HighLAND
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
P0dTrackerOOFVSystematics Class Reference
Inheritance diagram for P0dTrackerOOFVSystematics:
EventWeightBase SystematicBase

Public Member Functions

Weight_h ComputeWeight (const ToyExperiment &toy, const AnaEventC &event, const ToyBoxB &box)
 
- Public Member Functions inherited from EventWeightBase
 EventWeightBase ()
 Create the systematic, with one parameter.
 
 EventWeightBase (UInt_t npar)
 Create the systematic, specifying the number of systematic parameters.
 
virtual ~EventWeightBase ()
 Everyone should have a destructor.
 
virtual void InitializeEvent (const AnaEventC &event, const SelectionBase &sel, Int_t ibranch)
 Initialize the SystBox for this event.
 
virtual Weight_h ComputeWeight (const ToyExperiment &toy, const AnaEventC &event, const ToyBoxB &box, const SelectionBase &sel)
 This is now the actual method called by SystematicManager, which allows further selection tunning of relevant objects once the ToyBox is filled.
 
- Public Member Functions inherited from SystematicBase
 SystematicBase ()
 Create the systematic, with one parameter.
 
 SystematicBase (UInt_t npar)
 Create the systematic, specifying the number of systematic parameters.
 
virtual ~SystematicBase ()
 Everyone should have a destructor.
 
UInt_t GetNParameters () const
 Returns the number of systematic parameters associated to this systematic.
 
void SetNParameters (int N)
 Set the number of systematic parameters associated to this systematic.
 
virtual const char * GetName () const
 Return the name of this systematic. This overrides the TObject::GetName() interface.
 
const std::string & Name () const
 Return the name of this systematic.
 
void SetName (const std::string &name)
 Set the name of this systematic.
 
Int_t GetIndex () const
 Return the index of this systematic.
 
void SetIndex (Int_t index)
 Set the index of this systematic.
 
TypeEnum Type () const
 Return the type of this systematic.
 
std::string ConvertType ()
 Return the type of this systematic.
 
void SetType (TypeEnum type)
 Set the type of this systematic.
 
PDFEnum PDF () const
 Return the PDF of this systematic.
 
std::string ConvertPDF ()
 Return the PDF of this systematic.
 
void SetPDF (PDFEnum PDF)
 Set the PDF of this systematic.
 
void SetEnabled (bool ena)
 Set the enable bit.
 
bool IsEnabled () const
 Returns the enable bit.
 
virtual void FinalizeEvent (const AnaEventC &event)
 Delete the SystBox for this event.
 
SystBoxBGetSystBox (const AnaEventC &event, Int_t isel=0, Int_t ibranch=0) const
 Get the SystBox corresponding to a selection, branch and event.
 
virtual void Initialize (Int_t nsel, Int_t isel, Int_t nbranch, Int_t nevents)
 Create the array of SystBox.
 
 ClassDef (SystematicBase, 2)
 

Protected Member Functions

Int_t GetDetNumber (SubDetId::SubDetEnum det)
 
Int_t GetBeamNumber (Int_t runperiod, AnaTrackB *maintrack)
 
- Protected Member Functions inherited from EventWeightBase
virtual Int_t GetRelevantRecObjectGroups (const SelectionBase &, Int_t ibranch, Int_t *IDs) const
 Get the IDs of the RecObject groups that are relevant for this systematic in a given selection.
 
virtual Int_t GetRelevantTrueObjectGroups (const SelectionBase &, Int_t ibranch, Int_t *IDs) const
 Get the IDs of the TrueObject groups that are relevant for this systematic in a given selection.
 
virtual bool IsRelevantRecObject (const AnaEventC &, const AnaRecObjectC &) const
 Check whether a AnaRecObject is relevant for this systematic or not.
 
virtual bool IsRelevantTrueObject (const AnaEventC &, const AnaTrueObjectC &) const
 Check whether a AnaTrueObject is relevant for this systematic or not.
 
virtual void FillSystBox (const AnaEventC &event, const SelectionBase &sel, Int_t ibranch)
 Fills the SystBox.
 
virtual bool CheckTrueRecoAssociation (const AnaTrueObjectC &trueRecObject, const AnaRecObjectC &track) const
 Criteria for true-reco association for this systematic.
 
void FillTrueRecoAssociation (SystBoxB &box)
 Fll the true-reco association array.
 

Protected Attributes

Float_t _rate_corr
 Mean of the rate correction.
 
Float_t _rate_error
 Uncertainty on the rate correction.
 
Float_t _reco_corr [9]
 Mean of the reco eff correction.
 
Float_t _reco_error [9]
 Uncertainty on the reco eff correction.
 
Int_t _rate_index
 
Int_t _reco_index [9]
 
BinnedParams_p0d
 
BinnedParams_rate
 
- Protected Attributes inherited from SystematicBase
std::string _name
 The name of this systematic.
 
Int_t _index
 The index of this systematic (needed by SystematicsManager);.
 
TypeEnum _type
 The type of this systematic (variation, weight or flux)
 
bool _enabled
 Is this systematic enabled ?
 
PDFEnum _PDF
 The PDF use for the systematic parameter scan.
 
UInt_t _nParameters
 the number of systematic parameters
 
SystBoxB **** _systBoxes
 ----—— Relevant objects for this systematic ------------—— More...
 
Int_t _systBoxesNSel
 
Int_t _systBoxesNBranches [NMAXSELECTIONS]
 
Int_t _systBoxesNEvents [NMAXSELECTIONS][NMAXBRANCHES]
 

Additional Inherited Members

- Public Types inherited from SystematicBase
enum  TypeEnum { kVariation = 0, kWeight, kFlux, kUnknown }
 Enumerator describing the values that _type member can take.
 
enum  PDFEnum {
  kGaussian = 0, kUniform, kBinomial, kMultinomial,
  kUnknownPDF
}
 Enumerator describing the values that _PDF member can take.
 

Detailed Description

Definition at line 18 of file P0dTrackerOOFVSystematics.hxx.

Member Function Documentation

§ ComputeWeight()

Weight_h P0dTrackerOOFVSystematics::ComputeWeight ( const ToyExperiment toy,
const AnaEventC event,
const ToyBoxB box 
)
virtual

This is now the actual method called by SystematicManager, which allows further selection tunning of relevant objects once the ToyBox is filled This MUST be overridden in the derived class.

Implements EventWeightBase.

Definition at line 80 of file P0dTrackerOOFVSystematics.cxx.

80  {
81 //********************************************************************
82 
83  const AnaEventB& event = *static_cast<const AnaEventB*>(&eventC);
84 
85  // Cast the ToyBox to the appropriate type
86  const ToyBoxTracker& box = *static_cast<const ToyBoxTracker*>(&boxB);
87 
88  Weight_h eventWeight=1;
89  if (!box.MainTrack) return eventWeight; // HMN track should exist
90  if (!box.MainTrack->GetTrueParticle()) return eventWeight; // True track associated to HMN track should exist
91  if (!box.MainTrack->GetTrueParticle()->TrueVertex) return eventWeight; // True vertex associated to HMN track should exist
92 
93  // Get the true vertex position
94  Float_t* tvertex = box.MainTrack->GetTrueParticle()->TrueVertex->Position;
95 
96  // if the true vertex is inside the P0D FV this is not OOFV (RETURN EVENTWEIGHT=1)
97  if(anaUtils::InFiducialVolume(static_cast<SubDetId::SubDetEnum>(box.DetectorFV), tvertex)) return eventWeight;
98 
99  // Get the true track direction and position
100  //Float_t* tdir = box.MainTrack->GetTrueParticle()->Direction;
101  //Float_t* pos = box.MainTrack->GetTrueParticle()->Position;
102 
103  Float_t* p0d_det_min = DetDef::p0dmin;
104  Float_t* p0d_det_max = DetDef::p0dmax;
105 
106 
107  double Zmin_p0d_fv,Zmax_p0d_fv;
108  p0d_det_min = DetDef::p0dmin;
109  p0d_det_max = DetDef::p0dmax;
110  Zmin_p0d_fv = p0d_fv_minz;
111  Zmax_p0d_fv = p0d_fv_maxz;
112 
113  const SubDetId::SubDetEnum detector = static_cast<const SubDetId::SubDetEnum>(anaUtils::GetDetector(tvertex));
114 
115  Int_t categ =-1;
116  //In P0D CEcal.
117  if (SubDetId::IsP0DDetector(detector) && tvertex[2] > Zmax_p0d_fv)
118  categ = 0;
119  //In P0D US ECal
120  else if (SubDetId::IsP0DDetector(detector) && tvertex[2] < Zmin_p0d_fv)
121  categ = 1;
122  //In P0D WT
123  else if (SubDetId::IsP0DDetector(detector))
124  categ = 2;
125  else if (SubDetId::IsFGDDetector(detector))
126  categ = 3;
127  else if (SubDetId::IsECALDetector(detector))
128  categ = 4;
129  else if (SubDetId::IsPECALDetector(detector))
130  categ = 4;
131  else if (SubDetId::IsTECALDetector(detector))
132  categ = 4;
133  else if (SubDetId::IsSMRDDetector(detector))
134  categ = 5;
135  else if (SubDetId::IsTPCDetector(detector))
136  categ = 6;
137 
138  if(categ>=0 ){
140  Int_t runPeriod = anaUtils::GetRunPeriod(event.EventInfo.Run);
141 
142  if (!_rate->GetBinValues(GetBeamNumber(runPeriod,box.MainTrack), GetDetNumber(detector), _rate_corr, _rate_error,_rate_index)) _rate_index=-1;
143 
144  if (_reco_index[categ]>=0){
145  eventWeight.Systematic *= (1+ _reco_corr[categ] + _reco_error[categ]*toy.GetToyVariations(_index)->Variations[_reco_index[categ]]);
146  eventWeight.Correction *= (1+ _reco_corr[categ]);
147  }
148  if (_rate_index>=0){
149  eventWeight.Systematic *= (1+ _rate_corr + _rate_error*toy.GetToyVariations(_index)->Variations[_rate_index]);
150  eventWeight.Correction *= (1+ _rate_corr);
151  }
152 
153  }
154 
155 
156  if (eventWeight.Systematic < 0) eventWeight.Systematic = 0;
157 
158  return eventWeight;
159 }
Int_t _index
The index of this systematic (needed by SystematicsManager);.
AnaTrueVertexB * TrueVertex
Pointer to the AnaTrueVertexB of the interaction that created this AnaTrueParticleB.
Float_t * Variations
the vector of Variations, one for each of the systematic parameters
static bool IsFGDDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a FGD or not.
Definition: SubDetId.cxx:126
static bool IsP0DDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a SMRDP0D or not.
Definition: SubDetId.cxx:146
SubDetId_h DetectorFV
Indicate the FV we are interested in.
Definition: ToyBoxB.hxx:52
AnaTrackB * MainTrack
For storing the Main Track (The lepton candidate in geranal: HMN or HMP track)
SubDetId::SubDetEnum GetDetector(const Float_t *pos)
Return the detector in which the position is.
static bool IsPECALDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a P0D ECAL or not.
Definition: SubDetId.cxx:138
Float_t _rate_corr
Mean of the rate correction.
bool GetBinValues(Float_t value, Float_t &mean, Float_t &sigma)
Gets the bin values for a 1D source.
Float_t _reco_corr[9]
Mean of the reco eff correction.
Float_t Position[4]
The position the true interaction happened at.
static bool IsTPCDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a TPC or not.
Definition: SubDetId.cxx:122
int GetRunPeriod(int run, int subrun=-1)
Returns the run period (sequentially: 0,1,2,3,4,5 ...)
static bool IsECALDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a ECAL or not.
Definition: SubDetId.cxx:130
SubDetEnum
Enumeration of all detector systems and subdetectors.
Definition: SubDetId.hxx:25
static bool IsTECALDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a Tracker ECAL or not.
Definition: SubDetId.cxx:134
ToyVariations * GetToyVariations(UInt_t index) const
returns the variations for a given systematic (index)
Float_t _rate_error
Uncertainty on the rate correction.
Float_t _reco_error[9]
Uncertainty on the reco eff correction.
AnaTrueParticleB * GetTrueParticle() const
Return a casted version of the AnaTrueObject associated.
bool InFiducialVolume(SubDetId::SubDetEnum det, const Float_t *pos, const Float_t *FVdefmin, const Float_t *FVdefmax)
static bool IsSMRDDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a SMRD or not.
Definition: SubDetId.cxx:142

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