AliPhysics  31210d0 (31210d0)
AliAODTracklet.C
Go to the documentation of this file.
1 
11 #ifndef ALIAODTRACKLET_C
12 #define ALIAODTRACKLET_C
13 #include <TObject.h>
14 #ifndef __CINT__
15 # include <TMath.h>
16 # include <TString.h>
17 #endif
18 
19 //====================================================================
25 class AliAODTracklet : public TObject
26 {
27 public:
29  enum {
30  kInjection = 0x01,
32  kSecondary = 0x04,
33  kDistinct = 0x08,
34  kSimulated = 0x10,
35  kGenerated = 0x20,
36  kNeutral = 0x40,
37  kSuppressed = 0x80
38  };
39 
41  typedef Float_t Real_t;
51  AliAODTracklet(const AliAODTracklet& other);
55  virtual ~AliAODTracklet() {}
64 
74  void SetTheta(Real_t x) { fTheta = x; }
80  void SetPhi(Real_t x) { fPhi = x; }
86  void SetDTheta(Real_t x) { fDTheta = x; }
92  void SetDPhi(Real_t x) { fDPhi = x; }
98  void SetDelta(Real_t x) { fDelta = x; }
104  void SetFlags(UChar_t x) { fFlags = x; }
120  void SetDistinct() { fFlags |= kDistinct; }
132  void SetNeutral() { fFlags |= kNeutral; }
137  /* @} */
147  Real_t GetTheta() const { return fTheta; }
153  Real_t GetPhi() const { return fPhi; }
159  Real_t GetDTheta() const { return fDTheta; }
165  Real_t GetDPhi() const { return fDPhi; }
171  Real_t GetDelta() const { return fDelta; }
177  UChar_t GetFlags() const { return fFlags; }
178  /* @} */
188  Real_t GetEta() const { return -TMath::Log(TMath::Tan(fTheta/2)); }
196  Bool_t IsMeasured() const { return !IsInjection() && !IsGenerated(); }
201  Bool_t IsInjection() const { return fFlags & kInjection; }
210  Bool_t IsDistinct() const { return fFlags & kDistinct; }
214  Bool_t IsSimulated() const { return fFlags & kSimulated; }
218  Bool_t IsSecondary() const { return fFlags & kSecondary; }
222  Bool_t IsPrimary() const { return (IsSimulated() &&
223  !IsSecondary() &&
224  !IsCombinatorics() &&
225  !IsGenerated()); }
229  Bool_t IsGenerated() const { return fFlags & kGenerated; }
233  Bool_t IsNeutral() const { return fFlags & kNeutral; }
239  Bool_t IsSuppressed() const { return fFlags & kSuppressed; }
240  /* @} */
252  virtual Real_t GetParentPt(Bool_t second=false) const { return 0; }
260  virtual Short_t GetParentPdg(Bool_t second=false) const { return 0; }
261  /* @} */
267  void Print(Option_t* option="") const;
268 protected:
270  Real_t fTheta;
272  Real_t fPhi;
274  Real_t fDTheta;
276  Real_t fDPhi;
278  Real_t fDelta;
280  UChar_t fFlags;
281 
282  ClassDef(AliAODTracklet,2); // Single tracklet
283 };
284 //____________________________________________________________________
286  : fTheta(999),
287  fPhi(999),
288  fDTheta(999),
289  fDPhi(999),
290  fDelta(-1),
291  fFlags(0)
292 {}
293 //____________________________________________________________________
295  : TObject(other),
296  fTheta(other.fTheta),
297  fPhi(other.fPhi),
298  fDTheta(other.fDTheta),
299  fDPhi(other.fDPhi),
300  fDelta(other.fDelta),
301  fFlags(other.fFlags)
302 {}
303 //____________________________________________________________________
306 {
307  if (&other == this) return *this;
308  fTheta = other.fTheta;
309  fPhi = other.fPhi;
310  fDTheta = other.fDTheta;
311  fDPhi = other.fDPhi;
312  fDelta = other.fDelta;
313  fFlags = other.fFlags;
314  return *this;
315 }
316 //____________________________________________________________________
317 void AliAODTracklet::Print(Option_t* option) const
318 {
319  char flags[9];
320  if (IsMeasured()) flags[0] = 'M'; else flags[0] = '-';
321  if (IsInjection()) flags[1] = 'I'; else flags[1] = '-';
322  if (IsCombinatorics()) flags[2] = 'C'; else flags[2] = '-';
323  if (IsDistinct()) flags[3] = 'D'; else flags[3] = '-';
324  if (IsSecondary()) flags[4] = 'S'; else flags[4] = '-';
325  if (IsPrimary()) flags[5] = 'P'; else flags[5] = '-';
326  if (IsGenerated()) flags[6] = 'G'; else flags[6] = '-';
327  if (IsSuppressed()) flags[7] = 'S'; else flags[7] = '-';
328  flags[8] = '\0';
329  printf("Tracklet 0x%02x %s (%6.2f,%6.2f)+/-(%6.2f,%6.2f) [eta=%5.2f]",
330  fFlags,
331  flags,
332  TMath::RadToDeg()*fTheta,
333  TMath::RadToDeg()*fPhi,
334  TMath::RadToDeg()*fDTheta,
335  TMath::RadToDeg()*fDPhi,
336  GetEta());
337  if (option[0] == 'B') return;
338  printf("\n");
339 }
340 
341 
342 //====================================================================
349 {
350 public:
360  AliAODMCTracklet(const AliAODMCTracklet& other);
364  virtual ~AliAODMCTracklet() {}
384  virtual Real_t GetParentPt(Bool_t second=false) const
385  {
386  return !second ? fPar1Pt : fPar2Pt;
387  }
395  virtual Short_t GetParentPdg(Bool_t second=false) const
396  {
397  return !second ? fPar1Pdg : fPar2Pdg;
398  }
405  void SetParentPt(Real_t pt, Bool_t second=false)
406  {
407  if (!second) fPar1Pt = pt; else fPar2Pt = pt;
408  }
415  void SetParentPdg(Short_t pdg, Bool_t second=false)
416  {
417  if (!second) fPar1Pdg = pdg; else fPar2Pdg = pdg;
418  }
419  /* @} */
425  void Print(Option_t* option="") const;
426 protected:
435 
436  ClassDef(AliAODMCTracklet,2); // Single tracklet information (sim)
437 };
438 
439 //____________________________________________________________________
441  : AliAODTracklet(),
442  fPar1Pt(-1),
443  fPar2Pt(-1),
444  fPar1Pdg(0),
445  fPar2Pdg(0)
446 {}
447 //____________________________________________________________________
449  : AliAODTracklet(other),
450  fPar1Pt(other.fPar1Pt),
451  fPar2Pt(other.fPar2Pt),
452  fPar1Pdg(other.fPar1Pdg),
453  fPar2Pdg(other.fPar2Pdg)
454 {
455  SetSimulated();
456 }
457 //____________________________________________________________________
460 {
461  if (&other == this) return *this;
463  fPar1Pt = other.fPar1Pt;
464  fPar2Pt = other.fPar2Pt;
465  fPar1Pdg = other.fPar1Pdg;
466  fPar2Pdg = other.fPar2Pdg;
467  return *this;
468 }
469 
470 //____________________________________________________________________
472 {
474  Printf(" [%5d,%5.2f %5d,%5.2f]", fPar1Pdg,fPar1Pt, fPar2Pdg, fPar2Pt);
475 }
476 
477 #endif
478 //____________________________________________________________________
479 //
480 // EOF
481 //
void Print(Option_t *option="") const
Int_t pdg
void SetPhi(Real_t x)
Real_t GetEta() const
Real_t GetTheta() const
void SetFlags(UChar_t x)
void SetCombinatorics()
void SetParentPdg(Short_t pdg, Bool_t second=false)
void SetTheta(Real_t x)
virtual ~AliAODTracklet()
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
Real_t GetPhi() const
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
UChar_t GetFlags() const
Bool_t IsNeutral() const
Bool_t IsGenerated() const
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)
virtual ~AliAODMCTracklet()
Bool_t IsPrimary() const