AliAnalysisTask*
AddTaskCentralMCCorr()
{
+ // --- Load libraries ----------------------------------------------
+ gROOT->LoadClass("AliAODForwardMult", "libPWG2forward2");
+
// --- Creating the manager and handlers ---------------------------
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr->GetMCtruthEventHandler()) {
AddTaskCentralMult(Bool_t mc=false,
UShort_t sys=0, UShort_t sNN=0, Short_t field=0)
{
- gSystem->Load("libPWG2forward2");
+ // --- Load libraries ----------------------------------------------
+ gROOT->LoadClass("AliAODForwardMult", "libPWG2forward2");
+ // --- Get analysis manager ----------------------------------------
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr) {
Error("AddTaskCentralMult", "No analysis manager to connect to.");
Bool_t cutEdges = false,
const char* mcanalysisfilename = "none")
{
+ // --- Load libraries ----------------------------------------------
+ gROOT->LoadClass("AliAODForwardMult", "libPWG2forward2");
+
// --- Analysis manager --------------------------------------------
AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
AliAnalysisTask*
AddTaskFMDELoss(Bool_t mc, Bool_t useCent)
{
- gSystem->Load("libPWG2forward2");
+ // --- Load libraries ----------------------------------------------
+ gROOT->LoadClass("AliAODForwardMult", "libPWG2forward2");
+ // --- Get analysis manager ----------------------------------------
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr) {
Error("AddTaskFMDELoss", "No analysis manager to connect to.");
/**
* Add Flow task to train
*
- * @param type
- * @param etabins
- * @param addFlow
- * @param addFType
- * @param addFOrder
+ * @param type Type of analysis (v<n> n="1","2","3",or "4")
+ * @param etabins How may eta bins to make
+ * @param addFlow If true, add flow to MC particles
+ * @param addFType Which type of flow to add to MC particles
+ * @param addFOrder Order of flow to add to MC particles
*
* @ingroup pwg2_forward_flow
*/
Int_t addFType = 0,
Int_t addFOrder = 0)
{
+ // --- Load libraries ----------------------------------------------
+ gROOT->LoadClass("AliAODForwardMult", "libPWG2forward2");
+
+ // --- Get analysis manager ----------------------------------------
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr) {
Error("AddFMDFlowTask", "No analysis manager to connect to.");
return NULL;
}
- AliAODInputHandler* aodInput = dynamic_cast<AliAODInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
+ // --- Check that we're processing AODs ----------------------------
+ AliAODInputHandler* aodInput =
+ dynamic_cast<AliAODInputHandler*> (AliAnalysisManager::GetAnalysisManager()
+ ->GetInputEventHandler());
- Bool_t aod = kFALSE;
- if (aodInput) aod = kTRUE;
- if (!aod) {
+ if (!aodInput) {
Error("AddTaskForwardFlow", "No analysis manager to connect to.");
return NULL;
}
- // --- Check which harmonics to calculate --- //
-
+ // --- Check which harmonics to calculate --------------------------
Bool_t v1 = kTRUE;
Bool_t v2 = kTRUE;
Bool_t v3 = kTRUE;
if (!type.Contains("4")) v4 = kFALSE;
}
- // --- Create output containers and find input from fmd task --- //
+ // --- Create output containers and find input from fmd task -------
TString outputFile = AliAnalysisManager::GetCommonFileName();
outputFile += ":FlowResults";
- AliAnalysisDataContainer* qcout = mgr->CreateContainer("QCumulants", TList::Class(), AliAnalysisManager::kOutputContainer, outputFile);
+ AliAnalysisDataContainer* qcout =
+ mgr->CreateContainer("QCumulants", TList::Class(),
+ AliAnalysisManager::kOutputContainer, outputFile);
- // --- For the selected flow tasks the input and output is set --- //
-
+ // --- For the selected flow tasks the input and output is set -----
AliForwardFlowTaskQC* qc = new AliForwardFlowTaskQC("QCumulants");
qc->SetDoHarmonics(v1, v2, v3, v4);
return;
}
+//
+// EOF
+//
AliAnalysisTask*
AddTaskForwardMCCorr()
{
+ // --- Load libraries ----------------------------------------------
+ gROOT->LoadClass("AliAODForwardMult", "libPWG2forward2");
+
// --- Creating the manager and handlers ---------------------------
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr->GetMCtruthEventHandler()) {
AliAnalysisTask*
AddTaskForwardMult(Bool_t mc, UShort_t sys=0, UShort_t sNN=0, Short_t field=0)
{
- gSystem->Load("libPWG2forward2");
+ // --- Load libraries ----------------------------------------------
+ gROOT->LoadClass("AliAODForwardMult", "libPWG2forward2");
+ // --- Get analysis manager ----------------------------------------
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr) {
Error("AddTaskForwardMult", "No analysis manager to connect to.");
* @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
* @date Wed Mar 23 12:14:03 2011
*
- * @brief
- *
+ * @brief Include the Forward QA task in a train.
*
* @ingroup pwg2_forward_scripts_tasks
*/
/**
- * @defgroup pwg2_forward_eloss Energy Loss Fits
+ * @defgroup pwg2_forward_qa Quality Assurance
* @ingroup pwg2_forward_topical
*/
-
/**
- * This is the macro to include the FMD energy fitter in a train.
+ * This is the macro to include the Forward QA task in a train.
*
+ * @param mc Monte-carlo input
+ * @param useCent Use centrality
+ *
* @ingroup pwg2_forward_eloss
*/
AliAnalysisTask*
AddTaskForwardQA(Bool_t mc, Bool_t useCent)
{
- gSystem->Load("libPWG2forward2");
+ // --- Load libraries ----------------------------------------------
+ gROOT->LoadClass("AliAODForwardMult", "libPWG2forward2");
+ // --- Get analysis manager ----------------------------------------
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr) {
Error("AddTaskForwardQA", "No analysis manager to connect to.");
Bool_t cutEdges = false,
const char* mcanalysisfilename = "none")
{
+ // --- Load libraries ----------------------------------------------
+ gROOT->LoadClass("AliAODForwardMult", "libPWG2forward2");
+
// --- Analysis manager --------------------------------------------
AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
const char* scheme = 0,
Bool_t cutEdges = false)
{
- // --- Analysis manager --------------------------------------------
+ // --- Load libraries ----------------------------------------------
+ gROOT->LoadClass("AliAODForwardMult", "libPWG2forward2");
+
+ // --- Get analysis manager ----------------------------------------
AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
// --- Make our object ---------------------------------------------
class AliFMDDensityCalculator : public TNamed
{
public:
+ /**
+ * How to correct for the missing phi coverage at the corners of the
+ * sensors
+ *
+ */
+ enum {
+ /** No correction */
+ kPhiNoCorrect,
+ /** Correct the calculated number charged particles */
+ kPhiCorrectNch,
+ /** Correct the energy loss */
+ kPhiCorrectELoss
+ };
/**
* Constructor
*/
*
* @param u If >0, use the phi acceptance (default is false)
*/
- void SetUsePhiAcceptance(UShort_t u) { fUsePhiAcceptance = u; }
+ void SetUsePhiAcceptance(UShort_t u=kPhiCorrectNch) { fUsePhiAcceptance = u; }
/**
* Set the lower multiplicity cut. This overrides the setting in
* the energy loss fits.
// Set whether or not to include sigma in cut
task->GetDensityCalculator().SetCuts(cDensity);
- // Set whether or not to use the phi acceptance
- task->GetDensityCalculator().SetUsePhiAcceptance(true);
+ // Set whether or not to use the phi acceptance
+ // AliFMDDensityCalculator::kPhiNoCorrect
+ // AliFMDDensityCalculator::kPhiCorrectNch
+ // AliFMDDensityCalculator::kPhiCorrectELoss
+ task->GetDensityCalculator()
+ .SetUsePhiAcceptance(AliFMDDensityCalculator::kPhiCorrectNch);
// --- Corrector ---------------------------------------------------
// Whether to use the secondary map correction
* @defgroup pwg2_forward_scripts_makers Maker scripts
* @ingroup pwg2_forward_scripts
*/
+//====================================================================
/**
* @file MakeAOD.C
* @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
*
* @ingroup pwg2_forward_scripts_makers
*/
+//====================================================================
/**
* Run first pass of the analysis - that is read in ESD and produce AOD
*
{
// --- Possibly use plug-in for this -------------------------------
if ((name && name[0] != '\0') && gSystem->Load("libRAliEn") >= 0) {
- gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWG2/FORWARD/analysis2:"
- "$ALICE_ROOT/ANALYSIS/macros",
- gROOT->GetMacroPath()));
- gSystem->AddIncludePath("-I${ALICE_ROOT}/include");
- gSystem->Load("libANALYSIS");
- gSystem->Load("libANALYSISalice");
- gROOT->LoadMacro("TrainSetup.C+g");
+ const char* builder =
+ "$(ALICE_ROOT)/PWG2/FORWARD/analysis2/trains/BuildTrain.C"
+ gROOT->LoadMacro(builder);
+
+ BuildTrain("MakeAODTrain");
+
MakeAODTrain t(name, 0, 0, 0, centrality, false);
t.SetDataDir(esddir);
t.SetDataSet("");
* @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
* @date Wed Mar 23 14:08:14 2011
*
- * @brief
+ * @brief Generate energy loss fits
*
- *
- * @ingroup pwg2_forward_eloss
+ * @ingroup pwg2_forward_scripts_makers
*/
/**
* Run a pass on ESD data to produce the energ loss fits
*
+ * If the ROOT AliEn interface library (libRAliEn) can be loaded,
+ * and the parameter @a name is not empty, then use the plugin to do
+ * the analysis. Note that in this case, the output is placed
+ * in a sub-directory named by @a name after escaping spaces and special
+ * characters
+ *
+ * If PROOF mode is selected, then Terminate will be run on the master node
+ * in any case.
+ *
+ * @param esddir ESD input directory. Any file matching the pattern
+ * *AliESDs*.root are added to the chain
+ * @param nEvents Number of events to process. If 0 or less, then
+ * all events are analysed
+ * @param proof If larger then 1, run in PROOF-Lite mode with this
+ * many number of workers.
+ * @param mc Data is assumed to be from simulations
+ * @param cent Whether to use centrality or not
+ * @param name Name of train - free form. This will be the name
+ * of the output directory if the plug-in is used
*
* @ingroup pwg2_forward_eloss
*/
{
// --- Possibly use plug-in for this -------------------------------
if ((name && name[0] != '\0') && gSystem->Load("libRAliEn") >= 0) {
- gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWG2/FORWARD/analysis2:"
- "$ALICE_ROOT/ANALYSIS/macros",
- gROOT->GetMacroPath()));
- gSystem->AddIncludePath("-I${ALICE_ROOT}/include");
- gSystem->Load("libANALYSIS");
- gSystem->Load("libANALYSISalice");
- gROOT->LoadMacro("TrainSetup.C+");
+ const char* builder =
+ "$(ALICE_ROOT)/PWG2/FORWARD/analysis2/trains/BuildTrain.C"
+ gROOT->LoadMacro(builder);
+ BuildTrain("FMDELossTrain");
+
FMDELossTrain t(name, cent, false);
t.SetDataDir(esddir);
t.SetDataSet("");
* @author Alexander Hansen
* @date Wed Mar 23 12:11:33 2011
*
- * @brief
+ * @brief Analyse AODs for flow
*
* @ingroup pwg2_forward_scripts_makers
*
* The .txt file is expected to contain the path to the files
* from the current directory or the absolute path.
*
- * @par Inputs:
- *
- *
- * @par Outputs:
- * -
+ * @param data Input data (directory, list, or ROOT file)
+ * @param nevents Number of events to scan
+ * @param type Type of analysis (v<n>)
+ * @param etabins How may eta bins to make
+ * @param addFlow If true, add flow to MC particles
+ * @param addFType Which type of flow to add to MC particles
+ * @param addFOrder Order of flow to add to MC particles
+ * @param proof
*
* @ingroup pwg2_forward_flow
*/
gROOT->GetMacroPath()));
// --- Add to chain either AOD ------------------------------------
- if (data.IsNull()) {
- AliError("You didn't add a data file");
- return;
- }
- TChain* chain = new TChain("aodTree");
-
- if (data.Contains(".txt")) MakeChain(data, chain);
-
- if (data.Contains(".root")) {
- TFile* test = TFile::Open(data.Data());
- if (!test) {
- AliError(Form("AOD file %s not found", data.Data()));
- return;
- }
- test->Close(); // Remember to close!
- chain->Add(data.Data());
- }
+ gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/MakeChain.C");
+ TChain* chain = MakeChain("AOD", data.Data(), true);
+ // If 0 or less events is select, choose all
+ if (nEvents <= 0) nEvents = chain->GetEntries();
// --- Initiate the event handlers --------------------------------
- AliAnalysisManager *mgr = new AliAnalysisManager("Forward Flow",
- "Flow in the forward region");
+ AliAnalysisManager *mgr =
+ new AliAnalysisManager("Forward Flow",
+ "Flow in the forward region");
// --- AOD input handler -------------------------------------------
AliAODInputHandler *aodInputHandler = new AliAODInputHandler();
/**
- * @file MakedNdeta.C
+ * @file MakeMCCorr.C
* @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
- * @date Wed Mar 23 09:41:56 2011
+ * @date Tue Jul 12 10:06:07 2011
*
- * @brief Run second pass analysis - make @f$ dN/d\eta@f$
+ * @brief Generate MC corrections
*
* @ingroup pwg2_forward_scripts_makers
*/
+//====================================================================
/**
- * Run second pass analysis - make @f$ dN/d\eta@f$
+ * Generatew MC corrections
*
* If the ROOT AliEn interface library (libRAliEn) can be loaded,
* and the parameter @a name is not empty, then use the plugin to do
* @param name Name of train - free form. This will be the name
* of the output directory if the plug-in is used
*
- * @ingroup pwg2_forward_dndeta
+ * @ingroup pwg2_forward_corr
+ * @ingroup pwg2_forward_scripts_makers
*/
void MakeMCCorr(const char* esddir = ".",
Int_t nEvents = -1,
Error("MakeMCCorr", "Plug-in mode not implemented yet!");
return;
- gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWG2/FORWARD/analysis2:"
- "$ALICE_ROOT/ANALYSIS/macros",
- gROOT->GetMacroPath()));
- gSystem->AddIncludePath("-I${ALICE_ROOT}/include");
- gSystem->Load("libANALYSIS");
- gSystem->Load("libANALYSISalice");
- gROOT->LoadMacro("TrainSetup.C+");
+ const char* fwdPath =
+ gSystem->ExpandPathName("$(ALICE_ROOT)/PWG2/FORWARD/analysis2");
+ gROOT->LoadMacro(Form("%s/trains/BuildTrain.C", fwdPath));
+ BuildTrain("MakeMCCorrTrain");
+
MakeMCCorrTrain t(name, vzMin, vzMax);
t.SetDataDir(esddir);
t.SetDataSet("");
canvas->SetBottomMargin(0.15);
return canvas;
}
+
+//____________________________________________________________________
+void CleanStack(THStack* stack)
+{
+ TIter next(stack->GetHists());
+ TObject* o = 0;
+ while ((o = next())) {
+ TString name(o->GetName());
+ if (name.Contains("_t_"))
+ stack->RecursiveRemove(o);
+ }
+}
+
+
+//____________________________________________________________________
+THStack*
+AddToStack(TList* stacks, TList* fitter, const char* name)
+{
+ TObject* o = fitter->FindObject(name);
+ if (!o) {
+ Warning("AddToStack", "Object %s not found in %s", name,
+ fitter->GetName());
+ // fitter->ls();
+ return 0;
+ }
+ THStack* toAdd = static_cast<THStack*>(o);
+ CleanStack(toAdd);
+ Info("AddToStack", "Adding %s to stacks", name);
+ stacks->Add(toAdd);
+ return toAdd;
+}
+
//____________________________________________________________________
/**
}
canvas->Clear();
- THStack* chi2nu;
- THStack* c;
- THStack* delta;
- THStack* xi;
- THStack* sigma;
- THStack* sigman;
- THStack* n;
- TList stacks;
- stacks.Add(chi2nu = static_cast<THStack*>(fitter->FindObject("chi2")));
- stacks.Add(c = static_cast<THStack*>(fitter->FindObject("c")));
- stacks.Add(delta = static_cast<THStack*>(fitter->FindObject("delta")));
- stacks.Add(xi = static_cast<THStack*>(fitter->FindObject("xi")));
- stacks.Add(sigma = static_cast<THStack*>(fitter->FindObject("sigma")));
- stacks.Add(sigman = static_cast<THStack*>(fitter->FindObject("sigman")));
- stacks.Add(n = static_cast<THStack*>(fitter->FindObject("n")));
- Int_t baseA = stacks.GetEntries()+1;
- Int_t i=2;
+ TList stacks;
+ THStack* chi2nu = AddToStack(&stacks, fitter, "chi2");
+ THStack* c = AddToStack(&stacks, fitter, "c");
+ THStack* delta = AddToStack(&stacks, fitter, "delta");
+ THStack* xi = AddToStack(&stacks, fitter, "xi");
+ THStack* sigma = AddToStack(&stacks, fitter, "sigma");
+ THStack* sigman = AddToStack(&stacks, fitter, "sigman");
+ THStack* n = AddToStack(&stacks, fitter, "n");
+ Int_t baseA = stacks.GetEntries()+1;
+ Int_t i = 2;
while (true) {
- TObject* o = fitter->FindObject(Form("a%d",i++));
- if (!o) break;
- Info("DrawFits", "Adding %s", o->GetName());
- stacks.Add(o);
+ if (!AddToStack(&stacks, fitter, Form("a%d",i++)))
+ break;
}
// stacks.ls();
Int_t nMax = stacks.GetEntries();
if (!hasData) nMax--;
}
- canvas->SetRightMargin(0.05);
- canvas->SetTopMargin(0.05);
- canvas->Divide(2, (nMax+1)/2, 0.1, 0, 0);
+ canvas->SetRightMargin(0.01);
+ canvas->SetTopMargin(0.01);
+ Int_t nX = 2;
+ Int_t nY = (nMax+1) / 2;
+ canvas->Divide(nX, nY, 0.1, 0, 0);
TIter next(&stacks);
THStack* stack = 0;
Int_t b = 1;
while ((stack = static_cast<THStack*>(next()))) {
if (i > nMax) break;
- TVirtualPad* p = canvas->cd(1+i/5 + 2*(i%5));
- p->SetLeftMargin(.15);
+ Int_t ipad = 1+i/nY + 2 * (i % nY);
+ Info("DrawSummary", "cd'ing to canvas %d for %s", ipad,
+ stack->GetName());
+ TVirtualPad* p = canvas->cd(ipad);
+ p->SetLeftMargin(.6/nY);
+ p->SetTopMargin(.01);
+ p->SetRightMargin(.01);
p->SetFillColor(0);
p->SetFillStyle(0);
p->SetGridx();
if (i == 3) stack->SetMaximum(0.1); // xi
if (i == 4 || i == 5) stack->SetMaximum(0.5); // sigma{,n}
if (i == 7) stack->SetMaximum(0.5); // a
- yaxis->SetTitleSize(0.15);
+ if (i == 0) p->SetLogy();
+ yaxis->SetTitleSize(0.3/nY);
yaxis->SetLabelSize(0.08);
- yaxis->SetTitleOffset(0.35);
+ yaxis->SetTitleOffset(2.5/nY);
yaxis->SetNdivisions(5);
-
+ yaxis->SetTitleFont(42);
+ yaxis->SetLabelFont(42);
+ yaxis->SetDecimals();
+
TAxis* xaxis = stack->GetHistogram()->GetXaxis();
- xaxis->SetTitleSize(0.15);
+ xaxis->SetTitleSize(0.3/nY);
xaxis->SetLabelSize(0.08);
- xaxis->SetTitleOffset(0.35);
+ xaxis->SetTitleOffset(2./nY);
xaxis->SetNdivisions(10);
+ xaxis->SetTitleFont(42);
+ xaxis->SetLabelFont(42);
+ xaxis->SetDecimals();
// Redraw
stack->Draw("nostack");
if (i >= 5) b = 2;
p->cd();
}
+ canvas->SaveAs("fit_results.png");
canvas->Print(pdfName, "Title:Fit summary");
}
Error("PrintFits", "Couldn't get EDists list for FMD%d%c", d,r);
continue;
}
+
+ Info("DrawEtaBins", "Drawing for FMD%d%c", d, r);
TIter next(edists);
TH1* dist = 0;
Int_t i = 0;
Int_t j = 1;
while ((dist = static_cast<TH1*>(next()))) {
+ Info("DrawEtaBins", "FMD%d%c: %s", d, r, dist->GetName());
if (i == 4) {
i = 0;
j++;
* @ingroup pwg2_forward_scripts_corr
*/
void
-DrawAnaELoss(const char* fname="forward_eloss.root")
+DrawAnaELoss(const char* fname="forward_eloss.root", bool onlySummary=true)
{
if (!CheckCanvas()) {
Error("DrawFits", "No canvas");
return;
}
- canvas->Print(Form("%s[", pdfName));
+ if (!onlySummary) canvas->Print(Form("%s[", pdfName));
DrawSummary(fname);
+ if (onlySummary) return;
DrawRings(fname);
DrawEtaBins(fname);
canvas->Print(Form("%s]", pdfName));
+/**
+ * @file MakeChain.C
+ * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
+ * @date Tue Jul 12 10:20:07 2011
+ *
+ * @brief Script to generate a chain of files
+ *
+ * @ingroup pwg2_forward_scripts
+ */
+/**
+ * Check if a path points to a file
+ *
+ * @param path Path
+ *
+ * @return True if the path points to a regular file
+ *
+ * @ingroup pwg2_forward_scripts
+ */
+Bool_t
+IsFile(const char* path)
+{
+ Long_t id;
+ Long_t size;
+ Long_t flags;
+ Long_t modtime;
+ gSystem->GetPathInfo(path, &id, &size, &flags, &modtime);
+ return !((flags & 0x2) == 0x2);
+}
+
+/**
+ * Test if we can open a file
+ *
+ * @param name Name of file
+ * @param pattern Pattern to check against
+ *
+ * @return True on success
+ */
+Bool_t
+TestFile(const TString& name, const char* pattern=0)
+{
+ // If this is not a root file, ignore
+ if (!name.EndsWith(".root")) return false;
+
+ // If this file does not contain the pattern, ignore
+ if (pattern && pattern[0] != '\0' && !name.Contains(pattern)) return false;
+ if (name.Contains("friends")) return false;
+
+ Bool_t ret = true;
+ TFile* test = TFile::Open(data.Data(), "READ");
+ if (!test || test->IsZombie()) {
+ Warning("TestFile", "Failed to open file %s", data.Data());
+ ret = false;
+ }
+ else
+ test->Close();
+ return ret;
+}
+
/**
* Scan a directory (optionally recursive) for data files to add to
* the chain. Only ROOT files, and files which name contain the
continue;
}
- // If this is not a root file, ignore
- if (!name.EndsWith(".root")) continue;
-
- // If this file does not contain the pattern, ignore
- if (!name.Contains(pattern)) continue;
- if (name.Contains("friends")) continue;
-
// Get the path
TString data(Form("%s/%s", file->GetTitle(), name.Data()));
- TFile* test = TFile::Open(data.Data(), "READ");
- if (!test || test->IsZombie()) {
- Warning("ScanDirectory", "Failed to open file %s", data.Data());
- continue;
- }
- test->Close();
+ // Check the fuile
+ if (!TestFile(data, pattern)) continue;
chain->Add(data);
-
}
}
-
+/**
+ * Scan an input list of files
+ *
+ * @param chain Chain to add to
+ * @param path file with list of files to add
+ *
+ * @return true on success
+ */
+Bool_t
+ScanInputList(TChain* chain, const TString& path, const char* treeName)
+{
+ std::ifstream in(path.Data());
+ if (!in) {
+ Error("ScanInputList", "Failed to open input list %s", path.Data());
+ return false;
+ }
+ TString line;
+ while (in.good()) {
+ line.ReadLine(in); // Skip white-space
+ if (line.IsNull()) break; // Nothing -> EOF
+ if (line[0] == '#') continue; // Ignore comment lines
+ if (!TestFile(line, 0)) continue;
+ chain->Add(line);
+ }
+ in.close();
+ return true;
+}
+
+
/**
* Make a chain of specified data
*
// --- Our data chain ----------------------------------------------
TChain* chain = new TChain(treeName);
- // --- Get list of ESDs --------------------------------------------
+ // --- Get list of files --------------------------------------------
// Open source directory, and make sure we go back to were we were
TString oldDir(gSystem->WorkingDirectory());
- TSystemDirectory d(datadir, datadir);
- ScanDirectory(&d, chain, pattern, recursive);
-
+ TString path(gSystem->ExpandPathName(datadir));
+ if (!IsFile(path)) {
+ TSystemDirectory d(datadir, datadir);
+ ScanDirectory(&d, chain, pattern, recursive);
+ }
+ else if (path.EndsWith(".root")) {
+ if (TestFile(path, pattern)) chain->Add(path);
+ }
+ else {
+ // Input seems to be a list - parse it
+ ScanInputList(chain, path);
+ }
+
+ // Make sure we do not make an empty chain
+ if (chain->GetListOfFiles()->GetEntries() <= 0) {
+ Warning("MakeChain", "Chain %s is empty for input %s",
+ treeName, datadir);
+ delete chain;
+ chain = 0;
+ }
return chain;
}
//
+/**
+ * @file MakeAODTrain.C
+ * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
+ * @date Tue Jul 12 10:05:30 2011
+ *
+ * @brief Run first pass analysis - make AOD tree
+ *
+ * @ingroup pwg2_forward_trains
+ */
//====================================================================
/**
* Analysis train to make Forward and Central multiplicity
void CreateTasks(EMode mode, Bool_t par, AliAnalysisManager* mgr)
{
// --- Output file name ------------------------------------------
- AliAnalysisManager::SetCommonFileName("forward_eloss.root");
+ AliAnalysisManager::SetCommonFileName("forward_qa.root");
// --- Load libraries/pars ---------------------------------------
LoadLibrary("PWG2forward2", mode, par, true);