3 // Emcal physics selection class.
7 #include "AliEmcalPhysicsSelection.h"
8 #include "AliAODEvent.h"
9 #include "AliESDEvent.h"
12 ClassImp(AliEmcalPhysicsSelection)
14 AliEmcalPhysicsSelection::AliEmcalPhysicsSelection() :
15 AliPhysicsSelection(),
35 // Default constructor.
38 //__________________________________________________________________________________________________
39 UInt_t AliEmcalPhysicsSelection::GetSelectionMask(const TObject* obj)
41 // Calculate selection mask.
43 const AliVEvent *ev = dynamic_cast<const AliVEvent*>(obj);
49 const AliESDEvent *eev = dynamic_cast<const AliESDEvent*>(obj);
50 const AliAODEvent *aev = 0;
52 res = IsCollisionCandidate(eev);
54 aev = dynamic_cast<const AliAODEvent*>(obj);
55 res = aev->GetHeader()->GetOfflineTrigger();
58 // return 0, if 0 found
62 // return 0, if ptrs are not set
63 if ((eev==0) && (aev==0))
66 if (fTriggers) { // only process given triggers
67 if ((res & fTriggers) == 0)
71 AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager();
74 fIsGoodEvent = kFALSE;
80 if ((res & AliVEvent::kAnyINT) ||
81 (res & AliVEvent::kSemiCentral) ||
82 (res & AliVEvent::kCentral) ||
83 (res & AliVEvent::kEMC1) ||
84 (res & AliVEvent::kEMC7) ||
85 (res & AliVEvent::kEMCEJE) ||
86 (res & AliVEvent::kEMCEGA))
89 if (fZvertexDiff || (fZvertex>0)) {
90 Double_t vzPRI = +999;
91 Double_t vzSPD = -999;
92 const AliVVertex *pv = 0;
94 pv = eev->GetPrimaryVertex();
96 pv = aev->GetPrimaryVertex();
97 if (pv && pv->GetNContributors()>0) {
100 const AliVVertex *sv = 0;
102 sv = eev->GetPrimaryVertexSPD();
104 sv = aev->GetPrimaryVertexSPD();
105 if (sv && sv->GetNContributors()>0) {
108 Double_t dvertex = TMath::Abs(vzPRI-vzSPD);
109 // skip events with dvertex<1mm if requested
110 // https://indico.cern.ch/getFile.py/access?contribId=4&resId=0&materialId=slides&confId=189624
111 // also check on vertex z if requested
112 if (fZvertexDiff && (dvertex<0.1))
113 fIsGoodEvent = kFALSE;
114 if ((fZvertex>0) && (TMath::Abs(dvertex)>fZvertex))
115 fIsGoodEvent = kFALSE;
118 if ((fCentMin>-1) && (fCentMax>-1)) {
119 Double_t v0mcent = -1;
120 AliCentrality *centin = 0;
122 am->LoadBranch("Centrality.");
123 centin = dynamic_cast<AliCentrality*>(eev->FindListObject("Centrality"));
125 centin = const_cast<AliAODEvent*>(aev)->GetCentrality();
128 v0mcent = centin->GetCentralityPercentileUnchecked("V0M");
129 if ((v0mcent<fCentMin) || (v0mcent>fCentMax))
130 fIsGoodEvent = kFALSE;
133 AliVCaloCells *cells = ev->GetEMCALCells();
134 const Short_t nCells = cells->GetNumberOfCells();
136 // mark LHC11a fast only partition if requested
137 if (res & AliVEvent::kFastOnly) {
139 if (fMarkFastOnly||fSkipFastOnly) {
141 AliFatal(Form("Number of cells %d, even though EMCAL should not be in fast only partition.",nCells));
143 fIsGoodEvent = kFALSE;
149 am->LoadBranch("EMCALCells.");
150 for(Int_t iCell=0; iCell<nCells; ++iCell) {
151 Short_t cellId = cells->GetCellNumber(iCell);
152 Double_t cellE = cells->GetCellAmplitude(cellId);
160 am->LoadBranch("CaloClusters");
162 const Int_t nCaloClusters = ev->GetNumberOfCaloClusters();
163 for(Int_t iClus = 0; iClus<nCaloClusters; ++iClus) {
164 AliVCluster *cl = ev->GetCaloCluster(iClus);
167 Double_t e = cl->E();
174 TClonesArray *trks = 0;
176 am->LoadBranch("PicoTracks");
177 trks = dynamic_cast<TClonesArray*>(eev->FindListObject("PicoTracks"));
179 am->LoadBranch("Tracks");
180 trks = dynamic_cast<TClonesArray*>(eev->FindListObject("Tracks"));
183 trks = dynamic_cast<TClonesArray*>(aev->FindListObject("tracks"));
185 const Int_t Ntracks = trks->GetEntriesFast();
186 for (Int_t iTracks = 0; iTracks < Ntracks; ++iTracks) {
187 AliVTrack *track = static_cast<AliVTrack*>(trks->At(iTracks));
190 if (aev) { // a bit ugly since cuts are hard coded for now
191 AliAODTrack *aodtrack = static_cast<AliAODTrack*>(track);
192 if (!aodtrack->TestFilterBit(256) && !aodtrack->TestFilterBit(512))
195 Double_t pt = track->Pt();
201 // bad cell criterion for LHC11a from
202 // https://indico.cern.ch/materialDisplay.py?contribId=4&materialId=slides&confId=147067
203 const Int_t runN = ev->GetRunNumber();
204 if ((runN>=144871) && (runN<=146860)) {
207 am->LoadBranch("EMCALCells.");
209 // count cells above threshold
210 Int_t nCellCount[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
211 for(Int_t iCell=0; iCell<nCells; ++iCell) {
212 Short_t cellId = cells->GetCellNumber(iCell);
213 Double_t cellE = cells->GetCellAmplitude(cellId);
214 Int_t sm = cellId / (24*48);
219 if (nCellCount[4] > 100)
222 if ((runN>=146858) && (runN<=146860)) {
223 if ((res&AliVEvent::kMB) && (nCellCount[3]>=21))
225 else if ((res&AliVEvent::kEMC1) && (nCellCount[3]>=35))
230 fIsGoodEvent = kFALSE;
235 if (fCellMaxE>fCellMinE)
237 if ((fClusMaxE>fClusMinE) || (fTrackMaxPt>fTrackMinPt))
242 if ((fSkipLedEvent && fIsLedEvent) ||
243 (fSkipFastOnly && fIsFastOnly))