HighLAND
MomentumResolVariation.hxx
1 #ifndef MomentumResolVariation_h
2 #define MomentumResolVariation_h
3 
4 #include "BinnedParams.hxx"
5 
6 /// The code provides the functionality to smear the momentum of tracks with TPC information
7 /// Is a base one to the corresponding corrections and systematics
8 
9 class ToyExperiment;
10 
12 public:
13 
14  // Enum to distinguish if one wants to deal with the correction or systematics
15  enum ModeEnum{
16  kCorr,
17  kSyst
18  };
19 
21  _params = NULL;
22  }
23 
24  virtual ~MomentumResolVariation() {
25  if (_params) delete _params;
26  _params = NULL;
27  }
28 
29  /// 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
30  /// pt_inv_var = (1 + var)(pt_inv_rec - pt_inv_true) + pt_inv_true
31  /// the variation is calculated on the fly
32  virtual void ApplyVariation(AnaTrackB* track, const ToyExperiment& exp);
33 
34  /// Variation based on pure TPC (then propagated to global)
35  /// the closest TPC will be used, will do the alternate momentum in the same manner
36  virtual void ApplyVariationTPCBased(AnaTrackB* track, const ToyExperiment& exp);
37 
38 
39  /// Smear TPC track based on the corresponding true track
40  virtual void ApplyVariationTPC(AnaTPCParticleB* track, const ToyExperiment& exp);
41 
42  /// Abstract class to get the variation given a track
43  virtual bool GetVariation(AnaTrackB* track, Float_t& variation, const ToyExperiment& exp) = 0;
44 
45  /// Abstract class to get the variation given a TPC object
46  virtual bool GetVariationTPC(AnaTPCParticleB* track, Float_t& variation, const ToyExperiment& exp) {
47  (void)track;
48  (void)variation;
49  (void)exp;
50  return 0; // TMP
51  };
52 
53  /// Get TPC segment that satisfies DQ and is closest
54  static AnaParticleB* GetClosestTPCSegmentWithGoodDQ(const AnaTrackB& track, const Float_t* pos);
55 
56 protected:
57 
58  /// Get parameters for this global track assumed one uses X bins
59  bool GetXBinnedValues(AnaTrackB* track, Float_t& value1, Float_t& value2, Int_t& index1, Int_t& index2, ModeEnum mode);
60 
61  /// Get parameters for this tpc track assumed one uses X bins
62  bool GetXBinnedValues(AnaTPCParticleB* tpcTrack, Float_t& value1, Float_t& value2, Int_t& index1, Int_t& index2, ModeEnum mode);
63 
64  bool GetXBinnedValues(Float_t xmin, Float_t xmax, Float_t& value1, Float_t& value2, Int_t& index1, Int_t& index2, ModeEnum mode);
65 
66  /// Binned data to read the parameters
68 
69 };
70 
71 #endif
virtual void ApplyVariation(AnaTrackB *track, const ToyExperiment &exp)
virtual bool GetVariationTPC(AnaTPCParticleB *track, Float_t &variation, const ToyExperiment &exp)
Abstract class to get the variation given a TPC object.
static AnaParticleB * GetClosestTPCSegmentWithGoodDQ(const AnaTrackB &track, const Float_t *pos)
Get TPC segment that satisfies DQ and is closest.
virtual void ApplyVariationTPCBased(AnaTrackB *track, const ToyExperiment &exp)
Representation of a global track.
virtual void ApplyVariationTPC(AnaTPCParticleB *track, const ToyExperiment &exp)
Smear TPC track based on the corresponding true track.
Representation of a TPC segment of a global track.
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.
virtual bool GetVariation(AnaTrackB *track, Float_t &variation, const ToyExperiment &exp)=0
Abstract class to get the variation given a track.
Representation of a reconstructed particle (track or shower).
BinnedParams * _params
Binned data to read the parameters.