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