1 #include "ECalEMEnergyResolSystematics.hxx" 2 #include "ND280AnalysisUtils.hxx" 3 #include "HEPConstants.hxx" 4 #include "Parameters.hxx" 12 SystBoxECalEMResol::SystBoxECalEMResol(){
15 RelevantCrossings = NULL;
19 SystBoxECalEMResol::~SystBoxECalEMResol(){
22 if (RelevantCrossings)
23 delete [] RelevantCrossings;
24 RelevantCrossings = NULL;
29 ECalEMEnergyResolSystematics::~ECalEMEnergyResolSystematics() {
32 delete _RandomGenerator;
38 if (!_RandomGenerator){
39 _RandomGenerator =
new TRandom3();
40 SetRandomSeed(ND::params().GetParameterI(
"psycheSystematics.ECalEMResol.RandomSeed"));
48 return _RandomGenerator->GetSeed();
56 _RandomGenerator->SetSeed(seed);
66 uniqueID =
event.UniqueID;
73 if(!_systBoxes[0][0][uniqueID])
77 FillSystBox(event, sel, *_systBoxes[0][0][uniqueID]);
87 uniqueID =
event.UniqueID;
98 if (box.RelevantRecObjects)
delete [] box.RelevantRecObjects;
99 if (box.RelevantCrossings)
delete [] box.RelevantCrossings;
100 anaUtils::CreateArray(box.RelevantRecObjects, ntracks);
101 anaUtils::CreateArray(box.RelevantCrossings, ntracks);
119 if (!cross_tmp)
continue;
120 if (((cross_tmp->
Detector & (1<<SubDetId::kTECAL)) || (cross_tmp->
Detector & (1<<SubDetId::kDSECAL))) &&
144 std::cout <<
"ECalEMEnergyResolSystematics::ApplyVariation(): " << box->
nRelevantRecObjects << std::endl;
152 if (!track)
continue;
163 AnaDetCrossingB* cross =
static_cast<SystBoxECalEM*
>(box)->RelevantCrossings[itrk];
164 if (!cross)
continue;
167 std::cout << itrk << std::endl;
169 std::cout<<
"\n"<<std::endl;
176 Float_t p0_true_entrance = anaUtils::ArrayToTVector3(cross->
EntranceMomentum).Mag();
186 mass = particle->Mass()*units::GeV;
188 Float_t em0_true = sqrt(p0_true_entrance*p0_true_entrance + mass*mass) - mass;
192 std::cout <<
"track true mom entrance in ECal -- " << anaUtils::ArrayToTVector3(cross->
EntranceMomentum).Mag() << std::endl;
193 std::cout <<
"track true mom exit in ECal -- " << anaUtils::ArrayToTVector3(cross->
ExitMomentum).Mag() << std::endl;
194 std::cout <<
"track true mass -- " << mass << std::endl;
195 std::cout <<
"track true eloss in ECal -- " << em0_true << std::endl;
204 std::cout <<
"ecal track EM Energy -- " << em0 << std::endl;
211 if (!GetBinSigmaValue(em0, sigma, index))
continue;
214 std::cout <<
" bin values: sigma " << sigma <<
" index " << index << std::endl;
230 std::cout <<
"candidate EM Energy after tweak = "<< emv << std::endl;
bool InActive
If the particle passes through an active part of the subdetector.
Float_t * Variations
the vector of Variations, one for each of the systematic parameters
int nDetCrossings
The number of DetCrossing objects.
AnaECALParticleB * ECALSegments[NMAXECALS]
The ECAL segments that contributed to this global track.
Representation of an ECAL segment of a global track.
virtual void Print() const
Dump the object to screen.
UInt_t GetRandomSeed() const
The only thing we allow for the generator is to get the seed.
AnaTrueObjectC * TrueObject
The link to the true oject that most likely generated this reconstructed object.
virtual void InitializeEvent(const AnaEventC &event, const SelectionBase &sel)
Initialize the SystBox for this event.
void InitializeRandomGenerator()
Initialze random generator.
Representation of a true Monte Carlo trajectory/particle.
void SetRandomSeed(UInt_t seed)
And change the seed.
AnaDetCrossingB ** DetCrossings
Representation of a detector crossing info for a true particle (G4 trajectory).
Int_t PDG
The PDG code of this particle.
std::set< AnaRecObjectC * > RelevantRecObjectsSet
Representation of a global track.
Float_t ExitMomentum[3]
for each subdetector tell the exit momentum
ToyVariations * GetToyVariations(UInt_t index) const
returns the variations for a given systematic (index)
void InitializeEvent(const AnaEventC &event, const SelectionBase &sel)
Initialize the SystBox for this event.
Int_t nRelevantRecObjects
----—— Relevant rec objects and true objects for each systematic ------------—— ...
AnaTrueParticleB * GetTrueParticle() const
Return a casted version of the AnaTrueObject associated.
void Print() const
Dump the object to screen.
virtual void Apply(const ToyExperiment &toy, AnaEventC &event)
Apply the systematic.
Float_t EntranceMomentum[3]
for each subdetector tell the entrance momentum