]>
Commit | Line | Data |
---|---|---|
e69020a0 | 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 | ||
88cb7938 | 16 | /* $Id$ */ |
8ace09b6 | 17 | ///////////////////////////////////////////////////////////////////////// |
18 | // // | |
7d62fb64 | 19 | // Class for ITS RecPoint reconstruction // |
8ace09b6 | 20 | // // |
21 | //////////////////////////////////////////////////////////////////////// | |
b9d0a01d | 22 | |
e69020a0 | 23 | #include <TString.h> |
e69020a0 | 24 | #include "AliRun.h" |
88cb7938 | 25 | #include "AliRunLoader.h" |
7d62fb64 | 26 | #include "AliITSDetTypeRec.h" |
88cb7938 | 27 | #include "AliITSLoader.h" |
e69020a0 | 28 | #include "AliITSreconstruction.h" |
e69020a0 | 29 | #include "AliITSgeom.h" |
30 | ||
7d62fb64 | 31 | |
e69020a0 | 32 | ClassImp(AliITSreconstruction) |
33 | ||
34 | //______________________________________________________________________ | |
88cb7938 | 35 | AliITSreconstruction::AliITSreconstruction(): |
36 | fInit(kFALSE), | |
37 | fEnt(0), | |
38 | fEnt0(0), | |
8221b41b | 39 | fDetTypeRec(0x0), |
88cb7938 | 40 | fDfArp(kFALSE), |
8221b41b | 41 | fITSgeom(0x0), |
88cb7938 | 42 | fLoader(0x0), |
43 | fRunLoader(0x0) | |
44 | { | |
e69020a0 | 45 | // Default constructor. |
46 | // Inputs: | |
47 | // none. | |
48 | // Outputs: | |
49 | // none. | |
50 | // Return: | |
51 | // A zero-ed constructed AliITSreconstruction class. | |
e69020a0 | 52 | fDet[0] = fDet[1] = fDet[2] = kTRUE; |
4d24e763 | 53 | } |
54 | //______________________________________________________________________ | |
4d24e763 | 55 | |
88cb7938 | 56 | AliITSreconstruction::AliITSreconstruction(AliRunLoader *rl): |
57 | fInit(kFALSE), | |
58 | fEnt(0), | |
59 | fEnt0(0), | |
8221b41b | 60 | fDetTypeRec(0x0), |
88cb7938 | 61 | fDfArp(kFALSE), |
8221b41b | 62 | fITSgeom(0x0), |
88cb7938 | 63 | fLoader(0x0), |
64 | fRunLoader(rl) | |
65 | { | |
66 | fDet[0] = fDet[1] = fDet[2] = kTRUE; | |
e69020a0 | 67 | } |
68 | //______________________________________________________________________ | |
88cb7938 | 69 | AliITSreconstruction::AliITSreconstruction(const char* filename): |
70 | fInit(kFALSE), | |
71 | fEnt(0), | |
72 | fEnt0(0), | |
8221b41b | 73 | fDetTypeRec(0x0), |
88cb7938 | 74 | fDfArp(kFALSE), |
8221b41b | 75 | fITSgeom(0x0), |
88cb7938 | 76 | fLoader(0x0), |
77 | fRunLoader(0x0) | |
78 | { | |
e69020a0 | 79 | // Standard constructor. |
80 | // Inputs: | |
81 | // const char* filename filename containing the digits to be | |
3e9ba728 | 82 | // reconstructed. If filename = 0 (nil) |
83 | // then no file is opened but a file is | |
84 | // assumed to already be opened. This | |
85 | // already opened file will be used. | |
e69020a0 | 86 | // Outputs: |
87 | // none. | |
88 | // Return: | |
89 | // A standardly constructed AliITSreconstruction class. | |
90 | ||
88cb7938 | 91 | fDet[0] = fDet[1] = fDet[2] = kTRUE; |
92 | ||
93 | fRunLoader = AliRunLoader::Open(filename); | |
94 | if (fRunLoader == 0x0) | |
95 | { | |
a5a317a9 | 96 | Error("AliITSreconstruction","Can not load the session %s \n",filename); |
88cb7938 | 97 | return; |
98 | } | |
88cb7938 | 99 | |
e69020a0 | 100 | } |
8221b41b | 101 | |
7d62fb64 | 102 | |
e69020a0 | 103 | //______________________________________________________________________ |
104 | AliITSreconstruction::~AliITSreconstruction(){ | |
e69020a0 | 105 | // A destroyed AliITSreconstruction class. |
7d62fb64 | 106 | |
107 | //fITS = 0; | |
88cb7938 | 108 | delete fRunLoader; |
7d62fb64 | 109 | |
e69020a0 | 110 | } |
111 | //______________________________________________________________________ | |
112 | Bool_t AliITSreconstruction::Init(){ | |
113 | // Class Initilizer. | |
114 | // Inputs: | |
115 | // none. | |
116 | // Outputs: | |
117 | // none. | |
118 | // Return: | |
119 | // kTRUE if no errors initilizing this class occurse else kFALSE | |
a5a317a9 | 120 | Info("Init"," Init ITS reconstruction"); |
88cb7938 | 121 | if (fRunLoader == 0x0) |
122 | { | |
123 | Error("Init","Run Loader is NULL"); | |
124 | return kFALSE; | |
125 | } | |
60b9526b | 126 | // fRunLoader->LoadgAlice(); |
127 | // fRunLoader->LoadHeader(); | |
88cb7938 | 128 | |
129 | fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader"); | |
130 | if(!fLoader) { | |
131 | Error("Init","ITS loader not found"); | |
132 | fInit = kFALSE; | |
133 | } | |
134 | ||
e69020a0 | 135 | // Now ready to init. |
7d62fb64 | 136 | |
60b9526b | 137 | //fRunLoader->CdGAFile(); |
c7dca079 | 138 | fITSgeom = fLoader->GetITSgeom(); |
e69020a0 | 139 | |
6cae184e | 140 | fDetTypeRec = new AliITSDetTypeRec(); |
141 | fDetTypeRec->SetITSgeom(fITSgeom); | |
7d62fb64 | 142 | fDetTypeRec->SetDefaults(); |
e69020a0 | 143 | fDet[0] = fDet[1] = fDet[2] = kTRUE; |
144 | fEnt0 = 0; | |
88cb7938 | 145 | |
60b9526b | 146 | fEnt = Int_t(fRunLoader->GetNumberOfEvents()); |
88cb7938 | 147 | |
148 | fLoader->LoadDigits("read"); | |
149 | fLoader->LoadRecPoints("recreate"); | |
88cb7938 | 150 | if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R"); |
7d62fb64 | 151 | |
6cae184e | 152 | fDetTypeRec->SetTreeAddressD(fLoader->TreeD()); |
153 | fDetTypeRec->MakeBranchR(fLoader->TreeR()); | |
7d62fb64 | 154 | fDetTypeRec->SetTreeAddressR(fLoader->TreeR()); |
155 | ||
e69020a0 | 156 | fInit = InitRec(); |
88cb7938 | 157 | |
158 | Info("Init"," Done\n\n\n"); | |
159 | ||
e69020a0 | 160 | return fInit; |
161 | } | |
162 | //______________________________________________________________________ | |
163 | Bool_t AliITSreconstruction::InitRec(){ | |
164 | // Sets up Reconstruction part of AliITSDetType.. | |
165 | // Inputs: | |
166 | // none. | |
167 | // Outputs: | |
168 | // none. | |
169 | // Return: | |
170 | // none. | |
5d2c2f86 | 171 | |
172 | ||
173 | fDetTypeRec->SetDefaultClusterFindersV2(); | |
174 | Info("InitRec"," Done\n"); | |
175 | return kTRUE; | |
e69020a0 | 176 | } |
177 | //______________________________________________________________________ | |
178 | void AliITSreconstruction::Exec(const Option_t *opt){ | |
179 | // Main reconstruction function. | |
180 | // Inputs: | |
181 | // Option_t * opt list of subdetector to digitize. =0 all. | |
182 | // Outputs: | |
183 | // none. | |
184 | // Return: | |
185 | // none. | |
186 | Option_t *lopt; | |
88cb7938 | 187 | Int_t evnt; |
e8c2bf0d | 188 | Bool_t condition =kFALSE; |
189 | if(opt){ | |
190 | if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS"))condition =kTRUE; | |
191 | } | |
192 | else{ | |
193 | condition = kTRUE; | |
194 | } | |
195 | if(condition){ | |
88cb7938 | 196 | fDet[0] = fDet[1] = fDet[2] = kTRUE; |
197 | lopt = "All"; | |
e69020a0 | 198 | }else{ |
88cb7938 | 199 | fDet[0] = fDet[1] = fDet[2] = kFALSE; |
200 | if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE; | |
201 | if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE; | |
202 | if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE; | |
203 | if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All"; | |
204 | else lopt = opt; | |
e69020a0 | 205 | } // end if strstr(opt,...) |
206 | ||
207 | if(!fInit){ | |
88cb7938 | 208 | cout << "Initilization Failed, Can't run Exec." << endl; |
209 | return; | |
e69020a0 | 210 | } // end if !fInit |
88cb7938 | 211 | for(evnt=0;evnt<fEnt;evnt++) |
212 | { | |
a5a317a9 | 213 | // Info("Exec",""); |
88cb7938 | 214 | Info("Exec","Processing Event %d",evnt); |
a5a317a9 | 215 | // Info("Exec",""); |
88cb7938 | 216 | |
217 | fRunLoader->GetEvent(evnt); | |
218 | if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R"); | |
7d62fb64 | 219 | fDetTypeRec->MakeBranchR(0); |
7d62fb64 | 220 | fDetTypeRec->SetTreeAddressR(fLoader->TreeR()); |
221 | fDetTypeRec->SetTreeAddressD(fLoader->TreeD()); | |
6cae184e | 222 | fDetTypeRec->DigitsToRecPoints(fLoader->TreeD(),fLoader->TreeR(),0,lopt); |
e69020a0 | 223 | } // end for evnt |
f243fbe6 | 224 | } |
225 | //______________________________________________________________________ | |
226 | void AliITSreconstruction::SetOutputFile(TString filename){ | |
999cc3eb | 227 | // Set a new file name for recpoints. |
228 | // It must be called before Init() | |
229 | if(!fLoader)fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader"); | |
230 | if(fLoader){ | |
231 | Info("SetOutputFile","name for rec points is %s",filename.Data()); | |
232 | fLoader->SetRecPointsFileName(filename); | |
233 | } | |
234 | else { | |
235 | Error("SetOutputFile", | |
236 | "ITS loader not available. Not possible to set name: %s",filename.Data()); | |
237 | } | |
e69020a0 | 238 | } |