21 #include "StMessMgr.h"
22 #include "StCentralityMaker/StCentrality.h"
23 #include "StCentralityMaker/StCentralityMaker.h"
24 #include "StCentralityMaker/StNegativeBinomial.h"
25 #include "StGlauberConstUtilities.h"
26 #include "StGlauberHistogramMaker.h"
27 #include "StGlauberCumulantHistogramMaker.h"
28 #include "StGlauberTree/StGlauberTree.h"
29 #include "StGlauberUtilities/StGlauberUtilities.h"
31 #include "StGlauberAnalysisMaker.h"
40 "default",
"small",
"large",
"smallXsec",
"largeXsec",
"gauss",
41 "smallNpp",
"largeNpp",
"smallTotal",
"largeTotal",
45 const TString StGlauberAnalysisMaker::mDescription[] = {
53 "small n_{pp}, large x",
54 "large n_{pp}, small x",
55 "-5\% total cross section",
56 "+5\% total cross section",
57 "+2(-2) sigma p0 (p1) parameter for re-weighting",
58 "-2(+2) sigma p0 (p1) parameter for re-weighting"
77 StGlauberAnalysisMaker::StGlauberAnalysisMaker(
const TString type,
const TString system,
const TString outputFileName,
78 const TString tableDir)
79 : mType(type), mOutputFile(0), mOutputFileName(outputFileName),
98 if ( gSystem->AccessPathName(tableDir.Data()) == 1 ){
99 Error(
"StGlauberAnalysisMaker",
"can't find directory %s", tableDir.Data());
112 if(mCentralityMaker)
delete mCentralityMaker ;
113 if(mGlauberTree)
delete mGlauberTree ;
117 Bool_t StGlauberAnalysisMaker::Init(
const TString tableDir)
120 if(mOutputFile)
return kTRUE ;
122 mOutputFile = TFile::Open(mOutputFileName,
"recreate");
123 if(!mOutputFile || !mOutputFile->IsOpen() || mOutputFile->IsZombie()){
124 Error(
"StGlauberAnalysisMaker::Init",
"can't open %s", mOutputFileName.Data());
127 LOG_INFO <<
"StGlauberAnalysisMaker::Init Open output ROOT file: " << mOutputFile->GetName() << endm;
129 const TString title(mType) ;
131 StGlauberConstUtilities::GetImpactParameterBin(), 0.0, StGlauberConstUtilities::GetImpactParameterMax())
135 StGlauberConstUtilities::GetNpartBin(), 0.0, StGlauberConstUtilities::GetNpartMax())
139 StGlauberConstUtilities::GetNcollBin(), 0.0, StGlauberConstUtilities::GetNcollMax())
143 StGlauberConstUtilities::GetMultiplicityBin(), 0.0, StGlauberConstUtilities::GetMultiplicityMax())
147 const Int_t areaBin = 100 ;
148 const Double_t areaMin = 0.0 ;
149 const Double_t areaMax = 50.0 ;
154 const Int_t eccBin = 100 ;
155 const Double_t eccMin = -1.0 ;
156 const Double_t eccMax = 1.0 ;
160 for(Int_t io=0; io<3; io++){
174 for(Int_t io=0; io<3; io++){
179 mOutputFile->GetList()->Sort() ;
189 LOG_INFO <<
"StGlauberAnalysisMaker::Make Set x-axis" << endm;
192 const UInt_t centId = 0 ;
197 const Double_t multiplicity = mGlauberTree->GetMultiplicity() ;
203 const Double_t reweighting = (mReweighting) ? mCentralityMaker->GetCentrality(centId)->
GetReweighting(multiplicity) : 1.0 ;
206 if( mReweighting && StGlauberUtilities::instance()->GetUniform() > reweighting)
return kFALSE ;
216 mImpactParameter->
SetXaxis(*mGlauberTree, *mCentralityMaker, mType);
217 mNpart ->
SetXaxis(*mGlauberTree, *mCentralityMaker, mType);
218 mNcoll ->
SetXaxis(*mGlauberTree, *mCentralityMaker, mType);
219 mMultiplicity ->
SetXaxis(*mGlauberTree, *mCentralityMaker, mType);
220 mAreaRP ->
SetXaxis(*mGlauberTree, *mCentralityMaker, mType);
221 mAreaPP ->
SetXaxis(*mGlauberTree, *mCentralityMaker, mType);
222 mEccRP ->
SetXaxis(*mGlauberTree, *mCentralityMaker, mType);
223 mEccRPM ->
SetXaxis(*mGlauberTree, *mCentralityMaker, mType);
225 for(Int_t io=0; io<3; io++){
228 mEccPP[io]->
SetXaxis(*mGlauberTree, *mCentralityMaker, mType);
229 mEccPPM[io]->
SetXaxis(*mGlauberTree, *mCentralityMaker, mType);
233 LOG_INFO <<
"StGlauberAnalysisMaker::Make Start fill: " << endm;
237 const Double_t weight = (mUnitWeight) ? 1.0
238 : static_cast<Double_t>( multiplicity ) ;
241 mImpactParameter->
Fill(mGlauberTree->GetB(), 1.0) ;
242 mNpart->
Fill(mGlauberTree->GetNpart(), 1.0) ;
243 mNcoll->
Fill(mGlauberTree->GetNcoll(), 1.0) ;
244 mMultiplicity->
Fill(multiplicity, 1.0) ;
247 LOG_INFO <<
"StGlauberAnalysisMaker::Make reweighting = " << reweighting
248 <<
", b = " << mGlauberTree->GetB() <<
" fm"
249 <<
", npart = " << mGlauberTree->GetNpart()
250 <<
", ncoll = " << mGlauberTree->GetNcoll()
251 <<
", mult = " << multiplicity
255 const Double_t areaRP = mGlauberTree->
GetSRP(0) ;
256 mAreaRP->
Fill(areaRP, weight) ;
258 const Double_t areaPP = mGlauberTree->
GetSPP(0) ;
259 if( areaPP > -9999. ) mAreaPP->
Fill(areaPP, weight) ;
264 const Double_t eccRP = mGlauberTree->GetEccRP2(0) ;
265 if( eccRP > -9999.) mEccRP->
Fill(eccRP, weight) ;
267 const Double_t eccRPM = mGlauberTree->GetEccRP2(2) ;
268 if( eccRP > -9999.) mEccRPM->
Fill(eccRPM, weight) ;
271 for(Int_t io=0; io<3; io++){
272 Double_t eccPP = -9999. ;
273 Double_t eccPPM = -9999. ;
274 if( io == 0 ){ eccPP = mGlauberTree->GetEccPP2(0) ; eccPPM = mGlauberTree->GetEccPP2(2) ; }
275 else if( io == 1 ){ eccPP = mGlauberTree->GetEccPP3(0) ; eccPPM = mGlauberTree->GetEccPP3(2) ; }
276 else if( io == 2 ){ eccPP = mGlauberTree->GetEccPP4(0) ; eccPPM = mGlauberTree->GetEccPP4(2) ; }
278 if( eccPP > -9999.) mEccPP[io]->
Fill(eccPP, weight) ;
279 if( eccPPM > -9999.) mEccPPM[io]->
Fill(eccPPM, weight) ;
288 mGlauberTree->
Open(inputFileName);
290 const Int_t nevents = mGlauberTree->
GetEntries() ;
291 LOG_INFO << Form(
"StGlauberAnalysisMaker::RunFile Process %10d events ...", nevents) << endm;
293 for(Int_t ievent=0; ievent<nevents; ievent++){
294 mGlauberTree->
Clear() ;
297 LOG_INFO <<
"StGlauberAnalysisMaker::RunFile Event# = " << ievent << endm;
303 const Bool_t isEventOk =
Make() ;
304 if(isEventOk) mNevents++;
308 if( ievent%1000 == 0 ){
309 LOG_INFO <<
"StGlauberAnalysisMaker::RunFile ";
310 LOG_INFO << Form(
"event %10d/%10d : (Npart, Ncoll, b(fm), mult, cent, {x^2}, {x}) = (%5d, %5d, %1.2f, %5d, %1.1f, %1.4f, %1.4f)",
311 mNevents, ievent, mGlauberTree->GetNpart(), mGlauberTree->GetNcoll(), mGlauberTree->GetB(),
312 mGlauberTree->GetMultiplicity(),
313 mCentralityMaker->GetCentrality()->
GetCentrality(mGlauberTree->GetMultiplicity()),
314 mGlauberTree->GetSumX2(0), mGlauberTree->GetSumX(0)
322 LOG_INFO <<
"StGlauberAnalysisMaker::RunFile Close input file" << endm;
324 mGlauberTree->
Close() ;
332 ifstream fin(inputFileList.Data());
334 Error(
"StGlauberAnalysisMaker::run",
"can't find %s", inputFileList.Data());
337 LOG_INFO <<
"StGlauberAnalysisMaker::Run Open file list: " << inputFileList.Data() << endm;
340 while ( fin >> file ){
356 mImpactParameter->
Finish(mType) ;
359 mMultiplicity->
Finish(mType) ;
364 for(Int_t io=0; io<3; io++){
365 mEccPP[io]->
Finish(mType) ;
366 mEccPPM[io]->
Finish(mType) ;
369 mOutputFile->GetList()->Sort() ;
372 LOG_INFO <<
"StGlauberAnalysisMaker::Finish Write/Close output file: " << mOutputFile->GetName() << endm;
373 mOutputFile->Write();
374 mOutputFile->Close();
382 mUnitWeight = kTRUE ;
383 LOG_INFO <<
"StGlauberAnalysisMaker::UnitWeightOn Use unit weight" << endm ;
389 mReweighting = kTRUE ;
390 LOG_INFO <<
"StGlauberAnalysisMaker::ReweightingOn Apply re-weighting correction" << endm;
406 for(Int_t io=0; io<3; io++){
411 LOG_INFO <<
"StGlauberAnalysisMaker::DebugOn Print debugging messages" << endm;
Int_t Clear()
Default destructor.
Double_t GetSPP(const UInt_t id) const
Int_t GetEntries() const
Close ROOT file.
Bool_t Make()
Default destructor.
Bool_t Run(const TString inputFileList)
Loop over all events in one file.
void SetTableDirectory(const TString directory)
Default destructor.
Bool_t RunFile(const TString inputFileName="icmaker.root")
Make one event.
void UnitWeightOn()
Finish analysis.
Int_t GetEntry(const Int_t ievent)
Get entries.
void DebugOn()
Apply re-weighting correction.
void SetXaxis(const StGlauberTree &tree, const StCentralityMaker ¢ralityMaker, const TString type)
Initialize histograms.
virtual void Fill(const Double_t y, const Double_t weight)
Set X-axis variable.
Int_t Close()
Fill header tree.
void DebugOn()
Get histogram name.
void Fill(const Double_t y, const Double_t weight)
Set X-axis variable.
Double_t GetReweighting(const UInt_t multiplicity) const
Get trigger bias.
Bool_t Finish()
Loop over all file lists.
virtual void Finish(const TString type)
Fill histogram 'y' value with 'weight'.
void Finish(const TString type)
Double_t GetSRP(const UInt_t id) const
Double_t GetCentrality(const UInt_t multiplicity, const UInt_t mode=0) const
Print help messages.
Int_t Open(const TString filename)
Clear data members.
virtual ~StGlauberAnalysisMaker()
Default constructor.
void ReweightingOn()
Use unit weight instead of multiplicity weight.