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 *
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 **************************************************************************/
18 #include "AliHLTEMCALRawHistoMakerComponent.h"
19 #include "AliHLTEMCALRawHistoMaker.h"
21 #include "AliHLTCaloChannelDataHeaderStruct.h"
22 #include "AliHLTCaloChannelDataStruct.h"
24 #include "AliHLTCaloDefinitions.h"
32 #include "TProfile2D.h"
36 #include <sys/types.h>
38 #include "AliCDBEntry.h"
39 #include "AliCDBManager.h"
40 #include "AliCDBPath.h"
42 * @file AliHLTEMCALRawHistoMakerComponent.cxx
43 * @author Federico Ronchetti
45 * @brief A component to pusk back histograms for EMCAL HLT
49 AliHLTEMCALRawHistoMakerComponent gAliHLTEMCALRawHistoMakerComponent;
51 AliHLTEMCALRawHistoMakerComponent::AliHLTEMCALRawHistoMakerComponent() :
52 AliHLTCaloProcessor(),
56 fRootFileName("histofile_local.root"),
59 //see header file for documentation
63 AliHLTEMCALRawHistoMakerComponent::~AliHLTEMCALRawHistoMakerComponent()
65 //see header file for documentation
70 AliHLTEMCALRawHistoMakerComponent::DoInit(int argc, const char** argv )
72 //see header file for documentation
74 fRawHistoMakerPtr = new AliHLTEMCALRawHistoMaker();
76 for(int i = 0; i < argc; i++)
78 if(!strcmp("-roothistofilename", argv[i]))
79 fRootFileName = argv[i+1];
81 if(!strcmp("-pushfraction", argv[i]))
82 fPushFraction = atoi(argv[i+1]);
84 if(!strcmp("-beverbose", argv[i]))
85 fBeVerbose = atoi(argv[i+1]);
90 cout << "\nI-RAWHISTOMAKERCOMPONENT: local root file name is: " << fRootFileName << endl;
97 AliHLTEMCALRawHistoMakerComponent::Deinit()
99 //see header file for documentation
100 if(fRawHistoMakerPtr)
102 delete fRawHistoMakerPtr;
103 fRawHistoMakerPtr = 0;
110 AliHLTEMCALRawHistoMakerComponent::GetComponentID()
112 //see header file for documentation
113 return "EmcalRawHistoMaker";
118 AliHLTEMCALRawHistoMakerComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list)
120 //see header file for documentation
122 list.push_back(AliHLTEMCALDefinitions::fgkChannelDataType);
125 AliHLTComponentDataType
126 AliHLTEMCALRawHistoMakerComponent::GetOutputDataType()
128 //see header file for documentation
129 return kAliHLTDataTypeHistogram | kAliHLTDataOriginEMCAL;
133 AliHLTEMCALRawHistoMakerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
135 //see header file for documentation
137 // to be reviewed later
138 inputMultiplier = 100;
142 AliHLTEMCALRawHistoMakerComponent::DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
143 AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size,
144 std::vector<AliHLTComponentBlockData>& outputBlocks)
146 //see header file for documentation
151 AliHLTUInt8_t* outBPtr;
153 const AliHLTComponentBlockData* iter = 0;
156 UInt_t specification = 0;
158 for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
161 AliHLTCaloClusterHeaderStruct *caloClusterHeaderPtr = 0;
162 AliHLTCaloChannelDataHeaderStruct* tmpChannelData = 0;
167 PrintComponentDataTypeInfo(iter->fDataType);
170 if (iter->fDataType == AliHLTEMCALDefinitions::fgkChannelDataType)
173 tmpChannelData = reinterpret_cast<AliHLTCaloChannelDataHeaderStruct*>(iter->fPtr);
176 printf ("\nI-RAWHISTOMAKERCOMPONENT: Number of active channels in block: %d\n",tmpChannelData->fNChannels);
180 else if (iter->fDataType == kAliHLTDataTypeCaloCluster)
181 caloClusterHeaderPtr = reinterpret_cast<AliHLTCaloClusterHeaderStruct*>(iter->fPtr);
187 HLTWarning("\nI-RAWHISTOMAKERCOMPONENT: Data block does not of channel or cluster type \n");
189 HLTDebug("\nI-RAWHISTOMAKERCOMPONENT: Data block does not of channel or cluster type \n");
194 specification |= iter->fSpecification;
195 ret = fRawHistoMakerPtr->MakeHisto(tmpChannelData, caloClusterHeaderPtr, fBeVerbose);
202 TFile rootHistFile(fRootFileName,"recreate");
204 fRawHistoMakerPtr->GetHistograms()->Write();
206 if (fLocalEventCount%fPushFraction == 0) {
209 cout << "\nI-RAWHISTOMAKERCOMPONENT: pushback done at " << fLocalEventCount << " events " << endl;
211 PushBack(fRawHistoMakerPtr->GetHistograms(), kAliHLTDataTypeTObjArray | kAliHLTDataOriginEMCAL , specification);
221 AliHLTEMCALRawHistoMakerComponent::Spawn()
223 //see header file for documentation
224 return new AliHLTEMCALRawHistoMakerComponent();