HighLAND
P0DVetoSystematics.cxx
1 #include "P0DVetoSystematics.hxx"
2 #include "ND280AnalysisUtils.hxx"
3 
4 //********************************************************************
5 P0DVetoSystematics::P0DVetoSystematics():EventWeightBase(1){
6 //********************************************************************
7 
8  char dirname[256];
9  sprintf(dirname,"%s/data",getenv("PSYCHESYSTEMATICSROOT"));
10 
11  _p0d = new BinnedParams();
12  _p0d->SetType(BinnedParams::k1D_SYMMETRIC);
13  _p0d->SetName("P0DVeto");
14  _p0d->Read(dirname);
15 
16 
17  SetNParameters(_p0d->GetNBins());
18 }
19 
20 
21 //********************************************************************
23 //********************************************************************
24 
25  Weight_h eventWeight= 1;
26 
27  const AnaEventB& event = *static_cast<const AnaEventB*>(&eventBB);
28 
29  if( box.DetectorFV != SubDetId::kP0D) return eventWeight;
30 
31  // Get the run period (from 0 to 8)
32  Int_t runPeriod = anaUtils::GetRunPeriod(event.EventInfo.Run);
33 
34  // MainTrack should be in FV. This condition is already in box.DetectorFV
35  // if (!anaUtils::InFiducialVolume(box.DetectorFV, box.MainTrack->PositionStart)) return eventWeight;
36 
37  // Get the pileup values for this run period
38  Float_t veto_corr;
39  Float_t veto_corr_error;
40  Int_t index;
41 
42  if(!_p0d->GetBinValues(runPeriod, veto_corr, veto_corr_error, index)) return eventWeight;
43 
44  // compute the weight
45  eventWeight.Systematic = 1 - veto_corr - veto_corr_error * toy.GetToyVariations(_index)->Variations[index];
46  eventWeight.Correction = 1 - veto_corr;
47 
48  return eventWeight;
49 }
50 
Int_t _index
The index of this systematic (needed by SystematicsManager);.
Float_t * Variations
the vector of Variations, one for each of the systematic parameters
SubDetId_h DetectorFV
Indicate the FV we are interested in.
Definition: ToyBoxB.hxx:52
void SetNParameters(int N)
Set the number of systematic parameters associated to this systematic.
int GetRunPeriod(int run, int subrun=-1)
Returns the run period (sequentially: 0,1,2,3,4,5 ...)
ToyVariations * GetToyVariations(UInt_t index) const
returns the variations for a given systematic (index)
Weight_h ComputeWeight(const ToyExperiment &toy, const AnaEventC &event, const ToyBoxB &box)