]>
Commit | Line | Data |
---|---|---|
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 | /* $Id$ */ | |
17 | ||
18 | ||
19 | /////////////////////////////////////////////////////////////////////////////// | |
20 | // | |
21 | // An overview of the basic philosophy of the ITS code development | |
22 | // and analysis is show in the figure below. | |
23 | //Begin_Html | |
24 | /* | |
25 | <img src="picts/ITS/ITS_Analysis_schema.gif"> | |
26 | </pre> | |
27 | <br clear=left> | |
28 | <font size=+2 color=red> | |
29 | <p>Roberto Barbera is in charge of the ITS Offline code (1999). | |
30 | <a href="mailto:roberto.barbera@ct.infn.it">Roberto Barbera</a>. | |
31 | </font> | |
32 | <pre> | |
33 | */ | |
34 | //End_Html | |
35 | // | |
36 | // AliITS. Inner Traking System base class. | |
37 | // This class contains the base procedures for the Inner Tracking System | |
38 | // | |
39 | //Begin_Html | |
40 | /* | |
41 | <img src="picts/ITS/AliITS_Class_Diagram.gif"> | |
42 | </pre> | |
43 | <br clear=left> | |
44 | <font size=+2 color=red> | |
45 | <p>This show the class diagram of the different elements that are part of | |
46 | the AliITS class. | |
47 | </font> | |
48 | <pre> | |
49 | */ | |
50 | //End_Html | |
51 | // | |
52 | // Version: 0 | |
53 | // Written by Rene Brun, Federico Carminati, and Roberto Barbera | |
54 | // | |
55 | // Version: 1 | |
56 | // Modified and documented by Bjorn S. Nilsen | |
57 | // July 11 1999 | |
58 | // | |
59 | // Version: 2 | |
60 | // Modified and documented by A. Bologna | |
61 | // October 18 1999 | |
62 | // | |
63 | // AliITS is the general base class for the ITS. Also see AliDetector for | |
64 | // futher information. | |
65 | // | |
66 | /////////////////////////////////////////////////////////////////////////////// | |
67 | ||
68 | #include <Riostream.h> | |
69 | #include <stdlib.h> | |
70 | ||
71 | #include <TBranch.h> | |
72 | #include <TClonesArray.h> | |
73 | #include <TFile.h> | |
74 | #include <TMath.h> | |
75 | #include <TObjectTable.h> | |
76 | #include <TROOT.h> | |
77 | #include <TRandom.h> | |
78 | #include <TString.h> | |
79 | #include <TTree.h> | |
80 | #include <TVector.h> | |
81 | #include <TVirtualMC.h> | |
82 | ||
83 | #include "AliConfig.h" | |
84 | #include "AliHeader.h" | |
85 | #include "AliITS.h" | |
86 | #include "AliITSClusterFinderSDD.h" | |
87 | #include "AliITSClusterFinderSPD.h" | |
88 | #include "AliITSClusterFinderSSD.h" | |
89 | #include "AliITSDetType.h" | |
90 | #include "AliITSLoader.h" | |
91 | #include "AliITSRawClusterSPD.h" | |
92 | #include "AliITSRawClusterSDD.h" | |
93 | #include "AliITSRawClusterSSD.h" | |
94 | #include "AliITSRecPoint.h" | |
95 | #include "AliITSdigitSPD.h" | |
96 | #include "AliITSdigitSDD.h" | |
97 | #include "AliITSdigitSSD.h" | |
98 | #include "AliITSgeom.h" | |
99 | #include "AliITShit.h" | |
100 | #include "AliITSmodule.h" | |
101 | #include "AliITSpList.h" | |
102 | #include "AliITSresponseSDD.h" | |
103 | #include "AliITSresponseSPD.h" | |
104 | #include "AliITSresponseSSD.h" | |
105 | #include "AliITSsegmentationSDD.h" | |
106 | #include "AliITSsegmentationSPD.h" | |
107 | #include "AliITSsegmentationSSD.h" | |
108 | #include "AliITSsimulationSDD.h" | |
109 | #include "AliITSsimulationSPD.h" | |
110 | #include "AliITSsimulationSSD.h" | |
111 | #include "AliMC.h" | |
112 | #include "AliITSDigitizer.h" | |
113 | #include "AliITSclustererV2.h" | |
114 | #include "AliITStrackerV2.h" | |
115 | #include "AliITSpidESD.h" | |
116 | #include "AliV0vertexer.h" | |
117 | #include "AliCascadeVertexer.h" | |
118 | #include "AliESD.h" | |
119 | #include "AliRun.h" | |
120 | ||
121 | ClassImp(AliITS) | |
122 | ||
123 | //______________________________________________________________________ | |
124 | AliITS::AliITS() : AliDetector() { | |
125 | // Default initializer for ITS | |
126 | // The default constructor of the AliITS class. In addition to | |
127 | // creating the AliITS class it zeros the variables fIshunt (a member | |
128 | // of AliDetector class), fEuclidOut, and fIdN, and zeros the pointers | |
129 | // fITSpoints, fIdSens, and fIdName. The AliDetector default constructor | |
130 | // is also called. | |
131 | // Inputs: | |
132 | // none. | |
133 | // Outputs: | |
134 | // none. | |
135 | // Return: | |
136 | // Blank ITS class. | |
137 | ||
138 | fIshunt = 0; // not zeroed in AliDetector. | |
139 | ||
140 | // AliITS variables. | |
141 | fEuclidOut = 0; | |
142 | fITSgeom = 0; | |
143 | fITSmodules = 0; | |
144 | fOpt = "All"; | |
145 | // SetDetectors(); // default to fOpt="All". This variable not written out. | |
146 | ||
147 | fIdN = 0; | |
148 | fIdName = 0; | |
149 | fIdSens = 0; | |
150 | ||
151 | fNDetTypes = kNTYPES; | |
152 | fDetTypes = 0; | |
153 | ||
154 | fSDigits = 0; | |
155 | fNSDigits = 0; | |
156 | ||
157 | fNdtype = 0; | |
158 | fDtype = 0; | |
159 | ||
160 | fCtype = 0; | |
161 | fNctype = 0; | |
162 | ||
163 | fRecPoints = 0; | |
164 | fNRecPoints = 0; | |
165 | ||
166 | SetMarkerColor(kRed); | |
167 | } | |
168 | //______________________________________________________________________ | |
169 | AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){ | |
170 | // The standard Constructor for the ITS class. In addition to | |
171 | // creating the AliITS class, it allocates memory for the TClonesArrays | |
172 | // fHits, fSDigits, fDigits, fITSpoints, and the TObjArray of fCtype | |
173 | // (clusters). It also zeros the variables | |
174 | // fIshunt (a member of AliDetector class), fEuclidOut, and fIdN, and zeros | |
175 | // the pointers fIdSens and fIdName. To help in displaying hits via the | |
176 | // ROOT macro display.C AliITS also sets the marker color to red. The | |
177 | // variables passes with this constructor, const char *name and *title, | |
178 | // are used by the constructor of AliDetector class. See AliDetector | |
179 | // class for a description of these parameters and its constructor | |
180 | // functions. | |
181 | // Inputs: | |
182 | // const char *name Detector name. Should always be "ITS" | |
183 | // const char *title Detector title. | |
184 | // Outputs: | |
185 | // none. | |
186 | // Return: | |
187 | // An ITS class. | |
188 | ||
189 | fIshunt = 0; // not zeroed in AliDetector | |
190 | fHits = new TClonesArray("AliITShit", 1560);//not done in AliDetector | |
191 | gAlice->GetMCApp()->AddHitList(fHits); // Not done in AliDetector. | |
192 | ||
193 | fEuclidOut = 0; | |
194 | fITSgeom = 0; | |
195 | fITSmodules = 0; | |
196 | SetDetectors(); // default to fOpt="All". This variable not written out. | |
197 | ||
198 | fIdN = 0; | |
199 | fIdName = 0; | |
200 | fIdSens = 0; | |
201 | ||
202 | fNDetTypes = kNTYPES; | |
203 | fDetTypes = new TObjArray(fNDetTypes); | |
204 | ||
205 | fSDigits = new TClonesArray("AliITSpListItem",1000); | |
206 | fNSDigits = 0; | |
207 | ||
208 | fNdtype = new Int_t[fNDetTypes]; | |
209 | fDtype = new TObjArray(fNDetTypes); | |
210 | ||
211 | fCtype = new TObjArray(fNDetTypes); | |
212 | fNctype = new Int_t[fNDetTypes]; | |
213 | ||
214 | fRecPoints = new TClonesArray("AliITSRecPoint",1000); | |
215 | fNRecPoints = 0; | |
216 | ||
217 | Int_t i; | |
218 | for(i=0;i<fNDetTypes;i++) { | |
219 | fDetTypes->AddAt(new AliITSDetType(),i); | |
220 | fNdtype[i] = 0; | |
221 | fNctype[i] = 0; | |
222 | } // end for i | |
223 | ||
224 | SetMarkerColor(kRed); | |
225 | ||
226 | } | |
227 | //______________________________________________________________________ | |
228 | AliITS::~AliITS(){ | |
229 | // Default destructor for ITS. | |
230 | // The default destructor of the AliITS class. In addition to deleting | |
231 | // the AliITS class it deletes the memory pointed to by the fHits, fDigits, | |
232 | // fSDigits, fCtype, fITSmodules, fITSgeom, fRecPoints, fIdSens, fIdName, | |
233 | // fITSpoints, fDetType and it's contents. | |
234 | // Inputs: | |
235 | // none. | |
236 | // Outputs: | |
237 | // none. | |
238 | // Return: | |
239 | // none. | |
240 | ||
241 | if (fHits) { | |
242 | fHits->Delete(); | |
243 | delete fHits; | |
244 | fHits=0; | |
245 | } | |
246 | if (fSDigits) { | |
247 | fSDigits->Delete(); | |
248 | delete fSDigits; | |
249 | fSDigits=0; | |
250 | } | |
251 | if (fDigits) { | |
252 | fDigits->Delete(); | |
253 | delete fDigits; | |
254 | fDigits=0; | |
255 | } | |
256 | if (fRecPoints) { | |
257 | fRecPoints->Delete(); | |
258 | delete fRecPoints; | |
259 | fRecPoints=0; | |
260 | } | |
261 | delete[] fIdName; // Array of TStrings | |
262 | delete[] fIdSens; | |
263 | if(fITSmodules) { | |
264 | this->ClearModules(); | |
265 | delete fITSmodules; | |
266 | fITSmodules = 0; | |
267 | }// end if fITSmodules!=0 | |
268 | ||
269 | if(fDtype) { | |
270 | fDtype->Delete(); | |
271 | delete fDtype; | |
272 | } // end if fDtype | |
273 | delete [] fNdtype; | |
274 | if (fCtype) { | |
275 | fCtype->Delete(); | |
276 | delete fCtype; | |
277 | fCtype = 0; | |
278 | } // end if fCtype | |
279 | delete [] fNctype; | |
280 | ||
281 | if (fDetTypes) { | |
282 | fDetTypes->Delete(); | |
283 | delete fDetTypes; | |
284 | fDetTypes = 0; | |
285 | } // end if fDetTypes | |
286 | ||
287 | ||
288 | if (fITSgeom) delete fITSgeom; | |
289 | } | |
290 | //______________________________________________________________________ | |
291 | AliITS::AliITS(const AliITS &source) : AliDetector(source){ | |
292 | // Copy constructor. This is a function which is not allowed to be | |
293 | // done to the ITS. It exits with an error. | |
294 | // Inputs: | |
295 | // AliITS &source An AliITS class. | |
296 | // Outputs: | |
297 | // none. | |
298 | // Return: | |
299 | // none. | |
300 | ||
301 | if(this==&source) return; | |
302 | Error("Copy constructor", | |
303 | "You are not allowed to make a copy of the AliITS"); | |
304 | exit(1); | |
305 | } | |
306 | //______________________________________________________________________ | |
307 | AliITS& AliITS::operator=(AliITS &source){ | |
308 | // Assignment operator. This is a function which is not allowed to be | |
309 | // done to the ITS. It exits with an error. | |
310 | // Inputs: | |
311 | // AliITS &source An AliITS class. | |
312 | // Outputs: | |
313 | // none. | |
314 | // Return: | |
315 | // none. | |
316 | ||
317 | if(this==&source) return *this; | |
318 | Error("operator=","You are not allowed to make a copy of the AliITS"); | |
319 | exit(1); | |
320 | return *this; //fake return | |
321 | } | |
322 | //______________________________________________________________________ | |
323 | Int_t AliITS::DistancetoPrimitive(Int_t,Int_t) const{ | |
324 | // Distance from mouse to ITS on the screen. Dummy routine | |
325 | // A dummy routine used by the ROOT macro display.C to allow for the | |
326 | // use of the mouse (pointing device) in the macro. In general this should | |
327 | // never be called. If it is it returns the number 9999 for any value of | |
328 | // x and y. | |
329 | // Inputs: | |
330 | // Int_t Dummy screen coordinate. | |
331 | // Int_t Dummy screen coordinate. | |
332 | // Outputs: | |
333 | // none. | |
334 | // Return: | |
335 | // Int_t Dummy = 9999 distance to ITS. | |
336 | ||
337 | return 9999; | |
338 | } | |
339 | //______________________________________________________________________ | |
340 | void AliITS::Init(){ | |
341 | // Initializer ITS after it has been built | |
342 | // This routine initializes the AliITS class. It is intended to be | |
343 | // called from the Init function in AliITSv?. Besides displaying a banner | |
344 | // indicating that it has been called it initializes the array fIdSens | |
345 | // and sets the default segmentation, response, digit and raw cluster | |
346 | // classes therefore it should be called after a call to CreateGeometry. | |
347 | // Inputs: | |
348 | // none. | |
349 | // Outputs: | |
350 | // none. | |
351 | // Return: | |
352 | // none. | |
353 | Int_t i; | |
354 | ||
355 | SetDefaults(); | |
356 | // Array of TStrings | |
357 | for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]); | |
358 | } | |
359 | //______________________________________________________________________ | |
360 | void AliITS::SetDefaults(){ | |
361 | // sets the default segmentation, response, digit and raw cluster classes. | |
362 | // Inputs: | |
363 | // none. | |
364 | // Outputs: | |
365 | // none. | |
366 | // Return: | |
367 | // none. | |
368 | ||
369 | if(fDebug) printf("%s: SetDefaults\n",ClassName()); | |
370 | ||
371 | AliITSDetType *iDetType; | |
372 | ||
373 | //SPD | |
374 | iDetType=DetType(0); | |
375 | if (!iDetType->GetSegmentationModel()) { | |
376 | AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(fITSgeom); | |
377 | SetSegmentationModel(0,seg0); | |
378 | } // end if | |
379 | if (!iDetType->GetResponseModel()) { | |
380 | SetResponseModel(0,new AliITSresponseSPD()); | |
381 | } // end if | |
382 | // set digit and raw cluster classes to be used | |
383 | ||
384 | const char *kData0=(iDetType->GetResponseModel())->DataType(); | |
385 | if (strstr(kData0,"real")) { | |
386 | iDetType->ClassNames("AliITSdigit","AliITSRawClusterSPD"); | |
387 | } else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD"); | |
388 | ||
389 | // SDD | |
390 | iDetType=DetType(1); | |
391 | if (!iDetType->GetResponseModel()) { | |
392 | SetResponseModel(1,new AliITSresponseSDD("simulated")); | |
393 | } // end if | |
394 | AliITSresponse *resp1=iDetType->GetResponseModel(); | |
395 | if (!iDetType->GetSegmentationModel()) { | |
396 | AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(fITSgeom,resp1); | |
397 | SetSegmentationModel(1,seg1); | |
398 | } // end if | |
399 | const char *kData1=(iDetType->GetResponseModel())->DataType(); | |
400 | const char *kopt=iDetType->GetResponseModel()->ZeroSuppOption(); | |
401 | if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D")) || strstr(kData1,"real") ){ | |
402 | iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD"); | |
403 | } else iDetType->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD"); | |
404 | ||
405 | // SSD | |
406 | iDetType=DetType(2); | |
407 | if (!iDetType->GetSegmentationModel()) { | |
408 | AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(fITSgeom); | |
409 | SetSegmentationModel(2,seg2); | |
410 | } // end if | |
411 | if (!iDetType->GetResponseModel()) { | |
412 | SetResponseModel(2,new AliITSresponseSSD("simulated")); | |
413 | } // end if | |
414 | const char *kData2=(iDetType->GetResponseModel())->DataType(); | |
415 | if (strstr(kData2,"real")) { | |
416 | iDetType->ClassNames("AliITSdigit","AliITSRawClusterSSD"); | |
417 | } else iDetType->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD"); | |
418 | ||
419 | if (kNTYPES>3) { | |
420 | Warning("SetDefaults", | |
421 | "Only the three basic detector types are initialized!"); | |
422 | } // end if | |
423 | } | |
424 | //______________________________________________________________________ | |
425 | void AliITS::SetDefaultSimulation(){ | |
426 | // sets the default simulation. | |
427 | // Inputs: | |
428 | // none. | |
429 | // Outputs: | |
430 | // none. | |
431 | // Return: | |
432 | // none. | |
433 | ||
434 | AliITSDetType *iDetType; | |
435 | AliITSsimulation *sim; | |
436 | iDetType=DetType(0); | |
437 | sim = iDetType->GetSimulationModel(); | |
438 | if (!sim) { | |
439 | AliITSsegmentation *seg0= | |
440 | (AliITSsegmentation*)iDetType->GetSegmentationModel(); | |
441 | AliITSresponse *res0 = (AliITSresponse*)iDetType->GetResponseModel(); | |
442 | AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0); | |
443 | SetSimulationModel(0,sim0); | |
444 | }else{ // simulation exists, make sure it is set up properly. | |
445 | ((AliITSsimulationSPD*)sim)->Init( | |
446 | (AliITSsegmentationSPD*) iDetType->GetSegmentationModel(), | |
447 | (AliITSresponseSPD*) iDetType->GetResponseModel()); | |
448 | // if(sim->GetResponseModel()==0) sim->SetResponseModel( | |
449 | // (AliITSresponse*)iDetType->GetResponseModel()); | |
450 | // if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel( | |
451 | // (AliITSsegmentation*)iDetType->GetSegmentationModel()); | |
452 | } // end if | |
453 | iDetType=DetType(1); | |
454 | sim = iDetType->GetSimulationModel(); | |
455 | if (!sim) { | |
456 | AliITSsegmentation *seg1= | |
457 | (AliITSsegmentation*)iDetType->GetSegmentationModel(); | |
458 | AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel(); | |
459 | AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1); | |
460 | SetSimulationModel(1,sim1); | |
461 | }else{ // simulation exists, make sure it is set up properly. | |
462 | ((AliITSsimulationSDD*)sim)->Init( | |
463 | (AliITSsegmentationSDD*) iDetType->GetSegmentationModel(), | |
464 | (AliITSresponseSDD*) iDetType->GetResponseModel()); | |
465 | // if(sim->GetResponseModel()==0) sim->SetResponseModel( | |
466 | // (AliITSresponse*)iDetType->GetResponseModel()); | |
467 | // if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel( | |
468 | // (AliITSsegmentation*)iDetType->GetSegmentationModel()); | |
469 | } //end if | |
470 | iDetType=DetType(2); | |
471 | sim = iDetType->GetSimulationModel(); | |
472 | if (!sim) { | |
473 | AliITSsegmentation *seg2= | |
474 | (AliITSsegmentation*)iDetType->GetSegmentationModel(); | |
475 | AliITSresponse *res2 = (AliITSresponse*)iDetType->GetResponseModel(); | |
476 | AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2); | |
477 | SetSimulationModel(2,sim2); | |
478 | }else{ // simulation exists, make sure it is set up properly. | |
479 | ((AliITSsimulationSSD*)sim)->Init( | |
480 | (AliITSsegmentationSSD*) iDetType->GetSegmentationModel(), | |
481 | (AliITSresponseSSD*) iDetType->GetResponseModel()); | |
482 | // if(sim->GetResponseModel()==0) sim->SetResponseModel( | |
483 | // (AliITSresponse*)iDetType->GetResponseModel()); | |
484 | // if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel( | |
485 | // (AliITSsegmentation*)iDetType->GetSegmentationModel()); | |
486 | } // end if | |
487 | } | |
488 | //______________________________________________________________________ | |
489 | void AliITS::SetDefaultClusterFinders(){ | |
490 | // Sets the default cluster finders. Used in finding RecPoints. | |
491 | // Inputs: | |
492 | // none. | |
493 | // Outputs: | |
494 | // none. | |
495 | // Return: | |
496 | // none. | |
497 | ||
498 | MakeTreeC(); | |
499 | AliITSDetType *iDetType; | |
500 | ||
501 | // SPD | |
502 | iDetType=DetType(0); | |
503 | if (!iDetType->GetReconstructionModel()) { | |
504 | AliITSsegmentation *seg0 = | |
505 | (AliITSsegmentation*)iDetType->GetSegmentationModel(); | |
506 | TClonesArray *dig0=DigitsAddress(0); | |
507 | TClonesArray *recp0=ClustersAddress(0); | |
508 | AliITSClusterFinderSPD *rec0 = new AliITSClusterFinderSPD(seg0,dig0, | |
509 | recp0); | |
510 | SetReconstructionModel(0,rec0); | |
511 | } // end if | |
512 | ||
513 | // SDD | |
514 | iDetType=DetType(1); | |
515 | if (!iDetType->GetReconstructionModel()) { | |
516 | AliITSsegmentation *seg1 = | |
517 | (AliITSsegmentation*)iDetType->GetSegmentationModel(); | |
518 | AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel(); | |
519 | TClonesArray *dig1=DigitsAddress(1); | |
520 | TClonesArray *recp1=ClustersAddress(1); | |
521 | AliITSClusterFinderSDD *rec1 = | |
522 | new AliITSClusterFinderSDD(seg1,res1,dig1,recp1); | |
523 | SetReconstructionModel(1,rec1); | |
524 | } // end if | |
525 | ||
526 | // SSD | |
527 | iDetType=DetType(2); | |
528 | if (!iDetType->GetReconstructionModel()) { | |
529 | AliITSsegmentation *seg2= | |
530 | (AliITSsegmentation*)iDetType->GetSegmentationModel(); | |
531 | TClonesArray *dig2=DigitsAddress(2); | |
532 | AliITSClusterFinderSSD *rec2= new AliITSClusterFinderSSD(seg2,dig2); | |
533 | SetReconstructionModel(2,rec2); | |
534 | } // end if | |
535 | } | |
536 | //______________________________________________________________________ | |
537 | void AliITS::MakeBranch(Option_t* option){ | |
538 | // Creates Tree branches for the ITS. | |
539 | // Inputs: | |
540 | // Option_t *option String of Tree types S,D, and/or R. | |
541 | // const char *file String of the file name where these branches | |
542 | // are to be stored. If blank then these branches | |
543 | // are written to the same tree as the Hits were | |
544 | // read from. | |
545 | // Outputs: | |
546 | // none. | |
547 | // Return: | |
548 | // none. | |
549 | Bool_t cH = (strstr(option,"H")!=0); | |
550 | Bool_t cS = (strstr(option,"S")!=0); | |
551 | Bool_t cD = (strstr(option,"D")!=0); | |
552 | Bool_t cR = (strstr(option,"R")!=0); | |
553 | Bool_t cRF = (strstr(option,"RF")!=0); | |
554 | ||
555 | if(cRF)cR = kFALSE; | |
556 | if(cH && (fHits == 0x0)) fHits = new TClonesArray("AliITShit", 1560); | |
557 | ||
558 | AliDetector::MakeBranch(option); | |
559 | ||
560 | if(cS) MakeBranchS(0); | |
561 | if(cD) MakeBranchD(0); | |
562 | if(cR) MakeBranchR(0); | |
563 | if(cRF) MakeBranchRF(0); | |
564 | } | |
565 | //______________________________________________________________________ | |
566 | void AliITS::SetTreeAddress(){ | |
567 | // Set branch address for the Trees. | |
568 | // Inputs: | |
569 | // none. | |
570 | // Outputs: | |
571 | // none. | |
572 | // Return: | |
573 | // none. | |
574 | TTree *treeS = fLoader->TreeS(); | |
575 | TTree *treeD = fLoader->TreeD(); | |
576 | TTree *treeR = fLoader->TreeR(); | |
577 | if (fLoader->TreeH() && (fHits == 0x0)) fHits = new TClonesArray("AliITShit", 1560); | |
578 | ||
579 | AliDetector::SetTreeAddress(); | |
580 | ||
581 | SetTreeAddressS(treeS); | |
582 | SetTreeAddressD(treeD); | |
583 | SetTreeAddressR(treeR); | |
584 | } | |
585 | //______________________________________________________________________ | |
586 | AliITSDetType* AliITS::DetType(Int_t id){ | |
587 | // Return pointer to id detector type. | |
588 | // Inputs: | |
589 | // Int_t id detector id number. | |
590 | // Outputs: | |
591 | // none. | |
592 | // Return: | |
593 | // returned, a pointer to a AliITSDetType. | |
594 | ||
595 | return ((AliITSDetType*) fDetTypes->At(id)); | |
596 | } | |
597 | //______________________________________________________________________ | |
598 | void AliITS::SetResponseModel(Int_t id, AliITSresponse *response){ | |
599 | // Set the response model for the id detector type. | |
600 | // Inputs: | |
601 | // Int_t id detector id number. | |
602 | // AliITSresponse* a pointer containing an instance of AliITSresponse | |
603 | // to be stored/owned b y AliITSDetType. | |
604 | // Outputs: | |
605 | // none. | |
606 | // Return: | |
607 | // none. | |
608 | ||
609 | ((AliITSDetType*) fDetTypes->At(id))->ResponseModel(response); | |
610 | } | |
611 | //______________________________________________________________________ | |
612 | void AliITS::SetSegmentationModel(Int_t id, AliITSsegmentation *seg){ | |
613 | // Set the segmentation model for the id detector type. | |
614 | // Inputs: | |
615 | // Int_t id detector id number. | |
616 | // AliITSsegmentation* a pointer containing an instance of | |
617 | // AliITSsegmentation to be stored/owned b y | |
618 | // AliITSDetType. | |
619 | // Outputs: | |
620 | // none. | |
621 | // Return: | |
622 | // none. | |
623 | ||
624 | ((AliITSDetType*) fDetTypes->At(id))->SegmentationModel(seg); | |
625 | } | |
626 | //______________________________________________________________________ | |
627 | void AliITS::SetSimulationModel(Int_t id, AliITSsimulation *sim){ | |
628 | // Set the simulation model for the id detector type. | |
629 | // Inputs: | |
630 | // Int_t id detector id number. | |
631 | // AliITSresponse* a pointer containing an instance of AliITSresponse | |
632 | // to be stored/owned b y AliITSDetType. | |
633 | // Outputs: | |
634 | // none. | |
635 | // Return: | |
636 | // none. | |
637 | ||
638 | ((AliITSDetType*) fDetTypes->At(id))->SimulationModel(sim); | |
639 | ||
640 | } | |
641 | //______________________________________________________________________ | |
642 | void AliITS::SetReconstructionModel(Int_t id, AliITSClusterFinder *reconst){ | |
643 | // Set the cluster finder model for the id detector type. | |
644 | // Inputs: | |
645 | // Int_t id detector id number. | |
646 | // AliITSClusterFinder* a pointer containing an instance of | |
647 | // AliITSClusterFinder to be stored/owned b y | |
648 | // AliITSDetType. | |
649 | // Outputs: | |
650 | // none. | |
651 | // Return: | |
652 | // none. | |
653 | ||
654 | ((AliITSDetType*) fDetTypes->At(id))->ReconstructionModel(reconst); | |
655 | } | |
656 | //______________________________________________________________________ | |
657 | void AliITS::SetClasses(Int_t id, const char *digit, const char *cluster){ | |
658 | // Set the digit and cluster classes name to be used for the id detector | |
659 | // type. | |
660 | // Inputs: | |
661 | // Int_t id detector id number. | |
662 | // const char *digit Digit class name for detector id. | |
663 | // const char *cluster Cluster class name for detector id. | |
664 | // Outputs: | |
665 | // none. | |
666 | // Return: | |
667 | // none. | |
668 | ||
669 | ((AliITSDetType*) fDetTypes->At(id))->ClassNames(digit,cluster); | |
670 | } | |
671 | //______________________________________________________________________ | |
672 | void AliITS::AddHit(Int_t track, Int_t *vol, Float_t *hits){ | |
673 | // Add an ITS hit | |
674 | // The function to add information to the AliITShit class. See the | |
675 | // AliITShit class for a full description. This function allocates the | |
676 | // necessary new space for the hit information and passes the variable | |
677 | // track, and the pointers *vol and *hits to the AliITShit constructor | |
678 | // function. | |
679 | // Inputs: | |
680 | // Int_t track Track number which produced this hit. | |
681 | // Int_t *vol Array of Integer Hit information. See AliITShit.h | |
682 | // Float_t *hits Array of Floating Hit information. see AliITShit.h | |
683 | // Outputs: | |
684 | // none. | |
685 | // Return: | |
686 | // none. | |
687 | ||
688 | TClonesArray &lhits = *fHits; | |
689 | new(lhits[fNhits++]) AliITShit(fIshunt,track,vol,hits); | |
690 | } | |
691 | //______________________________________________________________________ | |
692 | void AliITS::InitModules(Int_t size,Int_t &nmodules){ | |
693 | // Initialize the modules array. | |
694 | // Inputs: | |
695 | // Int_t size Size of array of the number of modules to be | |
696 | // created. If size <=0 then the number of modules | |
697 | // is gotten from AliITSgeom class kept in fITSgeom. | |
698 | // Outputs: | |
699 | // Int_t &nmodules The number of modules existing. | |
700 | // Return: | |
701 | // none. | |
702 | ||
703 | if(fITSmodules){ | |
704 | fITSmodules->Delete(); | |
705 | delete fITSmodules; | |
706 | } // end fir fITSmoudles | |
707 | ||
708 | Int_t nl,indexMAX,index; | |
709 | ||
710 | if(size<=0){ // default to using data stored in AliITSgeom | |
711 | if(fITSgeom==0) { | |
712 | Error("InitModules","fITSgeom not defined"); | |
713 | return; | |
714 | } // end if fITSgeom==0 | |
715 | nl = fITSgeom->GetNlayers(); | |
716 | indexMAX = fITSgeom->GetModuleIndex(nl,fITSgeom->GetNladders(nl), | |
717 | fITSgeom->GetNdetectors(nl))+1; | |
718 | nmodules = indexMAX; | |
719 | fITSmodules = new TObjArray(indexMAX); | |
720 | for(index=0;index<indexMAX;index++){ | |
721 | fITSmodules->AddAt( new AliITSmodule(index),index); | |
722 | } // end for index | |
723 | }else{ | |
724 | fITSmodules = new TObjArray(size); | |
725 | for(index=0;index<size;index++) { | |
726 | fITSmodules->AddAt( new AliITSmodule(index),index); | |
727 | } // end for index | |
728 | ||
729 | nmodules = size; | |
730 | } // end i size<=0 | |
731 | } | |
732 | //______________________________________________________________________ | |
733 | void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules, | |
734 | Option_t *option, const char *filename){ | |
735 | // fill the modules with the sorted by module hits; add hits from | |
736 | // background if option=Add. | |
737 | // Inputs: | |
738 | // Int_t evnt Event to be processed. | |
739 | // Int_t bgrev Background Hit tree number. | |
740 | // Int_t nmodules Not used. | |
741 | // Option_t *option String indicating if merging hits or not. To | |
742 | // merge hits set equal to "Add". Otherwise no | |
743 | // background hits are considered. | |
744 | // Test_t *filename File name containing the background hits.. | |
745 | // Outputs: | |
746 | // none. | |
747 | // Return: | |
748 | // none. | |
749 | static TTree *trH1; //Tree with background hits | |
750 | static Bool_t first=kTRUE; | |
751 | static TFile *file; | |
752 | const char *addBgr = strstr(option,"Add"); | |
753 | ||
754 | evnt = nmodules; // Dummy use of variables to remove warnings | |
755 | if (addBgr ) { | |
756 | if(first) { | |
757 | file=new TFile(filename); | |
758 | } // end if first | |
759 | first=kFALSE; | |
760 | file->cd(); | |
761 | file->ls(); | |
762 | // Get Hits Tree header from file | |
763 | if(trH1) delete trH1; | |
764 | trH1=0; | |
765 | ||
766 | char treeName[20]; | |
767 | sprintf(treeName,"TreeH%d",bgrev); | |
768 | trH1 = (TTree*)gDirectory->Get(treeName); | |
769 | if (!trH1) { | |
770 | Error("FillModules","cannot find Hits Tree for event:%d",bgrev); | |
771 | } // end if !trH1 | |
772 | // Set branch addresses | |
773 | } // end if addBgr | |
774 | ||
775 | FillModules(fLoader->TreeH(),0); // fill from this file's tree. | |
776 | ||
777 | if (addBgr ) { | |
778 | FillModules(trH1,10000000); // Default mask 10M. | |
779 | TTree *fAli=fLoader->GetRunLoader()->TreeK(); | |
780 | TFile *fileAli=0; | |
781 | if (fAli) fileAli =fAli->GetCurrentFile(); | |
782 | fileAli->cd(); | |
783 | } // end if add | |
784 | } | |
785 | //______________________________________________________________________ | |
786 | void AliITS::FillModules(TTree *treeH, Int_t mask) { | |
787 | // fill the modules with the sorted by module hits; | |
788 | // can be called many times to do a merging | |
789 | // Inputs: | |
790 | // TTree *treeH The tree containing the hits to be copied into | |
791 | // the modules. | |
792 | // Int_t mask The track number mask to indecate which file | |
793 | // this hits came from. | |
794 | // Outputs: | |
795 | // none. | |
796 | // Return: | |
797 | // none. | |
798 | ||
799 | if (treeH == 0x0) | |
800 | { | |
801 | Error("FillModules","Tree is NULL"); | |
802 | } | |
803 | Int_t lay,lad,det,index; | |
804 | AliITShit *itsHit=0; | |
805 | AliITSmodule *mod=0; | |
806 | char branchname[20]; | |
807 | sprintf(branchname,"%s",GetName()); | |
808 | TBranch *branch = treeH->GetBranch(branchname); | |
809 | if (!branch) { | |
810 | Error("FillModules","%s branch in TreeH not found",branchname); | |
811 | return; | |
812 | } // end if !branch | |
813 | branch->SetAddress(&fHits); | |
814 | Int_t nTracks =(Int_t) treeH->GetEntries(); | |
815 | Int_t iPrimTrack,h; | |
816 | for(iPrimTrack=0; iPrimTrack<nTracks; iPrimTrack++){ | |
817 | ResetHits(); | |
818 | Int_t nBytes = treeH->GetEvent(iPrimTrack); | |
819 | if (nBytes <= 0) continue; | |
820 | Int_t nHits = fHits->GetEntriesFast(); | |
821 | for(h=0; h<nHits; h++){ | |
822 | itsHit = (AliITShit *)fHits->UncheckedAt(h); | |
823 | itsHit->GetDetectorID(lay,lad,det); | |
824 | if (fITSgeom) { | |
825 | index = fITSgeom->GetModuleIndex(lay,lad,det); | |
826 | } else { | |
827 | index=det-1; // This should not be used. | |
828 | } // end if [You must have fITSgeom for this to work!] | |
829 | mod = GetModule(index); | |
830 | itsHit->SetTrack(itsHit->GetTrack()+mask); // Set track mask. | |
831 | mod->AddHit(itsHit,iPrimTrack,h); | |
832 | } // end loop over hits | |
833 | } // end loop over tracks | |
834 | } | |
835 | //______________________________________________________________________ | |
836 | void AliITS::ClearModules(){ | |
837 | // Clear the modules TObjArray. | |
838 | // Inputs: | |
839 | // none. | |
840 | // Outputs: | |
841 | // none. | |
842 | ||
843 | if(fITSmodules) fITSmodules->Delete(); | |
844 | } | |
845 | //______________________________________________________________________ | |
846 | void AliITS::MakeBranchS(const char *fl){ | |
847 | // Creates Tree Branch for the ITS summable digits. | |
848 | // Inputs: | |
849 | // cont char *fl File name where SDigits branch is to be written | |
850 | // to. If blank it write the SDigits to the same | |
851 | // file in which the Hits were found. | |
852 | // Outputs: | |
853 | // none. | |
854 | // Return: | |
855 | // none. | |
856 | Int_t buffersize = 4000; | |
857 | char branchname[30]; | |
858 | ||
859 | // only one branch for SDigits. | |
860 | sprintf(branchname,"%s",GetName()); | |
861 | ||
862 | ||
863 | if(fLoader->TreeS()){ | |
864 | if (fSDigits == 0x0) fSDigits = new TClonesArray("AliITSpListItem",1000); | |
865 | MakeBranchInTree(fLoader->TreeS(),branchname,&fSDigits,buffersize,fl); | |
866 | } // end if | |
867 | } | |
868 | //______________________________________________________________________ | |
869 | void AliITS::SetTreeAddressS(TTree *treeS){ | |
870 | // Set branch address for the ITS summable digits Trees. | |
871 | // Inputs: | |
872 | // TTree *treeS Tree containing the SDigits. | |
873 | // Outputs: | |
874 | // none. | |
875 | // Return: | |
876 | // none. | |
877 | char branchname[30]; | |
878 | ||
879 | if(!treeS) return; | |
880 | if (fSDigits == 0x0) fSDigits = new TClonesArray("AliITSpListItem",1000); | |
881 | TBranch *branch; | |
882 | sprintf(branchname,"%s",GetName()); | |
883 | branch = treeS->GetBranch(branchname); | |
884 | if (branch) branch->SetAddress(&fSDigits); | |
885 | } | |
886 | //______________________________________________________________________ | |
887 | void AliITS::MakeBranchInTreeD(TTree *treeD,const char *file){ | |
888 | // Creates Tree branches for the ITS. | |
889 | // Inputs: | |
890 | // TTree *treeD Pointer to the Digits Tree. | |
891 | // cont char *file File name where Digits branch is to be written | |
892 | // to. If blank it write the SDigits to the same | |
893 | // file in which the Hits were found. | |
894 | // Outputs: | |
895 | // none. | |
896 | // Return: | |
897 | // none. | |
898 | Int_t buffersize = 4000; | |
899 | char branchname[30]; | |
900 | ||
901 | sprintf(branchname,"%s",GetName()); | |
902 | // one branch for digits per type of detector | |
903 | const char *det[3] = {"SPD","SDD","SSD"}; | |
904 | char digclass[40]; | |
905 | char clclass[40]; | |
906 | Int_t i; | |
907 | for (i=0; i<kNTYPES ;i++) { | |
908 | DetType(i)->GetClassNames(digclass,clclass); | |
909 | // digits | |
910 | if (fDtype == 0x0) fDtype = new TObjArray(fNDetTypes); | |
911 | if(!(fDtype->At(i))) fDtype->AddAt(new TClonesArray(digclass,1000),i); | |
912 | else ResetDigits(i); | |
913 | } // end for i | |
914 | for (i=0; i<kNTYPES ;i++) { | |
915 | if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]); | |
916 | else sprintf(branchname,"%sDigits%d",GetName(),i+1); | |
917 | if (fDtype && treeD) { | |
918 | MakeBranchInTree(treeD, branchname, &((*fDtype)[i]),buffersize,file); | |
919 | } // end if | |
920 | } // end for i | |
921 | } | |
922 | //______________________________________________________________________ | |
923 | void AliITS::SetTreeAddressD(TTree *treeD){ | |
924 | // Set branch address for the Trees. | |
925 | // Inputs: | |
926 | // TTree *treeD Tree containing the Digits. | |
927 | // Outputs: | |
928 | // none. | |
929 | // Return: | |
930 | // none. | |
931 | char branchname[30]; | |
932 | const char *det[3] = {"SPD","SDD","SSD"}; | |
933 | TBranch *branch; | |
934 | char digclass[40]; | |
935 | char clclass[40]; | |
936 | Int_t i; | |
937 | ||
938 | if(!treeD) return; | |
939 | for (i=0; i<kNTYPES; i++) { | |
940 | DetType(i)->GetClassNames(digclass,clclass); | |
941 | // digits | |
942 | if (fDtype == 0x0) fDtype = new TObjArray(fNDetTypes); | |
943 | if(!(fDtype->At(i))) fDtype->AddAt(new TClonesArray(digclass,1000),i); | |
944 | else ResetDigits(i); | |
945 | if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]); | |
946 | else sprintf(branchname,"%sDigits%d",GetName(),i+1); | |
947 | if (fDtype) { | |
948 | branch = treeD->GetBranch(branchname); | |
949 | if (branch) branch->SetAddress(&((*fDtype)[i])); | |
950 | } // end if fDtype | |
951 | } // end for i | |
952 | } | |
953 | //______________________________________________________________________ | |
954 | void AliITS::Hits2SDigits(){ | |
955 | // Standard Hits to summable Digits function. | |
956 | // Inputs: | |
957 | // none. | |
958 | // Outputs: | |
959 | // none. | |
960 | ||
961 | // return; // Using Hits in place of the larger sDigits. | |
962 | fLoader->LoadHits("read"); | |
963 | fLoader->LoadSDigits("recreate"); | |
964 | AliRunLoader* rl = fLoader->GetRunLoader(); | |
965 | ||
966 | for (Int_t iEvent = 0; iEvent < rl->GetNumberOfEvents(); iEvent++) { | |
967 | // Do the Hits to Digits operation. Use Standard input values. | |
968 | // Event number from file, no background hit merging , use size from | |
969 | // AliITSgeom class, option="All", input from this file only. | |
970 | rl->GetEvent(iEvent); | |
971 | if (!fLoader->TreeS()) fLoader->MakeTree("S"); | |
972 | MakeBranch("S"); | |
973 | SetTreeAddress(); | |
974 | HitsToSDigits(iEvent,0,-1," ",fOpt," "); | |
975 | } | |
976 | ||
977 | fLoader->UnloadHits(); | |
978 | fLoader->UnloadSDigits(); | |
979 | } | |
980 | //______________________________________________________________________ | |
981 | void AliITS::Hits2PreDigits(){ | |
982 | // Standard Hits to summable Digits function. | |
983 | // Inputs: | |
984 | // none. | |
985 | // Outputs: | |
986 | // none. | |
987 | ||
988 | AliHeader *header=fLoader->GetRunLoader()->GetHeader(); // Get event number from this file. | |
989 | // Do the Hits to Digits operation. Use Standard input values. | |
990 | // Event number from file, no background hit merging , use size from | |
991 | // AliITSgeom class, option="All", input from this file only. | |
992 | HitsToPreDigits(header->GetEvent(),0,-1," ",fOpt," "); | |
993 | } | |
994 | //______________________________________________________________________ | |
995 | AliDigitizer* AliITS::CreateDigitizer(AliRunDigitizer* manager) const | |
996 | { | |
997 | return new AliITSDigitizer(manager); | |
998 | } | |
999 | //______________________________________________________________________ | |
1000 | void AliITS::SDigitsToDigits(Option_t *opt){ | |
1001 | // Standard Summable digits to Digits function. | |
1002 | // Inputs: | |
1003 | // none. | |
1004 | // Outputs: | |
1005 | // none. | |
1006 | char name[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; | |
1007 | ||
1008 | if(!GetITSgeom()) return; // need transformations to do digitization. | |
1009 | AliITSgeom *geom = GetITSgeom(); | |
1010 | ||
1011 | const char *all = strstr(opt,"All"); | |
1012 | const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), | |
1013 | strstr(opt,"SSD")}; | |
1014 | if( !det[0] && !det[1] && !det[2] ) all = "All"; | |
1015 | else all = 0; | |
1016 | static Bool_t setDef=kTRUE; | |
1017 | if (setDef) SetDefaultSimulation(); | |
1018 | setDef=kFALSE; | |
1019 | ||
1020 | AliITSsimulation *sim = 0; | |
1021 | AliITSDetType *iDetType = 0; | |
1022 | TTree *trees = fLoader->TreeS(); | |
1023 | if( !(trees && this->GetSDigits()) ){ | |
1024 | Error("SDigits2Digits","Error: No trees or SDigits. Returning."); | |
1025 | return; | |
1026 | } // end if | |
1027 | sprintf( name, "%s", this->GetName() ); | |
1028 | TBranch *brchSDigits = trees->GetBranch( name ); | |
1029 | ||
1030 | Int_t id,module; | |
1031 | for(module=0;module<geom->GetIndexMax();module++){ | |
1032 | id = geom->GetModuleType(module); | |
1033 | if (!all && !det[id]) continue; | |
1034 | iDetType = DetType(id); | |
1035 | sim = (AliITSsimulation*)iDetType->GetSimulationModel(); | |
1036 | if (!sim) { | |
1037 | Error("SDigit2Digits", | |
1038 | "The simulation class was not instanciated!"); | |
1039 | exit(1); | |
1040 | } // end if !sim | |
1041 | sim->InitSimulationModule(module,gAlice->GetEvNumber()); | |
1042 | // | |
1043 | // add summable digits to module | |
1044 | this->GetSDigits()->Clear(); | |
1045 | brchSDigits->GetEvent(module); | |
1046 | sim->AddSDigitsToModule(GetSDigits(),0); | |
1047 | // | |
1048 | // Digitise current module sum(SDigits)->Digits | |
1049 | sim->FinishSDigitiseModule(); | |
1050 | ||
1051 | // fills all branches - wasted disk space | |
1052 | fLoader->TreeD()->Fill(); | |
1053 | this->ResetDigits(); | |
1054 | } // end for module | |
1055 | ||
1056 | fLoader->TreeD()->GetEntries(); | |
1057 | ||
1058 | fLoader->TreeD()->AutoSave(); | |
1059 | // reset tree | |
1060 | fLoader->TreeD()->Reset(); | |
1061 | ||
1062 | } | |
1063 | //______________________________________________________________________ | |
1064 | void AliITS::Hits2Digits(){ | |
1065 | // Standard Hits to Digits function. | |
1066 | // Inputs: | |
1067 | // none. | |
1068 | // Outputs: | |
1069 | // none. | |
1070 | ||
1071 | fLoader->LoadHits("read"); | |
1072 | fLoader->LoadDigits("recreate"); | |
1073 | AliRunLoader* rl = fLoader->GetRunLoader(); | |
1074 | ||
1075 | for (Int_t iEvent = 0; iEvent < rl->GetNumberOfEvents(); iEvent++) { | |
1076 | // Do the Hits to Digits operation. Use Standard input values. | |
1077 | // Event number from file, no background hit merging , use size from | |
1078 | // AliITSgeom class, option="All", input from this file only. | |
1079 | rl->GetEvent(iEvent); | |
1080 | if (!fLoader->TreeD()) fLoader->MakeTree("D"); | |
1081 | MakeBranch("D"); | |
1082 | SetTreeAddress(); | |
1083 | HitsToDigits(iEvent,0,-1," ",fOpt," "); | |
1084 | } | |
1085 | ||
1086 | fLoader->UnloadHits(); | |
1087 | fLoader->UnloadDigits(); | |
1088 | } | |
1089 | //______________________________________________________________________ | |
1090 | void AliITS::HitsToSDigits(Int_t evNumber,Int_t bgrev,Int_t size, | |
1091 | Option_t *option, Option_t *opt, const char *filename){ | |
1092 | // keep galice.root for signal and name differently the file for | |
1093 | // background when add! otherwise the track info for signal will be lost ! | |
1094 | // the condition below will disappear when the geom class will be | |
1095 | // initialized for all versions - for the moment it is only for v5 ! | |
1096 | // 7 is the SDD beam test version. Dummy routine. Hits are ITS's Summable | |
1097 | // Digits. | |
1098 | // Inputs: | |
1099 | // Int_t evnt Event to be processed. | |
1100 | // Int_t bgrev Background Hit tree number. | |
1101 | // Int_t nmodules Not used. | |
1102 | // Option_t *option String indicating if merging hits or not. To | |
1103 | // merge hits set equal to "Add". Otherwise no | |
1104 | // background hits are considered. | |
1105 | // Test_t *filename File name containing the background hits.. | |
1106 | // Outputs: | |
1107 | // none. | |
1108 | // Return: | |
1109 | // none. | |
1110 | // return; // using Hits instead of the larger sdigits. | |
1111 | ||
1112 | HitsToPreDigits(evNumber,bgrev,size,option,opt,filename); | |
1113 | } | |
1114 | //______________________________________________________________________ | |
1115 | void AliITS::HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size, | |
1116 | Option_t *option, Option_t *opt, const char *filename){ | |
1117 | // Keep galice.root for signal and name differently the file for | |
1118 | // background when add! otherwise the track info for signal will be lost ! | |
1119 | // the condition below will disappear when the geom class will be | |
1120 | // initialized for all versions - for the moment it is only for v5 ! | |
1121 | // 7 is the SDD beam test version. | |
1122 | // Inputs: | |
1123 | // Int_t evnt Event to be processed. | |
1124 | // Int_t bgrev Background Hit tree number. | |
1125 | // Int_t nmodules Not used. | |
1126 | // Option_t *option String indicating if merging hits or not. To | |
1127 | // merge hits set equal to "Add". Otherwise no | |
1128 | // background hits are considered. | |
1129 | // Test_t *filename File name containing the background hits.. | |
1130 | // Outputs: | |
1131 | // none. | |
1132 | // Return: | |
1133 | // none. | |
1134 | ||
1135 | if(!GetITSgeom()) return; // need transformations to do digitization. | |
1136 | AliITSgeom *geom = GetITSgeom(); | |
1137 | ||
1138 | const char *all = strstr(opt,"All"); | |
1139 | const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), | |
1140 | strstr(opt,"SSD")}; | |
1141 | static Bool_t setDef=kTRUE; | |
1142 | if (setDef) SetDefaultSimulation(); | |
1143 | setDef=kFALSE; | |
1144 | ||
1145 | Int_t nmodules; | |
1146 | InitModules(size,nmodules); | |
1147 | FillModules(evNumber,bgrev,nmodules,option,filename); | |
1148 | ||
1149 | AliITSsimulation *sim = 0; | |
1150 | AliITSDetType *iDetType = 0; | |
1151 | AliITSmodule *mod = 0; | |
1152 | Int_t id,module; | |
1153 | for(module=0;module<geom->GetIndexMax();module++){ | |
1154 | id = geom->GetModuleType(module); | |
1155 | if (!all && !det[id]) continue; | |
1156 | iDetType = DetType(id); | |
1157 | sim = (AliITSsimulation*)iDetType->GetSimulationModel(); | |
1158 | if (!sim) { | |
1159 | Error("HitsToSDigits", | |
1160 | "The simulation class was not instanciated!"); | |
1161 | exit(1); | |
1162 | } // end if !sim | |
1163 | mod = (AliITSmodule *)fITSmodules->At(module); | |
1164 | sim->SDigitiseModule(mod,module,evNumber); | |
1165 | // fills all branches - wasted disk space | |
1166 | fLoader->TreeS()->Fill(); | |
1167 | ResetSDigits(); | |
1168 | } // end for module | |
1169 | ||
1170 | ClearModules(); | |
1171 | ||
1172 | fLoader->TreeS()->GetEntries(); | |
1173 | fLoader->TreeS()->AutoSave(); | |
1174 | fLoader->WriteSDigits("OVERWRITE"); | |
1175 | // reset tree | |
1176 | fLoader->TreeS()->Reset(); | |
1177 | } | |
1178 | //______________________________________________________________________ | |
1179 | void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size, | |
1180 | Option_t *option, Option_t *opt, const char *filename){ | |
1181 | // Keep galice.root for signal and name differently the file for | |
1182 | // background when add! otherwise the track info for signal will be lost ! | |
1183 | // the condition below will disappear when the geom class will be | |
1184 | // initialized for all versions - for the moment it is only for v5 ! | |
1185 | // 7 is the SDD beam test version. | |
1186 | // Inputs: | |
1187 | // Int_t evnt Event to be processed. | |
1188 | // Int_t bgrev Background Hit tree number. | |
1189 | // Int_t nmodules Not used. | |
1190 | // Option_t *option String indicating if merging hits or not. To | |
1191 | // merge hits set equal to "Add". Otherwise no | |
1192 | // background hits are considered. | |
1193 | // Test_t *filename File name containing the background hits.. | |
1194 | // Outputs: | |
1195 | // none. | |
1196 | // Return: | |
1197 | // none. | |
1198 | ||
1199 | if(!GetITSgeom()) return; // need transformations to do digitization. | |
1200 | AliITSgeom *geom = GetITSgeom(); | |
1201 | ||
1202 | const char *all = strstr(opt,"All"); | |
1203 | const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), | |
1204 | strstr(opt,"SSD")}; | |
1205 | static Bool_t setDef=kTRUE; | |
1206 | if (setDef) SetDefaultSimulation(); | |
1207 | setDef=kFALSE; | |
1208 | ||
1209 | Int_t nmodules; | |
1210 | InitModules(size,nmodules); | |
1211 | FillModules(evNumber,bgrev,nmodules,option,filename); | |
1212 | ||
1213 | AliITSsimulation *sim = 0; | |
1214 | AliITSDetType *iDetType = 0; | |
1215 | AliITSmodule *mod = 0; | |
1216 | Int_t id,module; | |
1217 | for(module=0;module<geom->GetIndexMax();module++){ | |
1218 | id = geom->GetModuleType(module); | |
1219 | if (!all && !det[id]) continue; | |
1220 | iDetType = DetType(id); | |
1221 | sim = (AliITSsimulation*)iDetType->GetSimulationModel(); | |
1222 | if (!sim) { | |
1223 | Error("HitsToDigits", | |
1224 | "The simulation class was not instanciated!"); | |
1225 | exit(1); | |
1226 | } // end if !sim | |
1227 | mod = (AliITSmodule *)fITSmodules->At(module); | |
1228 | sim->DigitiseModule(mod,module,evNumber); | |
1229 | // fills all branches - wasted disk space | |
1230 | fLoader->TreeD()->Fill(); | |
1231 | ResetDigits(); | |
1232 | } // end for module | |
1233 | ||
1234 | ClearModules(); | |
1235 | ||
1236 | fLoader->TreeD()->GetEntries(); | |
1237 | fLoader->TreeD()->AutoSave(); | |
1238 | // reset tree | |
1239 | fLoader->TreeD()->Reset(); | |
1240 | } | |
1241 | //______________________________________________________________________ | |
1242 | void AliITS::ResetSDigits(){ | |
1243 | // Reset the Summable Digits array. | |
1244 | // Inputs: | |
1245 | // none. | |
1246 | // Outputs: | |
1247 | // none. | |
1248 | ||
1249 | if (fSDigits) fSDigits->Clear(); | |
1250 | fNSDigits = 0; | |
1251 | } | |
1252 | //______________________________________________________________________ | |
1253 | void AliITS::ResetDigits(){ | |
1254 | // Reset number of digits and the digits array for the ITS detector. | |
1255 | // Inputs: | |
1256 | // none. | |
1257 | // Outputs: | |
1258 | // none. | |
1259 | ||
1260 | if (!fDtype) return; | |
1261 | ||
1262 | Int_t i; | |
1263 | for (i=0;i<kNTYPES;i++ ) { | |
1264 | if (fDtype->At(i)) ((TClonesArray*)fDtype->At(i))->Clear(); | |
1265 | if (fNdtype) fNdtype[i]=0; | |
1266 | } // end for i | |
1267 | } | |
1268 | //______________________________________________________________________ | |
1269 | void AliITS::ResetDigits(Int_t i){ | |
1270 | // Reset number of digits and the digits array for this branch. | |
1271 | // Inputs: | |
1272 | // none. | |
1273 | // Outputs: | |
1274 | // none. | |
1275 | ||
1276 | if (fDtype->At(i)) ((TClonesArray*)fDtype->At(i))->Clear(); | |
1277 | if (fNdtype) fNdtype[i]=0; | |
1278 | } | |
1279 | //______________________________________________________________________ | |
1280 | void AliITS::AddSumDigit(AliITSpListItem &sdig){ | |
1281 | // Adds the a module full of summable digits to the summable digits tree. | |
1282 | // Inputs: | |
1283 | // AliITSpListItem &sdig SDigit to be added to SDigits tree. | |
1284 | // Outputs: | |
1285 | // none. | |
1286 | // Return: | |
1287 | // none. | |
1288 | ||
1289 | TClonesArray &lsdig = *fSDigits; | |
1290 | new(lsdig[fNSDigits++]) AliITSpListItem(sdig); | |
1291 | } | |
1292 | //______________________________________________________________________ | |
1293 | void AliITS::AddRealDigit(Int_t id, Int_t *digits){ | |
1294 | // Add a real digit - as coming from data. | |
1295 | // Inputs: | |
1296 | // Int_t id Detector type number. | |
1297 | // Int_t *digits Integer array containing the digits info. See | |
1298 | // AliITSdigit.h | |
1299 | // Outputs: | |
1300 | // none. | |
1301 | // Return: | |
1302 | // none. | |
1303 | ||
1304 | TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id)); | |
1305 | new(ldigits[fNdtype[id]++]) AliITSdigit(digits); | |
1306 | } | |
1307 | //______________________________________________________________________ | |
1308 | void AliITS::AddSimDigit(Int_t id, AliITSdigit *d){ | |
1309 | // Add a simulated digit. | |
1310 | // Inputs: | |
1311 | // Int_t id Detector type number. | |
1312 | // AliITSdigit *d Digit to be added to the Digits Tree. See | |
1313 | // AliITSdigit.h | |
1314 | // Outputs: | |
1315 | // none. | |
1316 | // Return: | |
1317 | // none. | |
1318 | ||
1319 | TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id)); | |
1320 | ||
1321 | switch(id){ | |
1322 | case 0: | |
1323 | new(ldigits[fNdtype[id]++]) AliITSdigitSPD(*((AliITSdigitSPD*)d)); | |
1324 | break; | |
1325 | case 1: | |
1326 | new(ldigits[fNdtype[id]++]) AliITSdigitSDD(*((AliITSdigitSDD*)d)); | |
1327 | break; | |
1328 | case 2: | |
1329 | new(ldigits[fNdtype[id]++]) AliITSdigitSSD(*((AliITSdigitSSD*)d)); | |
1330 | break; | |
1331 | } // end switch id | |
1332 | } | |
1333 | //______________________________________________________________________ | |
1334 | void AliITS::AddSimDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks, | |
1335 | Int_t *hits,Float_t *charges){ | |
1336 | // Add a simulated digit to the list. | |
1337 | // Inputs: | |
1338 | // Int_t id Detector type number. | |
1339 | // Float_t phys Physics indicator. See AliITSdigits.h | |
1340 | // Int_t *digits Integer array containing the digits info. See | |
1341 | // AliITSdigit.h | |
1342 | // Int_t *tracks Integer array [AliITSdigitS?D::GetNTracks()] | |
1343 | // containing the track numbers that contributed to | |
1344 | // this digit. | |
1345 | // Int_t *hits Integer array [AliITSdigitS?D::GetNTracks()] | |
1346 | // containing the hit numbers, from AliITSmodule, that | |
1347 | // contributed to this digit. | |
1348 | // Float_t *charge Floating point array of the signals contributed | |
1349 | // to this digit by each track. | |
1350 | // Outputs: | |
1351 | // none. | |
1352 | // Return: | |
1353 | // none. | |
1354 | ||
1355 | TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id)); | |
1356 | AliITSresponseSDD *resp = 0; | |
1357 | switch(id){ | |
1358 | case 0: | |
1359 | new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits); | |
1360 | break; | |
1361 | case 1: | |
1362 | resp = (AliITSresponseSDD*)DetType(1)->GetResponseModel(); | |
1363 | new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks, | |
1364 | hits,charges,resp); | |
1365 | break; | |
1366 | case 2: | |
1367 | new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits); | |
1368 | break; | |
1369 | } // end switch id | |
1370 | } | |
1371 | //______________________________________________________________________ | |
1372 | void AliITS::MakeTreeC(Option_t *option){ | |
1373 | // Create a separate tree to store the clusters. | |
1374 | // Inputs: | |
1375 | // Option_t *option string which must contain "C" otherwise | |
1376 | // no Cluster Tree is created. | |
1377 | // Outputs: | |
1378 | // none. | |
1379 | // Return: | |
1380 | // none. | |
1381 | ||
1382 | AliITSLoader *pITSLoader = (AliITSLoader*)fLoader; | |
1383 | ||
1384 | if (pITSLoader == 0x0) { | |
1385 | Error("MakeTreeC","fLoader == 0x0 option=%s",option); | |
1386 | return; | |
1387 | } | |
1388 | if (pITSLoader->TreeC() == 0x0) pITSLoader->MakeTree("C"); | |
1389 | MakeBranchC(); | |
1390 | } | |
1391 | ||
1392 | void AliITS::MakeBranchC() | |
1393 | { | |
1394 | //Makes barnches in treeC | |
1395 | AliITSLoader *pITSLoader = (AliITSLoader*)fLoader; | |
1396 | if (pITSLoader == 0x0) | |
1397 | { | |
1398 | Error("MakeTreeC","fLoader == 0x0"); | |
1399 | return; | |
1400 | } | |
1401 | TTree * lTC = pITSLoader->TreeC(); | |
1402 | if (lTC == 0x0) | |
1403 | { | |
1404 | Error("MakeTreeC","Can not get TreeC from Loader"); | |
1405 | return; | |
1406 | } | |
1407 | ||
1408 | Int_t buffersize = 4000; | |
1409 | char branchname[30]; | |
1410 | const char *det[3] = {"SPD","SDD","SSD"}; | |
1411 | char digclass[40]; | |
1412 | char clclass[40]; | |
1413 | ||
1414 | // one branch for Clusters per type of detector | |
1415 | Int_t i; | |
1416 | for (i=0; i<kNTYPES ;i++) | |
1417 | { | |
1418 | AliITSDetType *iDetType=DetType(i); | |
1419 | iDetType->GetClassNames(digclass,clclass); | |
1420 | // clusters | |
1421 | if (fCtype == 0x0) fCtype = new TObjArray(fNDetTypes); | |
1422 | if(!ClustersAddress(i)) | |
1423 | { | |
1424 | fCtype->AddAt(new TClonesArray(clclass,1000),i); | |
1425 | } | |
1426 | if (kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]); | |
1427 | else sprintf(branchname,"%sClusters%d",GetName(),i+1); | |
1428 | if (fCtype && lTC) | |
1429 | { | |
1430 | if (lTC->GetBranch(branchname)) | |
1431 | { | |
1432 | Warning("MakeBranchC","Branch %s alread exists in TreeC",branchname); | |
1433 | } | |
1434 | else | |
1435 | { | |
1436 | Info("MakeBranchC","Creating branch %s in TreeC",branchname); | |
1437 | lTC->Branch(branchname,&((*fCtype)[i]), buffersize); | |
1438 | } | |
1439 | } // end if fCtype && lTC | |
1440 | } // end for i | |
1441 | } | |
1442 | ||
1443 | //______________________________________________________________________ | |
1444 | void AliITS::GetTreeC(Int_t event){ | |
1445 | // Get the clusters tree for this event and set the branch address. | |
1446 | // Inputs: | |
1447 | // Int_t event Event number for the cluster tree. | |
1448 | // Outputs: | |
1449 | // none. | |
1450 | // Return: | |
1451 | // none. | |
1452 | char branchname[30]; | |
1453 | const char *det[3] = {"SPD","SDD","SSD"}; | |
1454 | ||
1455 | AliITSLoader *pITSLoader = (AliITSLoader*)fLoader; | |
1456 | TTree * lTC = pITSLoader->TreeC(); | |
1457 | ||
1458 | ResetClusters(); | |
1459 | if (lTC) { | |
1460 | pITSLoader->CleanRawClusters(); | |
1461 | } // end if TreeC() | |
1462 | ||
1463 | ||
1464 | TBranch *branch; | |
1465 | ||
1466 | if (lTC) { | |
1467 | Int_t i; | |
1468 | char digclass[40]; | |
1469 | char clclass[40]; | |
1470 | for (i=0; i<kNTYPES; i++) { | |
1471 | AliITSDetType *iDetType=DetType(i); | |
1472 | iDetType->GetClassNames(digclass,clclass); | |
1473 | // clusters | |
1474 | if (fCtype == 0x0) fCtype = new TObjArray(fNDetTypes); | |
1475 | if(!fCtype->At(i)) fCtype->AddAt(new TClonesArray(clclass,1000),i); | |
1476 | if(kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]); | |
1477 | else sprintf(branchname,"%sClusters%d",GetName(),i+1); | |
1478 | if (fCtype) { | |
1479 | branch = lTC->GetBranch(branchname); | |
1480 | if (branch) branch->SetAddress(&((*fCtype)[i])); | |
1481 | } // end if fCtype | |
1482 | } // end for i | |
1483 | } else { | |
1484 | Error("GetTreeC","cannot find Clusters Tree for event:%d",event); | |
1485 | } // end if lTC | |
1486 | } | |
1487 | //______________________________________________________________________ | |
1488 | void AliITS::AddCluster(Int_t id, AliITSRawCluster *c){ | |
1489 | // Add a cluster to the list. | |
1490 | // Inputs: | |
1491 | // Int_t id Detector type number. | |
1492 | // AliITSRawCluster *c Cluster class to be added to the tree of | |
1493 | // clusters. | |
1494 | // Outputs: | |
1495 | // none. | |
1496 | // Return: | |
1497 | // none. | |
1498 | ||
1499 | TClonesArray &lc = *((TClonesArray*)fCtype->At(id)); | |
1500 | ||
1501 | switch(id){ | |
1502 | case 0: | |
1503 | new(lc[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c)); | |
1504 | break; | |
1505 | case 1: | |
1506 | new(lc[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c)); | |
1507 | break; | |
1508 | case 2: | |
1509 | new(lc[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c)); | |
1510 | break; | |
1511 | } // end switch id | |
1512 | } | |
1513 | //______________________________________________________________________ | |
1514 | void AliITS::ResetClusters(){ | |
1515 | // Reset number of clusters and the clusters array for ITS. | |
1516 | // Inputs: | |
1517 | // none. | |
1518 | // Outputs: | |
1519 | // none. | |
1520 | ||
1521 | Int_t i; | |
1522 | for (i=0;i<kNTYPES;i++ ) ResetClusters(i); | |
1523 | } | |
1524 | //______________________________________________________________________ | |
1525 | void AliITS::ResetClusters(Int_t i){ | |
1526 | // Reset number of clusters and the clusters array for this branch. | |
1527 | // Inputs: | |
1528 | // Int_t i Detector type number. | |
1529 | // Outputs: | |
1530 | // none. | |
1531 | // Return: | |
1532 | // none. | |
1533 | ||
1534 | if (fCtype->At(i)) ((TClonesArray*)fCtype->At(i))->Clear(); | |
1535 | if (fNctype) fNctype[i]=0; | |
1536 | } | |
1537 | //______________________________________________________________________ | |
1538 | void AliITS::MakeBranchR(const char *file, Option_t *opt){ | |
1539 | // Creates Tree branches for the ITS Reconstructed points. | |
1540 | // Inputs: | |
1541 | // cont char *file File name where RecPoints branch is to be written | |
1542 | // to. If blank it write the SDigits to the same | |
1543 | // file in which the Hits were found. | |
1544 | // Outputs: | |
1545 | // none. | |
1546 | // Return: | |
1547 | // none. | |
1548 | Int_t buffsz = 4000; | |
1549 | char branchname[30]; | |
1550 | ||
1551 | // only one branch for rec points for all detector types | |
1552 | Bool_t oFast= (strstr(opt,"Fast")!=0); | |
1553 | if(oFast){ | |
1554 | sprintf(branchname,"%sRecPointsF",GetName()); | |
1555 | } else { | |
1556 | sprintf(branchname,"%sRecPoints",GetName()); | |
1557 | } | |
1558 | ||
1559 | ||
1560 | if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000); | |
1561 | if (fLoader->TreeR()) { | |
1562 | if (fRecPoints == 0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000); | |
1563 | MakeBranchInTree(fLoader->TreeR(),branchname,&fRecPoints,buffsz,file); | |
1564 | } // end if | |
1565 | } | |
1566 | //______________________________________________________________________ | |
1567 | void AliITS::SetTreeAddressR(TTree *treeR){ | |
1568 | // Set branch address for the Reconstructed points Trees. | |
1569 | // Inputs: | |
1570 | // TTree *treeR Tree containing the RecPoints. | |
1571 | // Outputs: | |
1572 | // none. | |
1573 | // Return: | |
1574 | // none. | |
1575 | char branchname[30]; | |
1576 | ||
1577 | if(!treeR) return; | |
1578 | if (fRecPoints == 0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000); | |
1579 | TBranch *branch; | |
1580 | sprintf(branchname,"%sRecPoints",GetName()); | |
1581 | branch = treeR->GetBranch(branchname); | |
1582 | if (branch) { | |
1583 | branch->SetAddress(&fRecPoints); | |
1584 | } | |
1585 | else { | |
1586 | sprintf(branchname,"%sRecPointsF",GetName()); | |
1587 | branch = treeR->GetBranch(branchname); | |
1588 | if (branch) { | |
1589 | branch->SetAddress(&fRecPoints); | |
1590 | } | |
1591 | } | |
1592 | } | |
1593 | //______________________________________________________________________ | |
1594 | void AliITS::AddRecPoint(const AliITSRecPoint &r){ | |
1595 | // Add a reconstructed space point to the list | |
1596 | // Inputs: | |
1597 | // const AliITSRecPoint &r RecPoint class to be added to the tree | |
1598 | // of reconstructed points TreeR. | |
1599 | // Outputs: | |
1600 | // none. | |
1601 | // Return: | |
1602 | // none. | |
1603 | ||
1604 | TClonesArray &lrecp = *fRecPoints; | |
1605 | new(lrecp[fNRecPoints++]) AliITSRecPoint(r); | |
1606 | } | |
1607 | //______________________________________________________________________ | |
1608 | void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size, | |
1609 | Option_t *opt0,Option_t *opt1, const char *flnm){ | |
1610 | // keep galice.root for signal and name differently the file for | |
1611 | // background when add! otherwise the track info for signal will be lost ! | |
1612 | // the condition below will disappear when the geom class will be | |
1613 | // initialized for all versions - for the moment it is only for v5 ! | |
1614 | // Inputs: | |
1615 | // Int_t evnt Event to be processed. | |
1616 | // Int_t bgrev Background Hit tree number. | |
1617 | // Int_t size Size used by InitModules. See InitModules. | |
1618 | // Option_t *opt0 Option passed to FillModules. See FillModules. | |
1619 | // Option_t *opt1 String indicating if merging hits or not. To | |
1620 | // merge hits set equal to "Add". Otherwise no | |
1621 | // background hits are considered. | |
1622 | // Test_t *flnm File name containing the background hits.. | |
1623 | // Outputs: | |
1624 | // none. | |
1625 | // Return: | |
1626 | // none. | |
1627 | ||
1628 | if(!GetITSgeom()) return; | |
1629 | AliITSLoader *pITSloader = (AliITSLoader*)fLoader; | |
1630 | AliITSgeom *geom = GetITSgeom(); | |
1631 | ||
1632 | const char *all = strstr(opt1,"All"); | |
1633 | const char *det[3] ={strstr(opt1,"SPD"),strstr(opt1,"SDD"), | |
1634 | strstr(opt1,"SSD")}; | |
1635 | Int_t nmodules; | |
1636 | InitModules(size,nmodules); | |
1637 | FillModules(evNumber,bgrev,nmodules,opt0,flnm); | |
1638 | ||
1639 | AliITSsimulation *sim = 0; | |
1640 | AliITSDetType *iDetType = 0; | |
1641 | AliITSmodule *mod = 0; | |
1642 | Int_t id,module; | |
1643 | ||
1644 | //m.b. : this change is nothing but a nice way to make sure | |
1645 | //the CPU goes up ! | |
1646 | ||
1647 | cout<<"HitsToFastRecPoints: N mod = "<<geom->GetIndexMax()<<endl; | |
1648 | ||
1649 | for(module=0;module<geom->GetIndexMax();module++) | |
1650 | { | |
1651 | id = geom->GetModuleType(module); | |
1652 | if (!all && !det[id]) continue; | |
1653 | iDetType = DetType(id); | |
1654 | sim = (AliITSsimulation*)iDetType->GetSimulationModel(); | |
1655 | if (!sim) | |
1656 | { | |
1657 | Error("HitsToFastPoints","The simulation class was not instanciated!"); | |
1658 | exit(1); | |
1659 | } // end if !sim | |
1660 | mod = (AliITSmodule *)fITSmodules->At(module); | |
1661 | sim->CreateFastRecPoints(mod,module,gRandom); | |
1662 | cout<<module<<"\r";fflush(0); | |
1663 | //gAlice->TreeR()->Fill(); | |
1664 | TTree *lTR = pITSloader->TreeR(); | |
1665 | TBranch *br=lTR->GetBranch("ITSRecPointsF"); | |
1666 | br->Fill(); | |
1667 | ResetRecPoints(); | |
1668 | } // end for module | |
1669 | ||
1670 | ClearModules(); | |
1671 | ||
1672 | fLoader->WriteRecPoints("OVERWRITE"); | |
1673 | } | |
1674 | //______________________________________________________________________ | |
1675 | void AliITS::Digits2Reco(){ | |
1676 | // Find clusters and reconstruct space points. | |
1677 | // Inputs: | |
1678 | // none. | |
1679 | // Outputs: | |
1680 | // none. | |
1681 | ||
1682 | AliHeader *header=fLoader->GetRunLoader()->GetHeader(); | |
1683 | // to Digits to RecPoints for event in file, all digits in file, and | |
1684 | // all ITS detectors. | |
1685 | DigitsToRecPoints(header->GetEvent(),0,fOpt); | |
1686 | } | |
1687 | //______________________________________________________________________ | |
1688 | void AliITS::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt){ | |
1689 | // cluster finding and reconstruction of space points | |
1690 | // the condition below will disappear when the geom class will be | |
1691 | // initialized for all versions - for the moment it is only for v5 ! | |
1692 | // 7 is the SDD beam test version | |
1693 | // Inputs: | |
1694 | // Int_t evNumber Event number to be processed. | |
1695 | // Int_t lastentry Offset for module when not all of the modules | |
1696 | // are processed. | |
1697 | // Option_t *opt String indicating which ITS sub-detectors should | |
1698 | // be processed. If ="All" then all of the ITS | |
1699 | // sub detectors are processed. | |
1700 | // Outputs: | |
1701 | // none. | |
1702 | // Return: | |
1703 | // none. | |
1704 | ||
1705 | if(!GetITSgeom()) return; | |
1706 | AliITSgeom *geom = GetITSgeom(); | |
1707 | ||
1708 | const char *all = strstr(opt,"All"); | |
1709 | const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), | |
1710 | strstr(opt,"SSD")}; | |
1711 | static Bool_t setRec=kTRUE; | |
1712 | if (setRec) SetDefaultClusterFinders(); | |
1713 | setRec=kFALSE; | |
1714 | ||
1715 | AliITSLoader *pITSloader = (AliITSLoader*)fLoader; | |
1716 | TTree *treeC=pITSloader->TreeC(); | |
1717 | AliITSClusterFinder *rec = 0; | |
1718 | AliITSDetType *iDetType = 0; | |
1719 | Int_t id,module,first=0; | |
1720 | for(module=0;module<geom->GetIndexMax();module++){ | |
1721 | id = geom->GetModuleType(module); | |
1722 | if (!all && !det[id]) continue; | |
1723 | if(det[id]) first = geom->GetStartDet(id); | |
1724 | iDetType = DetType(id); | |
1725 | rec = (AliITSClusterFinder*)iDetType->GetReconstructionModel(); | |
1726 | TClonesArray *itsDigits = this->DigitsAddress(id); | |
1727 | if (!rec) { | |
1728 | Error("DigitsToRecPoints", | |
1729 | "The reconstruction class was not instanciated! event=%d", | |
1730 | evNumber); | |
1731 | exit(1); | |
1732 | } // end if !rec | |
1733 | this->ResetDigits(); | |
1734 | TTree *lTD = pITSloader->TreeD(); | |
1735 | if (all) { | |
1736 | lTD->GetEvent(lastentry+module); | |
1737 | }else { | |
1738 | lTD->GetEvent(lastentry+(module-first)); | |
1739 | } | |
1740 | Int_t ndigits = itsDigits->GetEntriesFast(); | |
1741 | if (ndigits) rec->FindRawClusters(module); | |
1742 | pITSloader->TreeR()->Fill(); | |
1743 | ResetRecPoints(); | |
1744 | treeC->Fill(); | |
1745 | ResetClusters(); | |
1746 | } // end for module | |
1747 | ||
1748 | ||
1749 | pITSloader->WriteRecPoints("OVERWRITE"); | |
1750 | pITSloader->WriteRawClusters("OVERWRITE"); | |
1751 | } | |
1752 | //______________________________________________________________________ | |
1753 | void AliITS::ResetRecPoints(){ | |
1754 | // Reset number of rec points and the rec points array. | |
1755 | // Inputs: | |
1756 | // none. | |
1757 | // Outputs: | |
1758 | // none. | |
1759 | ||
1760 | if (fRecPoints) fRecPoints->Clear(); | |
1761 | fNRecPoints = 0; | |
1762 | } | |
1763 | //______________________________________________________________________ | |
1764 | AliLoader* AliITS::MakeLoader(const char* topfoldername) | |
1765 | { | |
1766 | //builds ITSgetter (AliLoader type) | |
1767 | //if detector wants to use castomized getter, it must overload this method | |
1768 | ||
1769 | Info("MakeLoader","Creating AliITSLoader. Top folder is %s.",topfoldername); | |
1770 | fLoader = new AliITSLoader(GetName(),topfoldername); | |
1771 | return fLoader; | |
1772 | } | |
1773 | ||
1774 | ||
1775 | //_____________________________________________________________________________ | |
1776 | void AliITS::Reconstruct() const | |
1777 | { | |
1778 | // reconstruct clusters | |
1779 | ||
1780 | AliLoader* loader = GetLoader(); | |
1781 | loader->LoadRecPoints("recreate"); | |
1782 | loader->LoadDigits("read"); | |
1783 | ||
1784 | AliITSclustererV2 clusterer(GetITSgeom()); | |
1785 | AliRunLoader* runLoader = loader->GetRunLoader(); | |
1786 | Int_t nEvents = runLoader->GetNumberOfEvents(); | |
1787 | ||
1788 | for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) { | |
1789 | runLoader->GetEvent(iEvent); | |
1790 | ||
1791 | TTree* treeClusters = loader->TreeR(); | |
1792 | if (!treeClusters) { | |
1793 | loader->MakeTree("R"); | |
1794 | treeClusters = loader->TreeR(); | |
1795 | } | |
1796 | TTree* treeDigits = loader->TreeD(); | |
1797 | if (!treeDigits) { | |
1798 | Error("Reconstruct", "Can't get digits tree !"); | |
1799 | return; | |
1800 | } | |
1801 | ||
1802 | clusterer.Digits2Clusters(treeDigits, treeClusters); | |
1803 | ||
1804 | loader->WriteRecPoints("OVERWRITE"); | |
1805 | } | |
1806 | ||
1807 | loader->UnloadRecPoints(); | |
1808 | loader->UnloadDigits(); | |
1809 | } | |
1810 | ||
1811 | //_____________________________________________________________________________ | |
1812 | AliTracker* AliITS::CreateTracker() const | |
1813 | { | |
1814 | // create an ITS tracker | |
1815 | ||
1816 | return new AliITStrackerV2(GetITSgeom()); | |
1817 | } | |
1818 | ||
1819 | //_____________________________________________________________________________ | |
1820 | void AliITS::FillESD(AliESD* esd) const | |
1821 | { | |
1822 | // make PID, find V0s and cascades | |
1823 | ||
1824 | Double_t parITS[] = {34., 0.15, 10.}; | |
1825 | AliITSpidESD itsPID(parITS); | |
1826 | itsPID.MakePID(esd); | |
1827 | ||
1828 | // V0 finding | |
1829 | Double_t cuts[]={33, // max. allowed chi2 | |
1830 | 0.16,// min. allowed negative daughter's impact parameter | |
1831 | 0.05,// min. allowed positive daughter's impact parameter | |
1832 | 0.080,// max. allowed DCA between the daughter tracks | |
1833 | 0.998,// max. allowed cosine of V0's pointing angle | |
1834 | 0.9, // min. radius of the fiducial volume | |
1835 | 2.9 // max. radius of the fiducial volume | |
1836 | }; | |
1837 | AliV0vertexer vtxer(cuts); | |
1838 | Double_t vtx[3], cvtx[6]; | |
1839 | esd->GetVertex(vtx, cvtx); | |
1840 | vtxer.SetVertex(vtx); | |
1841 | vtxer.Tracks2V0vertices(esd); | |
1842 | ||
1843 | // cascade finding | |
1844 | Double_t cts[]={33., // max. allowed chi2 | |
1845 | 0.05, // min. allowed V0 impact parameter | |
1846 | 0.008, // window around the Lambda mass | |
1847 | 0.035, // min. allowed bachelor's impact parameter | |
1848 | 0.10, // max. allowed DCA between a V0 and a track | |
1849 | 0.9985, //max. allowed cosine of the cascade pointing angle | |
1850 | 0.9, // min. radius of the fiducial volume | |
1851 | 2.9 // max. radius of the fiducial volume | |
1852 | }; | |
1853 | AliCascadeVertexer cvtxer=AliCascadeVertexer(cts); | |
1854 | cvtxer.V0sTracks2CascadeVertices(esd); | |
1855 | } | |
1856 |