]>
Commit | Line | Data |
---|---|---|
128a8042 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, 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 | //Class to calculate the intrinsic efficiency of the detection elements of the | |
17 | //MUON tracking chambers in function of the position in the detection element. | |
18 | //Author: Nicolas LE BRIS - SUBATECH Nantes | |
19 | ||
20 | ||
21 | //ROOT includes | |
22 | #include <TROOT.h> | |
23 | #include <TSystem.h> | |
24 | #include <TChain.h> | |
25 | #include <TFile.h> | |
26 | #include <TList.h> | |
27 | #include <TClonesArray.h> | |
28 | #include <TH2F.h> | |
29 | ||
30 | //ANALYSIS includes | |
31 | #include "AliAnalysisManager.h" | |
32 | #include "AliAnalysisTask.h" | |
33 | ||
34 | //STEER includes | |
35 | #include "AliESDEvent.h" | |
36 | #include "AliESDMuonTrack.h" | |
37 | #include "AliESDInputHandler.h" | |
f7a1cc68 | 38 | #include "AliMagF.h" |
128a8042 | 39 | #include "AliTracker.h" |
40 | #include "AliAnalysisManager.h" | |
41 | ||
42 | //PWG3/muon includes | |
43 | #include "AliAnalysisTaskMuonTrackingEff.h" | |
44 | #include "AliCheckMuonDetEltResponse.h" | |
45 | ||
46 | //MUON includes | |
47 | #include "AliMUONGeometryTransformer.h" | |
48 | #include "AliMUONTrackExtrap.h" | |
49 | ||
50 | ClassImp(AliAnalysisTaskMuonTrackingEff) | |
51 | ||
52 | const Int_t AliAnalysisTaskMuonTrackingEff::fTotNbrOfDetectionElt = 156; | |
53 | ||
54 | //________________________________________________________________________ | |
55 | AliAnalysisTaskMuonTrackingEff::AliAnalysisTaskMuonTrackingEff() | |
56 | : | |
57 | AliAnalysisTask(), | |
58 | fTransformer(0x0), | |
59 | fESD(0x0), | |
60 | fDetEltEffHistList(0x0), | |
61 | fDetEltTDHistList(0x0), | |
62 | fDetEltTTHistList(0x0) | |
63 | { | |
665701ae | 64 | /// Default constructor |
65 | } | |
66 | //________________________________________________________________________ | |
67 | AliAnalysisTaskMuonTrackingEff::AliAnalysisTaskMuonTrackingEff(const AliAnalysisTaskMuonTrackingEff& src) | |
68 | : | |
69 | AliAnalysisTask(src), | |
70 | fTransformer(0x0), | |
71 | fESD(0x0), | |
72 | fDetEltEffHistList(0x0), | |
73 | fDetEltTDHistList(0x0), | |
74 | fDetEltTTHistList(0x0) | |
75 | { | |
76 | /// copy ctor | |
77 | src.Copy(*this); | |
78 | } | |
79 | //________________________________________________________________________ | |
80 | AliAnalysisTaskMuonTrackingEff& AliAnalysisTaskMuonTrackingEff::operator=(const AliAnalysisTaskMuonTrackingEff& src) | |
81 | { | |
82 | /// assignement operator | |
83 | if ( this != &src ) | |
84 | { | |
85 | src.Copy(*this); | |
86 | } | |
87 | return *this; | |
128a8042 | 88 | } |
128a8042 | 89 | |
90 | //________________________________________________________________________ | |
91 | AliAnalysisTaskMuonTrackingEff::AliAnalysisTaskMuonTrackingEff(const char* name, | |
92 | const AliMUONGeometryTransformer* transformer) | |
93 | : | |
94 | AliAnalysisTask(name, "AnalysisTaskESD"), | |
95 | fTransformer(transformer), | |
96 | fESD(0x0), | |
97 | fDetEltEffHistList(0x0), | |
98 | fDetEltTDHistList(0x0), | |
99 | fDetEltTTHistList(0x0) | |
100 | { | |
101 | //Constructor | |
102 | //----------- | |
103 | ||
104 | //Define detection element efficiency histograms | |
105 | //---------------------------------------------- | |
106 | ||
107 | fDetEltEffHistList = new TClonesArray("TH2F",fTotNbrOfDetectionElt + 3); //!<+3 for: 1.the total efficiency chamber by chamber histogram. | |
108 | //!< 2.the total number of tracks detected by the tracking system. | |
109 | //!< 3.the number of track used for the efficiency calculation chamber by chamber | |
110 | fDetEltTDHistList = new TClonesArray("TH2F",fTotNbrOfDetectionElt + 1); | |
111 | fDetEltTTHistList = new TClonesArray("TH2F",fTotNbrOfDetectionElt + 1); | |
112 | ||
113 | for (Int_t i = 0; i<fTotNbrOfDetectionElt; ++i) | |
114 | { | |
115 | Int_t iDetElt = 0; | |
116 | if (i<16) iDetElt = 100*(i/4+1) + i - int(i/4)*4; | |
117 | else if (i<52) iDetElt = 100*((i-16)/18+5) + i - (int((i-16)/18)*18 + 16); | |
118 | if (i>51) iDetElt = 100*((i-52)/26+7) + i - (int((i-52)/26)*26 + 52); | |
119 | ||
120 | Char_t histName[255]; | |
121 | Char_t histTitle[255]; | |
122 | ||
123 | sprintf(histName,"Eff_detEltNbr%d",iDetElt); | |
124 | sprintf(histTitle,"detEltNbr %d",iDetElt); | |
125 | if(i<16) new((*fDetEltEffHistList)[i]) TH2F(histName,histTitle,12,-10,110,12,-10,110);//!<Stations 1 & 2. | |
126 | else new((*fDetEltEffHistList)[i]) TH2F(histName,histTitle,28,-140,140,8,-40,40); //!<Stations 3 -> 5. | |
127 | ||
128 | sprintf(histName,"TD_detEltNbr%d",iDetElt); | |
129 | if(i<16) new((*fDetEltTDHistList)[i]) TH2F(histName,histTitle,12,-10,110,12,-10,110);//!<Stations 1 & 2. | |
130 | else new((*fDetEltTDHistList)[i]) TH2F(histName,histTitle,28,-140,140,8,-40,40); //!<Stations 3 -> 5. | |
131 | ||
132 | sprintf(histName,"TT_detEltNbr%d",iDetElt); | |
133 | if(i<16) new((*fDetEltTTHistList)[i]) TH2F(histName,histTitle,12,-10,110,12,-10,110); //!<Stations 1 & 2. | |
134 | else new((*fDetEltTTHistList)[i]) TH2F(histName,histTitle,28,-140,140,8,-40,40); //!<Stations 3 -> 5. | |
135 | ||
136 | ((TH2F*) fDetEltEffHistList->UncheckedAt(i)) -> GetXaxis() -> SetTitle("X (cm)"); | |
137 | ((TH2F*) fDetEltEffHistList->UncheckedAt(i)) -> GetYaxis() -> SetTitle("Y (cm)"); | |
138 | ((TH2F*) fDetEltEffHistList->UncheckedAt(i)) -> GetZaxis() -> SetTitle("Efficiency (%)"); | |
139 | ((TH2F*) fDetEltEffHistList->UncheckedAt(i)) -> GetXaxis() -> SetTitleOffset(1.8); | |
140 | ((TH2F*) fDetEltEffHistList->UncheckedAt(i)) -> GetYaxis() -> SetTitleOffset(1.8); | |
141 | ((TH2F*) fDetEltEffHistList->UncheckedAt(i)) -> GetZaxis() -> SetTitleOffset(1.2); | |
142 | ((TH2F*) fDetEltEffHistList->UncheckedAt(i)) -> SetOption("LEGO"); | |
143 | } | |
144 | ||
145 | new((*fDetEltTDHistList )[fTotNbrOfDetectionElt]) TH2F("TD_Chamber" ,"TD_Chamber" ,10,0,10,1,0,1); //!<Detected tracks. | |
146 | new((*fDetEltTTHistList )[fTotNbrOfDetectionElt]) TH2F("TT_Chamber" ,"TT_Chamber" ,10,0,10,1,0,1); //!<Tracks total number. | |
147 | new((*fDetEltEffHistList)[fTotNbrOfDetectionElt]) TH2F("fChamberEff","fChamberEff",10,0,10,1,0,1); //!<Chamber efficiency. | |
148 | ||
149 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt)) -> GetXaxis() -> SetTitle("Chamber number"); | |
150 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt)) -> GetYaxis() -> SetTitle(""); | |
151 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt)) -> GetZaxis() -> SetTitle("Efficiency (%)"); | |
152 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt)) -> GetXaxis() -> SetTitleOffset(1.8); | |
153 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt)) -> GetYaxis() -> SetTitleOffset(1.8); | |
154 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt)) -> GetZaxis() -> SetTitleOffset(1.2); | |
155 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt)) -> SetOption("LEGO"); | |
156 | ||
157 | new((*fDetEltEffHistList)[157]) TH2F("TT_Chamber" ,"TT_Chamber" ,10,0,10,1,0,1); //!<Tracks total number by chamber. | |
158 | ||
159 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 1)) -> GetXaxis() -> SetTitle("Chamber number"); | |
160 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 1)) -> GetYaxis() -> SetTitle(""); | |
161 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 1)) -> GetZaxis() -> SetTitle("Number of tracks"); | |
162 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 1)) -> GetXaxis() -> SetTitleOffset(1.8); | |
163 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 1)) -> GetYaxis() -> SetTitleOffset(1.8); | |
164 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 1)) -> GetZaxis() -> SetTitleOffset(1.2); | |
165 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 1)) -> SetOption("LEGO"); | |
166 | ||
167 | new((*fDetEltEffHistList)[158]) TH2F("Total_Number_of_Tracks" ,"Total_Number_of_Tracks" ,1,0,1,1,0,1); //!<Tracks total number. | |
168 | ||
169 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 2)) -> GetXaxis() -> SetTitle(""); | |
170 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 2)) -> GetYaxis() -> SetTitle(""); | |
171 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 2)) -> GetZaxis() -> SetTitle("Number of tracks"); | |
172 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 2)) -> GetXaxis() -> SetTitleOffset(1.8); | |
173 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 2)) -> GetYaxis() -> SetTitleOffset(1.8); | |
174 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 2)) -> GetZaxis() -> SetTitleOffset(1.2); | |
175 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 2)) -> SetOption("LEGO"); | |
176 | ||
177 | //Define input & output | |
178 | //--------------------- | |
179 | ||
180 | // -Input slot 0 works with a TChain: | |
181 | DefineInput(0, TChain::Class()); | |
182 | ||
183 | // -Output slot 0 writes into a TClonesArray: | |
184 | DefineOutput(0, TClonesArray::Class()); | |
185 | } | |
186 | ||
187 | ||
188 | ||
189 | //______________________________________________________________________________ | |
190 | AliAnalysisTaskMuonTrackingEff::~AliAnalysisTaskMuonTrackingEff() | |
191 | { | |
192 | // Destructor. | |
193 | delete fDetEltEffHistList; | |
194 | delete fDetEltTDHistList; | |
195 | delete fDetEltTTHistList; | |
196 | } | |
197 | ||
198 | ||
199 | ||
200 | //________________________________________________________________________ | |
201 | void AliAnalysisTaskMuonTrackingEff::CreateOutputObjects() | |
202 | { | |
203 | OpenFile(0); | |
204 | } | |
205 | ||
206 | ||
207 | ||
208 | //________________________________________________________________________ | |
209 | void AliAnalysisTaskMuonTrackingEff::ConnectInputData(Option_t */*option*/) | |
210 | ||
211 | { | |
f7a1cc68 | 212 | //Set Field Map for track extrapolation |
213 | AliMUONTrackExtrap::SetField(); | |
128a8042 | 214 | |
f7a1cc68 | 215 | //Connect input |
128a8042 | 216 | AliESDInputHandler* esdHandler = (AliESDInputHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler()); |
217 | if (!esdHandler) | |
218 | { | |
219 | Printf("ERROR: Could not get ESDInputHandler"); | |
220 | } | |
221 | else fESD = esdHandler->GetEvent(); | |
222 | } | |
223 | ||
224 | ||
225 | //________________________________________________________________________ | |
226 | void AliAnalysisTaskMuonTrackingEff::Exec(Option_t */*option*/) | |
227 | { | |
228 | //Execute analysis for current event | |
229 | ||
230 | ||
231 | AliCheckMuonDetEltResponse* chamberEff; | |
232 | chamberEff = new AliCheckMuonDetEltResponse(fTransformer, fESD, fDetEltTDHistList, fDetEltTTHistList); | |
233 | chamberEff->CheckDetEltResponse(); | |
234 | ||
235 | ||
236 | for( Int_t i = 0; i<156; ++i) | |
237 | { | |
238 | ((TH2F*) fDetEltEffHistList->UncheckedAt(i))-> Divide( (TH2F*) fDetEltTDHistList->UncheckedAt(i), | |
239 | (TH2F*) fDetEltTTHistList->UncheckedAt(i), 100., 1.); | |
240 | } | |
241 | ||
242 | ((TH2F*) fDetEltEffHistList->UncheckedAt(156))-> Divide( (TH2F*) fDetEltTDHistList->UncheckedAt(156), | |
243 | (TH2F*) fDetEltTTHistList->UncheckedAt(156), 100., 1.); | |
244 | ||
245 | ||
246 | ((TH2F*) fDetEltEffHistList->UncheckedAt(157))-> Add ( (TH2F*) fDetEltTTHistList ->UncheckedAt(156), | |
247 | (TH2F*) fDetEltEffHistList->UncheckedAt(157), 1., 0.); | |
248 | ||
249 | ||
20e837dc | 250 | ((TH2F*) fDetEltEffHistList->UncheckedAt(158))-> Fill(0., 0., ((Double_t)fESD -> GetNumberOfMuonTracks())); |
128a8042 | 251 | |
252 | ||
253 | //Post the output data: | |
254 | PostData(0, fDetEltEffHistList); | |
255 | } | |
256 | ||
257 | ||
258 | ||
259 | //________________________________________________________________________ | |
260 | void AliAnalysisTaskMuonTrackingEff::Terminate(Option_t */*option*/) | |
261 | { | |
262 | //Terminate analysis | |
263 | ||
264 | } |