AliPhysics  5eaf189 (5eaf189)
AliEmcalCorrectionClusterNonLinearity.cxx
Go to the documentation of this file.
1 // AliEmcalCorrectionClusterNonLinearity
2 //
3 
5 
6 #include <TList.h>
7 
8 #include "AliClusterContainer.h"
9 
13 
14 // Actually registers the class with the base class
16 
17 const std::map <std::string, AliEMCALRecoUtils::NonlinearityFunctions> AliEmcalCorrectionClusterNonLinearity::fgkNonlinearityFunctionMap = {
18  { "kPi0MC", AliEMCALRecoUtils::kPi0MC },
19  { "kPi0GammaGamma", AliEMCALRecoUtils::kPi0GammaGamma },
20  { "kPi0GammaConversion", AliEMCALRecoUtils::kPi0GammaConversion },
21  { "kNoCorrection", AliEMCALRecoUtils::kNoCorrection },
22  { "kBeamTest", AliEMCALRecoUtils::kBeamTest },
23  { "kBeamTestCorrected", AliEMCALRecoUtils::kBeamTestCorrected },
24  { "kPi0MCv2", AliEMCALRecoUtils::kPi0MCv2 },
25  { "kPi0MCv3", AliEMCALRecoUtils::kPi0MCv3 },
26  { "kBeamTestCorrectedv2", AliEMCALRecoUtils::kBeamTestCorrectedv2 },
27  { "kSDMv5", AliEMCALRecoUtils::kSDMv5 },
28  { "kPi0MCv5", AliEMCALRecoUtils::kPi0MCv5 },
29  { "kSDMv6", AliEMCALRecoUtils::kSDMv6 },
30  { "kPi0MCv6", AliEMCALRecoUtils::kPi0MCv6 },
31  { "kBeamTestCorrectedv3", AliEMCALRecoUtils::kBeamTestCorrectedv3 }
32 };
33 
38  AliEmcalCorrectionComponent("AliEmcalCorrectionClusterNonLinearity"),
39  fEnergyDistBefore(0),
40  fEnergyTimeHistBefore(0),
41  fEnergyDistAfter(0),
42  fEnergyTimeHistAfter(0)
43 
44 {
45 }
46 
51 {
52 }
53 
58 {
59  // Initialization
61 
62  std::string nonLinFunctStr = "";
63  GetProperty("nonLinFunct", nonLinFunctStr);
64  UInt_t nonLinFunct = fgkNonlinearityFunctionMap.at(nonLinFunctStr);
65 
66  // init reco utils
67  if (!fRecoUtils)
69  fRecoUtils->SetNonLinearityFunction(nonLinFunct);
70 
71  if (fRecoUtils) {
73  fRecoUtils->Print("");
74  }
75 
76  return kTRUE;
77 }
78 
83 {
85 
86  // Create my user objects.
87  if (fCreateHisto){
88  fEnergyDistBefore = new TH1F("hEnergyDistBefore","hEnergyDistBefore;E_{clus} (GeV)",1500,0,150);
90  fEnergyTimeHistBefore = new TH2F("hEnergyTimeDistBefore","hEnergyTimeDistBefore;E_{clus} (GeV);time (s)",1500,0,150,500,-1e-6,1e-6);
92  fEnergyDistAfter = new TH1F("hEnergyDistAfter","hEnergyDistAfter;E_{clus} (GeV)",1500,0,150);
94  fEnergyTimeHistAfter = new TH2F("hEnergyTimeDistAfter","hEnergyTimeDistAfter;E_{clus} (GeV);time (s)",1500,0,150,500,-1e-6,1e-6);
96 
97  // Take ownership of output list
98  fOutput->SetOwner(kTRUE);
99  }
100 }
101 
106 {
108 
109  // loop over clusters
110  AliVCluster *clus = 0;
111  AliClusterContainer * clusCont = 0;
112  TIter nextClusCont(&fClusterCollArray);
113  while ((clusCont = static_cast<AliClusterContainer*>(nextClusCont()))) {
114 
115  if (!clusCont) return kFALSE;
116  auto clusItCont = clusCont->all_momentum();
117 
118  for (AliClusterIterableMomentumContainer::iterator clusIterator = clusItCont.begin(); clusIterator != clusItCont.end(); ++clusIterator) {
119  clus = static_cast<AliVCluster *>(clusIterator->second);
120 
121  if (!clus->IsEMCAL()) continue;
122 
123  if (fCreateHisto) {
124  fEnergyDistBefore->Fill(clus->E());
125  fEnergyTimeHistBefore->Fill(clus->E(), clus->GetTOF());
126  }
127 
128  if (fRecoUtils) {
131  clus->SetNonLinCorrEnergy(energy);
132  }
133  }
134 
135  // Fill histograms only if cluster is not exotic, as in ClusterMaker (the clusters are flagged, not removed)
136  if (fCreateHisto && !clus->GetIsExotic()) {
137  fEnergyDistAfter->Fill(clus->GetNonLinCorrEnergy());
138  fEnergyTimeHistAfter->Fill(clus->GetNonLinCorrEnergy(), clus->GetTOF());
139  }
140  }
141  }
142 
143  return kTRUE;
144 }
double Double_t
Definition: External.C:58
Definition: External.C:236
static const std::map< std::string, AliEMCALRecoUtils::NonlinearityFunctions > fgkNonlinearityFunctionMap
Relates string to the non-linearity function enumeration for YAML configuration.
bidirectional stl iterator over the EMCAL iterable container
energy
Definition: HFPtSpectrum.C:44
void SetNonLinearityFunction(Int_t fun)
TH2F * fEnergyTimeHistBefore
!energy/time distribution before
Some utilities for cluster and cell treatment.
AliEMCALRecoUtils * fRecoUtils
Pointer to RecoUtils.
TObjArray fClusterCollArray
Cluster collection array.
void Print(const Option_t *) const
unsigned int UInt_t
Definition: External.C:33
Base class for correction components in the EMCal correction framework.
Int_t GetNonLinearityFunction() const
TList * fOutput
! List of output histograms
Bool_t fCreateHisto
Flag to make some basic histograms.
const AliClusterIterableMomentumContainer all_momentum() const
Cluster energy non-linearity correction component in the EMCal correction framework.
bool Bool_t
Definition: External.C:53
Float_t CorrectClusterEnergyLinearity(AliVCluster *clu)
Container structure for EMCAL clusters.
static RegisterCorrectionComponent< AliEmcalCorrectionClusterNonLinearity > reg
TH2F * fEnergyTimeHistAfter
!energy/time distribution after
bool GetProperty(std::string propertyName, T &property, bool requiredProperty=true, std::string correctionName="")
Retrieve property.