1 #include "OOFVSystematics.hxx" 2 #include "ND280AnalysisUtils.hxx" 3 #include "ToyBoxTracker.hxx" 4 #include "BasicUtils.hxx" 5 #include "SubDetId.hxx" 6 #include "FiducialVolumeDefinition.hxx" 7 #include "VersioningUtils.hxx" 15 if (!versionUtils::prod6_systematics){
16 _fgd1 =
new BinnedParams(
"OOFVFGD1",BinnedParams::k2D_SYMMETRIC,versionUtils::Extension());
18 _fgd2 =
new BinnedParams(
"OOFVFGD2",BinnedParams::k2D_SYMMETRIC,versionUtils::Extension());
23 _fgd1 =
new BinnedParams(
"OOFV_reco_fgd1",BinnedParams::k1D_SYMMETRIC,versionUtils::Extension());
25 _fgd2 =
new BinnedParams(
"OOFV_reco_fgd2",BinnedParams::k1D_SYMMETRIC,versionUtils::Extension());
27 _rate =
new BinnedParams(
"OOFV_rate",BinnedParams::k2D_SYMMETRIC,versionUtils::Extension());
28 npars+=_rate->GetNBins();
32 if (!versionUtils::prod6_systematics){
33 for (
int i=0;i<9;i++){
34 if (!_fgd1->
GetBinValues(i, 0, _rate_corr[0][i], _rate_error[0][i],_rate_index[0][i])) _reco_index[0][i]=-1;
35 if (!_fgd1->
GetBinValues(i, 1, _reco_corr[0][i], _reco_error[0][i],_reco_index[0][i])) _rate_index[0][i]=-1;
36 if (!_fgd2->
GetBinValues(i, 0, _rate_corr[1][i], _rate_error[1][i],_rate_index[1][i])) _reco_index[1][i]=-1;
37 if (!_fgd2->
GetBinValues(i, 1, _reco_corr[1][i], _reco_error[1][i],_reco_index[1][i])) _rate_index[1][i]=-1;
41 for (
int i=0;i<9;i++){
42 if (!_fgd1->
GetBinValues(i, _reco_corr[0][i], _reco_error[0][i],_reco_index[0][i])) _reco_index[0][i]=-1;
43 if (!_fgd2->
GetBinValues(i, _reco_corr[1][i], _reco_error[1][i],_reco_index[1][i])) _reco_index[1][i]=-1;
45 if (_reco_index[0][i]>=0) _reco_index[0][i] += _rate->GetNBins();
46 if (_reco_index[1][i]>=0) _reco_index[1][i] += _rate->GetNBins();
53 Int_t OOFVSystematics::GetBeamNumber(Int_t runperiod,
AnaTrackB *maintrack){
111 Float_t* fgd_det_min;
112 Float_t* fgd_det_max;
113 double Zmin_lastmodule,zup,zdown;
118 fgd_det_min = DetDef::fgd1min;
119 fgd_det_max = DetDef::fgd1max;
120 Zmin_lastmodule = fgd_det_max[2]-DetDef::fgdXYModuleWidth;
126 fgd_det_min = DetDef::fgd2min;
127 fgd_det_max = DetDef::fgd2max;
128 Zmin_lastmodule = 1780;
132 else return eventWeight;
134 lastmodule = ( pos[2] >Zmin_lastmodule && pos[2] < fgd_det_max[2] );
143 if ((tvertex[2] > fgd_det_min[2] && tvertex[2] < fgd_det_max[2]) &&
144 (tvertex[0] > fgd_det_min[0] && tvertex[0] < fgd_det_max[0]) &&
145 (tvertex[1] > fgd_det_min[1] && tvertex[1] < fgd_det_max[1]))
148 else if ((tvertex[2] > zup && tvertex[2] < fgd_det_min[2]) &&
149 (tvertex[0] > -1335 && tvertex[0] < 1335) &&
150 (tvertex[1] > -1280.5 && tvertex[1] < 1280.5))
153 else if((tvertex[2] > fgd_det_max[2] && tvertex[2] < zdown) &&
154 (tvertex[0] > -1335 && tvertex[0] < 1335) &&
155 (tvertex[1] > -1280.5 && tvertex[1] < 1280.5))
162 else if(tdir[2]<=-0.5)
165 else if(tdir[2]>-0.5 && tdir[2]<0.5)
168 else if(fabs(tdir[0]/tdir[2])<0.07 || fabs(tdir[1]/tdir[2])<0.07)
178 if ((tvertex[2] > fgd_det_min[2] && tvertex[2] < fgd_det_max[2]) &&
179 (tvertex[0] > fgd_det_min[0] && tvertex[0] < fgd_det_max[0]) &&
180 (tvertex[1] > fgd_det_min[1] && tvertex[1] < fgd_det_max[1]))
183 else if((tvertex[2] > fgd_det_max[2] && tvertex[2] < zdown) &&
184 (tvertex[0] > -1335 && tvertex[0] < 1335) &&
185 (tvertex[1] > -1280.5 && tvertex[1] < 1280.5))
188 else if ((tvertex[2] > zup && tvertex[2] < fgd_det_min[2]) &&
189 (tvertex[0] > -1335 && tvertex[0] < 1335) &&
190 (tvertex[1] > -1280.5 && tvertex[1] < 1280.5))
197 else if(tdir[2]>=0.5)
200 else if(tdir[2]>-0.5 && tdir[2]<0.5)
203 else if(fabs(tdir[0]/tdir[2])<0.07 || fabs(tdir[1]/tdir[2])<0.07)
215 if (!versionUtils::prod6_systematics){
219 eventWeight.Correction *= (1+ _reco_corr[fgd][categ]);
220 eventWeight.Correction *= (1+ _rate_corr[fgd][categ]);
227 if (!_rate->GetBinValues(GetBeamNumber(runPeriod,box.
MainTrack), GetDetNumber(detector), _rate_corr[0][0], _rate_error[0][0],_rate_index[0][0])) _rate_index[0][0]=-1;
229 if (_reco_index[fgd][categ]>=0){
231 eventWeight.Correction *= (1+ _reco_corr[fgd][categ]);
233 if (_rate_index[0][0]>=0){
235 eventWeight.Correction *= (1+ _rate_corr[0][0]);
242 if (eventWeight.Systematic < 0) eventWeight.Systematic = 0;
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 PositionStart[4]
The reconstructed start position of the particle.
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.
static bool IsP0DDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a SMRDP0D or not.
SubDetId_h DetectorFV
Indicate the FV we are interested in.
Int_t GParentPDG
The PDG code of this particle's grandparent, or 0 if there is no grandparent.
AnaTrackB * MainTrack
For storing the Main Track (The lepton candidate in geranal: HMN or HMP track)
void SetNParameters(int N)
Set the number of systematic parameters associated to this systematic.
AnaTrueObjectC * TrueObject
The link to the true oject that most likely generated this reconstructed object.
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.
Float_t Charge
The reconstructed charge of the particle.
bool GetBinValues(Float_t value, Float_t &mean, Float_t &sigma)
Gets the bin values for a 1D source.
virtual bool IsRelevantRecObjectForSystematicInToy(const AnaEventC &, const ToyBoxB &, AnaRecObjectC *, SystId_h syst_index, Int_t branch=0) const
Is this track relevant for a given systematic (after selection, called for each toy) ...
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.
int GetRunPeriod(int run, int subrun=-1)
Returns the run period (sequentially: 0,1,2,3,4,5 ...)
Int_t SuccessfulBranch
The branch that is successful for this toy in the selection this ToyBox belongs to.
static bool IsECALDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a ECAL or not.
SubDetEnum
Enumeration of all detector systems and subdetectors.
Int_t ParentPDG
The PDG code of this particle's immediate parent, or 0 if there is no parent.
Representation of a global track.
static bool IsTECALDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a Tracker ECAL or not.
ToyVariations * GetToyVariations(UInt_t index) const
returns the variations for a given systematic (index)
bool InDetVolume(SubDetId::SubDetEnum det, const Float_t *pos)
Weight_h ComputeWeight(const ToyExperiment &toy, const AnaEventC &event, const ToyBoxB &box)
Float_t Position[4]
The initial position of the true particle.
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)
Float_t Direction[3]
The initial direction of the true particle.
Int_t GetNBins()
Get the number of bins.
static bool IsSMRDDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a SMRD or not.