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);
47 AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager();
50 const AliESDEvent *eev = dynamic_cast<const AliESDEvent*>(obj);
51 const AliAODEvent *aev = 0;
53 am->LoadBranch("AliESDHeader.");
54 am->LoadBranch("AliESDRun.");
55 TString title(eev->GetHeader()->GetTitle());
56 if (1&&(title.Length()>0)) {
57 res = eev->GetHeader()->GetUniqueID();
60 res = IsCollisionCandidate(eev);
63 aev = dynamic_cast<const AliAODEvent*>(obj);
64 res = aev->GetHeader()->GetOfflineTrigger();
67 // return 0, if 0 found
71 // return 0, if ptrs are not set
72 if ((eev==0) && (aev==0))
75 if (fTriggers) { // only process given triggers
76 if ((res & fTriggers) == 0)
81 fIsGoodEvent = kFALSE;
87 if ((res & AliVEvent::kAnyINT) ||
88 (res & AliVEvent::kSemiCentral) ||
89 (res & AliVEvent::kCentral) ||
90 (res & AliVEvent::kEMC1) ||
91 (res & AliVEvent::kEMC7) ||
92 (res & AliVEvent::kEMCEJE) ||
93 (res & AliVEvent::kEMCEGA))
99 if (fZvertexDiff || (fZvertex>0)) {
100 Double_t vzPRI = +999;
101 Double_t vzSPD = -999;
102 const AliVVertex *pv = 0;
104 am->LoadBranch("PrimaryVertex.");
105 pv = eev->GetPrimaryVertex();
107 pv = aev->GetPrimaryVertex();
109 if (pv && pv->GetNContributors()>0) {
112 const AliVVertex *sv = 0;
114 am->LoadBranch("SPDVertex.");
115 sv = eev->GetPrimaryVertexSPD();
117 sv = aev->GetPrimaryVertexSPD();
119 if (sv && sv->GetNContributors()>0) {
122 Double_t dvertex = TMath::Abs(vzPRI-vzSPD);
123 // skip events with dvertex>1mm if requested
124 // https://indico.cern.ch/getFile.py/access?contribId=4&resId=0&materialId=slides&confId=189624
125 // also check on vertex z if requested
126 if (fZvertexDiff && (dvertex>0.1))
127 fIsGoodEvent = kFALSE;
128 if ((fZvertex>0) && (TMath::Abs(dvertex)>fZvertex))
129 fIsGoodEvent = kFALSE;
132 if ((fCentMin>-1) && (fCentMax>-1)) {
133 Double_t v0mcent = -1;
134 AliCentrality *centin = 0;
136 TTree *tree = am->GetTree();
137 if (tree->GetBranch("Centrality."))
138 am->LoadBranch("Centrality.");
139 centin = dynamic_cast<AliCentrality*>(eev->FindListObject("Centrality"));
141 centin = const_cast<AliAODEvent*>(aev)->GetCentrality();
144 v0mcent = centin->GetCentralityPercentileUnchecked("V0M");
145 if ((v0mcent<fCentMin) || (v0mcent>fCentMax))
146 fIsGoodEvent = kFALSE;
149 AliVCaloCells *cells = ev->GetEMCALCells();
150 const Short_t nCells = cells->GetNumberOfCells();
152 // mark LHC11a fast only partition if requested
153 if (res & AliVEvent::kFastOnly) {
155 if (fMarkFastOnly||fSkipFastOnly) {
157 AliFatal(Form("Number of cells %d, even though EMCAL should not be in fast only partition.",nCells));
159 fIsGoodEvent = kFALSE;
165 am->LoadBranch("EMCALCells.");
166 for(Int_t iCell=0; iCell<nCells; ++iCell) {
167 Short_t cellId = cells->GetCellNumber(iCell);
168 Double_t cellE = cells->GetCellAmplitude(cellId);
176 am->LoadBranch("CaloClusters");
178 const Int_t nCaloClusters = ev->GetNumberOfCaloClusters();
179 for(Int_t iClus = 0; iClus<nCaloClusters; ++iClus) {
180 AliVCluster *cl = ev->GetCaloCluster(iClus);
183 Double_t e = cl->E();
190 TClonesArray *trks = 0;
192 am->LoadBranch("PicoTracks");
193 trks = dynamic_cast<TClonesArray*>(eev->FindListObject("PicoTracks"));
195 am->LoadBranch("Tracks");
196 trks = dynamic_cast<TClonesArray*>(eev->FindListObject("Tracks"));
199 trks = dynamic_cast<TClonesArray*>(aev->FindListObject("tracks"));
202 const Int_t Ntracks = trks->GetEntriesFast();
203 for (Int_t iTracks = 0; iTracks < Ntracks; ++iTracks) {
204 AliVTrack *track = static_cast<AliVTrack*>(trks->At(iTracks));
207 if (aev) { // a bit ugly since cuts are hard coded for now
208 AliAODTrack *aodtrack = static_cast<AliAODTrack*>(track);
209 if (!aodtrack->TestFilterBit(256) && !aodtrack->TestFilterBit(512))
212 Double_t pt = track->Pt();
219 // bad cell criterion for LHC11a from
220 // https://indico.cern.ch/materialDisplay.py?contribId=4&materialId=slides&confId=147067
221 const Int_t runN = ev->GetRunNumber();
222 if ((runN>=144871) && (runN<=146860)) {
225 am->LoadBranch("EMCALCells.");
227 // count cells above threshold
228 Int_t nCellCount[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
229 for(Int_t iCell=0; iCell<nCells; ++iCell) {
230 Short_t cellId = cells->GetCellNumber(iCell);
231 Double_t cellE = cells->GetCellAmplitude(cellId);
232 Int_t sm = cellId / (24*48);
237 if (nCellCount[4] > 100)
240 if ((runN>=146858) && (runN<=146860)) {
241 if ((res&AliVEvent::kMB) && (nCellCount[3]>=21))
243 else if ((res&AliVEvent::kEMC1) && (nCellCount[3]>=35))
248 fIsGoodEvent = kFALSE;
253 if (fCellMaxE>fCellMinE)
255 if ((fClusMaxE>fClusMinE) || (fTrackMaxPt>fTrackMinPt))
260 if ((fSkipLedEvent && fIsLedEvent) ||
261 (fSkipFastOnly && fIsFastOnly))