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