X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=PWGJE%2FEMCALJetTasks%2FUserTasks%2FAliAnalysisTaskRhoVnModulation.cxx;h=01cf17e24b0b14e9e192ff309a83460705b73107;hb=74779dffdce2e7178cea0be33000b5e204fb308b;hp=c9da194c03f08cb11a67611897907b6c1ba7b3ed;hpb=29495bcf9f7e5ea98ce1f1e759a4e02d530791da;p=u%2Fmrichter%2FAliRoot.git diff --git a/PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskRhoVnModulation.cxx b/PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskRhoVnModulation.cxx index c9da194c03f..01cf17e24b0 100644 --- a/PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskRhoVnModulation.cxx +++ b/PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskRhoVnModulation.cxx @@ -29,6 +29,7 @@ * rbertens@cern.ch, rbertens@nikhef.nl, r.a.bertens@uu.nl */ +// root includes #include #include #include @@ -38,20 +39,21 @@ #include #include #include - +// aliroot includes #include #include #include #include #include #include - +#include +// emcal jet framework includes #include #include #include - -#include "AliAnalysisTaskRhoVnModulation.h" - +#include +#include +#include class AliAnalysisTaskRhoVnModulation; using namespace std; @@ -59,21 +61,18 @@ using namespace std; ClassImp(AliAnalysisTaskRhoVnModulation) AliAnalysisTaskRhoVnModulation::AliAnalysisTaskRhoVnModulation() : AliAnalysisTaskEmcalJet("AliAnalysisTaskRhoVnModulation", kTRUE), - fDebug(0), fInitialized(0), fFillQAHistograms(kTRUE), fCentralityClasses(0), fNAcceptedTracks(0), fFitModulationType(kNoFit), fUsePtWeight(kTRUE), fDetectorType(kTPC), fFitModulationOptions("Q"), fRunModeType(kGrid), fDataType(kESD), fRandom(0), fMappedRunNumber(0), fInCentralitySelection(-1), fFitModulation(0), fMinPvalue(0), fMaxPvalue(1), fNameJetClones(0), fNamePicoTrackClones(0), fNameRho(0), fAbsVertexZ(10), fHistCentrality(0), fHistVertexz(0), fHistRunnumbersPhi(0), fHistRunnumbersEta(0), fHistPvaluePDF(0), fHistPvalueCDF(0), fMinDisanceRCtoLJ(0), fRandomConeRadius(0.4), fAbsVnHarmonics(kTRUE), fExcludeLeadingJetsFromFit(1.), fRebinSwapHistoOnTheFly(kTRUE), fPercentageOfFits(10.), fUseV0EventPlaneFromHeader(kFALSE), fSetPtSub(kFALSE), fOutputList(0), fOutputListGood(0), fOutputListBad(0), fHistAnalysisSummary(0), fHistSwap(0), fProfV2(0), fProfV3(0), fHistPsiControl(0), fHistPsiSpread(0), fHistPsiVZEROA(0), fHistPsiVZEROC(0), fHistPsiTPC(0), fHistPsiTPCSUBA(0), fHistPsiTPCSUBB(0), - fHistRhoVsMult(0), fHistRhoVsCent(0), fHistRhoAVsMult(0), fHistRhoAVsCent(0) { + fDebug(0), fRunToyMC(kFALSE), fLocalInit(0), fAttachToEvent(kTRUE), fSemiCentralInclusive(kFALSE), fFillHistograms(kTRUE), fFillQAHistograms(kTRUE), fReduceBinsXByFactor(-1.), fReduceBinsYByFactor(-1.), fNoEventWeightsForQC(kTRUE), fCentralityClasses(0), fPtBinsHybrids(0), fPtBinsJets(0), fExpectedRuns(0), fExpectedSemiGoodRuns(0), fUserSuppliedV2(0), fUserSuppliedV3(0), fUserSuppliedR2(0), fUserSuppliedR3(0), fTracksCont(0), fClusterCont(0), fJetsCont(0), fLeadingJet(0), fUseScaledRho(0), fNAcceptedTracks(0), fNAcceptedTracksQCn(0), fFitModulationType(kNoFit), fFitGoodnessTest(kChi2Poisson), fQCRecovery(kTryFit), fUsePtWeight(kTRUE), fUsePtWeightErrorPropagation(kTRUE), fDetectorType(kTPC), fAnalysisType( kCharged), fFitModulationOptions("QWLI"), fRunModeType(kGrid), fDataType(kESD), fCollisionType(kPbPb), fRandom(0), fRunNumber(-1), fMappedRunNumber(0), fInCentralitySelection(-1), fFitModulation(0), fFitControl(0), fMinPvalue(0.01), fMaxPvalue(1), fNameJetClones(0), fNamePicoTrackClones(0), fNameRho(0), fNameSmallRho(""), fCachedRho(0), fLocalJetMinEta(-10), fLocalJetMaxEta(-10), fLocalJetMinPhi(-10), fLocalJetMaxPhi(-10), fSoftTrackMinPt(0.15), fSoftTrackMaxPt(5.), fSemiGoodJetMinPhi(0.), fSemiGoodJetMaxPhi(4.), fSemiGoodTrackMinPhi(0.), fSemiGoodTrackMaxPhi(4.), fAbsVertexZ(10), fHistCentrality(0), fHistVertexz(0), fHistRunnumbersPhi(0), fHistRunnumbersEta(0), fHistPvalueCDFROOT(0), fHistPvalueCDFROOTCent(0), fHistChi2ROOTCent(0), fHistPChi2Root(0), fHistPvalueCDF(0), fHistPvalueCDFCent(0), fHistChi2Cent(0), fHistPChi2(0), fHistKolmogorovTest(0), fHistKolmogorovTestCent(0), fHistPKolmogorov(0), fHistRhoStatusCent(0), fHistUndeterminedRunQA(0), fMinDisanceRCtoLJ(0), fRandomConeRadius(-1.), fMaxCones(-1), fAbsVnHarmonics(kTRUE), fExcludeLeadingJetsFromFit(1.), fRebinSwapHistoOnTheFly(kTRUE), fPercentageOfFits(10.), fUseV0EventPlaneFromHeader(kTRUE), fExplicitOutlierCut(-1), fMinLeadingHadronPt(0), fSubtractJetPt(kFALSE), fOutputList(0), fOutputListGood(0), fOutputListBad(0), fHistAnalysisSummary(0), fHistSwap(0), fProfV2(0), fProfV2Cumulant(0), fProfV3(0), fProfV3Cumulant(0), fHistPsiControl(0), fHistPsiSpread(0), fHistPsiVZEROA(0), fHistPsiVZEROC(0), fHistPsiVZERO(0), fHistPsiTPC(0), fHistPsiVZEROAV0M(0), fHistPsiVZEROCV0M(0), fHistPsiVZEROVV0M(0), fHistPsiTPCiV0M(0), fHistPsiVZEROATRK(0), fHistPsiVZEROCTRK(0), fHistPsiVZEROTRK(0), fHistPsiTPCTRK(0), fHistRhoVsMult(0), fHistRhoVsCent(0), fHistRhoAVsMult(0), fHistRhoAVsCent(0) { for(Int_t i(0); i < 10; i++) { fProfV2Resolution[i] = 0; fProfV3Resolution[i] = 0; fHistPicoTrackPt[i] = 0; + fHistPicoTrackMult[i] = 0; fHistPicoCat1[i] = 0; fHistPicoCat2[i] = 0; fHistPicoCat3[i] = 0; - /* fHistClusterPt[i] = 0; */ - /* fHistClusterPhi[i] = 0; */ - /* fHistClusterEta[i] = 0; */ - /* fHistClusterCorrPt[i] = 0; */ - /* fHistClusterCorrPhi[i] = 0; */ - /* fHistClusterCorrEta[i] = 0; */ + fHistClusterPt[i] = 0; + fHistClusterEtaPhi[i] = 0; + fHistClusterEtaPhiWeighted[i] = 0; fHistRhoPackage[i] = 0; fHistRho[i] = 0; fHistRCPhiEta[i] = 0; @@ -86,46 +85,32 @@ AliAnalysisTaskRhoVnModulation::AliAnalysisTaskRhoVnModulation() : AliAnalysisTa fHistRCPtExLJ[i] = 0; fHistDeltaPtDeltaPhi2ExLJ[i] = 0; fHistDeltaPtDeltaPhi3ExLJ[i] = 0; - fHistRCPhiEtaRand[i] = 0; - fHistRhoVsRCPtRand[i] = 0; - fHistRCPtRand[i] = 0; - fHistDeltaPtDeltaPhi2Rand[i] = 0; - fHistDeltaPtDeltaPhi3Rand[i] = 0; fHistJetPtRaw[i] = 0; fHistJetPt[i] = 0; fHistJetEtaPhi[i] = 0; fHistJetPtArea[i] = 0; + fHistJetPtEta[i] = 0; fHistJetPtConstituents[i] = 0; fHistJetEtaRho[i] = 0; - fHistJetPsiTPCPt[i] = 0; - fHistJetPsiVZEROAPt[i] = 0; - fHistJetPsiVZEROCPt[i] = 0; - fHistDeltaPhi2VZEROA[i] = 0; - fHistDeltaPhi2VZEROC[i] = 0; - fHistDeltaPhi2TPC[i] = 0; - fHistDeltaPhi3VZEROA[i] = 0; - fHistDeltaPhi3VZEROC[i] = 0; - fHistDeltaPhi3TPC[i] = 0; + fHistJetPsi2Pt[i] = 0; + fHistJetPsi3Pt[i] = 0; } // default constructor } //_____________________________________________________________________________ AliAnalysisTaskRhoVnModulation::AliAnalysisTaskRhoVnModulation(const char* name, runModeType type) : AliAnalysisTaskEmcalJet(name, kTRUE), - fDebug(0), fInitialized(0), fFillQAHistograms(kTRUE), fCentralityClasses(0), fNAcceptedTracks(0), fFitModulationType(kNoFit), fUsePtWeight(kTRUE), fDetectorType(kTPC), fFitModulationOptions("Q"), fRunModeType(type), fDataType(kESD), fRandom(0), fMappedRunNumber(0), fInCentralitySelection(-1), fFitModulation(0), fMinPvalue(0), fMaxPvalue(1), fNameJetClones(0), fNamePicoTrackClones(0), fNameRho(0), fAbsVertexZ(10), fHistCentrality(0), fHistVertexz(0), fHistRunnumbersPhi(0), fHistRunnumbersEta(0), fHistPvaluePDF(0), fHistPvalueCDF(0), fMinDisanceRCtoLJ(0), fRandomConeRadius(0.4), fAbsVnHarmonics(kTRUE), fExcludeLeadingJetsFromFit(1.), fRebinSwapHistoOnTheFly(kTRUE), fPercentageOfFits(10.), fUseV0EventPlaneFromHeader(kFALSE), fSetPtSub(kFALSE), fOutputList(0), fOutputListGood(0), fOutputListBad(0), fHistAnalysisSummary(0), fHistSwap(0), fProfV2(0), fProfV3(0), fHistPsiControl(0), fHistPsiSpread(0), fHistPsiVZEROA(0), fHistPsiVZEROC(0), fHistPsiTPC(0), fHistPsiTPCSUBA(0), fHistPsiTPCSUBB(0), - fHistRhoVsMult(0), fHistRhoVsCent(0), fHistRhoAVsMult(0), fHistRhoAVsCent(0) { + fDebug(0), fRunToyMC(kFALSE), fLocalInit(0), fAttachToEvent(kTRUE), fSemiCentralInclusive(kFALSE), fFillHistograms(kTRUE), fFillQAHistograms(kTRUE), fReduceBinsXByFactor(-1.), fReduceBinsYByFactor(-1.), fNoEventWeightsForQC(kTRUE), fCentralityClasses(0), fPtBinsHybrids(0), fPtBinsJets(0), fExpectedRuns(0), fExpectedSemiGoodRuns(0), fUserSuppliedV2(0), fUserSuppliedV3(0), fUserSuppliedR2(0), fUserSuppliedR3(0), fTracksCont(0), fClusterCont(0), fJetsCont(0), fLeadingJet(0), fUseScaledRho(0), fNAcceptedTracks(0), fNAcceptedTracksQCn(0), fFitModulationType(kNoFit), fFitGoodnessTest(kChi2Poisson), fQCRecovery(kTryFit), fUsePtWeight(kTRUE), fUsePtWeightErrorPropagation(kTRUE), fDetectorType(kTPC), fAnalysisType(kCharged), fFitModulationOptions("QWLI"), fRunModeType(type), fDataType(kESD), fCollisionType(kPbPb), fRandom(0), fRunNumber(-1), fMappedRunNumber(0), fInCentralitySelection(-1), fFitModulation(0), fFitControl(0), fMinPvalue(0.01), fMaxPvalue(1), fNameJetClones(0), fNamePicoTrackClones(0), fNameRho(0), fNameSmallRho(""), fCachedRho(0), fLocalJetMinEta(-10), fLocalJetMaxEta(-10), fLocalJetMinPhi(-10), fLocalJetMaxPhi(-10), fSoftTrackMinPt(0.15), fSoftTrackMaxPt(5.), fSemiGoodJetMinPhi(0.), fSemiGoodJetMaxPhi(4.), fSemiGoodTrackMinPhi(0.), fSemiGoodTrackMaxPhi(4.), fAbsVertexZ(10), fHistCentrality(0), fHistVertexz(0), fHistRunnumbersPhi(0), fHistRunnumbersEta(0), fHistPvalueCDFROOT(0), fHistPvalueCDFROOTCent(0), fHistChi2ROOTCent(0), fHistPChi2Root(0), fHistPvalueCDF(0), fHistPvalueCDFCent(0), fHistChi2Cent(0), fHistPChi2(0), fHistKolmogorovTest(0), fHistKolmogorovTestCent(0), fHistPKolmogorov(0), fHistRhoStatusCent(0), fHistUndeterminedRunQA(0), fMinDisanceRCtoLJ(0), fRandomConeRadius(-1.), fMaxCones(-1), fAbsVnHarmonics(kTRUE), fExcludeLeadingJetsFromFit(1.), fRebinSwapHistoOnTheFly(kTRUE), fPercentageOfFits(10.), fUseV0EventPlaneFromHeader(kTRUE), fExplicitOutlierCut(-1), fMinLeadingHadronPt(0), fSubtractJetPt(kFALSE), fOutputList(0), fOutputListGood(0), fOutputListBad(0), fHistAnalysisSummary(0), fHistSwap(0), fProfV2(0), fProfV2Cumulant(0), fProfV3(0), fProfV3Cumulant(0), fHistPsiControl(0), fHistPsiSpread(0), fHistPsiVZEROA(0), fHistPsiVZEROC(0), fHistPsiVZERO(0), fHistPsiTPC(0), fHistPsiVZEROAV0M(0), fHistPsiVZEROCV0M(0), fHistPsiVZEROVV0M(0), fHistPsiTPCiV0M(0), fHistPsiVZEROATRK(0), fHistPsiVZEROCTRK(0), fHistPsiVZEROTRK(0), fHistPsiTPCTRK(0), fHistRhoVsMult(0), fHistRhoVsCent(0), fHistRhoAVsMult(0), fHistRhoAVsCent(0) { for(Int_t i(0); i < 10; i++) { fProfV2Resolution[i] = 0; fProfV3Resolution[i] = 0; fHistPicoTrackPt[i] = 0; + fHistPicoTrackMult[i] = 0; fHistPicoCat1[i] = 0; fHistPicoCat2[i] = 0; fHistPicoCat3[i] = 0; - /* fHistClusterPt[i] = 0; */ - /* fHistClusterPhi[i] = 0; */ - /* fHistClusterEta[i] = 0; */ - /* fHistClusterCorrPt[i] = 0; */ - /* fHistClusterCorrPhi[i] = 0; */ - /* fHistClusterCorrEta[i] = 0; */ + fHistClusterPt[i] = 0; + fHistClusterEtaPhi[i] = 0; + fHistClusterEtaPhiWeighted[i] = 0; fHistRhoPackage[i] = 0; fHistRho[i] = 0; fHistRCPhiEta[i] = 0; @@ -138,26 +123,15 @@ AliAnalysisTaskRhoVnModulation::AliAnalysisTaskRhoVnModulation(const char* name, fHistRCPtExLJ[i] = 0; fHistDeltaPtDeltaPhi2ExLJ[i] = 0; fHistDeltaPtDeltaPhi3ExLJ[i] = 0; - fHistRCPhiEtaRand[i] = 0; - fHistRhoVsRCPtRand[i] = 0; - fHistRCPtRand[i] = 0; - fHistDeltaPtDeltaPhi2Rand[i] = 0; - fHistDeltaPtDeltaPhi3Rand[i] = 0; fHistJetPtRaw[i] = 0; fHistJetPt[i] = 0; fHistJetEtaPhi[i] = 0; fHistJetPtArea[i] = 0; + fHistJetPtEta[i] = 0; fHistJetPtConstituents[i] = 0; fHistJetEtaRho[i] = 0; - fHistJetPsiTPCPt[i] = 0; - fHistJetPsiVZEROAPt[i] = 0; - fHistJetPsiVZEROCPt[i] = 0; - fHistDeltaPhi2VZEROA[i] = 0; - fHistDeltaPhi2VZEROC[i] = 0; - fHistDeltaPhi2TPC[i] = 0; - fHistDeltaPhi3VZEROA[i] = 0; - fHistDeltaPhi3VZEROC[i] = 0; - fHistDeltaPhi3TPC[i] = 0; + fHistJetPsi2Pt[i] = 0; + fHistJetPsi3Pt[i] = 0; } // constructor DefineInput(0, TChain::Class()); @@ -170,6 +144,13 @@ AliAnalysisTaskRhoVnModulation::AliAnalysisTaskRhoVnModulation(const char* name, } break; default: fDebug = -1; // suppress debug info explicitely when not running locally } + switch (fCollisionType) { + case kPythia : { + fFitModulationType = kNoFit; + } break; + default : break; + } + if(fLocalRhoName=="") fLocalRhoName = Form("LocalRhoFrom_%s", GetName()); } //_____________________________________________________________________________ AliAnalysisTaskRhoVnModulation::~AliAnalysisTaskRhoVnModulation() @@ -181,13 +162,43 @@ AliAnalysisTaskRhoVnModulation::~AliAnalysisTaskRhoVnModulation() if(fFitModulation) delete fFitModulation; if(fHistSwap) delete fHistSwap; if(fCentralityClasses) delete fCentralityClasses; + if(fExpectedRuns) delete fExpectedRuns; + if(fExpectedSemiGoodRuns) delete fExpectedSemiGoodRuns; + if(fFitControl) delete fFitControl; +} +//_____________________________________________________________________________ +void AliAnalysisTaskRhoVnModulation::ExecOnce() +{ + // Init the analysis + fLocalRho = new AliLocalRhoParameter(fLocalRhoName.Data(), 0); + if(fAttachToEvent) { + if(!(InputEvent()->FindListObject(fLocalRho->GetName()))) { + InputEvent()->AddObject(fLocalRho); + } else { + AliFatal(Form("%s: Container with name %s already present. Aborting", GetName(), fLocalRho->GetName())); + } + } + AliAnalysisTaskEmcalJet::ExecOnce(); // init the base class + AliAnalysisTaskEmcalJet::SetVzRange(-1.*fAbsVertexZ, fAbsVertexZ); + if(fUseScaledRho) { + // unscaled rho has been retrieved by the parent class, now we retrieve rho scaled + fRho = dynamic_cast(InputEvent()->FindListObject(Form("%s_Scaled", fRho->GetName()))); + if(!fRho) { + AliFatal(Form("%s: Couldn't find container for scaled rho. Aborting !", GetName())); + } + } + if(!GetJetContainer()) AliFatal(Form("%s: Couldn't find jet container. Aborting !", GetName())); } //_____________________________________________________________________________ Bool_t AliAnalysisTaskRhoVnModulation::InitializeAnalysis() { // initialize the anaysis if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); - if(fMinDisanceRCtoLJ==0) fMinDisanceRCtoLJ = .5*fJetRadius; + if(fRandomConeRadius <= 0) fRandomConeRadius = GetJetContainer()->GetJetRadius(); + if(fMaxCones <= 0) fMaxCones = TMath::Nint(1.8*TMath::TwoPi()/(TMath::Pi()*fRandomConeRadius*fRandomConeRadius)); + if(fLocalJetMinEta > -10 && fLocalJetMaxEta > -10) GetJetContainer()->SetJetEtaLimits(fLocalJetMinEta, fLocalJetMaxEta); + if(fLocalJetMinPhi > -10 && fLocalJetMaxPhi > -10) GetJetContainer()->SetJetPhiLimits(fLocalJetMinPhi, fLocalJetMaxPhi); + if(fMinDisanceRCtoLJ==0) fMinDisanceRCtoLJ = .5*GetJetRadius(); if(dynamic_cast(InputEvent())) fDataType = kAOD; // determine the datatype else if(dynamic_cast(InputEvent())) fDataType = kESD; fHistAnalysisSummary->SetBinContent(36, (int)fDataType); @@ -208,7 +219,7 @@ Bool_t AliAnalysisTaskRhoVnModulation::InitializeAnalysis() fFitModulation->FixParameter(1, 1.); // constant fFitModulation->FixParameter(2, 3.); // constant } break; - default : { // for the combined fit and the 'direct fourier series' we use v2 and v3 + default : { // for the combined fit, the 'direct fourier series' or the user supplied vn values we use v2 and v3 SetModulationFit(new TF1("fit_kCombined", "[0]*([1]+[2]*([3]*TMath::Cos([2]*(x-[4]))+[7]*TMath::Cos([5]*(x-[6]))))", 0, TMath::TwoPi())); fFitModulation->SetParameter(0, 0.); // normalization fFitModulation->SetParameter(3, 0.2); // v2 @@ -222,6 +233,7 @@ Bool_t AliAnalysisTaskRhoVnModulation::InitializeAnalysis() case kGrid : { fFitModulationOptions += "N0"; } break; default : break; } + FillAnalysisSummaryHistogram(); return kTRUE; } //_____________________________________________________________________________ @@ -229,11 +241,12 @@ TH1F* AliAnalysisTaskRhoVnModulation::BookTH1F(const char* name, const char* x, { // book a TH1F and connect it to the output container if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); + if(fReduceBinsXByFactor > 0 ) bins = TMath::Nint(bins/fReduceBinsXByFactor); if(!fOutputList) return 0x0; TString title(name); if(c!=-1) { // format centrality dependent histograms accordingly name = Form("%s_%i", name, c); - title += Form("_%i-%i", fCentralityClasses->At(c), fCentralityClasses->At(1+c)); + title += Form("_%i-%i", (int)(fCentralityClasses->At(c)), (int)(fCentralityClasses->At((1+c)))); } title += Form(";%s;[counts]", x); TH1F* histogram = new TH1F(name, title.Data(), bins, min, max); @@ -246,11 +259,13 @@ TH2F* AliAnalysisTaskRhoVnModulation::BookTH2F(const char* name, const char* x, { // book a TH2F and connect it to the output container if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); + if(fReduceBinsXByFactor > 0 ) binsx = TMath::Nint(binsx/fReduceBinsXByFactor); + if(fReduceBinsYByFactor > 0 ) binsy = TMath::Nint(binsy/fReduceBinsYByFactor); if(!fOutputList) return 0x0; TString title(name); if(c!=-1) { // format centrality dependent histograms accordingly name = Form("%s_%i", name, c); - title += Form("_%i-%i", fCentralityClasses->At(c), fCentralityClasses->At(1+c)); + title += Form("_%i-%i", (int)fCentralityClasses->At(c), (int)(fCentralityClasses->At((1+c)))); } title += Form(";%s;%s", x, y); TH2F* histogram = new TH2F(name, title.Data(), binsx, minx, maxx, binsy, miny, maxy); @@ -266,8 +281,16 @@ void AliAnalysisTaskRhoVnModulation::UserCreateOutputObjects() fOutputList = new TList(); fOutputList->SetOwner(kTRUE); if(!fCentralityClasses) { // classes must be defined at this point - Int_t c[] = {0, 20, 40, 60, 80, 100}; - fCentralityClasses = new TArrayI(sizeof(c)/sizeof(c[0]), c); + Double_t c[] = {0., 20., 40., 60., 80., 100.}; + fCentralityClasses = new TArrayD(sizeof(c)/sizeof(c[0]), c); + } + if(!fExpectedRuns) { // expected runs must be defined at this point + Int_t r[] = {167813, 167988, 168066, 168068, 168069, 168076, 168104, 168212, 168311, 168322, 168325, 168341, 168361, 168362, 168458, 168460, 168461, 168992, 169091, 169094, 169138, 169143, 169167, 169417, 169835, 169837, 169838, 169846, 169855, 169858, 169859, 169923, 169956, 170027, 170036, 170081, /* up till here original good TPC list */169975, 169981, 170038, 170040, 170083, 170084, 170085, 170088, 170089, 170091, 170152, 170155, 170159, 170163, 170193, 170195, 170203, 170204, 170205, 170228, 170230, 170264, 170268, 170269, 170270, 170306, 170308, 170309, /* original semi-good tpc list */169415, 169411, 169035, 168988, 168984, 168826, 168777, 168512, 168511, 168467, 168464, 168342, 168310, 168115, 168108, 168107, 167987, 167915, 167903, /*new runs, good according to RCT */ 169238, 169160, 169156, 169148, 169145, 169144 /* run swith missing OROC 8 but seem ok in QA */}; + fExpectedRuns = new TArrayI(sizeof(r)/sizeof(r[0]), r); + } + if(!fExpectedSemiGoodRuns) { + Int_t r[] = {169975, 169981, 170038, 170040, 170083, 170084, 170085, 170088, 170089, 170091, 170152, 170155, 170159, 170163, 170193, 170195, 170203, 170204, 170205, 170228, 170230, 170264, 170268, 170269, 170270, 170306, 170308, 170309}; + fExpectedSemiGoodRuns = new TArrayI(sizeof(r)/sizeof(r[0]), r); } // global QA fHistCentrality = BookTH1F("fHistCentrality", "centrality", 102, -2, 100); @@ -275,50 +298,55 @@ void AliAnalysisTaskRhoVnModulation::UserCreateOutputObjects() // pico track kinematics for(Int_t i(0); i < fCentralityClasses->GetSize()-1; i++) { - fHistPicoTrackPt[i] = BookTH1F("fHistPicoTrackPt", "p_{t} [GeV/c]", 100, 0, 50, i); + fHistPicoTrackPt[i] = BookTH1F("fHistPicoTrackPt", "p_{t} [GeV/c]", 100, 0, 100, i); + fHistPicoTrackMult[i] = BookTH1F("fHistPicoTrackMult", "multiplicity", 100, 0, 5000, i); if(fFillQAHistograms) { fHistPicoCat1[i] = BookTH2F("fHistPicoCat1", "#eta", "#phi", 50, -1, 1, 50, 0, TMath::TwoPi(), i); fHistPicoCat2[i] = BookTH2F("fHistPicoCat2", "#eta", "#phi", 50, -1, 1, 50, 0, TMath::TwoPi(), i); fHistPicoCat3[i] = BookTH2F("fHistPicoCat3", "#eta", "#phi", 50, -1, 1, 50, 0, TMath::TwoPi(), i); } // emcal kinematics - /* fHistClusterPt[i] = BookTH1F("fHistClusterPt", "p_{t} [GeV/c]", 100, 0, 100, i); */ - /* fHistClusterPhi[i] = BookTH1F("fHistClusterPhi", "#phi", 100, 0, TMath::TwoPi(), i); */ - /* fHistClusterEta[i] = BookTH1F("fHistClusterEta", "#eta", 100, -5, 5); */ + fHistClusterPt[i] = BookTH1F("fHistClusterPt", "p_{t} [GeV/c]", 100, 0, 100, i); + fHistClusterEtaPhi[i] = BookTH2F("fHistClusterEtaPhi", "#eta", "#phi", 100, -1., 1., 100, 0, TMath::TwoPi(), i); + fHistClusterEtaPhiWeighted[i] = BookTH2F("fHistClusterEtaPhiWeighted", "#eta", "#phi", 100, -1., 1., 100, 0, TMath::TwoPi(), i); - // emcal kinematics after hadronic correction - /* fHistClusterCorrPt[i] = BookTH1F("fHistClusterCorrPt", "p_{t} [GeV/c]", 100, 0, 100, i); */ - /* fHistClusterCorrPhi[i] = BookTH1F("fHistClusterCorrPhi", "#phi", 100, 0, TMath::TwoPi(), i); */ - /* fHistClusterCorrEta[i] = BookTH1F("fHistClusterCorrEta", "#eta", 100, -5, 5, i); */ } - // event plane estimates and quality - fHistPsiControl = new TProfile("fHistPsiControl", "fHistPsiControl", 10, 0, 10); - fHistPsiControl->Sumw2(); - fHistPsiSpread = new TProfile("fHistPsiSpread", "fHistPsiSpread", 4, 0, 4); - fHistPsiSpread->Sumw2(); - fHistPsiControl->GetXaxis()->SetBinLabel(1, "<#Psi_{2, VZEROA}>"); - fHistPsiControl->GetXaxis()->SetBinLabel(2, "<#Psi_{2, VZEROC}>"); - fHistPsiControl->GetXaxis()->SetBinLabel(3, "<#Psi_{2, TPC}>"); - fHistPsiControl->GetXaxis()->SetBinLabel(4, "<#Psi_{2, TPC, #eta < 0}>"); - fHistPsiControl->GetXaxis()->SetBinLabel(5, "<#Psi_{2, TPC, #eta > 0}>"); - fHistPsiControl->GetXaxis()->SetBinLabel(1, "<#Psi_{3, VZEROA}>"); - fHistPsiControl->GetXaxis()->SetBinLabel(2, "<#Psi_{3, VZEROC}>"); - fHistPsiControl->GetXaxis()->SetBinLabel(3, "<#Psi_{3, TPC}>"); - fHistPsiControl->GetXaxis()->SetBinLabel(4, "<#Psi_{3, TPC, #eta < 0}>"); - fHistPsiControl->GetXaxis()->SetBinLabel(5, "<#Psi_{3, TPC, #eta > 0}>"); - fHistPsiSpread->GetXaxis()->SetBinLabel(1, "<#Psi_{2, VZEROA} - #Psi_{2, VZEROC}>"); - fHistPsiSpread->GetXaxis()->SetBinLabel(2, "<#Psi_{2, VZEROC} - #Psi_{2, TPC}>"); - fHistPsiSpread->GetXaxis()->SetBinLabel(3, "<#Psi_{2, VZEROC} - #Psi_{2, TPC}>"); - fHistPsiSpread->GetXaxis()->SetBinLabel(4, "<#Psi_{2, TPC, #eta < 0} - #Psi_{2, TPC, #eta > 0}>"); - fOutputList->Add(fHistPsiControl); - fOutputList->Add(fHistPsiSpread); - fHistPsiVZEROA = BookTH1F("fHistPsiVZEROA", "#Psi_{VZEROA}", 100, -.5*TMath::Pi(), .5*TMath::Pi()); - fHistPsiVZEROC = BookTH1F("fHistPsiVZEROC", "#Psi_{VZEROC}", 100, -.5*TMath::Pi(), .5*TMath::Pi()); - fHistPsiTPC = BookTH1F("fHistPsiTPC", "#Psi_{TPC}", 100, -.5*TMath::Pi(), .5*TMath::Pi()); - fHistPsiTPCSUBA = BookTH1F("fHistPsiTPCSUBA", "#Psi_{TPC, #eta < 0}", 100, -.5*TMath::Pi(), .5*TMath::Pi()); - fHistPsiTPCSUBB = BookTH1F("fHistPsiTPCSUBB", "#Psi_{TPC, #eta > 0}", 100, -.5*TMath::Pi(), .5*TMath::Pi()); - + if(fFillQAHistograms) { + // event plane estimates and quality + fHistPsiControl = new TProfile("fHistPsiControl", "fHistPsiControl", 10, 0, 10); + fHistPsiControl->Sumw2(); + fHistPsiSpread = new TProfile("fHistPsiSpread", "fHistPsiSpread", 4, 0, 4); + fHistPsiSpread->Sumw2(); + fHistPsiControl->GetXaxis()->SetBinLabel(1, "<#Psi_{2, VZEROA}>"); + fHistPsiControl->GetXaxis()->SetBinLabel(2, "<#Psi_{2, VZEROC}>"); + fHistPsiControl->GetXaxis()->SetBinLabel(3, "<#Psi_{2, TPC}>"); + fHistPsiControl->GetXaxis()->SetBinLabel(4, "<#Psi_{2, TPC, #eta < 0}>"); + fHistPsiControl->GetXaxis()->SetBinLabel(5, "<#Psi_{2, TPC, #eta > 0}>"); + fHistPsiControl->GetXaxis()->SetBinLabel(6, "<#Psi_{3, VZEROA}>"); + fHistPsiControl->GetXaxis()->SetBinLabel(7, "<#Psi_{3, VZEROC}>"); + fHistPsiControl->GetXaxis()->SetBinLabel(8, "<#Psi_{3, TPC}>"); + fHistPsiControl->GetXaxis()->SetBinLabel(9, "<#Psi_{3, TPC, #eta < 0}>"); + fHistPsiControl->GetXaxis()->SetBinLabel(10, "<#Psi_{3, TPC, #eta > 0}>"); + fHistPsiSpread->GetXaxis()->SetBinLabel(1, "<#Psi_{2, VZEROA} - #Psi_{2, VZEROC}>"); + fHistPsiSpread->GetXaxis()->SetBinLabel(2, "<#Psi_{2, VZEROC} - #Psi_{2, TPC}>"); + fHistPsiSpread->GetXaxis()->SetBinLabel(3, "<#Psi_{2, VZEROC} - #Psi_{2, TPC}>"); + fHistPsiSpread->GetXaxis()->SetBinLabel(4, "<#Psi_{2, TPC, #eta < 0} - #Psi_{2, TPC, #eta > 0}>"); + fOutputList->Add(fHistPsiControl); + fOutputList->Add(fHistPsiSpread); + fHistPsiVZEROA = BookTH1F("fHistPsiVZEROA", "#Psi_{VZEROA}", 40, -.5*TMath::Pi(), .5*TMath::Pi()); + fHistPsiVZEROC = BookTH1F("fHistPsiVZEROC", "#Psi_{VZEROC}", 40, -.5*TMath::Pi(), .5*TMath::Pi()); + fHistPsiVZERO = BookTH1F("fHistPsiVZERO", "#Psi_{VZERO}", 40, -.5*TMath::Pi(), .5*TMath::Pi()); + fHistPsiTPC = BookTH1F("fHistPsiTPC", "#Psi_{TPC}", 40, -.5*TMath::Pi(), .5*TMath::Pi()); + fHistPsiVZEROAV0M = BookTH2F("fHistPsiVZEROAV0M", "V0M", "#Psi_{2, VZEROA}", 60, 0, 60, 40, -.5*TMath::Pi(), .5*TMath::Pi()); + fHistPsiVZEROCV0M = BookTH2F("fHistPsiVZEROCV0M", "V0M", "#Psi_{2, VZEROC}", 60, 0, 60, 40, -.5*TMath::Pi(), .5*TMath::Pi()); + fHistPsiVZEROVV0M = BookTH2F("fHistPsiVZEROV0M", "V0M", "#Psi_{2, VZERO}", 60, 0, 60, 40, -.5*TMath::Pi(), .5*TMath::Pi()); + fHistPsiTPCiV0M = BookTH2F("fHistPsiTPCV0M", "V0M", "#Psi_{2, TRK}", 60, 0, 60, 40, -.5*TMath::Pi(), .5*TMath::Pi()); + fHistPsiVZEROATRK = BookTH2F("fHistPsiVZEROATRK", "TRK", "#Psi_{2, VZEROA}", 60, 0, 60, 40, -.5*TMath::Pi(), .5*TMath::Pi()); + fHistPsiVZEROCTRK = BookTH2F("fHistPsiVZEROCTRK", "TRK", "#Psi_{2, VZEROC}", 60, 0, 60, 40, -.5*TMath::Pi(), .5*TMath::Pi()); + fHistPsiVZEROTRK = BookTH2F("fHistPsiVZEROTRK", "TRK", "#Psi_{2, VZERO}", 60, 0, 60, 40, -.5*TMath::Pi(), .5*TMath::Pi()); + fHistPsiTPCTRK = BookTH2F("fHistPsiTPCTRK", "TRK", "#Psi_{2, TRK}", 60, 0, 60, 40, -.5*TMath::Pi(), .5*TMath::Pi()); + } // background for(Int_t i(0); i < fCentralityClasses->GetSize()-1; i ++) { fHistRhoPackage[i] = BookTH1F("fHistRhoPackage", "#rho [GeV/c]", 100, 0, 150, i); @@ -329,171 +357,134 @@ void AliAnalysisTaskRhoVnModulation::UserCreateOutputObjects() fHistRhoAVsMult = BookTH2F("fHistRhoAVsMult", "multiplicity", "#rho * A (jet) [GeV/c]", 100, 0, 4000, 100, 0, 50); fHistRhoAVsCent = BookTH2F("fHistRhoAVsCent", "centrality", "#rho * A (jet) [GeV/c]", 100, 0, 100, 100, 0, 50); + TString detector(""); + switch (fDetectorType) { + case kTPC : detector+="TPC"; + break; + case kVZEROA : detector+="VZEROA"; + break; + case kVZEROC : detector+="VZEROC"; + break; + case kVZEROComb : detector+="VZEROComb"; + break; + default: break; + } // delta pt distributions for(Int_t i(0); i < fCentralityClasses->GetSize()-1; i ++) { - fHistRCPhiEta[i] = BookTH2F("fHistRCPhiEta", "#phi (RC)", "#eta (RC)", 100, 0, TMath::TwoPi(), 100, -1, 1, i); + if(fFillQAHistograms) fHistRCPhiEta[i] = BookTH2F("fHistRCPhiEta", "#phi (RC)", "#eta (RC)", 40, 0, TMath::TwoPi(), 40, -1, 1, i); fHistRhoVsRCPt[i] = BookTH2F("fHistRhoVsRCPt", "p_{t} (RC) [GeV/c]", "#rho * A (RC) [GeV/c]", 100, 0, 300, 100, 0, 350, i); fHistRCPt[i] = BookTH1F("fHistRCPt", "p_{t} (RC) [GeV/c]", 130, -20, 150, i); - fHistRCPhiEtaExLJ[i] = BookTH2F("fHistRCPhiEtaExLJ", "#phi (RC)", "#eta (RC)", 100, 0, TMath::TwoPi(), 100, -1, 1, i); - fHistDeltaPtDeltaPhi2[i] = BookTH2F("fHistDeltaPtDeltaPhi2", "#phi - #Psi_{TPC}", "#delta p_{t} [GeV/c]", 100, 0, TMath::TwoPi(), 100, -50, 100, i); - fHistDeltaPtDeltaPhi3[i] = BookTH2F("fHistDeltaPtDeltaPhi3", "#phi - #Psi_{TPC}", "#delta p_{t} [GeV/c]", 100, 0, TMath::TwoPi(), 100, -50, 100, i); + if(fFillQAHistograms) fHistRCPhiEtaExLJ[i] = BookTH2F("fHistRCPhiEtaExLJ", "#phi (RC)", "#eta (RC)", 40, 0, TMath::TwoPi(), 40, -1, 1, i); + fHistDeltaPtDeltaPhi2[i] = BookTH2F("fHistDeltaPtDeltaPhi2", Form("#phi - #Psi_{2, %s}", detector.Data()), "#delta p_{t} [GeV/c]", 40, 0, TMath::Pi(), 400, -70, 130, i); + fHistDeltaPtDeltaPhi3[i] = BookTH2F("fHistDeltaPtDeltaPhi3", Form("#phi - #Psi_{3, %s}", detector.Data()), "#delta p_{t} [GeV/c]", 40, 0, TMath::TwoPi()/3., 400, -70, 130, i); fHistRhoVsRCPtExLJ[i] = BookTH2F("fHistRhoVsRCPtExLJ", "p_{t} (RC) [GeV/c]", "#rho * A (RC) [GeV/c]", 100, 0, 300, 100, 0, 350, i); fHistRCPtExLJ[i] = BookTH1F("fHistRCPtExLJ", "p_{t} (RC) [GeV/c]", 130, -20, 150, i); - fHistRCPhiEtaRand[i] = BookTH2F("fHistRCPhiEtaRand", "#phi (RC)", "#eta (RC)", 100, 0, TMath::TwoPi(), 100, -1, 1, i); - fHistDeltaPtDeltaPhi2ExLJ[i] = BookTH2F("fHistDeltaPtDeltaPhi2ExLJ", "#phi - #Psi_{TPC}", "#delta p_{t} [GeV/c]", 100, 0, TMath::TwoPi(), 100, -50, 100, i); - fHistDeltaPtDeltaPhi3ExLJ[i] = BookTH2F("fHistDeltaPtDeltaPhi3ExLJ", "#phi - #Psi_{TPC}", "#delta p_{t} [GeV/c]", 100, 0, TMath::TwoPi(), 100, -50, 100, i); - fHistRhoVsRCPtRand[i] = BookTH2F("fHistRhoVsRCPtRand", "p_{t} (RC) [GeV/c]", "#rho * A (RC) [GeV/c]", 100, 0, 300, 100, 0, 350, i); - fHistRCPtRand[i] = BookTH1F("fHistRCPtRand", "p_{t} (RC) [GeV/c]", 130, -20, 150, i); - fHistDeltaPtDeltaPhi2Rand[i] = BookTH2F("fHistDeltaPtDeltaPhi2Rand", "#phi - #Psi_{TPC}", "#delta p_{t} [GeV/c]", 100, 0, TMath::TwoPi(), 100, -50, 100, i); - fHistDeltaPtDeltaPhi3Rand[i] = BookTH2F("fHistDeltaPtDeltaPhi3Rand", "#phi - #Psi_{TPC}", "#delta p_{t} [GeV/c]", 100, 0, TMath::TwoPi(), 100, -50, 100, i); + /* fHistRCPhiEtaRand[i] = BookTH2F("fHistRCPhiEtaRand", "#phi (RC)", "#eta (RC)", 100, 0, TMath::TwoPi(), 100, -1, 1, i); */ + fHistDeltaPtDeltaPhi2ExLJ[i] = BookTH2F("fHistDeltaPtDeltaPhi2ExLJ", Form("#phi - #Psi_{2, %s}", detector.Data()), "#delta p_{t} [GeV/c]", 40, 0, TMath::Pi(), 400, -70, 130, i); + fHistDeltaPtDeltaPhi3ExLJ[i] = BookTH2F("fHistDeltaPtDeltaPhi3ExLJ", Form("#phi - #Psi_{3, %s}", detector.Data()), "#delta p_{t} [GeV/c]", 40, 0, TMath::TwoPi()/3., 400, -70, 130, i); + /* fHistRhoVsRCPtRand[i] = BookTH2F("fHistRhoVsRCPtRand", "p_{t} (RC) [GeV/c]", "#rho * A (RC) [GeV/c]", 100, 0, 300, 100, 0, 350, i); */ + /* fHistRCPtRand[i] = BookTH1F("fHistRCPtRand", "p_{t} (RC) [GeV/c]", 130, -20, 150, i); */ + /* fHistDeltaPtDeltaPhi2Rand[i] = BookTH2F("fHistDeltaPtDeltaPhi2Rand", "#phi - #Psi_{TPC}", "#delta p_{t} [GeV/c]", 50, 0, TMath::Pi(), 100, -50, 100, i); */ + /* fHistDeltaPtDeltaPhi3Rand[i] = BookTH2F("fHistDeltaPtDeltaPhi3Rand", "#phi - #Psi_{TPC}", "#delta p_{t} [GeV/c]", 50, 0, TMath::TwoPi()/3., 100, -50, 100, i); */ // jet histograms (after kinematic cuts) - fHistJetPtRaw[i] = BookTH1F("fHistJetPtRaw", "p_{t} RAW [GeV/c]", 200, -50, 150, i); - fHistJetPt[i] = BookTH1F("fHistJetPt", "p_{t} [GeV/c]", 350, -100, 250, i); - fHistJetEtaPhi[i] = BookTH2F("fHistJetEtaPhi", "#eta", "#phi", 100, -1, 1, 100, 0, TMath::TwoPi(), i); - fHistJetPtArea[i] = BookTH2F("fHistJetPtArea", "p_{t} [GeV/c]", "Area", 350, -100, 250, 60, 0, 0.3, i); - fHistJetPtConstituents[i] = BookTH2F("fHistJetPtConstituents", "p_{t} [GeV/c]", "Area", 350, -100, 250, 60, 0, 150, i); + fHistJetPtRaw[i] = BookTH1F("fHistJetPtRaw", "p_{t, jet} RAW [GeV/c]", 200, -50, 150, i); + fHistJetPt[i] = BookTH1F("fHistJetPt", "p_{t, jet} [GeV/c]", 350, -100, 250, i); + if(fFillQAHistograms) fHistJetEtaPhi[i] = BookTH2F("fHistJetEtaPhi", "#eta", "#phi", 100, -1, 1, 100, 0, TMath::TwoPi(), i); + fHistJetPtArea[i] = BookTH2F("fHistJetPtArea", "p_{t, jet} [GeV/c]", "Area", 175, -100, 250, 30, 0, 0.9, i); + fHistJetPtEta[i] = BookTH2F("fHistJetPtEta", "p_{t, jet} [GeV/c]", "Eta", 175, -100, 250, 30, -0.9, 0.9, i); + fHistJetPtConstituents[i] = BookTH2F("fHistJetPtConstituents", "p_{t, jet} [GeV/c]", "Area", 350, -100, 250, 60, 0, 150, i); fHistJetEtaRho[i] = BookTH2F("fHistJetEtaRho", "#eta", "#rho", 100, -1, 1, 100, 0, 300, i); // in plane and out of plane spectra - fHistJetPsiTPCPt[i] = BookTH2F("fHistJetPsiTPCPt", "#phi_{jet} - #Psi_{2, TPC}", "p_{t} [GeV/c]", 100, 0., TMath::TwoPi(), 700, -100, 250, i); - fHistJetPsiVZEROAPt[i] = BookTH2F("fHistJetPsiVZEROAPt", "#phi_{jet} - #Psi_{2, VZEROA}", "p_{t} [GeV/c]", 100, 0., TMath::TwoPi(), 700, -100, 250, i); - fHistJetPsiVZEROCPt[i] = BookTH2F("fHistJetPsiVZEROCPt", "#phi_{jet} - #Psi_{V2, ZEROC}", "p_{t} [GeV/c]", 100, 0., TMath::TwoPi(), 700, -100, 250, i); - // phi minus psi - fHistDeltaPhi2VZEROA[i] = BookTH1F("fHistDeltaPhi2VZEROA", "#phi_{jet} - #Psi_{2, VZEROA}", 100, 0, TMath::TwoPi(), i); - fHistDeltaPhi2VZEROC[i] = BookTH1F("fHistDeltaPhi2VZEROC", "#phi_{jet} - #Psi_{2, VZEROC}", 100, 0, TMath::TwoPi(), i); - fHistDeltaPhi2TPC[i] = BookTH1F("fHistDeltaPhi2TPC", "#phi_{jet} - #Psi_{2, TPC}", 100, 0, TMath::TwoPi(), i); - fHistDeltaPhi3VZEROA[i] = BookTH1F("fHistDeltaPhi3VZEROA", "#phi_{jet} - #Psi_{2, VZEROA}", 100, 0, TMath::TwoPi(), i); - fHistDeltaPhi3VZEROC[i] = BookTH1F("fHistDeltaPhi3VZEROC", "#phi_{jet} - #Psi_{2, VZEROC}", 100, 0, TMath::TwoPi(), i); - fHistDeltaPhi3TPC[i] = BookTH1F("fHistDeltaPhi3TPC", "#phi_{jet} - #Psi_{2, TPC}", 100, 0, TMath::TwoPi(), i); - - fProfV2Resolution[i] = new TProfile(Form("fProfV2Resolution_%i", i), Form("fProfV2Resolution_%i", i), 8, -0.5, 7.5); - fProfV2Resolution[i]->GetXaxis()->SetBinLabel(1, ""); - fProfV2Resolution[i]->GetXaxis()->SetBinLabel(2, ""); + fHistJetPsi2Pt[i] = BookTH2F("fHistJetPsi2Pt", Form("#phi_{jet} - #Psi_{2, %s}", detector.Data()), "p_{t, jet} [GeV/c]", 40, 0., TMath::Pi(), 350, -100, 250, i); + fHistJetPsi3Pt[i] = BookTH2F("fHistJetPsi3Pt", Form("#phi_{jet} - #Psi_{3, %s}", detector.Data()), "p_{t, jet} [GeV/c]", 40, 0., TMath::TwoPi()/3., 350, -100, 250, i); + // profiles for all correlator permutations which are necessary to calculate each second and third order event plane resolution + fProfV2Resolution[i] = new TProfile(Form("fProfV2Resolution_%i", i), Form("fProfV2Resolution_%i", i), 11, -0.5, 10.5); fProfV2Resolution[i]->GetXaxis()->SetBinLabel(3, ""); fProfV2Resolution[i]->GetXaxis()->SetBinLabel(4, ""); fProfV2Resolution[i]->GetXaxis()->SetBinLabel(5, ""); fProfV2Resolution[i]->GetXaxis()->SetBinLabel(6, ""); fProfV2Resolution[i]->GetXaxis()->SetBinLabel(7, ""); fProfV2Resolution[i]->GetXaxis()->SetBinLabel(8, ""); + fProfV2Resolution[i]->GetXaxis()->SetBinLabel(9, ""); + fProfV2Resolution[i]->GetXaxis()->SetBinLabel(10, ""); + fProfV2Resolution[i]->GetXaxis()->SetBinLabel(11, ""); fOutputList->Add(fProfV2Resolution[i]); - fProfV3Resolution[i] = new TProfile(Form("fProfV3Resolution_%i", i), Form("fProfV3Resolution_%i", i), 8, -0.5, 7.5); - fProfV3Resolution[i]->GetXaxis()->SetBinLabel(1, ""); - fProfV3Resolution[i]->GetXaxis()->SetBinLabel(2, ""); + fProfV3Resolution[i] = new TProfile(Form("fProfV3Resolution_%i", i), Form("fProfV3Resolution_%i", i), 11, -0.5, 10.5); fProfV3Resolution[i]->GetXaxis()->SetBinLabel(3, ""); fProfV3Resolution[i]->GetXaxis()->SetBinLabel(4, ""); fProfV3Resolution[i]->GetXaxis()->SetBinLabel(5, ""); fProfV3Resolution[i]->GetXaxis()->SetBinLabel(6, ""); fProfV3Resolution[i]->GetXaxis()->SetBinLabel(7, ""); fProfV3Resolution[i]->GetXaxis()->SetBinLabel(8, ""); + fProfV3Resolution[i]->GetXaxis()->SetBinLabel(9, ""); + fProfV3Resolution[i]->GetXaxis()->SetBinLabel(10, ""); + fProfV3Resolution[i]->GetXaxis()->SetBinLabel(11, ""); fOutputList->Add(fProfV3Resolution[i]); } - // cdf and pdf of chisquare distribution - fHistPvaluePDF = BookTH1F("fHistPvaluePDF", "PDF #chi^{2}", 500, 0, 1); - fHistPvalueCDF = BookTH1F("fHistPvalueCDF", "CDF #chi^{2}", 500, 0, 1); - // vn profile + // vn profile Float_t temp[fCentralityClasses->GetSize()]; for(Int_t i(0); i < fCentralityClasses->GetSize(); i++) temp[i] = fCentralityClasses->At(i); fProfV2 = new TProfile("fProfV2", "fProfV2", fCentralityClasses->GetSize()-1, temp); fProfV3 = new TProfile("fProfV3", "fProfV3", fCentralityClasses->GetSize()-1, temp); fOutputList->Add(fProfV2); fOutputList->Add(fProfV3); - - // analysis summary histrogram, saves all relevant analysis settigns - fHistAnalysisSummary = BookTH1F("fHistAnalysisSummary", "flag", 42, -0.5, 42.5); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(1, "fJetRadius"); - fHistAnalysisSummary->SetBinContent(1, fJetRadius); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(2, "fPtBiasJetTrack"); - fHistAnalysisSummary->SetBinContent(2, fPtBiasJetTrack); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(3, "fPtBiasJetClus"); - fHistAnalysisSummary->SetBinContent(3, fPtBiasJetClus); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(4, "fJetPtCut"); - fHistAnalysisSummary->SetBinContent(4, fJetPtCut); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(5, "fJetAreaCut"); - fHistAnalysisSummary->SetBinContent(5, fJetAreaCut); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(6, "fPercAreaCut"); - fHistAnalysisSummary->SetBinContent(6, fPercAreaCut); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(7, "fAreaEmcCut"); - fHistAnalysisSummary->SetBinContent(7, fAreaEmcCut); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(8, "fJetMinEta"); - fHistAnalysisSummary->SetBinContent(8, fJetMinEta); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(9, "fJetMaxEta"); - fHistAnalysisSummary->SetBinContent(9, fJetMaxEta); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(10, "fJetMinPhi"); - fHistAnalysisSummary->SetBinContent(10, fJetMinPhi); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(11, "fJetMaxPhi"); - fHistAnalysisSummary->SetBinContent(11, fJetMaxPhi); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(12, "fMaxClusterPt"); - fHistAnalysisSummary->SetBinContent(12, fMaxClusterPt); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(13, "fMaxTrackPt"); - fHistAnalysisSummary->SetBinContent(13, fMaxTrackPt); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(14, "fLeadingHadronType"); - fHistAnalysisSummary->SetBinContent(14, fLeadingHadronType); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(15, "fAnaType"); - fHistAnalysisSummary->SetBinContent(15, fAnaType); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(16, "fForceBeamType"); - fHistAnalysisSummary->SetBinContent(16, fForceBeamType); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(17, "fMinCent"); - fHistAnalysisSummary->SetBinContent(17, fMinCent); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(18, "fMaxCent"); - fHistAnalysisSummary->SetBinContent(18, fMaxCent); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(19, "fMinVz"); - fHistAnalysisSummary->SetBinContent(19, fMinVz); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(20, "fMaxVz"); - fHistAnalysisSummary->SetBinContent(20, fMaxVz); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(21, "fOffTrigger"); - fHistAnalysisSummary->SetBinContent(21, fOffTrigger); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(22, "fClusPtCut"); - fHistAnalysisSummary->SetBinContent(22, fClusPtCut); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(23, "fTrackPtCut"); - fHistAnalysisSummary->SetBinContent(23, fTrackPtCut); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(24, "fTrackMinEta"); - fHistAnalysisSummary->SetBinContent(24, fTrackMinEta); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(25, "fTrackMaxEta"); - fHistAnalysisSummary->SetBinContent(25, fTrackMaxEta); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(26, "fTrackMinPhi"); - fHistAnalysisSummary->SetBinContent(26, fTrackMinPhi); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(27, "fTrackMaxPhi"); - fHistAnalysisSummary->SetBinContent(27, fTrackMaxPhi); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(28, "fClusTimeCutLow"); - fHistAnalysisSummary->SetBinContent(28, fClusTimeCutLow); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(29, "fClusTimeCutUp"); - fHistAnalysisSummary->SetBinContent(29, fClusTimeCutUp); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(30, "fMinPtTrackInEmcal"); - fHistAnalysisSummary->SetBinContent(30, fMinPtTrackInEmcal); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(31, "fEventPlaneVsEmcal"); - fHistAnalysisSummary->SetBinContent(31, fEventPlaneVsEmcal); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(32, "fMinEventPlane"); - fHistAnalysisSummary->SetBinContent(32, fMaxEventPlane); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(33, "fRandomConeRadius"); - fHistAnalysisSummary->SetBinContent(33, fRandomConeRadius); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(34, "fitModulationType"); - fHistAnalysisSummary->SetBinContent(34, (int)fFitModulationType); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(35, "runModeType"); - fHistAnalysisSummary->SetBinContent(35, (int)fRunModeType); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(36, "data type"); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(37, "iterator"); - fHistAnalysisSummary->SetBinContent(37, 1.); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(38, "fMinPvalue"); - fHistAnalysisSummary->SetBinContent(38, fMinPvalue); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(39, "fMaxPvalue"); - fHistAnalysisSummary->SetBinContent(39, fMaxPvalue); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(40, "fExcludeLeadingJetsFromFit"); - fHistAnalysisSummary->SetBinContent(40, fExcludeLeadingJetsFromFit); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(41, "fRebinSwapHistoOnTheFly"); - fHistAnalysisSummary->SetBinContent(41, (int)fRebinSwapHistoOnTheFly); - fHistAnalysisSummary->GetXaxis()->SetBinLabel(42, "fUsePtWeight"); - fHistAnalysisSummary->SetBinContent(42, (int)fUsePtWeight); - + switch (fFitModulationType) { + case kQC2 : { + fProfV2Cumulant = new TProfile("fProfV2Cumulant", "fProfV2Cumulant", fCentralityClasses->GetSize()-1, temp); + fProfV3Cumulant = new TProfile("fProfV3Cumulant", "fProfV3Cumulant", fCentralityClasses->GetSize()-1, temp); + fOutputList->Add(fProfV2Cumulant); + fOutputList->Add(fProfV3Cumulant); + } break; + case kQC4 : { + fProfV2Cumulant = new TProfile("fProfV2Cumulant", "fProfV2Cumulant", fCentralityClasses->GetSize()-1, temp); + fProfV3Cumulant = new TProfile("fProfV3Cumulant", "fProfV3Cumulant", fCentralityClasses->GetSize()-1, temp); + fOutputList->Add(fProfV2Cumulant); + fOutputList->Add(fProfV3Cumulant); + } break; + default : break; + } + // for the histograms initialized below, binning is fixed to runnumbers or flags + fReduceBinsXByFactor = 1; + fReduceBinsYByFactor = 1; if(fFillQAHistograms) { - fHistRunnumbersEta = new TH2F("fHistRunnumbersEta", "fHistRunnumbersEta", 100, -.5, 99.5, 100, -1.1, 1.1); + fHistRunnumbersEta = new TH2F("fHistRunnumbersEta", "fHistRunnumbersEta", fExpectedRuns->GetSize()+1, -.5, fExpectedRuns->GetSize()+.5, 100, -1.1, 1.1); fHistRunnumbersEta->Sumw2(); fOutputList->Add(fHistRunnumbersEta); - fHistRunnumbersPhi = new TH2F("fHistRunnumbersPhi", "fHistRunnumbersPhi", 100, -.5, 99.5, 100, -0.2, TMath::TwoPi()+0.2); + fHistRunnumbersPhi = new TH2F("fHistRunnumbersPhi", "fHistRunnumbersPhi", fExpectedRuns->GetSize()+1, -.5, fExpectedRuns->GetSize()+.5, 100, -0.2, TMath::TwoPi()+0.2); fHistRunnumbersPhi->Sumw2(); fOutputList->Add(fHistRunnumbersPhi); + for(Int_t i(0); i < fExpectedRuns->GetSize(); i++) { + fHistRunnumbersPhi->GetXaxis()->SetBinLabel(i+1, Form("%i", fExpectedRuns->At(i))); + fHistRunnumbersEta->GetXaxis()->SetBinLabel(i+1, Form("%i", fExpectedRuns->At(i))); + } + fHistRunnumbersPhi->GetXaxis()->SetBinLabel(fExpectedRuns->GetSize()+1, "undetermined"); + fHistRunnumbersEta->GetXaxis()->SetBinLabel(fExpectedRuns->GetSize()+1, "undetermined"); } - + fHistAnalysisSummary = BookTH1F("fHistAnalysisSummary", "flag", 54, -0.5, 54.5); fHistSwap = new TH1F("fHistSwap", "fHistSwap", 20, 0, TMath::TwoPi()); - fHistSwap->Sumw2(); + if(fUsePtWeight) fHistSwap->Sumw2(); + + if(fUserSuppliedV2) fOutputList->Add(fUserSuppliedV2); + if(fUserSuppliedV3) fOutputList->Add(fUserSuppliedV3); + if(fUserSuppliedR2) fOutputList->Add(fUserSuppliedR2); + if(fUserSuppliedR3) fOutputList->Add(fUserSuppliedR3); + // increase readability of output list + fOutputList->Sort(); + // cdf and pdf of chisquare distribution + fHistPvalueCDF = BookTH1F("fHistPvalueCDF", "CDF #chi^{2}", 50, 0, 1); + fHistPvalueCDFCent = BookTH2F("fHistPvalueCDFCent", "centrality", "p-value", 40, 0, 100, 40, 0, 1); + fHistChi2Cent = BookTH2F("fHistChi2Cent", "centrality", "#tilde{#chi^{2}}", 100, 0, 100, 100, 0, 5); + fHistPChi2 = BookTH2F("fHistPChi2", "p-value", "#tilde{#chi^{2}}", 1000, 0, 1, 100, 0, 5); + fHistKolmogorovTest = BookTH1F("fHistKolmogorovTest", "KolmogorovTest", 50, 0, 1); + fHistKolmogorovTestCent = BookTH2F("fHistKolmogorovTestCent", "centrality", "Kolmogorov p", 40, 0, 100, 45, 0, 1); + fHistPvalueCDFROOT = BookTH1F("fHistPvalueCDFROOT", "CDF #chi^{2} ROOT", 50, 0, 1); + fHistPvalueCDFROOTCent = BookTH2F("fHistPvalueCDFROOTCent", "centrality", "p-value ROOT", 40, 0, 100, 45, 0, 1); + fHistChi2ROOTCent = BookTH2F("fHistChi2ROOTCent", "centrality", "#tilde{#chi^{2}}", 40, 0, 100, 45, 0, 5); + fHistPChi2Root = BookTH2F("fHistPChi2Root", "p-value", "#tilde{#chi^{2}} ROOT", 1000, 0, 1, 100, 0, 5); + fHistPKolmogorov = BookTH2F("fHistPKolmogorov", "p-value", "kolmogorov p",40, 0, 1, 40, 0, 1); + fHistRhoStatusCent = BookTH2F("fHistRhoStatusCent", "centrality", "status [-1=lin was better, 0=ok, 1 = failed]", 101, -1, 100, 3, -1.5, 1.5); + fHistUndeterminedRunQA = BookTH1F("fHistUndeterminedRunQA", "runnumber", 10, 0, 10); + PostData(1, fOutputList); switch (fRunModeType) { @@ -507,66 +498,136 @@ void AliAnalysisTaskRhoVnModulation::UserCreateOutputObjects() } break; default: break; } + + // get the containers + fTracksCont = GetParticleContainer("Tracks"); + fClusterCont = GetClusterContainer(0); // get the default cluster container + fJetsCont = GetJetContainer("Jets"); } //_____________________________________________________________________________ Bool_t AliAnalysisTaskRhoVnModulation::Run() { // user exec: execute once for each event if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); - if(!fInitialized) fInitialized = InitializeAnalysis(); + if(!fTracks||!fJets||!fRho) return kFALSE; + if(!fLocalInit) fLocalInit = InitializeAnalysis(); // reject the event if expected data is missing if(!PassesCuts(InputEvent())) return kFALSE; - if(!(fTracks||fJets||fRho)) return kFALSE; - if(!fCaloClusters && fDebug > 0) printf(" > Warning: couldn't retreive calo clusters! < \n"); + fLeadingJet = GetLeadingJet(); // store the leading jet + // set the rho value + fLocalRho->SetVal(fRho->GetVal()); // [0][0] psi2a [1,0] psi2c // [0][1] psi3a [1,1] psi3c Double_t vzero[2][2]; CalculateEventPlaneVZERO(vzero); + /* for the combined vzero event plane + * [0] psi2 [1] psi3 + * not fully implmemented yet, use with caution ! */ + Double_t vzeroComb[2]; + CalculateEventPlaneCombinedVZERO(vzeroComb); // [0] psi2 [1] psi3 - // [2] psi2 a [3] psi2 b - // [4] psi3 a [5] psi3 b - Double_t tpc[6]; + Double_t tpc[2]; CalculateEventPlaneTPC(tpc); + Double_t psi2(-1), psi3(-1); // arrays which will hold the fit parameters - Double_t fitParameters[] = {0,0,0,0,0,0,0,0,0}; - Double_t psi2(-1), psi3(-1), psi2b(-1), psi3b(-1); switch (fDetectorType) { // determine the detector type for the rho fit - case kTPC : { psi2 = tpc[0]; psi3 = tpc[1]; } break; - case kTPCSUB : { psi2 = tpc[2]; psi3 = tpc[4]; - psi2b = tpc[3]; psi3b = tpc[5]; } break; - case kVZEROA : { psi2 = vzero[0][0]; psi3 = vzero[0][1]; } break; - case kVZEROC : { psi2 = vzero[1][0]; psi3 = vzero[1][1]; } break; + case kTPC : { psi2 = tpc[0]; psi3 = tpc[1]; } break; + case kVZEROA : { psi2 = vzero[0][0]; psi3 = vzero[0][1]; } break; + case kVZEROC : { psi2 = vzero[1][0]; psi3 = vzero[1][1]; } break; + case kVZEROComb : { psi2 = vzeroComb[0]; psi3 = vzeroComb[1];} break; default : break; } - switch (fFitModulationType) { // do the fits - case kNoFit : { fFitModulation->FixParameter(0, RhoVal()); } break; - case kV2 : { - if(CorrectRho(fitParameters, psi2, psi3, psi2b, psi3b)) { + case kNoFit : { + switch (fCollisionType) { + case kPythia : { // background is zero for pp jets + fFitModulation->FixParameter(0, 0); + fLocalRho->SetVal(0); + } break; + default : { + fFitModulation->FixParameter(0, fLocalRho->GetVal()); + } break; + } + } break; + case kV2 : { // only v2 + if(CorrectRho(psi2, psi3)) { fProfV2->Fill(fCent, fFitModulation->GetParameter(3)); - CalculateEventPlaneResolution(vzero, tpc); + if(fUserSuppliedR2) { + Double_t r(fUserSuppliedR2->GetBinContent(fUserSuppliedR2->GetXaxis()->FindBin(fCent))); + if(r > 0) fFitModulation->SetParameter(3, fFitModulation->GetParameter(3)/r); + } + CalculateEventPlaneResolution(vzero, vzeroComb, tpc); } } break; - case kV3 : { - if(CorrectRho(fitParameters, psi2, psi3, psi2b, psi3b)) { + case kV3 : { // only v3 + if(CorrectRho(psi2, psi3)) { + if(fUserSuppliedR3) { + Double_t r(fUserSuppliedR3->GetBinContent(fUserSuppliedR3->GetXaxis()->FindBin(fCent))); + if(r > 0) fFitModulation->SetParameter(3, fFitModulation->GetParameter(3)/r); + } fProfV3->Fill(fCent, fFitModulation->GetParameter(3)); - CalculateEventPlaneResolution(vzero, tpc); + CalculateEventPlaneResolution(vzero, vzeroComb, tpc); + } + } break; + case kQC2 : { // qc2 analysis + if(CorrectRho(psi2, psi3)) { + if(fUserSuppliedR2 && fUserSuppliedR3) { + // note for the qc method, resolution is REVERSED to go back to v2obs + Double_t r2(fUserSuppliedR2->GetBinContent(fUserSuppliedR2->GetXaxis()->FindBin(fCent))); + Double_t r3(fUserSuppliedR3->GetBinContent(fUserSuppliedR3->GetXaxis()->FindBin(fCent))); + if(r2 > 0) fFitModulation->SetParameter(3, fFitModulation->GetParameter(3)*r2); + if(r3 > 0) fFitModulation->SetParameter(7, fFitModulation->GetParameter(7)*r3); + } + if (fUsePtWeight) { // use weighted weights + Double_t dQCnM11 = (fNoEventWeightsForQC) ? 1. : QCnM11(); + fProfV2->Fill(fCent, fFitModulation->GetParameter(3), dQCnM11); + fProfV3->Fill(fCent, fFitModulation->GetParameter(7), dQCnM11); + } else { + Double_t dQCnM = (fNoEventWeightsForQC) ? 2. : QCnM(); + fProfV2->Fill(fCent, fFitModulation->GetParameter(3), dQCnM*(dQCnM-1)); + fProfV3->Fill(fCent, fFitModulation->GetParameter(7), dQCnM*(dQCnM-1)); + } + CalculateEventPlaneResolution(vzero, vzeroComb, tpc); } } break; - case kUser : { - CorrectRho(fitParameters, psi2, psi3, psi2b, psi3b); + case kQC4 : { + if(CorrectRho(psi2, psi3)) { + if(fUserSuppliedR2 && fUserSuppliedR3) { + // note for the qc method, resolution is REVERSED to go back to v2obs + Double_t r2(fUserSuppliedR2->GetBinContent(fUserSuppliedR2->GetXaxis()->FindBin(fCent))); + Double_t r3(fUserSuppliedR3->GetBinContent(fUserSuppliedR3->GetXaxis()->FindBin(fCent))); + if(r2 > 0) fFitModulation->SetParameter(3, fFitModulation->GetParameter(3)*r2); + if(r3 > 0) fFitModulation->SetParameter(7, fFitModulation->GetParameter(7)*r3); + } + if (fUsePtWeight) { // use weighted weights + fProfV2->Fill(fCent, TMath::Power(fFitModulation->GetParameter(3),0.5)/*, QCnM1111()*/); + fProfV3->Fill(fCent, TMath::Power(fFitModulation->GetParameter(7),0.5)/*, QCnM1111()*/); + } else { + fProfV2->Fill(fCent, TMath::Power(fFitModulation->GetParameter(3),0.5)/*, QCnM()*(QCnM()-1)*(QCnM()-2)*(QCnM()-3)*/); + fProfV3->Fill(fCent, TMath::Power(fFitModulation->GetParameter(7),0.5)/*, QCnM()*(QCnM()-1)*(QCnM()-2)*(QCnM()-3)*/); + } + } + CalculateEventPlaneResolution(vzero, vzeroComb, tpc); } break; default : { - if(CorrectRho(fitParameters, psi2, psi3, psi2b, psi3b)) { + if(CorrectRho(psi2, psi3)) { + if(fUserSuppliedR2 && fUserSuppliedR3) { + Double_t r2(fUserSuppliedR2->GetBinContent(fUserSuppliedR2->GetXaxis()->FindBin(fCent))); + Double_t r3(fUserSuppliedR3->GetBinContent(fUserSuppliedR3->GetXaxis()->FindBin(fCent))); + if(r2 > 0) fFitModulation->SetParameter(3, fFitModulation->GetParameter(3)/r2); + if(r3 > 0) fFitModulation->SetParameter(7, fFitModulation->GetParameter(7)/r3); + } fProfV2->Fill(fCent, fFitModulation->GetParameter(3)); fProfV3->Fill(fCent, fFitModulation->GetParameter(7)); - CalculateEventPlaneResolution(vzero, tpc); + CalculateEventPlaneResolution(vzero, vzeroComb, tpc); } } break; } - // fill a number of histograms - FillHistogramsAfterSubtraction(vzero, tpc); - + // if all went well, update the local rho parameter + fLocalRho->SetLocalRho(fFitModulation); + // fill a number of histograms. event qa needs to be filled first as it also determines the runnumber for the track qa + if(fFillQAHistograms) FillQAHistograms(InputEvent()); + if(fFillHistograms) FillHistogramsAfterSubtraction(psi2, psi3, vzero, vzeroComb, tpc); // send the output to the connected output container PostData(1, fOutputList); switch (fRunModeType) { @@ -576,6 +637,7 @@ Bool_t AliAnalysisTaskRhoVnModulation::Run() } break; default: break; } + return kTRUE; } //_____________________________________________________________________________ @@ -623,79 +685,115 @@ void AliAnalysisTaskRhoVnModulation::CalculateEventPlaneTPC(Double_t* tpc) fNAcceptedTracks = 0; // reset the track counter Double_t qx2(0), qy2(0); // for psi2 Double_t qx3(0), qy3(0); // for psi3 - Double_t qx2a(0), qy2a(0), qx2b(0), qy2b(0); // for psi2 a and b - Double_t qx3a(0), qy3a(0), qx3b(0), qy3b(0); // for psi3 a and b if(fTracks) { - Float_t excludeInEta[] = {-999, -999}; + Float_t excludeInEta = -999; if(fExcludeLeadingJetsFromFit > 0 ) { // remove the leading jet from ep estimate - AliEmcalJet* leadingJet[] = {0x0, 0x0}; - static Int_t lJets[9999] = {-1}; - GetSortedArray(lJets, fJets); - for(Int_t i(0); i < fJets->GetEntriesFast(); i++) { // get the two leading jets - if (1 + i > fJets->GetEntriesFast()) break; - leadingJet[0] = static_cast(fJets->At(lJets[i])); - leadingJet[1] = static_cast(fJets->At(lJets[i+1])); - if(PassesCuts(leadingJet[0]) && PassesCuts(leadingJet[1])) break; - } - if(leadingJet[0] && leadingJet[1]) { - for(Int_t i(0); i < 2; i++) excludeInEta[i] = leadingJet[i]->Eta(); - } + if(fLeadingJet) excludeInEta = fLeadingJet->Eta(); } Int_t iTracks(fTracks->GetEntriesFast()); for(Int_t iTPC(0); iTPC < iTracks; iTPC++) { AliVTrack* track = static_cast(fTracks->At(iTPC)); - if(!PassesCuts(track) || track->Pt() < .15 || track->Pt() > 5.) continue; - if(fExcludeLeadingJetsFromFit > 0 &&( (TMath::Abs(track->Eta() - excludeInEta[0]) < fJetRadius*fExcludeLeadingJetsFromFit ) || (TMath::Abs(track->Eta()) - fJetRadius - fJetMaxEta ) > 0 )) continue; + if(!PassesCuts(track) || track->Pt() < fSoftTrackMinPt || track->Pt() > fSoftTrackMaxPt) continue; + if(fExcludeLeadingJetsFromFit > 0 &&( (TMath::Abs(track->Eta() - excludeInEta) < GetJetContainer()->GetJetRadius()*fExcludeLeadingJetsFromFit ) || (TMath::Abs(track->Eta()) - GetJetContainer()->GetJetRadius() - GetJetContainer()->GetJetEtaMax() ) > 0 )) continue; fNAcceptedTracks++; qx2+= TMath::Cos(2.*track->Phi()); qy2+= TMath::Sin(2.*track->Phi()); qx3+= TMath::Cos(3.*track->Phi()); qy3+= TMath::Sin(3.*track->Phi()); - if(track->Eta() < 0) { // A side, negative eta - qx2a+= TMath::Cos(2.*track->Phi()); - qy2a+= TMath::Sin(2.*track->Phi()); - qx3a+= TMath::Cos(3.*track->Phi()); - qy3a+= TMath::Sin(3.*track->Phi()); - } else { // B side, positive eta - qx2b+= TMath::Cos(2.*track->Phi()); - qy2b+= TMath::Sin(2.*track->Phi()); - qx3b+= TMath::Cos(3.*track->Phi()); - qy3b+= TMath::Sin(3.*track->Phi()); - } } } tpc[0] = .5*TMath::ATan2(qy2, qx2); tpc[1] = (1./3.)*TMath::ATan2(qy3, qx3); - tpc[2] = .5*TMath::ATan2(qy2a, qx2a); - tpc[3] = .5*TMath::ATan2(qy2b, qx2b); - tpc[4] = (1./3.)*TMath::ATan2(qy3a, qx3a); - tpc[5] = (1./3.)*TMath::ATan2(qy3b, qx3b); } //_____________________________________________________________________________ -void AliAnalysisTaskRhoVnModulation::CalculateEventPlaneResolution(Double_t vzero[2][2], Double_t* tpc) const +void AliAnalysisTaskRhoVnModulation::CalculateEventPlaneCombinedVZERO(Double_t* comb) const +{ + // grab the combined vzero event plane +// if(fUseV0EventPlaneFromHeader) { // use the vzero from the header + Double_t a(0), b(0), c(0), d(0); + comb[0] = InputEvent()->GetEventplane()->CalculateVZEROEventPlane(InputEvent(), 10, 2, a, b); + comb[1] = InputEvent()->GetEventplane()->CalculateVZEROEventPlane(InputEvent(), 10, 3, c, d); +// } else { +// Double_t qx2a(0), qy2a(0), qx2c(0), qy2c(0), qx3a(0), qy3a(0), qx3c(0), qy3c(0); +// InputEvent()->GetEventplane()->CalculateVZEROEventPlane(InputEvent(), 8, 2, qx2a, qy2a); +// InputEvent()->GetEventplane()->CalculateVZEROEventPlane(InputEvent(), 9, 2, qx2c, qy2c); +// InputEvent()->GetEventplane()->CalculateVZEROEventPlane(InputEvent(), 8, 3, qx3a, qy3a); +// InputEvent()->GetEventplane()->CalculateVZEROEventPlane(InputEvent(), 9, 3, qx3c, qy3c); +// FIXME the rest of this function isn't impelmented yet (as of 01-07-2013) +// Double_t chi2A(-1), chi2C(-1), chi3A(-1), chi3C(-1); // get chi from the resolution +// Double_t qx2(chi2A*chi2A*qx2a+chi2C*chi2C*qx2c); +// Double_t qy2(chi2A*chi2A*qy2a+chi2C*chi2C*qy2c); +// Double_t qx3(chi3A*chi3A*qx3a+chi3C*chi3C*qx3c); +// Double_t qy3(chi3A*chi3A*qy3a+chi3C*chi3C*qy3c); +// comb[0] = .5*TMath::ATan2(qy2, qx2); +// comb[1] = (1./3.)*TMath::ATan2(qy3, qx3); +// } +} +//_____________________________________________________________________________ +void AliAnalysisTaskRhoVnModulation::CalculateEventPlaneResolution(Double_t vzero[2][2], Double_t* vzeroComb, Double_t* tpc) { // fill the profiles for the resolution parameters if(fDebug > 1) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); - fProfV2Resolution[fInCentralitySelection]->Fill(0., TMath::Cos(2.*(tpc[2] - tpc[3]))); - fProfV2Resolution[fInCentralitySelection]->Fill(1., TMath::Cos(2.*(tpc[3] - tpc[2]))); fProfV2Resolution[fInCentralitySelection]->Fill(2., TMath::Cos(2.*(vzero[0][0] - vzero[1][0]))); fProfV2Resolution[fInCentralitySelection]->Fill(3., TMath::Cos(2.*(vzero[1][0] - vzero[0][0]))); fProfV2Resolution[fInCentralitySelection]->Fill(4., TMath::Cos(2.*(vzero[0][0] - tpc[0]))); fProfV2Resolution[fInCentralitySelection]->Fill(5., TMath::Cos(2.*(tpc[0] - vzero[0][0]))); fProfV2Resolution[fInCentralitySelection]->Fill(6., TMath::Cos(2.*(vzero[1][0] - tpc[0]))); fProfV2Resolution[fInCentralitySelection]->Fill(7., TMath::Cos(2.*(tpc[0] - vzero[1][0]))); - fProfV3Resolution[fInCentralitySelection]->Fill(0., TMath::Cos(3.*(tpc[2] - tpc[3]))); - fProfV3Resolution[fInCentralitySelection]->Fill(1., TMath::Cos(3.*(tpc[3] - tpc[2]))); fProfV3Resolution[fInCentralitySelection]->Fill(2., TMath::Cos(3.*(vzero[0][0] - vzero[1][0]))); fProfV3Resolution[fInCentralitySelection]->Fill(3., TMath::Cos(3.*(vzero[1][0] - vzero[0][0]))); fProfV3Resolution[fInCentralitySelection]->Fill(4., TMath::Cos(3.*(vzero[0][0] - tpc[0]))); fProfV3Resolution[fInCentralitySelection]->Fill(5., TMath::Cos(3.*(tpc[0] - vzero[0][0]))); fProfV3Resolution[fInCentralitySelection]->Fill(6., TMath::Cos(3.*(vzero[1][0] - tpc[0]))); fProfV3Resolution[fInCentralitySelection]->Fill(7., TMath::Cos(3.*(tpc[0] - vzero[1][0]))); + // for the resolution of the combined vzero event plane, use two tpc halves as uncorrelated subdetectors + Double_t qx2a(0), qy2a(0); // for psi2a, negative eta + Double_t qx3a(0), qy3a(0); // for psi3a, negative eta + Double_t qx2b(0), qy2b(0); // for psi2a, positive eta + Double_t qx3b(0), qy3b(0); // for psi3a, positive eta + if(fTracks) { + Int_t iTracks(fTracks->GetEntriesFast()); + for(Int_t iTPC(0); iTPC < iTracks; iTPC++) { + AliVTrack* track = static_cast(fTracks->At(iTPC)); + if(!PassesCuts(track) || track->Pt() < fSoftTrackMinPt || track->Pt() > fSoftTrackMaxPt) continue; + if(track->Eta() < 0 ) { + qx2a+= TMath::Cos(2.*track->Phi()); + qy2a+= TMath::Sin(2.*track->Phi()); + qx3a+= TMath::Cos(3.*track->Phi()); + qy3a+= TMath::Sin(3.*track->Phi()); + } else if (track->Eta() > 0) { + qx2b+= TMath::Cos(2.*track->Phi()); + qy2b+= TMath::Sin(2.*track->Phi()); + qx3b+= TMath::Cos(3.*track->Phi()); + qy3b+= TMath::Sin(3.*track->Phi()); + } + } + } + Double_t tpca2(.5*TMath::ATan2(qy2a, qx2a)); + Double_t tpca3((1./3.)*TMath::ATan2(qy3a, qx3a)); + Double_t tpcb2(.5*TMath::ATan2(qy2b, qx2b)); + Double_t tpcb3((1./3.)*TMath::ATan2(qy3b, qx3b)); + fProfV2Resolution[fInCentralitySelection]->Fill(8., TMath::Cos(2.*(vzeroComb[0] - tpca2))); + fProfV2Resolution[fInCentralitySelection]->Fill(9., TMath::Cos(2.*(vzeroComb[0] - tpcb2))); + fProfV2Resolution[fInCentralitySelection]->Fill(10., TMath::Cos(2.*(tpca2 - tpcb2))); + fProfV3Resolution[fInCentralitySelection]->Fill(8., TMath::Cos(3.*(vzeroComb[1] - tpca3))); + fProfV3Resolution[fInCentralitySelection]->Fill(9., TMath::Cos(3.*(vzeroComb[1] - tpcb3))); + fProfV3Resolution[fInCentralitySelection]->Fill(10., TMath::Cos(3.*(tpca3 - tpcb3))); +} +//_____________________________________________________________________________ +Double_t AliAnalysisTaskRhoVnModulation::CalculateEventPlaneChi(Double_t resEP) const +{ + // Get Chi from EP resolution (PRC 58 1671) + Double_t chi(2.), delta (1.); + for (Int_t i(0); i < 15; i++) { + chi = ((TMath::Sqrt(TMath::Pi()/2.)/2.)*chi*exp(-chi*chi/4.)*(TMath::BesselI0(chi*chi/4.)+TMath::BesselI1(chi* chi/4.)) < resEP) ? chi+delta : chi-delta; + delta/=2.; + } + return chi; } //_____________________________________________________________________________ void AliAnalysisTaskRhoVnModulation::CalculateRandomCone(Float_t &pt, Float_t &eta, Float_t &phi, - AliEmcalJet* jet, Bool_t randomize) const + AliEmcalJet* jet) const { // get a random cone if(fDebug > 1) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); @@ -705,16 +803,18 @@ void AliAnalysisTaskRhoVnModulation::CalculateRandomCone(Float_t &pt, Float_t &e etaJet = jet->Eta(); phiJet = jet->Phi(); } - // force the random cones to at least be within detector acceptance - Float_t minPhi(fJetMinPhi), maxPhi(fJetMaxPhi); + // the random cone acceptance has to equal the jet acceptance + // this also insures safety when runnnig on the semi-good tpc runs for 11h data, + // where jet acceptance is adjusted to reduced acceptance - hence random cone acceptance as well + Float_t minPhi(GetJetContainer()->GetJetPhiMin()), maxPhi(GetJetContainer()->GetJetPhiMax()); if(maxPhi > TMath::TwoPi()) maxPhi = TMath::TwoPi(); if(minPhi < 0 ) minPhi = 0; - Float_t diffRcRJR(TMath::Abs(fRandomConeRadius-fJetRadius)); + Float_t diffRcRJR(TMath::Abs(fRandomConeRadius-GetJetContainer()->GetJetRadius())); // construct a random cone and see if it's far away enough from the leading jet Int_t attempts(1000); while(kTRUE) { attempts--; - eta = gRandom->Uniform(fJetMinEta+diffRcRJR, fJetMaxEta-diffRcRJR); + eta = gRandom->Uniform(GetJetContainer()->GetJetEtaMin()+diffRcRJR, GetJetContainer()->GetJetEtaMax()-diffRcRJR); phi = gRandom->Uniform(minPhi, maxPhi); dJet = TMath::Sqrt((etaJet-eta)*(etaJet-eta)+(phiJet-phi)*(phiJet-phi)); @@ -724,98 +824,388 @@ void AliAnalysisTaskRhoVnModulation::CalculateRandomCone(Float_t &pt, Float_t &e return; } } - if(fTracks) { - Int_t iTracks(fTracks->GetEntriesFast()); - for(Int_t i(0); i < iTracks; i++) { - AliVTrack* track = static_cast(fTracks->At(i)); - if(!PassesCuts(track)) continue; + if(fTracksCont) { + AliVParticle* track = fTracksCont->GetNextAcceptParticle(0); + while(track) { Float_t etaTrack(track->Eta()), phiTrack(track->Phi()), ptTrack(track->Pt()); - // if requested, randomize eta and phi to destroy any correlated fluctuations - if(randomize) { - etaTrack = gRandom->Uniform(fTrackMinEta, fTrackMaxEta); - phiTrack = gRandom->Uniform(minPhi, maxPhi); - } // get distance from cone if(TMath::Abs(phiTrack-phi) > TMath::Abs(phiTrack - phi + TMath::TwoPi())) phiTrack+=TMath::TwoPi(); if(TMath::Abs(phiTrack-phi) > TMath::Abs(phiTrack - phi - TMath::TwoPi())) phiTrack-=TMath::TwoPi(); if(TMath::Sqrt(TMath::Abs((etaTrack-eta)*(etaTrack-eta)+(phiTrack-phi)*(phiTrack-phi))) <= fRandomConeRadius) pt+=ptTrack; + track = fTracksCont->GetNextAcceptParticle(); } } } //_____________________________________________________________________________ -Bool_t AliAnalysisTaskRhoVnModulation::CorrectRho(Double_t* params, Double_t psi2, Double_t psi3, Double_t psi2b, Double_t psi3b) +Double_t AliAnalysisTaskRhoVnModulation::CalculateQC2(Int_t harm) { + // get the second order q-cumulant, a -999 return will be caught in the qa routine of CorrectRho + if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); + Double_t reQ(0), imQ(0), modQ(0), M11(0), M(0); + if(fUsePtWeight) { // for the weighted 2-nd order q-cumulant + QCnQnk(harm, 1, reQ, imQ); // get the weighted 2-nd order q-vectors + modQ = reQ*reQ+imQ*imQ; // get abs Q-squared + M11 = QCnM11(); // equals S2,1 - S1,2 + return (M11 > 0) ? ((modQ - QCnS(1,2))/M11) : -999; + } // else return the non-weighted 2-nd order q-cumulant + QCnQnk(harm, 0, reQ, imQ); // get the non-weighted 2-nd order q-vectors + modQ = reQ*reQ+imQ*imQ; // get abs Q-squared + M = QCnM(); + return (M > 1) ? (modQ - M)/(M*(M-1)) : -999; +} +//_____________________________________________________________________________ +Double_t AliAnalysisTaskRhoVnModulation::CalculateQC4(Int_t harm) { + // get the fourth order q-cumulant, a -999 return will be caught in the qa routine of CorrectRho + if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); + Double_t reQn1(0), imQn1(0), reQ2n2(0), imQ2n2(0), reQn3(0), imQn3(0), M1111(0), M(0); + Double_t a(0), b(0), c(0), d(0), e(0), f(0), g(0); // terms of the calculation + if(fUsePtWeight) { // for the weighted 4-th order q-cumulant + QCnQnk(harm, 1, reQn1, imQn1); + QCnQnk(harm*2, 2, reQ2n2, imQ2n2); + QCnQnk(harm, 3, reQn3, imQn3); + // fill in the terms ... + a = (reQn1*reQn1+imQn1*imQn1)*(reQn1*reQn1+imQn1*imQn1); + b = reQ2n2*reQ2n2 + imQ2n2*imQ2n2; + c = -2.*(reQ2n2*reQn1*reQn1-reQ2n2*imQn1*imQn1+2.*imQ2n2*reQn1*imQn1); + d = 8.*(reQn3*reQn1+imQn3*imQn1); + e = -4.*QCnS(1,2)*(reQn1*reQn1+imQn1*imQn1); + f = -6.*QCnS(1,4); + g = 2.*QCnS(2,2); + M1111 = QCnM1111(); + return (M1111 > 0) ? (a+b+c+d+e+f+g)/M1111 : -999; + } // else return the unweighted case + Double_t reQn(0), imQn(0), reQ2n(0), imQ2n(0); + QCnQnk(harm, 0, reQn, imQn); + QCnQnk(harm*2, 0, reQ2n, imQ2n); + // fill in the terms ... + M = QCnM(); + if(M < 4) return -999; + a = (reQn*reQn+imQn*imQn)*(reQn*reQn+imQn*imQn); + b = reQ2n*reQ2n + imQ2n*imQ2n; + c = -2.*(reQ2n*reQn*reQn-reQ2n*imQn*imQn+2.*imQ2n*reQn*imQn); + e = -4.*(M-2)*(reQn*reQn+imQn*imQn); + f = 2.*M*(M-3); + return (a+b+c+e+f)/(M*(M-1)*(M-2)*(M-3)); +} +//_____________________________________________________________________________ +void AliAnalysisTaskRhoVnModulation::QCnQnk(Int_t n, Int_t k, Double_t &reQ, Double_t &imQ) { + // get the weighted n-th order q-vector, pass real and imaginary part as reference + if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); + if(!fTracks) return; + fNAcceptedTracksQCn = 0; + Int_t iTracks(fTracks->GetEntriesFast()); + for(Int_t iTPC(0); iTPC < iTracks; iTPC++) { + AliVTrack* track = static_cast(fTracks->At(iTPC)); + if(!PassesCuts(track) || track->Pt() < fSoftTrackMinPt || track->Pt() > fSoftTrackMaxPt) continue; + fNAcceptedTracksQCn++; + // for the unweighted case, k equals zero and the weight doesn't contribute to the equation below + reQ += TMath::Power(track->Pt(), k) * TMath::Cos(((double)n)*track->Phi()); + imQ += TMath::Power(track->Pt(), k) * TMath::Sin(((double)n)*track->Phi()); + } +} +//_____________________________________________________________________________ +void AliAnalysisTaskRhoVnModulation::QCnDiffentialFlowVectors( + TClonesArray* pois, TArrayD* ptBins, Bool_t vpart, Double_t* repn, Double_t* impn, + Double_t *mp, Double_t *reqn, Double_t *imqn, Double_t* mq, Int_t n) +{ + // get unweighted differential flow vectors + Int_t iPois(pois->GetEntriesFast()); + if(vpart) { + for(Int_t i(0); i < iPois; i++) { + for(Int_t ptBin(0); ptBin < ptBins->GetSize()-1; ptBin++) { + AliVTrack* poi = static_cast(pois->At(i)); + if(PassesCuts(poi)) { + if(poi->Pt() >= ptBins->At(ptBin) && poi->Pt() < ptBins->At(ptBin+1)) { + // fill the flow vectors assuming that all poi's are in the rp selection (true by design) + repn[ptBin]+=TMath::Cos(((double)n)*poi->Phi()); + impn[ptBin]+=TMath::Sin(((double)n)*poi->Phi()); + mp[ptBin]++; + reqn[ptBin]+=TMath::Cos(((double)n)*poi->Phi()); + imqn[ptBin]+=TMath::Sin(((double)n)*poi->Phi()); + mq[ptBin]++; + } + } + } + } + } else { + for(Int_t i(0); i < iPois; i++) { + for(Int_t ptBin(0); ptBin < ptBins->GetSize()-1; ptBin++) { + AliEmcalJet* poi = static_cast(pois->At(i)); + if(PassesCuts(poi)) { + Double_t pt(poi->Pt()-poi->Area()*fLocalRho->GetLocalVal(poi->Phi(), GetJetContainer()->GetJetRadius(), fLocalRho->GetVal())); + if(pt >= ptBins->At(ptBin) && pt < ptBins->At(ptBin+1)) { + repn[ptBin]+=TMath::Cos(((double)n)*poi->Phi()); + impn[ptBin]+=TMath::Sin(((double)n)*poi->Phi()); + mp[ptBin]++; // qn isn't filled, no overlap between poi's and rp's + } + } + } + } + } +} +//_____________________________________________________________________________ +Double_t AliAnalysisTaskRhoVnModulation::QCnS(Int_t i, Int_t j) { + // get the weighted ij-th order autocorrelation correction + if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); + if(!fTracks || i <= 0 || j <= 0) return -999; + Int_t iTracks(fTracks->GetEntriesFast()); + Double_t Sij(0); + for(Int_t iTPC(0); iTPC < iTracks; iTPC++) { + AliVTrack* track = static_cast(fTracks->At(iTPC)); + if(!PassesCuts(track) || track->Pt() < fSoftTrackMinPt || track->Pt() > fSoftTrackMaxPt) continue; + Sij+=TMath::Power(track->Pt(), j); + } + return TMath::Power(Sij, i); +} +//_____________________________________________________________________________ +Double_t AliAnalysisTaskRhoVnModulation::QCnM() { + // get multiplicity for unweighted q-cumulants. function QCnQnk should be called first + if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); + return (Double_t) fNAcceptedTracksQCn; +} +//_____________________________________________________________________________ +Double_t AliAnalysisTaskRhoVnModulation::QCnM11() { + // get multiplicity weights for the weighted two particle cumulant + if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); + return (QCnS(2,1) - QCnS(1,2)); +} +//_____________________________________________________________________________ +Double_t AliAnalysisTaskRhoVnModulation::QCnM1111() { + // get multiplicity weights for the weighted four particle cumulant + if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); + return (QCnS(4,1)-6*QCnS(1,2)*QCnS(2,1)+8*QCnS(1,3)*QCnS(1,1)+3*QCnS(2,2)-6*QCnS(1,4)); +} +//_____________________________________________________________________________ +Bool_t AliAnalysisTaskRhoVnModulation::QCnRecovery(Double_t psi2, Double_t psi3) { + // decides how to deal with the situation where c2 or c3 is negative + // returns kTRUE depending on whether or not a modulated rho is used for the jet background + if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); + if(TMath::AreEqualAbs(fFitModulation->GetParameter(3), .0, 1e-10) && TMath::AreEqualAbs(fFitModulation->GetParameter(7), .0,1e-10)) { + fFitModulation->SetParameter(7, 0); + fFitModulation->SetParameter(3, 0); + fFitModulation->SetParameter(0, fLocalRho->GetVal()); + return kTRUE; // v2 and v3 have physical null values + } + switch (fQCRecovery) { + case kFixedRho : { // roll back to the original rho + fFitModulation->SetParameter(7, 0); + fFitModulation->SetParameter(3, 0); + fFitModulation->SetParameter(0, fLocalRho->GetVal()); + return kFALSE; // rho is forced to be fixed + } + case kNegativeVn : { + Double_t c2(fFitModulation->GetParameter(3)); + Double_t c3(fFitModulation->GetParameter(7)); + if( c2 < 0 ) c2 = -1.*TMath::Sqrt(-1.*c2); + if( c3 < 0 ) c3 = -1.*TMath::Sqrt(-1.*c3); + fFitModulation->SetParameter(3, c2); + fFitModulation->SetParameter(7, c3); + return kTRUE; // is this a physical quantity ? + } + case kTryFit : { + fitModulationType tempType(fFitModulationType); // store temporarily + fFitModulationType = kCombined; + fFitModulation->SetParameter(7, 0); + fFitModulation->SetParameter(3, 0); + Bool_t pass(CorrectRho(psi2, psi3)); // do the fit and all quality checks + fFitModulationType = tempType; // roll back for next event + return pass; + } + default : return kFALSE; + } + return kFALSE; +} +//_____________________________________________________________________________ +Bool_t AliAnalysisTaskRhoVnModulation::CorrectRho(Double_t psi2, Double_t psi3) { // get rho' -> rho(phi) - // two routines are available - // [1] fitting a fourier expansion to the de/dphi distribution - // [2] getting vn from a fourier series around dn/dphi (see below for info) - // this function will return kTRUE if the fit passes a set of quality criteria + // two routines are available, both can be used with or without pt weights + // [1] get vn from q-cumulants or as an integrated value from a user supplied histogram + // in case of cumulants, both cumulants and vn values are stored. in both cases, v2 and v3 + // are expected. a check is performed to see if rho has no negative local minimum + // for full description, see Phys. Rev. C 83, 044913 + // since the cn distribution has negative values, vn = sqrt(cn) can be imaginary sometimes + // in this case one can either roll back to the 'original' rixed rho, do a fit for vn or take use + // vn = - sqrt(|cn|) + // [2] fitting a fourier expansion to the de/dphi distribution + // the fit can be done with either v2, v3 or a combination. + // in all cases, a cut can be made on the p-value of the chi-squared value of the fit + // and a check can be performed to see if rho has no negative local minimum if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); + Int_t freeParams(2); // free parameters of the fit (for NDF) + switch (fFitModulationType) { // for approaches where no fitting is required + case kQC2 : { + fFitModulation->FixParameter(4, psi2); + fFitModulation->FixParameter(6, psi3); + fFitModulation->FixParameter(3, CalculateQC2(2)); // set here with cn, vn = sqrt(cn) + fFitModulation->FixParameter(7, CalculateQC2(3)); + // first fill the histos of the raw cumulant distribution + if (fUsePtWeight) { // use weighted weights + Double_t dQCnM11 = (fNoEventWeightsForQC) ? 1. : QCnM11(); + fProfV2Cumulant->Fill(fCent, fFitModulation->GetParameter(3), dQCnM11); + fProfV3Cumulant->Fill(fCent, fFitModulation->GetParameter(7), dQCnM11); + } else { + Double_t dQCnM = (fNoEventWeightsForQC) ? 2. : QCnM(); + fProfV2Cumulant->Fill(fCent, fFitModulation->GetParameter(3), dQCnM*(dQCnM-1)); + fProfV3Cumulant->Fill(fCent, fFitModulation->GetParameter(7), dQCnM*(dQCnM-1)); + } + // then see if one of the cn value is larger than zero and vn is readily available + if(fFitModulation->GetParameter(3) > 0 && fFitModulation->GetParameter(7) > 0) { + fFitModulation->FixParameter(3, TMath::Sqrt(fFitModulation->GetParameter(3))); + fFitModulation->FixParameter(7, TMath::Sqrt(fFitModulation->GetParameter(7))); + } else if (!QCnRecovery(psi2, psi3)) return kFALSE; // try to recover the cumulant, this will set v2 and v3 + if(fAbsVnHarmonics && fFitModulation->GetMinimum(0, TMath::TwoPi()) < 0) { // general check + fFitModulation->SetParameter(7, 0); + fFitModulation->SetParameter(3, 0); + fFitModulation->SetParameter(0, fLocalRho->GetVal()); + return kFALSE; + } + return kTRUE; + } break; + case kQC4 : { + fFitModulation->FixParameter(4, psi2); + fFitModulation->FixParameter(6, psi3); + fFitModulation->FixParameter(3, CalculateQC4(2)); // set here with cn, vn = sqrt(cn) + fFitModulation->FixParameter(7, CalculateQC4(3)); + // first fill the histos of the raw cumulant distribution + if (fUsePtWeight) { // use weighted weights + fProfV2Cumulant->Fill(fCent, fFitModulation->GetParameter(3)/*, QCnM1111()*/); + fProfV3Cumulant->Fill(fCent, fFitModulation->GetParameter(7)/*, QCnM1111()*/); + } else { + fProfV2Cumulant->Fill(fCent, fFitModulation->GetParameter(3)/*, QCnM1111()*/); + fProfV3Cumulant->Fill(fCent, fFitModulation->GetParameter(7)/*, QCnM1111()*/); + } + // then see if one of the cn value is larger than zero and vn is readily available + if(fFitModulation->GetParameter(3) > 0 && fFitModulation->GetParameter(7) > 0) { + fFitModulation->FixParameter(3, TMath::Sqrt(fFitModulation->GetParameter(3))); + fFitModulation->FixParameter(7, TMath::Sqrt(fFitModulation->GetParameter(7))); + } else if (!QCnRecovery(psi2, psi3)) return kFALSE; // try to recover the cumulant, this will set v2 and v3 + if(fAbsVnHarmonics && fFitModulation->GetMinimum(0, TMath::TwoPi()) < 0) { // general check + fFitModulation->SetParameter(7, 0); + fFitModulation->SetParameter(3, 0); + fFitModulation->SetParameter(0, fLocalRho->GetVal()); + return kFALSE; + } + } break; + case kIntegratedFlow : { + // use v2 and v3 values from an earlier iteration over the data + fFitModulation->FixParameter(3, fUserSuppliedV2->GetBinContent(fUserSuppliedV2->GetXaxis()->FindBin(fCent))); + fFitModulation->FixParameter(4, psi2); + fFitModulation->FixParameter(6, psi3); + fFitModulation->FixParameter(7, fUserSuppliedV3->GetBinContent(fUserSuppliedV3->GetXaxis()->FindBin(fCent))); + if(fAbsVnHarmonics && fFitModulation->GetMinimum(0, TMath::TwoPi()) < 0) { + fFitModulation->SetParameter(7, 0); + fFitModulation->SetParameter(3, 0); + fFitModulation->SetParameter(0, fLocalRho->GetVal()); + return kFALSE; + } + return kTRUE; + } + default : break; + } TString detector(""); switch (fDetectorType) { case kTPC : detector+="TPC"; break; - case kTPCSUB : detector+="kTPCSUB"; - break; case kVZEROA : detector+="VZEROA"; break; case kVZEROC : detector+="VZEROC"; break; + case kVZEROComb : detector+="VZEROComb"; + break; default: break; } Int_t iTracks(fTracks->GetEntriesFast()); - Double_t excludeInEta[] = {-999, -999}; - Double_t excludeInPhi[] = {-999, -999}; - Double_t excludeInPt[] = {-999, -999}; - if(iTracks <= 0 || RhoVal() <= 0 ) return kFALSE; // no use fitting an empty event ... + Double_t excludeInEta = -999; + Double_t excludeInPhi = -999; + Double_t excludeInPt = -999; + if(iTracks <= 0 || fLocalRho->GetVal() <= 0 ) return kFALSE; // no use fitting an empty event ... if(fExcludeLeadingJetsFromFit > 0 ) { - AliEmcalJet* leadingJet[] = {0x0, 0x0}; - static Int_t lJets[9999] = {-1}; - GetSortedArray(lJets, fJets); - for(Int_t i(0); i < fJets->GetEntriesFast(); i++) { // get the two leading jets - if (1 + i > fJets->GetEntriesFast()) break; - leadingJet[0] = static_cast(fJets->At(lJets[i])); - leadingJet[1] = static_cast(fJets->At(lJets[i+1])); - if(PassesCuts(leadingJet[0]) && PassesCuts(leadingJet[1])) break; - } - if(leadingJet[0] && leadingJet[1]) { - for(Int_t i(0); i < 2; i++) { - excludeInEta[i] = leadingJet[i]->Eta(); - excludeInPhi[i] = leadingJet[i]->Phi(); - excludeInPt[i] = leadingJet[i]->Pt(); - } + if(fLeadingJet) { + excludeInEta = fLeadingJet->Eta(); + excludeInPhi = fLeadingJet->Phi(); + excludeInPt = fLeadingJet->Pt(); } } + // check the acceptance of the track selection that will be used + // if one uses e.g. semi-good tpc tracks, accepance in phi is reduced to 0 < phi < 4 + // the defaults (-10 < phi < 10) which accept all, are then overwritten + Double_t lowBound(0.), upBound(TMath::TwoPi()); // bounds for fit + if(GetParticleContainer()->GetParticlePhiMin() > lowBound) lowBound = GetParticleContainer()->GetParticlePhiMin(); + if(GetParticleContainer()->GetParticlePhiMax() < upBound) upBound = GetParticleContainer()->GetParticlePhiMax(); + fHistSwap->Reset(); // clear the histogram - TH1F _tempSwap; + TH1F _tempSwap; // on stack for quick access + TH1F _tempSwapN; // on stack for quick access, bookkeeping histogram if(fRebinSwapHistoOnTheFly) { if(fNAcceptedTracks < 49) fNAcceptedTracks = 49; // avoid aliasing effects - _tempSwap = TH1F("_tempSwap", "_tempSwap", TMath::CeilNint(TMath::Sqrt(fNAcceptedTracks)), 0, TMath::TwoPi()); + _tempSwap = TH1F("_tempSwap", "_tempSwap", TMath::CeilNint(TMath::Sqrt(fNAcceptedTracks)), lowBound, upBound); + if(fUsePtWeightErrorPropagation) _tempSwapN = TH1F("_tempSwapN", "_tempSwapN", TMath::CeilNint(TMath::Sqrt(fNAcceptedTracks)), lowBound, upBound); + if(fUsePtWeight) _tempSwap.Sumw2(); } else _tempSwap = *fHistSwap; // now _tempSwap holds the desired histo + // non poissonian error when using pt weights + Double_t totalpts(0.), totalptsquares(0.), totalns(0.); for(Int_t i(0); i < iTracks; i++) { AliVTrack* track = static_cast(fTracks->At(i)); - if(fExcludeLeadingJetsFromFit > 0 &&( (TMath::Abs(track->Eta() - excludeInEta[0]) < fJetRadius*fExcludeLeadingJetsFromFit ) || (TMath::Abs(track->Eta()) - fJetRadius - fJetMaxEta ) > 0 )) continue; - if(!PassesCuts(track) || track->Pt() > 5 || track->Pt() < 0.15) continue; - if(fDetectorType == kTPCSUB && psi2 > -1000 && track->Eta() < 0 ) continue; - else if (fDetectorType == kTPCSUB && psi2 < -1000 && track->Eta() > 0 ) continue; - if(fUsePtWeight) _tempSwap.Fill(track->Phi(), track->Pt()); + if(fExcludeLeadingJetsFromFit > 0 &&( (TMath::Abs(track->Eta() - excludeInEta) < GetJetContainer()->GetJetRadius()*fExcludeLeadingJetsFromFit ) || (TMath::Abs(track->Eta()) - GetJetContainer()->GetJetRadius() - GetJetContainer()->GetJetEtaMax() ) > 0 )) continue; + if(!PassesCuts(track) || track->Pt() > fSoftTrackMaxPt || track->Pt() < fSoftTrackMinPt) continue; + if(fUsePtWeight) { + _tempSwap.Fill(track->Phi(), track->Pt()); + if(fUsePtWeightErrorPropagation) { + totalpts += track->Pt(); + totalptsquares += track->Pt()*track->Pt(); + totalns += 1; + _tempSwapN.Fill(track->Phi()); + } + } else _tempSwap.Fill(track->Phi()); } - for(Int_t i(0); i < _tempSwap.GetXaxis()->GetNbins(); i++) _tempSwap.SetBinError(1+i, TMath::Sqrt(_tempSwap.GetBinContent(1+i))); - fFitModulation->SetParameter(0, RhoVal()); + if(fUsePtWeight && fUsePtWeightErrorPropagation) { + // in the case of pt weights overwrite the poissonian error estimate which is assigned by root by a more sophisticated appraoch + // the assumption here is that the bin error will be dominated by the uncertainty in the mean pt in a bin and in the uncertainty + // of the number of tracks in a bin, the first of which will be estimated from the sample standard deviation of all tracks in the + // event, for the latter use a poissonian estimate. the two contrubitions are assumed to be uncorrelated + if(totalns < 1) return kFALSE; // not one track passes the cuts + for(Int_t l = 0; l < _tempSwap.GetNbinsX(); l++) { + if(_tempSwapN.GetBinContent(l+1) == 0) { + _tempSwap.SetBinContent(l+1,0); + _tempSwap.SetBinError(l+1,0); + } + else { + Double_t vartimesnsq = totalptsquares*totalns - totalpts*totalpts; + Double_t variance = vartimesnsq/(totalns*(totalns-1.)); + Double_t SDOMSq = variance / _tempSwapN.GetBinContent(l+1); + Double_t SDOMSqOverMeanSq = SDOMSq * _tempSwapN.GetBinContent(l+1) * _tempSwapN.GetBinContent(l+1) / (_tempSwapN.GetBinContent(l+1) * _tempSwapN.GetBinContent(l+1)); + Double_t poissonfrac = 1./_tempSwapN.GetBinContent(l+1); + Double_t vartotalfrac = SDOMSqOverMeanSq + poissonfrac; + Double_t vartotal = vartotalfrac * _tempSwap.GetBinContent(l+1) * _tempSwap.GetBinContent(l+1); + if(vartotal > 0.0001) _tempSwap.SetBinError(l+1,TMath::Sqrt(vartotal)); + else { + _tempSwap.SetBinContent(l+1,0); + _tempSwap.SetBinError(l+1,0); + } + } + } + } + + fFitModulation->SetParameter(0, fLocalRho->GetVal()); switch (fFitModulationType) { - case kNoFit : { fFitModulation->FixParameter(0, RhoVal() ); + case kNoFit : { + fFitModulation->FixParameter(0, fLocalRho->GetVal() ); + freeParams = 0; } break; case kV2 : { fFitModulation->FixParameter(4, psi2); + freeParams = 1; } break; case kV3 : { fFitModulation->FixParameter(4, psi3); + freeParams = 1; } break; - case kCombined : { + case kCombined : { fFitModulation->FixParameter(4, psi2); fFitModulation->FixParameter(6, psi3); + freeParams = 2; } break; case kFourierSeries : { // in this approach, an explicit calculation will be made of vn = sqrt(xn^2+yn^2) @@ -823,35 +1213,93 @@ Bool_t AliAnalysisTaskRhoVnModulation::CorrectRho(Double_t* params, Double_t psi Double_t cos2(0), sin2(0), cos3(0), sin3(0), sumPt(0); for(Int_t i(0); i < iTracks; i++) { AliVTrack* track = static_cast(fTracks->At(i)); - if(!PassesCuts(track) || track->Pt() > 5 || track->Pt() < 0.15) continue; + if(!PassesCuts(track) || track->Pt() > fSoftTrackMaxPt || track->Pt() < fSoftTrackMinPt) continue; sumPt += track->Pt(); cos2 += track->Pt()*TMath::Cos(2*PhaseShift(track->Phi()-psi2)); sin2 += track->Pt()*TMath::Sin(2*PhaseShift(track->Phi()-psi2)); cos3 += track->Pt()*TMath::Cos(3*PhaseShift(track->Phi()-psi3)); sin3 += track->Pt()*TMath::Sin(3*PhaseShift(track->Phi()-psi3)); } - fFitModulation->SetParameter(3, TMath::Sqrt(cos2*cos2+sin2*sin2)/RhoVal()); + fFitModulation->SetParameter(3, TMath::Sqrt(cos2*cos2+sin2*sin2)/fLocalRho->GetVal()); fFitModulation->SetParameter(4, psi2); fFitModulation->SetParameter(6, psi3); - fFitModulation->SetParameter(7, TMath::Sqrt(cos3*cos3+sin3*sin3)/RhoVal()); - } + fFitModulation->SetParameter(7, TMath::Sqrt(cos3*cos3+sin3*sin3)/fLocalRho->GetVal()); + } break; default : break; } - if(fDetectorType == kTPCSUB && psi2 > -1000 ) { // do the magic for the subevent case - Double_t v2(fFitModulation->GetParameter(3)), v3(fFitModulation->GetParameter(7)); - CorrectRho(params, -9999, -9999, psi2b, psi3b); - v2 += fFitModulation->GetParameter(3); - v3 += fFitModulation->GetParameter(7); - fFitModulation->SetParameter(3, v2/2.); - fFitModulation->SetParameter(7, v3/3.); + if(fRunToyMC) { + // toy mc, just here to check procedure, azimuthal profile is filled from hypothesis so p-value distribution should be flat + Int_t _bins = _tempSwap.GetXaxis()->GetNbins(); + TF1* _tempFit = new TF1("temp_fit_kCombined", "[0]*([1]+[2]*([3]*TMath::Cos([2]*(x-[4]))+[7]*TMath::Cos([5]*(x-[6]))))", 0, TMath::TwoPi()); + _tempFit->SetParameter(0, fFitModulation->GetParameter(0)); // normalization + _tempFit->SetParameter(3, 0.1); // v2 + _tempFit->FixParameter(1, 1.); // constant + _tempFit->FixParameter(2, 2.); // constant + _tempFit->FixParameter(5, 3.); // constant + _tempFit->FixParameter(4, fFitModulation->GetParameter(4)); + _tempFit->FixParameter(6, fFitModulation->GetParameter(6)); + _tempFit->SetParameter(7, 0.1); // v3 + _tempSwap.Reset(); // rese bin content + for(int _binsI = 0; _binsI < _bins*_bins; _binsI++) _tempSwap.Fill(_tempFit->GetRandom()); } - _tempSwap.Fit(fFitModulation, fFitModulationOptions.Data(), "", 0, TMath::TwoPi()); + _tempSwap.Fit(fFitModulation, fFitModulationOptions.Data(), "", lowBound, upBound); // the quality of the fit is evaluated from 1 - the cdf of the chi square distribution - Double_t CDF(1.-ChiSquareCDF(fFitModulation->GetNDF(), fFitModulation->GetChisquare())); -// Double_t PDF(ChiSquarePDF(fFitModulation->GetNDF(), fFitModulation->GetChisquare())); + // three methods are available, all with their drawbacks. all are stored, one is selected to do the cut + Int_t NDF(_tempSwap.GetXaxis()->GetNbins()-freeParams); + if(NDF == 0) return kFALSE; + Double_t CDF(1.-ChiSquareCDF(NDF, ChiSquare(_tempSwap, fFitModulation))); + Double_t CDFROOT(1.-ChiSquareCDF(NDF, fFitModulation->GetChisquare())); + Double_t CDFKolmogorov(KolmogorovTest(_tempSwap, fFitModulation)); + // fill the values and centrality correlation (redundant but easy on the eyes) fHistPvalueCDF->Fill(CDF); -// fHistPvaluePDF->Fill(PDF); - if(CDF > fMinPvalue && CDF < fMaxPvalue && ( fAbsVnHarmonics && fFitModulation->GetMinimum(0, TMath::TwoPi()) > 0)) { // fit quality + fHistPvalueCDFCent->Fill(fCent, CDF); + fHistPvalueCDFROOT->Fill(CDFROOT); + fHistPvalueCDFROOTCent->Fill(fCent, CDFROOT); + fHistKolmogorovTest->Fill(CDFKolmogorov); + fHistChi2ROOTCent->Fill(fCent, fFitModulation->GetChisquare()/((float)NDF)); + fHistChi2Cent->Fill(fCent, ChiSquare(_tempSwap, fFitModulation)/((float)NDF)); + fHistKolmogorovTestCent->Fill(fCent, CDFKolmogorov); + fHistPChi2Root->Fill(CDFROOT, fFitModulation->GetChisquare()/((float)NDF)); + fHistPChi2->Fill(CDF, ChiSquare(_tempSwap, fFitModulation)/((float)NDF)); + fHistPKolmogorov->Fill(CDF, CDFKolmogorov); + + // variable CDF is used for making cuts, so we fill it with the selected p-value + switch (fFitGoodnessTest) { + case kChi2ROOT : { + CDF = CDFROOT; + } break; + case kChi2Poisson : break; // CDF is already CDF + case kKolmogorov : { + CDF = CDFKolmogorov; + } break; + default: break; + } + + if(fFitControl) { + // as an additional quality check, see if fitting a control fit has a higher significance + _tempSwap.Fit(fFitControl, fFitModulationOptions.Data(), "", lowBound, upBound); + Double_t CDFControl(-1.); + switch (fFitGoodnessTest) { + case kChi2ROOT : { + CDFControl = 1.-ChiSquareCDF(fFitControl->GetNDF(), fFitModulation->GetChisquare()); + } break; + case kChi2Poisson : { + CDFControl = 1.-ChiSquareCDF(fFitControl->GetNDF(), ChiSquare(_tempSwap, fFitModulation)); + } break; + case kKolmogorov : { + CDFControl = KolmogorovTest(_tempSwap, fFitControl); + } break; + default: break; + } + if(CDFControl > CDF) { + CDF = -1.; // control fit is more significant, so throw out the 'old' fit + fHistRhoStatusCent->Fill(fCent, -1); + } + } + if(CDF >= fMinPvalue && CDF <= fMaxPvalue && ( fAbsVnHarmonics && fFitModulation->GetMinimum(0, TMath::TwoPi()) > 0)) { // fit quality. not that although with limited acceptance the fit is performed on just + // part of phase space, the requirement that energy desntiy is larger than zero is applied + // to the FULL spectrum + fHistRhoStatusCent->Fill(fCent, 0.); // for LOCAL didactic purposes, save the best and the worst fits // this routine can produce a lot of output histograms (it's not memory 'safe') and will not work on GRID // since the output will become unmergeable (i.e. different nodes may produce conflicting output) @@ -860,8 +1308,39 @@ Bool_t AliAnalysisTaskRhoVnModulation::CorrectRho(Double_t* params, Double_t psi if(fRandom->Uniform(0, 100) > fPercentageOfFits) break; static Int_t didacticCounterBest(0); TProfile* didacticProfile = (TProfile*)_tempSwap.Clone(Form("Fit_%i_1-CDF_%.3f_cen_%i_%s", didacticCounterBest, CDF, fInCentralitySelection, detector.Data())); - TF1* didactifFit = (TF1*)fFitModulation->Clone(Form("fit_%i_CDF_%.3f_cen_%i_%s", didacticCounterBest, CDF, fInCentralitySelection, detector.Data())); - didacticProfile->GetListOfFunctions()->Add(didactifFit); + TF1* didacticFit = (TF1*)fFitModulation->Clone(Form("fit_%i_CDF_%.3f_cen_%i_%s", didacticCounterBest, CDF, fInCentralitySelection, detector.Data())); + switch(fFitModulationType) { + case kCombined : { + // to make a nice picture also plot the separate components (v2 and v3) of the fit + // only done for cobined fit where there are actually components to split ... + TF1* v0(new TF1("dfit_kV2", "[0]", 0, TMath::TwoPi())); + v0->SetParameter(0, didacticFit->GetParameter(0)); // normalization + v0->SetLineColor(kMagenta); + v0->SetLineStyle(7); + didacticProfile->GetListOfFunctions()->Add(v0); + TF1* v2(new TF1("dfit_kV2", "[0]*([1]+[2]*[3]*TMath::Cos([2]*(x-[4])))", 0, TMath::TwoPi())); + v2->SetParameter(0, didacticFit->GetParameter(0)); // normalization + v2->SetParameter(3, didacticFit->GetParameter(3)); // v2 + v2->FixParameter(1, 1.); // constant + v2->FixParameter(2, 2.); // constant + v2->FixParameter(4, didacticFit->GetParameter(4)); // psi2 + v2->SetLineColor(kGreen); + didacticProfile->GetListOfFunctions()->Add(v2); + TF1* v3(new TF1("dfit_kV3", "[0]*([1]+[2]*[3]*TMath::Cos([5]*(x-[4])))", 0, TMath::TwoPi())); + v3->SetParameter(0, didacticFit->GetParameter(0)); // normalization + v3->SetParameter(3, didacticFit->GetParameter(7)); // v3 + v3->FixParameter(1, 1.); // constant + v3->FixParameter(2, 2.); // constant + v3->FixParameter(4, didacticFit->GetParameter(6)); // psi3 + v3->FixParameter(5, 3.); // constant + v3->SetLineColor(kCyan); + didacticProfile->GetListOfFunctions()->Add(v3); + } + default : break; + } + didacticProfile->GetListOfFunctions()->Add(didacticFit); + didacticProfile->GetYaxis()->SetTitle("#frac{d #sum #it{p}_{T}}{d #varphi} [GeV/#it{c}]"); + didacticProfile->GetXaxis()->SetTitle("#varphi"); fOutputListGood->Add(didacticProfile); didacticCounterBest++; TH2F* didacticSurface = BookTH2F(Form("surface_%s", didacticProfile->GetName()), "#phi", "#eta", 50, 0, TMath::TwoPi(), 50, -1, 1, -1, kFALSE); @@ -874,12 +1353,8 @@ Bool_t AliAnalysisTaskRhoVnModulation::CorrectRho(Double_t* params, Double_t psi } if(fExcludeLeadingJetsFromFit) { // visualize the excluded region TF2 *f2 = new TF2(Form("%s_LJ", didacticSurface->GetName()),"[0]*TMath::Gaus(x,[1],[2])*TMath::Gaus(y,[3],[4])", 0, TMath::TwoPi(), -1, 1); - f2->SetParameters(excludeInPt[0]/3.,excludeInPhi[0],.1,excludeInEta[0],.1); + f2->SetParameters(excludeInPt/3.,excludeInPhi,.1,excludeInEta,.1); didacticSurface->GetListOfFunctions()->Add(f2); - TF2 *f3 = new TF2(Form("%s_NLJ", didacticSurface->GetName()),"[0]*TMath::Gaus(x,[1],[2])*TMath::Gaus(y,[3],[4])", 0, TMath::TwoPi(), -1, 1); - f3->SetParameters(excludeInPt[1]/3.,excludeInPhi[1],.1,excludeInEta[1],.1); - f3->SetLineColor(kGreen); - didacticSurface->GetListOfFunctions()->Add(f3); } fOutputListGood->Add(didacticSurface); } break; @@ -891,8 +1366,8 @@ Bool_t AliAnalysisTaskRhoVnModulation::CorrectRho(Double_t* params, Double_t psi static Int_t didacticCounterWorst(0); if(fRandom->Uniform(0, 100) > fPercentageOfFits) break; TProfile* didacticProfile = (TProfile*)_tempSwap.Clone(Form("Fit_%i_1-CDF_%.3f_cen_%i_%s", didacticCounterWorst, CDF, fInCentralitySelection, detector.Data() )); - TF1* didactifFit = (TF1*)fFitModulation->Clone(Form("fit_%i_p_%.3f_cen_%i_%s", didacticCounterWorst, CDF, fInCentralitySelection, detector.Data())); - didacticProfile->GetListOfFunctions()->Add(didactifFit); + TF1* didacticFit = (TF1*)fFitModulation->Clone(Form("fit_%i_p_%.3f_cen_%i_%s", didacticCounterWorst, CDF, fInCentralitySelection, detector.Data())); + didacticProfile->GetListOfFunctions()->Add(didacticFit); fOutputListBad->Add(didacticProfile); didacticCounterWorst++; } break; @@ -900,17 +1375,16 @@ Bool_t AliAnalysisTaskRhoVnModulation::CorrectRho(Double_t* params, Double_t psi } switch (fFitModulationType) { case kNoFit : break; // nothing to do - case kUser : break; // FIXME not implemented yet case kCombined : fFitModulation->SetParameter(7, 0); // no break case kFourierSeries : fFitModulation->SetParameter(7, 0); // no break default : { // needs to be done if there was a poor fit fFitModulation->SetParameter(3, 0); - fFitModulation->SetParameter(0, RhoVal()); + fFitModulation->SetParameter(0, fLocalRho->GetVal()); } break; } + if(CDF > -.5) fHistRhoStatusCent->Fill(fCent, 1.); return kFALSE; // return false if the fit is rejected } - for(Int_t i(0); i < fFitModulation->GetNpar(); i++) params[i] = fFitModulation->GetParameter(i); return kTRUE; } //_____________________________________________________________________________ @@ -918,7 +1392,49 @@ Bool_t AliAnalysisTaskRhoVnModulation::PassesCuts(AliVEvent* event) { // event cuts if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); - if(!event) return kFALSE; + // determine the run number to see if the track and jet cuts should be refreshed for semi-good TPC runs + // only done if the runnumber changes, could be moved to a call to AliAnalysisTaskSE::Notify() + if(fRunNumber != InputEvent()->GetRunNumber()) { + fRunNumber = InputEvent()->GetRunNumber(); // set the current run number + if(fDebug > 0) printf("__FUNC__ %s > NEW RUNNUMBER DETECTED \n ", __func__); + // reset the cuts. should be a pointless operation except for the case where the run number changes + // from semi-good back to good on one node, which is not a likely scenario + AliAnalysisTaskEmcal::SetTrackPhiLimits(-10., 10.); + AliAnalysisTaskEmcalJet::SetJetPhiLimits(-10., 10.); + if(fCachedRho) { // if there's a cached rho, it's the default, so switch back + if(fDebug > 0) printf("__FUNC__ %s > replacing rho with cached rho \n ", __func__); + fRho = fCachedRho; // reset rho back to cached value. again, should be pointless + } + Bool_t flaggedAsSemiGood(kFALSE); // not flagged as anything + for(Int_t i(0); i < fExpectedSemiGoodRuns->GetSize(); i++) { + if(fExpectedSemiGoodRuns->At(i) == fRunNumber) { // run is semi-good + if(fDebug > 0) printf("__FUNC__ %s > semi-good tpc run detected, adjusting acceptance \n ", __func__); + flaggedAsSemiGood = kTRUE; + AliAnalysisTaskEmcalJet::SetJetPhiLimits(fSemiGoodJetMinPhi, fSemiGoodJetMaxPhi); // just an acceptance cut, jets are obtained from full azimuth, so no edge effects + AliAnalysisTaskEmcal::SetTrackPhiLimits(fSemiGoodTrackMinPhi, fSemiGoodTrackMaxPhi); // only affects vn extraction, NOT jet finding + // for semi-good runs, also try to get the 'small rho' estimate, if it is available + AliRhoParameter* tempRho(dynamic_cast(InputEvent()->FindListObject(fNameSmallRho.Data()))); + if(tempRho) { + if(fDebug > 0) printf("__FUNC__ %s > switching to small rho, caching normal rho \n ", __func__); + fHistAnalysisSummary->SetBinContent(54, 1.); // bookkeep the fact that small rho is used + fCachedRho = fRho; // cache the original rho ... + fRho = tempRho; // ... and use the small rho + } + } + } + if(!flaggedAsSemiGood) { + // in case the run is not a semi-good run, check if it is recognized as another run + // only done to catch unexpected runs + for(Int_t i(0); i < fExpectedRuns->GetSize(); i++) { + if(fExpectedRuns->At(i) == fRunNumber) break; // run is known, break the loop else store the number in a random bin + fHistUndeterminedRunQA->SetBinContent(TMath::Nint(10.*gRandom->Uniform(0.,.9))+1, fRunNumber); + } + fHistAnalysisSummary->SetBinContent(53, 1.); // bookkeep which rho estimate is used + } + } + // continue with event selection + if(!event || !AliAnalysisTaskEmcal::IsEventSelected()) return kFALSE; + if(fSemiCentralInclusive && ! (event->GetTriggerMask() & (ULong64_t(1)<<7))) return kFALSE; if(TMath::Abs(InputEvent()->GetPrimaryVertex()->GetZ()) > 10.) return kFALSE; // aod and esd specific checks switch (fDataType) { @@ -935,121 +1451,136 @@ Bool_t AliAnalysisTaskRhoVnModulation::PassesCuts(AliVEvent* event) fCent = InputEvent()->GetCentrality()->GetCentralityPercentile("V0M"); if(fCent <= fCentralityClasses->At(0) || fCent >= fCentralityClasses->At(fCentralityClasses->GetSize()-1) || TMath::Abs(fCent-InputEvent()->GetCentrality()->GetCentralityPercentile("TRK")) > 5.) return kFALSE; // determine centrality class + fInCentralitySelection = -1; for(Int_t i(0); i < fCentralityClasses->GetSize()-1; i++) { if(fCent >= fCentralityClasses->At(i) && fCent <= fCentralityClasses->At(1+i)) { fInCentralitySelection = i; break; } } - if(fFillQAHistograms) FillQAHistograms(event); + if(fInCentralitySelection<0) return kFALSE; // should be null op + if(fExplicitOutlierCut == 2010 || fExplicitOutlierCut == 2011) { + if(!PassesCuts(fExplicitOutlierCut)) return kFALSE; + } + // see if input containers are filled + if(fTracks->GetEntries() < 1) return kFALSE; + if(fRho->GetVal() <= 0 ) return kFALSE; + if(fAnalysisType == AliAnalysisTaskRhoVnModulation::kCharged && !fClusterCont) return kFALSE; return kTRUE; } //_____________________________________________________________________________ -Bool_t AliAnalysisTaskRhoVnModulation::PassesCuts(const AliVCluster* cluster) const +Bool_t AliAnalysisTaskRhoVnModulation::PassesCuts(Int_t year) { - // cluster cuts - if(fDebug > 1) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); - if(!cluster) return kFALSE; - return kTRUE; + // additional centrality cut based on relation between tpc and global multiplicity + if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); + AliAODEvent* event(dynamic_cast(InputEvent())); + if(!event) return kFALSE; + Int_t multTPC(0), multGlob(0), nTracks(InputEvent()->GetNumberOfTracks()); + for(Int_t iTracks = 0; iTracks < nTracks; iTracks++) { + AliAODTrack* track = event->GetTrack(iTracks); + if(!track) continue; + if (!track || track->Pt() < .2 || track->Pt() > 5.0 || TMath::Abs(track->Eta()) > .8 || track->GetTPCNcls() < 70 || !track->GetDetPid() || track->GetDetPid()->GetTPCsignal() < 10.0) continue; // general quality cut + if (track->TestFilterBit(1) && track->Chi2perNDF() > 0.2) multTPC++; + if (!track->TestFilterBit(16) || track->Chi2perNDF() < 0.1) continue; + Double_t b[2] = {-99., -99.}; + Double_t bCov[3] = {-99., -99., -99.}; + AliAODTrack copy(*track); + if (copy.PropagateToDCA(event->GetPrimaryVertex(), event->GetMagneticField(), 100., b, bCov) && TMath::Abs(b[0]) < 0.3 && TMath::Abs(b[1]) < 0.3) multGlob++; + } + if(year == 2010 && multTPC > (-40.3+1.22*multGlob) && multTPC < (32.1+1.59*multGlob)) return kTRUE; + if(year == 2011 && multTPC > (-36.73 + 1.48*multGlob) && multTPC < (62.87 + 1.78*multGlob)) return kTRUE; + return kFALSE; } //_____________________________________________________________________________ -void AliAnalysisTaskRhoVnModulation::FillHistogramsAfterSubtraction(Double_t vzero[2][2], Double_t* tpc) const +void AliAnalysisTaskRhoVnModulation::FillHistogramsAfterSubtraction(Double_t psi2, Double_t psi3, Double_t vzero[2][2], Double_t* vzeroComb, Double_t* tpc) { // fill histograms if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); FillTrackHistograms(); - /* FillClusterHistograms(); */ - FillJetHistograms(vzero, tpc); - /* FillCorrectedClusterHistograms(); */ - FillEventPlaneHistograms(vzero, tpc); + FillClusterHistograms(); + FillJetHistograms(psi2, psi3); + if(fFillQAHistograms) FillEventPlaneHistograms(vzero, vzeroComb, tpc); FillRhoHistograms(); - switch (fDetectorType) { // determine the detector type for the rho fit - case kTPC : { FillDeltaPtHistograms(tpc[0], tpc[1]); } break; - case kTPCSUB : { FillDeltaPtHistograms(tpc[2], tpc[4]); - FillDeltaPtHistograms(tpc[3], tpc[5]); } break; - case kVZEROA : { FillDeltaPtHistograms(vzero[0][0], vzero[0][1]); } break; - case kVZEROC : { FillDeltaPtHistograms(vzero[1][0], vzero[1][1]); } break; - default : break; - } - FillDeltaPhiHistograms(vzero, tpc); + FillDeltaPtHistograms(psi2, psi3); } //_____________________________________________________________________________ void AliAnalysisTaskRhoVnModulation::FillTrackHistograms() const { // fill track histograms if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); - Int_t iTracks(fTracks->GetEntriesFast()); + Int_t iTracks(fTracks->GetEntriesFast()), iAcceptedTracks(0); for(Int_t i(0); i < iTracks; i++) { AliVTrack* track = static_cast(fTracks->At(i)); if(!PassesCuts(track)) continue; + iAcceptedTracks++; fHistPicoTrackPt[fInCentralitySelection]->Fill(track->Pt()); if(fFillQAHistograms) FillQAHistograms(track); } + fHistPicoTrackMult[fInCentralitySelection]->Fill(iAcceptedTracks); } //_____________________________________________________________________________ void AliAnalysisTaskRhoVnModulation::FillClusterHistograms() const { // fill cluster histograms if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); - /* Int_t iClusters(fCaloClusters->GetEntriesFast()); + if(!fClusterCont) return; + Int_t iClusters(fClusterCont->GetNClusters()); for(Int_t i(0); i < iClusters; i++) { - AliVCluster* cluster = static_cast(fCaloClusters->At(iClusters)); + AliVCluster* cluster = fClusterCont->GetCluster(i); if (!PassesCuts(cluster)) continue; TLorentzVector clusterLorentzVector; cluster->GetMomentum(clusterLorentzVector, const_cast(fVertex)); fHistClusterPt[fInCentralitySelection]->Fill(clusterLorentzVector.Pt()); - fHistClusterEta[fInCentralitySelection]->Fill(clusterLorentzVector.Eta()); - fHistClusterPhi[fInCentralitySelection]->Fill(clusterLorentzVector.Phi()); + fHistClusterEtaPhi[fInCentralitySelection]->Fill(clusterLorentzVector.Eta(), clusterLorentzVector.Phi()); + fHistClusterEtaPhiWeighted[fInCentralitySelection]->Fill(clusterLorentzVector.Eta(), clusterLorentzVector.Phi(), clusterLorentzVector.Pt()); } - return; */ + return; } //_____________________________________________________________________________ -void AliAnalysisTaskRhoVnModulation::FillCorrectedClusterHistograms() const -{ - // fill clusters after hadronic correction FIXME implement - if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); -} -//_____________________________________________________________________________ -void AliAnalysisTaskRhoVnModulation::FillEventPlaneHistograms(Double_t vzero[2][2], Double_t* tpc) const +void AliAnalysisTaskRhoVnModulation::FillEventPlaneHistograms(Double_t vzero[2][2], Double_t* vzeroComb, Double_t* tpc) const { // fill event plane histograms if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); fHistPsiControl->Fill(0.5, vzero[0][0]); // vzero a psi2 fHistPsiControl->Fill(1.5, vzero[1][0]); // vzero c psi2 fHistPsiControl->Fill(2.5, tpc[0]); // tpc psi 2 - fHistPsiControl->Fill(3.5, tpc[2]); // tpc sub a psi 2 - fHistPsiControl->Fill(4.5, tpc[3]); // tpc sub b psi 2 fHistPsiControl->Fill(5.5, vzero[0][1]); // vzero a psi3 fHistPsiControl->Fill(6.5, vzero[1][1]); // vzero b psi3 fHistPsiControl->Fill(7.5, tpc[1]); // tpc psi 3 - fHistPsiControl->Fill(8.5, tpc[4]); // tpc sub a psi3 - fHistPsiControl->Fill(9.5, tpc[5]); // tpc sub b psi3 fHistPsiVZEROA->Fill(vzero[0][0]); fHistPsiVZEROC->Fill(vzero[1][0]); + fHistPsiVZERO->Fill(vzeroComb[0]); fHistPsiTPC->Fill(tpc[0]); - fHistPsiTPCSUBA->Fill(tpc[2]); - fHistPsiTPCSUBB->Fill(tpc[3]); fHistPsiSpread->Fill(0.5, TMath::Abs(vzero[0][0]-vzero[1][0])); fHistPsiSpread->Fill(1.5, TMath::Abs(vzero[0][0]-tpc[0])); fHistPsiSpread->Fill(2.5, TMath::Abs(vzero[1][0]-tpc[0])); - fHistPsiSpread->Fill(3.5, TMath::Abs(tpc[2]-tpc[3])); + // event plane vs centrality QA histo's to check recentering + Double_t TRK(InputEvent()->GetCentrality()->GetCentralityPercentile("TRK")); + Double_t V0M(InputEvent()->GetCentrality()->GetCentralityPercentile("V0M")); + fHistPsiVZEROAV0M->Fill(V0M, vzero[0][0]); + fHistPsiVZEROCV0M->Fill(V0M, vzero[1][0]); + fHistPsiVZEROVV0M->Fill(V0M, vzeroComb[0]); + fHistPsiTPCiV0M->Fill(V0M, tpc[0]); + fHistPsiVZEROATRK->Fill(TRK, vzero[0][0]); + fHistPsiVZEROCTRK->Fill(TRK, vzero[1][0]); + fHistPsiVZEROTRK->Fill(TRK, vzeroComb[0]); + fHistPsiTPCTRK->Fill(TRK, tpc[0]); } //_____________________________________________________________________________ -void AliAnalysisTaskRhoVnModulation::FillRhoHistograms() const +void AliAnalysisTaskRhoVnModulation::FillRhoHistograms() { // fill rho histograms if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); - fHistRhoPackage[fInCentralitySelection]->Fill(RhoVal()); // save the rho estimate from the emcal jet package + fHistRhoPackage[fInCentralitySelection]->Fill(fLocalRho->GetVal()); // save the rho estimate from the emcal jet package // get multiplicity FIXME inefficient - Int_t iTracks(fTracks->GetEntriesFast()), mult(0), iJets(fJets->GetEntriesFast()); - for(Int_t i(0); i < iTracks; i ++) { if(PassesCuts(static_cast(fTracks->At(i)))) mult++; } - Double_t rho(RhoVal(TMath::Pi(), TMath::Pi(), fRho->GetVal())); + Int_t iJets(fJets->GetEntriesFast()); + Double_t rho(fLocalRho->GetLocalVal(TMath::Pi(), TMath::Pi(), fLocalRho->GetVal())); fHistRho[fInCentralitySelection]->Fill(rho); - fHistRhoVsMult->Fill(mult, rho); + fHistRhoVsMult->Fill(fTracks->GetEntries(), rho); fHistRhoVsCent->Fill(fCent, rho); for(Int_t i(0); i < iJets; i++) { AliEmcalJet* jet = static_cast(fJets->At(i)); if(!PassesCuts(jet)) continue; - fHistRhoAVsMult->Fill(mult, rho * jet->Area()); + fHistRhoAVsMult->Fill(fTracks->GetEntries(), rho * jet->Area()); fHistRhoAVsCent->Fill(fCent, rho * jet->Area()); } } @@ -1058,51 +1589,33 @@ void AliAnalysisTaskRhoVnModulation::FillDeltaPtHistograms(Double_t psi2, Double { // fill delta pt histograms if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); - Int_t i(0), maxCones(20); - AliEmcalJet* leadingJet(0x0); - static Int_t sJets[9999] = {-1}; - GetSortedArray(sJets, fJets); - do { // get the leading jet - leadingJet = static_cast(fJets->At(sJets[i])); - i++; - } - while (!PassesCuts(leadingJet)&&iGetEntriesFast()); - if(!leadingJet && fDebug > 0) printf(" > failed to retrieve leading jet ! < \n"); + Int_t i(0); const Float_t areaRC = fRandomConeRadius*fRandomConeRadius*TMath::Pi(); // we're retrieved the leading jet, now get a random cone - for(i = 0; i < maxCones; i++) { + for(i = 0; i < fMaxCones; i++) { Float_t pt(0), eta(0), phi(0); // get a random cone without constraints on leading jet position CalculateRandomCone(pt, eta, phi, 0x0); if(pt > 0) { - fHistRCPhiEta[fInCentralitySelection]->Fill(phi, eta); - fHistRhoVsRCPt[fInCentralitySelection]->Fill(pt, RhoVal(phi, fJetRadius, fRho->GetVal())*areaRC); + if(fFillQAHistograms) fHistRCPhiEta[fInCentralitySelection]->Fill(phi, eta); + fHistRhoVsRCPt[fInCentralitySelection]->Fill(pt, fLocalRho->GetLocalVal(phi, GetJetContainer()->GetJetRadius(), fLocalRho->GetVal())*areaRC); fHistRCPt[fInCentralitySelection]->Fill(pt); - fHistDeltaPtDeltaPhi2[fInCentralitySelection]->Fill(PhaseShift(phi-psi2), pt - areaRC*RhoVal(phi, fJetRadius, fRho->GetVal())); - fHistDeltaPtDeltaPhi3[fInCentralitySelection]->Fill(PhaseShift(phi-psi3), pt - areaRC*RhoVal(phi, fJetRadius, fRho->GetVal())); + fHistDeltaPtDeltaPhi2[fInCentralitySelection]->Fill(PhaseShift(phi-psi2, 2.), pt - areaRC*fLocalRho->GetLocalVal(phi, GetJetContainer()->GetJetRadius(), fLocalRho->GetVal())); + fHistDeltaPtDeltaPhi3[fInCentralitySelection]->Fill(PhaseShift(phi-psi3, 3.), pt - areaRC*fLocalRho->GetLocalVal(phi, GetJetContainer()->GetJetRadius(), fLocalRho->GetVal())); } // get a random cone excluding leading jet area - CalculateRandomCone(pt, eta, phi, leadingJet); + CalculateRandomCone(pt, eta, phi, fLeadingJet); if(pt > 0) { - fHistRCPhiEtaExLJ[fInCentralitySelection]->Fill(phi, eta); - fHistRhoVsRCPtExLJ[fInCentralitySelection]->Fill(pt, RhoVal(phi, fJetRadius, fRho->GetVal())*areaRC); + if(fFillQAHistograms) fHistRCPhiEtaExLJ[fInCentralitySelection]->Fill(phi, eta); + fHistRhoVsRCPtExLJ[fInCentralitySelection]->Fill(pt, fLocalRho->GetLocalVal(phi, GetJetContainer()->GetJetRadius(), fLocalRho->GetVal())*areaRC); fHistRCPtExLJ[fInCentralitySelection]->Fill(pt); - fHistDeltaPtDeltaPhi2ExLJ[fInCentralitySelection]->Fill(PhaseShift(phi-psi2), pt - areaRC*RhoVal(phi, fJetRadius, fRho->GetVal())); - fHistDeltaPtDeltaPhi3ExLJ[fInCentralitySelection]->Fill(PhaseShift(phi-psi3), pt - areaRC*RhoVal(phi, fJetRadius, fRho->GetVal())); - } - // get a random cone in an event with randomized phi and eta - CalculateRandomCone(pt, eta, phi, 0x0, kTRUE); - if( pt > 0) { - fHistRCPhiEtaRand[fInCentralitySelection]->Fill(phi, eta); - fHistRhoVsRCPtRand[fInCentralitySelection]->Fill(pt, RhoVal(phi, fJetRadius, fRho->GetVal())*areaRC); - fHistRCPtRand[fInCentralitySelection]->Fill(pt); - fHistDeltaPtDeltaPhi2Rand[fInCentralitySelection]->Fill(PhaseShift(phi-psi2), pt - areaRC*RhoVal(phi, fJetRadius, fRho->GetVal())); - fHistDeltaPtDeltaPhi3Rand[fInCentralitySelection]->Fill(PhaseShift(phi-psi3), pt - areaRC*RhoVal(phi, fJetRadius, fRho->GetVal())); + fHistDeltaPtDeltaPhi2ExLJ[fInCentralitySelection]->Fill(PhaseShift(phi-psi2, 2.), pt - areaRC*fLocalRho->GetLocalVal(phi, GetJetContainer()->GetJetRadius(), fLocalRho->GetVal())); + fHistDeltaPtDeltaPhi3ExLJ[fInCentralitySelection]->Fill(PhaseShift(phi-psi3, 3.), pt - areaRC*fLocalRho->GetLocalVal(phi, GetJetContainer()->GetJetRadius(), fLocalRho->GetVal())); } } } //_____________________________________________________________________________ -void AliAnalysisTaskRhoVnModulation::FillJetHistograms(Double_t vzero[2][2], Double_t* tpc) const +void AliAnalysisTaskRhoVnModulation::FillJetHistograms(Double_t psi2, Double_t psi3) { // fill jet histograms if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); @@ -1111,43 +1624,21 @@ void AliAnalysisTaskRhoVnModulation::FillJetHistograms(Double_t vzero[2][2], Dou AliEmcalJet* jet = static_cast(fJets->At(i)); if(PassesCuts(jet)) { Double_t pt(jet->Pt()), area(jet->Area()), eta(jet->Eta()), phi(jet->Phi()); - Double_t rho(RhoVal(phi, fJetRadius, fRho->GetVal())); + Double_t rho(fLocalRho->GetLocalVal(phi, GetJetContainer()->GetJetRadius(), fLocalRho->GetVal())); fHistJetPtRaw[fInCentralitySelection]->Fill(pt); fHistJetPt[fInCentralitySelection]->Fill(pt-area*rho); - fHistJetEtaPhi[fInCentralitySelection]->Fill(eta, phi); + if(fFillQAHistograms) fHistJetEtaPhi[fInCentralitySelection]->Fill(eta, phi); fHistJetPtArea[fInCentralitySelection]->Fill(pt-area*rho, area); - fHistJetPsiTPCPt[fInCentralitySelection]->Fill(PhaseShift(phi-tpc[0]), pt-area*rho); - fHistJetPsiVZEROAPt[fInCentralitySelection]->Fill(PhaseShift(phi-vzero[0][0]), pt-area*rho); - fHistJetPsiVZEROCPt[fInCentralitySelection]->Fill(PhaseShift(phi-vzero[1][0]), pt-area*rho); + fHistJetPtEta[fInCentralitySelection]->Fill(pt-area*rho, eta); + fHistJetPsi2Pt[fInCentralitySelection]->Fill(PhaseShift(phi-psi2, 2.), pt-area*rho); + fHistJetPsi3Pt[fInCentralitySelection]->Fill(PhaseShift(phi-psi3, 3.), pt-area*rho); fHistJetPtConstituents[fInCentralitySelection]->Fill(pt-area*rho, jet->Nch()); fHistJetEtaRho[fInCentralitySelection]->Fill(eta, pt/area); - if(fSetPtSub) jet->SetPtSub(pt-area*rho); - } - else { // if the jet is rejected, excluded it for the flow analysis - if(fSetPtSub) jet->SetPtSub(-999.); - } + if(fSubtractJetPt) jet->SetPtSub(pt-area*rho); // if requested, save the subtracted jet pt + } else if(fSubtractJetPt) jet->SetPtSub(-999.); } } //_____________________________________________________________________________ -void AliAnalysisTaskRhoVnModulation::FillDeltaPhiHistograms(Double_t vzero[2][2], Double_t* tpc) const -{ - // fill phi minus psi histograms - if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); - if(fTracks) { - Int_t iTracks(fTracks->GetEntriesFast()); - for(Int_t iTPC(0); iTPC < iTracks; iTPC++) { - AliVTrack* track = static_cast(fTracks->At(iTPC)); - if(!PassesCuts(track)) continue; - fHistDeltaPhi2VZEROA[fInCentralitySelection]->Fill(PhaseShift(track->Phi()-vzero[0][0])); - fHistDeltaPhi2VZEROC[fInCentralitySelection]->Fill(PhaseShift(track->Phi()-vzero[1][0])); - fHistDeltaPhi2TPC[fInCentralitySelection]->Fill(PhaseShift(track->Phi()-tpc[0])); - fHistDeltaPhi3VZEROA[fInCentralitySelection]->Fill(PhaseShift(track->Phi()-vzero[0][1])); - fHistDeltaPhi3VZEROC[fInCentralitySelection]->Fill(PhaseShift(track->Phi()-vzero[1][1])); - fHistDeltaPhi3TPC[fInCentralitySelection]->Fill(PhaseShift(track->Phi()-tpc[1])); - } - } -} -//_____________________________________________________________________________ void AliAnalysisTaskRhoVnModulation::FillQAHistograms(AliVTrack* vtrack) const { // fill qa histograms for pico tracks @@ -1177,27 +1668,87 @@ void AliAnalysisTaskRhoVnModulation::FillQAHistograms(AliVEvent* vevent) fHistVertexz->Fill(vevent->GetPrimaryVertex()->GetZ()); fHistCentrality->Fill(fCent); Int_t runNumber(InputEvent()->GetRunNumber()); - Int_t runs[] = {167813, 167988, 168066, 168068, 168069, 168076, 168104, 168212, 168311, 168322, 168325, 168341, 168361, 168362, 168458, 168460, 168461, 168992, 169091, 169094, 169138, 169143, 169167, 169417, 169835, 169837, 169838, 169846, 169855, 169858, 169859, 169923, 169956, 170027, 170036, 170081, 169975, 169981, 170038, 170040, 170083, 170084, 170085, 170088, 170089, 170091, 170152, 170155, 170159, 170163, 170193, 170195, 170203, 170204, 170205, 170228, 170230, 170264, 170268, 170269, 170270, 170306, 170308, 170309}; - for(fMappedRunNumber = 0; fMappedRunNumber < 64; fMappedRunNumber++) { - if(runs[fMappedRunNumber]==runNumber) break; + for(fMappedRunNumber = 0; fExpectedRuns->GetSize()+1; fMappedRunNumber++) { + if(fExpectedRuns->At(fMappedRunNumber) == runNumber) break; } } //_____________________________________________________________________________ +void AliAnalysisTaskRhoVnModulation::FillAnalysisSummaryHistogram() const +{ + // fill the analysis summary histrogram, saves all relevant analysis settigns + if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(2, "fJetRadius"); + fHistAnalysisSummary->SetBinContent(2, GetJetContainer()->GetJetRadius()); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(3, "fJetEtaMin"); + fHistAnalysisSummary->SetBinContent(3, GetJetContainer()->GetJetEtaMin()); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(4, "fJetEtaMax"); + fHistAnalysisSummary->SetBinContent(4, GetJetContainer()->GetJetEtaMax()); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(5, "fJetPhiMin"); + fHistAnalysisSummary->SetBinContent(5, GetJetContainer()->GetJetPhiMin()); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(6, "fJetPhiMax"); + fHistAnalysisSummary->SetBinContent(6, GetJetContainer()->GetJetPhiMin()); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(16, "fForceBeamType"); + fHistAnalysisSummary->SetBinContent(16, fForceBeamType); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(17, "fMinCent"); + fHistAnalysisSummary->SetBinContent(17, fMinCent); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(18, "fMaxCent"); + fHistAnalysisSummary->SetBinContent(18, fMaxCent); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(19, "fMinVz"); + fHistAnalysisSummary->SetBinContent(19, fMinVz); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(20, "fMaxVz"); + fHistAnalysisSummary->SetBinContent(20, fMaxVz); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(21, "fOffTrigger"); + fHistAnalysisSummary->SetBinContent(21, fOffTrigger); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(33, "fRandomConeRadius"); + fHistAnalysisSummary->SetBinContent(33, fRandomConeRadius); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(34, "fitModulationType"); + fHistAnalysisSummary->SetBinContent(34, (int)fFitModulationType); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(35, "runModeType"); + fHistAnalysisSummary->SetBinContent(35, (int)fRunModeType); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(36, "data type"); + fHistAnalysisSummary->SetBinContent(36, (int)fDataType); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(37, "iterator"); + fHistAnalysisSummary->SetBinContent(37, 1.); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(38, "fMinPvalue"); + fHistAnalysisSummary->SetBinContent(38, fMinPvalue); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(39, "fMaxPvalue"); + fHistAnalysisSummary->SetBinContent(39, fMaxPvalue); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(40, "fExcludeLeadingJetsFromFit"); + fHistAnalysisSummary->SetBinContent(40, fExcludeLeadingJetsFromFit); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(41, "fRebinSwapHistoOnTheFly"); + fHistAnalysisSummary->SetBinContent(41, (int)fRebinSwapHistoOnTheFly); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(42, "fUsePtWeight"); + fHistAnalysisSummary->SetBinContent(42, (int)fUsePtWeight); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(43, "fMinLeadingHadronPt"); + fHistAnalysisSummary->SetBinContent(43, fMinLeadingHadronPt); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(44, "fExplicitOutlierCut"); + fHistAnalysisSummary->SetBinContent(44, fExplicitOutlierCut); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(45, "fLocalJetMinEta"); + fHistAnalysisSummary->SetBinContent(45,fLocalJetMinEta ); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(46, "fLocalJetMaxEta"); + fHistAnalysisSummary->SetBinContent(46, fLocalJetMaxEta); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(47, "fLocalJetMinPhi"); + fHistAnalysisSummary->SetBinContent(47, fLocalJetMinPhi); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(48, "fLocalJetMaxPhi"); + fHistAnalysisSummary->SetBinContent(48, fLocalJetMaxPhi); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(49, "fSoftTrackMinPt"); + fHistAnalysisSummary->SetBinContent(49, fSoftTrackMinPt); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(50, "fSoftTrackMaxPt"); + fHistAnalysisSummary->SetBinContent(50, fSoftTrackMaxPt); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(51, "fMaxCones"); + fHistAnalysisSummary->SetBinContent(51, fMaxCones); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(52, "fUseScaledRho"); + fHistAnalysisSummary->SetBinContent(52, fUseScaledRho); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(53, "used rho"); + fHistAnalysisSummary->GetXaxis()->SetBinLabel(54, "used small rho"); +} +//_____________________________________________________________________________ void AliAnalysisTaskRhoVnModulation::Terminate(Option_t *) { // terminate switch (fRunModeType) { case kLocal : { printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); - if(fFillQAHistograms) { - Int_t runs[] = {167813, 167988, 168066, 168068, 168069, 168076, 168104, 168212, 168311, 168322, 168325, 168341, 168361, 168362, 168458, 168460, 168461, 168992, 169091, 169094, 169138, 169143, 169167, 169417, 169835, 169837, 169838, 169846, 169855, 169858, 169859, 169923, 169956, 170027, 170036, 170081, 169975, 169981, 170038, 170040, 170083, 170084, 170085, 170088, 170089, 170091, 170152, 170155, 170159, 170163, 170193, 170195, 170203, 170204, 170205, 170228, 170230, 170264, 170268, 170269, 170270, 170306, 170308, 170309}; - for(Int_t i(0); i < 64; i++) { - fHistRunnumbersPhi->GetXaxis()->SetBinLabel(i+1, Form("%i", runs[i])); - fHistRunnumbersEta->GetXaxis()->SetBinLabel(i+1, Form("%i", runs[i])); - } - fHistRunnumbersPhi->GetXaxis()->SetBinLabel(65, "undetermined"); - fHistRunnumbersEta->GetXaxis()->SetBinLabel(65, "undetermined"); - } AliAnalysisTaskRhoVnModulation::Dump(); for(Int_t i(0); i < fHistAnalysisSummary->GetXaxis()->GetNbins(); i++) printf( " > flag: %s \t content %.2f \n", fHistAnalysisSummary->GetXaxis()->GetBinLabel(1+i), fHistAnalysisSummary->GetBinContent(1+i)); } break; @@ -1205,3 +1756,112 @@ void AliAnalysisTaskRhoVnModulation::Terminate(Option_t *) } } //_____________________________________________________________________________ +void AliAnalysisTaskRhoVnModulation::SetModulationFit(TF1* fit) +{ + // set modulation fit + if (fFitModulation) delete fFitModulation; + fFitModulation = fit; +} +//_____________________________________________________________________________ +void AliAnalysisTaskRhoVnModulation::SetUseControlFit(Bool_t c) +{ + // set control fit + if (fFitControl) delete fFitControl; + if (c) { + fFitControl = new TF1("controlFit", "pol0", 0, TMath::TwoPi()); + } else fFitControl = 0x0; +} +//_____________________________________________________________________________ +TH1F* AliAnalysisTaskRhoVnModulation::GetResolutionFromOuptutFile(detectorType det, Int_t h, TArrayD* cen) +{ + // INTERFACE METHOD FOR OUTPUTFILE + // get the detector resolution, user has ownership of the returned histogram + if(!fOutputList) { + printf(" > Please add fOutputList first < \n"); + return 0x0; + } + TH1F* r(0x0); + (cen) ? r = new TH1F("R", "R", cen->GetSize()-1, cen->GetArray()) : r = new TH1F("R", "R", 10, 0, 10); + if(!cen) r->GetXaxis()->SetTitle("number of centrality bin"); + r->GetYaxis()->SetTitle(Form("Resolution #Psi_{%i}", h)); + for(Int_t i(0); i < 10; i++) { + TProfile* temp((TProfile*)fOutputList->FindObject(Form("fProfV%iResolution_%i", h, i))); + if(!temp) break; + Double_t a(temp->GetBinContent(3)), b(temp->GetBinContent(5)), c(temp->GetBinContent(7)); + Double_t d(temp->GetBinContent(9)), e(temp->GetBinContent(10)), f(temp->GetBinContent(11)); + Double_t _a(temp->GetBinError(3)), _b(temp->GetBinError(5)), _c(temp->GetBinError(7)); + Double_t _d(temp->GetBinError(9)), _e(temp->GetBinError(10)), _f(temp->GetBinError(11)); + if(a <= 0 || b <= 0 || c <= 0 || d <= 0 || e <= 0 || f <= 0) continue; + switch (det) { + case kVZEROA : { + r->SetBinContent(1+i, TMath::Sqrt((a*b)/c)); + if(i==0) r->SetNameTitle("VZEROA resolution", "VZEROA resolution"); + r->SetBinError(1+i, TMath::Sqrt(_a*_a+_b*_b+_c*_c)); + } break; + case kVZEROC : { + r->SetBinContent(1+i, TMath::Sqrt((a*c)/b)); + if(i==0) r->SetNameTitle("VZEROC resolution", "VZEROC resolution"); + r->SetBinError(1+i, TMath::Sqrt(_a*_a+_b*_b+_c*_c)); + } break; + case kTPC : { + r->SetBinContent(1+i, TMath::Sqrt((b*c)/a)); + if(i==0) r->SetNameTitle("TPC resolution", "TPC resolution"); + r->SetBinError(1+i, TMath::Sqrt(_a*_a+_b*_b+_c*_c)); + } break; + case kVZEROComb : { + r->SetBinContent(1+i, TMath::Sqrt((d*e)/f)); + if(i==0) r->SetNameTitle("VZEROComb resolution", "VZEROComb resolution"); + r->SetBinError(1+i, TMath::Sqrt(_d*_d+_e*_e+_f*_f)); + } break; + default : break; + } + } + return r; +} +//_____________________________________________________________________________ +TH1F* AliAnalysisTaskRhoVnModulation::CorrectForResolutionDiff(TH1F* v, detectorType det, TArrayD* cen, Int_t c, Int_t h) +{ + // INTERFACE METHOD FOR OUTPUT FILE + // correct the supplied differential vn histogram v for detector resolution + TH1F* r(GetResolutionFromOuptutFile(det, h, cen)); + if(!r) { + printf(" > Couldn't find resolution < \n"); + return 0x0; + } + Double_t res(1./r->GetBinContent(1+r->FindBin(c))); + TF1* line = new TF1("line", "pol0", 0, 200); + line->SetParameter(0, res); + v->Multiply(line); + return v; +} +//_____________________________________________________________________________ +TH1F* AliAnalysisTaskRhoVnModulation::CorrectForResolutionInt(TH1F* v, detectorType det, TArrayD* cen, Int_t h) +{ + // INTERFACE METHOD FOR OUTPUT FILE + // correct the supplied intetrated vn histogram v for detector resolution + // integrated vn must have the same centrality binning as the resolotion correction + TH1F* r(GetResolutionFromOuptutFile(det, h, cen)); + v->Divide(v, r); + return v; +} +//_____________________________________________________________________________ +TH1F* AliAnalysisTaskRhoVnModulation::GetDifferentialQC(TProfile* refCumulants, TProfile* diffCumlants, TArrayD* ptBins, Int_t h) +{ + // get differential QC + Double_t r(refCumulants->GetBinContent(h-1)); // v2 reference flow + if(r > 0) r = TMath::Sqrt(r); + TH1F* qc = new TH1F(Form("QC2v%i", h), Form("QC2v%i", h), ptBins->GetSize()-1, ptBins->GetArray()); + Double_t a(0), b(0), c(0); // dummy variables + for(Int_t i(0); i < ptBins->GetSize(); i++) { + if(r > 0) { + a = diffCumlants->GetBinContent(1+i); + b = diffCumlants->GetBinError(1+i); + c = a/r; + qc->SetBinContent(1+i, c); + (a <= 0 || b <= 0) ? qc->SetBinError(1+i, b) : qc->SetBinError(1+i, TMath::Sqrt(c*c*b*b/(a*a))); + } + } + return qc; +} + +//_____________________________________________________________________________