* @ingroup pwglf_forward_aod
*/
AliAnalysisTask*
-AddTaskCentralMult(Bool_t mc=false,
- UShort_t sys=0, UShort_t sNN=0, Short_t field=0)
+AddTaskCentralMult(Bool_t mc=false,
+ UShort_t sys=0,
+ UShort_t sNN=0,
+ Short_t field=0,
+ Int_t debug=0)
{
// --- Load libraries ----------------------------------------------
gROOT->LoadClass("AliAODForwardMult", "libPWGLFforward2");
AliCentralMultiplicityTask* task = 0;
if (!mc) task = new AliCentralMultiplicityTask("Central");
else task = new AliCentralMCMultiplicityTask("Central");
- if(sys>0 && sNN > 0)
+ if(sys>0 && sNN > 0) {
task->GetManager().Init(sys, sNN, field);
+ if (!task->GetManager().HasSecondaryCorrection())
+ Fatal("AddTaskCentralMult", "No secondary correction defined!");
+ if (!task->GetManager().HasAcceptanceCorrection())
+ Fatal("AddTaskCentralMult", "No acceptance correction defined!");
+ }
+ task->SetDebugLevel(debug);
+ task->Configure("CentralAODConfig.C");
mgr->AddTask(task);
- // --- Configure the task ------------------------------------------
- TString macroPath(gROOT->GetMacroPath());
- if (!macroPath.Contains("$(ALICE_ROOT)/PWGLF/FORWARD/analysis2")) {
- macroPath.Append(":$(ALICE_ROOT)/PWGLF/FORWARD/analysis2");
- gROOT->SetMacroPath(macroPath);
- }
- const char* config = gSystem->Which(gROOT->GetMacroPath(),
- "CentralAODConfig.C");
- if (!config)
- Warning("AddTaskCentralMult", "CentralAODConfig.C not found in %s",
- gROOT->GetMacroPath());
- else {
- Info("AddTaskCentralMult",
- "Loading configuration of '%s' from %s",
- task->ClassName(), config);
- gROOT->Macro(Form("%s((AliCentralMultiplicityTask*)%p)", config, task));
- delete config;
- }
// --- Make the output container and connect it --------------------
TString outputfile = AliAnalysisManager::GetCommonFileName();
* @ingroup pwglf_forward_aod
*/
AliAnalysisTask*
-AddTaskForwardMult(Bool_t mc, UShort_t sys=0, UShort_t sNN=0, Short_t field=0)
+AddTaskForwardMult(Bool_t mc,
+ UShort_t sys=0,
+ UShort_t sNN=0,
+ Short_t field=0,
+ Int_t debug=0)
{
// --- Load libraries ----------------------------------------------
gROOT->LoadClass("AliAODForwardMult", "libPWGLFforward2");
// --- Make the task and add it to the manager ---------------------
AliForwardMultiplicityBase* task = 0;
-
- if (mc)
- task = new AliForwardMCMultiplicityTask("FMD");
- else
- task = new AliForwardMultiplicityTask("FMD");
+ if (mc) task = new AliForwardMCMultiplicityTask("FMD");
+ else task = new AliForwardMultiplicityTask("FMD");
+ task->SetDebugLevel(debug);
+ task->Configure("ForwardAODConfig.C");
mgr->AddTask(task);
// --- Do a local initialisation with assumed values ---------------
- if (sys > 0 && sNN > 0)
- AliForwardCorrectionManager::Instance().Init(sys,sNN,field,mc);
-
- // --- Configure the task ------------------------------------------
- TString macroPath(gROOT->GetMacroPath());
- if (!macroPath.Contains("$(ALICE_ROOT)/PWGLF/FORWARD/analysis2")) {
- macroPath.Append(":$(ALICE_ROOT)/PWGLF/FORWARD/analysis2");
- gROOT->SetMacroPath(macroPath);
- }
- const char* config = gSystem->Which(gROOT->GetMacroPath(),
- "ForwardAODConfig.C");
- if (!config)
- Warning("AddTaskForwardMult", "ForwardAODConfig.C not found in %s",
- gROOT->GetMacroPath());
- else {
- Info("AddTaskForwardMult",
- "Loading configuration of '%s' from %s",
- task->ClassName(), config);
- gROOT->Macro(Form("%s((AliForwardMultiplicityBase*)%p)", config, task));
- delete config;
+ if (sys > 0 && sNN > 0) {
+ UInt_t what = AliForwardCorrectionManager::kAll;
+ what ^= AliForwardCorrectionManager::kDoubleHit;
+ what ^= AliForwardCorrectionManager::kVertexBias;
+ what ^= AliForwardCorrectionManager::kMergingEfficiency;
+ if (!AliForwardCorrectionManager::Instance().Init(sys,sNN,field,mc,what))
+ Fatal("AddTaskForwardMult", "Failed to initialize corrections");
}
// --- Make the output container and connect it --------------------
#include "AliESDEvent.h"
#include "AliMultiplicity.h"
#include <TROOT.h>
+#include <TSystem.h>
#include <TFile.h>
#include <TError.h>
#include <TSystem.h>
fEtaMax = o.fEtaMax;
return *this;
}
+//____________________________________________________________________
+Bool_t
+AliCentralMultiplicityTask::Configure(const char* macro)
+{
+ // --- Configure the task ------------------------------------------
+ TString macroPath(gROOT->GetMacroPath());
+ if (!macroPath.Contains("$(ALICE_ROOT)/PWGLF/FORWARD/analysis2")) {
+ macroPath.Append(":$(ALICE_ROOT)/PWGLF/FORWARD/analysis2");
+ gROOT->SetMacroPath(macroPath);
+ }
+ const char* config = gSystem->Which(gROOT->GetMacroPath(),macro);
+ if (!config) {
+ AliWarningF("%s not found in %s", macro, gROOT->GetMacroPath());
+ return false;
+ }
+
+ AliInfoF("Loading configuration of '%s' from %s", ClassName(), config);
+ gROOT->Macro(Form("%s((AliCentralMultiplicityTask*)%p)", config, this));
+ delete config;
+
+ return true;
+}
+
//____________________________________________________________________
void AliCentralMultiplicityTask::UserCreateOutputObjects()
{
* @return Reference to this object
*/
AliCentralMultiplicityTask& operator=(const AliCentralMultiplicityTask& o);
+ /**
+ * Configure this task via a macro
+ *
+ * @param macro Macro to configure va
+ *
+ * @return true on success, false otherwise
+ */
+ virtual Bool_t Configure(const char* macro="CentralAODConfig.C");
/**
* Create output objects
*
for(UShort_t n = 1; n <= 6; n++) {
if (!fv[n]) continue;
for (Int_t v = 1; v <= fVtxAxis->GetNbins(); v++) {
- fBinsFMD.Add(new VertexBin(fVtxAxis->GetBinLowEdge(v), fVtxAxis->GetBinUpEdge(v), n, "FMD"));
- fBinsSPD.Add(new VertexBin(fVtxAxis->GetBinLowEdge(v), fVtxAxis->GetBinUpEdge(v), n, "SPD", kFALSE));
+ Int_t vL = Int_t(fVtxAxis->GetBinLowEdge(v));
+ Int_t vH = Int_t(fVtxAxis->GetBinUpEdge(v));
+ fBinsFMD.Add(new VertexBin(vL, vH, n, "FMD"));
+ fBinsSPD.Add(new VertexBin(vL, vH, n, "SPD", kFALSE));
}
}
*/
enum { kHmult = 1, kHQnRe, kHQnIm, kHQ2nRe, kHQ2nIm };
/*
- * Enumeration for cumulant histogram
+ * Enumeration for cumulant histograms
*/
- enum { kW2Two = 1, kW2, kW4Four, kW4, kQnRe, kQnIm, kM,
- kCosphi1phi2, kSinphi1phi2, kCosphi1phi2phi3m, kSinphi1phi2phi3m, kMm1m2,
- kw2two, kw2, kw4four, kw4, kpnRe, kpnIm, kmp,
- kCospsi1phi2, kSinpsi1phi2, kCospsi1phi2phi3m, kSinpsi1phi2phi3m,
- kmpmq, kCospsi1phi2phi3p, kSinpsi1phi2phi3p };
+ enum { kW2Two = 1,
+ kW2,
+ kW4Four,
+ kW4,
+ kQnRe,
+ kQnIm,
+ kM,
+ kCosphi1phi2,
+ kSinphi1phi2,
+ kCosphi1phi2phi3m,
+ kSinphi1phi2phi3m,
+ kMm1m2,
+ kw2two,
+ kw2,
+ kw4four,
+ kw4,
+ kpnRe,
+ kpnIm,
+ kmp,
+ kCospsi1phi2,
+ kSinpsi1phi2,
+ kCospsi1phi2phi3m,
+ kSinpsi1phi2phi3m,
+ kmpmq,
+ kCospsi1phi2phi3p,
+ kSinpsi1phi2phi3p };
- const UShort_t fMoment; // flow moment
- const Int_t fVzMin; // z-vertex min must be in whole [cm]
- const Int_t fVzMax; // z-vertex max must be in whoe [cm]
- TString fType; // data type
- const Bool_t fSymEta; // Use forward-backward symmetry, if detector allows it
- TH2D* fCumuRef; // histogram for reference flow
- TH2D* fCumuDiff; // histogram for differential flow
- TH3D* fCumuHist; // histogram for cumulants calculations
- TH2D* fdNdedpAcc; // Diagnostics histogram to make acc. maps
- UShort_t fDebug; // Debug flag
+ const UShort_t fMoment; // flow moment
+ const Int_t fVzMin; // z-vertex min must be in whole [cm]
+ const Int_t fVzMax; // z-vertex max must be in whoe [cm]
+ TString fType; // data type
+ const Bool_t fSymEta; // Use forward-backward symmetry, if detector allows it
+ TH2D* fCumuRef; // histogram for reference flow
+ TH2D* fCumuDiff; // histogram for differential flow
+ TH3D* fCumuHist; // histogram for cumulants calculations
+ TH2D* fdNdedpAcc; // Diagnostics histogram to make acc. maps
+ UShort_t fDebug; // Debug flag
ClassDef(VertexBin, 1); // object for cumulants ananlysis in FMD
};
TList* fOutputList; // Output list
AliAODEvent* fAOD; // AOD event
Bool_t fv[7]; // Calculate v_{n} flag
- Float_t fVtx; // Z vertex bin
+ Float_t fVtx; // Z vertex bin
Double_t fCent; // Centrality
TH1D* fHistCent; // Diagnostics hist for centrality
TH1D* fHistVertexSel; // Diagnostics hist for selected vertices
#include "AliFMDEventPlaneFinder.h"
#include "AliESDEvent.h"
#include <TROOT.h>
+#include <TSystem.h>
#include <TAxis.h>
#include <THStack.h>
#include <iostream>
fCorrManager = o.fCorrManager;
return *this;
}
+//____________________________________________________________________
+Bool_t
+AliForwardMultiplicityBase::Configure(const char* macro)
+{
+ // --- Configure the task ------------------------------------------
+ TString macroPath(gROOT->GetMacroPath());
+ if (!macroPath.Contains("$(ALICE_ROOT)/PWGLF/FORWARD/analysis2")) {
+ macroPath.Append(":$(ALICE_ROOT)/PWGLF/FORWARD/analysis2");
+ gROOT->SetMacroPath(macroPath);
+ }
+ const char* config = gSystem->Which(gROOT->GetMacroPath(), macro);
+ if (!config) {
+ AliWarningF("%s not found in %s", macro, gROOT->GetMacroPath());
+ return false;
+ }
+
+ AliInfoF("Loading configuration of '%s' from %s", ClassName(), config);
+ gROOT->Macro(Form("%s((AliForwardMultiplicityBase*)%p)", config, this));
+ delete config;
+
+ return true;
+}
//____________________________________________________________________
Bool_t
/**
* @}
*/
+ /**
+ * Configure this task via a macro
+ *
+ * @param macro Macro to configure va
+ *
+ * @return true on success, false otherwise
+ */
+ virtual Bool_t Configure(const char* macro="ForwardAODConfig.C");
/**
* Print information
*
* @}
*/
virtual void SetDebug(Int_t dbg) = 0;
+ /**
+ * Overload super class method for setting debug level to call our
+ * SetDebug member function.
+ *
+ * @param dbg Debug level (0: no output, 1: essentials, 3: a whole lot)
+ */
+ virtual void SetDebugLevel(Int_t dbg)
+ {
+ AliAnalysisTaskSE::SetDebugLevel(dbg);
+ SetDebug(dbg);
+ }
protected:
/**
* Constructor
// --- Debug -------------------------------------------------------
// Set the overall debug level (1: some output, 3: a lot of output)
- task->SetDebug(0);
+ // task->SetDebug(0);
// Set the debug level of a single algorithm
- task->GetSharingFilter().SetDebug(3);
+ // task->GetSharingFilter().SetDebug(3);
// --- Eventplane Finder -------------------------------------------
task->GetEventPlaneFinder().SetUsePhiWeights(false);
fSys(sys),
fSNN(sNN),
fField(field),
- fUseCent(useCent)
+ fUseCent(useCent),
+ fDebugLvl(0),
+ fUseTPCEventPlane(false)
{}
+ /**
+ * Set the debug level on Forward objects
+ *
+ * @param lvl Debug level
+ */
+ void SetDebugLevel(Int_t lvl) { fDebugLvl = lvl; }
+ /**
+ * If set to true, add TPC event plane task.
+ *
+ * @param use Wheter to include TPC event plane task
+ */
+ void SetUseTPCEventPlance(Bool_t use) { fUseTPCEventPlane = use; }
/**
* Run this analysis
*
Bool_t mc = mgr->GetMCtruthEventHandler() != 0;
// --- Add TPC eventplane task
- gROOT->Macro("AddTaskEventplane.C");
+ if (fUseTPCEventPlane) gROOT->Macro("AddTaskEventplane.C");
// --- Task to copy header information ---------------------------
gROOT->Macro("AddTaskCopyHeader.C");
// --- Add the task ----------------------------------------------
- gROOT->Macro(Form("AddTaskForwardMult.C(%d,%d,%d,%d)",
- mc, fSys, fSNN, fField));
+ gROOT->Macro(Form("AddTaskForwardMult.C(%d,%d,%d,%d,%d)",
+ mc, fSys, fSNN, fField, fDebugLvl));
AddExtraFile(gSystem->Which(gROOT->GetMacroPath(), "ForwardAODConfig.C"));
// --- Add the task ----------------------------------------------
- gROOT->Macro(Form("AddTaskCentralMult.C(%d,%d,%d,%d)",
- mc, fSys, fSNN, fField));
+ gROOT->Macro(Form("AddTaskCentralMult.C(%d,%d,%d,%d,%d)",
+ mc, fSys, fSNN, fField, fDebugLvl));
AddExtraFile(gSystem->Which(gROOT->GetMacroPath(), "CentralAODConfig.C"));
// --- Add MC particle task --------------------------------------
// --- Ignore trigger class when selecting events. This means ---
// --- that we get offline+(A,C,E) events too --------------------
// ps->SetSkipTriggerClassSelection(true);
-/*
- if (mc) {
- AliOADBPhysicsSelection * oadbDefaultPbPb = new AliOADBPhysicsSelection("oadbDefaultPbPb");
- oadbDefaultPbPb->AddCollisionTriggerClass ( AliVEvent::kHighMult,"+C0SMH-B-NOPF-ALLNOTRD","B",0);
- oadbDefaultPbPb->AddBGTriggerClass ( AliVEvent::kHighMult,"+C0SMH-A-NOPF-ALLNOTRD","A",0);
- oadbDefaultPbPb->AddBGTriggerClass ( AliVEvent::kHighMult,"+C0SMH-C-NOPF-ALLNOTRD","C",0);
- oadbDefaultPbPb->AddBGTriggerClass ( AliVEvent::kHighMult,"+C0SMH-E-NOPF-ALLNOTRD","E",0);
- oadbDefaultPbPb->SetHardwareTrigger ( 0,"SPDGFO >= 100");
- oadbDefaultPbPb->SetOfflineTrigger ( 0,"SPDGFO >= 100 && !V0ABG && !V0CBG");
-
- oadbDefaultPbPb->AddCollisionTriggerClass ( AliVEvent::kMB,"+CMBACS2-B-NOPF-ALLNOTRD","B",1);
- oadbDefaultPbPb->AddBGTriggerClass ( AliVEvent::kMB,"+CMBACS2-A-NOPF-ALLNOTRD","A",1);
- oadbDefaultPbPb->AddBGTriggerClass ( AliVEvent::kMB,"+CMBACS2-C-NOPF-ALLNOTRD","C",1);
- oadbDefaultPbPb->AddBGTriggerClass ( AliVEvent::kMB,"+CMBACS2-E-NOPF-ALLNOTRD","E",1);
- oadbDefaultPbPb->SetHardwareTrigger ( 1,"(V0A && V0C && SPDGFO > 1)");
- oadbDefaultPbPb->SetOfflineTrigger ( 1,"(V0A && V0C && SPDGFO > 1) && !V0ABG && !V0CBG");
- // LHC10h8
- AliOADBPhysicsSelection * oadbLHC10h8 = new AliOADBPhysicsSelection("oadbLHC10h8");
- oadbLHC10h8->AddCollisionTriggerClass ( AliVEvent::kHighMult,"+C0SMH-B-NOPF-ALL","B",0);
- oadbLHC10h8->AddBGTriggerClass ( AliVEvent::kHighMult,"+C0SMH-A-NOPF-ALL","A",0);
- oadbLHC10h8->AddBGTriggerClass ( AliVEvent::kHighMult,"+C0SMH-C-NOPF-ALL","C",0);
- oadbLHC10h8->AddBGTriggerClass ( AliVEvent::kHighMult,"+C0SMH-E-NOPF-ALL","E",0);
- oadbLHC10h8->SetHardwareTrigger ( 0,"SPDGFO >= 100");
- oadbLHC10h8->SetOfflineTrigger ( 0,"SPDGFO >= 100 && !V0ABG && !V0CBG");
-
- oadbLHC10h8->AddCollisionTriggerClass ( AliVEvent::kMB,"+CMBACS2-B-NOPF-ALL","B",1);
- oadbLHC10h8->AddBGTriggerClass ( AliVEvent::kMB,"+CMBACS2-A-NOPF-ALL","A",1);
- oadbLHC10h8->AddBGTriggerClass ( AliVEvent::kMB,"+CMBACS2-C-NOPF-ALL","C",1);
- oadbLHC10h8->AddBGTriggerClass ( AliVEvent::kMB,"+CMBACS2-E-NOPF-ALL","E",1);
- oadbLHC10h8->SetHardwareTrigger ( 1,"(V0A && V0C && SPDGFOL1 > 1)");
- oadbLHC10h8->SetOfflineTrigger ( 1,"(V0A && V0C && SPDGFOL1 > 1) && !V0ABG && !V0CBG");
-
- ps->SetCustomOADBObjects(oadbDefaultPbPb, 0, 0);
- ps->SetCustomOADBObjects(oadbLHC10h8, 0, 0);
- }*/
}
//__________________________________________________________________
/**
if (!fUseCent) return;
TrainSetup::CreateCentralitySelection(mc, mgr);
}
+ //__________________________________________________________________
+ /**
+ * Create the setup script. This is overloaded here, so that we can
+ * create our dN/deta job script here.
+ *
+ * @param type Type of analysis
+ * @param mode Mode of the analysis
+ * @param mc Whether this is MC or not
+ * @param usePar Whether to use par files or not
+ * @param dbg Debug level
+ */
+ virtual void CreateSetupScript(EType type,
+ EMode mode,
+ Bool_t mc,
+ Bool_t usePar,
+ Int_t dbg) const
+ {
+ TrainSetup::CreateSetupScript(type, mode, mc, usePar, dbg);
+
+ Info("CreateSetupScript", "Creating dNdeta train setup script");
+ TString base(Form("%s_dndeta", fName.Data()));
+ TString escaped = EscapeName(base, fDatime);
+ std::ofstream o(Form("%s.C", escaped.Data()));
+ if (!o) {
+ Error("CreateSetupScript", "Failed to make dNdeta script %s.C",
+ escaped.Data());
+ return;
+ }
+
+ o << std::boolalpha
+ << "// Script to analyse AOD pass " << EscapedName() << " for dN/deta\n"
+ << "// Automatically generated by MakeAODTrain\n"
+ << "void " << escaped << "(bool terminate=false,"
+ << "const char* trig=\"INEL\",Double_t vzMin=-10, Double_t vzMax=+10,"
+ << "const char* scheme=\"FULL\")\n"
+ << "{\n";
+ WriteBuild(o, "MakedNdetaTrain");
+
+ o << " MakedNdetaTrain t(\"" << base << "\",trig,vzMin,vzMax,scheme,"
+ << fUseCent << ");\n";
+ TrainSetup::WriteSettings(o, "t");
+ o << " t.SetDataDir(\"" << GetOutputDirectory(mode) << "\");\n";
+ WriteRuns(o, "t");
+
+ const char* cmode = (mode == kLocal ? "\"LOCAL\"" :
+ mode == kProof ? "\"PROOF\"" : "\"GRID\"");
+ o << " t.Run(" << cmode << ",(terminate ? \"TERMINATE\" : \"FULL\"),-1,"
+ << usePar << ',' << dbg << ");\n"
+ << "}\n"
+ << "// EOF" << std::endl;
+
+ o.close();
+ }
+ //__________________________________________________________________
+ const char* ClassName() const { return "MakeAODTrain"; }
+ //__________________________________________________________________
+ void WriteConstruction(std::ostream& o, const char* obj) const
+ {
+ o << " UShort_t sys = " << fSys << "; // 1:pp, 2:PbPb, 3:pPb\n"
+ << " UShort_t sNN = " << fSNN << "; // sqrt(sNN) in GeV\n"
+ << " Short_t fld = " << fField << "; // L3 field in kG\n"
+ << " Bool_t cen = " << fUseCent << "; // enable centrality\n"
+ << " MakeAODTrain "<< obj << "(\"" << fName << "\",sys,sNN,fld,cen);\n";
+ }
+ //__________________________________________________________________
+ void WriteSettings(std::ostream& o, const char* obj) const
+ {
+ TrainSetup::WriteSettings(o, obj);
+ o << " " << obj << ".SetDebugLvl(" << fDebugLvl << ");\n"
+ << " " << obj << ".SetUseTPCEventPlane(" << fUseTPCEventPlane << ");\n"
+ << std::endl;
+ }
+ //__________________________________________________________________
+ void WriteRun(std::ostream& o,
+ const char* obj,
+ const char* /*type*/,
+ const char* mode,
+ const char* oper,
+ Bool_t mc,
+ Bool_t usePar,
+ Int_t dbg) const
+ {
+ o << " " << obj << ".Run(" << mode << ',' << oper << ",-1," << mc << ','
+ << usePar << ',' << dbg << ");" << std::endl;
+ }
UShort_t fSys;
UShort_t fSNN;
Short_t fField;
Bool_t fUseCent;
+ Int_t fDebugLvl;
+ Bool_t fUseTPCEventPlane;
};
//
// EOF
* @param usePar If true, use PARs
*/
void Run(const char* mode, const char* oper,
- Int_t nEvents=-1, Bool_t usePar=false)
+ Int_t nEvents=-1, Bool_t usePar=false, Int_t dbg=0)
{
- Exec("AOD", mode, oper, nEvents, false, usePar);
+ Exec("AOD", mode, oper, nEvents, false, usePar, dbg);
}
/**
* Run this analysis
* @param usePar If true, use PARs
*/
void Run(EMode mode, EOper oper, Int_t nEvents=-1,
- Bool_t usePar=false)
+ Bool_t usePar=false, Int_t dbg=0)
{
- Exec(kAOD, mode, oper, nEvents, false, usePar);
+ Exec(kAOD, mode, oper, nEvents, false, usePar, dbg);
}
/**
* Set the trigger to use (INEL, INEL>0, NSD)
* @return 0
*/
AliVEventHandler* CreateOutputHandler(EType) { return 0; }
+ //__________________________________________________________________
+ const char* ClassName() const { return "MakedNdetaTrain"; }
+ //__________________________________________________________________
+ void WriteConstruction(std::ostream& o, const char* obj) const
+ {
+ o << " const char* trig = \"" << fTrig << "\";\n"
+ << " Double_t vzMin = " << fVzMin << ";\n"
+ << " Double_t vzMax = " << fVzMax << ";\n"
+ << " const char* scheme = \"" << fScheme << "\";\n"
+ << " Bool_t cent = " << fUseCent << ";\n"
+ << " MakedNdetaTrain " << obj << "(\""
+ << fName << "\",trig,vzMin,vzMax,scheme,cent);\n";
+ }
+ void WriteRun(std::ostream& o,
+ const char* obj,
+ const char* /* type */,
+ const char* mode,
+ const char* oper,
+ Bool_t mc,
+ Bool_t usePar,
+ Int_t dbg) const
+ {
+ o << " " << obj << ".Run(" << mode << ',' << oper << ",-1,"
+ << usePar << ',' << dbg << ");" << std::endl;
+ }
TString fTrig; // Trigger to use
Double_t fVzMin; // Least v_z
Double_t fVzMax; // Largest v_z
class TArrayI;
class TChain;
class AliAnalysisManager;
+class TDatime;
#endif
//====================================================================
UShort_t year=0, UShort_t month=0,
UShort_t day=0, UShort_t hour=0, UShort_t min=0)
: fName(name),
+ fEscapedName(name),
fRootVersion("v5-28-00a"),
fAliRootVersion("v4-21-18-AN"),
fAliEnAPIVersion("V1.1x"),
fDataDir("/alice/data/2010/LHC10c"),
fDataSet("/COMMON/COMMON/LHC09a4_run8100X#/esdTree"),
fXML(""),
+ fNReplica(4),
+ fESDPass(3),
+ fPassPostfix(""),
+ fAllowOverwrite(kFALSE),
+ fUseGDB(kFALSE),
+ fMaxSplit(50),
fRunNumbers(0),
fListOfPARs(),
fListOfSources(),
fListOfLibraries(),
fListOfExtras(),
- fNReplica(4),
- fESDPass(3),
- fPassPostfix(""),
- fEscapedName(name),
- fAllowOverwrite(kFALSE),
- fUseGDB(kFALSE)
+ fDatime((year<1995?1995:year), month, day, hour, min, 0)
+ {
+ // If no time is specified, set to now
+ if (useDateTime && (year == 0 || month == 0 || day == 0)) fDatime.Set();
+
+ fEscapedName = EscapeName(fName, fDatime);
+ }
+
+ static TString EscapeName(const char* name, const TDatime& datime)
{
+ TString escaped = name;
char c[] = { ' ', '/', '@', 0 };
char* p = c;
while (*p) {
- fEscapedName.ReplaceAll(Form("%c", *p), "_");
+ escaped.ReplaceAll(Form("%c", *p), "_");
p++;
}
-
- if (useDateTime) {
- if (year == 0 || month == 0 || day == 0) {
- TDatime now;
- year = now.GetYear();
- month = now.GetMonth();
- day = now.GetDay();
- hour = now.GetHour();
- min = now.GetMinute();
- }
- fEscapedName.Append(Form("_%04d%02d%02d_%02d%02d",
- year, month, day, hour, min));
- }
-
+ if (datime.GetYear() <= 1995 &&
+ datime.GetMonth() == 0 &&
+ datime.GetDay() == 0) return escaped;
+ escaped.Append(Form("_%04d%02d%02d_%02d%02d",
+ datime.GetYear(),
+ datime.GetMonth(),
+ datime.GetDay(),
+ datime.GetHour(),
+ datime.GetMinute()));
+ return escaped;
+ }
+ void SetDateTime(UShort_t year, UShort_t month, UShort_t day,
+ UShort_t hour, UShort_t minutes)
+ {
+ fDatime.Set((year<1995?1995:year), month, day, hour, minutes, 0);
+ fEscapedName = EscapeName(fName, fDatime);
}
-
//__________________________________________________________________
/**
* Parse a string into a type enum
* @param v Version string of AliROOT
*/
void SetAliROOTVersion(const char* v) { fAliRootVersion = v; }
-
+ //__________________________________________________________________
+ /**
+ * Set the AliEn API version to use
+ *
+ * @param v AliEn API version
+ */
void SetAliEnAPIVersion(const char* v) { fAliEnAPIVersion = v; }
//__________________________________________________________________
/**
* @param n Number of replicas requested
*/
void SetNReplica(Int_t n) { fNReplica = n; }
+ //__________________________________________________________________
/**
* Set the ESD pass to use
*
* @param pass Pass number
*/
void SetESDPass(Int_t pass) { fESDPass = pass; }
+ //__________________________________________________________________
/**
* Set the ESD pass to use
*
*/
void SetUseGDB(Bool_t use=kTRUE) { fUseGDB = use; }
//__________________________________________________________________
+ /**
+ * Set the maximum number of files per sub-job.
+ *
+ * @param max Maximum number of files per sub-job
+ */
+ void SetMaxSplit(UShort_t max=50) { fMaxSplit = max; }
+ //__________________________________________________________________
/**
* Add a source file to be copied and byte compiled on slaves
*
<< base << "." << ext << "++g\");\n"
<< " if (ret != 0) Fatal(\"BUILD\",\"Failed to build\");\n"
<< " else Info(\"BUILD\", \"Made " << base << "\");\n"
- << "}\n"
- << std::endl;
+ << "}\n"
+ << std::endl;
cbuild.close();
// Make our set-up script
return retval;
}
//__________________________________________________________________
+ static void PrintFieldName(std::ostream& o, const char* name)
+ {
+ o << " " << std::left << std::setw(20) << name << ": " << std::flush;
+ }
+ //__________________________________________________________________
+ static void PrintFieldList(std::ostream& o, const char* name,
+ const TCollection& c)
+ {
+ PrintFieldName(o, name);
+ Bool_t first = true;
+ TObject* obj = 0;
+ TIter next(&c);
+ while ((obj = next())) {
+ o << (first ? "" : ", ") << obj->GetName();
+ first = false;
+ }
+ std::cout << std::endl;
+ }
+ //__________________________________________________________________
+ template <typename T>
+ static void PrintField(std::ostream& o, const char* name, T& value)
+ {
+ PrintFieldName(o, name);
+ o << value << std::endl;
+ }
+ //__________________________________________________________________
/**
* Print the setup
*
*/
- void Print() const
+ virtual void Print() const
{
bool mc = AliAnalysisManager::GetAnalysisManager()
->GetMCtruthEventHandler();
std::cout << fName << " train setup\n"
- << std::boolalpha
- << " ROOT version: " << fRootVersion << "\n"
- << " AliROOT version: " << fAliRootVersion << "\n"
- << " Name of proof server: " << fProofServer << "\n"
- << " Grid Input directory: " << fDataDir << "\n"
- << " Proof data set name: " << fDataSet << "\n"
- << " XML collection: " << fXML << "\n"
- << " Monte-Carlo input: " << mc << "\n"
- << " Storage replication: " << fNReplica << "\n"
- << " Run numbers: " << std::flush;
+ << std::boolalpha;
+ PrintField(std::cout, "Escaped name", fEscapedName);
+ PrintField(std::cout, "ROOT version", fRootVersion);
+ PrintField(std::cout, "AliROOT version", fAliRootVersion);
+ PrintField(std::cout, "AliEn API version", fAliEnAPIVersion);
+ PrintField(std::cout, "Name of proof server", fProofServer);
+ PrintField(std::cout, "Input directory", fDataDir);
+ PrintField(std::cout, "Proof data set name", fDataSet);
+ PrintField(std::cout, "XML collection", fXML);
+ PrintField(std::cout, "Storage replication", fNReplica);
+ PrintField(std::cout, "ESD pass", fESDPass);
+ PrintField(std::cout, "ESD pass postfix", fPassPostfix);
+ PrintField(std::cout, "Allow overwrite", fAllowOverwrite);
+ PrintField(std::cout, "Do GDB debugging", fUseGDB);
+ PrintField(std::cout, "Max # files per split", fMaxSplit);
+ PrintField(std::cout, "Monte-Carlo input", mc);
+
+ PrintFieldName(std::cout, "Run numbers");
for (Int_t i = 0; i < fRunNumbers.GetSize(); i++)
std::cout << (i == 0 ? "" : ", ") << fRunNumbers.At(i);
+ std::cout << std::endl;
- std::cout << "\n"
- << " PAR files: " << std::flush;
- Bool_t first = true;
- TObject* obj = 0;
- TIter nextPar(&fListOfPARs);
- while ((obj = nextPar())) {
- std::cout << (first ? "" : ", ") << obj->GetName();
- first = false;
- }
+ PrintFieldList(std::cout, "PAR files", fListOfPARs);
+ PrintFieldList(std::cout, "Script sources", fListOfSources);
+ PrintFieldList(std::cout, "Libraries", fListOfLibraries);
+ PrintFieldList(std::cout, "Extras", fListOfExtras);
- std::cout << "\n"
- << " Script sources: " << std::flush;
- first = true;
- TIter nextSrc(&fListOfSources);
- while ((obj = nextSrc())) {
- std::cout << (first ? "" : ", ") << obj->GetName();
- first = false;
- }
-
- std::cout << "\n"
- << " Libraries to load: " << std::flush;
- first = true;
- TIter nextLib(&fListOfLibraries);
- while ((obj = nextLib())) {
- std::cout << (first ? "" : ", ") << obj->GetName();
- first = false;
- }
std::cout << std::noboolalpha << std::endl;
AliAnalysisGrid* plugin =
AliAnalysisAlien* gridHandler = CreateGridHandler(type, mode, oper);
if (gridHandler) mgr->SetGridHandler(gridHandler);
+ // --- Print setup -----------------------------------------------
+ CreateSetupScript(type, mode, mc, usePar, dbg);
+
// --- Print setup -----------------------------------------------
Print();
// if (mode == kProof) {
* @param o Object to copy from
*/
TrainSetup(const TrainSetup& o)
- : fName(o.fName),
- fRootVersion(o.fRootVersion),
- fAliRootVersion(o.fAliRootVersion),
- fProofServer(o.fProofServer),
- fDataDir(o.fDataDir),
- fDataSet(o.fDataSet),
- fXML(o.fXML),
- fRunNumbers(o.fRunNumbers),
- fListOfPARs(),
- fListOfSources(),
- fListOfLibraries(),
- fListOfExtras(),
- fNReplica(o.fNReplica),
- fESDPass(o.fESDPass)
+ : fName(o.fName),
+ fRootVersion(o.fRootVersion),
+ fAliRootVersion(o.fAliRootVersion),
+ fProofServer(o.fProofServer),
+ fDataDir(o.fDataDir),
+ fDataSet(o.fDataSet),
+ fXML(o.fXML),
+ fNReplica(o.fNReplica),
+ fESDPass(o.fESDPass),
+ fPassPostfix(o.fPassPostfix),
+ fAllowOverwrite(o.fAllowOverwrite),
+ fUseGDB(o.fUseGDB),
+ fMaxSplit(o.fMaxSplit),
+ fRunNumbers(o.fRunNumbers),
+ fListOfPARs(),
+ fListOfSources(),
+ fListOfLibraries(),
+ fListOfExtras(),
+ fDatime(o.fDatime)
{
if (isdigit(fName[0])) {
Warning("TrainSetup", "Name starts with a digit, prepending 'a' to name");
// Data search patterns
TString pat;
- if (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()) {
+ if (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler() ||
+ type == kAOD) {
pat = "*/";
- plugin->SetRunPrefix("");
+ plugin->SetRunPrefix(type == kAOD ? "000" : "");
}
else {
pat = Form("*ESDs/pass%d%s/*/", fESDPass, fPassPostfix.Data());
// Split by storage element - must be lower case!
plugin->SetSplitMode("se");
+ plugin->SetSplitMaxInputFileNumber(fMaxSplit);
return plugin;
}
virtual void CreateCentralitySelection(Bool_t mc, AliAnalysisManager* mgr)
{
gROOT->Macro("AddTaskCentrality.C");
+ const char* name = "CentralitySelection";
AliCentralitySelectionTask* ctask =
- dynamic_cast<AliCentralitySelectionTask*>(mgr->GetTask("CentralitySelection"));
+ dynamic_cast<AliCentralitySelectionTask*>(mgr->GetTask(name));
if (!ctask) return;
// ctask->SetPass(fESDPass);
if (mc) ctask->SetMCInput();
}
// Extract archive
- gSystem->Exec(Form("tar xvzf %s", parFile.Data()));
+ gSystem->Exec(Form("tar xzf %s", parFile.Data()));
// Change directory into par archive
TString cwd = gSystem->WorkingDirectory();
return chain;
}
//__________________________________________________________________
+ TString GetOutputDirectory(EMode mode) const
+ {
+ TString ret(fEscapedName);
+ if (mode != kGrid) return ret;
+
+ AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
+ if (!am) {
+ Warning("GetOutputDirectory", "No analysis manager defined yet");
+ return ret;
+ }
+ AliAnalysisGrid* ag = am->GetGridHandler();
+ if (!ag) {
+ Warning("GetOutputDirectory", "No grid handler defined yet");
+ return ret;
+ }
+ AliAnalysisAlien* aa = dynamic_cast<AliAnalysisAlien*>(ag);
+ if (!aa) {
+ Warning("GetOutputDirectory", "Grid handler isn't for AliEn");
+ return ret;
+ }
+ ret = aa->GetGridOutputDir();
+ if (!ret.BeginsWith("/")) {
+ if (gGrid)
+ ret = Form("%s/%s/%s", gGrid->GetHomeDirectory(),
+ fEscapedName.Data(), aa->GetGridOutputDir());
+ else
+ ret = Form("%s/%s", fEscapedName.Data(), aa->GetGridOutputDir());
+ }
+ return ret;
+ }
+
+ //__________________________________________________________________
+ virtual void WriteConstruction(std::ostream& o, const char* obj) const
+ {
+ o << " " << ClassName() << " "
+ << obj << "(\"" << fName << "\");" << std::endl;
+ }
+ //__________________________________________________________________
+ virtual void WriteSettings(std::ostream& o, const char* obj) const
+ {
+ o << " " << obj << ".SetDateTime(" << fDatime.GetYear() << ','
+ << fDatime.GetMonth() << ','
+ << fDatime.GetDay() << ','
+ << fDatime.GetHour() << ','
+ << fDatime.GetMinute() << ");\n"
+ << " " << obj << ".SetROOTVersion(\"" << fRootVersion << "\");\n"
+ << " " << obj << ".SetAliROOTVersion(\"" << fAliRootVersion << "\");\n"
+ << " " << obj << ".SetAliEnAPIVersion(\"" << fAliEnAPIVersion << "\");\n"
+ << " " << obj << ".SetProofServer(\"" << fProofServer << "\");\n"
+ << " " << obj << ".SetDataDir(\"" << fDataDir << "\");\n"
+ << " " << obj << ".SetDataSet(\"" << fDataSet << "\");\n"
+ << " " << obj << ".SetXML(\"" << fXML << "\");\n"
+ << " " << obj << ".SetNReplica(" << fNReplica << ");\n"
+ << " " << obj << ".SetESDPass(" << fESDPass << ");\n"
+ << " " << obj << ".SetPassPostfix(\"" << fPassPostfix << "\");\n"
+ << " " << obj << ".SetAllowOverwrite(" << fAllowOverwrite << ");\n"
+ << " " << obj << ".SetUseGDB(" << fUseGDB << ");\n"
+ << " " << obj << ".SetMaxSplit(" << fMaxSplit << ");\n"
+ << std::endl;
+ }
+ //__________________________________________________________________
+ virtual void WriteRun(std::ostream& o,
+ const char* obj,
+ const char* type,
+ const char* mode,
+ const char* oper,
+ Bool_t mc,
+ Bool_t usePar,
+ Int_t dbg) const
+ {
+ o << " " << obj << ".Run(" << type << "," << mode
+ << "," << oper << "," << mc << "," << usePar << ","
+ << dbg << ");" << std::endl;
+ }
+ //__________________________________________________________________
+ virtual const char* ClassName() const
+ {
+ return "TrainSetup";
+ }
+ //__________________________________________________________________
+ virtual void WriteBuild(std::ostream& o, const char* cls) const
+ {
+ o << " const char* builder = \n"
+ << " \"$(ALICE_ROOT)/PWGLF/FORWARD/analysis2/trains/BuildTrain.C\";\n"
+ << " gROOT->LoadMacro(builder);\n"
+ << " BuildTrain(\"" << cls << "\");\n" << std::endl;
+ }
+ //__________________________________________________________________
+ virtual void WriteRuns(std::ostream& o, const char* obj) const
+ {
+ for (Int_t i = 0; i < fRunNumbers.GetSize(); i++)
+ o << " " << obj << ".AddRun(" << fRunNumbers.At(i) << ");\n";
+ o << std::endl;
+ }
+ //__________________________________________________________________
+ virtual void CreateSetupScript(EType type,
+ EMode mode,
+ Bool_t mc,
+ Bool_t usePar,
+ Int_t dbg) const
+ {
+ std::ofstream o(Form("setup_%s.C", fEscapedName.Data()));
+ if (!o) {
+ Error("CreateSetupScript", "Failed to generate setup_%s.C",
+ fEscapedName.Data());
+ return;
+ }
+ const char* cls = ClassName();
+ o << std::boolalpha
+ << "// Script to set-up the analysis chain\n"
+ << "// Automatically generated by TrainSetup\n"
+ << "// Run with argument to true, to do Terminate processing\n"
+ << "void setup_" << fEscapedName << "(bool terminate)\n"
+ << "{\n";
+ WriteBuild(o, cls);
+ WriteConstruction(o, "t");
+ WriteSettings(o, "t");
+ WriteRuns(o, "t");
+
+ const char* ctype = (type == kESD ? "\"ESD\"" : "\"AOD\"");
+ const char* cmode = (mode == kLocal ? "\"LOCAL\"" :
+ mode == kProof ? "\"PROOF\"" : "\"GRID\"");
+ WriteRun(o, "t", ctype, cmode, "(terminate ? \"TERMINATE\" : \"FULL\")",
+ mc, usePar, dbg);
+
+
+ o << "\n}\n// EOF\n" << std::endl;
+
+
+ o.close();
+ }
+ //__________________________________________________________________
TString fName; // Name of analysis
+ TString fEscapedName; // Name escaped for special chars
TString fRootVersion; // ROOT version to use
TString fAliRootVersion; // AliROOT version to use
TString fAliEnAPIVersion; // AliEn API version to use
TString fDataDir; // Grid Input directory
TString fDataSet; // Proof data set name
TString fXML; // XML collection for local/proof mode
- TArrayI fRunNumbers; // List of run number
- TList fListOfPARs; // List of PAR files to use
- TList fListOfSources; // List of sources to upload and AcLIC
- TList fListOfLibraries; // List of libraries to load
- TList fListOfExtras; // List of extra files to upload
Int_t fNReplica; // Storage replication
Int_t fESDPass; // ESD pass number
TString fPassPostfix; // Possible pass postfix
- TString fEscapedName; // Name escaped for special chars
Bool_t fAllowOverwrite; // Allow overwriting output dir
Bool_t fUseGDB; // Wrap PROOF slaves in GDB
+ Int_t fMaxSplit; // Maximum number of files per split
+ TArrayI fRunNumbers; // List of run number
+ TList fListOfPARs; // List of PAR files to use
+ TList fListOfSources; // List of sources to upload and AcLIC
+ TList fListOfLibraries; // List of libraries to load
+ TList fListOfExtras; // List of extra files to upload
+ TDatime fDatime;
};