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$ |
686b2f43 |
18 | Revision 1.43 2001/04/26 13:22:52 barbera |
19 | TMatrix and TVector elimininated to speed up the code |
20 | |
53e7090a |
21 | Revision 1.42 2001/04/25 21:55:12 barbera |
22 | Updated version to be compatible with actual verion of STEER and TPC |
23 | |
8ab89103 |
24 | Revision 1.41 2001/04/21 15:16:51 barbera |
25 | Updated with the new SSD reconstruction code |
26 | |
fd61217e |
27 | Revision 1.40 2001/03/17 15:07:06 mariana |
28 | Update SDD response parameters |
29 | |
37de990d |
30 | Revision 1.39 2001/03/12 17:45:32 hristov |
31 | Changes needed on Sun with CC 5.0 |
32 | |
5cf7bbad |
33 | Revision 1.38 2001/03/07 14:04:51 barbera |
34 | Some vector dimensions increased to cope with full events |
35 | |
54fcea18 |
36 | Revision 1.37 2001/03/07 12:36:35 barbera |
37 | A change added in the tracking part to manage delta rays |
38 | |
4f06a953 |
39 | Revision 1.36 2001/03/02 19:44:11 barbera |
40 | modified to taking into account new version tracking v1 |
41 | |
8af13b4b |
42 | Revision 1.35 2001/02/28 18:16:46 mariana |
43 | Make the code compatible with the new AliRun |
44 | |
340cd0d8 |
45 | Revision 1.34 2001/02/11 15:51:39 mariana |
46 | Set protection in MakeBranch |
47 | |
c34b4885 |
48 | Revision 1.33 2001/02/10 22:26:39 mariana |
49 | Move the initialization of the containers for raw clusters in MakeTreeC() |
50 | |
caf37aec |
51 | Revision 1.32 2001/02/08 23:55:31 nilsen |
52 | Removed fMajor/MinorVersion variables in favor of variables in derived classes. |
53 | Set arrays char *det[3] = {"SPD","SDD","SSD"} as const. |
54 | |
04874c1a |
55 | Revision 1.31 2001/02/02 23:57:28 nilsen |
56 | Added include file that are no londer included in AliITSgeom.h |
57 | |
d953664a |
58 | Revision 1.30 2001/01/30 09:23:13 hristov |
59 | Streamers removed (R.Brun) |
60 | |
a8a6107b |
61 | Revision 1.29 2001/01/26 20:01:09 hristov |
62 | Major upgrade of AliRoot code |
63 | |
2ab0c725 |
64 | Revision 1.28 2000/12/18 14:02:00 barbera |
65 | new version of the ITS tracking to take into account the new TPC track parametrization |
66 | |
cc6e75dd |
67 | Revision 1.27 2000/12/08 13:49:27 barbera |
68 | Hidden declaration in a for loop removed to be compliant with HP-UX compiler |
69 | |
c5b22044 |
70 | Revision 1.26 2000/11/27 13:12:13 barbera |
71 | New version containing the files for tracking |
72 | |
55b5a0b3 |
73 | Revision 1.25 2000/11/12 22:38:05 barbera |
74 | Added header file for the SPD Bari model |
75 | |
dfe2a93f |
76 | Revision 1.24 2000/10/09 22:18:12 barbera |
77 | Bug fixes from MAriana to le AliITStest.C run correctly |
78 | |
65d4384f |
79 | Revision 1.23 2000/10/05 20:47:42 nilsen |
80 | fixed dependencies of include files. Tryed but failed to get a root automaticly |
81 | generates streamer function to work. Modified SetDefaults. |
82 | |
143d1056 |
83 | Revision 1.9.2.15 2000/10/04 16:56:40 nilsen |
84 | Needed to include stdlib.h |
85 | |
86 | ======= |
87 | Revision 1.22 2000/10/04 19:45:52 barbera |
88 | Corrected by F. Carminati for v3.04 |
89 | |
114da3a4 |
90 | Revision 1.21 2000/10/02 21:28:08 fca |
91 | Removal of useless dependecies via forward declarations |
92 | |
94de3818 |
93 | Revision 1.20 2000/10/02 16:31:39 barbera |
94 | General code clean-up |
95 | |
d5da1ecf |
96 | Revision 1.9.2.14 2000/10/02 15:43:51 barbera |
97 | General code clean-up (e.g., printf -> cout) |
98 | |
99 | Revision 1.19 2000/09/22 12:13:25 nilsen |
100 | Patches and updates for fixes to this and other routines. |
101 | |
9c74c52b |
102 | Revision 1.18 2000/07/12 05:32:20 fca |
103 | Correcting several syntax problem with static members |
104 | |
b669392e |
105 | Revision 1.17 2000/07/10 16:07:18 fca |
106 | Release version of ITS code |
107 | |
3bd79107 |
108 | Revision 1.9.2.3 2000/02/02 13:42:09 barbera |
109 | fixed AliITS.cxx for new AliRun structure. Added ITS hits list to list of hits which will have their track numbers updated |
110 | |
111 | Revision 1.9.2.2 2000/01/23 03:03:13 nilsen |
112 | //fixed FillModule. Removed fi(fabs(xl)<dx.... |
113 | |
114 | Revision 1.9.2.1 2000/01/12 19:03:32 nilsen |
115 | This is the version of the files after the merging done in December 1999. |
116 | See the ReadMe110100.txt file for details |
c9a71be1 |
117 | |
1cedd08a |
118 | Revision 1.9 1999/11/14 14:33:25 fca |
119 | Correct problems with distructors and pointers, thanks to I.Hrivnacova |
120 | |
6c854497 |
121 | Revision 1.8 1999/09/29 09:24:19 fca |
122 | Introduction of the Copyright and cvs Log |
123 | |
4c039060 |
124 | */ |
125 | |
fe4da5cc |
126 | /////////////////////////////////////////////////////////////////////////////// |
58005f18 |
127 | // |
128 | // An overview of the basic philosophy of the ITS code development |
129 | // and analysis is show in the figure below. |
fe4da5cc |
130 | //Begin_Html |
131 | /* |
a92b2b7d |
132 | <img src="picts/ITS/ITS_Analysis_schema.gif"> |
fe4da5cc |
133 | </pre> |
134 | <br clear=left> |
135 | <font size=+2 color=red> |
58005f18 |
136 | <p>Roberto Barbera is in charge of the ITS Offline code (1999). |
fe4da5cc |
137 | <a href="mailto:roberto.barbera@ct.infn.it">Roberto Barbera</a>. |
138 | </font> |
139 | <pre> |
140 | */ |
141 | //End_Html |
58005f18 |
142 | // |
143 | // AliITS. Inner Traking System base class. |
144 | // This class contains the base procedures for the Inner Tracking System |
145 | // |
146 | //Begin_Html |
147 | /* |
a92b2b7d |
148 | <img src="picts/ITS/AliITS_Class_Diagram.gif"> |
58005f18 |
149 | </pre> |
150 | <br clear=left> |
151 | <font size=+2 color=red> |
152 | <p>This show the class diagram of the different elements that are part of |
153 | the AliITS class. |
154 | </font> |
155 | <pre> |
156 | */ |
157 | //End_Html |
158 | // |
159 | // Version: 0 |
160 | // Written by Rene Brun, Federico Carminati, and Roberto Barbera |
161 | // |
162 | // Version: 1 |
163 | // Modified and documented by Bjorn S. Nilsen |
164 | // July 11 1999 |
165 | // |
3bd79107 |
166 | // Version: 2 |
167 | // Modified and documented by A. Bologna |
168 | // October 18 1999 |
169 | // |
58005f18 |
170 | // AliITS is the general base class for the ITS. Also see AliDetector for |
171 | // futher information. |
172 | // |
fe4da5cc |
173 | /////////////////////////////////////////////////////////////////////////////// |
d953664a |
174 | #include <iostream.h> |
175 | #include <iomanip.h> |
176 | #include <fstream.h> |
143d1056 |
177 | #include <stdlib.h> |
fe4da5cc |
178 | #include <TMath.h> |
179 | #include <TRandom.h> |
9c74c52b |
180 | #include <TBranch.h> |
fe4da5cc |
181 | #include <TVector.h> |
caf37aec |
182 | #include <TClonesArray.h> |
3bd79107 |
183 | #include <TROOT.h> |
184 | #include <TObjectTable.h> |
9c74c52b |
185 | #include <TFile.h> |
186 | #include <TTree.h> |
d5da1ecf |
187 | #include <TString.h> |
4f06a953 |
188 | #include <TParticle.h> |
3bd79107 |
189 | |
bb8ac1e0 |
190 | |
fe4da5cc |
191 | #include "AliRun.h" |
3bd79107 |
192 | #include "AliITS.h" |
193 | #include "AliITSMap.h" |
e8189707 |
194 | #include "AliITSDetType.h" |
3bd79107 |
195 | #include "AliITSClusterFinder.h" |
caf37aec |
196 | //#include "AliITSsimulation.h" |
197 | #include "AliITSsimulationSPD.h" |
198 | #include "AliITSsimulationSDD.h" |
199 | #include "AliITSsimulationSSD.h" |
143d1056 |
200 | #include "AliITSresponse.h" |
3bd79107 |
201 | #include "AliITSsegmentationSPD.h" |
202 | #include "AliITSresponseSPD.h" |
dfe2a93f |
203 | #include "AliITSresponseSPDbari.h" |
3bd79107 |
204 | #include "AliITSsegmentationSDD.h" |
205 | #include "AliITSresponseSDD.h" |
206 | #include "AliITSsegmentationSSD.h" |
207 | #include "AliITSresponseSSD.h" |
9c74c52b |
208 | #include "AliITShit.h" |
209 | #include "AliITSgeom.h" |
210 | #include "AliITSdigit.h" |
211 | #include "AliITSmodule.h" |
212 | #include "AliITSRecPoint.h" |
213 | #include "AliITSRawCluster.h" |
94de3818 |
214 | #include "AliMC.h" |
114da3a4 |
215 | #include "stdlib.h" |
8ab89103 |
216 | #include "AliKalmanTrack.h" |
217 | #include "AliMagF.h" |
e8189707 |
218 | |
55b5a0b3 |
219 | #include "AliITStrack.h" |
220 | #include "AliITSiotrack.h" |
8af13b4b |
221 | #include "AliITStracking.h" |
222 | #include "AliITSRad.h" |
55b5a0b3 |
223 | #include "../TPC/AliTPC.h" |
224 | #include "../TPC/AliTPCParam.h" |
225 | |
c9a71be1 |
226 | |
3bd79107 |
227 | ClassImp(AliITS) |
228 | |
fe4da5cc |
229 | //_____________________________________________________________________________ |
3bd79107 |
230 | AliITS::AliITS() : AliDetector() { |
fe4da5cc |
231 | // |
232 | // Default initialiser for ITS |
58005f18 |
233 | // The default constructor of the AliITS class. In addition to |
234 | // creating the AliITS class it zeros the variables fIshunt (a member |
235 | // of AliDetector class), fEuclidOut, and fIdN, and zeros the pointers |
3bd79107 |
236 | // fITSpoints, fIdSens, and fIdName. The AliDetector default constructor |
237 | // is also called. |
fe4da5cc |
238 | // |
3bd79107 |
239 | |
9c74c52b |
240 | |
58005f18 |
241 | fIshunt = 0; |
242 | fEuclidOut = 0; |
e8189707 |
243 | |
a8a6107b |
244 | fNDetTypes = kNTYPES; |
58005f18 |
245 | fIdN = 0; |
246 | fIdName = 0; |
247 | fIdSens = 0; |
6c854497 |
248 | fITSmodules = 0; |
3bd79107 |
249 | // |
250 | fDetTypes = 0; |
3bd79107 |
251 | // |
252 | fDtype = 0; |
253 | fNdtype = 0; |
254 | fCtype = 0; |
255 | fNctype = 0; |
256 | fRecPoints = 0; |
257 | fNRecPoints = 0; |
e8189707 |
258 | fTreeC = 0; |
3bd79107 |
259 | // |
260 | fITSgeom=0; |
fe4da5cc |
261 | } |
3bd79107 |
262 | |
fe4da5cc |
263 | //_____________________________________________________________________________ |
58005f18 |
264 | AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){ |
fe4da5cc |
265 | // |
266 | // Default initialiser for ITS |
58005f18 |
267 | // The constructor of the AliITS class. In addition to creating the |
268 | // AliITS class, it allocates memory for the TClonesArrays fHits and |
269 | // fDigits, and for the TObjArray fITSpoints. It also zeros the variables |
270 | // fIshunt (a member of AliDetector class), fEuclidOut, and fIdN, and zeros |
271 | // the pointers fIdSens and fIdName. To help in displaying hits via the ROOT |
272 | // macro display.C AliITS also sets the marker color to red. The variables |
273 | // passes with this constructor, const char *name and *title, are used by |
274 | // the constructor of AliDetector class. See AliDetector class for a |
275 | // description of these parameters and its constructor functions. |
fe4da5cc |
276 | // |
58005f18 |
277 | |
9c74c52b |
278 | |
58005f18 |
279 | fHits = new TClonesArray("AliITShit", 1560); |
1cedd08a |
280 | gAlice->AddHitList(fHits); |
3bd79107 |
281 | |
a8a6107b |
282 | fNDetTypes = kNTYPES; |
e8189707 |
283 | |
a8a6107b |
284 | fNdtype = new Int_t[kNTYPES]; |
285 | fDtype = new TObjArray(kNTYPES); |
e8189707 |
286 | |
a8a6107b |
287 | fNctype = new Int_t[kNTYPES]; |
288 | fCtype = new TObjArray(kNTYPES); |
3bd79107 |
289 | |
3bd79107 |
290 | |
291 | fRecPoints = 0; |
292 | fNRecPoints = 0; |
293 | |
e8189707 |
294 | fTreeC = 0; |
3bd79107 |
295 | |
296 | fITSmodules = 0; |
58005f18 |
297 | |
298 | fIshunt = 0; |
299 | fEuclidOut = 0; |
300 | fIdN = 0; |
301 | fIdName = 0; |
302 | fIdSens = 0; |
3bd79107 |
303 | |
a8a6107b |
304 | fDetTypes = new TObjArray(kNTYPES); |
3bd79107 |
305 | |
306 | Int_t i; |
a8a6107b |
307 | for(i=0;i<kNTYPES;i++) { |
3bd79107 |
308 | (*fDetTypes)[i]=new AliITSDetType(); |
e8189707 |
309 | fNdtype[i]=0; |
310 | fNctype[i]=0; |
3bd79107 |
311 | } |
312 | // |
58005f18 |
313 | |
fe4da5cc |
314 | SetMarkerColor(kRed); |
58005f18 |
315 | |
3bd79107 |
316 | fITSgeom=0; |
317 | } |
318 | //___________________________________________________________________________ |
319 | AliITS::AliITS(AliITS &source){ |
e8189707 |
320 | // copy constructor |
3bd79107 |
321 | if(this==&source) return; |
d5da1ecf |
322 | Error("AliITS::Copy constructor", |
323 | "You are not allowed to make a copy of the AliITS"); |
3bd79107 |
324 | exit(1); |
fe4da5cc |
325 | } |
3bd79107 |
326 | //____________________________________________________________________________ |
327 | AliITS& AliITS::operator=(AliITS &source){ |
e8189707 |
328 | // assignment operator |
3bd79107 |
329 | if(this==&source) return *this; |
d5da1ecf |
330 | Error("AliITS::operator=", |
331 | "You are not allowed to make a copy of the AliITS"); |
3bd79107 |
332 | exit(1); |
e8189707 |
333 | return *this; //fake return |
3bd79107 |
334 | } |
335 | //____________________________________________________________________________ |
336 | void AliITS::ClearModules(){ |
337 | //clear the modules TObjArray |
3bd79107 |
338 | |
9c74c52b |
339 | if(fITSmodules) fITSmodules->Delete(); |
fe4da5cc |
340 | |
3bd79107 |
341 | } |
fe4da5cc |
342 | //_____________________________________________________________________________ |
58005f18 |
343 | AliITS::~AliITS(){ |
fe4da5cc |
344 | // |
345 | // Default distructor for ITS |
58005f18 |
346 | // The default destructor of the AliITS class. In addition to deleting |
347 | // the AliITS class it deletes the memory pointed to by the fHits, fDigits, |
348 | // fIdSens, fIdName, and fITSpoints. |
fe4da5cc |
349 | // |
3bd79107 |
350 | |
351 | |
fe4da5cc |
352 | delete fHits; |
353 | delete fDigits; |
3bd79107 |
354 | delete fRecPoints; |
143d1056 |
355 | // delete fIdName; // TObjArray of TObjStrings |
356 | if(fIdName!=0) delete[] fIdName; // Array of TStrings |
58005f18 |
357 | if(fIdSens!=0) delete[] fIdSens; |
3bd79107 |
358 | if(fITSmodules!=0) { |
359 | this->ClearModules(); |
360 | delete fITSmodules; |
361 | }// end if fITSmodules!=0 |
fe4da5cc |
362 | |
fe4da5cc |
363 | // |
3bd79107 |
364 | if(fDtype) { |
9c74c52b |
365 | fDtype->Delete(); |
366 | delete fDtype; |
3bd79107 |
367 | } |
9c74c52b |
368 | delete [] fNdtype; |
369 | if (fCtype) { |
370 | fCtype->Delete(); |
371 | delete fCtype; |
3bd79107 |
372 | } |
9c74c52b |
373 | delete [] fNctype; |
fe4da5cc |
374 | // |
3bd79107 |
375 | |
376 | if (fDetTypes) { |
377 | fDetTypes->Delete(); |
378 | delete fDetTypes; |
379 | } |
380 | |
381 | if (fTreeC) delete fTreeC; |
e8189707 |
382 | |
9c74c52b |
383 | if (fITSgeom) delete fITSgeom; |
384 | |
3bd79107 |
385 | } |
386 | |
387 | //___________________________________________ |
388 | AliITSDetType* AliITS::DetType(Int_t id) |
389 | { |
390 | //return pointer to id detector type |
391 | return ((AliITSDetType*) (*fDetTypes)[id]); |
392 | |
393 | } |
394 | //___________________________________________ |
e8189707 |
395 | void AliITS::SetClasses(Int_t id, const char *digit, const char *cluster) |
3bd79107 |
396 | { |
397 | //set the digit and cluster classes to be used for the id detector type |
398 | ((AliITSDetType*) (*fDetTypes)[id])->ClassNames(digit,cluster); |
399 | |
400 | } |
401 | //___________________________________________ |
402 | void AliITS::SetResponseModel(Int_t id, AliITSresponse *response) |
403 | { |
404 | //set the response model for the id detector type |
405 | |
406 | ((AliITSDetType*) (*fDetTypes)[id])->ResponseModel(response); |
407 | |
fe4da5cc |
408 | } |
409 | |
3bd79107 |
410 | //___________________________________________ |
411 | void AliITS::SetSegmentationModel(Int_t id, AliITSsegmentation *seg) |
412 | { |
413 | //set the segmentation model for the id detector type |
414 | |
415 | ((AliITSDetType*) (*fDetTypes)[id])->SegmentationModel(seg); |
416 | |
417 | } |
418 | |
419 | //___________________________________________ |
420 | void AliITS::SetSimulationModel(Int_t id, AliITSsimulation *sim) |
421 | { |
422 | //set the simulation model for the id detector type |
423 | |
424 | ((AliITSDetType*) (*fDetTypes)[id])->SimulationModel(sim); |
425 | |
426 | } |
427 | //___________________________________________ |
428 | void AliITS::SetReconstructionModel(Int_t id, AliITSClusterFinder *reconst) |
429 | { |
430 | //set the cluster finder model for the id detector type |
431 | |
432 | ((AliITSDetType*) (*fDetTypes)[id])->ReconstructionModel(reconst); |
58005f18 |
433 | |
58005f18 |
434 | } |
435 | |
fe4da5cc |
436 | //_____________________________________________________________________________ |
58005f18 |
437 | void AliITS::AddHit(Int_t track, Int_t *vol, Float_t *hits){ |
fe4da5cc |
438 | // |
439 | // Add an ITS hit |
58005f18 |
440 | // The function to add information to the AliITShit class. See the |
441 | // AliITShit class for a full description. This function allocates the |
442 | // necessary new space for the hit information and passes the variable |
443 | // track, and the pointers *vol and *hits to the AliITShit constructor |
444 | // function. |
fe4da5cc |
445 | // |
446 | TClonesArray &lhits = *fHits; |
447 | new(lhits[fNhits++]) AliITShit(fIshunt,track,vol,hits); |
448 | } |
3bd79107 |
449 | //_____________________________________________________________________________ |
450 | void AliITS::AddRealDigit(Int_t id, Int_t *digits) |
451 | { |
452 | // add a real digit - as coming from data |
453 | |
454 | TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]); |
455 | new(ldigits[fNdtype[id]++]) AliITSdigit(digits); |
456 | |
457 | } |
458 | //_____________________________________________________________________________ |
e8189707 |
459 | void AliITS::AddSimDigit(Int_t id, AliITSdigit *d) |
3bd79107 |
460 | { |
461 | |
462 | // add a simulated digit |
463 | |
3bd79107 |
464 | TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]); |
465 | |
466 | switch(id) |
467 | { |
468 | case 0: |
469 | new(ldigits[fNdtype[id]++]) AliITSdigitSPD(*((AliITSdigitSPD*)d)); |
470 | break; |
471 | case 1: |
472 | new(ldigits[fNdtype[id]++]) AliITSdigitSDD(*((AliITSdigitSDD*)d)); |
473 | break; |
474 | case 2: |
475 | new(ldigits[fNdtype[id]++]) AliITSdigitSSD(*((AliITSdigitSSD*)d)); |
476 | break; |
477 | } |
478 | |
479 | } |
480 | |
481 | //_____________________________________________________________________________ |
e8189707 |
482 | void AliITS::AddSimDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks,Int_t *hits,Float_t *charges){ |
3bd79107 |
483 | |
484 | // add a simulated digit to the list |
485 | |
486 | TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]); |
487 | switch(id) |
488 | { |
489 | case 0: |
e8189707 |
490 | new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits); |
3bd79107 |
491 | break; |
492 | case 1: |
e8189707 |
493 | new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks,hits,charges); |
3bd79107 |
494 | break; |
495 | case 2: |
e8189707 |
496 | new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits); |
3bd79107 |
497 | break; |
498 | } |
499 | |
500 | } |
501 | |
502 | //_____________________________________________________________________________ |
503 | void AliITS::AddCluster(Int_t id, AliITSRawCluster *c) |
504 | { |
505 | |
506 | // add a cluster to the list |
507 | |
3bd79107 |
508 | TClonesArray &lcl = *((TClonesArray*)(*fCtype)[id]); |
509 | |
510 | switch(id) |
511 | { |
512 | case 0: |
513 | new(lcl[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c)); |
514 | break; |
515 | case 1: |
516 | new(lcl[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c)); |
517 | break; |
518 | case 2: |
519 | new(lcl[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c)); |
520 | break; |
521 | } |
522 | |
523 | } |
524 | |
525 | |
526 | //_____________________________________________________________________________ |
527 | void AliITS::AddRecPoint(const AliITSRecPoint &r) |
528 | { |
529 | // |
530 | // Add a reconstructed space point to the list |
531 | // |
532 | TClonesArray &lrecp = *fRecPoints; |
533 | new(lrecp[fNRecPoints++]) AliITSRecPoint(r); |
534 | } |
535 | |
536 | |
537 | //____________________________________________ |
538 | void AliITS::ResetDigits() |
539 | { |
540 | // |
9c74c52b |
541 | // Reset number of digits and the digits array for the ITS detector |
3bd79107 |
542 | // |
543 | |
544 | if (!fDtype) return; |
545 | |
546 | Int_t i; |
a8a6107b |
547 | for (i=0;i<kNTYPES;i++ ) { |
3bd79107 |
548 | if ((*fDtype)[i]) ((TClonesArray*)(*fDtype)[i])->Clear(); |
549 | if (fNdtype) fNdtype[i]=0; |
550 | } |
551 | } |
552 | |
553 | //____________________________________________ |
554 | void AliITS::ResetDigits(Int_t i) |
555 | { |
556 | // |
557 | // Reset number of digits and the digits array for this branch |
558 | // |
e8189707 |
559 | if ((*fDtype)[i]) ((TClonesArray*)(*fDtype)[i])->Clear(); |
560 | if (fNdtype) fNdtype[i]=0; |
3bd79107 |
561 | } |
e8189707 |
562 | |
563 | |
3bd79107 |
564 | //____________________________________________ |
565 | void AliITS::ResetClusters() |
566 | { |
567 | // |
568 | // Reset number of clusters and the clusters array for ITS |
569 | // |
570 | |
571 | Int_t i; |
a8a6107b |
572 | for (i=0;i<kNTYPES;i++ ) { |
3bd79107 |
573 | if ((*fCtype)[i]) ((TClonesArray*)(*fCtype)[i])->Clear(); |
574 | if (fNctype) fNctype[i]=0; |
575 | } |
576 | |
577 | } |
e8189707 |
578 | |
3bd79107 |
579 | //____________________________________________ |
580 | void AliITS::ResetClusters(Int_t i) |
581 | { |
582 | // |
583 | // Reset number of clusters and the clusters array for this branch |
584 | // |
585 | if ((*fCtype)[i]) ((TClonesArray*)(*fCtype)[i])->Clear(); |
586 | if (fNctype) fNctype[i]=0; |
587 | |
588 | } |
589 | |
590 | |
591 | //____________________________________________ |
592 | void AliITS::ResetRecPoints() |
593 | { |
594 | // |
595 | // Reset number of rec points and the rec points array |
596 | // |
3bd79107 |
597 | if (fRecPoints) fRecPoints->Clear(); |
9c74c52b |
598 | fNRecPoints = 0; |
3bd79107 |
599 | |
600 | } |
601 | |
fe4da5cc |
602 | //_____________________________________________________________________________ |
58005f18 |
603 | Int_t AliITS::DistancetoPrimitive(Int_t , Int_t ){ |
fe4da5cc |
604 | // |
605 | // Distance from mouse to ITS on the screen. Dummy routine |
58005f18 |
606 | // A dummy routine used by the ROOT macro display.C to allow for the |
607 | // use of the mouse (pointing device) in the macro. In general this should |
608 | // never be called. If it is it returns the number 9999 for any value of |
609 | // x and y. |
fe4da5cc |
610 | // |
611 | return 9999; |
612 | } |
613 | |
614 | //_____________________________________________________________________________ |
58005f18 |
615 | void AliITS::Init(){ |
fe4da5cc |
616 | // |
617 | // Initialise ITS after it has been built |
58005f18 |
618 | // This routine initializes the AliITS class. It is intended to be called |
619 | // from the Init function in AliITSv?. Besides displaying a banner |
3bd79107 |
620 | // indicating that it has been called it initializes the array fIdSens |
621 | // and sets the default segmentation, response, digit and raw cluster classes |
58005f18 |
622 | // Therefore it should be called after a call to CreateGeometry. |
fe4da5cc |
623 | // |
624 | Int_t i; |
143d1056 |
625 | |
143d1056 |
626 | // |
627 | SetDefaults(); |
143d1056 |
628 | // Array of TStrings |
58005f18 |
629 | for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]); |
143d1056 |
630 | // |
fe4da5cc |
631 | } |
632 | |
3bd79107 |
633 | //_____________________________________________________________________________ |
634 | void AliITS::SetDefaults() |
635 | { |
636 | // sets the default segmentation, response, digit and raw cluster classes |
637 | |
65d4384f |
638 | printf("SetDefaults\n"); |
3bd79107 |
639 | |
640 | AliITSDetType *iDetType; |
641 | |
65d4384f |
642 | |
3bd79107 |
643 | //SPD |
644 | |
65d4384f |
645 | iDetType=DetType(0); |
143d1056 |
646 | if (!iDetType->GetSegmentationModel()) { |
65d4384f |
647 | AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(fITSgeom); |
648 | SetSegmentationModel(0,seg0); |
649 | } |
650 | if (!iDetType->GetResponseModel()) { |
651 | SetResponseModel(0,new AliITSresponseSPD()); |
652 | } |
3bd79107 |
653 | // set digit and raw cluster classes to be used |
65d4384f |
654 | |
655 | const char *kData0=(iDetType->GetResponseModel())->DataType(); |
e8189707 |
656 | if (strstr(kData0,"real")) { |
3bd79107 |
657 | iDetType->ClassNames("AliITSdigit","AliITSRawClusterSPD"); |
658 | } else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD"); |
659 | |
65d4384f |
660 | // SDD // |
661 | iDetType=DetType(1); |
662 | if (!iDetType->GetResponseModel()) { |
663 | SetResponseModel(1,new AliITSresponseSDD()); |
664 | } |
665 | AliITSresponse *resp1=iDetType->GetResponseModel(); |
143d1056 |
666 | if (!iDetType->GetSegmentationModel()) { |
65d4384f |
667 | AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(fITSgeom,resp1); |
143d1056 |
668 | SetSegmentationModel(1,seg1); |
143d1056 |
669 | } |
65d4384f |
670 | const char *kData1=(iDetType->GetResponseModel())->DataType(); |
671 | const char *kopt=iDetType->GetResponseModel()->ZeroSuppOption(); |
e8189707 |
672 | if ((!strstr(kopt,"2D")) && (!strstr(kopt,"1D")) || strstr(kData1,"real") ) { |
3bd79107 |
673 | iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD"); |
674 | } else iDetType->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD"); |
675 | |
676 | // SSD |
65d4384f |
677 | iDetType=DetType(2); |
143d1056 |
678 | if (!iDetType->GetSegmentationModel()) { |
65d4384f |
679 | AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(fITSgeom); |
143d1056 |
680 | SetSegmentationModel(2,seg2); |
65d4384f |
681 | } |
682 | if (!iDetType->GetResponseModel()) { |
683 | SetResponseModel(2,new AliITSresponseSSD()); |
684 | } |
685 | const char *kData2=(iDetType->GetResponseModel())->DataType(); |
e8189707 |
686 | if (strstr(kData2,"real")) { |
3bd79107 |
687 | iDetType->ClassNames("AliITSdigit","AliITSRawClusterSSD"); |
688 | } else iDetType->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD"); |
689 | |
a8a6107b |
690 | if (kNTYPES>3) { |
3bd79107 |
691 | Warning("SetDefaults","Only the three basic detector types are initialised!"); |
65d4384f |
692 | } |
3bd79107 |
693 | |
694 | } |
65d4384f |
695 | |
696 | |
697 | |
e8189707 |
698 | //_____________________________________________________________________________ |
699 | void AliITS::SetDefaultSimulation() |
700 | { |
701 | // to be written |
702 | |
703 | } |
704 | //_____________________________________________________________________________ |
705 | void AliITS::SetDefaultClusterFinders() |
706 | { |
707 | // to be written |
708 | |
709 | } |
3bd79107 |
710 | //_____________________________________________________________________________ |
711 | |
712 | void AliITS::MakeTreeC(Option_t *option) |
713 | { |
714 | // create a separate tree to store the clusters |
715 | |
d5da1ecf |
716 | cout << "AliITS::MakeTreeC" << endl; |
9c74c52b |
717 | |
5cf7bbad |
718 | const char *optC = strstr(option,"C"); |
3bd79107 |
719 | if (optC && !fTreeC) fTreeC = new TTree("TC","Clusters in ITS"); |
9c74c52b |
720 | else return; |
3bd79107 |
721 | |
722 | Int_t buffersize = 4000; |
723 | char branchname[30]; |
724 | |
04874c1a |
725 | const char *det[3] = {"SPD","SDD","SSD"}; |
3bd79107 |
726 | |
caf37aec |
727 | char digclass[40]; |
728 | char clclass[40]; |
729 | |
3bd79107 |
730 | // one branch for Clusters per type of detector |
731 | Int_t i; |
a8a6107b |
732 | for (i=0; i<kNTYPES ;i++) { |
caf37aec |
733 | AliITSDetType *iDetType=DetType(i); |
734 | iDetType->GetClassNames(digclass,clclass); |
caf37aec |
735 | // clusters |
736 | (*fCtype)[i] = new TClonesArray(clclass,10000); |
a8a6107b |
737 | if (kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]); |
3bd79107 |
738 | else sprintf(branchname,"%sClusters%d",GetName(),i+1); |
739 | if (fCtype && fTreeC) { |
740 | TreeC()->Branch(branchname,&((*fCtype)[i]), buffersize); |
d5da1ecf |
741 | cout << "Making Branch " << branchname; |
742 | cout << " for Clusters of detector type " << i+1 << endl; |
3bd79107 |
743 | } |
744 | } |
745 | |
746 | } |
747 | |
748 | //_____________________________________________________________________________ |
749 | void AliITS::GetTreeC(Int_t event) |
750 | { |
751 | |
d5da1ecf |
752 | cout << "AliITS::GetTreeC" << endl; |
9c74c52b |
753 | |
3bd79107 |
754 | // get the clusters tree for this event and set the branch address |
755 | char treeName[20]; |
756 | char branchname[30]; |
757 | |
04874c1a |
758 | const char *det[3] = {"SPD","SDD","SSD"}; |
3bd79107 |
759 | |
760 | ResetClusters(); |
761 | if (fTreeC) { |
762 | delete fTreeC; |
763 | } |
764 | |
765 | sprintf(treeName,"TreeC%d",event); |
766 | fTreeC = (TTree*)gDirectory->Get(treeName); |
767 | |
3bd79107 |
768 | TBranch *branch; |
769 | if (fTreeC) { |
770 | Int_t i; |
a8a6107b |
771 | for (i=0; i<kNTYPES; i++) { |
772 | if (kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]); |
e8189707 |
773 | else sprintf(branchname,"%sClusters%d",GetName(),i+1); |
774 | if (fCtype) { |
3bd79107 |
775 | branch = fTreeC->GetBranch(branchname); |
776 | if (branch) branch->SetAddress(&((*fCtype)[i])); |
777 | } |
778 | } |
779 | } else { |
d5da1ecf |
780 | Error("AliITS::GetTreeC", |
781 | "cannot find Clusters Tree for event:%d\n",event); |
3bd79107 |
782 | } |
783 | |
784 | } |
fe4da5cc |
785 | //_____________________________________________________________________________ |
2ab0c725 |
786 | void AliITS::MakeBranch(Option_t* option, char *file) |
787 | { |
fe4da5cc |
788 | // |
3bd79107 |
789 | // Creates Tree branches for the ITS. |
fe4da5cc |
790 | // |
2ab0c725 |
791 | // |
fe4da5cc |
792 | Int_t buffersize = 4000; |
3bd79107 |
793 | char branchname[30]; |
fe4da5cc |
794 | sprintf(branchname,"%s",GetName()); |
795 | |
2ab0c725 |
796 | AliDetector::MakeBranch(option,file); |
fe4da5cc |
797 | |
5cf7bbad |
798 | const char *cD = strstr(option,"D"); |
799 | const char *cR = strstr(option,"R"); |
fe4da5cc |
800 | |
2ab0c725 |
801 | if (cD) { |
802 | // |
803 | // one branch for digits per type of detector |
804 | // |
04874c1a |
805 | const char *det[3] = {"SPD","SDD","SSD"}; |
3bd79107 |
806 | |
e8189707 |
807 | char digclass[40]; |
808 | char clclass[40]; |
3bd79107 |
809 | |
810 | Int_t i; |
a8a6107b |
811 | for (i=0; i<kNTYPES ;i++) { |
3bd79107 |
812 | AliITSDetType *iDetType=DetType(i); |
e8189707 |
813 | iDetType->GetClassNames(digclass,clclass); |
3bd79107 |
814 | // digits |
c34b4885 |
815 | if(!((*fDtype)[i])) (*fDtype)[i] = new TClonesArray(digclass,10000); |
816 | else ResetDigits(i); |
3bd79107 |
817 | } |
818 | |
a8a6107b |
819 | for (i=0; i<kNTYPES ;i++) { |
820 | if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]); |
2ab0c725 |
821 | else sprintf(branchname,"%sDigits%d",GetName(),i+1); |
822 | if (fDtype && gAlice->TreeD()) { |
823 | gAlice->MakeBranchInTree(gAlice->TreeD(), |
c34b4885 |
824 | branchname, &((*fDtype)[i]), buffersize, file); |
2ab0c725 |
825 | cout << "Making Branch " << branchname; |
826 | cout << " for digits of type "<< i+1 << endl; |
3bd79107 |
827 | } |
2ab0c725 |
828 | } |
3bd79107 |
829 | } |
830 | |
2ab0c725 |
831 | if (cR) { |
832 | // |
3bd79107 |
833 | // only one branch for rec points for all detector types |
2ab0c725 |
834 | // |
835 | sprintf(branchname,"%sRecPoints",GetName()); |
836 | |
340cd0d8 |
837 | if(!fRecPoints) fRecPoints=new TClonesArray("AliITSRecPoint",10000); |
3bd79107 |
838 | |
2ab0c725 |
839 | if (fRecPoints && gAlice->TreeR()) { |
840 | gAlice->MakeBranchInTree(gAlice->TreeR(), |
841 | branchname, &fRecPoints, buffersize, file) ; |
842 | cout << "Making Branch " << branchname; |
843 | cout << " for reconstructed space points" << endl; |
844 | } |
3bd79107 |
845 | } |
3bd79107 |
846 | } |
847 | |
848 | //___________________________________________ |
849 | void AliITS::SetTreeAddress() |
850 | { |
851 | |
852 | // Set branch address for the Trees. |
853 | |
854 | char branchname[30]; |
855 | AliDetector::SetTreeAddress(); |
856 | |
04874c1a |
857 | const char *det[3] = {"SPD","SDD","SSD"}; |
3bd79107 |
858 | |
859 | TBranch *branch; |
860 | TTree *treeD = gAlice->TreeD(); |
861 | TTree *treeR = gAlice->TreeR(); |
862 | |
863 | Int_t i; |
864 | if (treeD) { |
a8a6107b |
865 | for (i=0; i<kNTYPES; i++) { |
866 | if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]); |
3bd79107 |
867 | else sprintf(branchname,"%sDigits%d",GetName(),i+1); |
868 | if (fDtype) { |
869 | branch = treeD->GetBranch(branchname); |
870 | if (branch) branch->SetAddress(&((*fDtype)[i])); |
871 | } |
872 | } |
873 | } |
874 | |
875 | |
876 | if (treeR) { |
877 | sprintf(branchname,"%sRecPoints",GetName()); |
3bd79107 |
878 | branch = treeR->GetBranch(branchname); |
879 | if (branch) branch->SetAddress(&fRecPoints); |
3bd79107 |
880 | } |
881 | |
882 | |
883 | } |
884 | |
885 | //____________________________________________________________________________ |
886 | void AliITS::InitModules(Int_t size,Int_t &nmodules){ |
887 | |
888 | //initialize the modules array |
889 | |
e8189707 |
890 | if(fITSmodules){ |
9c74c52b |
891 | fITSmodules->Delete(); |
e8189707 |
892 | delete fITSmodules; |
893 | } |
894 | |
3bd79107 |
895 | Int_t nl,indexMAX,index; |
3bd79107 |
896 | |
897 | if(size<=0){ // default to using data stored in AliITSgeom |
898 | if(fITSgeom==0) { |
d5da1ecf |
899 | Error("AliITS::InitModules", |
900 | "in AliITS::InitModule fITSgeom not defined\n"); |
3bd79107 |
901 | return; |
902 | } // end if fITSgeom==0 |
903 | nl = fITSgeom->GetNlayers(); |
904 | indexMAX = fITSgeom->GetModuleIndex(nl,fITSgeom->GetNladders(nl), |
905 | fITSgeom->GetNdetectors(nl))+1; |
906 | nmodules = indexMAX; |
907 | fITSmodules = new TObjArray(indexMAX); |
3bd79107 |
908 | for(index=0;index<indexMAX;index++){ |
3bd79107 |
909 | fITSmodules->AddAt( new AliITSmodule(index),index); |
3bd79107 |
910 | } // end for index |
911 | }else{ |
912 | fITSmodules = new TObjArray(size); |
9c74c52b |
913 | for(index=0;index<size;index++) { |
914 | fITSmodules->AddAt( new AliITSmodule(index),index); |
915 | } |
916 | |
3bd79107 |
917 | nmodules = size; |
918 | } // end i size<=0 |
919 | } |
920 | |
921 | //____________________________________________________________________________ |
e8189707 |
922 | void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,Option_t *option,Text_t *filename){ |
3bd79107 |
923 | |
924 | // fill the modules with the sorted by module hits; add hits from background |
925 | // if option=Add |
926 | |
9c74c52b |
927 | |
3bd79107 |
928 | static TTree *trH1; //Tree with background hits |
929 | static TClonesArray *fHits2; //List of hits for one track only |
930 | |
931 | static Bool_t first=kTRUE; |
932 | static TFile *file; |
5cf7bbad |
933 | const char *addBgr = strstr(option,"Add"); |
3bd79107 |
934 | |
935 | |
e8189707 |
936 | if (addBgr ) { |
3bd79107 |
937 | if(first) { |
938 | cout<<"filename "<<filename<<endl; |
939 | file=new TFile(filename); |
940 | cout<<"I have opened "<<filename<<" file "<<endl; |
941 | fHits2 = new TClonesArray("AliITShit",1000 ); |
942 | } |
943 | first=kFALSE; |
944 | file->cd(); |
945 | file->ls(); |
946 | // Get Hits Tree header from file |
947 | if(fHits2) fHits2->Clear(); |
948 | if(trH1) delete trH1; |
949 | trH1=0; |
950 | |
951 | char treeName[20]; |
952 | sprintf(treeName,"TreeH%d",bgrev); |
953 | trH1 = (TTree*)gDirectory->Get(treeName); |
954 | //printf("TrH1 %p of treename %s for event %d \n",trH1,treeName,bgrev); |
955 | |
956 | if (!trH1) { |
d5da1ecf |
957 | Error("AliITS::FillModules", |
958 | "cannot find Hits Tree for event:%d\n",bgrev); |
3bd79107 |
959 | } |
960 | // Set branch addresses |
961 | TBranch *branch; |
962 | char branchname[20]; |
963 | sprintf(branchname,"%s",GetName()); |
964 | if (trH1 && fHits2) { |
965 | branch = trH1->GetBranch(branchname); |
966 | if (branch) branch->SetAddress(&fHits2); |
967 | } |
968 | |
969 | // test |
970 | //Int_t ntracks1 =(Int_t)TrH1->GetEntries(); |
971 | //printf("background - ntracks1 - %d\n",ntracks1); |
972 | } |
973 | |
2ab0c725 |
974 | //Int_t npart = gAlice->GetEvent(evnt); |
975 | //if(npart<=0) return; |
3bd79107 |
976 | TClonesArray *itsHits = this->Hits(); |
977 | Int_t lay,lad,det,index; |
978 | AliITShit *itsHit=0; |
979 | AliITSmodule *mod=0; |
980 | |
981 | TTree *iTH = gAlice->TreeH(); |
982 | Int_t ntracks =(Int_t) iTH->GetEntries(); |
983 | |
984 | Int_t t,h; |
985 | for(t=0; t<ntracks; t++){ |
986 | gAlice->ResetHits(); |
987 | iTH->GetEvent(t); |
988 | Int_t nhits = itsHits->GetEntriesFast(); |
9c74c52b |
989 | //printf("nhits %d\n",nhits); |
3bd79107 |
990 | if (!nhits) continue; |
3bd79107 |
991 | for(h=0; h<nhits; h++){ |
992 | itsHit = (AliITShit *)itsHits->UncheckedAt(h); |
993 | itsHit->GetDetectorID(lay,lad,det); |
9c74c52b |
994 | // temporarily index=det-1 !!! |
995 | if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det); |
996 | else index=det-1; |
997 | // |
3bd79107 |
998 | mod = this->GetModule(index); |
9c74c52b |
999 | mod->AddHit(itsHit,t,h); |
3bd79107 |
1000 | } // end loop over hits |
1001 | } // end loop over tracks |
1002 | |
1003 | // open the file with background |
1004 | |
e8189707 |
1005 | if (addBgr ) { |
1006 | Int_t track,i; |
3bd79107 |
1007 | ntracks =(Int_t)trH1->GetEntries(); |
1008 | //printf("background - ntracks1 %d\n",ntracks); |
1009 | //printf("background - Start loop over tracks \n"); |
1010 | // Loop over tracks |
1011 | |
e8189707 |
1012 | for (track=0; track<ntracks; track++) { |
3bd79107 |
1013 | |
1014 | if (fHits2) fHits2->Clear(); |
1015 | trH1->GetEvent(track); |
1016 | // Loop over hits |
1017 | for(i=0;i<fHits2->GetEntriesFast();++i) { |
1018 | |
1019 | itsHit=(AliITShit*) (*fHits2)[i]; |
1020 | itsHit->GetDetectorID(lay,lad,det); |
9c74c52b |
1021 | // temporarily index=det-1 !!! |
1022 | if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det); |
1023 | else index=det-1; |
1024 | // |
3bd79107 |
1025 | mod = this->GetModule(index); |
9c74c52b |
1026 | mod->AddHit(itsHit,track,i); |
3bd79107 |
1027 | } // end loop over hits |
1028 | } // end loop over tracks |
1029 | |
1030 | TTree *fAli=gAlice->TreeK(); |
1031 | TFile *fileAli=0; |
1032 | |
1033 | if (fAli) fileAli =fAli->GetCurrentFile(); |
9c74c52b |
1034 | fileAli->cd(); |
3bd79107 |
1035 | |
1036 | } // end if add |
1037 | |
3bd79107 |
1038 | //gObjectTable->Print(); |
1039 | |
1040 | } |
1041 | |
2ab0c725 |
1042 | //____________________________________________________________________________ |
1043 | |
1044 | void AliITS::SDigits2Digits() |
1045 | { |
1046 | |
1047 | AliITSgeom *geom = GetITSgeom(); |
1048 | |
1049 | // SPD |
1050 | AliITSDetType *iDetType; |
1051 | iDetType=DetType(0); |
1052 | AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel(); |
1053 | AliITSresponseSPD *res0 = (AliITSresponseSPD*)iDetType->GetResponseModel(); |
1054 | AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0); |
1055 | SetSimulationModel(0,sim0); |
1056 | // test |
1057 | // printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz()); |
1058 | // printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx()); |
1059 | // printf("SPD pitches %d %d \n",seg0->Dpz(0),seg0->Dpx(0)); |
1060 | // end test |
1061 | // |
1062 | // SDD |
1063 | //Set response functions |
2ab0c725 |
1064 | // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable, 2 fTolerance |
1065 | |
1066 | iDetType=DetType(1); |
1067 | AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel(); |
1068 | if (!res1) { |
1069 | res1=new AliITSresponseSDD(); |
1070 | SetResponseModel(1,res1); |
1071 | } |
37de990d |
1072 | Float_t noise, baseline; |
1073 | res1->GetNoiseParam(noise,baseline); |
1074 | Float_t noise_after_el = res1->GetNoiseAfterElectronics(); |
1075 | Float_t fCutAmp = baseline + 2.*noise_after_el; |
1076 | Int_t cp[8]={0,0,(int)fCutAmp,(int)fCutAmp,0,0,0,0}; //1D |
2ab0c725 |
1077 | res1->SetCompressParam(cp); |
2ab0c725 |
1078 | AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel(); |
1079 | if (!seg1) { |
1080 | seg1 = new AliITSsegmentationSDD(geom,res1); |
1081 | SetSegmentationModel(1,seg1); |
1082 | } |
1083 | AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1); |
2ab0c725 |
1084 | SetSimulationModel(1,sim1); |
1085 | |
1086 | // SSD |
1087 | iDetType=DetType(2); |
1088 | AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel(); |
1089 | AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel(); |
1090 | res2->SetSigmaSpread(3.,2.); |
1091 | AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2); |
1092 | SetSimulationModel(2,sim2); |
1093 | |
1094 | cerr<<"Digitizing ITS...\n"; |
1095 | |
1096 | TStopwatch timer; |
1097 | timer.Start(); |
1098 | HitsToDigits(0,0,-1," ","All"," "); |
1099 | timer.Stop(); timer.Print(); |
1100 | |
1101 | delete sim0; |
1102 | delete sim1; |
1103 | delete sim2; |
1104 | } |
1105 | |
3bd79107 |
1106 | |
1107 | //____________________________________________________________________________ |
e8189707 |
1108 | void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size, Option_t *option, Option_t *opt,Text_t *filename) |
3bd79107 |
1109 | { |
1110 | // keep galice.root for signal and name differently the file for |
1111 | // background when add! otherwise the track info for signal will be lost ! |
1112 | |
9c74c52b |
1113 | // the condition below will disappear when the geom class will be |
1114 | // initialised for all versions - for the moment it is only for v5 ! |
1115 | // 7 is the SDD beam test version |
1116 | Int_t ver = this->IsVersion(); |
1117 | if(ver!=5 && ver!=7) return; |
1118 | |
5cf7bbad |
1119 | const char *all = strstr(opt,"All"); |
1120 | const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")}; |
fd61217e |
1121 | cout<<" 1 AliITS "<<endl; |
3bd79107 |
1122 | Int_t nmodules; |
1123 | InitModules(size,nmodules); |
fd61217e |
1124 | cout<<" 2 AliITS "<<endl; |
e8189707 |
1125 | FillModules(evNumber,bgrev,nmodules,option,filename); |
fd61217e |
1126 | cout<<" 3 AliITS "<<endl; |
3bd79107 |
1127 | |
9c74c52b |
1128 | //TBranch *branch; |
3bd79107 |
1129 | AliITSsimulation* sim; |
9c74c52b |
1130 | //TObjArray *branches=gAlice->TreeD()->GetListOfBranches(); |
3bd79107 |
1131 | AliITSgeom *geom = GetITSgeom(); |
1132 | |
1133 | Int_t id,module; |
fd61217e |
1134 | Int_t lay, lad, detect; |
9c74c52b |
1135 | Int_t first,last; |
a8a6107b |
1136 | for (id=0;id<kNTYPES;id++) { |
3bd79107 |
1137 | if (!all && !det[id]) continue; |
9c74c52b |
1138 | //branch = (TBranch*)branches->UncheckedAt(id); |
3bd79107 |
1139 | AliITSDetType *iDetType=DetType(id); |
1140 | sim = (AliITSsimulation*)iDetType->GetSimulationModel(); |
fd61217e |
1141 | |
3bd79107 |
1142 | if (!sim) { |
1143 | Error("HitsToDigits","The simulation class was not instantiated!"); |
1144 | exit(1); |
e8189707 |
1145 | // or SetDefaultSimulation(); |
3bd79107 |
1146 | } |
fd61217e |
1147 | |
9c74c52b |
1148 | if(geom) { |
1149 | first = geom->GetStartDet(id); |
1150 | last = geom->GetLastDet(id); |
1151 | } else first=last=0; |
d5da1ecf |
1152 | cout << "det type " << id << " first, last "<< first << last << endl; |
3bd79107 |
1153 | for(module=first;module<=last;module++) { |
1154 | AliITSmodule *mod = (AliITSmodule *)fITSmodules->At(module); |
fd61217e |
1155 | |
1156 | geom->GetModuleId(module,lay, lad, detect); |
686b2f43 |
1157 | /* if ( lay == 6 ) |
fd61217e |
1158 | ((AliITSsegmentationSSD*)(((AliITSsimulationSSD*)sim)->GetSegmentation()))->SetLayer(6); |
1159 | if ( lay == 5 ) |
1160 | ((AliITSsegmentationSSD*)(((AliITSsimulationSSD*)sim)->GetSegmentation()))->SetLayer(5); |
686b2f43 |
1161 | */ |
3bd79107 |
1162 | sim->DigitiseModule(mod,module,evNumber); |
1163 | // fills all branches - wasted disk space |
1164 | gAlice->TreeD()->Fill(); |
1165 | ResetDigits(); |
1166 | // try and fill only the branch |
1167 | //branch->Fill(); |
1168 | //ResetDigits(id); |
1169 | } // loop over modules |
1170 | } // loop over detector types |
1171 | |
3bd79107 |
1172 | ClearModules(); |
1173 | |
e8189707 |
1174 | Int_t nentries=(Int_t)gAlice->TreeD()->GetEntries(); |
d5da1ecf |
1175 | cout << "nentries in TreeD" << nentries << endl; |
3bd79107 |
1176 | |
1177 | char hname[30]; |
1178 | sprintf(hname,"TreeD%d",evNumber); |
2ab0c725 |
1179 | gAlice->TreeD()->Write(hname,TObject::kOverwrite); |
3bd79107 |
1180 | // reset tree |
1181 | gAlice->TreeD()->Reset(); |
1182 | |
1183 | } |
1184 | |
1185 | |
1186 | //____________________________________________________________________________ |
1187 | void AliITS::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt) |
1188 | { |
e8189707 |
1189 | // cluster finding and reconstruction of space points |
3bd79107 |
1190 | |
9c74c52b |
1191 | // the condition below will disappear when the geom class will be |
1192 | // initialised for all versions - for the moment it is only for v5 ! |
1193 | // 7 is the SDD beam test version |
1194 | Int_t ver = this->IsVersion(); |
340cd0d8 |
1195 | if(ver!=5) return; |
9c74c52b |
1196 | |
5cf7bbad |
1197 | const char *all = strstr(opt,"All"); |
1198 | const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")}; |
3bd79107 |
1199 | |
1200 | static Bool_t first=kTRUE; |
caf37aec |
1201 | if (!TreeC() && first) { |
3bd79107 |
1202 | MakeTreeC("C"); |
1203 | first=kFALSE; |
1204 | } |
caf37aec |
1205 | |
1206 | TTree *treeC=TreeC(); |
3bd79107 |
1207 | |
9c74c52b |
1208 | |
1209 | //TBranch *branch; |
3bd79107 |
1210 | AliITSClusterFinder* rec; |
1211 | |
9c74c52b |
1212 | //TObjArray *branches=gAlice->TreeR()->GetListOfBranches(); |
3bd79107 |
1213 | AliITSgeom *geom = GetITSgeom(); |
1214 | |
1215 | Int_t id,module; |
a8a6107b |
1216 | for (id=0;id<kNTYPES;id++) { |
3bd79107 |
1217 | if (!all && !det[id]) continue; |
9c74c52b |
1218 | //branch = (TBranch*)branches->UncheckedAt(id); |
3bd79107 |
1219 | AliITSDetType *iDetType=DetType(id); |
1220 | rec = (AliITSClusterFinder*)iDetType->GetReconstructionModel(); |
1221 | if (!rec) { |
1222 | Error("DigitsToRecPoints","The cluster finder class was not instantiated!"); |
1223 | exit(1); |
e8189707 |
1224 | // or SetDefaultClusterFinders(); |
3bd79107 |
1225 | } |
1226 | TClonesArray *itsDigits = this->DigitsAddress(id); |
1227 | |
9c74c52b |
1228 | Int_t first,last; |
1229 | if(geom) { |
1230 | first = geom->GetStartDet(id); |
1231 | last = geom->GetLastDet(id); |
1232 | } else first=last=0; |
1233 | //printf("first last %d %d\n",first,last); |
3bd79107 |
1234 | for(module=first;module<=last;module++) { |
3bd79107 |
1235 | this->ResetDigits(); |
1236 | if (all) gAlice->TreeD()->GetEvent(lastentry+module); |
1237 | else gAlice->TreeD()->GetEvent(lastentry+(module-first)); |
1238 | Int_t ndigits = itsDigits->GetEntriesFast(); |
1239 | if (ndigits) rec->FindRawClusters(); |
1240 | gAlice->TreeR()->Fill(); |
1241 | ResetRecPoints(); |
caf37aec |
1242 | treeC->Fill(); |
3bd79107 |
1243 | ResetClusters(); |
1244 | // try and fill only the branch |
1245 | //branch->Fill(); |
1246 | //ResetRecPoints(id); |
1247 | } // loop over modules |
1248 | } // loop over detector types |
1249 | |
1250 | |
e8189707 |
1251 | Int_t nentries=(Int_t)gAlice->TreeR()->GetEntries(); |
caf37aec |
1252 | Int_t ncentries=(Int_t)treeC->GetEntries(); |
d5da1ecf |
1253 | cout << " nentries ncentries " << nentries << ncentries << endl; |
3bd79107 |
1254 | |
1255 | char hname[30]; |
1256 | sprintf(hname,"TreeR%d",evNumber); |
2ab0c725 |
1257 | gAlice->TreeR()->Write(hname,TObject::kOverwrite); |
3bd79107 |
1258 | // reset tree |
1259 | gAlice->TreeR()->Reset(); |
1260 | |
1261 | sprintf(hname,"TreeC%d",evNumber); |
caf37aec |
1262 | treeC->Write(hname,TObject::kOverwrite); |
1263 | treeC->Reset(); |
3bd79107 |
1264 | } |
1265 | |
1266 | |
1267 | //____________________________________________________________________________ |
e8189707 |
1268 | void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size, |
3bd79107 |
1269 | Option_t *option,Option_t *opt,Text_t *filename) |
1270 | { |
1271 | // keep galice.root for signal and name differently the file for |
1272 | // background when add! otherwise the track info for signal will be lost ! |
1273 | |
9c74c52b |
1274 | |
1275 | // the condition below will disappear when the geom class will be |
1276 | // initialised for all versions - for the moment it is only for v5 ! |
1277 | Int_t ver = this->IsVersion(); |
1278 | if(ver!=5) return; |
1279 | |
5cf7bbad |
1280 | const char *all = strstr(opt,"All"); |
1281 | const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")}; |
3bd79107 |
1282 | |
1283 | Int_t nmodules; |
e8189707 |
1284 | InitModules(size,nmodules); |
1285 | FillModules(evNumber,bgrev,nmodules,option,filename); |
3bd79107 |
1286 | |
1287 | |
e8189707 |
1288 | AliITSsimulation* sim; |
3bd79107 |
1289 | AliITSgeom *geom = GetITSgeom(); |
1290 | |
e8189707 |
1291 | TRandom *random=new TRandom[9]; |
1292 | random[0].SetSeed(111); |
1293 | random[1].SetSeed(222); |
1294 | random[2].SetSeed(333); |
1295 | random[3].SetSeed(444); |
1296 | random[4].SetSeed(555); |
1297 | random[5].SetSeed(666); |
1298 | random[6].SetSeed(777); |
1299 | random[7].SetSeed(888); |
1300 | random[8].SetSeed(999); |
1301 | |
1302 | |
3bd79107 |
1303 | Int_t id,module; |
a8a6107b |
1304 | for (id=0;id<kNTYPES;id++) { |
3bd79107 |
1305 | if (!all && !det[id]) continue; |
e8189707 |
1306 | AliITSDetType *iDetType=DetType(id); |
1307 | sim = (AliITSsimulation*)iDetType->GetSimulationModel(); |
1308 | if (!sim) { |
1309 | Error("HitsToFastPoints","The simulation class was not instantiated!"); |
1310 | exit(1); |
1311 | // or SetDefaultSimulation(); |
1312 | } |
3bd79107 |
1313 | Int_t first = geom->GetStartDet(id); |
1314 | Int_t last = geom->GetLastDet(id); |
1315 | for(module=first;module<=last;module++) { |
1316 | AliITSmodule *mod = (AliITSmodule *)fITSmodules->At(module); |
e8189707 |
1317 | sim->CreateFastRecPoints(mod,module,random); |
3bd79107 |
1318 | gAlice->TreeR()->Fill(); |
1319 | ResetRecPoints(); |
1320 | } // loop over modules |
1321 | } // loop over detector types |
1322 | |
1323 | |
1324 | ClearModules(); |
1325 | |
1326 | //Int_t nentries=(Int_t)gAlice->TreeR()->GetEntries(); |
1327 | |
1328 | char hname[30]; |
1329 | sprintf(hname,"TreeR%d",evNumber); |
2ab0c725 |
1330 | gAlice->TreeR()->Write(hname,TObject::kOverwrite); |
3bd79107 |
1331 | // reset tree |
1332 | gAlice->TreeR()->Reset(); |
1333 | |
e8189707 |
1334 | delete [] random; |
1335 | |
fe4da5cc |
1336 | } |
1337 | |
55b5a0b3 |
1338 | //________________________________________________________________ |
55b5a0b3 |
1339 | AliITStrack AliITS::Tracking(AliITStrack &track, AliITStrack *reference,TObjArray *fastpoints, Int_t |
8af13b4b |
1340 | **vettid, Bool_t flagvert, AliITSRad *rl ) { |
55b5a0b3 |
1341 | |
1342 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it |
1343 | |
cc6e75dd |
1344 | |
55b5a0b3 |
1345 | TList *list= new TList(); |
1346 | |
1347 | AliITStrack tr(track); |
cc6e75dd |
1348 | |
55b5a0b3 |
1349 | list->AddLast(&tr); |
1350 | |
1351 | Double_t Pt=(tr).GetPt(); |
53e7090a |
1352 | cout << "\n Pt = " << Pt <<"\n"; //stampa |
55b5a0b3 |
1353 | |
8af13b4b |
1354 | AliITStracking obj(list, reference, this, fastpoints,TMath::Abs(Pt),vettid, flagvert, rl); |
55b5a0b3 |
1355 | list->Delete(); |
1356 | delete list; |
1357 | |
1358 | Int_t itot=-1; |
1359 | TVector VecTotLabref(18); |
cc6e75dd |
1360 | Int_t lay, k; |
1361 | for(lay=5; lay>=0; lay--) { |
55b5a0b3 |
1362 | TVector VecLabref(3); |
1363 | VecLabref=(*reference).GetLabTrack(lay); |
53e7090a |
1364 | Float_t ClustZ=(*reference).GetZclusterTrack( lay); //aggiunta il 5-3-2001 |
1365 | for(k=0; k<3; k++){ //{itot++; VecTotLabref(itot)=VecLabref(k);} //cambiata il 5-3-2001 |
1366 | Int_t lpp=(Int_t)VecLabref(k); |
1367 | if(lpp>=0) { |
1368 | TParticle *p=(TParticle*) gAlice->Particle(lpp); |
1369 | Int_t pcode=p->GetPdgCode(); |
1370 | if(pcode==11) VecLabref(k)=p->GetFirstMother(); |
1371 | } |
1372 | itot++; VecTotLabref(itot)=VecLabref(k); |
1373 | if(VecLabref(k)==0. && ClustZ == 0.) VecTotLabref(itot) =-3.; } |
55b5a0b3 |
1374 | } |
1375 | Long_t labref; |
1376 | Int_t freq; |
1377 | (*reference).Search(VecTotLabref, labref, freq); |
1378 | |
53e7090a |
1379 | //if(freq < 4) labref=-labref; |
1380 | //if(freq < 6) labref=-labref; // cinque - sei |
1381 | if(freq < 5) labref=-labref; // cinque - sei |
55b5a0b3 |
1382 | (*reference).SetLabel(labref); |
1383 | |
1384 | return *reference; |
1385 | |
1386 | } |
1387 | |
1388 | |
1389 | |
1390 | //________________________________________________________________ |
1391 | |
1392 | |
1393 | |
1394 | void AliITS::DoTracking(Int_t evNumber, Int_t min_t, Int_t max_t, TFile *file, Bool_t flagvert) { |
1395 | |
1396 | // ex macro for tracking ITS |
1397 | |
1398 | printf("begin DoTracking - file %p\n",file); |
1399 | |
53e7090a |
1400 | //const char *pname="75x40_100x60"; |
55b5a0b3 |
1401 | |
8af13b4b |
1402 | Int_t imax=200,jmax=450; |
1403 | AliITSRad *rl = new AliITSRad(imax,jmax); |
1404 | //cout<<" dopo costruttore AliITSRad\n"; getchar(); |
1405 | |
55b5a0b3 |
1406 | struct GoodTrack { |
1407 | Int_t lab,code; |
1408 | Float_t px,py,pz,x,y,z,pxg,pyg,pzg,ptg; |
1409 | Bool_t flag; |
1410 | }; |
1411 | |
1412 | |
1413 | gAlice->GetEvent(0); |
53e7090a |
1414 | |
8ab89103 |
1415 | AliKalmanTrack *kkprov; |
53e7090a |
1416 | kkprov->SetConvConst(100/0.299792458/0.2/gAlice->Field()->Factor()); |
8ab89103 |
1417 | |
53e7090a |
1418 | /* //modificato il 26-4-2001 |
1419 | AliTPC *TPC=(AliTPC*)gAlice->GetDetector("TPC"); |
1420 | AliTPCParam *digp = (AliTPCParam*)file->Get(pname); |
1421 | if (digp!=0) TPC->SetParam(digp); |
1422 | */ |
8ab89103 |
1423 | TFile *cf=TFile::Open("AliTPCclusters.root"); |
1424 | AliTPCParam *digp= (AliTPCParam*)cf->Get("75x40_100x60"); |
1425 | if (!digp) { cerr<<"TPC parameters have not been found !\n"; getchar();} |
53e7090a |
1426 | |
1427 | |
54fcea18 |
1428 | GoodTrack gt[15000]; |
55b5a0b3 |
1429 | Int_t ngood=0; |
8af13b4b |
1430 | ifstream in("itsgood_tracks"); |
55b5a0b3 |
1431 | |
8af13b4b |
1432 | cerr<<"Reading itsgood tracks...\n"; |
55b5a0b3 |
1433 | while (in>>gt[ngood].lab>>gt[ngood].code |
1434 | >>gt[ngood].px >>gt[ngood].py>>gt[ngood].pz |
1435 | >>gt[ngood].x >>gt[ngood].y >>gt[ngood].z |
1436 | >>gt[ngood].pxg >>gt[ngood].pyg >>gt[ngood].pzg |
1437 | >>gt[ngood].ptg >>gt[ngood].flag) { |
1438 | ngood++; |
1439 | cerr<<ngood<<'\r'; |
54fcea18 |
1440 | if (ngood==15000) { |
55b5a0b3 |
1441 | cerr<<"Too many good tracks !\n"; |
1442 | break; |
1443 | } |
1444 | } |
8af13b4b |
1445 | if (!in.eof()) cerr<<"Read error (itsgood_tracks) !\n"; |
55b5a0b3 |
1446 | |
1447 | |
1448 | // Load tracks |
53e7090a |
1449 | // TFile *tf=TFile::Open("tpctracks.root"); //commentato 26-4-2001 |
1450 | TFile *tf=TFile::Open("AliTPCtracks.root"); |
8ab89103 |
1451 | if (!tf->IsOpen()) {cerr<<"Can't open AliTPCtracks.root !\n"; return ;} |
53e7090a |
1452 | TObjArray tracks(200000); |
55b5a0b3 |
1453 | TTree *tracktree=(TTree*)tf->Get("TreeT"); |
1454 | TBranch *tbranch=tracktree->GetBranch("tracks"); |
1455 | Int_t nentr=(Int_t)tracktree->GetEntries(); |
cc6e75dd |
1456 | Int_t kk; |
53e7090a |
1457 | /* commentato il 26-4-2001 |
1458 | for (kk=0; kk<nentr; kk++) { |
1459 | AliTPCtrack *iotrack=new AliTPCtrack; |
1460 | tbranch->SetAddress(&iotrack); |
1461 | tracktree->GetEvent(kk); |
1462 | tracks.AddLast(iotrack); |
1463 | } |
1464 | */ |
8ab89103 |
1465 | AliTPCtrack *iotracktpc=0; |
cc6e75dd |
1466 | for (kk=0; kk<nentr; kk++) { |
8ab89103 |
1467 | iotracktpc=new AliTPCtrack; |
1468 | tbranch->SetAddress(&iotracktpc); |
cc6e75dd |
1469 | tracktree->GetEvent(kk); |
8ab89103 |
1470 | tracks.AddLast(iotracktpc); |
53e7090a |
1471 | } |
55b5a0b3 |
1472 | tf->Close(); |
1473 | |
1474 | |
1475 | Int_t nt = tracks.GetEntriesFast(); |
1476 | cerr<<"Number of found tracks "<<nt<<endl; |
1477 | |
1478 | TVector DataOut(9); |
1479 | Int_t kkk=0; |
1480 | |
1481 | Double_t ptg=0.,pxg=0.,pyg=0.,pzg=0.; |
1482 | |
1483 | ////////////////////////////// good tracks definition in TPC //////////////////////////////// |
1484 | |
1485 | ofstream out1 ("AliITSTrag.out"); |
cc6e75dd |
1486 | Int_t i; |
1487 | for (i=0; i<ngood; i++) out1 << gt[i].ptg << "\n"; |
55b5a0b3 |
1488 | out1.close(); |
1489 | |
1490 | |
1491 | TVector vec(5); |
1492 | TTree *TR=gAlice->TreeR(); |
1493 | Int_t nent=(Int_t)TR->GetEntries(); |
1494 | TClonesArray *recPoints = RecPoints(); |
1495 | Int_t numbpoints; |
1496 | Int_t totalpoints=0; |
1497 | Int_t *np = new Int_t[nent]; |
1498 | Int_t **vettid = new Int_t* [nent]; |
cc6e75dd |
1499 | Int_t mod; |
1500 | for (mod=0; mod<nent; mod++) { |
55b5a0b3 |
1501 | vettid[mod]=0; |
1502 | this->ResetRecPoints(); |
340cd0d8 |
1503 | //gAlice->TreeR()->GetEvent(mod+1); //first entry in TreeR is empty |
1504 | gAlice->TreeR()->GetEvent(mod); //first entry in TreeR is empty |
55b5a0b3 |
1505 | numbpoints = recPoints->GetEntries(); |
1506 | totalpoints+=numbpoints; |
1507 | np[mod] = numbpoints; |
53e7090a |
1508 | //cout<<" mod = "<<mod<<" numbpoints = "<<numbpoints<<"\n"; getchar(); |
55b5a0b3 |
1509 | vettid[mod] = new Int_t[numbpoints]; |
cc6e75dd |
1510 | Int_t ii; |
1511 | for (ii=0;ii<numbpoints; ii++) *(vettid[mod]+ii)=0; |
55b5a0b3 |
1512 | } |
1513 | |
53e7090a |
1514 | AliTPCtrack *track=0; |
1515 | |
55b5a0b3 |
1516 | |
1517 | if(min_t < 0) {min_t = 0; max_t = nt-1;} |
1518 | |
1519 | /* |
1520 | ///////////////////////////////// Definition of vertex end its error //////////////////////////// |
1521 | ////////////////////////// In the future it will be given by a method /////////////////////////// |
1522 | Double_t Vx=0.; |
1523 | Double_t Vy=0.; |
1524 | Double_t Vz=0.; |
1525 | |
1526 | Float_t sigmavx=0.0050; // 50 microns |
1527 | Float_t sigmavy=0.0050; // 50 microns |
1528 | Float_t sigmavz=0.010; // 100 microns |
1529 | |
1530 | //Vx+=gRandom->Gaus(0,sigmavx); Vy+=gRandom->Gaus(0,sigmavy); Vz+=gRandom->Gaus(0,sigmavz); |
1531 | TVector vertex(3), ervertex(3) |
1532 | vertex(0)=Vx; vertex(1)=Vy; vertex(2)=Vz; |
1533 | ervertex(0)=sigmavx; ervertex(1)=sigmavy; ervertex(2)=sigmavz; |
1534 | ///////////////////////////////////////////////////////////////////////////////////////////////// |
1535 | */ |
53e7090a |
1536 | |
55b5a0b3 |
1537 | |
1538 | TTree tracktree1("TreeT","Tree with ITS tracks"); |
1539 | AliITSiotrack *iotrack=0; |
1540 | tracktree1.Branch("ITStracks","AliITSiotrack",&iotrack,32000,0); |
1541 | |
1542 | ofstream out ("AliITSTra.out"); |
53e7090a |
1543 | //ofstream outprova ("AliITSprova.out"); //commentato il 26-4-2001 |
cc6e75dd |
1544 | |
1545 | Int_t j; |
1546 | for (j=min_t; j<=max_t; j++) { |
53e7090a |
1547 | track=(AliTPCtrack*)tracks.UncheckedAt(j); |
55b5a0b3 |
1548 | Int_t flaglab=0; |
1549 | if (!track) continue; |
1550 | ////// elimination of not good tracks //////////// |
1551 | Int_t ilab=TMath::Abs(track->GetLabel()); |
cc6e75dd |
1552 | Int_t iii; |
1553 | for (iii=0;iii<ngood;iii++) { |
1554 | //cout<<" ilab, gt[iii].lab = "<<ilab<<" "<<gt[iii].lab<<"\n"; getchar(); |
1555 | if (ilab==gt[iii].lab) { |
55b5a0b3 |
1556 | flaglab=1; |
cc6e75dd |
1557 | ptg=gt[iii].ptg; |
1558 | pxg=gt[iii].pxg; |
1559 | pyg=gt[iii].pyg; |
1560 | pzg=gt[iii].pzg; |
55b5a0b3 |
1561 | break; |
1562 | } |
1563 | } |
1564 | //cout<<" j flaglab = " <<j<<" "<<flaglab<<"\n"; getchar(); |
53e7090a |
1565 | if (!flaglab) continue; |
55b5a0b3 |
1566 | //cout<<" j = " <<j<<"\n"; getchar(); |
1567 | /* |
1568 | ////// old propagation to the end of TPC ////////////// |
1569 | Double_t xk=76.; |
1570 | track->PropagateTo(xk); |
1571 | xk-=0.11; |
1572 | track->PropagateTo(xk,42.7,2.27); //C |
1573 | xk-=2.6; |
1574 | track->PropagateTo(xk,36.2,1.98e-3); //C02 |
1575 | xk-=0.051; |
1576 | track->PropagateTo(xk,42.7,2.27); //C |
1577 | /////////////////////////////////////////////////// |
1578 | */ |
1579 | |
1580 | ////// new propagation to the end of TPC ////////////// |
1581 | Double_t xk=77.415; |
1582 | track->PropagateTo(xk, 28.94, 1.204e-3); //Ne |
1583 | xk -=0.01; |
1584 | track->PropagateTo(xk, 44.77, 1.71); //Tedlar |
1585 | xk -=0.04; |
1586 | track->PropagateTo(xk, 44.86, 1.45); //Kevlar |
1587 | xk -=2.0; |
1588 | track->PropagateTo(xk, 41.28, 0.029); //Nomex |
1589 | xk-=16; |
1590 | track->PropagateTo(xk,36.2,1.98e-3); //C02 |
1591 | xk -=0.01; |
1592 | track->PropagateTo(xk, 24.01, 2.7); //Al |
1593 | xk -=0.01; |
1594 | track->PropagateTo(xk, 44.77, 1.71); //Tedlar |
1595 | xk -=0.04; |
1596 | track->PropagateTo(xk, 44.86, 1.45); //Kevlar |
1597 | xk -=0.5; |
1598 | track->PropagateTo(xk, 41.28, 0.029); //Nomex |
1599 | |
1600 | /////////////////////////////////////////////////////////////// |
1601 | |
1602 | /////////////////////////////////////////////////////////////// |
1603 | AliITStrack trackITS(*track); |
1604 | AliITStrack result(*track); |
1605 | AliITStrack primarytrack(*track); |
1606 | |
1607 | /////////////////////////////////////////////////////////////////////////////////////////////// |
1608 | TVector Vgeant(3); |
1609 | Vgeant=result.GetVertex(); |
1610 | |
1611 | // Definition of Dv and Zv for vertex constraint |
cc6e75dd |
1612 | Double_t sigmaDv=0.0050; Double_t sigmaZv=0.010; |
1613 | //Double_t sigmaDv=0.0015; Double_t sigmaZv=0.0015; |
55b5a0b3 |
1614 | Double_t uniform= gRandom->Uniform(); |
1615 | Double_t signdv; |
1616 | if(uniform<=0.5) signdv=-1.; |
1617 | else |
1618 | signdv=1.; |
1619 | |
1620 | Double_t Vr=TMath::Sqrt(Vgeant(0)*Vgeant(0)+ Vgeant(1)*Vgeant(1)); |
1621 | Double_t Dv=gRandom->Gaus(signdv*Vr,(Float_t)sigmaDv); |
1622 | Double_t Zv=gRandom->Gaus(Vgeant(2),(Float_t)sigmaZv); |
1623 | |
1624 | //cout<<" Dv e Zv = "<<Dv<<" "<<Zv<<"\n"; |
1625 | trackITS.SetDv(Dv); trackITS.SetZv(Zv); |
1626 | trackITS.SetsigmaDv(sigmaDv); trackITS.SetsigmaZv(sigmaZv); |
1627 | result.SetDv(Dv); result.SetZv(Zv); |
1628 | result.SetsigmaDv(sigmaDv); result.SetsigmaZv(sigmaZv); |
1629 | primarytrack.SetDv(Dv); primarytrack.SetZv(Zv); |
1630 | primarytrack.SetsigmaDv(sigmaDv); primarytrack.SetsigmaZv(sigmaZv); |
1631 | |
1632 | ///////////////////////////////////////////////////////////////////////////////////////////////// |
1633 | |
8af13b4b |
1634 | primarytrack.PrimaryTrack(rl); |
55b5a0b3 |
1635 | TVector d2=primarytrack.Getd2(); |
1636 | TVector tgl2=primarytrack.Gettgl2(); |
1637 | TVector dtgl=primarytrack.Getdtgl(); |
1638 | trackITS.Setd2(d2); trackITS.Settgl2(tgl2); trackITS.Setdtgl(dtgl); |
1639 | result.Setd2(d2); result.Settgl2(tgl2); result.Setdtgl(dtgl); |
1640 | /* |
1641 | trackITS.SetVertex(vertex); trackITS.SetErrorVertex(ervertex); |
1642 | result.SetVertex(vertex); result.SetErrorVertex(ervertex); |
53e7090a |
1643 | */ |
1644 | |
8af13b4b |
1645 | Tracking(trackITS,&result,recPoints,vettid, flagvert,rl); |
55b5a0b3 |
1646 | |
8af13b4b |
1647 | // cout<<" progressive track number = "<<j<<"\r"; |
cc6e75dd |
1648 | // cout<<j<<"\r"; |
53e7090a |
1649 | Int_t NumofCluster=result.GetNumClust(); |
1650 | cout<<" progressive track number = "<<j<<"\n"; // stampa |
55b5a0b3 |
1651 | Long_t labITS=result.GetLabel(); |
53e7090a |
1652 | cout << " ITS track label = " << labITS << "\n"; // stampa |
55b5a0b3 |
1653 | int lab=track->GetLabel(); |
53e7090a |
1654 | cout << " TPC track label = " << lab <<"\n"; // stampa |
55b5a0b3 |
1655 | |
53e7090a |
1656 | |
55b5a0b3 |
1657 | //propagation to vertex |
1658 | |
1659 | Double_t rbeam=3.; |
cc6e75dd |
1660 | |
1661 | result.Propagation(rbeam); |
53e7090a |
1662 | |
1663 | Double_t C00,C10,C11,C20,C21,C22,C30,C31,C32,C33,C40,C41,C42,C43,C44; |
1664 | result.GetCElements(C00,C10,C11,C20,C21,C22,C30,C31,C32,C33,C40,C41,C42,C43,C44); |
1665 | |
55b5a0b3 |
1666 | Double_t pt=TMath::Abs(result.GetPt()); |
1667 | Double_t Dr=result.GetD(); |
1668 | Double_t Z=result.GetZ(); |
1669 | Double_t tgl=result.GetTgl(); |
1670 | Double_t C=result.GetC(); |
1671 | Double_t Cy=C/2.; |
1672 | Double_t Dz=Z-(tgl/Cy)*TMath::ASin(result.arga(rbeam)); |
53e7090a |
1673 | Dz-=Vgeant(2); |
cc6e75dd |
1674 | |
55b5a0b3 |
1675 | // cout<<" Dr e dz alla fine = "<<Dr<<" "<<Dz<<"\n"; getchar(); |
1676 | Double_t phi=result.Getphi(); |
1677 | Double_t phivertex = phi - TMath::ASin(result.argA(rbeam)); |
1678 | Double_t duepi=2.*TMath::Pi(); |
1679 | if(phivertex>duepi) phivertex-=duepi; |
1680 | if(phivertex<0.) phivertex+=duepi; |
cc6e75dd |
1681 | Double_t Dtot=TMath::Sqrt(Dr*Dr+Dz*Dz); |
1682 | |
55b5a0b3 |
1683 | ////////////////////////////////////////////////////////////////////////////////////////// |
53e7090a |
1684 | |
1685 | Int_t idmodule,idpoint; |
1686 | if(NumofCluster >=5) { // cinque - sei |
1687 | //if(NumofCluster ==6) { // cinque - sei |
55b5a0b3 |
1688 | |
1689 | |
1690 | AliITSiotrack outtrack; |
1691 | |
1692 | iotrack=&outtrack; |
1693 | |
1694 | iotrack->SetStatePhi(phi); |
1695 | iotrack->SetStateZ(Z); |
1696 | iotrack->SetStateD(Dr); |
1697 | iotrack->SetStateTgl(tgl); |
1698 | iotrack->SetStateC(C); |
1699 | Double_t radius=result.Getrtrack(); |
1700 | iotrack->SetRadius(radius); |
1701 | Int_t charge; |
1702 | if(C>0.) charge=-1; else charge=1; |
1703 | iotrack->SetCharge(charge); |
1704 | |
55b5a0b3 |
1705 | |
53e7090a |
1706 | |
686b2f43 |
1707 | iotrack->SetCovMatrix(C00,C10,C11,C20,C21,C22,C30,C31,C32,C33,C40,C41,C42,C43,C44); |
55b5a0b3 |
1708 | |
8ab89103 |
1709 | Double_t px=pt*TMath::Cos(phivertex); |
1710 | Double_t py=pt*TMath::Sin(phivertex); |
55b5a0b3 |
1711 | Double_t pz=pt*tgl; |
1712 | |
8ab89103 |
1713 | Double_t xtrack=Dr*TMath::Sin(phivertex); |
1714 | Double_t ytrack=Dr*TMath::Cos(phivertex); |
55b5a0b3 |
1715 | Double_t ztrack=Dz+Vgeant(2); |
1716 | |
1717 | |
1718 | iotrack->SetPx(px); |
1719 | iotrack->SetPy(py); |
1720 | iotrack->SetPz(pz); |
1721 | iotrack->SetX(xtrack); |
1722 | iotrack->SetY(ytrack); |
1723 | iotrack->SetZ(ztrack); |
1724 | iotrack->SetLabel(labITS); |
1725 | |
c5b22044 |
1726 | Int_t il; |
1727 | for(il=0;il<6; il++){ |
55b5a0b3 |
1728 | iotrack->SetIdPoint(il,result.GetIdPoint(il)); |
1729 | iotrack->SetIdModule(il,result.GetIdModule(il)); |
1730 | } |
1731 | tracktree1.Fill(); |
1732 | |
1733 | //cout<<" labITS = "<<labITS<<"\n"; |
1734 | //cout<<" phi z Dr tgl C = "<<phi<<" "<<Z<<" "<<Dr<<" "<<tgl<<" "<<C<<"\n"; getchar(); |
1735 | |
1736 | DataOut(kkk) = ptg; kkk++; DataOut(kkk)=labITS; kkk++; DataOut(kkk)=lab; kkk++; |
1737 | |
c5b22044 |
1738 | for (il=0;il<6;il++) { |
55b5a0b3 |
1739 | idpoint=result.GetIdPoint(il); |
1740 | idmodule=result.GetIdModule(il); |
1741 | *(vettid[idmodule]+idpoint)=1; |
1742 | iotrack->SetIdPoint(il,idpoint); |
1743 | iotrack->SetIdModule(il,idmodule); |
1744 | } |
cc6e75dd |
1745 | |
1746 | // cout<<" +++++++++++++ pt e ptg = "<<pt<<" "<<ptg<<" ++++++++++\n"; |
55b5a0b3 |
1747 | Double_t difpt= (pt-ptg)/ptg*100.; |
1748 | DataOut(kkk)=difpt; kkk++; |
1749 | Double_t lambdag=TMath::ATan(pzg/ptg); |
1750 | Double_t lam=TMath::ATan(tgl); |
1751 | Double_t diflam = (lam - lambdag)*1000.; |
1752 | DataOut(kkk) = diflam; kkk++; |
53e7090a |
1753 | Double_t phig=TMath::ATan2(pyg,pxg); if(phig<0) phig=2.*TMath::Pi()+phig; |
1754 | Double_t phi=phivertex; |
1755 | |
55b5a0b3 |
1756 | Double_t difphi = (phi - phig)*1000.; |
1757 | DataOut(kkk)=difphi; kkk++; |
1758 | DataOut(kkk)=Dtot*1.e4; kkk++; |
1759 | DataOut(kkk)=Dr*1.e4; kkk++; |
53e7090a |
1760 | DataOut(kkk)=Dz*1.e4; kkk++; |
cc6e75dd |
1761 | Int_t r; |
1762 | for (r=0; r<9; r++) { out<<DataOut(r)<<" ";} |
55b5a0b3 |
1763 | out<<"\n"; |
1764 | kkk=0; |
1765 | |
1766 | |
1767 | } // end if on NumofCluster |
1768 | //gObjectTable->Print(); // stampa memoria |
1769 | } // end for (int j=min_t; j<=max_t; j++) |
1770 | |
1771 | out.close(); |
53e7090a |
1772 | //outprova.close(); |
cc6e75dd |
1773 | |
55b5a0b3 |
1774 | static Bool_t first=kTRUE; |
1775 | static TFile *tfile; |
1776 | |
1777 | if(first) { |
1778 | tfile=new TFile("itstracks.root","RECREATE"); |
1779 | //cout<<"I have opened itstracks.root file "<<endl; |
1780 | } |
1781 | first=kFALSE; |
1782 | tfile->cd(); |
1783 | tfile->ls(); |
1784 | |
1785 | char hname[30]; |
1786 | sprintf(hname,"TreeT%d",evNumber); |
1787 | |
1788 | tracktree1.Write(hname); |
1789 | |
1790 | |
1791 | |
1792 | TTree *fAli=gAlice->TreeK(); |
1793 | TFile *fileAli=0; |
1794 | |
1795 | if (fAli) fileAli =fAli->GetCurrentFile(); |
1796 | fileAli->cd(); |
1797 | |
1798 | //////////////////////////////////////////////////////////////////////////////////////////////// |
1799 | |
1800 | printf("delete vectors\n"); |
1801 | if(np) delete [] np; |
1802 | if(vettid) delete [] vettid; |
1803 | |
1804 | } |
53e7090a |
1805 | |