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 << "I-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 AliHLTCaloChannelDataHeaderStruct* tmpChannelData = 0;
160 AliHLTCaloClusterHeaderStruct *caloClusterHeaderPtr = 0;
162 for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
167 PrintComponentDataTypeInfo(iter->fDataType);
168 cout << "\nI-RAWHISTOMAKERCOMPONENT: verbose mode enabled: " << fBeVerbose << endl;
172 if(iter->fDataType == kAliHLTDataTypeCaloCluster)
175 cout << "\nI-RAWHISTOMAKERCOMPONENT: cluster data handling HERE !" << endl;
177 //specification |= iter->fSpecification;
178 caloClusterHeaderPtr = reinterpret_cast<AliHLTCaloClusterHeaderStruct*>(iter->fPtr);
179 cout << " --------------------> cluster pointer here !!!!!!!! ->>>>>>>>>>>>>>>>>>>>>: " << caloClusterHeaderPtr << endl;
187 HLTWarning("\nI-RAWHISTOMAKERCOMPONENT: Data block does not contain clusters\n");
189 HLTDebug("\nI-RAWHISTOMAKERCOMPONENT: Data block does not contain clusters\n");
196 if (iter->fDataType == AliHLTEMCALDefinitions::fgkChannelDataType)
200 tmpChannelData = reinterpret_cast<AliHLTCaloChannelDataHeaderStruct*>(iter->fPtr);
201 cout << " --------------------> channel pointer here !!!!!!!! ->>>>>>>>>>>>>>>>>>>>>: " << tmpChannelData << endl;
204 HLTWarning ("\nI-RAWHISTOMAKERCOMPONENT: reading channel number %d\n",tmpChannelData->fNChannels);
213 HLTWarning("\nI-RAWHISTOMAKERCOMPONENT: Data block does not contain signal amplitude\n");
215 HLTDebug("\nI-RAWHISTOMAKERCOMPONENT: Data block does not contain signal amplitude\n");
221 specification |= iter->fSpecification;
222 ret = fRawHistoMakerPtr->MakeHisto(tmpChannelData, caloClusterHeaderPtr, fBeVerbose);
228 TFile rootHistFile(fRootFileName,"recreate");
230 fRawHistoMakerPtr->GetHistograms()->Write();
232 if (fLocalEventCount%fPushFraction == 0) {
235 cout << "I-RAWHISTOMAKERCOMPONENT: pushback done at " << fLocalEventCount << " events " << endl;
237 PushBack(fRawHistoMakerPtr->GetHistograms(), kAliHLTDataTypeTObjArray | kAliHLTDataOriginEMCAL , specification);
247 AliHLTEMCALRawHistoMakerComponent::Spawn()
249 //see header file for documentation
250 return new AliHLTEMCALRawHistoMakerComponent();