AliPhysics  master (3d17d9d)
AliAODTracklet.C
Go to the documentation of this file.
1 #ifndef ALIAODTRACKLET_C
8 #define ALIAODTRACKLET_C
9 #include <TObject.h>
10 #ifndef __CINT__
11 # include <TMath.h>
12 # include <TString.h>
13 #endif
14 
17 class AliAODTracklet : public TObject
18 {
19 public:
21  enum {
22  kInjection = 0x01,
24  kSecondary = 0x04,
25  kDistinct = 0x08,
26  kSimulated = 0x10,
27  kGenerated = 0x20,
28  kNeutral = 0x40,
29  kSuppressed = 0x80
30  };
31 
33  typedef Float_t Real_t;
40  AliAODTracklet(const AliAODTracklet& other);
44  virtual ~AliAODTracklet() {}
52 
53 
55 
59  void SetTheta(Real_t x) { fTheta = x; }
65  void SetPhi(Real_t x) { fPhi = x; }
71  void SetDTheta(Real_t x) { fDTheta = x; }
77  void SetDPhi(Real_t x) { fDPhi = x; }
83  void SetDelta(Real_t x) { fDelta = x; }
89  void SetFlags(UChar_t x) { fFlags = x; }
105  void SetDistinct() { fFlags |= kDistinct; }
117  void SetNeutral() { fFlags |= kNeutral; }
122 
123 
125 
131  Real_t GetTheta() const { return fTheta; }
137  Real_t GetPhi() const { return fPhi; }
143  Real_t GetDTheta() const { return fDTheta; }
149  Real_t GetDPhi() const { return fDPhi; }
155  Real_t GetDelta() const { return fDelta; }
161  UChar_t GetFlags() const { return fFlags; }
162 
164 
170  Real_t GetEta() const { return -TMath::Log(TMath::Tan(fTheta/2)); }
178  Bool_t IsMeasured() const { return !IsInjection() && !IsGenerated(); }
183  Bool_t IsInjection() const { return fFlags & kInjection; }
192  Bool_t IsDistinct() const { return fFlags & kDistinct; }
196  Bool_t IsSimulated() const { return fFlags & kSimulated; }
200  Bool_t IsSecondary() const { return fFlags & kSecondary; }
204  Bool_t IsPrimary() const { return (IsSimulated() &&
205  !IsSecondary() &&
206  !IsCombinatorics() &&
207  !IsGenerated()); }
211  Bool_t IsGenerated() const { return fFlags & kGenerated; }
215  Bool_t IsNeutral() const { return fFlags & kNeutral; }
221  Bool_t IsSuppressed() const { return fFlags & kSuppressed; }
232  virtual Real_t GetParentPt(Bool_t second=false) const { return 0; }
240  virtual Short_t GetParentPdg(Bool_t second=false) const { return 0; }
246  void Print(Option_t* option="") const;
247 protected:
249  Real_t fTheta;
251  Real_t fPhi;
253  Real_t fDTheta;
255  Real_t fDPhi;
257  Real_t fDelta;
259  UChar_t fFlags;
260 
261  ClassDef(AliAODTracklet,2);
262 };
263 //____________________________________________________________________
265  : fTheta(999),
266  fPhi(999),
267  fDTheta(999),
268  fDPhi(999),
269  fDelta(-1),
270  fFlags(0)
271 {}
272 //____________________________________________________________________
274  : TObject(other),
275  fTheta(other.fTheta),
276  fPhi(other.fPhi),
277  fDTheta(other.fDTheta),
278  fDPhi(other.fDPhi),
279  fDelta(other.fDelta),
280  fFlags(other.fFlags)
281 {}
282 //____________________________________________________________________
285 {
286  if (&other == this) return *this;
287  fTheta = other.fTheta;
288  fPhi = other.fPhi;
289  fDTheta = other.fDTheta;
290  fDPhi = other.fDPhi;
291  fDelta = other.fDelta;
292  fFlags = other.fFlags;
293  return *this;
294 }
295 //____________________________________________________________________
296 void AliAODTracklet::Print(Option_t* option) const
297 {
298  char flags[9];
299  if (IsMeasured()) flags[0] = 'M'; else flags[0] = '-';
300  if (IsInjection()) flags[1] = 'I'; else flags[1] = '-';
301  if (IsCombinatorics()) flags[2] = 'C'; else flags[2] = '-';
302  if (IsDistinct()) flags[3] = 'D'; else flags[3] = '-';
303  if (IsSecondary()) flags[4] = 'S'; else flags[4] = '-';
304  if (IsPrimary()) flags[5] = 'P'; else flags[5] = '-';
305  if (IsGenerated()) flags[6] = 'G'; else flags[6] = '-';
306  if (IsSuppressed()) flags[7] = 'S'; else flags[7] = '-';
307  flags[8] = '\0';
308  printf("Tracklet 0x%02x %s (%6.2f,%6.2f)+/-(%6.2f,%6.2f) [eta=%5.2f]",
309  fFlags,
310  flags,
311  TMath::RadToDeg()*fTheta,
312  TMath::RadToDeg()*fPhi,
313  TMath::RadToDeg()*fDTheta,
314  TMath::RadToDeg()*fDPhi,
315  GetEta());
316  if (option[0] == 'B') return;
317  printf("\n");
318 }
319 
320 
321 //====================================================================
328 {
329 public:
339  AliAODMCTracklet(const AliAODMCTracklet& other);
343  virtual ~AliAODMCTracklet() {}
362  virtual Real_t GetParentPt(Bool_t second=false) const
363  {
364  return !second ? fPar1Pt : fPar2Pt;
365  }
373  virtual Short_t GetParentPdg(Bool_t second=false) const
374  {
375  return !second ? fPar1Pdg : fPar2Pdg;
376  }
383  void SetParentPt(Real_t pt, Bool_t second=false)
384  {
385  if (!second) fPar1Pt = pt; else fPar2Pt = pt;
386  }
393  void SetParentPdg(Short_t pdg, Bool_t second=false)
394  {
395  if (!second) fPar1Pdg = pdg; else fPar2Pdg = pdg;
396  }
402  void Print(Option_t* option="") const;
403 protected:
412 
413  ClassDef(AliAODMCTracklet,2);
414 };
415 
416 //____________________________________________________________________
418  : AliAODTracklet(),
419  fPar1Pt(-1),
420  fPar2Pt(-1),
421  fPar1Pdg(0),
422  fPar2Pdg(0)
423 {}
424 //____________________________________________________________________
426  : AliAODTracklet(other),
427  fPar1Pt(other.fPar1Pt),
428  fPar2Pt(other.fPar2Pt),
429  fPar1Pdg(other.fPar1Pdg),
430  fPar2Pdg(other.fPar2Pdg)
431 {
432  SetSimulated();
433 }
434 //____________________________________________________________________
437 {
438  if (&other == this) return *this;
440  fPar1Pt = other.fPar1Pt;
441  fPar2Pt = other.fPar2Pt;
442  fPar1Pdg = other.fPar1Pdg;
443  fPar2Pdg = other.fPar2Pdg;
444  return *this;
445 }
446 
447 //____________________________________________________________________
449 {
451  Printf(" [%5d,%5.2f %5d,%5.2f]", fPar1Pdg,fPar1Pt, fPar2Pdg, fPar2Pt);
452 }
453 
454 #endif
void Print(Option_t *option="") const
Int_t pdg
void SetPhi(Real_t x)
Real_t GetEta() const
Short_t fPar2Pdg
Second parent pt.
Real_t GetTheta() const
void SetFlags(UChar_t x)
Real_t fDTheta
Tracklet polar opening angle.
void SetCombinatorics()
Short_t fPar1Pdg
First parent pt.
void SetParentPdg(Short_t pdg, Bool_t second=false)
UChar_t fFlags
Tracklet flags.
void SetTheta(Real_t x)
virtual ~AliAODTracklet()
AliAODTracklet()
Default constructor.
Bool_t IsSecondary() const
void SetDTheta(Real_t x)
Bool_t IsInjection() const
virtual Real_t GetParentPt(Bool_t second=false) const
virtual Real_t GetParentPt(Bool_t second=false) const
Bool_t IsCombinatorics() const
AliAODMCTracklet & operator=(const AliAODMCTracklet &other)
Bool_t IsSimulated() const
Real_t GetDTheta() const
Bool_t IsSuppressed() const
float Float_t
Definition: External.C:68
Real_t GetDPhi() const
Tracklet AOD object.
Real_t fPar2Pt
Second parent pt.
Real_t GetPhi() const
Real_t fTheta
Tracklet polar angle.
virtual Short_t GetParentPdg(Bool_t second=false) const
Bool_t IsMeasured() const
virtual Short_t GetParentPdg(Bool_t second=false) const
AliAODTracklet & operator=(const AliAODTracklet &other)
void SetParentPt(Real_t pt, Bool_t second=false)
short Short_t
Definition: External.C:23
Float_t Real_t
Type of real values.
UChar_t GetFlags() const
Bool_t IsNeutral() const
Bool_t IsGenerated() const
Real_t fPar1Pt
First parent pt.
void Print(Option_t *option="") const
Bool_t IsDistinct() const
const char Option_t
Definition: External.C:48
Real_t GetDelta() const
bool Bool_t
Definition: External.C:53
void SetDelta(Real_t x)
void SetDPhi(Real_t x)
Real_t fPhi
Tracklet azimuthal angle.
Real_t fDPhi
Tracklet azimuthal opening angle.
virtual ~AliAODMCTracklet()
Bool_t IsPrimary() const
Real_t fDelta
Tracklet quality.