StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StPicoUtilities.h
1 
8 #ifndef StPicoUtilities_h
9 #define StPicoUtilities_h
10 
11 // C++ headers
12 #include <array>
13 #include <string>
14 #include <cmath>
15 
16 // MuDst headers
17 #include "StMuDSTMaker/COMMON/StMuTrack.h"
18 #include "StMuDSTMaker/COMMON/StMuDst.h"
19 
20 //_________________
21 namespace StPicoUtilities {
22 
23  enum Charge_t { Neg=0, Pos=1 };
24  enum TpcHalf_t { East=0, West=2 };
25  enum Mult_t { refMult2=0, refMult3=4, refMult4=8, refMultHalf=12 };
26 
27  enum RefMult_t {
28  RefMult2NegEast = refMult2|Neg|East,
29  RefMult2NegWest = refMult2|Neg|West,
30  RefMult2PosEast = refMult2|Pos|East,
31  RefMult2PosWest = refMult2|Pos|West,
32  RefMult3NegEast = refMult3|Neg|East,
33  RefMult3NegWest = refMult3|Neg|West,
34  RefMult3PosEast = refMult3|Pos|East,
35  RefMult3PosWest = refMult3|Pos|West,
36  RefMult4NegEast = refMult4|Neg|East,
37  RefMult4NegWest = refMult4|Neg|West,
38  RefMult4PosEast = refMult4|Pos|East,
39  RefMult4PosWest = refMult4|Pos|West,
40  RefMultHalfNegEast = refMultHalf|Neg|East,
41  RefMultHalfNegWest = refMultHalf|Neg|West,
42  RefMultHalfPosEast = refMultHalf|Pos|East,
43  RefMultHalfPosWest = refMultHalf|Pos|West
44  };
45 
46  std::array<int, 16> calculateRefMult(const StMuDst& muDst) {
47 
48  std::array<int, 16> custom_refMult = {};
49 
50  // Loop over all primary tracks
51  for (Int_t iTrk = 0; iTrk < muDst.primaryTracks()->GetEntries(); ++iTrk) {
52 
53  // Retrieve track
54  StMuTrack* track = muDst.primaryTracks(iTrk);
55 
56  // Track must exist
57  if (!track) continue;
58 
59  // These first 3 checks are used for all refMult
60  if( track->flag() < 0 ||
61  fabs(track->momentum().mag()) < 1.e-10 ||
62  track->dca().mag() > 3. ||
63  fabs(track->momentum().pseudoRapidity()) > 1. ) continue;
64 
65  double const eta = track->momentum().pseudoRapidity() ;
66  Charge_t chargeName = (track->charge() > 0) ? Pos : Neg;
67  TpcHalf_t tpcHalfName = (eta > 0) ? West : East;
68 
69  double const beta = track->btofPidTraits().beta();
70  double const massSqr = (beta <= 1.e-5) ? -999. : track->momentum().mag2() * (std::pow(1. / beta, 2) - 1.);
71 
72  // Define refMultHalf, refMult2 and refMult3
73  if (track->nHitsFit(kTpcId) >= 10) {
74 
75  // refMultHalf definition: pt> 0.1 && abs(dca) < 3 && nHitsTpc >= 10 && abs(eta) < 1
76  custom_refMult[refMultHalf | chargeName | tpcHalfName] += 1;
77 
78  // refMult2 definition: pt> 0.1 && abs(dca) < 3 && nHitsTpc >= 10 && abs(eta) > 0.5 && abs(eta) < 1
79  if (fabs(eta) > 0.5) {
80  custom_refMult[refMult2 | chargeName | tpcHalfName] += 1;
81  }
82 
83  // refMult3 definition: pt> 0.1 && abs(dca) < 3 && nHitsTpc >= 10 && abs(eta) < 1 && Exclude protons
84  if (track->nSigmaProton() < -3. && massSqr < 0.4) {
85  custom_refMult[refMult3 | chargeName | tpcHalfName] += 1;
86  }
87  } //if (track->nHitsFit(kTpcId) >= 10)
88 
89  // Define refMult4
90  if (track->nHitsFit(kTpcId) >= 15) {
91 
92  // refMult4 definition: pt> 0.1 && abs(dca) < 3 && nHitsTpc >= 15 && abs(eta) < 1 && Exclude kaons
93  if( (massSqr <= -990. && fabs(track->nSigmaKaon()) > 3) || // tof is not available
94  (massSqr > -990. && (massSqr > 0.6 || massSqr < 0.1)) ) { // tof is available
95  custom_refMult[refMult4 | chargeName | tpcHalfName] += 1;
96  }
97  } // if (track->nHitsFit(kTpcId) >= 15)
98  } //for (Int_t iTrk = 0; iTrk < muDst.primaryTracks()->GetEntries(); ++iTrk)
99 
100  return custom_refMult;
101 
102  } //std::array<int, 16> calculateRefMult(const StMuDst& muDst)
103 }
104 
105 #endif // #define StPicoUtilities_h
UShort_t nHitsFit() const
Return total number of hits used in fit.
Definition: StMuTrack.h:239
short flag() const
Returns flag, (see StEvent manual for type information)
Definition: StMuTrack.h:230
Short_t charge() const
Returns charge.
Definition: StMuTrack.h:255
static TObjArray * primaryTracks()
returns pointer to a list of tracks belonging to the selected primary vertex
Definition: StMuDst.h:301
const StThreeVectorF & momentum() const
Returns 3-momentum at dca to primary vertex.
Definition: StMuTrack.h:260
StThreeVectorF dca(Int_t vtx_id=-1) const
Returns 3D distance of closest approach to primary vertex.
Definition: StMuTrack.cxx:359
Double_t nSigmaProton() const
Returns Craig&#39;s distance to the calculated dE/dx band for protons in units of sigma.
Definition: StMuTrack.h:247
Double_t nSigmaKaon() const
Returns Craig&#39;s distance to the calculated dE/dx band for kaons in units of sigma.
Definition: StMuTrack.h:246