]>
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" | |
39 | ||
40 | // STEER includes | |
41 | #include "AliLog.h" | |
59156747 | 42 | #include "AliESDEvent.h" |
43 | #include "AliESDMuonTrack.h" | |
59156747 | 44 | |
59156747 | 45 | // ANALYSIS includes |
ebbabac1 | 46 | #include "AliAnalysisTaskSE.h" |
47 | ||
59156747 | 48 | #include "AliAnalysisTaskTrigChEff.h" |
49 | ||
50 | ClassImp(AliAnalysisTaskTrigChEff) | |
51 | ||
52 | //________________________________________________________________________ | |
53 | AliAnalysisTaskTrigChEff::AliAnalysisTaskTrigChEff(const char *name) : | |
ebbabac1 | 54 | AliAnalysisTaskSE(name), |
73a0c99f | 55 | fUseGhosts(kFALSE), |
59156747 | 56 | fList(0) |
57 | { | |
58 | // | |
59 | /// Constructor. | |
60 | // | |
ebbabac1 | 61 | // Output slot #1 writes into a TObjArray container |
62 | DefineOutput(1, TList::Class()); | |
b201705a | 63 | if (fUseGhosts) AliInfo("Use also trigger tracks not matching tracker tracks"); |
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 | |
73a0c99f | 200 | const Float_t kRadToDeg = 180./TMath::Pi(); |
ebbabac1 | 201 | Int_t nTracks = esdEvent->GetNumberOfMuonTracks(); |
73a0c99f | 202 | |
59156747 | 203 | const Int_t kFirstTrigCh = 11; //AliMpConstants::NofTrackingChambers()+1; |
204 | ||
ebbabac1 | 205 | TArrayI othersEfficient(kNchambers); |
206 | ||
59156747 | 207 | for (Int_t itrack = 0; itrack < nTracks; itrack++) { |
ebbabac1 | 208 | esdTrack = esdEvent->GetMuonTrack(itrack); |
73a0c99f | 209 | |
210 | if ( ! esdTrack->ContainTrackerData() && ! fUseGhosts ) continue; | |
59156747 | 211 | |
ebbabac1 | 212 | pattern = esdTrack->GetHitsPatternInTrigCh(); |
73a0c99f | 213 | Int_t effFlag = AliESDMuonTrack::GetEffFlag(pattern); |
59156747 | 214 | |
73a0c99f | 215 | if(effFlag < AliESDMuonTrack::kChEff) continue; // Track not good for efficiency calculation |
59156747 | 216 | |
73a0c99f | 217 | ((TH1F*)fList->At(kHthetaX))->Fill(esdTrack->GetThetaX() * kRadToDeg); |
218 | ((TH1F*)fList->At(kHthetaY))->Fill(esdTrack->GetThetaY() * kRadToDeg); | |
59156747 | 219 | |
ebbabac1 | 220 | othersEfficient.Reset(1); |
221 | for(Int_t cath=0; cath<kNcathodes; cath++){ | |
222 | for(Int_t ich=0; ich<kNchambers; ich++){ | |
223 | if( ! AliESDMuonTrack::IsChamberHit(pattern, cath, ich)){ | |
224 | for(Int_t jch=0; jch<kNchambers; jch++){ | |
225 | if ( jch != ich) { | |
226 | othersEfficient[jch] = 0; | |
227 | //AliInfo(Form("%s ch %i by New", baseOutString.Data(), jch)); | |
228 | } | |
229 | } // loop on other chambers | |
230 | break; | |
231 | } // if chamber not efficient | |
232 | } // loop on chambers | |
233 | } // loop on cathodes | |
234 | ||
235 | Bool_t rejectTrack = kTRUE; | |
236 | for (Int_t ich=0; ich<kNchambers; ich++){ | |
237 | if ( othersEfficient[ich] > 0 ){ | |
238 | rejectTrack = kFALSE; | |
239 | break; | |
240 | } | |
241 | } | |
242 | ||
243 | if ( rejectTrack ) continue; | |
244 | ||
245 | slat = AliESDMuonTrack::GetSlatOrInfo(pattern); | |
246 | board = esdTrack->LoCircuit(); | |
73a0c99f | 247 | |
248 | if(effFlag >= AliESDMuonTrack::kSlatEff) ((TH1F*)fList->At(kHtracksInSlat))->Fill(slat); | |
249 | if(effFlag >= AliESDMuonTrack::kBoardEff) ((TH1F*)fList->At(kHtracksInBoard))->Fill(board); | |
59156747 | 250 | |
251 | for(Int_t cath=0; cath<kNcathodes; cath++){ | |
ebbabac1 | 252 | for(Int_t ch=0; ch<kNchambers; ch++){ |
253 | if ( ! othersEfficient[ch] ) | |
254 | continue; // Reject track if the info of the chamber under study | |
255 | // is necessary to create the track itself | |
256 | ||
257 | Int_t whichType = AliESDMuonTrack::IsChamberHit(pattern, cath, ch) ? kChHit : kChNonHit; | |
73a0c99f | 258 | |
ebbabac1 | 259 | Int_t iChamber = kFirstTrigCh + ch; |
260 | Int_t hindex = ( whichType == kChHit ) ? kHchamberEff : kHchamberNonEff; | |
59156747 | 261 | ((TH1F*)fList->At(hindex + cath))->Fill(iChamber); |
262 | ||
73a0c99f | 263 | if(effFlag < AliESDMuonTrack::kSlatEff) continue; // Track crossed different slats |
ebbabac1 | 264 | Int_t chCath = GetPlane(cath, ch); |
265 | hindex = ( whichType == kChHit ) ? kHslatEff : kHslatNonEff; | |
59156747 | 266 | ((TH1F*)fList->At(hindex + chCath))->Fill(slat); |
267 | ||
73a0c99f | 268 | if(effFlag < AliESDMuonTrack::kBoardEff) continue; // Track crossed different boards |
ebbabac1 | 269 | hindex = ( whichType == kChHit ) ? kHboardEff : kHboardNonEff; |
59156747 | 270 | ((TH1F*)fList->At(hindex + chCath))->Fill(board); |
271 | } // loop on chambers | |
272 | } // loop on cathodes | |
ebbabac1 | 273 | } // loop on tracks |
59156747 | 274 | |
275 | // Post final data. It will be written to a file with option "RECREATE" | |
ebbabac1 | 276 | PostData(1, fList); |
59156747 | 277 | } |
278 | ||
279 | //________________________________________________________________________ | |
280 | void AliAnalysisTaskTrigChEff::Terminate(Option_t *) { | |
281 | // | |
282 | /// Draw result to the screen | |
283 | /// Called once at the end of the query. | |
284 | // | |
285 | if (!gROOT->IsBatch()) { | |
b201705a | 286 | fList = dynamic_cast<TList*> (GetOutputData(1)); |
287 | ||
59156747 | 288 | TCanvas *can[kNcathodes]; |
289 | TH1F *num = 0x0; | |
290 | TH1F *den = 0x0; | |
291 | for(Int_t cath=0; cath<kNcathodes; cath++){ | |
292 | TString canName = Form("can%i",cath); | |
293 | can[cath] = new TCanvas(canName.Data(),canName.Data(),10*(1+cath),10*(1+cath),310,310); | |
294 | can[cath]->SetFillColor(10); can[cath]->SetHighLightColor(10); | |
295 | can[cath]->SetLeftMargin(0.15); can[cath]->SetBottomMargin(0.15); | |
296 | can[cath]->Divide(2,2); | |
297 | for(Int_t ch=0; ch<kNchambers; ch++){ | |
298 | Int_t chCath = GetPlane(cath, ch); | |
ebbabac1 | 299 | num = (TH1F*)(fList->At(kHboardEff + chCath)->Clone()); |
59156747 | 300 | den = (TH1F*)(fList->At(kHboardNonEff + chCath)->Clone()); |
301 | den->Add(num); | |
302 | num->Divide(den); | |
303 | can[cath]->cd(ch+1); | |
304 | num->DrawCopy("E"); | |
305 | } | |
306 | } | |
307 | } | |
308 | } |