Changes for report #76227: ZDC TDC info in ESD and physics selection (for release...
[u/mrichter/AliRoot.git] / ZDC / AliZDCRecoParamPbPb.cxx
CommitLineData
7bff3766 1/**************************************************************************
2 * Copyright(c) 2007-2009, 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 with ZDC reconstruction parameters //
19// Origin: Chiara.Oppedisano@to.infn.it //
20// //
21///////////////////////////////////////////////////////////////////////////////
22
73bc3a3f 23#include <TFile.h>
24#include <TTree.h>
25#include <TH2F.h>
26#include <TH1D.h>
7bff3766 27
7bff3766 28#include "AliZDCRecoParam.h"
29#include "AliZDCRecoParamPbPb.h"
30
31ClassImp(AliZDCRecoParamPbPb)
32
33//_____________________________________________________________________________
34AliZDCRecoParamPbPb::AliZDCRecoParamPbPb() :
35 AliZDCRecoParam(),
73bc3a3f 36 fhNpartDist(0x0),
37 fhbDist(0x0),
38 fClkCenter(0)
7bff3766 39{
40 //
41 //Default constructor
42}
43//_____________________________________________________________________________
0d579f58 44AliZDCRecoParamPbPb::AliZDCRecoParamPbPb(TH1D *hNpart, TH1D *hb, Float_t clkCent) :
73bc3a3f 45 AliZDCRecoParam(),
73bc3a3f 46 fhNpartDist(hNpart),
47 fhbDist(hb),
48 fClkCenter(clkCent)
49{
50 //
51 //Standard constructor
52}
7bff3766 53
73bc3a3f 54//______________________________________________________________________________
55AliZDCRecoParamPbPb::AliZDCRecoParamPbPb(const AliZDCRecoParamPbPb &oldrecopar) :
56 AliZDCRecoParam(),
73bc3a3f 57 fhNpartDist(0x0),
58 fhbDist(0x0),
59 fClkCenter(oldrecopar.fClkCenter)
60{
61 //Copy constructor
73bc3a3f 62 if(oldrecopar.fhNpartDist){
63 fhNpartDist = new TH1D(*oldrecopar.fhNpartDist);
64 fhNpartDist->SetDirectory(0);
65 }
66 if(oldrecopar.fhbDist){
67 fhbDist = new TH1D(*oldrecopar.fhbDist);
68 fhbDist->SetDirectory(0);
69 }
70}
db0907f4 71
72//_____________________________________________________________________________
73AliZDCRecoParamPbPb &AliZDCRecoParamPbPb::operator =(const AliZDCRecoParamPbPb &recpar)
74{
213a7d34 75 // Equal operator.
76 this->~AliZDCRecoParamPbPb();
77 new(this) AliZDCRecoParamPbPb(recpar);
78 return *this;
79
db0907f4 80}
73bc3a3f 81
82//_____________________________________________________________________________
83AliZDCRecoParamPbPb::~AliZDCRecoParamPbPb()
84{
85 // destructor
7bff3766 86
73bc3a3f 87 if(fhNpartDist) delete fhNpartDist;
88 if(fhbDist) delete fhbDist;
7bff3766 89}
90
91//_____________________________________________________________________________
2d9c70ab 92void AliZDCRecoParamPbPb::SetGlauberMCDist(Float_t beamEnergy)
7bff3766 93{
73bc3a3f 94 // Setting Glauber MC distributions
95 // from histos file stored in $ALICE_ROOT/ZDC
2d9c70ab 96 TH1::AddDirectory(0);
97 TH2::AddDirectory(0);
98
99 TFile *fileGlauberMC = TFile::Open("$ALICE_ROOT/ZDC/GlauberMCDist.root");
100 if(!fileGlauberMC) {
ee4788fe 101 AliError((" Opening file $ALICE_ROOT/ZDC/GlauberMCDist.root failed\n"));
2d9c70ab 102 return;
103 }
104
105 Float_t sqrtS = 2*beamEnergy;
106 //
107 if(TMath::Abs(sqrtS-5500) < 100.){
108 AliDebug(2, " ZDC -> Looking for energy5500 in file $ALICE_ROOT/ZDC/GlauberMCDist.root");
109 fileGlauberMC->cd("energy5500");
2d9c70ab 110 fileGlauberMC->GetObject("energy5500/hbGlauber;1", fhbDist);
111 if(!fhbDist) AliError(" PROBLEM!!! Can't get Glauber MC b distribution from file GlauberMCDist.root\n");
ee4788fe 112 fileGlauberMC->GetObject("energy5500/hNpartGlauber;1", fhNpartDist);
113 if(!fhNpartDist) AliError(" PROBLEM!!! Can't get Glauber MC Npart distribution from file GlauberMCDist.root\n");
2d9c70ab 114 }
115 else if(TMath::Abs(sqrtS-2760) < 100.){
116 AliDebug(2, " ZDC -> Looking for energy2760 in file $ALICE_ROOT/ZDC/GlauberMCDist.root");
117 fileGlauberMC->cd("energy2760");
2d9c70ab 118 fileGlauberMC->GetObject("energy2760/hbGlauber;1", fhbDist);
119 if(!fhbDist) AliError(" PROBLEM!!! Can't get Glauber MC b distribution from file GlauberMCDist.root\n");
ee4788fe 120 fileGlauberMC->GetObject("energy2760/hNpartGlauber;1", fhNpartDist);
121 if(!fhNpartDist) AliError(" PROBLEM!!! Can't get Glauber MC Npart distribution from file GlauberMCDist.root\n");
2d9c70ab 122 }
123 else AliError(Form(" No AliZDCRecoParam provided for Pb-Pb @ sqrt(s) = %1.0f GeV\n", sqrtS));
7bff3766 124 //
73bc3a3f 125 fhNpartDist->SetDirectory(0);
73bc3a3f 126 fhbDist->SetDirectory(0);
7bff3766 127
2d9c70ab 128 fileGlauberMC->Close();
7bff3766 129}
1de9cc13 130
131//_____________________________________________________________________________
2d9c70ab 132AliZDCRecoParamPbPb *AliZDCRecoParamPbPb::GetHighFluxParam(Float_t beamEnergy)
1de9cc13 133{
134 // Create high flux reco parameter
135 TH1::AddDirectory(0);
136 TH2::AddDirectory(0);
137 //
2d9c70ab 138 TFile *fileGlauberMC = TFile::Open("$ALICE_ROOT/ZDC/GlauberMCDist.root");
139 if(!fileGlauberMC) printf(" AliZDCRecoParamPbPb::GetHighFluxParam() ERROR opening file $ALICE_ROOT/ZDC/SpectatorSignal.root\n");
140
bb98da29 141 Float_t sqrtS = 2*beamEnergy;
142
82dffa48 143 TH1D *hNpartDist=0x0, *hbDist=0x0;
bb98da29 144 if(TMath::Abs(sqrtS-5500)<100.){
2d9c70ab 145 fileGlauberMC->cd("energy5500");
146 fileGlauberMC->GetObject("energy5500/hNpartGlauber;1", hNpartDist);
147 if(!hNpartDist) printf(" AliZDCRecoParamPbPb::GetHighFluxParam() PROBLEM!!! Can't get Glauber MC Npart distribution from file GlauberMCDist.root\n");
148 fileGlauberMC->GetObject("energy5500/hbGlauber;1", hbDist);
149 if(!hbDist) printf(" AliZDCRecoParamPbPb::GetHighFluxParam() PROBLEM!!! Can't get Glauber MC b distribution from file GlauberMCDist.root\n");
150 }
bb98da29 151 else if(TMath::Abs(sqrtS-2760)<100.){
2d9c70ab 152 fileGlauberMC->cd("energy2760");
153 fileGlauberMC->GetObject("energy2760/hNpartGlauber;1", hNpartDist);
154 if(!hNpartDist) printf(" PROBLEM!!! Can't get Glauber MC Npart distribution from file GlauberMCDist.root\n");
155 fileGlauberMC->GetObject("energy2760/hbGlauber;1", hbDist);
156 if(!hbDist) printf(" AliZDCRecoParamPbPb::GetHighFluxParam() PROBLEM!!! Can't get Glauber MC b distribution from file GlauberMCDist.root\n");
157 }
bb98da29 158 else printf(" No AliZDCRecoParam provided for Pb-Pb @ sqrt(s) = %1.0f GeV\n", sqrtS);
1de9cc13 159 //
2d9c70ab 160 hNpartDist->SetDirectory(0);
1de9cc13 161 hbDist->SetDirectory(0);
2d9c70ab 162
163 AliZDCRecoParamPbPb* zdcRecoParam = new AliZDCRecoParamPbPb(hNpartDist, hbDist, 0.1);
1de9cc13 164 //
2d9c70ab 165 fileGlauberMC->Close();
1de9cc13 166
167 return zdcRecoParam;
168
169}