AliPhysics  master (3d17d9d)
AliEmcalCorrectionClusterExotics.cxx
Go to the documentation of this file.
1 // AliEmcalCorrectionClusterExotics
2 //
3 
5 
6 #include <TH2F.h>
7 #include <TList.h>
8 
9 #include "AliClusterContainer.h"
10 #include "AliEMCALRecoUtils.h"
11 
15 
16 // Actually registers the class with the base class
18 
23  AliEmcalCorrectionComponent("AliEmcalCorrectionClusterExotics"),
24  fEtaPhiDistBefore(0),
25  fEtaPhiDistAfter(0),
26  fEtaPhiDistAfterNDiffCut(0),
27  fEnergyExoticClusters(0),
28  fEnergyExoticClustersNDiffCut(0),
29  fExoticMinCellAmplitude(0),
30  fMaxFcross(0),
31  fCellCrossMaxTimeDiff(0),
32  fHighEnergyNdiffCut(0),
33  fMinCellEnNdiffCut(0)
34 {
35 }
36 
41 {
42 }
43 
48 {
49  // Initialization
51 
53  GetProperty("fExoticMinCellAmplitude", fExoticMinCellAmplitude);
54  fMaxFcross = 0.97;
55  GetProperty("fMaxFcross", fMaxFcross);
57  GetProperty("fCellCrossMaxTimeDiff", fCellCrossMaxTimeDiff);
58  fHighEnergyNdiffCut = 300; // open, use ~50
59  GetProperty("fHighEnergyNdiffCut", fHighEnergyNdiffCut);
61  GetProperty("fMinCellEnNdiffCut",fMinCellEnNdiffCut);
62 
63  // init reco utils
64  if (!fRecoUtils)
70  if (fRecoUtils)
71  fRecoUtils->Print("");
72 
73  return kTRUE;
74 }
75 
80 {
82 
83  // Create my user objects.
84  if (fCreateHisto){
85  fEtaPhiDistBefore = new TH2F("hEtaPhiDistBefore","hEtaPhiDistBefore;#eta;#phi",280,-0.7,0.7,200*3.14,0,2*3.14);
87  fEtaPhiDistAfter = new TH2F("hEtaPhiDistAfter","hEtaPhiDistAfter;#eta;#phi",280,-0.7,0.7,200*3.14,0,2*3.14);
89  fEtaPhiDistAfterNDiffCut = new TH2F("hEtaPhiDistAfterNDiffCut","hEtaPhiDistAfterNDiffCut;#eta;#phi",280,-0.7,0.7,200*3.14,0,2*3.14);
91  fEnergyExoticClusters = new TH1F("fEnergyExoticClusters","fEnergyExoticClusters;E_{ex clus} (GeV)",2000,0,200);
93  fEnergyExoticClustersNDiffCut = new TH1F("fEnergyExoticClustersNDiffCut","fEnergyExoticClustersNDiffCut;E_{ex clus} (GeV)",2000,0,200);
95 
96  // Take ownership of output list
97  fOutput->SetOwner(kTRUE);
98  }
99 }
100 
105 {
107 
108  // loop over clusters
109  AliVCluster *clus = 0;
110  AliClusterContainer * clusCont = 0;
111  TIter nextClusCont(&fClusterCollArray);
112  while ((clusCont = static_cast<AliClusterContainer*>(nextClusCont()))) {
113 
114  if (!clusCont) continue;
115  auto clusItCont = clusCont->all_momentum();
116 
117  for (AliClusterIterableMomentumContainer::iterator clusIterator = clusItCont.begin(); clusIterator != clusItCont.end(); ++clusIterator) {
118  clus = static_cast<AliVCluster *>(clusIterator->second);
119 
120  if (!clus->IsEMCAL()) continue;
121 
122  if (fCreateHisto) {
123  Float_t pos[3] = {0.};
124  clus->GetPosition(pos);
125  TVector3 vec(pos);
126  // Phi needs to be in 0 to 2 Pi
127  fEtaPhiDistBefore->Fill(vec.Eta(), TVector2::Phi_0_2pi(vec.Phi()));
128  }
129 
130  Bool_t exResult = kFALSE;
131  Bool_t exResult2= kFALSE;
132 
133  if (fRecoUtils) {
135  Bool_t exRemoval = fRecoUtils->IsRejectExoticCell();
136  fRecoUtils->SwitchOnRejectExoticCell(); //switch on temporarily
137 
138  //exResult = fRecoUtils->IsExoticCluster(clus, fCaloCells);
139 
140  // Copy fRecoUtils->IsExoticCluster(), to avoid double calling of absIdMax finding
141  //
142  AliEMCALGeometry* geom = AliEMCALGeometry::GetInstance();
143 
144  if(!geom)
145  {
146  AliError("No instance of the geometry is available");
147  return kFALSE;
148  }
149 
150  Int_t iSupMod = -1, absIdMax = -1, ieta = -1, iphi = -1;
151  Bool_t shared = kFALSE;
152  fRecoUtils->GetMaxEnergyCell(geom, fCaloCells, clus,
153  absIdMax, iSupMod, ieta, iphi, shared);
154 
155  exResult = fRecoUtils->IsExoticCell(absIdMax, fCaloCells);
156 
157  if (!exRemoval) fRecoUtils->SwitchOffRejectExoticCell(); //switch back off
158 
159  clus->SetIsExotic(exResult);
160  if ( !exResult && clus->E() > fHighEnergyNdiffCut )
161  {
162  Int_t nDiff = 0, nSame = 0;
163  Float_t eDiff = 0, eSame = 0;
165  nDiff, nSame, eDiff, eSame,
167 
168  if ( nDiff == 0 ) exResult2 = kTRUE;
169 
170  clus->SetIsExotic(exResult2);
171  }
172  }
173  }
174 
175  if (fCreateHisto) {
176  if (exResult) {
177  fEnergyExoticClusters->Fill(clus->E());
178  }
179  else {
180  Float_t pos[3] = {0.};
181  clus->GetPosition(pos);
182  TVector3 vec(pos);
183  // Phi needs to be in 0 to 2 Pi
184  fEtaPhiDistAfter->Fill(vec.Eta(), TVector2::Phi_0_2pi(vec.Phi()));
185  if(!exResult2) fEtaPhiDistAfterNDiffCut->Fill(vec.Eta(), TVector2::Phi_0_2pi(vec.Phi()));
186  }
187  if(exResult2) fEnergyExoticClustersNDiffCut->Fill(clus->E());
188  }
189  }
190  }
191 
192  return kTRUE;
193 }
Float_t fHighEnergyNdiffCut
Minimum energy for which the cut on n diff T-Card = 0 is applied.
Exotic cluster removal in the EMCal correction framework.
Definition: External.C:236
Bool_t IsRejectExoticCluster() const
void GetEnergyAndNumberOfCellsInTCard(AliVCluster *clus, Int_t absIdMax, AliVCaloCells *cells, Int_t &nDiff, Int_t &nSame, Float_t &eDiff, Float_t &eSame, Float_t emin=0.)
bidirectional stl iterator over the EMCAL iterable container
Bool_t IsExoticCell(Int_t absId, AliVCaloCells *cells, Int_t bc=-1)
TH1F * fEnergyExoticClustersNDiffCut
!energy of exotic clusters, both exo and ndiff cut
AliVCaloCells * fCaloCells
! Pointer to CaloCells
Some utilities for cluster and cell treatment.
TH2F * fEtaPhiDistAfter
!eta/phi distribution after
AliEMCALRecoUtils * fRecoUtils
Pointer to RecoUtils.
TObjArray fClusterCollArray
Cluster collection array.
int Int_t
Definition: External.C:63
void Print(const Option_t *) const
TH1F * fEnergyExoticClusters
!energy of exotic clusters
float Float_t
Definition: External.C:68
Base class for correction components in the EMCal correction framework.
void SetExoticCellDiffTimeCut(Float_t dt)
Float_t fMinCellEnNdiffCut
Minimum energy of cells used counting n diff in T-Card.
TList * fOutput
! List of output histograms
Bool_t fCreateHisto
Flag to make some basic histograms.
void GetMaxEnergyCell(const AliEMCALGeometry *geom, AliVCaloCells *cells, const AliVCluster *clu, Int_t &absId, Int_t &iSupMod, Int_t &ieta, Int_t &iphi, Bool_t &shared)
const AliClusterIterableMomentumContainer all_momentum() const
void SwitchOnRejectExoticCluster()
Bool_t IsRejectExoticCell() const
void SetExoticCellMinAmplitudeCut(Float_t ma)
static RegisterCorrectionComponent< AliEmcalCorrectionClusterExotics > reg
void SetExoticCellFractionCut(Float_t f)
bool Bool_t
Definition: External.C:53
TH2F * fEtaPhiDistBefore
!eta/phi distribution before
Float_t fCellCrossMaxTimeDiff
Max time difference allowed between leading cell and cross cells (in ns)
Container structure for EMCAL clusters.
TH2F * fEtaPhiDistAfterNDiffCut
!eta/phi distribution after both exo and ndiff cut
Float_t fMaxFcross
Max value of Fcross = 1-Ecross/ecell allowed for clusters to pass exotic cut.
Float_t fExoticMinCellAmplitude
Min energy of leading cell in order for exotic cut to be attempted.
bool GetProperty(std::string propertyName, T &property, bool requiredProperty=true, std::string correctionName="")
Retrieve property.