StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StV0TofCorrection.cxx
Go to the documentation of this file.
1 // $Id: StV0TofCorrection.cxx,v 1.3 2017/10/20 17:50:33 smirnovd Exp $
8 // ---
9 // $Log: StV0TofCorrection.cxx,v $
10 // Revision 1.3 2017/10/20 17:50:33 smirnovd
11 // Squashed commit of the following:
12 //
13 // StBTof: Remove outdated ClassImp macro
14 //
15 // Prefer explicit namespace for std:: names in header files
16 //
17 // Removed unnecessary specification of default std::allocator
18 //
19 // Frank signed-off
20 //
21 // Revision 1.2 2014/01/20 16:55:50 geurts
22 // Major update by Patrick Huck:
23 // - fixed memory leaks, clean-up
24 // - switch from a custom closest-points-of-approach-finder to the StHelix::pathLengths()
25 // - added a public helper function calcM2() to calculate mass^2 after TOF correction
26 //
27 // Revision 1.1 2011/01/24 21:01:49 geurts
28 // *** empty log message ***
29 //
30 // ---
31 #include "StV0TofCorrection.h"
32 #include "TError.h"
33 
34 
35 M2CutType StV0TofCorrection::mM2CutMap = StV0TofCorrection::createM2CutMap();
36 
38 : clight(29.9792458), cleared(kTRUE), cleared2(kTRUE),
39  NrDecays(0), Vectors3D(NULL), tracks(NULL) { }
41 
43 inline Float_t StV0TofCorrection::calcTof(
44  const StLorentzVectorD& trackAB, const Float_t& PathAB
45  ) {
46  StThreeVectorD mom = trackAB.vect();
47  Float_t BetaAB = mom.mag() / trackAB.e() * clight;
48  return PathAB / BetaAB;
49 }
50 
52 inline Bool_t StV0TofCorrection::inputOk() {
53  if ( Vectors3D == NULL ) {
54  Error("StV0TofCorrection::correctBeta","setVectors3D() call missing!");
55  return kFALSE;
56  }
57  if ( tracks == NULL ) {
58  Error("StV0TofCorrection::correctBeta", "setMotherTracks() call missing!");
59  return kFALSE;
60  }
61  if ( Vectors3D->getNrArgs()-2 != tracks->getNrArgs() ) {
62  Error(
63  "StV0TofCorrection::correctBeta",
64  "number of 3d-vectors not consistent to number of tracks!"
65  );
66  return kFALSE;
67  }
68  return kTRUE;
69 }
70 
72 inline Bool_t StV0TofCorrection::cutOnMass2(
73  const Float_t& Mass2, const std::string& particle
74  ) {
75  return (
76  Mass2 > mM2CutMap[particle].first &&
77  Mass2 < mM2CutMap[particle].second
78  );
79 }
80 
83  const StPhysicalHelixD& helixA, const Float_t& TofA, Float_t& BetaCorr,
84  const Float_t& mom, const std::string& particle
85  ) {
86  if ( inputOk() ) {
87  NrDecays = Vectors3D->getNrArgs()-2;
88  Float_t TofCorr = TofA;
89  for ( Int_t i = 0; i < NrDecays; i++ ) {
90  // assume straight tracks for all mother particles
91  Float_t PathAB = ( (*Vectors3D)[i+1] - (*Vectors3D)[i] ).mag();
92  TofCorr -= calcTof((*tracks)[i], PathAB); // TOF CORRECTION
93  }
94  // calculate pathlength on helixA from vectorAB to vectorTof
95  Float_t PathCorr = helixA.pathLength( (*Vectors3D)[NrDecays+1] );
96  PathCorr -= helixA.pathLength( (*Vectors3D)[NrDecays] );
97  BetaCorr = PathCorr / (TofCorr*clight);
98  if ( !particle.empty() ) { // cut on new particle mass
99  Float_t m2corr = calcM2(mom, BetaCorr);
100  return cutOnMass2(m2corr, particle);
101  }
102  return kTRUE;
103  }
104  Error("StV0TofCorrection::correctBeta", "check Input! BetaCorr set to -998!");
105  BetaCorr = -998.;
106  return kFALSE;
107 }
108 
Definition: FJcore.h:367
Float_t calcM2(const Float_t &mom, const Float_t &beta)
helper function to calculate m2 from momentum &amp; beta
header file of StV0TofCorrection class created by Patrick Huck (phuck@lbl.gov) [12/13/2010] ...
pair< double, double > pathLength(double r) const
path length at given r (cylindrical r)
Definition: StHelix.cc:351
virtual ~StV0TofCorrection()
destructor
static M2CutType mM2CutMap
default m2 cuts
StV0TofCorrection()
constructor
Bool_t correctBeta(const StPhysicalHelixD &, const Float_t &, Float_t &, const Float_t &MomentumA=-999., const std::string &particle="")
main function for beta correction