LCOV - code coverage report
Current view: top level - HLT/PHOS - AliHLTPHOSMonitorTriggerComponent.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 18 91 19.8 %
Date: 2016-06-14 17:26:59 Functions: 7 16 43.8 %

          Line data    Source code
       1             : // $Id$
       2             : 
       3             :  /**************************************************************************
       4             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       5             :  *                                                                        *
       6             :  * Authors: Oystein Djuvsland <oysteind@ift.uib.no>                       *
       7             :  *                                                                        *
       8             :  * Permission to use, copy, modify and distribute this software and its   *
       9             :  * documentation strictly for non-commercial purposes is hereby granted   *
      10             :  * without fee, provided that the above copyright notice appears in all   *
      11             :  * copies and that both the copyright notice and this permission notice   *
      12             :  * appear in the supporting documentation. The authors make no claims     *
      13             :  * about the suitability of this software for any purpose. It is          *
      14             :  * provided "as is" without express or implied warranty.                  *
      15             :  **************************************************************************/
      16             : 
      17             : #include <iostream>
      18             : #include "AliHLTPHOSDefinitions.h" // PTH
      19             : #include "AliHLTPHOSMonitorTriggerComponent.h"
      20             : #include "AliHLTCaloClusterDataStruct.h"
      21             : #include "AliHLTDataTypes.h"
      22             : 
      23             : /** @file   AliHLTPHOSMonitorTriggerComponent.h
      24             :     @author Oystein Djuvsland
      25             :     @date   
      26             :     @brief  
      27             : */
      28             : 
      29             : // see header file for class documentation
      30             : // or
      31             : // refer to README to build package
      32             : // or
      33             : // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
      34             : 
      35             : #if __GNUC__>= 3
      36             : using namespace std;
      37             : #endif
      38             : 
      39             : const AliHLTComponentDataType AliHLTPHOSMonitorTriggerComponent::fgkInputDataTypes[]=
      40           3 :   {
      41           9 :     kAliHLTVoidDataType,{0,"",""}
      42             :   };
      43             : 
      44           6 : AliHLTPHOSMonitorTriggerComponent gAliHLTPHOSMonitorTriggerComponent;
      45             : 
      46             : 
      47             : AliHLTPHOSMonitorTriggerComponent::AliHLTPHOSMonitorTriggerComponent(): 
      48           3 :   AliHLTCaloProcessor(), 
      49           3 :   fCheckClusterEnergy(false),
      50           3 :   fCheckClusterMultiplicities(false),
      51           3 :   fClusterEnergyThreshold(1),
      52           3 :   fMultiplicityThreshold(5),
      53           3 :   fMultEnergyThreshold(0.5),
      54           3 :   fDigitMultiplicityThreshold(16),
      55           3 :   fMultDigitMultiplicityThreshold(9),
      56           3 :   fLowerCentrality(0.5),
      57           3 :   fUpperCentrality(0.9)
      58          15 : {
      59             :   //See headerfile for documentation
      60           6 : }
      61             : 
      62             : AliHLTPHOSMonitorTriggerComponent::~AliHLTPHOSMonitorTriggerComponent()
      63           6 : {
      64             :   //See headerfile for documentation
      65             : 
      66             :   
      67           9 : }
      68             : 
      69             : 
      70             : int
      71             : AliHLTPHOSMonitorTriggerComponent::Deinit()
      72             : {
      73             :   //See headerfile for documentation
      74             : 
      75             :   
      76           0 :   return 0;
      77             : }
      78             : 
      79             : const Char_t*
      80             : AliHLTPHOSMonitorTriggerComponent::GetComponentID()
      81             : {
      82             :   //See headerfile for documentation
      83             : 
      84         258 :   return "PhosMonitorTrigger";
      85             : }
      86             : 
      87             : void
      88             : AliHLTPHOSMonitorTriggerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
      89             : {
      90           0 :   list.clear();
      91           0 :   list.push_back(AliHLTPHOSDefinitions::fgkClusterDataType);
      92           0 : }
      93             : 
      94             : AliHLTComponentDataType
      95             : AliHLTPHOSMonitorTriggerComponent::GetOutputDataType()
      96             : {
      97             :   //See headerfile for documentation
      98           0 :   return AliHLTPHOSDefinitions::fgkSandboxDataType;
      99             : }
     100             : 
     101             : void
     102             : AliHLTPHOSMonitorTriggerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
     103             : 
     104             : {
     105             :   //See headerfile for documentation
     106           0 :   constBase = sizeof(int);
     107           0 :   inputMultiplier = 0;
     108           0 : }
     109             : 
     110             : int
     111             : AliHLTPHOSMonitorTriggerComponent::DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
     112             :                                            AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* /*outputPtr*/, AliHLTUInt32_t& /*size*/,
     113             :                                         std::vector<AliHLTComponentBlockData>& /*outputBlocks*/)
     114             : {
     115             :   //See headerfile for documentation
     116             : 
     117             :   Int_t specification = 0;
     118             :   Bool_t monitorflag = 0;
     119             :   UInt_t ndx = 0;
     120             :   
     121             :   const AliHLTComponentBlockData* iter = NULL; 
     122             : 
     123           0 :   for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
     124             :     {
     125           0 :       iter = blocks+ndx;
     126           0 :       if ( iter->fDataType != AliHLTPHOSDefinitions::fgkDDLPackedRawDataType  )
     127             :         {
     128             :           HLTDebug("Data block is not of type fgkDDLPackedRawDataType");
     129             :           continue; 
     130             :         }
     131           0 :       specification |= iter->fSpecification;
     132             : 
     133           0 :       monitorflag += CheckClusters(reinterpret_cast<AliHLTCaloClusterHeaderStruct*>(iter->fPtr));
     134             :         
     135           0 :     }
     136             : 
     137           0 :   if(monitorflag == true)
     138             :     {
     139             :       Int_t blockCount = 1;
     140           0 :       int ret = ReserveEventDoneData( 1+2+blockCount*4 ); 
     141           0 :       if(!ret)
     142             :         {
     143             :           AliHLTUInt32_t eddWord;
     144             :           
     145             :           eddWord = 5; // kAliHLTEventDoneFlagMonitorEventCmd
     146           0 :           PushEventDoneData( eddWord );
     147             :           eddWord = 4; // kAliHLTEventDoneMonitorListCmd
     148           0 :           PushEventDoneData( eddWord );
     149             :           eddWord = blockCount;
     150           0 :           PushEventDoneData( eddWord );
     151             :           
     152             :           //Int_t blockIndex = 0;
     153             :           // low data type
     154             :           eddWord = 0;
     155             :          
     156           0 :           for ( unsigned ii=0; ii<4; ii++ )
     157             :             {
     158           0 :               eddWord |= ((AliHLTUInt32_t)(AliHLTPHOSDefinitions::fgkDDLPackedRawDataType.fID[8-1-ii])) << (ii*8);
     159             :             }
     160           0 :           PushEventDoneData( eddWord );
     161             :           
     162             :           // high data type
     163             :           eddWord = 0;
     164           0 :           for ( unsigned ii=0; ii<4; ii++ )
     165             :             {
     166           0 :               eddWord |= ((AliHLTUInt32_t)(AliHLTPHOSDefinitions::fgkDDLPackedRawDataType.fID[8-5-ii])) << (ii*8);
     167             :             }
     168           0 :           PushEventDoneData( eddWord );
     169             :           
     170             :           // data spec
     171             :           eddWord = 0;
     172           0 :           for ( unsigned ii=0; ii<4; ii++ )
     173             :             {
     174           0 :               eddWord |= ((AliHLTUInt32_t)(AliHLTPHOSDefinitions::fgkDDLPackedRawDataType.fOrigin[4-1-ii])) << (ii*8);
     175             :             }
     176           0 :           PushEventDoneData( eddWord );
     177             :           
     178             :           eddWord = specification;
     179           0 :           PushEventDoneData( eddWord );
     180           0 :         }
     181             :       else
     182             :         {
     183           0 :           HLTWarning("Could not get Event Done Data blocks");
     184             :         }
     185           0 :     }
     186             : 
     187           0 :   return 0;
     188             : }
     189             : 
     190             : Bool_t
     191             : AliHLTPHOSMonitorTriggerComponent::CheckClusters(AliHLTCaloClusterHeaderStruct* clusterHeaderPtr)
     192             : {
     193             :   //See headerfile for documentation
     194             :   
     195           0 :   UInt_t nClusters = clusterHeaderPtr->fNClusters;
     196             : //  Float_t* ampFracPtr = 0;
     197             : 
     198             :   AliHLTCaloClusterDataStruct* clusterPtr = 0;
     199             : 
     200           0 :   clusterPtr = reinterpret_cast<AliHLTCaloClusterDataStruct*>((UChar_t*)(clusterHeaderPtr + 1));
     201             :       
     202           0 :   for(UInt_t n = 0; n < nClusters; n++)
     203             :     {
     204           0 :       if(fCheckClusterEnergy == true && clusterPtr->fEnergy > fClusterEnergyThreshold && clusterPtr->fNCells > fDigitMultiplicityThreshold)
     205             :         {
     206             : /*        ampFracPtr = &(clusterPtr->fCellsAmpFraction);
     207             :           for(UInt_t i = 0; i < clusterPtr->fNCells; i++)
     208             :             {
     209             :               if(*ampFracPtr > fLowerCentrality && *ampFracPtr < fUpperCentrality) return true;
     210             :               ampFracPtr += 6; // 6 = sizeof(Short_t) + sizeof(Float_t)
     211             :             }*/
     212             :         }
     213           0 :       if(fCheckClusterMultiplicities == true && clusterPtr->fEnergy > fMultEnergyThreshold && clusterPtr->fNCells > fMultDigitMultiplicityThreshold)
     214             :         {
     215           0 :           nClusters++;
     216           0 :           if(nClusters > fMultiplicityThreshold)
     217             :             {
     218           0 :               return true;
     219             :             }
     220             :         }
     221           0 :       clusterPtr += sizeof(AliHLTCaloClusterDataStruct) + 5*clusterPtr->fNCells; //5 = sizeof(Short_t) + sizeof(Float_t) - 1(pair already included)
     222             :     }
     223             : 
     224           0 :   return false;
     225             : 
     226           0 : }
     227             : 
     228             : 
     229             : int
     230             : AliHLTPHOSMonitorTriggerComponent::DoInit(int argc, const char** argv )
     231             : {
     232             :   //See headerfile for documentation
     233             : 
     234           0 :   for (int i = 0; i < argc; i++)
     235             :     {
     236           0 :       if(!strcmp("-checkenergy", argv[i]))
     237             :         {
     238           0 :           fCheckClusterEnergy = true;
     239           0 :         }
     240           0 :       if(!strcmp("-checkmultiplicity", argv[i]))
     241             :         {
     242           0 :           fCheckClusterMultiplicities = true;
     243           0 :         }
     244           0 :       if(!strcmp("-energythreshold", argv[i]))
     245             :         {
     246           0 :           fClusterEnergyThreshold = atof(argv[i+1]);
     247           0 :           fCheckClusterEnergy = true;
     248           0 :         }
     249           0 :       if(!strcmp("-multiplicityinclusterE", argv[i]))
     250             :         {
     251           0 :           fDigitMultiplicityThreshold = atoi(argv[i+1]);
     252           0 :         }
     253           0 :       if(!strcmp("-multiplicitythreshold", argv[i]))
     254             :         {
     255           0 :           fMultiplicityThreshold = atoi(argv[i+1]);
     256           0 :           fCheckClusterMultiplicities = true;
     257           0 :         }
     258           0 :       if(!strcmp("-multiplicityinclusterMult", argv[i]))
     259             :         {
     260           0 :           fMultDigitMultiplicityThreshold = atoi(argv[i+1]);
     261           0 :         }
     262           0 :       if(!strcmp("-centralitylimits", argv[i]))
     263             :         {
     264           0 :           fLowerCentrality = atof(argv[i+1]);
     265           0 :           fUpperCentrality = atof(argv[i+2]);
     266           0 :         } 
     267             :     }
     268           0 :   return 0;
     269             : }
     270             : 
     271             : AliHLTComponent*
     272             : AliHLTPHOSMonitorTriggerComponent::Spawn()
     273             : {
     274             :   //See headerfile for documentation
     275             : 
     276           0 :   return new AliHLTPHOSMonitorTriggerComponent();
     277           0 : }

Generated by: LCOV version 1.11