]>
Commit | Line | Data |
---|---|---|
ebbabac1 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | //----------------------------------------------------------------------------- | |
17 | /// \class AliAnalysisTaskSingleMu | |
18 | /// Analysis task for single muons in the spectrometer. | |
19 | /// The output is a list of histograms. | |
20 | /// The macro class can run on AOD or ESDs. | |
21 | /// If Monte Carlo information is present, some basics checks are performed. | |
22 | /// | |
23 | /// \author Diego Stocco | |
24 | //----------------------------------------------------------------------------- | |
25 | ||
26 | //---------------------------------------------------------------------------- | |
27 | // Implementation of the class for trigger chamber efficiency determinaltion | |
28 | //---------------------------------------------------------------------------- | |
29 | ||
30 | ||
59156747 | 31 | #define AliAnalysisTaskTrigChEff_cxx |
32 | ||
33 | // ROOT includes | |
59156747 | 34 | #include "TH1.h" |
35 | #include "TCanvas.h" | |
36 | #include "TROOT.h" | |
37 | #include "TString.h" | |
38 | #include "TList.h" | |
5623f0cb | 39 | #include "TGraphAsymmErrors.h" |
59156747 | 40 | |
41 | // STEER includes | |
42 | #include "AliLog.h" | |
59156747 | 43 | #include "AliESDEvent.h" |
44 | #include "AliESDMuonTrack.h" | |
59156747 | 45 | |
59156747 | 46 | // ANALYSIS includes |
ebbabac1 | 47 | #include "AliAnalysisTaskSE.h" |
48 | ||
59156747 | 49 | #include "AliAnalysisTaskTrigChEff.h" |
50 | ||
51 | ClassImp(AliAnalysisTaskTrigChEff) | |
52 | ||
53 | //________________________________________________________________________ | |
54 | AliAnalysisTaskTrigChEff::AliAnalysisTaskTrigChEff(const char *name) : | |
ebbabac1 | 55 | AliAnalysisTaskSE(name), |
73a0c99f | 56 | fUseGhosts(kFALSE), |
59156747 | 57 | fList(0) |
58 | { | |
59 | // | |
60 | /// Constructor. | |
61 | // | |
ebbabac1 | 62 | // Output slot #1 writes into a TObjArray container |
63 | DefineOutput(1, TList::Class()); | |
59156747 | 64 | } |
65 | ||
b201705a | 66 | //________________________________________________________________________ |
67 | AliAnalysisTaskTrigChEff::~AliAnalysisTaskTrigChEff() | |
68 | { | |
69 | delete fList; | |
70 | } | |
71 | ||
72 | ||
59156747 | 73 | //___________________________________________________________________________ |
ebbabac1 | 74 | void AliAnalysisTaskTrigChEff::UserCreateOutputObjects() { |
59156747 | 75 | // |
76 | /// Create histograms | |
77 | /// Called once | |
78 | // | |
59156747 | 79 | |
80 | TString cathCode[2] = {"bendPlane", "nonBendPlane"}; | |
81 | TString countTypeName[2] = {"CountInCh", "NonCountInCh"}; | |
82 | ||
a6e0ebfe | 83 | const Char_t* yAxisTitle = "counts"; |
59156747 | 84 | |
85 | const Int_t kNboards = 234; //AliMpConstants::NofLocalBoards(); | |
86 | const Int_t kFirstTrigCh = 11;//AliMpConstants::NofTrackingChambers()+1; | |
87 | ||
88 | Int_t chamberBins = kNchambers; | |
89 | Float_t chamberLow = kFirstTrigCh-0.5, chamberHigh = kFirstTrigCh+kNchambers-0.5; | |
a6e0ebfe | 90 | const Char_t* chamberName = "chamber"; |
59156747 | 91 | |
92 | Int_t slatBins = kNslats; | |
93 | Float_t slatLow = 0-0.5, slatHigh = kNslats-0.5; | |
a6e0ebfe | 94 | const Char_t* slatName = "slat"; |
59156747 | 95 | |
96 | Int_t boardBins = kNboards; | |
97 | Float_t boardLow = 1-0.5, boardHigh = kNboards+1.-0.5; | |
a6e0ebfe | 98 | const Char_t* boardName = "board"; |
59156747 | 99 | |
ebbabac1 | 100 | Int_t angleBins = 280; |
101 | Float_t angleLow = -70., angleHigh = 70.; | |
73a0c99f | 102 | const Char_t* angleNameX = "#theta_{x} (deg)"; |
103 | const Char_t* angleNameY = "#theta_{y} (deg)"; | |
104 | ||
59156747 | 105 | TString baseName, histoName; |
106 | fList = new TList(); | |
107 | ||
108 | TH1F* histo; | |
109 | ||
110 | histo = new TH1F("nTracksInSlat", "Num. of tracks used for efficiency calculation", | |
111 | slatBins, slatLow, slatHigh); | |
112 | histo->GetXaxis()->SetTitle(slatName); | |
113 | histo->GetYaxis()->SetTitle("num of used tracks"); | |
114 | ||
115 | fList->AddAt(histo, kHtracksInSlat); | |
116 | ||
117 | histo = new TH1F("nTracksInBoard", "Num. of tracks used for efficiency calculation", | |
118 | boardBins, boardLow, boardHigh); | |
119 | histo->GetXaxis()->SetTitle(boardName); | |
120 | histo->GetYaxis()->SetTitle("num of used tracks"); | |
121 | ||
122 | fList->AddAt(histo, kHtracksInBoard); | |
123 | ||
124 | for(Int_t hType=0; hType<kNcounts; hType++){ | |
ebbabac1 | 125 | Int_t hindex = (hType==0) ? kHchamberEff : kHchamberNonEff; |
59156747 | 126 | for(Int_t cath=0; cath<kNcathodes; cath++){ |
127 | histoName = Form("%sChamber%s", cathCode[cath].Data(), countTypeName[hType].Data()); | |
128 | histo = new TH1F(histoName, histoName, | |
129 | chamberBins, chamberLow, chamberHigh); | |
130 | histo->GetXaxis()->SetTitle(chamberName); | |
131 | histo->GetYaxis()->SetTitle(yAxisTitle); | |
132 | ||
133 | fList->AddAt(histo, hindex + cath); | |
134 | } // loop on cath | |
135 | } // loop on counts | |
136 | ||
137 | for(Int_t hType=0; hType<kNcounts; hType++){ | |
ebbabac1 | 138 | Int_t hindex = (hType==0) ? kHslatEff : kHslatNonEff; |
59156747 | 139 | for(Int_t cath=0; cath<kNcathodes; cath++){ |
140 | for(Int_t ch=0; ch<kNchambers; ch++){ | |
141 | Int_t chCath = GetPlane(cath, ch); | |
142 | histoName = Form("%sSlat%s%i", cathCode[cath].Data(), countTypeName[hType].Data(), kFirstTrigCh+ch); | |
143 | histo = new TH1F(histoName, histoName, | |
144 | slatBins, slatLow, slatHigh); | |
145 | histo->GetXaxis()->SetTitle(slatName); | |
146 | histo->GetYaxis()->SetTitle(yAxisTitle); | |
147 | ||
148 | fList->AddAt(histo, hindex + chCath); | |
149 | } // loop on chamber | |
150 | } // loop on cath | |
151 | } // loop on counts | |
152 | ||
153 | for(Int_t hType=0; hType<kNcounts; hType++){ | |
ebbabac1 | 154 | Int_t hindex = (hType==0) ? kHboardEff : kHboardNonEff; |
59156747 | 155 | for(Int_t cath=0; cath<kNcathodes; cath++){ |
156 | for(Int_t ch=0; ch<kNchambers; ch++){ | |
157 | Int_t chCath = GetPlane(cath, ch); | |
158 | histoName = Form("%sBoard%s%i", cathCode[cath].Data(), countTypeName[hType].Data(), kFirstTrigCh+ch); | |
159 | histo = new TH1F(histoName, histoName, | |
160 | boardBins, boardLow, boardHigh); | |
161 | histo->GetXaxis()->SetTitle(boardName); | |
162 | histo->GetYaxis()->SetTitle(yAxisTitle); | |
163 | ||
164 | fList->AddAt(histo, hindex + chCath); | |
165 | } // loop on chamber | |
166 | } // loop on cath | |
167 | } // loop on counts | |
73a0c99f | 168 | |
169 | histo = new TH1F("thetaX", "Angular distribution", | |
170 | angleBins, angleLow, angleHigh); | |
171 | histo->GetXaxis()->SetTitle(angleNameX); | |
172 | histo->GetYaxis()->SetTitle("entries"); | |
173 | fList->AddAt(histo, kHthetaX); | |
174 | ||
175 | histo = new TH1F("thetaY", "Angular distribution", | |
176 | angleBins, angleLow, angleHigh); | |
177 | histo->GetXaxis()->SetTitle(angleNameY); | |
178 | histo->GetYaxis()->SetTitle("entries"); | |
179 | fList->AddAt(histo, kHthetaY); | |
180 | ||
59156747 | 181 | } |
182 | ||
183 | //________________________________________________________________________ | |
ebbabac1 | 184 | void AliAnalysisTaskTrigChEff::UserExec(Option_t *) { |
59156747 | 185 | // |
186 | /// Main loop | |
187 | /// Called for each event | |
188 | // | |
ebbabac1 | 189 | AliESDEvent* esdEvent = dynamic_cast<AliESDEvent*> (InputEvent()); |
190 | ||
191 | if (!esdEvent) { | |
192 | Printf("ERROR: esdEvent not available\n"); | |
193 | return; | |
194 | } | |
195 | ||
196 | Int_t slat = 0, board = 0; | |
59156747 | 197 | UShort_t pattern = 0; |
198 | AliESDMuonTrack *esdTrack = 0x0; | |
59156747 | 199 | |
ebbabac1 | 200 | Int_t nTracks = esdEvent->GetNumberOfMuonTracks(); |
73a0c99f | 201 | |
59156747 | 202 | const Int_t kFirstTrigCh = 11; //AliMpConstants::NofTrackingChambers()+1; |
203 | ||
ebbabac1 | 204 | TArrayI othersEfficient(kNchambers); |
205 | ||
59156747 | 206 | for (Int_t itrack = 0; itrack < nTracks; itrack++) { |
ebbabac1 | 207 | esdTrack = esdEvent->GetMuonTrack(itrack); |
73a0c99f | 208 | |
209 | if ( ! esdTrack->ContainTrackerData() && ! fUseGhosts ) continue; | |
59156747 | 210 | |
ebbabac1 | 211 | pattern = esdTrack->GetHitsPatternInTrigCh(); |
73a0c99f | 212 | Int_t effFlag = AliESDMuonTrack::GetEffFlag(pattern); |
59156747 | 213 | |
73a0c99f | 214 | if(effFlag < AliESDMuonTrack::kChEff) continue; // Track not good for efficiency calculation |
59156747 | 215 | |
5623f0cb | 216 | ((TH1F*)fList->At(kHthetaX))->Fill(esdTrack->GetThetaXUncorrected() * TMath::RadToDeg()); |
217 | ((TH1F*)fList->At(kHthetaY))->Fill(esdTrack->GetThetaYUncorrected() * TMath::RadToDeg()); | |
59156747 | 218 | |
ebbabac1 | 219 | othersEfficient.Reset(1); |
220 | for(Int_t cath=0; cath<kNcathodes; cath++){ | |
221 | for(Int_t ich=0; ich<kNchambers; ich++){ | |
222 | if( ! AliESDMuonTrack::IsChamberHit(pattern, cath, ich)){ | |
223 | for(Int_t jch=0; jch<kNchambers; jch++){ | |
224 | if ( jch != ich) { | |
225 | othersEfficient[jch] = 0; | |
226 | //AliInfo(Form("%s ch %i by New", baseOutString.Data(), jch)); | |
227 | } | |
228 | } // loop on other chambers | |
229 | break; | |
230 | } // if chamber not efficient | |
231 | } // loop on chambers | |
232 | } // loop on cathodes | |
233 | ||
234 | Bool_t rejectTrack = kTRUE; | |
235 | for (Int_t ich=0; ich<kNchambers; ich++){ | |
236 | if ( othersEfficient[ich] > 0 ){ | |
237 | rejectTrack = kFALSE; | |
238 | break; | |
239 | } | |
240 | } | |
241 | ||
242 | if ( rejectTrack ) continue; | |
243 | ||
244 | slat = AliESDMuonTrack::GetSlatOrInfo(pattern); | |
245 | board = esdTrack->LoCircuit(); | |
73a0c99f | 246 | |
247 | if(effFlag >= AliESDMuonTrack::kSlatEff) ((TH1F*)fList->At(kHtracksInSlat))->Fill(slat); | |
248 | if(effFlag >= AliESDMuonTrack::kBoardEff) ((TH1F*)fList->At(kHtracksInBoard))->Fill(board); | |
59156747 | 249 | |
250 | for(Int_t cath=0; cath<kNcathodes; cath++){ | |
ebbabac1 | 251 | for(Int_t ch=0; ch<kNchambers; ch++){ |
252 | if ( ! othersEfficient[ch] ) | |
253 | continue; // Reject track if the info of the chamber under study | |
254 | // is necessary to create the track itself | |
255 | ||
256 | Int_t whichType = AliESDMuonTrack::IsChamberHit(pattern, cath, ch) ? kChHit : kChNonHit; | |
73a0c99f | 257 | |
ebbabac1 | 258 | Int_t iChamber = kFirstTrigCh + ch; |
259 | Int_t hindex = ( whichType == kChHit ) ? kHchamberEff : kHchamberNonEff; | |
59156747 | 260 | ((TH1F*)fList->At(hindex + cath))->Fill(iChamber); |
261 | ||
73a0c99f | 262 | if(effFlag < AliESDMuonTrack::kSlatEff) continue; // Track crossed different slats |
ebbabac1 | 263 | Int_t chCath = GetPlane(cath, ch); |
264 | hindex = ( whichType == kChHit ) ? kHslatEff : kHslatNonEff; | |
59156747 | 265 | ((TH1F*)fList->At(hindex + chCath))->Fill(slat); |
266 | ||
73a0c99f | 267 | if(effFlag < AliESDMuonTrack::kBoardEff) continue; // Track crossed different boards |
ebbabac1 | 268 | hindex = ( whichType == kChHit ) ? kHboardEff : kHboardNonEff; |
59156747 | 269 | ((TH1F*)fList->At(hindex + chCath))->Fill(board); |
270 | } // loop on chambers | |
271 | } // loop on cathodes | |
ebbabac1 | 272 | } // loop on tracks |
59156747 | 273 | |
274 | // Post final data. It will be written to a file with option "RECREATE" | |
ebbabac1 | 275 | PostData(1, fList); |
59156747 | 276 | } |
277 | ||
278 | //________________________________________________________________________ | |
279 | void AliAnalysisTaskTrigChEff::Terminate(Option_t *) { | |
280 | // | |
281 | /// Draw result to the screen | |
282 | /// Called once at the end of the query. | |
283 | // | |
5623f0cb | 284 | if ( gROOT->IsBatch() ) return; |
285 | fList = dynamic_cast<TList*> (GetOutputData(1)); | |
286 | ||
287 | TCanvas *can; | |
288 | TH1F *num = 0x0; | |
289 | TH1F *den = 0x0; | |
290 | TGraphAsymmErrors* effGraph = 0x0; | |
291 | TString baseName[3] = {"Chamber", "RPC", "Board"}; | |
292 | Int_t baseIndex1[3] = {kHchamberEff, kHslatEff, kHboardEff}; | |
293 | Int_t baseIndex2[3] = {kHchamberNonEff, kHslatNonEff, kHboardNonEff}; | |
294 | TString cathName[2] = {"BendPlane", "NonBendPlane"}; | |
295 | for (Int_t itype=0; itype<3; itype++) { | |
59156747 | 296 | for(Int_t cath=0; cath<kNcathodes; cath++){ |
5623f0cb | 297 | TString canName = Form("efficiencyPer%s_%s",baseName[itype].Data(),cathName[cath].Data()); |
298 | can = new TCanvas(canName.Data(),canName.Data(),10*(1+2*itype+cath),10*(1+2*itype+cath),310,310); | |
299 | can->SetFillColor(10); can->SetHighLightColor(10); | |
300 | can->SetLeftMargin(0.15); can->SetBottomMargin(0.15); | |
301 | if ( itype > 0 ) | |
302 | can->Divide(2,2); | |
303 | ||
59156747 | 304 | for(Int_t ch=0; ch<kNchambers; ch++){ |
5623f0cb | 305 | Int_t chCath = ( itype == 0 ) ? cath : GetPlane(cath, ch); |
306 | num = (TH1F*)(fList->At(baseIndex1[itype] + chCath)->Clone()); | |
307 | den = (TH1F*)(fList->At(baseIndex2[itype] + chCath)->Clone()); | |
59156747 | 308 | den->Add(num); |
5623f0cb | 309 | effGraph = new TGraphAsymmErrors(num, den); |
310 | effGraph->GetYaxis()->SetRangeUser(0., 1.1); | |
311 | effGraph->GetYaxis()->SetTitle("Efficiency"); | |
312 | effGraph->GetXaxis()->SetTitle(baseName[itype].Data()); | |
313 | can->cd(ch+1); | |
314 | effGraph->Draw("AP"); | |
315 | if ( itype == 0 ) break; | |
316 | } // loop on chamber | |
317 | } // loop on cathode | |
318 | } // loop on histo | |
59156747 | 319 | } |