]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/muon/AliMuonsHFHeader.cxx
Coverity fix (an obsolete constructor removed)
[u/mrichter/AliRoot.git] / PWG3 / muon / AliMuonsHFHeader.cxx
CommitLineData
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
27de2dfb 16/* $Id$ */
17
fd1d0cb9 18/////////////////////////////////////////////////////////////
19//
20// class used to extract and store info at event level
21//
22// Author: X-M. Zhang, zhang@clermont.in2p3.fr
23// zhangxm@iopp.ccnu.edu.cn
24/////////////////////////////////////////////////////////////
25
4292b3b6 26#include <TMath.h>
fd1d0cb9 27#include <TH1.h>
6709e09d 28#include <TH1D.h>
fd1d0cb9 29#include <TList.h>
1195bb6f 30
9bcac085 31#include "AliVEvent.h"
fd1d0cb9 32#include "AliMuonInfoStoreRD.h"
33#include "AliMuonInfoStoreMC.h"
34#include "AliDimuInfoStoreRD.h"
35#include "AliDimuInfoStoreMC.h"
4292b3b6 36#include "AliMuonsHFHeader.h"
37
fd1d0cb9 38class TNamed;
6709e09d 39class AliVVertex;
fd1d0cb9 40
4292b3b6 41ClassImp(AliMuonsHFHeader)
42
fd1d0cb9 43const TString AliMuonsHFHeader::fgkStdBranchName("MuEvsH");
1195bb6f 44Int_t AliMuonsHFHeader::fgAnaMode = 0;
45Bool_t AliMuonsHFHeader::fgIsMC = kFALSE;
9bcac085 46Double_t AliMuonsHFHeader::fgCuts[5] = { -999999., 999999., 999999., -999999., 999999. };
fd1d0cb9 47
4292b3b6 48//_____________________________________________________________________________
49AliMuonsHFHeader::AliMuonsHFHeader() :
50TNamed(),
9bcac085 51fSelMask(AliVEvent::kAny),
b46f66fc 52fIsMB(kFALSE),
53fIsMU(kFALSE),
1195bb6f 54fVtxContrsN(0),
55fFiredTriggerClass(),
fd1d0cb9 56fCentrality(0.)
4292b3b6 57{
58 //
59 // default constructor
60 //
fd1d0cb9 61 for (Int_t i=3; i--;) fVtx[i] = 0.;
fd1d0cb9 62}
63
64//_____________________________________________________________________________
65AliMuonsHFHeader::AliMuonsHFHeader(const AliMuonsHFHeader &src) :
66TNamed(),
9bcac085 67fSelMask(src.fSelMask),
b46f66fc 68fIsMB(src.fIsMB),
69fIsMU(src.fIsMU),
1195bb6f 70fVtxContrsN(src.fVtxContrsN),
71fFiredTriggerClass(src.fFiredTriggerClass),
fd1d0cb9 72fCentrality(src.fCentrality)
73{
74 //
75 // copy constructor
76 //
1195bb6f 77 for (Int_t i=3; i--;) fVtx[i] = src.fVtx[i];
fd1d0cb9 78}
79
80//_____________________________________________________________________________
81AliMuonsHFHeader& AliMuonsHFHeader::operator=(const AliMuonsHFHeader &src)
82{
83 //
84 // assignment constructor
85 //
1195bb6f 86
9bcac085 87 fSelMask = src.fSelMask;
b46f66fc 88 fIsMB = src.fIsMB;
89 fIsMU = src.fIsMU;
1195bb6f 90 fVtxContrsN = src.fVtxContrsN;
91 fFiredTriggerClass = src.fFiredTriggerClass;
92 fCentrality = src.fCentrality;
93 for (Int_t i=3; i--;) fVtx[i] = src.fVtx[i];
fd1d0cb9 94
95 return *this;
4292b3b6 96}
97
98//_____________________________________________________________________________
99AliMuonsHFHeader::~AliMuonsHFHeader()
100{
101 //
102 // default destructor
103 //
104}
105
106//_____________________________________________________________________________
9bcac085 107void AliMuonsHFHeader::SetVertex(AliVVertex *vertex)
4292b3b6 108{
fd1d0cb9 109 // extract event info from AOD event
110
fd1d0cb9 111 vertex->GetXYZ(fVtx);
1195bb6f 112 fVtxContrsN = vertex->GetNContributors();
fd1d0cb9 113 this->SetTitle(vertex->GetTitle());
fd1d0cb9 114 return;
115}
116
b46f66fc 117void AliMuonsHFHeader::SetFiredTriggerClass(TString trigger)
118{
119 fFiredTriggerClass = trigger;
9bcac085 120 fIsMB=(fFiredTriggerClass.Contains("CINT1B-ABCE-NOPF-ALL") || // p-p min. bias trigger before Aug/2010
121 fFiredTriggerClass.Contains("CINT1-B-NOPF-ALLNOTRD") || // p-p min. bias trigger from Aug/2010
122 fFiredTriggerClass.Contains("CMBS2A-B-NOPF-ALL") || // Pb-Pb min. bias trigger 2-out-of-3
123 fFiredTriggerClass.Contains("CMBS2C-B-NOPF-ALL") || // Pb-Pb min. bias trigger 2-out-of-3
124 fFiredTriggerClass.Contains("CMBAC-B-NOPF-ALL") || // Pb-Pb min. bias trigger 2-out-of-3
125 fFiredTriggerClass.Contains("CMBACS2-B-NOPF-ALL") || // Pb-Pb min. bias trigger 3-out-of-3 (early)
126 fFiredTriggerClass.Contains("CMBACS2-B-NOPF-ALLNOTRD")); // Pb-Pb min. bias trigger 3-out-of-3 (late 2010)
127 fIsMU=(fFiredTriggerClass.Contains("CMUS1B-ABCE-NOPF-MUON") || // p-p MUON trigger before Aug/2010
128 fFiredTriggerClass.Contains("CMUS1-B-NOPF-ALLNOTRD")); // p-p MUON trigger from Aug/2010
b46f66fc 129 return;
130}
131
fd1d0cb9 132//_____________________________________________________________________________
6709e09d 133Bool_t AliMuonsHFHeader::IsSelected()
fd1d0cb9 134{
1195bb6f 135 // select event according to the event selection cuts
9bcac085 136 if (this->VtxContrsN()<fgCuts[0]) return kFALSE;
137 if (TMath::Abs(this->Vz())>fgCuts[1]) return kFALSE;
138 if (this->Vt()>fgCuts[2]) return kFALSE;
139
140 // centrality selection
141 Float_t centr = this->Centrality();
142 if (centr<fgCuts[3] || centr>fgCuts[4]) return kFALSE;
1195bb6f 143 return kTRUE;
fd1d0cb9 144}
145
146//_____________________________________________________________________________
1195bb6f 147void AliMuonsHFHeader::CreateHistograms(TList *list)
fd1d0cb9 148{
1195bb6f 149 // create output histos of muon analysis according to the analysis mode & MC flag
fd1d0cb9 150
b46f66fc 151 if (fgIsMC) {
152 this->CreateHistosEvnH(list);
153 if (fgAnaMode!=2) {
154 TString sName[7] = { "Unidentified", "Hadron", "SecondaryMu", "PrimaryMu", "CharmMu", "BottomMu", "" };
155 for (Int_t i=7; i--;) this->CreateHistosMuon(list, sName[i]);
1195bb6f 156 }
b46f66fc 157 if (fgAnaMode!=1) {
158 TString sName[7] = { "Uncorr", "Resonance", "DDsame", "DDdiff", "BBsame", "BBdiff", "" };
159 for (Int_t i=7; i--;) this->CreateHistosDimu(list, sName[i]);
1195bb6f 160 }
b46f66fc 161 return;
fd1d0cb9 162 }
1195bb6f 163
9bcac085 164 this->CreateHistosEvnH(list,"MB"); this->CreateHistosEvnH(list,"MU");
165 if (fgAnaMode!=2) { this->CreateHistosMuon(list,"MB"); this->CreateHistosMuon(list,"MU"); }
166 if (fgAnaMode!=1) { this->CreateHistosDimu(list,"MB"); this->CreateHistosDimu(list,"MU"); }
fd1d0cb9 167 return;
168}
169
170//_____________________________________________________________________________
b46f66fc 171void AliMuonsHFHeader::CreateHistosEvnH(TList *list, TString sName)
fd1d0cb9 172{
173 // create histograms at event level
174
175 if (!list) list = new TList();
176 list->SetOwner();
177 Bool_t oldStatus = TH1::AddDirectoryStatus();
178 TH1::AddDirectory(kFALSE);
179
9bcac085 180 const Int_t nhs = 3;
181 TString tName[nhs] = { "Vz", "Vt", "VtxNcontr" };
182 Int_t nbins[nhs] = { 800 , 40 , 202 };
183 Double_t xlow[nhs] = { -40., 0., -2.5 };
184 Double_t xup[nhs] = { 40., 4., 199.5 };
fd1d0cb9 185
6709e09d 186 TH1D *histo = 0;
9bcac085 187 for (Int_t i=0; i<nhs; i++) {
b46f66fc 188 char *hName = Form("h%s_%s", sName.Data(), tName[i].Data());
189 histo = new TH1D(hName, hName, nbins[i], xlow[i], xup[i]);
1195bb6f 190 histo->Sumw2(); list->Add(histo); histo = 0;
fd1d0cb9 191 }
192
193 TH1::AddDirectory(oldStatus);
194 return;
195}
196
197//_____________________________________________________________________________
1195bb6f 198void AliMuonsHFHeader::CreateHistosMuon(TList *list, TString sName)
fd1d0cb9 199{
200 // create histograms for single muon
201
202 if (!list) list = new TList();
203 list->SetOwner();
204 Bool_t oldStatus = TH1::AddDirectoryStatus();
205 TH1::AddDirectory(kFALSE);
b46f66fc 206
9bcac085 207 const Int_t nhs = 7;
208 TString tName[nhs] = { "P", "Pt", "Eta", "DCA", "TrM", "Charge", "Rabs" };
209 Int_t nbins[nhs] = { 1500 , 300 , 15 , 1000 , 4 , 3 , 48 };
210 Double_t xlow[nhs] = { 0., 0., -4.0, 0., -0.5, -1.5, 17.6 };
211 Double_t xup[nhs] = { 150., 30., -2.5, 500., 3.5, 1.5, 80.0 };
fd1d0cb9 212
6709e09d 213 TH1D *histo = 0;
9bcac085 214 for (Int_t i=0; i<nhs; i++) {
1195bb6f 215 char *hName = Form("h%s_%s", sName.Data(), tName[i].Data());
6709e09d 216 histo = new TH1D(hName, hName, nbins[i], xlow[i], xup[i]);
1195bb6f 217 histo->Sumw2(); list->Add(histo); histo = 0;
fd1d0cb9 218 }
219
220 TH1::AddDirectory(oldStatus);
221 return;
222}
223
224//_____________________________________________________________________________
1195bb6f 225void AliMuonsHFHeader::CreateHistosDimu(TList *list, TString sName)
fd1d0cb9 226{
227 // create histograms for dimuon
228
229 if (!list) list = new TList();
230 list->SetOwner();
231 Bool_t oldStatus = TH1::AddDirectoryStatus();
232 TH1::AddDirectory(kFALSE);
233
6709e09d 234 TH1D *histo = 0;
9bcac085 235 const Int_t nhs = 3;
236 TString tName[nhs] = { "P", "Pt", "InvM" };
237 Int_t nbins[nhs] = { 1500 , 300 , 300 };
238 Double_t xlow[nhs] = { 0., 0., 0. };
239 Double_t xup[nhs] = { 150., 30., 30. };
1195bb6f 240 TString dimuName[3] = { "DimuNN", "DimuNP", "DimuPP" };
fd1d0cb9 241 for (Int_t i=0; i<3; i++) {
9bcac085 242 for (Int_t j=0; j<nhs; j++) {
1195bb6f 243 char *hName = Form("h%s_%s_%s", sName.Data(), dimuName[i].Data(), tName[j].Data());
6709e09d 244 histo = new TH1D(hName, hName, nbins[j], xlow[j], xup[j]);
1195bb6f 245 histo->Sumw2(); list->Add(histo); histo = 0;
fd1d0cb9 246 }
247 }
248
249 TH1::AddDirectory(oldStatus);
250 return;
251}
252
253//_____________________________________________________________________________
1195bb6f 254void AliMuonsHFHeader::FillHistosEvnH(TList *list)
fd1d0cb9 255{
256 // fill histograms at event level according to event selection cuts
257
1195bb6f 258 if (!list) return;
6709e09d 259 if (!this->IsSelected()) return;
fd1d0cb9 260
9bcac085 261 const Int_t nhs = 3;
262 TString tName[nhs] = { "Vz", "Vt", "VtxNcontr" };
263 Double_t dist[nhs] = { this->Vz(), this->Vt(), this->VtxContrsN() };
264 if (fgIsMC && (fSelMask & AliVEvent::kAny)) {
265 for (Int_t i=nhs; i--;) ((TH1D*)list->FindObject(Form("h_%s",tName[i].Data())))->Fill(dist[i]);
b46f66fc 266 } else {
9bcac085 267 if (fIsMB && (fSelMask & AliVEvent::kMB)) { for (Int_t i=nhs; i--;) ((TH1D*)list->FindObject(Form("h%s_%s","MB",tName[i].Data())))->Fill(dist[i]); }
268 if (fIsMU && (fSelMask & AliVEvent::kMUON)) { for (Int_t i=nhs; i--;) ((TH1D*)list->FindObject(Form("h%s_%s","MU",tName[i].Data())))->Fill(dist[i]); }
b46f66fc 269 }
fd1d0cb9 270 return;
271}
272
273//_____________________________________________________________________________
b46f66fc 274void AliMuonsHFHeader::FillHistosMuon(TList *list, AliMuonInfoStoreRD* const infoStore, Int_t s)
fd1d0cb9 275{
276 // fill histograms for single muon according to event & muon track selection cuts
277
6709e09d 278 if (!list) return;
279 if (!this->IsSelected()) return;
280 if (!infoStore->IsSelected()) return;
1195bb6f 281
9bcac085 282 const Int_t nhs = 7;
283 TString tName[nhs] = { "P", "Pt", "Eta", "DCA", "TrM", "Charge", "Rabs" };
284 Double_t dist[nhs] = { infoStore->Momentum().Mag(),
1195bb6f 285 infoStore->Momentum().Pt(),
286 infoStore->Momentum().Eta(),
287 infoStore->DCA(),
288 infoStore->MatchTrigger(),
289 infoStore->Charge(),
b46f66fc 290 infoStore->RabsEnd() };
291
9bcac085 292 if (fgIsMC && (fSelMask & AliVEvent::kAny)) {
b46f66fc 293 TString sName[7] = { "BottomMu", "CharmMu", "PrimaryMu", "SecondaryMu", "Hadron", "Unidentified", "" };
9bcac085 294 for (Int_t i=nhs; i--;) ((TH1D*)list->FindObject(Form("h%s_%s",sName[6].Data(),tName[i].Data())))->Fill(dist[i]);
295 for (Int_t i=nhs; i--;) ((TH1D*)list->FindObject(Form("h%s_%s",sName[s].Data(),tName[i].Data())))->Fill(dist[i]);
b46f66fc 296 } else {
9bcac085 297 if (fIsMB && (fSelMask & AliVEvent::kMB)) { for (Int_t i=nhs; i--;) ((TH1D*)list->FindObject(Form("h%s_%s","MB",tName[i].Data())))->Fill(dist[i]); }
298 if (fIsMU && (fSelMask & AliVEvent::kMUON)) { for (Int_t i=nhs; i--;) ((TH1D*)list->FindObject(Form("h%s_%s","MU",tName[i].Data())))->Fill(dist[i]); }
1195bb6f 299 }
fd1d0cb9 300
fd1d0cb9 301 return;
302}
303
304//_____________________________________________________________________________
b46f66fc 305void AliMuonsHFHeader::FillHistosDimu(TList *list, AliDimuInfoStoreRD* const infoStore, Int_t s)
fd1d0cb9 306{
307 // fill histograms for dimuon according to evnet & dimuon candidates selection cuts
308
6709e09d 309 if (!list) return;
310 if (!this->IsSelected()) return;
311 if (!infoStore->IsSelected()) return;
fd1d0cb9 312
1195bb6f 313 TString dimuName = "DimuNN";
314 if (infoStore->Charge()==0) dimuName = "DimuNP";
315 else if (infoStore->Charge()>0) dimuName = "DimuPP";
fd1d0cb9 316
9bcac085 317 const Int_t nhs = 3;
318 TString tName[nhs] = { "P", "Pt", "InvM" };
319 Double_t dist[nhs] = { infoStore->Momentum().Mag(),
1195bb6f 320 infoStore->Momentum().Pt(),
321 infoStore->InvM() };
fd1d0cb9 322
9bcac085 323 if (fgIsMC && (fSelMask & AliVEvent::kAny)) {
b46f66fc 324 TString sName[7] = { "BBdiff", "BBsame", "DDdiff", "DDsame", "Resonance", "Uncorr", "" };
9bcac085 325 for (Int_t i=nhs; i--;) ((TH1D*)list->FindObject(Form("h%s_%s_%s",sName[6].Data(),dimuName.Data(),tName[i].Data())))->Fill(dist[i]);
326 for (Int_t i=nhs; i--;) ((TH1D*)list->FindObject(Form("h%s_%s_%s",sName[s].Data(),dimuName.Data(),tName[i].Data())))->Fill(dist[i]);
b46f66fc 327 } else {
9bcac085 328 if (fIsMB && (fSelMask & AliVEvent::kMB)) {
329 for (Int_t i=nhs; i--;) ((TH1D*)list->FindObject(Form("h%s_%s_%s","MB",dimuName.Data(),tName[i].Data())))->Fill(dist[i]);
330 }
331 if (fIsMU && (fSelMask & AliVEvent::kMUON)) {
332 for (Int_t i=nhs; i--;) ((TH1D*)list->FindObject(Form("h%s_%s_%s","MU",dimuName.Data(),tName[i].Data())))->Fill(dist[i]);
333 }
1195bb6f 334 }
fd1d0cb9 335
4292b3b6 336 return;
337}