1 /**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * All rights reserved. *
5 * Primary Authors: Freancesco Blanco *
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 **************************************************************************/
16 #include "AliHLTEMCALClusterMonitorComponent.h"
17 #include "AliHLTEMCALClusterMonitor.h"
25 * @file AliHLTEMCALClusterMonitorComponent.cxx
26 * @author Francesco Blanco
28 * @brief A component to pusk back histograms for EMCAL HLT
32 AliHLTEMCALClusterMonitorComponent gAliHLTEMCALClusterMonitorComponent;
34 AliHLTEMCALClusterMonitorComponent::AliHLTEMCALClusterMonitorComponent() :
35 AliHLTCaloProcessor(),
36 fRootFileName("histofile_local.root"),
42 //see header file for documentation
46 AliHLTEMCALClusterMonitorComponent::~AliHLTEMCALClusterMonitorComponent()
48 //see header file for documentation
53 AliHLTEMCALClusterMonitorComponent::DoInit(int argc, const char** argv )
55 //see header file for documentation
57 fHistoMakerPtr = new AliHLTEMCALClusterMonitor();
59 for(int i = 0; i < argc; i++)
61 if(!strcmp("-roothistofilename", argv[i]))
62 fRootFileName = argv[i+1];
64 if(!strcmp("-pushfraction", argv[i]))
65 fPushFraction = atoi(argv[i+1]);
67 if(!strcmp("-beverbose", argv[i]))
68 fBeVerbose = atoi(argv[i+1]);
72 if (fBeVerbose) cout << "\nI-CLUSTERMONITORCOMPONENT: local root file name is: " << fRootFileName << endl;
79 AliHLTEMCALClusterMonitorComponent::Deinit()
81 //see header file for documentation
84 delete fHistoMakerPtr;
92 AliHLTEMCALClusterMonitorComponent::GetComponentID()
94 //see header file for documentation
95 return "EmcalClusterMonitor";
100 AliHLTEMCALClusterMonitorComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list)
102 //see header file for documentation
104 list.push_back(kAliHLTDataTypeCaloCluster);
107 AliHLTComponentDataType
108 AliHLTEMCALClusterMonitorComponent::GetOutputDataType()
110 //see header file for documentation
111 return kAliHLTDataTypeHistogram | kAliHLTDataOriginEMCAL;
115 AliHLTEMCALClusterMonitorComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
117 //see header file for documentation
119 // to be reviewed later
120 inputMultiplier = 100;
124 AliHLTEMCALClusterMonitorComponent::DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
125 AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* /*outputPtr*/, AliHLTUInt32_t& /*size*/,
126 std::vector<AliHLTComponentBlockData>& /*outputBlocks*/)
130 const AliHLTComponentBlockData* iter = 0;
133 UInt_t specification = 0;
134 for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
137 AliHLTCaloClusterHeaderStruct *caloClusterHeaderPtr = 0;
141 if (fBeVerbose) PrintComponentDataTypeInfo(iter->fDataType);
143 if (iter->fDataType == kAliHLTDataTypeCaloCluster) caloClusterHeaderPtr = reinterpret_cast<AliHLTCaloClusterHeaderStruct*>(iter->fPtr);
145 if(fBeVerbose) HLTWarning("\nI-CLUSTERMONITORCOMPONENT: Data block does not contain cluster type \n");
149 specification |= iter->fSpecification;
150 fHistoMakerPtr->MakeHisto(caloClusterHeaderPtr);
157 TFile rootHistFile(fRootFileName,"recreate");
159 fHistoMakerPtr->GetHistograms()->Write();
161 if (fLocalEventCount%fPushFraction == 0) {
163 if (fBeVerbose) cout << "\nI-CLUSTERMONITORCOMPONENT: pushback done at " << fLocalEventCount << " events " << endl;
165 PushBack(fHistoMakerPtr->GetHistograms(), kAliHLTDataTypeTObjArray | kAliHLTDataOriginEMCAL , specification);
173 AliHLTEMCALClusterMonitorComponent::Spawn()
175 //see header file for documentation
176 return new AliHLTEMCALClusterMonitorComponent();