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