]>
Commit | Line | Data |
---|---|---|
fd1d0cb9 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2006, 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 | // | |
18 | // class used to extract and store info at event level | |
19 | // | |
20 | // Author: X-M. Zhang, zhang@clermont.in2p3.fr | |
21 | // zhangxm@iopp.ccnu.edu.cn | |
22 | ///////////////////////////////////////////////////////////// | |
23 | ||
4292b3b6 | 24 | #include <TMath.h> |
fd1d0cb9 | 25 | #include <TH1.h> |
26 | #include <TH1F.h> | |
fd1d0cb9 | 27 | #include <TList.h> |
1195bb6f | 28 | |
fd1d0cb9 | 29 | #include "AliMuonInfoStoreRD.h" |
30 | #include "AliMuonInfoStoreMC.h" | |
31 | #include "AliDimuInfoStoreRD.h" | |
32 | #include "AliDimuInfoStoreMC.h" | |
4292b3b6 | 33 | #include "AliMuonsHFHeader.h" |
34 | ||
fd1d0cb9 | 35 | class TNamed; |
36 | class AliESDVertex; | |
37 | ||
4292b3b6 | 38 | ClassImp(AliMuonsHFHeader) |
39 | ||
fd1d0cb9 | 40 | const TString AliMuonsHFHeader::fgkStdBranchName("MuEvsH"); |
1195bb6f | 41 | Int_t AliMuonsHFHeader::fgAnaMode = 0; |
42 | Bool_t AliMuonsHFHeader::fgIsMC = kFALSE; | |
fd1d0cb9 | 43 | Double_t AliMuonsHFHeader::fgCuts[3] = { -999999., 999999., 999999.}; |
44 | ||
4292b3b6 | 45 | //_____________________________________________________________________________ |
46 | AliMuonsHFHeader::AliMuonsHFHeader() : | |
47 | TNamed(), | |
1195bb6f | 48 | fVtxContrsN(0), |
49 | fFiredTriggerClass(), | |
fd1d0cb9 | 50 | fCentrality(0.) |
4292b3b6 | 51 | { |
52 | // | |
53 | // default constructor | |
54 | // | |
fd1d0cb9 | 55 | for (Int_t i=3; i--;) fVtx[i] = 0.; |
fd1d0cb9 | 56 | } |
57 | ||
58 | //_____________________________________________________________________________ | |
59 | AliMuonsHFHeader::AliMuonsHFHeader(const AliMuonsHFHeader &src) : | |
60 | TNamed(), | |
1195bb6f | 61 | fVtxContrsN(src.fVtxContrsN), |
62 | fFiredTriggerClass(src.fFiredTriggerClass), | |
fd1d0cb9 | 63 | fCentrality(src.fCentrality) |
64 | { | |
65 | // | |
66 | // copy constructor | |
67 | // | |
1195bb6f | 68 | for (Int_t i=3; i--;) fVtx[i] = src.fVtx[i]; |
fd1d0cb9 | 69 | } |
70 | ||
71 | //_____________________________________________________________________________ | |
72 | AliMuonsHFHeader& AliMuonsHFHeader::operator=(const AliMuonsHFHeader &src) | |
73 | { | |
74 | // | |
75 | // assignment constructor | |
76 | // | |
1195bb6f | 77 | |
78 | fVtxContrsN = src.fVtxContrsN; | |
79 | fFiredTriggerClass = src.fFiredTriggerClass; | |
80 | fCentrality = src.fCentrality; | |
81 | for (Int_t i=3; i--;) fVtx[i] = src.fVtx[i]; | |
fd1d0cb9 | 82 | |
83 | return *this; | |
4292b3b6 | 84 | } |
85 | ||
86 | //_____________________________________________________________________________ | |
87 | AliMuonsHFHeader::~AliMuonsHFHeader() | |
88 | { | |
89 | // | |
90 | // default destructor | |
91 | // | |
92 | } | |
93 | ||
94 | //_____________________________________________________________________________ | |
1195bb6f | 95 | void AliMuonsHFHeader::SetEvent(AliVVertex *vertex) |
4292b3b6 | 96 | { |
fd1d0cb9 | 97 | // extract event info from AOD event |
98 | ||
fd1d0cb9 | 99 | vertex->GetXYZ(fVtx); |
1195bb6f | 100 | fVtxContrsN = vertex->GetNContributors(); |
fd1d0cb9 | 101 | this->SetTitle(vertex->GetTitle()); |
fd1d0cb9 | 102 | return; |
103 | } | |
104 | ||
105 | //_____________________________________________________________________________ | |
1195bb6f | 106 | Bool_t AliMuonsHFHeader::EventSelection() |
fd1d0cb9 | 107 | { |
1195bb6f | 108 | // select event according to the event selection cuts |
109 | if (this->VtxContrsN()<fgCuts[0]) return kFALSE; | |
110 | if (TMath::Abs(this->Vz())>fgCuts[1]) return kFALSE; | |
111 | if (this->Vt()>fgCuts[2]) return kFALSE; | |
112 | return kTRUE; | |
fd1d0cb9 | 113 | } |
114 | ||
115 | //_____________________________________________________________________________ | |
1195bb6f | 116 | void AliMuonsHFHeader::CreateHistograms(TList *list) |
fd1d0cb9 | 117 | { |
1195bb6f | 118 | // create output histos of muon analysis according to the analysis mode & MC flag |
fd1d0cb9 | 119 | |
1195bb6f | 120 | this->CreateHistosEvnH(list); |
fd1d0cb9 | 121 | |
1195bb6f | 122 | if (fgAnaMode!=2) { |
123 | this->CreateHistosMuon(list); | |
124 | if (fgIsMC) { | |
125 | TString sName[6] = { "Unidentified", "Hadron", "SecondaryMu", "PrimaryMu", "CharmMu", "BottomMu" }; | |
126 | for (Int_t i=AliMuonInfoStoreMC::SourcesN(); i--;) this->CreateHistosMuon(list, sName[i]); | |
127 | } | |
fd1d0cb9 | 128 | } |
fd1d0cb9 | 129 | |
1195bb6f | 130 | if (fgAnaMode!=1) { |
131 | this->CreateHistosDimu(list); | |
132 | if (fgIsMC) { | |
133 | TString sName[6] = { "Uncorr", "Resonance", "DDsame", "DDdiff", "BBsame", "BBdiff" }; | |
134 | for (Int_t i=AliDimuInfoStoreMC::SourcesN(); i--;) this->CreateHistosDimu(list, sName[i]); | |
135 | } | |
fd1d0cb9 | 136 | } |
1195bb6f | 137 | |
fd1d0cb9 | 138 | return; |
139 | } | |
140 | ||
141 | //_____________________________________________________________________________ | |
1195bb6f | 142 | void AliMuonsHFHeader::CreateHistosEvnH(TList *list) |
fd1d0cb9 | 143 | { |
144 | // create histograms at event level | |
145 | ||
146 | if (!list) list = new TList(); | |
147 | list->SetOwner(); | |
148 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
149 | TH1::AddDirectory(kFALSE); | |
150 | ||
1195bb6f | 151 | const Int_t nHistos = 3; |
152 | TString tname[nHistos] = { "hVz", "hVt", "hVtxNcontr" }; | |
153 | Int_t nbins[nHistos] = { 800 , 40 , 202 }; | |
154 | Double_t xlow[nHistos] = { -40., 0., -2.5 }; | |
155 | Double_t xup[nHistos] = { 40., 4., 199.5 }; | |
fd1d0cb9 | 156 | |
1195bb6f | 157 | TH1F *histo = 0; |
fd1d0cb9 | 158 | for (Int_t i=0; i<nHistos; i++) { |
1195bb6f | 159 | histo = new TH1F(tname[i], tname[i].Data(), nbins[i], xlow[i], xup[i]); |
160 | histo->Sumw2(); list->Add(histo); histo = 0; | |
fd1d0cb9 | 161 | } |
162 | ||
163 | TH1::AddDirectory(oldStatus); | |
164 | return; | |
165 | } | |
166 | ||
167 | //_____________________________________________________________________________ | |
1195bb6f | 168 | void AliMuonsHFHeader::CreateHistosMuon(TList *list, TString sName) |
fd1d0cb9 | 169 | { |
170 | // create histograms for single muon | |
171 | ||
172 | if (!list) list = new TList(); | |
173 | list->SetOwner(); | |
174 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
175 | TH1::AddDirectory(kFALSE); | |
176 | ||
1195bb6f | 177 | const Int_t nHistos = 8; |
178 | TString tName[nHistos] = { "P", "Pt", "Eta", "DCA", "TrM", "Charge", "Rabs", "UnfVtx" }; | |
179 | Int_t nbins[nHistos] = { 1500 , 300 , 100 , 500 , 4 , 3 , 300 , 80 }; | |
180 | Double_t xlow[nHistos] = { 0., 0., -10., 0., -0.5, -1.5, 0., -40. }; | |
181 | Double_t xup[nHistos] = { 150., 30., 0., 500., 3.5, 1.5, 150., 40. }; | |
fd1d0cb9 | 182 | |
183 | TH1F *histo = 0; | |
184 | for (Int_t i=0; i<nHistos; i++) { | |
1195bb6f | 185 | char *hName = Form("h%s_%s", sName.Data(), tName[i].Data()); |
186 | histo = new TH1F(hName, hName, nbins[i], xlow[i], xup[i]); | |
187 | histo->Sumw2(); list->Add(histo); histo = 0; | |
fd1d0cb9 | 188 | } |
189 | ||
190 | TH1::AddDirectory(oldStatus); | |
191 | return; | |
192 | } | |
193 | ||
194 | //_____________________________________________________________________________ | |
1195bb6f | 195 | void AliMuonsHFHeader::CreateHistosDimu(TList *list, TString sName) |
fd1d0cb9 | 196 | { |
197 | // create histograms for dimuon | |
198 | ||
199 | if (!list) list = new TList(); | |
200 | list->SetOwner(); | |
201 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
202 | TH1::AddDirectory(kFALSE); | |
203 | ||
204 | TH1F *histo = 0; | |
205 | const Int_t nHistos = 3; | |
1195bb6f | 206 | TString tName[nHistos] = { "P", "Pt", "InvM" }; |
207 | Int_t nbins[nHistos] = { 1500 , 300 , 300 }; | |
208 | Double_t xlow[nHistos] = { 0., 0., 0. }; | |
209 | Double_t xup[nHistos] = { 150., 30., 30. }; | |
210 | TString dimuName[3] = { "DimuNN", "DimuNP", "DimuPP" }; | |
fd1d0cb9 | 211 | for (Int_t i=0; i<3; i++) { |
212 | for (Int_t j=0; j<nHistos; j++) { | |
1195bb6f | 213 | char *hName = Form("h%s_%s_%s", sName.Data(), dimuName[i].Data(), tName[j].Data()); |
214 | histo = new TH1F(hName, hName, nbins[j], xlow[j], xup[j]); | |
215 | histo->Sumw2(); list->Add(histo); histo = 0; | |
fd1d0cb9 | 216 | } |
217 | } | |
218 | ||
219 | TH1::AddDirectory(oldStatus); | |
220 | return; | |
221 | } | |
222 | ||
223 | //_____________________________________________________________________________ | |
1195bb6f | 224 | void AliMuonsHFHeader::FillHistosEvnH(TList *list) |
fd1d0cb9 | 225 | { |
226 | // fill histograms at event level according to event selection cuts | |
227 | ||
1195bb6f | 228 | if (!list) return; |
229 | if (!this->EventSelection()) return; | |
fd1d0cb9 | 230 | |
1195bb6f | 231 | const Int_t nHistos = 3; |
232 | TString tname[nHistos] = { "hVz", "hVt", "hVtxNcontr" }; | |
233 | Double_t dist[nHistos] = { this->Vz(), this->Vt(), this->VtxContrsN() }; | |
234 | for (Int_t i=nHistos; i--;) ((TH1F*)list->FindObject(tname[i].Data()))->Fill(dist[i]); | |
fd1d0cb9 | 235 | return; |
236 | } | |
237 | ||
238 | //_____________________________________________________________________________ | |
1195bb6f | 239 | void AliMuonsHFHeader::FillHistosMuon(TList *list, AliMuonInfoStoreRD* const infoStore, Int_t src) |
fd1d0cb9 | 240 | { |
241 | // fill histograms for single muon according to event & muon track selection cuts | |
242 | ||
1195bb6f | 243 | if (!list) return; |
244 | if (!this->EventSelection()) return; | |
245 | if (!infoStore->MuonSelection()) return; | |
246 | ||
247 | const Int_t nHistos = 8; | |
248 | TString tName[nHistos] = { "P", "Pt", "Eta", "DCA", "TrM", "Charge", "Rabs", "UnfVtx" }; | |
249 | Double_t dist[nHistos] = { infoStore->Momentum().Mag(), | |
250 | infoStore->Momentum().Pt(), | |
251 | infoStore->Momentum().Eta(), | |
252 | infoStore->DCA(), | |
253 | infoStore->MatchTrigger(), | |
254 | infoStore->Charge(), | |
255 | infoStore->RabsEnd(), | |
256 | this->Vz() }; | |
257 | for (Int_t i=nHistos; i--;) ((TH1F*)list->FindObject(Form("h%s_%s","",tName[i].Data())))->Fill(dist[i]); | |
258 | ||
259 | if (fgIsMC && src>=0) { | |
260 | TString sName[6] = { "BottomMu", "CharmMu", "PrimaryMu", "SecondaryMu", "Hadron", "Unidentified" }; | |
261 | for (Int_t i=nHistos; i--;) ((TH1F*)list->FindObject(Form("h%s_%s",sName[src].Data(),tName[i].Data())))->Fill(dist[i]); | |
262 | } | |
fd1d0cb9 | 263 | |
fd1d0cb9 | 264 | return; |
265 | } | |
266 | ||
267 | //_____________________________________________________________________________ | |
1195bb6f | 268 | void AliMuonsHFHeader::FillHistosDimu(TList *list, AliDimuInfoStoreRD* const infoStore, Int_t src) |
fd1d0cb9 | 269 | { |
270 | // fill histograms for dimuon according to evnet & dimuon candidates selection cuts | |
271 | ||
1195bb6f | 272 | if (!list) return; |
273 | if (!this->EventSelection()) return; | |
274 | if (!infoStore->DimuSelection()) return; | |
fd1d0cb9 | 275 | |
1195bb6f | 276 | TString dimuName = "DimuNN"; |
277 | if (infoStore->Charge()==0) dimuName = "DimuNP"; | |
278 | else if (infoStore->Charge()>0) dimuName = "DimuPP"; | |
fd1d0cb9 | 279 | |
1195bb6f | 280 | const Int_t nHistos = 3; |
281 | TString tName[nHistos] = { "P", "Pt", "InvM" }; | |
282 | Double_t dist[nHistos] = { infoStore->Momentum().Mag(), | |
283 | infoStore->Momentum().Pt(), | |
284 | infoStore->InvM() }; | |
285 | for (Int_t i=nHistos; i--;) ((TH1F*)list->FindObject(Form("h%s_%s_%s","",dimuName.Data(),tName[i].Data())))->Fill(dist[i]); | |
fd1d0cb9 | 286 | |
1195bb6f | 287 | if (fgIsMC && src>=0) { |
288 | TString sName[6] = { "BBdiff", "BBsame", "DDdiff", "DDsame", "Resonance", "Uncorr" }; | |
289 | for (Int_t i=nHistos; i--;) ((TH1F*)list->FindObject(Form("h%s_%s_%s",sName[src].Data(),dimuName.Data(),tName[i].Data())))->Fill(dist[i]); | |
290 | } | |
fd1d0cb9 | 291 | |
4292b3b6 | 292 | return; |
293 | } |