PandaRoot
PndSmpCand.h
Go to the documentation of this file.
1 
12 #ifndef PndSmpCand_H
13 #define PndSmpCand_H
14 
15 #include "TLorentzVector.h"
16 #include <iostream>
17 
18 using std::cout;
19 using std::endl;
20 
21 // -------------------------------------------------------------------------
22 
23 class PndSmpCand {
24  public:
25  // Constructors
28 
30  PndSmpCand(TLorentzVector lv, Float_t chrg, Int_t pdg = 0, Int_t uid = -1);
31 
33  PndSmpCand(TLorentzVector *lv, Float_t chrg, Int_t pdg = 0, Int_t uid = -1);
34 
36  PndSmpCand(Int_t pdg, PndSmpCand &c0, PndSmpCand &c1) { CombCand(pdg, &c0, &c1); }
38  PndSmpCand(Int_t pdg, PndSmpCand &c0, PndSmpCand &c1, PndSmpCand &c2) { CombCand(pdg, &c0, &c1, &c2); }
40  PndSmpCand(Int_t pdg, PndSmpCand &c0, PndSmpCand &c1, PndSmpCand &c2, PndSmpCand &c3) { CombCand(pdg, &c0, &c1, &c2, &c3); }
42  PndSmpCand(Int_t pdg, PndSmpCand &c0, PndSmpCand &c1, PndSmpCand &c2, PndSmpCand &c3, PndSmpCand &c4) { CombCand(pdg, &c0, &c1, &c2, &c3, &c4); }
43 
45  PndSmpCand(Int_t pdg, PndSmpCand *c0, PndSmpCand *c1, PndSmpCand *c2 = nullptr, PndSmpCand *c3 = nullptr, PndSmpCand *c4 = nullptr) { CombCand(pdg, c0, c1, c2, c3, c4); }
46 
47  // Modifiers
49  void SetP4(TLorentzVector p4) { fLV = p4; }
51  void SetM(Double_t m) { fLV.SetVectM(fLV.Vect(), m); }
53  void SetCharge(Float_t ch) { fCharge = ch; }
54 
55  // Methods
57  Bool_t operator==(const PndSmpCand &c1) const { return (c1.fMarker == fMarker) && (c1.fPdgCode == fPdgCode); }
59  Bool_t operator!=(const PndSmpCand &c1) const { return !(*this == c1); }
60 
62  void CombCand(Int_t pdg, PndSmpCand *c0, PndSmpCand *c1, PndSmpCand *c2 = nullptr, PndSmpCand *c3 = nullptr, PndSmpCand *c4 = nullptr);
63 
64  TLorentzVector P4() { return fLV; }
65  Float_t Charge() { return fCharge; }
66  Int_t Pdg() { return fPdgCode; }
67  Int_t NDau() { return fNDau; }
68  ULong_t Marker() { return fMarker; }
69  PndSmpCand *Dau(Int_t idx)
70  {
71  if (idx >= 0 && idx < fNDau)
72  return fDaughter[idx];
73  else
74  return nullptr;
75  }
76  Bool_t Overlap(PndSmpCand *c) { return fMarker & c->fMarker; }
77  Bool_t Overlap(PndSmpCand &c) { return fMarker & c.fMarker; }
78  void Print();
79 
80  private:
81  // Private methods
83  void PrintBinary(ULong_t x)
84  {
85  ULong_t bit = ULong_t(1) << 63;
86  while (bit) {
87  cout << ((x & bit) ? 1 : 0);
88  bit >>= 1;
89  if (bit & 0x8080808080808080)
90  cout << " ";
91  }
92  }
93 
94  // Member variables
95  TLorentzVector fLV; // the Lorentz vector
96  Float_t fCharge; // charge
97  Int_t fPdgCode; // pdg code
98  Int_t fUniqueID; // unique id, only applied for initial (non-composite) candidates
99  ULong_t fMarker; // a bit marker used for overlap check; limits number of initial candidate to 64 (long = 64 bits)
100  Int_t fNDau; // number of daughters of composites (up to 5)
101  PndSmpCand *fDaughter[5]; // pointers to daughters
102 };
103 
104 // -------------------------------------------------------------------------
105 
106 #endif
void SetM(Double_t m)
Sets mass (used for different mass hypotheses in filter.
Definition: PndSmpCand.h:51
Bool_t operator==(const PndSmpCand &c1) const
Overload of == operator needed to compare std::vectors of candidates.
Definition: PndSmpCand.h:57
Float_t Charge()
Definition: PndSmpCand.h:65
__m128 m
Definition: P4_F32vec4.h:26
void SetCharge(Float_t ch)
Sets charge.
Definition: PndSmpCand.h:53
Int_t Pdg()
Definition: PndSmpCand.h:66
PndSmpCand(Int_t pdg, PndSmpCand *c0, PndSmpCand *c1, PndSmpCand *c2=nullptr, PndSmpCand *c3=nullptr, PndSmpCand *c4=nullptr)
Constructor from up to 5 daughter pointers. Calls CombCand.
Definition: PndSmpCand.h:45
PndSmpCand(Int_t pdg, PndSmpCand &c0, PndSmpCand &c1)
Constructor from 2 daughters. Calls CombCand.
Definition: PndSmpCand.h:36
TLorentzVector P4()
Definition: PndSmpCand.h:64
PndSmpCand()
Default constructor.
Definition: PndSmpCand.h:27
Bool_t Overlap(PndSmpCand &c)
Definition: PndSmpCand.h:77
void SetP4(TLorentzVector p4)
Sets LorentzVector.
Definition: PndSmpCand.h:49
void Print()
void CombCand(Int_t pdg, PndSmpCand *c0, PndSmpCand *c1, PndSmpCand *c2=nullptr, PndSmpCand *c3=nullptr, PndSmpCand *c4=nullptr)
Combines this candidate from several daughters (adds P4 and charges).
Bool_t Overlap(PndSmpCand *c)
Definition: PndSmpCand.h:76
ULong_t Marker()
Definition: PndSmpCand.h:68
PndSmpCand(Int_t pdg, PndSmpCand &c0, PndSmpCand &c1, PndSmpCand &c2, PndSmpCand &c3)
Constructor from 4 daughters. Calls CombCand.
Definition: PndSmpCand.h:40
PndSmpCand(Int_t pdg, PndSmpCand &c0, PndSmpCand &c1, PndSmpCand &c2)
Constructor from 3 daughters. Calls CombCand.
Definition: PndSmpCand.h:38
PndSmpCand * Dau(Int_t idx)
Definition: PndSmpCand.h:69
Bool_t operator!=(const PndSmpCand &c1) const
Overload of == operator needed to compare std::vectors of candidates.
Definition: PndSmpCand.h:59
PndSmpCand(Int_t pdg, PndSmpCand &c0, PndSmpCand &c1, PndSmpCand &c2, PndSmpCand &c3, PndSmpCand &c4)
Constructor from 5 daughters. Calls CombCand.
Definition: PndSmpCand.h:42
Int_t NDau()
Definition: PndSmpCand.h:67
Simple particle candidate to perform simple combinatorics and particle counting for event filtering...
Definition: PndSmpCand.h:23