]>
Commit | Line | Data |
---|---|---|
4c039060 | 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 | /* | |
17 | $Log$ | |
143d1056 | 18 | Revision 1.9.2.15 2000/10/04 16:56:40 nilsen |
19 | Needed to include stdlib.h | |
20 | ||
21 | ======= | |
22 | Revision 1.22 2000/10/04 19:45:52 barbera | |
23 | Corrected by F. Carminati for v3.04 | |
24 | ||
114da3a4 | 25 | Revision 1.21 2000/10/02 21:28:08 fca |
26 | Removal of useless dependecies via forward declarations | |
27 | ||
94de3818 | 28 | Revision 1.20 2000/10/02 16:31:39 barbera |
29 | General code clean-up | |
30 | ||
d5da1ecf | 31 | Revision 1.9.2.14 2000/10/02 15:43:51 barbera |
32 | General code clean-up (e.g., printf -> cout) | |
33 | ||
34 | Revision 1.19 2000/09/22 12:13:25 nilsen | |
35 | Patches and updates for fixes to this and other routines. | |
36 | ||
9c74c52b | 37 | Revision 1.18 2000/07/12 05:32:20 fca |
38 | Correcting several syntax problem with static members | |
39 | ||
b669392e | 40 | Revision 1.17 2000/07/10 16:07:18 fca |
41 | Release version of ITS code | |
42 | ||
3bd79107 | 43 | Revision 1.9.2.3 2000/02/02 13:42:09 barbera |
44 | fixed AliITS.cxx for new AliRun structure. Added ITS hits list to list of hits which will have their track numbers updated | |
45 | ||
46 | Revision 1.9.2.2 2000/01/23 03:03:13 nilsen | |
47 | //fixed FillModule. Removed fi(fabs(xl)<dx.... | |
48 | ||
49 | Revision 1.9.2.1 2000/01/12 19:03:32 nilsen | |
50 | This is the version of the files after the merging done in December 1999. | |
51 | See the ReadMe110100.txt file for details | |
c9a71be1 | 52 | |
1cedd08a | 53 | Revision 1.9 1999/11/14 14:33:25 fca |
54 | Correct problems with distructors and pointers, thanks to I.Hrivnacova | |
55 | ||
6c854497 | 56 | Revision 1.8 1999/09/29 09:24:19 fca |
57 | Introduction of the Copyright and cvs Log | |
58 | ||
4c039060 | 59 | */ |
60 | ||
fe4da5cc | 61 | /////////////////////////////////////////////////////////////////////////////// |
58005f18 | 62 | // |
63 | // An overview of the basic philosophy of the ITS code development | |
64 | // and analysis is show in the figure below. | |
fe4da5cc | 65 | //Begin_Html |
66 | /* | |
a92b2b7d | 67 | <img src="picts/ITS/ITS_Analysis_schema.gif"> |
fe4da5cc | 68 | </pre> |
69 | <br clear=left> | |
70 | <font size=+2 color=red> | |
58005f18 | 71 | <p>Roberto Barbera is in charge of the ITS Offline code (1999). |
fe4da5cc | 72 | <a href="mailto:roberto.barbera@ct.infn.it">Roberto Barbera</a>. |
73 | </font> | |
74 | <pre> | |
75 | */ | |
76 | //End_Html | |
58005f18 | 77 | // |
78 | // AliITS. Inner Traking System base class. | |
79 | // This class contains the base procedures for the Inner Tracking System | |
80 | // | |
81 | //Begin_Html | |
82 | /* | |
a92b2b7d | 83 | <img src="picts/ITS/AliITS_Class_Diagram.gif"> |
58005f18 | 84 | </pre> |
85 | <br clear=left> | |
86 | <font size=+2 color=red> | |
87 | <p>This show the class diagram of the different elements that are part of | |
88 | the AliITS class. | |
89 | </font> | |
90 | <pre> | |
91 | */ | |
92 | //End_Html | |
93 | // | |
94 | // Version: 0 | |
95 | // Written by Rene Brun, Federico Carminati, and Roberto Barbera | |
96 | // | |
97 | // Version: 1 | |
98 | // Modified and documented by Bjorn S. Nilsen | |
99 | // July 11 1999 | |
100 | // | |
3bd79107 | 101 | // Version: 2 |
102 | // Modified and documented by A. Bologna | |
103 | // October 18 1999 | |
104 | // | |
58005f18 | 105 | // AliITS is the general base class for the ITS. Also see AliDetector for |
106 | // futher information. | |
107 | // | |
fe4da5cc | 108 | /////////////////////////////////////////////////////////////////////////////// |
143d1056 | 109 | #include <stdlib.h> |
fe4da5cc | 110 | #include <TMath.h> |
111 | #include <TRandom.h> | |
9c74c52b | 112 | #include <TBranch.h> |
fe4da5cc | 113 | #include <TVector.h> |
3bd79107 | 114 | #include <TObjArray.h> |
3bd79107 | 115 | #include <TROOT.h> |
116 | #include <TObjectTable.h> | |
9c74c52b | 117 | #include <TFile.h> |
118 | #include <TTree.h> | |
d5da1ecf | 119 | #include <TString.h> |
3bd79107 | 120 | |
121 | ||
bb8ac1e0 | 122 | |
fe4da5cc | 123 | #include "AliRun.h" |
3bd79107 | 124 | #include "AliITS.h" |
125 | #include "AliITSMap.h" | |
e8189707 | 126 | #include "AliITSDetType.h" |
3bd79107 | 127 | #include "AliITSClusterFinder.h" |
128 | #include "AliITSsimulation.h" | |
143d1056 | 129 | #include "AliITSresponse.h" |
3bd79107 | 130 | #include "AliITSsegmentationSPD.h" |
131 | #include "AliITSresponseSPD.h" | |
132 | #include "AliITSsegmentationSDD.h" | |
133 | #include "AliITSresponseSDD.h" | |
134 | #include "AliITSsegmentationSSD.h" | |
135 | #include "AliITSresponseSSD.h" | |
9c74c52b | 136 | #include "AliITShit.h" |
137 | #include "AliITSgeom.h" | |
138 | #include "AliITSdigit.h" | |
139 | #include "AliITSmodule.h" | |
140 | #include "AliITSRecPoint.h" | |
141 | #include "AliITSRawCluster.h" | |
94de3818 | 142 | #include "AliMC.h" |
114da3a4 | 143 | #include "stdlib.h" |
e8189707 | 144 | |
b669392e | 145 | const Int_t AliITS::fgkNTYPES=3; |
c9a71be1 | 146 | |
3bd79107 | 147 | ClassImp(AliITS) |
148 | ||
fe4da5cc | 149 | //_____________________________________________________________________________ |
3bd79107 | 150 | AliITS::AliITS() : AliDetector() { |
fe4da5cc | 151 | // |
152 | // Default initialiser for ITS | |
58005f18 | 153 | // The default constructor of the AliITS class. In addition to |
154 | // creating the AliITS class it zeros the variables fIshunt (a member | |
155 | // of AliDetector class), fEuclidOut, and fIdN, and zeros the pointers | |
3bd79107 | 156 | // fITSpoints, fIdSens, and fIdName. The AliDetector default constructor |
157 | // is also called. | |
fe4da5cc | 158 | // |
3bd79107 | 159 | |
9c74c52b | 160 | |
58005f18 | 161 | fIshunt = 0; |
162 | fEuclidOut = 0; | |
e8189707 | 163 | |
164 | //fNDetTypes = fgkNTYPES; | |
58005f18 | 165 | fIdN = 0; |
166 | fIdName = 0; | |
167 | fIdSens = 0; | |
6c854497 | 168 | fITSmodules = 0; |
3bd79107 | 169 | // |
170 | fDetTypes = 0; | |
3bd79107 | 171 | // |
172 | fDtype = 0; | |
173 | fNdtype = 0; | |
174 | fCtype = 0; | |
175 | fNctype = 0; | |
176 | fRecPoints = 0; | |
177 | fNRecPoints = 0; | |
e8189707 | 178 | fTreeC = 0; |
3bd79107 | 179 | // |
180 | fITSgeom=0; | |
fe4da5cc | 181 | } |
3bd79107 | 182 | |
fe4da5cc | 183 | //_____________________________________________________________________________ |
58005f18 | 184 | AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){ |
fe4da5cc | 185 | // |
186 | // Default initialiser for ITS | |
58005f18 | 187 | // The constructor of the AliITS class. In addition to creating the |
188 | // AliITS class, it allocates memory for the TClonesArrays fHits and | |
189 | // fDigits, and for the TObjArray fITSpoints. It also zeros the variables | |
190 | // fIshunt (a member of AliDetector class), fEuclidOut, and fIdN, and zeros | |
191 | // the pointers fIdSens and fIdName. To help in displaying hits via the ROOT | |
192 | // macro display.C AliITS also sets the marker color to red. The variables | |
193 | // passes with this constructor, const char *name and *title, are used by | |
194 | // the constructor of AliDetector class. See AliDetector class for a | |
195 | // description of these parameters and its constructor functions. | |
fe4da5cc | 196 | // |
58005f18 | 197 | |
9c74c52b | 198 | |
58005f18 | 199 | fHits = new TClonesArray("AliITShit", 1560); |
1cedd08a | 200 | gAlice->AddHitList(fHits); |
3bd79107 | 201 | |
e8189707 | 202 | //fNDetTypes = fgkNTYPES; |
203 | ||
204 | fNdtype = new Int_t[fgkNTYPES]; | |
205 | fDtype = new TObjArray(fgkNTYPES); | |
206 | ||
207 | fNctype = new Int_t[fgkNTYPES]; | |
208 | fCtype = new TObjArray(fgkNTYPES); | |
3bd79107 | 209 | |
3bd79107 | 210 | |
211 | fRecPoints = 0; | |
212 | fNRecPoints = 0; | |
213 | ||
e8189707 | 214 | fTreeC = 0; |
3bd79107 | 215 | |
216 | fITSmodules = 0; | |
58005f18 | 217 | |
218 | fIshunt = 0; | |
219 | fEuclidOut = 0; | |
220 | fIdN = 0; | |
221 | fIdName = 0; | |
222 | fIdSens = 0; | |
3bd79107 | 223 | |
e8189707 | 224 | fDetTypes = new TObjArray(fgkNTYPES); |
3bd79107 | 225 | |
226 | Int_t i; | |
e8189707 | 227 | for(i=0;i<fgkNTYPES;i++) { |
3bd79107 | 228 | (*fDetTypes)[i]=new AliITSDetType(); |
e8189707 | 229 | fNdtype[i]=0; |
230 | fNctype[i]=0; | |
3bd79107 | 231 | } |
232 | // | |
58005f18 | 233 | |
fe4da5cc | 234 | SetMarkerColor(kRed); |
58005f18 | 235 | |
3bd79107 | 236 | fITSgeom=0; |
237 | } | |
238 | //___________________________________________________________________________ | |
239 | AliITS::AliITS(AliITS &source){ | |
e8189707 | 240 | // copy constructor |
3bd79107 | 241 | if(this==&source) return; |
d5da1ecf | 242 | Error("AliITS::Copy constructor", |
243 | "You are not allowed to make a copy of the AliITS"); | |
3bd79107 | 244 | exit(1); |
fe4da5cc | 245 | } |
3bd79107 | 246 | //____________________________________________________________________________ |
247 | AliITS& AliITS::operator=(AliITS &source){ | |
e8189707 | 248 | // assignment operator |
3bd79107 | 249 | if(this==&source) return *this; |
d5da1ecf | 250 | Error("AliITS::operator=", |
251 | "You are not allowed to make a copy of the AliITS"); | |
3bd79107 | 252 | exit(1); |
e8189707 | 253 | return *this; //fake return |
3bd79107 | 254 | } |
255 | //____________________________________________________________________________ | |
256 | void AliITS::ClearModules(){ | |
257 | //clear the modules TObjArray | |
3bd79107 | 258 | |
9c74c52b | 259 | if(fITSmodules) fITSmodules->Delete(); |
fe4da5cc | 260 | |
3bd79107 | 261 | } |
fe4da5cc | 262 | //_____________________________________________________________________________ |
58005f18 | 263 | AliITS::~AliITS(){ |
fe4da5cc | 264 | // |
265 | // Default distructor for ITS | |
58005f18 | 266 | // The default destructor of the AliITS class. In addition to deleting |
267 | // the AliITS class it deletes the memory pointed to by the fHits, fDigits, | |
268 | // fIdSens, fIdName, and fITSpoints. | |
fe4da5cc | 269 | // |
3bd79107 | 270 | |
271 | ||
fe4da5cc | 272 | delete fHits; |
273 | delete fDigits; | |
3bd79107 | 274 | delete fRecPoints; |
143d1056 | 275 | // delete fIdName; // TObjArray of TObjStrings |
276 | if(fIdName!=0) delete[] fIdName; // Array of TStrings | |
58005f18 | 277 | if(fIdSens!=0) delete[] fIdSens; |
3bd79107 | 278 | if(fITSmodules!=0) { |
279 | this->ClearModules(); | |
280 | delete fITSmodules; | |
281 | }// end if fITSmodules!=0 | |
fe4da5cc | 282 | |
fe4da5cc | 283 | // |
3bd79107 | 284 | if(fDtype) { |
9c74c52b | 285 | fDtype->Delete(); |
286 | delete fDtype; | |
3bd79107 | 287 | } |
9c74c52b | 288 | delete [] fNdtype; |
289 | if (fCtype) { | |
290 | fCtype->Delete(); | |
291 | delete fCtype; | |
3bd79107 | 292 | } |
9c74c52b | 293 | delete [] fNctype; |
fe4da5cc | 294 | // |
3bd79107 | 295 | |
296 | if (fDetTypes) { | |
297 | fDetTypes->Delete(); | |
298 | delete fDetTypes; | |
299 | } | |
300 | ||
301 | if (fTreeC) delete fTreeC; | |
e8189707 | 302 | |
9c74c52b | 303 | if (fITSgeom) delete fITSgeom; |
304 | ||
3bd79107 | 305 | } |
306 | ||
307 | //___________________________________________ | |
308 | AliITSDetType* AliITS::DetType(Int_t id) | |
309 | { | |
310 | //return pointer to id detector type | |
311 | return ((AliITSDetType*) (*fDetTypes)[id]); | |
312 | ||
313 | } | |
314 | //___________________________________________ | |
e8189707 | 315 | void AliITS::SetClasses(Int_t id, const char *digit, const char *cluster) |
3bd79107 | 316 | { |
317 | //set the digit and cluster classes to be used for the id detector type | |
318 | ((AliITSDetType*) (*fDetTypes)[id])->ClassNames(digit,cluster); | |
319 | ||
320 | } | |
321 | //___________________________________________ | |
322 | void AliITS::SetResponseModel(Int_t id, AliITSresponse *response) | |
323 | { | |
324 | //set the response model for the id detector type | |
325 | ||
326 | ((AliITSDetType*) (*fDetTypes)[id])->ResponseModel(response); | |
327 | ||
fe4da5cc | 328 | } |
329 | ||
3bd79107 | 330 | //___________________________________________ |
331 | void AliITS::SetSegmentationModel(Int_t id, AliITSsegmentation *seg) | |
332 | { | |
333 | //set the segmentation model for the id detector type | |
334 | ||
335 | ((AliITSDetType*) (*fDetTypes)[id])->SegmentationModel(seg); | |
336 | ||
337 | } | |
338 | ||
339 | //___________________________________________ | |
340 | void AliITS::SetSimulationModel(Int_t id, AliITSsimulation *sim) | |
341 | { | |
342 | //set the simulation model for the id detector type | |
343 | ||
344 | ((AliITSDetType*) (*fDetTypes)[id])->SimulationModel(sim); | |
345 | ||
346 | } | |
347 | //___________________________________________ | |
348 | void AliITS::SetReconstructionModel(Int_t id, AliITSClusterFinder *reconst) | |
349 | { | |
350 | //set the cluster finder model for the id detector type | |
351 | ||
352 | ((AliITSDetType*) (*fDetTypes)[id])->ReconstructionModel(reconst); | |
58005f18 | 353 | |
58005f18 | 354 | } |
355 | ||
fe4da5cc | 356 | //_____________________________________________________________________________ |
58005f18 | 357 | void AliITS::AddHit(Int_t track, Int_t *vol, Float_t *hits){ |
fe4da5cc | 358 | // |
359 | // Add an ITS hit | |
58005f18 | 360 | // The function to add information to the AliITShit class. See the |
361 | // AliITShit class for a full description. This function allocates the | |
362 | // necessary new space for the hit information and passes the variable | |
363 | // track, and the pointers *vol and *hits to the AliITShit constructor | |
364 | // function. | |
fe4da5cc | 365 | // |
366 | TClonesArray &lhits = *fHits; | |
367 | new(lhits[fNhits++]) AliITShit(fIshunt,track,vol,hits); | |
368 | } | |
3bd79107 | 369 | //_____________________________________________________________________________ |
370 | void AliITS::AddRealDigit(Int_t id, Int_t *digits) | |
371 | { | |
372 | // add a real digit - as coming from data | |
373 | ||
374 | TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]); | |
375 | new(ldigits[fNdtype[id]++]) AliITSdigit(digits); | |
376 | ||
377 | } | |
378 | //_____________________________________________________________________________ | |
e8189707 | 379 | void AliITS::AddSimDigit(Int_t id, AliITSdigit *d) |
3bd79107 | 380 | { |
381 | ||
382 | // add a simulated digit | |
383 | ||
3bd79107 | 384 | TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]); |
385 | ||
386 | switch(id) | |
387 | { | |
388 | case 0: | |
389 | new(ldigits[fNdtype[id]++]) AliITSdigitSPD(*((AliITSdigitSPD*)d)); | |
390 | break; | |
391 | case 1: | |
392 | new(ldigits[fNdtype[id]++]) AliITSdigitSDD(*((AliITSdigitSDD*)d)); | |
393 | break; | |
394 | case 2: | |
395 | new(ldigits[fNdtype[id]++]) AliITSdigitSSD(*((AliITSdigitSSD*)d)); | |
396 | break; | |
397 | } | |
398 | ||
399 | } | |
400 | ||
401 | //_____________________________________________________________________________ | |
e8189707 | 402 | void AliITS::AddSimDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks,Int_t *hits,Float_t *charges){ |
3bd79107 | 403 | |
404 | // add a simulated digit to the list | |
405 | ||
406 | TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]); | |
407 | switch(id) | |
408 | { | |
409 | case 0: | |
e8189707 | 410 | new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits); |
3bd79107 | 411 | break; |
412 | case 1: | |
e8189707 | 413 | new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks,hits,charges); |
3bd79107 | 414 | break; |
415 | case 2: | |
e8189707 | 416 | new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits); |
3bd79107 | 417 | break; |
418 | } | |
419 | ||
420 | } | |
421 | ||
422 | //_____________________________________________________________________________ | |
423 | void AliITS::AddCluster(Int_t id, AliITSRawCluster *c) | |
424 | { | |
425 | ||
426 | // add a cluster to the list | |
427 | ||
3bd79107 | 428 | TClonesArray &lcl = *((TClonesArray*)(*fCtype)[id]); |
429 | ||
430 | switch(id) | |
431 | { | |
432 | case 0: | |
433 | new(lcl[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c)); | |
434 | break; | |
435 | case 1: | |
436 | new(lcl[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c)); | |
437 | break; | |
438 | case 2: | |
439 | new(lcl[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c)); | |
440 | break; | |
441 | } | |
442 | ||
443 | } | |
444 | ||
445 | ||
446 | //_____________________________________________________________________________ | |
447 | void AliITS::AddRecPoint(const AliITSRecPoint &r) | |
448 | { | |
449 | // | |
450 | // Add a reconstructed space point to the list | |
451 | // | |
452 | TClonesArray &lrecp = *fRecPoints; | |
453 | new(lrecp[fNRecPoints++]) AliITSRecPoint(r); | |
454 | } | |
455 | ||
456 | ||
457 | //____________________________________________ | |
458 | void AliITS::ResetDigits() | |
459 | { | |
460 | // | |
9c74c52b | 461 | // Reset number of digits and the digits array for the ITS detector |
3bd79107 | 462 | // |
463 | ||
464 | if (!fDtype) return; | |
465 | ||
466 | Int_t i; | |
e8189707 | 467 | for (i=0;i<fgkNTYPES;i++ ) { |
3bd79107 | 468 | if ((*fDtype)[i]) ((TClonesArray*)(*fDtype)[i])->Clear(); |
469 | if (fNdtype) fNdtype[i]=0; | |
470 | } | |
471 | } | |
472 | ||
473 | //____________________________________________ | |
474 | void AliITS::ResetDigits(Int_t i) | |
475 | { | |
476 | // | |
477 | // Reset number of digits and the digits array for this branch | |
478 | // | |
e8189707 | 479 | if ((*fDtype)[i]) ((TClonesArray*)(*fDtype)[i])->Clear(); |
480 | if (fNdtype) fNdtype[i]=0; | |
3bd79107 | 481 | } |
e8189707 | 482 | |
483 | ||
3bd79107 | 484 | //____________________________________________ |
485 | void AliITS::ResetClusters() | |
486 | { | |
487 | // | |
488 | // Reset number of clusters and the clusters array for ITS | |
489 | // | |
490 | ||
491 | Int_t i; | |
e8189707 | 492 | for (i=0;i<fgkNTYPES;i++ ) { |
3bd79107 | 493 | if ((*fCtype)[i]) ((TClonesArray*)(*fCtype)[i])->Clear(); |
494 | if (fNctype) fNctype[i]=0; | |
495 | } | |
496 | ||
497 | } | |
e8189707 | 498 | |
3bd79107 | 499 | //____________________________________________ |
500 | void AliITS::ResetClusters(Int_t i) | |
501 | { | |
502 | // | |
503 | // Reset number of clusters and the clusters array for this branch | |
504 | // | |
505 | if ((*fCtype)[i]) ((TClonesArray*)(*fCtype)[i])->Clear(); | |
506 | if (fNctype) fNctype[i]=0; | |
507 | ||
508 | } | |
509 | ||
510 | ||
511 | //____________________________________________ | |
512 | void AliITS::ResetRecPoints() | |
513 | { | |
514 | // | |
515 | // Reset number of rec points and the rec points array | |
516 | // | |
3bd79107 | 517 | if (fRecPoints) fRecPoints->Clear(); |
9c74c52b | 518 | fNRecPoints = 0; |
3bd79107 | 519 | |
520 | } | |
521 | ||
fe4da5cc | 522 | //_____________________________________________________________________________ |
58005f18 | 523 | Int_t AliITS::DistancetoPrimitive(Int_t , Int_t ){ |
fe4da5cc | 524 | // |
525 | // Distance from mouse to ITS on the screen. Dummy routine | |
58005f18 | 526 | // A dummy routine used by the ROOT macro display.C to allow for the |
527 | // use of the mouse (pointing device) in the macro. In general this should | |
528 | // never be called. If it is it returns the number 9999 for any value of | |
529 | // x and y. | |
fe4da5cc | 530 | // |
531 | return 9999; | |
532 | } | |
533 | ||
534 | //_____________________________________________________________________________ | |
58005f18 | 535 | void AliITS::Init(){ |
fe4da5cc | 536 | // |
537 | // Initialise ITS after it has been built | |
58005f18 | 538 | // This routine initializes the AliITS class. It is intended to be called |
539 | // from the Init function in AliITSv?. Besides displaying a banner | |
3bd79107 | 540 | // indicating that it has been called it initializes the array fIdSens |
541 | // and sets the default segmentation, response, digit and raw cluster classes | |
58005f18 | 542 | // Therefore it should be called after a call to CreateGeometry. |
fe4da5cc | 543 | // |
544 | Int_t i; | |
143d1056 | 545 | |
d5da1ecf | 546 | cout << endl; |
547 | for(i=0;i<30;i++) cout << "*";cout << " ITS_INIT "; | |
548 | for(i=0;i<30;i++) cout << "*";cout << endl; | |
143d1056 | 549 | // |
550 | SetDefaults(); | |
551 | // TObjArray of TObjStrings | |
552 | // for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId((fIdName->At(i))->GetName()); | |
553 | // Array of TStrings | |
58005f18 | 554 | for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]); |
143d1056 | 555 | // |
d5da1ecf | 556 | for(i=0;i<70;i++) cout << "*"; |
557 | cout << endl; | |
fe4da5cc | 558 | } |
559 | ||
3bd79107 | 560 | //_____________________________________________________________________________ |
561 | void AliITS::SetDefaults() | |
562 | { | |
563 | // sets the default segmentation, response, digit and raw cluster classes | |
564 | ||
d5da1ecf | 565 | cout << "AliITS::SetDefaults" << endl; |
3bd79107 | 566 | |
567 | AliITSDetType *iDetType; | |
568 | ||
569 | //SPD | |
570 | ||
143d1056 | 571 | iDetType = DetType(0); |
572 | AliITSresponseSPD *resp0 = (AliITSresponseSPD*) iDetType->GetResponseModel(); | |
573 | if (!iDetType->GetSegmentationModel()) { | |
574 | AliITSsegmentationSPD *seg0 = new AliITSsegmentationSPD(fITSgeom); | |
575 | SetSegmentationModel(0,seg0); | |
576 | } // end if | |
577 | if (!resp0){ | |
578 | resp0 = new AliITSresponseSPD(); | |
579 | SetResponseModel(0,resp0); | |
580 | } // end if | |
3bd79107 | 581 | // set digit and raw cluster classes to be used |
143d1056 | 582 | |
583 | const char *kData0 = resp0->DataType(); | |
e8189707 | 584 | if (strstr(kData0,"real")) { |
3bd79107 | 585 | iDetType->ClassNames("AliITSdigit","AliITSRawClusterSPD"); |
586 | } else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD"); | |
587 | ||
143d1056 | 588 | // SDD |
589 | iDetType = DetType(1); | |
590 | AliITSresponseSDD *resp1 = (AliITSresponseSDD*)iDetType->GetResponseModel(); | |
d5da1ecf | 591 | //printf("SetDefaults: iDetType %p\n",iDetType); |
143d1056 | 592 | if (!iDetType->GetSegmentationModel()) { |
593 | AliITSsegmentationSDD *seg1 = new AliITSsegmentationSDD(fITSgeom,resp1); | |
594 | SetSegmentationModel(1,seg1); | |
595 | } // end if | |
d5da1ecf | 596 | //printf("SetDefaults: segm %p\n",iDetType->GetSegmentationModel()); |
143d1056 | 597 | if (!resp1) { |
598 | resp1 = new AliITSresponseSDD(); | |
599 | SetResponseModel(1,resp1); | |
600 | } | |
d5da1ecf | 601 | //printf("SetDefaults: resp %p\n",iDetType->GetResponseModel()); |
143d1056 | 602 | const char *kData1 = resp1->DataType(); |
603 | const char *kopt = resp1->ZeroSuppOption(); | |
e8189707 | 604 | if ((!strstr(kopt,"2D")) && (!strstr(kopt,"1D")) || strstr(kData1,"real") ) { |
3bd79107 | 605 | iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD"); |
606 | } else iDetType->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD"); | |
607 | ||
608 | // SSD | |
143d1056 | 609 | iDetType = DetType(2); |
610 | AliITSresponseSSD *resp2 = (AliITSresponseSSD*)iDetType->GetResponseModel(); | |
611 | if (!iDetType->GetSegmentationModel()) { | |
612 | AliITSsegmentationSSD *seg2 = new AliITSsegmentationSSD(fITSgeom); | |
613 | SetSegmentationModel(2,seg2); | |
614 | } // end if | |
615 | if (!resp2) { | |
616 | resp2 = new AliITSresponseSSD(); | |
617 | SetResponseModel(2,resp2); | |
618 | } // end if | |
619 | const char *kData2 = resp2->DataType(); | |
e8189707 | 620 | if (strstr(kData2,"real")) { |
3bd79107 | 621 | iDetType->ClassNames("AliITSdigit","AliITSRawClusterSSD"); |
622 | } else iDetType->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD"); | |
623 | ||
e8189707 | 624 | if (fgkNTYPES>3) { |
3bd79107 | 625 | Warning("SetDefaults","Only the three basic detector types are initialised!"); |
143d1056 | 626 | } // end if |
3bd79107 | 627 | |
628 | } | |
e8189707 | 629 | //_____________________________________________________________________________ |
630 | void AliITS::SetDefaultSimulation() | |
631 | { | |
632 | // to be written | |
633 | ||
634 | } | |
635 | //_____________________________________________________________________________ | |
636 | void AliITS::SetDefaultClusterFinders() | |
637 | { | |
638 | // to be written | |
639 | ||
640 | } | |
3bd79107 | 641 | //_____________________________________________________________________________ |
642 | ||
643 | void AliITS::MakeTreeC(Option_t *option) | |
644 | { | |
645 | // create a separate tree to store the clusters | |
646 | ||
d5da1ecf | 647 | cout << "AliITS::MakeTreeC" << endl; |
9c74c52b | 648 | |
3bd79107 | 649 | char *optC = strstr(option,"C"); |
650 | if (optC && !fTreeC) fTreeC = new TTree("TC","Clusters in ITS"); | |
9c74c52b | 651 | else return; |
3bd79107 | 652 | |
653 | Int_t buffersize = 4000; | |
654 | char branchname[30]; | |
655 | ||
656 | char *det[3] = {"SPD","SDD","SSD"}; | |
657 | ||
658 | // one branch for Clusters per type of detector | |
659 | Int_t i; | |
e8189707 | 660 | for (i=0; i<fgkNTYPES ;i++) { |
661 | if (fgkNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]); | |
3bd79107 | 662 | else sprintf(branchname,"%sClusters%d",GetName(),i+1); |
663 | if (fCtype && fTreeC) { | |
664 | TreeC()->Branch(branchname,&((*fCtype)[i]), buffersize); | |
d5da1ecf | 665 | cout << "Making Branch " << branchname; |
666 | cout << " for Clusters of detector type " << i+1 << endl; | |
3bd79107 | 667 | } |
668 | } | |
669 | ||
670 | } | |
671 | ||
672 | //_____________________________________________________________________________ | |
673 | void AliITS::GetTreeC(Int_t event) | |
674 | { | |
675 | ||
d5da1ecf | 676 | cout << "AliITS::GetTreeC" << endl; |
9c74c52b | 677 | |
3bd79107 | 678 | // get the clusters tree for this event and set the branch address |
679 | char treeName[20]; | |
680 | char branchname[30]; | |
681 | ||
682 | char *det[3] = {"SPD","SDD","SSD"}; | |
683 | ||
684 | ResetClusters(); | |
685 | if (fTreeC) { | |
686 | delete fTreeC; | |
687 | } | |
688 | ||
689 | sprintf(treeName,"TreeC%d",event); | |
690 | fTreeC = (TTree*)gDirectory->Get(treeName); | |
691 | ||
692 | ||
693 | TBranch *branch; | |
694 | if (fTreeC) { | |
695 | Int_t i; | |
e8189707 | 696 | for (i=0; i<fgkNTYPES; i++) { |
697 | if (fgkNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]); | |
698 | else sprintf(branchname,"%sClusters%d",GetName(),i+1); | |
699 | if (fCtype) { | |
3bd79107 | 700 | branch = fTreeC->GetBranch(branchname); |
701 | if (branch) branch->SetAddress(&((*fCtype)[i])); | |
702 | } | |
703 | } | |
704 | } else { | |
d5da1ecf | 705 | Error("AliITS::GetTreeC", |
706 | "cannot find Clusters Tree for event:%d\n",event); | |
3bd79107 | 707 | } |
708 | ||
709 | } | |
fe4da5cc | 710 | //_____________________________________________________________________________ |
58005f18 | 711 | void AliITS::MakeBranch(Option_t* option){ |
fe4da5cc | 712 | // |
3bd79107 | 713 | // Creates Tree branches for the ITS. |
fe4da5cc | 714 | // |
3bd79107 | 715 | |
716 | ||
fe4da5cc | 717 | Int_t buffersize = 4000; |
3bd79107 | 718 | char branchname[30]; |
fe4da5cc | 719 | sprintf(branchname,"%s",GetName()); |
720 | ||
721 | AliDetector::MakeBranch(option); | |
722 | ||
fe4da5cc | 723 | |
3bd79107 | 724 | // one branch for digits per type of detector |
725 | ||
726 | char *det[3] = {"SPD","SDD","SSD"}; | |
727 | ||
e8189707 | 728 | char digclass[40]; |
729 | char clclass[40]; | |
3bd79107 | 730 | |
731 | Int_t i; | |
e8189707 | 732 | for (i=0; i<fgkNTYPES ;i++) { |
3bd79107 | 733 | AliITSDetType *iDetType=DetType(i); |
e8189707 | 734 | iDetType->GetClassNames(digclass,clclass); |
735 | //printf("i, digclass, recclass %d %s %s\n",i,digclass,clclass); | |
3bd79107 | 736 | // digits |
e8189707 | 737 | (*fDtype)[i] = new TClonesArray(digclass,10000); |
3bd79107 | 738 | // clusters |
e8189707 | 739 | (*fCtype)[i] = new TClonesArray(clclass,10000); |
3bd79107 | 740 | } |
741 | ||
742 | ||
e8189707 | 743 | for (i=0; i<fgkNTYPES ;i++) { |
744 | if (fgkNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]); | |
3bd79107 | 745 | else sprintf(branchname,"%sDigits%d",GetName(),i+1); |
746 | ||
747 | if (fDtype && gAlice->TreeD()) { | |
748 | gAlice->TreeD()->Branch(branchname,&((*fDtype)[i]), buffersize); | |
d5da1ecf | 749 | cout << "Making Branch " << branchname; |
750 | cout << " for digits of type "<< i+1 << endl; | |
3bd79107 | 751 | } |
752 | } | |
753 | ||
754 | // only one branch for rec points for all detector types | |
755 | sprintf(branchname,"%sRecPoints",GetName()); | |
756 | ||
e8189707 | 757 | fRecPoints=new TClonesArray("AliITSRecPoint",10000); |
3bd79107 | 758 | |
759 | if (fRecPoints && gAlice->TreeR()) { | |
760 | gAlice->TreeR()->Branch(branchname,&fRecPoints, buffersize); | |
d5da1ecf | 761 | cout << "Making Branch " << branchname; |
762 | cout << " for reconstructed space points" << endl; | |
3bd79107 | 763 | } |
764 | ||
765 | ||
766 | } | |
767 | ||
768 | //___________________________________________ | |
769 | void AliITS::SetTreeAddress() | |
770 | { | |
771 | ||
772 | // Set branch address for the Trees. | |
773 | ||
774 | char branchname[30]; | |
775 | AliDetector::SetTreeAddress(); | |
776 | ||
777 | char *det[3] = {"SPD","SDD","SSD"}; | |
778 | ||
779 | TBranch *branch; | |
780 | TTree *treeD = gAlice->TreeD(); | |
781 | TTree *treeR = gAlice->TreeR(); | |
782 | ||
783 | Int_t i; | |
784 | if (treeD) { | |
e8189707 | 785 | for (i=0; i<fgkNTYPES; i++) { |
786 | if (fgkNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]); | |
3bd79107 | 787 | else sprintf(branchname,"%sDigits%d",GetName(),i+1); |
788 | if (fDtype) { | |
789 | branch = treeD->GetBranch(branchname); | |
790 | if (branch) branch->SetAddress(&((*fDtype)[i])); | |
791 | } | |
792 | } | |
793 | } | |
794 | ||
795 | ||
796 | if (treeR) { | |
797 | sprintf(branchname,"%sRecPoints",GetName()); | |
798 | if (fRecPoints) { | |
799 | branch = treeR->GetBranch(branchname); | |
800 | if (branch) branch->SetAddress(&fRecPoints); | |
801 | } | |
802 | } | |
803 | ||
804 | ||
805 | } | |
806 | ||
807 | //____________________________________________________________________________ | |
808 | void AliITS::InitModules(Int_t size,Int_t &nmodules){ | |
809 | ||
810 | //initialize the modules array | |
811 | ||
e8189707 | 812 | if(fITSmodules){ |
9c74c52b | 813 | fITSmodules->Delete(); |
e8189707 | 814 | delete fITSmodules; |
815 | } | |
816 | ||
3bd79107 | 817 | Int_t nl,indexMAX,index; |
3bd79107 | 818 | |
819 | if(size<=0){ // default to using data stored in AliITSgeom | |
820 | if(fITSgeom==0) { | |
d5da1ecf | 821 | Error("AliITS::InitModules", |
822 | "in AliITS::InitModule fITSgeom not defined\n"); | |
3bd79107 | 823 | return; |
824 | } // end if fITSgeom==0 | |
825 | nl = fITSgeom->GetNlayers(); | |
826 | indexMAX = fITSgeom->GetModuleIndex(nl,fITSgeom->GetNladders(nl), | |
827 | fITSgeom->GetNdetectors(nl))+1; | |
828 | nmodules = indexMAX; | |
829 | fITSmodules = new TObjArray(indexMAX); | |
3bd79107 | 830 | for(index=0;index<indexMAX;index++){ |
3bd79107 | 831 | fITSmodules->AddAt( new AliITSmodule(index),index); |
3bd79107 | 832 | } // end for index |
833 | }else{ | |
834 | fITSmodules = new TObjArray(size); | |
9c74c52b | 835 | for(index=0;index<size;index++) { |
836 | fITSmodules->AddAt( new AliITSmodule(index),index); | |
837 | } | |
838 | ||
3bd79107 | 839 | nmodules = size; |
840 | } // end i size<=0 | |
841 | } | |
842 | ||
843 | //____________________________________________________________________________ | |
e8189707 | 844 | void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,Option_t *option,Text_t *filename){ |
3bd79107 | 845 | |
846 | // fill the modules with the sorted by module hits; add hits from background | |
847 | // if option=Add | |
848 | ||
9c74c52b | 849 | |
3bd79107 | 850 | static TTree *trH1; //Tree with background hits |
851 | static TClonesArray *fHits2; //List of hits for one track only | |
852 | ||
853 | static Bool_t first=kTRUE; | |
854 | static TFile *file; | |
e8189707 | 855 | char *addBgr = strstr(option,"Add"); |
3bd79107 | 856 | |
857 | ||
e8189707 | 858 | if (addBgr ) { |
3bd79107 | 859 | if(first) { |
860 | cout<<"filename "<<filename<<endl; | |
861 | file=new TFile(filename); | |
862 | cout<<"I have opened "<<filename<<" file "<<endl; | |
863 | fHits2 = new TClonesArray("AliITShit",1000 ); | |
864 | } | |
865 | first=kFALSE; | |
866 | file->cd(); | |
867 | file->ls(); | |
868 | // Get Hits Tree header from file | |
869 | if(fHits2) fHits2->Clear(); | |
870 | if(trH1) delete trH1; | |
871 | trH1=0; | |
872 | ||
873 | char treeName[20]; | |
874 | sprintf(treeName,"TreeH%d",bgrev); | |
875 | trH1 = (TTree*)gDirectory->Get(treeName); | |
876 | //printf("TrH1 %p of treename %s for event %d \n",trH1,treeName,bgrev); | |
877 | ||
878 | if (!trH1) { | |
d5da1ecf | 879 | Error("AliITS::FillModules", |
880 | "cannot find Hits Tree for event:%d\n",bgrev); | |
3bd79107 | 881 | } |
882 | // Set branch addresses | |
883 | TBranch *branch; | |
884 | char branchname[20]; | |
885 | sprintf(branchname,"%s",GetName()); | |
886 | if (trH1 && fHits2) { | |
887 | branch = trH1->GetBranch(branchname); | |
888 | if (branch) branch->SetAddress(&fHits2); | |
889 | } | |
890 | ||
891 | // test | |
892 | //Int_t ntracks1 =(Int_t)TrH1->GetEntries(); | |
893 | //printf("background - ntracks1 - %d\n",ntracks1); | |
894 | } | |
895 | ||
3bd79107 | 896 | Int_t npart = gAlice->GetEvent(evnt); |
897 | if(npart<=0) return; | |
898 | TClonesArray *itsHits = this->Hits(); | |
899 | Int_t lay,lad,det,index; | |
900 | AliITShit *itsHit=0; | |
901 | AliITSmodule *mod=0; | |
902 | ||
903 | TTree *iTH = gAlice->TreeH(); | |
904 | Int_t ntracks =(Int_t) iTH->GetEntries(); | |
905 | ||
906 | Int_t t,h; | |
907 | for(t=0; t<ntracks; t++){ | |
908 | gAlice->ResetHits(); | |
909 | iTH->GetEvent(t); | |
910 | Int_t nhits = itsHits->GetEntriesFast(); | |
9c74c52b | 911 | //printf("nhits %d\n",nhits); |
3bd79107 | 912 | if (!nhits) continue; |
3bd79107 | 913 | for(h=0; h<nhits; h++){ |
914 | itsHit = (AliITShit *)itsHits->UncheckedAt(h); | |
915 | itsHit->GetDetectorID(lay,lad,det); | |
9c74c52b | 916 | // temporarily index=det-1 !!! |
917 | if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det); | |
918 | else index=det-1; | |
919 | // | |
3bd79107 | 920 | mod = this->GetModule(index); |
9c74c52b | 921 | mod->AddHit(itsHit,t,h); |
3bd79107 | 922 | } // end loop over hits |
923 | } // end loop over tracks | |
924 | ||
925 | // open the file with background | |
926 | ||
e8189707 | 927 | if (addBgr ) { |
928 | Int_t track,i; | |
3bd79107 | 929 | ntracks =(Int_t)trH1->GetEntries(); |
930 | //printf("background - ntracks1 %d\n",ntracks); | |
931 | //printf("background - Start loop over tracks \n"); | |
932 | // Loop over tracks | |
933 | ||
e8189707 | 934 | for (track=0; track<ntracks; track++) { |
3bd79107 | 935 | |
936 | if (fHits2) fHits2->Clear(); | |
937 | trH1->GetEvent(track); | |
938 | // Loop over hits | |
939 | for(i=0;i<fHits2->GetEntriesFast();++i) { | |
940 | ||
941 | itsHit=(AliITShit*) (*fHits2)[i]; | |
942 | itsHit->GetDetectorID(lay,lad,det); | |
9c74c52b | 943 | // temporarily index=det-1 !!! |
944 | if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det); | |
945 | else index=det-1; | |
946 | // | |
3bd79107 | 947 | mod = this->GetModule(index); |
9c74c52b | 948 | mod->AddHit(itsHit,track,i); |
3bd79107 | 949 | } // end loop over hits |
950 | } // end loop over tracks | |
951 | ||
952 | TTree *fAli=gAlice->TreeK(); | |
953 | TFile *fileAli=0; | |
954 | ||
955 | if (fAli) fileAli =fAli->GetCurrentFile(); | |
9c74c52b | 956 | fileAli->cd(); |
3bd79107 | 957 | |
958 | } // end if add | |
959 | ||
3bd79107 | 960 | //gObjectTable->Print(); |
961 | ||
962 | } | |
963 | ||
964 | ||
965 | //____________________________________________________________________________ | |
e8189707 | 966 | void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size, Option_t *option, Option_t *opt,Text_t *filename) |
3bd79107 | 967 | { |
968 | // keep galice.root for signal and name differently the file for | |
969 | // background when add! otherwise the track info for signal will be lost ! | |
970 | ||
9c74c52b | 971 | // the condition below will disappear when the geom class will be |
972 | // initialised for all versions - for the moment it is only for v5 ! | |
973 | // 7 is the SDD beam test version | |
974 | Int_t ver = this->IsVersion(); | |
975 | if(ver!=5 && ver!=7) return; | |
976 | ||
3bd79107 | 977 | char *all = strstr(opt,"All"); |
978 | char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")}; | |
3bd79107 | 979 | |
980 | Int_t nmodules; | |
981 | InitModules(size,nmodules); | |
e8189707 | 982 | FillModules(evNumber,bgrev,nmodules,option,filename); |
3bd79107 | 983 | |
9c74c52b | 984 | //TBranch *branch; |
3bd79107 | 985 | AliITSsimulation* sim; |
9c74c52b | 986 | //TObjArray *branches=gAlice->TreeD()->GetListOfBranches(); |
3bd79107 | 987 | AliITSgeom *geom = GetITSgeom(); |
988 | ||
989 | Int_t id,module; | |
9c74c52b | 990 | Int_t first,last; |
e8189707 | 991 | for (id=0;id<fgkNTYPES;id++) { |
3bd79107 | 992 | if (!all && !det[id]) continue; |
9c74c52b | 993 | //branch = (TBranch*)branches->UncheckedAt(id); |
3bd79107 | 994 | AliITSDetType *iDetType=DetType(id); |
995 | sim = (AliITSsimulation*)iDetType->GetSimulationModel(); | |
996 | if (!sim) { | |
997 | Error("HitsToDigits","The simulation class was not instantiated!"); | |
998 | exit(1); | |
e8189707 | 999 | // or SetDefaultSimulation(); |
3bd79107 | 1000 | } |
9c74c52b | 1001 | if(geom) { |
1002 | first = geom->GetStartDet(id); | |
1003 | last = geom->GetLastDet(id); | |
1004 | } else first=last=0; | |
d5da1ecf | 1005 | cout << "det type " << id << " first, last "<< first << last << endl; |
3bd79107 | 1006 | for(module=first;module<=last;module++) { |
1007 | AliITSmodule *mod = (AliITSmodule *)fITSmodules->At(module); | |
1008 | sim->DigitiseModule(mod,module,evNumber); | |
1009 | // fills all branches - wasted disk space | |
1010 | gAlice->TreeD()->Fill(); | |
1011 | ResetDigits(); | |
1012 | // try and fill only the branch | |
1013 | //branch->Fill(); | |
1014 | //ResetDigits(id); | |
1015 | } // loop over modules | |
1016 | } // loop over detector types | |
1017 | ||
3bd79107 | 1018 | ClearModules(); |
1019 | ||
e8189707 | 1020 | Int_t nentries=(Int_t)gAlice->TreeD()->GetEntries(); |
d5da1ecf | 1021 | cout << "nentries in TreeD" << nentries << endl; |
3bd79107 | 1022 | |
1023 | char hname[30]; | |
1024 | sprintf(hname,"TreeD%d",evNumber); | |
1025 | gAlice->TreeD()->Write(hname); | |
1026 | // reset tree | |
1027 | gAlice->TreeD()->Reset(); | |
1028 | ||
1029 | } | |
1030 | ||
1031 | ||
1032 | //____________________________________________________________________________ | |
1033 | void AliITS::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt) | |
1034 | { | |
e8189707 | 1035 | // cluster finding and reconstruction of space points |
3bd79107 | 1036 | |
9c74c52b | 1037 | // the condition below will disappear when the geom class will be |
1038 | // initialised for all versions - for the moment it is only for v5 ! | |
1039 | // 7 is the SDD beam test version | |
1040 | Int_t ver = this->IsVersion(); | |
1041 | if(ver!=5 && ver!=7) return; | |
1042 | ||
3bd79107 | 1043 | char *all = strstr(opt,"All"); |
1044 | char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")}; | |
1045 | ||
1046 | static Bool_t first=kTRUE; | |
1047 | if (first) { | |
1048 | MakeTreeC("C"); | |
1049 | first=kFALSE; | |
1050 | } | |
3bd79107 | 1051 | |
9c74c52b | 1052 | TTree *iTC=TreeC(); |
1053 | ||
1054 | //TBranch *branch; | |
3bd79107 | 1055 | AliITSClusterFinder* rec; |
1056 | ||
9c74c52b | 1057 | //TObjArray *branches=gAlice->TreeR()->GetListOfBranches(); |
3bd79107 | 1058 | AliITSgeom *geom = GetITSgeom(); |
1059 | ||
1060 | Int_t id,module; | |
e8189707 | 1061 | for (id=0;id<fgkNTYPES;id++) { |
3bd79107 | 1062 | if (!all && !det[id]) continue; |
9c74c52b | 1063 | //branch = (TBranch*)branches->UncheckedAt(id); |
3bd79107 | 1064 | AliITSDetType *iDetType=DetType(id); |
1065 | rec = (AliITSClusterFinder*)iDetType->GetReconstructionModel(); | |
1066 | if (!rec) { | |
1067 | Error("DigitsToRecPoints","The cluster finder class was not instantiated!"); | |
1068 | exit(1); | |
e8189707 | 1069 | // or SetDefaultClusterFinders(); |
3bd79107 | 1070 | } |
1071 | TClonesArray *itsDigits = this->DigitsAddress(id); | |
1072 | ||
9c74c52b | 1073 | Int_t first,last; |
1074 | if(geom) { | |
1075 | first = geom->GetStartDet(id); | |
1076 | last = geom->GetLastDet(id); | |
1077 | } else first=last=0; | |
1078 | //printf("first last %d %d\n",first,last); | |
3bd79107 | 1079 | for(module=first;module<=last;module++) { |
3bd79107 | 1080 | this->ResetDigits(); |
1081 | if (all) gAlice->TreeD()->GetEvent(lastentry+module); | |
1082 | else gAlice->TreeD()->GetEvent(lastentry+(module-first)); | |
1083 | Int_t ndigits = itsDigits->GetEntriesFast(); | |
1084 | if (ndigits) rec->FindRawClusters(); | |
1085 | gAlice->TreeR()->Fill(); | |
1086 | ResetRecPoints(); | |
1087 | iTC->Fill(); | |
1088 | ResetClusters(); | |
1089 | // try and fill only the branch | |
1090 | //branch->Fill(); | |
1091 | //ResetRecPoints(id); | |
1092 | } // loop over modules | |
1093 | } // loop over detector types | |
1094 | ||
1095 | ||
e8189707 | 1096 | Int_t nentries=(Int_t)gAlice->TreeR()->GetEntries(); |
1097 | Int_t ncentries=(Int_t)iTC->GetEntries(); | |
d5da1ecf | 1098 | cout << " nentries ncentries " << nentries << ncentries << endl; |
3bd79107 | 1099 | |
1100 | char hname[30]; | |
1101 | sprintf(hname,"TreeR%d",evNumber); | |
1102 | gAlice->TreeR()->Write(hname); | |
1103 | // reset tree | |
1104 | gAlice->TreeR()->Reset(); | |
1105 | ||
1106 | sprintf(hname,"TreeC%d",evNumber); | |
1107 | iTC->Write(hname); | |
1108 | iTC->Reset(); | |
1109 | } | |
1110 | ||
1111 | ||
1112 | //____________________________________________________________________________ | |
e8189707 | 1113 | void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size, |
3bd79107 | 1114 | Option_t *option,Option_t *opt,Text_t *filename) |
1115 | { | |
1116 | // keep galice.root for signal and name differently the file for | |
1117 | // background when add! otherwise the track info for signal will be lost ! | |
1118 | ||
9c74c52b | 1119 | |
1120 | // the condition below will disappear when the geom class will be | |
1121 | // initialised for all versions - for the moment it is only for v5 ! | |
1122 | Int_t ver = this->IsVersion(); | |
1123 | if(ver!=5) return; | |
1124 | ||
3bd79107 | 1125 | char *all = strstr(opt,"All"); |
1126 | char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")}; | |
1127 | ||
1128 | Int_t nmodules; | |
e8189707 | 1129 | InitModules(size,nmodules); |
1130 | FillModules(evNumber,bgrev,nmodules,option,filename); | |
3bd79107 | 1131 | |
1132 | ||
e8189707 | 1133 | AliITSsimulation* sim; |
3bd79107 | 1134 | AliITSgeom *geom = GetITSgeom(); |
1135 | ||
e8189707 | 1136 | TRandom *random=new TRandom[9]; |
1137 | random[0].SetSeed(111); | |
1138 | random[1].SetSeed(222); | |
1139 | random[2].SetSeed(333); | |
1140 | random[3].SetSeed(444); | |
1141 | random[4].SetSeed(555); | |
1142 | random[5].SetSeed(666); | |
1143 | random[6].SetSeed(777); | |
1144 | random[7].SetSeed(888); | |
1145 | random[8].SetSeed(999); | |
1146 | ||
1147 | ||
3bd79107 | 1148 | Int_t id,module; |
e8189707 | 1149 | for (id=0;id<fgkNTYPES;id++) { |
3bd79107 | 1150 | if (!all && !det[id]) continue; |
e8189707 | 1151 | AliITSDetType *iDetType=DetType(id); |
1152 | sim = (AliITSsimulation*)iDetType->GetSimulationModel(); | |
1153 | if (!sim) { | |
1154 | Error("HitsToFastPoints","The simulation class was not instantiated!"); | |
1155 | exit(1); | |
1156 | // or SetDefaultSimulation(); | |
1157 | } | |
3bd79107 | 1158 | Int_t first = geom->GetStartDet(id); |
1159 | Int_t last = geom->GetLastDet(id); | |
1160 | for(module=first;module<=last;module++) { | |
1161 | AliITSmodule *mod = (AliITSmodule *)fITSmodules->At(module); | |
e8189707 | 1162 | sim->CreateFastRecPoints(mod,module,random); |
3bd79107 | 1163 | gAlice->TreeR()->Fill(); |
1164 | ResetRecPoints(); | |
1165 | } // loop over modules | |
1166 | } // loop over detector types | |
1167 | ||
1168 | ||
1169 | ClearModules(); | |
1170 | ||
1171 | //Int_t nentries=(Int_t)gAlice->TreeR()->GetEntries(); | |
1172 | ||
1173 | char hname[30]; | |
1174 | sprintf(hname,"TreeR%d",evNumber); | |
1175 | gAlice->TreeR()->Write(hname); | |
1176 | // reset tree | |
1177 | gAlice->TreeR()->Reset(); | |
1178 | ||
e8189707 | 1179 | delete [] random; |
1180 | ||
fe4da5cc | 1181 | } |
1182 | ||
d5da1ecf | 1183 | |
e8189707 | 1184 | //____________________________________________________________________________ |
1185 | void AliITS::Streamer(TBuffer &R__b){ | |
58005f18 | 1186 | // Stream an object of class AliITS. |
3bd79107 | 1187 | |
e8189707 | 1188 | Int_t i; |
3bd79107 | 1189 | |
58005f18 | 1190 | if (R__b.IsReading()) { |
235841d0 | 1191 | Version_t R__v = R__b.ReadVersion(); |
1192 | if (R__v) { | |
1193 | AliDetector::Streamer(R__b); | |
e8189707 | 1194 | R__b >> fIdN; |
1195 | R__b.ReadArray(fIdSens); | |
143d1056 | 1196 | if(fIdName!=0) delete[] fIdName; // Array of TStrings |
1197 | fIdName = new TString[fIdN]; | |
e8189707 | 1198 | for(i=0;i<fIdN;i++) fIdName[i].Streamer(R__b); |
235841d0 | 1199 | R__b >> fITSgeom; |
1200 | R__b >> fITSmodules; | |
1201 | R__b >> fEuclidOut; | |
235841d0 | 1202 | R__b >> fMajorVersion; |
1203 | R__b >> fMinorVersion; | |
1204 | R__b >> fDetTypes; | |
235841d0 | 1205 | R__b >> fDtype; |
1206 | delete []fNdtype; | |
e8189707 | 1207 | fNdtype = new Int_t[fgkNTYPES]; |
1208 | R__b.ReadFastArray(fNdtype,fgkNTYPES); | |
235841d0 | 1209 | R__b >> fCtype; |
1210 | delete []fNctype; | |
e8189707 | 1211 | fNctype = new Int_t[fgkNTYPES]; |
1212 | R__b.ReadFastArray(fNctype,fgkNTYPES); | |
235841d0 | 1213 | R__b >> fRecPoints; |
1214 | R__b >> fNRecPoints; | |
235841d0 | 1215 | R__b >> fTreeC; |
1216 | } // end if R__v | |
1217 | } else { // writing | |
58005f18 | 1218 | R__b.WriteVersion(AliITS::IsA()); |
1219 | AliDetector::Streamer(R__b); | |
e8189707 | 1220 | R__b << fIdN; |
1221 | R__b.WriteArray(fIdSens,fIdN); | |
1222 | for(i=0;i<fIdN;i++) fIdName[i].Streamer(R__b); | |
58005f18 | 1223 | R__b << fITSgeom; |
2b2439bd | 1224 | R__b << fITSmodules; |
58005f18 | 1225 | R__b << fEuclidOut; |
58005f18 | 1226 | R__b << fMajorVersion; |
1227 | R__b << fMinorVersion; | |
3bd79107 | 1228 | R__b << fDetTypes; |
2b2439bd | 1229 | R__b << fDtype; |
e8189707 | 1230 | R__b.WriteFastArray(fNdtype,fgkNTYPES); |
2b2439bd | 1231 | R__b << fCtype; |
e8189707 | 1232 | R__b.WriteFastArray(fNctype,fgkNTYPES); |
3bd79107 | 1233 | R__b << fRecPoints; |
1234 | R__b << fNRecPoints; | |
2b2439bd | 1235 | R__b << fTreeC; |
235841d0 | 1236 | } // end if |
e8189707 | 1237 | |
fe4da5cc | 1238 | } |