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