]>
Commit | Line | Data |
---|---|---|
31dd44e4 | 1 | /************************************************************************** |
2 | * This file is property of and copyright by the ALICE HLT Project * | |
3 | * All rights reserved. * | |
4 | * * | |
5 | * Primary Authors: Freancesco Blanco * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
16 | #include "AliHLTEMCALClusterMonitorComponent.h" | |
17 | #include "AliHLTEMCALClusterMonitor.h" | |
18 | ||
19 | #include "TFile.h" | |
20 | #include "TString.h" | |
21 | ||
22 | ||
23 | ||
24 | /** | |
25 | * @file AliHLTEMCALClusterMonitorComponent.cxx | |
26 | * @author Francesco Blanco | |
27 | * @date | |
28 | * @brief A component to pusk back histograms for EMCAL HLT | |
29 | */ | |
30 | ||
31 | //FIXME | |
32 | AliHLTEMCALClusterMonitorComponent gAliHLTEMCALClusterMonitorComponent; | |
33 | ||
34 | AliHLTEMCALClusterMonitorComponent::AliHLTEMCALClusterMonitorComponent() : | |
35 | AliHLTCaloProcessor(), | |
36 | fRootFileName("histofile_local.root"), | |
37 | fPushFraction(10), | |
38 | fLocalEventCount(0), | |
39 | fBeVerbose(0), | |
40 | fHistoMakerPtr(0) | |
41 | { | |
42 | //see header file for documentation | |
43 | } | |
44 | ||
45 | ||
46 | AliHLTEMCALClusterMonitorComponent::~AliHLTEMCALClusterMonitorComponent() | |
47 | { | |
48 | //see header file for documentation | |
49 | } | |
50 | ||
51 | ||
52 | int | |
53 | AliHLTEMCALClusterMonitorComponent::DoInit(int argc, const char** argv ) | |
54 | { | |
55 | //see header file for documentation | |
56 | ||
57 | fHistoMakerPtr = new AliHLTEMCALClusterMonitor(); | |
58 | SetupCTPData(); | |
59 | for(int i = 0; i < argc; i++) | |
60 | { | |
61 | if(!strcmp("-roothistofilename", argv[i])) | |
62 | fRootFileName = argv[i+1]; | |
63 | ||
64 | if(!strcmp("-pushfraction", argv[i])) | |
65 | fPushFraction = atoi(argv[i+1]); | |
66 | ||
67 | if(!strcmp("-beverbose", argv[i])) | |
68 | fBeVerbose = atoi(argv[i+1]); | |
69 | ||
70 | } | |
71 | ||
72 | if (fBeVerbose) cout << "\nI-CLUSTERMONITORCOMPONENT: local root file name is: " << fRootFileName << endl; | |
73 | ||
74 | return 0; | |
75 | } | |
76 | ||
77 | ||
78 | int | |
79 | AliHLTEMCALClusterMonitorComponent::Deinit() | |
80 | { | |
81 | //see header file for documentation | |
82 | if(fHistoMakerPtr) | |
83 | { | |
84 | delete fHistoMakerPtr; | |
85 | fHistoMakerPtr = 0; | |
86 | } | |
87 | ||
88 | return 0; | |
89 | } | |
90 | ||
91 | const char* | |
92 | AliHLTEMCALClusterMonitorComponent::GetComponentID() | |
93 | { | |
94 | //see header file for documentation | |
95 | return "EmcalClusterMonitor"; | |
96 | } | |
97 | ||
98 | ||
99 | void | |
100 | AliHLTEMCALClusterMonitorComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list) | |
101 | { | |
102 | //see header file for documentation | |
103 | list.clear(); | |
104 | list.push_back(kAliHLTDataTypeCaloCluster); | |
105 | } | |
106 | ||
107 | AliHLTComponentDataType | |
108 | AliHLTEMCALClusterMonitorComponent::GetOutputDataType() | |
109 | { | |
110 | //see header file for documentation | |
111 | return kAliHLTDataTypeHistogram | kAliHLTDataOriginEMCAL; | |
112 | } | |
113 | ||
114 | void | |
115 | AliHLTEMCALClusterMonitorComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier) | |
116 | { | |
117 | //see header file for documentation | |
118 | constBase = 0; | |
119 | // to be reviewed later | |
120 | inputMultiplier = 100; | |
121 | } | |
122 | ||
123 | int | |
124 | AliHLTEMCALClusterMonitorComponent::DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, | |
125 | AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* /*outputPtr*/, AliHLTUInt32_t& /*size*/, | |
126 | std::vector<AliHLTComponentBlockData>& /*outputBlocks*/) | |
127 | { | |
128 | ||
129 | ||
130 | const AliHLTComponentBlockData* iter = 0; | |
131 | unsigned long ndx; | |
132 | ||
133 | UInt_t specification = 0; | |
134 | for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) | |
135 | { | |
136 | ||
137 | AliHLTCaloClusterHeaderStruct *caloClusterHeaderPtr = 0; | |
138 | ||
139 | iter = blocks+ndx; | |
140 | ||
141 | if (fBeVerbose) PrintComponentDataTypeInfo(iter->fDataType); | |
142 | ||
143 | if (iter->fDataType == kAliHLTDataTypeCaloCluster) caloClusterHeaderPtr = reinterpret_cast<AliHLTCaloClusterHeaderStruct*>(iter->fPtr); | |
144 | else { | |
145 | if(fBeVerbose) HLTWarning("\nI-CLUSTERMONITORCOMPONENT: Data block does not contain cluster type \n"); | |
146 | } | |
147 | ||
148 | ||
149 | specification |= iter->fSpecification; | |
150 | fHistoMakerPtr->MakeHisto(caloClusterHeaderPtr); | |
151 | ||
152 | } | |
153 | ||
154 | ||
155 | fLocalEventCount++; | |
156 | ||
157 | TFile rootHistFile(fRootFileName,"recreate"); | |
158 | ||
159 | fHistoMakerPtr->GetHistograms()->Write(); | |
160 | ||
161 | if (fLocalEventCount%fPushFraction == 0) { | |
162 | ||
163 | if (fBeVerbose) cout << "\nI-CLUSTERMONITORCOMPONENT: pushback done at " << fLocalEventCount << " events " << endl; | |
164 | ||
165 | PushBack(fHistoMakerPtr->GetHistograms(), kAliHLTDataTypeTObjArray | kAliHLTDataOriginEMCAL , specification); | |
166 | } | |
167 | ||
168 | return 0; | |
169 | } | |
170 | ||
171 | ||
172 | AliHLTComponent* | |
173 | AliHLTEMCALClusterMonitorComponent::Spawn() | |
174 | { | |
175 | //see header file for documentation | |
176 | return new AliHLTEMCALClusterMonitorComponent(); | |
177 | } |