EMCAL/AliEmcalClusterMaker.cxx
EMCAL/AliEmcalCompatTask.cxx
EMCAL/AliEmcalContainer.cxx
+ EMCAL/AliEmcalDebugTask.cxx
EMCAL/AliEmcalEsdTrackFilterTask.cxx
EMCAL/AliEmcalMCTrackSelector.cxx
EMCAL/AliEmcalParticle.cxx
--- /dev/null
+// $Id$
+//
+// Task to debug problems
+//
+// Author: C.Loizides
+
+#include "AliEmcalDebugTask.h"
+#include <TClonesArray.h>
+#include <TFile.h>
+#include <TRandom3.h>
+#include <TSystem.h>
+#include "AliAnalysisManager.h"
+#include "AliESDEvent.h"
+#include "AliInputEventHandler.h"
+#include "AliLog.h"
+
+ClassImp(AliEmcalDebugTask)
+
+//________________________________________________________________________
+AliEmcalDebugTask::AliEmcalDebugTask() :
+ AliAnalysisTaskSE(),
+ fId(0),
+ fFileTest(),
+ fPrintEnv(0),
+ fOutput(0),
+ fFileName(),
+ fRand(0)
+{
+ // Constructor.
+}
+
+//________________________________________________________________________
+AliEmcalDebugTask::AliEmcalDebugTask(const char *name) :
+ AliAnalysisTaskSE(name),
+ fId(0),
+ fFileTest(),
+ fPrintEnv(0),
+ fOutput(0),
+ fFileName(),
+ fRand(0)
+{
+ // Constructor.
+
+ DefineOutput(1, TList::Class());
+ fBranchNames = "ESD:AliESDHeader.,AliESDRun.,Tracks";
+}
+
+//________________________________________________________________________
+AliEmcalDebugTask::~AliEmcalDebugTask()
+{
+ // Destructor.
+}
+
+//________________________________________________________________________
+void AliEmcalDebugTask::UserCreateOutputObjects()
+{
+ // Create user objects
+
+ fOutput = new TList();
+ fOutput->SetOwner();
+
+ TRandom3 r(0);
+ fRand = r.Integer(kMaxUInt);
+ fOutput->Add(new TNamed(Form("%u",fId),Form("%u",fRand)));
+
+ AliInfo(Form("AliEmcalDebug: %u %u",fId,fRand));
+ if (fPrintEnv)
+ gSystem->Exec("env");
+
+ PostData(1, fOutput);
+}
+
+//________________________________________________________________________
+void AliEmcalDebugTask::UserExec(Option_t *)
+{
+ // Main loop, called for each event.
+
+ AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager();
+ if (!am) {
+ AliError("Manager zero, returning");
+ return;
+ }
+
+ TString filename;
+
+ TTree *t = am->GetTree();
+ if (t) {
+ TFile *f = t->GetCurrentFile();
+ if (f) {
+ filename = f->GetName();
+ }
+ }
+
+ if (filename==fFileName)
+ return;
+
+ if (fFileTest.Length()>0) {
+ if (!fFileName.Contains(fFileTest)) {
+ AliError(Form("Filename %s does not contain %s", fFileName.Data(), fFileTest.Data()));
+ return;
+ }
+ }
+ fFileName = filename;
+
+ AliInfo(Form("New file: %s", fFileName.Data()));
+ fOutput->Add(new TNamed(Form("%u:%u",fId,fRand),fFileName.Data()));
+}
--- /dev/null
+#ifndef ALIEMCALDEBUGTASK_H
+#define ALIEMCALDEBUGTASK_H
+
+// $Id$
+
+#include "AliAnalysisTaskSE.h"
+
+class AliEmcalDebugTask : public AliAnalysisTaskSE {
+ public:
+ AliEmcalDebugTask();
+ AliEmcalDebugTask(const char *name);
+ virtual ~AliEmcalDebugTask();
+
+ void SetId(UInt_t id) { fId = id; }
+ void SetFileTest(const char *n) { fFileTest = n; }
+ void SetPrintEnv(Bool_t b) { fPrintEnv = b; }
+
+ protected:
+ void UserCreateOutputObjects();
+ void UserExec(Option_t *option);
+
+ UInt_t fId; //id to be stored in the output file
+ TString fFileTest; //path name test
+ Bool_t fPrintEnv; //print env if true
+ TList *fOutput; //!output list
+ TString fFileName; //!current file name
+ UInt_t fRand; //!random number
+
+ private:
+ AliEmcalDebugTask(const AliEmcalDebugTask&); // not implemented
+ AliEmcalDebugTask &operator=(const AliEmcalDebugTask&); // not implemented
+
+ ClassDef(AliEmcalDebugTask, 1); // Class to be able to run on skimmed ESDs
+};
+
+#endif
--- /dev/null
+// $Id$
+
+AliEmcalDebugTask* AddTaskEmcalDebug(
+ const UInt_t id = 0,
+ const char *fnametest = 0,
+ const char *tnamebase = "DebugTask",
+ const char *outputfn = "AnalysisResults.root"
+)
+{
+ // Get the pointer to the existing analysis manager via the static access method.
+ //==============================================================================
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr)
+ {
+ ::Error("AddTaskEmcalCompat", "No analysis manager to connect to.");
+ return NULL;
+ }
+
+ // Check the analysis type using the event handlers connected to the analysis manager.
+ //==============================================================================
+ if (!mgr->GetInputEventHandler())
+ {
+ ::Error("AddTaskEmcalCompat", "This task requires an input event handler");
+ return NULL;
+ }
+
+ //-------------------------------------------------------
+ // Init the task and do settings
+ //-------------------------------------------------------
+
+ AliEmcalDebugTask *dtask = new AliEmcalDebugTask(tnamebase);
+ UInt_t tid = id;
+ if (id==0) {
+ TRandom3 r(0);
+ tid = r.Integer(kMaxUInt);
+ }
+ ::Info("AddTaskEmcalDebug","Setting up debug task with id %u", tid);
+ dtask->SetId(tid);
+ if (fnametest)
+ dtask->SetFileTest(fnametest);
+ dtask->SelectCollisionCandidates(0);
+
+ //-------------------------------------------------------
+ // Final settings, pass to manager and set the containers
+ //-------------------------------------------------------
+ mgr->AddTask(dtask);
+
+ // Create containers for input/output
+ AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
+ AliAnalysisDataContainer *coutput = mgr->CreateContainer(Form("%s_%u",tnamebase,tid),
+ TList::Class(),
+ AliAnalysisManager::kOutputContainer,
+ outputfn);
+ mgr->ConnectInput(dtask, 0, cinput);
+ mgr->ConnectOutput(dtask,1,coutput);
+
+ return dtask;
+}
#pragma link C++ class AliEmcalClusterMaker+;
#pragma link C++ class AliEmcalCompatTask+;
#pragma link C++ class AliEmcalContainer+;
+#pragma link C++ class AliEmcalDebugTask+;
#pragma link C++ class AliEmcalEsdTrackFilterTask;
#pragma link C++ class AliEmcalMCTrackSelector+;
#pragma link C++ class AliEmcalParticle+;