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"
34 ClassImp(AliRecoParam)
36 AliRecoParam::AliRecoParam():
38 fEventSpecie(kDefault)
40 // Default constructor
42 for(Int_t iDet = 0; iDet < kNDetectors; iDet++)
43 fDetRecoParams[iDet] = NULL;
44 for(Int_t iSpecie = 0; iSpecie < kNSpecies; iSpecie++) {
45 for(Int_t iDet = 0; iDet < kNDetectors; iDet++) {
46 fDetRecoParamsIndex[iSpecie][iDet] = -1;
51 AliRecoParam::~AliRecoParam(){
54 // Delete the array with the reco-param objects
55 for(Int_t iDet = 0; iDet < kNDetectors; iDet++) {
56 if (fDetRecoParams[iDet]){
57 fDetRecoParams[iDet]->Delete();
58 delete fDetRecoParams[iDet];
63 void AliRecoParam::Print(Option_t *option) const {
65 // Print reconstruction setup
67 for(Int_t iDet = 0; iDet < kNDetectors; iDet++) {
68 if (fDetRecoParams[iDet]){
69 printf("AliDetectorRecoParam objects for detector %d:\n",iDet);
70 Int_t nparam = fDetRecoParams[iDet]->GetEntriesFast();
71 for (Int_t iparam=0; iparam<nparam; iparam++){
72 AliDetectorRecoParam * param = (AliDetectorRecoParam *)fDetRecoParams[iDet]->At(iparam);
78 printf("No AliDetectorRecoParam objects specified for detector %d\n",iDet);
83 void AliRecoParam::SetEventSpecie(const AliRunInfo */*runInfo*/, const AliEventInfo &/*evInfo*/)
86 // Here we return always kDefault!!
87 fEventSpecie = kDefault;
90 const AliDetectorRecoParam *AliRecoParam::GetDetRecoParam(Int_t iDet) const
92 // Return AliDetectorRecoParam object for a given detector
93 // according to the event specie provided as an argument
94 if (!fDetRecoParams[iDet]) return NULL;
95 if (fDetRecoParams[iDet]->GetEntries() == 0) return NULL;
97 for(Int_t iBit = 0; iBit < kNSpecies; iBit++) {
98 if (fEventSpecie & (1 << iBit)) {
99 if (fDetRecoParamsIndex[iBit][iDet] >= 0)
100 return (AliDetectorRecoParam *)fDetRecoParams[iDet]->At(fDetRecoParamsIndex[iBit][iDet]);
102 return (AliDetectorRecoParam *)fDetRecoParams[iDet]->At(fDetRecoParamsIndex[0][iDet]);
107 AliError(Form("Invalid event specie: %d!",fEventSpecie));
108 return (AliDetectorRecoParam *)fDetRecoParams[iDet]->At(fDetRecoParamsIndex[0][iDet]);
111 void AliRecoParam::AddDetRecoParam(Int_t iDet, AliDetectorRecoParam* param)
113 // Add an instance of reco params object into
114 // the fDetRecoParams for detector iDet
115 // Updates the fDetRecoParams index
116 if (!fDetRecoParams[iDet]) fDetRecoParams[iDet] = new TObjArray;
117 fDetRecoParams[iDet]->AddLast(param);
118 Int_t index = fDetRecoParams[iDet]->GetLast();
121 Int_t specie = param->GetEventSpecie();
122 for(Int_t iBit = 0; iBit < kNSpecies; iBit++) {
123 if (specie & (1 << iBit)) {
124 fDetRecoParamsIndex[iBit][iDet] = index;
129 Bool_t AliRecoParam::AddDetRecoParamArray(Int_t iDet, TObjArray* parArray)
131 // Add an array of reconstruction parameter objects
132 // for a given detector
133 // Basic check on the consistency of the array
134 Bool_t defaultFound = kFALSE;
135 for(Int_t i = 0; i < parArray->GetEntriesFast(); i++) {
136 AliDetectorRecoParam *par = (AliDetectorRecoParam*)parArray->At(i);
138 if (par->IsDefault()) defaultFound = kTRUE;
140 Int_t specie = par->GetEventSpecie();
141 for(Int_t iBit = 0; iBit < kNSpecies; iBit++) {
142 if (specie & (1 << iBit)) {
143 fDetRecoParamsIndex[iBit][iDet] = i;
148 fDetRecoParams[iDet] = parArray;