AliPhysics  4a7363b (4a7363b)
AliEmcalCorrectionClusterEnergyVariation.cxx
Go to the documentation of this file.
1 // AliEmcalCorrectionClusterEnergyVariation
2 //
3 
5 
6 #include "AliClusterContainer.h"
7 
11 
12 // Actually registers the class with the base class
14 
19  AliEmcalCorrectionComponent("AliEmcalCorrectionClusterEnergyVariation"),
20  fEnergyScaleShift(0.),
21  fSmearingWidth(0.),
22  fRandom(0)
23 {
24 }
25 
30 {
31 }
32 
37 {
38  // Initialization
40 
41  GetProperty("energyScaleShift", fEnergyScaleShift);
42  GetProperty("smearingWidth", fSmearingWidth);
43 
44  return kTRUE;
45 }
46 
51 {
53 }
54 
59 {
60  fRandom.SetSeed(0);
61 }
62 
67 {
69 
70  // Loop over all clusters
71  AliTLorentzVector clusFourVec;
72  AliVCluster *cluster = 0;
73  AliClusterContainer * clusCont = 0;
74  TIter nextClusCont(&fClusterCollArray);
75  while ((clusCont = static_cast<AliClusterContainer*>(nextClusCont()))) {
76  auto clusItCont = clusCont->all_momentum();
77  for (AliClusterIterableMomentumContainer::iterator clusIterator = clusItCont.begin(); clusIterator != clusItCont.end(); ++clusIterator) {
78 
79  // Get the cluster energy (using the default energy type set in the cluster container)
80  clusFourVec.Clear();
81  clusFourVec = clusIterator->first;
82  Double_t energyclus = clusFourVec.E();
83 
84  // Scale energy (if applicable)
85  if (TMath::Abs(fEnergyScaleShift) > 1e-6) {
86  energyclus *= (1 + fEnergyScaleShift);
87  }
88 
89  // Smear energy (if applicable)
90  if (fSmearingWidth > 1e-6) {
91  energyclus *= (1 + fRandom.Gaus(0, fSmearingWidth) );
92  }
93 
94  // Set the shifted/smeared energy to the user-defined energy field
95  cluster = static_cast<AliVCluster *>(clusIterator->second);
96  if (cluster->IsEMCAL() && energyclus > 0) {
97  cluster->SetUserDefEnergy(AliVCluster::kUserDefEnergy1, energyclus);
98  }
99 
100  }
101  }
102 
103  return kTRUE;
104 }
double Double_t
Definition: External.C:58
bidirectional stl iterator over the EMCAL iterable container
Double_t fSmearingWidth
Width of Gaussian used to smear cluster energy.
TObjArray fClusterCollArray
Cluster collection array.
Base class for correction components in the EMCal correction framework.
Cluster energy variation component in the EMCal correction framework, for EMCal systematics.
Double_t fEnergyScaleShift
Fraction of cluster energy to shift (positive means upward shift)
const AliClusterIterableMomentumContainer all_momentum() const
TRandom3 fRandom
! Random number generator for cluster energy smearing
bool Bool_t
Definition: External.C:53
Container structure for EMCAL clusters.
static RegisterCorrectionComponent< AliEmcalCorrectionClusterEnergyVariation > reg
bool GetProperty(std::string propertyName, T &property, bool requiredProperty=true, std::string correctionName="")
Retrieve property.