LCOV - code coverage report
Current view: top level - HLT/EMCAL - AliHLTEMCALRawHistoMakerComponent.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 12 63 19.0 %
Date: 2016-06-14 17:26:59 Functions: 6 14 42.9 %

          Line data    Source code
       1             : 
       2             : 
       3             : /**************************************************************************
       4             :  * This file is property of and copyright by the ALICE HLT Project        *
       5             :  * All rights reserved.                                                   *
       6             :  * INFN, Laboratori Nazionali di Frascati                                 *
       7             :  * Primary Authors: Federico Ronchetti                                    *
       8             :  *                                                                        *
       9             :  * Permission to use, copy, modify and distribute this software and its   *
      10             :  * documentation strictly for non-commercial purposes is hereby granted   *
      11             :  * without fee, provided that the above copyright notice appears in all   *
      12             :  * copies and that both the copyright notice and this permission notice   *
      13             :  * appear in the supporting documentation. The authors make no claims     *
      14             :  * about the suitability of this software for any purpose. It is          *
      15             :  * provided "as is" without express or implied warranty.                  *
      16             :  **************************************************************************/
      17             : 
      18             : #include "AliHLTEMCALRawHistoMakerComponent.h"
      19             : #include "AliHLTEMCALRawHistoMaker.h"
      20             : 
      21             : #include "AliHLTCaloChannelDataHeaderStruct.h"
      22             : #include "AliHLTCaloChannelDataStruct.h"
      23             : 
      24             : #include "AliHLTCaloDefinitions.h"
      25             : 
      26             : #include "TString.h"
      27             : 
      28             : 
      29             : 
      30             : // root stuff
      31             : #include "TFile.h"
      32             : #include "TProfile2D.h"
      33             : #include "TH1F.h"
      34             : #include "TH2F.h"
      35             : #include <sys/stat.h>
      36             : #include <sys/types.h>
      37             : 
      38             : #include "AliCDBEntry.h"
      39             : #include "AliCDBManager.h"
      40             : #include "AliCDBPath.h"
      41             : /** 
      42             :  * @file   AliHLTEMCALRawHistoMakerComponent.cxx
      43             :  * @author Federico Ronchetti
      44             :  * @date   
      45             :  * @brief  A component to pusk back histograms for EMCAL HLT
      46             :  */
      47             : 
      48             : //FIXME
      49           6 : AliHLTEMCALRawHistoMakerComponent gAliHLTEMCALRawHistoMakerComponent;
      50             : 
      51             : AliHLTEMCALRawHistoMakerComponent::AliHLTEMCALRawHistoMakerComponent() :
      52           3 :                                   AliHLTCaloProcessor(),
      53           3 :                                   fRawHistoMakerPtr(0),
      54           3 :                                   fPushFraction(10),
      55           3 :                                   fLocalEventCount(0),
      56           3 :                                   fRootFileName("histofile_local.root"),
      57           3 :                                   fBeVerbose(0)
      58          15 : {
      59             :         //see header file for documentation
      60           6 : }
      61             : 
      62             : 
      63             : AliHLTEMCALRawHistoMakerComponent::~AliHLTEMCALRawHistoMakerComponent()
      64          12 : {
      65             :         //see header file for documentation
      66           6 : }
      67             : 
      68             : 
      69             : int
      70             : AliHLTEMCALRawHistoMakerComponent::DoInit(int argc, const char** argv )
      71             : {
      72             :         //see header file for documentation
      73             : 
      74           0 :         fRawHistoMakerPtr = new AliHLTEMCALRawHistoMaker();
      75             : 
      76           0 :         for(int i = 0; i < argc; i++)
      77             :         {
      78           0 :                 if(!strcmp("-roothistofilename", argv[i]))
      79           0 :                         fRootFileName = argv[i+1];
      80             : 
      81           0 :                 if(!strcmp("-pushfraction", argv[i]))
      82           0 :                         fPushFraction = atoi(argv[i+1]);
      83             : 
      84           0 :                 if(!strcmp("-beverbose", argv[i]))
      85           0 :                         fBeVerbose = atoi(argv[i+1]);
      86             : 
      87             :         }
      88             : 
      89           0 :         if (fBeVerbose)
      90           0 :                 cout << "\nI-RAWHISTOMAKERCOMPONENT: local root file name is: " << fRootFileName << endl;
      91             : 
      92           0 :         return 0;
      93           0 : }
      94             : 
      95             : 
      96             : int 
      97             : AliHLTEMCALRawHistoMakerComponent::Deinit()
      98             : { 
      99             :         //see header file for documentation
     100           0 :         if(fRawHistoMakerPtr)
     101             :         {
     102           0 :                 delete fRawHistoMakerPtr;
     103           0 :                 fRawHistoMakerPtr = 0;
     104           0 :         }
     105             : 
     106           0 :         return 0;
     107             : }
     108             : 
     109             : const char*
     110             : AliHLTEMCALRawHistoMakerComponent::GetComponentID()
     111             : {
     112             :         //see header file for documentation
     113         342 :         return "EmcalRawHistoMaker";
     114             : }
     115             : 
     116             : 
     117             : void
     118             : AliHLTEMCALRawHistoMakerComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list)
     119             : { 
     120             :         //see header file for documentation
     121           0 :         list.clear();
     122           0 :         list.push_back(AliHLTEMCALDefinitions::fgkChannelDataType);
     123           0 : }
     124             : 
     125             : AliHLTComponentDataType 
     126             : AliHLTEMCALRawHistoMakerComponent::GetOutputDataType()
     127             : {
     128             :         //see header file for documentation
     129           0 :         return kAliHLTDataTypeHistogram | kAliHLTDataOriginEMCAL;
     130             : }
     131             : 
     132             : void 
     133             : AliHLTEMCALRawHistoMakerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
     134             : {
     135             :         //see header file for documentation
     136           0 :         constBase = 0;
     137             :         // to be reviewed later
     138           0 :         inputMultiplier = 100;
     139           0 : }
     140             : 
     141             : int 
     142             : AliHLTEMCALRawHistoMakerComponent::DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
     143             :                 AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size,
     144             :                 std::vector<AliHLTComponentBlockData>& outputBlocks)
     145             : {
     146             :         //see header file for documentation
     147             :         UInt_t mysize           = 0;
     148             :         Int_t ret               = 0;
     149             : 
     150             : 
     151             :         AliHLTUInt8_t* outBPtr;
     152             :         outBPtr = outputPtr;
     153             :         const AliHLTComponentBlockData* iter = 0;
     154             :         unsigned long ndx;
     155             : 
     156             :         UInt_t specification = 0;
     157             :         
     158           0 :         for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
     159             :         {
     160             :           
     161             :                 AliHLTCaloClusterHeaderStruct *caloClusterHeaderPtr = 0;
     162             :                 AliHLTCaloChannelDataHeaderStruct* tmpChannelData = 0;
     163             : 
     164           0 :                 iter = blocks+ndx;
     165             :                 
     166           0 :                 if (fBeVerbose) 
     167           0 :                   PrintComponentDataTypeInfo(iter->fDataType);
     168             :                 
     169             :                 
     170           0 :                 if (iter->fDataType == AliHLTEMCALDefinitions::fgkChannelDataType)
     171             :                   {
     172             :                   
     173           0 :                     tmpChannelData = reinterpret_cast<AliHLTCaloChannelDataHeaderStruct*>(iter->fPtr);
     174             :                                     
     175           0 :                     if (fBeVerbose)
     176           0 :                       printf ("\nI-RAWHISTOMAKERCOMPONENT: Number of active channels in block: %d\n",tmpChannelData->fNChannels);
     177             :                     
     178             :                   } 
     179             : 
     180           0 :                 else if (iter->fDataType == kAliHLTDataTypeCaloCluster)
     181           0 :                   caloClusterHeaderPtr = reinterpret_cast<AliHLTCaloClusterHeaderStruct*>(iter->fPtr);
     182             :                     
     183             :                 else
     184             :                   
     185             :                   {
     186           0 :                     if (fBeVerbose)
     187             :         {
     188           0 :                       HLTWarning("\nI-RAWHISTOMAKERCOMPONENT: Data block does not of channel or cluster type \n");
     189             :         }
     190             :                     else
     191             :         {
     192             :                       HLTDebug("\nI-RAWHISTOMAKERCOMPONENT: Data block does not of channel or cluster type \n");
     193             :         }
     194           0 :                     continue;
     195             :                   }
     196             : 
     197             :         
     198           0 :                 specification |= iter->fSpecification;
     199           0 :                 ret = fRawHistoMakerPtr->MakeHisto(tmpChannelData, caloClusterHeaderPtr, fBeVerbose);
     200             : 
     201           0 :         }
     202             : 
     203             : 
     204           0 :         fLocalEventCount++;
     205             : 
     206           0 :         TFile rootHistFile(fRootFileName,"recreate");
     207             :         
     208           0 :         fRawHistoMakerPtr->GetHistograms()->Write();
     209             :         
     210           0 :         if (fLocalEventCount%fPushFraction == 0) {
     211             :           
     212           0 :           if (fBeVerbose)
     213           0 :             cout << "\nI-RAWHISTOMAKERCOMPONENT: pushback done at " << fLocalEventCount << " events " << endl;
     214             :           
     215           0 :           PushBack(fRawHistoMakerPtr->GetHistograms(), kAliHLTDataTypeTObjArray | kAliHLTDataOriginEMCAL , specification);
     216             :         }
     217             :         
     218           0 :         size = mysize;
     219             :         
     220             :         return 0;
     221           0 : }
     222             : 
     223             : 
     224             : AliHLTComponent*
     225             : AliHLTEMCALRawHistoMakerComponent::Spawn()
     226             : {
     227             :         //see header file for documentation
     228           0 :         return new AliHLTEMCALRawHistoMakerComponent();
     229           0 : }

Generated by: LCOV version 1.11