2 /**************************************************************************
3 * This file is property of and copyright by the ALICE HLT Project *
4 * All rights reserved. *
6 * Primary Authors: Svein Lindal, Oeystein Djuvsland *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 * @file AliHLTCaloHistoComponent.cxx
18 * @author Svein Lindal
20 * @brief A physics histogram producer component for Calo HLT
29 #include "AliHLTCaloHistoComponent.h"
30 #include "AliHLTCaloHistoCellEnergy.h"
31 #include "AliHLTCaloHistoClusterEnergy.h"
32 #include "AliHLTCaloHistoInvMass.h"
33 #include "AliHLTCaloHistoMatchedTracks.h"
34 #include "AliESDEvent.h"
35 #include "TRefArray.h"
37 // see below for class documentation
39 // refer to README to build package
41 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
44 ClassImp(AliHLTCaloHistoComponent);
46 AliHLTCaloHistoComponent::AliHLTCaloHistoComponent() :
48 fEmcalClustersArray(NULL),
49 fPhosClustersArray(NULL),
52 fDoCellEnergy(kFALSE),
53 fDoClusterEnergy(kFALSE),
54 fDoInvariantMass(kFALSE),
55 fDoMatchedTracks(kFALSE),
56 fPhosCellEnergyHistProducer(NULL),
57 fEmcalCellEnergyHistProducer(NULL),
58 fPhosClusterEnergyHistProducer(NULL),
59 fEmcalClusterEnergyHistProducer(NULL),
60 fPhosInvariantMassHistProducer(NULL),
61 fEmcalInvariantMassHistProducer(NULL),
62 fPhosMatchedTracksHistProducer(NULL),
63 fEmcalMatchedTracksHistProducer(NULL)
65 //see header file for documentation
68 AliHLTCaloHistoComponent::~AliHLTCaloHistoComponent()
70 //see header file for documentation
74 Int_t AliHLTCaloHistoComponent::DoInit(int argc, const char** argv ) {
75 //see header file for documentation
79 for(int i = 0; i < argc; i++) {
80 if(!strcmp("-cellenergy", argv[i+1])) fDoCellEnergy = true;
81 if(!strcmp("-clusterenergy", argv[i+1])) fDoClusterEnergy = true;
82 if(!strcmp("-invariantmass", argv[i+1])) fDoInvariantMass= true;
83 if(!strcmp("-matchedtracks", argv[i+1])) fDoMatchedTracks = true;
84 if(!strcmp("-phos", argv[i+1])) fDoPhos = true;
85 if(!strcmp("-emcal", argv[i+1])) fDoEmcal = true;
93 fPhosClustersArray = new TRefArray();
96 fPhosInvariantMassHistProducer = new AliHLTCaloHistoInvMass("PHOS");
100 fPhosMatchedTracksHistProducer = new AliHLTCaloHistoMatchedTracks("PHOS");
104 fPhosClusterEnergyHistProducer = new AliHLTCaloHistoClusterEnergy("PHOS");
108 fPhosCellEnergyHistProducer = new AliHLTCaloHistoCellEnergy("PHOS");
116 fEmcalClustersArray = new TRefArray();
119 fEmcalInvariantMassHistProducer = new AliHLTCaloHistoInvMass("EMCAL");
123 fEmcalMatchedTracksHistProducer = new AliHLTCaloHistoMatchedTracks("EMCAL");
127 fEmcalClusterEnergyHistProducer = new AliHLTCaloHistoClusterEnergy("EMCAL");
131 fEmcalCellEnergyHistProducer = new AliHLTCaloHistoCellEnergy("EMCAL");
139 Int_t AliHLTCaloHistoComponent::DoDeinit()
141 //see header file for documentation
145 if(fEmcalClustersArray)
146 delete fEmcalClustersArray;
147 fEmcalClustersArray = NULL;
149 if(fPhosClustersArray)
150 delete fPhosClustersArray;
151 fPhosClustersArray = NULL;
155 if(fPhosCellEnergyHistProducer)
156 delete fPhosCellEnergyHistProducer;
157 fPhosCellEnergyHistProducer = NULL;
160 if(fEmcalCellEnergyHistProducer)
161 delete fEmcalCellEnergyHistProducer;
162 fEmcalCellEnergyHistProducer = NULL;
166 if(fPhosClusterEnergyHistProducer)
167 delete fPhosClusterEnergyHistProducer;
168 fPhosClusterEnergyHistProducer = NULL;
170 if(fEmcalClusterEnergyHistProducer)
171 delete fEmcalClusterEnergyHistProducer;
172 fEmcalClusterEnergyHistProducer = NULL;
175 //Invariant mass histogram producers
176 if(fPhosInvariantMassHistProducer)
177 delete fPhosInvariantMassHistProducer;
178 fPhosInvariantMassHistProducer = NULL;
180 if(fEmcalInvariantMassHistProducer)
181 delete fEmcalInvariantMassHistProducer;
182 fEmcalInvariantMassHistProducer = NULL;
185 //Matched track histogram producers
186 if(fEmcalMatchedTracksHistProducer)
187 delete fEmcalMatchedTracksHistProducer;
188 fEmcalMatchedTracksHistProducer = NULL;
190 if(fPhosMatchedTracksHistProducer)
191 delete fPhosMatchedTracksHistProducer;
192 fPhosMatchedTracksHistProducer = NULL;
198 const char* AliHLTCaloHistoComponent::GetComponentID()
200 //see header file for documentation
201 return "CaloPhysicsHistos";
206 AliHLTCaloHistoComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list)
208 //see header file for documentation
210 list.push_back( kAliHLTDataTypeESDObject|kAliHLTDataOriginOut );
211 // list.push_back(AliHLTPHOSDefinitions::fgkClusterDataType);
212 // list.push_back(AliHLTPHOSDefinitions::fgkESDCaloClusterDataType);
213 // list.push_back(AliHLTPHOSDefinitions::fgkESDCaloCellsDataType);
217 AliHLTComponentDataType AliHLTCaloHistoComponent::GetOutputDataType()
219 //see header file for documentation
220 return kAliHLTDataTypeHistogram | kAliHLTDataOriginOut;
224 void AliHLTCaloHistoComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
226 //see header file for documentation
231 AliHLTComponent* AliHLTCaloHistoComponent::Spawn() {
232 //see header file for documentation
233 return new AliHLTCaloHistoComponent();
236 Int_t AliHLTCaloHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/) {
238 //see header file for documentation
239 if ( GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR ) )
244 // fUID = ( gSystem->GetPid() + t.GetNanoSec())*10 + evtData.fEventID;
248 for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDObject); iter != NULL; iter = GetNextInputObject() ) {
249 AliESDEvent *event = dynamic_cast<AliESDEvent*>(const_cast<TObject*>( iter ) );
255 Int_t nec = event->GetEMCALClusters(fEmcalClustersArray);
258 fEmcalMatchedTracksHistProducer->FillHistograms(nec, fEmcalClustersArray);
261 fEmcalInvariantMassHistProducer->FillHistograms(nec, fEmcalClustersArray);
264 fEmcalClusterEnergyHistProducer->FillHistograms(nec, fEmcalClustersArray);
267 fEmcalCellEnergyHistProducer->FillHistograms(nec, fEmcalClustersArray);;
275 Int_t npc = event->GetPHOSClusters(fPhosClustersArray);
278 fPhosMatchedTracksHistProducer->FillHistograms(npc, fPhosClustersArray);
281 fPhosInvariantMassHistProducer->FillHistograms(npc, fPhosClustersArray);
284 fPhosClusterEnergyHistProducer->FillHistograms(npc, fPhosClustersArray);
287 fPhosCellEnergyHistProducer->FillHistograms(npc, fPhosClustersArray);
300 PushBack(fPhosInvariantMassHistProducer->GetHistograms(), kAliHLTDataTypeHistogram);
303 PushBack(fPhosMatchedTracksHistProducer->GetHistograms(), kAliHLTDataTypeHistogram);
306 PushBack(fPhosClusterEnergyHistProducer->GetHistograms(), kAliHLTDataTypeHistogram);
309 PushBack(fPhosCellEnergyHistProducer->GetHistograms(), kAliHLTDataTypeHistogram);
317 PushBack(fEmcalInvariantMassHistProducer->GetHistograms(), kAliHLTDataTypeHistogram);
320 PushBack(fEmcalMatchedTracksHistProducer->GetHistograms(), kAliHLTDataTypeHistogram);
323 PushBack(fEmcalClusterEnergyHistProducer->GetHistograms(), kAliHLTDataTypeHistogram);
326 PushBack(fEmcalCellEnergyHistProducer->GetHistograms(), kAliHLTDataTypeHistogram);