]>
Commit | Line | Data |
---|---|---|
fdf6f4e9 | 1 | |
2 | ||
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 * | |
8 | * * | |
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 | **************************************************************************/ | |
17 | ||
18 | #include "AliHLTEMCALRawHistoMakerComponent.h" | |
19 | #include "AliHLTEMCALRawHistoMaker.h" | |
20 | ||
21 | #include "AliHLTCaloChannelDataHeaderStruct.h" | |
22 | #include "AliHLTCaloChannelDataStruct.h" | |
23 | ||
4cec1df9 | 24 | #include "AliHLTCaloDefinitions.h" |
25 | ||
26 | #include "TString.h" | |
27 | ||
28 | ||
29 | ||
fdf6f4e9 | 30 | // root stuff |
31 | #include "TFile.h" | |
32 | #include "TProfile2D.h" | |
33 | #include "TH1F.h" | |
34 | #include "TH2F.h" | |
35 | #include <sys/stat.h> | |
36 | #include <sys/types.h> | |
37 | ||
38 | #include "AliCDBEntry.h" | |
39 | #include "AliCDBManager.h" | |
40 | #include "AliCDBPath.h" | |
41 | /** | |
42 | * @file AliHLTEMCALRawHistoMakerComponent.cxx | |
43 | * @author Federico Ronchetti | |
44 | * @date | |
45 | * @brief A component to pusk back histograms for EMCAL HLT | |
46 | */ | |
47 | ||
48 | //FIXME | |
49 | AliHLTEMCALRawHistoMakerComponent gAliHLTEMCALRawHistoMakerComponent; | |
50 | ||
51 | AliHLTEMCALRawHistoMakerComponent::AliHLTEMCALRawHistoMakerComponent() : | |
52 | AliHLTCaloProcessor(), | |
53 | fRawHistoMakerPtr(0), | |
54 | fPushFraction(10), | |
55 | fLocalEventCount(0), | |
fb43b5cd | 56 | fRootFileName("histofile_local.root"), |
57 | fBeVerbose(0) | |
fdf6f4e9 | 58 | { |
59 | //see header file for documentation | |
60 | } | |
61 | ||
62 | ||
63 | AliHLTEMCALRawHistoMakerComponent::~AliHLTEMCALRawHistoMakerComponent() | |
64 | { | |
65 | //see header file for documentation | |
66 | } | |
67 | ||
4cec1df9 | 68 | |
69 | int | |
70 | AliHLTEMCALRawHistoMakerComponent::DoInit(int argc, const char** argv ) | |
71 | { | |
72 | //see header file for documentation | |
73 | ||
74 | fRawHistoMakerPtr = new AliHLTEMCALRawHistoMaker(); | |
75 | ||
76 | for(int i = 0; i < argc; i++) | |
77 | { | |
78 | if(!strcmp("-roothistofilename", argv[i])) | |
79 | fRootFileName = argv[i+1]; | |
80 | ||
81 | if(!strcmp("-pushfraction", argv[i])) | |
82 | fPushFraction = atoi(argv[i+1]); | |
83 | ||
84 | if(!strcmp("-beverbose", argv[i])) | |
85 | fBeVerbose = atoi(argv[i+1]); | |
86 | ||
87 | } | |
88 | ||
89 | if (fBeVerbose) | |
2fb9aff8 | 90 | cout << "\nI-RAWHISTOMAKERCOMPONENT: local root file name is: " << fRootFileName << endl; |
4cec1df9 | 91 | |
92 | return 0; | |
93 | } | |
94 | ||
95 | ||
fdf6f4e9 | 96 | int |
97 | AliHLTEMCALRawHistoMakerComponent::Deinit() | |
98 | { | |
99 | //see header file for documentation | |
100 | if(fRawHistoMakerPtr) | |
101 | { | |
102 | delete fRawHistoMakerPtr; | |
103 | fRawHistoMakerPtr = 0; | |
104 | } | |
105 | ||
106 | return 0; | |
107 | } | |
108 | ||
109 | const char* | |
110 | AliHLTEMCALRawHistoMakerComponent::GetComponentID() | |
111 | { | |
112 | //see header file for documentation | |
fb43b5cd | 113 | return "EmcalRawHistoMaker"; |
fdf6f4e9 | 114 | } |
115 | ||
116 | ||
117 | void | |
118 | AliHLTEMCALRawHistoMakerComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list) | |
119 | { | |
120 | //see header file for documentation | |
121 | list.clear(); | |
122 | list.push_back(AliHLTEMCALDefinitions::fgkChannelDataType); | |
123 | } | |
124 | ||
125 | AliHLTComponentDataType | |
126 | AliHLTEMCALRawHistoMakerComponent::GetOutputDataType() | |
127 | { | |
128 | //see header file for documentation | |
129 | return kAliHLTDataTypeHistogram | kAliHLTDataOriginEMCAL; | |
130 | } | |
131 | ||
132 | void | |
133 | AliHLTEMCALRawHistoMakerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier) | |
134 | { | |
135 | //see header file for documentation | |
136 | constBase = 0; | |
137 | // to be reviewed later | |
138 | inputMultiplier = 100; | |
139 | } | |
140 | ||
141 | int | |
142 | AliHLTEMCALRawHistoMakerComponent::DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, | |
143 | AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size, | |
144 | std::vector<AliHLTComponentBlockData>& outputBlocks) | |
145 | { | |
146 | //see header file for documentation | |
147 | UInt_t mysize = 0; | |
148 | Int_t ret = 0; | |
149 | ||
150 | ||
151 | AliHLTUInt8_t* outBPtr; | |
152 | outBPtr = outputPtr; | |
153 | const AliHLTComponentBlockData* iter = 0; | |
154 | unsigned long ndx; | |
155 | ||
156 | UInt_t specification = 0; | |
4cec1df9 | 157 | |
fdf6f4e9 | 158 | for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) |
159 | { | |
c79ec212 | 160 | |
161 | AliHLTCaloClusterHeaderStruct *caloClusterHeaderPtr = 0; | |
162 | AliHLTCaloChannelDataHeaderStruct* tmpChannelData = 0; | |
163 | ||
fdf6f4e9 | 164 | iter = blocks+ndx; |
4cec1df9 | 165 | |
c79ec212 | 166 | if (fBeVerbose) |
167 | PrintComponentDataTypeInfo(iter->fDataType); | |
168 | ||
4cec1df9 | 169 | |
4cec1df9 | 170 | if (iter->fDataType == AliHLTEMCALDefinitions::fgkChannelDataType) |
171 | { | |
172 | ||
4cec1df9 | 173 | tmpChannelData = reinterpret_cast<AliHLTCaloChannelDataHeaderStruct*>(iter->fPtr); |
c79ec212 | 174 | |
4cec1df9 | 175 | if (fBeVerbose) |
c79ec212 | 176 | printf ("\nI-RAWHISTOMAKERCOMPONENT: Number of active channels in block: %d\n",tmpChannelData->fNChannels); |
177 | ||
4cec1df9 | 178 | } |
c79ec212 | 179 | |
180 | else if (iter->fDataType == kAliHLTDataTypeCaloCluster) | |
181 | caloClusterHeaderPtr = reinterpret_cast<AliHLTCaloClusterHeaderStruct*>(iter->fPtr); | |
182 | ||
4cec1df9 | 183 | else |
184 | ||
185 | { | |
186 | if (fBeVerbose) | |
c79ec212 | 187 | HLTWarning("\nI-RAWHISTOMAKERCOMPONENT: Data block does not of channel or cluster type \n"); |
4cec1df9 | 188 | else |
c79ec212 | 189 | HLTDebug("\nI-RAWHISTOMAKERCOMPONENT: Data block does not of channel or cluster type \n"); |
4cec1df9 | 190 | continue; |
c79ec212 | 191 | } |
4cec1df9 | 192 | |
193 | ||
fdf6f4e9 | 194 | specification |= iter->fSpecification; |
4cec1df9 | 195 | ret = fRawHistoMakerPtr->MakeHisto(tmpChannelData, caloClusterHeaderPtr, fBeVerbose); |
fdf6f4e9 | 196 | |
fdf6f4e9 | 197 | } |
198 | ||
c79ec212 | 199 | |
fdf6f4e9 | 200 | fLocalEventCount++; |
201 | ||
fdf6f4e9 | 202 | TFile rootHistFile(fRootFileName,"recreate"); |
4cec1df9 | 203 | |
fdf6f4e9 | 204 | fRawHistoMakerPtr->GetHistograms()->Write(); |
4cec1df9 | 205 | |
fdf6f4e9 | 206 | if (fLocalEventCount%fPushFraction == 0) { |
4cec1df9 | 207 | |
208 | if (fBeVerbose) | |
c79ec212 | 209 | cout << "\nI-RAWHISTOMAKERCOMPONENT: pushback done at " << fLocalEventCount << " events " << endl; |
4cec1df9 | 210 | |
211 | PushBack(fRawHistoMakerPtr->GetHistograms(), kAliHLTDataTypeTObjArray | kAliHLTDataOriginEMCAL , specification); | |
fdf6f4e9 | 212 | } |
4cec1df9 | 213 | |
fdf6f4e9 | 214 | size = mysize; |
4cec1df9 | 215 | |
fdf6f4e9 | 216 | return 0; |
217 | } | |
218 | ||
219 | ||
220 | AliHLTComponent* | |
221 | AliHLTEMCALRawHistoMakerComponent::Spawn() | |
222 | { | |
223 | //see header file for documentation | |
224 | return new AliHLTEMCALRawHistoMakerComponent(); | |
225 | } |