]>
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), | |
7d62fb64 | 39 | //fITS(0x0), |
88cb7938 | 40 | fDfArp(kFALSE), |
41 | fLoader(0x0), | |
42 | fRunLoader(0x0) | |
43 | { | |
e69020a0 | 44 | // Default constructor. |
45 | // Inputs: | |
46 | // none. | |
47 | // Outputs: | |
48 | // none. | |
49 | // Return: | |
50 | // A zero-ed constructed AliITSreconstruction class. | |
e69020a0 | 51 | fDet[0] = fDet[1] = fDet[2] = kTRUE; |
4d24e763 | 52 | } |
53 | //______________________________________________________________________ | |
4d24e763 | 54 | |
88cb7938 | 55 | AliITSreconstruction::AliITSreconstruction(AliRunLoader *rl): |
56 | fInit(kFALSE), | |
57 | fEnt(0), | |
58 | fEnt0(0), | |
7d62fb64 | 59 | //fITS(0x0), |
88cb7938 | 60 | fDfArp(kFALSE), |
61 | fLoader(0x0), | |
62 | fRunLoader(rl) | |
63 | { | |
64 | fDet[0] = fDet[1] = fDet[2] = kTRUE; | |
e69020a0 | 65 | } |
66 | //______________________________________________________________________ | |
88cb7938 | 67 | AliITSreconstruction::AliITSreconstruction(const char* filename): |
68 | fInit(kFALSE), | |
69 | fEnt(0), | |
70 | fEnt0(0), | |
7d62fb64 | 71 | //fITS(0x0), |
88cb7938 | 72 | fDfArp(kFALSE), |
73 | fLoader(0x0), | |
74 | fRunLoader(0x0) | |
75 | { | |
e69020a0 | 76 | // Standard constructor. |
77 | // Inputs: | |
78 | // const char* filename filename containing the digits to be | |
3e9ba728 | 79 | // reconstructed. If filename = 0 (nil) |
80 | // then no file is opened but a file is | |
81 | // assumed to already be opened. This | |
82 | // already opened file will be used. | |
e69020a0 | 83 | // Outputs: |
84 | // none. | |
85 | // Return: | |
86 | // A standardly constructed AliITSreconstruction class. | |
87 | ||
88cb7938 | 88 | fDet[0] = fDet[1] = fDet[2] = kTRUE; |
89 | ||
90 | fRunLoader = AliRunLoader::Open(filename); | |
91 | if (fRunLoader == 0x0) | |
92 | { | |
93 | Error("AliITSreconstruction","Can not load the session",filename); | |
94 | return; | |
95 | } | |
96 | fRunLoader->LoadgAlice(); | |
97 | gAlice = fRunLoader->GetAliRun(); | |
98 | ||
99 | if(!gAlice) { | |
100 | Error("AliITSreconstruction","gAlice not found on file. Aborting."); | |
101 | fInit = kFALSE; | |
102 | return; | |
103 | } // end if !gAlice | |
104 | ||
e69020a0 | 105 | } |
7d62fb64 | 106 | //______________________________________________________________________ |
107 | AliITSreconstruction::AliITSreconstruction(const AliITSreconstruction &/*rec*/):TTask(/*rec*/){ | |
108 | // Copy constructor. | |
109 | ||
110 | Error("Copy constructor","Copy constructor not allowed"); | |
111 | ||
112 | } | |
113 | //______________________________________________________________________ | |
114 | AliITSreconstruction& AliITSreconstruction::operator=(const AliITSreconstruction& /*source*/){ | |
115 | // Assignment operator. This is a function which is not allowed to be | |
116 | // done. | |
117 | Error("operator=","Assignment operator not allowed\n"); | |
118 | return *this; | |
119 | } | |
120 | ||
e69020a0 | 121 | //______________________________________________________________________ |
122 | AliITSreconstruction::~AliITSreconstruction(){ | |
e69020a0 | 123 | // A destroyed AliITSreconstruction class. |
7d62fb64 | 124 | |
125 | //fITS = 0; | |
88cb7938 | 126 | delete fRunLoader; |
7d62fb64 | 127 | |
e69020a0 | 128 | } |
129 | //______________________________________________________________________ | |
130 | Bool_t AliITSreconstruction::Init(){ | |
131 | // Class Initilizer. | |
132 | // Inputs: | |
133 | // none. | |
134 | // Outputs: | |
135 | // none. | |
136 | // Return: | |
137 | // kTRUE if no errors initilizing this class occurse else kFALSE | |
88cb7938 | 138 | Info("Init",""); |
139 | if (fRunLoader == 0x0) | |
140 | { | |
141 | Error("Init","Run Loader is NULL"); | |
142 | return kFALSE; | |
143 | } | |
144 | fRunLoader->LoadgAlice(); | |
145 | fRunLoader->LoadHeader(); | |
146 | ||
147 | fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader"); | |
148 | if(!fLoader) { | |
149 | Error("Init","ITS loader not found"); | |
150 | fInit = kFALSE; | |
151 | } | |
152 | ||
e69020a0 | 153 | // Now ready to init. |
7d62fb64 | 154 | |
155 | fRunLoader->CdGAFile(); | |
156 | fITSgeom = (AliITSgeom*)gDirectory->Get("AliITSgeom"); | |
e69020a0 | 157 | |
8e50d897 | 158 | fDetTypeRec = new AliITSDetTypeRec(fLoader); |
7d62fb64 | 159 | fDetTypeRec->SetDefaults(); |
e69020a0 | 160 | fDet[0] = fDet[1] = fDet[2] = kTRUE; |
161 | fEnt0 = 0; | |
88cb7938 | 162 | |
8ace09b6 | 163 | //fEnt = gAlice->GetEventsPerRun(); |
164 | fEnt = Int_t(fRunLoader->TreeE()->GetEntries()); | |
88cb7938 | 165 | |
166 | fLoader->LoadDigits("read"); | |
167 | fLoader->LoadRecPoints("recreate"); | |
168 | fLoader->LoadRawClusters("recreate"); | |
169 | if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R"); | |
7d62fb64 | 170 | if (fLoader->TreeC() == 0x0) fLoader->MakeTree("C"); |
171 | ||
7d62fb64 | 172 | fDetTypeRec->MakeBranchR(0); |
173 | fDetTypeRec->MakeBranchC(); | |
174 | fDetTypeRec->SetTreeAddress(); | |
175 | fDetTypeRec->SetTreeAddressR(fLoader->TreeR()); | |
176 | ||
e69020a0 | 177 | fInit = InitRec(); |
88cb7938 | 178 | |
179 | Info("Init"," Done\n\n\n"); | |
180 | ||
e69020a0 | 181 | return fInit; |
182 | } | |
183 | //______________________________________________________________________ | |
184 | Bool_t AliITSreconstruction::InitRec(){ | |
185 | // Sets up Reconstruction part of AliITSDetType.. | |
186 | // Inputs: | |
187 | // none. | |
188 | // Outputs: | |
189 | // none. | |
190 | // Return: | |
191 | // none. | |
7d62fb64 | 192 | /* |
193 | //AliITSDetType *idt; | |
194 | fDetTypeRec->SetLoader(fLoader); | |
e69020a0 | 195 | // SPD |
7d62fb64 | 196 | if(fDet[kSPD]){ |
197 | Info("InitRec","SPD"); | |
198 | //idt = fITS->DetType(kSPD); | |
199 | AliITSsegmentationSPD *segSPD = (AliITSsegmentationSPD*)fDetTypeRec->GetSegmentationModel(0); | |
200 | TClonesArray *digSPD = fDetTypeRec->DigitsAddress(kSPD); | |
201 | TClonesArray *recpSPD = fDetTypeRec->ClustersAddress(kSPD); | |
202 | Info("InitRec","idt = %#x; digSPD = %#x; recpSPD = %#x",fDetTypeRec,digSPD,recpSPD); | |
88cb7938 | 203 | AliITSClusterFinderSPD *recSPD = new AliITSClusterFinderSPD(segSPD,digSPD,recpSPD); |
7d62fb64 | 204 | fDetTypeRec->SetReconstructionModel(kSPD,recSPD); |
e69020a0 | 205 | } // end if fDet[kSPD]. |
7d62fb64 | 206 | // SDD |
207 | if(fDet[kSDD]){ | |
208 | Info("InitRec","SDD"); | |
209 | // idt = fITS->DetType(kSDD); | |
210 | AliITSsegmentationSDD *segSDD = (AliITSsegmentationSDD*) | |
211 | fDetTypeRec->GetSegmentationModel(1); | |
212 | AliITSresponseSDD *resSDD = (AliITSresponseSDD*) | |
213 | fDetTypeRec->GetCalibrationModel(fDetTypeRec->GetITSgeom()->GetStartSDD()); | |
214 | TClonesArray *digSDD = fDetTypeRec->DigitsAddress(kSDD); | |
215 | TClonesArray *recpSDD = fDetTypeRec->ClustersAddress(kSDD); | |
216 | AliITSClusterFinderSDD *recSDD =new AliITSClusterFinderSDD(segSDD, | |
217 | resSDD, | |
218 | digSDD,recpSDD); | |
219 | fDetTypeRec->SetReconstructionModel(kSDD,recSDD); | |
220 | } // end if fDet[kSDD] | |
e69020a0 | 221 | // SSD |
7d62fb64 | 222 | if(fDet[kSSD]){ |
223 | Info("InitRec","SSD"); | |
224 | //idt = fITS->DetType(kSSD); | |
225 | AliITSsegmentationSSD *segSSD = (AliITSsegmentationSSD*) | |
226 | fDetTypeRec->GetSegmentationModel(2); | |
227 | TClonesArray *digSSD = fDetTypeRec->DigitsAddress(kSSD); | |
88cb7938 | 228 | AliITSClusterFinderSSD *recSSD =new AliITSClusterFinderSSD(segSSD, |
7d62fb64 | 229 | digSSD); |
230 | recSSD->SetITSgeom(fDetTypeRec->GetITSgeom()); | |
231 | fDetTypeRec->SetReconstructionModel(kSSD,recSSD); | |
e69020a0 | 232 | } // end if fDet[kSSD] |
7d62fb64 | 233 | */ |
234 | fDetTypeRec->SetDefaultClusterFinders(); | |
88cb7938 | 235 | Info("InitRec"," Done\n"); |
e69020a0 | 236 | return kTRUE; |
237 | } | |
238 | //______________________________________________________________________ | |
239 | void AliITSreconstruction::Exec(const Option_t *opt){ | |
240 | // Main reconstruction function. | |
241 | // Inputs: | |
242 | // Option_t * opt list of subdetector to digitize. =0 all. | |
243 | // Outputs: | |
244 | // none. | |
245 | // Return: | |
246 | // none. | |
247 | Option_t *lopt; | |
88cb7938 | 248 | Int_t evnt; |
e69020a0 | 249 | |
250 | if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS")||opt==0){ | |
88cb7938 | 251 | fDet[0] = fDet[1] = fDet[2] = kTRUE; |
252 | lopt = "All"; | |
e69020a0 | 253 | }else{ |
88cb7938 | 254 | fDet[0] = fDet[1] = fDet[2] = kFALSE; |
255 | if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE; | |
256 | if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE; | |
257 | if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE; | |
258 | if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All"; | |
259 | else lopt = opt; | |
e69020a0 | 260 | } // end if strstr(opt,...) |
261 | ||
262 | if(!fInit){ | |
88cb7938 | 263 | cout << "Initilization Failed, Can't run Exec." << endl; |
264 | return; | |
e69020a0 | 265 | } // end if !fInit |
88cb7938 | 266 | for(evnt=0;evnt<fEnt;evnt++) |
267 | { | |
268 | Info("Exec",""); | |
269 | Info("Exec","Processing Event %d",evnt); | |
270 | Info("Exec",""); | |
271 | ||
272 | fRunLoader->GetEvent(evnt); | |
273 | if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R"); | |
7d62fb64 | 274 | fDetTypeRec->MakeBranchR(0); |
275 | if (fLoader->TreeC() == 0x0){ | |
276 | fDetTypeRec->MakeTreeC(); | |
277 | fDetTypeRec->MakeBranchC(); | |
278 | } | |
279 | fDetTypeRec->SetTreeAddressR(fLoader->TreeR()); | |
280 | fDetTypeRec->SetTreeAddressD(fLoader->TreeD()); | |
281 | fDetTypeRec->DigitsToRecPoints(evnt,0,lopt); | |
e69020a0 | 282 | } // end for evnt |
f243fbe6 | 283 | } |
284 | //______________________________________________________________________ | |
285 | void AliITSreconstruction::SetOutputFile(TString filename){ | |
999cc3eb | 286 | // Set a new file name for recpoints. |
287 | // It must be called before Init() | |
288 | if(!fLoader)fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader"); | |
289 | if(fLoader){ | |
290 | Info("SetOutputFile","name for rec points is %s",filename.Data()); | |
291 | fLoader->SetRecPointsFileName(filename); | |
292 | } | |
293 | else { | |
294 | Error("SetOutputFile", | |
295 | "ITS loader not available. Not possible to set name: %s",filename.Data()); | |
296 | } | |
e69020a0 | 297 | } |