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