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"
26 #include "TProfile2D.h"
30 #include <sys/types.h>
32 #include "AliCDBEntry.h"
33 #include "AliCDBManager.h"
34 #include "AliCDBPath.h"
36 * @file AliHLTEMCALRawHistoMakerComponent.cxx
37 * @author Federico Ronchetti
39 * @brief A component to pusk back histograms for EMCAL HLT
43 AliHLTEMCALRawHistoMakerComponent gAliHLTEMCALRawHistoMakerComponent;
45 AliHLTEMCALRawHistoMakerComponent::AliHLTEMCALRawHistoMakerComponent() :
46 AliHLTCaloProcessor(),
50 fRootFileName("histofile_local.root"),
53 //see header file for documentation
57 AliHLTEMCALRawHistoMakerComponent::~AliHLTEMCALRawHistoMakerComponent()
59 //see header file for documentation
63 AliHLTEMCALRawHistoMakerComponent::Deinit()
65 //see header file for documentation
68 delete fRawHistoMakerPtr;
69 fRawHistoMakerPtr = 0;
76 AliHLTEMCALRawHistoMakerComponent::GetComponentID()
78 //see header file for documentation
79 return "EmcalRawHistoMaker";
84 AliHLTEMCALRawHistoMakerComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list)
86 //see header file for documentation
88 list.push_back(AliHLTEMCALDefinitions::fgkChannelDataType);
91 AliHLTComponentDataType
92 AliHLTEMCALRawHistoMakerComponent::GetOutputDataType()
94 //see header file for documentation
95 return kAliHLTDataTypeHistogram | kAliHLTDataOriginEMCAL;
99 AliHLTEMCALRawHistoMakerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
101 //see header file for documentation
103 // to be reviewed later
104 inputMultiplier = 100;
108 AliHLTEMCALRawHistoMakerComponent::DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
109 AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size,
110 std::vector<AliHLTComponentBlockData>& outputBlocks)
112 //see header file for documentation
117 AliHLTUInt8_t* outBPtr;
119 const AliHLTComponentBlockData* iter = 0;
122 UInt_t specification = 0;
123 AliHLTCaloChannelDataHeaderStruct* tmpChannelData = 0;
126 for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
131 PrintComponentDataTypeInfo(iter->fDataType);
132 cout << "I-RAWHISTOMAKERCOMPONENT: verbose mode enabled: " << fBeVerbose << endl;
135 if(iter->fDataType != AliHLTEMCALDefinitions::fgkChannelDataType)
139 HLTWarning("I-RAWHISTOMAKERCOMPONENT: Data block is not of type fgkChannelDataType");
141 HLTDebug("I-RAWHISTOMAKERCOMPONENT: Data block is not of type fgkChannelDataType");
146 specification |= iter->fSpecification;
147 tmpChannelData = reinterpret_cast<AliHLTCaloChannelDataHeaderStruct*>(iter->fPtr);
150 HLTWarning ("I-RAWHISTOMAKERCOMPONENT: channel number %d",tmpChannelData->fNChannels);
152 ret = fRawHistoMakerPtr->MakeHisto(tmpChannelData, iter, outputPtr, size, fBeVerbose);
156 // HLTError("Trying to write over buffer size");
164 TFile rootHistFile(fRootFileName,"recreate");
166 fRawHistoMakerPtr->GetHistograms()->Write();
168 if (fLocalEventCount%fPushFraction == 0) {
171 cout << "I-RAWHISTOMAKERCOMPONENT: pushback done at " << fLocalEventCount << " events " << endl;
173 PushBack(fRawHistoMakerPtr->GetHistograms(), kAliHLTDataTypeTObjArray | kAliHLTDataOriginEMCAL , specification);
183 AliHLTEMCALRawHistoMakerComponent::DoInit(int argc, const char** argv )
185 //see header file for documentation
187 fRawHistoMakerPtr = new AliHLTEMCALRawHistoMaker();
189 for(int i = 0; i < argc; i++)
191 if(!strcmp("-roothistofilename", argv[i]))
192 fRootFileName = argv[i+1];
194 if(!strcmp("-pushfraction", argv[i]))
195 fPushFraction = atoi(argv[i+1]);
197 if(!strcmp("-beverbose", argv[i]))
198 fBeVerbose = atoi(argv[i+1]);
203 cout << "I-RAWHISTOMAKERCOMPONENT: local root file name is: " << fRootFileName << endl;
210 AliHLTEMCALRawHistoMakerComponent::Spawn()
212 //see header file for documentation
213 return new AliHLTEMCALRawHistoMakerComponent();