]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITShit.cxx
Missing whitespaces preventing to compile with gcc4
[u/mrichter/AliRoot.git] / ITS / AliITShit.cxx
CommitLineData
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
88cb7938 16/* $Id$ */
4c039060 17
4ae5bbc4 18#include <Riostream.h>
58005f18 19
012f0f4c 20#include <TLorentzVector.h>
21#include <TParticle.h>
58005f18 22
b2340bbf 23#include "AliRun.h"
58005f18 24#include "AliITS.h"
4fc5ed2d 25#include "AliITSgeom.h"
58005f18 26#include "AliITShit.h"
5d12ce38 27#include "AliMC.h"
58005f18 28
29
30ClassImp(AliITShit)
31////////////////////////////////////////////////////////////////////////
32// Version: 0
33// Written by Rene Brun, Federico Carminati, and Roberto Barbera
34//
35// Version: 1
36// Modified and documented by Bjorn S. Nilsen
37// July 11 1999
38//
39// AliITShit is the hit class for the ITS. Hits are the information
40// that comes from a Monte Carlo at each step as a particle mass through
41// sensitive detector elements as particles are transported through a
42// detector.
43//
44//Begin_Html
45/*
a92b2b7d 46<img src="picts/ITS/AliITShit_Class_Diagram.gif">
58005f18 47</pre>
48<br clear=left>
49<font size=+2 color=red>
50<p>This show the relasionships between the ITS hit class and the rest of Aliroot.
51</font>
52<pre>
53*/
54//End_Html
b2340bbf 55////////////////////////////////////////////////////////////////////////
56// Inline Member functions:
57//
58// AliITShit()
59// The default creator of the AliITShit class.
60//
61// ~AliITShit()
62// The default destructor of the AliITShit class.
63//
64// int GetTrack()
65// See AliHit for a full description. Returns the track number fTrack
66// for this hit.
67//
68// SetTrack(int track)
69// See AliHit for a full description. Sets the track number fTrack
70// for this hit.
71//
72// Int_t GetTrackStatus()
73// Returns the value of the track status flag fStatus. This flag
74// indicates the track status at the time of creating this hit. It is
75// made up of the following 8 status bits from highest order to lowest
76// order bits
77// 0 : IsTrackAlive(): IsTrackStop():IsTrackDisappeared():
78// IsTrackOut():IsTrackExiting():IsTrackEntering():IsTrackInside() .
79// See AliMC for a description of these functions. If the function is
80// true then the bit is set to one, otherwise it is zero.
81//
82// Bool_t StatusInside()
83// Returns kTRUE if the particle producing this hit is still inside
84// the present volume. Returns kFalse if this particle will be in another
85// volume. {bit IsTrackInside is set or not}
86//
87// Bool_t StatusEntering()
88// Returns kTRUE if the particle producing this hit is has just enterd
89// the present volume. Returns kFalse otherwise. {bit IsTrackEntering is
90// set or not}
91//
92// Bool_t StatusExiting()
93// Returns kTRUE if the particle producing this hit is will exit
94// the present volume. Returns kFalse otherwise. {bit IsTrackExiting is set
95// or not}
96//
97// Bool_t StatusOut()
98// Returns kTRUE if the particle producing this hit is goint exit the
99// simulation. Returns kFalse otherwise. {bit IsTrackOut is set or not}
100//
101// Bool_t StatusDisappeared()
102// Returns kTRUE if the particle producing this hit is going to "disappear"
103// for example it has interacted producing some other particles. Returns
104// kFalse otherwise. {bit IsTrackOut is set or not}
105//
106// Bool_t StatusStop()
107// Returns kTRUE if the particle producing this hit is has dropped below
108// its energy cut off producing some other particles. Returns kFalse otherwise.
109// {bit IsTrackOut is set or not}
110//
111// Bool_t StatuAlives()
112// Returns kTRUE if the particle producing this hit is going to continue
113// to be transported. Returns kFalse otherwise. {bit IsTrackOut is set or not}
114//
115// Int_t GetLayer()
116// Returns the layer number, fLayer, for this hit.
117//
118// Int_t GetLadder()
119// Returns the ladder number, fLadder, for this hit.
120//
121// Int_t GetDetector()
122// Returns the detector number, fDet, for this hit.
123//
124// GetDetectorID(Int_t &layer, Int_t &ladder, Int_t &detector)
125// Returns the layer, ladder, and detector numbers, fLayer fLadder fDet,
126// in one call.
127//
128// Float_t GetIonization()
129// Returns the energy lost, fDestep, by the particle creating this hit,
130// in the units defined by the Monte Carlo.
131//
132// GetPositionG(Float_t &x, Float_t &y, Float_t &z)
133// Returns the global position, fX fY fZ, of this hit, in the units
134// define by the Monte Carlo.
135//
136// GetPositionG(Double_t &x, Double_t &y, Double_t &z)
137// Returns the global position, fX fY fZ, of this hit, in the units
138// define by the Monte Carlo.
139//
140// GetPositionG(Float_t &x, Float_t &y, Float_t &z, Float_t &tof)
141// Returns the global position and time of flight, fX fY fZ fTof, of
142// this hit, in the units define by the Monte Carlo.
143//
144// GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
145// Returns the global position and time of flight, fX fY fZ fTof, of
146// this hit, in the units define by the Monte Carlo.
147//
148// GetPositionL(Double_t &x,Double_t &y,Double_t &z)
149// Returns the local position, fX fY fZ, of this hit in the coordiante
150// of this module, in the units define by the Monte Carlo.
151//
152// GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
153// Returns the local position and time of flight, fX fY fZ fTof, of
154// this hit in the coordinates of this module, in the units define by the
155// Monte Carlo.
156//
157// Float_t GetXG()
158// Returns the global x position in the units defined by the Monte Carlo.
159//
160// Float_t GetYG()
161// Returns the global y position in the units defined by the Monte Carlo.
162//
163// Float_t GetYG()
164// Returns the global z position in the units defined by the Monte Carlo.
165//
166// Float_t GetTOF()
167// Returns the time of flight, fTof, of this hit, in the units defined
168// by the Monte Carlo.
169//
170// GetMomentumG(Float_t &px, Float_t &py, Float_t &pz)
171// Returns the global momentum, fPx fPy fPz, of the particle that made
172// this hit, in the units define by the Monte Carlo.
173//
174// GetMomentumG(Double_t &px,Double_t &py,Double_t &pz)
175// Returns the global momentum, fPx fPy fPz, of the particle that made
176// this hit, in the units define by the Monte Carlo.
177//
178// GetMomentumL(Double_t &px,Double_t &py,Double_t &pz)
179// Returns the momentum, fPx fPy fPz in coordinate appropreate for this
180// specific module, in the units define by the Monte Carlo.
181//
182// Float_t GetPXG()
183// Returns the global X momentum in the units defined by the Monte Carlo.
184//
185// Float_t GetPYG()
186// Returns the global Y momentum in the units defined by the Monte Carlo.
187//
188// Float_t GetPZG()
189// Returns the global Z momentum in the units defined by the Monte Carlo.
190//
191////////////////////////////////////////////////////////////////////////
58005f18 192//_____________________________________________________________________________
7537d03c 193AliITShit::AliITShit():AliHit(),
012f0f4c 194fStatus(0), // Track Status
195fModule(0), // Module number
196fPx(0.0), // PX of particle at the point of the hit
197fPy(0.0), // PY of particle at the point of the hit
198fPz(0.0), // PZ of particle at the point of the hit
199fDestep(0.0), // Energy deposited in the current step
200fTof(0.0), // Time of flight at the point of the hit
201fStatus0(0),// Track Status of Starting point
202fx0(0.0), // Starting point of this step
203fy0(0.0), // Starting point of this step
204fz0(0.0), // Starting point of this step
205ft0(0.0) // Starting point of this step
206{
7e3ded1b 207 // Default Constructor
208 // Zero data member just to be safe.
209 // Intputs:
210 // none.
211 // Outputs:
212 // none.
213 // Return:
214 // A default created AliITShit class.
215
7e3ded1b 216}
012f0f4c 217//----------------------------------------------------------------------
7e3ded1b 218AliITShit::AliITShit(Int_t shunt,Int_t track,Int_t *vol,Float_t edep,
012f0f4c 219 Float_t tof,TLorentzVector &x,TLorentzVector &x0,
220 TLorentzVector &p) :
221AliHit(shunt, track), // AliHit
222fStatus(vol[3]), // Track Status
223fModule(vol[0]), // Module number
224fPx(p.Px()), // PX of particle at the point of the hit
225fPy(p.Py()), // PY of particle at the point of the hit
226fPz(p.Pz()), // PZ of particle at the point of the hit
227fDestep(edep), // Energy deposited in the current step
228fTof(tof), // Time of flight at the point of the hit
229fStatus0(vol[4]),// Track Status of Starting point
230fx0(x0.X()), // Starting point of this step
231fy0(x0.Y()), // Starting point of this step
232fz0(x0.Z()), // Starting point of this step
233ft0(x0.T()) // Starting point of this step
234{
235 // Create ITS hit
236 // The creator of the AliITShit class. The variables shunt and
237 // track are passed to the creator of the AliHit class. See the AliHit
238 // class for a full description. In the units of the Monte Carlo
239 // Inputs:
7e3ded1b 240 // Int_t shunt See AliHit
241 // Int_t track Track number, see AliHit
242 // Int_t *vol Array of integer hit data,
012f0f4c 243 // vol[0] module
244 // vol[1] not used
245 // vol[2] not used
7e3ded1b 246 // vol[3] Set of status bits
247 // vol[4] Set of status bits at start
012f0f4c 248 // Float_t edep The energy deposited GeV during the transport
249 // of this step
250 // Float_t tof The time of flight of this particle at this step
251 // TLorenzVector &x The Global position of this step [cm]
252 // TLorenzVector &x0 The Global position of where this step
253 // started from [cm]
254 // TLorenzVector &p The Global momentum of the particle at this
255 // step [GeV/c]
7e3ded1b 256 // Outputs:
257 // none.
258 // Return:
259 // A default created AliITShit class.
260
012f0f4c 261 SetPosition(x);
7e3ded1b 262}
263//______________________________________________________________________
58005f18 264AliITShit::AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
012f0f4c 265 AliHit(shunt, track), // AliHit
266fStatus(vol[3]), // Track Status
267fModule(vol[0]), // Module number
268fPx(hits[3]), // PX of particle at the point of the hit
269fPy(hits[4]), // PY of particle at the point of the hit
270fPz(hits[5]), // PZ of particle at the point of the hit
271fDestep(hits[6]), // Energy deposited in the current step
272fTof(hits[7]), // Time of flight at the point of the hit
273fStatus0(vol[4]),// Track Status of Starting point
274fx0(hits[8]), // Starting point of this step
275fy0(hits[9]), // Starting point of this step
276fz0(hits[10]), // Starting point of this step
277ft0(hits[11]) // Starting point of this step
278{
279 // Create ITS hit
280 // The creator of the AliITShit class. The variables shunt and
281 // track are passed to the creator of the AliHit class. See the AliHit
282 // class for a full description. the integer array *vol contains, in order,
283 // fLayer = vol[0], fDet = vol[1], fLadder = vol[2], fStatus = vol[3].
284 // The array *hits contains, in order, fX = hits[0], fY = hits[1],
285 // fZ = hits[2], fPx = hits[3], fPy = hits[4], fPz = hits[5],
286 // fDestep = hits[6], and fTof = hits[7]. In the units of the Monte Carlo
7e3ded1b 287 // Intputs:
288 // Int_t shunt See AliHit
289 // Int_t track Track number, see AliHit
290 // Int_t *vol Array of integer hit data,
012f0f4c 291 // vol[0] module number
292 // vol[1] not used
293 // vol[2] not used
7e3ded1b 294 // vol[3] Set of status bits
012f0f4c 295 // vol[4] Set of status bits at start
7e3ded1b 296 // Float_t *hits Array of hit information
297 // hits[0] X global position of this hit
298 // hits[1] Y global position of this hit
299 // hits[2] Z global position of this hit
300 // hits[3] Px global position of this hit
301 // hits[4] Py global position of this hit
302 // hits[5] Pz global position of this hit
303 // hits[6] Energy deposited by this step
304 // hits[7] Time of flight of this particle at this step
012f0f4c 305 // hits[8] X0 global position of start of step
306 // hits[9] Y0 global position of start of step
307 // hits[10] Z0 global position of start of step
308 // hits[11] Time of flight of this particle before step
7e3ded1b 309 // Outputs:
310 // none.
311 // Return:
312 // A standard created AliITShit class.
012f0f4c 313
314 fX = hits[0]; // Track X global position
315 fY = hits[1]; // Track Y global position
316 fZ = hits[2]; // Track Z global position
58005f18 317}
b2340bbf 318//______________________________________________________________________
012f0f4c 319AliITShit::AliITShit(const AliITShit &h):
320AliHit(h), // AliHit
321fStatus(h.fStatus), // Track Status
322fModule(h.fModule), // Module number
323fPx(h.fPx), // PX of particle at the point of the hit
324fPy(h.fPy), // PY of particle at the point of the hit
325fPz(h.fPz), // PZ of particle at the point of the hit
326fDestep(h.fDestep), // Energy deposited in the current step
327fTof(h.fTof), // Time of flight at the point of the hit
328fStatus0(h.fStatus0),// Track Status of Starting point
329fx0(h.fx0), // Starting point of this step
330fy0(h.fy0), // Starting point of this step
331fz0(h.fz0), // Starting point of this step
332ft0(h.ft0) // Starting point of this step
333{
334 // The standard copy constructor
335 // Inputs:
336 // AliITShit &h the sourse of this copy
337 // Outputs:
338 // none.
339 // Return:
340 // A copy of the sourse hit h
58005f18 341
012f0f4c 342 //Info("CopyConstructor","Coping hit");
343
344 if(this == &h) return;
58005f18 345 return;
346}
b2340bbf 347//______________________________________________________________________
012f0f4c 348AliITShit& AliITShit::operator=(const AliITShit &h){
349 // The standard = operator
350 // Inputs:
351 // AliITShit &h the sourse of this copy
352 // Outputs:
353 // none.
354 // Return:
355 // A copy of the sourse hit h
356
357 if(this == &h) return *this;
358 this->fStatus = h.fStatus;
359 this->fModule = h.fModule;
360 this->fPx = h.fPx;
361 this->fPy = h.fPy;
362 this->fPz = h.fPz;
363 this->fDestep = h.fDestep;
364 this->fTof = h.fTof;
365 this->fStatus0 = h.fStatus0;
366 this->fx0 = h.fx0;
367 this->fy0 = h.fy0;
368 this->fz0 = h.fz0;
369 this->ft0 = h.ft0;
370 return *this;
371}
372//______________________________________________________________________
373void AliITShit::SetShunt(Int_t shunt){
374 // Sets track flag based on shunt value. Code copied from
375 // AliHit standar constructor.
376 // Inputs:
377 // Int_t shunt A flag to indecate what to do with track numbers
378 // Outputs:
379 // none.
380 // Return:
381 // none.
382 Int_t primary,track,current,parent;
383 TParticle *part;
384
385 track = fTrack;
386 if(shunt == 1) {
387 primary = gAlice->GetMCApp()->GetPrimary(track);
388 gAlice->GetMCApp()->Particle(primary)->SetBit(kKeepBit);
389 fTrack=primary;
390 }else if (shunt == 2) {
391 // the "primary" particle associated to the hit is
392 // the last track that has been flagged in the StepManager
393 // used by PHOS to associate the hit with the decay gamma
394 // rather than with the original pi0
395 parent=track;
396 while (1) {
397 current=parent;
398 part = gAlice->GetMCApp()->Particle(current);
399 parent=part->GetFirstMother();
400 if(parent<0 || part->TestBit(kKeepBit))
401 break;
402 }
403 fTrack=current;
404 }else {
405 fTrack=track;
406 gAlice->GetMCApp()->FlagTrack(fTrack);
407 } // end if shunt
408}
409//______________________________________________________________________
58005f18 410void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof){
012f0f4c 411 // Returns the position and time of flight of this hit in the local
412 // coordinates of this module, and in the units of the Monte Carlo.
413 // Inputs:
414 // none.
415 // Outputs:
416 // Float_t x Global position of this hit [cm]
417 // Float_t y Global position of this hit [cm]
418 // Float_t z Global poistion of this hit [cm]
419 // Float_t tof Time of flight of particle at this hit
420 // Return:
421 // none.
58005f18 422 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
423 Float_t g[3],l[3];
424
425 g[0] = fX;
426 g[1] = fY;
427 g[2] = fZ;
4fc5ed2d 428 if(gm) {
012f0f4c 429 gm->GtoL(fModule,g,l);
430 x = l[0];
431 y = l[1];
432 z = l[2];
4fc5ed2d 433 } else {
012f0f4c 434 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
435 // AliITSv7 - SDD case
436 x=fX;
437 y=fY;
438 z=fZ;
439 } // end if
58005f18 440 tof = fTof;
441 return;
442}
b2340bbf 443//______________________________________________________________________
d2ace6e6 444void AliITShit::GetPositionL0(Double_t &x,Double_t &y,Double_t &z,
012f0f4c 445 Double_t &tof){
446 // Returns the initial position and time of flight of this hit
447 // in the local coordinates of this module, and in the units of the
448 // Monte Carlo.
449 // Inputs:
450 // none.
451 // Outputs:
452 // Double_t x Global position of this hit [cm]
453 // Double_t y Global position of this hit [cm]
454 // Double_t z Global poistion of this hit [cm]
455 // Double_t tof Time of flight of particle at this hit
456 // Return:
457 // none.
d2ace6e6 458 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
459 Float_t g[3],l[3];
460
461 g[0] = fx0;
462 g[1] = fy0;
463 g[2] = fz0;
464 if(gm) {
012f0f4c 465 gm->GtoL(fModule,g,l);
466 x = l[0];
467 y = l[1];
468 z = l[2];
d2ace6e6 469 } else {
012f0f4c 470 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
471 x=fx0;
472 y=fy0;
473 z=fz0;
d2ace6e6 474 }
475 tof = ft0;
476 return;
477}
478//______________________________________________________________________
58005f18 479void AliITShit::GetMomentumL(Float_t &px,Float_t &py,Float_t &pz){
012f0f4c 480 // Returns the momentum of this hit in the local coordinates of this
481 // module, and in the units of the Monte Carlo.
482 // Inputs:
483 // none.
484 // Outputs:
485 // Float_t px Track x momentum at this hit [GeV/c]
486 // Float_t py Track y momentum at this hit [GeV/c]
487 // Float_t pz Track z momentum at this hit [GeV/c]
488 // Return:
489 // none.
58005f18 490 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
491 Float_t g[3],l[3];
492
493 g[0] = fPx;
494 g[1] = fPy;
495 g[2] = fPz;
4fc5ed2d 496 if (gm) {
012f0f4c 497 gm->GtoLMomentum(fModule,g,l);
498 px = l[0];
499 py = l[1];
500 pz = l[2];
4fc5ed2d 501 } else {
012f0f4c 502 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
503 px=fPx;
504 py=fPy;
505 pz=fPz;
506 } // end if
58005f18 507 return;
508}
b2340bbf 509//______________________________________________________________________
012f0f4c 510TParticle * AliITShit::GetParticle() const {
511 // Returns the pointer to the TParticle for the particle that created
512 // this hit. From the TParticle all kinds of information about this
513 // particle can be found. See the TParticle class.
514 // Inputs:
515 // none.
516 // Outputs:
517 // none.
518 // Return:
519 // The TParticle of the track that created this hit.
4fc5ed2d 520
012f0f4c 521 return gAlice->GetMCApp()->Particle(GetTrack());
b2340bbf 522}
012f0f4c 523//----------------------------------------------------------------------
524void AliITShit::GetDetectorID(Int_t &layer,Int_t &ladder,Int_t &det)const{
525 // Returns the layer ladder and detector number lables for this
526 // ITS module. The use of layer, ladder and detector number for
527 // discribing the ITS is obsoleate.
528 // Inputs:
529 // none.
530 // Outputs:
531 // Int_t &layer Layer lable
532 // Int_t &ladder Ladder lable
533 // Int_t &det Detector lable
534 // Return:
535 // none.
b2340bbf 536 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
537
012f0f4c 538 gm->GetModuleId(fModule,layer,ladder,det);
539 return;
3dbb2c95 540}
541//----------------------------------------------------------------------
33da2552 542void AliITShit::Print(ostream *os) const {
012f0f4c 543 // Standard output format for this class.
544 // Inputs:
545 // ostream *os The output stream
546 // Outputs:
547 // none.
548 // Return:
549 // none.
550
3dbb2c95 551#if defined __GNUC__
552#if __GNUC__ > 2
553 ios::fmtflags fmt;
554#else
555 Int_t fmt;
556#endif
94831058 557#else
9f69211c 558#if defined __ICC || defined __ECC || defined __xlC__
94831058 559 ios::fmtflags fmt;
3dbb2c95 560#else
561 Int_t fmt;
94831058 562#endif
3dbb2c95 563#endif
564
565 fmt = os->setf(ios::scientific); // set scientific floating point output
e11d9a3a 566 *os << fTrack << " " << fX << " " << fY << " " << fZ << " ";
3dbb2c95 567 fmt = os->setf(ios::hex); // set hex for fStatus only.
568 *os << fStatus << " ";
569 fmt = os->setf(ios::dec); // every thing else decimel.
012f0f4c 570 *os << fModule << " ";
3dbb2c95 571 *os << fPx << " " << fPy << " " << fPz << " ";
572 *os << fDestep << " " << fTof;
000d397e 573 *os << " " << fx0 << " " << fy0 << " " << fz0;
574// *os << " " << endl;
3dbb2c95 575 os->flags(fmt); // reset back to old formating.
576 return;
577}
578//----------------------------------------------------------------------
33da2552 579void AliITShit::Read(istream *is) {
012f0f4c 580 // Standard input format for this class.
581 // Inputs:
582 // istream *is the input stream
583 // Outputs:
584 // none.
585 // Return:
586 // none.
e11d9a3a 587
588 *is >> fTrack >> fX >> fY >> fZ;
012f0f4c 589 *is >> fStatus >> fModule >> fPx >> fPy >> fPz >> fDestep >> fTof;
7e3ded1b 590 *is >> fx0 >> fy0 >> fz0;
3dbb2c95 591 return;
592}
593//----------------------------------------------------------------------
594ostream &operator<<(ostream &os,AliITShit &p){
012f0f4c 595 // Standard output streaming function.
596 // Inputs:
597 // ostream os The output stream
598 // AliITShit p The his to be printed out
599 // Outputs:
600 // none.
601 // Return:
602 // The input stream
603
3dbb2c95 604 p.Print(&os);
605 return os;
606}
607//----------------------------------------------------------------------
608istream &operator>>(istream &is,AliITShit &r){
012f0f4c 609 // Standard input streaming function.
610 // Inputs:
611 // istream is The input stream
612 // AliITShit p The AliITShit class to be filled from this input stream
613 // Outputs:
614 // none.
615 // Return:
616 // The input stream
617
3dbb2c95 618 r.Read(&is);
619 return is;
b2340bbf 620}
3dbb2c95 621//----------------------------------------------------------------------