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