AliPhysics  f05a842 (f05a842)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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  };
38 
40  typedef Float_t Real_t;
50  AliAODTracklet(const AliAODTracklet& other);
54  virtual ~AliAODTracklet() {}
63 
73  void SetTheta(Real_t x) { fTheta = x; }
79  void SetPhi(Real_t x) { fPhi = x; }
85  void SetDTheta(Real_t x) { fDTheta = x; }
91  void SetDPhi(Real_t x) { fDPhi = x; }
97  void SetDelta(Real_t x) { fDelta = x; }
103  void SetFlags(UChar_t x) { fFlags = x; }
119  void SetDistinct() { fFlags |= kDistinct; }
131  void SetNeutral() { fFlags |= kNeutral; }
132  /* @} */
142  Real_t GetTheta() const { return fTheta; }
148  Real_t GetPhi() const { return fPhi; }
154  Real_t GetDTheta() const { return fDTheta; }
160  Real_t GetDPhi() const { return fDPhi; }
166  Real_t GetDelta() const { return fDelta; }
172  UChar_t GetFlags() const { return fFlags; }
173  /* @} */
183  Real_t GetEta() const { return -TMath::Log(TMath::Tan(fTheta/2)); }
191  Bool_t IsMeasured() const { return !IsInjection() && !IsGenerated(); }
196  Bool_t IsInjection() const { return fFlags & kInjection; }
205  Bool_t IsDistinct() const { return fFlags & kDistinct; }
209  Bool_t IsSimulated() const { return fFlags & kSimulated; }
213  Bool_t IsSecondary() const { return fFlags & kSecondary; }
217  Bool_t IsPrimary() const { return (IsSimulated() &&
218  !IsSecondary() &&
219  !IsCombinatorics() &&
220  !IsGenerated()); }
224  Bool_t IsGenerated() const { return fFlags & kGenerated; }
228  Bool_t IsNeutral() const { return fFlags & kNeutral; }
229  /* @} */
241  virtual Real_t GetParentPt(Bool_t second=false) const { return 0; }
249  virtual Short_t GetParentPdg(Bool_t second=false) const { return 0; }
250  /* @} */
251  void Print(Option_t* option="") const;
252 protected:
264  UChar_t fFlags;
265 
266  ClassDef(AliAODTracklet,2); // Single tracklet
267 };
268 //____________________________________________________________________
270  : fTheta(999),
271  fPhi(999),
272  fDTheta(999),
273  fDPhi(999),
274  fDelta(-1),
275  fFlags(0)
276 {}
277 //____________________________________________________________________
279  : TObject(other),
280  fTheta(other.fTheta),
281  fPhi(other.fPhi),
282  fDTheta(other.fDTheta),
283  fDPhi(other.fDPhi),
284  fDelta(other.fDelta),
285  fFlags(other.fFlags)
286 {}
287 //____________________________________________________________________
290 {
291  if (&other == this) return *this;
292  fTheta = other.fTheta;
293  fPhi = other.fPhi;
294  fDTheta = other.fDTheta;
295  fDPhi = other.fDPhi;
296  fDelta = other.fDelta;
297  fFlags = other.fFlags;
298  return *this;
299 }
300 //____________________________________________________________________
301 void AliAODTracklet::Print(Option_t* option) const
302 {
303  char flags[8];
304  if (IsMeasured()) flags[0] = 'M'; else flags[0] = '-';
305  if (IsInjection()) flags[1] = 'I'; else flags[1] = '-';
306  if (IsCombinatorics()) flags[2] = 'C'; else flags[2] = '-';
307  if (IsDistinct()) flags[3] = 'D'; else flags[3] = '-';
308  if (IsSecondary()) flags[4] = 'S'; else flags[4] = '-';
309  if (IsPrimary()) flags[5] = 'P'; else flags[5] = '-';
310  if (IsGenerated()) flags[6] = 'G'; else flags[6] = '-';
311  flags[7] = '\0';
312  Printf("Tracklet 0x%02x %s (%6.2f,%6.2f)+/-(%6.2f,%6.2f) [eta=%5.2f]",
313  fFlags,
314  flags,
315  TMath::RadToDeg()*fTheta,
316  TMath::RadToDeg()*fPhi,
317  TMath::RadToDeg()*fDTheta,
318  TMath::RadToDeg()*fDPhi,
319  GetEta());
320 }
321 
322 
323 //====================================================================
330 {
331 public:
341  AliAODMCTracklet(const AliAODMCTracklet& other);
345  virtual ~AliAODMCTracklet() {}
365  virtual Real_t GetParentPt(Bool_t second=false) const
366  {
367  return !second ? fPar1Pt : fPar2Pt;
368  }
376  virtual Short_t GetParentPdg(Bool_t second=false) const
377  {
378  return !second ? fPar1Pdg : fPar2Pdg;
379  }
386  void SetParentPt(Real_t pt, Bool_t second=false)
387  {
388  if (!second) fPar1Pt = pt; else fPar2Pt = pt;
389  }
396  void SetParentPdg(Short_t pdg, Bool_t second=false)
397  {
398  if (!second) fPar1Pdg = pdg; else fPar2Pdg = pdg;
399  }
400  /* @} */
401 protected:
410 
411  ClassDef(AliAODMCTracklet,2); // Single tracklet information (sim)
412 };
413 
414 //____________________________________________________________________
416  : AliAODTracklet(),
417  fPar1Pt(-1),
418  fPar2Pt(-1),
419  fPar1Pdg(0),
420  fPar2Pdg(0)
421 {}
422 //____________________________________________________________________
424  : AliAODTracklet(other),
425  fPar1Pt(other.fPar1Pt),
426  fPar2Pt(other.fPar2Pt),
427  fPar1Pdg(other.fPar1Pdg),
428  fPar2Pdg(other.fPar2Pdg)
429 {
430  SetSimulated();
431 }
432 //____________________________________________________________________
435 {
436  if (&other == this) return *this;
438  fPar1Pt = other.fPar1Pt;
439  fPar2Pt = other.fPar2Pt;
440  fPar1Pdg = other.fPar1Pdg;
441  fPar2Pdg = other.fPar2Pdg;
442  return *this;
443 }
444 
445 #endif
446 //____________________________________________________________________
447 //
448 // EOF
449 //
Int_t pdg
void SetPhi(Real_t x)
Real_t GetEta() const
ClassDef(AliAODTracklet, 2)
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
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)
ClassDef(AliAODMCTracklet, 2)
virtual ~AliAODMCTracklet()
Bool_t IsPrimary() const