#ifndef __CINT__
#include <fstream>
+#include <iostream>
#include <TAlienCollection.h>
#include <TArrayI.h>
/**
* Set ROOT version to use
*
- * @param v
+ * @param v Version string of ROOT
*/
void SetROOTVersion(const char* v) { fRootVersion = v; }
//__________________________________________________________________
/**
* Set AliROOT version to use
*
- * @param v
+ * @param v Version string of AliROOT
*/
void SetAliROOTVersion(const char* v) { fAliRootVersion = v; }
//__________________________________________________________________
/**
- * Set the proof server URL
+ * Set the PROOF server URL
*
- * @param s
+ * @param s PROOF server URL
*/
void SetProofServer(const char* s) { fProofServer = s; }
//__________________________________________________________________
/**
* Set the GRID/Local data dir
*
- * @param d
+ * @param d Directory with data
*/
- void SetDataDir(const char* d) { fDataDir = d; }
+ void SetDataDir(const char* d) { fDataDir = d; }
//__________________________________________________________________
/**
* Set the PROOF data set
*
- * @param d
+ * @param d PROOF registered data set
*/
- void SetDataSet(const char* d) { fDataSet = d; }
+ void SetDataSet(const char* d) { fDataSet = d; }
//__________________________________________________________________
/**
* Set the XML file to use
*
- * @param x
+ * @param x XML file
*/
- void SetXML(const char* x) { fXML = x; }
+ void SetXML(const char* x) { fXML = x; }
//__________________________________________________________________
/**
* Set how many replicas of the output we want
*
- * @param n
+ * @param n Number of replicas requested
*/
- void SetNReplica(Int_t n) { fNReplica = n; }
+ void SetNReplica(Int_t n) { fNReplica = n; }
+ /**
+ * Set the ESD pass to use
+ *
+ * @param pass Pass number
+ */
+ void SetESDPass(Int_t pass) { fESDPass = pass; }
//__________________________________________________________________
/**
* Add a source file to be copied and byte compiled on slaves
gROOT->SetMacroPath(Form("%s:$ALICE_ROOT/ANALYSIS/macros",
gROOT->GetMacroPath()));
- // --- Physics selction ------------------------------------------
- CreatePhysicsSelection(mc, mgr);
+ // --- Physics selction - only for ESD ---------------------------
+ if (type == kESD) CreatePhysicsSelection(mc, mgr);
// --- Create tasks ----------------------------------------------
CreateTasks(mode, usePar, mgr);
*
* @return Grid handler
*/
- virtual AliAnalysisAlien* CreateGridHandler(EType type, EMode mode, EOper oper)
+ virtual AliAnalysisAlien*
+ CreateGridHandler(EType type, EMode mode, EOper oper)
{
if (mode != kGrid) return 0;
*/
virtual AliVEventHandler* CreateOutputHandler(EType type)
{
+ AliAODHandler* ret = new AliAODHandler();
switch (type) {
- case kESD: // Fall through
- case kAOD: {
- AliAODHandler* ret = new AliAODHandler();
+ case kESD:
ret->SetOutputFileName("AliAOD.root");
- return ret;
- }
+ break;
+ case kAOD:
+ ret->SetOutputFileName("AliAOD.pass2.root");
+ break;
}
return 0;
}
* Create physics selection , and add to manager
*
* @param mc Whether this is for MC
+ * @param mgr Manager
*/
virtual void CreatePhysicsSelection(Bool_t mc,
AliAnalysisManager* mgr)
//__________________________________________________________________
/**
* Scan directory @a dir (possibly recursive) for tree files to add
- * to the chain.
+ * to the chain. This does not follow sym-links
*
* @param dir Directory to scan
* @param chain Chain to add to
// Get list of files, and go back to old working directory
TString oldDir(gSystem->WorkingDirectory());
TList* files = dir->GetListOfFiles();
- gSystem->ChangeDirectory(oldDir);
- if (!files) return false;
+ if (!files) {
+ gSystem->ChangeDirectory(oldDir);
+ return false;
+ }
// Sort list of files and check if we should add it
files->Sort();
TSystemFile* file = 0;
while ((file = static_cast<TSystemFile*>(next()))) {
TString name(file->GetName());
-
+ TString title(file->GetTitle());
+ TString full(gSystem->ConcatFileName(file->GetTitle(), name.Data()));
// Ignore special links
- if (name == "." || name == "..") continue;
+ if (name == "." || name == "..") {
+ // Info("ScanDirectory", "Ignoring %s", name.Data());
+ continue;
+ }
+ Info("ScanDirectory", "Looking at %s", full.Data());
// Check if this is a directory
- if (file->IsDirectory()) {
- if (recursive)
+ if (file->IsDirectory(full.Data())) {
+ Info("ScanDirectory", "%s is a directory", full.Data());
+ if (recursive) {
if (ScanDirectory(static_cast<TSystemDirectory*>(file),
chain,type,recursive))
- ret = true;;
+ ret = true;
+ }
+ else
+ Info("ScanDirectory",
+ "%s is a directory but we're not scanning recusively",
+ name.Data());
continue;
}
if (!name.EndsWith(".root")) continue;
// If this file does not contain AliESDs, ignore
- if (!name.Contains(fnPattern)) continue;
+ if (!name.Contains(fnPattern)) {
+ Info("ScanDirectory", "%s does not match pattern %s",
+ name.Data(), fnPattern.Data());
+ continue;
+ }
// Get the path
TString fn(Form("%s/%s", file->GetTitle(), name.Data()));
chain->Add(fn);
ret = true;
}
+ gSystem->ChangeDirectory(oldDir);
return ret;
}
//__________________________________________________________________
*
* @ingroup pwg2_forward_scripts_makers
*/
-class ForwardELoss : public TrainSetup
+class FMDELossTrain : public TrainSetup
{
public:
/**
* Constructor. Date and time must be specified when running this
* in Termiante mode on Grid
*
- * @param dateTime Append date and time to name
+ * @param name Name of train
+ * @param useCent Whether to use centrality or not
+ * @param dateTime Append date and time to name
* @param year Year
* @param month Month
* @param day Day
* @param hour Hour
* @param min Minutes
*/
- ForwardELoss(Bool_t dateTime,
- UShort_t year = 0,
- UShort_t month = 0,
- UShort_t day = 0,
- UShort_t hour = 0,
- UShort_t min = 0)
- : TrainSetup("Forward energy loss", dateTime,
- year, month, day, hour, min)
+ FMDELossTrain(const char* name = "FMD Energy Loss",
+ Bool_t useCent = false,
+ Bool_t dateTime = false,
+ UShort_t year = 0,
+ UShort_t month = 0,
+ UShort_t day = 0,
+ UShort_t hour = 0,
+ UShort_t min = 0)
+ : TrainSetup(name, dateTime, year, month, day, hour, min),
+ fUseCent(useCent)
{}
+ //__________________________________________________________________
/**
* Run this analysis
*
void Run(const char* mode, const char* oper,
Int_t nEvents=-1, Bool_t mc=false)
{
- EMode eMode = ParseMode(mode);
- EOper eOper = ParseOperation(oper);
-
- Run(eMode, eOper, nEvents, mc);
+ Exec("ESD", mode, oper, nEvents, mc);
}
+ //__________________________________________________________________
/**
* Run this analysis
*
{
Exec(kESD, mode, oper, nEvents, mc, true);
}
+protected:
+ //__________________________________________________________________
/**
* Create the tasks
*
Bool_t mc = mgr->GetMCtruthEventHandler() != 0;
// --- Add the task ----------------------------------------------
- gROOT->Macro(Form("AddTaskForwardMultEloss.C(%d)", mc));
+ gROOT->Macro(Form("AddTaskFMDEloss.C(%d,%d)", mc, fUseCent));
}
+ /**
+ * Crete output handler - we don't want one here.
+ *
+ * @return 0
+ */
+ AliVEventHandler* CreateOutputHandler(EType) { return 0; }
+ Bool_t fUseCent;
};
//====================================================================
/**
* Analysis train to make Forward and Central multiplicity
*
+ * To run, do
+ * @code
+ * gROOT->LoadMacro("TrainSetup.C");
+ * // Make train
+ * MakeAODTrain t("My Analysis");
+ * // Set variaous parameters on the train
+ * t.SetDataDir("/home/of/data");
+ * t.AddRun(118506)
+ * // Run it
+ * t.Run("LOCAL", "FULL", -1, false, false);
+ * @endcode
+ *
* @ingroup pwg2_forward_scripts_makers
* @ingroup pwg2_forward_aod
*/
* Constructor. Date and time must be specified when running this
* in Termiante mode on Grid
*
- * @param dateTime Append date and time to name
+ * @param name Name of train (free form)
* @param sys Collision system (1: pp, 2: PbPb)
* @param sNN Center of mass energy [GeV]
* @param field L3 magnetic field - one of {-5,0,+5} kG
+ * @param useCent Whether to use centrality
+ * @param dateTime Append date and time to name
* @param year Year - if not specified, current year
* @param month Month - if not specified, current month
* @param day Day - if not specified, current day
/**
* Run this analysis
*
- * @param mode Mode
- * @param oper Operation
+ * @param mode Mode - see TrainSetup::EMode
+ * @param oper Operation - see TrainSetup::EOperation
* @param nEvents Number of events (negative means all)
* @param mc If true, assume simulated events
* @param usePar If true, use PARs
/**
* Run this analysis
*
- * @param mode Mode
- * @param oper Operation
+ * @param mode Mode - see TrainSetup::EMode
+ * @param oper Operation - see TrainSetup::EOperation
* @param nEvents Number of events (negative means all)
* @param mc If true, assume simulated events
* @param usePar If true, use PARs
* Create physics selection , and add to manager
*
* @param mc Whether this is for MC
+ * @param mgr Manager
*/
void CreatePhysicsSelection(Bool_t mc,
AliAnalysisManager* mgr)
{
- gROOT->Macro(Form("AddTaskPhysicsSelection.C(%d)", mc));
- mgr->RegisterExtraFile("event_stat.root");
+ TrainSetup::CreatePhysicsSelection(mc, mgr);
// --- Get input event handler -----------------------------------
AliInputEventHandler* ih =
- static_cast<AliInputEventHandler*>(mgr->GetInputEventHandler());
+ dynamic_cast<AliInputEventHandler*>(mgr->GetInputEventHandler());
+ if (!ih)
+ Fatal("CreatePhysicsSelection", "Couldn't get input handler (%p)", ih);
// --- Get Physics selection -------------------------------------
AliPhysicsSelection* ps =
- static_cast<AliPhysicsSelection*>(ih->GetEventSelection());
+ dynamic_cast<AliPhysicsSelection*>(ih->GetEventSelection());
+ if (!ps)
+ Fatal("CreatePhysicsSelection", "Couldn't get PhysicsSelection (%p)", ps);
// --- Ignore trigger class when selecting events. This means ---
// --- that we get offline+(A,C,E) events too --------------------
/**
* Analysis train to make @f$ dN/d\eta@f$
*
+ * To run, do
+ * @code
+ * gROOT->LoadMacro("TrainSetup.C");
+ * // Make train
+ * MakedNdetaTrain t("My Analysis");
+ * // Set variaous parameters on the train
+ * t.SetDataDir("/home/of/data");
+ * t.AddRun(118506)
+ * // Run it
+ * t.Run("LOCAL", "FULL", -1, false, false);
+ * @endcode
+ *
* @ingroup pwg2_forward_scripts_makers
* @ingroup pwg2_forward_dndeta
*/
* Constructor. Date and time must be specified when running this
* in Termiante mode on Grid
*
+ * @param name Name of train (free form)
* @param trig Trigger to use
* @param vzMin Least @f$ v_z@f$
* @param vzMax Largest @f$ v_z@f$
/**
* Run this analysis
*
- * @param mode Mode
- * @param oper Operation
+ * @param mode Mode - see TrainSetup::EMode
+ * @param oper Operation - see TrainSetup::EOperation
* @param nEvents Number of events (negative means all)
- * @param mc If true, assume simulated events
* @param usePar If true, use PARs
*/
void Run(const char* mode, const char* oper,
/**
* Run this analysis
*
- * @param mode Mode
- * @param oper Operation
+ * @param mode Mode - see TrainSetup::EMode
+ * @param oper Operation - see TrainSetup::EOperation
* @param nEvents Number of events (negative means all)
- * @param mc If true, assume simulated events
* @param usePar If true, use PARs
*/
void Run(EMode mode, EOper oper, Int_t nEvents=-1,
*
* @param mode Processing mode
* @param par Whether to use par files
- * @param mgr Analysis manager
*/
void CreateTasks(EMode mode, Bool_t par, AliAnalysisManager*)
{
gROOT->Macro(Form("AddTaskCentraldNdeta.C(\"%s\",%f,%f,%d,\"%s\")",
fTrig.Data(), fVzMin, fVzMax, fUseCent, fScheme.Data()));
}
- //__________________________________________________________________
- /**
- * Do nothing
- *
- */
- void CreatePhysicsSelection(Bool_t,AliAnalysisManager*) {}
/**
* Crete output handler - we don't want one here.
*