]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/EMCALTasks/AliEmcalPhysicsSelection.cxx
CreateCTTMMatrix call: moved from CreateLTMMatrixFromDigits to CreateLTMMatrix (F...
[u/mrichter/AliRoot.git] / PWGGA / EMCALTasks / AliEmcalPhysicsSelection.cxx
CommitLineData
b0a53615 1// $Id$
2//
980821ba 3// Emcal physics selection class.
b0a53615 4//
cd231d42 5// Author: C.Loizides
be94a07d 6
7#include "AliEmcalPhysicsSelection.h"
bb33f819 8#include "AliAODEvent.h"
be94a07d 9#include "AliESDEvent.h"
0abef324 10#include "AliLog.h"
be94a07d 11
12ClassImp(AliEmcalPhysicsSelection)
13
fb81cdb7 14AliEmcalPhysicsSelection::AliEmcalPhysicsSelection() :
15 AliPhysicsSelection(),
16 fMarkFastOnly(0),
17 fMarkLedEvent(0),
18 fSkipFastOnly(0),
19 fSkipLedEvent(0),
20 fCellMinE(2),
21 fClusMinE(5),
22 fIsFastOnly(0),
23 fIsLedEvent(0),
24 fIsGoodEvent(0),
25 fCellMaxE(0),
26 fClusMaxE(0)
27{
28 // Default constructor.
29}
30
be94a07d 31//__________________________________________________________________________________________________
32UInt_t AliEmcalPhysicsSelection::GetSelectionMask(const TObject* obj)
33{
bb33f819 34 // Calculate selection mask.
35
36 const AliVEvent *ev = dynamic_cast<const AliVEvent*>(obj);
37 if (!ev) {
38 return 0;
39 }
40
41 UInt_t res = 0;
42 const AliESDEvent *eev = dynamic_cast<const AliESDEvent*>(obj);
43 const AliAODEvent *aev = 0;
44 if (eev) {
45 res = IsCollisionCandidate(eev);
46 } else {
47 aev = dynamic_cast<const AliAODEvent*>(obj);
48 res = aev->GetHeader()->GetOfflineTrigger();
49 }
be94a07d 50
fb81cdb7 51 fIsFastOnly = kFALSE;
52 fIsGoodEvent = kFALSE;
53 fIsLedEvent = kFALSE;
54 fCellMaxE = 0;
55 fClusMaxE = 0;
56
57 if ((res & AliVEvent::kAnyINT) ||
58 (res & AliVEvent::kEMC1) ||
bb33f819 59 (res & AliVEvent::kEMC7) ||
60 (res & AliVEvent::kEMCEJE) ||
61 (res & AliVEvent::kEMCEGA))
fb81cdb7 62 fIsGoodEvent = kTRUE;
63
64 AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager();
65 am->LoadBranch("EMCALCells.");
66 am->LoadBranch("CaloClusters");
67
bb33f819 68 AliVCaloCells *cells = ev->GetEMCALCells();
fb81cdb7 69 const Short_t nCells = cells->GetNumberOfCells();
70
71 // mark LHC11a fast only partition if requested
72 if (res & AliVEvent::kFastOnly) {
73 fIsFastOnly = kTRUE;
74 if (fMarkFastOnly||fSkipFastOnly) {
75 if (nCells>0) {
76 AliFatal(Form("Number of cells %d, even though EMCAL should not be in fast only partition.",nCells));
be94a07d 77 }
fb81cdb7 78 fIsGoodEvent = kFALSE;
be94a07d 79 }
80 }
81
fb81cdb7 82 // count cells above threshold
83 Int_t nCellCount[10] = {0,0,0,0,0,0,0,0,0,0};
84 for(Int_t iCell=0; iCell<nCells; ++iCell) {
85 Short_t cellId = cells->GetCellNumber(iCell);
86 Double_t cellE = cells->GetCellAmplitude(cellId);
87 Int_t sm = cellId / (24*48);
88 if (cellE>0.1)
89 ++nCellCount[sm];
90 if (cellE>fCellMaxE)
91 fCellMaxE = cellE;
92 }
93
94 const Int_t nCaloClusters = ev->GetNumberOfCaloClusters();
95 for(Int_t iClus = 0; iClus<nCaloClusters; ++iClus) {
bb33f819 96 AliVCluster *cl = ev->GetCaloCluster(iClus);
fb81cdb7 97 if (!cl->IsEMCAL())
98 continue;
99 Double_t e = cl->E();
100 if (e>fClusMaxE)
101 fClusMaxE = e;
102 }
103
104 // bad cell criterion for LHC11a from
105 // https://indico.cern.ch/materialDisplay.py?contribId=4&materialId=slides&confId=147067
106 const Int_t runN = ev->GetRunNumber();
107 if ((runN>=144871) && (runN<=146860)) {
108 if (nCellCount[4] > 100)
109 fIsLedEvent = kTRUE;
110 else {
111 if ((runN>=146858) && (runN<=146860)) {
112 if ((res&AliVEvent::kMB) && (nCellCount[3]>=21))
113 fIsLedEvent = kTRUE;
114 else if ((res&AliVEvent::kEMC1) && (nCellCount[3]>=35))
115 fIsLedEvent = kTRUE;
116 }
117 }
118 if (fIsLedEvent) {
119 fIsGoodEvent = kFALSE;
120 }
121 }
122
123 if (fCellMaxE>=fCellMinE)
124 res |= kEmcalHC;
125
126 if (fClusMaxE>=fClusMinE)
127 res |= kEmcalHT;
128
129 if (fIsGoodEvent)
130 res |= kEmcalOk;
131
132 if ((fSkipLedEvent && fIsLedEvent) ||
133 (fSkipFastOnly && fIsFastOnly))
134 res = 0;
135
be94a07d 136 return res;
137}