]>
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" | |
38 | #include "AliMagFMaps.h" | |
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 | { | |
64 | // Default constructor | |
65 | } | |
66 | ||
67 | ||
68 | ||
69 | //________________________________________________________________________ | |
70 | AliAnalysisTaskMuonTrackingEff::AliAnalysisTaskMuonTrackingEff(const char* name, | |
71 | const AliMUONGeometryTransformer* transformer) | |
72 | : | |
73 | AliAnalysisTask(name, "AnalysisTaskESD"), | |
74 | fTransformer(transformer), | |
75 | fESD(0x0), | |
76 | fDetEltEffHistList(0x0), | |
77 | fDetEltTDHistList(0x0), | |
78 | fDetEltTTHistList(0x0) | |
79 | { | |
80 | //Constructor | |
81 | //----------- | |
82 | ||
83 | //Define detection element efficiency histograms | |
84 | //---------------------------------------------- | |
85 | ||
86 | fDetEltEffHistList = new TClonesArray("TH2F",fTotNbrOfDetectionElt + 3); //!<+3 for: 1.the total efficiency chamber by chamber histogram. | |
87 | //!< 2.the total number of tracks detected by the tracking system. | |
88 | //!< 3.the number of track used for the efficiency calculation chamber by chamber | |
89 | fDetEltTDHistList = new TClonesArray("TH2F",fTotNbrOfDetectionElt + 1); | |
90 | fDetEltTTHistList = new TClonesArray("TH2F",fTotNbrOfDetectionElt + 1); | |
91 | ||
92 | for (Int_t i = 0; i<fTotNbrOfDetectionElt; ++i) | |
93 | { | |
94 | Int_t iDetElt = 0; | |
95 | if (i<16) iDetElt = 100*(i/4+1) + i - int(i/4)*4; | |
96 | else if (i<52) iDetElt = 100*((i-16)/18+5) + i - (int((i-16)/18)*18 + 16); | |
97 | if (i>51) iDetElt = 100*((i-52)/26+7) + i - (int((i-52)/26)*26 + 52); | |
98 | ||
99 | Char_t histName[255]; | |
100 | Char_t histTitle[255]; | |
101 | ||
102 | sprintf(histName,"Eff_detEltNbr%d",iDetElt); | |
103 | sprintf(histTitle,"detEltNbr %d",iDetElt); | |
104 | if(i<16) new((*fDetEltEffHistList)[i]) TH2F(histName,histTitle,12,-10,110,12,-10,110);//!<Stations 1 & 2. | |
105 | else new((*fDetEltEffHistList)[i]) TH2F(histName,histTitle,28,-140,140,8,-40,40); //!<Stations 3 -> 5. | |
106 | ||
107 | sprintf(histName,"TD_detEltNbr%d",iDetElt); | |
108 | if(i<16) new((*fDetEltTDHistList)[i]) TH2F(histName,histTitle,12,-10,110,12,-10,110);//!<Stations 1 & 2. | |
109 | else new((*fDetEltTDHistList)[i]) TH2F(histName,histTitle,28,-140,140,8,-40,40); //!<Stations 3 -> 5. | |
110 | ||
111 | sprintf(histName,"TT_detEltNbr%d",iDetElt); | |
112 | if(i<16) new((*fDetEltTTHistList)[i]) TH2F(histName,histTitle,12,-10,110,12,-10,110); //!<Stations 1 & 2. | |
113 | else new((*fDetEltTTHistList)[i]) TH2F(histName,histTitle,28,-140,140,8,-40,40); //!<Stations 3 -> 5. | |
114 | ||
115 | ((TH2F*) fDetEltEffHistList->UncheckedAt(i)) -> GetXaxis() -> SetTitle("X (cm)"); | |
116 | ((TH2F*) fDetEltEffHistList->UncheckedAt(i)) -> GetYaxis() -> SetTitle("Y (cm)"); | |
117 | ((TH2F*) fDetEltEffHistList->UncheckedAt(i)) -> GetZaxis() -> SetTitle("Efficiency (%)"); | |
118 | ((TH2F*) fDetEltEffHistList->UncheckedAt(i)) -> GetXaxis() -> SetTitleOffset(1.8); | |
119 | ((TH2F*) fDetEltEffHistList->UncheckedAt(i)) -> GetYaxis() -> SetTitleOffset(1.8); | |
120 | ((TH2F*) fDetEltEffHistList->UncheckedAt(i)) -> GetZaxis() -> SetTitleOffset(1.2); | |
121 | ((TH2F*) fDetEltEffHistList->UncheckedAt(i)) -> SetOption("LEGO"); | |
122 | } | |
123 | ||
124 | new((*fDetEltTDHistList )[fTotNbrOfDetectionElt]) TH2F("TD_Chamber" ,"TD_Chamber" ,10,0,10,1,0,1); //!<Detected tracks. | |
125 | new((*fDetEltTTHistList )[fTotNbrOfDetectionElt]) TH2F("TT_Chamber" ,"TT_Chamber" ,10,0,10,1,0,1); //!<Tracks total number. | |
126 | new((*fDetEltEffHistList)[fTotNbrOfDetectionElt]) TH2F("fChamberEff","fChamberEff",10,0,10,1,0,1); //!<Chamber efficiency. | |
127 | ||
128 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt)) -> GetXaxis() -> SetTitle("Chamber number"); | |
129 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt)) -> GetYaxis() -> SetTitle(""); | |
130 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt)) -> GetZaxis() -> SetTitle("Efficiency (%)"); | |
131 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt)) -> GetXaxis() -> SetTitleOffset(1.8); | |
132 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt)) -> GetYaxis() -> SetTitleOffset(1.8); | |
133 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt)) -> GetZaxis() -> SetTitleOffset(1.2); | |
134 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt)) -> SetOption("LEGO"); | |
135 | ||
136 | new((*fDetEltEffHistList)[157]) TH2F("TT_Chamber" ,"TT_Chamber" ,10,0,10,1,0,1); //!<Tracks total number by chamber. | |
137 | ||
138 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 1)) -> GetXaxis() -> SetTitle("Chamber number"); | |
139 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 1)) -> GetYaxis() -> SetTitle(""); | |
140 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 1)) -> GetZaxis() -> SetTitle("Number of tracks"); | |
141 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 1)) -> GetXaxis() -> SetTitleOffset(1.8); | |
142 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 1)) -> GetYaxis() -> SetTitleOffset(1.8); | |
143 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 1)) -> GetZaxis() -> SetTitleOffset(1.2); | |
144 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 1)) -> SetOption("LEGO"); | |
145 | ||
146 | new((*fDetEltEffHistList)[158]) TH2F("Total_Number_of_Tracks" ,"Total_Number_of_Tracks" ,1,0,1,1,0,1); //!<Tracks total number. | |
147 | ||
148 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 2)) -> GetXaxis() -> SetTitle(""); | |
149 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 2)) -> GetYaxis() -> SetTitle(""); | |
150 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 2)) -> GetZaxis() -> SetTitle("Number of tracks"); | |
151 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 2)) -> GetXaxis() -> SetTitleOffset(1.8); | |
152 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 2)) -> GetYaxis() -> SetTitleOffset(1.8); | |
153 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 2)) -> GetZaxis() -> SetTitleOffset(1.2); | |
154 | ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 2)) -> SetOption("LEGO"); | |
155 | ||
156 | //Define input & output | |
157 | //--------------------- | |
158 | ||
159 | // -Input slot 0 works with a TChain: | |
160 | DefineInput(0, TChain::Class()); | |
161 | ||
162 | // -Output slot 0 writes into a TClonesArray: | |
163 | DefineOutput(0, TClonesArray::Class()); | |
164 | } | |
165 | ||
166 | ||
167 | ||
168 | //______________________________________________________________________________ | |
169 | AliAnalysisTaskMuonTrackingEff::~AliAnalysisTaskMuonTrackingEff() | |
170 | { | |
171 | // Destructor. | |
172 | delete fDetEltEffHistList; | |
173 | delete fDetEltTDHistList; | |
174 | delete fDetEltTTHistList; | |
175 | } | |
176 | ||
177 | ||
178 | ||
179 | //________________________________________________________________________ | |
180 | void AliAnalysisTaskMuonTrackingEff::CreateOutputObjects() | |
181 | { | |
182 | OpenFile(0); | |
183 | } | |
184 | ||
185 | ||
186 | ||
187 | //________________________________________________________________________ | |
188 | void AliAnalysisTaskMuonTrackingEff::ConnectInputData(Option_t */*option*/) | |
189 | ||
190 | { | |
191 | //Set mag field; waiting for mag field in CDB | |
192 | //------------------------------------------- | |
193 | AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 1, 1., 10., AliMagFMaps::k5kG); | |
194 | AliTracker::SetFieldMap(field, kFALSE); | |
195 | ||
196 | //Set Field Map for track extrapolation | |
197 | //------------------------------------- | |
198 | AliMUONTrackExtrap::SetField(AliTracker::GetFieldMap()); | |
199 | ||
200 | //Connect input | |
201 | AliESDInputHandler* esdHandler = (AliESDInputHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler()); | |
202 | if (!esdHandler) | |
203 | { | |
204 | Printf("ERROR: Could not get ESDInputHandler"); | |
205 | } | |
206 | else fESD = esdHandler->GetEvent(); | |
207 | } | |
208 | ||
209 | ||
210 | //________________________________________________________________________ | |
211 | void AliAnalysisTaskMuonTrackingEff::Exec(Option_t */*option*/) | |
212 | { | |
213 | //Execute analysis for current event | |
214 | ||
215 | ||
216 | AliCheckMuonDetEltResponse* chamberEff; | |
217 | chamberEff = new AliCheckMuonDetEltResponse(fTransformer, fESD, fDetEltTDHistList, fDetEltTTHistList); | |
218 | chamberEff->CheckDetEltResponse(); | |
219 | ||
220 | ||
221 | for( Int_t i = 0; i<156; ++i) | |
222 | { | |
223 | ((TH2F*) fDetEltEffHistList->UncheckedAt(i))-> Divide( (TH2F*) fDetEltTDHistList->UncheckedAt(i), | |
224 | (TH2F*) fDetEltTTHistList->UncheckedAt(i), 100., 1.); | |
225 | } | |
226 | ||
227 | ((TH2F*) fDetEltEffHistList->UncheckedAt(156))-> Divide( (TH2F*) fDetEltTDHistList->UncheckedAt(156), | |
228 | (TH2F*) fDetEltTTHistList->UncheckedAt(156), 100., 1.); | |
229 | ||
230 | ||
231 | ((TH2F*) fDetEltEffHistList->UncheckedAt(157))-> Add ( (TH2F*) fDetEltTTHistList ->UncheckedAt(156), | |
232 | (TH2F*) fDetEltEffHistList->UncheckedAt(157), 1., 0.); | |
233 | ||
234 | ||
235 | ((TH2F*) fDetEltEffHistList->UncheckedAt(158))-> Fill(0., 0., ((double_t)fESD -> GetNumberOfMuonTracks())); | |
236 | ||
237 | ||
238 | //Post the output data: | |
239 | PostData(0, fDetEltEffHistList); | |
240 | } | |
241 | ||
242 | ||
243 | ||
244 | //________________________________________________________________________ | |
245 | void AliAnalysisTaskMuonTrackingEff::Terminate(Option_t */*option*/) | |
246 | { | |
247 | //Terminate analysis | |
248 | ||
249 | } |