From 6ff251d8697ea8246b30ffb1e67f29f816982790 Mon Sep 17 00:00:00 2001 From: cholm Date: Thu, 7 Jun 2012 22:20:20 +0000 Subject: [PATCH] Cleaned up error handling when missing corrections. Previously this would cause SIGSEGV at odd (but predicatable) places. Now, the tasks are marked as Zombie and no more processing will take place in that task. Cleaned up histogram handling in the event plane finder, and added some more diagnostics. Fixed some minor issues in the AOD train setup, and some minor things in the TrainSetup base class. --- .../AliCentralMCMultiplicityTask.cxx | 1 + .../analysis2/AliCentralMultiplicityTask.cxx | 29 +- .../analysis2/AliFMDEventPlaneFinder.cxx | 351 +++++++++--------- .../analysis2/AliFMDEventPlaneFinder.h | 99 +++-- .../AliForwardMCMultiplicityTask.cxx | 7 +- .../analysis2/AliForwardMCMultiplicityTask.h | 3 +- .../analysis2/AliForwardMultiplicityBase.cxx | 16 +- .../analysis2/AliForwardMultiplicityBase.h | 3 +- .../analysis2/AliForwardMultiplicityTask.cxx | 6 +- .../analysis2/AliForwardMultiplicityTask.h | 3 +- PWGLF/FORWARD/analysis2/AliForwardQATask.cxx | 5 +- PWGLF/FORWARD/analysis2/trains/MakeAODTrain.C | 50 ++- PWGLF/FORWARD/analysis2/trains/TrainSetup.C | 14 +- 13 files changed, 361 insertions(+), 226 deletions(-) diff --git a/PWGLF/FORWARD/analysis2/AliCentralMCMultiplicityTask.cxx b/PWGLF/FORWARD/analysis2/AliCentralMCMultiplicityTask.cxx index 612296ccafe..11fdf1201c3 100644 --- a/PWGLF/FORWARD/analysis2/AliCentralMCMultiplicityTask.cxx +++ b/PWGLF/FORWARD/analysis2/AliCentralMCMultiplicityTask.cxx @@ -131,6 +131,7 @@ void AliCentralMCMultiplicityTask::UserExec(Option_t* option) if (!ah->GetFillAOD() || fIvz <= 0) return; const AliMCEvent* mcEvent = MCEvent(); + if (!mcEvent) return; TH2D& hist = fAODMCCentral.GetHistogram(); Double_t vz = GetManager().GetSecMap()->GetVertexAxis().GetBinCenter(fIvz); diff --git a/PWGLF/FORWARD/analysis2/AliCentralMultiplicityTask.cxx b/PWGLF/FORWARD/analysis2/AliCentralMultiplicityTask.cxx index d3fcd37d8ee..5199f2cc0fa 100644 --- a/PWGLF/FORWARD/analysis2/AliCentralMultiplicityTask.cxx +++ b/PWGLF/FORWARD/analysis2/AliCentralMultiplicityTask.cxx @@ -190,6 +190,7 @@ AliCentralMultiplicityTask::GetESDEvent() // Get the ESD event. IF this is the first event, initialise // DGUARD(fDebug,1,"Get ESD event in AliCentralMultiplicityTask"); + if (IsZombie()) return 0; AliESDEvent* esd = dynamic_cast(InputEvent()); if (!esd) { AliWarning("No ESD event found for input event"); @@ -207,13 +208,26 @@ AliCentralMultiplicityTask::GetESDEvent() GetManager().Init(fInspector.GetCollisionSystem(), fInspector.GetEnergy(), fInspector.GetField()); - AliInfo("Manager of corrections in AliCentralMultiplicityTask init"); + //AliInfo("Manager of corrections in AliCentralMultiplicityTask init"); + } + Bool_t ok = true; + if (!GetManager().HasSecondaryCorrection()) { + ok = false; + AliError("No secondary correction defined!"); + } + if (!GetManager().HasAcceptanceCorrection()) { + ok = false; + AliError("No acceptance correction defined!"); + } + // If the corrections are not seen, make this a zombie, and prevent + // further execution of this task. + if (!ok) { + AliError("Missing corrections, make this a zombie"); + SetZombie(true); + esd = 0; + fFirstEventSeen = true; + return esd; } - if (!GetManager().HasSecondaryCorrection()) - AliFatal("No secondary correction defined!"); - if (!GetManager().HasAcceptanceCorrection()) - AliFatal("No acceptance correction defined!"); - // Check for existence and get secondary map AliCentralCorrSecondaryMap* secMap = GetManager().GetSecMap(); @@ -394,7 +408,8 @@ void AliCentralMultiplicityTask::UserExec(Option_t* /*option*/) fIvz = 0; AliESDEvent* esd = GetESDEvent(); - + if (!esd) return; + Bool_t lowFlux = kFALSE; UInt_t triggers = 0; UShort_t ivz = 0; diff --git a/PWGLF/FORWARD/analysis2/AliFMDEventPlaneFinder.cxx b/PWGLF/FORWARD/analysis2/AliFMDEventPlaneFinder.cxx index abae40dd70e..6dcbcfaffd0 100644 --- a/PWGLF/FORWARD/analysis2/AliFMDEventPlaneFinder.cxx +++ b/PWGLF/FORWARD/analysis2/AliFMDEventPlaneFinder.cxx @@ -37,16 +37,18 @@ AliFMDEventPlaneFinder::AliFMDEventPlaneFinder() fQ1(), fQ2(), fQeta(), - fHistFMDEventplane(0), - fHistFMDEventplaneA(0), - fHistFMDEventplaneC(0), - fHistFMDEventplane1(0), - fHistFMDEventplane2(0), - fHistPhiDist(0), - fHistFMDmTPCep(0), - fHistFMDvsTPCep(0), - fHistFMDmVZEROep(0), - fHistFMDvsVZEROep(0), + fHepFMD(0), + fHepFMDA(0), + fHepFMDC(0), + fHepFMDQC1(0), + fHepFMDQC2(0), + fHdiffFMDAC(0), + fHdiffFMDTPC(0), + fHdiffFMDVZERO(0), + fHcorrFMDAC(0), + fHcorrFMDTPC(0), + fHcorrFMDVZERO(0), + fHPhi(0), fDebug(0), fOADBFileName(0), fOADBContainer(0), @@ -72,16 +74,18 @@ AliFMDEventPlaneFinder::AliFMDEventPlaneFinder(const char* title) fQ1(), fQ2(), fQeta(), - fHistFMDEventplane(0), - fHistFMDEventplaneA(0), - fHistFMDEventplaneC(0), - fHistFMDEventplane1(0), - fHistFMDEventplane2(0), - fHistPhiDist(0), - fHistFMDmTPCep(0), - fHistFMDvsTPCep(0), - fHistFMDmVZEROep(0), - fHistFMDvsVZEROep(0), + fHepFMD(0), + fHepFMDA(0), + fHepFMDC(0), + fHepFMDQC1(0), + fHepFMDQC2(0), + fHdiffFMDAC(0), + fHdiffFMDTPC(0), + fHdiffFMDVZERO(0), + fHcorrFMDAC(0), + fHcorrFMDTPC(0), + fHcorrFMDVZERO(0), + fHPhi(0), fDebug(0), fOADBFileName(0), fOADBContainer(0), @@ -110,16 +114,18 @@ AliFMDEventPlaneFinder::AliFMDEventPlaneFinder(const fQ1(o.fQ1), fQ2(o.fQ2), fQeta(o.fQeta), - fHistFMDEventplane(o.fHistFMDEventplane), - fHistFMDEventplaneA(o.fHistFMDEventplaneA), - fHistFMDEventplaneC(o.fHistFMDEventplaneC), - fHistFMDEventplane1(o.fHistFMDEventplane1), - fHistFMDEventplane2(o.fHistFMDEventplane2), - fHistPhiDist(o.fHistPhiDist), - fHistFMDmTPCep(o.fHistFMDmTPCep), - fHistFMDvsTPCep(o.fHistFMDvsTPCep), - fHistFMDmVZEROep(o.fHistFMDmVZEROep), - fHistFMDvsVZEROep(o.fHistFMDvsVZEROep), + fHepFMD(o.fHepFMD), + fHepFMDA(o.fHepFMDA), + fHepFMDC(o.fHepFMDC), + fHepFMDQC1(o.fHepFMDQC1), + fHepFMDQC2(o.fHepFMDQC2), + fHdiffFMDAC(o.fHdiffFMDAC), + fHdiffFMDTPC(o.fHdiffFMDTPC), + fHdiffFMDVZERO(o.fHdiffFMDVZERO), + fHcorrFMDAC(o.fHcorrFMDAC), + fHcorrFMDTPC(o.fHcorrFMDTPC), + fHcorrFMDVZERO(o.fHcorrFMDVZERO), + fHPhi(o.fHPhi), fDebug(o.fDebug), fOADBFileName(o.fOADBFileName), fOADBContainer(o.fOADBContainer), @@ -161,34 +167,91 @@ AliFMDEventPlaneFinder::operator=(const AliFMDEventPlaneFinder& o) if (&o == this) return *this; TNamed::operator=(o); - fList = o.fList; - fEvent = o.fEvent; - fQt = o.fQt; - fQa = o.fQa; - fQc = o.fQc; - fQ1 = o.fQ1; - fQ2 = o.fQ2; - fQeta = o.fQeta; - fHistFMDEventplane = o.fHistFMDEventplane; - fHistFMDEventplaneA = o.fHistFMDEventplaneA; - fHistFMDEventplaneC = o.fHistFMDEventplaneC; - fHistFMDEventplane1 = o.fHistFMDEventplane1; - fHistFMDEventplane2 = o.fHistFMDEventplane2; - fHistPhiDist = o.fHistPhiDist; - fHistFMDmTPCep = o.fHistFMDmTPCep; - fHistFMDvsTPCep = o.fHistFMDvsTPCep; - fHistFMDmVZEROep = o.fHistFMDmVZEROep; - fHistFMDvsVZEROep = o.fHistFMDvsVZEROep; - fDebug = o.fDebug; - fOADBFileName = o.fOADBFileName; - fOADBContainer = o.fOADBContainer; - fPhiDist = o.fPhiDist; - fRunNumber = o.fRunNumber; - fUsePhiWeights = o.fUsePhiWeights; + fList = o.fList; + fEvent = o.fEvent; + fQt = o.fQt; + fQa = o.fQa; + fQc = o.fQc; + fQ1 = o.fQ1; + fQ2 = o.fQ2; + fQeta = o.fQeta; + fHepFMD = o.fHepFMD; + fHepFMDA = o.fHepFMDA; + fHepFMDC = o.fHepFMDC; + fHepFMDQC1 = o.fHepFMDQC1; + fHepFMDQC2 = o.fHepFMDQC2; + fHdiffFMDAC = o.fHdiffFMDAC; + fHdiffFMDTPC = o.fHdiffFMDTPC; + fHdiffFMDVZERO = o.fHdiffFMDVZERO; + fHcorrFMDAC = o.fHcorrFMDAC; + fHcorrFMDTPC = o.fHcorrFMDTPC; + fHcorrFMDVZERO = o.fHcorrFMDVZERO; + fHPhi = o.fHPhi; + fDebug = o.fDebug; + fOADBFileName = o.fOADBFileName; + fOADBContainer = o.fOADBContainer; + fPhiDist = o.fPhiDist; + fRunNumber = o.fRunNumber; + fUsePhiWeights = o.fUsePhiWeights; return *this; } +//____________________________________________________________________ +TH1D* +AliFMDEventPlaneFinder::MakePsiRHist(const char* name, + const char* title, + Int_t color) +{ + // Generate a 1D histogram of Psi_R. + TH1D* ret = new TH1D(name, Form("#Psi_{R} - %s",title), 100, 0, TMath::Pi()); + ret->SetDirectory(0); + ret->SetXTitle("#Psi_{R} [radians]"); + ret->SetYTitle("Events"); + ret->SetLineColor(color); + ret->SetFillColor(color); + ret->SetFillStyle(3001); + ret->Sumw2(); + fList->Add(ret); + return ret; +} +//____________________________________________________________________ +TH1D* +AliFMDEventPlaneFinder::MakeDiffHist(const char* name, + const char* first, + const char* second, + Int_t color) +{ + TH1D* ret = new TH1D(name, Form("#Delta#Psi_{R} - %s minus %s",first,second), + 100, -TMath::Pi()/2, +TMath::Pi()/2); + ret->SetDirectory(0); + ret->SetXTitle(Form("#Psi_{R,%s}-#Psi_{R,%s} [radians]", first, second)); + ret->SetYTitle("Events"); + ret->SetLineColor(color); + ret->SetFillColor(color); + ret->SetFillStyle(3001); + ret->Sumw2(); + fList->Add(ret); + return ret; + +} +//____________________________________________________________________ +TH2F* +AliFMDEventPlaneFinder::MakeCorrHist(const char* name, + const char* first, + const char* second) +{ + TH2F* ret = new TH2F(name, Form("#Psi_{R} - %s vs %s", first, second), + 100, 0, TMath::Pi(), 100, 0, TMath::Pi()); + ret->SetDirectory(0); + ret->Sumw2(); + ret->SetXTitle(Form("#Psi_{R,%s} [radians]", first)); + ret->SetYTitle(Form("#Psi_{R,%s} [radians]", second)); + ret->SetZTitle("Events"); + fList->Add(ret); + return ret; +} + //____________________________________________________________________ void AliFMDEventPlaneFinder::Init(const TAxis& etaAxis) @@ -199,81 +262,32 @@ AliFMDEventPlaneFinder::Init(const TAxis& etaAxis) // etaAxis fmd eta axis binning // DGUARD(fDebug,1,"Initalization of AliFMDEventPlaneFinder"); - fHistFMDEventplane = new TH1D("hFMDEventplane", "FMD eventplane", - 100, 0., TMath::Pi()); - fHistFMDEventplane->Sumw2(); - fHistFMDEventplane->SetDirectory(0); - fList->Add(fHistFMDEventplane); - // - fHistFMDEventplaneA = new TH1D("hFMDEventplaneA", "FMD eventplaneA", - 100, 0., TMath::Pi()); - fHistFMDEventplaneA->Sumw2(); - fHistFMDEventplaneA->SetDirectory(0); - fList->Add(fHistFMDEventplaneA); - - // - fHistFMDEventplaneC = new TH1D("hFMDEventplaneC", "FMD eventplaneC", - 100, 0., TMath::Pi()); - fHistFMDEventplaneC->Sumw2(); - fHistFMDEventplaneC->SetDirectory(0); - fList->Add(fHistFMDEventplaneC); + fHepFMD = MakePsiRHist("epFMD", "FMD", kRed+1); + fHepFMDA = MakePsiRHist("epFMDA","FMD - A side", kGreen+1); + fHepFMDC = MakePsiRHist("epFMDC","FMD - C side", kBlue+1); + fHepFMDQC1 = MakePsiRHist("epFMDQC1", "FMD QC{1}", kMagenta+1); + fHepFMDQC2 = MakePsiRHist("epEMDQC2", "FMD QC{2}", kCyan+1); - // - fHistFMDEventplane1 = new TH1D("hFMDEventplane1", "FMD eventplane1", - 100, 0., TMath::Pi()); - fHistFMDEventplane1->Sumw2(); - fHistFMDEventplane1->SetDirectory(0); - fList->Add(fHistFMDEventplane1); - - // - fHistFMDEventplane2 = new TH1D("hFMDEventplane2", "FMD eventplane2", - 100, 0., TMath::Pi()); - fHistFMDEventplane2->Sumw2(); - fHistFMDEventplane2->SetDirectory(0); - fList->Add(fHistFMDEventplane2); + fHdiffFMDAC = MakeDiffHist("diffFMDAC", "FMD-A", "FMD-C", kRed+1); + fHdiffFMDTPC = MakeDiffHist("diffFMDTPC", "FMD", "TPC", kGreen+1); + fHdiffFMDVZERO = MakeDiffHist("diffFMDVZERO", "FMD", "VZERO", kBlue+1); + fHcorrFMDAC = MakeCorrHist("corrFMDAC", "FMD-A", "FMD-C"); + fHcorrFMDTPC = MakeCorrHist("corrFMDTPC", "FMD", "TPC"); + fHcorrFMDVZERO = MakeCorrHist("corrFMDVZERO", "FMD", "VZERO"); // - fHistPhiDist = new TH2D("hPhiDist", "Phi distribution in FMD", - etaAxis.GetNbins(), etaAxis.GetXmin(), etaAxis.GetXmax(), - 20, 0., TMath::TwoPi()); - fHistPhiDist->Sumw2(); - fHistPhiDist->SetDirectory(0); - fList->Add(fHistPhiDist); + fHPhi = new TH2D("hPhi", "Phi distribution in FMD", + etaAxis.GetNbins(), etaAxis.GetXmin(), etaAxis.GetXmax(), + 20, 0., TMath::TwoPi()); + fHPhi->Sumw2(); + fHPhi->SetXTitle("#eta"); + fHPhi->SetYTitle("#phi [radians]"); + fHPhi->SetZTitle("Events"); + fHPhi->SetDirectory(0); + fList->Add(fHPhi); // - fHistFMDmTPCep = new TH1D("hFMDmTPCep", - "Eventplane from FMD - TPC", - 100, -TMath::Pi()/2., TMath::Pi()/2.); - fHistFMDmTPCep->Sumw2(); - fHistFMDmTPCep->SetDirectory(0); - fList->Add(fHistFMDmTPCep); - - // - fHistFMDvsTPCep = new TH2F("hFMDvsTPCep", - "Eventplane from FMD vs. TPC", - 100, 0., TMath::Pi(), - 100, 0., TMath::Pi()); - fHistFMDvsTPCep->Sumw2(); - fHistFMDvsTPCep->SetDirectory(0); - fList->Add(fHistFMDvsTPCep); - - // - fHistFMDmVZEROep = new TH1D("hFMDmVZEROep", - "Eventplane from FMD - VZERO", - 100, -TMath::Pi()/2., TMath::Pi()/2.); - fHistFMDmVZEROep->Sumw2(); - fHistFMDmVZEROep->SetDirectory(0); - fList->Add(fHistFMDmVZEROep); - - // - fHistFMDvsVZEROep = new TH2F("hFMDvsVZEROep", - "Eventplane from FMD vs. VZERO", - 100, 0., TMath::Pi(), - 100, 0., TMath::Pi()); - fHistFMDvsVZEROep->Sumw2(); - fHistFMDvsVZEROep->SetDirectory(0); - fList->Add(fHistFMDvsVZEROep); if (!fUsePhiWeights) return; @@ -287,7 +301,8 @@ AliFMDEventPlaneFinder::Init(const TAxis& etaAxis) return; } fOADBContainer = (AliOADBContainer*)foadb.Get("FMDphidist"); - if (!fOADBContainer) AliError(Form("No OADB container found in %s", fOADBFileName.Data())); + if (!fOADBContainer) + AliError(Form("No OADB container found in %s", fOADBFileName.Data())); foadb.Close(); return; @@ -384,9 +399,9 @@ AliFMDEventPlaneFinder::CalcQVectors(TH2D* h, TH1D* eHist) weight = h->GetBinContent(e, 4); if (fUsePhiWeights) weight *= GetPhiWeight(e, 4); } - fHistPhiDist->Fill(eta, phi, weight); + fHPhi->Fill(eta, phi, weight); // for underflowbin total Nch/eta - fHistPhiDist->Fill(eta, -1., weight); + fHPhi->Fill(eta, -1., weight); // increment Q vectors qx += weight*TMath::Cos(2.*phi); @@ -428,6 +443,16 @@ AliFMDEventPlaneFinder::CalcEventplane(const TVector2& v) const return ep; } +//_____________________________________________________________________ +Double_t +AliFMDEventPlaneFinder::CalcDifference(Double_t a1, Double_t a2) const +{ + Double_t diff = a1 - a2; + if (diff < TMath::Pi()/2) diff = TMath::Pi() - diff; + if (diff >= TMath::Pi()/2) diff = TMath::Pi() - diff; + return diff; +} + //_____________________________________________________________________ void AliFMDEventPlaneFinder::FillHists(AliAODForwardEP* fmdEP) @@ -443,44 +468,26 @@ AliFMDEventPlaneFinder::FillHists(AliAODForwardEP* fmdEP) // Double_t fmdEP2 = fmdEP->GetEventplane2(); // FMD hists - fHistFMDEventplane->Fill(fmdEPt); - fHistFMDEventplaneA->Fill(fmdEPa); - fHistFMDEventplaneC->Fill(fmdEPc); -// fHistFMDEventplane1->Fill(fmdEP1); -// fHistFMDEventplane2->Fill(fmdEP2); + fHepFMD->Fill(fmdEPt); + fHepFMDA->Fill(fmdEPa); + fHepFMDC->Fill(fmdEPc); + + fHdiffFMDAC->Fill(CalcDifference(fmdEPa,fmdEPc)); + fHcorrFMDAC->Fill(fmdEPa, fmdEPc); + // fHepFMDQC1->Fill(fmdEP1); + // fHepFMDQC2->Fill(fmdEP2); // TPC comparison AliEventplane* ep = fEvent->GetEventplane(); - Double_t tpcEP = -1; - if (ep) tpcEP = ep->GetEventplane("Q"); - - Double_t diffTPC = fmdEPt - tpcEP; - - if (diffTPC < TMath::Pi()/2.) diffTPC = TMath::Pi() - diffTPC; - if (diffTPC >= TMath::Pi()/2.) diffTPC = TMath::Pi() - diffTPC; - - fHistFMDmTPCep->Fill(diffTPC); - -// if (fmdEPt >= TMath::Pi()/2. && fmdEPt - tpcEP >= TMath::Pi()/2.) tpcEP = TMath::Pi()-tpcEP; -// if (fmdEPt < TMath::Pi()/2. && tpcEP - fmdEPt >= TMath::Pi()/2.) tpcEP = TMath::Pi()-tpcEP; - - fHistFMDvsTPCep->Fill(fmdEPt, tpcEP); + Double_t tpcEP = (ep ? ep->GetEventplane("Q") : -1); + fHdiffFMDTPC->Fill(CalcDifference(fmdEPt, tpcEP)); + fHcorrFMDTPC->Fill(fmdEPt, tpcEP); // VZERO comparison - Double_t vzeroEP = -1; - if (ep) vzeroEP = ep->GetEventplane("V0", fEvent, 2); - - Double_t diffVZERO = fmdEPt - vzeroEP; - - if (diffVZERO < TMath::Pi()/2.) diffVZERO = TMath::Pi() - diffVZERO; - if (diffVZERO >= TMath::Pi()/2.) diffVZERO = TMath::Pi() - diffVZERO; - - fHistFMDmVZEROep->Fill(diffVZERO); - -// if (fmdEPt >= TMath::Pi()/2. && fmdEPt - vzeroEP >= TMath::Pi()/2.) vzeroEP = TMath::Pi()-vzeroEP; -// if (fmdEPt < TMath::Pi()/2. && vzeroEP - fmdEPt >= TMath::Pi()/2.) vzeroEP = TMath::Pi()-vzeroEP; - - fHistFMDvsVZEROep->Fill(fmdEPt, vzeroEP); + Double_t vzeroEP = ep ? ep->GetEventplane("V0", fEvent, 2) : -1; + fHdiffFMDVZERO->Fill(CalcDifference(fmdEPt, vzeroEP)); + fHcorrFMDVZERO->Fill(fmdEPt, vzeroEP); + return; } @@ -493,13 +500,13 @@ AliFMDEventPlaneFinder::GetPhiWeight(Int_t etaBin, Int_t phiBin) const // Double_t phiWeight = 1; - if (fPhiDist) { - Double_t nParticles = fPhiDist->GetBinContent(etaBin, 0); - Double_t nPhiBins = fPhiDist->GetNbinsY(); - Double_t phiDistValue = fPhiDist->GetBinContent(etaBin, phiBin); - - if (phiDistValue > 0) phiWeight = nParticles/nPhiBins/phiDistValue; - } + if (!fPhiDist) return phiWeight; + + Double_t nParticles = fPhiDist->GetBinContent(etaBin, 0); + Double_t nPhiBins = fPhiDist->GetNbinsY(); + Double_t phiDistValue = fPhiDist->GetBinContent(etaBin, phiBin); + + if (phiDistValue > 0) phiWeight = nParticles/nPhiBins/phiDistValue; return phiWeight; } @@ -528,7 +535,9 @@ AliFMDEventPlaneFinder::GetPhiDist() // if (!fOADBContainer) return; - fPhiDist = (TH2D*)fOADBContainer->GetObject(fRunNumber, "Default")->Clone(Form("fPhiDist_%d", fRunNumber)); + fPhiDist = static_cast(fOADBContainer + ->GetObject(fRunNumber, "Default") + ->Clone(Form("fPhiDist_%d", fRunNumber))); fList->Add(fPhiDist); return; @@ -550,11 +559,11 @@ AliFMDEventPlaneFinder::Print(Option_t* /*option*/) const std::cout << ind << ClassName() << ": " << GetName() << '\n' << std::boolalpha << ind << "Eventplane finder active!" << '\n' - << ind << "Loading OADB object for run number: " << fRunNumber << '\n' - << ind << "Using phi weights: " << (fUsePhiWeights ? "true" : "false") << '\n' + << ind << "Loading OADB object for run number: " + << fRunNumber << '\n' + << ind << "Using phi weights: " << fUsePhiWeights << '\n' << std::noboolalpha - << std::flush; - std::cout << std::endl; + << std::endl; } //____________________________________________________________________ // diff --git a/PWGLF/FORWARD/analysis2/AliFMDEventPlaneFinder.h b/PWGLF/FORWARD/analysis2/AliFMDEventPlaneFinder.h index 13d07c6306a..3a7af3b9fc7 100644 --- a/PWGLF/FORWARD/analysis2/AliFMDEventPlaneFinder.h +++ b/PWGLF/FORWARD/analysis2/AliFMDEventPlaneFinder.h @@ -158,31 +158,80 @@ protected: * @return phi weight for etaBin, phiBin as double */ Double_t GetPhiWeight(Int_t etaBin, Int_t phiBin) const; - - TList* fList; // List for diag. hists. - AliVEvent* fEvent; // Current event - TVector2 fQt; // Q vector for total ep - TVector2 fQa; // Q vector for sub-ep A - TVector2 fQc; // Q vector for sub-ep C - TVector2 fQ1; // Q vector for sub-ep 1 - TVector2 fQ2; // Q vector for sub-ep 2 - TVector2 fQeta; // Q vector for psi eta-dependence - TH1D* fHistFMDEventplane; // Diagnostics histogram - TH1D* fHistFMDEventplaneA;// Diagnostics histogram - TH1D* fHistFMDEventplaneC;// Diagnostics histogram - TH1D* fHistFMDEventplane1;// Diagnostics histogram - TH1D* fHistFMDEventplane2;// Diagnostics histogram - TH2D* fHistPhiDist; // Diagnostics histogram - TH1D* fHistFMDmTPCep; // Diagnostics histogram - TH2F* fHistFMDvsTPCep; // Diagnostics histogram - TH1D* fHistFMDmVZEROep; // Diagnostics histogram - TH2F* fHistFMDvsVZEROep; // Diagnostics histogram - Int_t fDebug; // Debug flag - TString fOADBFileName; // Path to OADB container - AliOADBContainer* fOADBContainer; // OADBContainer object - TH2D* fPhiDist; // Phi dist. for phi weights - Int_t fRunNumber; // Run number supplied - Bool_t fUsePhiWeights; // Flag for phi weights + /** + * Calculat the difference @f$a_1 - a_2@$f between two angles + * @f$a_1, a_2@f$ and normalize to @f$[-\pi/2,\pi/2]@f$ + * + * @param a1 First angle @f$a_1@f$ + * @param a2 Second angle @f$a_2@f$ + * + * @return @f$a_1 - a_2 \in[-\pi/2,\pi/2]@f$ + */ + Double_t CalcDifference(Double_t a1, Double_t a2) const; + /** + * Make a histogram of @f$\Psi_R@f$ values + * + * @param name Name of histogram + * @param title Source + * @param color Color of histogram + * + * @return Newly allocated histogram + */ + TH1D* MakePsiRHist(const char* name, + const char* title, + Int_t color); + /** + * Make a difference histogram, and add to the output list + * + * @param name Name of histogram + * @param first First variable to correlate (X axis) + * @param second Second variable to correlate (Y axis) + * @param color Fill and line color of histogram + * + * @return Newly allocated histogram + */ + TH1D* MakeDiffHist(const char* name, + const char* first, + const char* second, + Int_t color); + /** + * Make a correlation histogram, and add it to the output list. + * + * @param name Name of histogram + * @param first First variable to correlate (X axis) + * @param second Second variable to correlate (Y axis) + * + * @return Newly allocated histogram + */ + TH2F* MakeCorrHist(const char* name, + const char* first, + const char* second); + TList* fList; // List for diag. hists. + AliVEvent* fEvent; // Current event + TVector2 fQt; // Q vector for total ep + TVector2 fQa; // Q vector for sub-ep A + TVector2 fQc; // Q vector for sub-ep C + TVector2 fQ1; // Q vector for sub-ep 1 + TVector2 fQ2; // Q vector for sub-ep 2 + TVector2 fQeta; // Q vector for psi eta-dependence + TH1D* fHepFMD; // Diagnostics histogram + TH1D* fHepFMDA; // Diagnostics histogram + TH1D* fHepFMDC; // Diagnostics histogram + TH1D* fHepFMDQC1; // Diagnostics histogram + TH1D* fHepFMDQC2; // Diagnostics histogram + TH1D* fHdiffFMDAC; // Diagnostics histogram + TH1D* fHdiffFMDTPC; // Diagnostics histogram + TH1D* fHdiffFMDVZERO; // Diagnostics histogram + TH2F* fHcorrFMDAC; // Diagnostics histogram + TH2F* fHcorrFMDTPC; // Diagnostics histogram + TH2F* fHcorrFMDVZERO; // Diagnostics histogram + TH2D* fHPhi; // Diagnostics histogram + Int_t fDebug; // Debug flag + TString fOADBFileName; // Path to OADB container + AliOADBContainer* fOADBContainer; // OADBContainer object + TH2D* fPhiDist; // Phi dist. for phi weights + Int_t fRunNumber; // Run number supplied + Bool_t fUsePhiWeights; // Flag for phi weights ClassDef(AliFMDEventPlaneFinder,1); // }; diff --git a/PWGLF/FORWARD/analysis2/AliForwardMCMultiplicityTask.cxx b/PWGLF/FORWARD/analysis2/AliForwardMCMultiplicityTask.cxx index 9a1328233ea..aa5719d6759 100644 --- a/PWGLF/FORWARD/analysis2/AliForwardMCMultiplicityTask.cxx +++ b/PWGLF/FORWARD/analysis2/AliForwardMCMultiplicityTask.cxx @@ -179,7 +179,7 @@ AliForwardMCMultiplicityTask::SetOnlyPrimary(Bool_t use) } //____________________________________________________________________ -void +Bool_t AliForwardMCMultiplicityTask::InitializeSubs() { // @@ -189,7 +189,7 @@ AliForwardMCMultiplicityTask::InitializeSubs() const TAxis* pe = 0; const TAxis* pv = 0; - if (!ReadCorrections(pe,pv,true)) return; + if (!ReadCorrections(pe,pv,true)) return false; fHistos.Init(*pe); fAODFMD.Init(*pe); @@ -247,6 +247,8 @@ AliForwardMCMultiplicityTask::InitializeSubs() fEventPlaneFinder.Init(*pe); this->Print(); + + return true; } //____________________________________________________________________ @@ -312,6 +314,7 @@ AliForwardMCMultiplicityTask::UserExec(Option_t*) // Get the input data AliESDEvent* esd = GetESDEvent(); AliMCEvent* mcEvent = MCEvent(); + if (!esd || !mcEvent) return; // Clear stuff fHistos.Clear(); diff --git a/PWGLF/FORWARD/analysis2/AliForwardMCMultiplicityTask.h b/PWGLF/FORWARD/analysis2/AliForwardMCMultiplicityTask.h index ca2d20a22eb..20c7a229724 100644 --- a/PWGLF/FORWARD/analysis2/AliForwardMCMultiplicityTask.h +++ b/PWGLF/FORWARD/analysis2/AliForwardMCMultiplicityTask.h @@ -196,8 +196,9 @@ protected: /** * Initialise the sub objects and stuff. Called on first event * + * @return false on errors */ - virtual void InitializeSubs(); + virtual Bool_t InitializeSubs(); TH2D* fHData; // Summed 1/Nd^2N_{ch}/dphideta AliESDFMD fESDFMD; // Sharing corrected ESD object diff --git a/PWGLF/FORWARD/analysis2/AliForwardMultiplicityBase.cxx b/PWGLF/FORWARD/analysis2/AliForwardMultiplicityBase.cxx index 503af41c579..137300169f5 100644 --- a/PWGLF/FORWARD/analysis2/AliForwardMultiplicityBase.cxx +++ b/PWGLF/FORWARD/analysis2/AliForwardMultiplicityBase.cxx @@ -170,7 +170,10 @@ AliForwardMultiplicityBase::ReadCorrections(const TAxis*& pe, GetEventInspector().GetEnergy(), GetEventInspector().GetField(), mc, - what)) return false; + what)) { + AliWarning("Failed to read in some corrections, making task zombie"); + return false; + } if (!CheckCorrections(what)) return false; // Sett our persistency pointer @@ -197,6 +200,7 @@ AliForwardMultiplicityBase::GetESDEvent() // Get the ESD event. IF this is the first event, initialise // DGUARD(fDebug,1,"Get the ESD event"); + if (IsZombie()) return 0; AliESDEvent* esd = dynamic_cast(InputEvent()); if (!esd) { AliWarning("No ESD event found for input event"); @@ -212,7 +216,7 @@ AliForwardMultiplicityBase::GetESDEvent() " AliESDEvent::GetBeamType() ->%s\n" " AliESDEvent::GetCurrentL3() ->%f\n" " AliESDEvent::GetMagneticField()->%f\n" - " AliESDEvent::GetRunNumber() ->%d\n", + " AliESDEvent::GetRunNumber() ->%d", esd->GetBeamEnergy(), esd->GetBeamType(), esd->GetCurrentL3(), @@ -222,7 +226,13 @@ AliForwardMultiplicityBase::GetESDEvent() fFirstEvent = false; GetEventPlaneFinder().SetRunNumber(esd->GetRunNumber()); - InitializeSubs(); + if (!InitializeSubs()) { + AliError("Failed to initialize sub-algorithms, making this a zombie"); + esd = 0; // Make sure we do nothing on this event + Info("GetESDEvent", "ESD event pointer %p", esd); + SetZombie(true); + // return 0; + } } return esd; } diff --git a/PWGLF/FORWARD/analysis2/AliForwardMultiplicityBase.h b/PWGLF/FORWARD/analysis2/AliForwardMultiplicityBase.h index 0726ab84698..59b4a3c3bdb 100644 --- a/PWGLF/FORWARD/analysis2/AliForwardMultiplicityBase.h +++ b/PWGLF/FORWARD/analysis2/AliForwardMultiplicityBase.h @@ -287,8 +287,9 @@ protected: /** * Initialise the sub objects and stuff. Called on first event * + * @return false on errors */ - virtual void InitializeSubs() = 0; + virtual Bool_t InitializeSubs() = 0; /** * Mark this event as one to store in the AOD * diff --git a/PWGLF/FORWARD/analysis2/AliForwardMultiplicityTask.cxx b/PWGLF/FORWARD/analysis2/AliForwardMultiplicityTask.cxx index e297db0af33..fe6df3a371e 100644 --- a/PWGLF/FORWARD/analysis2/AliForwardMultiplicityTask.cxx +++ b/PWGLF/FORWARD/analysis2/AliForwardMultiplicityTask.cxx @@ -156,7 +156,7 @@ AliForwardMultiplicityTask::SetDebug(Int_t dbg) } //____________________________________________________________________ -void +Bool_t AliForwardMultiplicityTask::InitializeSubs() { // @@ -167,7 +167,7 @@ AliForwardMultiplicityTask::InitializeSubs() const TAxis* pe = 0; const TAxis* pv = 0; - if (!ReadCorrections(pe,pv)) return; + if (!ReadCorrections(pe,pv)) return false; fHistos.Init(*pe); fAODFMD.Init(*pe); @@ -203,6 +203,7 @@ AliForwardMultiplicityTask::InitializeSubs() fEventPlaneFinder.Init(*pe); this->Print(); + return true; } //____________________________________________________________________ @@ -253,6 +254,7 @@ AliForwardMultiplicityTask::UserExec(Option_t*) // cnt++; // Get the input data AliESDEvent* esd = GetESDEvent(); + if (!esd) return; // Clear stuff fHistos.Clear(); diff --git a/PWGLF/FORWARD/analysis2/AliForwardMultiplicityTask.h b/PWGLF/FORWARD/analysis2/AliForwardMultiplicityTask.h index bcef9606f5e..1cda8de499f 100644 --- a/PWGLF/FORWARD/analysis2/AliForwardMultiplicityTask.h +++ b/PWGLF/FORWARD/analysis2/AliForwardMultiplicityTask.h @@ -187,8 +187,9 @@ protected: /** * Initialise the sub objects and stuff. Called on first event * + * @return false on errors */ - virtual void InitializeSubs(); + virtual Bool_t InitializeSubs(); TH2D* fHData; // Summed 1/Nd^2N_{ch}/dphideta AliESDFMD fESDFMD; // Sharing corrected ESD object diff --git a/PWGLF/FORWARD/analysis2/AliForwardQATask.cxx b/PWGLF/FORWARD/analysis2/AliForwardQATask.cxx index 01184f1bf79..802b4c5fd6b 100644 --- a/PWGLF/FORWARD/analysis2/AliForwardQATask.cxx +++ b/PWGLF/FORWARD/analysis2/AliForwardQATask.cxx @@ -230,6 +230,7 @@ AliForwardQATask::GetESDEvent() // // Get the ESD event. IF this is the first event, initialise // + if (IsZombie()) return 0; AliESDEvent* esd = dynamic_cast(InputEvent()); if (!esd) { AliWarning("No ESD event found for input event"); @@ -245,7 +246,7 @@ AliForwardQATask::GetESDEvent() " AliESDEvent::GetBeamType() ->%s\n" " AliESDEvent::GetCurrentL3() ->%f\n" " AliESDEvent::GetMagneticField()->%f\n" - " AliESDEvent::GetRunNumber() ->%d\n", + " AliESDEvent::GetRunNumber() ->%d", esd->GetBeamEnergy(), esd->GetBeamType(), esd->GetCurrentL3(), @@ -255,6 +256,8 @@ AliForwardQATask::GetESDEvent() if (!InitializeSubs()) { AliWarning("Initialisation of sub algorithms failed!"); + SetZombie(true); + esd = 0; return 0; } AliInfoF("Clearing first event flag from %s to false", diff --git a/PWGLF/FORWARD/analysis2/trains/MakeAODTrain.C b/PWGLF/FORWARD/analysis2/trains/MakeAODTrain.C index 535dea0f0ee..6a407650886 100644 --- a/PWGLF/FORWARD/analysis2/trains/MakeAODTrain.C +++ b/PWGLF/FORWARD/analysis2/trains/MakeAODTrain.C @@ -210,23 +210,53 @@ protected: } //__________________________________________________________________ - void SaveSetupROOT(Runner& r, Int_t nEvents) + void SaveSetupShell(Runner& r, Int_t nEvents) { - TrainSetup::SaveSetup(r, nEvents); + TrainSetup::SaveSetupShell(r, nEvents); - TString base(Form("dndeta_%s", fEscapedName.Data())); + std::ofstream o("dNdeta.sh"); + o << "#!/bin/bash\n\n" + << "oper=$1\n" + << "if test x$oper = x ; then oper=full ; fi\n\n" + << "class=MakedNdetaTrain\n" + << "name=" << fName << "_dNdeta\n" + << "nev=" << nEvents << "\n\n" + << "opts=(--class=$class \\\n" + << " --name=$name \\\n" + << " --events=$nev \\\n"; + for (Int_t i = 0; i < fRunNumbers.GetSize(); i++) + o << " --run=" << fRunNumbers.At(i) << " \\\n"; + TrainSetup::SaveOptions(o, "--", r); + if (fUseCent) o << " --cent \\\n" + o << " --type=AOD \\\n" + << " --trig=INEL \\\n" + << " --vzMin=-10 \\\n" + << " --vzMax=10 \\\n" + << " --scheme=full \\\n" + << " --datadir=" << GetOutputDirectory(fExecMode) << " \\\n" + << " --oper=$oper)\n\n" + << "echo \"Running runTrain ${opts[@]}\"\n" + << "runTrain \"${opts[@]}\"\n\n" + << "# EOF\n" << std::endl; + o.close(); + gSystem->Exec("chmod a+x dNdeta.sh"); + } + //__________________________________________________________________ + void SaveSetupROOT(Runner& r, Int_t nEvents) + { + TrainSetup::SaveSetupROOT(r, nEvents); - std::ofstream o(Form("%s.C", base.Data())); - o << "void " << base << "()\n" + std::ofstream o("dNdeta.C"); + o << "void dNdeta()\n" << "{\n" << " TString opts;\n"; TrainSetup::SaveOptions(o, "opts", r); o << " // Note, `type' from above overwritten here\n" - << " opts.Append(\"type=AOD:\");\n" - << " opts.Append(\"trig=INEL:\");\n" - << " opts.Append(\"vzMin=-10:\");\n" - << " opts.Append(\"vzMax=-10:\");\n" - << " opts.Append(\"scheme=full:\");\n" + << " opts.Append(\"type=AOD,\");\n" + << " opts.Append(\"trig=INEL,\");\n" + << " opts.Append(\"vzMin=-10,\");\n" + << " opts.Append(\"vzMax=10,\");\n" + << " opts.Append(\"scheme=full,\");\n" << " opts.Append(\"datadir=" << GetOutputDirectory(fExecMode) << ":\");\n\n" << " TString runs(\""; diff --git a/PWGLF/FORWARD/analysis2/trains/TrainSetup.C b/PWGLF/FORWARD/analysis2/trains/TrainSetup.C index 78bdd9617a6..93b4310087a 100644 --- a/PWGLF/FORWARD/analysis2/trains/TrainSetup.C +++ b/PWGLF/FORWARD/analysis2/trains/TrainSetup.C @@ -510,6 +510,17 @@ struct TrainSetup // _must_ be done after all tasks has been added AliAnalysisAlien* gridHandler = CreateGridHandler(); if (gridHandler) mgr->SetGridHandler(gridHandler); + + // --- Set debug level on defined tasks -------------------------- + if (fVerbose > 0) { + TIter next(mgr->GetTasks()); + AliAnalysisTask* sub = 0; + while ((sub = static_cast(next()))) { + AliAnalysisTaskSE* se = dynamic_cast(sub); + if (!se) continue; + se->SetDebugLevel(fVerbose); + } + } // --- Print setup ----------------------------------------------- Print(); @@ -2665,8 +2676,7 @@ protected: o << " --oper=$oper)\n\n" << "echo \"Running runTrain ${opts[@]}\"\n" << "runTrain \"${opts[@]}\"\n\n" - << "#EOF\n" - << std::endl; + << "# EOF" << std::endl; o.close(); gSystem->Exec("chmod a+x rerun.sh"); } -- 2.43.0