HighLAND
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MomentumResolVariation Class Referenceabstract
Inheritance diagram for MomentumResolVariation:
MomentumResolSystematics MomResolMCCorrection

Public Types

enum  ModeEnum { kCorr, kSyst }
 

Public Member Functions

virtual void ApplyVariation (AnaTrackB *track, const ToyExperiment &exp)
 
virtual void ApplyVariationTPCBased (AnaTrackB *track, const ToyExperiment &exp)
 
virtual void ApplyVariationTPC (AnaTPCParticleB *track, const ToyExperiment &exp)
 Smear TPC track based on the corresponding true track.
 
virtual bool GetVariation (AnaTrackB *track, Float_t &variation, const ToyExperiment &exp)=0
 Abstract class to get the variation given a track.
 
virtual bool GetVariationTPC (AnaTPCParticleB *track, Float_t &variation, const ToyExperiment &exp)
 Abstract class to get the variation given a TPC object.
 

Static Public Member Functions

static AnaParticleBGetClosestTPCSegmentWithGoodDQ (const AnaTrackB &track, const Float_t *pos)
 Get TPC segment that satisfies DQ and is closest.
 

Protected Member Functions

bool GetXBinnedValues (AnaTrackB *track, Float_t &value1, Float_t &value2, Int_t &index1, Int_t &index2, ModeEnum mode)
 Get parameters for this global track assumed one uses X bins.
 
bool GetXBinnedValues (AnaTPCParticleB *tpcTrack, Float_t &value1, Float_t &value2, Int_t &index1, Int_t &index2, ModeEnum mode)
 Get parameters for this tpc track assumed one uses X bins.
 
bool GetXBinnedValues (Float_t xmin, Float_t xmax, Float_t &value1, Float_t &value2, Int_t &index1, Int_t &index2, ModeEnum mode)
 

Protected Attributes

BinnedParams_params
 Binned data to read the parameters.
 

Detailed Description

Definition at line 11 of file MomentumResolVariation.hxx.

Member Function Documentation

§ ApplyVariation()

void MomentumResolVariation::ApplyVariation ( AnaTrackB track,
const ToyExperiment exp 
)
virtual

Apply the variation to the track, the variation is assumed to be an additional factor one adds to the true-rec difference of pt_inv pt_inv_var = (1 + var)(pt_inv_rec - pt_inv_true) + pt_inv_true the variation is calculated on the fly

Definition at line 12 of file MomentumResolVariation.cxx.

12  {
13  //********************************************************************
14 
15  if (!track) return;
16 
17  // Initial momenum to be varied
18  Float_t p = track->Momentum;
19 
20  // Get the true momentum
21  if (!track->TrueObject) return;
22 
23  // Then the change cannot be undone
24  if(!track->Original) return;
25 
26 
27 #ifdef DEBUG
28  std::cout << " MomentumResolVariation::ApplyVariation() - start " << std::endl;
29 #endif
30 
31  Float_t variation;
32 
33  if (!GetVariation(track, variation, exp)) return; // for prod6 only depends on coordinates
34 
35  Float_t p0_true = track->GetTrueParticle()->Momentum;
36 
37 #ifdef DEBUG
38  std::cout << " MomentumResolVariation::ApplyVariation() p0, p0_true = " << p << " " << p0_true << std::endl;
39 #endif
40 
41  // Get the inverse transverse momentum
42  Float_t pt0_inv = anaUtils::ComputeInversePT(*track);
43 
44  Float_t pt0_inv_flip = anaUtils::ComputeInversePTFlip(*track);
45 
46  if (pt0_inv < 0) return;
47 
48  // Get the true inverse transverse momentum
49  Float_t pt0_inv_true = anaUtils::ComputeInversePT(*(track->GetTrueParticle()));
50 
51 #ifdef DEBUG
52  std::cout << " MomentumResolVariation::ApplyVariation() 1/pt0, 1/pt0_true = " << pt0_inv << " " << pt0_inv_true << std::endl;
53  std::cout << " MomentumResolVariation::ApplyVariation() 1/pt0_flip = " << pt0_inv_flip << std::endl;
54  std::cout << " MomentumResolVariation::ApplyVariation() var = " << variation << std::endl;
55 #endif
56 
57  // Apply momentum resolution smearing
58  Float_t pt_inv = (1 + variation) * (pt0_inv - pt0_inv_true) + pt0_inv_true;
59 
60  // Same for the flip, since we assume this will be used as a correct one when ToF applied...
61  Float_t pt_inv_flip = (1 + variation) * (pt0_inv_flip - pt0_inv_true) + pt0_inv_true;
62 
63  // Convert back to the full momentum
64  p = fabs(anaUtils::ComputeMomentumFromInversePT( *(track), pt_inv));
65 
66  if (p < 0) return;
67 
68 
69  // Set the new momentum
70  track->Momentum = p;
71 
72  Float_t p_flip = fabs(anaUtils::ComputeMomentumFromInversePTFlip( *(track), pt_inv_flip));
73  if (p_flip > 0)
74  track->MomentumFlip = p_flip;
75 
76 
77  // Apply the smearing to the TPC constituents
78  if (track->nTPCSegments == 0) return;
79 
80 
81  Float_t p0 = track->GetOriginalTrack()->Momentum;
82 
83  // Translate the smearing on the error of the local momentum and its error
84  Float_t smearingFact = (p - p0_true)/(p0 - p0_true);
85  Float_t smearingFactMom = p / p0;
86 
87  for(int iseg = 0; iseg < track->nTPCSegments; iseg++){
88  AnaTPCParticleB* tpcTrackOrig = static_cast<const AnaTrackB*>(track->Original)->TPCSegments[iseg];
89  AnaTPCParticleB* tpcTrack = track->TPCSegments[iseg];
90  Float_t tpcmomerr = tpcTrackOrig->MomentumError;
91  Float_t tpcmom = tpcTrackOrig->Momentum;
92 
93  tpcTrack->MomentumError = tpcmomerr * smearingFact;
94  tpcTrack->Momentum = tpcmom * smearingFactMom;
95  }
96 
97 #ifdef DEBUG
98  std::cout << " MomentumResolVariation::ApplyVariation() p0 new = " << track->Momentum << std::endl;
99  std::cout << " MomentumResolVariation::ApplyVariation() p0flip new = " << track->MomentumFlip << std::endl;
100 #endif
101 
102 }
const AnaTrackB * GetOriginalTrack() const
Return a casted version of the original AnaParticleB associated.
AnaTPCParticleB * TPCSegments[NMAXTPCS]
The TPC segments that contributed to this global track.
Float_t ComputeMomentumFromInversePT(const AnaParticleB &part, Float_t PTinv)
compute the total momentum given the part and the inverse transverse momentum
AnaTrueObjectC * TrueObject
The link to the true oject that most likely generated this reconstructed object.
Float_t Momentum
The initial momentum of the true particle.
Float_t MomentumError
Error of the momentum at the start of the segment.
Float_t MomentumFlip
Momentum for the main PID hypothesis and reverse sense.
Float_t Momentum
The reconstructed momentum of the particle, at the start position.
int nTPCSegments
How many TPC tracks are associated with this track.
Float_t ComputeInversePT(const AnaDetCrossingB &cross, bool entrance=true)
Compute inverse PT given an AnaDetCrossing.
const AnaParticleB * Original
Float_t ComputeMomentumFromInversePTFlip(const AnaParticleB &part, Float_t PTinv)
Compute the total momentum (flip) given the part and the inverse transverse momentum.
Representation of a global track.
Representation of a TPC segment of a global track.
virtual bool GetVariation(AnaTrackB *track, Float_t &variation, const ToyExperiment &exp)=0
Abstract class to get the variation given a track.
AnaTrueParticleB * GetTrueParticle() const
Return a casted version of the AnaTrueObject associated.

§ ApplyVariationTPCBased()

void MomentumResolVariation::ApplyVariationTPCBased ( AnaTrackB track,
const ToyExperiment exp 
)
virtual

Variation based on pure TPC (then propagated to global) the closest TPC will be used, will do the alternate momentum in the same manner

Definition at line 106 of file MomentumResolVariation.cxx.

106  {
107  //********************************************************************
108 
109 #ifdef DEBUG
110  std::cout << " MomentumResolVariation::ApplyVariationTPCBased() - start " << std::endl;
111 #endif
112 
113  if (!track) return;
114 
115  // Get the true momentum
116  if (!track->TrueObject) return;
117 
118  // Then the change cannot be undone
119  if(!track->Original) return;
120 
121 #ifdef DEBUG
122  Float_t p0_true = track->GetTrueParticle()->Momentum;
123  std::cout << " MomentumResolVariation::ApplyVariationTPCBased() p0, p0_true = " << track->Momentum << " " << p0_true << std::endl;
124  std::cout << " MomentumResolVariation::ApplyVariationTPCBased() p0flip, p0_true = " << track->MomentumFlip << " " << p0_true << std::endl;
125 #endif
126 
127  // Do nothing if there are no TPC constituents
128  if (track->nTPCSegments == 0) return;
129 
130  // Smear each constituent separately
131  for (int iseg = 0; iseg < track->nTPCSegments; iseg++){
132  if (!track->TPCSegments[iseg]) continue;
133 
134  // Smear the TPC momentum
135  ApplyVariationTPC(track->TPCSegments[iseg], exp);
136  }
137 
138  // Using the TPC closest to the starting point smear the global momentum
139  AnaParticleMomB* tpcStart = static_cast<AnaParticleMomB*>(
141 
142  if (tpcStart)
143  // Retrieve the original momentum and apply the differnece to the one of the global track
144  if (tpcStart->Original)
145  track->Momentum += tpcStart->Momentum - static_cast<const AnaParticleMomB*>(tpcStart->Original)->Momentum ;
146 
147 
148  // Using the TPC closest to the end point smear the flip momentum
149  AnaParticleMomB* tpcEnd = static_cast<AnaParticleMomB*>(
151  if (tpcEnd)
152  // Retrieve the original momentum and apply the differnece to the one of the global track
153  if (tpcEnd->Original)
154  track->MomentumFlip += tpcEnd->Momentum - static_cast<const AnaParticleMomB*>(tpcEnd->Original)->Momentum ;
155 
156 #ifdef DEBUG
157  std::cout << " MomentumResolVariation::ApplyVariationTPCBased() p0 new = " << track->Momentum << std::endl;
158  std::cout << " MomentumResolVariation::ApplyVariationTPCBased() p0flip new = " << track->MomentumFlip << std::endl;
159 #endif
160 
161 }
Float_t PositionStart[4]
The reconstructed start position of the particle.
/// Extension to AnaParticleB containing momentum and charge info
AnaTPCParticleB * TPCSegments[NMAXTPCS]
The TPC segments that contributed to this global track.
AnaTrueObjectC * TrueObject
The link to the true oject that most likely generated this reconstructed object.
Float_t Momentum
The initial momentum of the true particle.
static AnaParticleB * GetClosestTPCSegmentWithGoodDQ(const AnaTrackB &track, const Float_t *pos)
Get TPC segment that satisfies DQ and is closest.
Float_t MomentumFlip
Momentum for the main PID hypothesis and reverse sense.
Float_t Momentum
The reconstructed momentum of the particle, at the start position.
int nTPCSegments
How many TPC tracks are associated with this track.
const AnaParticleB * Original
virtual void ApplyVariationTPC(AnaTPCParticleB *track, const ToyExperiment &exp)
Smear TPC track based on the corresponding true track.
AnaTrueParticleB * GetTrueParticle() const
Return a casted version of the AnaTrueObject associated.
Float_t PositionEnd[4]
The reconstructed end position of the particle.

The documentation for this class was generated from the following files: