HighLAND
Public Member Functions | Protected Member Functions | List of all members
TPCClusterEffSystematics Class Reference

#include <TPCClusterEffSystematics.hxx>

Inheritance diagram for TPCClusterEffSystematics:
EventWeightBase BinnedParams SystematicBase

Public Member Functions

 TPCClusterEffSystematics ()
 
Weight_h ComputeWeight (const ToyExperiment &, const AnaEventC &, const ToyBoxB &)
 
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. More...
 
- 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.
 
- 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)
 
- Public Member Functions inherited from BinnedParams
 BinnedParams (const std::string &folder_name, const std::string &name, TypeEnum type, const std::string &extension="", bool useInterpolation=false)
 Constructor provided the folder name, name and the type.
 
 BinnedParams (const std::string &name, TypeEnum type, const std::string &extension="", bool useInterpolation=false)
 Constructor provided the name and the type, this is to make current psycheSystematics work, may remove it.
 
void AddBin (Float_t min, Float_t max, Float_t meanREAL, Float_t meanMC, Float_t sigmaMCl, Float_t sigmaMCh, Float_t meanDATA, Float_t sigmaDATAl, Float_t sigmaDATAh)
 Add a new bin for a 1D source.
 
void AddBin (Float_t min, Float_t max, Float_t mean, Float_t sigma)
 
void AddBin (Float_t min, Float_t max, Float_t min2, Float_t max2, Float_t meanREAL, Float_t meanMC, Float_t sigmaMCl, Float_t sigmaMCh, Float_t meanDATA, Float_t sigmaDATAl, Float_t sigmaDATAh)
 Add a new bin for a 2D source.
 
void AddBin (Float_t min, Float_t max, Float_t min2, Float_t max2, Float_t mean, Float_t sigma)
 
void AddBin (Float_t min, Float_t max, Float_t min2, Float_t max2, Float_t min3, Float_t max3, Float_t meanREAL, Float_t meanMC, Float_t sigmaMCl, Float_t sigmaMCh, Float_t meanDATA, Float_t sigmaDATAl, Float_t sigmaDATAh)
 Add a new bin for a 3D source.
 
void AddBin (Float_t min, Float_t max, Float_t min2, Float_t max2, Float_t min3, Float_t max3, Float_t mean, Float_t sigma)
 
void AddGraphBin (Float_t min, Float_t max, Float_t meanREAL, Float_t meanMC, Float_t sigmaMCl, Float_t sigmaMCh, Float_t meanDATA, Float_t sigmaDATAl, Float_t sigmaDATAh)
 Add a new bin graph for a 1D source.
 
void AddGraphBin (Float_t min, Float_t max, Float_t mean, Float_t sigma)
 
void AddGraphBin (Float_t min, Float_t max, Float_t min2, Float_t max2, Float_t meanREAL, Float_t meanMC, Float_t sigmaMCl, Float_t sigmaMCh, Float_t meanDATA, Float_t sigmaDATAl, Float_t sigmaDATAh)
 Add a new bin graph for a 2D source.
 
void AddGraphBin (Float_t min, Float_t max, Float_t min2, Float_t max2, Float_t mean, Float_t sigma)
 
void AddGraphBin (Float_t min, Float_t max, Float_t min2, Float_t max2, Float_t min3, Float_t max3, Float_t meanREAL, Float_t meanMC, Float_t sigmaMCl, Float_t sigmaMCh, Float_t meanDATA, Float_t sigmaDATAl, Float_t sigmaDATAh)
 Add a new bin graph for a 3D source.
 
void AddGraphBin (Float_t min, Float_t max, Float_t min2, Float_t max2, Float_t min3, Float_t max3, Float_t mean, Float_t sigma)
 
bool GetGraphBin (Float_t value, BinnedParamsGraphBin *&bin)
 Gets the bin for a 2D source.
 
bool GetGraphBin (Float_t value1, Float_t value2, BinnedParamsGraphBin *&bin)
 Gets the bin for a 3D source.
 
bool GetBin (Float_t value, BinnedParamsBin *&bin)
 Gets the bin for a 1D source.
 
bool GetBin (Float_t value1, Float_t value2, BinnedParamsBin *&bin)
 Gets the bin for a 2D source.
 
bool GetBin (Float_t value1, Float_t value2, Float_t value3, BinnedParamsBin *&bin)
 Gets the bin for a 3D source.
 
bool GetBinIndex (Float_t value, Int_t &index)
 Gets the bin index for a 1D source.
 
bool GetParametersForBin (Int_t index, Float_t &mean, Float_t &sigma)
 Gets the bin values for a source provided the bin index.
 
bool GetParametersForBin (Int_t index, BinnedParamsParams &params)
 
bool GetSigmaValueForBin (Int_t index, Float_t &sigma)
 Get only mean or sigma.
 
bool GetMeanValueForBin (Int_t index, Float_t &mean)
 
bool GetBinValues (Float_t value, Float_t &mean, Float_t &sigma)
 Gets the bin values for a 1D source.
 
bool GetBinValues (Float_t value, Float_t &mean, Float_t &sigma, Int_t &index)
 
bool GetBinSigmaValue (Float_t value, Float_t &sigma)
 Get only sigma.
 
bool GetBinSigmaValue (Float_t value, Float_t &sigma, Int_t &index)
 
bool GetBinMeanValue (Float_t value, Float_t &mean)
 
bool GetBinMeanValue (Float_t value, Float_t &mean, Int_t &index)
 
bool GetBinValues (Float_t value, BinnedParamsParams &params)
 
bool GetBinValues (Float_t value, BinnedParamsParams &params, Int_t &index)
 
bool GetBinValues (Float_t value1, Float_t value2, Float_t &mean, Float_t &sigma)
 Gets the bin values for a 2D source.
 
bool GetBinValues (Float_t value1, Float_t value2, Float_t &mean, Float_t &sigma, Int_t &index)
 
bool GetBinSigmaValue (Float_t value1, Float_t value2, Float_t &sigma)
 Get only sigma.
 
bool GetBinSigmaValue (Float_t value1, Float_t value2, Float_t &sigma, Int_t &index)
 
bool GetBinMeanValue (Float_t value1, Float_t value2, Float_t &mean)
 
bool GetBinMeanValue (Float_t value1, Float_t value2, Float_t &mean, Int_t &index)
 
bool GetBinValues (Float_t value1, Float_t value2, BinnedParamsParams &params)
 
bool GetBinValues (Float_t value1, Float_t value2, BinnedParamsParams &params, Int_t &index)
 
bool GetBinValues (Float_t value1, Float_t value2, Float_t value3, Float_t &mean, Float_t &sigma)
 Gets the bin values for a 3D source.
 
bool GetBinValues (Float_t value1, Float_t value2, Float_t value3, Float_t &mean, Float_t &sigma, Int_t &index)
 
bool GetBinSigmaValue (Float_t value1, Float_t value2, Float_t value3, Float_t &sigma)
 Get only sigma.
 
bool GetBinSigmaValue (Float_t value1, Float_t value2, Float_t value3, Float_t &sigma, Int_t &index)
 
bool GetBinMeanValue (Float_t value1, Float_t value2, Float_t value3, Float_t &mean)
 
bool GetBinMeanValue (Float_t value1, Float_t value2, Float_t value3, Float_t &mean, Int_t &index)
 
bool GetBinValues (Float_t value1, Float_t value2, Float_t value3, BinnedParamsParams &params)
 
bool GetBinValues (Float_t value1, Float_t value2, Float_t value3, BinnedParamsParams &params, Int_t &index)
 
bool GetInterBinValues (Float_t value1, BinnedParamsParams &params)
 Get values using interpolation.
 
bool GetInterBinValues (Float_t value1, Float_t value2, BinnedParamsParams &params)
 Gets the bin values for a 2D source.
 
bool GetInterBinValues (Float_t value1, Float_t value2, Float_t value3, BinnedParamsParams &params)
 Gets the bin values for a 3D source.
 
void SetType (TypeEnum type)
 Set the type.
 
void SetName (const std::string &name)
 Set the name.
 
void SetInterpolationUsage (bool use)
 Set the name.
 
const std::string & GetDataName ()
 Get the name of the source.
 
TypeEnum GetDataType ()
 Returns the type of the data.
 
bool GetInterpolationStatus ()
 Returns the type of the data.
 
void Print ()
 Dump into the screen the systematic source values.
 
void Read (const std::string &inputDirName, const std::string &extension="")
 Read from a file the systematic source values.
 
Int_t GetNBins ()
 Get the number of bins.
 
bool UpdateEfficiencyCounter (Int_t index, bool correct)
 Update the efficiency variables _ncorrect and _nwrong.
 
void InitializeEfficiencyCounter ()
 Initialize counters.
 
Int_t GetNCorrectAssoc (Int_t index)
 
Int_t GetNWrongAssoc (Int_t index)
 

Protected Member Functions

Int_t GetRelevantRecObjectGroups (const SelectionBase &sel, Int_t ibranch, Int_t *IDs) const
 Get the TrackGroup IDs array for this systematic.
 
- Protected Member Functions inherited from EventWeightBase
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.
 

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.
 
- Public Types inherited from BinnedParams
enum  TypeEnum {
  k1D_SYMMETRIC = 0, k2D_SYMMETRIC, k3D_SYMMETRIC, k1D_SYMMETRIC_NOMEAN,
  k2D_SYMMETRIC_NOMEAN, k3D_SYMMETRIC_NOMEAN, k1D_EFF_SYMMETRIC, k2D_EFF_SYMMETRIC,
  k3D_EFF_SYMMETRIC, k1D_EFF_ASSYMMETRIC, k2D_EFF_ASSYMMETRIC, k3D_EFF_ASSYMMETRIC,
  k1D_DATA, k2D_DATA, k3D_DATA, kUnknown
}
 Enumerator describing the values that _type member can take.
 
enum  TypeShortEnum { k1D = 0, k2D, k3D, kUnknownShort }
 
- 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]
 

Detailed Description

This systematic affects the number of reconstructed nodes in an AnaTpcSegment. The extra inefficiency for each virtual analysis is chosen from a Gaussian, with mean and sigma specified by the user.

The correction for each AnaTpcSegment is then chosen from a uniform distribution between 0 and the inefficiency for this virtual analysis.

Definition at line 13 of file TPCClusterEffSystematics.hxx.

Constructor & Destructor Documentation

§ TPCClusterEffSystematics()

TPCClusterEffSystematics::TPCClusterEffSystematics ( )

Instantiate the TPC track quality systematic. nana is the number of virtual analyses to run.

Definition at line 8 of file TPCClusterEffSystematics.cxx.

8  :BinnedParams("TPCClusterEff",k1D_EFF_SYMMETRIC, versionUtils::Extension()){
9 //********************************************************************
10 
11  // Get the TPC cluster extra inefficiency
12  //GetParametersForBin(0, _extraIneff, _extraIneffError);
13  //GetParametersForBin(0, _params);
15 }
void SetNParameters(int N)
Set the number of systematic parameters associated to this systematic.
Int_t GetNBins()
Get the number of bins.

Member Function Documentation

§ ComputeWeight() [1/2]

Weight_h TPCClusterEffSystematics::ComputeWeight ( const ToyExperiment ,
const AnaEventC ,
const ToyBoxB  
)
inlinevirtual

Apply the systematic to each AnaTpcSegment, varying the number of reconstructed nodes. See TPCClusterEffSystematics class documentation for details.

Implements EventWeightBase.

Definition at line 25 of file TPCClusterEffSystematics.hxx.

25 {return 1;}

§ ComputeWeight() [2/2]

Weight_h TPCClusterEffSystematics::ComputeWeight ( const ToyExperiment toy,
const AnaEventC event,
const ToyBoxB box,
const SelectionBase sel 
)
virtual

This is now the actual method called by SystematicManager, which allows further selection tunning of relevant objects once the ToyBox is filled.

extra hit inefficiency for MC: 0.0007 = effdata-effMC/effMC => effdata/effmc=1-0.0007

Reimplemented from EventWeightBase.

Definition at line 18 of file TPCClusterEffSystematics.cxx.

18  {
19 //********************************************************************
20 
21  // Get the SystBox for this event, and the appropriate selection and branch
23 
24 
25  Weight_h eventWeight = 1.0;
26 
27  // loop over reconstructed tracks in the TPC
28  for (Int_t irec=0;irec<(int) SystBox->nRelevantRecObjects;irec++){
29  AnaTrackB* track = static_cast<AnaTrackB*>(SystBox->RelevantRecObjects[irec]);
30 
31  if (!track) continue;
32 
33  // For example in numuCC inclusive selection, only the Candidate is important at first order
34  if (!sel.IsRelevantRecObjectForSystematicInToy(event, box, track, SystId::kTpcClusterEff, box.SuccessfulBranch)) continue;
35 
36  //SubDetId::SubDetEnum tpc=anaUtils::GetClosestTPC(*track);
37  //AnaTPCParticleB *tpcTrack=static_cast<AnaTPCParticleB*> (anaUtils::GetSegmentInDet(*track,tpc));
38 
39  // AnaTPCParticleB* tpcTrack = static_cast<AnaTPCParticleB*>(track->TPCSegments[0]);
40 
41  // Use the TPC segment with more nodes in closest TPC to the start position of the track
43  if (!tpcTrack)continue;
44  float dir=fabs(tpcTrack->DirectionStart[2]);
45 
46  BinnedParamsParams params;
47  int index;
48  if(!GetBinValues(dir, params, index)) continue;
49 
50  int nn= tpcTrack->NNodes;
51 
52  // pvar_data/pvar_mc *pana
53  //eff_w = ----------------------
54  // pana
55 
56  // 1- pvar_data/pvar_mc *pana
57  //ineff_w =---------------------------
58  // 1 - pana
59 
60  //meanDATA <=> effdata/effmc
61  //meanMC <=> 1
62  //meanMCANA <=> 1
63  //sigmaMC <=> 0
64  //sigmaDATA <=> ratio error
65 
66  /// extra hit inefficiency for MC: 0.0007 = effdata-effMC/effMC
67  /// => effdata/effmc=1-0.0007
68 
69  // weight = effvarWeight ^nn *( (nn+1) * Pineffvar + 1) / ( (nn+1) * Pineff +1)
70 
71 #if useNewWeights
72  Weight_h eff_w= systUtils::ComputeEffLikeWeight(true, toy.GetToyVariations(_index)->Variations[0], params);//new way with data-mc error included
73 #else
74  Weight_h eff_w= systUtils::ComputeEffLikeWeight(true, toy.GetToyVariations(_index)->Variations[0], toy.GetToyVariations(_index)->Variations[1], params);
75 #endif
76  Float_t Pnom=params.meanMCANA;
77  Weight_h Pineff=(eff_w*(-1))+1; //this is true, only if assume that effMC=1
78 
79  Weight_h weight(TMath::Power(eff_w.Correction,(Float_t)nn)*((nn+1)*(Pineff.Correction)+1. )/ ((nn+1)*(1-Pnom)+1. ),
80  TMath::Power(eff_w.Systematic,(Float_t)nn)*((nn+1)*(Pineff.Systematic)+1. )/ ((nn+1)*(1-Pnom)+1. ));
81  eventWeight*=weight;
82  }
83 
84 
85  return eventWeight;
86 
87 }
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
Int_t SelectionEnabledIndex
The enabled index of this selection this ToyBox belongs to.
Definition: ToyBoxB.hxx:49
Int_t NNodes
The number of nodes in the reconstructed object.
SystBoxB * GetSystBox(const AnaEventC &event, Int_t isel=0, Int_t ibranch=0) const
Get the SystBox corresponding to a selection, branch and event.
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) ...
Int_t SuccessfulBranch
The branch that is successful for this toy in the selection this ToyBox belongs to.
Definition: ToyBoxB.hxx:46
Representation of a global track.
Representation of a TPC segment of a global track.
ToyVariations * GetToyVariations(UInt_t index) const
returns the variations for a given systematic (index)
Float_t DirectionStart[3]
The reconstructed start direction of the particle.
Float_t meanMCANA
The mean value for each of the systematic parameters of the analysis sample.
Int_t nRelevantRecObjects
----—— Relevant rec objects and true objects for each systematic ------------—— ...
Definition: SystBoxB.hxx:20
AnaParticleB * GetSegmentWithMostNodesInClosestTpc(const AnaTrackB &track)
Combined function to address NuMu selection needs as efficiently as possible - gets the TPC segment w...

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