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