]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliRecoParam.cxx
Removing declaration of constructor with report identifiers as parameters
[u/mrichter/AliRoot.git] / STEER / AliRecoParam.cxx
CommitLineData
242b332c 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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
17///////////////////////////////////////////////////////////////////////////////
18// //
6769d914 19// ALICE Reconstruction parameterization: //
20// //
21// //
22// Base Class for Detector reconstruction parameters //
23// Revision: cvetan.cheshkov@cern.ch 12/06/2008 //
24// Its structure has been revised and it is interfaced to AliEventInfo. //
242b332c 25// //
26///////////////////////////////////////////////////////////////////////////////
27
28#include "TObjArray.h"
29#include "AliDetectorRecoParam.h"
30
6bcbb25b 31#include "AliLog.h"
242b332c 32#include "AliRecoParam.h"
48f5e52d 33#include "AliRunInfo.h"
34#include "AliEventInfo.h"
242b332c 35
242b332c 36ClassImp(AliRecoParam)
37
6769d914 38AliRecoParam::AliRecoParam():
7e88424f 39 TObject(),
40 fEventSpecie(kDefault)
242b332c 41{
6769d914 42 // Default constructor
43 // ...
7e88424f 44 for(Int_t iDet = 0; iDet < kNDetectors; iDet++)
45 fDetRecoParams[iDet] = NULL;
46 for(Int_t iSpecie = 0; iSpecie < kNSpecies; iSpecie++) {
47 for(Int_t iDet = 0; iDet < kNDetectors; iDet++) {
48 fDetRecoParamsIndex[iSpecie][iDet] = -1;
49 }
50 }
242b332c 51}
52
54e51010 53AliRecoParam::AliRecoParam(const AliRecoParam& par) :
54 TObject(),
55 fEventSpecie(par.fEventSpecie)
56{
57 // copy constructor
58 for(Int_t iDet = 0; iDet < kNDetectors; iDet++) {
54e51010 59 if (par.fDetRecoParams[iDet])
60 fDetRecoParams[iDet] = (TObjArray*)(par.fDetRecoParams[iDet]->Clone());
61 else
62 fDetRecoParams[iDet] = NULL;
63 }
64 for(Int_t iSpecie = 0; iSpecie < kNSpecies; iSpecie++) {
65 for(Int_t iDet = 0; iDet < kNDetectors; iDet++) {
66 fDetRecoParamsIndex[iSpecie][iDet] = par.fDetRecoParamsIndex[iSpecie][iDet];
67 }
68 }
69}
70
49ad11d0 71//_____________________________________________________________________________
72AliRecoParam& AliRecoParam::operator = (const AliRecoParam& par)
73{
74 // assignment operator
75
76 if(&par == this) return *this;
77
78 this->~AliRecoParam();
79 new(this) AliRecoParam(par);
80 return *this;
81}
82
242b332c 83AliRecoParam::~AliRecoParam(){
6769d914 84 // Destructor
85 // ...
86 // Delete the array with the reco-param objects
7e88424f 87 for(Int_t iDet = 0; iDet < kNDetectors; iDet++) {
88 if (fDetRecoParams[iDet]){
89 fDetRecoParams[iDet]->Delete();
90 delete fDetRecoParams[iDet];
91 }
242b332c 92 }
93}
94
6769d914 95void AliRecoParam::Print(Option_t *option) const {
242b332c 96 //
97 // Print reconstruction setup
98 //
7e88424f 99 for(Int_t iDet = 0; iDet < kNDetectors; iDet++) {
100 if (fDetRecoParams[iDet]){
ac232c75 101 printf("AliDetectorRecoParam objects for detector %d:\n",iDet);
7e88424f 102 Int_t nparam = fDetRecoParams[iDet]->GetEntriesFast();
103 for (Int_t iparam=0; iparam<nparam; iparam++){
104 AliDetectorRecoParam * param = (AliDetectorRecoParam *)fDetRecoParams[iDet]->At(iparam);
105 if (!param) continue;
106 param->Print(option);
107 }
108 }
109 else {
110 printf("No AliDetectorRecoParam objects specified for detector %d\n",iDet);
111 }
242b332c 112 }
113}
114
48f5e52d 115void AliRecoParam::SetEventSpecie(const AliRunInfo *runInfo, const AliEventInfo &evInfo)
7e88424f 116{
117 // To be implemented
118 // Here we return always kDefault!!
48f5e52d 119
7e88424f 120 fEventSpecie = kDefault;
48f5e52d 121
122 if (strcmp(runInfo->GetRunType(),"PHYSICS")) {
123 // Not a physics run, the event specie is set to kCalib
124 fEventSpecie = kCalib;
125 return;
126 }
127
128 if (strcmp(runInfo->GetLHCState(),"STABLE_BEAMS") == 0) {
129 // In case of stable beams
130 if ((strcmp(runInfo->GetBeamType(),"A-A") == 0) ||
131 (strcmp(runInfo->GetBeamType(),"A-") == 0) ||
132 (strcmp(runInfo->GetBeamType(),"-A") == 0)) {
133 // Heavy ion run, the event specie is set to kHighMult
134 fEventSpecie = kHighMult;
135 }
136 else if ((strcmp(runInfo->GetBeamType(),"p-p") == 0) ||
137 (strcmp(runInfo->GetBeamType(),"p-") == 0) ||
138 (strcmp(runInfo->GetBeamType(),"-p") == 0) ||
139 (strcmp(runInfo->GetBeamType(),"P-P") == 0) ||
140 (strcmp(runInfo->GetBeamType(),"P-") == 0) ||
141 (strcmp(runInfo->GetBeamType(),"-P") == 0)) {
142 // Proton run, the event specie is set to kLowMult
143 fEventSpecie = kLowMult;
144 }
145 else if (strcmp(runInfo->GetBeamType(),"-") == 0) {
146 // No beams, we assume cosmic data
147 fEventSpecie = kCosmic;
148 }
149 else if (strcmp(runInfo->GetBeamType(),"UNKNOWN") == 0) {
150 // No LHC beam information is available, we the default
151 // event specie
152 fEventSpecie = kDefault;
153 }
154
155 // Now we look into the trigger type in order to decide
156 // on the remaining cases (cosmic event within LHC run,
157 // high-mult event based on high-mult SPD trigger
158 // within p-p run, laser triggers within physics run,
159 // special DAQ events considered as calibration etc...)
160 if (evInfo.GetEventType() != 7) {
161 // START_OF_*, END_OF_*, CALIBRATION etc events
162 fEventSpecie = kCalib;
163 }
164
165 TString triggerClasses = evInfo.GetTriggerClasses();
166 TObjArray* trClassArray = triggerClasses.Tokenize(" ");
167 Int_t nTrClasses = trClassArray->GetEntriesFast();
168 Bool_t cosmicTrigger = kFALSE,
169 laserTrigger = kFALSE,
170 highMultTrigger = kFALSE,
171 otherTrigger = kFALSE;
172 for( Int_t i=0; i<nTrClasses; ++i ) {
173 TString trClass = ((TObjString*)trClassArray->At(i))->String();
174 if (trClass.BeginsWith("C0A") ||
175 trClass.BeginsWith("C0SC") ||
176 trClass.BeginsWith("C0OC")) {
177 // ACORDE/SPD/TOF cosmic trigger, so we have cosmic event
178 // not always true, but we don't have a better idea...
179 cosmicTrigger = kTRUE;
180 }
181 else if (trClass.BeginsWith("C0LSR")) {
182 // Laser trigger
183 laserTrigger = kTRUE;
184 }
185 else if (trClass.BeginsWith("C0SH")) {
186 // High-multiplicity SPD trugger
187 // Have to add other high-mult triggers here...
188 highMultTrigger = kTRUE;
189 }
190 else {
191 otherTrigger = kTRUE;
192 }
193 }
194
195 if (laserTrigger) {
196 fEventSpecie = kCalib;
197 return;
198 }
199 if (cosmicTrigger && !highMultTrigger && !otherTrigger) {
200 fEventSpecie = kCosmic;
201 return;
202 }
203 if (highMultTrigger) {
204 fEventSpecie = kHighMult;
205 return;
206 }
207
208 // Here we have to add if we have other cases
209 // and also HLT info if any...
210 }
7e88424f 211}
212
213const AliDetectorRecoParam *AliRecoParam::GetDetRecoParam(Int_t iDet) const
214{
215 // Return AliDetectorRecoParam object for a given detector
216 // according to the event specie provided as an argument
a00021a7 217 if ( iDet >= kNDetectors) return NULL;
7e88424f 218 if (!fDetRecoParams[iDet]) return NULL;
219 if (fDetRecoParams[iDet]->GetEntries() == 0) return NULL;
220
221 for(Int_t iBit = 0; iBit < kNSpecies; iBit++) {
222 if (fEventSpecie & (1 << iBit)) {
223 if (fDetRecoParamsIndex[iBit][iDet] >= 0)
224 return (AliDetectorRecoParam *)fDetRecoParams[iDet]->At(fDetRecoParamsIndex[iBit][iDet]);
225 else
226 return (AliDetectorRecoParam *)fDetRecoParams[iDet]->At(fDetRecoParamsIndex[0][iDet]);
227 }
228 }
6bcbb25b 229
7e88424f 230 // Default one
231 AliError(Form("Invalid event specie: %d!",fEventSpecie));
232 return (AliDetectorRecoParam *)fDetRecoParams[iDet]->At(fDetRecoParamsIndex[0][iDet]);
6bcbb25b 233}
234
7e88424f 235void AliRecoParam::AddDetRecoParam(Int_t iDet, AliDetectorRecoParam* param)
236{
6769d914 237 // Add an instance of reco params object into
7e88424f 238 // the fDetRecoParams for detector iDet
239 // Updates the fDetRecoParams index
240 if (!fDetRecoParams[iDet]) fDetRecoParams[iDet] = new TObjArray;
241 fDetRecoParams[iDet]->AddLast(param);
242 Int_t index = fDetRecoParams[iDet]->GetLast();
243
244 // Index
245 Int_t specie = param->GetEventSpecie();
246 for(Int_t iBit = 0; iBit < kNSpecies; iBit++) {
247 if (specie & (1 << iBit)) {
248 fDetRecoParamsIndex[iBit][iDet] = index;
249 }
250 }
251}
252
253Bool_t AliRecoParam::AddDetRecoParamArray(Int_t iDet, TObjArray* parArray)
254{
255 // Add an array of reconstruction parameter objects
256 // for a given detector
257 // Basic check on the consistency of the array
258 Bool_t defaultFound = kFALSE;
259 for(Int_t i = 0; i < parArray->GetEntriesFast(); i++) {
260 AliDetectorRecoParam *par = (AliDetectorRecoParam*)parArray->At(i);
261 if (!par) continue;
262 if (par->IsDefault()) defaultFound = kTRUE;
3d0847a7 263
264 Int_t specie = par->GetEventSpecie();
265 for(Int_t iBit = 0; iBit < kNSpecies; iBit++) {
266 if (specie & (1 << iBit)) {
267 fDetRecoParamsIndex[iBit][iDet] = i;
268 }
269 }
270 }
7e88424f 271
272 fDetRecoParams[iDet] = parArray;
273
274 return defaultFound;
242b332c 275}
48f5e52d 276
277const char* AliRecoParam::PrintEventSpecie() const
278{
279 // Print the current
280 // event specie
281 switch (fEventSpecie) {
282 case kDefault:
283 return "Default";
284 break;
285 case kLowMult:
286 return "Low-multiplicity";
287 break;
288 case kHighMult:
289 return "High-multiplicity";
290 break;
291 case kCosmic:
292 return "Cosmic";
293 break;
294 case kCalib:
295 return "Calibration";
296 break;
297 default:
298 return "Unknown";
299 break;
300 }
301}