diff --git a/StRoot/PWGTools/BadRunQA/README.md b/StRoot/PWGTools/BadRunQA/README.md new file mode 100644 index 00000000000..86435a1d85e --- /dev/null +++ b/StRoot/PWGTools/BadRunQA/README.md @@ -0,0 +1 @@ +This directory contains codes for initial data QA. \ No newline at end of file diff --git a/StRoot/PWGTools/CentralityCalibration/Centrality/GetCentrality.C b/StRoot/PWGTools/CentralityCalibration/Centrality/GetCentrality.C new file mode 100644 index 00000000000..1bff7fab769 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Centrality/GetCentrality.C @@ -0,0 +1,109 @@ +#include +#include "TMath.h" +#include "TRandom3.h" +#include "TCanvas.h" +#include "TF1.h" +#include "TH1D.h" +#include "TH1D.h" +#include "TGraph.h" +#include "TAxis.h" +#include "TGraph2D.h" +#include "TGraphErrors.h" +#include "TH1F.h" +#include "TFile.h" +#include "TNtuple.h" +#include +#include + +void GetCentrality() { + TFile *f0 = new TFile("glauberfit.root"); + TH1D *sim = (TH1D *)f0->Get("hRefMultSim"); + TH1D *data = (TH1D *)f0->Get("hRefMultCorr"); + //sim->Scale(1.0/sim->Integral(50,500)); + //data->Scale(1.0/data->Integral(50,500)); + + + int centralitybin[16][2]; + double integral = sim->Integral(); + for(int cent=0; cent<16; cent++){ + double distance = 1000.0; //Initialize the distance from 5% cut to be large + double fraction = 0.05*((double)cent+1.0); + //For the most central bins, integrate the data + if(cent<4){ + for(int i=0; iGetNbinsX(); i++){ + double thisfraction = (data->Integral(i,500))/(integral); + double thisdistance = TMath::Abs(thisfraction - fraction);//This is how far the current integral + // is from the desired fraction. + if(thisdistance>distance){ //If the distance from the fraction increased, then the previous bin was your desired cut + if(cent==0){centralitybin[0][0]=500; centralitybin[0][1]=i-1;centralitybin[1][0]=i-2;} + else{centralitybin[cent][1]=i-1;centralitybin[cent+1][0]=i-2;} + break; + } + else{distance=thisdistance;} + } + } + //For more peripheral bins, integrate the simulated distribution + else{ + int newmaxbin = centralitybin[3][1]-1;//Integrate the glauber up to this bin + double zeroToTwentyIntegral = data->Integral(newmaxbin+1,500); + for(int i=0; iIntegral(i,newmaxbin)+zeroToTwentyIntegral)/(integral); + double thisdistance = TMath::Abs(thisfraction - fraction); + if(thisdistance>distance){ + if(cent==15){centralitybin[15][1]=i-1;} + else{centralitybin[cent][1]=i-1;centralitybin[cent+1][0]=i-2;} + break; + } + else{distance=thisdistance;} + } + } + } + + //Print out all useful imformation + cout<<"******* 16 Bins *******"<GetXaxis()->GetBinCenter(centralitybin[i][0])+0.5<GetXaxis()->GetBinCenter(centralitybin[i][1])-0.5<Integral(centralitybin[i][1],centralitybin[i][0]))/(sim->Integral())<Integral(centralitybin[i][1],centralitybin[i][0]))/(sim->Integral())<Integral(centralitybin[i][1],500))/(sim->Integral())<Integral(centralitybin[i][1],centralitybin[3][1]-1)+data->Integral(centralitybin[3][1],500))/(sim->Integral())<Integral(centralitybin[i][1],centralitybin[i][0]))/(sim->Integral(centralitybin[i][1],centralitybin[i][0])); + if(thiseff>1.0) thiseff=1.0; + if(i<4)cout<<1<"<GetBinContent(centralitybin[i][1],centralitybin[i][0]))/(sim->Integral(centralitybin[i][1],centralitybin[i][0])); + if(thiseff>1.0) thiseff=1.0; + if(i<4)cout<<1<GetXaxis()->GetBinCenter(centralitybin[i][0])+0.5<GetXaxis()->GetBinCenter(centralitybin[2*i-1][0])+0.5<GetXaxis()->GetBinCenter(centralitybin[i][1])-0.5<GetXaxis()->GetBinCenter(centralitybin[2*i-1][1])-0.5< + +ClassImp(StCentralityAnalyzer) + + +//________________ +StCentralityAnalyzer::StCentralityAnalyzer(StPicoDstReader *reader, + const Char_t* oFileName): +mOutFileName(oFileName), mOutFile(nullptr), mReader(reader), mDst(nullptr), + mTriggerIdCollection(), mEventsPassed(0), mDebug(kFALSE), + hRefMult(nullptr), hGRefMult(nullptr), hPrimVertNum(nullptr), hPrimVertZ(nullptr), + hZdcAdcEast(nullptr), hZdcAdcWest(nullptr), hZdcAdcSum(nullptr), hZdcCoincidenceRate(nullptr), + hEpdAdcEast(nullptr), hEpdAdcWest(nullptr), hEpdAdcSum(nullptr), + hPrimVertXvsY(nullptr), hPrimVertVpdVzDiff(nullptr), hRefMultVsTofTrayMult(nullptr), + hGRefMultVsTofTrayMult(nullptr), hRefMultVsTofMatched(nullptr), hRefMultVsBemcMatch(nullptr), + hRefMultVsRunNumber(nullptr), hGRefMultVsRunNumber(nullptr), hTofTrayMultVsRunNumber(nullptr), + hRefMultVsZdcCoincidenceRate(nullptr),hZdcAdcSumVsRunNumber(nullptr), hPrimTrackPtVsRunNumber(nullptr), + hPrimTrackNHitsVsRunNumber(nullptr), hPrimTrackDedxVsRunNumber(nullptr), + hGlobTrackPtVsRunNumber(nullptr), hGlobTrackNHitsVsRunNumber(nullptr), + hGlobTrackDedxVsRunNumber(nullptr), hAvgRefMultVsZdcCoincidenceRate(nullptr) { + + mVtxZ[0] = -70.; mVtxZ[1] = 70.; + mVtxR[0] = 0.; mVtxR[1] = 2.; + mVtxXShift = 0.; mVtxYShift = 0.; + mVpdVzDiff[0] = -5.; mVpdVzDiff[1] = 5.; + mRefMult[0] = 0.; mRefMult[1] = 1000.; + // Next numbers are for isobar runs + mRunIdBins = 57990; + mRunIdRange[0] = 19071030; mRunIdRange[1] = 19129020; + mMom[0] = 0.1; mMom[1] = 1e9; + mEta[0] = -1.; mEta[1] = 1.; + mNHits[0] = 15; mNHits[1] = 100; + mNHitsRatio[0] = 0.; mNHitsRatio[1] = 1.1; +} + +//________________ +StCentralityAnalyzer::~StCentralityAnalyzer() { + /* empty */ +} + +//________________ +Int_t StCentralityAnalyzer::Init() { + if ( !mReader ) { + std::cout << "No StPicoDstReader has been provided" << std::endl; + return kStErr; + } + + mDst = mReader->picoDst(); + if ( !mDst ) { + std::cout << "No StPicoDst has been retrieved from reader" << std::endl; + return kStErr; + } + + mOutFile = new TFile(mOutFileName, "recreate"); + createHistograms(); + + return StMaker::Init(); +} + +//________________ +Int_t StCentralityAnalyzer::Finish() { + if( mOutFile ) { + std::cout << "StCentralityAnalyzer::Finish - Writing histograms to the output file..."; + mOutFile->Write(); + mOutFile->Close(); + std::cout << "\t [DONE]" << std::endl; + } + + return kStOK; +} + +//________________ +Int_t StCentralityAnalyzer::Make() { + + mEventsPassed++; + Bool_t readEvent = mReader->readPicoEvent(mEventsPassed); + //std::cout << "Working on event# " << mEventsPassed << std::endl; + + StPicoEvent* event = mDst->event(); + TRandom3* rndm3 = new TRandom3(0); + + if ( !event ) { + std::cout << "No StPicoEvent has been retrieved from DST" << std::endl; + return kStSkip; + } + + // Skip bad runs + if ( isInBadRunList( event->runId() ) ) return kStOk; + + // Skip bad events + if ( !isGoodEvent(event) ) return kStOk; + + //std::cout << "Event vtxZ: " << event->primaryVertex().Z() << std::endl; + double VtxX = event->primaryVertex().X(); + double VtxY = event->primaryVertex().Y(); + double VtxZ = event->primaryVertex().Z(); + double VzVpd = event->vzVpd(); + + // Fill event information + Double_t refMult = event->refMult(); + + // Luminosity correction + if(mUseLumCorr){ + Double_t thislumcorr = calculateLumCorr(event->ZDCx()); + double zeroToOne = rndm3->Rndm(); + double nonIntegerRefMult = (Double_t)(refMult)-0.5+zeroToOne; + refMult = TMath::Nint(nonIntegerRefMult*thislumcorr); + } + + //fill tree + mTree_Vz = VtxZ; + mTree_ZDCx = event->ZDCx(); + mTree_refMult = refMult; + + //correct refMult Vz dependence + if(mUseVzCorr){ + refMult = getRefMultCorrVz(refMult, VtxZ); + mTree_refMultCor = refMult; + } + mTree_nBTOFMatched = event->nBTOFMatch(); + mTree->Fill(); + + //RefMult shape weight + //Double weight = getShapeWeight(VtxZ, refMult); + //it should be used like hRefMult->Fill(refMult, weight); + + Int_t grefMult = event->grefMult(); + + double VtxZBinDouble = VtxZ/2. + 36.; //change this if Vz histogram labels change + if(VtxZ==73.0) hRefMultVtxZ[72]->Fill(refMult); //edge case + else if(VtxZ==-73.0) hRefMultVtxZ[0]->Fill(refMult); //edge case + else if(VtxZBinDouble - (int)VtxZBinDouble == 0.5){ //more likely edge case, filling both hists if Vz is on boundary + hRefMultVtxZ[(int)VtxZBinDouble]->Fill(refMult); + hRefMultVtxZ[(int)VtxZBinDouble+1]->Fill(refMult); + } + else hRefMultVtxZ[TMath::Nint(VtxZBinDouble)]->Fill(refMult); //most events by far + + hPrimVertXvsY->Fill(VtxX, VtxY); + hPrimVertZ->Fill(VtxZ); + hPrimVertVpdVzDiff->Fill(VtxZ-VzVpd); + + // Will be faster than direct call in case of simultanious usage + UInt_t runId = event->runId(); + + hRefMult->Fill( refMult ); + hGRefMult->Fill( grefMult ); + hRefMultVsRunNumber->Fill( runId, refMult ); + hRefMultVsTofTrayMult->Fill( refMult, event->btofTrayMultiplicity() ); + hRefMultVsTofMatched->Fill( event->nBTOFMatch() , refMult ); + hGRefMultVsTofTrayMult->Fill( grefMult, event->btofTrayMultiplicity() ); + hGRefMultVsTofMatched->Fill( grefMult, event->nBTOFMatch() ); + hRefMultVsRunNumber->Fill( runId, refMult ); + hGRefMultVsRunNumber->Fill( runId, grefMult ); + hRefMultVsZdcCoincidenceRate->Fill(event->ZDCx(),refMult); + hAvgRefMultVsZdcCoincidenceRate->Fill(event->ZDCx(), refMult); + hZdcCoincidenceRateVsRunNumber->Fill( runId, event->ZDCx() ); + hTofTrayMultVsRunNumber->Fill( runId, event->btofTrayMultiplicity() ); + hTofMatchedVsRunNumber->Fill( runId, event->nBTOFMatch() ); + + std::vector TheseTrigs = event->triggerIds(); + for(int jTrigs=0; jTrigsFill(event->ZDCx(), refMult); + if(thisTrig==600011) hAvgRefMultVsZdcCoincidenceRateForTrig[1]->Fill(event->ZDCx(), refMult); + if(thisTrig==600021) hAvgRefMultVsZdcCoincidenceRateForTrig[2]->Fill(event->ZDCx(), refMult); + if(thisTrig==600031) hAvgRefMultVsZdcCoincidenceRateForTrig[3]->Fill(event->ZDCx(), refMult); + } + + for ( UInt_t iTrk=0; iTrknumberOfTracks(); iTrk++ ) { + StPicoTrack* track = mDst->track( iTrk ); + if ( !track ) continue; + + if ( !isGoodTrack( track ) ) continue; + + // Fill track information + hGlobTrackNHitsVsRunNumber->Fill( runId, track->nHits() ); + hGlobTrackPtVsRunNumber->Fill( runId, track->gPt() ); + } // for ( Int_t iTrk=0; iTrknumberOfTracks(); iTrk++ ) + + return kStOK; +} + +//________________ +void StCentralityAnalyzer::Clear(Option_t *opt) { + StMaker::Clear(); +} + +//________________ +//Informed by https://drupal.star.bnl.gov/STAR/system/files/Centrality_for_Run18_27GeVAuAu_ZaochenYe_20190827.pdf +Double_t StCentralityAnalyzer::calculateLumCorr(Double_t ZDCx) { + double f_ZDCx = m_LumCorr_a*ZDCx + m_LumCorr_b; + double LumCorr = m_LumCorr_bprime/(f_ZDCx); + return LumCorr; +} + +//________________ +Bool_t StCentralityAnalyzer::isGoodEvent(StPicoEvent* ev) { + Bool_t goodEvent = ( isGoodVertex( ev->primaryVertex().X(), + ev->primaryVertex().Y(), + ev->primaryVertex().Z(), + ev->vzVpd() ) && + isGoodTrigger( ev->triggerIds() ) ); + Bool_t pileUpRejected = true; + if(mUsePileUp){ + pileUpRejected = isNotPileUp( ev->refMult(), ev->nBTOFMatch() ); + } + return ( goodEvent && pileUpRejected ); +} + +//________________ +void StCentralityAnalyzer::addTriggerId(const unsigned int& id) { + Bool_t isInList = ( std::find(mTriggerIdCollection.begin(), mTriggerIdCollection.end(), id) != mTriggerIdCollection.end() ); + if ( !isInList ) { + mTriggerIdCollection.push_back( id ); + } +} + +//________________ +Bool_t StCentralityAnalyzer::isNotPileUp(UShort_t refMult, UShort_t btofMatched) { + + //double refmultcutmode=m_a0+m_a1*(btofMatched)+m_a2*pow(btofMatched,2)+m_a3*pow(btofMatched,3)+m_a4*pow(btofMatched,4); + double refmultcutmax = ( m_b0 + m_b1*(btofMatched) + m_b2*pow(btofMatched,2) + + m_b3*pow(btofMatched,3) + m_b4*pow(btofMatched,4) ); + double refmultcutmin = ( m_c0 + m_c1*(btofMatched) + m_c2*pow(btofMatched,2) + + m_c3*pow(btofMatched,3) + m_c4*pow(btofMatched,4) ); + + return ( refMultrefmultcutmin ); +} + +//_________________ +Bool_t StCentralityAnalyzer::isInBadRunList(unsigned int runId) { + Bool_t isInRuRu_200GeV = ( std::find( bad_run_list_ruru_200gev.begin(), bad_run_list_ruru_200gev.end(), runId) != bad_run_list_ruru_200gev.end() ); + Bool_t isInZrZr_200GeV = ( std::find( bad_run_list_zrzr_200gev.begin(), bad_run_list_zrzr_200gev.end(), runId) != bad_run_list_zrzr_200gev.end() ); + + return ( isInRuRu_200GeV || isInZrZr_200GeV ); +} + +//________________ +Bool_t StCentralityAnalyzer::isGoodTrigger(std::vector triggers) { + Bool_t isInList = false; + for ( unsigned int i=0; i mVtxZ[0]) && (z < mVtxZ[1]) ); + mIsGoodPositionR = ( vtxPositionR >= mVtxR[0] && vtxPositionR < mVtxR[1] ); + mIsGoodVpdVzDiff = ( vpdVzDiff > mVpdVzDiff[0] && vpdVzDiff < mVpdVzDiff[1] ); + + if(mDebug) { + Bool_t isGoodVertex = ( mIsGoodPositionZ && mIsGoodPositionR && mIsGoodVpdVzDiff ); + std::cout << "IsGoodVertex: " << isGoodVertex << " : " << std::endl; + std::cout << "position z: " << z << " IsGood: " << mIsGoodPositionZ << std::endl + << "position r: " << vtxPositionR << " IsGood: " << mIsGoodPositionR << std::endl + << "vpdvz diff: " << vpdVzDiff << " IsGood: " << mIsGoodVpdVzDiff << std::endl; + } //if(mDebug) + + return ( mIsGoodPositionZ && mIsGoodPositionR && mIsGoodVpdVzDiff ); +} + +//________________ +Bool_t StCentralityAnalyzer::isGoodTrack(StPicoTrack *trk) { + Bool_t mGoodTrk = false; + Float_t hitRatio = ( (float)trk->nHitsFit() / (float)trk->nHitsMax() ); + mGoodTrk = ( (trk->gPtot() >= mMom[0]) && (trk->gPtot() <= mMom[1]) && + (trk->gPt() >= 0.1) && + (trk->gMom().Eta() >= mEta[0]) && + (trk->gMom().Eta() <= mEta[1]) && + (trk->nHits() >= mNHits[0]) && + (trk->nHits() <= mNHits[1]) && + (hitRatio >= mNHitsRatio[0]) && + (hitRatio <= mNHitsRatio[1]) ); + + if(mDebug) { + std::cout << "IsGoodTrack: " << mGoodTrk << " : " << std::endl + << "primary : " << trk->isPrimary() << std::endl + << "gPtot : " << trk->gPtot() << std::endl + << "gPt : " << trk->gPt() << std::endl + << "gEta : " << trk->gMom().Eta() << std::endl; + if( trk->isPrimary() ) { + std::cout << "Ptot : " << trk->pMom().Mag() << std::endl + << "Pt : " << trk->pMom().Perp() << std::endl + << "Eta : " << trk->pMom().Eta() << std::endl; + } //if( trk->isPrimary() ) + + std::cout << "nhits : " << trk->nHits() << std::endl + << "hitRatio: " << hitRatio << std::endl; + } //if(mDebug) + return mGoodTrk; +} + +//________________ +void StCentralityAnalyzer::createHistograms() { + createEventHistograms(); + createGlobalTrackHistograms(); + createPrimaryTrackHistograms(); +} + +//________________ +void StCentralityAnalyzer::createEventHistograms() { + std::cout << "Creating event histograms..."; + + mTree = new TTree("mTree","backup tree for refMult correction"); + mTree->Branch("ZDCx", &mTree_ZDCx, "ZDCx/D"); + mTree->Branch("Vz", &mTree_Vz, "Vz/D"); + mTree->Branch("refMult", &mTree_refMult, "refMult/D"); + mTree->Branch("refMultCor", &mTree_refMultCor, "refMultCor/D"); + mTree->Branch("nBTOFMatched", &mTree_nBTOFMatched, "nBTOFMatched/D"); + + Int_t refMultBins = 500; + Float_t refMult[2] = { 0.0, 500.0 }; //refMult hist should have bin edges on integer values in order to make centrality cuts exact + hRefMult = new TH1F( Form("hRefMult"), + Form("refMult;refMult;events"), + refMultBins, refMult[0], refMult[1]); + for ( Int_t iBin=0; iBin<73; iBin++ ) { + Float_t zmin = -73.; + Float_t zstep = 2.; + Float_t zrange[2] = { zmin + iBin*zstep, zmin + (iBin+1)*zstep}; + hRefMultVtxZ[iBin] = new TH1F( Form("hRefMultVtxZ_%d",iBin), + Form("Reference multiplicity for %3.1f #leq z #leq %3.1f",zrange[0],zrange[1]), + refMultBins, refMult[0], refMult[1] ); + } // for ( Int_t iBin=0; iBin<73; iBin++ ) + hGRefMult = new TH1F( Form("hGRefMult"), + Form("gRefMult;gRefMult;events"), + 2500, 0.0, 2500.0); + hPrimVertNum = new TH1F( Form("hPrimVertNum"), + Form("hPrimVertNum;Number of pVtx; events"), + 15, -0.5, 14.5); + hPrimVertZ = new TH1F( Form("hPrimVertZ"), Form("hPrimVertZ;z (cm);events/4 cm"), 110, -220., 220.); + hPrimVertXvsY = new TH2F( Form("hPrimVertXvsY"), + Form("hPrimVertXvsY;x (cm);y (cm);events"), + 40, -10., 10., 40, -10., 10.); + hPrimVertVpdVzDiff = new TH1F( Form("hPrimVertVpdVzDiff"), + Form("hPrimVertVpdVzDiff;Vz_{TPC}-Vz_{VPD} (cm);events"), + 40, -20., 20.); + hRefMultVsTofTrayMult = new TH2F( Form("hRefMultVsTofTrayMult"), + Form("hRefMultVsTofTrayMult;refMult;btofTrayMultiplicity;events"), + 650, -0.5, 649.5, 650, -0.5, 649.5 ); + hRefMultVsTofMatched = new TH2F( Form("hRefMultVsTofMatched"), + Form("hRefMultVsTofTrayMult;btofMatched;refMult;events"), + 650, -0.5, 649.5, 650, -0.5, 649.5 ); + hGRefMultVsTofTrayMult = new TH2F( Form("hGRefMultVsTofTrayMult"), + Form("hGRefMultVsTofTrayMult;gRefMult;btofTrayMultiplicity;events"), + 1950, -0.5, 1949.5, + 650, -0.5, 649.5); + hGRefMultVsTofMatched = new TH2F( Form("hGRefMultVsTofMatched"), + Form("hGRefMultVsTofTrayMult;gRefMult;BTofMatched;events"), + 1950, -0.5, 1949.5, + 650, -0.5, 649.5); + hRefMultVsZdcCoincidenceRate = new TH2F( Form("hRefMultVsZdcCoincidenceRate"), + Form("hRefMultVsZdcCoincidenceRate;ZdcCoincidenceRate (Hz);refMult"), + 700, 6000., 15000.,650,-0.5,649.5); + hRefMultVsRunNumber = new TProfile( Form("hRefMultVsRunNumber"), + Form("hRefMultVsRunNumber;runId;"), + mRunIdBins, mRunIdRange[0], mRunIdRange[1] ); + hAvgRefMultVsZdcCoincidenceRate = new TProfile( Form("hAvgRefMultVsZdcCoincidenceRate"), + Form("hAvgRefMultVsZdcCoincidenceRate;ZdcCoincidenceRate (Hz);"), + 700, 6000., 15000.); + int Trigs[4]={600001,600011,600021,600031}; + for(int iTrig=0; iTrig<4; iTrig++){ + hAvgRefMultVsZdcCoincidenceRateForTrig[iTrig] = new TProfile( Form("hAvgRefMultVsZdcCoincidenceRateForTrig_%d",Trigs[iTrig]), + Form("hAvgRefMultVsZdcCoincidenceRate_%d;ZdcCoincidenceRate (Hz);",Trigs[iTrig]), + 700, 6000., 15000.); + } + + hGRefMultVsRunNumber = new TProfile( Form("hGRefMultVsRunNumber"), + Form("hGRefMultVsRunNumber;runId;"), + mRunIdBins, mRunIdRange[0], mRunIdRange[1] ); + hZdcCoincidenceRateVsRunNumber = new TProfile( Form("hZdcCoincidenceRateVsRunNumber"), + Form("hZdcCoincidenceRateVsRunNumber;runId; (kHz)"), + mRunIdBins, mRunIdRange[0], mRunIdRange[1] ); + hTofTrayMultVsRunNumber = new TProfile( Form("hTofTrayMultVsRunNumber"), + Form("hTofTrayMultVsRunNumber;runId;btofTrayMult"), + mRunIdBins, mRunIdRange[0], mRunIdRange[1] ); + hTofMatchedVsRunNumber = new TProfile( Form("hTofMatchedVsRunNumber"), + Form("hTofTrayMultVsRunNumber;runId;BTofMatched"), + mRunIdBins, mRunIdRange[0], mRunIdRange[1] ); + + std::cout << "\t[DONE]" << std::endl; +} + +//________________ +void StCentralityAnalyzer::createGlobalTrackHistograms() { + std::cout << "Creating global track histograms..."; + hGlobTrackNHitsVsRunNumber = new TProfile( Form("hGlobTrackNHitsVsRunNumber"), + Form("hGlobTrackNHitsVsRunNumber;runId;primary track "), + mRunIdBins, mRunIdRange[0], mRunIdRange[1] ); + hGlobTrackDedxVsRunNumber = new TProfile( Form("hGlobTrackDedxVsRunNumber"), + Form("hGlobTrackDedxVsRunNumber;runId;primary track (keV/cm)"), + mRunIdBins, mRunIdRange[0], mRunIdRange[1] ); + hGlobTrackPtVsRunNumber = new TProfile( Form("hGlobTrackPtVsRunNumber"), + Form("hGlobTrackPtVsRunNumber;runId;global track (GeV/c)"), + mRunIdBins, mRunIdRange[0], mRunIdRange[1] ); + std::cout << "\t[DONE]" << std::endl; +} + +//________________ +void StCentralityAnalyzer::createPrimaryTrackHistograms() { + std::cout << "Creating primary track histograms..."; + hPrimTrackPtVsRunNumber = new TProfile( Form("hPrimTrackPtVsRunNumber"), + Form("hPrimTrackPtVsRunNumber;runId;primary track (GeV/c)"), + mRunIdBins, mRunIdRange[0], mRunIdRange[1] ); + hPrimTrackNHitsVsRunNumber = new TProfile( Form("hPrimTrackNHitsVsRunNumber"), + Form("hPrimTrackNHitsVsRunNumber;runId;primary track "), + mRunIdBins, mRunIdRange[0], mRunIdRange[1] ); + hPrimTrackDedxVsRunNumber = new TProfile( Form("hPrimTrackDedxVsRunNumber"), + Form("hPrimTrackDedxVsRunNumber;runId;primary track (keV/cm)"), + mRunIdBins, mRunIdRange[0], mRunIdRange[1] ); + std::cout << "\t[DONE]" << std::endl; +} + +//_________________ +const std::vector StCentralityAnalyzer::bad_run_list_ruru_200gev = { + 19120009,19102023,19102054,19103022, + 19083049, 19083050, 19083051, 19083052, 19083053, + 19083054, 19083055, 19083056, 19083057, 19083058, + 19083059, 19083060, 19083061, 19083062, 19083063, + 19083064, 19083065, 19083066, 19083067, 19084001, + 19084002, 19084003, 19084004, 19084005, 19084006, + 19084007, 19084008, 19084010, 19084011, 19084013, + 19084022, 19084024, 19084025, 19084026, 19084027, + 19084028, 19084029, 19084030, 19084031, 19084032, + 19084033, 19084034, 19084035, 19084036, 19084037, + 19084038, 19084039, 19084053, 19084055, 19084057, + 19084059, 19084060, 19084061, 19084062, 19084063, + 19084064, 19084065, 19084066, 19084067, 19084068, + 19084070, 19084071, 19084072, 19085001, 19085002, + 19085003, 19085004, 19085005, 19085006, 19085007, + 19085008, 19085009, 19085010, 19085011, 19085012, + 19085013, 19085014, 19085015, 19085016, 19085017, + 19085018, 19085019, 19085020, 19085021, 19085023, + 19085024, 19085025, 19085026, 19085058, 19086026, + 19086060, 19086061, 19086062, 19086063, 19086064, + 19086066, 19086067, 19086069, 19086070, 19086072, + 19086073, 19086074, 19086076, 19086077, 19086080, + 19087001, 19087012, 19087014, 19087015, 19087016, + 19087017, 19087021, 19087022, 19087038, 19087042, + 19088051, 19088052, 19088053, 19088055, 19090009, + 19090010, 19090011, 19090012, 19090015, 19090016, + 19090018, 19090019, 19090021, 19090022, 19090023, + 19090024, 19090025, 19090032, 19092051, 19093042, + 19093043, 19095061, 19096002, 19096005, 19096006, + 19096057, 19097057, 19098017, 19098018, 19098020, + 19100045, 19103007, 19103041, 19105024, 19105026, + 19106023, 19106034, 19107045, 19110015, 19110039, + 19112012, 19112029, 19115020, 19116035, 19120047, + 19120048, 19122004, 19122005 + /* Here will be some runIds in the format: 11111111, 22222222, etc */ +}; + +//_________________ +const std::vector StCentralityAnalyzer::bad_run_list_zrzr_200gev = { + 19120009,19102023,19102054,19103022, + 19083049, 19083050, 19083051, 19083052, 19083053, + 19083054, 19083055, 19083056, 19083057, 19083058, + 19083059, 19083060, 19083061, 19083062, 19083063, + 19083064, 19083065, 19083066, 19083067, 19084001, + 19084002, 19084003, 19084004, 19084005, 19084006, + 19084007, 19084008, 19084010, 19084011, 19084013, + 19084022, 19084024, 19084025, 19084026, 19084027, + 19084028, 19084029, 19084030, 19084031, 19084032, + 19084033, 19084034, 19084035, 19084036, 19084037, + 19084038, 19084039, 19084053, 19084055, 19084057, + 19084059, 19084060, 19084061, 19084062, 19084063, + 19084064, 19084065, 19084066, 19084067, 19084068, + 19084070, 19084071, 19084072, 19085001, 19085002, + 19085003, 19085004, 19085005, 19085006, 19085007, + 19085008, 19085009, 19085010, 19085011, 19085012, + 19085013, 19085014, 19085015, 19085016, 19085017, + 19085018, 19085019, 19085020, 19085021, 19085023, + 19085024, 19085025, 19085026, 19085058, 19086026, + 19086060, 19086061, 19086062, 19086063, 19086064, + 19086066, 19086067, 19086069, 19086070, 19086072, + 19086073, 19086074, 19086076, 19086077, 19086080, + 19087001, 19087012, 19087014, 19087015, 19087016, + 19087017, 19087021, 19087022, 19087038, 19087042, + 19088051, 19088052, 19088053, 19088055, 19090009, + 19090010, 19090011, 19090012, 19090015, 19090016, + 19090018, 19090019, 19090021, 19090022, 19090023, + 19090024, 19090025, 19090032, 19092051, 19093042, + 19093043, 19095061, 19096002, 19096005, 19096006, + 19096057, 19097057, 19098017, 19098018, 19098020, + 19100045, 19103007, 19103041, 19105024, 19105026, + 19106023, 19106034, 19107045, 19110015, 19110039, + 19112012, 19112029, 19115020, 19116035, 19120047, + 19120048, 19122004, 19122005 + /* Here will be some runIds in the format: 11111111, 22222222, etc */ +}; + +//_________________ +Double_t StCentralityAnalyzer::getRefMultCorrVz(Double_t RefMult, Double_t Vz){ + + const Double_t RefMult_ref = m_vzCorr0; //RefMult at |z|<1. + const Double_t RefMult_z = m_vzCorr0 + + m_vzCorr1*Vz + m_vzCorr2*pow(Vz, 2) + + m_vzCorr3*pow(Vz, 3) + m_vzCorr4*pow(Vz, 4) + + m_vzCorr5*pow(Vz, 5) + m_vzCorr6*pow(Vz, 6); + + Double_t ScaleFactor = 1.0; + + if(RefMult_z > 0.0){ + ScaleFactor = RefMult_ref / RefMult_z; + } + + return RefMult * ScaleFactor; + +} + +//_________________ +Double_t StCentralityAnalyzer::getShapeWeight(Double_t Vz, Double_t RefMult){ + + // no shape correction for -9<=Vz<=9 + if(Vz>=-9 && Vz<=9) return 1.; + //obtain index to load weight + Double_t VtxZBinDouble = Vz/2. + 17.; + Int_t VzIndex = 0; + if(Vz == 25.) VzIndex = 29; + else if(Vz == -35.) VzIndex = 0; + else VzIndex = TMath::Nint(VtxZBinDouble); + //handle VzIndex for Vz>9 + if(VzIndex >= 22) VzIndex = VzIndex - 9; + //retrive shape weight + Double_t weight = ShapeWeightArray[mShapeIndex][VzIndex][TMath::Nint(RefMult)]; + //handle bad weight + if(weight == 0 || TMath::IsNaN(weight)) weight = 1.; + return weight; + +} diff --git a/StRoot/PWGTools/CentralityCalibration/Centrality/StCentralityAnalyzer/StCentralityAnalyzer.h b/StRoot/PWGTools/CentralityCalibration/Centrality/StCentralityAnalyzer/StCentralityAnalyzer.h new file mode 100644 index 00000000000..0f54291e51f --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Centrality/StCentralityAnalyzer/StCentralityAnalyzer.h @@ -0,0 +1,205 @@ +/** + * \class StCentralityAnalyzer + * \brief Process and build distributions for centrality determination + * + * The StPiStCentralityAnalyzer processes + * Most of the members are copied from StMuEvent. + * \author Grigory Nigmatkulov + */ + +#ifndef StCentralityAnalyzer_h +#define StCentralityAnalyzer_h + +// STAR classes +#include "StMaker.h" + +// PicoDst headers +#include "StPicoEvent/StPicoDstReader.h" +#include "StPicoEvent/StPicoEvent.h" +#include "StPicoEvent/StPicoTrack.h" +#include "StPicoEvent/StPicoBTofPidTraits.h" +#include "StPicoEvent/StPicoDst.h" + +// ROOT headers +#include "TFile.h" +#include "TH1.h" +#include "TH2.h" +#include "TProfile.h" +#include "TRandom3.h" + +// C++ headers +#include + +//________________ +class StCentralityAnalyzer : public StMaker { + public: + // Constructor + StCentralityAnalyzer(StPicoDstReader *reader, const Char_t* oFileName); + // Destructor + virtual ~StCentralityAnalyzer(); + + // Standard StMaker inherited methods + virtual Int_t Init(); + virtual Int_t Make(); + virtual Int_t Finish(); + void Clear(Option_t *option=""); + + // Set cuts, limits and triggers + void addTriggerId(const unsigned int& id); + void setDebugStatus(bool status) { mDebug = status; } + void setUsePileUp(bool pileup) { mUsePileUp = pileup; } + void setUseLumCorr(bool lumcorr) { mUseLumCorr = lumcorr; } + void setUseVzCorr(bool vzcorr) { mUseVzCorr = vzcorr; } + void setRunIdParameters(unsigned int& bins, double& lo, double hi) { mRunIdBins=bins; mRunIdRange[0]=lo; mRunIdRange[1]=hi; } + void setVtxZCut(const float& lo, const float& hi) { mVtxZ[0]=lo; mVtxZ[1]=hi; } + void setVtxRCut(const float& lo, const float& hi) { mVtxR[0]=lo; mVtxR[1]=hi; } + void setVtxPositionShift(const float& x, const float& y) { mVtxXShift=x; mVtxYShift=y; } + void setVtxVpdVzCut(const float& lo, const float& hi) { mVpdVzDiff[0]=lo; mVpdVzDiff[1]=hi; } + + void setPileUpParameters(double a0,double a1,double a2,double a3,double a4, + double b0,double b1,double b2,double b3,double b4, + double c0,double c1,double c2,double c3,double c4) + { m_a0=a0; m_a1=a1; m_a2=a2; m_a3=a3; m_a4=a4; + m_b0=b0; m_b1=b1; m_b2=b2; m_b3=b3; m_b4=b4; + m_c0=c0; m_c1=c1; m_c2=c2; m_c3=c3; m_c4=c4;} + + void setLumCorrParameters(double lumcorr_a, double lumcorr_b, double lumcorr_bprime) + { m_LumCorr_a = lumcorr_a; m_LumCorr_b = lumcorr_b; m_LumCorr_bprime = lumcorr_bprime; } + + void setVzCorrParameters(double vzCorPar0, double vzCorPar1, double vzCorPar2, double vzCorPar3, double vzCorPar4, double vzCorPar5, double vzCorPar6) + { + m_vzCorr0 = vzCorPar0; + m_vzCorr1 = vzCorPar1; + m_vzCorr2 = vzCorPar2; + m_vzCorr3 = vzCorPar3; + m_vzCorr4 = vzCorPar4; + m_vzCorr5 = vzCorPar5; + m_vzCorr6 = vzCorPar6; + } + + //set shape correction index, 0: Ru, 1: Zr + void setShapeIndex(Int_t index) {mShapeIndex = index;} + + Double_t getShapeWeight(Double_t Vz, Double_t RefMult); + + private: + // Histogram creation + void createHistograms(); + void createEventHistograms(); + void createPrimaryTrackHistograms(); + void createGlobalTrackHistograms(); + + // Methods to check whether + Bool_t isGoodEvent(StPicoEvent* event); + Bool_t isGoodVertex(Float_t x, Float_t y, Float_t z, Float_t vpdVz); + Bool_t isGoodTrigger(std::vector ids); + Bool_t isNotPileUp(UShort_t refMult, UShort_t btofMatched); + Bool_t isGoodTrack(StPicoTrack* track); + Bool_t isInBadRunList(unsigned int runId); + + // Method for luminosity correction + Double_t calculateLumCorr(Double_t ZDCx); + + //Function to correct refmult Vz dependence + Double_t getRefMultCorrVz(Double_t RefMult, Double_t Vz); + + const Char_t *mOutFileName; + TFile *mOutFile; + StPicoDstReader *mReader; + StPicoDst* mDst; + std::vector mTriggerIdCollection; + + UInt_t mEventsPassed; + + Bool_t mDebug; + Bool_t mUsePileUp; + Bool_t mUseLumCorr; + Bool_t mUseVzCorr; + + // Pileup Parameters + Double_t m_a0, m_a1, m_a2, m_a3, m_a4; + Double_t m_b0, m_b1, m_b2, m_b3, m_b4; + Double_t m_c0, m_c1, m_c2, m_c3, m_c4; + + // Luminosity Correction Parameters + Double_t m_LumCorr_a; + Double_t m_LumCorr_b; + Double_t m_LumCorr_bprime; + + //a backup tree to confirm vz correciton + TTree *mTree; + Double_t mTree_Vz; + Double_t mTree_ZDCx; + Double_t mTree_refMult; + Double_t mTree_refMultCor; + Double_t mTree_nBTOFMatched; + + + // Vz Correction Parameters + Double_t m_vzCorr0, m_vzCorr1, m_vzCorr2, m_vzCorr3, m_vzCorr4, m_vzCorr5, m_vzCorr6; + //Shape correction index, 0: Ru, 1: Zr + Int_t mShapeIndex; + + // Bad run list for Ru+Ru at 200 GeV + static const std::vector bad_run_list_ruru_200gev; + // Bad run list for Zr+Zr at 200 GeV + static const std::vector bad_run_list_zrzr_200gev; + + // Event cuts + Float_t mVtxZ[2]; + Float_t mVtxR[2]; + Float_t mVtxXShift, mVtxYShift; + Float_t mVpdVzDiff[2]; + Float_t mRefMult[2]; + UInt_t mRunIdBins; + Double_t mRunIdRange[2]; + + // Track cuts + Float_t mMom[2]; + Float_t mEta[2]; + Float_t mNHits[2]; + Float_t mNHitsRatio[2]; + + ////////////////////// + // Histograms // + ////////////////////// + TH1F* hRefMult; + TH1F* hRefMultVtxZ[73]; + TH1F* hGRefMult; + TH1F* hPrimVertNum; + TH1F* hPrimVertZ; + TH1F* hZdcAdcEast; + TH1F* hZdcAdcWest; + TH1F* hZdcAdcSum; + TH1F* hZdcCoincidenceRate; + TH1F* hEpdAdcEast; + TH1F* hEpdAdcWest; + TH1F* hEpdAdcSum; + TH2F* hPrimVertXvsY; + TH1F* hPrimVertVpdVzDiff; + TH2F* hRefMultVsTofTrayMult; + TH2F* hRefMultVsTofMatched; + TH2F* hGRefMultVsTofTrayMult; + TH2F* hGRefMultVsTofMatched; + TH2F* hRefMultVsTofMatch; + TH2F* hRefMultVsBemcMatch; + TH2F* hRefMultVsZdcCoincidenceRate; + TProfile* hRefMultVsRunNumber; + TProfile* hGRefMultVsRunNumber; + TProfile* hTofTrayMultVsRunNumber; + TProfile* hTofMatchedVsRunNumber; + TProfile* hZdcAdcSumVsRunNumber; + TProfile* hZdcCoincidenceRateVsRunNumber; + TProfile* hPrimTrackPtVsRunNumber; + TProfile* hPrimTrackNHitsVsRunNumber; + TProfile* hPrimTrackDedxVsRunNumber; + TProfile* hGlobTrackPtVsRunNumber; + TProfile* hGlobTrackNHitsVsRunNumber; + TProfile* hGlobTrackDedxVsRunNumber; + TProfile* hAvgRefMultVsZdcCoincidenceRate; + TProfile* hAvgRefMultVsZdcCoincidenceRateForTrig[4]; + + ClassDef(StCentralityAnalyzer,0) +}; + +#endif // StCentralityAnalyzer_h diff --git a/StRoot/PWGTools/CentralityCalibration/Centrality/processPicoDst.xml b/StRoot/PWGTools/CentralityCalibration/Centrality/processPicoDst.xml new file mode 100644 index 00000000000..9af86537c68 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Centrality/processPicoDst.xml @@ -0,0 +1,52 @@ + + + + + + + + stardev + setenv NODEBUG yes + set softDir = /star/data03/pwg/sweger/IsobarCentrality/centrality_definition/Centrality + ln -s ${softDir}/StRoot . + pwd + ls -al + + + + set newlist="$PWD"/"$JOBID".list + awk '{print $1}' ${FILELIST} > $newlist + eval set outfilename = o${JOBID}.root + root4star -b -l runCentralityAnalyzer.C\(\"$newlist\",\"$outfilename\"\) + + + + + + + + + + + + + + + /star/data03/pwg/sweger/IsobarCentrality/centrality_definition/Centrality/log/ + + + + + file:./.sl73_gcc485/ + file:./runCentralityAnalyzer.C + + + + diff --git a/StRoot/PWGTools/CentralityCalibration/Centrality/processPicoDst_Ru.xml b/StRoot/PWGTools/CentralityCalibration/Centrality/processPicoDst_Ru.xml new file mode 100644 index 00000000000..be434f327dd --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Centrality/processPicoDst_Ru.xml @@ -0,0 +1,45 @@ + + + + + + + + stardev + setenv NODEBUG yes + set softDir = /star/data03/pwg/sweger/IsobarCentrality/centrality_definition/Centrality + ln -s ${softDir}/StRoot . + pwd + ls -al + + + set newlist="$PWD"/"$JOBID".list + awk '{print $1}' ${FILELIST} > $newlist + eval set outfilename = o${JOBID}.root + root4star -b -l runCentralityAnalyzer_Ru.C\(\"$newlist\",\"$outfilename\"\) + + + + + + + + + + + + + + + + /star/data03/pwg/sweger/IsobarCentrality/centrality_definition/Centrality/log/ + + + + + file:./.sl73_gcc485/ + file:./runCentralityAnalyzer_Ru.C + + + + diff --git a/StRoot/PWGTools/CentralityCalibration/Centrality/processPicoDst_Zr.xml b/StRoot/PWGTools/CentralityCalibration/Centrality/processPicoDst_Zr.xml new file mode 100644 index 00000000000..a911211c0bb --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Centrality/processPicoDst_Zr.xml @@ -0,0 +1,45 @@ + + + + + + + + stardev + setenv NODEBUG yes + set softDir = /star/data03/pwg/sweger/IsobarCentrality/centrality_definition/Centrality + ln -s ${softDir}/StRoot . + pwd + ls -al + + + set newlist="$PWD"/"$JOBID".list + awk '{print $1}' ${FILELIST} > $newlist + eval set outfilename = o${JOBID}.root + root4star -b -l runCentralityAnalyzer_Zr.C\(\"$newlist\",\"$outfilename\"\) + + + + + + + + + + + + + + + + /star/data03/pwg/sweger/IsobarCentrality/centrality_definition/Centrality/log/ + + + + + file:./.sl73_gcc485/ + file:./runCentralityAnalyzer_Zr.C + + + + diff --git a/StRoot/PWGTools/CentralityCalibration/Centrality/referenceVzCorr.C b/StRoot/PWGTools/CentralityCalibration/Centrality/referenceVzCorr.C new file mode 100644 index 00000000000..1a873a178a0 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Centrality/referenceVzCorr.C @@ -0,0 +1,180 @@ +#include +#include "TMath.h" +#include "TRandom3.h" +#include "TCanvas.h" +#include "TPad.h" +#include "TF1.h" +#include "TH1D.h" +#include "TGraph.h" +#include "TAxis.h" +#include "TGraphErrors.h" +#include "TFile.h" +#include "TNtuple.h" +#include +#include + +int referenceVzCorr(){ + + TFile *f0 = new TFile("referenceData.root"); + + int numHists = 29; + double Vz[numHists]; + double VzErr[numHists]; + TH1F *hist[numHists]; + TH1F *clonedhist[numHists]; + double h[numHists]; + double par0[numHists]; + double par1[numHists]; + double hErr[numHists]; + double chi2perNDF[numHists]; + double minbin = 320.0; + double maxbin = 450.0; + + + for(int i=0; iGet(Form("hRefMultPWVtxZ_%d",i)); + TF1 *f1 = new TF1("f1","([0]/10.0) * (TMath::Erf( -[1]*(x - [2]) ) + 1)", minbin, maxbin); + f1->SetParameter(0,1.0e4); + f1->SetParameter(1,0.027); + f1->SetParameter(2,maxbin-50.0); + TFitResultPtr r = hist[i]->Fit("f1","RLMS"); + h[i] = r->Parameter(2); + par0[i] = r->Parameter(0); + par1[i] = r->Parameter(1); + hErr[i] = r->ParError(2); + Vz[i]=10.0*(i-14.0); + VzErr[i] = 5.0; + TF1 *fit = hist[i]->GetFunction("f1"); + Double_t chi2 = fit->GetChisquare(); + double numbins = maxbin-minbin+1.0; + cout<<"CHi2/ndf: "<Draw(); + TPad* pad_100 = new TPad("pad_100","Pad",0.,0.,1.,1.); + pad_100->Divide(4,2); + pad_100->Draw(); + TCanvas *c_200 = new TCanvas("c_200","Canvas",1200,600); + c_200->Draw(); + TPad* pad_200 = new TPad("pad_200","Pad",0.,0.,1.,1.); + pad_200->Divide(4,2); + pad_200->Draw(); + TCanvas *c_300 = new TCanvas("c_300","Canvas",1200,600); + c_300->Draw(); + TPad* pad_300 = new TPad("pad_300","Pad",0.,0.,1.,1.); + pad_300->Divide(4,2); + pad_300->Draw(); + TCanvas *c_400 = new TCanvas("c_400","Canvas",1200,600); + c_400->Draw(); + TPad* pad_400 = new TPad("pad_400","Pad",0.,0.,1.,1.); + pad_400->Divide(4,2); + pad_400->Draw(); + + + for(int i=0; iGet(Form("hRefMultPWVtxZ_%d",i)); + hist[i]->GetXaxis()->SetTitle("Reference Multiplicity"); + + TF1 *f1 = new TF1("f1","([0]/10.0) * (TMath::Erf( -[1]*(x - [2]) ) + 1)",minbin,maxbin); + f1->SetParameter(0,par0[i]); + f1->SetParameter(1,par1[i]); + f1->SetParameter(2,h[i]); + f1->SetLineWidth(5); + if(i<8){ + pad_100->cd(i+1); + pad_100->cd(i+1)->SetLogy(); + hist[i]->GetXaxis()->SetRangeUser(0,500.0); + hist[i]->Draw("E"); + f1->Draw("SAME"); + } + else if(i<16){ + pad_200->cd(i+1-8); + pad_200->cd(i+1-8)->SetLogy(); + hist[i]->GetXaxis()->SetRangeUser(0,500.0); + hist[i]->Draw("E"); + f1->Draw("SAME"); + } + else if(i<24){ + pad_300->cd(i+1-16); + pad_300->cd(i+1-16)->SetLogy(); + hist[i]->GetXaxis()->SetRangeUser(0,500.0); + hist[i]->Draw("E"); + f1->Draw("SAME"); + } + else if(i<32){ + pad_400->cd(i+1-24); + pad_400->cd(i+1-24)->SetLogy(); + hist[i]->GetXaxis()->SetRangeUser(0,500.0); + hist[i]->Draw("E"); + f1->Draw("SAME"); + } + } + + + TCanvas *allRefMult = new TCanvas("allRefMult","allRefMult",800,600); + allRefMult->cd(); + TLegend *legP = new TLegend(0.45,0.65,0.9,0.9,"","NDC"); + legP->SetNColumns(3); + int j[6]={0,0,0,0,0,0}; + bool secondrepeat = false; + for(int i=0; i<29;i++){ + clonedhist[i] = (TH1F*) hist[i]->Clone(); + if(clonedhist[i]->GetBinContent(10)==0)continue; + clonedhist[i]->Scale(1.0/clonedhist[i]->Integral(25,50)); + if(j[5]==5){j[0]=-1;j[1]=-1;j[2]=-1;j[3]=-1;j[4]=-1;j[5]=-1;secondrepeat=true;} + if(secondrepeat){j[0]=-2;j[1]=-2;j[2]=-2;j[3]=-2;j[4]=-2;j[5]=-2;} + if(i%6==0){clonedhist[i]->SetLineColor(kRed+j[0]);j[0]++;} + if(i%6==1){clonedhist[i]->SetLineColor(kOrange+j[1]);j[1]++;} + if(i%6==2){clonedhist[i]->SetLineColor(kGreen+j[2]);j[2]++;} + if(i%6==3){clonedhist[i]->SetLineColor(kCyan+j[3]);j[3]++;} + if(i%6==4){clonedhist[i]->SetLineColor(kBlue+j[4]);j[4]++;} + if(i%6==5){clonedhist[i]->SetLineColor(kMagenta+j[5]);j[5]++;} + clonedhist[i]->SetStats(0); + if(i==0)clonedhist[i]->Draw("HIST"); + else clonedhist[i]->Draw("SAME HIST"); + TString name=Form("(%d,%d)cm",(int)(-145.0+10.*(i)),(int)(-145.0+10.*(i+1))); + legP->AddEntry(clonedhist[i],name,"l"); + } + legP->Draw(); + + auto c1 = new TCanvas("c1","c1"); + TGraphErrors* g = new TGraphErrors(numHists, Vz, h, VzErr, hErr); + g->SetMarkerStyle(kFullCircle); + g->Draw("AP"); + + TGraph* g_chi = new TGraph(numHists, Vz, chi2perNDF); + auto cchi = new TCanvas("cchi","cchi"); + g_chi->SetMarkerStyle(kFullCircle); + g_chi->Draw("AP"); + + double lowedges[numHists]; + for(int i=0; iFill(Vz[i],h[i]); + upperEdge->SetBinError(i+1,hErr[i]); + } + + auto c3 = new TCanvas("c3","c3"); + TF1 *f2 = new TF1("f2","[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x+[5]*x*x*x*x*x+[6]*x*x*x*x*x*x",-145.0,145.0); + + cout<<"***************************** SIXTH-ORDER VZ CORRECTION ********************************"<Fit("f2","RMS"); + TF1 *Vzfit = upperEdge->GetFunction("f2"); + Double_t Vzchi2 = Vzfit->GetChisquare(); + cout<<"CHI2/NDF: "<GetNumberFreeParameters())< + +class StMaker; +class StChain; +class StPicoDstReader; + +const Char_t* testInFName = "/star/u/gnigmat/soft/u/centrality_definition/Centrality/input/st_physics_adc_19084053_raw_0000006.picoDst.root"; + +//________________ +void runCentralityAnalyzer(const Char_t* inFileName = testInFName, + const Char_t* oFileName = "oTestAna.root") { + + std::cout << "Start running centrality analyzer" << std::endl; + gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C"); + loadSharedLibraries(); + // Load specific libraries + gSystem->Load("StPicoEvent"); + gSystem->Load("StPicoDstMaker"); + gSystem->Load("StCentralityAnalyzer"); + + // Create new chain + StChain *chain = new StChain(); + + StPicoDstReader *reader = new StPicoDstReader(inFileName); + reader->Init(); + reader->SetStatus("*", 0); + reader->SetStatus("Event*", 1); + reader->SetStatus("Track*", 1); + reader->SetStatus("BTofPidTraits*", 1); + + StCentralityAnalyzer *anaMaker = new StCentralityAnalyzer(reader, oFileName); + anaMaker->setUsePileUp(false); + anaMaker->setVtxZCut(-35., 25.); + anaMaker->addTriggerId(600001); + anaMaker->addTriggerId(600011); + anaMaker->addTriggerId(600021); + anaMaker->addTriggerId(600031); + anaMaker->setRunIdParameters(57990, 19071030, 19129020); + + //These are found by the pileup code in ../QA/pileup + //Test parameters + double a0=-1.27785869748694, a1=0.918278154432662, a2=-0.000421651379949012, a3=1.20429516308073e-06, a4=-1.54521733920117e-09; + double b0=13.2397261316822, b1=1.46248491801055, b2=-0.00310419986439369, b3=8.21875717651988e-06, b4=-8.61348326634967e-09; + double c0=-11.2055760170529, c1=0.415626210975414, c2=0.00191757674104115, c3=-4.93833806589717e-06, c4=4.74283345256434e-09; + anaMaker->setPileUpParameters(a0,a1,a2,a3,a4,b0,b1,b2,b3,b4,c0,c1,c2,c3,c4); + + std::cout << "Initializing chain" << std::endl; + // Check that all maker has been successfully initialized + if( chain->Init() == kStErr ){ + std::cout << "Error during the chain initializtion. Exit. " << std::endl; + return; + } + std::cout << "... done" << std::endl; + + int nEvents2Process = reader->chain()->GetEntries(); + std::cout << " Number of events in files: " << nEvents2Process << std::endl; + + // Processing events + for (Int_t iEvent=0; iEventClear(); + + // Check return code + int iret = chain->Make(); + // Quit event processing if return code is not 0 + if (iret) { std::cout << "Bad return code!" << iret << endl; break; } + } // for (Int_t iEvent=0; iEventFinish(); + std::cout << "... done" << std::endl; + + std::cout << "Centrality analyzer finished the work" << std::endl; +} diff --git a/StRoot/PWGTools/CentralityCalibration/Centrality/runCentralityAnalyzer_Ru.C b/StRoot/PWGTools/CentralityCalibration/Centrality/runCentralityAnalyzer_Ru.C new file mode 100644 index 00000000000..be3963d46cf --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Centrality/runCentralityAnalyzer_Ru.C @@ -0,0 +1,109 @@ +#include + +class StMaker; +class StChain; +class StPicoDstReader; + +const Char_t* testInFName = "/star/u/gnigmat/soft/u/centrality_definition/Centrality/input/st_physics_adc_19084053_raw_0000006.picoDst.root"; + +//________________ +void runCentralityAnalyzer_Ru(const Char_t* inFileName = testInFName, + const Char_t* oFileName = "oTestAna.root") { + + std::cout << "Start running centrality analyzer" << std::endl; + gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C"); + loadSharedLibraries(); + // Load specific libraries + gSystem->Load("StPicoEvent"); + gSystem->Load("StPicoDstMaker"); + gSystem->Load("StCentralityAnalyzer"); + + // Create new chain + StChain *chain = new StChain(); + + StPicoDstReader *reader = new StPicoDstReader(inFileName); + reader->Init(); + reader->SetStatus("*", 0); + reader->SetStatus("Event*", 1); + reader->SetStatus("Track*", 0); + reader->SetStatus("BTofPidTraits*", 0); + + StCentralityAnalyzer *anaMaker = new StCentralityAnalyzer(reader, oFileName); + anaMaker->setUsePileUp(true); + anaMaker->setUseLumCorr(false); + anaMaker->setUseVzCorr(false); + anaMaker->setVtxZCut(-35., 25.); + anaMaker->addTriggerId(600001); + anaMaker->addTriggerId(600011); + anaMaker->addTriggerId(600021); + anaMaker->addTriggerId(600031); + anaMaker->setRunIdParameters(57990, 19071030, 19129020); + + //These are found by the pileup code in ../QA/pileup + //Ru pileup parameters + //--------------------------------------------------- + //double a0=-1.1761972238142, a1=0.91190057314294, a2=-0.000361521536620541, a3=9.77684373134588e-07, a4=-1.28146895587406e-09; + //double b0=13.5471357600988, b1=1.44271774447208, b2=-0.00288349264907301, b3=7.3544264332388e-06, b4=-7.54314488345979e-09; + //double c0=-11.2648623623068, c1=0.419490120285247, c2=0.001856323147039, c3=-4.68448675939297e-06, c4=4.40012904437496e-09; + //--------------------------------------------------- + //New parameters from corrected bad-runs list + double a0=-1.17135278798859, a1=0.911627701794553, a2=-0.000359098306320787, a3=9.61800858474059e-07, a4=-1.25136113760776e-09; + double b0=13.5426221755897, b1=1.44261201539344, b2=-0.00288428931227279, b3=7.35384541646783e-06, b4=-7.53407759526067e-09; + double c0=-11.2591376113937, c1=0.419541462167548, c2=0.00185578651291454, c3=-4.68933832723005e-06, c4=4.4151761900593e-09; + //--------------------------------------------------- + anaMaker->setPileUpParameters(a0,a1,a2,a3,a4,b0,b1,b2,b3,b4,c0,c1,c2,c3,c4); + + //Ru luminosity correction parameters + double lumcorr_a = -1.1624e-5; + double lumcorr_b = 98.113; + double lumcorr_bprime = 97.9927; + //--------------------------------------------------- + //--------------------------------------------------- + anaMaker->setLumCorrParameters(lumcorr_a,lumcorr_b,lumcorr_bprime); + + //Vz correction parameters for Ru+Ru + double vzCorPar0 = 302.019; + double vzCorPar1 = 0.0270308; + double vzCorPar2 = -0.0017795; + double vzCorPar3 = 0.000243777; + double vzCorPar4 = 1.18462e-05; + double vzCorPar5 = -3.3121e-07; + double vzCorPar6 = -1.22651e-08; + + anaMaker->setVzCorrParameters(vzCorPar0, vzCorPar1, vzCorPar2, vzCorPar3, vzCorPar4, vzCorPar5, vzCorPar6); + + //set shape correction weight index; 0: Ru, 1: Zr + anaMaker->setShapeIndex(0); + //--------------------------------------------------- + + std::cout << "Initializing chain" << std::endl; + // Check that all maker has been successfully initialized + if( chain->Init() == kStErr ){ + std::cout << "Error during the chain initializtion. Exit. " << std::endl; + return; + } + std::cout << "... done" << std::endl; + + int nEvents2Process = reader->chain()->GetEntries(); + std::cout << " Number of events in files: " << nEvents2Process << std::endl; + + // Processing events + for (Int_t iEvent=0; iEventClear(); + + // Check return code + int iret = chain->Make(); + // Quit event processing if return code is not 0 + if (iret) { std::cout << "Bad return code!" << iret << endl; break; } + } // for (Int_t iEvent=0; iEventFinish(); + std::cout << "... done" << std::endl; + + std::cout << "Centrality analyzer finished the work" << std::endl; +} diff --git a/StRoot/PWGTools/CentralityCalibration/Centrality/runCentralityAnalyzer_Zr.C b/StRoot/PWGTools/CentralityCalibration/Centrality/runCentralityAnalyzer_Zr.C new file mode 100644 index 00000000000..0105e407912 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Centrality/runCentralityAnalyzer_Zr.C @@ -0,0 +1,112 @@ +#include + +class StMaker; +class StChain; +class StPicoDstReader; + +const Char_t* testInFName = "/star/u/gnigmat/soft/u/centrality_definition/Centrality/input/st_physics_adc_19084053_raw_0000006.picoDst.root"; + +//________________ +void runCentralityAnalyzer_Zr(const Char_t* inFileName = testInFName, + const Char_t* oFileName = "oTestAna.root") { + + std::cout << "Start running centrality analyzer" << std::endl; + gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C"); + loadSharedLibraries(); + // Load specific libraries + gSystem->Load("StPicoEvent"); + gSystem->Load("StPicoDstMaker"); + gSystem->Load("StCentralityAnalyzer"); + + // Create new chain + StChain *chain = new StChain(); + + StPicoDstReader *reader = new StPicoDstReader(inFileName); + reader->Init(); + reader->SetStatus("*", 0); + reader->SetStatus("Event*", 1); + reader->SetStatus("Track*", 0); + reader->SetStatus("BTofPidTraits*", 0); + + StCentralityAnalyzer *anaMaker = new StCentralityAnalyzer(reader, oFileName); + anaMaker->setUsePileUp(true); + anaMaker->setUseLumCorr(false); + anaMaker->setUseVzCorr(false); + anaMaker->setVtxZCut(-35., 25.); + anaMaker->addTriggerId(600001); + anaMaker->addTriggerId(600011); + anaMaker->addTriggerId(600021); + anaMaker->addTriggerId(600031); + anaMaker->setRunIdParameters(57990, 19071030, 19129020); + + //These are found by the pileup code in ../QA/pileup + //Zr pileup parameters + //--------------------------------------------------- + //double a0=-1.21309838794601, a1=0.912951771896837, a2=-0.000367314265128479, a3=9.94347355669806e-07, a4=-1.31455343813894e-09; + //double b0=13.9009773648019, b1=1.44056038211802, b2=-0.00289508482803666, b3=7.46976650036052e-06, b4=-7.76886643291828e-09; + //double c0=-11.5092765154364, c1=0.422455652498953, c2=0.00184903353426273, c3=-4.6965709740072e-06, c4=4.43430319329608e-09; + //--------------------------------------------------- + //New parameters from corrected bad-runs list + double a0=-1.19267140255075, a1=0.912703837475103, a2=-0.000366760799818202, a3=9.94532126858323e-07, a4=-1.31386727140715e-09; + double b0=13.5244327901538, b1=1.4429201808933, b2=-0.002873496957537, b3=7.29172798142226e-06, b4=-7.45759942317285e-09; + double c0=-11.2781454979572, c1=0.420728494449501, c2=0.00184005031913895, c3=-4.61008765754698e-06, c4=4.28291905929182e-09; + //--------------------------------------------------- + anaMaker->setPileUpParameters(a0,a1,a2,a3,a4,b0,b1,b2,b3,b4,c0,c1,c2,c3,c4); + + //Zr luminosity correction parameters + //--------------------------------------------------- + double lumcorr_a = -1.3917e-4; + double lumcorr_b = 98.412; + double lumcorr_bprime = 96.9914; + //--------------------------------------------------- + anaMaker->setLumCorrParameters(lumcorr_a,lumcorr_b,lumcorr_bprime); + + //Vz correction parameters for Zr+Zr + + double vzCorPar0 = 300.296; + double vzCorPar1 = 0.0358743; + double vzCorPar2 = -0.000549242; + double vzCorPar3 = 0.000232057; + double vzCorPar4 = 5.86792e-06; + double vzCorPar5 = -2.91945e-07; + double vzCorPar6 = -6.33743e-09; + + anaMaker->setVzCorrParameters(vzCorPar0, vzCorPar1, vzCorPar2, vzCorPar3, vzCorPar4, vzCorPar5, vzCorPar6); + + //set shape correction weight index; 0: Ru, 1: Zr + anaMaker->setShapeIndex(1); + //--------------------------------------------------- + + + + std::cout << "Initializing chain" << std::endl; + // Check that all maker has been successfully initialized + if( chain->Init() == kStErr ){ + std::cout << "Error during the chain initializtion. Exit. " << std::endl; + return; + } + std::cout << "... done" << std::endl; + + int nEvents2Process = reader->chain()->GetEntries(); + std::cout << " Number of events in files: " << nEvents2Process << std::endl; + + // Processing events + for (Int_t iEvent=0; iEventClear(); + + // Check return code + int iret = chain->Make(); + // Quit event processing if return code is not 0 + if (iret) { std::cout << "Bad return code!" << iret << endl; break; } + } // for (Int_t iEvent=0; iEventFinish(); + std::cout << "... done" << std::endl; + + std::cout << "Centrality analyzer finished the work" << std::endl; +} diff --git a/StRoot/PWGTools/CentralityCalibration/CentralityChecker/GetCentrality.C b/StRoot/PWGTools/CentralityCalibration/CentralityChecker/GetCentrality.C new file mode 100644 index 00000000000..2551aae1f88 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/CentralityChecker/GetCentrality.C @@ -0,0 +1,84 @@ +// ROOT headers +#include "TMath.h" +#include "TRandom3.h" +#include "TCanvas.h" +#include "TF1.h" +#include "TH1D.h" +#include "TH1D.h" +#include "TGraph.h" +#include "TAxis.h" +#include "TGraph2D.h" +#include "TGraphErrors.h" +#include "TH1F.h" +#include "TH1F.h" +#include "TFile.h" +#include "TNtuple.h" + +// C++ headers +#include +#include +#include +#include + +//_________________ +void getcentralitybins() { + TFile *f0 = new TFile("Case3/Zr/Ratio_npp2.386_k3.889_x0.123_eff0.024.root"); + TH1D *sim = (TH1D *)f0->Get("hRefMultSim"); + TH1D *data = (TH1D *)f0->Get("hRefMult"); + + int centralitybin[16][2]; + double integral = sim->Integral(); + for(int cent=0; cent<16; cent++){ + double distance = 1000.0; + double fraction = 0.05*((double)cent+1.0); + //For the most central bins, integrate the data + if(cent<4){ + for(int i=0; iGetNbinsX(); i++){ + double thisfraction = (data->Integral(i,500))/(integral); + double thisdistance = TMath::Abs(thisfraction - fraction); + if(thisdistance>distance){ + if(cent==0){centralitybin[0][0]=500; centralitybin[0][1]=i-1;centralitybin[1][0]=i-2;} + else{centralitybin[cent][1]=i-1;centralitybin[cent+1][0]=i-2;} + break; + } + else{distance=thisdistance;} + } + } + //For more peripheral bins, integrate the simulated distribution + else{ + int newmaxbin = centralitybin[3][1]-1; + double zeroToTwentyIntegral = data->Integral(newmaxbin+1,500); + for(int i=0; iIntegral(i,newmaxbin)+zeroToTwentyIntegral)/(integral); + double thisdistance = TMath::Abs(thisfraction - fraction); + if(thisdistance>distance){ + if(cent==15){centralitybin[15][1]=i-2;} + else{centralitybin[cent][1]=i-1;centralitybin[cent+1][0]=i-2;} + break; + } + else{distance=thisdistance;} + } + } + } + + std::cout<<"******* 16 Bins *******"< + +ClassImp(StCentralityAnalyzer) + + +//________________ +StCentralityAnalyzer::StCentralityAnalyzer(StPicoDstReader *reader, + const Char_t* oFileName): +mOutFileName(oFileName), mOutFile(nullptr), mReader(reader), mDst(nullptr), + mTriggerIdCollection(), mEventsPassed(0), mDebug(kFALSE), + hRefMult(nullptr), hGRefMult(nullptr), hPrimVertNum(nullptr), hPrimVertZ(nullptr), + hZdcAdcEast(nullptr), hZdcAdcWest(nullptr), hZdcAdcSum(nullptr), hZdcCoincidenceRate(nullptr), + hEpdAdcEast(nullptr), hEpdAdcWest(nullptr), hEpdAdcSum(nullptr), + hPrimVertXvsY(nullptr), hPrimVertVpdVzDiff(nullptr), hRefMultVsTofTrayMult(nullptr), + hGRefMultVsTofTrayMult(nullptr), hRefMultVsTofMatched(nullptr), hRefMultVsBemcMatch(nullptr), + hRefMultVsRunNumber(nullptr), hGRefMultVsRunNumber(nullptr), hTofTrayMultVsRunNumber(nullptr), + hRefMultVsZdcCoincidenceRate(nullptr),hZdcAdcSumVsRunNumber(nullptr), hPrimTrackPtVsRunNumber(nullptr), + hPrimTrackNHitsVsRunNumber(nullptr), hPrimTrackDedxVsRunNumber(nullptr), + hGlobTrackPtVsRunNumber(nullptr), hGlobTrackNHitsVsRunNumber(nullptr), + hGlobTrackDedxVsRunNumber(nullptr), hAvgRefMultVsZdcCoincidenceRate(nullptr) { + + mVtxZ[0] = -70.; mVtxZ[1] = 70.; + mVtxR[0] = 0.; mVtxR[1] = 2.; + mVtxXShift = 0.; mVtxYShift = 0.; + mVpdVzDiff[0] = -5.; mVpdVzDiff[1] = 5.; + mRefMult[0] = 0.; mRefMult[1] = 1000.; + // Next numbers are for isobar runs + mRunIdBins = 57990; + mRunIdRange[0] = 19071030; mRunIdRange[1] = 19129020; + mMom[0] = 0.1; mMom[1] = 1e9; + mEta[0] = -1.; mEta[1] = 1.; + mNHits[0] = 15; mNHits[1] = 100; + mNHitsRatio[0] = 0.; mNHitsRatio[1] = 1.1; +} + +//________________ +StCentralityAnalyzer::~StCentralityAnalyzer() { + /* empty */ +} + +//________________ +Int_t StCentralityAnalyzer::Init() { + if ( !mReader ) { + std::cout << "No StPicoDstReader has been provided" << std::endl; + return kStErr; + } + + mDst = mReader->picoDst(); + if ( !mDst ) { + std::cout << "No StPicoDst has been retrieved from reader" << std::endl; + return kStErr; + } + + mOutFile = new TFile(mOutFileName, "recreate"); + createHistograms(); + + return StMaker::Init(); +} + +//________________ +Int_t StCentralityAnalyzer::Finish() { + if( mOutFile ) { + std::cout << "StCentralityAnalyzer::Finish - Writing histograms to the output file..."; + mOutFile->Write(); + mOutFile->Close(); + std::cout << "\t [DONE]" << std::endl; + } + + return kStOK; +} + +//________________ +Int_t StCentralityAnalyzer::Make() { + + mEventsPassed++; + Bool_t readEvent = mReader->readPicoEvent(mEventsPassed); + //std::cout << "Working on event# " << mEventsPassed << std::endl; + + StPicoEvent* event = mDst->event(); + TRandom3* rndm3 = new TRandom3(0); + + if ( !event ) { + std::cout << "No StPicoEvent has been retrieved from DST" << std::endl; + return kStSkip; + } + + // Skip bad runs + if ( isInBadRunList( event->runId() ) ) return kStOk; + + // Skip bad events + if ( !isGoodEvent(event) ) return kStOk; + + //std::cout << "Event vtxZ: " << event->primaryVertex().Z() << std::endl; + double VtxX = event->primaryVertex().X(); + double VtxY = event->primaryVertex().Y(); + double VtxZ = event->primaryVertex().Z(); + double VzVpd = event->vzVpd(); + + // Fill event information + Double_t refMult = event->refMult(); + + // Luminosity correction + if(mUseLumCorr){ + Double_t thislumcorr = calculateLumCorr(event->ZDCx()); + double zeroToOne = rndm3->Rndm(); + double nonIntegerRefMult = (Double_t)(refMult)-0.5+zeroToOne; + refMult = TMath::Nint(nonIntegerRefMult*thislumcorr); + } + + //fill tree + mTree_Vz = VtxZ; + mTree_ZDCx = event->ZDCx(); + mTree_refMult = refMult; + + //correct refMult Vz dependence + if(mUseVzCorr){ + refMult = getRefMultCorrVz(refMult, VtxZ); + mTree_refMultCor = refMult; + } + mTree_nBTOFMatched = event->nBTOFMatch(); + mTree->Fill(); + + //RefMult shape weight + //Double weight = getShapeWeight(VtxZ, refMult); + //it should be used like hRefMult->Fill(refMult, weight); + + Int_t grefMult = event->grefMult(); + + double VtxZBinDouble = VtxZ/2. + 36.; //change this if Vz histogram labels change + if(VtxZ==73.0) hRefMultVtxZ[72]->Fill(refMult); //edge case + else if(VtxZ==-73.0) hRefMultVtxZ[0]->Fill(refMult); //edge case + else if(VtxZBinDouble - (int)VtxZBinDouble == 0.5){ //more likely edge case, filling both hists if Vz is on boundary + hRefMultVtxZ[(int)VtxZBinDouble]->Fill(refMult); + hRefMultVtxZ[(int)VtxZBinDouble+1]->Fill(refMult); + } + else hRefMultVtxZ[TMath::Nint(VtxZBinDouble)]->Fill(refMult); //most events by far + + hPrimVertXvsY->Fill(VtxX, VtxY); + hPrimVertZ->Fill(VtxZ); + hPrimVertVpdVzDiff->Fill(VtxZ-VzVpd); + + // Will be faster than direct call in case of simultanious usage + UInt_t runId = event->runId(); + + hRefMult->Fill( refMult ); + hGRefMult->Fill( grefMult ); + hRefMultVsRunNumber->Fill( runId, refMult ); + hRefMultVsTofTrayMult->Fill( refMult, event->btofTrayMultiplicity() ); + hRefMultVsTofMatched->Fill( event->nBTOFMatch() , refMult ); + hGRefMultVsTofTrayMult->Fill( grefMult, event->btofTrayMultiplicity() ); + hGRefMultVsTofMatched->Fill( grefMult, event->nBTOFMatch() ); + hRefMultVsRunNumber->Fill( runId, refMult ); + hGRefMultVsRunNumber->Fill( runId, grefMult ); + hRefMultVsZdcCoincidenceRate->Fill(event->ZDCx(),refMult); + hAvgRefMultVsZdcCoincidenceRate->Fill(event->ZDCx(), refMult); + hZdcCoincidenceRateVsRunNumber->Fill( runId, event->ZDCx() ); + hTofTrayMultVsRunNumber->Fill( runId, event->btofTrayMultiplicity() ); + hTofMatchedVsRunNumber->Fill( runId, event->nBTOFMatch() ); + + std::vector TheseTrigs = event->triggerIds(); + for(int jTrigs=0; jTrigsFill(event->ZDCx(), refMult); + if(thisTrig==600011) hAvgRefMultVsZdcCoincidenceRateForTrig[1]->Fill(event->ZDCx(), refMult); + if(thisTrig==600021) hAvgRefMultVsZdcCoincidenceRateForTrig[2]->Fill(event->ZDCx(), refMult); + if(thisTrig==600031) hAvgRefMultVsZdcCoincidenceRateForTrig[3]->Fill(event->ZDCx(), refMult); + } + + for ( UInt_t iTrk=0; iTrknumberOfTracks(); iTrk++ ) { + StPicoTrack* track = mDst->track( iTrk ); + if ( !track ) continue; + + if ( !isGoodTrack( track ) ) continue; + + // Fill track information + hGlobTrackNHitsVsRunNumber->Fill( runId, track->nHits() ); + hGlobTrackPtVsRunNumber->Fill( runId, track->gPt() ); + } // for ( Int_t iTrk=0; iTrknumberOfTracks(); iTrk++ ) + + return kStOK; +} + +//________________ +void StCentralityAnalyzer::Clear(Option_t *opt) { + StMaker::Clear(); +} + +//________________ +//Informed by https://drupal.star.bnl.gov/STAR/system/files/Centrality_for_Run18_27GeVAuAu_ZaochenYe_20190827.pdf +Double_t StCentralityAnalyzer::calculateLumCorr(Double_t ZDCx) { + double f_ZDCx = m_LumCorr_a*ZDCx + m_LumCorr_b; + double LumCorr = m_LumCorr_bprime/(f_ZDCx); + return LumCorr; +} + +//________________ +Bool_t StCentralityAnalyzer::isGoodEvent(StPicoEvent* ev) { + Bool_t goodEvent = ( isGoodVertex( ev->primaryVertex().X(), + ev->primaryVertex().Y(), + ev->primaryVertex().Z(), + ev->vzVpd() ) && + isGoodTrigger( ev->triggerIds() ) ); + Bool_t pileUpRejected = true; + if(mUsePileUp){ + pileUpRejected = isNotPileUp( ev->refMult(), ev->nBTOFMatch() ); + } + return ( goodEvent && pileUpRejected ); +} + +//________________ +void StCentralityAnalyzer::addTriggerId(const unsigned int& id) { + Bool_t isInList = ( std::find(mTriggerIdCollection.begin(), mTriggerIdCollection.end(), id) != mTriggerIdCollection.end() ); + if ( !isInList ) { + mTriggerIdCollection.push_back( id ); + } +} + +//________________ +Bool_t StCentralityAnalyzer::isNotPileUp(UShort_t refMult, UShort_t btofMatched) { + + //double refmultcutmode=m_a0+m_a1*(btofMatched)+m_a2*pow(btofMatched,2)+m_a3*pow(btofMatched,3)+m_a4*pow(btofMatched,4); + double refmultcutmax = ( m_b0 + m_b1*(btofMatched) + m_b2*pow(btofMatched,2) + + m_b3*pow(btofMatched,3) + m_b4*pow(btofMatched,4) ); + double refmultcutmin = ( m_c0 + m_c1*(btofMatched) + m_c2*pow(btofMatched,2) + + m_c3*pow(btofMatched,3) + m_c4*pow(btofMatched,4) ); + + return ( refMultrefmultcutmin ); +} + +//_________________ +Bool_t StCentralityAnalyzer::isInBadRunList(unsigned int runId) { + Bool_t isInRuRu_200GeV = ( std::find( bad_run_list_ruru_200gev.begin(), bad_run_list_ruru_200gev.end(), runId) != bad_run_list_ruru_200gev.end() ); + Bool_t isInZrZr_200GeV = ( std::find( bad_run_list_zrzr_200gev.begin(), bad_run_list_zrzr_200gev.end(), runId) != bad_run_list_zrzr_200gev.end() ); + + return ( isInRuRu_200GeV || isInZrZr_200GeV ); +} + +//________________ +Bool_t StCentralityAnalyzer::isGoodTrigger(std::vector triggers) { + Bool_t isInList = false; + for ( unsigned int i=0; i mVtxZ[0]) && (z < mVtxZ[1]) ); + mIsGoodPositionR = ( vtxPositionR >= mVtxR[0] && vtxPositionR < mVtxR[1] ); + mIsGoodVpdVzDiff = ( vpdVzDiff > mVpdVzDiff[0] && vpdVzDiff < mVpdVzDiff[1] ); + + if(mDebug) { + Bool_t isGoodVertex = ( mIsGoodPositionZ && mIsGoodPositionR && mIsGoodVpdVzDiff ); + std::cout << "IsGoodVertex: " << isGoodVertex << " : " << std::endl; + std::cout << "position z: " << z << " IsGood: " << mIsGoodPositionZ << std::endl + << "position r: " << vtxPositionR << " IsGood: " << mIsGoodPositionR << std::endl + << "vpdvz diff: " << vpdVzDiff << " IsGood: " << mIsGoodVpdVzDiff << std::endl; + } //if(mDebug) + + return ( mIsGoodPositionZ && mIsGoodPositionR && mIsGoodVpdVzDiff ); +} + +//________________ +Bool_t StCentralityAnalyzer::isGoodTrack(StPicoTrack *trk) { + Bool_t mGoodTrk = false; + Float_t hitRatio = ( (float)trk->nHitsFit() / (float)trk->nHitsMax() ); + mGoodTrk = ( (trk->gPtot() >= mMom[0]) && (trk->gPtot() <= mMom[1]) && + (trk->gPt() >= 0.1) && + (trk->gMom().Eta() >= mEta[0]) && + (trk->gMom().Eta() <= mEta[1]) && + (trk->nHits() >= mNHits[0]) && + (trk->nHits() <= mNHits[1]) && + (hitRatio >= mNHitsRatio[0]) && + (hitRatio <= mNHitsRatio[1]) ); + + if(mDebug) { + std::cout << "IsGoodTrack: " << mGoodTrk << " : " << std::endl + << "primary : " << trk->isPrimary() << std::endl + << "gPtot : " << trk->gPtot() << std::endl + << "gPt : " << trk->gPt() << std::endl + << "gEta : " << trk->gMom().Eta() << std::endl; + if( trk->isPrimary() ) { + std::cout << "Ptot : " << trk->pMom().Mag() << std::endl + << "Pt : " << trk->pMom().Perp() << std::endl + << "Eta : " << trk->pMom().Eta() << std::endl; + } //if( trk->isPrimary() ) + + std::cout << "nhits : " << trk->nHits() << std::endl + << "hitRatio: " << hitRatio << std::endl; + } //if(mDebug) + return mGoodTrk; +} + +//________________ +void StCentralityAnalyzer::createHistograms() { + createEventHistograms(); + createGlobalTrackHistograms(); + createPrimaryTrackHistograms(); +} + +//________________ +void StCentralityAnalyzer::createEventHistograms() { + std::cout << "Creating event histograms..."; + + mTree = new TTree("mTree","backup tree for refMult correction"); + mTree->Branch("ZDCx", &mTree_ZDCx, "ZDCx/D"); + mTree->Branch("Vz", &mTree_Vz, "Vz/D"); + mTree->Branch("refMult", &mTree_refMult, "refMult/D"); + mTree->Branch("refMultCor", &mTree_refMultCor, "refMultCor/D"); + mTree->Branch("nBTOFMatched", &mTree_nBTOFMatched, "nBTOFMatched/D"); + + Int_t refMultBins = 500; + Float_t refMult[2] = { -0.5, 499.5 }; + hRefMult = new TH1F( Form("hRefMult"), + Form("refMult;refMult;events"), + refMultBins, refMult[0], refMult[1]); + for ( Int_t iBin=0; iBin<73; iBin++ ) { + Float_t zmin = -73.; + Float_t zstep = 2.; + Float_t zrange[2] = { zmin + iBin*zstep, zmin + (iBin+1)*zstep}; + hRefMultVtxZ[iBin] = new TH1F( Form("hRefMultVtxZ_%d",iBin), + Form("Reference multiplicity for %3.1f #leq z #leq %3.1f",zrange[0],zrange[1]), + refMultBins, refMult[0], refMult[1] ); + } // for ( Int_t iBin=0; iBin<73; iBin++ ) + hGRefMult = new TH1F( Form("hGRefMult"), + Form("gRefMult;gRefMult;events"), + 2500, -0.5, 2499.5); + hPrimVertNum = new TH1F( Form("hPrimVertNum"), + Form("hPrimVertNum;Number of pVtx; events"), + 15, -0.5, 14.5); + hPrimVertZ = new TH1F( Form("hPrimVertZ"), Form("hPrimVertZ;z (cm);events/4 cm"), 110, -220., 220.); + hPrimVertXvsY = new TH2F( Form("hPrimVertXvsY"), + Form("hPrimVertXvsY;x (cm);y (cm);events"), + 40, -10., 10., 40, -10., 10.); + hPrimVertVpdVzDiff = new TH1F( Form("hPrimVertVpdVzDiff"), + Form("hPrimVertVpdVzDiff;Vz_{TPC}-Vz_{VPD} (cm);events"), + 40, -20., 20.); + hRefMultVsTofTrayMult = new TH2F( Form("hRefMultVsTofTrayMult"), + Form("hRefMultVsTofTrayMult;refMult;btofTrayMultiplicity;events"), + 650, -0.5, 649.5, 650, -0.5, 649.5 ); + hRefMultVsTofMatched = new TH2F( Form("hRefMultVsTofMatched"), + Form("hRefMultVsTofTrayMult;btofMatched;refMult;events"), + 650, -0.5, 649.5, 650, -0.5, 649.5 ); + hGRefMultVsTofTrayMult = new TH2F( Form("hGRefMultVsTofTrayMult"), + Form("hGRefMultVsTofTrayMult;gRefMult;btofTrayMultiplicity;events"), + 1950, -0.5, 1949.5, + 650, -0.5, 649.5); + hGRefMultVsTofMatched = new TH2F( Form("hGRefMultVsTofMatched"), + Form("hGRefMultVsTofTrayMult;gRefMult;BTofMatched;events"), + 1950, -0.5, 1949.5, + 650, -0.5, 649.5); + hRefMultVsZdcCoincidenceRate = new TH2F( Form("hRefMultVsZdcCoincidenceRate"), + Form("hRefMultVsZdcCoincidenceRate;ZdcCoincidenceRate (Hz);refMult"), + 700, 6000., 15000.,650,-0.5,649.5); + hRefMultVsRunNumber = new TProfile( Form("hRefMultVsRunNumber"), + Form("hRefMultVsRunNumber;runId;"), + mRunIdBins, mRunIdRange[0], mRunIdRange[1] ); + hAvgRefMultVsZdcCoincidenceRate = new TProfile( Form("hAvgRefMultVsZdcCoincidenceRate"), + Form("hAvgRefMultVsZdcCoincidenceRate;ZdcCoincidenceRate (Hz);"), + 700, 6000., 15000.); + int Trigs[4]={600001,600011,600021,600031}; + for(int iTrig=0; iTrig<4; iTrig++){ + hAvgRefMultVsZdcCoincidenceRateForTrig[iTrig] = new TProfile( Form("hAvgRefMultVsZdcCoincidenceRateForTrig_%d",Trigs[iTrig]), + Form("hAvgRefMultVsZdcCoincidenceRate_%d;ZdcCoincidenceRate (Hz);",Trigs[iTrig]), + 700, 6000., 15000.); + } + + hGRefMultVsRunNumber = new TProfile( Form("hGRefMultVsRunNumber"), + Form("hGRefMultVsRunNumber;runId;"), + mRunIdBins, mRunIdRange[0], mRunIdRange[1] ); + hZdcCoincidenceRateVsRunNumber = new TProfile( Form("hZdcCoincidenceRateVsRunNumber"), + Form("hZdcCoincidenceRateVsRunNumber;runId; (kHz)"), + mRunIdBins, mRunIdRange[0], mRunIdRange[1] ); + hTofTrayMultVsRunNumber = new TProfile( Form("hTofTrayMultVsRunNumber"), + Form("hTofTrayMultVsRunNumber;runId;btofTrayMult"), + mRunIdBins, mRunIdRange[0], mRunIdRange[1] ); + hTofMatchedVsRunNumber = new TProfile( Form("hTofMatchedVsRunNumber"), + Form("hTofTrayMultVsRunNumber;runId;BTofMatched"), + mRunIdBins, mRunIdRange[0], mRunIdRange[1] ); + + std::cout << "\t[DONE]" << std::endl; +} + +//________________ +void StCentralityAnalyzer::createGlobalTrackHistograms() { + std::cout << "Creating global track histograms..."; + hGlobTrackNHitsVsRunNumber = new TProfile( Form("hGlobTrackNHitsVsRunNumber"), + Form("hGlobTrackNHitsVsRunNumber;runId;primary track "), + mRunIdBins, mRunIdRange[0], mRunIdRange[1] ); + hGlobTrackDedxVsRunNumber = new TProfile( Form("hGlobTrackDedxVsRunNumber"), + Form("hGlobTrackDedxVsRunNumber;runId;primary track (keV/cm)"), + mRunIdBins, mRunIdRange[0], mRunIdRange[1] ); + hGlobTrackPtVsRunNumber = new TProfile( Form("hGlobTrackPtVsRunNumber"), + Form("hGlobTrackPtVsRunNumber;runId;global track (GeV/c)"), + mRunIdBins, mRunIdRange[0], mRunIdRange[1] ); + std::cout << "\t[DONE]" << std::endl; +} + +//________________ +void StCentralityAnalyzer::createPrimaryTrackHistograms() { + std::cout << "Creating primary track histograms..."; + hPrimTrackPtVsRunNumber = new TProfile( Form("hPrimTrackPtVsRunNumber"), + Form("hPrimTrackPtVsRunNumber;runId;primary track (GeV/c)"), + mRunIdBins, mRunIdRange[0], mRunIdRange[1] ); + hPrimTrackNHitsVsRunNumber = new TProfile( Form("hPrimTrackNHitsVsRunNumber"), + Form("hPrimTrackNHitsVsRunNumber;runId;primary track "), + mRunIdBins, mRunIdRange[0], mRunIdRange[1] ); + hPrimTrackDedxVsRunNumber = new TProfile( Form("hPrimTrackDedxVsRunNumber"), + Form("hPrimTrackDedxVsRunNumber;runId;primary track (keV/cm)"), + mRunIdBins, mRunIdRange[0], mRunIdRange[1] ); + std::cout << "\t[DONE]" << std::endl; +} + +//_________________ +const std::vector StCentralityAnalyzer::bad_run_list_ruru_200gev = { + 19120009,19102023,19102054,19103022, + 19083049, 19083050, 19083051, 19083052, 19083053, + 19083054, 19083055, 19083056, 19083057, 19083058, + 19083059, 19083060, 19083061, 19083062, 19083063, + 19083064, 19083065, 19083066, 19083067, 19084001, + 19084002, 19084003, 19084004, 19084005, 19084006, + 19084007, 19084008, 19084010, 19084011, 19084013, + 19084022, 19084024, 19084025, 19084026, 19084027, + 19084028, 19084029, 19084030, 19084031, 19084032, + 19084033, 19084034, 19084035, 19084036, 19084037, + 19084038, 19084039, 19084053, 19084055, 19084057, + 19084059, 19084060, 19084061, 19084062, 19084063, + 19084064, 19084065, 19084066, 19084067, 19084068, + 19084070, 19084071, 19084072, 19085001, 19085002, + 19085003, 19085004, 19085005, 19085006, 19085007, + 19085008, 19085009, 19085010, 19085011, 19085012, + 19085013, 19085014, 19085015, 19085016, 19085017, + 19085018, 19085019, 19085020, 19085021, 19085023, + 19085024, 19085025, 19085026, 19085058, 19086026, + 19086060, 19086061, 19086062, 19086063, 19086064, + 19086066, 19086067, 19086069, 19086070, 19086072, + 19086073, 19086074, 19086076, 19086077, 19086080, + 19087001, 19087012, 19087014, 19087015, 19087016, + 19087017, 19087021, 19087022, 19087038, 19087042, + 19088051, 19088052, 19088053, 19088055, 19090009, + 19090010, 19090011, 19090012, 19090015, 19090016, + 19090018, 19090019, 19090021, 19090022, 19090023, + 19090024, 19090025, 19090032, 19092051, 19093042, + 19093043, 19095061, 19096002, 19096005, 19096006, + 19096057, 19097057, 19098017, 19098018, 19098020, + 19100045, 19103007, 19103041, 19105024, 19105026, + 19106023, 19106034, 19107045, 19110015, 19110039, + 19112012, 19112029, 19115020, 19116035, 19120047, + 19120048, 19122004, 19122005 + /* Here will be some runIds in the format: 11111111, 22222222, etc */ +}; + +//_________________ +const std::vector StCentralityAnalyzer::bad_run_list_zrzr_200gev = { + 19120009,19102023,19102054,19103022, + 19083049, 19083050, 19083051, 19083052, 19083053, + 19083054, 19083055, 19083056, 19083057, 19083058, + 19083059, 19083060, 19083061, 19083062, 19083063, + 19083064, 19083065, 19083066, 19083067, 19084001, + 19084002, 19084003, 19084004, 19084005, 19084006, + 19084007, 19084008, 19084010, 19084011, 19084013, + 19084022, 19084024, 19084025, 19084026, 19084027, + 19084028, 19084029, 19084030, 19084031, 19084032, + 19084033, 19084034, 19084035, 19084036, 19084037, + 19084038, 19084039, 19084053, 19084055, 19084057, + 19084059, 19084060, 19084061, 19084062, 19084063, + 19084064, 19084065, 19084066, 19084067, 19084068, + 19084070, 19084071, 19084072, 19085001, 19085002, + 19085003, 19085004, 19085005, 19085006, 19085007, + 19085008, 19085009, 19085010, 19085011, 19085012, + 19085013, 19085014, 19085015, 19085016, 19085017, + 19085018, 19085019, 19085020, 19085021, 19085023, + 19085024, 19085025, 19085026, 19085058, 19086026, + 19086060, 19086061, 19086062, 19086063, 19086064, + 19086066, 19086067, 19086069, 19086070, 19086072, + 19086073, 19086074, 19086076, 19086077, 19086080, + 19087001, 19087012, 19087014, 19087015, 19087016, + 19087017, 19087021, 19087022, 19087038, 19087042, + 19088051, 19088052, 19088053, 19088055, 19090009, + 19090010, 19090011, 19090012, 19090015, 19090016, + 19090018, 19090019, 19090021, 19090022, 19090023, + 19090024, 19090025, 19090032, 19092051, 19093042, + 19093043, 19095061, 19096002, 19096005, 19096006, + 19096057, 19097057, 19098017, 19098018, 19098020, + 19100045, 19103007, 19103041, 19105024, 19105026, + 19106023, 19106034, 19107045, 19110015, 19110039, + 19112012, 19112029, 19115020, 19116035, 19120047, + 19120048, 19122004, 19122005 + /* Here will be some runIds in the format: 11111111, 22222222, etc */ +}; + +//_________________ +Double_t StCentralityAnalyzer::getRefMultCorrVz(Double_t RefMult, Double_t Vz){ + + const Double_t RefMult_ref = m_vzCorr0; //RefMult at |z|<1. + const Double_t RefMult_z = m_vzCorr0 + + m_vzCorr1*Vz + m_vzCorr2*pow(Vz, 2) + + m_vzCorr3*pow(Vz, 3) + m_vzCorr4*pow(Vz, 4) + + m_vzCorr5*pow(Vz, 5) + m_vzCorr6*pow(Vz, 6); + + Double_t ScaleFactor = 1.0; + + if(RefMult_z > 0.0){ + ScaleFactor = RefMult_ref / RefMult_z; + } + + return RefMult * ScaleFactor; + +} + +//_________________ +Double_t StCentralityAnalyzer::getShapeWeight(Double_t Vz, Double_t RefMult){ + + // no shape correction for -9<=Vz<=9 + if(Vz>=-9 && Vz<=9) return 1.; + //obtain index to load weight + Double_t VtxZBinDouble = Vz/2. + 17.; + Int_t VzIndex = 0; + if(Vz == 25.) VzIndex = 29; + else if(Vz == -35.) VzIndex = 0; + else VzIndex = TMath::Nint(VtxZBinDouble); + //handle VzIndex for Vz>9 + if(VzIndex >= 22) VzIndex = VzIndex - 9; + //retrive shape weight + Double_t weight = ShapeWeightArray[mShapeIndex][VzIndex][TMath::Nint(RefMult)]; + //handle bad weight + if(weight == 0 || TMath::IsNaN(weight)) weight = 1.; + return weight; + +} diff --git a/StRoot/PWGTools/CentralityCalibration/CentralityChecker/Makers/StCentralityAnalyzer/StCentralityAnalyzer.h b/StRoot/PWGTools/CentralityCalibration/CentralityChecker/Makers/StCentralityAnalyzer/StCentralityAnalyzer.h new file mode 100644 index 00000000000..0f54291e51f --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/CentralityChecker/Makers/StCentralityAnalyzer/StCentralityAnalyzer.h @@ -0,0 +1,205 @@ +/** + * \class StCentralityAnalyzer + * \brief Process and build distributions for centrality determination + * + * The StPiStCentralityAnalyzer processes + * Most of the members are copied from StMuEvent. + * \author Grigory Nigmatkulov + */ + +#ifndef StCentralityAnalyzer_h +#define StCentralityAnalyzer_h + +// STAR classes +#include "StMaker.h" + +// PicoDst headers +#include "StPicoEvent/StPicoDstReader.h" +#include "StPicoEvent/StPicoEvent.h" +#include "StPicoEvent/StPicoTrack.h" +#include "StPicoEvent/StPicoBTofPidTraits.h" +#include "StPicoEvent/StPicoDst.h" + +// ROOT headers +#include "TFile.h" +#include "TH1.h" +#include "TH2.h" +#include "TProfile.h" +#include "TRandom3.h" + +// C++ headers +#include + +//________________ +class StCentralityAnalyzer : public StMaker { + public: + // Constructor + StCentralityAnalyzer(StPicoDstReader *reader, const Char_t* oFileName); + // Destructor + virtual ~StCentralityAnalyzer(); + + // Standard StMaker inherited methods + virtual Int_t Init(); + virtual Int_t Make(); + virtual Int_t Finish(); + void Clear(Option_t *option=""); + + // Set cuts, limits and triggers + void addTriggerId(const unsigned int& id); + void setDebugStatus(bool status) { mDebug = status; } + void setUsePileUp(bool pileup) { mUsePileUp = pileup; } + void setUseLumCorr(bool lumcorr) { mUseLumCorr = lumcorr; } + void setUseVzCorr(bool vzcorr) { mUseVzCorr = vzcorr; } + void setRunIdParameters(unsigned int& bins, double& lo, double hi) { mRunIdBins=bins; mRunIdRange[0]=lo; mRunIdRange[1]=hi; } + void setVtxZCut(const float& lo, const float& hi) { mVtxZ[0]=lo; mVtxZ[1]=hi; } + void setVtxRCut(const float& lo, const float& hi) { mVtxR[0]=lo; mVtxR[1]=hi; } + void setVtxPositionShift(const float& x, const float& y) { mVtxXShift=x; mVtxYShift=y; } + void setVtxVpdVzCut(const float& lo, const float& hi) { mVpdVzDiff[0]=lo; mVpdVzDiff[1]=hi; } + + void setPileUpParameters(double a0,double a1,double a2,double a3,double a4, + double b0,double b1,double b2,double b3,double b4, + double c0,double c1,double c2,double c3,double c4) + { m_a0=a0; m_a1=a1; m_a2=a2; m_a3=a3; m_a4=a4; + m_b0=b0; m_b1=b1; m_b2=b2; m_b3=b3; m_b4=b4; + m_c0=c0; m_c1=c1; m_c2=c2; m_c3=c3; m_c4=c4;} + + void setLumCorrParameters(double lumcorr_a, double lumcorr_b, double lumcorr_bprime) + { m_LumCorr_a = lumcorr_a; m_LumCorr_b = lumcorr_b; m_LumCorr_bprime = lumcorr_bprime; } + + void setVzCorrParameters(double vzCorPar0, double vzCorPar1, double vzCorPar2, double vzCorPar3, double vzCorPar4, double vzCorPar5, double vzCorPar6) + { + m_vzCorr0 = vzCorPar0; + m_vzCorr1 = vzCorPar1; + m_vzCorr2 = vzCorPar2; + m_vzCorr3 = vzCorPar3; + m_vzCorr4 = vzCorPar4; + m_vzCorr5 = vzCorPar5; + m_vzCorr6 = vzCorPar6; + } + + //set shape correction index, 0: Ru, 1: Zr + void setShapeIndex(Int_t index) {mShapeIndex = index;} + + Double_t getShapeWeight(Double_t Vz, Double_t RefMult); + + private: + // Histogram creation + void createHistograms(); + void createEventHistograms(); + void createPrimaryTrackHistograms(); + void createGlobalTrackHistograms(); + + // Methods to check whether + Bool_t isGoodEvent(StPicoEvent* event); + Bool_t isGoodVertex(Float_t x, Float_t y, Float_t z, Float_t vpdVz); + Bool_t isGoodTrigger(std::vector ids); + Bool_t isNotPileUp(UShort_t refMult, UShort_t btofMatched); + Bool_t isGoodTrack(StPicoTrack* track); + Bool_t isInBadRunList(unsigned int runId); + + // Method for luminosity correction + Double_t calculateLumCorr(Double_t ZDCx); + + //Function to correct refmult Vz dependence + Double_t getRefMultCorrVz(Double_t RefMult, Double_t Vz); + + const Char_t *mOutFileName; + TFile *mOutFile; + StPicoDstReader *mReader; + StPicoDst* mDst; + std::vector mTriggerIdCollection; + + UInt_t mEventsPassed; + + Bool_t mDebug; + Bool_t mUsePileUp; + Bool_t mUseLumCorr; + Bool_t mUseVzCorr; + + // Pileup Parameters + Double_t m_a0, m_a1, m_a2, m_a3, m_a4; + Double_t m_b0, m_b1, m_b2, m_b3, m_b4; + Double_t m_c0, m_c1, m_c2, m_c3, m_c4; + + // Luminosity Correction Parameters + Double_t m_LumCorr_a; + Double_t m_LumCorr_b; + Double_t m_LumCorr_bprime; + + //a backup tree to confirm vz correciton + TTree *mTree; + Double_t mTree_Vz; + Double_t mTree_ZDCx; + Double_t mTree_refMult; + Double_t mTree_refMultCor; + Double_t mTree_nBTOFMatched; + + + // Vz Correction Parameters + Double_t m_vzCorr0, m_vzCorr1, m_vzCorr2, m_vzCorr3, m_vzCorr4, m_vzCorr5, m_vzCorr6; + //Shape correction index, 0: Ru, 1: Zr + Int_t mShapeIndex; + + // Bad run list for Ru+Ru at 200 GeV + static const std::vector bad_run_list_ruru_200gev; + // Bad run list for Zr+Zr at 200 GeV + static const std::vector bad_run_list_zrzr_200gev; + + // Event cuts + Float_t mVtxZ[2]; + Float_t mVtxR[2]; + Float_t mVtxXShift, mVtxYShift; + Float_t mVpdVzDiff[2]; + Float_t mRefMult[2]; + UInt_t mRunIdBins; + Double_t mRunIdRange[2]; + + // Track cuts + Float_t mMom[2]; + Float_t mEta[2]; + Float_t mNHits[2]; + Float_t mNHitsRatio[2]; + + ////////////////////// + // Histograms // + ////////////////////// + TH1F* hRefMult; + TH1F* hRefMultVtxZ[73]; + TH1F* hGRefMult; + TH1F* hPrimVertNum; + TH1F* hPrimVertZ; + TH1F* hZdcAdcEast; + TH1F* hZdcAdcWest; + TH1F* hZdcAdcSum; + TH1F* hZdcCoincidenceRate; + TH1F* hEpdAdcEast; + TH1F* hEpdAdcWest; + TH1F* hEpdAdcSum; + TH2F* hPrimVertXvsY; + TH1F* hPrimVertVpdVzDiff; + TH2F* hRefMultVsTofTrayMult; + TH2F* hRefMultVsTofMatched; + TH2F* hGRefMultVsTofTrayMult; + TH2F* hGRefMultVsTofMatched; + TH2F* hRefMultVsTofMatch; + TH2F* hRefMultVsBemcMatch; + TH2F* hRefMultVsZdcCoincidenceRate; + TProfile* hRefMultVsRunNumber; + TProfile* hGRefMultVsRunNumber; + TProfile* hTofTrayMultVsRunNumber; + TProfile* hTofMatchedVsRunNumber; + TProfile* hZdcAdcSumVsRunNumber; + TProfile* hZdcCoincidenceRateVsRunNumber; + TProfile* hPrimTrackPtVsRunNumber; + TProfile* hPrimTrackNHitsVsRunNumber; + TProfile* hPrimTrackDedxVsRunNumber; + TProfile* hGlobTrackPtVsRunNumber; + TProfile* hGlobTrackNHitsVsRunNumber; + TProfile* hGlobTrackDedxVsRunNumber; + TProfile* hAvgRefMultVsZdcCoincidenceRate; + TProfile* hAvgRefMultVsZdcCoincidenceRateForTrig[4]; + + ClassDef(StCentralityAnalyzer,0) +}; + +#endif // StCentralityAnalyzer_h diff --git a/StRoot/PWGTools/CentralityCalibration/CentralityChecker/README.md b/StRoot/PWGTools/CentralityCalibration/CentralityChecker/README.md new file mode 100644 index 00000000000..65fe5ae6d28 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/CentralityChecker/README.md @@ -0,0 +1,6 @@ +# Centrality + +The codes in this directory allows to perform checks of the trigger, Vz, and luminosity +dependence of refMult. + +GetCentrality.C calculates centrality bins from the root files output by the Glauber code diff --git a/StRoot/PWGTools/CentralityCalibration/CentralityChecker/processPicoDst.xml b/StRoot/PWGTools/CentralityCalibration/CentralityChecker/processPicoDst.xml new file mode 100644 index 00000000000..9af86537c68 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/CentralityChecker/processPicoDst.xml @@ -0,0 +1,52 @@ + + + + + + + + stardev + setenv NODEBUG yes + set softDir = /star/data03/pwg/sweger/IsobarCentrality/centrality_definition/Centrality + ln -s ${softDir}/StRoot . + pwd + ls -al + + + + set newlist="$PWD"/"$JOBID".list + awk '{print $1}' ${FILELIST} > $newlist + eval set outfilename = o${JOBID}.root + root4star -b -l runCentralityAnalyzer.C\(\"$newlist\",\"$outfilename\"\) + + + + + + + + + + + + + + + /star/data03/pwg/sweger/IsobarCentrality/centrality_definition/Centrality/log/ + + + + + file:./.sl73_gcc485/ + file:./runCentralityAnalyzer.C + + + + diff --git a/StRoot/PWGTools/CentralityCalibration/CentralityChecker/processPicoDst_Ru.xml b/StRoot/PWGTools/CentralityCalibration/CentralityChecker/processPicoDst_Ru.xml new file mode 100644 index 00000000000..be434f327dd --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/CentralityChecker/processPicoDst_Ru.xml @@ -0,0 +1,45 @@ + + + + + + + + stardev + setenv NODEBUG yes + set softDir = /star/data03/pwg/sweger/IsobarCentrality/centrality_definition/Centrality + ln -s ${softDir}/StRoot . + pwd + ls -al + + + set newlist="$PWD"/"$JOBID".list + awk '{print $1}' ${FILELIST} > $newlist + eval set outfilename = o${JOBID}.root + root4star -b -l runCentralityAnalyzer_Ru.C\(\"$newlist\",\"$outfilename\"\) + + + + + + + + + + + + + + + + /star/data03/pwg/sweger/IsobarCentrality/centrality_definition/Centrality/log/ + + + + + file:./.sl73_gcc485/ + file:./runCentralityAnalyzer_Ru.C + + + + diff --git a/StRoot/PWGTools/CentralityCalibration/CentralityChecker/processPicoDst_Zr.xml b/StRoot/PWGTools/CentralityCalibration/CentralityChecker/processPicoDst_Zr.xml new file mode 100644 index 00000000000..a911211c0bb --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/CentralityChecker/processPicoDst_Zr.xml @@ -0,0 +1,45 @@ + + + + + + + + stardev + setenv NODEBUG yes + set softDir = /star/data03/pwg/sweger/IsobarCentrality/centrality_definition/Centrality + ln -s ${softDir}/StRoot . + pwd + ls -al + + + set newlist="$PWD"/"$JOBID".list + awk '{print $1}' ${FILELIST} > $newlist + eval set outfilename = o${JOBID}.root + root4star -b -l runCentralityAnalyzer_Zr.C\(\"$newlist\",\"$outfilename\"\) + + + + + + + + + + + + + + + + /star/data03/pwg/sweger/IsobarCentrality/centrality_definition/Centrality/log/ + + + + + file:./.sl73_gcc485/ + file:./runCentralityAnalyzer_Zr.C + + + + diff --git a/StRoot/PWGTools/CentralityCalibration/CentralityChecker/runCentralityAnalyzer.C b/StRoot/PWGTools/CentralityCalibration/CentralityChecker/runCentralityAnalyzer.C new file mode 100644 index 00000000000..3e40d353391 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/CentralityChecker/runCentralityAnalyzer.C @@ -0,0 +1,77 @@ +#include + +class StMaker; +class StChain; +class StPicoDstReader; + +const Char_t* testInFName = "/star/u/gnigmat/soft/u/centrality_definition/Centrality/input/st_physics_adc_19084053_raw_0000006.picoDst.root"; + +//________________ +void runCentralityAnalyzer(const Char_t* inFileName = testInFName, + const Char_t* oFileName = "oTestAna.root") { + + std::cout << "Start running centrality analyzer" << std::endl; + gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C"); + loadSharedLibraries(); + // Load specific libraries + gSystem->Load("StPicoEvent"); + gSystem->Load("StPicoDstMaker"); + gSystem->Load("StCentralityAnalyzer"); + + // Create new chain + StChain *chain = new StChain(); + + StPicoDstReader *reader = new StPicoDstReader(inFileName); + reader->Init(); + reader->SetStatus("*", 0); + reader->SetStatus("Event*", 1); + reader->SetStatus("Track*", 1); + reader->SetStatus("BTofPidTraits*", 1); + + StCentralityAnalyzer *anaMaker = new StCentralityAnalyzer(reader, oFileName); + anaMaker->setUsePileUp(false); + anaMaker->setVtxZCut(-35., 25.); + anaMaker->addTriggerId(600001); + anaMaker->addTriggerId(600011); + anaMaker->addTriggerId(600021); + anaMaker->addTriggerId(600031); + anaMaker->setRunIdParameters(57990, 19071030, 19129020); + + //These are found by the pileup code in ../QA/pileup + //Test parameters + double a0=-1.27785869748694, a1=0.918278154432662, a2=-0.000421651379949012, a3=1.20429516308073e-06, a4=-1.54521733920117e-09; + double b0=13.2397261316822, b1=1.46248491801055, b2=-0.00310419986439369, b3=8.21875717651988e-06, b4=-8.61348326634967e-09; + double c0=-11.2055760170529, c1=0.415626210975414, c2=0.00191757674104115, c3=-4.93833806589717e-06, c4=4.74283345256434e-09; + anaMaker->setPileUpParameters(a0,a1,a2,a3,a4,b0,b1,b2,b3,b4,c0,c1,c2,c3,c4); + + std::cout << "Initializing chain" << std::endl; + // Check that all maker has been successfully initialized + if( chain->Init() == kStErr ){ + std::cout << "Error during the chain initializtion. Exit. " << std::endl; + return; + } + std::cout << "... done" << std::endl; + + int nEvents2Process = reader->chain()->GetEntries(); + std::cout << " Number of events in files: " << nEvents2Process << std::endl; + + // Processing events + for (Int_t iEvent=0; iEventClear(); + + // Check return code + int iret = chain->Make(); + // Quit event processing if return code is not 0 + if (iret) { std::cout << "Bad return code!" << iret << endl; break; } + } // for (Int_t iEvent=0; iEventFinish(); + std::cout << "... done" << std::endl; + + std::cout << "Centrality analyzer finished the work" << std::endl; +} diff --git a/StRoot/PWGTools/CentralityCalibration/CentralityChecker/runCentralityAnalyzer_Ru.C b/StRoot/PWGTools/CentralityCalibration/CentralityChecker/runCentralityAnalyzer_Ru.C new file mode 100644 index 00000000000..be3963d46cf --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/CentralityChecker/runCentralityAnalyzer_Ru.C @@ -0,0 +1,109 @@ +#include + +class StMaker; +class StChain; +class StPicoDstReader; + +const Char_t* testInFName = "/star/u/gnigmat/soft/u/centrality_definition/Centrality/input/st_physics_adc_19084053_raw_0000006.picoDst.root"; + +//________________ +void runCentralityAnalyzer_Ru(const Char_t* inFileName = testInFName, + const Char_t* oFileName = "oTestAna.root") { + + std::cout << "Start running centrality analyzer" << std::endl; + gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C"); + loadSharedLibraries(); + // Load specific libraries + gSystem->Load("StPicoEvent"); + gSystem->Load("StPicoDstMaker"); + gSystem->Load("StCentralityAnalyzer"); + + // Create new chain + StChain *chain = new StChain(); + + StPicoDstReader *reader = new StPicoDstReader(inFileName); + reader->Init(); + reader->SetStatus("*", 0); + reader->SetStatus("Event*", 1); + reader->SetStatus("Track*", 0); + reader->SetStatus("BTofPidTraits*", 0); + + StCentralityAnalyzer *anaMaker = new StCentralityAnalyzer(reader, oFileName); + anaMaker->setUsePileUp(true); + anaMaker->setUseLumCorr(false); + anaMaker->setUseVzCorr(false); + anaMaker->setVtxZCut(-35., 25.); + anaMaker->addTriggerId(600001); + anaMaker->addTriggerId(600011); + anaMaker->addTriggerId(600021); + anaMaker->addTriggerId(600031); + anaMaker->setRunIdParameters(57990, 19071030, 19129020); + + //These are found by the pileup code in ../QA/pileup + //Ru pileup parameters + //--------------------------------------------------- + //double a0=-1.1761972238142, a1=0.91190057314294, a2=-0.000361521536620541, a3=9.77684373134588e-07, a4=-1.28146895587406e-09; + //double b0=13.5471357600988, b1=1.44271774447208, b2=-0.00288349264907301, b3=7.3544264332388e-06, b4=-7.54314488345979e-09; + //double c0=-11.2648623623068, c1=0.419490120285247, c2=0.001856323147039, c3=-4.68448675939297e-06, c4=4.40012904437496e-09; + //--------------------------------------------------- + //New parameters from corrected bad-runs list + double a0=-1.17135278798859, a1=0.911627701794553, a2=-0.000359098306320787, a3=9.61800858474059e-07, a4=-1.25136113760776e-09; + double b0=13.5426221755897, b1=1.44261201539344, b2=-0.00288428931227279, b3=7.35384541646783e-06, b4=-7.53407759526067e-09; + double c0=-11.2591376113937, c1=0.419541462167548, c2=0.00185578651291454, c3=-4.68933832723005e-06, c4=4.4151761900593e-09; + //--------------------------------------------------- + anaMaker->setPileUpParameters(a0,a1,a2,a3,a4,b0,b1,b2,b3,b4,c0,c1,c2,c3,c4); + + //Ru luminosity correction parameters + double lumcorr_a = -1.1624e-5; + double lumcorr_b = 98.113; + double lumcorr_bprime = 97.9927; + //--------------------------------------------------- + //--------------------------------------------------- + anaMaker->setLumCorrParameters(lumcorr_a,lumcorr_b,lumcorr_bprime); + + //Vz correction parameters for Ru+Ru + double vzCorPar0 = 302.019; + double vzCorPar1 = 0.0270308; + double vzCorPar2 = -0.0017795; + double vzCorPar3 = 0.000243777; + double vzCorPar4 = 1.18462e-05; + double vzCorPar5 = -3.3121e-07; + double vzCorPar6 = -1.22651e-08; + + anaMaker->setVzCorrParameters(vzCorPar0, vzCorPar1, vzCorPar2, vzCorPar3, vzCorPar4, vzCorPar5, vzCorPar6); + + //set shape correction weight index; 0: Ru, 1: Zr + anaMaker->setShapeIndex(0); + //--------------------------------------------------- + + std::cout << "Initializing chain" << std::endl; + // Check that all maker has been successfully initialized + if( chain->Init() == kStErr ){ + std::cout << "Error during the chain initializtion. Exit. " << std::endl; + return; + } + std::cout << "... done" << std::endl; + + int nEvents2Process = reader->chain()->GetEntries(); + std::cout << " Number of events in files: " << nEvents2Process << std::endl; + + // Processing events + for (Int_t iEvent=0; iEventClear(); + + // Check return code + int iret = chain->Make(); + // Quit event processing if return code is not 0 + if (iret) { std::cout << "Bad return code!" << iret << endl; break; } + } // for (Int_t iEvent=0; iEventFinish(); + std::cout << "... done" << std::endl; + + std::cout << "Centrality analyzer finished the work" << std::endl; +} diff --git a/StRoot/PWGTools/CentralityCalibration/CentralityChecker/runCentralityAnalyzer_Zr.C b/StRoot/PWGTools/CentralityCalibration/CentralityChecker/runCentralityAnalyzer_Zr.C new file mode 100644 index 00000000000..0105e407912 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/CentralityChecker/runCentralityAnalyzer_Zr.C @@ -0,0 +1,112 @@ +#include + +class StMaker; +class StChain; +class StPicoDstReader; + +const Char_t* testInFName = "/star/u/gnigmat/soft/u/centrality_definition/Centrality/input/st_physics_adc_19084053_raw_0000006.picoDst.root"; + +//________________ +void runCentralityAnalyzer_Zr(const Char_t* inFileName = testInFName, + const Char_t* oFileName = "oTestAna.root") { + + std::cout << "Start running centrality analyzer" << std::endl; + gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C"); + loadSharedLibraries(); + // Load specific libraries + gSystem->Load("StPicoEvent"); + gSystem->Load("StPicoDstMaker"); + gSystem->Load("StCentralityAnalyzer"); + + // Create new chain + StChain *chain = new StChain(); + + StPicoDstReader *reader = new StPicoDstReader(inFileName); + reader->Init(); + reader->SetStatus("*", 0); + reader->SetStatus("Event*", 1); + reader->SetStatus("Track*", 0); + reader->SetStatus("BTofPidTraits*", 0); + + StCentralityAnalyzer *anaMaker = new StCentralityAnalyzer(reader, oFileName); + anaMaker->setUsePileUp(true); + anaMaker->setUseLumCorr(false); + anaMaker->setUseVzCorr(false); + anaMaker->setVtxZCut(-35., 25.); + anaMaker->addTriggerId(600001); + anaMaker->addTriggerId(600011); + anaMaker->addTriggerId(600021); + anaMaker->addTriggerId(600031); + anaMaker->setRunIdParameters(57990, 19071030, 19129020); + + //These are found by the pileup code in ../QA/pileup + //Zr pileup parameters + //--------------------------------------------------- + //double a0=-1.21309838794601, a1=0.912951771896837, a2=-0.000367314265128479, a3=9.94347355669806e-07, a4=-1.31455343813894e-09; + //double b0=13.9009773648019, b1=1.44056038211802, b2=-0.00289508482803666, b3=7.46976650036052e-06, b4=-7.76886643291828e-09; + //double c0=-11.5092765154364, c1=0.422455652498953, c2=0.00184903353426273, c3=-4.6965709740072e-06, c4=4.43430319329608e-09; + //--------------------------------------------------- + //New parameters from corrected bad-runs list + double a0=-1.19267140255075, a1=0.912703837475103, a2=-0.000366760799818202, a3=9.94532126858323e-07, a4=-1.31386727140715e-09; + double b0=13.5244327901538, b1=1.4429201808933, b2=-0.002873496957537, b3=7.29172798142226e-06, b4=-7.45759942317285e-09; + double c0=-11.2781454979572, c1=0.420728494449501, c2=0.00184005031913895, c3=-4.61008765754698e-06, c4=4.28291905929182e-09; + //--------------------------------------------------- + anaMaker->setPileUpParameters(a0,a1,a2,a3,a4,b0,b1,b2,b3,b4,c0,c1,c2,c3,c4); + + //Zr luminosity correction parameters + //--------------------------------------------------- + double lumcorr_a = -1.3917e-4; + double lumcorr_b = 98.412; + double lumcorr_bprime = 96.9914; + //--------------------------------------------------- + anaMaker->setLumCorrParameters(lumcorr_a,lumcorr_b,lumcorr_bprime); + + //Vz correction parameters for Zr+Zr + + double vzCorPar0 = 300.296; + double vzCorPar1 = 0.0358743; + double vzCorPar2 = -0.000549242; + double vzCorPar3 = 0.000232057; + double vzCorPar4 = 5.86792e-06; + double vzCorPar5 = -2.91945e-07; + double vzCorPar6 = -6.33743e-09; + + anaMaker->setVzCorrParameters(vzCorPar0, vzCorPar1, vzCorPar2, vzCorPar3, vzCorPar4, vzCorPar5, vzCorPar6); + + //set shape correction weight index; 0: Ru, 1: Zr + anaMaker->setShapeIndex(1); + //--------------------------------------------------- + + + + std::cout << "Initializing chain" << std::endl; + // Check that all maker has been successfully initialized + if( chain->Init() == kStErr ){ + std::cout << "Error during the chain initializtion. Exit. " << std::endl; + return; + } + std::cout << "... done" << std::endl; + + int nEvents2Process = reader->chain()->GetEntries(); + std::cout << " Number of events in files: " << nEvents2Process << std::endl; + + // Processing events + for (Int_t iEvent=0; iEventClear(); + + // Check return code + int iret = chain->Make(); + // Quit event processing if return code is not 0 + if (iret) { std::cout << "Bad return code!" << iret << endl; break; } + } // for (Int_t iEvent=0; iEventFinish(); + std::cout << "... done" << std::endl; + + std::cout << "Centrality analyzer finished the work" << std::endl; +} diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/README.md b/StRoot/PWGTools/CentralityCalibration/Glauber/README.md new file mode 100644 index 00000000000..fab680400f6 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/README.md @@ -0,0 +1,10 @@ +# Glauber model + +Directory consists of two subdirectories needed for the Glauber model +calculations. + +"star_glauber" -- contains codes for the actual Glauber calculations and other +useful routines. + +"glauberOut" -- empty directory that is used to store output of the Glauber calculations. + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StCentralityMaker/StCentrality.cxx b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StCentralityMaker/StCentrality.cxx new file mode 100644 index 00000000000..b23144179fc --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StCentralityMaker/StCentrality.cxx @@ -0,0 +1,1385 @@ + +#include + +#include "TError.h" +#include "TMath.h" + +#include "StMessMgr.h" +#include "StCentrality.h" + +ClassImp(StCentrality) + + using std::vector ; + + //____________________________________________________________________________________________________ + // Re-weighting correction +Double_t Reweighting(const Double_t* x, const Double_t* par) +{ + return 1.0 - TMath::Exp(-par[0]*TMath::Power(x[0], par[1])); +} + +//____________________________________________________________________________________________________ +// Default constructor + StCentrality::StCentrality(const TString system, const TString type) +: mType(type), mNpp(0.0), mK(0.0), mX(0.0) +{ + for(UInt_t im=0; im %4d for centrality %3d - %3d (%%)", + mMultiplicityCut[im][ic], (Int_t)mCentralityMin[im][ic], (Int_t)mCentralityMax[im][ic]) + << endm; + }// centrality + }// mode + +} + +//____________________________________________________________________________________________________ +// Default destructor +StCentrality::~StCentrality() +{ + for(UInt_t im=0; im= mNMode ){ + Error("StCentrality::GetCentrality", "Invalid mode, mode=%3d. reutnr -1", mode); + return -1.0 ; + } + + // Make sure array has some entries + if( mMultiplicityCut[mode].empty() ){ + Error("StCentrality::GetCentrality", "multiplicity cuts for centrality have not implemented. return -1"); + return -1.0 ; + } + + // Find centrality bin + for(UInt_t icent=0; icent mMultiplicityCut[mode][icent] ) + return (mCentralityMin[mode][icent]+mCentralityMax[mode][icent])/2.0; + } + + return -1.0 ; +} + +//____________________________________________________________________________________________________ +Double_t StCentrality::GetNppError(const Double_t npp) const +{ + if ( mType.CompareTo("default", TString::kIgnoreCase) == 0 ) return 0.0 ; + else if ( mType.CompareTo("low", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StCentrality::GetNppError type=low add -5% error on npp" << endm; + return -0.05 * npp ; + } + else if ( mType.CompareTo("high", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StCentrality::GetNppError type=high add +5% error on npp" << endm; + return 0.05 * npp ; + } + else { + Warning("StCentrality::GetNppError", "Unknown type, type=%s. Set error = 0", mType.Data()); + return 0.0 ; + } +} + +//____________________________________________________________________________________________________ +void StCentrality::Init_AuAu200GeV() +{ + // Run4 stuffs +#if 0 + // Centrality definition in 200 GeV Run4 + // Define multiplicity cut from central to peripheral + mMultiplicityCut[0].push_back( 514 - 1 ); mCentralityMin[0].push_back( 0.0 ); mCentralityMax[0].push_back( 5.0 ); + mMultiplicityCut[0].push_back( 432 - 1 ); mCentralityMin[0].push_back( 5.0 ); mCentralityMax[0].push_back( 10.0 ); + mMultiplicityCut[0].push_back( 302 - 1 ); mCentralityMin[0].push_back( 10.0 ); mCentralityMax[0].push_back( 20.0 ); + mMultiplicityCut[0].push_back( 208 - 1 ); mCentralityMin[0].push_back( 20.0 ); mCentralityMax[0].push_back( 30.0 ); + mMultiplicityCut[0].push_back( 138 - 1 ); mCentralityMin[0].push_back( 30.0 ); mCentralityMax[0].push_back( 40.0 ); + mMultiplicityCut[0].push_back( 88 - 1 ); mCentralityMin[0].push_back( 40.0 ); mCentralityMax[0].push_back( 50.0 ); + mMultiplicityCut[0].push_back( 52 - 1 ); mCentralityMin[0].push_back( 50.0 ); mCentralityMax[0].push_back( 60.0 ); + mMultiplicityCut[0].push_back( 28 - 1 ); mCentralityMin[0].push_back( 60.0 ); mCentralityMax[0].push_back( 70.0 ); + mMultiplicityCut[0].push_back( 14 - 1 ); mCentralityMin[0].push_back( 70.0 ); mCentralityMax[0].push_back( 80.0 ); +#endif + + /// Initialize Au + Au collisiona at 200 GeV (Run10) + //---------------------------------------------------------------------------------------------------- + // Update on Feb/04/2011 + // npp and x are determined from published spectra paper, PRC79, 034909 (2009) + // npp = 2.43 + // k = 2.0 (probably k dependence is weak, need to study) + // x = 0.13 from interpolation between 19.6 and 200 GeV data (PHOBOS, PRC70, 021902, 2004) + // + // - Multiplicity dependent efficiency with d=0.14 + // - Additional constant efficiency loss 17% (0.17) + // (need to be implemented somehow, this is currently done by temporary fix in StNegativeBinomial.cxx) + // + // NOTE: parameters are not final yet (Feb/04/2011) + //---------------------------------------------------------------------------------------------------- + // 0.00 - 5.00 (%) : M > 441 + // 5.00 - 10.00 (%) : M > 375 + // 10.00 - 15.00 (%) : M > 317 + // 15.00 - 20.00 (%) : M > 266 + // 20.00 - 25.00 (%) : M > 221 + // 25.00 - 30.00 (%) : M > 182 + // 30.00 - 35.00 (%) : M > 148 + // 35.00 - 40.00 (%) : M > 118 + // 40.00 - 45.00 (%) : M > 93 + // 45.00 - 50.00 (%) : M > 72 + // 50.00 - 55.00 (%) : M > 55 + // 55.00 - 60.00 (%) : M > 41 + // 60.00 - 65.00 (%) : M > 30 + // 65.00 - 70.00 (%) : M > 21 + // 70.00 - 75.00 (%) : M > 15 + // 75.00 - 80.00 (%) : M > 10 + // 80.00 - 85.00 (%) : M > 6 + // 85.00 - 90.00 (%) : M > 4 + // + + // Error on x (energy specific ???) + // NOTE: type 'low' and 'high' are for npp, x is anti-correlated with npp + Double_t xError = 0.0 ; // absolute error + if( mType.CompareTo("low", TString::kIgnoreCase) == 0 ) xError = 0.02 ; // npp is low, x is high + else if( mType.CompareTo("high", TString::kIgnoreCase) == 0 ) xError = -0.02 ; // npp is high, x is low + + const Double_t npp = 2.07 ; // default npp + mNpp = npp + GetNppError(npp) ; // 5% error on npp + mK = 2.00 ; + mX = 0.14 + xError ; + mEfficiency = 0.15 ; + mTriggerBias = 1.00 ; + // mTriggerBias = 0.835 ; // Run10 200 GeV + + // Final centrality bins + // Define multiplicity cut from central to peripheral + mMultiplicityCut[0].push_back( 469 ); mCentralityMin[0].push_back( 0.0 ); mCentralityMax[0].push_back( 5.0 ); + mMultiplicityCut[0].push_back( 398 ); mCentralityMin[0].push_back( 5.0 ); mCentralityMax[0].push_back( 10.0 ); + mMultiplicityCut[0].push_back( 336 ); mCentralityMin[0].push_back( 10.0 ); mCentralityMax[0].push_back( 15.0 ); + mMultiplicityCut[0].push_back( 281 ); mCentralityMin[0].push_back( 15.0 ); mCentralityMax[0].push_back( 20.0 ); + mMultiplicityCut[0].push_back( 234 ); mCentralityMin[0].push_back( 20.0 ); mCentralityMax[0].push_back( 25.0 ); + mMultiplicityCut[0].push_back( 192 ); mCentralityMin[0].push_back( 25.0 ); mCentralityMax[0].push_back( 30.0 ); + mMultiplicityCut[0].push_back( 155 ); mCentralityMin[0].push_back( 30.0 ); mCentralityMax[0].push_back( 35.0 ); + mMultiplicityCut[0].push_back( 124 ); mCentralityMin[0].push_back( 35.0 ); mCentralityMax[0].push_back( 40.0 ); + mMultiplicityCut[0].push_back( 98 ); mCentralityMin[0].push_back( 40.0 ); mCentralityMax[0].push_back( 45.0 ); + mMultiplicityCut[0].push_back( 75 ); mCentralityMin[0].push_back( 45.0 ); mCentralityMax[0].push_back( 50.0 ); + mMultiplicityCut[0].push_back( 57 ); mCentralityMin[0].push_back( 50.0 ); mCentralityMax[0].push_back( 55.0 ); + mMultiplicityCut[0].push_back( 42 ); mCentralityMin[0].push_back( 55.0 ); mCentralityMax[0].push_back( 60.0 ); + mMultiplicityCut[0].push_back( 31 ); mCentralityMin[0].push_back( 60.0 ); mCentralityMax[0].push_back( 65.0 ); + mMultiplicityCut[0].push_back( 22 ); mCentralityMin[0].push_back( 65.0 ); mCentralityMax[0].push_back( 70.0 ); + mMultiplicityCut[0].push_back( 15 ); mCentralityMin[0].push_back( 70.0 ); mCentralityMax[0].push_back( 75.0 ); + mMultiplicityCut[0].push_back( 10 ); mCentralityMin[0].push_back( 75.0 ); mCentralityMax[0].push_back( 80.0 ); + // -5% +5% + mMultiplicityCut[1].push_back( 473 ); mMultiplicityCut[2].push_back( 465 ); + mMultiplicityCut[1].push_back( 405 ); mMultiplicityCut[2].push_back( 391 ); + mMultiplicityCut[1].push_back( 345 ); mMultiplicityCut[2].push_back( 327 ); + mMultiplicityCut[1].push_back( 292 ); mMultiplicityCut[2].push_back( 271 ); + mMultiplicityCut[1].push_back( 245 ); mMultiplicityCut[2].push_back( 223 ); + mMultiplicityCut[1].push_back( 204 ); mMultiplicityCut[2].push_back( 181 ); + mMultiplicityCut[1].push_back( 168 ); mMultiplicityCut[2].push_back( 144 ); + mMultiplicityCut[1].push_back( 136 ); mMultiplicityCut[2].push_back( 113 ); + mMultiplicityCut[1].push_back( 109 ); mMultiplicityCut[2].push_back( 87 ); + mMultiplicityCut[1].push_back( 86 ); mMultiplicityCut[2].push_back( 66 ); + mMultiplicityCut[1].push_back( 67 ); mMultiplicityCut[2].push_back( 49 ); + mMultiplicityCut[1].push_back( 51 ); mMultiplicityCut[2].push_back( 35 ); + mMultiplicityCut[1].push_back( 38 ); mMultiplicityCut[2].push_back( 25 ); + mMultiplicityCut[1].push_back( 28 ); mMultiplicityCut[2].push_back( 17 ); + mMultiplicityCut[1].push_back( 20 ); mMultiplicityCut[2].push_back( 11 ); + mMultiplicityCut[1].push_back( 14 ); mMultiplicityCut[2].push_back( 7 ); + + // Set same centrality bins + for(UInt_t ic=0; ic 30 + // + // Relative error on npp +/- 5% --> +/- 17% error on x (i.e. 0.12 +/- 0.02) + // + //---------------------------------------------------------------------------------------------------- + // Update on Jul/29/2010 + // npp = 1.52 + // k = 1.5 + // x = 0.12 (see above) + // eff : Multiplicity dependent efficiency with d = 0.14 + // * All above parameters were determined by using low multiplicity cut off M > 30 + // + // Re-weighting correction parameters: p0 = 0.92 +/- 0.03, p1 = 0.43 +/- 0.01 + // These parameter are ANTI-correlated + + // Error on x (energy specific ???) + // NOTE: type 'low' and 'high' are for npp, x is anti-correlated with npp + Double_t xError = 0.0 ; // absolute error + if( mType.CompareTo("low", TString::kIgnoreCase) == 0 ) xError = 0.02 ; // npp is low, x is high + else if( mType.CompareTo("high", TString::kIgnoreCase) == 0 ) xError = -0.02 ; // npp is high, x is low + + const Double_t npp = 1.52 ; // default npp + mNpp = npp + GetNppError(npp) ; // 5% error on npp + mK = 1.50 ; + mX = 0.12 + xError ; + mEfficiency = 0.14 ; + mTriggerBias = 1.00 ; + + // Parameters for re-weighting correction + mParReweighting[0] = 0.92 ; + mParReweighting[1] = 0.43 ; + + // Assign +/- 2 sigma for re-weighting correction + if( mType.CompareTo("lowrw", TString::kIgnoreCase) == 0 ){ + mParReweighting[0] = 0.98 ; // + 2sigma + mParReweighting[1] = 0.41 ; // - 2sigma + } + else if ( mType.CompareTo("highrw", TString::kIgnoreCase) == 0 ){ + mParReweighting[0] = 0.86 ; // - 2sigma + mParReweighting[1] = 0.45 ; // + 2sigma + } + + LOG_INFO << "StCentrality::Init_AuAu39GeV Use " << mType << " type: re-weighting correction will be " + << Form("1-exp(-%1.2f*refmult^{%1.2f})", mParReweighting[0], mParReweighting[1]) + << endm; + +#if 0 + // Define multiplicity cut from central to peripheral + mMultiplicityCut[0].push_back( 316 ); mCentralityMin[0].push_back( 0.0 ); mCentralityMax[0].push_back( 5.0 ); + mMultiplicityCut[0].push_back( 265 ); mCentralityMin[0].push_back( 5.0 ); mCentralityMax[0].push_back( 10.0 ); + mMultiplicityCut[0].push_back( 185 ); mCentralityMin[0].push_back( 10.0 ); mCentralityMax[0].push_back( 20.0 ); + mMultiplicityCut[0].push_back( 125 ); mCentralityMin[0].push_back( 20.0 ); mCentralityMax[0].push_back( 30.0 ); + mMultiplicityCut[0].push_back( 81 ); mCentralityMin[0].push_back( 30.0 ); mCentralityMax[0].push_back( 40.0 ); + mMultiplicityCut[0].push_back( 50 ); mCentralityMin[0].push_back( 40.0 ); mCentralityMax[0].push_back( 50.0 ); + mMultiplicityCut[0].push_back( 28 ); mCentralityMin[0].push_back( 50.0 ); mCentralityMax[0].push_back( 60.0 ); + mMultiplicityCut[0].push_back( 15 ); mCentralityMin[0].push_back( 60.0 ); mCentralityMax[0].push_back( 70.0 ); + mMultiplicityCut[0].push_back( 7 ); mCentralityMin[0].push_back( 70.0 ); mCentralityMax[0].push_back( 80.0 ); + + // -5% +5% + mMultiplicityCut[1].push_back( 319 ); mMultiplicityCut[2].push_back( 313 ); // 0-5% + mMultiplicityCut[1].push_back( 270 ); mMultiplicityCut[2].push_back( 260 ); // 5-10% + mMultiplicityCut[1].push_back( 192 ); mMultiplicityCut[2].push_back( 178 ); // 10-20% + mMultiplicityCut[1].push_back( 133 ); mMultiplicityCut[2].push_back( 118 ); // 20-30% + mMultiplicityCut[1].push_back( 89 ); mMultiplicityCut[2].push_back( 74 ); // 30-40% + mMultiplicityCut[1].push_back( 57 ); mMultiplicityCut[2].push_back( 44 ); // 40-50% + mMultiplicityCut[1].push_back( 34 ); mMultiplicityCut[2].push_back( 24 ); // 50-60% + mMultiplicityCut[1].push_back( 19 ); mMultiplicityCut[2].push_back( 12 ); // 60-70% + mMultiplicityCut[1].push_back( 10 ); mMultiplicityCut[2].push_back( 5 ); // 70-80% +#endif + + // Final centrality bins + // Define multiplicity cut from central to peripheral + // mMultiplicityCut[0].push_back( 316 ); mCentralityMin[0].push_back( 0.0 ); mCentralityMax[0].push_back( 5.0 ); + // mMultiplicityCut[0].push_back( 265 ); mCentralityMin[0].push_back( 5.0 ); mCentralityMax[0].push_back( 10.0 ); + // Temporary to include 7.5% + mMultiplicityCut[0].push_back( 316 ); mCentralityMin[0].push_back( 0.0 ); mCentralityMax[0].push_back( 5.0 ); + mMultiplicityCut[0].push_back( 290 ); mCentralityMin[0].push_back( 5.0 ); mCentralityMax[0].push_back( 7.5 ); + mMultiplicityCut[0].push_back( 265 ); mCentralityMin[0].push_back( 7.5 ); mCentralityMax[0].push_back( 10.0 ); + + mMultiplicityCut[0].push_back( 222 ); mCentralityMin[0].push_back( 10.0 ); mCentralityMax[0].push_back( 15.0 ); + mMultiplicityCut[0].push_back( 185 ); mCentralityMin[0].push_back( 15.0 ); mCentralityMax[0].push_back( 20.0 ); + mMultiplicityCut[0].push_back( 153 ); mCentralityMin[0].push_back( 20.0 ); mCentralityMax[0].push_back( 25.0 ); + mMultiplicityCut[0].push_back( 125 ); mCentralityMin[0].push_back( 25.0 ); mCentralityMax[0].push_back( 30.0 ); + mMultiplicityCut[0].push_back( 102 ); mCentralityMin[0].push_back( 30.0 ); mCentralityMax[0].push_back( 35.0 ); + mMultiplicityCut[0].push_back( 81 ); mCentralityMin[0].push_back( 35.0 ); mCentralityMax[0].push_back( 40.0 ); + mMultiplicityCut[0].push_back( 64 ); mCentralityMin[0].push_back( 40.0 ); mCentralityMax[0].push_back( 45.0 ); + mMultiplicityCut[0].push_back( 50 ); mCentralityMin[0].push_back( 45.0 ); mCentralityMax[0].push_back( 50.0 ); + mMultiplicityCut[0].push_back( 38 ); mCentralityMin[0].push_back( 50.0 ); mCentralityMax[0].push_back( 55.0 ); + mMultiplicityCut[0].push_back( 28 ); mCentralityMin[0].push_back( 55.0 ); mCentralityMax[0].push_back( 60.0 ); + mMultiplicityCut[0].push_back( 21 ); mCentralityMin[0].push_back( 60.0 ); mCentralityMax[0].push_back( 65.0 ); + mMultiplicityCut[0].push_back( 15 ); mCentralityMin[0].push_back( 65.0 ); mCentralityMax[0].push_back( 70.0 ); + mMultiplicityCut[0].push_back( 10 ); mCentralityMin[0].push_back( 70.0 ); mCentralityMax[0].push_back( 75.0 ); + mMultiplicityCut[0].push_back( 7 ); mCentralityMin[0].push_back( 75.0 ); mCentralityMax[0].push_back( 80.0 ); + + // -5% +5% + mMultiplicityCut[1].push_back( 319 ); mMultiplicityCut[2].push_back( 313 ); + mMultiplicityCut[1].push_back( 293 ); mMultiplicityCut[2].push_back( 286 ); // temp + mMultiplicityCut[1].push_back( 270 ); mMultiplicityCut[2].push_back( 260 ); + mMultiplicityCut[1].push_back( 228 ); mMultiplicityCut[2].push_back( 216 ); + mMultiplicityCut[1].push_back( 192 ); mMultiplicityCut[2].push_back( 178 ); + mMultiplicityCut[1].push_back( 160 ); mMultiplicityCut[2].push_back( 145 ); + mMultiplicityCut[1].push_back( 133 ); mMultiplicityCut[2].push_back( 118 ); + mMultiplicityCut[1].push_back( 110 ); mMultiplicityCut[2].push_back( 94 ); + mMultiplicityCut[1].push_back( 89 ); mMultiplicityCut[2].push_back( 74 ); + mMultiplicityCut[1].push_back( 72 ); mMultiplicityCut[2].push_back( 57 ); + mMultiplicityCut[1].push_back( 57 ); mMultiplicityCut[2].push_back( 44 ); + mMultiplicityCut[1].push_back( 44 ); mMultiplicityCut[2].push_back( 33 ); + mMultiplicityCut[1].push_back( 34 ); mMultiplicityCut[2].push_back( 24 ); + mMultiplicityCut[1].push_back( 26 ); mMultiplicityCut[2].push_back( 17 ); + mMultiplicityCut[1].push_back( 19 ); mMultiplicityCut[2].push_back( 12 ); + mMultiplicityCut[1].push_back( 14 ); mMultiplicityCut[2].push_back( 8 ); + mMultiplicityCut[1].push_back( 10 ); mMultiplicityCut[2].push_back( 5 ); + + // Set same centrality bins + for(UInt_t ic=0; ic100 + // k = 1.80 + // x = 0.16 + // eff = 0.11 + // with d = 0.14 (factor for multiplicity dependent efficiency) + //---------------------------------------------------------------------------------------------------- + + // Error on x (energy specific ???) + // NOTE: type 'low' and 'high' are for npp, x is anti-correlated with npp + Double_t xError = 0.0 ; // absolute error + if( mType.CompareTo("low", TString::kIgnoreCase) == 0 ) xError = 0.02 ; // npp is low, x is high + else if( mType.CompareTo("high", TString::kIgnoreCase) == 0 ) xError = -0.02 ; // npp is high, x is low + + const Double_t npp = 1.27 ; + mNpp = npp + GetNppError(npp) ; + mK = 1.80 ; + mX = 0.16 + xError ; + mEfficiency = 0.11 ; + mTriggerBias = 1.00 ; + + mMultiplicityCut[0].push_back( 295 ); mCentralityMin[0].push_back( 0.0 ); mCentralityMax[0].push_back( 5.0 ); + mMultiplicityCut[0].push_back( 245 ); mCentralityMin[0].push_back( 5.0 ); mCentralityMax[0].push_back( 10.0 ); + mMultiplicityCut[0].push_back( 204 ); mCentralityMin[0].push_back( 10.0 ); mCentralityMax[0].push_back( 15.0 ); + mMultiplicityCut[0].push_back( 169 ); mCentralityMin[0].push_back( 15.0 ); mCentralityMax[0].push_back( 20.0 ); + mMultiplicityCut[0].push_back( 138 ); mCentralityMin[0].push_back( 20.0 ); mCentralityMax[0].push_back( 25.0 ); + mMultiplicityCut[0].push_back( 113 ); mCentralityMin[0].push_back( 25.0 ); mCentralityMax[0].push_back( 30.0 ); + mMultiplicityCut[0].push_back( 91 ); mCentralityMin[0].push_back( 30.0 ); mCentralityMax[0].push_back( 35.0 ); + mMultiplicityCut[0].push_back( 72 ); mCentralityMin[0].push_back( 35.0 ); mCentralityMax[0].push_back( 40.0 ); + mMultiplicityCut[0].push_back( 57 ); mCentralityMin[0].push_back( 40.0 ); mCentralityMax[0].push_back( 45.0 ); + mMultiplicityCut[0].push_back( 44 ); mCentralityMin[0].push_back( 45.0 ); mCentralityMax[0].push_back( 50.0 ); + mMultiplicityCut[0].push_back( 33 ); mCentralityMin[0].push_back( 50.0 ); mCentralityMax[0].push_back( 55.0 ); + mMultiplicityCut[0].push_back( 25 ); mCentralityMin[0].push_back( 55.0 ); mCentralityMax[0].push_back( 60.0 ); + mMultiplicityCut[0].push_back( 18 ); mCentralityMin[0].push_back( 60.0 ); mCentralityMax[0].push_back( 65.0 ); + mMultiplicityCut[0].push_back( 13 ); mCentralityMin[0].push_back( 65.0 ); mCentralityMax[0].push_back( 70.0 ); + mMultiplicityCut[0].push_back( 9 ); mCentralityMin[0].push_back( 70.0 ); mCentralityMax[0].push_back( 75.0 ); + mMultiplicityCut[0].push_back( 6 ); mCentralityMin[0].push_back( 75.0 ); mCentralityMax[0].push_back( 80.0 ); + mMultiplicityCut[1].push_back( 298 ); mMultiplicityCut[2].push_back( 293 ); + mMultiplicityCut[1].push_back( 250 ); mMultiplicityCut[2].push_back( 241 ); + mMultiplicityCut[1].push_back( 209 ); mMultiplicityCut[2].push_back( 198 ); + mMultiplicityCut[1].push_back( 175 ); mMultiplicityCut[2].push_back( 162 ); + mMultiplicityCut[1].push_back( 146 ); mMultiplicityCut[2].push_back( 132 ); + mMultiplicityCut[1].push_back( 120 ); mMultiplicityCut[2].push_back( 106 ); + mMultiplicityCut[1].push_back( 98 ); mMultiplicityCut[2].push_back( 84 ); + mMultiplicityCut[1].push_back( 79 ); mMultiplicityCut[2].push_back( 66 ); + mMultiplicityCut[1].push_back( 64 ); mMultiplicityCut[2].push_back( 51 ); + mMultiplicityCut[1].push_back( 50 ); mMultiplicityCut[2].push_back( 38 ); + mMultiplicityCut[1].push_back( 39 ); mMultiplicityCut[2].push_back( 28 ); + mMultiplicityCut[1].push_back( 30 ); mMultiplicityCut[2].push_back( 20 ); + mMultiplicityCut[1].push_back( 22 ); mMultiplicityCut[2].push_back( 14 ); + mMultiplicityCut[1].push_back( 16 ); mMultiplicityCut[2].push_back( 10 ); + mMultiplicityCut[1].push_back( 12 ); mMultiplicityCut[2].push_back( 6 ); + mMultiplicityCut[1].push_back( 8 ); mMultiplicityCut[2].push_back( 4 ); + + // /// Initialize Au + Au collisiona at 27 GeV + // //---------------------------------------------------------------------------------------------------- + // // Update on Dec/15/2011 + // // npp = 1.385 from fitting, M>50 + // // k = 1.65 + // // x = 0.12 + // // with d = 0.14 (factor for multiplicity dependent efficiency) + // //---------------------------------------------------------------------------------------------------- + + // // Error on x (energy specific ???) + // // NOTE: type 'low' and 'high' are for npp, x is anti-correlated with npp + // Double_t xError = 0.0 ; // absolute error + // if( mType.CompareTo("low", TString::kIgnoreCase) == 0 ) xError = 0.02 ; // npp is low, x is high + // else if( mType.CompareTo("high", TString::kIgnoreCase) == 0 ) xError = -0.02 ; // npp is high, x is low + + // const Double_t npp = 1.385 ; // default npp + // // const Double_t npp = 1.390 ; // default npp + // mNpp = npp + GetNppError(npp) ; + // mK = 1.65 ; + // mX = 0.12 + xError ; + // mEfficiency = 0.14 ; + // mTriggerBias = 1.00 ; + + // // Centrality bins (Final) + // mMultiplicityCut[0].push_back( 288 ); mCentralityMin[0].push_back( 0.0 ); mCentralityMax[0].push_back( 5.0 ); + // mMultiplicityCut[0].push_back( 241 ); mCentralityMin[0].push_back( 5.0 ); mCentralityMax[0].push_back( 10.0 ); + // mMultiplicityCut[0].push_back( 201 ); mCentralityMin[0].push_back( 10.0 ); mCentralityMax[0].push_back( 15.0 ); + // mMultiplicityCut[0].push_back( 168 ); mCentralityMin[0].push_back( 15.0 ); mCentralityMax[0].push_back( 20.0 ); + // mMultiplicityCut[0].push_back( 139 ); mCentralityMin[0].push_back( 20.0 ); mCentralityMax[0].push_back( 25.0 ); + // mMultiplicityCut[0].push_back( 114 ); mCentralityMin[0].push_back( 25.0 ); mCentralityMax[0].push_back( 30.0 ); + // mMultiplicityCut[0].push_back( 92 ); mCentralityMin[0].push_back( 30.0 ); mCentralityMax[0].push_back( 35.0 ); + // mMultiplicityCut[0].push_back( 74 ); mCentralityMin[0].push_back( 35.0 ); mCentralityMax[0].push_back( 40.0 ); + // mMultiplicityCut[0].push_back( 58 ); mCentralityMin[0].push_back( 40.0 ); mCentralityMax[0].push_back( 45.0 ); + // mMultiplicityCut[0].push_back( 45 ); mCentralityMin[0].push_back( 45.0 ); mCentralityMax[0].push_back( 50.0 ); + // mMultiplicityCut[0].push_back( 35 ); mCentralityMin[0].push_back( 50.0 ); mCentralityMax[0].push_back( 55.0 ); + // mMultiplicityCut[0].push_back( 26 ); mCentralityMin[0].push_back( 55.0 ); mCentralityMax[0].push_back( 60.0 ); + // mMultiplicityCut[0].push_back( 19 ); mCentralityMin[0].push_back( 60.0 ); mCentralityMax[0].push_back( 65.0 ); + // mMultiplicityCut[0].push_back( 13 ); mCentralityMin[0].push_back( 65.0 ); mCentralityMax[0].push_back( 70.0 ); + // mMultiplicityCut[0].push_back( 9 ); mCentralityMin[0].push_back( 70.0 ); mCentralityMax[0].push_back( 75.0 ); + // mMultiplicityCut[0].push_back( 6 ); mCentralityMin[0].push_back( 75.0 ); mCentralityMax[0].push_back( 80.0 ); + // mMultiplicityCut[1].push_back( 290 ); mMultiplicityCut[2].push_back( 285 ); + // mMultiplicityCut[1].push_back( 245 ); mMultiplicityCut[2].push_back( 236 ); + // mMultiplicityCut[1].push_back( 206 ); mMultiplicityCut[2].push_back( 196 ); + // mMultiplicityCut[1].push_back( 174 ); mMultiplicityCut[2].push_back( 161 ); + // mMultiplicityCut[1].push_back( 145 ); mMultiplicityCut[2].push_back( 132 ); + // mMultiplicityCut[1].push_back( 121 ); mMultiplicityCut[2].push_back( 107 ); + // mMultiplicityCut[1].push_back( 99 ); mMultiplicityCut[2].push_back( 85 ); + // mMultiplicityCut[1].push_back( 81 ); mMultiplicityCut[2].push_back( 67 ); + // mMultiplicityCut[1].push_back( 65 ); mMultiplicityCut[2].push_back( 52 ); + // mMultiplicityCut[1].push_back( 51 ); mMultiplicityCut[2].push_back( 40 ); + // mMultiplicityCut[1].push_back( 40 ); mMultiplicityCut[2].push_back( 29 ); + // mMultiplicityCut[1].push_back( 31 ); mMultiplicityCut[2].push_back( 21 ); + // mMultiplicityCut[1].push_back( 23 ); mMultiplicityCut[2].push_back( 15 ); + // mMultiplicityCut[1].push_back( 17 ); mMultiplicityCut[2].push_back( 10 ); + // mMultiplicityCut[1].push_back( 12 ); mMultiplicityCut[2].push_back( 7 ); + // mMultiplicityCut[1].push_back( 9 ); mMultiplicityCut[2].push_back( 4 ); + + + // Set same centrality bins + for(UInt_t ic=0; ic30 + // k = 2.0 (not final, but probably ok) + // x = 0.12 (see above) + // with d = 0.14 (factor for multiplicity dependent efficiency) + //---------------------------------------------------------------------------------------------------- + // Update on Jul/13/2010 + // npp = 1.29 from fitting, M>50 + // k = 1.8 (2.0 should be fine for centrality) + // x = 0.12 + // with d = 0.14 (factor for multiplicity dependent efficiency) + //---------------------------------------------------------------------------------------------------- + + // Error on x (energy specific ???) + // NOTE: type 'low' and 'high' are for npp, x is anti-correlated with npp + Double_t xError = 0.0 ; // absolute error + if( mType.CompareTo("low", TString::kIgnoreCase) == 0 ) xError = 0.02 ; // npp is low, x is high + else if( mType.CompareTo("high", TString::kIgnoreCase) == 0 ) xError = -0.02 ; // npp is high, x is low + + const Double_t npp = 1.29 ; // default npp + mNpp = npp + GetNppError(npp) ; + mK = 1.80 ; + mX = 0.12 + xError ; + mEfficiency = 0.14 ; + mTriggerBias = 1.00 ; + + // Define multiplicity cut from central to peripheral + // -- Very preliminary, version 0 + // ---> Wrong. + // 0.00 - 5.00 (%) : M > 268 (im=531, M=268.5, bin= 0) (sum, total, fraction>cut) = (1865909.564, 36584023.104, 0.051>0.050) + // 5.00 - 10.00 (%) : M > 227 (im=572, M=227.5, bin= 1) (sum, total, fraction>cut) = (3659792.503, 36584023.104, 0.100>0.100) + // 10.00 - 15.00 (%) : M > 191 (im=608, M=191.5, bin= 2) (sum, total, fraction>cut) = (5520660.789, 36584023.104, 0.151>0.150) + // 15.00 - 20.00 (%) : M > 161 (im=638, M=161.5, bin= 3) (sum, total, fraction>cut) = (7330091.938, 36584023.104, 0.200>0.200) + // 20.00 - 25.00 (%) : M > 134 (im=665, M=134.5, bin= 4) (sum, total, fraction>cut) = (9203867.067, 36584023.104, 0.252>0.250) + // 25.00 - 30.00 (%) : M > 111 (im=688, M=111.5, bin= 5) (sum, total, fraction>cut) = (11055589.347, 36584023.104, 0.302>0.300) + // 30.00 - 35.00 (%) : M > 92 (im=707, M=92.5, bin= 6) (sum, total, fraction>cut) = (12811790.742, 36584023.104, 0.350>0.350) + // 35.00 - 40.00 (%) : M > 75 (im=724, M=75.5, bin= 7) (sum, total, fraction>cut) = (14634728.713, 36584023.104, 0.400>0.400) + // 40.00 - 45.00 (%) : M > 60 (im=739, M=60.5, bin= 8) (sum, total, fraction>cut) = (16514693.859, 36584023.104, 0.451>0.450) + // 45.00 - 50.00 (%) : M > 47 (im=752, M=47.5, bin= 9) (sum, total, fraction>cut) = (18447727.788, 36584023.104, 0.504>0.500) + // 50.00 - 55.00 (%) : M > 37 (im=762, M=37.5, bin= 10) (sum, total, fraction>cut) = (20227672.215, 36584023.104, 0.553>0.550) + // 55.00 - 60.00 (%) : M > 28 (im=771, M=28.5, bin= 11) (sum, total, fraction>cut) = (22164445.031, 36584023.104, 0.606>0.600) + // 60.00 - 65.00 (%) : M > 21 (im=778, M=21.5, bin= 12) (sum, total, fraction>cut) = (24030566.783, 36584023.104, 0.657>0.650) + // 65.00 - 70.00 (%) : M > 16 (im=783, M=16.5, bin= 13) (sum, total, fraction>cut) = (25698037.289, 36584023.104, 0.702>0.700) + // 70.00 - 75.00 (%) : M > 11 (im=788, M=11.5, bin= 14) (sum, total, fraction>cut) = (27877720.702, 36584023.104, 0.762>0.750) + // 75.00 - 80.00 (%) : M > 8 (im=791, M=8.5, bin= 15) (sum, total, fraction>cut) = (29625858.979, 36584023.104, 0.810>0.800) + // 0.00 - 4.75 (%) : M > 271 (im=528, M=271.5, bin= 0) (sum, total, fraction>cut) = (1746865.153, 36584023.104, 0.048>0.048) + // 4.75 - 9.50 (%) : M > 230 (im=569, M=230.5, bin= 1) (sum, total, fraction>cut) = (3516397.766, 36584023.104, 0.096>0.095) + // 9.50 - 14.25 (%) : M > 196 (im=603, M=196.5, bin= 2) (sum, total, fraction>cut) = (5242402.709, 36584023.104, 0.143>0.143) + // 14.25 - 19.00 (%) : M > 166 (im=633, M=166.5, bin= 3) (sum, total, fraction>cut) = (7009696.381, 36584023.104, 0.192>0.190) + // 19.00 - 23.75 (%) : M > 141 (im=658, M=141.5, bin= 4) (sum, total, fraction>cut) = (8691141.983, 36584023.104, 0.238>0.237) + // 23.75 - 28.50 (%) : M > 118 (im=681, M=118.5, bin= 5) (sum, total, fraction>cut) = (10463893.991, 36584023.104, 0.286>0.285) + // 28.50 - 33.25 (%) : M > 98 (im=701, M=98.5, bin= 6) (sum, total, fraction>cut) = (12230763.287, 36584023.104, 0.334>0.333) + // 33.25 - 38.00 (%) : M > 81 (im=718, M=81.5, bin= 7) (sum, total, fraction>cut) = (13960155.911, 36584023.104, 0.382>0.380) + // 38.00 - 42.75 (%) : M > 66 (im=733, M=66.5, bin= 8) (sum, total, fraction>cut) = (15724764.315, 36584023.104, 0.430>0.427) + // 42.75 - 47.50 (%) : M > 53 (im=746, M=53.5, bin= 9) (sum, total, fraction>cut) = (17511835.309, 36584023.104, 0.479>0.475) + // 47.50 - 52.25 (%) : M > 43 (im=756, M=43.5, bin= 10) (sum, total, fraction>cut) = (19120910.397, 36584023.104, 0.523>0.522) + // 52.25 - 57.00 (%) : M > 33 (im=766, M=33.5, bin= 11) (sum, total, fraction>cut) = (21038381.483, 36584023.104, 0.575>0.570) + // 57.00 - 61.75 (%) : M > 26 (im=773, M=26.5, bin= 12) (sum, total, fraction>cut) = (22657326.941, 36584023.104, 0.619>0.618) + // 61.75 - 66.50 (%) : M > 20 (im=779, M=20.5, bin= 13) (sum, total, fraction>cut) = (24334148.323, 36584023.104, 0.665>0.665) + // 66.50 - 71.25 (%) : M > 15 (im=784, M=15.5, bin= 14) (sum, total, fraction>cut) = (26079513.531, 36584023.104, 0.713>0.713) + // 71.25 - 76.00 (%) : M > 11 (im=788, M=11.5, bin= 15) (sum, total, fraction>cut) = (27877720.702, 36584023.104, 0.762>0.760) + // 0.00 - 5.25 (%) : M > 266 (im=533, M=266.5, bin= 0) (sum, total, fraction>cut) = (1945845.654, 36584023.104, 0.053>0.053) + // 5.25 - 10.50 (%) : M > 223 (im=576, M=223.5, bin= 1) (sum, total, fraction>cut) = (3851324.498, 36584023.104, 0.105>0.105) + // 10.50 - 15.75 (%) : M > 186 (im=613, M=186.5, bin= 2) (sum, total, fraction>cut) = (5804143.067, 36584023.104, 0.159>0.158) + // 15.75 - 21.00 (%) : M > 155 (im=644, M=155.5, bin= 3) (sum, total, fraction>cut) = (7722828.743, 36584023.104, 0.211>0.210) + // 21.00 - 26.25 (%) : M > 128 (im=671, M=128.5, bin= 4) (sum, total, fraction>cut) = (9661467.345, 36584023.104, 0.264>0.263) + // 26.25 - 31.50 (%) : M > 105 (im=694, M=105.5, bin= 5) (sum, total, fraction>cut) = (11584938.211, 36584023.104, 0.317>0.315) + // 31.50 - 36.75 (%) : M > 85 (im=714, M=85.5, bin= 6) (sum, total, fraction>cut) = (13527498.620, 36584023.104, 0.370>0.368) + // 36.75 - 42.00 (%) : M > 68 (im=731, M=68.5, bin= 7) (sum, total, fraction>cut) = (15473958.886, 36584023.104, 0.423>0.420) + // 42.00 - 47.25 (%) : M > 54 (im=745, M=54.5, bin= 8) (sum, total, fraction>cut) = (17364335.845, 36584023.104, 0.475>0.473) + // 47.25 - 52.50 (%) : M > 42 (im=757, M=42.5, bin= 9) (sum, total, fraction>cut) = (19296755.163, 36584023.104, 0.527>0.525) + // 52.50 - 57.75 (%) : M > 32 (im=767, M=32.5, bin= 10) (sum, total, fraction>cut) = (21253100.432, 36584023.104, 0.581>0.578) + // 57.75 - 63.00 (%) : M > 24 (im=775, M=24.5, bin= 11) (sum, total, fraction>cut) = (23177632.234, 36584023.104, 0.634>0.630) + // 63.00 - 68.25 (%) : M > 18 (im=781, M=18.5, bin= 12) (sum, total, fraction>cut) = (24982936.706, 36584023.104, 0.683>0.683) + // 68.25 - 73.50 (%) : M > 13 (im=786, M=13.5, bin= 13) (sum, total, fraction>cut) = (26916490.129, 36584023.104, 0.736>0.735) + // 73.50 - 78.75 (%) : M > 9 (im=790, M=9.5, bin= 14) (sum, total, fraction>cut) = (28990174.993, 36584023.104, 0.792>0.788) + // 78.75 - 84.00 (%) : M > 6 (im=793, M=6.5, bin= 15) (sum, total, fraction>cut) = (31082429.908, 36584023.104, 0.850>0.840) + // + + // Final centrality bins + // 0.00 - 5.00 (%) : M > 263 (im=536, M=263.5, bin= 0) (sum, total, fraction>cut) = (1990649.322, 39152407.031, 0.051>0.050) + // 5.00 - 10.00 (%) : M > 220 (im=579, M=220.5, bin= 1) (sum, total, fraction>cut) = (3932718.338, 39152407.031, 0.100>0.100) + // 10.00 - 15.00 (%) : M > 183 (im=616, M=183.5, bin= 2) (sum, total, fraction>cut) = (5911300.888, 39152407.031, 0.151>0.150) + // 15.00 - 20.00 (%) : M > 152 (im=647, M=152.5, bin= 3) (sum, total, fraction>cut) = (7860151.100, 39152407.031, 0.201>0.200) + // 20.00 - 25.00 (%) : M > 125 (im=674, M=125.5, bin= 4) (sum, total, fraction>cut) = (9839908.223, 39152407.031, 0.251>0.250) + // 25.00 - 30.00 (%) : M > 102 (im=697, M=102.5, bin= 5) (sum, total, fraction>cut) = (11809650.159, 39152407.031, 0.302>0.300) + // 30.00 - 35.00 (%) : M > 83 (im=716, M=83.5, bin= 6) (sum, total, fraction>cut) = (13705762.079, 39152407.031, 0.350>0.350) + // 35.00 - 40.00 (%) : M > 66 (im=733, M=66.5, bin= 7) (sum, total, fraction>cut) = (15697507.669, 39152407.031, 0.401>0.400) + // 40.00 - 45.00 (%) : M > 52 (im=747, M=52.5, bin= 8) (sum, total, fraction>cut) = (17654337.142, 39152407.031, 0.451>0.450) + // 45.00 - 50.00 (%) : M > 40 (im=759, M=40.5, bin= 9) (sum, total, fraction>cut) = (19666308.865, 39152407.031, 0.502>0.500) + // 50.00 - 55.00 (%) : M > 30 (im=769, M=30.5, bin= 10) (sum, total, fraction>cut) = (21739702.884, 39152407.031, 0.555>0.550) + // 55.00 - 60.00 (%) : M > 23 (im=776, M=23.5, bin= 11) (sum, total, fraction>cut) = (23540510.015, 39152407.031, 0.601>0.600) + // 60.00 - 65.00 (%) : M > 17 (im=782, M=17.5, bin= 12) (sum, total, fraction>cut) = (25471310.968, 39152407.031, 0.651>0.650) + // 65.00 - 70.00 (%) : M > 12 (im=787, M=12.5, bin= 13) (sum, total, fraction>cut) = (27562143.469, 39152407.031, 0.704>0.700) + // 70.00 - 75.00 (%) : M > 8 (im=791, M=8.5, bin= 14) (sum, total, fraction>cut) = (29853827.818, 39152407.031, 0.763>0.750) + // 75.00 - 80.00 (%) : M > 6 (im=793, M=6.5, bin= 15) (sum, total, fraction>cut) = (31386989.094, 39152407.031, 0.802>0.800) + // 0.00 - 4.75 (%) : M > 266 (im=533, M=266.5, bin= 0) (sum, total, fraction>cut) = (1868877.506, 39152407.031, 0.048>0.048) + // 4.75 - 9.50 (%) : M > 224 (im=575, M=224.5, bin= 1) (sum, total, fraction>cut) = (3736885.828, 39152407.031, 0.095>0.095) + // 9.50 - 14.25 (%) : M > 188 (im=611, M=188.5, bin= 2) (sum, total, fraction>cut) = (5623883.068, 39152407.031, 0.144>0.143) + // 14.25 - 19.00 (%) : M > 158 (im=641, M=158.5, bin= 3) (sum, total, fraction>cut) = (7458337.777, 39152407.031, 0.190>0.190) + // 19.00 - 23.75 (%) : M > 131 (im=668, M=131.5, bin= 4) (sum, total, fraction>cut) = (9372350.178, 39152407.031, 0.239>0.237) + // 23.75 - 28.50 (%) : M > 109 (im=690, M=109.5, bin= 5) (sum, total, fraction>cut) = (11177088.210, 39152407.031, 0.285>0.285) + // 28.50 - 33.25 (%) : M > 89 (im=710, M=89.5, bin= 6) (sum, total, fraction>cut) = (13073333.249, 39152407.031, 0.334>0.333) + // 33.25 - 38.00 (%) : M > 72 (im=727, M=72.5, bin= 7) (sum, total, fraction>cut) = (14957151.313, 39152407.031, 0.382>0.380) + // 38.00 - 42.75 (%) : M > 58 (im=741, M=58.5, bin= 8) (sum, total, fraction>cut) = (16773822.999, 39152407.031, 0.428>0.427) + // 42.75 - 47.50 (%) : M > 46 (im=753, M=46.5, bin= 9) (sum, total, fraction>cut) = (18612835.049, 39152407.031, 0.475>0.475) + // 47.50 - 52.25 (%) : M > 35 (im=764, M=35.5, bin= 10) (sum, total, fraction>cut) = (20646606.832, 39152407.031, 0.527>0.522) + // 52.25 - 57.00 (%) : M > 27 (im=772, M=27.5, bin= 11) (sum, total, fraction>cut) = (22464915.089, 39152407.031, 0.574>0.570) + // 57.00 - 61.75 (%) : M > 20 (im=779, M=20.5, bin= 12) (sum, total, fraction>cut) = (24447945.353, 39152407.031, 0.624>0.617) + // 61.75 - 66.50 (%) : M > 15 (im=784, M=15.5, bin= 13) (sum, total, fraction>cut) = (26239770.921, 39152407.031, 0.670>0.665) + // 66.50 - 71.25 (%) : M > 11 (im=788, M=11.5, bin= 14) (sum, total, fraction>cut) = (28067060.740, 39152407.031, 0.717>0.712) + // 71.25 - 76.00 (%) : M > 8 (im=791, M=8.5, bin= 15) (sum, total, fraction>cut) = (29853827.818, 39152407.031, 0.763>0.760) + // 0.00 - 5.25 (%) : M > 261 (im=538, M=261.5, bin= 0) (sum, total, fraction>cut) = (2073119.952, 39152407.031, 0.053>0.053) + // 5.25 - 10.50 (%) : M > 216 (im=583, M=216.5, bin= 1) (sum, total, fraction>cut) = (4130946.974, 39152407.031, 0.106>0.105) + // 10.50 - 15.75 (%) : M > 178 (im=621, M=178.5, bin= 2) (sum, total, fraction>cut) = (6207230.441, 39152407.031, 0.159>0.158) + // 15.75 - 21.00 (%) : M > 146 (im=653, M=146.5, bin= 3) (sum, total, fraction>cut) = (8276842.338, 39152407.031, 0.211>0.210) + // 21.00 - 26.25 (%) : M > 119 (im=680, M=119.5, bin= 4) (sum, total, fraction>cut) = (10326627.455, 39152407.031, 0.264>0.263) + // 26.25 - 31.50 (%) : M > 96 (im=703, M=96.5, bin= 5) (sum, total, fraction>cut) = (12373773.701, 39152407.031, 0.316>0.315) + // 31.50 - 36.75 (%) : M > 76 (im=723, M=76.5, bin= 6) (sum, total, fraction>cut) = (14487729.614, 39152407.031, 0.370>0.368) + // 36.75 - 42.00 (%) : M > 60 (im=739, M=60.5, bin= 7) (sum, total, fraction>cut) = (16495966.197, 39152407.031, 0.421>0.420) + // 42.00 - 47.25 (%) : M > 46 (im=753, M=46.5, bin= 8) (sum, total, fraction>cut) = (18612835.049, 39152407.031, 0.475>0.473) + // 47.25 - 52.50 (%) : M > 35 (im=764, M=35.5, bin= 9) (sum, total, fraction>cut) = (20646606.832, 39152407.031, 0.527>0.525) + // 52.50 - 57.75 (%) : M > 26 (im=773, M=26.5, bin= 10) (sum, total, fraction>cut) = (22718278.145, 39152407.031, 0.580>0.578) + // 57.75 - 63.00 (%) : M > 19 (im=780, M=19.5, bin= 11) (sum, total, fraction>cut) = (24774922.765, 39152407.031, 0.633>0.630) + // 63.00 - 68.25 (%) : M > 13 (im=786, M=13.5, bin= 12) (sum, total, fraction>cut) = (27094272.205, 39152407.031, 0.692>0.683) + // 68.25 - 73.50 (%) : M > 9 (im=790, M=9.5, bin= 13) (sum, total, fraction>cut) = (29201368.616, 39152407.031, 0.746>0.735) + // 73.50 - 78.75 (%) : M > 6 (im=793, M=6.5, bin= 14) (sum, total, fraction>cut) = (31386989.094, 39152407.031, 0.802>0.788) + // 78.75 - 84.00 (%) : M > 4 (im=795, M=4.5, bin= 15) (sum, total, fraction>cut) = (33378906.955, 39152407.031, 0.853>0.840) + + mMultiplicityCut[0].push_back( 263 ); mCentralityMin[0].push_back( 0.0 ); mCentralityMax[0].push_back( 5.0 ); + mMultiplicityCut[0].push_back( 220 ); mCentralityMin[0].push_back( 5.0 ); mCentralityMax[0].push_back( 10.0 ); + mMultiplicityCut[0].push_back( 183 ); mCentralityMin[0].push_back( 10.0 ); mCentralityMax[0].push_back( 15.0 ); + mMultiplicityCut[0].push_back( 152 ); mCentralityMin[0].push_back( 15.0 ); mCentralityMax[0].push_back( 20.0 ); + mMultiplicityCut[0].push_back( 125 ); mCentralityMin[0].push_back( 20.0 ); mCentralityMax[0].push_back( 25.0 ); + mMultiplicityCut[0].push_back( 102 ); mCentralityMin[0].push_back( 25.0 ); mCentralityMax[0].push_back( 30.0 ); + mMultiplicityCut[0].push_back( 83 ); mCentralityMin[0].push_back( 30.0 ); mCentralityMax[0].push_back( 35.0 ); + mMultiplicityCut[0].push_back( 66 ); mCentralityMin[0].push_back( 35.0 ); mCentralityMax[0].push_back( 40.0 ); + mMultiplicityCut[0].push_back( 52 ); mCentralityMin[0].push_back( 40.0 ); mCentralityMax[0].push_back( 45.0 ); + mMultiplicityCut[0].push_back( 40 ); mCentralityMin[0].push_back( 45.0 ); mCentralityMax[0].push_back( 50.0 ); + mMultiplicityCut[0].push_back( 30 ); mCentralityMin[0].push_back( 50.0 ); mCentralityMax[0].push_back( 55.0 ); + mMultiplicityCut[0].push_back( 23 ); mCentralityMin[0].push_back( 55.0 ); mCentralityMax[0].push_back( 60.0 ); + mMultiplicityCut[0].push_back( 17 ); mCentralityMin[0].push_back( 60.0 ); mCentralityMax[0].push_back( 65.0 ); + mMultiplicityCut[0].push_back( 12 ); mCentralityMin[0].push_back( 65.0 ); mCentralityMax[0].push_back( 70.0 ); + mMultiplicityCut[0].push_back( 8 ); mCentralityMin[0].push_back( 70.0 ); mCentralityMax[0].push_back( 75.0 ); + mMultiplicityCut[0].push_back( 6 ); mCentralityMin[0].push_back( 75.0 ); mCentralityMax[0].push_back( 80.0 ); + + // -5% +5% + mMultiplicityCut[1].push_back( 266 ); mMultiplicityCut[2].push_back( 261 ); + mMultiplicityCut[1].push_back( 224 ); mMultiplicityCut[2].push_back( 216 ); + mMultiplicityCut[1].push_back( 188 ); mMultiplicityCut[2].push_back( 178 ); + mMultiplicityCut[1].push_back( 158 ); mMultiplicityCut[2].push_back( 146 ); + mMultiplicityCut[1].push_back( 131 ); mMultiplicityCut[2].push_back( 119 ); + mMultiplicityCut[1].push_back( 109 ); mMultiplicityCut[2].push_back( 96 ); + mMultiplicityCut[1].push_back( 89 ); mMultiplicityCut[2].push_back( 76 ); + mMultiplicityCut[1].push_back( 72 ); mMultiplicityCut[2].push_back( 60 ); + mMultiplicityCut[1].push_back( 58 ); mMultiplicityCut[2].push_back( 46 ); + mMultiplicityCut[1].push_back( 46 ); mMultiplicityCut[2].push_back( 35 ); + mMultiplicityCut[1].push_back( 35 ); mMultiplicityCut[2].push_back( 26 ); + mMultiplicityCut[1].push_back( 27 ); mMultiplicityCut[2].push_back( 19 ); + mMultiplicityCut[1].push_back( 20 ); mMultiplicityCut[2].push_back( 13 ); + mMultiplicityCut[1].push_back( 15 ); mMultiplicityCut[2].push_back( 9 ); + mMultiplicityCut[1].push_back( 11 ); mMultiplicityCut[2].push_back( 6 ); + mMultiplicityCut[1].push_back( 8 ); mMultiplicityCut[2].push_back( 4 ); + + // Set same centrality bins + for(UInt_t ic=0; ic30 + // k = 2.0 (not final, but probably ok) + // x = 0.12 (see above) + // with d = 0.14 (factor for multiplicity dependent efficiency) + //---------------------------------------------------------------------------------------------------- + // Update on Oct/25/2010 (with full production) + // npp = 1.06 from fitting, M>30 + // k = 2.0 + // x = 0.12 (see above) + // with d = 0.14 (factor for multiplicity dependent efficiency) + // + // ---> Stick to the 1.07 + //---------------------------------------------------------------------------------------------------- + + // Error on x (energy specific ???) + // NOTE: type 'low' and 'high' are for npp, x is anti-correlated with npp + Double_t xError = 0.0 ; // absolute error + if( mType.CompareTo("low", TString::kIgnoreCase) == 0 ) xError = 0.02 ; // npp is low, x is high + else if( mType.CompareTo("high", TString::kIgnoreCase) == 0 ) xError = -0.02 ; // npp is high, x is low + + const Double_t npp = 1.07 ; // default npp + // const Double_t npp = 1.06 ; // default npp + mNpp = npp + GetNppError(npp) ; + mK = 2.00 ; + mX = 0.12 + xError ; + mEfficiency = 0.14 ; + mTriggerBias = 1.00 ; + + // Define multiplicity cut from central to peripheral + // For the fast offline + // from +#if 0 + mMultiplicityCut[0].push_back( 221 ); mCentralityMin[0].push_back( 0.0 ); mCentralityMax[0].push_back( 5.0 ); + mMultiplicityCut[0].push_back( 184 ); mCentralityMin[0].push_back( 5.0 ); mCentralityMax[0].push_back( 10.0 ); + mMultiplicityCut[0].push_back( 127 ); mCentralityMin[0].push_back( 10.0 ); mCentralityMax[0].push_back( 20.0 ); + mMultiplicityCut[0].push_back( 86 ); mCentralityMin[0].push_back( 20.0 ); mCentralityMax[0].push_back( 30.0 ); + mMultiplicityCut[0].push_back( 56 ); mCentralityMin[0].push_back( 30.0 ); mCentralityMax[0].push_back( 40.0 ); + mMultiplicityCut[0].push_back( 34 ); mCentralityMin[0].push_back( 40.0 ); mCentralityMax[0].push_back( 50.0 ); + mMultiplicityCut[0].push_back( 19 ); mCentralityMin[0].push_back( 50.0 ); mCentralityMax[0].push_back( 60.0 ); + mMultiplicityCut[0].push_back( 10 ); mCentralityMin[0].push_back( 60.0 ); mCentralityMax[0].push_back( 70.0 ); + mMultiplicityCut[0].push_back( 5 ); mCentralityMin[0].push_back( 70.0 ); mCentralityMax[0].push_back( 80.0 ); + + // -5% +5% + mMultiplicityCut[1].push_back( 223 ); mMultiplicityCut[2].push_back( 219 ); // 0-5% + mMultiplicityCut[1].push_back( 188 ); mMultiplicityCut[2].push_back( 181 ); // 5-10% + mMultiplicityCut[1].push_back( 132 ); mMultiplicityCut[2].push_back( 123 ); // 10-20% + mMultiplicityCut[1].push_back( 91 ); mMultiplicityCut[2].push_back( 81 ); // 20-30% + mMultiplicityCut[1].push_back( 61 ); mMultiplicityCut[2].push_back( 51 ); // 30-40% + mMultiplicityCut[1].push_back( 39 ); mMultiplicityCut[2].push_back( 30 ); // 40-50% + mMultiplicityCut[1].push_back( 23 ); mMultiplicityCut[2].push_back( 16 ); // 50-60% + mMultiplicityCut[1].push_back( 13 ); mMultiplicityCut[2].push_back( 8 ); // 60-70% + mMultiplicityCut[1].push_back( 7 ); mMultiplicityCut[2].push_back( 3 ); // 70-80% + + // For the full production + mMultiplicityCut[0].push_back( 219 ); mCentralityMin[0].push_back( 0.0 ); mCentralityMax[0].push_back( 5.0 ); + mMultiplicityCut[0].push_back( 183 ); mCentralityMin[0].push_back( 5.0 ); mCentralityMax[0].push_back( 10.0 ); + mMultiplicityCut[0].push_back( 126 ); mCentralityMin[0].push_back( 10.0 ); mCentralityMax[0].push_back( 20.0 ); + mMultiplicityCut[0].push_back( 85 ); mCentralityMin[0].push_back( 20.0 ); mCentralityMax[0].push_back( 30.0 ); + mMultiplicityCut[0].push_back( 55 ); mCentralityMin[0].push_back( 30.0 ); mCentralityMax[0].push_back( 40.0 ); + mMultiplicityCut[0].push_back( 34 ); mCentralityMin[0].push_back( 40.0 ); mCentralityMax[0].push_back( 50.0 ); + mMultiplicityCut[0].push_back( 19 ); mCentralityMin[0].push_back( 50.0 ); mCentralityMax[0].push_back( 60.0 ); + mMultiplicityCut[0].push_back( 10 ); mCentralityMin[0].push_back( 60.0 ); mCentralityMax[0].push_back( 70.0 ); + mMultiplicityCut[0].push_back( 5 ); mCentralityMin[0].push_back( 70.0 ); mCentralityMax[0].push_back( 80.0 ); + + // -5% +5% + mMultiplicityCut[1].push_back( 221 ); mMultiplicityCut[2].push_back( 217 ); // 0-5% + mMultiplicityCut[1].push_back( 186 ); mMultiplicityCut[2].push_back( 179 ); // 5-10% + mMultiplicityCut[1].push_back( 131 ); mMultiplicityCut[2].push_back( 121 ); // 10-20% + mMultiplicityCut[1].push_back( 91 ); mMultiplicityCut[2].push_back( 80 ); // 20-30% + mMultiplicityCut[1].push_back( 60 ); mMultiplicityCut[2].push_back( 50 ); // 30-40% + mMultiplicityCut[1].push_back( 38 ); mMultiplicityCut[2].push_back( 30 ); // 40-50% + mMultiplicityCut[1].push_back( 23 ); mMultiplicityCut[2].push_back( 16 ); // 50-60% + mMultiplicityCut[1].push_back( 13 ); mMultiplicityCut[2].push_back( 8 ); // 60-70% + mMultiplicityCut[1].push_back( 6 ); mMultiplicityCut[2].push_back( 3 ); // 70-80% +#endif + + // Final centrality bins + // Define multiplicity cut from central to peripheral + // mMultiplicityCut[0].push_back( 221 ); mCentralityMin[0].push_back( 0.0 ); mCentralityMax[0].push_back( 5.0 ); + // mMultiplicityCut[0].push_back( 184 ); mCentralityMin[0].push_back( 5.0 ); mCentralityMax[0].push_back( 10.0 ); + + // Temporary to include 7.5% + mMultiplicityCut[0].push_back( 221 ); mCentralityMin[0].push_back( 0.0 ); mCentralityMax[0].push_back( 5.0 ); + mMultiplicityCut[0].push_back( 202 ); mCentralityMin[0].push_back( 5.0 ); mCentralityMax[0].push_back( 7.5 ); + mMultiplicityCut[0].push_back( 184 ); mCentralityMin[0].push_back( 7.5 ); mCentralityMax[0].push_back( 10.0 ); + + mMultiplicityCut[0].push_back( 153 ); mCentralityMin[0].push_back( 10.0 ); mCentralityMax[0].push_back( 15.0 ); + mMultiplicityCut[0].push_back( 127 ); mCentralityMin[0].push_back( 15.0 ); mCentralityMax[0].push_back( 20.0 ); + mMultiplicityCut[0].push_back( 105 ); mCentralityMin[0].push_back( 20.0 ); mCentralityMax[0].push_back( 25.0 ); + mMultiplicityCut[0].push_back( 86 ); mCentralityMin[0].push_back( 25.0 ); mCentralityMax[0].push_back( 30.0 ); + mMultiplicityCut[0].push_back( 70 ); mCentralityMin[0].push_back( 30.0 ); mCentralityMax[0].push_back( 35.0 ); + mMultiplicityCut[0].push_back( 56 ); mCentralityMin[0].push_back( 35.0 ); mCentralityMax[0].push_back( 40.0 ); + mMultiplicityCut[0].push_back( 44 ); mCentralityMin[0].push_back( 40.0 ); mCentralityMax[0].push_back( 45.0 ); + mMultiplicityCut[0].push_back( 34 ); mCentralityMin[0].push_back( 45.0 ); mCentralityMax[0].push_back( 50.0 ); + mMultiplicityCut[0].push_back( 26 ); mCentralityMin[0].push_back( 50.0 ); mCentralityMax[0].push_back( 55.0 ); + mMultiplicityCut[0].push_back( 19 ); mCentralityMin[0].push_back( 55.0 ); mCentralityMax[0].push_back( 60.0 ); + mMultiplicityCut[0].push_back( 14 ); mCentralityMin[0].push_back( 60.0 ); mCentralityMax[0].push_back( 65.0 ); + mMultiplicityCut[0].push_back( 10 ); mCentralityMin[0].push_back( 65.0 ); mCentralityMax[0].push_back( 70.0 ); + mMultiplicityCut[0].push_back( 7 ); mCentralityMin[0].push_back( 70.0 ); mCentralityMax[0].push_back( 75.0 ); + mMultiplicityCut[0].push_back( 5 ); mCentralityMin[0].push_back( 75.0 ); mCentralityMax[0].push_back( 80.0 ); + + // -5% +5% + mMultiplicityCut[1].push_back( 223 ); mMultiplicityCut[2].push_back( 219 ); + mMultiplicityCut[1].push_back( 204 ); mMultiplicityCut[2].push_back( 199 ); // temp + mMultiplicityCut[1].push_back( 188 ); mMultiplicityCut[2].push_back( 181 ); + mMultiplicityCut[1].push_back( 158 ); mMultiplicityCut[2].push_back( 149 ); + mMultiplicityCut[1].push_back( 132 ); mMultiplicityCut[2].push_back( 123 ); + mMultiplicityCut[1].push_back( 110 ); mMultiplicityCut[2].push_back( 100 ); + mMultiplicityCut[1].push_back( 91 ); mMultiplicityCut[2].push_back( 81 ); + mMultiplicityCut[1].push_back( 75 ); mMultiplicityCut[2].push_back( 64 ); + mMultiplicityCut[1].push_back( 61 ); mMultiplicityCut[2].push_back( 51 ); + mMultiplicityCut[1].push_back( 49 ); mMultiplicityCut[2].push_back( 39 ); + mMultiplicityCut[1].push_back( 39 ); mMultiplicityCut[2].push_back( 30 ); + mMultiplicityCut[1].push_back( 30 ); mMultiplicityCut[2].push_back( 22 ); + mMultiplicityCut[1].push_back( 23 ); mMultiplicityCut[2].push_back( 16 ); + mMultiplicityCut[1].push_back( 17 ); mMultiplicityCut[2].push_back( 11 ); + mMultiplicityCut[1].push_back( 13 ); mMultiplicityCut[2].push_back( 8 ); + mMultiplicityCut[1].push_back( 9 ); mMultiplicityCut[2].push_back( 5 ); + mMultiplicityCut[1].push_back( 7 ); mMultiplicityCut[2].push_back( 3 ); + + // Set same centrality bins + for(UInt_t ic=0; ic 0.12 from extrapolation between 19.6 and 200 GeV data (PHOBOS, PRC70, 021902, 2004) + // NOTE: parameters are not final yet (May/03/2010) + //---------------------------------------------------------------------------------------------------- + // Update: May/07/2010 + // npp = 0.86 from fitting, M>30 + // k = 2.0 (not final, but probably ok) + // x = 0.12 (see above) + // with d = 0.14 (factor for multiplicity dependent efficiency) + //---------------------------------------------------------------------------------------------------- + // Update: Sep/08/2010 + // npp = 0.89 from fitting, M>30 + // k = 2.0 + // x = 0.12 (see above) + // with d = 0.14 (factor for multiplicity dependent efficiency) + //---------------------------------------------------------------------------------------------------- + + // Error on x (energy specific ???) + // NOTE: type 'low' and 'high' are for npp, x is anti-correlated with npp + Double_t xError = 0.0 ; // absolute error + if( mType.CompareTo("low", TString::kIgnoreCase) == 0 ) xError = 0.02 ; // npp is low, x is high + else if( mType.CompareTo("high", TString::kIgnoreCase) == 0 ) xError = -0.02 ; // npp is high, x is low + + const Double_t npp = 0.89 ; // default npp + mNpp = npp + GetNppError(npp) ; + mK = 2.00 ; + mX = 0.12 + xError ; + mEfficiency = 0.14 ; + mTriggerBias = 1.00 ; + + // Fast offline (obsolete) + // Define multiplicity cut from central to peripheral + // from + // mMultiplicityCut[0].push_back( 179 ); mCentralityMin[0].push_back( 0.0 ); mCentralityMax[0].push_back( 5.0 ); + // mMultiplicityCut[0].push_back( 149 ); mCentralityMin[0].push_back( 5.0 ); mCentralityMax[0].push_back( 10.0 ); + // mMultiplicityCut[0].push_back( 103 ); mCentralityMin[0].push_back( 10.0 ); mCentralityMax[0].push_back( 20.0 ); + // mMultiplicityCut[0].push_back( 69 ); mCentralityMin[0].push_back( 20.0 ); mCentralityMax[0].push_back( 30.0 ); + // mMultiplicityCut[0].push_back( 45 ); mCentralityMin[0].push_back( 30.0 ); mCentralityMax[0].push_back( 40.0 ); + // mMultiplicityCut[0].push_back( 27 ); mCentralityMin[0].push_back( 40.0 ); mCentralityMax[0].push_back( 50.0 ); + // mMultiplicityCut[0].push_back( 16 ); mCentralityMin[0].push_back( 50.0 ); mCentralityMax[0].push_back( 60.0 ); + // mMultiplicityCut[0].push_back( 8 ); mCentralityMin[0].push_back( 60.0 ); mCentralityMax[0].push_back( 70.0 ); + // mMultiplicityCut[0].push_back( 4 ); mCentralityMin[0].push_back( 70.0 ); mCentralityMax[0].push_back( 80.0 ); + // + // // -5% +5% + // mMultiplicityCut[1].push_back( 181 ); mMultiplicityCut[2].push_back( 177 ); // 0-5% + // mMultiplicityCut[1].push_back( 152 ); mMultiplicityCut[2].push_back( 146 ); // 5-10% + // mMultiplicityCut[1].push_back( 107 ); mMultiplicityCut[2].push_back( 99 ); // 10-20% + // mMultiplicityCut[1].push_back( 74 ); mMultiplicityCut[2].push_back( 65 ); // 20-30% + // mMultiplicityCut[1].push_back( 49 ); mMultiplicityCut[2].push_back( 41 ); // 30-40% + // mMultiplicityCut[1].push_back( 31 ); mMultiplicityCut[2].push_back( 24 ); // 40-50% + // mMultiplicityCut[1].push_back( 19 ); mMultiplicityCut[2].push_back( 13 ); // 50-60% + // mMultiplicityCut[1].push_back( 10 ); mMultiplicityCut[2].push_back( 6 ); // 60-70% + // mMultiplicityCut[1].push_back( 5 ); mMultiplicityCut[2].push_back( 3 ); // 70-80% + + // Final centrality bins + // Define multiplicity cut from central to peripheral + // mMultiplicityCut[0].push_back( 185 ); mCentralityMin[0].push_back( 0.0 ); mCentralityMax[0].push_back( 5.0 ); + // mMultiplicityCut[0].push_back( 154 ); mCentralityMin[0].push_back( 5.0 ); mCentralityMax[0].push_back( 10.0 ); + + // Temporary to include 7.5% + mMultiplicityCut[0].push_back( 185 ); mCentralityMin[0].push_back( 0.0 ); mCentralityMax[0].push_back( 5.0 ); + mMultiplicityCut[0].push_back( 169 ); mCentralityMin[0].push_back( 5.0 ); mCentralityMax[0].push_back( 7.5 ); + mMultiplicityCut[0].push_back( 154 ); mCentralityMin[0].push_back( 7.5 ); mCentralityMax[0].push_back( 10.0 ); + + mMultiplicityCut[0].push_back( 128 ); mCentralityMin[0].push_back( 10.0 ); mCentralityMax[0].push_back( 15.0 ); + mMultiplicityCut[0].push_back( 106 ); mCentralityMin[0].push_back( 15.0 ); mCentralityMax[0].push_back( 20.0 ); + mMultiplicityCut[0].push_back( 87 ); mCentralityMin[0].push_back( 20.0 ); mCentralityMax[0].push_back( 25.0 ); + mMultiplicityCut[0].push_back( 72 ); mCentralityMin[0].push_back( 25.0 ); mCentralityMax[0].push_back( 30.0 ); + mMultiplicityCut[0].push_back( 58 ); mCentralityMin[0].push_back( 30.0 ); mCentralityMax[0].push_back( 35.0 ); + mMultiplicityCut[0].push_back( 46 ); mCentralityMin[0].push_back( 35.0 ); mCentralityMax[0].push_back( 40.0 ); + mMultiplicityCut[0].push_back( 37 ); mCentralityMin[0].push_back( 40.0 ); mCentralityMax[0].push_back( 45.0 ); + mMultiplicityCut[0].push_back( 28 ); mCentralityMin[0].push_back( 45.0 ); mCentralityMax[0].push_back( 50.0 ); + mMultiplicityCut[0].push_back( 22 ); mCentralityMin[0].push_back( 50.0 ); mCentralityMax[0].push_back( 55.0 ); + mMultiplicityCut[0].push_back( 16 ); mCentralityMin[0].push_back( 55.0 ); mCentralityMax[0].push_back( 60.0 ); + mMultiplicityCut[0].push_back( 12 ); mCentralityMin[0].push_back( 60.0 ); mCentralityMax[0].push_back( 65.0 ); + mMultiplicityCut[0].push_back( 8 ); mCentralityMin[0].push_back( 65.0 ); mCentralityMax[0].push_back( 70.0 ); + mMultiplicityCut[0].push_back( 6 ); mCentralityMin[0].push_back( 70.0 ); mCentralityMax[0].push_back( 75.0 ); + mMultiplicityCut[0].push_back( 4 ); mCentralityMin[0].push_back( 75.0 ); mCentralityMax[0].push_back( 80.0 ); + + // -5% +5% + mMultiplicityCut[1].push_back( 187 ); mMultiplicityCut[2].push_back( 183 ); + mMultiplicityCut[1].push_back( 171 ); mMultiplicityCut[2].push_back( 167 ); // temp + mMultiplicityCut[1].push_back( 157 ); mMultiplicityCut[2].push_back( 152 ); + mMultiplicityCut[1].push_back( 132 ); mMultiplicityCut[2].push_back( 125 ); + mMultiplicityCut[1].push_back( 110 ); mMultiplicityCut[2].push_back( 102 ); + mMultiplicityCut[1].push_back( 92 ); mMultiplicityCut[2].push_back( 83 ); + mMultiplicityCut[1].push_back( 76 ); mMultiplicityCut[2].push_back( 67 ); + mMultiplicityCut[1].push_back( 62 ); mMultiplicityCut[2].push_back( 54 ); + mMultiplicityCut[1].push_back( 51 ); mMultiplicityCut[2].push_back( 42 ); + mMultiplicityCut[1].push_back( 41 ); mMultiplicityCut[2].push_back( 33 ); + mMultiplicityCut[1].push_back( 32 ); mMultiplicityCut[2].push_back( 25 ); + mMultiplicityCut[1].push_back( 25 ); mMultiplicityCut[2].push_back( 18 ); + mMultiplicityCut[1].push_back( 19 ); mMultiplicityCut[2].push_back( 13 ); + mMultiplicityCut[1].push_back( 15 ); mMultiplicityCut[2].push_back( 9 ); + mMultiplicityCut[1].push_back( 11 ); mMultiplicityCut[2].push_back( 7 ); + mMultiplicityCut[1].push_back( 8 ); mMultiplicityCut[2].push_back( 4 ); + mMultiplicityCut[1].push_back( 5 ); mMultiplicityCut[2].push_back( 3 ); + + // Set same centrality bins + for(UInt_t ic=0; ic +#include "TString.h" + +//____________________________________________________________________________________________________ +// Class StCentrality: Centrality class +// - Centrality: multiplicity cut, and corresponding centrality range +// - NBD: npp, k and x parameters +class StCentrality { + public: + /// Type description + /// default default parameters for a given system + /// low low npp, high x (-5% npp) + /// high high npp, low x (+5% npp) + StCentrality(const TString system = "AuAu_200GeV", const TString type="default"); /// Default constructor + virtual ~StCentrality(); /// Default destructor + + static void help() ; /// Print help messages + + // Getters + + // mode + // 0 default + // 1 -5% total cross section + // 2 +5% total cross section + Double_t GetCentrality(const UInt_t multiplicity, const UInt_t mode=0) const ; // Get centrality + + Double_t GetNpp() const ; /// Get Npp + Double_t GetK() const ; /// Get K + Double_t GetX() const ; /// Get X + Double_t GetEfficiency() const ; /// Get efficiency + Double_t GetTriggerBias() const ; /// Get trigger bias + + Double_t GetReweighting(const UInt_t multiplicity) const ; /// Re-weighting correction + + private: + // Functions + Double_t GetNppError(const Double_t npp) const ; /// +/- 5% error if type is low or high + + // Initialization + void Init_AuAu200GeV() ; /// Initialization of Au + Au 200 GeV + void Init_AuAu62GeV() ; /// Initialization of Au + Au 62.4 GeV + void Init_AuAu39GeV() ; /// Initialization of Au + Au 39 GeV + void Init_AuAu27GeV() ; /// Initialization of Au + Au 27 GeV + void Init_AuAu19GeV() ; /// Initialization of Au + Au 19.6 GeV + void Init_AuAu11GeV() ; /// Initialization of Au + Au 11.5 GeV + void Init_AuAu7GeV() ; /// Initialization of Au + Au 7.7 GeV + // void Init_SmSm200GeV() ; /// Initialization of Sm + Sm 200 GeV + void Init_dAu200GeV() ; /// Initialization of d + Au 200 GeV + + // Need actual implementation + void Init_CuCu200GeV() ; + void Init_ZrZr200GeV() ; + void Init_UU200GeV() ; + void Init_PbPb2760GeV() ; + + // Data members + enum { + mNMode = 3 + }; + + const TString mType ; /// Type + Double_t mNpp ; /// Average multiplicity in p + p + Double_t mK ; /// NBD k parameters + Double_t mX ; /// Fraction of hard component + Double_t mEfficiency ; /// Efficiency + Double_t mTriggerBias ; /// Trigger bias + Double_t mParReweighting[2]; /// Parameters for re-weighting correction 1-exp(-p0*x^{p1}) + std::vector mMultiplicityCut[mNMode] ; /// Multiplicity cut for each centrality bin + std::vector mCentralityMin[mNMode] ; /// Minimum centrality + std::vector mCentralityMax[mNMode] ; /// Maximum centrality + + ClassDef(StCentrality, 0) +}; + +inline Double_t StCentrality::GetNpp() const { return mNpp ; } +inline Double_t StCentrality::GetK() const { return mK ; } +inline Double_t StCentrality::GetX() const { return mX ; } +inline Double_t StCentrality::GetEfficiency() const { return mEfficiency ; } +inline Double_t StCentrality::GetTriggerBias() const { return mTriggerBias ; } + +#endif + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StCentralityMaker/StCentralityMaker.cxx b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StCentralityMaker/StCentralityMaker.cxx new file mode 100644 index 00000000000..917bced3ec8 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StCentralityMaker/StCentralityMaker.cxx @@ -0,0 +1,91 @@ +/****************************************************************************** + * $Id: StCentralityMaker.cxx,v 1.4 2012/04/25 05:17:24 hmasui Exp $ + * $Log: StCentralityMaker.cxx,v $ + * Revision 1.4 2012/04/25 05:17:24 hmasui + * Remove SetModeNBD() and corresponding data member, merged into GetNegativeBinomial() function + * +******************************************************************************/ + +#include + +#include "TError.h" + +#include "StMessMgr.h" +#include "StNegativeBinomial.h" +#include "StCentrality.h" +#include "StCentralityMaker.h" + +ClassImp(StCentralityMaker) + +//____________________________________________________________________________________________________ +// Default constructor +StCentralityMaker::StCentralityMaker() + : mNBinomial(0), mCentrality(0) +{ + LOG_INFO << "StCentralityMaker User needs to call Init(const Char_t* system) function to Initialize NBD (see below)" << endm; + StCentrality::help(); +} + +//____________________________________________________________________________________________________ +// Initialization inside the constructor +StCentralityMaker::StCentralityMaker(const Char_t* system) + : mNBinomial(0), mCentrality(0) +{ + Init(system); +} + +//____________________________________________________________________________________________________ +// Default destructor +StCentralityMaker::~StCentralityMaker() +{ +} + +//____________________________________________________________________________________________________ +const StNegativeBinomial* StCentralityMaker::GetNegativeBinomial(const UInt_t id) const +{ + if( id >= mNBinomial.size() ){ + Error("StCentralityMaker::GetNegativeBinomial", "Invalid index for negative binomial, id=%3d", id); + assert(0); + } + + return mNBinomial[id] ; +} + +//____________________________________________________________________________________________________ +StCentrality* StCentralityMaker::GetCentrality(const UInt_t id) const +{ + if( id >= mCentrality.size() ){ + Error("StCentralityMaker::GetCentrality", "Invalid index for centrality, id=%3d", id); + assert(0); + } + + return mCentrality[id] ; +} + +//____________________________________________________________________________________________________ +// Use this function to initialize centrality bin and NBD +void StCentralityMaker::Init(const Char_t* system) +{ + /// Initialize centrality and NBD + const TString systemName(system); + + LOG_INFO << "StCentralityMaker::Init Initialization for " << systemName.Data() << endm; + + /// Initialize centrality and NBD parameters + const TString type[] = {"default", "low", "high"}; + for(UInt_t id=0; id<3; id++){ + mCentrality.push_back( new StCentrality(systemName, type[id]) ); + } + + /// Initialize NBD utility + // Use multiplicity depdent efficiency for all systems + for(UInt_t id=0; id<3; id++){ + Bool_t isConstEfficiency = kFALSE ; + + mNBinomial.push_back( + new StNegativeBinomial( mCentrality[id]->GetNpp(), mCentrality[id]->GetK(), mCentrality[id]->GetX(), + mCentrality[id]->GetEfficiency(), mCentrality[id]->GetTriggerBias(), isConstEfficiency) + ); + } +} + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StCentralityMaker/StCentralityMaker.h b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StCentralityMaker/StCentralityMaker.h new file mode 100644 index 00000000000..e1c5e55bddb --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StCentralityMaker/StCentralityMaker.h @@ -0,0 +1,75 @@ +/****************************************************************************** + * $Id: StCentralityMaker.h,v 1.4 2012/04/25 05:17:24 hmasui Exp $ + * $Log: StCentralityMaker.h,v $ + * Revision 1.4 2012/04/25 05:17:24 hmasui + * Remove SetModeNBD() and corresponding data member, merged into GetNegativeBinomial() function + * + * Revision 1.3 2010/11/20 19:01:32 hmasui + * Move mode flag for NBD to contrl npp and x from StFastGlauberMcMaker + * +******************************************************************************/ + +#ifndef __StCentralityMaker_h__ +#define __StCentralityMaker_h__ + +#include "Rtypes.h" +#include +class StCentrality ; +class StNegativeBinomial ; + +//____________________________________________________________________________________________________ +// Class StCentralityMaker: Centrality maker +// - Have 3 different NBD parameters: default, low (npp, x), high (npp, x) +// +// - Access centrality class (StCentrality) by +// StCentrality* GetCentrality(const UInt_t id) const +// where id = 0, 1, 2 +// id = 0: default centrality +// id = 1: low (npp, x) +// id = 2: high (npp, x) +// +// - Each centrality class (StCentrality) can provide 3 different centrality bins by +// StCentrality::GetCentrality(const UInt_t multiplicity, const UInt_t mode) const +// where mode = 0, 1 or 2 +// mode = 0: default centrality +// mode = 1: -5% total cross section +// mode = 2: +5% total cross section +// +class StCentralityMaker { + public: + StCentralityMaker(); /// Default constructor + StCentralityMaker(const Char_t* system); /// Call init(const Char_t* system) + virtual ~StCentralityMaker(); /// Default destructor + + // Get NBD + // Make sure the proper "mode" has been set by StCentralityMaker::SetModeNBD(const UInt_t mode) ; + // Default mode is 0 + // + // mode description + // 0 default Npp + // 1 Small Npp, large x + // 2 Large Npp, small x + const StNegativeBinomial* GetNegativeBinomial(const UInt_t id = 0) const ; + + // Initialization for specific systems (see details in source) + void Init(const Char_t* system = "AuAu_200GeV") ; + + // Get centrality, use StCentrality::GetCentrality(const UInt_t multiplicity) + // to access the centrality values from multiplicity + StCentrality* GetCentrality(const UInt_t id = 0) const ; + + private: + // Functions + + /// Initialization of NBD (default is TPC refmult) + void Init(const Double_t npp, const Double_t k, const Double_t x, + const Double_t efficiency=1.0, const Double_t triggerbias=1.0, const Bool_t useTpc=kTRUE) ; + + // Data members + std::vector mNBinomial ; /// Negative binomial utility + std::vector mCentrality ; /// Centrality utility + + ClassDef(StCentralityMaker, 0) +}; +#endif + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StCentralityMaker/StNbdFitMaker.cxx b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StCentralityMaker/StNbdFitMaker.cxx new file mode 100644 index 00000000000..758a1a5041d --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StCentralityMaker/StNbdFitMaker.cxx @@ -0,0 +1,502 @@ + +#include + +#include "TCanvas.h" +#include "TError.h" +#include "TFile.h" +#include "TGraph.h" +#include "TH2.h" +#include "TH3.h" +#include "TLine.h" +#include "TStyle.h" +#include "TMath.h" + +#include "StMessMgr.h" +#include "StNegativeBinomial.h" +#include "StNbdFitMaker.h" + +ClassImp(StNbdFitMaker) + + //____________________________________________________________________________________________________ + // Default constructor +StNbdFitMaker::StNbdFitMaker() +{ + mNBinomial = 0 ; + mhRefMult = 0 ; + mhRefMultSim = 0 ; + + mNData = 0 ; + + mMinimumMultiplicityCut = 100.0 ; // >50 by default. Can be changed by setMinimumMultiplicityCut(const Double_t) + + //mDoCentralityDetermination = kFALSE ; + mDoCentralityDetermination = kTRUE; + + mCanvas = 0 ; + mCutOff[0] = 0; + mCutOff[1] = 0; + mOneLine = 0 ; + mChi2Graph = 0; +} + +//____________________________________________________________________________________________________ +// Default destructor +StNbdFitMaker::~StNbdFitMaker() +{ + if(mNBinomial) delete mNBinomial ; + if(mCanvas) delete mCanvas ; + + for(Int_t i=0;i<2;i++) + { + if(mCutOff[i]) delete mCutOff[i] ; + } + if(mOneLine) delete mOneLine ; + + if(mChi2Graph) delete mChi2Graph ; +} + +//____________________________________________________________________________________________________ +void StNbdFitMaker::DoCentralityDetermination() +{ + LOG_INFO << "StNbdFitMaker::DoCentralityDetermination Centrality determination is ON" << endm; + mDoCentralityDetermination = kTRUE ; +} + +//____________________________________________________________________________________________________ +Double_t StNbdFitMaker::GetNormalization(const TH1& h1, const TH1& h2, const Double_t min, const Double_t max) const +{ + // Get normalization factor in (min, max) + Double_t numerator = 0.0; + Double_t denominator = 0.0; + const Int_t mulminbin = h1.GetXaxis()->FindBin(min); + const Int_t mulmaxbin = h1.GetXaxis()->FindBin(max); + + for(Int_t mul=mulminbin; mul(min), static_cast(max), norm) + << endm; + + return norm ; +} + +//____________________________________________________________________________________________________ +Double_t StNbdFitMaker::CalculateChi2(const TH1& hdata, const TH1& hfunc, const Double_t minimumMultiplicityCut) +{ + /// Calculate chi2 from data and func + mNData = 0 ; + + Double_t chi2 = 0.0 ; + for(Int_t ix=0; ix %5d: (npp, k) = (%1.5f, %1.5f) chi2/ndata = %1.3f/%5d = %1.3f", + static_cast(minimumMultiplicityCut), mNBinomial->GetNpp(), mNBinomial->GetK(), chi2, mNData, chi2/static_cast(mNData)) + << endm; + + return chi2 ; +} + +//____________________________________________________________________________________________________ +void StNbdFitMaker::CalculateCentrality(const TH1& hdata, const TH1& hmc) const +{ + // - Calculate centrality from the MC multiplicity distribution + // - Also calculate the re-weighting correction = MC/Data, important for peripheral (typically 60-80%) + // + // NOTE: Assume MC multiplicity has been normalized to the real data + + const UInt_t ncent = 16 ; // 0-80% (5% increment) + Int_t centBin[2][3][ncent]; // Final centrality bins + + for(UInt_t i=0; i<2; i++) { + // For cross check, do centrality determination + // 1) from peripheral to central + // 2) from central to peripheral + if ( i == 0 ) LOG_INFO << "StNbdFitMaker::CalculateCentrality (1) Centrality determination from peripheral to central" << endm; + if ( i == 1 ) LOG_INFO << "StNbdFitMaker::CalculateCentrality (2) Centrality determination from central to peripheral" << endm; + + // Centrality cut + Double_t centralityCut[ncent] ; + Double_t centralityMin[ncent] ; + Double_t centralityMax[ncent] ; + + for(UInt_t ic=0; ic fCentBinCut ; + + if( isCentOk && bin < ncent ){ + cout << Form("%2.2f - %2.2f (%%) : M > %4d (im=%3d, M=%1.1f, bin=%4d) (sum, total, fraction>cut) = (%1.3f, %1.3f, %1.3f>%1.3f)", + TMath::Abs(centralityMin[bin]*scale), TMath::Abs(centralityMax[bin]*scale), Mint, im, M, bin, sum, nevent, R, fCentBinCut) << endl; + + centBin[i][it][bin] = (Double_t)Mint ; + bin++; + } + }// multiplicity loop + }// different total cross section + }// from peripheral or central + + // Print centrality bins in the array format for implementation in StCentrality.cxx + // - Use central to peripheral + for(UInt_t ic=0; ic " << cut << endm; +} + +//____________________________________________________________________________________________________ +void StNbdFitMaker::ReadData(const Char_t* data, const Char_t* glauber, const Char_t* dataHistogramName) +{ + // Read real data file + TFile* inputData = TFile::Open(data); + if(!inputData || !inputData->IsOpen()){ + Error("StNbdFitMaker::readData", "can't open %s", data); + assert(0); + } + LOG_INFO << "StNbdFitMaker::readData open Data file: " << inputData->GetName() << endm; + + mhRefMult = 0; + // if( mNBinomial->useTpc() ){ + /// TPC refMult + mhRefMult = (TH1D*) inputData->Get(dataHistogramName); + // mhRefMult = (TH1D*) inputData->Get("hRefMultTpc"); + // mhRefMult = (TH1D*) inputData->Get("hRefMult"); + // } + // else{ + // /// FTPC refMult + // mhRefMult = (TH1D*) inputData->Get("hRefMultFTpc"); + // } + + if(!mhRefMult){ + Error("StNbdFitMaker::readData", "hRefMult doesn't exist"); + assert(mhRefMult); + } + + mhRefMult->SetLineColor(1); + + // Define simulated refmult + const Int_t nbinsx = mhRefMult->GetNbinsX() ; + const Double_t xmin = mhRefMult->GetXaxis()->GetXmin() ; + const Double_t xmax = mhRefMult->GetXaxis()->GetXmax() ; + mhRefMultSim = new TH1D("hRefMultSim", "", nbinsx, xmin, xmax); + mhRefMultSim->SetLineColor(2); + + // Sumw2 to calculate error properly + mhRefMult->Sumw2(); + mhRefMultSim->Sumw2(); + + // Read glauber file + TFile* inputGlauber = TFile::Open(glauber); + if(!inputGlauber || !inputGlauber->IsOpen()) + { + Error("StNbdFitMaker::readData", "can't open %s", glauber); + assert(0); + } + LOG_INFO << "StNbdFitMaker::readData open Glauber file: " << inputGlauber->GetName() << endm; + + mhNcoll_Npart = (TH2D*) inputGlauber->Get("hNcoll_Npart"); + if(!mhNcoll_Npart) + { + Error("StNbdFitMaker::readData", "hNcoll_Npart doesn't exist"); + assert(mhNcoll_Npart); + } +} + +//____________________________________________________________________________________________________ +//TGraph* StNbdFitMaker::Fit(const Int_t nevents, const Char_t* outputFileName)//old +TGraph* StNbdFitMaker::Fit(const Int_t nevents, TString outputFileName)//zaochen +{ + gStyle->SetOptStat(0); + + /// Fit real data by simulated multiplicity distribution + + /// Make sure the refmult and Ncoll_Npart histograms have benn opened + if(!mhRefMult) + { + Error("StNbdFitMaker::Fit", "hRefMult doesn't exist"); + assert(mhRefMult); + } + + if(!mhNcoll_Npart) + { + Error("StNbdFitMaker::Fit", "hNcoll_Npart doesn't exist"); + assert(mhNcoll_Npart); + } + + mhRefMultSim->Reset(); + + Int_t ievent = 0 ; + while( ievent < nevents ) + { + Double_t npart, ncoll; + mhNcoll_Npart->GetRandom2(npart, ncoll); + const Bool_t isNpartNcollOk = (npart>=2 && ncoll>=1) ; + if ( !isNpartNcollOk ) continue ; + + const Int_t multiplicity = mNBinomial->GetMultiplicity(npart, static_cast(ncoll)); + mhRefMultSim->Fill(multiplicity); + + if( ievent % (nevents/10) == 0 ) + { + LOG_INFO << Form("StNbdFitMaker::Fit ievent=%10d (npart, ncoll, mult) = (%10d, %10d, %10d)", + ievent, (Int_t)npart, (Int_t)ncoll, multiplicity) + << endm; + } + + ievent++; + } + + // Normalization + const Double_t norm = GetNormalization(*mhRefMult, *mhRefMultSim, mMinimumMultiplicityCut, mhRefMult->GetXaxis()->GetXmax()); + //const Double_t norm = GetNormalization(*mhRefMult, *mhRefMultSim, mMinimumMultiplicityCut, 400); + mhRefMultSim->Scale(norm); + + // Get chi2 + const Double_t chi2 = CalculateChi2(*mhRefMult, *mhRefMultSim, mMinimumMultiplicityCut); + + //---------------------------------------------------------------------------------------------------- + // Set chi2 + //---------------------------------------------------------------------------------------------------- + if(mChi2Graph) delete mChi2Graph ; + mChi2Graph = new TGraph(); + mChi2Graph->SetPoint(0, 0, chi2); + mChi2Graph->SetPoint(1, 1, mNData - 2); // 2 fitting parameters (npp, k) + mChi2Graph->SetPoint(2, 2, chi2/(mNData-2.0)); + + //---------------------------------------------------------------------------------------------------- + // Draw + //---------------------------------------------------------------------------------------------------- + mhRefMult->SetMinimum(0.1); + mhRefMult->SetMaximum(mhRefMult->GetMaximum()*10.0); + + mhRefMultSim->SetXTitle("Refmult (MC)"); + mhRefMultSim->SetYTitle("Count"); + mhRefMultSim->SetTitle(Form("npp=%1.2f, k=%1.2f, x=%1.2f", + mNBinomial->GetNpp(), mNBinomial->GetK(), mNBinomial->GetX())); + + if(mCanvas) delete mCanvas ; + mCanvas = new TCanvas("c1", "c1", 1200, 500); + mCanvas->Divide(2, 1); + mCanvas->cd(1); + mCanvas->GetPad(1)->SetLogy(1); + + mhRefMult->Draw("h"); + mhRefMultSim->Draw("hsame"); + + // Normalization line + if(mCutOff[0]) delete mCutOff[0] ; + mCutOff[0] = new TLine( mMinimumMultiplicityCut, mhRefMult->GetMinimum(), mMinimumMultiplicityCut, mhRefMult->GetMaximum()); + mCutOff[0]->SetLineColor(4); + mCutOff[0]->SetLineStyle(2); + mCutOff[0]->Draw(); + + // Draw ratio of MC to data + mCanvas->cd(2); + TH1* hRatio = (TH1D*) mhRefMultSim->Clone(); + hRatio->SetName("hRatio"); + hRatio->Divide(mhRefMult); + hRatio->SetYTitle("MC/data"); + + hRatio->SetMinimum(0); + hRatio->SetMaximum(2); + hRatio->Draw(); + + if(mOneLine) delete mOneLine ; + mOneLine = new TLine(hRatio->GetXaxis()->GetXmin(), 1.0, hRatio->GetXaxis()->GetXmax(), 1.0); + mOneLine->SetLineColor(4); + mOneLine->SetLineStyle(2); + mOneLine->Draw(); + + if(mCutOff[1]) delete mCutOff[1] ; + mCutOff[1] = new TLine( mMinimumMultiplicityCut, hRatio->GetMinimum(), mMinimumMultiplicityCut, hRatio->GetMaximum()); + mCutOff[1]->SetLineColor(4); + mCutOff[1]->SetLineStyle(2); + mCutOff[1]->Draw(); + + mCanvas->cd(); + mCanvas->Update(); + + //---------------------------------------------------------------------------------------------------- + // Centrality + //---------------------------------------------------------------------------------------------------- + if ( mDoCentralityDetermination ) + { + CalculateCentrality(*mhRefMult, *mhRefMultSim) ; + } + + //---------------------------------------------------------------------------------------------------- + // Write only if outputFileName is given + //---------------------------------------------------------------------------------------------------- + //const TString fileName(outputFileName);//zaochen + //if(!fileName.IsWhitespace())//zaochen + if(!outputFileName.IsWhitespace())//zaochen + { + LOG_INFO << "StNbdFitMaker::Fit Write output ROOT file : " << outputFileName << endm; + TFile* output = TFile::Open(outputFileName, "recreate"); + mhRefMult->Write(); + mhRefMultSim->Write(); + hRatio->Write(); + output->Close(); + } + + return mChi2Graph; +} + +//____________________________________________________________________________________________________ +Int_t StNbdFitMaker::Scan(const Int_t nevents, + const Int_t nppbin, const Double_t nppmin, const Double_t nppmax, + const Int_t kbin, const Double_t kmin, const Double_t kmax, + const Int_t xbin, const Double_t xmin, const Double_t xmax, + //const Double_t x, + //const Int_t effbin, const Double_t effmin, const Double_t effmax, + const Double_t efficiency, + const Double_t triggerbias, const Bool_t isConstEfficiency + ){ + /// Loop over all (npp, k, x) to find out minimum chi2 + TH3* hChi2 = new TH3D("hChi2", "#chi^{2}/NDF in (npp, k, x) space", + nppbin, nppmin, nppmax, kbin, kmin, kmax, xbin, xmin, xmax); + hChi2->SetXTitle("n_{pp}"); + hChi2->SetYTitle("k"); + hChi2->SetZTitle("x"); + + const Double_t nppstep = (nppbin==1) ? 0 : (nppmax-nppmin)/static_cast(nppbin-1) ; + const Double_t kstep = (kbin==1) ? 0 : (kmax-kmin)/static_cast(kbin-1) ; + const Double_t xstep = (xbin==1) ? 0 : (xmax-xmin)/static_cast(xbin-1) ; + + for(Int_t ix=0; ixSetBinContent(ix+1, iy+1, iz+1, mChi2Graph->GetY()[2]); + + LOG_INFO << Form("StNbdFitMaker::Scan Fitting for (npp, k, x, d, chi2/ndf) = (%1.3f, %1.3f, %1.3f, %1.3f, %1.3f/%3d=%1.3f) ...", + npp, k, x, efficiency, mChi2Graph->GetY()[0], (Int_t)mChi2Graph->GetY()[1], mChi2Graph->GetY()[2]) + << endm; + }// x loop + }// k loop + }// npp loop + + //---------------------------------------------------------------------------------------------------- + // Write chi2 graph + // Filename is determined by the range of npp, k and x + //---------------------------------------------------------------------------------------------------- + //const Char_t* fileName(Form("chi2_nevents%d_npp%1.3f-%1.3f_k%1.3f-%1.3f_x%1.3f_%1.3f_eff%1.3f.root", + const Char_t* fileName(Form("RatioChi2Files/chi2_nevents%d_npp%1.3f-%1.3f_k%1.3f-%1.3f_x%1.3f_%1.3f_eff%1.3f.root", + nevents, nppmin, nppmax, kmin, kmax, xmin, xmax, efficiency)); + TFile* outputFile = TFile::Open(fileName, "recreate"); + hChi2->Write(); + outputFile->Close(); + + return 1; +} + + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StCentralityMaker/StNbdFitMaker.h b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StCentralityMaker/StNbdFitMaker.h new file mode 100644 index 00000000000..e01a4676bab --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StCentralityMaker/StNbdFitMaker.h @@ -0,0 +1,86 @@ +/****************************************************************************** + * $Id: StNbdFitMaker.h,v 1.2 2012/04/25 05:15:30 hmasui Exp $ + * $Log: StNbdFitMaker.h,v $ + * Revision 1.2 2012/04/25 05:15:30 hmasui + * Added centrality calculation. Real data histogram name can be now specified in ReadData() function + * + ******************************************************************************/ + +#ifndef __StNbdFitMaker_h__ +#define __StNbdFitMaker_h__ + +class TCanvas ; +class TGraph ; +class TH1 ; +class TH2 ; +class TLine ; +class StNegativeBinomial ; + +//____________________________________________________________________________________________________ +// Class StNbdFitMaker: Determine the NBD parameters from the data +class StNbdFitMaker { + public: + StNbdFitMaker(); + virtual ~StNbdFitMaker(); /// Default destructor + + /// Switch on centrality calculation (default is OFF) + void DoCentralityDetermination() ; + + /// Read real data and glauber ROOT files + void ReadData(const Char_t* data, const Char_t* glauber, + const Char_t* dataHistogramName = "hRefMultTpc") ; + + /// Draw multiplicity distribution sampled by nevents (default is 1000 events) + /// Do not write output ROOT file if outputFileName is blank + /// Return TGraph, contains + /// [0] = chi2 + /// [1] = NDF + /// [2] = chi2/NDF + //TGraph* Fit(const Int_t nevents = 1000, const Char_t* outputFileName = "");//zaochen comment + TGraph* Fit(const Int_t nevents = 1000, const TString outputFileName = ""); + + /// Find minimum chi2/NDF in (npp, k, efficiency) space + Int_t Scan(const Int_t nevents, + const Int_t nppbin, const Double_t nppmin, const Double_t nppmax, + const Int_t kbin, const Double_t kmin, const Double_t kmax, + const Int_t xbin, const Double_t xmin, const Double_t xmax, + // const Double_t x, + const Double_t efficiency=1.0, + // const Int_t effbin, const Double_t effmin, const Double_t effmax, + const Double_t triggerbias=1.0, const Bool_t isConstEfficiency=kTRUE + ); + + /// Set parameters + void SetParameters(const Double_t npp, const Double_t k, const Double_t x, + const Double_t efficiency, const Double_t triggerbias, const Bool_t isConstEfficiency) ; + + /// Set minimum multiplicity cuts to avoid inefficiency (default is M>50) + void SetMinimumMultiplicityCut(const Double_t cut) ; + + private: + // Functions + Double_t GetNormalization(const TH1& h1, const TH1& h2, + const Double_t min, const Double_t max) const ; // Get normalization factor in (min, max) + Double_t CalculateChi2(const TH1& hdata, const TH1& hfunc, + const Double_t minimumMultiplicityCut) ; // Get chi2 from data and func + + void CalculateCentrality(const TH1& hdata, const TH1& hmc) const ; + + // Data members + StNegativeBinomial* mNBinomial ; /// Negative binomial distribution + TH1* mhRefMult ; /// Reference multiplicity + TH1* mhRefMultSim ; /// Simulated refmult + TH2* mhNcoll_Npart ; /// Ncoll vs Npart histograms for fit + Int_t mNData ; /// Number of data points used in fit + Double_t mMinimumMultiplicityCut ; /// Minimum multiplicity cut for fitting + Bool_t mDoCentralityDetermination ; /// Centrality determination flag (default is false) + + TCanvas* mCanvas ; /// Canvas to draw multiplicity + TLine* mCutOff[2] ; /// Multiplicity cut off + TLine* mOneLine ; /// Line at 1 + TGraph* mChi2Graph ; /// Container of chi2 and NDF + + ClassDef(StNbdFitMaker, 0) +}; +#endif + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StCentralityMaker/StNegativeBinomial.cxx b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StCentralityMaker/StNegativeBinomial.cxx new file mode 100644 index 00000000000..e966171cf8d --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StCentralityMaker/StNegativeBinomial.cxx @@ -0,0 +1,209 @@ +/****************************************************************************** + * $Id: StNegativeBinomial.cxx,v 1.2 2012/04/25 05:13:24 hmasui Exp $ + * $Log: StNegativeBinomial.cxx,v $ + * Revision 1.2 2012/04/25 05:13:24 hmasui + * Use STAR logger. Take into account additional constant inefficiency by using the trigger bias parameter + * +******************************************************************************/ + +#include + +#include "TH1.h" +#include "TMath.h" +#include "TString.h" + +#include "StMessMgr.h" + +#include "StGlauberUtilities/StGlauberUtilities.h" +#include "StNegativeBinomial.h" + +ClassImp(StNegativeBinomial) + + UInt_t StNegativeBinomial::mCounter = 0 ; + +//____________________________________________________________________________________________________ +StNegativeBinomial::StNegativeBinomial(const Double_t npp, const Double_t k, const Double_t x, + const Double_t efficiency, const Double_t triggerbias, const Bool_t isConstEfficiency) + : mEfficiency(efficiency), mTriggerBias(triggerbias), mNpp(npp), mK(k), mX(x), mIsConstEfficiency(isConstEfficiency) +{ + LOG_INFO << Form("StNegativeBinomial (npp, k, x, eff, trig. bias) = (%1.3f, %1.3f, %1.3f, %1.3f, %1.3f)", + mNpp, mK, mX, mEfficiency, mTriggerBias) + << endm; + + if(mIsConstEfficiency){ + LOG_INFO << "StNegativeBinomial Use constant efficiency" << endm; + } + else{ + LOG_INFO << "StNegativeBinomial Use multiplicity dependent efficiency" << endm; + } + + /// Initialize histogram + mhNbd = 0 ; + InitHistogram() ; +} + +//____________________________________________________________________________________________________ +StNegativeBinomial::~StNegativeBinomial() +{ + delete mhNbd ; +} + +//____________________________________________________________________________________________________ +void StNegativeBinomial::InitHistogram() +{ + const Int_t nbin = 100 ; + + if( mhNbd ){ + // Reset current stuffs + mhNbd->Reset(); + } + else{ + mhNbd = new TH1D(Form("mhNbd_%d", mCounter++), "", nbin, 0, nbin); + } + + for(Int_t i=0;iSetBinContent(i+1, GetNegativeBinomial(i)); + } +} + +//____________________________________________________________________________________________________ +void StNegativeBinomial::SetParameters(const Double_t npp, const Double_t k, const Double_t x) +{ + mNpp = npp ; + mK = k ; + + if( x > 0.0 ){ + mX = x ; + } + + /// Initialize histogram + InitHistogram() ; +} + +//____________________________________________________________________________________________________ +Double_t StNegativeBinomial::GetTwoComponentMultiplicity(const Double_t npart, const Double_t ncoll) const +{ + /// Remind 0.5. Need 2*npart in d+Au FTPC + + return (mX==0.0) ? npart : 0.5*(1.0-mX)*npart + mX*ncoll ; +} + +//____________________________________________________________________________________________________ +Int_t StNegativeBinomial::GetMultiplicity(const Double_t npart, const Double_t ncoll) const +{ + /// Get multiplicity from negative binomial distribution + // Take into account trigger efficiency, multiplicity efficiency + + const Double_t nchPP = GetTwoComponentMultiplicity(npart, ncoll) ; + const Double_t nchSampled = nchPP ; + + // Sample multiplicity (including trigger bias) + const Int_t nchInt = TMath::Nint(nchSampled); + Int_t multIdeal = 0; + for(Int_t ich=0; ichGetRandom(); + } + + // Multiplicity dependent efficiency for TPC + const Double_t efficiency = (mIsConstEfficiency) ? mEfficiency : GetEfficiency(multIdeal) ; + //cout<GetUniform2() <= efficiency ){ + mult++; + } + } + + if ( mTriggerBias == 1.0 ) return mult ; + + const Int_t nmult = mult ; + mult = 0 ; + for(Int_t im=0; imGetUniform() <= mTriggerBias ){ + mult++; + } + } + + return mult ; +} + +//____________________________________________________________________________________________________ +TH1* StNegativeBinomial::GetMultiplicity(const Double_t npart, const Double_t ncoll, + const Double_t weight) const +{ + // Do not forget to delete histogram + const Double_t nchPP = GetTwoComponentMultiplicity(npart, ncoll) ; + const Int_t nch = TMath::Nint(nchPP * mTriggerBias) ; // with trigger bias + + // Multiplicity dependent efficiency for TPC +// const Double_t efficiency = (mUseTpc) ? GetEfficiency(nch) : mEfficiency ; +// const Double_t efficiency = mEfficiency ; + const Double_t efficiency = (mIsConstEfficiency) ? mEfficiency : GetEfficiency(nch) ; + const Int_t nchSampled = TMath::Nint(nch * efficiency) ; + + const Int_t nbin = 1000 ; + TH1* h = new TH1D("hmultTmp", "", nbin, 0, static_cast(nbin)); + + for(Int_t ix=0; ix0.0 && probabilityFill(ix+0.5, probability*weight); + } + } + + return h ; +} + +//____________________________________________________________________________________________________ +Double_t StNegativeBinomial::GetNegativeBinomial(const Int_t n) const +{ + const Double_t Const = TMath::Exp( TMath::LnGamma(n+mK) - TMath::LnGamma(n+1) - TMath::LnGamma(mK) ); + const Double_t term = n * TMath::Log(mNpp/mK) - (n+mK) * TMath::Log(mNpp/mK+1.0) ; + + return Const * TMath::Exp(term); +} + +//____________________________________________________________________________________________________ +Double_t StNegativeBinomial::GetNegativeBinomial(const Int_t n, const Double_t m) const +{ + // npp and k are scaled by m + + const Double_t Const = TMath::Exp( TMath::LnGamma(n+mK*m) - TMath::LnGamma(n+1) - TMath::LnGamma(mK*m) ); + const Double_t term = n * TMath::Log(mNpp/mK) - (n+mK*m) * TMath::Log(mNpp/mK+1.0) ; + + return Const * TMath::Exp(term); +} + +//______________________________________________________________________________________________________ +Double_t StNegativeBinomial::GetEfficiency(const Int_t mult) const +{ + /// Check flag + if( mIsConstEfficiency ){ + Error("StNegativeBinomial::GetEfficiency", "Something is wrong, supposed to be constant efficiency. abort"); + assert(0) ; + } + + /// TPC efficiency, http://www.star.bnl.gov/protected/strange/atimmins/Glauber/page.html + if ( mult < 0 ) return mEfficiency ; + + // Multiplicity dependent efficiency correction (valid only for main TPC refmult) + + // const Double_t eff0 = 1.05 ; // 98 % efficiency at p+p + const Double_t eff0 = 0.98 ; // 98 % efficiency at p+p +// const Double_t d = 0.14 ; // 14 % drop at most central Au + Au + const Double_t d = mEfficiency ; + + return eff0 * (1.0 - mult * d/540.0) ; + //return eff0 * d * (1.0 - mult * 0.14/560.0) ; +} + +//______________________________________________________________________________________________________ +void StNegativeBinomial::DrawNbd() const +{ + if(mhNbd) mhNbd->Draw() ; +} + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StCentralityMaker/StNegativeBinomial.h b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StCentralityMaker/StNegativeBinomial.h new file mode 100644 index 00000000000..0841fb2e165 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StCentralityMaker/StNegativeBinomial.h @@ -0,0 +1,82 @@ +/****************************************************************************** + * $Id: StNegativeBinomial.h,v 1.2 2012/04/25 05:13:24 hmasui Exp $ + * $Log: StNegativeBinomial.h,v $ + * Revision 1.2 2012/04/25 05:13:24 hmasui + * Use STAR logger. Take into account additional constant inefficiency by using the trigger bias parameter + * +******************************************************************************/ + +#ifndef __StNegativeBinomial_h__ +#define __StNegativeBinomial_h__ + +class TH1 ; +#include "Rtypes.h" + +//____________________________________________________________________________________________________ +// StNegativeBinomial class: Generate negative binomial distribution +class StNegativeBinomial { + public: + /// Default constructor + // npp: mean multiplicity in p+p + // k: 1/k deviation from poisson (1/k -> 0 poisson) + // x: fraction of hard component + // efficiency: detector efficiency + // triggerbias: trigger bias + // IsConstEfficiency: true-> constant efficiencty, false-> multiplicity dependent efficiency + StNegativeBinomial(const Double_t npp = 2.38, const Double_t k = 2.00, const Double_t x = 0.13, + const Double_t efficiency = 1.0, const Double_t triggerbias = 1.0, const Bool_t isConstEfficiency=kTRUE); + + /// Default destructor + virtual ~StNegativeBinomial(); + + /// (1-x)*npart/2 + x*ncoll + Double_t GetTwoComponentMultiplicity(const Double_t npart, const Double_t ncoll) const ; + + /// Get multiplcity by convoluting NBD + Int_t GetMultiplicity(const Double_t npart, const Double_t ncoll) const ; + + /// Get multiplicity by scaled NBD, with npp*mult and k*mult + TH1* GetMultiplicity(const Double_t npart, const Double_t ncoll, + const Double_t weight) const ; + + Double_t GetNegativeBinomial(const Int_t n) const ; /// Get NBD(npp, k; n) + Double_t GetNegativeBinomial(const Int_t n, const Double_t m) const ; /// Get NBD(npp*m, k*m; n) + + /// Set (npp, k, x) + void SetParameters(const Double_t npp, const Double_t k, const Double_t x = -1.0) ; + + // Getter + Double_t GetNpp() const ; /// Get npp parameter + Double_t GetK() const ; /// Get k parameter + Double_t GetX() const ; /// Get x parameter + Double_t GetEfficiency() const ; /// Get mEfficiency (CAUTION: value has different meaning between constant and multiplicity dep. modes) + Bool_t IsConstEfficiency() const ; /// Get flag for efficiency + void DrawNbd() const ; /// Draw nbd distribution + + private: + // Functions + Double_t GetEfficiency(const Int_t mult) const ; + void InitHistogram() ; /// Initialize histogram (mhNbd) + + // Data members + const Double_t mEfficiency ; /// Efficiency + const Double_t mTriggerBias ; /// Trigger bias + Double_t mNpp ; /// Mean multiplicity in p+p + Double_t mK ; /// 1/k deviation from poisson + Double_t mX ; /// Fraction of hard component + const Bool_t mIsConstEfficiency ; /// Flag for efficiency + static UInt_t mCounter ; /// Unique histogram id for StNegativeBinomial + + TH1* mhNbd ; /// Histogram to store negative binomial distribution + + ClassDef(StNegativeBinomial, 0) +}; + +inline Double_t StNegativeBinomial::GetNpp() const { return mNpp ; } +inline Double_t StNegativeBinomial::GetK() const { return mK ; } +inline Double_t StNegativeBinomial::GetX() const { return mX ; } +inline Double_t StNegativeBinomial::GetEfficiency() const { return mEfficiency ; } +inline Bool_t StNegativeBinomial::IsConstEfficiency() const { return mIsConstEfficiency ; } + +#endif + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StFastGlauberMcMaker/Nucleon.cxx b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StFastGlauberMcMaker/Nucleon.cxx new file mode 100644 index 00000000000..0f3cc2608a6 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StFastGlauberMcMaker/Nucleon.cxx @@ -0,0 +1,140 @@ + +#include +#include "Nucleon.h" + +ClassImp(Nucleon) + +//____________________________________________________________________________________________________ +// Default constructor +Nucleon::Nucleon() +{ + Reset() ; +} + +//____________________________________________________________________________________________________ +// Default destructor +Nucleon::~Nucleon() +{ +} + +//____________________________________________________________________________________________________ +void Nucleon::Reset() +{ + mPosition.SetMagThetaPhi(-9999., -9999., -9999.); + mNpart = 0; + mNcoll = 0; + mMultiplicity = 0.0; +} + +//____________________________________________________________________________________________________ +void Nucleon::Set(const Double_t r, const Double_t theta, const Double_t phi, + const Double_t impactParameter, const Double_t Theta, const Double_t Phi, + const Bool_t isThetaFirst) +{ + /// Initial position of nucleon without rotation + mPosition.SetMagThetaPhi(r, theta, phi); + + /// Rotate angles if Theta and Phi are non-zero + if( Theta != 0.0 && Phi != 0.0 ){ + if(isThetaFirst){ + /// Rotate Theta, then Phi + mPosition.RotateY(Theta); + mPosition.RotateZ(Phi); + } + else{ + /// Rotate Phi, then Theta + mPosition.RotateZ(Phi); + mPosition.RotateY(Theta); + } + } + + mPosition.SetX( mPosition.X() + impactParameter ); + mNpart = 0; + mNcoll = 0; + mMultiplicity = 0.0; +} + + +//____________________________________________________________________________________________________ +Double_t Nucleon::GetX() const +{ + return mPosition.X() ; +} + +//____________________________________________________________________________________________________ +Double_t Nucleon::GetY() const +{ + return mPosition.Y() ; +} + +//____________________________________________________________________________________________________ +Double_t Nucleon::GetZ() const +{ + return mPosition.Z() ; +} + +//____________________________________________________________________________________________________ +Double_t Nucleon::GetPhi() const +{ + return mPosition.Phi() ; +} + +//____________________________________________________________________________________________________ +Double_t Nucleon::GetR() const +{ + return mPosition.Mag() ; +} + +//____________________________________________________________________________________________________ +Double_t Nucleon::GetXYZ(const Char_t* name) const +{ + /// Get each x/y/z position, or product of them + /// Input argument 'name' is case insensitive + const TString type(name); + + if( type.CompareTo("x", TString::kIgnoreCase) == 0 ) return GetX() ; + else if( type.CompareTo("y", TString::kIgnoreCase) == 0 ) return GetY() ; + else if( type.CompareTo("z", TString::kIgnoreCase) == 0 ) return GetZ() ; + else if( type.CompareTo("xx", TString::kIgnoreCase) == 0 ) return GetX() * GetX() ; + else if( type.CompareTo("yy", TString::kIgnoreCase) == 0 ) return GetY() * GetY() ; + else if( type.CompareTo("xy", TString::kIgnoreCase) == 0 ) return GetX() * GetY() ; + else if( type.CompareTo("xxx", TString::kIgnoreCase) == 0 ) return GetX() * GetX() * GetX() ; + else if( type.CompareTo("yyy", TString::kIgnoreCase) == 0 ) return GetY() * GetY() * GetY() ; + else if( type.CompareTo("xxy", TString::kIgnoreCase) == 0 ) return GetX() * GetX() * GetY() ; + else if( type.CompareTo("xyy", TString::kIgnoreCase) == 0 ) return GetX() * GetY() * GetY() ; + else{ + Error("IcGenerator::GetXYZ", "Invalid name for sum, name=%s", name); + assert(0); + } + + // Never happen + Error("Nucleon::GetXYZ", "Something is wrong"); + assert(0); +} + + +//____________________________________________________________________________________________________ +const TVector3& Nucleon::GetVector() const +{ + return mPosition ; +} + +//____________________________________________________________________________________________________ +Double_t Nucleon::GetWeight(const UInt_t weightId) const +{ + /// Get multiplicity weight, npart, ncoll or multiplicity + + switch ( weightId ) { + case 0: return 1.0 ; // Npart weight + case 1: return GetNcoll() ; // Ncoll weight + case 2: return GetMultiplicity() ; // Multiplicity weight + default: + Warning("Nucleon::GetWeight", "Invalid weightId, id=%3d. Return unit weight", weightId); + return 1.0; + } + + // Never happen + Error("Nucleon::GetWeight", "Something is wrong"); + assert(0); +} + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StFastGlauberMcMaker/Nucleon.h b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StFastGlauberMcMaker/Nucleon.h new file mode 100644 index 00000000000..87fcc319e82 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StFastGlauberMcMaker/Nucleon.h @@ -0,0 +1,59 @@ + +#ifndef __Nucleon_h__ +#define __Nucleon_h__ + +#include "TVector3.h" + +//____________________________________________________________________________________________________ +// Class Nucleon: Nucleon class +class Nucleon { + public: + /// Default constructor + /// (r, theta, phi) are the spherical coordinates of nucleon + /// (Theta, Phi) are the orientation of nuclei, used to rotate nucleons with respect to those angles + /// Rotation will be done by 1) Theta, and then 2) Phi by default + /// if isThetaFirst = kFALSE, rotate Phi first, then Theta. + Nucleon() ; + virtual ~Nucleon(); /// Default destructor + + void Reset() ; /// Reset all data members + void Set(const Double_t r, const Double_t theta, const Double_t phi, + const Double_t impactParameter, const Double_t Theta, const Double_t Phi, + const Bool_t isThetaFirst = kTRUE) ; + + Double_t GetX() const ; /// Get x position + Double_t GetY() const ; /// Get y position + Double_t GetZ() const ; /// Get z position + Double_t GetXYZ(const Char_t* name="X") const ; /// Get x/y/z or their product (see source) + Double_t GetPhi() const ; /// Get azimuthal angle of nucleon + Double_t GetR() const ; /// Get radius + + UInt_t GetNpart() const ; /// Get Npart(x,y) + UInt_t GetNcoll() const ; /// Get Ncoll(x,y) + Double_t GetMultiplicity() const ; /// Get Multiplicity(x,y) + Double_t GetWeight(const UInt_t weightId=0) const ; /// Get weight factor to calculate average quantities + + void IncrementNpart() ; /// Increment Npart(x,y) + void IncrementNcoll() ; /// Increment Ncoll(x,y) + void SetMultiplicity(const Double_t val) ; /// Set multiplicity + + const TVector3& GetVector() const ; /// Get (x,y,z) vector + + private: + TVector3 mPosition ; /// (x,y,z) position of nucleon + UInt_t mNpart ; /// Npart(x,y) + UInt_t mNcoll ; /// Ncoll(x,y) + Double_t mMultiplicity ; /// Multiplicity(x,y) + + ClassDef(Nucleon, 1) +}; + +inline void Nucleon::IncrementNpart() { mNpart++ ; } +inline void Nucleon::IncrementNcoll() { mNcoll++ ; } +inline UInt_t Nucleon::GetNpart() const { return mNpart ; } +inline UInt_t Nucleon::GetNcoll() const { return mNcoll ; } +inline Double_t Nucleon::GetMultiplicity() const { return mMultiplicity ; } +inline void Nucleon::SetMultiplicity(const Double_t val) { mMultiplicity = val ; } + +#endif + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StFastGlauberMcMaker/StFastGlauberMcMaker.cxx b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StFastGlauberMcMaker/StFastGlauberMcMaker.cxx new file mode 100644 index 00000000000..ed3203443e8 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StFastGlauberMcMaker/StFastGlauberMcMaker.cxx @@ -0,0 +1,1512 @@ +/****************************************************************************** + * $Id: StFastGlauberMcMaker.cxx,v 1.6 2014/10/21 01:03:38 hmasui Exp $ + * $Log: StFastGlauberMcMaker.cxx,v $ + * Revision 1.6 2014/10/21 01:03:38 hmasui + * Add 14.5 GeV cross section + * + * Revision 1.5 2013/02/06 18:58:20 hmasui + * Added 2.76 TeV cross section + * + * Revision 1.4 2013/02/05 22:49:50 hmasui + * Added Pb and Cu nuclei + * + * Revision 1.3 2012/04/25 05:22:42 hmasui + * Added deformation parameters, higher order participant eccentricity with r^2 weight + * + * Revision 1.2 2010/11/20 19:03:11 hmasui + * Mode mode flag to StCentralityMaker. Use STAR logger rather than STD iostream + * + ******************************************************************************/ + +#include + +#include "TF1.h" +#include "TF3.h" +#include "TH1.h" +#include "TGraph.h" +#include "TMath.h" +#include "TVector3.h" + +#include "StMessMgr.h" + +#include "StMessMgr.h" +#include "Nucleon.h" +#include "StCentralityMaker/StCentralityMaker.h" +#include "StCentralityMaker/StNegativeBinomial.h" +#include "StGlauberTree/StGlauberTree.h" +#include "StGlauberUtilities/StGlauberUtilities.h" +#include "StFastGlauberMcMaker.h" + +using std::vector ; + +ClassImp(StFastGlauberMcMaker) + + const UInt_t StFastGlauberMcMaker::mVersion = 2 ; /// Current version + + //____________________________________________________________________________________________________ + // Default constructor +StFastGlauberMcMaker::StFastGlauberMcMaker() + : mEnergy(200), mOutputFileName("fastglaubermc.root"), + mInelasticNNCrossSection(4.2) // fm^2 --> 42 mb +{ + /// Initialize Au+Au collisions at 200 GeV + const UInt_t A = 197 ; + const Double_t R = 6.38 ; + const Double_t d = 0.535 ; + + mMode = 0 ; + mIsDeformed[0] = kFALSE ; + mIsDeformed[1] = kFALSE ; + + Init(A, R, d, 0.0, 0.0, A, R, d, 0.0, 0.0); +} + +//____________________________________________________________________________________________________ +StFastGlauberMcMaker::StFastGlauberMcMaker( + const TString outputFileName, + const TString system, + const Double_t energy, + const TString type, + const Bool_t isDeformed + ) +: mEnergy(energy), mOutputFileName(outputFileName), + mInelasticNNCrossSection(GetInelasticNNCrossSection(mEnergy, type)) +{ + // Set deformation. Spherical + Spherical or Deformed + Deformed collision + // Use other constructor if Spherical + Deformed collision is needed + mIsDeformed[0] = isDeformed ; + mIsDeformed[1] = isDeformed ; + + // Initialize nuclei + if ( system.CompareTo("auau", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker Initialize AuAu collisions" << endm; + InitAuAu(type); + } + else if ( system.CompareTo("smsm", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker Initialize SmSm collisions" << endm; + InitSmSm(type); + } + else if ( system.CompareTo("uu", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker Initialize UU collisions" << endm; + InitUU(type); + } + else if ( system.CompareTo("pbpb", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker Initialize PbPb collisions" << endm; + InitPbPb(type); + } + else if ( system.CompareTo("cucu", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker Initialize CuCu collisions" << endm; + InitCuCu(type); + } + else if ( system.CompareTo("zrzr_case1", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker Initialize ZrZr_Case1 collisions" << endm; + InitZrZr(type,1); + } + else if ( system.CompareTo("ruru_case1", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker Initialize RuRu_Case1 collisions" << endm; + InitRuRu(type,1); + } + else if ( system.CompareTo("zrzr_case2", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker Initialize ZrZr_Case2 collisions" << endm; + InitZrZr(type,2); + } + else if ( system.CompareTo("ruru_case2", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker Initialize RuRu_Case2 collisions" << endm; + InitRuRu(type,2); + } + else if ( system.CompareTo("zrzr_case3", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker Initialize ZrZr_Case3 collisions" << endm; + InitZrZr(type,3); + } + else if ( system.CompareTo("ruru_case3", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker Initialize RuRu_Case3 collisions" << endm; + InitRuRu(type,3); + } + else{ + Error("StFastGlauberMcMaker", "Unknown system %s. abort", system.Data()); + assert(0); + } +} + +//____________________________________________________________________________________________________ +StFastGlauberMcMaker::StFastGlauberMcMaker( + const TString outputFileName, // Output filename + const UInt_t massNumber, // Mass number of nucleus + const Double_t radius, // Radius of nucleus + const Double_t skinDepth, // Skin depth of nucleus + const Double_t beta2, // 2nd order deformation parameter + const Double_t beta4, // 4th order deformation parameter + const Double_t inelasticCrossSection, // Inelastic NN cross section + const Double_t energy // sqrt(sNN) + ) +: mEnergy(energy), mOutputFileName(outputFileName), + mInelasticNNCrossSection(inelasticCrossSection) +{ + mMode = 0 ; + + // Set deformation + mIsDeformed[0] = kFALSE ; + mIsDeformed[1] = kFALSE ; + if(beta2 != 0.0 || beta4 != 0.0 ){ + mIsDeformed[0] = kTRUE ; + mIsDeformed[1] = kTRUE ; + } + + /// Initialize symmetric collisions + Init(massNumber, radius, skinDepth, beta2, beta4, massNumber, radius, skinDepth, beta2, beta4) ; +} + +//____________________________________________________________________________________________________ +StFastGlauberMcMaker::StFastGlauberMcMaker( + const TString outputFileName, // Output filename + const UInt_t massNumberA, // Mass number of nucleus for nucleus A + const Double_t radiusA, // Radius of nucleus for nucleus A + const Double_t skinDepthA, // Skin depth of nucleus for nucleus A + const Double_t beta2A, // 2nd order deformation parameter for nucleus A + const Double_t beta4A, // 4th order deformation parameter for nucleus A + const UInt_t massNumberB, // Mass number of nucleus for nucleus B + const Double_t radiusB, // Radius of nucleus for nucleus B + const Double_t skinDepthB, // Skin depth of nucleus for nucleus B + const Double_t beta2B, // 2nd order deformation parameter for nucleus B + const Double_t beta4B, // 4th order deformation parameter for nucleus B + const Double_t inelasticCrossSection, // Inelastic NN cross section + const Double_t energy // sqrt(sNN) + ) +: mEnergy(energy), mOutputFileName(outputFileName), + mInelasticNNCrossSection(inelasticCrossSection) +{ + mMode = 0 ; + + // Set deformation + mIsDeformed[0] = kFALSE ; + mIsDeformed[1] = kFALSE ; + if( beta2A != 0.0 || beta4A != 0.0 ) mIsDeformed[0] = kTRUE ; + if( beta2B != 0.0 || beta4B != 0.0 ) mIsDeformed[1] = kTRUE ; + + /// Initialize asymmetric collisions + Init(massNumberA, radiusA, skinDepthA, beta2A, beta4A, massNumberB, radiusB, skinDepthB, beta2B, beta4B) ; +} + +//____________________________________________________________________________________________________ +// Default destructor +StFastGlauberMcMaker::~StFastGlauberMcMaker() +{ +} + +//____________________________________________________________________________________________________ +void StFastGlauberMcMaker::SetRepulsionDistance(const Double_t repulsionDistance) +{ + mRepulsionDistance = repulsionDistance ; + LOG_INFO << "StFastGlauberMcMaker::SetRepulsionDistance Set repulsion distance between two nucleons, d = " + << mRepulsionDistance << " fm" + << endm; +} + +//____________________________________________________________________________________________________ +Int_t StFastGlauberMcMaker::Clear() +{ + mGlauberTree->Clear() ; + + for(UInt_t in=0;in<2;in++){ + for(UInt_t i=0;iReset() ; + } + } + + return 1 ; +} + +//____________________________________________________________________________________________________ +Int_t StFastGlauberMcMaker::InitTree() +{ + // Initialize Glauber tree in write mode + mGlauberTree = new StGlauberTree(1); + + // Clear data members in tree + Clear() ; + + // Initialize tree + mGlauberTree->Open(mOutputFileName) ; + + // Histograms + for(Int_t in=0;in<4;in++){ + TString nucleus("Projectile"); + if( in % 2 == 1 ) nucleus = "Target"; + + TString title(Form("Woods-saxon density profile (%s)", nucleus.Data())); + if(in>=2) title = Form("Woods-saxon density profile after repulsion (%s)", nucleus.Data()); + + mhWoodsSaxon[in] = new TH1D(Form("hWoodsSaxon_%d", in), title, 400, 0, 20); + mhWoodsSaxon[in]->SetXTitle("r (fm)"); + } + + // Sort output histograms/tree + mGlauberTree->Sort(); + + return 1; +} + +//____________________________________________________________________________________________________ +Int_t StFastGlauberMcMaker::Init( + const UInt_t massNumberA, // Mass number of nucleus for nucleus A + const Double_t radiusA, // Radius of nucleus for nucleus A + const Double_t skinDepthA, // Skin depth of nucleus for nucleus A + const Double_t beta2A, // 2nd order deformation parameter for nucleus A + const Double_t beta4A, // 4th order deformation parameter for nucleus A + const UInt_t massNumberB, // Mass number of nucleus for nucleus B + const Double_t radiusB, // Radius of nucleus for nucleus B + const Double_t skinDepthB, // Skin depth of nucleus for nucleus B + const Double_t beta2B, // 2nd order deformation parameter for nucleus B + const Double_t beta4B, // 4th order deformation parameter for nucleus B + const TString type + ){ + LOG_INFO << "StFastGlauberMcMaker::Init Inelastic N-N cross section = " + << mInelasticNNCrossSection * 10.0 << " mb" + << " for sqrt(sNN) = " << mEnergy << " (GeV)" + << endm; + + mDebug = 0 ; + + mNeventsThrow = 0 ; // Number of all events + mNeventsAccept = 0 ; // Number of accepted events (Ncoll>0) + + // Centrlaity maker + const Char_t* system(Form("%s%s_%dGeV", GetName(massNumberA), GetName(massNumberB), + static_cast(mEnergy))) ; + LOG_INFO << "StFastGlauberMcMaker::init Initialize system " << system << endm; + mCentralityMaker = new StCentralityMaker(system); + + /// Repulsion distance is 0fm by default. Use SetRepulsionDistance(const Double_t) method to set finite value + mRepulsionDistance = 0.0 ; + + mHardCoreSmearing = kFALSE ; /// Hard-core smearing, default is OFF + mGaussianSmearing = kFALSE ; /// Gaussian smearing, default is OFF + + mCollisionProfile = mkHardCoreProfile ; /// Default is hard-core collision + if ( type.CompareTo("gauss", TString::kIgnoreCase) == 0 ){ + //DoGaussianCollision() ; + } + + /// Hard-core smearing (only use if mHardCoreSmearing is true) + const Double_t dmaxh = TMath::Sqrt(mInelasticNNCrossSection/TMath::Pi()); + mfHardCore = new TF3("fHardCore", GlauberUtilities::StepFunction, -dmaxh, dmaxh, -dmaxh, dmaxh, -dmaxh, dmaxh, 1); + mfHardCore->SetParameter(0, mInelasticNNCrossSection); + + if(mDebug){ + LOG_INFO << "StFastGlauberMcMaker::Init Initialize hard-core smearing function (will be used only if hard-core smearing is ON)" + << endm; + } + + /// Gaussian smearing (only use if mGaussianSmearing is true) + const Double_t sigma = 0.79/TMath::Sqrt(3.0) ; + const Double_t dmaxg = sigma*5.0 ; + mfGaussian = new TF3("fGaussian", GlauberUtilities::Gaussian, -dmaxg, dmaxg, -dmaxg, dmaxg, -dmaxg, dmaxg, 1); + mfGaussian->SetParameter(0, sigma); // width + + if(mDebug){ + LOG_INFO << "StFastGlauberMcMaker::Init Initialize gaussian smearing function (will be used only if gaussian smearing is ON)" + << endm; + } + + for(UInt_t in=0; in<2; in++){ + if(mIsDeformed[in]){ + // Make sure deformation is finite + const Bool_t isNoDeformation = (in==0) ? (beta2A==0.0 && beta4A==0.0) : (beta2B==0.0 && beta4B==0.0) ; + if( isNoDeformation ){ + Error("StFastGlauberMcMaker::Init", "No deformation: beta2=beta4=0. abort"); + assert(0); + } + + /// Initialize Woods-saxon density profile for deformed nuclei + mfWoodsSaxon[in] = 0 ; // NULL pointer for spherical woods-saxon + + mfWoodsSaxon2D[in] = new TF2(Form("fWoodsSaxon2D_%d", in), GlauberUtilities::WoodsSaxon2D, 0, 20, -1.0, 1.0, 4); + mfWoodsSaxon2D[in]->SetParName(0, "Radius"); + mfWoodsSaxon2D[in]->SetParName(1, "Skin depth"); + mfWoodsSaxon2D[in]->SetParName(2, "#beta_{2}"); + mfWoodsSaxon2D[in]->SetParName(3, "#beta_{4}"); + // mfWoodsSaxon2D[in]->SetParName(4, "#beta_{6}"); + + // Default number of sampling points are too small (probably for y-axis) in TF2 + // this causes the step-like structures if you get (r,theta) from TF2::GetRandom2() + // --> Increase Npx, Npy by a factor of 2 + mfWoodsSaxon2D[in]->SetNpx(200); + mfWoodsSaxon2D[in]->SetNpy(200); + + if( in == 0 ){ + mfWoodsSaxon2D[in]->SetParameter(0, radiusA) ; + mfWoodsSaxon2D[in]->SetParameter(1, skinDepthA) ; + mfWoodsSaxon2D[in]->SetParameter(2, beta2A) ; + mfWoodsSaxon2D[in]->SetParameter(3, beta4A) ; + } + else{ + mfWoodsSaxon2D[in]->SetParameter(0, radiusB) ; + mfWoodsSaxon2D[in]->SetParameter(1, skinDepthB) ; + mfWoodsSaxon2D[in]->SetParameter(2, beta2B) ; + mfWoodsSaxon2D[in]->SetParameter(3, beta4B) ; + } + + LOG_INFO << "StFastGlauberMcMaker::Init Initialize Deformed Woods-saxon density profile" << endm; + for(Int_t ipar=0; iparGetNpar(); ipar++){ + LOG_INFO << "StFastGlauberMcMaker::Init par[" << ipar << "] = " << mfWoodsSaxon2D[in]->GetParameter(ipar) + << ", parName = " << mfWoodsSaxon2D[in]->GetParName(ipar) + << endm; + } + } + else{ + /// Initialize Woods-saxon density profile for spherical nuclei + // Radius and skin depth + mfWoodsSaxon2D[in] = 0 ; // NULL pointer for deformed woods-saxon + + mfWoodsSaxon[in] = new TF1(Form("fWoodsSaxon_%d", in), GlauberUtilities::WoodsSaxon, 0, 20, 2); + mfWoodsSaxon[in]->SetParName(0, "Radius"); + mfWoodsSaxon[in]->SetParName(1, "Skin depth"); + if( in == 0 ){ + mfWoodsSaxon[in]->SetParameter(0, radiusA) ; + mfWoodsSaxon[in]->SetParameter(1, skinDepthA) ; + } + else{ + mfWoodsSaxon[in]->SetParameter(0, radiusB) ; + mfWoodsSaxon[in]->SetParameter(1, skinDepthB) ; + } + + LOG_INFO << "StFastGlauberMcMaker::Init Initialize Spherical Woods-saxon density profile" << endm; + for(Int_t ipar=0; iparGetNpar(); ipar++){ + LOG_INFO << "StFastGlauberMcMaker::Init par[" << ipar << "] = " << mfWoodsSaxon[in]->GetParameter(ipar) + << ", parName = " << mfWoodsSaxon[in]->GetParName(ipar) + << endm; + } + } + + /// Initialize nucleons + mNucleons[in].clear() ; + const UInt_t A = (in==0) ? massNumberA : massNumberB ; + LOG_INFO << "StFastGlauberMcMaker::Init Initialize " << A << " nucleons ..." << endm; + + for(UInt_t i=0;i take 2 sigma + if ( type.CompareTo("large", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker::InitAuAu Set large R, small d" << endm; + RError = 0.12 ; + dError = -0.054 ; + // RError = 0.32 ; //5% + // dError = -0.0267 ;//5% + } + else if ( type.CompareTo("small", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker::InitAuAu Set small R, large d" << endm; + RError = -0.12 ; + dError = 0.054 ; + // RError = -0.32 ; //5% + // dError = 0.0267 ; //5% + } + else if ( type.CompareTo("gauss", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker::InitAuAu Gaussian collision profile" << endm; + DoGaussianCollision() ; + } + else if ( type.CompareTo("smallNpp", TString::kIgnoreCase) == 0 ){ + mMode = 1 ; + LOG_INFO << "StFastGlauberMcMaker::InitAuAu Use small npp, large x for multiplicity (mMode = " + << mMode << ")" + << endm; + } + else if ( type.CompareTo("largeNpp", TString::kIgnoreCase) == 0 ){ + mMode = 2 ; + LOG_INFO << "StFastGlauberMcMaker::InitAuAu Use large npp, small x for multiplicity (mMode = " + << mMode << ")" + << endm; + } + + return Init(A, R+RError, d+dError, beta2, beta4, A, R+RError, d+dError, beta2, beta4, type); +} + +//____________________________________________________________________________________________________ +Int_t StFastGlauberMcMaker::InitSmSm(const TString type) +{ + /// Initialize Sm + Sm collisions + // - Sm144 (spherical, A=144, N=82, Z=62) + // - Sm154 (deformed, A=154, N=92, Z=62) + // + // Sm144 + // R = 5.71 = 1.12*(144)^{1/3} - 0.86*(144)^{-1/3} + // d = 0.543 = 0.522 * 5.9387 / 5.71 + const UInt_t A = (mIsDeformed) ? 154 : 144 ; + // const Double_t R = (mIsDeformed) ? 5.9387 : 5.71 ; + // const Double_t d = (mIsDeformed) ? 0.522 : 0.543 ; + const Double_t R = (mIsDeformed) ? 5.9387 : 5.9387 ; + const Double_t d = (mIsDeformed) ? 0.522 : 0.522 ; + Double_t RError = 0.0 ; // Absolute error on R + Double_t dError = 0.0 ; // Absolute error on d + + // Deformation parameters + Double_t beta2 = 0.0 ; + Double_t beta4 = 0.0 ; + // Double_t beta6 = 0.0 ; + + // Deformation + if( mIsDeformed ){ + LOG_INFO << "StFastGlauberMcMaker::InitSmSm Set deformation for Sm nuclei" << endm ; + beta2 = 0.270 ; // Deformation parameter beta2 + beta4 = 0.113 ; // Deformation parameter beta4 + // beta6 = -0.005 ; // Deformation parameter beta6 + } + + // Error on R and d is taken from Atomic Data and Nuclear Table 36, 495 (1987) + // R = 5.9387 (no error, assign +/- 0.0050), d = 0.522 +/- 0.015 for Sm154 + // No R and d parameters for Sm144 + // --> take 2 sigma + if ( type.CompareTo("large", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker::InitSmSm Set large R, small d" << endm; + RError = 0.01 ; + dError = -0.030 ; + } + else if ( type.CompareTo("small", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker::InitSmSm Set small R, large d" << endm; + RError = -0.01 ; + dError = 0.030 ; + } + else if ( type.CompareTo("gauss", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker::InitSmSm Gaussian collision profile" << endm; + DoGaussianCollision() ; + } + else if ( type.CompareTo("smallNpp", TString::kIgnoreCase) == 0 ){ + mMode = 1 ; + LOG_INFO << "StFastGlauberMcMaker::InitSmSm Use small npp, large x for multiplicity (mMode = " + << mMode << ")" + << endm; + } + else if ( type.CompareTo("largeNpp", TString::kIgnoreCase) == 0 ){ + mMode = 2 ; + LOG_INFO << "StFastGlauberMcMaker::InitSmSm Use large npp, small x for multiplicity (mMode = " + << mMode << ")" + << endm; + } + + return Init(A, R+RError, d+dError, beta2, beta4, A, R+RError, d+dError, beta2, beta4, type); +} + +//____________________________________________________________________________________________________ +Int_t StFastGlauberMcMaker::InitUU(const TString type) +{ + /// Initialize U + U collisions + const UInt_t A = 238 ; + const Double_t R = 6.81 ; + const Double_t d = 0.55 ; + Double_t RError = 0.0 ; // Absolute error on R + Double_t dError = 0.0 ; // Absolute error on d + + // Deformation parameters + Double_t beta2 = 0.0 ; + Double_t beta4 = 0.0 ; + // Double_t beta6 = 0.0 ; + + // Deformation + if( mIsDeformed ){ + LOG_INFO << "StFastGlauberMcMaker::InitUU Set deformation for U nuclei" << endm ; + beta2 = 0.28 ; // Deformation parameter beta2 + beta4 = 0.093 ; // Deformation parameter beta4 + // beta6 = 0.007 ; // Deformation parameter beta6 + } + + // Error on R and d is taken from Atomic Data and Nuclear Table 36, 495 (1987) + // R = 6.8054, d = 0.605 +/- 0.016 (PRC13, 1083, 1976) + // R = 6.874, d = 0.556 (unpublished) + // difference gives + // \Delta R = 0.0686 fm, \Delta d = 0.049 fm + // --> take 2 sigma + if ( type.CompareTo("large", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker::InitUU Set large R, small d" << endm; + RError = 0.137 ; + dError = -0.098 ; + } + else if ( type.CompareTo("small", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker::InitUU Set small R, large d" << endm; + RError = -0.137 ; + dError = 0.098 ; + } + else if ( type.CompareTo("gauss", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker::InitUU Gaussian collision profile" << endm; + DoGaussianCollision() ; + } + else if ( type.CompareTo("smallNpp", TString::kIgnoreCase) == 0 ){ + mMode = 1 ; + LOG_INFO << "StFastGlauberMcMaker::InitUU Use small npp, large x for multiplicity (mMode = " + << mMode << ")" + << endm; + } + else if ( type.CompareTo("largeNpp", TString::kIgnoreCase) == 0 ){ + mMode = 2 ; + LOG_INFO << "StFastGlauberMcMaker::InitUU Use large npp, small x for multiplicity (mMode = " + << mMode << ")" + << endm; + } + + return Init(A, R+RError, d+dError, beta2, beta4, A, R+RError, d+dError, beta2, beta4, type); +} + +//____________________________________________________________________________________________________ +Int_t StFastGlauberMcMaker::InitPbPb(const TString type) +{ + /// Initialize Pb + Pb collisions + const UInt_t A = 208 ; + const Double_t R = 6.62 ; + const Double_t d = 0.546 ; + Double_t RError = 0.0 ; // Absolute error on R + Double_t dError = 0.0 ; // Absolute error on d + + // Deformation parameters + Double_t beta2 = 0.0 ; + Double_t beta4 = 0.0 ; + // Double_t beta6 = 0.0 ; + + // Deformation + if( mIsDeformed ){ + LOG_INFO << "StFastGlauberMcMaker::InitPbPb Set deformation for Pb nuclei" << endl; + beta2 = 0.0; + beta4 = 0.0; + } + + if ( type.CompareTo("large", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker::InitPbPb Set large R, small d" << endm; + RError = 0.120 ; + dError = -0.020 ; + } + else if ( type.CompareTo("small", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker::InitPbPb Set small R, large d" << endm; + RError = -0.120 ; + dError = 0.020 ; + } + else if ( type.CompareTo("gauss", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker::InitPbPb Gaussian collision profile" << endm; + DoGaussianCollision() ; + } + else if ( type.CompareTo("smallNpp", TString::kIgnoreCase) == 0 ){ + mMode = 1 ; + LOG_INFO << "StFastGlauberMcMaker::InitPbPb Use small npp, large x for multiplicity (mMode = " + << mMode << ")" + << endm; + } + else if ( type.CompareTo("largeNpp", TString::kIgnoreCase) == 0 ){ + mMode = 2 ; + LOG_INFO << "StFastGlauberMcMaker::InitPbPb Use large npp, small x for multiplicity (mMode = " + << mMode << ")" + << endm; + } + + return Init(A, R+RError, d+dError, beta2, beta4, A, R+RError, d+dError, beta2, beta4, type); +} + +//____________________________________________________________________________________________________ +Int_t StFastGlauberMcMaker::InitCuCu(const TString type) +{ + /// Initialize Cu + Cu collisions + const UInt_t A = 63 ; + const Double_t R = 4.19 ; + const Double_t d = 0.60 ; + Double_t RError = 0.0 ; // Absolute error on R + Double_t dError = 0.0 ; // Absolute error on d + + // Deformation parameters + Double_t beta2 = 0.0 ; + Double_t beta4 = 0.0 ; + // Double_t beta6 = 0.0 ; + + // Deformation + if( mIsDeformed ){ + LOG_INFO << "StFastGlauberMcMaker::InitCuCu Set deformation for Cu nuclei" << endm ; + beta2 = 0.162 ; // Deformation parameter beta2 + beta4 = -0.006 ; // Deformation parameter beta4 + } + + // Error on R and d is taken from Atomic Data and Nuclear Table 36, 495 (1987) + if ( type.CompareTo("large", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker::InitCuCu Set large R, small d" << endm; + RError = 0.041 ; + dError = -0.016 ; + } + else if ( type.CompareTo("small", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker::InitCuCu Set small R, large d" << endm; + RError = -0.041 ; + dError = 0.016 ; + } + else if ( type.CompareTo("gauss", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker::InitCuCu Gaussian collision profile" << endm; + DoGaussianCollision() ; + } + else if ( type.CompareTo("smallNpp", TString::kIgnoreCase) == 0 ){ + mMode = 1 ; + LOG_INFO << "StFastGlauberMcMaker::InitCuCu Use small npp, large x for multiplicity (mMode = " + << mMode << ")" + << endm; + } + else if ( type.CompareTo("largeNpp", TString::kIgnoreCase) == 0 ){ + mMode = 2 ; + LOG_INFO << "StFastGlauberMcMaker::InitCuCu Use large npp, small x for multiplicity (mMode = " + << mMode << ")" + << endm; + } + + return Init(A, R+RError, d+dError, beta2, beta4, A, R+RError, d+dError, beta2, beta4, type); +} + +//____________________________________________________________________________________________________ +Int_t StFastGlauberMcMaker::InitZrZr(const TString type, int Case) +{ + /// Initialize Zr + Zr collisions + const UInt_t A = 96 ; + Double_t R; + Double_t d; + if(Case==1){R = 5.02 ; d = 0.46 ;} + else if(Case==2){R = 5.02 ; d = 0.46 ;} + else if(Case==3){R = 4.965 ; d = 0.556 ;} + Double_t RError = 0.0 ; // Absolute error on R + Double_t dError = 0.0 ; // Absolute error on d + + // Deformation parameters + Double_t beta2 = 0.0 ; + Double_t beta4 = 0.0 ; + // Double_t beta6 = 0.0 ; + + // Deformation parameters taken from https://journals.aps.org/prc/pdf/10.1103/PhysRevC.99.044908 + // B Schenke, C Shen, P Tribedy. Phys. Rev. C 99, 044908 (2019) + // Deformation + if( mIsDeformed ){ + LOG_INFO << "StFastGlauberMcMaker::InitZrZr Set deformation for Zr nuclei" << endm ; + if(Case==1){beta2 = 0.08 ; beta4 = 0.0 ; } + else if(Case==2){beta2 = 0.217 ; beta4 = 0.0 ; } + else if(Case==3){beta2 = 0.0 ; beta4 = 0.0 ; } + } + + if ( type.CompareTo("large", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker::InitZrZr Set large R, small d" << endm; + RError = 0.0 ; + dError = 0.0 ; + } + else if ( type.CompareTo("small", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker::InitZrZr Set small R, large d" << endm; + RError = 0.0 ; + dError = 0.0 ; + } + else if ( type.CompareTo("gauss", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker::InitZrZr Gaussian collision profile" << endm; + DoGaussianCollision() ; + } + else if ( type.CompareTo("smallNpp", TString::kIgnoreCase) == 0 ){ + mMode = 1 ; + LOG_INFO << "StFastGlauberMcMaker::InitZrZr Use small npp, large x for multiplicity (mMode = " + << mMode << ")" + << endm; + } + else if ( type.CompareTo("largeNpp", TString::kIgnoreCase) == 0 ){ + mMode = 2 ; + LOG_INFO << "StFastGlauberMcMaker::InitZrZr Use large npp, small x for multiplicity (mMode = " + << mMode << ")" + << endm; + } + + return Init(A, R+RError, d+dError, beta2, beta4, A, R+RError, d+dError, beta2, beta4, type); +} + +//____________________________________________________________________________________________________ +Int_t StFastGlauberMcMaker::InitRuRu(const TString type, int Case) +{ + /// Initialize Ru + Ru collisions + const UInt_t A = 96 ; + Double_t R; + Double_t d; + if(Case==1){R = 5.085 ; d = 0.46 ;} + else if(Case==2){R = 5.085 ; d = 0.46 ;} + else if(Case==3){R = 5.067 ; d = 0.500 ;} + Double_t RError = 0.0 ; // Absolute error on R + Double_t dError = 0.0 ; // Absolute error on d + + // Deformation parameters + Double_t beta2 = 0.0 ; + Double_t beta4 = 0.0 ; + // Double_t beta6 = 0.0 ; + + // Deformation parameters taken from https://journals.aps.org/prc/pdf/10.1103/PhysRevC.99.044908 + // B Schenke, C Shen, P Tribedy. Phys. Rev. C 99, 044908 (2019) + // Deformation + if( mIsDeformed ){ + LOG_INFO << "StFastGlauberMcMaker::InitRuRu Set deformation for Ru nuclei" << endm ; + if(Case==1){beta2 = 0.158 ; beta4 = 0.0 ; } + else if(Case==2){beta2 = 0.053 ; beta4 = 0.0 ; } + else if(Case==3){beta2 = 0.0 ; beta4 = 0.0 ; } + } + + if ( type.CompareTo("large", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker::InitRuRu Set large R, small d" << endm; + RError = 0.0 ; + dError = 0.0 ; + } + else if ( type.CompareTo("small", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker::InitRuRu Set small R, large d" << endm; + RError = 0.0 ; + dError = 0.0 ; + } + else if ( type.CompareTo("gauss", TString::kIgnoreCase) == 0 ){ + LOG_INFO << "StFastGlauberMcMaker::InitRuRu Gaussian collision profile" << endm; + DoGaussianCollision() ; + } + else if ( type.CompareTo("smallNpp", TString::kIgnoreCase) == 0 ){ + mMode = 1 ; + LOG_INFO << "StFastGlauberMcMaker::InitRuRu Use small npp, large x for multiplicity (mMode = " + << mMode << ")" + << endm; + } + else if ( type.CompareTo("largeNpp", TString::kIgnoreCase) == 0 ){ + mMode = 2 ; + LOG_INFO << "StFastGlauberMcMaker::InitRuRu Use large npp, small x for multiplicity (mMode = " + << mMode << ")" + << endm; + } + + return Init(A, R+RError, d+dError, beta2, beta4, A, R+RError, d+dError, beta2, beta4, type); +} + + + + +//____________________________________________________________________________________________________ +Bool_t StFastGlauberMcMaker::IsCollision(Nucleon* nucleon0, Nucleon* nucleon1) const +{ + const Double_t dx = nucleon0->GetX() - nucleon1->GetX() ; + const Double_t dy = nucleon0->GetY() - nucleon1->GetY() ; + const Double_t dt = TMath::Sqrt(dx*dx + dy*dy) ; + const Double_t cutoff = TMath::Sqrt(mInelasticNNCrossSection/TMath::Pi()); + + switch ( mCollisionProfile ){ + /// Hard-core collision profile (default) + case mkHardCoreProfile: + { + return dt <= cutoff ; + } + + /// Gaussian collision profile + case mkGaussianProfile: + { + const Double_t sigma = cutoff ; + const Double_t arg = 0.5*dt/sigma ; + return ( StGlauberUtilities::instance()->GetUniform() <= TMath::Exp(-arg*arg) ); + } + + default: + { + Error("StFastGlauberMcMaker::IsCollision", "No collision profile specified. see below"); + LOG_INFO << " profile description function" << endm; + LOG_INFO << " Hard-core profile cut off distance = sqrt(sigma/pi) DoHardCoreCollision()" << endm; + LOG_INFO << " Gaussian profile sigma of gaussian = sqrt(sigma/pi) DoGaussianCollision()" << endm; + LOG_INFO << endm; + LOG_INFO << " d: transverse distrance between two nucleons (fm)" << endm; + LOG_INFO << " sigma: Inelastic N-N cross section (fm^2)" << endm; + assert(0); + } + } + + return kFALSE ; +} + +//____________________________________________________________________________________________________ +Int_t StFastGlauberMcMaker::Make() +{ + /// Clear all data members + Clear() ; + + StGlauberUtilities* glauberUtilities = StGlauberUtilities::instance() ; + + /// Impact parameter + const Double_t impactParameter = glauberUtilities->GetImpactParameter() ; + mGlauberTree->SetB( impactParameter ); + + //---------------------------------------------------------------------------------------------------- + /// 1. Generate nucleon positions (r,theta,phi) + /// 2. Smearing nucleon positions if switch is ON (either DoHardCoreSmearing() or DoGaussianSmearing()) + /// 3. Distribute (r,theta,phi) with repulsion distance ds if ds != 0 + //---------------------------------------------------------------------------------------------------- + + for(UInt_t in=0;in<2;in++){ + // Rotation angle (theta, phi) for deformed nuclei + const Double_t Theta = (mIsDeformed[in]) ? glauberUtilities->GetTheta() : 0.0 ; + const Double_t Phi = (mIsDeformed[in]) ? glauberUtilities->GetPhi() : 0.0 ; + mGlauberTree->SetTheta(in, Theta); + mGlauberTree->SetPhi(in, Phi); + + /// Determine impact parameter for each nucleus + const Double_t b = (in==0) ? -impactParameter/2.0 : impactParameter/2.0 ; + + UInt_t nNucleons = 0 ; + while( nNucleons < mNucleons[in].size() ){ + Double_t r = 0.0 ; + Double_t theta = 0.0 ; + Double_t phi = 0.0 ; + + // Get (r,theta,phi) for nucleons + GetRThetaPhi(in, r, theta, phi) ; + + mhWoodsSaxon[in]->Fill(r, 1.0/(r*r)) ; + + if( mRepulsionDistance == 0.0 ){ + /// No repulsion, just store (r,theta,phi) + mNucleons[in][nNucleons]->Set(r, theta, phi, b, Theta, Phi, kTRUE) ; + nNucleons++; + } + else{ + if(nNucleons==0){ + /// Store first nucleon, and increment total + mNucleons[in][nNucleons]->Set(r, theta, phi, b, Theta, Phi, kTRUE) ; + nNucleons++; + } + else{ + /// Check all the nucleons stored whether there are overlap each other + /// defined by mRepulsionDistance. If any nucleons overlap, then discard + /// current nucleon and try again + Bool_t isOk = kFALSE ; + do { + const Double_t x = r*TMath::Sin(theta)*TMath::Cos(phi) ; + const Double_t y = r*TMath::Sin(theta)*TMath::Sin(phi) ; + const Double_t z = r*TMath::Cos(theta); + + Bool_t isOverlap = kFALSE ; + for(UInt_t i=0; iGetX() ; + const Double_t y0 = mNucleons[in][i]->GetY() ; + const Double_t z0 = mNucleons[in][i]->GetZ() ; + const Double_t dx = x - x0 ; + const Double_t dy = y - y0 ; + const Double_t dz = z - z0 ; + + // If any nucleons are found to be overlapped to the current one, stop the loop to save time + if( TMath::Sqrt(dx*dx + dy*dy + dz*dz) <= mRepulsionDistance ){ + isOverlap = kTRUE ; + break ; + } + }// Looping over other nucleons + + if(isOverlap){ + // There are overlap nucleons, try again + isOk = kFALSE ; + + // Get (r,theta,phi) for nucleons + GetRThetaPhi(in, r, theta, phi) ; + } + else{ + // if no nucleons are overlapped with the current one + isOk = kTRUE ; + } + + } while( !isOk ) ; // Find any overlaped nucleons ? + + // Add positions and increment total + mNucleons[in][nNucleons]->Set(r, theta, phi, b, Theta, Phi, kTRUE) ; + nNucleons++; + }// Check overlap from 2nd nucleons + }// mRepulsionDistance > 0 + }// Looping over all nucleons + }// Nucleus loop + + //---------------------------------------------------------------------------------------------------- + /// Determine Number of collisions by looping over all pair of nucleons + //---------------------------------------------------------------------------------------------------- + UInt_t Ncoll = 0 ; + for(UInt_t in=0; inIncrementNcoll() ; + nucleon1->IncrementNcoll() ; + + Ncoll++; + } + } + } + + //---------------------------------------------------------------------------------------------------- + /// Need at least one Ncoll + //---------------------------------------------------------------------------------------------------- + if( Ncoll == 0 ) return 0 ; + + //---------------------------------------------------------------------------------------------------- + /// Determine Npart + /// Calculate , , , , , ecc_{RP} and ecc_{PP} + //---------------------------------------------------------------------------------------------------- + Double_t nSum[4] ; + Double_t sumx[4] ; + Double_t sumy[4] ; + Double_t sumx2[4] ; + Double_t sumy2[4] ; + Double_t sumxy[4] ; + + for(Int_t i=0;i<4;i++){ + nSum[i] = 0.0 ; + sumx[i] = 0.0 ; + sumy[i] = 0.0 ; + sumx2[i] = 0.0 ; + sumy2[i] = 0.0 ; + sumxy[i] = 0.0 ; + } + + UInt_t Npart = 0 ; + for(UInt_t in=0;in<2;in++){ + for(UInt_t i=0;iGetNcoll() ; + if( ncoll > 0 ){ + // Participant weight + sumx[0] += nucleon->GetXYZ("x"); + sumy[0] += nucleon->GetXYZ("y"); + sumx2[0] += nucleon->GetXYZ("xx"); + sumy2[0] += nucleon->GetXYZ("yy"); + sumxy[0] += nucleon->GetXYZ("xy"); + nSum[0]++ ; // Should be identical to Npart + + // Ncoll weight + sumx[1] += ncoll * nucleon->GetXYZ("x"); + sumy[1] += ncoll * nucleon->GetXYZ("y"); + sumx2[1] += ncoll * nucleon->GetXYZ("xx"); + sumy2[1] += ncoll * nucleon->GetXYZ("yy"); + sumxy[1] += ncoll * nucleon->GetXYZ("xy"); + nSum[1] += ncoll ; + + // Multiplicity weight + const Double_t mult = mCentralityMaker->GetNegativeBinomial()->GetTwoComponentMultiplicity(1.0, ncoll) ; + nucleon->SetMultiplicity(mult); + sumx[2] += mult * nucleon->GetXYZ("x"); + sumy[2] += mult * nucleon->GetXYZ("y"); + sumx2[2] += mult * nucleon->GetXYZ("xx"); + sumy2[2] += mult * nucleon->GetXYZ("yy"); + sumxy[2] += mult * nucleon->GetXYZ("xy"); + nSum[2] += mult ; + + nucleon->IncrementNpart() ; + Npart++; + } + else{ + // Spectator + sumx[3] += nucleon->GetXYZ("x"); + sumy[3] += nucleon->GetXYZ("y"); + sumx2[3] += nucleon->GetXYZ("xx"); + sumy2[3] += nucleon->GetXYZ("yy"); + sumxy[3] += nucleon->GetXYZ("xy"); + + nSum[3]++ ; // Should be identical to MassNumber - Npart + } + }// Nucleon loop + }// Nucleus loop + + // Set multiplicity + mGlauberTree->SetNpart(Npart) ; + mGlauberTree->SetNcoll(Ncoll) ; + + // Get StNegativeBinomial with different (npp, x) + const StNegativeBinomial* nbinomial = mCentralityMaker->GetNegativeBinomial() ; + mGlauberTree->SetMultiplicity( nbinomial->GetMultiplicity(Npart, Ncoll) ); + + // Get average and calculate eccentricity + for(UInt_t i=0;i<4;i++){ + if(nSum[i]==0.0) continue ; + + sumx[i] /= nSum[i] ; + sumy[i] /= nSum[i] ; + sumx2[i] /= nSum[i] ; + sumy2[i] /= nSum[i] ; + sumxy[i] /= nSum[i] ; + + mGlauberTree->SetSumX(i, sumx[i]); + mGlauberTree->SetSumY(i, sumy[i]); + mGlauberTree->SetSumX2(i, sumx2[i]); + mGlauberTree->SetSumY2(i, sumy2[i]); + mGlauberTree->SetSumXY(i, sumxy[i]); + + // Eccentricity + const Double_t sigmaX2 = sumx2[i] - sumx[i]*sumx[i] ; + const Double_t sigmaY2 = sumy2[i] - sumy[i]*sumy[i] ; + const Double_t sumSigma = sigmaX2 + sigmaY2 ; + Double_t eccRP2 = -9999. ; + Double_t eccPP2 = -9999. ; + Double_t eccPP3 = -9999. ; + Double_t eccPP4 = -9999. ; + Double_t PP2 = -9999. ; + Double_t PP3 = -9999. ; + Double_t PP4 = -9999. ; + + if( sumSigma == 0.0 ){ + // Check denominator + eccRP2 = -9999. ; + eccPP2 = -9999. ; + eccPP3 = -9999. ; + eccPP4 = -9999. ; + PP2 = -9999. ; + PP3 = -9999. ; + PP4 = -9999. ; + } + else{ + //---------------------------------------------------------------------------------------------------- + // Reaction plane eccentricity + //---------------------------------------------------------------------------------------------------- + eccRP2 = (sigmaY2-sigmaX2)/sumSigma ; + + //---------------------------------------------------------------------------------------------------- + // The n-th order participant plane eccentricity + //---------------------------------------------------------------------------------------------------- + for(Int_t io=0; io<3; io++){ + const Double_t order = io + 2.0 ; + TGraph* qpart = GetParticipantEccentricity(order, sumx[i], sumy[i], nSum[i], i); + if( io == 0 ) { PP2 = qpart->GetY()[2] ; eccPP2 = qpart->GetY()[3] ; } + if( io == 1 ) { PP3 = qpart->GetY()[2] ; eccPP3 = qpart->GetY()[3] ; } + if( io == 2 ) { PP4 = qpart->GetY()[2] ; eccPP4 = qpart->GetY()[3] ; } + delete qpart ; + } + } + + mGlauberTree->SetEccRP2(i, eccRP2); + mGlauberTree->SetEccPP2(i, eccPP2); + mGlauberTree->SetEccPP3(i, eccPP3); + mGlauberTree->SetEccPP4(i, eccPP4); + mGlauberTree->SetPP2(i, PP2); + mGlauberTree->SetPP3(i, PP3); + mGlauberTree->SetPP4(i, PP4); + } + + return 1; +} + +//____________________________________________________________________________________________________ +Int_t StFastGlauberMcMaker::Run(const UInt_t nevents) +{ + LOG_INFO << "StFastGlauberMcMaker::Run Run " << nevents << " events ..." << endm; + + while( mNeventsAccept < nevents ){ + if ( Make() == 1 ){ + // Debug + if ( mNeventsAccept % 100 == 0 ){ + LOG_INFO << Form("StFastGlauberMcMaker::Run (accept/throw, Npart, Ncoll, b) = (%5d/%5d, %4d, %4d, %1.2f fm)", + mNeventsAccept, mNeventsThrow, mGlauberTree->GetNpart(), mGlauberTree->GetNcoll(), + mGlauberTree->GetB()) + << endm; + } + + if(mDebug){ + LOG_INFO << Form("StFastGlauberMcMaker::Run (accept/throw, Npart, Ncoll, b) = (%5d/%5d, %4d, %4d, %1.2f fm)", + mNeventsAccept, mNeventsThrow, mGlauberTree->GetNpart(), mGlauberTree->GetNcoll(), + mGlauberTree->GetB()) + << endm; + } + + // Fill tree + mGlauberTree->Fill() ; + + mNeventsAccept++; + } + + mNeventsThrow++; + } + + return 1; +} + +//____________________________________________________________________________________________________ +Int_t StFastGlauberMcMaker::Finish() +{ + // Store header info. + + // Name of nucleus + const UInt_t A[2] = {mNucleons[0].size(), mNucleons[0].size()}; + mGlauberTree->SetNameNucleusA(GetName(A[0])); + mGlauberTree->SetNameNucleusB(GetName(A[1])); + + // Mass numbers + mGlauberTree->SetMassNumberA(A[0]); + mGlauberTree->SetMassNumberB(A[1]); + + // Radius + mGlauberTree->SetRadiusA((mIsDeformed[0]) ? mfWoodsSaxon2D[0]->GetParameter(0) : mfWoodsSaxon[0]->GetParameter(0)); + mGlauberTree->SetRadiusB((mIsDeformed[1]) ? mfWoodsSaxon2D[1]->GetParameter(0) : mfWoodsSaxon[1]->GetParameter(0)); + + // Skin depth + mGlauberTree->SetSkinDepthA((mIsDeformed[0]) ? mfWoodsSaxon2D[0]->GetParameter(1) : mfWoodsSaxon[0]->GetParameter(1)); + mGlauberTree->SetSkinDepthB((mIsDeformed[1]) ? mfWoodsSaxon2D[1]->GetParameter(1) : mfWoodsSaxon[1]->GetParameter(1)); + + // Deformation parameters + if(mIsDeformed[0]){ + mGlauberTree->SetBeta2A(mfWoodsSaxon2D[0]->GetParameter(2)); + mGlauberTree->SetBeta4A(mfWoodsSaxon2D[0]->GetParameter(3)); + } + if(mIsDeformed[1]){ + mGlauberTree->SetBeta2A(mfWoodsSaxon2D[1]->GetParameter(2)); + mGlauberTree->SetBeta4A(mfWoodsSaxon2D[1]->GetParameter(3)); + } + + // sigmaNN, sqrt(sNN) + mGlauberTree->SetSigmaNN( mInelasticNNCrossSection * 10.0 ) ; // mb + mGlauberTree->SetSqrtSNN( mEnergy ) ; + + // Repulsion distance + mGlauberTree->SetRepulsionD(mRepulsionDistance); + + // Total cross section (mb) skip if no events have been processed + Double_t totalX = 0.0 ; + Double_t totalXError = 0.0 ; + const Double_t bmax = StGlauberUtilities::instance()->GetMaximumImpactParameter() ; + + if( mNeventsAccept != 0 ){ + const Double_t scaleFactor = TMath::Pi() * bmax * bmax * 10.0 ; + totalX = (Double_t)mNeventsAccept / (Double_t)mNeventsThrow * scaleFactor ; + totalXError = totalX * TMath::Sqrt(1.0/mNeventsAccept + 1.0/mNeventsThrow) ; + } + mGlauberTree->SetTotalXsec(totalX) ; + mGlauberTree->SetTotalXsecError(totalXError) ; + + // Smearing options (0 or 1) + // UInt_t smearHardCore = (mHardCoreSmearing) ? 1 : 0 ; + // UInt_t smearGaussian = (mGaussianSmearing) ? 1 : 0 ; + mGlauberTree->SetSmearHardCore(mHardCoreSmearing); + mGlauberTree->SetSmearGaussian(mGaussianSmearing); + + // Collision profile options (0 or 1) + UInt_t collisionHardCore = (mCollisionProfile==mkHardCoreProfile) ? 1 : 0 ; + UInt_t collisionGaussian = (mCollisionProfile==mkGaussianProfile) ? 1 : 0 ; + mGlauberTree->SetCollisionHardCore(collisionHardCore); + mGlauberTree->SetCollisionGaussian(collisionGaussian); + + // Maximum impact parameter + mGlauberTree->SetBMax(bmax); + + // Number of events + mGlauberTree->SetNeventsAccept(mNeventsAccept); + mGlauberTree->SetNeventsThrow(mNeventsThrow); + + // NBD parameters + const StNegativeBinomial* nb = mCentralityMaker->GetNegativeBinomial() ; + mGlauberTree->SetNpp( nb->GetNpp() ); + mGlauberTree->SetK( nb->GetK() ); + mGlauberTree->SetX( nb->GetX() ); + mGlauberTree->SetEfficiency( nb->GetEfficiency() ); + mGlauberTree->SetIsConstEfficiency( nb->IsConstEfficiency() ); + + // version + mGlauberTree->SetVersion(mVersion); + mGlauberTree->FillHeader() ; + + LOG_INFO << "StFastGlauberMcMaker::Finish Close ROOT file" << endm; + mGlauberTree->Close(); + + return 1; +} + +//____________________________________________________________________________________________________ +void StFastGlauberMcMaker::DoHardCoreSmearing() +{ + mHardCoreSmearing = kTRUE ; + LOG_INFO << "StFastGlauberMcMaker::DoHardCoreSmearing Hard-core smearing in (x,y,z) "; + LOG_INFO << "by using the step function with inelastic nn cross section" << endm; + + /// Turn off Gaussian smearing + mGaussianSmearing = kFALSE ; + if(mDebug){ + LOG_INFO << "StFastGlauberMcMaker::DoHardCoreSmearing Gaussian smearing turned off" << endm; + } +} + +//____________________________________________________________________________________________________ +void StFastGlauberMcMaker::DoGaussianSmearing() +{ + mGaussianSmearing = kTRUE ; + LOG_INFO << "StFastGlauberMcMaker::DoGaussianSmearing gaussian smearing in (x,y,z) "; + LOG_INFO << "by using the gaussian function with fixed sigma" << endm; + + /// Turn off Hard-core smearing + mHardCoreSmearing = kFALSE ; + if(mDebug){ + LOG_INFO << "StFastGlauberMcMaker::DoGaussianSmearing hard-core smearing turned off" << endm; + } +} + +//____________________________________________________________________________________________________ +void StFastGlauberMcMaker::DoHardCoreCollision() +{ + /// Hard-core collision + mCollisionProfile = mkHardCoreProfile ; + LOG_INFO << "StFastGlauberMcMaker::DoHardCoreCollision hard-core n-n collision " + << " cut off distance is sqrt(sigma/pi) = " << TMath::Sqrt(mInelasticNNCrossSection/TMath::Pi()) + << endm; +} + +//____________________________________________________________________________________________________ +void StFastGlauberMcMaker::DoGaussianCollision() +{ + /// Gaussian profile collision + mCollisionProfile = mkGaussianProfile ; + LOG_INFO << "StFastGlauberMcMaker::DoGaussianCollision gaussian profile n-n collision " + << " sigma of gaussian is sqrt(sigma/pi) = " << TMath::Sqrt(mInelasticNNCrossSection/TMath::Pi()) + << endm; +} + +//---------------------------------------------------------------------------------------------------- +// Utilities +//---------------------------------------------------------------------------------------------------- + +//____________________________________________________________________________________________________ +const Char_t* StFastGlauberMcMaker::GetName(const UInt_t massNumber) const +{ + switch ( massNumber ){ + case 63: return "Cu"; + case 144: return "Sm"; + case 154: return "Sm"; + case 197: return "Au"; + case 208: return "Pb"; + case 238: return "U"; + //ZS The following should be changed to include Ru + case 96: return "Zr"; + default: + Error("StFastGlauberMcMaker::GetName", "can't find mass number = %d. Return white space", massNumber); + return ""; + } + + return ""; +} + +//____________________________________________________________________________________________________ +Double_t StFastGlauberMcMaker::GetInelasticNNCrossSection(const Double_t energy, const TString type) const +{ + /// Cast to integer + const UInt_t energyInt = static_cast(energy) ; + + /// Assign error +/- 1mb if type is either largeXsec (+1mb) or smallXsec (-1mb) + Double_t error = 0.0 ; // absolute error on cross section + if( type.CompareTo("smallXsec", TString::kIgnoreCase) == 0 ) error = -0.1 ; + else if( type.CompareTo("largeXsec", TString::kIgnoreCase) == 0 ) error = 0.1 ; + + Double_t sigmaNN = 0.0 ; + switch ( energyInt ) { + case 2760: sigmaNN = 6.4 + error ; break ; // 64 mb + case 200: sigmaNN = 4.2 + error ; break ; // 42 mb + case 62: sigmaNN = 3.6 + error ; break ; // 36 mb + case 39: sigmaNN = 3.4 + error ; break ; // 34 mb + case 27: sigmaNN = 3.3 + error ; break ; // 33 mb + case 19: sigmaNN = 3.2 + error ; break ; // 32 mb + case 14: sigmaNN = 3.15 + error; break ; // 31.5 mb (for 14.5 GeV) + case 11: sigmaNN = 3.12 + error; break ; // 31.2 mb (for 11.5 GeV) + case 7: sigmaNN = 3.08 + error; break ; // 30.8 mb (for 7.7 GeV) + default: + Error("StFastGlauberMcMaker::GetInelasticNNCrossSection", "No energy = %1.1f GeV is available. abort", energy); + assert(0); + } + + if(mDebug){ + LOG_INFO << "StFastGlauberMcMaker::GetInelasticNNCrossSection "; + LOG_INFO << "Inelastic NN cross section = " << sigmaNN * 10 << " (mb) for sqrt(sNN) = " << energy + << endm; + } + + return sigmaNN ; +} + +//____________________________________________________________________________________________________ +void StFastGlauberMcMaker::GetRThetaPhi(const UInt_t inucleus, Double_t& r, Double_t& theta, Double_t& phi) const +{ + if( mIsDeformed[inucleus] ){ + // Deformed nuclei + Double_t cosTheta = -9999. ; + + // Random (r, cos(theta)) + mfWoodsSaxon2D[inucleus]->GetRandom2(r, cosTheta) ; + theta = TMath::ACos(cosTheta) ; // convert into theta + } + else{ + // Spherical nuclei + r = mfWoodsSaxon[inucleus]->GetRandom() ; + theta = StGlauberUtilities::instance()->GetTheta() ; // cos(theta) profile in 0 < theta < pi + } + phi = StGlauberUtilities::instance()->GetPhi() ; // flat phi in -pi < phi < pi + + // Smearing if the switch is ON + Smearing(r, theta, phi) ; +} + +//____________________________________________________________________________________________________ +void StFastGlauberMcMaker::Smearing(Double_t& r, Double_t& theta, Double_t& phi) const +{ + // Return original if both smearing options are OFF + if(!mHardCoreSmearing && !mGaussianSmearing) return; + + // Hard-core smearing + if(mHardCoreSmearing){ + Double_t dx, dy, dz ; /// Smearing width + mfHardCore->GetRandom3(dx, dy, dz) ; + + if(mDebug){ + LOG_INFO << Form("StFastGlauberMcMaker::Smearing Do hard-core smearing : (dx,dy,dz)=(%1.3f,%1.3f,%1.3f) fm", + dx,dy,dz) << endm; + } + + const Double_t x = r * TMath::Sin(theta) * TMath::Cos(phi) + dx ; + const Double_t y = r * TMath::Sin(theta) * TMath::Sin(phi) + dy ; + const Double_t z = r * TMath::Cos(theta) + dz ; + + r = TMath::Sqrt(x*x + y*y + z*z) ; + theta = TMath::ACos(z/r) ; + phi = TMath::ATan2(y, x) ; + return; + } + + // Gaussian smearing + if(mGaussianSmearing){ + Double_t dx, dy, dz ; /// Smearing width + mfGaussian->GetRandom3(dx, dy, dz) ; + + if(mDebug){ + LOG_INFO << Form("StFastGlauberMcMaker::Smearing Do gaussian smearing : (dx,dy,dz)=(%1.3f,%1.3f,%1.3f) fm", + dx,dy,dz) << endm; + } + + const Double_t x = r * TMath::Sin(theta) * TMath::Cos(phi) + dx ; + const Double_t y = r * TMath::Sin(theta) * TMath::Sin(phi) + dy ; + const Double_t z = r * TMath::Cos(theta) + dz ; + + r = TMath::Sqrt(x*x + y*y + z*z) ; + theta = TMath::ACos(z/r) ; + phi = TMath::ATan2(y, x) ; + return; + } +} + +//____________________________________________________________________________________________________ +TGraph* StFastGlauberMcMaker::GetParticipantEccentricity(const Double_t order, const Double_t sumx, const Double_t sumy, + const Double_t sumw, const UInt_t weightId) const +{ + Double_t qx = 0.0 ; + Double_t qy = 0.0 ; + Double_t qw = 0.0 ; + + for(UInt_t in=0;in<2;in++){ + for(UInt_t j=0;jGetNcoll() ; + + const Bool_t isOk = (weightId==3 && ncoll==0) // Spectator + || (weightId!=3 && ncoll > 0) ; // Participants + + if(!isOk) continue ; + + const Double_t x = nucleon->GetX() - sumx ; + const Double_t y = nucleon->GetY() - sumy ; + const Double_t z = nucleon->GetZ() ; + + const TVector3 vpart(x, y, z); + const Double_t rt = vpart.Perp() ; + const Double_t phi = vpart.Phi() ; + Double_t weight = 1.0 ; + if( weightId == 1 ) weight = ncoll ; + if( weightId == 2 ) weight = nucleon->GetMultiplicity() ; + if( weightId == 3 ) weight = 1.0 ; + + qx += -weight * rt*rt * TMath::Cos(order*phi) ; // -sign added to keep the same definition of participant plane + qy += weight * rt*rt * TMath::Sin(order*phi) ; + qw += weight * rt*rt ; + } + } + + qx /= sumw ; + qy /= sumw ; + qw /= sumw ; + + TGraph* g = new TGraph() ; // needs to be deleted later + g->SetPoint(0, 0, qx); + g->SetPoint(1, 1, qy); + g->SetPoint(2, 2, TMath::ATan2(qy, qx)); + g->SetPoint(3, 3, TMath::Sqrt(qx*qx + qy*qy)/qw) ; + + return g ; +} + +//____________________________________________________________________________________________________ +void StFastGlauberMcMaker::DebugOn() +{ + mDebug = 1 ; + LOG_INFO << "StFastGlauberMcMaker::DebugOn Set debug mode, will see a bunch of debugging messages" << endm; +} + +//____________________________________________________________________________________________________ +void StFastGlauberMcMaker::Print(const TString option) const +{ + if( option.CompareTo("type", TString::kIgnoreCase) == 0 ){ + LOG_INFO << endm; + LOG_INFO << "#----------------------------------------------------------------------------------------------------" << endm; + LOG_INFO << "StFastGlauberMcMaker::Print Current available types are:" << endm; + LOG_INFO << "type description" << endm; + LOG_INFO << " default" << endm; + LOG_INFO << " large Large R(+2%), small d(-10%)" << endm; + LOG_INFO << " small Small R(-2%), large d(+10%)" << endm; + LOG_INFO << " largeXsec Large inelastic NN cross section (+1mb)" << endm; + LOG_INFO << " smallXsec Small inelastic NN cross section (-1mb)" << endm; + LOG_INFO << " gauss Use gaussian collision profile" << endm; + LOG_INFO << " largeNpp Use large Npp, small x" << endm; + LOG_INFO << " smallNpp Use small Npp, large x" << endm; + LOG_INFO << "----------------------------------------------------------------------------------------------------" << endm; + LOG_INFO << "NOTE: Types below are not relevant for generating trees." << endm; + LOG_INFO << "NOTE: Only important for making histograms by StGlauberAnalysisMaker." << endm; + LOG_INFO << "NOTE: Users should use the default outputs and modify type to see " << endm; + LOG_INFO << "NOTE: the effect of different total cross section, for example" << endm; + LOG_INFO << endm; + LOG_INFO << " largeTotal +5% total cross section" << endm; + LOG_INFO << " smallTotal -5% total cross section" << endm; + LOG_INFO << " lowrw +2(-2) sigma p0 (p1) parameter for re-weighting correction" << endm; + LOG_INFO << " highrw -2(+2) sigma p0 (p1) parameter for re-weighting correction" << endm; + LOG_INFO << "#----------------------------------------------------------------------------------------------------" << endm; + LOG_INFO << endm; + } +} + +//____________________________________________________________________________________________________ +UInt_t StFastGlauberMcMaker::Version() const +{ + LOG_INFO << endm << endm; + LOG_INFO << "StFastGlauberMcMaker::Version Current StFastGlauberMcMaker version is " << mVersion << endm; + Print("type"); + LOG_INFO << endm << endm; + + return mVersion ; +} + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StFastGlauberMcMaker/StFastGlauberMcMaker.h b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StFastGlauberMcMaker/StFastGlauberMcMaker.h new file mode 100644 index 00000000000..b394ada759a --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StFastGlauberMcMaker/StFastGlauberMcMaker.h @@ -0,0 +1,248 @@ +/****************************************************************************** + * $Id: StFastGlauberMcMaker.h,v 1.4 2013/02/05 22:49:50 hmasui Exp $ + * $Log: StFastGlauberMcMaker.h,v $ + * Revision 1.4 2013/02/05 22:49:50 hmasui + * Added Pb and Cu nuclei + * + * Revision 1.3 2012/04/25 05:22:42 hmasui + * Added deformation parameters, higher order participant eccentricity with r^2 weight + * + * Revision 1.2 2010/11/20 19:03:11 hmasui + * Mode mode flag to StCentralityMaker. Use STAR logger rather than STD iostream + * +******************************************************************************/ +//==================================================================================================== +// StFastGlauberMcMaker class +// Fast MC Glauber simulation +// +// In order to run the MC glauber simulation, you can do +// root4star -b +// [0] .L doFastGlauberMcMaker.C +// [1] doFastGlauberMcMaker("glauber.root", 1000, "AuAu", 200, "default", kFALSE); +// where 1st argument is output ROOT file name, 2nd is number of events, +// 3rd is the system, 4th is the center of mass energy +// and 5th is type. The available type can be checked by +// StFastGlauberMcMaker::Print("type"); +// +// - The 5th argument is the flag of deformation. kFALSE (or false) gives +// spherical nuclei (default), kTRUE (or true) gives deformed nuclei. +// Deformation parameters are defined inside the class up to 4th order deformation. +// +// You can see the debugging messages by +// StFastGlauberMcMaker::DebugOn() +// in case you need further checks of outputs +// +//---------------------------------------------------------------------------------------------------- +// Hiroshi Masui (HMasui@lbl.gov) +//==================================================================================================== + +#ifndef __StFastGlauberMcMaker_h__ +#define __StFastGlauberMcMaker_h__ + +class TF1 ; +class TF2 ; +class TF3 ; +class TGraph ; +class TH1 ; +class TTree ; +class Nucleon ; +class StCentralityMaker ; +class StGlauberTree ; +#include +#include "TString.h" + +//____________________________________________________________________________________________________ +// Class StFastGlauberMcMaker: Fast Glauber Monte Carlo +class StFastGlauberMcMaker { + public: + // Default constructor (spherical Au+Au), and output file "fastglaubermc.root" + StFastGlauberMcMaker(); + + /// User friendly constructor + // Current available system: + // AuAu + // + // Current available type + // default + // large Large R(+2%), small d(-10%) + // small Small R(-2%), large d(+10%) + // largeXsec Large inelastic NN cross section (+1mb) + // smallXsec Small inelastic NN cross section (-1mb) + // gauss Use gaussian collision profile + StFastGlauberMcMaker( + const TString outputFileName, // Output fileName + const TString system, // System name (e.x. AuAu) + const Double_t energy, // energy (GeV) + const TString type, // type (see above) + const Bool_t isDeformed = kFALSE // Deformation flag + ); + + /// Constructor for symmetric collisions + StFastGlauberMcMaker( + const TString outputFileName, + const UInt_t massNumber, // Mass number of nucleus + const Double_t radius, // Radius of nucleus + const Double_t skinDepth, // Skin depth of nucleus + const Double_t beta2, // 2nd order deformation parameter + const Double_t beta4, // 4th order deformation parameter + const Double_t inelasticCrossSection, // Inelastic NN cross section + const Double_t energy // sqrt(sNN) + ); /// Default constructor + + /// Constructor for asymmetric collisions + StFastGlauberMcMaker( + const TString outputFileName, + const UInt_t massNumberA, // Mass number of nucleus for nucleus A + const Double_t radiusA, // Radius of nucleus for nucleus A + const Double_t skinDepthA, // Skin depth of nucleus for nucleus A + const Double_t beta2A, // 2nd order deformation parameter for nucleus A + const Double_t beta4A, // 4th order deformation parameter for nucleus A + const UInt_t massNumberB, // Mass number of nucleus for nucleus B + const Double_t radiusB, // Radius of nucleus for nucleus B + const Double_t skinDepthB, // Skin depth of nucleus for nucleus B + const Double_t beta2B, // 2nd order deformation parameter for nucleus B + const Double_t beta4B, // 4th order deformation parameter for nucleus B + const Double_t inelasticCrossSection, // Inelastic NN cross section + const Double_t energy // sqrt(sNN) + ); /// Default constructor + + virtual ~StFastGlauberMcMaker(); /// Default destructor + + /// Set repulsion of nucleons (default is 0fm) + void SetRepulsionDistance(const Double_t repulsionDistance); + + Int_t Make() ; /// Make one event + Int_t Run(const UInt_t nevents) ; /// Run Make() by nevents + Int_t Finish() ; /// Finish maker + + /// Hard-core smearing by sigmaNN + void DoHardCoreSmearing() ; /// Default is OFF + + /// Gaussian smearing by width = 0.79/sqrt(3) from CPC180, 69, 2009 + void DoGaussianSmearing() ; /// Default is OFF + + /// Collision profiles + void DoHardCoreCollision() ; /// Hard-core collision (default) + void DoGaussianCollision() ; /// Gaussion profile collision + + /// Print info. + // option=type print all available types + void Print(const TString option="") const ; + + void DebugOn() ; /// Debug Mode ON + UInt_t Version() const ; /// Return version + + private: + // Functions + Int_t Clear() ; /// Clear all data members in tree + + /// Initialize ROOT tree + Int_t InitTree() ; + + /// Initialization of nucleus and nucleons, and output ROOT file + Int_t Init( + const UInt_t massNumberA, // Mass number of nucleus for nucleus A + const Double_t radiusA, // Radius of nucleus for nucleus A + const Double_t skinDepthA, // Skin depth of nucleus for nucleus A + const Double_t beta2A, // 2nd order deformation parameter for nucleus A + const Double_t beta4A, // 4th order deformation parameter for nucleus A + const UInt_t massNumberB, // Mass number of nucleus for nucleus B + const Double_t radiusB, // Radius of nucleus for nucleus B + const Double_t skinDepthB, // Skin depth of nucleus for nucleus B + const Double_t beta2B, // 2nd order deformation parameter for nucleus B + const Double_t beta4B, // 4th order deformation parameter for nucleus B + const TString type = "default" + ); + + /// Initialization for specific collisions + Int_t InitAuAu(const TString type) ; + Int_t InitSmSm(const TString type) ; + Int_t InitUU(const TString type) ; + Int_t InitPbPb(const TString type) ; + Int_t InitCuCu(const TString type) ; + Int_t InitZrZr(const TString type, int Case) ; + Int_t InitRuRu(const TString type, int Case) ; + + /// Nucleon-Nucleon collision + Bool_t IsCollision(Nucleon* nucleon0, Nucleon* nucleon1) const ; + + /// Utilities + const Char_t* GetName(const UInt_t massNumber) const ; /// Mass number -> nucleus name + Double_t GetInelasticNNCrossSection(const Double_t energy, const TString type) const ; + void GetRThetaPhi(const UInt_t inucleus, + Double_t& r, Double_t& theta, Double_t& phi) const ; /// Arguments are outputs, not inputs + + /// Do smearing (either hard-core or gaussian depending on the switch) + void Smearing(Double_t& r, Double_t& theta, Double_t& phi) const ; /// NOTE: (r,theta,phi) is output + + /// Participant eccentricity: eps_{part;n} = sqrt(q_{x;n}^2 + q_{y;n}^2)/r_t^2 + /// q_{x;n} = + /// q_{y;n} = + /// r_T = sqrt(x_{part}^2 + y_{part}^2) + /// phi_part is the azimth of nucleons with respect to the participant plane + // + // TGraph::GetY()[0] + // TGraph::GetY()[1] + // TGraph::GetY()[2] n * Psi = tan^{-1}(q_{y;n}, q_{x;n}) + // TGraph::GetY()[3] eps_{part;n} + TGraph* GetParticipantEccentricity(const Double_t order, const Double_t sumx, const Double_t sumy, + const Double_t sumw, const UInt_t weightId) const ; + + //____________________________________________________________________________________________________ + // Data members + + // For collision profile + enum { + mkHardCoreProfile = 0, + mkGaussianProfile = 1 + }; + + // Version control + static const UInt_t mVersion ; + + const Double_t mEnergy ; /// sqrt(sNN) + const TString mOutputFileName ; /// Output filename + Double_t mInelasticNNCrossSection ; /// Inelastic NN cross section + + UInt_t mDebug ; /// Debug flag + + // Switches + Double_t mRepulsionDistance ; /// Repulsion distance between nucleons (default is 0fm) + + // NOTE: Only one smearing method can be applied + // Another option will be switched off when one turn on one of them + Bool_t mHardCoreSmearing ; /// true -> smear nucleons by step function with sigmaNN + /// false -> Use original position (default) + Bool_t mGaussianSmearing ; /// true -> smear nucleons by gaussian distribution with fixed sigma + /// false -> Use original position (default) + UInt_t mCollisionProfile ; /// Collision profile flag (mkHardCoreProfile=0, mkGaussianProfile=1) + + UInt_t mMode ; /// 0:default, 1:large npp (small x), 2:small npp (large x) + Bool_t mIsDeformed[2] ; /// Deformation flag (default is false, spherical nuclei) + + StCentralityMaker* mCentralityMaker ; /// For multiplicity + std::vector mNucleons[2] ; /// Nucleons + TF1* mfWoodsSaxon[2] ; /// Woods-saxon density profile for spherical nuclei + TF2* mfWoodsSaxon2D[2] ; /// Woods-saxon density profile for deformed nuclei + + UInt_t mNeventsThrow ; /// Number of all events + UInt_t mNeventsAccept ; /// Number of accepted events (Ncoll>0) + TTree* mHeader ; /// Output ROOT tree (store constant info., R, d, sigma etc) + + // Output data in tree + StGlauberTree* mGlauberTree ; /// MC glauber tree class + + // QA histograms + TH1* mhWoodsSaxon[4] ; /// Woods-saxon checks. First 2 histograms = all nucleons, Last 2 histograms = for replusive nucleons + /// If repulsion distance is 0fm, then First and Last two should be identical + + // Random number generator + TF1* mfB ; /// Impact parameter distribtion p(b) ~ b + TF3* mfHardCore ; /// Hard-core smearing for (x,y,z) of nucleons + TF3* mfGaussian ; /// Gaussian smearing for (x,y,z) of nucleons + + ClassDef(StFastGlauberMcMaker, 1) +}; + +#endif + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberAnalysisMaker.cxx b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberAnalysisMaker.cxx new file mode 100644 index 00000000000..b13f1c713ef --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberAnalysisMaker.cxx @@ -0,0 +1,414 @@ +/****************************************************************************** + * $Id: StGlauberAnalysisMaker.cxx,v 1.3 2012/04/25 05:05:08 hmasui Exp $ + * $Log: StGlauberAnalysisMaker.cxx,v $ + * Revision 1.3 2012/04/25 05:05:08 hmasui + * Fix the multiplicity calculation in the analysis maker, use multiplicity from tree. Added higher harmonics. Unit weight for multiplicity related quantities. Use STAR logger. + * + * Revision 1.2 2010/11/21 02:27:56 hmasui + * Add re-weighting. Calculate multiplicity from Npart and Ncoll. Use STAR logger + * + ******************************************************************************/ + +#include +#include + +#include "TError.h" +#include "TFile.h" +#include "TSystem.h" +#include "TTree.h" +#include "TSystem.h" + +#include "StMessMgr.h" +#include "StCentralityMaker/StCentrality.h" +#include "StCentralityMaker/StCentralityMaker.h" +#include "StCentralityMaker/StNegativeBinomial.h" +#include "StGlauberConstUtilities.h" +#include "StGlauberHistogramMaker.h" +#include "StGlauberCumulantHistogramMaker.h" +#include "StGlauberTree/StGlauberTree.h" +#include "StGlauberUtilities/StGlauberUtilities.h" + +#include "StGlauberAnalysisMaker.h" + +using std::fstream ; +using std::map ; +using std::pair ; + +ClassImp(StGlauberAnalysisMaker) + + const TString StGlauberAnalysisMaker::mTypeName[] = { + "default", "small", "large", "smallXsec", "largeXsec", "gauss", + "smallNpp", "largeNpp", "smallTotal", "largeTotal", + "lowrw", "highrw" + }; + +const TString StGlauberAnalysisMaker::mDescription[] = { + "default", + "small R, large d", + "large R, small d", + "small #sigma_{NN}", + "large #sigma_{NN}", + // "gray disk overlap", + "gaussian overlap", + "small n_{pp}, large x", + "large n_{pp}, small x", + "-5\% total cross section", + "+5\% total cross section", + "+2(-2) sigma p0 (p1) parameter for re-weighting", + "-2(+2) sigma p0 (p1) parameter for re-weighting" +}; + +// const UInt_t StGlauberAnalysisMaker::mCentralityId[] = { +// 0, // "default", +// 0, // "small R, large d", +// 0, // "large R, small d", +// 0, // "small #sigma_{NN}", +// 0, // "large #sigma_{NN}", +// 0, // "gray disk overlap", +// 0, // "gaussian overlap", +// 1, // "small n_{pp}, large x", +// 2, // "large n_{pp}, small x", +// 0, // "-5% total cross section", +// 0 // "+5% total cross section" +// }; + +//____________________________________________________________________________________________________ +// Default constructor +StGlauberAnalysisMaker::StGlauberAnalysisMaker(const TString type, const TString system, const TString outputFileName, + const TString tableDir) +: mType(type), mOutputFile(0), mOutputFileName(outputFileName), + mUnitWeight(kFALSE), // Unit weight flag (default is false, use multiplicity weight) + mReweighting(kFALSE) // Re-weighting flag (default is false, no re-weighting correction) +{ + // Init StGlauberTree (read mode) + mGlauberTree = new StGlauberTree(0); + + // System should be like "AuAu_200GeV" (case insensitive) + mCentralityMaker = new StCentralityMaker(system) ; + + + // for(Int_t it=0; it(mTypeName[it], mCentralityId[it]) ); + // } + + // Make sure table directory exists (0=directory exists) + if ( gSystem->AccessPathName(tableDir.Data()) == 1 ){ + Error("StGlauberAnalysisMaker", "can't find directory %s", tableDir.Data()); + assert(0); + } + + mNevents = 0 ; + + Init(tableDir) ; +} + +//____________________________________________________________________________________________________ +// Default destructor +StGlauberAnalysisMaker::~StGlauberAnalysisMaker() +{ + if(mCentralityMaker) delete mCentralityMaker ; + if(mGlauberTree) delete mGlauberTree ; +} + +//____________________________________________________________________________________________________ +Bool_t StGlauberAnalysisMaker::Init(const TString tableDir) +{ + /// Skip if output ROOT file has already opened + if(mOutputFile) return kTRUE ; + + mOutputFile = TFile::Open(mOutputFileName, "recreate"); + if(!mOutputFile || !mOutputFile->IsOpen() || mOutputFile->IsZombie()){ + Error("StGlauberAnalysisMaker::Init", "can't open %s", mOutputFileName.Data()); + assert(0); + } + LOG_INFO << "StGlauberAnalysisMaker::Init Open output ROOT file: " << mOutputFile->GetName() << endm; + + const TString title(mType) ; + mImpactParameter = new StGlauberHistogramMaker("ImpactParameter", title, "impact parameter b (fm)", + StGlauberConstUtilities::GetImpactParameterBin(), 0.0, StGlauberConstUtilities::GetImpactParameterMax()) + ; + + mNpart = new StGlauberHistogramMaker("Npart", title, "N_{part}", + StGlauberConstUtilities::GetNpartBin(), 0.0, StGlauberConstUtilities::GetNpartMax()) + ; + + mNcoll = new StGlauberHistogramMaker("Ncoll", title, "N_{coll}", + StGlauberConstUtilities::GetNcollBin(), 0.0, StGlauberConstUtilities::GetNcollMax()) + ; + + mMultiplicity = new StGlauberHistogramMaker("Multiplicity", title, "Multiplicity", + StGlauberConstUtilities::GetMultiplicityBin(), 0.0, StGlauberConstUtilities::GetMultiplicityMax()) + ; + + // Aera + const Int_t areaBin = 100 ; + const Double_t areaMin = 0.0 ; + const Double_t areaMax = 50.0 ; + mAreaRP = new StGlauberHistogramMaker("AreaRP", title, "#LTS_{RP}#GT", areaBin, areaMin, areaMax); + mAreaPP = new StGlauberHistogramMaker("AreaPP", title, "#LTS_{PP}#GT", areaBin, areaMin, areaMax) ; + + // Eccentricity + const Int_t eccBin = 100 ; + const Double_t eccMin = -1.0 ; + const Double_t eccMax = 1.0 ; + mEccRP = new StGlauberCumulantHistogramMaker("EccRP", title, "#LT#varepsilon_{RP}#GT", eccBin, eccMin, eccMax); + mEccRPM = new StGlauberCumulantHistogramMaker("EccRPM", title, "#LT#varepsilon_{RP}#GT", eccBin, eccMin, eccMax); + + for(Int_t io=0; io<3; io++){ + mEccPP[io] = new StGlauberCumulantHistogramMaker(Form("EccPP_%d", io), title, Form("#LT#varepsilon_{PP,%d}#GT", io+2), eccBin/2, 0.0, eccMax) ; + mEccPPM[io] = new StGlauberCumulantHistogramMaker(Form("EccPPM_%d", io), title, Form("#LT#varepsilon_{PP,%d}#GT", io+2), eccBin/2, 0.0, eccMax) ; + } + + // Set table output directory + mImpactParameter->SetTableDirectory(tableDir); + mNpart->SetTableDirectory(tableDir); + mNcoll->SetTableDirectory(tableDir); + mMultiplicity->SetTableDirectory(tableDir); + mAreaRP->SetTableDirectory(tableDir); + mAreaPP->SetTableDirectory(tableDir); + mEccRP->SetTableDirectory(tableDir); + mEccRPM->SetTableDirectory(tableDir); + for(Int_t io=0; io<3; io++){ + mEccPP[io]->SetTableDirectory(tableDir); + mEccPPM[io]->SetTableDirectory(tableDir); + } + + mOutputFile->GetList()->Sort() ; + + return kTRUE ; +} + +//____________________________________________________________________________________________________ +Bool_t StGlauberAnalysisMaker::Make() +{ + /// Set x-axis + if(mDebug){ + LOG_INFO << "StGlauberAnalysisMaker::Make Set x-axis" << endm; + } + + const UInt_t centId = 0 ; // Fix default (no need to change id unless one calculate multiplicity here) + // const UInt_t centId = mCentralityIdMap[mType] ; // 0:default, 1:small npp (large x), 2:large npp (small x) + + // Calculate multiplicity here + // in order to deal with the change of centrality bins + const Double_t multiplicity = mGlauberTree->GetMultiplicity() ; + // const Double_t npart = static_cast(mGlauberTree->GetNpart()) ; + // const Double_t ncoll = static_cast(mGlauberTree->GetNcoll()) ; + // const Double_t multiplicity = mCentralityMaker->GetNegativeBinomial()->GetMultiplicity(npart, ncoll); + + // Re-weighting correction + const Double_t reweighting = (mReweighting) ? mCentralityMaker->GetCentrality(centId)->GetReweighting(multiplicity) : 1.0 ; + + /// Discard events if mReweighting is true && the following condition is satisfied + if( mReweighting && StGlauberUtilities::instance()->GetUniform() > reweighting) return kFALSE ; + + // mImpactParameter->SetXaxis(*mGlauberTree, *(mCentralityMaker->GetCentrality(centId)), mType); + // mNpart ->SetXaxis(*mGlauberTree, *(mCentralityMaker->GetCentrality(centId)), mType); + // mNcoll ->SetXaxis(*mGlauberTree, *(mCentralityMaker->GetCentrality(centId)), mType); + // mMultiplicity ->SetXaxis(*mGlauberTree, *(mCentralityMaker->GetCentrality(centId)), mType); + // mAreaRP ->SetXaxis(*mGlauberTree, *(mCentralityMaker->GetCentrality(centId)), mType); + // mAreaPP ->SetXaxis(*mGlauberTree, *(mCentralityMaker->GetCentrality(centId)), mType); + // mEccRP ->SetXaxis(*mGlauberTree, *(mCentralityMaker->GetCentrality(centId)), mType); + // mEccRPM ->SetXaxis(*mGlauberTree, *(mCentralityMaker->GetCentrality(centId)), mType); + mImpactParameter->SetXaxis(*mGlauberTree, *mCentralityMaker, mType); + mNpart ->SetXaxis(*mGlauberTree, *mCentralityMaker, mType); + mNcoll ->SetXaxis(*mGlauberTree, *mCentralityMaker, mType); + mMultiplicity ->SetXaxis(*mGlauberTree, *mCentralityMaker, mType); + mAreaRP ->SetXaxis(*mGlauberTree, *mCentralityMaker, mType); + mAreaPP ->SetXaxis(*mGlauberTree, *mCentralityMaker, mType); + mEccRP ->SetXaxis(*mGlauberTree, *mCentralityMaker, mType); + mEccRPM ->SetXaxis(*mGlauberTree, *mCentralityMaker, mType); + + for(Int_t io=0; io<3; io++){ + // mEccPP[io]->SetXaxis(*mGlauberTree, *(mCentralityMaker->GetCentrality(centId)), mType); + // mEccPPM[io]->SetXaxis(*mGlauberTree, *(mCentralityMaker->GetCentrality(centId)), mType); + mEccPP[io]->SetXaxis(*mGlauberTree, *mCentralityMaker, mType); + mEccPPM[io]->SetXaxis(*mGlauberTree, *mCentralityMaker, mType); + } + + if(mDebug){ + LOG_INFO << "StGlauberAnalysisMaker::Make Start fill: " << endm; + } + + /// Fill impact parameter, Npart, Ncoll, ... + const Double_t weight = (mUnitWeight) ? 1.0 // Unit weight (event-wise average) + : static_cast( multiplicity ) ; // Multiplicity weight (particle-wise average) + + // Unit weight + mImpactParameter->Fill(mGlauberTree->GetB(), 1.0) ; + mNpart->Fill(mGlauberTree->GetNpart(), 1.0) ; + mNcoll->Fill(mGlauberTree->GetNcoll(), 1.0) ; + mMultiplicity->Fill(multiplicity, 1.0) ; + + if(mDebug){ + LOG_INFO << "StGlauberAnalysisMaker::Make reweighting = " << reweighting + << ", b = " << mGlauberTree->GetB() << " fm" + << ", npart = " << mGlauberTree->GetNpart() + << ", ncoll = " << mGlauberTree->GetNcoll() + << ", mult = " << multiplicity + << endm ; + } + + const Double_t areaRP = mGlauberTree->GetSRP(0) ; + mAreaRP->Fill(areaRP, weight) ; + + const Double_t areaPP = mGlauberTree->GetSPP(0) ; + if( areaPP > -9999. ) mAreaPP->Fill(areaPP, weight) ; + + // LOG_INFO << areaRP << " " << areaPP << endm; + + // Reaction plane + const Double_t eccRP = mGlauberTree->GetEccRP2(0) ; + if( eccRP > -9999.) mEccRP->Fill(eccRP, weight) ; + + const Double_t eccRPM = mGlauberTree->GetEccRP2(2) ; + if( eccRP > -9999.) mEccRPM->Fill(eccRPM, weight) ; + + // Participant plane + for(Int_t io=0; io<3; io++){ + Double_t eccPP = -9999. ; + Double_t eccPPM = -9999. ; + if( io == 0 ){ eccPP = mGlauberTree->GetEccPP2(0) ; eccPPM = mGlauberTree->GetEccPP2(2) ; } + else if( io == 1 ){ eccPP = mGlauberTree->GetEccPP3(0) ; eccPPM = mGlauberTree->GetEccPP3(2) ; } + else if( io == 2 ){ eccPP = mGlauberTree->GetEccPP4(0) ; eccPPM = mGlauberTree->GetEccPP4(2) ; } + + if( eccPP > -9999.) mEccPP[io]->Fill(eccPP, weight) ; + if( eccPPM > -9999.) mEccPPM[io]->Fill(eccPPM, weight) ; + } + + return kTRUE ; +} + +//____________________________________________________________________________________________________ +Bool_t StGlauberAnalysisMaker::RunFile(const TString inputFileName) +{ + mGlauberTree->Open(inputFileName); + + const Int_t nevents = mGlauberTree->GetEntries() ; + LOG_INFO << Form("StGlauberAnalysisMaker::RunFile Process %10d events ...", nevents) << endm; + + for(Int_t ievent=0; ieventClear() ; + + if(mDebug){ + LOG_INFO << "StGlauberAnalysisMaker::RunFile Event# = " << ievent << endm; + } + + mGlauberTree->GetEntry(ievent); + + /// Make one event + const Bool_t isEventOk = Make() ; + if(isEventOk) mNevents++; + + + /// Debugging message + if( ievent%1000 == 0 ){ + LOG_INFO << "StGlauberAnalysisMaker::RunFile "; + 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)", + mNevents, ievent, mGlauberTree->GetNpart(), mGlauberTree->GetNcoll(), mGlauberTree->GetB(), + mGlauberTree->GetMultiplicity(), + mCentralityMaker->GetCentrality()->GetCentrality(mGlauberTree->GetMultiplicity()), + mGlauberTree->GetSumX2(0), mGlauberTree->GetSumX(0) + ) + << endm; + } + } + + /// Clean up + if(mDebug){ + LOG_INFO << "StGlauberAnalysisMaker::RunFile Close input file" << endm; + } + mGlauberTree->Close() ; + + return kTRUE ; +} + +//____________________________________________________________________________________________________ +Bool_t StGlauberAnalysisMaker::Run(const TString inputFileList) +{ + ifstream fin(inputFileList.Data()); + if(!fin){ + Error("StGlauberAnalysisMaker::run", "can't find %s", inputFileList.Data()); + assert(fin); + } + LOG_INFO << "StGlauberAnalysisMaker::Run Open file list: " << inputFileList.Data() << endm; + + TString file ; + while ( fin >> file ){ + RunFile(file); + } + + return kTRUE ; +} + +//____________________________________________________________________________________________________ +Bool_t StGlauberAnalysisMaker::Finish() +{ + /// Finish analysis + /// 1. Correct particle-wise weight + /// 2. Write text table + /// 3. Write graph into outputs + + mOutputFile->cd(); + mImpactParameter->Finish(mType) ; + mNpart->Finish(mType) ; + mNcoll->Finish(mType) ; + mMultiplicity->Finish(mType) ; + mAreaRP->Finish(mType) ; + mAreaPP->Finish(mType) ; + mEccRP->Finish(mType) ; + mEccRPM->Finish(mType) ; + for(Int_t io=0; io<3; io++){ + mEccPP[io]->Finish(mType) ; + mEccPPM[io]->Finish(mType) ; + } + + mOutputFile->GetList()->Sort() ; + + /// Write/Close output ROOT file + LOG_INFO << "StGlauberAnalysisMaker::Finish Write/Close output file: " << mOutputFile->GetName() << endm; + mOutputFile->Write(); + mOutputFile->Close(); + + return kTRUE ; +} + +//____________________________________________________________________________________________________ +void StGlauberAnalysisMaker::UnitWeightOn() +{ + mUnitWeight = kTRUE ; + LOG_INFO << "StGlauberAnalysisMaker::UnitWeightOn Use unit weight" << endm ; +} + +//____________________________________________________________________________________________________ +void StGlauberAnalysisMaker::ReweightingOn() +{ + mReweighting = kTRUE ; + LOG_INFO << "StGlauberAnalysisMaker::ReweightingOn Apply re-weighting correction" << endm; +} + +//____________________________________________________________________________________________________ +void StGlauberAnalysisMaker::DebugOn() +{ + mDebug = 1 ; + + mImpactParameter->DebugOn() ; + mNpart->DebugOn() ; + mNcoll->DebugOn() ; + mMultiplicity->DebugOn() ; + mAreaRP->DebugOn() ; + mAreaPP->DebugOn() ; + mEccRP->DebugOn() ; + mEccRPM->DebugOn() ; + for(Int_t io=0; io<3; io++){ + mEccPP[io]->DebugOn() ; + mEccPPM[io]->DebugOn() ; + } + + LOG_INFO << "StGlauberAnalysisMaker::DebugOn Print debugging messages" << endm; +} + + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberAnalysisMaker.h b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberAnalysisMaker.h new file mode 100644 index 00000000000..9dafb6ec6b9 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberAnalysisMaker.h @@ -0,0 +1,112 @@ +/****************************************************************************** + * $Id: StGlauberAnalysisMaker.h,v 1.3 2012/04/25 05:05:08 hmasui Exp $ + * $Log: StGlauberAnalysisMaker.h,v $ + * Revision 1.3 2012/04/25 05:05:08 hmasui + * Fix the multiplicity calculation in the analysis maker, use multiplicity from tree. Added higher harmonics. Unit weight for multiplicity related quantities. Use STAR logger. + * + * Revision 1.2 2010/11/21 02:27:56 hmasui + * Add re-weighting. Calculate multiplicity from Npart and Ncoll. Use STAR logger + * + ******************************************************************************/ +//==================================================================================================== +// StGlauberAnalysisMaker class +// Analyze outputs from Fast MC Glauber simulation by StFastGlauberMcMaker +// +// In order to make histograms from the output tree, you can do +// root4star -b +// [0] .L doAnalysisMaker.C +// [1] doAnalysisMaker("AuAu_200GeV", "file.list", "ana.root", "default") +// where first argument is the system+energy string, +// second argument is the input file list, +// third argument is the output file name +// and fourth argument is type. The available type can be found by +// StFastGlauberMcMaker::Print("type") +// +// The system+energy string should be like "%2s%2s_%dGeV", +// where the system name should contain 2+2 characters from +// each nucleus and energy should be integer (e.x. 7.7 -> 7) +// +// Reweighting correction can be applied by +// StGlauberAnalysisMaker::ReweightingOn() +// +// You can see the debugging messages by +// StGlauberAnalysisMaker::DebugOn() +// in case you need further checks of outputs +// +//==================================================================================================== + + +#ifndef __StGlauberAnalysisMaker_h__ +#define __StGlauberAnalysisMaker_h__ + +class TBranch ; +class TFile ; +class TTree ; +class StCentralityMaker ; +class StGlauberHistogramMaker ; +class StGlauberCumulantHistogramMaker ; +class StGlauberTree ; +//#include +#include "TString.h" + +//____________________________________________________________________________________________________ +// Class StGlauberAnalysisMaker: Analyze initial conditions +class StGlauberAnalysisMaker { + public: + StGlauberAnalysisMaker(const TString type="default", + const TString system = "AuAu_200GeV", const TString outputFileName = "ana.root", + const TString tableDir = "./"); /// Default constructor + virtual ~StGlauberAnalysisMaker(); /// Default destructor + + Bool_t Make() ; /// Make one event + Bool_t RunFile(const TString inputFileName = "icmaker.root") ; /// Loop over all events in one file + Bool_t Run(const TString inputFileList) ; /// Loop over all file lists + Bool_t Finish() ; /// Finish analysis + + void UnitWeightOn() ; /// Use unit weight instead of multiplicity weight + void ReweightingOn() ; /// Apply re-weighting correction + void DebugOn() ; /// Print debugging messages + + private: + // Functions + Bool_t Init(const TString tableDir); /// Initialization of histograms + + // Data members + enum { + mNMaxType = 12 // Maximum number of types + }; + + static const TString mTypeName[mNMaxType] ; /// Available types + static const TString mDescription[mNMaxType] ; /// Description of types + // static const UInt_t mCentralityId[mNMaxType] ; /// Centrality id for corresponding type + + const TString mType ; /// Type (see above) + TFile* mOutputFile ; /// Output ROOT file + TString mOutputFileName ; /// Output ROOT filename + Bool_t mUnitWeight ; /// Unit weight flag + Bool_t mReweighting ; /// Reweighting flag + UInt_t mDebug ; /// Debug flag + UInt_t mNevents ; /// Number of accepted events + + // std::map mCentralityIdMap ; /// Centrality id for each node + + StGlauberTree* mGlauberTree ; /// Input ROOT tree (read mode) + StCentralityMaker* mCentralityMaker ; /// Centrality maker + + // Output histograms + StGlauberHistogramMaker* mImpactParameter ; /// Impact parameter + StGlauberHistogramMaker* mNpart ; /// Npart + StGlauberHistogramMaker* mNcoll ; /// Ncoll + StGlauberHistogramMaker* mMultiplicity ; /// Multiplicity (uncorrected) + StGlauberHistogramMaker* mAreaRP ; /// Reaction plane area + StGlauberHistogramMaker* mAreaPP ; /// Participant plane area + StGlauberCumulantHistogramMaker* mEccRP ; /// Reaction plane eccentricity (2nd order) Npart weight + StGlauberCumulantHistogramMaker* mEccPP[3] ; /// Participant plane eccentricity (2nd, 3rd and 4th) Npart weight + StGlauberCumulantHistogramMaker* mEccRPM ; /// Reaction plane eccentricity (2nd order) multiplicity weight + StGlauberCumulantHistogramMaker* mEccPPM[3] ; /// Participant plane eccentricity (2nd, 3rd and 4th) multiplicity weight + + ClassDef(StGlauberAnalysisMaker, 0) +}; + +#endif + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberConstUtilities.cxx b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberConstUtilities.cxx new file mode 100644 index 00000000000..ec9cc7bd193 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberConstUtilities.cxx @@ -0,0 +1,126 @@ +/****************************************************************************** + * $Id: StGlauberConstUtilities.cxx,v 1.2 2012/04/25 04:55:04 hmasui Exp $ + * $Log: StGlauberConstUtilities.cxx,v $ + * Revision 1.2 2012/04/25 04:55:04 hmasui + * Expand centrality bins + * +******************************************************************************/ + +#include +#include "TError.h" +#include "StGlauberConstUtilities.h" + +//____________________________________________________________________________________________________ +namespace StGlauberConstUtilities { + // Impact parameter + const UInt_t mBBin = 400 ; + const Double_t mBMax = 20.0 ; + + // Npart + const UInt_t mNpartBin = 500 ; + const Double_t mNpartMax = 500 ; + + // Ncoll + const UInt_t mNcollBin = 1800 ; + const Double_t mNcollMax = 1800 ; + + // Multiplicity + const UInt_t mMultiplicityBin = 2000 ; + const Double_t mMultiplicityMax = 2000 ; + + // Centrality + const UInt_t mCentralityBin = 36 ; + const Double_t mCentralityMin[] = { 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, + 0, 10, 20, 30, 40, 50, 60, 70, 10, 40, 0, 20, 40, 60, 20, 50, 0, 0, 7.5 }; + const Double_t mCentralityMax[] = { 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 100, + 10, 20, 30, 40, 50, 60, 70, 80, 40, 80, 20, 40, 60, 80, 50, 80, 60, 80, 30 }; +}; + +//____________________________________________________________________________________________________ +const UInt_t StGlauberConstUtilities::GetImpactParameterBin() +{ + return mBBin ; +} + +//____________________________________________________________________________________________________ +const Double_t StGlauberConstUtilities::GetImpactParameterMax() +{ + return mBMax ; +} + +//____________________________________________________________________________________________________ +const UInt_t StGlauberConstUtilities::GetNpartBin() +{ + return mNpartBin ; +} + +//____________________________________________________________________________________________________ +const Double_t StGlauberConstUtilities::GetNpartMax() +{ + return mNpartMax ; +} + +//____________________________________________________________________________________________________ +const UInt_t StGlauberConstUtilities::GetNcollBin() +{ + return mNcollBin ; +} + +//____________________________________________________________________________________________________ +const Double_t StGlauberConstUtilities::GetNcollMax() +{ + return mNcollMax ; +} + +//____________________________________________________________________________________________________ +const UInt_t StGlauberConstUtilities::GetMultiplicityBin() +{ + return mMultiplicityBin ; +} + +//____________________________________________________________________________________________________ +const Double_t StGlauberConstUtilities::GetMultiplicityMax() +{ + return mMultiplicityMax ; +} + +//____________________________________________________________________________________________________ +const UInt_t StGlauberConstUtilities::GetCentralityBin() +{ + return mCentralityBin ; +} + +//____________________________________________________________________________________________________ +const Double_t StGlauberConstUtilities::GetCentralityMin(const UInt_t icent) +{ + if( icent >= mCentralityBin ){ + Error("StGlauberConstUtilities::GetCentralityMin", "Unknown centrality id, icent=%3d", icent); + assert(0); + } + + return mCentralityMin[icent] ; +} + +//____________________________________________________________________________________________________ +const Double_t StGlauberConstUtilities::GetCentralityMax(const UInt_t icent) +{ + if( icent >= mCentralityBin ){ + Error("StGlauberConstUtilities::GetCentralityMax", "Unknown centrality id, icent=%3d", icent); + assert(0); + } + + return mCentralityMax[icent] ; +} + + +//____________________________________________________________________________________________________ +const Bool_t StGlauberConstUtilities::IsCentralityOk(const UInt_t icent, const Double_t centrality) +{ + if(icent>=mCentralityBin){ + Error("StGlauberConstUtilities::IsCentralityOk", "Unknown centrality bin, icent=%3d", icent); + assert(0); + } + + return (centrality >= mCentralityMin[icent] && centrality < mCentralityMax[icent] ); +} + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberConstUtilities.h b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberConstUtilities.h new file mode 100644 index 00000000000..955449615a7 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberConstUtilities.h @@ -0,0 +1,35 @@ + +#ifndef __StGlauberConstUtilities_h__ +#define __StGlauberConstUtilities_h__ + +#include "Rtypes.h" + +//____________________________________________________________________________________________________ +// namespace StGlauberConstUtilities: Utilities for constant variables in MC Glauber +namespace StGlauberConstUtilities { + /// Impact parameter + const UInt_t GetImpactParameterBin() ; // Impact parameter bin + const Double_t GetImpactParameterMax() ; // Maximum impact parameter + + /// Npart + const UInt_t GetNpartBin() ; // Npart bin + const Double_t GetNpartMax() ; // Maximum Npart + + /// Ncoll + const UInt_t GetNcollBin() ; // Ncoll bin + const Double_t GetNcollMax() ; // Maximum Ncoll + + /// Multiplicity + const UInt_t GetMultiplicityBin() ; // Multiplicity bin + const Double_t GetMultiplicityMax() ; // Maximum multiplicity + + /// Centrality + const UInt_t GetCentralityBin() ; // centrality bin + const Double_t GetCentralityMin(const UInt_t icent) ; // Minimum centrality + const Double_t GetCentralityMax(const UInt_t icent) ; // Maximum centrality + + const Bool_t IsCentralityOk(const UInt_t icent, const Double_t centrality) ; // Centrality check +}; + +#endif + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberCumulantHistogramMaker.cxx b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberCumulantHistogramMaker.cxx new file mode 100644 index 00000000000..9482d9f9fdc --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberCumulantHistogramMaker.cxx @@ -0,0 +1,261 @@ +/****************************************************************************** + * $Id: StGlauberCumulantHistogramMaker.cxx,v 1.2 2012/04/25 05:03:31 hmasui Exp $ + * $Log: StGlauberCumulantHistogramMaker.cxx,v $ + * Revision 1.2 2012/04/25 05:03:31 hmasui + * Use STAR logger + * +******************************************************************************/ + +#include +#include +#include + +#include "StMessMgr.h" + +#include "TH1.h" +#include "TMath.h" +#include "TProfile.h" + +#include "StGlauberCumulantHistogramMaker.h" + +ClassImp(StGlauberCumulantHistogramMaker) + +using std::ofstream ; +using std::vector ; + +//____________________________________________________________________________________________________ +StGlauberCumulantHistogramMaker::StGlauberCumulantHistogramMaker(const TString name, const TString title, const TString ytitle, + const Int_t ybin, const Double_t ymin, const Double_t ymax, const Bool_t isUnitWeight) + : StGlauberHistogramMaker(name, title, ytitle, ybin, ymin, ymax, isUnitWeight) +{ + Init() ; +} + +//____________________________________________________________________________________________________ +// Default destructor +StGlauberCumulantHistogramMaker::~StGlauberCumulantHistogramMaker() +{ + Reset() ; +} + +//____________________________________________________________________________________________________ +void StGlauberCumulantHistogramMaker::Init() +{ + /// Initialize histograms in StGlauberHistogramMaker first + + /// Initialize histograms + for(UInt_t io=0; io::iterator iter = mProfileCumulant[io].begin(); + iter != mProfileCumulant[io].end(); iter++){ + TProfile* h = (TProfile*) (*iter); + LOG_INFO << Form("StGlauberCumulantHistogramMaker::Init Initialize TProfile: %s (%s), x:(bin, min, max) = (%4d, %1.2f, %1.2f)", + h->GetName(), h->GetTitle(), h->GetNbinsX(), h->GetXaxis()->GetXmin(), h->GetXaxis()->GetXmax()) + << endm; + } + + }// cumulant order loop + +} + +//____________________________________________________________________________________________________ +void StGlauberCumulantHistogramMaker::Reset() +{ + StGlauberHistogramMaker::Reset() ; + + for(UInt_t io=0; ioClone() ; + TH1* h1raw4 = (TH1D*) mHistogram1DCumulant[1][ix]->Clone() ; + TH1* h1raw6 = (TH1D*) mHistogram1DCumulant[2][ix]->Clone() ; + + for(Int_t i=0; iGetNbinsX(); i++){ + const Double_t val[] = { h1raw2->GetBinContent(i+1), h1raw4->GetBinContent(i+1), h1raw6->GetBinContent(i+1) } ; + const Double_t err[] = { h1raw2->GetBinError(i+1), h1raw4->GetBinError(i+1), h1raw6->GetBinError(i+1) } ; + + for(Int_t io=0; ioSetBinContent(i+1, GetCumulant(order, val)); + mHistogram1DCumulant[io][ix]->SetBinError(i+1, GetCumulantError(order, val, err)); + }// cumulant order loop + } + + delete h1raw2 ; + delete h1raw4 ; + delete h1raw6 ; + }// x-axis loop + + // Write table + for(Int_t io=0; io0.0) ? 1.0 : -1.0 ; + + return TMath::Power(sign*raw, 0.25) ; +} + +//____________________________________________________________________________________________________ +Double_t StGlauberCumulantHistogramMaker::Get6thOrderCumulant(const Double_t c2, const Double_t c4, const Double_t c6) const +{ + const Double_t raw = 0.25*(c6 - 9.0*c4*c2 + 12.0*c2*c2*c2) ; + const Double_t sign = (raw>0.0) ? 1.0 : -1.0 ; + + return TMath::Power(sign*raw, 1.0/6.0) ; +} + +//____________________________________________________________________________________________________ +Double_t StGlauberCumulantHistogramMaker::GetNthOrderCumulantError(const Double_t order, const Double_t val, const Double_t err) const +{ + if( val == 0.0 ) return 0.0 ; + + return TMath::Abs(order) * TMath::Power(TMath::Abs(val), order-1.0) * err ; +} + +//____________________________________________________________________________________________________ +Double_t StGlauberCumulantHistogramMaker::Get2ndOrderCumulantError(const Double_t c2, const Double_t c2error) const +{ + return GetNthOrderCumulantError(0.5, c2, c2error) ; +} + +//____________________________________________________________________________________________________ +Double_t StGlauberCumulantHistogramMaker::Get4thOrderCumulantError(const Double_t c2, const Double_t c4, + const Double_t c2error, const Double_t c4error) const +{ + const Double_t cumulant = Get4thOrderCumulant(c2, c4) ; + const Double_t error = TMath::Sqrt(16.0*c2*c2*c2error*c2error + c4error*c4error) ; + + return GetNthOrderCumulantError(0.25, cumulant, error) ; +} + +//____________________________________________________________________________________________________ +Double_t StGlauberCumulantHistogramMaker::Get6thOrderCumulantError(const Double_t c2, const Double_t c4, const Double_t c6, + const Double_t c2error, const Double_t c4error, const Double_t c6error) const +{ + const Double_t cumulant = Get6thOrderCumulant(c2, c4, c6) ; + const Double_t error1 = (c4!=0.0 && c2!=0.0) ? + 9.0 * TMath::Abs(c4*c2) * TMath::Sqrt(TMath::Power(c4error/c4, 2.0) + TMath::Power(c2error/c2, 2.0)) : 0.0; + const Double_t error2 = 12.0 * 3.0 * c2*c2*c2error ; + const Double_t error = 0.25 * TMath::Sqrt(c6error*c6error + error1*error1 + error2*error2) ; + + return GetNthOrderCumulantError(1.0/6.0, cumulant, error) ; +} + +//____________________________________________________________________________________________________ +Double_t StGlauberCumulantHistogramMaker::GetCumulant(const UInt_t order, const Double_t* val) const +{ + /// val array should contain val[] = {c2, c4, c6, ...} + if(!val) return -9999. ; + + const Double_t invalid = -9999. ; + + switch ( order ){ + case 2: // 2nd order cumulant + return (val[0]<0.0) ? invalid : TMath::Sqrt(val[0]) ; + + case 4: // 4th order cumulant + return Get4thOrderCumulant(val[0], val[1]) ; + + case 6: // 6th order cumulant + return Get6thOrderCumulant(val[0], val[1], val[2]) ; + + default: + Error("StGlauberCumulantHistogramMaker::GetCumulant", "Unknown order, order=%3d. abort", order); + assert(0); + } + + return -9999. ; +} + +//____________________________________________________________________________________________________ +Double_t StGlauberCumulantHistogramMaker::GetCumulantError(const UInt_t order, const Double_t* val, const Double_t* err) const +{ + /// val and err array should contain val[] = {c2, c4, c6, ...}, err[] = {c2error, c4error, c6error, ...} + if(!val) return -9999. ; + if(!err) return -9999. ; + + switch ( order ){ + case 2: // 2nd order cumulant + return Get2ndOrderCumulantError(val[0], err[0]); + + case 4: // 4th order cumulant + return Get4thOrderCumulantError(val[0], val[1], err[0], err[1]) ; + + case 6: // 6th order cumulant + return Get6thOrderCumulantError(val[0], val[1], val[2], err[0], err[1], err[2]) ; + + default: + Error("StGlauberCumulantHistogramMaker::GetCumulantError", "Unknown order, order=%3d. abort", order); + assert(0); + } + + return -9999. ; +} + + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberCumulantHistogramMaker.h b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberCumulantHistogramMaker.h new file mode 100644 index 00000000000..8b9f6fad02d --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberCumulantHistogramMaker.h @@ -0,0 +1,65 @@ +/****************************************************************************** + * $Id: StGlauberCumulantHistogramMaker.h,v 1.2 2012/04/25 05:03:31 hmasui Exp $ + * $Log: StGlauberCumulantHistogramMaker.h,v $ + * Revision 1.2 2012/04/25 05:03:31 hmasui + * Use STAR logger + * +******************************************************************************/ + +#ifndef __StGlauberCumulantHistogramMaker_h__ +#define __StGlauberCumulantHistogramMaker_h__ + +#include +#include "StGlauberHistogramMaker.h" + +//____________________________________________________________________________________________________ +// Class StGlauberCumulantHistogramMaker: Cumulant histogram maker, mainly for eccentricity +class StGlauberCumulantHistogramMaker : public StGlauberHistogramMaker { + public: + // Fixed bin width, make histograms up to 6th order cumulant + StGlauberCumulantHistogramMaker(const TString name, + const TString title, const TString ytitle, + const Int_t ybin, const Double_t ymin, const Double_t ymax, + const Bool_t isUnitWeight=kTRUE); + + ~StGlauberCumulantHistogramMaker() ; /// Default destructor + + void Init() ; + void Fill(const Double_t y, const Double_t weight) ; + + /// Do correction for weight, and write table in the current directory + /// and calculate cumulants of the stored quantity + /// table name will be: table_{mName}_vs_centrality.txt + /// table contains + /// + void Finish(const TString type) ; + + private: + // Functions + void Reset() ; + + UInt_t GetOrder(const UInt_t io) const ; + Double_t Get4thOrderCumulant(const Double_t c2, const Double_t c4) const ; + Double_t Get6thOrderCumulant(const Double_t c2, const Double_t c4, const Double_t c6) const ; + + Double_t GetNthOrderCumulantError(const Double_t order, const Double_t val, const Double_t err) const ; + Double_t Get2ndOrderCumulantError(const Double_t c2, const Double_t c2error) const ; + Double_t Get4thOrderCumulantError(const Double_t c2, const Double_t c4, const Double_t c2error, const Double_t c4error) const ; + Double_t Get6thOrderCumulantError(const Double_t c2, const Double_t c4, const Double_t c6, + const Double_t c2error, const Double_t c4error, const Double_t c6error) const ; + + Double_t GetCumulant(const UInt_t order, const Double_t* val) const ; /// Get n-th order (mOrder) cumulant of val + Double_t GetCumulantError(const UInt_t order, const Double_t* val, const Double_t* err) const ; /// Get n-th order (mOrder) cumulant error + + // Data members + enum { + mNOrder = 3 /// Up to 6-th order cumulant + }; + + std::vector mProfileCumulant[mNOrder] ; /// Cumulant profile histogram + std::vector mHistogram1DCumulant[mNOrder] ; /// Cumulant 1D histogram + + ClassDef(StGlauberCumulantHistogramMaker, 0) +}; +#endif + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberHistogramMaker.cxx b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberHistogramMaker.cxx new file mode 100644 index 00000000000..d45e85a34c4 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberHistogramMaker.cxx @@ -0,0 +1,452 @@ +/****************************************************************************** + * $Id: StGlauberHistogramMaker.cxx,v 1.2 2012/04/25 05:03:06 hmasui Exp $ + * $Log: StGlauberHistogramMaker.cxx,v $ + * Revision 1.2 2012/04/25 05:03:06 hmasui + * Use StCentralityMaker. Added weight for 2D fill. Use STAR logger instead of iostream + * +******************************************************************************/ + +#include +#include + +#include "TError.h" +#include "TGraphErrors.h" +#include "TH1.h" +#include "TH2.h" +#include "TProfile.h" + +#include "StMessMgr.h" + +//#include "StCentralityMaker/StNegativeBinomial.h" +#include "StCentralityMaker/StCentralityMaker.h" +#include "StCentralityMaker/StCentrality.h" +#include "StGlauberConstUtilities.h" +#include "StGlauberTree/StGlauberTree.h" +#include "StGlauberHistogramMaker.h" + +ClassImp(StGlauberHistogramMaker) + +using std::ofstream ; +using std::endl ; +using std::vector ; + + const TString StGlauberHistogramMaker::mXAxisName[] = { "b", "Npart", "mult", "cent" }; + const TString StGlauberHistogramMaker::mXAxisTitle[] = { "impact parameter (fm)", "N_{part}", "multiplicity", "centrality (%)" }; + const Int_t StGlauberHistogramMaker::mXAxisBin[] = { + 400, // Impact parameter bin up to 20 fm, 0.2 fm increment + 100, // Npart bin (5 Npart per bin) + 100, // Multiplicity bin (20 multiplicity per bin) + StGlauberConstUtilities::GetCentralityBin() // Centrality bin + }; + + /// Define maximum (minimum is always 0) + const Double_t StGlauberHistogramMaker::mXAxisMax[] = { + 20.0, // Maximum impact parameter + 500, // Maximum Npart + 2000, // Maximum multiplicity + StGlauberConstUtilities::GetCentralityBin() // Maximum centrality + }; + +//____________________________________________________________________________________________________ +// Default constructor +StGlauberHistogramMaker::StGlauberHistogramMaker() + : mName("hTest"), mTitle("Test"), mYTitle("Test"), mYbin(1), mYmin(0), mYmax(1), mIsUnitWeight(kTRUE) +{ + Init(); +} + + +//____________________________________________________________________________________________________ +StGlauberHistogramMaker::StGlauberHistogramMaker(const TString name, const TString title, const TString ytitle, + const Int_t ybin, const Double_t ymin, const Double_t ymax, const Bool_t isUnitWeight) + : mName(name), mTitle(title), mYTitle(ytitle), mYbin(ybin), mYmin(ymin), mYmax(ymax), mIsUnitWeight(isUnitWeight) +{ + Init(); +} + +//____________________________________________________________________________________________________ +// Default destructor +StGlauberHistogramMaker::~StGlauberHistogramMaker() +{ + Reset() ; +} + +//____________________________________________________________________________________________________ +void StGlauberHistogramMaker::SetTableDirectory(const TString directory) +{ + mTableDirectory = directory ; + LOG_INFO << "StGlauberHistogramMaker::SetTableDirectory Set output directory for table : " + << mTableDirectory.Data() << endm; +} + +//____________________________________________________________________________________________________ +void StGlauberHistogramMaker::Init() +{ + mDebug = 0 ; + + /// Initialize histograms and x-axis + Reset() ; + + /// Initialize x-axis + for(UInt_t ix=0; ix::iterator iter = mProfile.begin(); + iter != mProfile.end(); iter++){ + TProfile* h = (TProfile*) (*iter); + LOG_INFO << Form("StGlauberHistogramMaker::Init Initialize TProfile: %s (%s), x:(bin, min, max) = (%4d, %1.2f, %1.2f)", + h->GetName(), h->GetTitle(), h->GetNbinsX(), h->GetXaxis()->GetXmin(), h->GetXaxis()->GetXmax()) + << endm; + } +} + +//____________________________________________________________________________________________________ +void StGlauberHistogramMaker::Reset() +{ + mHistogram1D.clear(); + mHistogram2D.clear(); + mProfile.clear(); + mWeight.clear(); + mXaxis.clear(); +} + +//____________________________________________________________________________________________________ +void StGlauberHistogramMaker::SetXaxis(const StGlauberTree& tree, const StCentralityMaker& centralityMaker, const TString type) +{ + /// Set x-axis (put variable in correct order, see Init()) + mXaxis[0] = tree.GetB() ; // impact parameter + mXaxis[1] = tree.GetNpart() ; // Npart + + // Get multiplicity from tree + mXaxis[2] = tree.GetMultiplicity() ; // Multiplicity + + /// Set id!=0 if type is "smallTotal" or "largeTotal" + UInt_t mode = 0 ; // default + if( type.CompareTo("smalltotal", TString::kIgnoreCase) == 0 ) mode = 1 ; // -5% total Xsection + else if( type.CompareTo("largetotal", TString::kIgnoreCase) == 0 ) mode = 2 ; // +5% total Xsection + + const StCentrality* centrality = centralityMaker.GetCentrality() ; + + if(mDebug){ + LOG_INFO << Form("StGlauberHistogramMaker::SetXaxis mult=%6d, centrality: (default, -5%, +5%) = (%1.1f, %1.1f, %1.1f)", + static_cast(mXaxis[2]), + centrality->GetCentrality(mXaxis[2], 0), + centrality->GetCentrality(mXaxis[2], 1), + centrality->GetCentrality(mXaxis[2], 2) + ) << endm; + } + + mXaxis[3] = centrality->GetCentrality(mXaxis[2], mode) ; // Centrality +} + +//____________________________________________________________________________________________________ +Bool_t StGlauberHistogramMaker::IsXaxisOk() const +{ + UInt_t isXaxisBad = 0 ; + + for(vector::const_iterator iter=mXaxis.begin(); iter != mXaxis.end(); iter++){ + if( (*iter) == -9999. ) isXaxisBad++ ; + } + + return (isXaxisBad==0) ? kTRUE : kFALSE ; +} + +//____________________________________________________________________________________________________ +void StGlauberHistogramMaker::Fill2D(vector collection, const Double_t y, const Double_t weight) +{ + /// Fill 2D histogram + if( mXaxis.size() != collection.size() ){ + Error("StGlauberHistogramMaker::Fill2D", Form("Array size is different: (x-axis, 2D) = (%3d, %3d)", + mXaxis.size(), collection.size())); + assert(0); + } + + for(UInt_t ix=0; ixGetName()); + + // Centrality bin is inclusive + if( name.Contains("cent") ){ + const Double_t centrality = mXaxis[ix] ; + + // Loop over all centrality bins + for(Int_t icent=0; icentGetNbinsX(); icent++){ + // Fill histogram if current centrality is included + if(StGlauberConstUtilities::IsCentralityOk(icent, centrality)){ + h->Fill(icent+0.5, y, weight); + } + } + } + else{ + // Others (except for centrality) fill as it is + h->Fill(mXaxis[ix], y, weight); + } + } +} + +//____________________________________________________________________________________________________ +void StGlauberHistogramMaker::FillProfile(vector collection, const Double_t y) +{ + /// Fill profile histogram + if( mXaxis.size() != collection.size() ){ + Error("StGlauberHistogramMaker::FillProfile", Form("Array size is different: (x-axis, Weight) = (%3d, %3d)", + mXaxis.size(), collection.size())); + assert(0); + } + + for(UInt_t ix=0; ixGetName()); + + // Centrality bin is inclusive + if( name.Contains("cent") ){ + const Double_t centrality = mXaxis[ix] ; + + // Loop over all centrality bins + for(Int_t icent=0; icentGetNbinsX(); icent++){ + // Fill histogram if current centrality is included + if(StGlauberConstUtilities::IsCentralityOk(icent, centrality)){ + h->Fill(icent, y) ; + } + } + } + else{ + // Others (except for centrality) fill as it is + h->Fill(mXaxis[ix], y); + } + } +} + + +//____________________________________________________________________________________________________ +void StGlauberHistogramMaker::Fill(const TString type, const Double_t y, const Double_t weight) +{ + /// Fill histogram + /// Choose type '2d', 'profile' or 'weight' + // + /// (2d)->Fill(x, y, weight); + /// (profile)->Fill(x, y*weight) + /// (weight)->Fill(x, weight) + /// + + if( type.CompareTo("2d", TString::kIgnoreCase) == 0 ){ + Fill2D(mHistogram2D, y, weight) ; + } + else if ( type.CompareTo("profile", TString::kIgnoreCase) == 0 ){ + FillProfile(mProfile, y*weight) ; + } + else if ( type.CompareTo("weight", TString::kIgnoreCase) == 0 ){ + FillProfile(mWeight, weight) ; + } + else{ + Error("StGlauberHistogramMaker::Fill", "Unknown option, option=%s", type.Data()); + assert(0); + } + +} + +//____________________________________________________________________________________________________ +void StGlauberHistogramMaker::Fill(const Double_t y, const Double_t weight) +{ + /// Fill 'y' value with 'weight' + /// Re-weighting is only applied for numerator + + /// Check x-axis, abort if all bad + if(!IsXaxisOk()){ + Error("StGlauberHistogramMaker::Fill", "x-axis has not defined yet for %s", mName.Data()); + assert(0); + } + + /// Fill + Fill("2d", y, 1.0) ; // No weight. Don't use this histogram for final result. Just for drawing. + Fill("profile", y, weight); + Fill("weight", y, weight) ; +} + +//____________________________________________________________________________________________________ +void StGlauberHistogramMaker::DoWeightCorrection(vector collection1d, vector collectionp) +{ + /// Profile / Weight + /// Use TH1 instead of TProfile since TProfile is not accurate to calculate errors in Divide() function + LOG_INFO << Form("StGlauberHistogramMaker::DoWeightCorrection %s: particle-wise weight correction, profile/weight", + mName.Data()) << endm; + + for(UInt_t ix=0; ixProjectionX(); + TH1* w1 = (TH1D*) mWeight[ix]->ProjectionX(); + p1->Divide(w1); + + p1->SetXTitle(h1->GetXaxis()->GetTitle()); + p1->SetYTitle(h1->GetXaxis()->GetTitle()); + + /// Set y-axis range from 2D + p1->SetMinimum(mYmin); + p1->SetMaximum(mYmax); + + /// Copy contenst/errors + for(Int_t i=0; iGetNbinsX(); i++){ + collection1d[ix]->SetBinContent(i+1, p1->GetBinContent(i+1)); + collection1d[ix]->SetBinError(i+1, p1->GetBinError(i+1)); + } + collection1d[ix]->SetEntries(p1->GetEntries()); + collection1d[ix]->Print() ; + delete p1 ; + delete w1 ; + } +} + +//____________________________________________________________________________________________________ +void StGlauberHistogramMaker::WriteTable(vector collection, const TString name) +{ + /// Format will be: + /// + const TString tableName(Form("%s/table_%s_vs_centrality.txt", + mTableDirectory.Data(), name.Data())); + ofstream fout(tableName.Data()); + LOG_INFO << "StGlauberHistogramMaker::WriteTable Write table " << tableName.Data() << endm; + + const UInt_t centId = 3 ; // 4-th histogram has centrality in x-axis + for(UInt_t ic=0; icGetBinContent(ic+1); + const Double_t error = collection[centId]->GetBinError(ic+1); + + const Double_t centmin = StGlauberConstUtilities::GetCentralityMin(ic) ; + const Double_t centmax = StGlauberConstUtilities::GetCentralityMax(ic) ; + fout << Form("%10d %1.1f %1.1f %1.5f %1.5f", + ic, centmin, centmax, val, error) << endl; + } + fout << endl << endl ; + fout << "# " << endl; + fout << Form("# %s", mTitle.Data()) << endl; // description (type, node name in tree) +} + +//____________________________________________________________________________________________________ +void StGlauberHistogramMaker::WriteGraphs(vector collection) +{ + /// Write TGraphErrors into output ROOT file + const UInt_t centId = 3; // 4-th histogram has centrality in x-axis + + TGraphErrors* graph = new TGraphErrors() ; + + TString name(collection[centId]->GetName()); // should be g + getHistogramName() + name.Replace(0, 1, "graph"); + graph->SetName(name); + graph->SetTitle(collection[centId]->GetTitle()); + + LOG_INFO << Form("StGlauberHistogramMaker::WriteGraphs Write graph %s (vs centrality)", graph->GetName()) << endm; + + // Fill up to 80 % + const UInt_t ncentrality = 9 ; + for(UInt_t ic=0; icGetBinContent(ic+1) ; + const Double_t err = collection[centId]->GetBinError(ic+1) ; + graph->SetPoint(ic, cent, val); + graph->SetPointError(ic, 0.0, err); + } + + graph->Write() ; + +} + + +//____________________________________________________________________________________________________ +void StGlauberHistogramMaker::Finish(const TString type) +{ + LOG_INFO << "StGlauberHistogramMaker::Finish "; + LOG_INFO << Form("Finish %s. Correction weight for TProfile, ", mName.Data()); + LOG_INFO << "and store it into 1D. Write averate qunatity vs centrality" << endm; + + /// Weight correction + DoWeightCorrection(mHistogram1D, mProfile) ; + + /// Write down the table + const TString name(type + "_" + mName); + WriteTable(mHistogram1D, name) ; + + /// Write graphs + WriteGraphs(mHistogram1D) ; +} + +//____________________________________________________________________________________________________ +const TString StGlauberHistogramMaker::GetHistogramName(const TString name, const UInt_t ix) const +{ + return Form("%s_%s", name.Data(), mXAxisName[ix].Data()); +} + +//____________________________________________________________________________________________________ +TH1* StGlauberHistogramMaker::GetTH1D(const TString name, const UInt_t ix) +{ + TH1* h = new TH1D("g" + GetHistogramName(name, ix), + Form("%s vs %s, %s", mYTitle.Data(), mXAxisTitle[ix].Data(), mTitle.Data()), mXAxisBin[ix], 0.0, mXAxisMax[ix]); + h->SetXTitle(mXAxisTitle[ix].Data()); + h->SetYTitle(mYTitle.Data()); + + return h ; +} + +//____________________________________________________________________________________________________ +TH2* StGlauberHistogramMaker::GetTH2D(const TString name, const UInt_t ix) +{ + TH2* h = new TH2D("h" + GetHistogramName(name, ix), + Form("%s vs %s, %s (2D)", mYTitle.Data(), mXAxisTitle[ix].Data(), mTitle.Data()), + mXAxisBin[ix], 0.0, mXAxisMax[ix], mYbin, mYmin, mYmax); + h->SetXTitle(mXAxisTitle[ix].Data()); + h->SetYTitle(mYTitle.Data()); + + return h ; +} + +//____________________________________________________________________________________________________ +TProfile* StGlauberHistogramMaker::GetTProfile(const TString name, const UInt_t ix, const TString title) +{ + const TString prefix = (title.CompareTo("profile", TString::kIgnoreCase)==0) ? "p" : "w" ; + TProfile* h = new TProfile(prefix + GetHistogramName(name, ix), + Form("%s vs %s, %s (%s)", mYTitle.Data(), mXAxisTitle[ix].Data(), mTitle.Data(), title.Data()), mXAxisBin[ix], 0.0, mXAxisMax[ix]); + h->SetXTitle(mXAxisTitle[ix].Data()); + h->SetYTitle(mYTitle.Data()); + + return h ; +} + +//____________________________________________________________________________________________________ +const TString StGlauberHistogramMaker::GetName() const +{ + return mName ; +} + +//____________________________________________________________________________________________________ +void StGlauberHistogramMaker::DebugOn() +{ + mDebug = 1 ; + LOG_INFO << "StGlauberHistogramMaker::DebugOn Print debug messages" << endm; +} + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberHistogramMaker.h b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberHistogramMaker.h new file mode 100644 index 00000000000..a76403d2877 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberHistogramMaker.h @@ -0,0 +1,114 @@ +/****************************************************************************** + * $Id: StGlauberHistogramMaker.h,v 1.2 2012/04/25 05:03:06 hmasui Exp $ + * $Log: StGlauberHistogramMaker.h,v $ + * Revision 1.2 2012/04/25 05:03:06 hmasui + * Use StCentralityMaker. Added weight for 2D fill. Use STAR logger instead of iostream + * +******************************************************************************/ + +#ifndef __StGlauberHistogramMaker_h__ +#define __StGlauberHistogramMaker_h__ + +class TH1 ; +class TH2 ; +class TProfile ; +class StGlauberTree ; +class StCentralityMaker; +#include "TString.h" +#include + +//____________________________________________________________________________________________________ +// Class StGlauberHistogramMaker: Histogram maker +class StGlauberHistogramMaker { + public: + StGlauberHistogramMaker() ; /// Default constructor + + // Fixed bin width + StGlauberHistogramMaker(const TString name, + const TString title, const TString ytitle, + const Int_t ybin, const Double_t ymin, const Double_t ymax, + const Bool_t isUnitWeight=kTRUE); + + ~StGlauberHistogramMaker() ; /// Default destructor + + /// Set directory for output table (default is current directory) + void SetTableDirectory(const TString directory) ; + + virtual void Init(); /// Initialize histograms + + void SetXaxis(const StGlauberTree& tree, const StCentralityMaker& centralityMaker, const TString type); /// Set X-axis variable + virtual void Fill(const Double_t y, const Double_t weight); /// Fill histogram 'y' value with 'weight' + + /// Do correction for weight, and write table in the current directory + /// table name will be: table_{mName}_vs_centrality.txt + /// table contains + /// + virtual void Finish(const TString type) ; + + const TString GetName() const ; /// Get histogram name + void DebugOn() ; /// Print debug messages + + private: + // Data members + + const TString mName ; /// Histogram name + const TString mTitle ; /// Histogram title + const TString mYTitle ; /// y-axis title + const Int_t mYbin ; /// Histogram bin in y-axis + const Double_t mYmin ; /// Histogram minimum value in y-axis + const Double_t mYmax ; /// Histogram maximum value in y-axis + const Bool_t mIsUnitWeight ; /// true:unit weight, false:some weight + + enum { + mNXaxis = 4 /// Number of x-axis + }; + + static const TString mXAxisName[mNXaxis] ; /// x-axis name + static const TString mXAxisTitle[mNXaxis] ; /// x-axis title + static const Int_t mXAxisBin[mNXaxis] ; /// x-axis bin + static const Double_t mXAxisMax[mNXaxis] ; /// x-axis maximum (minimum is 0) + + std::vector mXaxis ; /// x-axis definition + + std::vector mHistogram1D ; /// 1D histogram collection (Profile/Weight) + std::vector mHistogram2D ; /// 2D histogram collection + std::vector mProfile ; /// Profile histogram collection + std::vector mWeight ; /// Weight histogram + + TString mTableDirectory ; /// Output directory for table + + UInt_t mDebug ; /// Debug flag + + protected: + // Functions + virtual void Reset(); /// Reset all data members + + Bool_t IsXaxisOk() const ; /// Check xAxis has been filled, abort if empty + void Fill2D(std::vector collection, const Double_t y, const Double_t weight) ; + void FillProfile(std::vector collection, const Double_t y) ; + void Fill(const TString type, const Double_t y, const Double_t weight) ; + + /// Calculate sum(w*val)/sum(w) for each profile histogram + void DoWeightCorrection(std::vector collection1d, std::vector collectionp) ; + + /// Write text table, average quantity vs centrality (table: table_{mName}_vs_centrality.txt) + void WriteTable(std::vector collection, const TString name) ; + + /// Write TGraphErrors (vs centrality, 0-80%) + void WriteGraphs(std::vector collection) ; + + const TString GetHistogramName(const TString name, const UInt_t ix) const ; // histogram name + TH1* GetTH1D(const TString name, const UInt_t ix) ; // 1D histogram + TH2* GetTH2D(const TString name, const UInt_t ix) ; // 2D histogram + TProfile* GetTProfile(const TString name, const UInt_t ix, const TString title="Profile") ; // Profile histogram + + /// Naxis + UInt_t GetNXaxis() const ; + + ClassDef(StGlauberHistogramMaker, 0) +}; + +inline UInt_t StGlauberHistogramMaker::GetNXaxis() const { return mNXaxis ; } + +#endif + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberPlotMaker.cxx b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberPlotMaker.cxx new file mode 100644 index 00000000000..b507da7be38 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberPlotMaker.cxx @@ -0,0 +1,423 @@ +/****************************************************************************** + * $Id: StGlauberPlotMaker.cxx,v 1.2 2012/04/25 05:02:16 hmasui Exp $ + * $Log: StGlauberPlotMaker.cxx,v $ + * Revision 1.2 2012/04/25 05:02:16 hmasui + * 5% increment for centrality bins. Added 3rd harmonic eccentricity + * + ******************************************************************************/ + +#include +#include + +#include "TColor.h" +#include "TCanvas.h" +#include "TError.h" +#include "TGraph.h" +#include "TGraphErrors.h" +#include "TH1.h" +#include "TLegend.h" +#include "TLine.h" +#include "TMath.h" +#include "TStyle.h" + +#include "StMessMgr.h" + +#include "StGlauberConstUtilities.h" +#include "StGlauberPlotMaker.h" + +ClassImp(StGlauberPlotMaker) + + using std::ifstream ; + using std::ofstream ; + using std::endl ; + using std::vector ; + + UInt_t StGlauberPlotMaker::mCanvasId = 0 ; + UInt_t StGlauberPlotMaker::mGraphId = 0 ; + + //____________________________________________________________________________________________________ + // Default constructor + StGlauberPlotMaker::StGlauberPlotMaker(const TString name) +: mName(name) +{ + mGraph.clear() ; + mGraphDraw.clear() ; + mSystematicError = 0 ; +} + +//____________________________________________________________________________________________________ +// Default destructor +StGlauberPlotMaker::~StGlauberPlotMaker() +{ + mGraph.clear() ; + mGraphDraw.clear() ; + if(mSystematicError) delete mSystematicError ; +} + +//____________________________________________________________________________________________________ +Int_t StGlauberPlotMaker::Read(const TString filename, const TString type) +{ + ifstream fin(filename.Data()); + if(!fin){ + Error("StGlauberPlotMaker::Read", "can't open %s", filename.Data()); + return 0 ; + } + + LOG_INFO << Form("StGlauberPlotMaker::Read OPEN %s (%s)", filename.Data(), type.Data()) << endm; + + TGraphErrors* gall = new TGraphErrors() ; + TGraphErrors* gdraw = new TGraphErrors() ; + const TString name("g" + mName) ; + gall ->SetName(Form("%s_all_%d", name.Data(), mGraphId)); + gdraw->SetName(Form("%s_draw_%d", name.Data(), mGraphId)); + gall ->SetTitle(type); + gdraw->SetTitle(type); + mGraphId++; // increment graph id + + LOG_INFO << "StGlauberPlotMaker::Read Init graphs: " + << gall->GetName() << " and " << gdraw->GetName() + << endm; + + const UInt_t ncent = mNCentrality ; // 16 centrality bins for 0-80% (5% increment in 0-80%) + UInt_t centralityId ; + Double_t centMin, centMax ; + Double_t val, error ; + + for(UInt_t ic=0; ic> centralityId >> centMin >> centMax >> val >> error ; + + const Double_t cent = (centMin + centMax)/2.0 ; + if( centralityId < ncent ){ + gdraw->SetPoint(centralityId, cent, val); + gdraw->SetPointError(centralityId, 0.0, error); + } + + LOG_INFO << "StGlauberPlotMaker::Read " << mName << ": centrality (min,max) = (" + << centMin << "," << centMax << "), val = " + << val << " +/- " << error + << endm; + + gall->SetPoint(centralityId, cent, val); + gall->SetPointError(centralityId, 0.0, error); + } + + /// Stack graphs into array + mGraph.push_back( gall ); + mGraphDraw.push_back( gdraw ); + + return 1 ; +} + +//____________________________________________________________________________________________________ +Double_t StGlauberPlotMaker::GetYMinimum() const +{ + Double_t ymin = 0.0 ; + if( mName.CompareTo("impactparameter", TString::kIgnoreCase) == 0 ) ymin = 0.0 ; + else if ( mName.CompareTo("npart", TString::kIgnoreCase) == 0 ) ymin = 0.0 ; + else if ( mName.CompareTo("ncoll", TString::kIgnoreCase) == 0 ) ymin = 0.0 ; + else if ( mName.CompareTo("multiplicity", TString::kIgnoreCase) == 0 ) ymin = 0.0 ; + else if ( mName.CompareTo("arearp", TString::kIgnoreCase) == 0 ) ymin = 0.0 ; + else if ( mName.CompareTo("areapp", TString::kIgnoreCase) == 0 ) ymin = 0.0 ; + else if ( mName.CompareTo("eccrp", TString::kIgnoreCase) == 0 ) ymin = 0.0 ; + else if ( mName.CompareTo("eccrpm", TString::kIgnoreCase) == 0 ) ymin = 0.0 ; + else if ( mName.CompareTo("eccpp_0", TString::kIgnoreCase) == 0 ) ymin = 0.0 ; + else if ( mName.CompareTo("eccpp_0_2", TString::kIgnoreCase) == 0 ) ymin = 0.0 ; + else if ( mName.CompareTo("eccpp_1", TString::kIgnoreCase) == 0 ) ymin = 0.0 ; + else if ( mName.CompareTo("eccpp_1_2", TString::kIgnoreCase) == 0 ) ymin = 0.0 ; + else if ( mName.CompareTo("eccppm_0", TString::kIgnoreCase) == 0 ) ymin = 0.0 ; + else if ( mName.CompareTo("eccppm_0_2", TString::kIgnoreCase) == 0 ) ymin = 0.0 ; + else if ( mName.CompareTo("eccppm_1", TString::kIgnoreCase) == 0 ) ymin = 0.0 ; + else if ( mName.CompareTo("eccppm_1_2", TString::kIgnoreCase) == 0 ) ymin = 0.0 ; + else{ + Error("StGlauberPlotMaker::GetYMinimum", Form("Cannot find %s in the list. return 0", mName.Data())); + return 0.0 ; + } + + return ymin ; +} + +//____________________________________________________________________________________________________ +Double_t StGlauberPlotMaker::GetYMaximum() const +{ + Double_t ymax = 0.0 ; + if( mName.CompareTo("impactparameter", TString::kIgnoreCase) == 0 ) ymax = 18.0 ; + else if ( mName.CompareTo("npart", TString::kIgnoreCase) == 0 ) ymax = 420.0 ; + else if ( mName.CompareTo("ncoll", TString::kIgnoreCase) == 0 ) ymax = 1200.0 ; + else if ( mName.CompareTo("multiplicity", TString::kIgnoreCase) == 0 ) ymax = 1200.0 ; + else if ( mName.CompareTo("arearp", TString::kIgnoreCase) == 0 ) ymax = 42.0 ; + else if ( mName.CompareTo("areapp", TString::kIgnoreCase) == 0 ) ymax = 42.0 ; + else if ( mName.CompareTo("eccrp", TString::kIgnoreCase) == 0 ) ymax = 0.98 ; + else if ( mName.CompareTo("eccrpm", TString::kIgnoreCase) == 0 ) ymax = 0.98 ; + else if ( mName.CompareTo("eccpp_0", TString::kIgnoreCase) == 0 ) ymax = 0.98 ; + else if ( mName.CompareTo("eccpp_0_2", TString::kIgnoreCase) == 0 ) ymax = 0.98 ; + else if ( mName.CompareTo("eccpp_1", TString::kIgnoreCase) == 0 ) ymax = 0.98 ; + else if ( mName.CompareTo("eccpp_1_2", TString::kIgnoreCase) == 0 ) ymax = 0.98 ; + else if ( mName.CompareTo("eccppm_0", TString::kIgnoreCase) == 0 ) ymax = 0.98 ; + else if ( mName.CompareTo("eccppm_0_2", TString::kIgnoreCase) == 0 ) ymax = 0.98 ; + else if ( mName.CompareTo("eccppm_1", TString::kIgnoreCase) == 0 ) ymax = 0.98 ; + else if ( mName.CompareTo("eccppm_1_2", TString::kIgnoreCase) == 0 ) ymax = 0.98 ; + else{ + Error("StGlauberPlotMaker::GetYMaximum", Form("Cannot find %s in the list. return 0", mName.Data())); + return 0.0 ; + } + + return ymax ; +} + +//____________________________________________________________________________________________________ +TString StGlauberPlotMaker::GetYTitle() const +{ + TString title(""); + + if( mName.CompareTo("impactparameter", TString::kIgnoreCase) == 0 ) title = "#LTb#GT (fm)" ; + else if ( mName.CompareTo("npart", TString::kIgnoreCase) == 0 ) title = "N_{part}" ; + else if ( mName.CompareTo("ncoll", TString::kIgnoreCase) == 0 ) title = "N_{coll}" ; + else if ( mName.CompareTo("multiplicity", TString::kIgnoreCase) == 0 ) title = "Multiplicity" ; + else if ( mName.CompareTo("arearp", TString::kIgnoreCase) == 0 ) title = "#LTS_{RP}#GT (fm^{2})" ; + else if ( mName.CompareTo("areapp", TString::kIgnoreCase) == 0 ) title = "#LTS_{PP}#GT (fm^{2})" ; + else if ( mName.CompareTo("eccrp", TString::kIgnoreCase) == 0 ) title = "#LT#varepsilon_{RP}#GT" ; + else if ( mName.CompareTo("eccrpm", TString::kIgnoreCase) == 0 ) title = "#LT#varepsilon_{RP}#GT" ; + else if ( mName.CompareTo("eccpp_0", TString::kIgnoreCase) == 0 ) title = "#LT#varepsilon_{part}#GT" ; + else if ( mName.CompareTo("eccpp_0_2", TString::kIgnoreCase) == 0 ) title = "#varepsilon_{part}{2}" ; + else if ( mName.CompareTo("eccpp_1", TString::kIgnoreCase) == 0 ) title = "#LT#varepsilon_{3,part}#GT" ; + else if ( mName.CompareTo("eccpp_1_2", TString::kIgnoreCase) == 0 ) title = "#varepsilon_{3,part}{2}" ; + else if ( mName.CompareTo("eccppm_0", TString::kIgnoreCase) == 0 ) title = "#LT#varepsilon_{part}#GT" ; + else if ( mName.CompareTo("eccppm_0_2", TString::kIgnoreCase) == 0 ) title = "#varepsilon_{part}{2}" ; + else if ( mName.CompareTo("eccppm_1", TString::kIgnoreCase) == 0 ) title = "#LT#varepsilon_{3,part}#GT" ; + else if ( mName.CompareTo("eccppm_1_2", TString::kIgnoreCase) == 0 ) title = "#varepsilon_{3,part}{2}" ; + else{ + Error("StGlauberPlotMaker::GetYTitle", Form("Cannot find %s in the list. return 0", mName.Data())); + return ""; + } + + return title ; +} + +//____________________________________________________________________________________________________ +TGraphErrors* StGlauberPlotMaker::Divide(const TGraphErrors& g0, const TGraphErrors& g1) const +{ + TGraphErrors* g = new TGraphErrors(); + g->SetMarkerSize( g0.GetMarkerSize() ); + g->SetMarkerStyle( g0.GetMarkerStyle() ); + g->SetMarkerColor( g0.GetMarkerColor() ); + g->SetLineColor( g0.GetLineColor() ); + + for(Int_t i=0;iGetN() ; + + g->SetPoint(n, g0.GetX()[i], r) ; + g->SetPointError(n, g0.GetEX()[i], re) ; + } + } + + return g ; +} + +//____________________________________________________________________________________________________ +TGraphErrors* StGlauberPlotMaker::SystematicErrors(const UInt_t mode) +{ + /// Require at least two graphs + if( mGraph.size() < 2 ){ + Error("StGlauberPlotMaker::SystematicErrors", "Number of graphs < 2, at least 2 graphs are needed to evaluate sys. errors. abort"); + assert(0); + } + + /// Evaluate systematic errors, and write tables + LOG_INFO << "StGlauberPlotMaker::SystematicErrors Start evaluating systematic errors" << endm; + + /// Take quadratic sum of the difference between default and all other available data points + /// assume first graph contains default data points + const UInt_t nCent = mGraph[0]->GetN() ; + Double_t qSum[nCent] ; + for(UInt_t ic=0; icGetTitle() << endm; + + for(UInt_t ic=0; icGetY()[ic]; + const Double_t ref = mGraph[0]->GetY()[ic]; + const Double_t diff = val - ref; + qSum[ic] += diff * diff ; + } + } + + // qSum = sqrt(sum{diff}) + mSystematicError = new TGraph(); + + Double_t factor = 1.0/TMath::Sqrt(12.0) ; + if( mode == 1 ) factor = 1.0 ; + + for(UInt_t ic=0; icSetPoint(ic, ic+0.5, qSum[ic]); + } + + // Fill graph + TGraphErrors* g = new TGraphErrors() ; + g->SetFillColor(kYellow); + g->SetLineColor(kYellow); + + for(UInt_t ic=0; icSetPoint(ic, mGraph[0]->GetX()[ic], mGraph[0]->GetY()[ic]); + g->SetPointError(ic, 0.0, qSum[ic]); + } + + return g ; +} + +//____________________________________________________________________________________________________ +void StGlauberPlotMaker::Draw(const UInt_t mode) +{ + /// Draw graphs and evaluate systematic errors + TColor::CreateColorWheel(); + gStyle->SetPadRightMargin(0.05); + + /// Systematic errors + TGraphErrors* gSysError = SystematicErrors(mode) ; + + /// Draw + TCanvas* c1 = new TCanvas(Form("c%d", mCanvasId), Form("c%d", mCanvasId++), 600, 800); + c1->Divide(1, 2); + + // Styles, and colors + const UInt_t style[] = {20, 21, 25, 22, 26, 29, 21, 25, 22, 26, 27, 28}; + const UInt_t color[] = {kBlack, kRed, kRed, kBlue, kBlue, kMagenta+1, + kGreen+2, kGreen+2, + kOrange+1, kOrange+1, + kCyan-3, kCyan-3 + }; + + //---------------------------------------------------------------------------------------------------- + // Draw + //---------------------------------------------------------------------------------------------------- + c1->cd(1); + + /// Minimum/Maximum according to the mName + const Double_t ymin = GetYMinimum() ; + const Double_t ymax = GetYMaximum() ; + + TH1* frame = c1->GetPad(1)->DrawFrame(0, ymin, 80, ymax); + frame->SetXTitle("% Most central"); + frame->SetYTitle(GetYTitle()); + + TLegend* leg = new TLegend(0.05, 0.1, 0.95, 0.9); + leg->SetTextSize(0.05); + leg->SetFillColor(10); + // leg->SetBorderSize(1); + + const UInt_t nSize = mGraphDraw.size() ; + TGraphErrors* gRatio[nSize] ; + for(UInt_t id=0; idSetMarkerSize(1.2); + mGraphDraw[id]->SetMarkerStyle(style[id]); + mGraphDraw[id]->SetMarkerColor(color[id]); + mGraphDraw[id]->SetLineColor(color[id]); + mGraphDraw[id]->Draw("P"); + + // Calculate ratio + gRatio[id] = Divide(*mGraphDraw[id], *mGraphDraw[0]) ; + + // Add entry in legend + leg->AddEntry(mGraphDraw[id], gRatio[id]->GetTitle(), "P"); + } + mGraphDraw[0]->Draw("P"); + + //---------------------------------------------------------------------------------------------------- + // Draw ratio + //---------------------------------------------------------------------------------------------------- + TPad* pad = (TPad*) c1->GetPad(2); + pad->Divide(2, 1); + pad->cd(1); + + const Double_t rmin = 1.0 - 0.3 ; + const Double_t rmax = 1.0 + 0.3 ; + TH1* frameRatio = pad->GetPad(1)->DrawFrame(0, rmin, 80, rmax); + frameRatio->SetXTitle("% Most central"); + frameRatio->SetYTitle(Form("Ratio of %s", GetYTitle().Data())); + + TLine* lzero = new TLine(0, 1.0, 80, 1.0); + lzero->SetLineStyle(3); + lzero->Draw() ; + + for(UInt_t id=1; idDraw("P"); + } + + //---------------------------------------------------------------------------------------------------- + // Draw legend + //---------------------------------------------------------------------------------------------------- + pad->cd(2); + leg->Draw() ; + + c1->cd(); + c1->Update(); + + c1->Print(Form("figure/systematicerror_%s.eps", mName.Data())); + // c1->Print(Form("%s_systematic_error.png", mName.Data())); + + //---------------------------------------------------------------------------------------------------- + // Draw default vs centrality with systematic error (eps) + //---------------------------------------------------------------------------------------------------- + TCanvas* c2 = new TCanvas(Form("c%d", mCanvasId), Form("c%d", mCanvasId++)); + TH1* frame2 = c2->DrawFrame(0, ymin, 80, ymax); + frame2->SetXTitle("% Most central"); + frame2->SetYTitle(GetYTitle()); + + gSysError->Draw("E3"); + mGraphDraw[0]->Draw("P"); + + c2->cd(); + c2->Update(); + + c2->Print(Form("figure/%s_vs_centrality_with_systematicerror.eps", mName.Data())); + + //---------------------------------------------------------------------------------------------------- + // Draw default vs centrality with systematic error (png for web, small TCanvas) + //---------------------------------------------------------------------------------------------------- + TCanvas* c3 = new TCanvas(Form("c%d", mCanvasId), Form("c%d", mCanvasId++), 700*0.5, 500*0.5); + TH1* frame3 = c3->DrawFrame(0, ymin, 80, ymax); + frame3->SetXTitle("% Most central"); + frame3->SetYTitle(GetYTitle()); + + gSysError->Draw("E3"); + mGraphDraw[0]->Draw("P"); + + c3->cd(); + c3->Update(); + + c3->Print(Form("figure/%s_vs_centrality_with_systematicerror.png", mName.Data())); + + //---------------------------------------------------------------------------------------------------- + // Write table + //---------------------------------------------------------------------------------------------------- + const TString tableName(Form("table_%s_vs_centrality_systematicerror.txt", mName.Data())); + ofstream fout(tableName.Data()) ; + LOG_INFO << Form("StGlauberPlotMaker::Draw Write table %s in the current directory", tableName.Data()) << endm; + + for(Int_t ic=0; icGetN(); ic++){ + const Double_t val = mGraph[0]->GetY()[ic] ; + const Double_t sys = mSystematicError->GetY()[ic] ; + const Double_t centMin = StGlauberConstUtilities::GetCentralityMin(ic) ; + const Double_t centMax = StGlauberConstUtilities::GetCentralityMax(ic) ; + + fout << Form("%10d %1.1f %1.1f %1.5f %1.5f", + ic, centMin, centMax, val, sys) << endl; + } + fout << endl << endl ; + fout << "# " << endl; +} + + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberPlotMaker.h b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberPlotMaker.h new file mode 100644 index 00000000000..bd1e7fb5753 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberAnalysisMaker/StGlauberPlotMaker.h @@ -0,0 +1,61 @@ +/****************************************************************************** + * $Id: StGlauberPlotMaker.h,v 1.2 2012/04/25 05:02:16 hmasui Exp $ + * $Log: StGlauberPlotMaker.h,v $ + * Revision 1.2 2012/04/25 05:02:16 hmasui + * 5% increment for centrality bins. Added 3rd harmonic eccentricity + * +******************************************************************************/ + +#ifndef __StGlauberPlotMaker_h__ +#define __StGlauberPlotMaker_h__ + +class TGraph ; +class TGraphErrors ; +#include +#include "TString.h" + +//____________________________________________________________________________________________________ +// Class StGlauberPlotMaker: Plot average quantity as a function of centrality and evaluate systematic error +class StGlauberPlotMaker { + public: + StGlauberPlotMaker(const TString name="Npart"); /// Default constructor + virtual ~StGlauberPlotMaker(); /// Default destructor + + /// Read text file to get graphs + Int_t Read(const TString filename, const TString type) ; + + /// Draw and evaluate systematic errors. Write table in the current directory + /// table name will be: table_{mName}_vs_centrality_systematicerror.txt + /// mode + /// 0: evaluate errors by assuming flat probability distribution (error = RMS/sqrt(12)) (default) + /// 1: evaluate errors from maximum difference between the data points + void Draw(const UInt_t mode = 0) ; + + private: + // Functions + Double_t GetYMinimum() const ; /// Y-axis minimum + Double_t GetYMaximum() const ; /// Y-axis maximum + TString GetYTitle() const ; /// Y-axis title + + /// Divide g0 by g1 + TGraphErrors* Divide(const TGraphErrors& g0, const TGraphErrors& g1) const ; + + /// Evaluate sysetmatic errors from all graphs, return systeamtic error vs centrality (graph) + TGraphErrors* SystematicErrors(const UInt_t mode) ; + + // Data members + enum { + mNCentrality = 16 // 16 centrality bins in 0-80% (5% increment) + }; + const TString mName ; /// Name of average quantity + std::vector mGraph ; /// Collection of graphs (all centrality) + std::vector mGraphDraw ; /// Collection of graphs (0-80% for drawing) + + TGraph* mSystematicError ; /// Systematic error graph (not for draw) + static UInt_t mCanvasId ; /// Unique canvas id + static UInt_t mGraphId ; /// Unique graph id + + ClassDef(StGlauberPlotMaker, 0) +}; +#endif + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberTree/StGlauberTree.cxx b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberTree/StGlauberTree.cxx new file mode 100644 index 00000000000..7160691b43d --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberTree/StGlauberTree.cxx @@ -0,0 +1,375 @@ +//==================================================================================================== +// $Id: StGlauberTree.cxx,v 1.2 2012/04/25 04:45:26 hmasui Exp $ +// $Log: StGlauberTree.cxx,v $ +// Revision 1.2 2012/04/25 04:45:26 hmasui +// Expand branches for eccentricity in the main tree, and deformation parameters in header +// +//==================================================================================================== + +#include + +#include "TError.h" +#include "TFile.h" +#include "TMath.h" +#include "TTree.h" +#include "StMessMgr.h" +#include "StGlauberTree.h" + +ClassImp(StGlauberTree) + +//____________________________________________________________________________________________________ +// Default constructor +StGlauberTree::StGlauberTree(const UInt_t mode) + : mMode(mode) +{ + switch ( mMode ){ + case 0: LOG_INFO << "StGlauberTree read mode" << endm; break ; + case 1: LOG_INFO << "StGlauberTree write mode" << endm; break ; + default: + Error("StGlauberTree", "Mode should 0(read) or 1(write). abort"); + assert(0); + } + + mFile = 0 ; + mTree = 0 ; + + Clear() ; + + // Initialize header stuffs only once + sprintf(mNameNucleusA, "%s", "") ; + sprintf(mNameNucleusB, "%s", "") ; + mMassNumberA = 0 ; + mMassNumberB = 0 ; + mRadiusA = -9999. ; + mRadiusA = -9999. ; + mSkinDepthA = -9999. ; + mSkinDepthB = -9999. ; + mBeta2A = -9999. ; + mBeta4A = -9999. ; + mBeta2B = -9999. ; + mBeta4B = -9999. ; + mSigmaNN = -9999. ; + mSqrtSNN = -9999. ; + mRepulsionD = -9999. ; + mTotalXsec = -9999. ; + mTotalXsecError = 0.0 ; + mSmearHardCore = 0 ; + mSmearGaussian = 0 ; + mCollisionHardCore = 0 ; + mCollisionGaussian = 0 ; + mBMax = -9999. ; + mNeventsAccept = 0 ; + mNeventsThrow = 0 ; + mNpp = -9999. ; + mK = -9999. ; + mX = -9999. ; + mEfficiency = -9999. ; + mIsConstEfficiency = 0 ; + mVersion = 0 ; +} + +//____________________________________________________________________________________________________ +// Default destructor +StGlauberTree::~StGlauberTree() +{ +} + +//____________________________________________________________________________________________________ +Int_t StGlauberTree::Clear() +{ + /// Clear data members in tree + mB = -9999. ; + mNpart = 0 ; + mNcoll = 0 ; + mMultiplicity = 0 ; + + for(UInt_t i=0;i<2;i++){ + mTheta[i] = 0.0 ; + mPhi[i] = 0.0 ; + } + + for(UInt_t i=0;i<4;i++){ + mSumX[i] = 0.0 ; + mSumY[i] = 0.0 ; + mSumX2[i] = 0.0 ; + mSumY2[i] = 0.0 ; + mSumXY[i] = 0.0 ; + mEccRP2[i] = -9999. ; + mEccPP2[i] = -9999. ; + mEccPP3[i] = -9999. ; + mEccPP4[i] = -9999. ; + mPP2[i] = -9999. ; + mPP3[i] = -9999. ; + mPP4[i] = -9999. ; + } + + return 1 ; +} + +//____________________________________________________________________________________________________ +Int_t StGlauberTree::InitBranch() +{ + // event-wise tree + mTree->SetMakeClass(1); + mTree->SetBranchAddress("b", &mB, &b_b); + mTree->SetBranchAddress("npart", &mNpart, &b_npart); + mTree->SetBranchAddress("ncoll", &mNcoll, &b_ncoll); + mTree->SetBranchAddress("mult", &mMultiplicity, &b_mult); + mTree->SetBranchAddress("theta", mTheta, &b_theta); + mTree->SetBranchAddress("phi", mPhi, &b_phi); + mTree->SetBranchAddress("sumx", mSumX, &b_sumx); + mTree->SetBranchAddress("sumy", mSumY, &b_sumy); + mTree->SetBranchAddress("sumx2", mSumX2, &b_sumx2); + mTree->SetBranchAddress("sumy2", mSumY2, &b_sumy2); + mTree->SetBranchAddress("sumxy", mSumXY, &b_sumxy); + mTree->SetBranchAddress("eccrp2", mEccRP2, &b_eccrp2); + mTree->SetBranchAddress("eccpp2", mEccPP2, &b_eccpp2); + mTree->SetBranchAddress("eccpp3", mEccPP3, &b_eccpp3); + mTree->SetBranchAddress("eccpp4", mEccPP4, &b_eccpp4); + mTree->SetBranchAddress("pp2", mPP2, &b_pp2); + mTree->SetBranchAddress("pp3", mPP3, &b_pp3); + mTree->SetBranchAddress("pp4", mPP4, &b_pp4); + + // header + mHeader->SetMakeClass(1); + mHeader->SetBranchAddress("nameA", mNameNucleusA, &b_nameA); + mHeader->SetBranchAddress("nameB", mNameNucleusB, &b_nameB); + mHeader->SetBranchAddress("massNumberA", &mMassNumberA, &b_massNumberA); + mHeader->SetBranchAddress("massNumberB", &mMassNumberB, &b_massNumberB); + mHeader->SetBranchAddress("radiusA", &mRadiusA, &b_radiusA); + mHeader->SetBranchAddress("radiusB", &mRadiusB, &b_radiusB); + mHeader->SetBranchAddress("skinDepthA", &mSkinDepthA, &b_skinDepthA); + mHeader->SetBranchAddress("skinDepthB", &mSkinDepthB, &b_skinDepthB); + mHeader->SetBranchAddress("beta2A", &mBeta2A, &b_beta2A); + mHeader->SetBranchAddress("beta4A", &mBeta4A, &b_beta4A); + mHeader->SetBranchAddress("beta2B", &mBeta2B, &b_beta2B); + mHeader->SetBranchAddress("beta4B", &mBeta4B, &b_beta4B); + mHeader->SetBranchAddress("sigmaNN", &mSigmaNN, &b_sigmaNN); + mHeader->SetBranchAddress("sqrtSNN", &mSqrtSNN, &b_sqrtSNN); + mHeader->SetBranchAddress("repulsionD", &mRepulsionD, &b_repulsionD); + mHeader->SetBranchAddress("totalXsec", &mTotalXsec, &b_totalXsec); + mHeader->SetBranchAddress("totalXsecError", &mTotalXsecError, &b_totalXsecError); + mHeader->SetBranchAddress("smearHardCore", &mSmearHardCore, &b_smearHardCore); + mHeader->SetBranchAddress("smearGaussian", &mSmearGaussian, &b_smearGaussian); + mHeader->SetBranchAddress("collisionHardCore", &mCollisionHardCore, &b_collisionHardCore); + mHeader->SetBranchAddress("collisionGaussian", &mCollisionGaussian, &b_collisionGaussian); + mHeader->SetBranchAddress("maxB", &mBMax, &b_maxB); + mHeader->SetBranchAddress("neventsAccept", &mNeventsAccept, &b_neventsAccept); + mHeader->SetBranchAddress("neventsThrow", &mNeventsThrow, &b_neventsThrow); + mHeader->SetBranchAddress("npp", &mNpp, &b_npp); + mHeader->SetBranchAddress("k", &mK, &b_k); + mHeader->SetBranchAddress("x", &mX, &b_x); + mHeader->SetBranchAddress("efficiency", &mEfficiency, &b_efficiency); + mHeader->SetBranchAddress("isConstEfficiency", &mIsConstEfficiency, &b_isConstEfficiency); + mHeader->SetBranchAddress("version", &mVersion, &b_version); + + return 1; +} + + +//____________________________________________________________________________________________________ +Int_t StGlauberTree::Open(const TString filename) +{ + if(mMode==0){ + // Read mode + mFile = TFile::Open(filename); + if(!mFile || !mFile->IsOpen()){ + Error("StGlauberTree::Open", "can't open %s", filename.Data()); + assert(0); + } + LOG_INFO << "StGlauberTree::Open Open input ROOT file: " << mFile->GetName() << endm; + + // Get tree + mTree = (TTree*) mFile->Get("tree"); + if(!mTree){ + Error("StGlauberTree::Open", "No tree found in %s", filename.Data()); + assert(0); + } + + mHeader = (TTree*) mFile->Get("header"); + if(!mHeader){ + Error("StGlauberTree::Open", "No header found in %s", filename.Data()); + assert(0); + } + + InitBranch() ; + } + else{ + // Make sure mFile/mTree/mHeader are NULL + if(mFile) delete mFile ; + if(mTree) delete mTree ; + if(mHeader) delete mHeader ; + + // Write mode + mFile = TFile::Open(filename, "recreate", "", 9); // max compression + if(!mFile || !mFile->IsOpen()){ + Error("StGlauberTree::Open", "can't open %s", filename.Data()); + assert(0); + } + LOG_INFO << "StGlauberTree::Open Open output ROOT file: " << mFile->GetName() << endm; + + // Initialization of tree + LOG_INFO << "StGlauberTree::Open Init tree" << endm; + mTree = new TTree("tree", "Event-wise information for Fast MC glauber tree"); + mTree->Branch("b", &mB, "b/D") ; // Impact parameter + mTree->Branch("npart", &mNpart, "npart/i") ; // Number of participants + mTree->Branch("ncoll", &mNcoll, "ncoll/i") ; // Number of collicipants + mTree->Branch("mult", &mMultiplicity, "mult/i") ; // Multiplicity + mTree->Branch("theta", mTheta, "theta[2]/D") ; // Polar angle rotation for deformed nuclei + mTree->Branch("phi", mPhi, "phi[2]/D") ; // Azimuthal angle rotation for deformed nuclei + mTree->Branch("sumx", mSumX, "sumx[4]/D") ; // + mTree->Branch("sumy", mSumY, "sumy[4]/D") ; // + mTree->Branch("sumx2", mSumX2, "sumx2[4]/D") ; // + mTree->Branch("sumy2", mSumY2, "sumy2[4]/D") ; // + mTree->Branch("sumxy", mSumXY, "sumxy[4]/D") ; // + mTree->Branch("eccrp2", mEccRP2, "eccrp2[4]/D") ; // 2nd order Reaction plane eccentricity + mTree->Branch("eccpp2", mEccPP2, "eccpp2[4]/D") ; // 2nd order Participant plane eccentricity + mTree->Branch("eccpp3", mEccPP3, "eccpp3[4]/D") ; // 3rd order Participant plane eccentricity + mTree->Branch("eccpp4", mEccPP4, "eccpp4[4]/D") ; // 4th order Participant plane eccentricity + mTree->Branch("pp2", mPP2, "pp2[4]/D") ; // 2nd order participant plane + mTree->Branch("pp3", mPP3, "pp3[4]/D") ; // 3rd order participant plane + mTree->Branch("pp4", mPP4, "pp4[4]/D") ; // 4th order participant plane + + mHeader = new TTree("header", "Constants used in the Fast MC glauber"); + mHeader->Branch("nameA", mNameNucleusA, "nameA[2]/C"); + mHeader->Branch("nameB", mNameNucleusB, "nameB[2]/C"); + mHeader->Branch("massNumberA", &mMassNumberA, "massNumberA/i"); + mHeader->Branch("massNumberB", &mMassNumberB, "massNumberB/i"); + mHeader->Branch("radiusA", &mRadiusA, "radiusA/F"); + mHeader->Branch("radiusB", &mRadiusB, "radiusB/F"); + mHeader->Branch("skinDepthA", &mSkinDepthA, "skinDepthA/F"); + mHeader->Branch("skinDepthB", &mSkinDepthB, "skinDepthB/F"); + mHeader->Branch("beta2A", &mBeta2A, "beta2A/F"); + mHeader->Branch("beta4A", &mBeta4A, "beta4A/F"); + mHeader->Branch("beta2B", &mBeta2B, "beta2B/F"); + mHeader->Branch("beta4B", &mBeta4B, "beta4B/F"); + mHeader->Branch("sigmaNN", &mSigmaNN, "sigmaNN/F"); + mHeader->Branch("sqrtSNN", &mSqrtSNN, "sqrtSNN/F"); + mHeader->Branch("repulsionD", &mRepulsionD, "repulsionD/F"); + mHeader->Branch("totalXsec", &mTotalXsec, "totalXsec/F"); + mHeader->Branch("totalXsecError", &mTotalXsecError, "totalXsecError/F"); + mHeader->Branch("smearHardCore", &mSmearHardCore, "smearHardCore/i"); + mHeader->Branch("smearGaussian", &mSmearGaussian, "smearGaussian/i"); + mHeader->Branch("collisionHardCore", &mCollisionHardCore, "collisionHardCore/i"); + mHeader->Branch("collisionGaussian", &mCollisionGaussian, "collisionGaussian/i"); + mHeader->Branch("maxB", &mBMax, "maxB/F"); + mHeader->Branch("neventsAccept", &mNeventsAccept, "neventsAccept/i"); + mHeader->Branch("neventsThrow", &mNeventsThrow, "neventsThrow/i"); + mHeader->Branch("npp", &mNpp, "npp/F"); + mHeader->Branch("k", &mK, "k/F"); + mHeader->Branch("x", &mX, "x/F"); + mHeader->Branch("efficiency", &mEfficiency, "efficiency/F"); + mHeader->Branch("isConstEfficiency", &mIsConstEfficiency, "isConstEfficiency/i"); + mHeader->Branch("version", &mVersion, "version/i"); + } + + return 1; +} + +//____________________________________________________________________________________________________ +void StGlauberTree::Sort() +{ + /// Sort objects in ROOT file (write mode only) + if( mMode == 1 ) mFile->GetList()->Sort() ; +} + +//____________________________________________________________________________________________________ +Int_t StGlauberTree::Fill() +{ + return mTree->Fill(); +} + +//____________________________________________________________________________________________________ +Int_t StGlauberTree::FillHeader() +{ + return mHeader->Fill(); +} + +//____________________________________________________________________________________________________ +Int_t StGlauberTree::Close() +{ + LOG_INFO << "StGlauberTree::Close close ROOT file : " << mFile->GetName() << endm; + if(mMode==1) mFile->Write(); + mFile->Close(); + + return 1; +} + +//____________________________________________________________________________________________________ +Int_t StGlauberTree::GetEntries() const +{ + return mTree->GetEntries() ; +} + +//____________________________________________________________________________________________________ +Int_t StGlauberTree::GetEntry(const Int_t ievent) +{ + return mTree->GetEntry(ievent); +} + +//____________________________________________________________________________________________________ +Double_t StGlauberTree::GetSigmaA2(const Double_t a2, const Double_t a) const +{ + const Double_t val = a2 - a*a ; + if( val < 0.0 ){ + Error("GetSigmaA2", "{a^2}-{a}^2 < 0 (= %1.3f)", val); + return -9999. ; + } + + return a2 - a*a ; +} + +//____________________________________________________________________________________________________ +Double_t StGlauberTree::GetSigmaXY(const Double_t xy, const Double_t x, const Double_t y) const +{ + return xy - x*y ; +} + +//____________________________________________________________________________________________________ +Double_t StGlauberTree::GetSRP(const UInt_t id) const +{ + /// S_{RP} = pi * sqrt(sigma_x^2 * sigma_y^2) + + if( id >= 4 ){ + Error("StGlauberTree::GetSRP", "Unknown id, id=%3d. abort", id); + assert(0); + } + + const Double_t sigmax2 = GetSigmaA2(mSumX2[id], mSumX[id]); + const Double_t sigmay2 = GetSigmaA2(mSumY2[id], mSumY[id]); + const Double_t area = TMath::Pi() * TMath::Sqrt(sigmax2*sigmay2) ; + + return area ; +} + +//____________________________________________________________________________________________________ +Double_t StGlauberTree::GetSPP(const UInt_t id) const +{ + /// S_{PP} = pi * sqrt(sigma_x^2 * sigma_y^2 - sigma_{xy}^2} + + if( id >= 4 ){ + Error("StGlauberTree::GetSPP", "Unknown id, id=%3d. abort", id); + assert(0); + } + + const Double_t sigmax2 = GetSigmaA2(mSumX2[id], mSumX[id]); + const Double_t sigmay2 = GetSigmaA2(mSumY2[id], mSumY[id]); + const Double_t sigmaxy = GetSigmaXY(mSumXY[id], mSumX[id], mSumY[id]); + const Double_t term = sigmax2*sigmay2 - sigmaxy*sigmaxy ; + if( term < 0 ) return -9999. ; + + return TMath::Pi() * TMath::Sqrt(term) ; +} + +//____________________________________________________________________________________________________ +void StGlauberTree::SetNameNucleusA(const Char_t* val) +{ + sprintf(mNameNucleusA, "%s", val); +} + +//____________________________________________________________________________________________________ +void StGlauberTree::SetNameNucleusB(const Char_t* val) +{ + sprintf(mNameNucleusB, "%s", val); +} + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberTree/StGlauberTree.h b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberTree/StGlauberTree.h new file mode 100644 index 00000000000..706633d94e9 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberTree/StGlauberTree.h @@ -0,0 +1,370 @@ +//==================================================================================================== +// Glauber MC tree +// - Event-wise tree contains Npart, Ncoll, eccentricity etc +// - Header tree contains all relevavnt parameters used in the Glauber MC simulation +// +// You can access the data members by +// Get*() functions, like GetNpart() +// +//==================================================================================================== +// $Id: StGlauberTree.h,v 1.2 2012/04/25 04:45:26 hmasui Exp $ +// $Log: StGlauberTree.h,v $ +// Revision 1.2 2012/04/25 04:45:26 hmasui +// Expand branches for eccentricity in the main tree, and deformation parameters in header +// +//==================================================================================================== + +#ifndef __StGlauberTree_h__ +#define __StGlauberTree_h__ + +class TBranch ; +class TFile ; +class TTree ; +#include "TString.h" + +//____________________________________________________________________________________________________ +// Class StGlauberTree: MC Glauber ROOT tree (read/write) +class StGlauberTree { + public: + // Mode + // 0 read + // 1 write + StGlauberTree(const UInt_t mode=0); /// Default constructor + virtual ~StGlauberTree(); /// Default destructor + + Int_t Clear() ; /// Clear data members + Int_t Open(const TString filename) ; /// Open ROOT file, initialize tree + void Sort() ; /// Sort outputs in ROOT file + Int_t Fill() ; /// Fill event-wise tree + Int_t FillHeader() ; /// Fill header tree + Int_t Close() ; /// Close ROOT file + + Int_t GetEntries() const ; /// Get entries + Int_t GetEntry(const Int_t ievent) ; /// Get entry for all branches + + // Setter/Getter for event-wise tree + void SetB (const Double_t val) ; + void SetNpart (const UInt_t val) ; + void SetNcoll (const UInt_t val) ; + void SetMultiplicity (const UInt_t val) ; + void SetTheta (const UInt_t id, const Double_t val) ; + void SetPhi (const UInt_t id, const Double_t val) ; + void SetSumX (const UInt_t id, const Double_t val) ; + void SetSumY (const UInt_t id, const Double_t val) ; + void SetSumX2 (const UInt_t id, const Double_t val) ; + void SetSumY2 (const UInt_t id, const Double_t val) ; + void SetSumXY (const UInt_t id, const Double_t val) ; + void SetEccRP2 (const UInt_t id, const Double_t val) ; + void SetEccPP2 (const UInt_t id, const Double_t val) ; + void SetEccPP3 (const UInt_t id, const Double_t val) ; + void SetEccPP4 (const UInt_t id, const Double_t val) ; + void SetPP2 (const UInt_t id, const Double_t val) ; + void SetPP3 (const UInt_t id, const Double_t val) ; + void SetPP4 (const UInt_t id, const Double_t val) ; + + Double_t GetB () const ; + UInt_t GetNpart () const ; + UInt_t GetNcoll () const ; + UInt_t GetMultiplicity () const ; + Double_t GetTheta (const UInt_t id) const ; // polar angle rotation + Double_t GetPhi (const UInt_t id) const ; // azimuthal angle rotation + Double_t GetSumX (const UInt_t id) const ; // {x} + Double_t GetSumY (const UInt_t id) const ; // {y} + Double_t GetSumX2 (const UInt_t id) const ; // {x^2} + Double_t GetSumY2 (const UInt_t id) const ; // {y^2} + Double_t GetSumXY (const UInt_t id) const ; // {xy} + Double_t GetEccRP2 (const UInt_t id) const ; // 2nd order Reaction plane eccentricity + Double_t GetEccPP2 (const UInt_t id) const ; // 2nd order Participant plane eccentricity + Double_t GetEccPP3 (const UInt_t id) const ; // 3rd order Participant plane eccentricity + Double_t GetEccPP4 (const UInt_t id) const ; // 4th order Participant plane eccentricity + Double_t GetPP2 (const UInt_t id) const ; // 2nd order participant plane + Double_t GetPP3 (const UInt_t id) const ; // 3rd order participant plane + Double_t GetPP4 (const UInt_t id) const ; // 4th order participant plane + + Double_t GetSigmaA2 (const Double_t a2, const Double_t a) const ; // {a^2} - {a}^2 + Double_t GetSigmaXY (const Double_t xy, const Double_t x, const Double_t y) const ; // {xy} - {x}{y} + Double_t GetSRP (const UInt_t id) const ; // Reaction plane area (fm^2) + Double_t GetSPP (const UInt_t id) const ; // Participant plane area (fm^2) + + // For header tree + void SetNameNucleusA (const Char_t* val) ; + void SetNameNucleusB (const Char_t* val) ; + void SetMassNumberA (const UInt_t val) ; + void SetMassNumberB (const UInt_t val) ; + void SetRadiusA (const Float_t val) ; + void SetRadiusB (const Float_t val) ; + void SetSkinDepthA (const Float_t val) ; + void SetSkinDepthB (const Float_t val) ; + void SetBeta2A (const Float_t val) ; + void SetBeta4A (const Float_t val) ; + void SetBeta2B (const Float_t val) ; + void SetBeta4B (const Float_t val) ; + void SetSigmaNN (const Float_t val) ; + void SetSqrtSNN (const Float_t val) ; + void SetRepulsionD (const Float_t val) ; + void SetTotalXsec (const Float_t val) ; + void SetTotalXsecError (const Float_t val) ; + void SetSmearHardCore (const UInt_t val) ; + void SetSmearGaussian (const UInt_t val) ; + void SetCollisionHardCore (const UInt_t val) ; + void SetCollisionGaussian (const UInt_t val) ; + void SetBMax (const Float_t val) ; + void SetNeventsAccept (const UInt_t val) ; + void SetNeventsThrow (const UInt_t val) ; + void SetNpp (const Float_t val) ; + void SetK (const Float_t val) ; + void SetX (const Float_t val) ; + void SetEfficiency (const Float_t val) ; + void SetIsConstEfficiency (const UInt_t val) ; + void SetVersion (const UInt_t val) ; + + Char_t* GetNameNucleusA () ; + Char_t* GetNameNucleusB () ; + UInt_t GetMassNumberA () const ; + UInt_t GetMassNumberB () const ; + Float_t GetRadiusA () const ; + Float_t GetRadiusB () const ; + Float_t GetSkinDepthA () const ; + Float_t GetSkinDepthB () const ; + Float_t GetBeta2A () const ; + Float_t GetBeta4A () const ; + Float_t GetBeta2B () const ; + Float_t GetBeta4B () const ; + Float_t GetSigmaNN () const ; + Float_t GetSqrtSNN () const ; + Float_t GetRepulsionD () const ; + Float_t GetTotalXsec () const ; + Float_t GetTotalXsecError () const ; + UInt_t GetSmearHardCore () const ; + UInt_t GetSmearGaussian () const ; + UInt_t GetCollisionHardCore () const ; + UInt_t GetCollisionGaussian () const ; + Float_t GetBMax () const ; + UInt_t GetNeventsAccept () const ; + UInt_t GetNeventsThrow () const ; + Float_t GetNpp () const ; + Float_t GetK () const ; + Float_t GetX () const ; + Float_t GetEfficiency () const ; + UInt_t GetIsConstEfficiency () const ; + UInt_t GetVersion () const ; + + private: + // Initialize branches (in read mode) + Int_t InitBranch() ; + + const UInt_t mMode ; /// Mode (0=read, 1=write) + TFile* mFile ; /// Input/output ROOT file + TTree* mTree ; /// MC Glauber event-wise tree + TTree* mHeader ; /// Header tree to store constants + + // Data members in event-wise tree + Double_t mB ; /// Impact parameter + UInt_t mNpart ; /// Number of participants + UInt_t mNcoll ; /// Number of collisions + UInt_t mMultiplicity ; /// Two component model multiplicity + Double_t mTheta[2] ; /// Polar angle rotation (relevant only for deformed nuclei) + Double_t mPhi[2] ; /// Azimuthal angle rotation (relevant only for deformed nuclei) + Double_t mSumX[4] ; /// (0:Npart, 1:Ncoll, 2:multiplicity, 3:spectator) + Double_t mSumY[4] ; /// (0:Npart, 1:Ncoll, 2:multiplicity, 3:spectator) + Double_t mSumX2[4] ; /// (0:Npart, 1:Ncoll, 2:multiplicity, 3:spectator) + Double_t mSumY2[4] ; /// (0:Npart, 1:Ncoll, 2:multiplicity, 3:spectator) + Double_t mSumXY[4] ; /// (0:Npart, 1:Ncoll, 2:multiplicity, 3:spectator) + Double_t mEccRP2[4] ; /// 2nd order Reaction plane eccentricity (0:Npart, 1:Ncoll, 2:multiplicity, 3:spectator) + Double_t mEccPP2[4] ; /// 2nd order Participant plane eccentricity (0:Npart, 1:Ncoll, 2:multiplicity, 3:spectator) + Double_t mEccPP3[4] ; /// 3rd order Participant plane eccentricity (0:Npart, 1:Ncoll, 2:multiplicity, 3:spectator) + Double_t mEccPP4[4] ; /// 4th order Participant plane eccentricity (0:Npart, 1:Ncoll, 2:multiplicity, 3:spectator) + Double_t mPP2[4] ; /// 2nd order participant plane + Double_t mPP3[4] ; /// 3rd order participant plane + Double_t mPP4[4] ; /// 4th order participant plane + + // Data members in header + Char_t mNameNucleusA[4] ; /// Name of nucleus A (like 'Au') + Char_t mNameNucleusB[4] ; /// Name of nucleus B (like 'Au') + UInt_t mMassNumberA ; /// Mass number of nucleus A + UInt_t mMassNumberB ; /// Mass number of nucleus B + Float_t mRadiusA ; /// Radius of nucleus A (fm) + Float_t mRadiusB ; /// Radius of nucleus B (fm) + Float_t mSkinDepthA ; /// Skin depth of nucleus A (fm) + Float_t mSkinDepthB ; /// Skin depth of nucleus B (fm) + Float_t mBeta2A ; /// 2nd order deformation parameter for nucleus A + Float_t mBeta4A ; /// 4th order deformation parameter for nucleus A + Float_t mBeta2B ; /// 2nd order deformation parameter for nucleus B + Float_t mBeta4B ; /// 4th order deformation parameter for nucleus B + Float_t mSigmaNN ; /// Inelastic nucleon-nucleon cross section (mb) + Float_t mSqrtSNN ; /// Center of mass energy (GeV) + Float_t mRepulsionD ; /// Repulsion distance (fm) + Float_t mTotalXsec ; /// Total geometrical cross section (mb) + Float_t mTotalXsecError ; /// Error of total geometrical cross section (mb) + UInt_t mSmearHardCore ; /// Flag for hard-core smearing (1=ON) + UInt_t mSmearGaussian ; /// Flag for gaussian smearing (1=ON) + UInt_t mCollisionHardCore ; /// Flag for hard-core collision profile (1=ON) + UInt_t mCollisionGaussian ; /// Flag for gaussian collision profile (1=ON) + Float_t mBMax ; /// Maximum impact parameter + UInt_t mNeventsAccept ; /// Number of accepted events + UInt_t mNeventsThrow ; /// Number of total events thrown + Float_t mNpp ; /// Npp parameter in NBD + Float_t mK ; /// k parameter in NBD + Float_t mX ; /// x parameter in NBD (fraction of hard component) + Float_t mEfficiency ; /// Efficiency or d value used in NBD + UInt_t mIsConstEfficiency ; /// Constant efficiency(=1) or multiplicity dependent efficiency(=0) + UInt_t mVersion ; /// Version of StFastGlauberMcMaker + + // Branches + TBranch* b_b ; + TBranch* b_npart ; + TBranch* b_ncoll ; + TBranch* b_mult ; + TBranch* b_theta ; + TBranch* b_phi ; + TBranch* b_sumx ; + TBranch* b_sumy ; + TBranch* b_sumx2 ; + TBranch* b_sumy2 ; + TBranch* b_sumxy ; + TBranch* b_eccrp2 ; + TBranch* b_eccpp2 ; + TBranch* b_eccpp3 ; + TBranch* b_eccpp4 ; + TBranch* b_pp2 ; + TBranch* b_pp3 ; + TBranch* b_pp4 ; + + TBranch* b_nameA ; + TBranch* b_nameB ; + TBranch* b_massNumberA ; + TBranch* b_massNumberB ; + TBranch* b_radiusA ; + TBranch* b_radiusB ; + TBranch* b_skinDepthA ; + TBranch* b_skinDepthB ; + TBranch* b_beta2A ; + TBranch* b_beta4A ; + TBranch* b_beta2B ; + TBranch* b_beta4B ; + TBranch* b_sigmaNN ; + TBranch* b_sqrtSNN ; + TBranch* b_repulsionD ; + TBranch* b_totalXsec ; + TBranch* b_totalXsecError ; + TBranch* b_smearHardCore ; + TBranch* b_smearGaussian ; + TBranch* b_collisionHardCore ; + TBranch* b_collisionGaussian ; + TBranch* b_maxB ; + TBranch* b_neventsAccept ; + TBranch* b_neventsThrow ; + TBranch* b_npp ; + TBranch* b_k ; + TBranch* b_x ; + TBranch* b_efficiency ; + TBranch* b_isConstEfficiency ; + TBranch* b_version ; + + ClassDef(StGlauberTree, 1) +}; + +// Setter for event-wise tree +inline void StGlauberTree::SetB (const Double_t val) { mB = val ; } +inline void StGlauberTree::SetNpart (const UInt_t val) { mNpart = val ; } +inline void StGlauberTree::SetNcoll (const UInt_t val) { mNcoll = val ; } +inline void StGlauberTree::SetMultiplicity (const UInt_t val) { mMultiplicity = val ; } +inline void StGlauberTree::SetTheta (const UInt_t id, const Double_t val) { mTheta[id] = val ; } +inline void StGlauberTree::SetPhi (const UInt_t id, const Double_t val) { mPhi[id] = val ; } +inline void StGlauberTree::SetSumX (const UInt_t id, const Double_t val) { mSumX[id] = val ; } +inline void StGlauberTree::SetSumY (const UInt_t id, const Double_t val) { mSumY[id] = val ; } +inline void StGlauberTree::SetSumX2 (const UInt_t id, const Double_t val) { mSumX2[id] = val ; } +inline void StGlauberTree::SetSumY2 (const UInt_t id, const Double_t val) { mSumY2[id] = val ; } +inline void StGlauberTree::SetSumXY (const UInt_t id, const Double_t val) { mSumXY[id] = val ; } +inline void StGlauberTree::SetEccRP2 (const UInt_t id, const Double_t val) { mEccRP2[id] = val ; } +inline void StGlauberTree::SetEccPP2 (const UInt_t id, const Double_t val) { mEccPP2[id] = val ; } +inline void StGlauberTree::SetEccPP3 (const UInt_t id, const Double_t val) { mEccPP3[id] = val ; } +inline void StGlauberTree::SetEccPP4 (const UInt_t id, const Double_t val) { mEccPP4[id] = val ; } +inline void StGlauberTree::SetPP2 (const UInt_t id, const Double_t val) { mPP2[id] = val ; } +inline void StGlauberTree::SetPP3 (const UInt_t id, const Double_t val) { mPP3[id] = val ; } +inline void StGlauberTree::SetPP4 (const UInt_t id, const Double_t val) { mPP4[id] = val ; } + +// Getter for event-wise tree +inline Double_t StGlauberTree::GetB () const { return mB ; } +inline UInt_t StGlauberTree::GetNpart () const { return mNpart ; } +inline UInt_t StGlauberTree::GetNcoll () const { return mNcoll ; } +inline UInt_t StGlauberTree::GetMultiplicity () const { return mMultiplicity ; } +inline Double_t StGlauberTree::GetTheta (const UInt_t id) const { return mTheta[id] ; } +inline Double_t StGlauberTree::GetPhi (const UInt_t id) const { return mPhi[id] ; } +inline Double_t StGlauberTree::GetSumX (const UInt_t id) const { return mSumX[id] ; } +inline Double_t StGlauberTree::GetSumY (const UInt_t id) const { return mSumY[id] ; } +inline Double_t StGlauberTree::GetSumX2 (const UInt_t id) const { return mSumX2[id] ; } +inline Double_t StGlauberTree::GetSumY2 (const UInt_t id) const { return mSumY2[id] ; } +inline Double_t StGlauberTree::GetSumXY (const UInt_t id) const { return mSumXY[id] ; } +inline Double_t StGlauberTree::GetEccRP2 (const UInt_t id) const { return mEccRP2[id] ; } +inline Double_t StGlauberTree::GetEccPP2 (const UInt_t id) const { return mEccPP2[id] ; } +inline Double_t StGlauberTree::GetEccPP3 (const UInt_t id) const { return mEccPP3[id] ; } +inline Double_t StGlauberTree::GetEccPP4 (const UInt_t id) const { return mEccPP4[id] ; } +inline Double_t StGlauberTree::GetPP2 (const UInt_t id) const { return mPP2[id] ; } +inline Double_t StGlauberTree::GetPP3 (const UInt_t id) const { return mPP3[id] ; } +inline Double_t StGlauberTree::GetPP4 (const UInt_t id) const { return mPP4[id] ; } + +// Setter for header tree +inline void StGlauberTree::SetMassNumberA (const UInt_t val) { mMassNumberA = val ; } +inline void StGlauberTree::SetMassNumberB (const UInt_t val) { mMassNumberB = val ; } +inline void StGlauberTree::SetRadiusA (const Float_t val) { mRadiusA = val ; } +inline void StGlauberTree::SetRadiusB (const Float_t val) { mRadiusB = val ; } +inline void StGlauberTree::SetSkinDepthA (const Float_t val) { mSkinDepthA = val ; } +inline void StGlauberTree::SetSkinDepthB (const Float_t val) { mSkinDepthB = val ; } +inline void StGlauberTree::SetBeta2A (const Float_t val) { mBeta2A = val ; } +inline void StGlauberTree::SetBeta4A (const Float_t val) { mBeta4A = val ; } +inline void StGlauberTree::SetBeta2B (const Float_t val) { mBeta2B = val ; } +inline void StGlauberTree::SetBeta4B (const Float_t val) { mBeta4B = val ; } +inline void StGlauberTree::SetSigmaNN (const Float_t val) { mSigmaNN = val ; } +inline void StGlauberTree::SetSqrtSNN (const Float_t val) { mSqrtSNN = val ; } +inline void StGlauberTree::SetRepulsionD (const Float_t val) { mRepulsionD = val ; } +inline void StGlauberTree::SetTotalXsec (const Float_t val) { mTotalXsec = val ; } +inline void StGlauberTree::SetTotalXsecError (const Float_t val) { mTotalXsecError = val ; } +inline void StGlauberTree::SetSmearHardCore (const UInt_t val) { mSmearHardCore = val ; } +inline void StGlauberTree::SetSmearGaussian (const UInt_t val) { mSmearGaussian = val ; } +inline void StGlauberTree::SetCollisionHardCore (const UInt_t val) { mCollisionHardCore = val ; } +inline void StGlauberTree::SetCollisionGaussian (const UInt_t val) { mCollisionGaussian = val ; } +inline void StGlauberTree::SetBMax (const Float_t val) { mBMax = val ; } +inline void StGlauberTree::SetNeventsAccept (const UInt_t val) { mNeventsAccept = val ; } +inline void StGlauberTree::SetNeventsThrow (const UInt_t val) { mNeventsThrow = val ; } +inline void StGlauberTree::SetNpp (const Float_t val) { mNpp = val ; } +inline void StGlauberTree::SetK (const Float_t val) { mK = val ; } +inline void StGlauberTree::SetX (const Float_t val) { mX = val ; } +inline void StGlauberTree::SetEfficiency (const Float_t val) { mEfficiency = val ; } +inline void StGlauberTree::SetIsConstEfficiency (const UInt_t val) { mIsConstEfficiency = val ; } +inline void StGlauberTree::SetVersion (const UInt_t val) { mVersion = val ; } + +inline Char_t* StGlauberTree::GetNameNucleusA () { return mNameNucleusA ; } +inline Char_t* StGlauberTree::GetNameNucleusB () { return mNameNucleusB ; } +inline UInt_t StGlauberTree::GetMassNumberA () const { return mMassNumberA ; } +inline UInt_t StGlauberTree::GetMassNumberB () const { return mMassNumberB ; } +inline Float_t StGlauberTree::GetRadiusA () const { return mRadiusA ; } +inline Float_t StGlauberTree::GetRadiusB () const { return mRadiusB ; } +inline Float_t StGlauberTree::GetSkinDepthA () const { return mSkinDepthA ; } +inline Float_t StGlauberTree::GetSkinDepthB () const { return mSkinDepthB ; } +inline Float_t StGlauberTree::GetBeta2A () const { return mBeta2A ; } +inline Float_t StGlauberTree::GetBeta4A () const { return mBeta4A ; } +inline Float_t StGlauberTree::GetBeta2B () const { return mBeta2B ; } +inline Float_t StGlauberTree::GetBeta4B () const { return mBeta4B ; } +inline Float_t StGlauberTree::GetSigmaNN () const { return mSigmaNN ; } +inline Float_t StGlauberTree::GetSqrtSNN () const { return mSqrtSNN ; } +inline Float_t StGlauberTree::GetRepulsionD () const { return mRepulsionD ; } +inline Float_t StGlauberTree::GetTotalXsec () const { return mTotalXsec ; } +inline Float_t StGlauberTree::GetTotalXsecError () const { return mTotalXsecError ; } +inline UInt_t StGlauberTree::GetSmearHardCore () const { return mSmearHardCore ; } +inline UInt_t StGlauberTree::GetSmearGaussian () const { return mSmearGaussian ; } +inline UInt_t StGlauberTree::GetCollisionHardCore () const { return mCollisionHardCore ; } +inline UInt_t StGlauberTree::GetCollisionGaussian () const { return mCollisionGaussian ; } +inline Float_t StGlauberTree::GetBMax () const { return mBMax ; } +inline UInt_t StGlauberTree::GetNeventsAccept () const { return mNeventsAccept ; } +inline UInt_t StGlauberTree::GetNeventsThrow () const { return mNeventsThrow ; } +inline Float_t StGlauberTree::GetNpp () const { return mNpp ; } +inline Float_t StGlauberTree::GetK () const { return mK ; } +inline Float_t StGlauberTree::GetX () const { return mX ; } +inline Float_t StGlauberTree::GetEfficiency () const { return mEfficiency ; } +inline UInt_t StGlauberTree::GetIsConstEfficiency () const { return mIsConstEfficiency ; } +inline UInt_t StGlauberTree::GetVersion () const { return mVersion ; } + + +#endif + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberUtilities/StGlauberUtilities.cxx b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberUtilities/StGlauberUtilities.cxx new file mode 100644 index 00000000000..86da7308536 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberUtilities/StGlauberUtilities.cxx @@ -0,0 +1,216 @@ +/**************************************************************************************************** + * $Id: StGlauberUtilities.cxx,v 1.2 2012/04/25 04:42:37 hmasui Exp $ + * $Log: StGlauberUtilities.cxx,v $ + * Revision 1.2 2012/04/25 04:42:37 hmasui + * Moved several functions from StFastGlauberMcMaker. Added namespace GlauberUtilities + * + * +****************************************************************************************************/ +//---------------------------------------------------------------------------------------------------- +// Random number generators for +// - impact parameter (dN/db = b) in 0 < r < 20 fm +// - radius from several different density profile +// - phi & theta angles for nucleons +//---------------------------------------------------------------------------------------------------- + +#include + +#include "TClass.h" +#include "TError.h" +#include "TF1.h" +#include "TMath.h" +#include "TRandom.h" +#include "TRandom3.h" + +#include "StMessMgr.h" +#include "StGlauberUtilities.h" + +ClassImp(StGlauberUtilities) + +namespace GlauberUtilities { + //____________________________________________________________________________________________________ + // Woods-saxon density profile (1D for spherical nuclei) + Double_t WoodsSaxon(Double_t* x, Double_t* par) + { + const Double_t r = x[0] ; + const Double_t R = par[0] ; + const Double_t d = par[1] ; + + return r*r/(1.0+TMath::Exp((r-R)/d)) ; + } + + //____________________________________________________________________________________________________ + // Woods-saxon density profile (2D for deformed nuclei) + Double_t WoodsSaxon2D(Double_t* x, Double_t* par) + { + const Double_t r = x[0] ; + const Double_t cosTheta = x[1] ; + const Double_t R0 = par[0] ; + const Double_t d = par[1] ; + const Double_t beta2 = par[2] ; // Parameter for deformation (beta2=0 --> Standard woods-saxon density) + const Double_t beta4 = par[3] ; // Parameter for deformation (beta4=0 --> Standard woods-saxon density) + const Double_t beta6 = 0.0 ; + + const Double_t cosTheta2 = cosTheta * cosTheta ; + const Double_t cosTheta4 = cosTheta2 * cosTheta2 ; + + // Spherical harmonics (l=2, m=0) Y20(theta) = 1/4 sqrt(5/pi) * (3cos^2(theta) - 1) + const Double_t Y20 = TMath::Sqrt(5.0/TMath::Pi()) / 4.0 * (3.0 * cosTheta2 - 1.0 ) ; + const Double_t Y40 = TMath::Sqrt(1.0/TMath::Pi()) * 3.0 / 16.0 * (35.0*cosTheta4 - 30.0*cosTheta2 + 3.0); + // const Double_t Y60 = TMath::Sqrt(13.0/TMath::Pi()) / 32.0 * (231.0*cosTheta4*cosTheta2 - 315.0*cosTheta4 + 105.0*cosTheta2 - 5.0) ; + const Double_t Y60 = 0.0 ; + + const Double_t R = R0 * (1.0 + beta2 * Y20 + beta4 * Y40 + beta6 * Y60 ) ; + + return r*r/(1.0+TMath::Exp((r-R)/d)) ; + } + + //____________________________________________________________________________________________________ + // Step function + Double_t StepFunction(Double_t* x, Double_t* par) + { + Double_t dx = x[0] ; + Double_t dy = x[1] ; + Double_t dz = x[2] ; + Double_t position = TMath::Sqrt(dx*dx + dy*dy + dz*dz); + Double_t sigma = par[0] ; + + const Double_t pi = TMath::Pi() ; + const Double_t r2 = sigma/pi ; + const Double_t r = TMath::Sqrt(r2); + // return (r - position < 0.0) ? 0.0 : 1.0 ; + + const Double_t V = 4.0*pi*r2*r/3.0 ; + return (r - position < 0.0) ? 0.0 : 1.0/V ; + } + + //____________________________________________________________________________________________________ + // Gaussian function + Double_t Gaussian(Double_t* x, Double_t* par) + { + Double_t dx = x[0] ; + Double_t dy = x[1] ; + Double_t dz = x[2] ; + Double_t r = TMath::Sqrt(dx*dx + dy*dy + dz*dz) ; + Double_t sigma2 = par[0]*par[0] ; + const Double_t norm = 2.0*TMath::Pi()*sigma2 ; + + return 1.0/TMath::Power(norm, 3.0/2.0) * TMath::Exp(-0.5*r*r/sigma2); + } +} + + StGlauberUtilities* StGlauberUtilities::mInstance = 0 ; + const UShort_t StGlauberUtilities::mDebugLevel = 20 ; + +//____________________________________________________________________________________________________ +// Get singleton +StGlauberUtilities* StGlauberUtilities::instance() +{ + if(!mInstance){ + mInstance = new StGlauberUtilities() ; + } + + return mInstance ; +} + +//____________________________________________________________________________________________________ +// Default constructor +StGlauberUtilities::StGlauberUtilities() +{ + LOG_INFO << "StGlauberUtilities Initialize StGlauberUtilities" << endm; + + /// Define TRandom and seed here, will be used in any classes + mRandom = new TRandom3() ; + mRandom->SetSeed(0); + LOG_INFO << "StGlauberUtilities Set random number seed = " << mRandom->GetSeed() << endm; + + /// Define impact parameter distribution in 0 < r < 20 fm + mImpactParameter = new TF1("mImpactParameter", "x", 0, 20.0); + LOG_INFO << "StGlauberUtilities Set impact parameter distributions: " + << mImpactParameter->GetXmin() + << " < b < " + << mImpactParameter->GetXmax() + << " fm" << endm; + + mDebug = 0 ; +} + +//____________________________________________________________________________________________________ +// Default destructor +StGlauberUtilities::~StGlauberUtilities() +{ +} + +//____________________________________________________________________________________________________ +Double_t StGlauberUtilities::GetImpactParameter() const +{ + /// Generate random impact parameter in 0 < r < 20 fm + /// according to the dN/db = b + if(!mImpactParameter){ + Error("StGlauberUtilities::GetImpactParameter", "cannot find impact parameter distribution (TF1). abort"); + assert(0); + } + const Double_t b = mImpactParameter->GetRandom() ; + + if( mDebug > 0 ){ + LOG_INFO << "StGlauberUtilities::GetImpactParameter Generate random b = " + << b + << " (fm)" << endm; + } + + return b ; +} + +//____________________________________________________________________________________________________ +Double_t StGlauberUtilities::GetMaximumImpactParameter() const +{ + return mImpactParameter->GetXmax() ; +} + +//____________________________________________________________________________________________________ +Double_t StGlauberUtilities::GetTheta() const +{ + /// Generate random polar angle in 0 < theta < pi + /// according to the dN/dtheta = cos(theta) + const Double_t theta = TMath::ACos(mRandom->Rndm()*2.0-1.0); + + if( mDebug > 0 ){ + LOG_INFO << "StGlauberUtilities::GetTheta Generate random theta = " << theta << endm; + } + + return theta ; +} + +//____________________________________________________________________________________________________ +Double_t StGlauberUtilities::GetPhi() const +{ + /// Generate flat phi angle in -pi < phi < pi + const Double_t phi = mRandom->Rndm()*TMath::Pi()*2.0 - TMath::Pi() ; + + if( mDebug > 0 ){ + LOG_INFO << "StGlauberUtilities::GetPhi Generate random phi = " << phi << endm; + } + + return phi ; +} + +//____________________________________________________________________________________________________ +Double_t StGlauberUtilities::GetUniform() const +{ + /// Uniform distribution in 0 < x < 1 + return mRandom->Rndm() ; +} +//____________________________________________________________________________________________________ +Double_t StGlauberUtilities::GetUniform2() const +{ + /// Uniform distribution in 0 < x < 2 + return mRandom->Uniform(0,2); +} + +//____________________________________________________________________________________________________ +void StGlauberUtilities::SetDebug(const UInt_t debug) +{ + mDebug = debug ; + LOG_INFO << "StGlauberUtilities::SetDebug Set debug level = " << mDebug << endm; +} + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberUtilities/StGlauberUtilities.h b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberUtilities/StGlauberUtilities.h new file mode 100644 index 00000000000..bc45890038a --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/StGlauberUtilities/StGlauberUtilities.h @@ -0,0 +1,74 @@ +/**************************************************************************************************** + * $Id: StGlauberUtilities.h,v 1.2 2012/04/25 04:42:37 hmasui Exp $ + * $Log: StGlauberUtilities.h,v $ + * Revision 1.2 2012/04/25 04:42:37 hmasui + * Moved several functions from StFastGlauberMcMaker. Added namespace GlauberUtilities + * + * +****************************************************************************************************/ + +#ifndef __StGlauberUtilities_h__ +#define __StGlauberUtilities_h__ + +class TF1 ; +class TRandom ; +class TRandom3 ; +#include "Rtypes.h" + +//____________________________________________________________________________________________________ +// Class StGlauberUtilities: Random number, and functions +class StGlauberUtilities { + public: + static StGlauberUtilities* instance(); + virtual ~StGlauberUtilities(); /// Default destructor + + /// Get impact parameter + Double_t GetImpactParameter() const ; + + /// Get maximum impact parameter + Double_t GetMaximumImpactParameter() const ; + + /// Get theta (polar angle) + Double_t GetTheta() const ; + + /// Get phi (azimuthal angle) + Double_t GetPhi() const ; + + /// Get uniform distribution in 0 < x < 1 + Double_t GetUniform() const ; + Double_t GetUniform2() const ; + + /// Set debug level + void SetDebug(const UInt_t debug) ; + + private: + static StGlauberUtilities* mInstance ; /// singleton + StGlauberUtilities(); /// Default constructor + + static const UShort_t mDebugLevel ; /// Debug level for StGlauberUtilities + TF1* mImpactParameter ; /// impact parameter + + // TRandom* mRandom ; /// Random numbers + TRandom3* mRandom ; /// Random numbers + UInt_t mDebug ; /// Debug level + + ClassDef(StGlauberUtilities, 0) +}; + +namespace GlauberUtilities { + // Woods-saxon density profile + Double_t WoodsSaxon(Double_t* x, Double_t* par) ; + + // Woods-saxon density profile (2D for deformed nuclei) + Double_t WoodsSaxon2D(Double_t* x, Double_t* par) ; + + // Step function + Double_t StepFunction(Double_t* x, Double_t* par) ; + + // Gaussian function + Double_t Gaussian(Double_t* x, Double_t* par) ; +} + + +#endif + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/macros/doAnalysisMaker.C b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/macros/doAnalysisMaker.C new file mode 100644 index 00000000000..fd5e36f017a --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/macros/doAnalysisMaker.C @@ -0,0 +1,52 @@ + +//____________________________________________________________________________________________________ +void doAnalysisMaker( + const TString system = "AuAu_39GeV", + const TString inputFileList = "tmp.list", + const TString outputFile = "ana.root", + const TString type = "default", + const TString tabledir = "./table", + const Bool_t doReweighting = kTRUE, + const Bool_t doUnitWeight = kFALSE, + const UShort_t debug = 0 +){ + gSystem->Load("St_base"); + gSystem->Load("StUtilities"); + gSystem->Load("StGlauberUtilities"); + gSystem->Load("StCentralityMaker"); + gSystem->Load("StGlauberTree"); + gSystem->Load("StGlauberAnalysisMaker"); + + StGlauberAnalysisMaker* maker = new StGlauberAnalysisMaker(type, system, outputFile, tabledir); + if(debug) maker->DebugOn(); + if(doReweighting) maker->ReweightingOn() ; + if(doUnitWeight) maker->UnitWeightOn() ; + maker->Run(inputFileList); + maker->Finish(); +} + +//____________________________________________________________________________________________________ +void doAnalysisMakerOneFile( + const TString system = "AuAu_39GeV", + const TString inputFile = "icmaker.root", + const TString outputFile = "ana.root", + const TString type = "default", + const TString abledir = "./table", + const Bool_t doReweighting = kTRUE, + const Bool_t doUnitWeight = kFALSE, + const UShort_t debug = 3 +){ + gSystem->Load("St_base"); + gSystem->Load("StUtilities"); + gSystem->Load("StGlauberUtilities"); + gSystem->Load("StCentralityMaker"); + gSystem->Load("StGlauberTree"); + gSystem->Load("StGlauberAnalysisMaker"); + + StGlauberAnalysisMaker* maker = new StGlauberAnalysisMaker(type, system, outputFile, tabledir); + if(debug) maker->DebugOn(); + if(doReweighting) maker->ReweightingOn() ; + if(doUnitWeight) maker->UnitWeightOn() ; + maker->RunFile(inputFile); + maker->Finish(); +} diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/macros/doFastGlauberMcMaker.C b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/macros/doFastGlauberMcMaker.C new file mode 100644 index 00000000000..35cedb13bef --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/macros/doFastGlauberMcMaker.C @@ -0,0 +1,113 @@ +//**************************************************************************************************** +// Run Fast Monte Carlo Glauber simulation (StFastGlauberMcMaker) +//**************************************************************************************************** +/**************************************************************************************************** + * $Id: doFastGlauberMcMaker.C,v 1.3 2012/04/25 05:29:34 hmasui Exp $ + * $Log: doFastGlauberMcMaker.C,v $ + * Revision 1.3 2012/04/25 05:29:34 hmasui + * Added deformation flag + * + * Revision 1.2 2010/10/27 00:31:45 hmasui + * Added loading relevant STAR libs + * + * Revision 1.1 2010/06/24 23:41:40 hmasui + * Macro to run StFastGlauberMcMaker + * + ****************************************************************************************************/ + +//____________________________________________________________________________________________________ +// Specify the system by TString, detailed parameters will be defined inside StFastGlauberMcMaker +void doFastGlauberMcMaker( + const TString outputFileName = "fastmcglauber.root", + const UInt_t nevents = 1000, + const TString system = "AuAu", + const Double_t energy = 200, + const TString type = "default", + const Bool_t isDeformed = kFALSE, + const Double_t replusionDistance = 0.0 +){ + gBenchmark->Start("doFastGlauberMcMaker"); + + gSystem->Load("St_base"); + gSystem->Load("StUtilities"); + gSystem->Load("StGlauberUtilities"); + gSystem->Load("StCentralityMaker"); + gSystem->Load("StGlauberTree"); + gSystem->Load("StFastGlauberMcMaker"); + + StFastGlauberMcMaker* maker = new StFastGlauberMcMaker(outputFileName, system, energy, type, isDeformed); +// maker->DebugOn(); + + // Print available types + maker->Print("type"); + + // Smearing option will be added in type later +// maker->DoHardCoreSmearing() ; // Hard-core smearing ON +// maker->DoGaussianSmearing() ; // Gaussian smearing ON + + // Repulsion option will be added in type later +// maker->SetRepulsionDistance(replusionDistance); // Repulsion distance between two nucleons + + // Collision profile were already added (default is hard-core) + // specify "gauss" in type for Gaussian collision profile +// if( collisionProfile == 0 ) maker->DoHardCoreCollision() ; +// if( collisionProfile == 1 ) maker->DoGaussianCollision() ; + + // Run nevents + maker->Run(nevents); + + // Close ROOT file etc + maker->Finish(); + + gBenchmark->Stop("doFastGlauberMcMaker"); + gBenchmark->Show("doFastGlauberMcMaker"); + gBenchmark->Reset(); +} + + +//____________________________________________________________________________________________________ +// Specify all parameters by hand +void _doFastGlauberMcMaker( + const Char_t* outputFileName, + const UInt_t nevents = 1000, + const UInt_t A = 197, + const Double_t R = 6.38, + const Double_t d = 0.535, + const Double_t beta2 = -0.131, + const Double_t beta4 = -0.031, + const Double_t sigma = 4.2, + const Double_t energy = 200, + const Double_t replusionDistance = 0.9, + const UInt_t collisionProfile = 0 // 0=hard-core (default), 1=gaussian profile +){ + gBenchmark->Start("doFastGlauberMcMaker"); + + gSystem->Load("StGlauberUtilities"); + gSystem->Load("StCentralityMaker"); + gSystem->Load("StFastGlauberMcMaker"); + + StFastGlauberMcMaker* maker = new StFastGlauberMcMaker(outputFileName, A, R, d, beta2, beta4, sigma, energy); + + // Hard-core smearing ON +// maker->DoHardCoreSmearing() ; + + // Gaussian smearing ON +// maker->DoGaussianSmearing() ; + + // Repulsion distance between two nucleons + maker->SetRepulsionDistance(replusionDistance); + + // Collision profile + if( collisionProfile == 0 ) maker->DoHardCoreCollision() ; + if( collisionProfile == 1 ) maker->DoGaussianCollision() ; + + // Run nevents + maker->Run(nevents); + + // Close ROOT file etc + maker->Finish(); + + gBenchmark->Stop("doFastGlauberMcMaker"); + gBenchmark->Show("doFastGlauberMcMaker"); + gBenchmark->Reset(); +} diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/macros/doNbdFitMaker.C b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/macros/doNbdFitMaker.C new file mode 100644 index 00000000000..4cae1c6f32b --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/Makers/macros/doNbdFitMaker.C @@ -0,0 +1,108 @@ +/**************************************************************************************************** + * $Id: doNbdFitMaker.C,v 1.2 2012/04/25 05:29:16 hmasui Exp $ + * $Log: doNbdFitMaker.C,v $ + * Revision 1.2 2012/04/25 05:29:16 hmasui + * Added histogram name + * +****************************************************************************************************/ + +//____________________________________________________________________________________________________ +void doNbdFitMaker( + const Char_t* outputFileName = "", + const Int_t nevents = 1000, + const Char_t* realData = "refmult.root", + const Char_t* glauber = "ncoll_npart.root", + const Char_t* realHistogram = "hRefMultTpc", + const Double_t multiplicityCut = 30, + const Double_t npp = 1.37, + const Double_t k = 1.0, + const Double_t x = 0.13, + const Double_t efficiency = 1.00, + const Double_t triggerbias = 1.00, + const Bool_t isConstEfficiency = kTRUE +){ + gSystem->Load("St_base"); + gSystem->Load("StUtilities"); + gSystem->Load("StGlauberUtilities"); + gSystem->Load("StCentralityMaker"); + + StNbdFitMaker* maker = new StNbdFitMaker(); + maker->DoCentralityDetermination() ; + + // Set parameters + maker->SetParameters(npp, k, x, efficiency, triggerbias, isConstEfficiency); + + // Set low multiplicity cut off for fitting + maker->SetMinimumMultiplicityCut(multiplicityCut); + + // Read input files + maker->ReadData(realData, glauber, realHistogram); + + // Fit + maker->Fit(nevents, outputFileName); +} + +//____________________________________________________________________________________________________ +void scan( + const Int_t nevents = 200000, + const Char_t* realData = "refmult.root", + const Char_t* glauber = "ncoll_npart.root", + const Char_t* realHistogram = "hRefMultTpc", + const Double_t multiplicityCut = 50, + const Int_t nppbin = 40, const Double_t nppmin = 1.2, const Double_t nppmax = 1.6, + const Int_t kbin = 1, const Double_t kmin = 2.0, const Double_t kmax = 2.0, + const Int_t xbin = 50, const Double_t xmin = 0.08, const Double_t xmax = 0.18, + const Double_t efficiency = 1.00, + const Double_t triggerbias = 1.00, + const Bool_t isConstEfficiency = kTRUE +){ + gSystem->Load("St_base"); + gSystem->Load("StUtilities"); + gSystem->Load("StGlauberUtilities"); + gSystem->Load("StCentralityMaker"); + + StNbdFitMaker* maker = new StNbdFitMaker(); + + // Set dummy parameters + maker->SetParameters(nppmin, kmin, xmin, efficiency, triggerbias, isConstEfficiency); + + // Set low multiplicity cut off for fitting + maker->SetMinimumMultiplicityCut(multiplicityCut); + + // Read input files + maker->ReadData(realData, glauber, realHistogram); + + // Fit + maker->Scan(nevents, nppbin, nppmin, nppmax, kbin, kmin, kmax, xbin, xmin, xmax, + efficiency, triggerbias, isConstEfficiency); +} + +//____________________________________________________________________________________________________ +void simulateMultiplicity( + const Char_t* outputFileName = "test.root", + const Int_t nevents = 500000, + const Char_t* glauber = "ncoll_npart.root", + const Double_t npp = 2.9, + const Double_t k = 2.0, + const Double_t x = 0.20, + const Double_t efficiency = 1.00, + const Double_t triggerbias = 1.00, + const Bool_t isConstEfficiency = kTRUE +){ + gSystem->Load("St_base"); + gSystem->Load("StUtilities"); + gSystem->Load("StGlauberUtilities"); + gSystem->Load("StCentralityMaker"); + + StNbdFitMaker* maker = new StNbdFitMaker(); + + // Set parameters + maker->SetParameters(npp, k, x, efficiency, triggerbias, isConstEfficiency); + + // Read input files + maker->ReadGlauber(glauber, 3000, 0, 3000); + + // Fit + maker->Simulate(nevents, outputFileName); +} + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/README.md b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/README.md new file mode 100644 index 00000000000..768381c9b25 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/README.md @@ -0,0 +1,131 @@ +# Run Glauber simulation + +### Step 1. Initialization + +```bash +./prepare.sh +``` +To create needed directories, please look into this simple script before run it, +just in case of deleting your important files by mistake. +A tip here, put all the codes under your RCF home directory and set the outDir to be on your PWG disk. + +Then execute “cons”, (to compile all the codes, please be sure there is no errors to compile the codes) +```bash +cons +``` + +```bash +./all_submit_doFastGlauberMcMaker.csh AuAu 27 0 5 1 +``` +If you want to generate deformed nuclei, set the default deformation to kTRUE in submit_glauber.pl +The first input parameter: 27 is the energy per nucleon +The second input parameter: 0 is the start job index +The third input parameter: 5 is the end job index +The fourth input parameter: 1 means "submit jobs”; 0 means “only test, won't submit" + +Make nEvents one fifth of the total number you want. If you want 1E6, set nevents=2E5 +For the test run, you can change the “nevents” in all_submit_doFastGlauberMcMaker.csh to 10, +to submit a test run, after all jobs finish successfully and the output files looks good +(if you don’t know they are good or not, just move forward, you will know it later), then change +it to the 100k (100000) or 500k, for real submissions. + +### Step 2. NPD and finding the best fit parameters + +After the previous jobs finished, then you can Scan Negative Binomial Distribution (NBD) fitting parameters for the best parameters +```bash +./creatList.csh +``` +EDIT this before running. This script is to prepare the input TTree file list. + +```bash +root4star -b -q -l addNcollVsNpart.C +``` +Create ncoll_npart.root file in the current directory, this will be used for the NBD scan +on the parameters: npp, k, x, and eff. The scan ranges of npp, k, x and eff can be defined +in “submit_doScan.pl”, in order to set a reasonable ranges, +you better check the best parameters from previous study first, the previous parameters can be found +in “StRoot/StCentralityMaker/StCentrality.cxx”, if you only want to submit 1 job with a constant npp, k, x +and eff values, you can set nppbin, kin, xbin, effbin =1 and let the min and max of npp, k, x and eff be same value. +Please note that, the goal of scan is to find the best parameters matching to real data, the real data here is +the Refmult distribution after all corrections (luminosity, vertex…), usually called RefmultCorr. In this example, +you can find the Refmult is saved in a root file “ run18_27Gev_MB_refMultCorr.root” , the corresponding histogram is +named as “hRefMultCorr”, the name of the root file need to be given in the “ doScanX_my.csh”, and the name of the +histogram need to be given in “doNbdFitMaker.C”. Please make sure you have the input root file under this directory. + +Another thing need to be noted is the Refmult lower limit cut in doScanX_my.csh, usually cut on Refmult>100 for +the 200 GeV AuAu Refmult scan, for 27 GeV, we choose to cut on 50. This cut is the fitting Refmult fitting range +(while compare MC to Data). + +After you selected the parameter ranges, put the root file with hRefmultCorr under this directory, set the Refmult Cut and modify +the names in the script and code as above, you can then start to submit jobs for the scan by “./submit_doScan.pl" + +After the above jobs finished, you will find the output root files under “RatioCHi2Files” which include “chi2*.root” and “Ratio*.root”, +they are named by the events, npp, k, x and eff values. The out log files corresponding these jobs can be found at LOG_Scan. + +Then you can “cd getBestChi2_fromCat”, run the following scripts to find the best Chi2/ndf root files, and then based on the names of the +root file, you will know all the parameter values. + +```bash +./extractChi2Lines.sh +``` +It will read the output log files and write down the lines with Chi2/ndf information + +```bash +./genMinChi2List.sh +``` +Adjust nevents! This script will read the output from previous step and find the least Chi2/ndf root files and write them into +a file “minChi2_file.list”, please note that, here we still don’t know the eff values corresponding to the least Chi2/ndf, +we need one more step + +Run findMinChi2.C in root: +```bash +root -l +> .L findMinChi2.C +> findMinChi2() +``` + +```bash +./getBestChi2RootFile.sh +``` +It will finally find best parameters of npp,k,x,eff and the root files corresponding to the least Chi2/ndf +and copy them into “bestChisRootFile". + +After obtained all the parameter values, and the corresponding output root files, we can get the Ratio of MC/Data in +the root file (“Ratio_npp1.270_k1.800_x0.160_eff0.110.root”), named as “hRatio”, you can then use this ratio to +weight your RefmultCorr in the real data, and obtain the RefmultCorr_Weighted and save into a new root file, +in my case I name the root file as “run18_27Gev_MB_refMultCorr_Weighted.root”, you can then fix the fitting +parameters in “./submit_doScan.pl” and modify the input root file name in “doScanX_my.csh” and input histogram +name in “doNbdFitMaker.C”, and then submit it a single job by “./submit_doScan.pl” to get a new “hRatio” histogram +in the Ratio……root file. You should find that the new “hRatio” should be flat at 1, since the the new input +“hRefmultCorr_Weighted” is obtained by weighting the RefmultCorr with MC/Data ratio. It is always good to make +a plot to compare the hRefmultCorr, hRefmultsim, hRatio before and after reweitht, to make sure everything working correctly. + +If everything so far looks good, then you finished most parts of the steps. Now move to the systematic uncertainty calculaltion in the next step. + +### Step 3. Systematic Uncertainty Estimation + +Go the LOG_Scan, and find the output log files like “doScanX_my_1_27_1_8_0_16_0_11.out”, the name is defined based on the +parameter values, so it should be easy to find it. Copy the line 173-204 and paste them to +“StRoot/StCentralityMaker/StCentrality.cxx” and change all the npp, k, x and eff values to those you obtained in the same code. + +Important! After updating `StCentrality.cxx` with the correct parameters, recompile and then re-generate the glauber trees that were created in the first step: +```bash +cons +./all_submit_doFastGlauberMcMaker.csh RuRu_Case1 200 0 5 1 +``` + +```bash +./createList.csh +``` + +```bash +./all_doAnalysisMaker.csh AuAu_27GeV kFALSE kFALSE +``` +In this step it will read the output tree files generated at the first step from “all_submit_doFastGlauberMcMaker.csh”, +Write down the new output files “ana*.root" + +Produce all tables under ./table +```bash +./all_doPlotMaker.csh 27 +``` +This will make all the plots and save into ./figure diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/addNcollVsNpart.C b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/addNcollVsNpart.C new file mode 100644 index 00000000000..da904046dc9 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/addNcollVsNpart.C @@ -0,0 +1,42 @@ + +//____________________________________________________________________________________________________ +void addNcollVsNpart( + const Char_t* inputFileList = "./LIST/tree.default.list" + ) +{ + gSystem->Load("St_base"); + gSystem->Load("StUtilities"); + gSystem->Load("StGlauberUtilities"); + gSystem->Load("StCentralityMaker"); + gSystem->Load("StGlauberTree"); + gSystem->Load("StGlauberAnalysisMaker"); + + ifstream fin(inputFileList); + if(!fin) + { + Error("addNcollVsNpart", "can't open %s", inputFileList); + return; + } + + TChain t("tree"); + TString file; + while(fin>>file) + { + cout << "Add " << file << " into chain" << endl; + t.Add(file); + } + + TH2* hNcoll_Npart = new TH2D + ("hNcoll_Npart", "hNcoll_Npart;Npart;Ncoll;", + // StGlauberConstUtilities::GetNpartBin(), 0, StGlauberConstUtilities::GetNpartMax(), + // StGlauberConstUtilities::GetNcollBin(), 0, StGlauberConstUtilities::GetNcollMax() + 500, 0, 500, 1800, 0, 1800 + ); + t.Draw("ncoll:npart>>hNcoll_Npart", "npart>=2&&ncoll>=1"); + + // Write output ROOT file + TFile* outputFile = TFile::Open("ncoll_npart.root", "recreate"); + hNcoll_Npart->Print(); + hNcoll_Npart->Write(); + outputFile->Close(); +} diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/all_doAnalysisMaker.csh b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/all_doAnalysisMaker.csh new file mode 100644 index 00000000000..16c5504d067 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/all_doAnalysisMaker.csh @@ -0,0 +1,42 @@ +#!/bin/csh + +if ( $#argv != 3 ) then + echo "" + echo " Usage: $0 [system] [re-weighting correction (true or false)] [Unit weight (true or false)]" + echo "" + echo "" + exit +endif + +#starnew +stardev +#set list=("default") +#set list = ( "smallNpp" "largeNpp" ) +#set list = ( "lowrw" "highrw" ) +#set list = ( "default" "small" "large" "smallXsec" "largeXsec" "gauss" "smallNpp" "largeNpp" "smallTotal" "largeTotal" "lowrw" "highrw" ) +#set list = ( "default" "small" "large" "smallXsec" "largeXsec" "gauss" "smallNpp" "largeNpp" "smallTotal" "largeTotal" ) +#set list = ( "default" "small" "large" "smallXsec" "largeXsec" "smallNpp" "largeNpp" "smallTotal" "largeTotal" ) +#set list = ( "default" "small" "large" "smallXsec" "largeXsec" "gray" "gauss" "smallNpp" "largeNpp" "smallTotal" "largeTotal" ) +#set list = ( "small" "large" "smallXsec" "largeXsec" "gray" "gauss" "smallNpp" "largeNpp" "smallTotal" "largeTotal" ) + +set list = ( "default" "small" "large" "smallXsec" "largeXsec" "gauss" "smallNpp" "largeNpp" "smallTotal" "largeTotal") +#set list = ( "smallTotal" "largeTotal" ) + +set system = "$1" +set reweighting = "$2" +set unitweight = "$3" + +foreach type ($list) + set input = "./LIST/tree.$type.list" + set output = "ana_${system}_${type}.root" + if ( -f $input ) then + set submit = "submit_condor.pl -v -s doAnalysisMaker.csh $system $input $output $type $reweighting $unitweight" + echo $submit + $submit + else + echo "" + echo "can't find input $input. Skip" + echo "" + endif +end + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/all_doPlotMaker.csh b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/all_doPlotMaker.csh new file mode 100644 index 00000000000..51df4caebe8 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/all_doPlotMaker.csh @@ -0,0 +1,18 @@ +#!/bin/csh + +if ( $#argv != 1 ) then + echo "" + echo " Usage : $0 [Energy]" + echo "" + echo "" + exit +endif + +#set list = ( "ImpactParameter" "Npart" "Ncoll" "Multiplicity" "AreaRP" "AreaPP" "EccRP" "EccPP" "EccPP_2" "EccPPM" ) +set list = ( "ImpactParameter" "Npart" "Ncoll" "Multiplicity" "AreaRP" "AreaPP" "EccRP" "EccRPM" "EccPP_0" "EccPP_0_2" "EccPPM_0" "EccPPM_0_2" ) +set energy = "$1" + +foreach name ($list) + doPlotMaker.csh $name $energy +end + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/all_submit_doFastGlauberMcMaker.csh b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/all_submit_doFastGlauberMcMaker.csh new file mode 100644 index 00000000000..ec7c87c1c0b --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/all_submit_doFastGlauberMcMaker.csh @@ -0,0 +1,37 @@ +#!/bin/csh -f + +if ( $#argv != 5 ) then + echo "" + echo " Usage : $0 [system] [energy] [Begin jobIndex] [End jobIndex] [0=test, 1=submit]" + echo "" + echo "" + exit +endif + +#set nevents = 100000 # 100K +set nevents = 200000 +set system = "$1" +set energy = "$2" +set begin = "$3" +set end = "$4" +########################################################## +#set types = ( "default" ) +#for systematic uncertainty, we need to submit the jobs with different types +#set types = ( "gauss" ) +#set types = ( "smallNpp" "largeNpp" ) +#set types = ( "default" "large" "small" "largeXsec" "smallXsec" "smallNpp" "largeNpp" ) +set types = ( "default" "large" "small" "largeXsec" "smallXsec" "gauss" "smallNpp" "largeNpp" ) +########################################################## + +set flag = "$5" +set run = "" +if ( $flag == 1 ) then + set run = "-run" +endif + +foreach type ($types) + submit_glauber.pl -sleep 0 -v $run -n $nevents -sys $system -e $energy -t $type $begin $end +end + + + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/createList.csh b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/createList.csh new file mode 100644 index 00000000000..56dc764b20b --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/createList.csh @@ -0,0 +1,27 @@ +#!/bin/csh -f + +#set energy = "11" +set energy = "200" +#set energy = "27" + +#set types =("default") +#set types = ( "default" "small" "large" "smallXsec" "largeXsec" "gray" "gauss" ) +set types = ( "default" "small" "large" "smallXsec" "largeXsec" "gauss" "smallNpp" "largeNpp" ) + +foreach type ($types) + set treelist = "./LIST/tree.$type.list" + echo "Make $treelist..." + ls -1 ./output/fastglaubermc_RuRu_Case1_${energy}*GeV_${type}_deformed_*.root > $treelist +end + +# Make link "smallNpp" "largeNpp" "smallTotal" "largeTotal" to "default" +cd LIST +#ln -vs tree.default.list tree.smallNpp.list +#ln -vs tree.default.list tree.largeNpp.list +ln -vsf tree.default.list tree.smallTotal.list +ln -vsf tree.default.list tree.largeTotal.list +ln -vsf tree.default.list tree.lowrw.list +ln -vsf tree.default.list tree.highrw.list +ls -lrta +cd - + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/doAnalysisMaker.C b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/doAnalysisMaker.C new file mode 100644 index 00000000000..75b556162bd --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/doAnalysisMaker.C @@ -0,0 +1,58 @@ + +//____________________________________________________________________________________________________ +void doAnalysisMaker( + const TString system = "AuAu_39GeV", + const TString inputFileList = "tmp.list", + const TString outputFile = "ana.root", + const TString type = "default", + const TString tabledir = "./table", + const Bool_t doReweighting = kFALSE, + const Bool_t doUnitWeight = kFALSE, + const UShort_t debug = 0 + ) +{ + gSystem->Load("St_base"); + gSystem->Load("StUtilities"); + gSystem->Load("StGlauberUtilities"); + gSystem->Load("StCentralityMaker"); + gSystem->Load("StGlauberTree"); + gSystem->Load("StGlauberAnalysisMaker"); + + StGlauberAnalysisMaker* maker = new StGlauberAnalysisMaker(type, system, outputFile, tabledir); + + if(debug) maker->DebugOn(); + if(doReweighting) maker->ReweightingOn() ; + if(doUnitWeight) maker->UnitWeightOn() ; + + maker->Run(inputFileList); + maker->Finish(); +} + +//____________________________________________________________________________________________________ +void doAnalysisMakerOneFile( + const TString system = "AuAu_39GeV", + const TString inputFile = "icmaker.root", + const TString outputFile = "ana.root", + const TString type = "default", + const TString abledir = "./table", + const Bool_t doReweighting = kFALSE, + const Bool_t doUnitWeight = kFALSE, + const UShort_t debug = 3 + ) +{ + gSystem->Load("St_base"); + gSystem->Load("StUtilities"); + gSystem->Load("StGlauberUtilities"); + gSystem->Load("StCentralityMaker"); + gSystem->Load("StGlauberTree"); + gSystem->Load("StGlauberAnalysisMaker"); + + StGlauberAnalysisMaker* maker = new StGlauberAnalysisMaker(type, system, outputFile, tabledir); + + if(debug) maker->DebugOn(); + if(doReweighting) maker->ReweightingOn() ; + if(doUnitWeight) maker->UnitWeightOn() ; + + maker->RunFile(inputFile); + maker->Finish(); +} diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/doAnalysisMaker.csh b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/doAnalysisMaker.csh new file mode 100644 index 00000000000..8960da383ca --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/doAnalysisMaker.csh @@ -0,0 +1,26 @@ +#!/bin/csh + +if ( $#argv != 6 ) then + echo "" + echo " Usage: $0 [System] [Input file list] [Output filename] [type] [re-weighting correction (true or false)] [Unit weight (true or false)]" + echo "" + echo "" + exit +endif + +set system = "$1" +set input = "$2" +set output = "$3" +set type = "$4" +set table = "./table" +set reweighting = "$5" +set unitweight = "$6" + +starver SL16d + +root4star -b <Start("doFastGlauberMcMaker"); + + gSystem->Load("St_base"); + gSystem->Load("StUtilities"); + gSystem->Load("StGlauberUtilities"); + gSystem->Load("StCentralityMaker"); + gSystem->Load("StGlauberTree"); + gSystem->Load("StFastGlauberMcMaker"); + + StFastGlauberMcMaker* maker = new StFastGlauberMcMaker(outputFileName, system, energy, type, isDeformed); + // maker->DebugOn(); + + // Print available types + maker->Print("type"); + + // Smearing option will be added in type later + // maker->DoHardCoreSmearing() ; // Hard-core smearing ON + // maker->DoGaussianSmearing() ; // Gaussian smearing ON + + // Repulsion option will be added in type later + // maker->SetRepulsionDistance(replusionDistance); // Repulsion distance between two nucleons + + // Collision profile were already added (default is hard-core) + // specify "gauss" in type for Gaussian collision profile + // if( collisionProfile == 0 ) maker->DoHardCoreCollision() ; + // if( collisionProfile == 1 ) maker->DoGaussianCollision() ; + + // Run nevents + maker->Run(nevents); + + // Close ROOT file etc + maker->Finish(); + + gBenchmark->Stop("doFastGlauberMcMaker"); + gBenchmark->Show("doFastGlauberMcMaker"); + gBenchmark->Reset(); +} +//____________________________________________________________________________________________________ +// Specify all parameters by hand +void _doFastGlauberMcMaker +( + const Char_t* outputFileName, + const UInt_t nevents = 1000, + const UInt_t A = 197, + const Double_t R = 6.38, + const Double_t d = 0.535, + const Double_t beta2 = -0.131, + const Double_t beta4 = -0.031, + const Double_t sigma = 4.2, + const Double_t energy = 200, + const Double_t replusionDistance = 0.9, + const UInt_t collisionProfile = 0 // 0=hard-core (default), 1=gaussian profile + ) +{ + gBenchmark->Start("doFastGlauberMcMaker"); + gSystem->Load("StGlauberUtilities"); + gSystem->Load("StCentralityMaker"); + gSystem->Load("StFastGlauberMcMaker"); + + StFastGlauberMcMaker* maker = new StFastGlauberMcMaker(outputFileName, A, R, d, beta2, beta4, sigma, energy); + + // Hard-core smearing ON + // maker->DoHardCoreSmearing() ; + + // Gaussian smearing ON + // maker->DoGaussianSmearing() ; + + // Repulsion distance between two nucleons + maker->SetRepulsionDistance(replusionDistance); + + // Collision profile + if( collisionProfile == 0 ) maker->DoHardCoreCollision() ; + if( collisionProfile == 1 ) maker->DoGaussianCollision() ; + + // Run nevents + maker->Run(nevents); + + // Close ROOT file etc + maker->Finish(); + + gBenchmark->Stop("doFastGlauberMcMaker"); + gBenchmark->Show("doFastGlauberMcMaker"); + gBenchmark->Reset(); +} diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/doFastGlauberMcMaker.csh b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/doFastGlauberMcMaker.csh new file mode 100644 index 00000000000..39ee5683349 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/doFastGlauberMcMaker.csh @@ -0,0 +1,24 @@ +#!/bin/csh + +if ( $#argv != 6 ) then + echo "" + echo " Usage : $0 [Output filename] [Number of events] [system] [energy] [type] [deformation (true or false)]" + echo "" + exit +endif + +set output = "$1" +set nevents = "$2" +set system = "$3" +set energy = "$4" +set type = "$5" +set deformation = "$6" + +starver SL19b + +root4star -b <Load("St_base"); + gSystem->Load("StUtilities"); + gSystem->Load("StGlauberUtilities"); + gSystem->Load("StCentralityMaker"); + + StNbdFitMaker* maker = new StNbdFitMaker(); + + // Set parameters + maker->SetParameters(npp, k, x, efficiency, triggerbias, isConstEfficiency); + + // Set low multiplicity cut off for fitting + maker->SetMinimumMultiplicityCut(multiplicityCut); + + // maker->ReadData(realData, glauber, "hRefMultCorr"); + maker->ReadData(realData, glauber, "hRefMult"); + //maker->ReadData(realData, glauber, "hRefMultCorr_Weighted"); + + // Fit + maker->Fit(nevents, outputFileName); +} + +//____________________________________________________________________________________________________ +void scan( + const Int_t nevents = 200000, + const Char_t* realData = "run11.MonTrg.refMultCorrWithWeight.histo.root", + const Char_t* glauber = "ncoll_npart.root", + const Double_t multiplicityCut = 100, + const Int_t nppbin = 40, const Double_t nppmin = 1.2, const Double_t nppmax = 1.6, + const Int_t kbin = 1, const Double_t kmin = 2.0, const Double_t kmax = 2.0, + const Int_t xbin = 50, const Double_t xmin = 0.08, const Double_t xmax = 0.18, + //const Double_t x = 0.12, + //const Int_t effbin = 50, const Double_t effmin = 0.08, const Double_t effmax = 0.18, + const Double_t efficiency = 1.00, + const Double_t triggerbias = 1.00, + const Bool_t isConstEfficiency = kTRUE +) +{ + gSystem->Load("St_base"); + gSystem->Load("StUtilities"); + gSystem->Load("StGlauberUtilities"); + gSystem->Load("StCentralityMaker"); + + StNbdFitMaker* maker = new StNbdFitMaker(); + + // Set low multiplicity cut off for fitting + maker->SetMinimumMultiplicityCut(multiplicityCut); + + //// Dump centrality bin boundary + //maker->DoCentralityDetermination(); + + // Set dummy parameters + maker->SetParameters(nppmin, kmin, xmin, efficiency, triggerbias, isConstEfficiency); + //maker->SetParameters(nppmin, kmin, x, effmin, triggerbias, isConstEfficiency); + + // Read input files + //maker->ReadData(realData, glauber, "hRefMultCorr"); + maker->ReadData(realData, glauber, "hRefMult"); + //maker->ReadData(realData, glauber, "hRefMultCorr_Weighted"); + + // Fit + maker->Scan( + nevents, + nppbin, nppmin, nppmax, + kbin, kmin, kmax, + xbin, xmin, xmax, + efficiency, triggerbias, isConstEfficiency + ); + //maker->Scan(nevents, nppbin, nppmin, nppmax, kbin, kmin, kmax, x, + // effbin, effmin, effmax, triggerbias, isConstEfficiency); +} + +//____________________________________________________________________________________________________ +void simulateMultiplicity( + const Char_t* outputFileName = "test.root", + const Int_t nevents = 500000, + const Char_t* glauber = "ncoll_npart.root", + const Double_t npp = 2.9, + const Double_t k = 2.0, + const Double_t x = 0.20, + const Double_t efficiency = 1.00, + const Double_t triggerbias = 1.00, + const Bool_t isConstEfficiency = kTRUE +){ + gSystem->Load("St_base"); + gSystem->Load("StUtilities"); + gSystem->Load("StGlauberUtilities"); + gSystem->Load("StCentralityMaker"); + + StNbdFitMaker* maker = new StNbdFitMaker(); + + // Set parameters + maker->SetParameters(npp, k, x, efficiency, triggerbias, isConstEfficiency); + + // Read input files + maker->ReadGlauber(glauber, 3000, 0, 3000); + + // Fit + maker->Simulate(nevents, outputFileName); +} + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/doPlotMaker.C b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/doPlotMaker.C new file mode 100644 index 00000000000..8cc1d1a6e51 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/doPlotMaker.C @@ -0,0 +1,163 @@ +void doPlotMaker( + const TString name = "Npart", + const TString energy = "200", + const UInt_t mode = 1 // Take maximum difference as a systematic error + ) +{ + // type description node + // default default default + // small small R, large d small + // large large R, small d large + // smallXsec small sigma_{NN} smallXsec + // largeXsec large sigma_{NN} largeXsec + // gray gray disk profile gray + // gauss gaussian profile gauss + // smallNpp small (npp, x) default + // largeNpp large (npp, x) default + // smallTotal -5% total cross section default + // largeTotal +5% total cross section default + + gSystem->Load("St_base"); + gSystem->Load("StUtilities"); + gSystem->Load("StGlauberAnalysisMaker"); + + StGlauberPlotMaker* maker = new StGlauberPlotMaker(name); + // const Int_t nFiles = 11 ; + // const TString type[] = { + // "default", "small", "large", "smallXsec", "largeXsec", + // "gray", "gauss", "smallNBD", "largeNBD", "smallTotal", "largeTotal" + // }; + // const Int_t nFiles = 1 ; + // const Int_t nFiles = 10 ; + // const Int_t nFiles = 12 ; + // const TString type[] = { + // "default", "small", "large", "smallXsec", "largeXsec", + // "gauss", "smallNpp", "largeNpp", "smallTotal", "largeTotal", + // "lowrw", "highrw" + // }; + + const Int_t nFiles = 10 ; + const TString type[] = + { + "default", "small", "large", "smallXsec", "largeXsec", + "smallNpp", "largeNpp", "gauss", "smallTotal", "largeTotal" + // "smallNpp", "largeNpp", "gauss" + }; + + //---------------------------------------------------------------------------------------------------- + // Description for Au+Au 200 GeV Run10 (default) + //---------------------------------------------------------------------------------------------------- + TString description[] = + { + "default", + "small R, large d", + "large R, small d", + "small #sigma_{NN}=41mb", + "large #sigma_{NN}=43mb", + // "small n_{pp}: (npp, x) = (2.55, 0.11)", + // "large n_{pp}: (npp, x) = (2.31, 0.15)", + "small n_{pp}: (npp, x) = (2.153, 0.13)", + "large n_{pp}: (npp, x) = (1.948, 0.17)", + "gauss profile", + "-5% total cross section", + "+5% total cross section" + }; + + if( energy.Contains("200") ) + { + cout << "Initialize 200 GeV" << endl; + } + + //---------------------------------------------------------------------------------------------------- + // Description for Au+Au 39 GeV Run10 + //---------------------------------------------------------------------------------------------------- + if( energy.Contains("39") ) + { + cout << "Initialize 39 GeV" << endl; + description[3] = "small #sigma_{NN}=33mb" ; + description[4] = "large #sigma_{NN}=35mb" ; + description[5] = "small n_{pp}: (npp, x) = (1.44, 0.14)" ; + description[6] = "large n_{pp}: (npp, x) = (1.60, 0.10)" ; + } + +#if 0 + const TString description[] = { + "default", + "-2% R, +10% d", + "+2% R, -10% d", + "small #sigma_{NN}=33mb", + "large #sigma_{NN}=35mb", + // "gray disk profile", + "gaussian profile", + "small n_{pp}: (npp, x) = (1.44, 0.14)", + "large n_{pp}: (npp, x) = (1.60, 0.10)", + "-5% total cross section", + "+5% total cross section", + "Re-weighting +(-) 2#sigma for p_{0}(p_{1})", + "Re-weighting -(+) 2#sigma for p_{0}(p_{1})" + }; +#endif + + //---------------------------------------------------------------------------------------------------- + // Description for Au+Au 11.5 GeV Run10 + //---------------------------------------------------------------------------------------------------- + if( energy.Contains("11.5") ) { + cout << "Initialize 11.5 GeV" << endl; + description[3] = "small #sigma_{NN}=30.2mb" ; + description[4] = "large #sigma_{NN}=32.2mb" ; + description[5] = "small n_{pp}: (npp, x) = (1.01, 0.14)" ; + description[6] = "large n_{pp}: (npp, x) = (1.11, 0.10)" ; + } + +#if 0 + const TString description[] = { + "default", + "small R, large d", + "large R, small d", + "small #sigma_{NN}=30.2mb", + "large #sigma_{NN}=32.2mb", + "gaussian profile", + "small n_{pp}: (npp, x) = (0.82, 0.14)", + "large n_{pp}: (npp, x) = (0.90, 0.10)", + "-5% total cross section", + "+5% total cross section" + }; +#endif + //---------------------------------------------------------------------------------------------------- + // Description for Au+Au 7.7 GeV Run10 + //---------------------------------------------------------------------------------------------------- + if( energy.Contains("7.7") ) { + cout << "Initialize 7.7 GeV" << endl; + description[3] = "small #sigma_{NN}=29.8mb" ; + description[4] = "large #sigma_{NN}=31.8mb" ; + description[5] = "small n_{pp}: (npp, x) = (0.85, 0.14)" ; + description[6] = "large n_{pp}: (npp, x) = (0.93, 0.10)" ; + } + +#if 0 + const TString description[] = { + "default", + "small R, large d", + "large R, small d", + "small #sigma_{NN}=29.8mb", + "large #sigma_{NN}=31.8mb", + // "gaussian profile", + "small n_{pp}: (npp, x) = (0.85, 0.14)", + "large n_{pp}: (npp, x) = (0.93, 0.10)", + "-5% total cross section", + "+5% total cross section" + }; + // "small n_{pp}: (npp, x) = (0.82, 0.14)", // Fast offline + // "large n_{pp}: (npp, x) = (0.90, 0.10)", // Fast offline +#endif + + for(Int_t i=0; iRead(tableName, description[i]) ; + } + + maker->Draw(mode) ; +} + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/doPlotMaker.csh b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/doPlotMaker.csh new file mode 100644 index 00000000000..083eeee93e7 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/doPlotMaker.csh @@ -0,0 +1,27 @@ +#!/bin/csh + +if ( $#argv != 2 ) then + echo "" + echo " Usage : $0 [name] [energy]" + echo " Current available name's are:" + echo " ImpactParameter, Npart, Ncoll, Multiplicity, AreaRP, AreaPP, EccRP, EccPP" + echo "" + echo " NOTE: name is case insensitive" + echo "" + exit +endif + +starver SL16d + +set name = "$1" +set energy = "$2" +#set mode = "$3" +set mode = "1" +set option = "-b" + +root4star $option < allout.list + +echo "generating catLOG_for_MinChi2, be patient !!!" + +for ifile in $(cat allout.list) +do + #head -44 ${ifile} | tail -1 >> catLOG_for_MinChi2 #if turn off centrality definition + head -206 ${ifile} | tail -1 >> catLOG_for_MinChi2 #if with centrality definition +done + +echo "generated catLOG_for_MinChi2" + +exit + + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/getBestChi2_fromCat/extractChi2LinesForIsobars.sh b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/getBestChi2_fromCat/extractChi2LinesForIsobars.sh new file mode 100644 index 00000000000..0f8c66f9351 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/getBestChi2_fromCat/extractChi2LinesForIsobars.sh @@ -0,0 +1,34 @@ +#!/bin/bash +############################################################ +# original author Zaochen Ye +# new STAR users are responsible to improve the script +############################################################ + +rm allout_ZR.list +rm catLOG_for_MinChi2_ZR +rm allout_RU.list +rm catLOG_for_MinChi2_RU + +inDir=../ + +find $inDir/LOG_Scan_Zr -name "*.out" > allout_ZR.list +find $inDir/LOG_Scan_Ru -name "*.out" > allout_RU.list + +echo "generating catLOG_for_MinChi2_ZR and catLOG_for_MinChi2_RU, be patient !!!" + +for ifile in $(cat allout_ZR.list) +do + head -206 ${ifile} | tail -1 >> catLOG_for_MinChi2_ZR #if with centrality definition +done +for ifile in $(cat allout_RU.list) +do + head -206 ${ifile} | tail -1 >> catLOG_for_MinChi2_RU #if with centrality definition +done + + +echo "generated catLOG_for_MinChi2_ZR" +echo "generated catLOG_for_MinChi2_RU" + +exit + + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/getBestChi2_fromCat/findMinChi2.C b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/getBestChi2_fromCat/findMinChi2.C new file mode 100644 index 00000000000..0a51f33da1c --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/getBestChi2_fromCat/findMinChi2.C @@ -0,0 +1,67 @@ +//#include "/star/u/syang/Macro/headers.h" +//#include "/star/u/syang/Macro/function.C" + +//find the minimum Chi2 among all the root files, then print out the root file full name +//the name of the root file will tell what parameter settings give the minimum chi2 + +void findMinChi2(const Char_t* inputFileList = "minChi2_file.list") +{ + ifstream fin(inputFileList); + if(!fin){ + Error("Error, inputfile", "can't open %s", inputFileList); + return; + } + + Double_t minChi2 = 1.e9; + TString minName = ""; + + ofstream outData("minChi2_rootfile_fullname.dat"); + + TString name(""); + + while( fin >> name ) + { + TFile* file = TFile::Open(name); + if(!file || !file->IsOpen() || !file->GetNkeys()) + { + Error("check chi2", "can't open %s", name.Data()); + continue; + } + //cout << "OPEN " << file->GetName() << endl; + + TH3* hchi2 = (TH3D*) file->Get("hChi2"); + + for(Int_t i=0; iGetNbinsX(); i++)//parameter n_{pp} + { + for(Int_t j=0; jGetNbinsY(); j++)//parameter k + { + for(Int_t k=0; kGetNbinsZ(); k++)//parameter x + { + Double_t chi2 = hchi2->GetBinContent(i+1, j+1, k+1); + + if(chi2Close(); + } + + outData<<"The minimum Chi2 are found: "< chi2_values +echo "generated chi2_values" + +minChi2=$(head -n 1 chi2_values) + +echo "found minimum chi2: $minChi2" + +nppValue=$(grep "=${minChi2}" catLOG_for_MinChi2 | cut -c 67-71) +kValue=$(grep "=${minChi2}" catLOG_for_MinChi2 | cut -c 74-78) +xValue=$(grep "=${minChi2}" catLOG_for_MinChi2 | cut -c 81-85) + +echo "nppValue: " $nppValue +echo "kValue: " $kValue +echo "xValue: " $xValue + +inDir=../RatioChi2Files +#HERE Change v +ls ${inDir}/chi2_nevents1000000_npp${nppValue}-${nppValue}_k${kValue}-${kValue}_x${xValue}_${xValue}_eff*.root > minChi2_file.list + +exit + +#chi2_nevents1000000_npp2.300-2.300_k2.000-2.000_x0.140_0.140_eff0.170.root diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/getBestChi2_fromCat/genMinChi2ListForIsobars.sh b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/getBestChi2_fromCat/genMinChi2ListForIsobars.sh new file mode 100644 index 00000000000..6efc613846e --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/getBestChi2_fromCat/genMinChi2ListForIsobars.sh @@ -0,0 +1,95 @@ +#!/bin/bash +#before run this script, be sure that, the number of event should be on the same order: 1000000, otherwise, it won't work. + +rm chi2_valuesCOMBINED +rm chi2_valuesCombinedAndOrdered +rm chi2_valuesRU +rm chi2_valuesZR + +#First isolate the fit parameters and sort them so you can compare the same parameters for each isobar +echo "generate chi2_values" +cat catLOG_for_MinChi2_ZR | cut -d "=" -f2 | sort -g > chi2_valuesZR +cat catLOG_for_MinChi2_RU | cut -d "=" -f2 | sort -g > chi2_valuesRU + +#numLines=$(wc -l chi2_valuesZR | cut -d " " -f1) + +# HERE v Edit the number below to correspond to the number of lines in chi2_valuesZR +for i in {1..256} +do + chi2_zr=$(sed "${i}q;d" chi2_valuesZR | cut -d "," -f5 | cut -d "/" -f1) + dof_zr=$(sed "${i}q;d" chi2_valuesZR | cut -d "," -f5 | cut -d "/" -f2) + chi2_ru=$(sed "${i}q;d" chi2_valuesRU | cut -d "," -f5 | cut -d "/" -f1) + dof_ru=$(sed "${i}q;d" chi2_valuesRU | cut -d "," -f5 | cut -d "/" -f2) + chi2_combined=$(awk '{print ($1+$3)/($2+$4)}' <<<"${chi2_zr} ${dof_zr} ${chi2_ru} ${dof_ru}") + echo $chi2_combined >> chi2_valuesCOMBINED +done + +cat chi2_valuesCOMBINED | sort -g > chi2_valuesCombinedAndOrdered + +echo "generated chi2_values" + +minChi2=$(head -n 1 chi2_valuesCombinedAndOrdered) + +echo "found minimum combined chi2: $minChi2" +chiLineNumber=$(grep -n "${minChi2}" chi2_valuesCOMBINED | cut -d ":" -f1) +echo "Best chi2 found at line number: $chiLineNumber of chi2_valuesZR and chi2_valuesRU" + +nppValue_zr=$(sed "${chiLineNumber}q;d" chi2_valuesZR | cut -c 3-7) +kValue_zr=$(sed "${chiLineNumber}q;d" chi2_valuesZR | cut -c 10-14) +xValue_zr=$(sed "${chiLineNumber}q;d" chi2_valuesZR | cut -c 17-21) +dValue_zr=$(sed "${chiLineNumber}q;d" chi2_valuesZR | cut -c 24-28) +chiValue_zr=$(sed "${chiLineNumber}q;d" chi2_valuesZR | cut -d "," -f5 | cut -d "/" -f1) +dofValue_zr=$(sed "${chiLineNumber}q;d" chi2_valuesZR | cut -d "," -f5 | cut -d "/" -f2) +nppValue_ru=$(sed "${chiLineNumber}q;d" chi2_valuesRU | cut -c 3-7) +kValue_ru=$(sed "${chiLineNumber}q;d" chi2_valuesRU | cut -c 10-14) +xValue_ru=$(sed "${chiLineNumber}q;d" chi2_valuesRU | cut -c 17-21) +dValue_ru=$(sed "${chiLineNumber}q;d" chi2_valuesRU | cut -c 24-28) +chiValue_ru=$(sed "${chiLineNumber}q;d" chi2_valuesRU | cut -d "," -f5 | cut -d "/" -f1) +dofValue_ru=$(sed "${chiLineNumber}q;d" chi2_valuesRU | cut -d "," -f5 | cut -d "/" -f2) + +echo "Zr parameters (npp, k, x, d): $nppValue_zr, $kValue_zr, $xValue_zr, $dValue_zr" +echo "Zr chi2/DOF = $chiValue_zr / $dofValue_zr" +echo "Ru parameters (npp, k, x, d): $nppValue_ru, $kValue_ru, $xValue_ru, $dValue_ru" +echo "Ru chi2/DOF = $chiValue_ru / $dofValue_ru" + + +if (( $(echo "$nppValue_zr != $nppValue_ru" |bc -l) )) +then + echo "Best fit values do not match for the isobars! Something went wrong!" + echo "npp_Zr: ${nppValue_zr}, npp_Ru: ${nppValue_ru}" + exit +fi + +nppValue=$nppValue_zr +kValue=$kValue_zr +xValue=$xValue_zr +dValue=$dValue_zr + +echo "nppValue: " $nppValue +echo "kValue: " $kValue +echo "xValue: " $xValue +echo "dValue: " $dValue + +inDir=../RatioChi2Files +#HERE Change v +#ls ${inDir}/chi2_nevents1000000_npp${nppValue}-${nppValue}_k${kValue}-${kValue}_x${xValue}_${xValue}_eff*.root > minChi2_fileCOMBINED.list +inDir_Zr=../RatioChi2Files_Zr +inDir_Ru=../RatioChi2Files_Ru +rm -r bestChi2RootFile/Zr +rm -r bestChi2RootFile/Ru +mkdir bestChi2RootFile/Zr +mkdir bestChi2RootFile/Ru +outDir_Zr=bestChi2RootFile/Zr +outDir_Ru=bestChi2RootFile/Ru + +cp ${inDir_Zr}/chi2_nevents2000000_npp${nppValue}-${nppValue}_k${kValue}-${kValue}_x${xValue}_${xValue}_eff${dValue}.root ${outDir_Zr} +cp ${inDir_Zr}/Ratio_npp${nppValue}_k${kValue}_x${xValue}_eff${dValue}.root ${outDir_Zr} +cp ${inDir_Ru}/chi2_nevents2000000_npp${nppValue}-${nppValue}_k${kValue}-${kValue}_x${xValue}_${xValue}_eff${dValue}.root ${outDir_Ru} +cp ${inDir_Ru}/Ratio_npp${nppValue}_k${kValue}_x${xValue}_eff${dValue}.root ${outDir_Ru} + +echo "the root files are copied to dir of bestChi2RootFile" + + +exit + +#chi2_nevents1000000_npp2.300-2.300_k2.000-2.000_x0.140_0.140_eff0.170.root diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/getBestChi2_fromCat/getBestChi2RootFile.sh b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/getBestChi2_fromCat/getBestChi2RootFile.sh new file mode 100644 index 00000000000..7d00e311a8f --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/getBestChi2_fromCat/getBestChi2RootFile.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +############################################################ +# original author Zaochen Ye +# new STAR users are responsible to improve the script +############################################################ + +#if nevents=1million +nppValue=$(tail -1 minChi2_rootfile_fullname.dat | cut -c 42-46) +kValue=$(tail -1 minChi2_rootfile_fullname.dat | cut -c 55-59) +xValue=$(tail -1 minChi2_rootfile_fullname.dat | cut -c 68-72) +effValue=$(tail -1 minChi2_rootfile_fullname.dat | cut -c 83-87) +#if nevents=100k +#nppValue=$(tail -1 minChi2_rootfile_fullname.dat | cut -c 41-45) +#kValue=$(tail -1 minChi2_rootfile_fullname.dat | cut -c 54-58) +#xValue=$(tail -1 minChi2_rootfile_fullname.dat | cut -c 67-71) +#effValue=$(tail -1 minChi2_rootfile_fullname.dat | cut -c 82-86) + +#nppValue=$(tail -1 minChi2_file.list | cut -c 42-46) +#kValue=$(tail -1 minChi2_file.list | cut -c 55-59) +#xValue=$(tail -1 minChi2_file.list | cut -c 128-132) +#effValue=$(tail -1 minChi2_file.list | cut -c 143-147) + +echo "The parameters to best match Glauber Simulation to Corrected Refmult in real data are found as:" +echo "nppValue: " $nppValue +echo "kValue: " $kValue +echo "xValue: " $xValue +echo "effValue:" $effValue + +inDir=../RatioChi2Files +outDir=bestChi2RootFile + +#HERE v +cp ${inDir}/chi2_nevents1000000_npp${nppValue}-${nppValue}_k${kValue}-${kValue}_x${xValue}_${xValue}_eff${effValue}.root ${outDir} +cp ${inDir}/Ratio_npp${nppValue}_k${kValue}_x${xValue}_eff${effValue}.root ${outDir} +echo "the root files are copied to dir of ${outDir}" +exit diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/getBestChi2_fromCat/readme b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/getBestChi2_fromCat/readme new file mode 100644 index 00000000000..4e4e86acd52 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/getBestChi2_fromCat/readme @@ -0,0 +1,4 @@ +run this first ./genTargetList.sh +then run: rbq findBestChi2.C + you will find the corresponding root file name + /direct/star+u/zye20/allScripts/analysis/GlauberSimu/auau27gev/glauberSim/LOG_Scan/doScanX_my_1_27_1_8_0_16_0_11.log diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/merge_chi2.C b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/merge_chi2.C new file mode 100644 index 00000000000..24dbee04b81 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/merge_chi2.C @@ -0,0 +1,225 @@ + +//____________________________________________________________________________________________________ +void merge_chi2_npp_k(const Char_t* inputFileList = "file_chi2.list") +{ + ifstream fin(inputFileList); + if(!fin){ + Error("merge_chi2", "can't open %s", inputFileList); + return; + } + + // 200 GeV + // const Int_t nppbin = 20 ; + // const Double_t nppmin = 2.18 ; + // const Double_t nppmax = 2.38 ; + // const Int_t kbin = 100 ; + // const Double_t kmin = 0.30 ; + // const Double_t kmax = 1.30 ; + // const Int_t nppbin = 40 ; + // const Double_t nppmin = 2.00 ; + // const Double_t nppmax = 2.40 ; + // const Int_t kbin = 30 ; + // const Double_t kmin = 0.50 ; + // const Double_t kmax = 3.50 ; + + // 39 GeV + // const Int_t nppbin = 10 ; + // const Int_t nppbin = 50 ; + // const Double_t nppmin = 1.1 ; + // const Double_t nppmax = 1.6 ; + // const Double_t nppmin = 1.3 ; + // const Double_t nppmax = 1.8 ; + // const Double_t nppmin = 1.45 ; + // const Double_t nppmax = 1.55 ; + + // 39 GeV + // const Int_t kbin = 31 ; + // const Double_t kmin = 0.50 ; + // const Double_t kmax = 3.50 ; + // const Int_t kbin = 40 ; + // const Int_t kbin = 20 ; + // const Double_t kmin = 1.00 ; + // const Double_t kmax = 3.00 ; + + // 11.5 GeV + // const Int_t nppbin = 20 ; + // const Double_t nppmin = 1.0 ; + // const Double_t nppmax = 1.2 ; + // const Int_t kbin = 10 ; + // const Double_t kmin = 1.00 ; + // const Double_t kmax = 2.00 ; + // const Int_t kbin = 50 ; + // const Double_t kmin = 0.50 ; + // const Double_t kmax = 3.00 ; + + // 7.7 GeV + const Int_t nppbin = 30 ; + const Double_t nppmin = 0.7 ; + const Double_t nppmax = 1.0 ; + const Int_t kbin = 30 ; + const Double_t kmin = 0.50 ; + const Double_t kmax = 3.50 ; + + TH2* hChi2 = new TH2D("hchi2Merge", "", nppbin, nppmin, nppmax, kbin, kmin, kmax); + hChi2->SetXTitle("n_{pp}"); + hChi2->SetYTitle("k"); + + Int_t ifile = 0 ; + Double_t nevents = 0 ; + TString name(""); + while( fin >> name ){ + TFile* file = TFile::Open(name); + if(!file || !file->IsOpen()){ + Error("merge_chi2", "can't open %s", name.Data()); + return; + } + cout << "OPEN " << file->GetName() << endl; + + TH3* hchi2 = (TH3D*) file->Get("hChi2"); + nevents += hchi2->GetEntries() ; + for(Int_t x=0; xGetNbinsX(); x++){ + const Int_t y = ifile ; + hChi2->SetBinContent(x+1, y+1, hchi2->GetBinContent(x+1, 1, 1)); + } + + ifile++; + } + + hChi2->SetEntries(nevents); + + TFile* output = TFile::Open("chi2_merge.root", "recreate"); + hChi2->Write(); + output->Close(); +} + + +//____________________________________________________________________________________________________ +void merge_chi2_npp_x(const Char_t* inputFileList = "file_chi2.list") +{ + ifstream fin(inputFileList); + if(!fin){ + Error("merge_chi2", "can't open %s", inputFileList); + return; + } + + const Int_t nppbin = 50 ; + // const Double_t nppmin = 1.1 ; + // const Double_t nppmax = 1.6 ; + const Double_t nppmin = 1.3 ; + const Double_t nppmax = 1.8 ; + // const Int_t xbin = 11 ; + // const Double_t xmin = 0.08 ; + // const Double_t xmax = 0.19 ; + const Int_t xbin = 70 ; + const Double_t xmin = 0.08 ; + const Double_t xmax = 0.15 ; + + TH2* hChi2 = new TH2D("hchi2Merge", "", nppbin, nppmin, nppmax, xbin, xmin, xmax); + hChi2->SetXTitle("n_{pp}"); + hChi2->SetYTitle("x"); + + Int_t ifile = 0 ; + Double_t nevents = 0 ; + TString name(""); + while( fin >> name ){ + TFile* file = TFile::Open(name); + if(!file || !file->IsOpen()){ + Error("merge_chi2", "can't open %s", name.Data()); + return; + } + cout << "OPEN " << file->GetName() << " nfile=[" << ifile << "]" << endl; + + TH3* hchi2 = (TH3D*) file->Get("hChi2"); + nevents += hchi2->GetEntries() ; + for(Int_t x=0; xGetNbinsX(); x++){ + const Int_t z = ifile ; + hChi2->SetBinContent(x+1, z+1, hchi2->GetBinContent(x+1, 1, 1)); + } + + ifile++; + } + hChi2->SetEntries(nevents); + + TFile* output = TFile::Open("chi2_merge_x_vs_npp.root", "recreate"); + hChi2->Write(); + output->Close(); +} + +//____________________________________________________________________________________________________ +void merge_chi2_eff(const Char_t* inputFileList = "file_chi2.list") +{ + ifstream fin(inputFileList); + if(!fin){ + Error("merge_chi2", "can't open %s", inputFileList); + return; + } + + // 39 GeV + // const Int_t kbin = 30 ; + // const Double_t kmin = 0.50 ; + // const Double_t kmax = 3.50 ; + const Int_t nppbin = 50 ; + const Double_t nppmin = 0.70 ; + const Double_t nppmax = 1.20 ; + + // 11.5 GeV + const Int_t nppbin = 20 ; + const Double_t nppmin = 1.00 ; + const Double_t nppmax = 1.20 ; + + // For constant efficiency, 7.7 GeV + // const Int_t effbin = 40 ; + // const Double_t effmin = 0.60 ; + // const Double_t effmax = 1.00 ; + + // For mult-dep efficiency, 7.7 GeV + // const Int_t effbin = 60 ; + // const Double_t effmin = 0.00 ; + // const Double_t effmax = 0.60 ; + // const Double_t effmin = 0.10 ; + // const Double_t effmax = 0.31 ; + + // 11.5 GeV (mult-dep) + const Int_t effbin = 30 ; + const Double_t effmin = 0.05 ; + const Double_t effmax = 0.35 ; + + // TH2* hChi2 = new TH2D("hchi2Merge", "", kbin, kmin, kmax, effbin, effmin, effmax); + // hChi2->SetXTitle("k"); + TH2* hChi2 = new TH2D("hchi2Merge", "", nppbin, nppmin, nppmax, effbin, effmin, effmax); + hChi2->SetXTitle("n_{pp}"); + hChi2->SetYTitle("#varepsilon"); + + Int_t ifile = 0 ; + Double_t nevents = 0 ; + TString name(""); + while( fin >> name ){ + TFile* file = TFile::Open(name); + if(!file || !file->IsOpen()){ + Error("merge_chi2", "can't open %s", name.Data()); + return; + } + cout << "OPEN " << file->GetName() << endl; + + TH3* hchi2 = (TH3D*) file->Get("hChi2"); + // TH1* hchi2k = (TH1D*) hchi2->Project3D("y"); + TH1* hchi2npp = (TH1D*) hchi2->Project3D("x"); + nevents += hchi2->GetEntries() ; + // for(Int_t x=0; xGetNbinsX(); x++){ + for(Int_t x=0; xGetNbinsX(); x++){ + const Int_t z = ifile ; + // hChi2->SetBinContent(x+1, z+1, hchi2k->GetBinContent(x+1)); + hChi2->SetBinContent(x+1, z+1, hchi2npp->GetBinContent(x+1)); + } + + ifile++; + file->Close(); + } + hChi2->SetEntries(nevents); + + TFile* output = TFile::Open("chi2_merge.root", "recreate"); + hChi2->Write(); + output->Close(); + } + + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/prepare.sh b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/prepare.sh new file mode 100644 index 00000000000..a3f9b60d1a5 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/prepare.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +outDir=../glauberOut +mkdir -p ${outDir} +ln -s ${outDir} . + +mkdir -p ${outDir}/temfor_rm +mv ${outDir}/LOG ${outDir}/temfor_rm/ +mv ${outDir}/LIST ${outDir}/temfor_rm/ +mv ${outDir}/table ${outDir}/temfor_rm/ +mv ${outDir}/figure ${outDir}/temfor_rm/ + +mkdir -p ${outDir}/LOG +mkdir -p ${outDir}/LIST +mkdir -p ${outDir}/table +mkdir -p ${outDir}/figure +mkdir -p ${outDir}/output +mkdir -p ${outDir}/RatioChi2Files +mkdir -p ${outDir}/LOG_Scan + +ln -s ${outDir}/LOG +ln -s ${outDir}/LIST +ln -s ${outDir}/table +ln -s ${outDir}/figure +ln -s ${outDir}/output +ln -s ${outDir}/RatioChi2Files +ln -s ${outDir}/LOG_Scan + + +echo "after mv the old output, LOG, LIST, table, figure files to the temfor_rm, let's delele temfor_rm" +rm -rf ${outDir}/temfor_rm & + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/submit_condor.pl b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/submit_condor.pl new file mode 100644 index 00000000000..0e3149256e2 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/submit_condor.pl @@ -0,0 +1,264 @@ +#! /usr/bin/perl +use Getopt::Long; + +# Default arguments +$verbose = 0 ; +my $help = 0 ; +my $log = "LOG_Scan"; +my $queue = 0 ; # batch queue flag +my $submit = 0 ; + +GetOptions ( + 'verbose' => \$verbose, # Debug flag + 'help' => \$help , # Help messages + 'log=s' => \$log, # Set log directory (default is $PWD/LOG) + 'queue' => \$queue, # Use "long" queue (default is cas) + 'submit' => \$submit # submit jobs +); + +#---------------------------------------------------------------------------------------------------- +# Help messages +#---------------------------------------------------------------------------------------------------- +my $usage = q( + + Usage: submit_condor.pl [-d] [-h] [-l log directory] [-s] 'command' 'arguments ...' + + Submit 'command' into the condor batch queue + + Current available arguments (in any order): + + -h or --help Show this messages and exit + -l or --log [log file directory] Set log directory (default is $PWD/LOG) + -l SCRATCH will set the log directory in $SCRATCH + + -q or --queue Use long queue (default is short queue, cas) + -s or --submit Submit jobs + -v or --verbose Print debug messages + + In order to submit job, you need add '-s' option like + submit_condor.pl -s [your command] [your arguments] + + Otherwise the submit_condor.pl will just return the submission strings + + + +); + +#---------------------------------------------------------------------------------------------------- +# Print help messages and exit +#---------------------------------------------------------------------------------------------------- +if( $help ) +{ + print($usage); + exit(0); +} + +#---------------------------------------------------------------------------------------------------- +# Debugging messages +#---------------------------------------------------------------------------------------------------- +printDebug("\n\nVerbose mode. Print debugging messages ..."); + +my $currentDir = `pwd` ; +chomp($currentDir); +printDebug("Current directory: $currentDir"); + +#---------------------------------------------------------------------------------------------------- +# Execute command, make sure it exists +#---------------------------------------------------------------------------------------------------- +my $nARGV = $#ARGV + 1 ; +printDebug("# of arguments : $nARGV"); +for(my $i=0; $i<=$#ARGV; $i++) { + printDebug("The argument $i+1: $ARGV[$i]"); +} + +if ( $nARGV == 0 ){ + print ""; + print " No argument. See usage below"; + print($usage); + exit(0); +} + +#---------------------------------------------------------------------------------------------------- +# Execute command, and make sure it exists +#---------------------------------------------------------------------------------------------------- +my $execLocal = shift @ARGV ; +my $execCommand = "$currentDir/$execLocal" ; +checkFile($execCommand); +printDebug("Execute command: $execCommand"); + +#---------------------------------------------------------------------------------------------------- +# Make log file strings +#---------------------------------------------------------------------------------------------------- +$execHeader = `echo $execLocal | sed 's/\.csh//g' | sed 's/\.pl//g'` ; +chomp($execHeader); + +my $logHeader = "$execHeader"; +my @arguments = (""); + +if( $#ARGV + 1 != 0 ){ # Arguments > 0 + # Remove path, and ".root" + for(my $i = 0; $i < $#ARGV + 1; $i++){ + # For job submission arguments + @arguments = @ARGV ; + + # For log files (remove .root, .csh .list) + $tmp[$i] = `basename $ARGV[$i] | sed 's/\\.root//g' | sed 's/\\.csh//g' | sed 's/\\.list//g' | sed 's/\\./_/g'` ; + chomp($tmp[$i]); + } + + $logHeader = "$execHeader\_@tmp"; + # Remove space between arguments + $logHeader = `echo $logHeader | sed 's/ /_/g'` ; + chomp($logHeader); +} + +#---------------------------------------------------------------------------------------------------- +# Make log directory to full path +#---------------------------------------------------------------------------------------------------- +my $logFullPath = $log ; + +if ( $logFullPath =~ /SCRATCH/ ){ + # Do not check directory for $SCRATCH + $logFullPath = "\$SCRATCH"; + printDebug("Use \$SCRATCH directory for log files ..."); +} +elsif ( $logFullPath !~ /^\// ) { + # Supposed to be the path in the current directory + $logFullPath = "$currentDir/$log" ; + checkDirectory($logFullPath, "log"); +} + +my $outFile = "$logFullPath/$logHeader.out"; +my $logFile = "$logFullPath/$logHeader.log"; +my $errFile = "$logFullPath/$logHeader.err"; +printDebug("Out file : $outFile"); +printDebug("Log file : $logFile"); +printDebug("Err file : $errFile"); + +#---------------------------------------------------------------------------------------------------- +# Delete previous log if they are found +#---------------------------------------------------------------------------------------------------- +if ( -e $logFile ){ + system("rm -v $logFile"); +} + +if ( -e $errFile ){ + system("rm -v $errFile"); +} + +#---------------------------------------------------------------------------------------------------- +# Set queue +#---------------------------------------------------------------------------------------------------- +my $batchQueue = "cas"; +if( $queue ){ + $batchQueue = "long"; +} +printDebug("Use queue = $batchQueue"); + +#---------------------------------------------------------------------------------------------------- +# Set submission command +#---------------------------------------------------------------------------------------------------- +$requirements = '(CPU_Type != "crs") && (CPU_Experiment == "star") && CPU_Experiment != "lsst" && CPU_Experiment != "atlas"'; +$usermail = "chenlz\@rcf.rhic.bnl.gov"; + +#print "-------------------------- condor_submit input list --------------------------\n" ; +#print "\n" ; +#print "Universe = vanilla\n" ; +#print "Notification = Error\n" ; +#print "Executable = $execCommand\n"; +#print "Arguments = @arguments\n"; +#print "Initialdir = $currentDir\n" ; +#print "Output = $outFile\n" ; +#print "Error = $errFile\n" ; +#print "Log = $logFile\n" ; +#print "Requirements = $requirements\n" ; +#print "GetEnv = True\n" ; +#print "Notify_user = $usermail\n" ; +#print "Priority = +10\n" ; +#print "+Experiment = \"star\"\n" ; +#print "+Job_Type = \"$batchQueue\"\n" ; +#print "PeriodicRemove = (JobStatus == 2 && (CurrentTime - JobCurrentStartDate > (54000)) && ((RemoteUserCpu+RemoteSysCpu)/(CurrentTime-JobCurrentStartDate) < 0.10))\n" ; +#print "Queue\n"; +#print "\n" ; +#print "------------------------------------------------------------------------------\n" ; + +if ( $submit ) { + # Make temporary xml file to submit job. tmpSubmitJob.xml + my $xmlFile = "tmpSubmitJob.xml"; # will be deleted right after job submission + open (OUT, ">$xmlFile") || die "can't open $xmlFile\n"; + print OUT "Universe = vanilla\n" ; + print OUT "Notification = Error\n" ; + print OUT "Executable = $execCommand\n"; + print OUT "Arguments = @arguments\n"; + print OUT "Initialdir = $currentDir\n" ; + print OUT "Output = $outFile\n" ; + print OUT "Error = $errFile\n" ; + print OUT "Log = $logFile\n" ; + print OUT "Requirements = $requirements\n" ; + print OUT "GetEnv = True\n" ; + print OUT "Notify_user = $usermail\n" ; + print OUT "Priority = +10\n" ; + print OUT "+Experiment = \"star\"\n" ; + print OUT "+Job_Type = \"$batchQueue\"\n" ; + print OUT "PeriodicRemove = (JobStatus == 2 && (CurrentTime - JobCurrentStartDate > (54000)) && ((RemoteUserCpu+RemoteSysCpu)/(CurrentTime-JobCurrentStartDate) < 0.10))\n" ; + print OUT "Queue\n"; + close(OUT); + system("condor_submit $xmlFile"); + system("rm $xmlFile"); +} + +#---------------------------------------------------------------------------------------------------- +# Check file exists +#---------------------------------------------------------------------------------------------------- +sub checkFile { + my $file = shift @_ ; + if( -f $file ){ + if($verbose){ + printDebug("OK: $file"); + } + + return; + } + + print "\n"; + print " Error: No $file exists. Stop. \n"; + print " Make sure you've put the correct path for $file file. \n"; + print "\n"; + exit(0); +} + +#---------------------------------------------------------------------------------------------------- +# Check directory exists +#---------------------------------------------------------------------------------------------------- +sub checkDirectory { + my $directory = shift @_ ; + my $file = shift @_ ; + if( -d $directory ){ + if($verbose){ + printDebug("OK: ($file) $directory"); + } + + return; + } + + print "\n"; + print " Error: No $directory exists. Stop. \n"; + print " Make sure you've put the correct path for $file file. \n"; + print "\n"; + exit(0); +} + + +#---------------------------------------------------------------------------------------------------- +# Debug print +#---------------------------------------------------------------------------------------------------- +sub printDebug { + if(!$verbose){ + return; + } + + my $arg = shift @_ ; + print "DEBUG: $arg\n"; + return; +} + diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/submit_doScan.pl b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/submit_doScan.pl new file mode 100644 index 00000000000..a85489f035d --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/submit_doScan.pl @@ -0,0 +1,81 @@ +#! /usr/bin/perl + +############################################################################# +#the follow are the parameters obtained in Run11 27GeV AuAu mb data +# const Double_t npp = 1.385 ; // default npp +# // const Double_t npp = 1.390 ; // default npp +# mNpp = npp + GetNppError(npp) ; +# mK = 1.65 ; +# mX = 0.12 + xError ; +# mEfficiency = 0.14 ; +# mTriggerBias = 1.00 ; +############################################################################# + + +############################################################################## +# to scan for the best parameters, we can set the #bins and range for each parameter +#npp1.270-1.270_k1.700-1.700_x0.150_0.150_eff0.090. +my $nppbin = 5; +my $nppmin = 2.0; +my $nppmax = 3.0; + +my $kbin = 5; +my $kmin = 1.5; +my $kmax = 5.0; + +my $xbin = 5; +my $xmin = 0.10; +my $xmax = 0.25; + +my $effbin = 5; +my $effmin = 0.08; +my $effmax = 0.20; +############################################################################# + + +############################################################################# +#after the scan, find the best parameters, and fix them as follows: +#and please change the input RefmultCor to be the one after the reweight (Refmult_LumVzCor/hRatio) +#npp1.270-1.270_k1.700-1.700_x0.150_0.150_eff0.090. +# +#my $nppbin = 1; +#my $nppmin = 1.27; +#my $nppmax = 1.27; +# +#my $kbin = 1; +#my $kmin = 1.80; +#my $kmax = 1.80; +# +#my $xbin = 1; +#my $xmin = 0.16; +#my $xmax = 0.16; +# +#my $effbin = 1; +#my $effmin = 0.11; +#my $effmax = 0.11; +############################################################################# + +my $nTotJobs = $nppbin * $kbin * $xbin * $effbin; + +print "number of jobs will be submitted: $nTotJobs\n"; + +my $npp_step = ($nppbin==1) ? 0 : ($nppmax-$nppmin)/($nppbin-1); +my $k_step = ($kbin==1) ? 0 : ($kmax-$kmin)/($kbin-1); +my $x_step = ($xbin==1) ? 0 : ($xmax-$xmin)/($xbin-1); +my $eff_step = ($effbin==1) ? 0 : ($effmax-$effmin)/($effbin-1); +my $macro = "doScanX_my.csh"; +for (my $i=0; $i<$nppbin; $i++) { + for(my $j=0; $j<$kbin; $j++) { + for (my $k=0; $k<$xbin; $k++) { + for(my $ki=0; $ki<$effbin; $ki++) { + my $npp_value = $nppmin + $npp_step * $i; + my $k_value = $kmin + $k_step * $j; + my $x_value = $xmin + $x_step * $k; + my $eff_value = $effmin + $eff_step * $ki; + my $submit = "submit_condor.pl -s $macro $npp_value $k_value $x_value $eff_value"; + system("$submit"); + print "$submit\n"; + } + } + } +} diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/submit_doScanTest.pl b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/submit_doScanTest.pl new file mode 100644 index 00000000000..b55fa27e813 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/submit_doScanTest.pl @@ -0,0 +1,38 @@ +#! /usr/bin/perl + +my $nppbin = 1; +my $nppmin = 2.01; +my $nppmax = 2.01; + +my $kbin = 1; +my $kmin = 2.0; +my $kmax = 2.0; + +my $xbin = 1; +my $xmin = 0.10; +my $xmax = 0.10; + +my $effbin = 1; +my $effmin = 0.11; +my $effmax = 0.11; + +my $npp_step = ($nppbin==1) ? 0 : ($nppmax-$nppmin)/($nppbin-1); +my $k_step = ($kbin==1) ? 0 : ($kmax-$kmin)/($kbin-1); +my $x_step = ($xbin==1) ? 0 : ($xmax-$xmin)/($xbin-1); +my $eff_step = ($effbin==1) ? 0 : ($effmax-$effmin)/($effbin-1); +my $macro = "doScanX_my.csh"; +for (my $i=0; $i<$nppbin; $i++) { + for(my $j=0; $j<$kbin; $j++) { + for (my $k=0; $k<$xbin; $k++) { + for(my $ki=0; $ki<$effbin; $ki++) { + my $npp_value = $nppmin + $npp_step * $i; + my $k_value = $kmin + $k_step * $j; + my $x_value = $xmin + $x_step * $k; + my $eff_value = $effmin + $eff_step * $ki; + my $submit = "submit_condor.pl -s $macro $npp_value $k_value $x_value $eff_value"; + system("$submit"); + print "$submit\n"; + } + } + } +} diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/submit_doScan_multBins.pl b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/submit_doScan_multBins.pl new file mode 100644 index 00000000000..2aad19ac0f4 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/submit_doScan_multBins.pl @@ -0,0 +1,30 @@ +#! /usr/bin/perl + +my $nppbin = 81; +my $nppmin = 1.8; +my $nppmax = 2.6; + +my $kbin = 1; +my $kmin = 2.0; +my $kmax = 2.0; + +my $xbin = 21; +my $xmin = 0.05; +my $xmax = 0.25; + +my $effbin = 21; +my $effmin = 0.05; +my $effmax = 0.25; + +my $npp_step = ($nppbin==1) ? 0 : ($nppmax-$nppmin)/($nppbin-1); +my $eff_step = ($effbin==1) ? 0 : ($effmax-$effmin)/($effbin-1); +my $macro = "doScanX_multBins.csh"; +for (my $i=0; $i<$nppbin; $i++) { + for(my $ki=0; $ki<$effbin; $ki++) { + my $npp_value = $nppmin + $npp_step * $i; + my $eff_value = $effmin + $eff_step * $ki; + my $submit = "submit_condor.pl -s $macro $npp_value $kbin $kmin $kmax $xbin $xmin $xmax $eff_value"; + system("$submit"); + print "$submit\n"; + } +} diff --git a/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/submit_glauber.pl b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/submit_glauber.pl new file mode 100644 index 00000000000..ac0204b4a80 --- /dev/null +++ b/StRoot/PWGTools/CentralityCalibration/Glauber/star_glauber/submit_glauber.pl @@ -0,0 +1,171 @@ +#! /usr/bin/perl +# +#---------------------------------------------------------------------------------------------------- +# Glauber job submission script +#---------------------------------------------------------------------------------------------------- + +use Getopt::Long ; + +my $directory = "output" ; # Output directory (default is outputs) +my $energy = 27 ; # sqrt(sNN), default is 200 GeV +my $help = 0 ; # Help messages flag +my $nevents = 1000 ; # Number of events (default is 1000) +my $repulsion = 0.0 ; # repulsion distance (default is 0fm, i.e. no repulsion) +my $run = 0 ; # Submission flag (default is OFF, i.e. not submit jobs, just print) +my $overwrite = 0 ; # Overwrite flag (default is false) +my $system = "AuAu" ; # System (default is Au+Au) +my $sleep = 0 ; # Job waiting time (default is 0 sec) +my $type = "default" ; # Type (default is "default") +my $deformation = "kTRUE" ; # Deformation flag (default is "kTRUE") +my $verbose = 0 ; # Debug flag + +my $macro = "doFastGlauberMcMaker.csh" ; # macro in current directory + +GetOptions ( + 'deformation=s' => \$deformation, + 'directory=s' => \$directory, + 'energy=s' => \$energy, + 'help' => \$help, + 'nevents=s' => \$nevents, + 'repulsion=s' => \$repulsion, + 'run' => \$run, + 'system=s' => \$system, + 'sleep=i' => \$sleep, + 'type=s' => \$type, + 'verbose' => \$verbose +); + +my $usage = q( + + Usage: submit_glauber.pl [options] [Begin run] [End run] + + Begin/End run should be any integer values, and End run should be larger than Begin run. + + + Current available options (in any order): + + -def (or --deformation) [kTRUE or kFALSE] Set deformation flag + + -dir (or --directory) [output dir] Set output directory (default is outputs) + -e (or --energy) [energy] Set energy (default is 200 GeV) + -h or --help Show this messages and exit + -n (or --nevents) [# of events] Set number of events (default is 1000) + -re (or --repulsion) [distance] Set repulsion distance (default is 0fm, i.e. no repulsion) + -run Submit jobs (default is OFF, i.e. not submit, just print) + + -sys (or --system) [system] Set system (default is AuAu) + Current available systems are: + AuAu + SmSm + + -sleep [second] Wait [second] sec (default is 0 sec, i.e. no wait) + + -t (or --type) [type] Set type of Glauber simulation (default is "default") + Current available types are: + default Default MC Glauber simulation + large Larger radius (+2%), smaller skin depth (-10%) + small Smaller radius (-2%), larger skin depth (+10%) + largeXsec Larger cross section (+1mb) + smallXsec Smaller cross section (-1mb) + gauss Gaussian overlap collision profile + + -v or --verbose Print debugging messages + +); + +#---------------------------------------------------------------------------------------------------- +# Print help, and exit +#---------------------------------------------------------------------------------------------------- +if($help){ + print($usage); + exit(0); +} + +printDebug("Verbose mode. Print debugging messages ..."); + +#---------------------------------------------------------------------------------------------------- +# Check macro exists +#---------------------------------------------------------------------------------------------------- +if ( ! -f $macro ){ + print "\n\n\n Error: No $macro exists in current directory. Stop \n\n\n"; + exit(0); +} +printDebug("Use macro: $macro"); + +#---------------------------------------------------------------------------------------------------- +# Check number of arguments (should be 2) +#---------------------------------------------------------------------------------------------------- +if ( $#ARGV + 1 != 2 ) { + print "\n\n\n Error: You need 2 arguments. See below for help \n\n\n"; + print($usage); + exit(0); +} +printDebug("Number of arguments is $#ARGV + 1"); + +#---------------------------------------------------------------------------------------------------- +# Check validity of Begin/End runs +#---------------------------------------------------------------------------------------------------- +my $beginRun = shift @ARGV ; +my $endRun = shift @ARGV ; + +if ( $beginRun > $endRun ){ + print "\n\n\n Error: End run is larger than begin run. (begin, end) = ($beginRun, $endRun). Stop \n\n\n"; + exit(0); +} + +printDebug("Begin/End Run: (begin, end) = ($beginRun, $endRun)"); + +#---------------------------------------------------------------------------------------------------- +# Check output directory +#---------------------------------------------------------------------------------------------------- +if ( ! -d $directory ) { + print "\n\n\n Error: No output directory $directory exists. Stop \n\n\n"; + exit(0); +} + +printDebug("Output directory for ROOT files: $directory"); + +#---------------------------------------------------------------------------------------------------- +# Deformation flag +#---------------------------------------------------------------------------------------------------- +my $nuclei = "spherical"; +if ( $deformation =~ "kTRUE" ){ + $nuclei = "deformed" +} + +#---------------------------------------------------------------------------------------------------- +# Looping over all run number +#---------------------------------------------------------------------------------------------------- +while ( $beginRun < $endRun ){ + $runNumber = `printf "%04d" $beginRun` ; + $outputFileName = "$directory/fastglaubermc_$system\_$energy" . "GeV_$type\_$nuclei\_run$runNumber.root"; + $submit = "submit_condor.pl -v -s $macro $outputFileName $nevents $system $energy $type $deformation"; + printDebug("$submit"); + + # Submit if "$run" flag is ON + if($run){ + system("$submit"); + + if($sleep>0){ + printDebug("Waiting for $sleep sec ..."); + system("sleep $sleep"); + } + } + + $beginRun++; +} + +#---------------------------------------------------------------------------------------------------- +# Debug print +#---------------------------------------------------------------------------------------------------- +sub printDebug { + if(!$verbose){ + return; + } + + my $arg = shift @_ ; + print "DEBUG: $arg\n"; + return; +} + + diff --git a/mgr/Construct b/mgr/Construct index d28592c5067..60cab6f79c4 100644 --- a/mgr/Construct +++ b/mgr/Construct @@ -264,7 +264,7 @@ my $items = "";# print "items $#items = @items\n"; if ( defined($SKIP_DIRS) ) { $items = join("|", split(" ", $SKIP_DIRS)); } else { - $items = "StShadowMaker"; + $items = "StShadowMaker|PWGTools"; } if ( $#items > -1){