1 /**************************************************************************
2 * Copyright(c) 1998-2006, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 /////////////////////////////////////////////////////////////
18 // class used to extract and store info at event level
20 // Author: X-M. Zhang, zhang@clermont.in2p3.fr
21 // zhangxm@iopp.ccnu.edu.cn
22 /////////////////////////////////////////////////////////////
29 #include "AliMuonInfoStoreRD.h"
30 #include "AliMuonInfoStoreMC.h"
31 #include "AliDimuInfoStoreRD.h"
32 #include "AliDimuInfoStoreMC.h"
33 #include "AliMuonsHFHeader.h"
38 ClassImp(AliMuonsHFHeader)
40 const TString AliMuonsHFHeader::fgkStdBranchName("MuEvsH");
41 Int_t AliMuonsHFHeader::fgAnaMode = 0;
42 Bool_t AliMuonsHFHeader::fgIsMC = kFALSE;
43 Double_t AliMuonsHFHeader::fgCuts[3] = { -999999., 999999., 999999.};
45 //_____________________________________________________________________________
46 AliMuonsHFHeader::AliMuonsHFHeader() :
53 // default constructor
55 for (Int_t i=3; i--;) fVtx[i] = 0.;
58 //_____________________________________________________________________________
59 AliMuonsHFHeader::AliMuonsHFHeader(const AliMuonsHFHeader &src) :
61 fVtxContrsN(src.fVtxContrsN),
62 fFiredTriggerClass(src.fFiredTriggerClass),
63 fCentrality(src.fCentrality)
68 for (Int_t i=3; i--;) fVtx[i] = src.fVtx[i];
71 //_____________________________________________________________________________
72 AliMuonsHFHeader& AliMuonsHFHeader::operator=(const AliMuonsHFHeader &src)
75 // assignment constructor
78 fVtxContrsN = src.fVtxContrsN;
79 fFiredTriggerClass = src.fFiredTriggerClass;
80 fCentrality = src.fCentrality;
81 for (Int_t i=3; i--;) fVtx[i] = src.fVtx[i];
86 //_____________________________________________________________________________
87 AliMuonsHFHeader::~AliMuonsHFHeader()
94 //_____________________________________________________________________________
95 void AliMuonsHFHeader::SetEvent(AliVVertex *vertex)
97 // extract event info from AOD event
100 fVtxContrsN = vertex->GetNContributors();
101 this->SetTitle(vertex->GetTitle());
105 //_____________________________________________________________________________
106 Bool_t AliMuonsHFHeader::EventSelection()
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;
115 //_____________________________________________________________________________
116 void AliMuonsHFHeader::CreateHistograms(TList *list)
118 // create output histos of muon analysis according to the analysis mode & MC flag
120 this->CreateHistosEvnH(list);
123 this->CreateHistosMuon(list);
125 TString sName[6] = { "Unidentified", "Hadron", "SecondaryMu", "PrimaryMu", "CharmMu", "BottomMu" };
126 for (Int_t i=AliMuonInfoStoreMC::SourcesN(); i--;) this->CreateHistosMuon(list, sName[i]);
131 this->CreateHistosDimu(list);
133 TString sName[6] = { "Uncorr", "Resonance", "DDsame", "DDdiff", "BBsame", "BBdiff" };
134 for (Int_t i=AliDimuInfoStoreMC::SourcesN(); i--;) this->CreateHistosDimu(list, sName[i]);
141 //_____________________________________________________________________________
142 void AliMuonsHFHeader::CreateHistosEvnH(TList *list)
144 // create histograms at event level
146 if (!list) list = new TList();
148 Bool_t oldStatus = TH1::AddDirectoryStatus();
149 TH1::AddDirectory(kFALSE);
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 };
158 for (Int_t i=0; i<nHistos; i++) {
159 histo = new TH1F(tname[i], tname[i].Data(), nbins[i], xlow[i], xup[i]);
160 histo->Sumw2(); list->Add(histo); histo = 0;
163 TH1::AddDirectory(oldStatus);
167 //_____________________________________________________________________________
168 void AliMuonsHFHeader::CreateHistosMuon(TList *list, TString sName)
170 // create histograms for single muon
172 if (!list) list = new TList();
174 Bool_t oldStatus = TH1::AddDirectoryStatus();
175 TH1::AddDirectory(kFALSE);
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. };
184 for (Int_t i=0; i<nHistos; i++) {
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;
190 TH1::AddDirectory(oldStatus);
194 //_____________________________________________________________________________
195 void AliMuonsHFHeader::CreateHistosDimu(TList *list, TString sName)
197 // create histograms for dimuon
199 if (!list) list = new TList();
201 Bool_t oldStatus = TH1::AddDirectoryStatus();
202 TH1::AddDirectory(kFALSE);
205 const Int_t nHistos = 3;
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" };
211 for (Int_t i=0; i<3; i++) {
212 for (Int_t j=0; j<nHistos; j++) {
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;
219 TH1::AddDirectory(oldStatus);
223 //_____________________________________________________________________________
224 void AliMuonsHFHeader::FillHistosEvnH(TList *list)
226 // fill histograms at event level according to event selection cuts
229 if (!this->EventSelection()) return;
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]);
238 //_____________________________________________________________________________
239 void AliMuonsHFHeader::FillHistosMuon(TList *list, AliMuonInfoStoreRD* const infoStore, Int_t src)
241 // fill histograms for single muon according to event & muon track selection cuts
244 if (!this->EventSelection()) return;
245 if (!infoStore->MuonSelection()) return;
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(),
253 infoStore->MatchTrigger(),
255 infoStore->RabsEnd(),
257 for (Int_t i=nHistos; i--;) ((TH1F*)list->FindObject(Form("h%s_%s","",tName[i].Data())))->Fill(dist[i]);
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]);
267 //_____________________________________________________________________________
268 void AliMuonsHFHeader::FillHistosDimu(TList *list, AliDimuInfoStoreRD* const infoStore, Int_t src)
270 // fill histograms for dimuon according to evnet & dimuon candidates selection cuts
273 if (!this->EventSelection()) return;
274 if (!infoStore->DimuSelection()) return;
276 TString dimuName = "DimuNN";
277 if (infoStore->Charge()==0) dimuName = "DimuNP";
278 else if (infoStore->Charge()>0) dimuName = "DimuPP";
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(),
285 for (Int_t i=nHistos; i--;) ((TH1F*)list->FindObject(Form("h%s_%s_%s","",dimuName.Data(),tName[i].Data())))->Fill(dist[i]);
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]);