HighLAND
ECalEMEnergyScaleSystematics.cxx
1 #include "ECalEMEnergyScaleSystematics.hxx"
2 
3 //#define DEBUG
4 
5 
6 //********************************************************************
8 //********************************************************************
9 
10  // Get the SystBox for this event
11  SystBoxB* box = GetSystBox(event);
12 
13 #ifdef DEBUG
14  std::cout << "ECalEMEnergyScaleSystematics::ApplyVariation(): " << box->nRelevantRecObjects << std::endl;
15 #endif
16 
17  // Loop over the relevant tracks for this systematic
18  for (Int_t itrk=0;itrk<box->nRelevantRecObjects;itrk++){
19  AnaTrackB* track = static_cast<AnaTrackB*>(box->RelevantRecObjects[itrk]);
20 
21  if(!track) continue;
22 
23  // Get ECal segment
24  AnaECALParticleB* ecalTrack = track->ECALSegments[0];
25 
26  if(!ecalTrack) continue;
27 
28 #ifdef DEBUG
29  std::cout << itrk << " EM Energy before the tweak --> em_0 = " << ecalTrack->EMEnergy << std::endl;
30 #endif
31 
32  Float_t scaleError;
33  Int_t index;
34 
35  // Get the systematic source values
36  if (!GetBinSigmaValue(ecalTrack->EMEnergy, scaleError, index)) continue;
37 
38 #ifdef DEBUG
39  std::cout << " bin values: scaleError " << scaleError << " index " << index << std::endl;
40 #endif
41 
42  // Apply the momentum scale factor
43  ecalTrack->EMEnergy *=(1 + scaleError*toy.GetToyVariations(_index)->Variations[index]);
44 
45 #ifdef DEBUG
46  std::cout << "EMEnergy after the tweak em = " << ecalTrack->EMEnergy << std::endl;
47 #endif
48  }
49 }
50 
51 
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
AnaECALParticleB * ECALSegments[NMAXECALS]
The ECAL segments that contributed to this global track.
Representation of an ECAL segment of a global track.
SystBoxB * GetSystBox(const AnaEventC &event, Int_t isel=0, Int_t ibranch=0) const
Get the SystBox corresponding to a selection, branch and event.
void Apply(const ToyExperiment &toy, AnaEventC &event)
Apply the systematic.
Representation of a global track.
ToyVariations * GetToyVariations(UInt_t index) const
returns the variations for a given systematic (index)
Int_t nRelevantRecObjects
----—— Relevant rec objects and true objects for each systematic ------------—— ...
Definition: SystBoxB.hxx:20
bool GetBinSigmaValue(Float_t value, Float_t &sigma)
Get only sigma.