]>
Commit | Line | Data |
---|---|---|
7984e5f7 | 1 | // |
2 | // Calculate the multiplicity in the forward regions event-by-event | |
3 | // | |
4 | // Inputs: | |
5 | // - AliESDEvent | |
6 | // | |
7 | // Outputs: | |
8 | // - AliAODForwardMult | |
9 | // | |
10 | // Histograms | |
11 | // | |
12 | // Corrections used | |
13 | // | |
0bd4b00f | 14 | #include "AliForwardMultiplicityTask.h" |
7e4038b5 | 15 | #include "AliTriggerAnalysis.h" |
16 | #include "AliPhysicsSelection.h" | |
17 | #include "AliLog.h" | |
7e4038b5 | 18 | #include "AliESDEvent.h" |
19 | #include "AliAODHandler.h" | |
20 | #include "AliMultiplicity.h" | |
21 | #include "AliInputEventHandler.h" | |
0bd4b00f | 22 | #include "AliForwardCorrectionManager.h" |
23 | #include "AliAnalysisManager.h" | |
7e4038b5 | 24 | #include <TH1.h> |
4f9319f3 | 25 | #include <TH3D.h> |
7e4038b5 | 26 | #include <TDirectory.h> |
27 | #include <TTree.h> | |
0bd4b00f | 28 | #include <TROOT.h> |
1f7aa5c7 | 29 | #include <TStopwatch.h> |
30 | #include <TProfile.h> | |
7e4038b5 | 31 | |
32 | //==================================================================== | |
0bd4b00f | 33 | AliForwardMultiplicityTask::AliForwardMultiplicityTask() |
eb865a4f | 34 | : AliForwardMultiplicityBase(), |
7e4038b5 | 35 | fESDFMD(), |
fffea31d | 36 | fEventInspector(), |
7e4038b5 | 37 | fSharingFilter(), |
38 | fDensityCalculator(), | |
39 | fCorrections(), | |
40 | fHistCollector(), | |
8449e3e0 | 41 | fEventPlaneFinder() |
7e4038b5 | 42 | { |
7984e5f7 | 43 | // |
44 | // Constructor | |
45 | // | |
5ca83fee | 46 | DGUARD(fDebug, 3,"Default CTOR of AliForwardMultiplicityTask"); |
7e4038b5 | 47 | } |
48 | ||
49 | //____________________________________________________________________ | |
0bd4b00f | 50 | AliForwardMultiplicityTask::AliForwardMultiplicityTask(const char* name) |
eb865a4f | 51 | : AliForwardMultiplicityBase(name), |
7e4038b5 | 52 | fESDFMD(), |
fffea31d | 53 | fEventInspector("event"), |
7e4038b5 | 54 | fSharingFilter("sharing"), |
55 | fDensityCalculator("density"), | |
56 | fCorrections("corrections"), | |
57 | fHistCollector("collector"), | |
8449e3e0 | 58 | fEventPlaneFinder("eventplane") |
7e4038b5 | 59 | { |
7984e5f7 | 60 | // |
61 | // Constructor | |
62 | // | |
63 | // Parameters: | |
64 | // name Name of task | |
65 | // | |
5ca83fee | 66 | DGUARD(fDebug, 3,"named CTOR of AliForwardMultiplicityTask: %s", name); |
7e4038b5 | 67 | } |
68 | ||
7e4038b5 | 69 | |
70 | //____________________________________________________________________ | |
c8b1a7db | 71 | Bool_t |
72 | AliForwardMultiplicityTask::PreEvent() | |
7e4038b5 | 73 | { |
c8b1a7db | 74 | // Clear stuff |
75 | fHistos.Clear(); | |
76 | fESDFMD.Clear(); | |
77 | fAODFMD.Clear(); | |
78 | fAODEP.Clear(); | |
79 | return true; | |
7e4038b5 | 80 | } |
7e4038b5 | 81 | //____________________________________________________________________ |
c8b1a7db | 82 | Bool_t |
83 | AliForwardMultiplicityTask::Event(AliESDEvent& esd) | |
7e4038b5 | 84 | { |
7984e5f7 | 85 | // |
86 | // Process each event | |
87 | // | |
88 | // Parameters: | |
89 | // option Not used | |
90 | // | |
1f7aa5c7 | 91 | TStopwatch total; |
92 | TStopwatch individual; | |
93 | if (fDoTiming) total.Start(true); | |
94 | ||
f53fb4f6 | 95 | DGUARD(fDebug,1,"Process the input event"); |
1f7aa5c7 | 96 | |
97 | // Inspect the event | |
98 | if (fDoTiming) individual.Start(true); | |
5bb5d1f6 | 99 | Bool_t lowFlux = kFALSE; |
100 | UInt_t triggers = 0; | |
101 | UShort_t ivz = 0; | |
5ca83fee | 102 | TVector3 ip; |
5bb5d1f6 | 103 | Double_t cent = -1; |
104 | UShort_t nClusters = 0; | |
c8b1a7db | 105 | UInt_t found = fEventInspector.Process(&esd, triggers, lowFlux, |
5ca83fee | 106 | ivz, ip, cent, nClusters); |
1f7aa5c7 | 107 | if (fDoTiming) fHTiming->Fill(kTimingEventInspector, individual.CpuTime()); |
e58000b7 | 108 | |
c8b1a7db | 109 | if (found & AliFMDEventInspector::kNoEvent) return false; |
110 | if (found & AliFMDEventInspector::kNoTriggers) return false; | |
9bff843b | 111 | |
fffea31d | 112 | // Set trigger bits, and mark this event for storage |
9d99b0dd | 113 | fAODFMD.SetTriggerBits(triggers); |
b2e7f2d6 | 114 | fAODFMD.SetSNN(fEventInspector.GetEnergy()); |
115 | fAODFMD.SetSystem(fEventInspector.GetCollisionSystem()); | |
e58000b7 | 116 | fAODFMD.SetCentrality(cent); |
5bb5d1f6 | 117 | fAODFMD.SetNClusters(nClusters); |
7e4038b5 | 118 | MarkEventForStore(); |
2b556440 | 119 | |
c8b1a7db | 120 | // Do not check if SPD data is there - potential bias |
121 | // if (found & AliFMDEventInspector::kNoSPD) return false; | |
122 | if (found & AliFMDEventInspector::kNoFMD) return false; | |
123 | if (found & AliFMDEventInspector::kNoVertex) return false; | |
124 | if (triggers & AliAODForwardMult::kPileUp) return false; | |
5ca83fee | 125 | fAODFMD.SetIpZ(ip.Z()); |
c8b1a7db | 126 | if (found & AliFMDEventInspector::kBadVertex) return false; |
7e4038b5 | 127 | |
0bd4b00f | 128 | // We we do not want to use low flux specific code, we disable it here. |
129 | if (!fEnableLowFlux) lowFlux = false; | |
130 | ||
fffea31d | 131 | // Get FMD data |
c8b1a7db | 132 | AliESDFMD* esdFMD = esd.GetFMDData(); |
1f7aa5c7 | 133 | |
134 | // Apply the sharing filter (or hit merging or clustering if you like) | |
135 | if (fDoTiming) individual.Start(true); | |
5ca83fee | 136 | if (!fSharingFilter.Filter(*esdFMD, lowFlux, fESDFMD, ip.Z())) { |
fffea31d | 137 | AliWarning("Sharing filter failed!"); |
c8b1a7db | 138 | return false; |
7e4038b5 | 139 | } |
1f7aa5c7 | 140 | if (fDoTiming) fHTiming->Fill(kTimingSharingFilter, individual.CpuTime()); |
2b556440 | 141 | |
7e4038b5 | 142 | // Calculate the inclusive charged particle density |
1f7aa5c7 | 143 | if (fDoTiming) individual.Start(true); |
5ca83fee | 144 | if (!fDensityCalculator.Calculate(fESDFMD, fHistos, lowFlux, cent, ip)) { |
f7cfc454 | 145 | // if (!fDensityCalculator.Calculate(*esdFMD, fHistos, ivz, lowFlux)) { |
7e4038b5 | 146 | AliWarning("Density calculator failed!"); |
c8b1a7db | 147 | return false; |
7e4038b5 | 148 | } |
1f7aa5c7 | 149 | if (fDoTiming) fHTiming->Fill(kTimingDensityCalculator,individual.CpuTime()); |
2b556440 | 150 | |
1f7aa5c7 | 151 | // Check if we should do the event plane finder |
2b556440 | 152 | if (fEventInspector.GetCollisionSystem() == AliFMDEventInspector::kPbPb) { |
1f7aa5c7 | 153 | if (fDoTiming) individual.Start(true); |
c8b1a7db | 154 | if (!fEventPlaneFinder.FindEventplane(&esd, fAODEP, |
5ca83fee | 155 | &(fAODFMD.GetHistogram()), &fHistos)) |
2b556440 | 156 | AliWarning("Eventplane finder failed!"); |
1f7aa5c7 | 157 | if (fDoTiming) fHTiming->Fill(kTimingEventPlaneFinder,individual.CpuTime()); |
2b556440 | 158 | } |
7e4038b5 | 159 | |
77f97e3f CHC |
160 | // Check how many rings have been marked for skipping |
161 | Int_t nSkip = 0; | |
162 | for (UShort_t d=1; d<=3; d++) { | |
163 | for (UShort_t q=0; q<=(d/2); q++) { | |
164 | TH2D* h = fHistos.Get(d,q == 0 ? 'I' : 'O'); | |
165 | if (h && h->TestBit(AliForwardUtil::kSkipRing)) nSkip++; | |
166 | } | |
167 | } | |
168 | if (nSkip > 0) | |
169 | // Skip the rest if we have too many outliers | |
170 | return false; | |
171 | ||
7e4038b5 | 172 | // Do the secondary and other corrections. |
1f7aa5c7 | 173 | if (fDoTiming) individual.Start(true); |
7e4038b5 | 174 | if (!fCorrections.Correct(fHistos, ivz)) { |
175 | AliWarning("Corrections failed"); | |
c8b1a7db | 176 | return false; |
7e4038b5 | 177 | } |
1f7aa5c7 | 178 | if (fDoTiming) fHTiming->Fill(kTimingCorrections, individual.CpuTime()); |
7e4038b5 | 179 | |
1f7aa5c7 | 180 | // Collect our `super' histogram |
181 | if (fDoTiming) individual.Start(true); | |
5bb5d1f6 | 182 | if (!fHistCollector.Collect(fHistos, fRingSums, |
8449e3e0 | 183 | ivz, fAODFMD.GetHistogram(), |
184 | fAODFMD.GetCentrality())) { | |
7e4038b5 | 185 | AliWarning("Histogram collector failed"); |
c8b1a7db | 186 | return false; |
7e4038b5 | 187 | } |
1f7aa5c7 | 188 | if (fDoTiming) fHTiming->Fill(kTimingHistCollector, individual.CpuTime()); |
7e4038b5 | 189 | |
77f97e3f | 190 | if (fAODFMD.IsTriggerBits(AliAODForwardMult::kInel) && nSkip < 1) |
7e4038b5 | 191 | fHData->Add(&(fAODFMD.GetHistogram())); |
2d68d438 | 192 | |
1f7aa5c7 | 193 | if (fDoTiming) fHTiming->Fill(kTimingTotal, total.CpuTime()); |
c8b1a7db | 194 | |
195 | return true; | |
36ffcf83 | 196 | } |
197 | ||
7e4038b5 | 198 | |
199 | // | |
200 | // EOF | |
201 | // |