1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 ///////////////////////////////////////////////////////////////////////////////
19 // ALICE Reconstruction parameterization: //
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. //
26 ///////////////////////////////////////////////////////////////////////////////
28 #include "TObjArray.h"
29 #include "AliDetectorRecoParam.h"
32 #include "AliRecoParam.h"
33 #include "AliRunInfo.h"
34 #include "AliEventInfo.h"
36 ClassImp(AliRecoParam)
38 AliRecoParam::AliRecoParam():
40 fEventSpecie(kDefault)
42 // Default constructor
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;
53 AliRecoParam::AliRecoParam(const AliRecoParam& par) :
55 fEventSpecie(par.fEventSpecie)
58 for(Int_t iDet = 0; iDet < kNDetectors; iDet++) {
59 if (par.fDetRecoParams[iDet])
60 fDetRecoParams[iDet] = (TObjArray*)(par.fDetRecoParams[iDet]->Clone());
62 fDetRecoParams[iDet] = NULL;
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];
71 //_____________________________________________________________________________
72 AliRecoParam& AliRecoParam::operator = (const AliRecoParam& par)
74 // assignment operator
76 if(&par == this) return *this;
78 this->~AliRecoParam();
79 new(this) AliRecoParam(par);
83 AliRecoParam::~AliRecoParam(){
86 // Delete the array with the reco-param objects
87 for(Int_t iDet = 0; iDet < kNDetectors; iDet++) {
88 if (fDetRecoParams[iDet]){
89 fDetRecoParams[iDet]->Delete();
90 delete fDetRecoParams[iDet];
95 void AliRecoParam::Print(Option_t *option) const {
97 // Print reconstruction setup
99 for(Int_t iDet = 0; iDet < kNDetectors; iDet++) {
100 if (fDetRecoParams[iDet]){
101 printf("AliDetectorRecoParam objects for detector %d:\n",iDet);
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);
110 printf("No AliDetectorRecoParam objects specified for detector %d\n",iDet);
115 void AliRecoParam::SetEventSpecie(const AliRunInfo *runInfo, const AliEventInfo &evInfo)
118 // Here we return always kDefault!!
120 fEventSpecie = kDefault;
122 if (strcmp(runInfo->GetRunType(),"PHYSICS")) {
123 // Not a physics run, the event specie is set to kCalib
124 fEventSpecie = kCalib;
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;
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;
145 else if (strcmp(runInfo->GetBeamType(),"-") == 0) {
146 // No beams, we assume cosmic data
147 fEventSpecie = kCosmic;
149 else if (strcmp(runInfo->GetBeamType(),"UNKNOWN") == 0) {
150 // No LHC beam information is available, we the default
152 fEventSpecie = kDefault;
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;
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;
181 else if (trClass.BeginsWith("C0LSR")) {
183 laserTrigger = kTRUE;
185 else if (trClass.BeginsWith("C0SH")) {
186 // High-multiplicity SPD trugger
187 // Have to add other high-mult triggers here...
188 highMultTrigger = kTRUE;
191 otherTrigger = kTRUE;
196 fEventSpecie = kCalib;
199 if (cosmicTrigger && !highMultTrigger && !otherTrigger) {
200 fEventSpecie = kCosmic;
203 if (highMultTrigger) {
204 fEventSpecie = kHighMult;
208 // Here we have to add if we have other cases
209 // and also HLT info if any...
213 const AliDetectorRecoParam *AliRecoParam::GetDetRecoParam(Int_t iDet) const
215 // Return AliDetectorRecoParam object for a given detector
216 // according to the event specie provided as an argument
217 if ( iDet >= kNDetectors) return NULL;
218 if (!fDetRecoParams[iDet]) return NULL;
219 if (fDetRecoParams[iDet]->GetEntries() == 0) return NULL;
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]);
226 return (AliDetectorRecoParam *)fDetRecoParams[iDet]->At(fDetRecoParamsIndex[0][iDet]);
231 AliError(Form("Invalid event specie: %d!",fEventSpecie));
232 return (AliDetectorRecoParam *)fDetRecoParams[iDet]->At(fDetRecoParamsIndex[0][iDet]);
235 void AliRecoParam::AddDetRecoParam(Int_t iDet, AliDetectorRecoParam* param)
237 // Add an instance of reco params object into
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();
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;
253 Bool_t AliRecoParam::AddDetRecoParamArray(Int_t iDet, TObjArray* parArray)
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);
262 if (par->IsDefault()) defaultFound = kTRUE;
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;
272 fDetRecoParams[iDet] = parArray;
277 const char* AliRecoParam::PrintEventSpecie() const
281 switch (fEventSpecie) {
286 return "Low-multiplicity";
289 return "High-multiplicity";
295 return "Calibration";