New developments of the analysis framework - selectorised version of the manager...
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisManager.h
CommitLineData
d3106602 1#ifndef ALIANALYSISMANAGER_H
2#define ALIANALYSISMANAGER_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7// Author: Andrei Gheata, 31/05/2006
8
9//==============================================================================
10// AliAnalysysManager - Manager analysis class. Allows creation of several
11// analysis tasks and data containers storing their input/output. Allows
12// connecting/chaining tasks via shared data containers. Serializes the current
13// event for all tasks depending only on initial input data.
14//==============================================================================
15
16#ifndef ROOT_TSelector
17#include "TSelector.h"
18#endif
19
20class TClass;
21class AliAnalysisDataContainer;
22class AliAnalysisTask;
23
24class AliAnalysisManager : public TSelector {
25
26public:
27
28enum EAliAnalysisContType {
29 kNormalContainer = 0,
30 kInputContainer = 1,
31 kOutputContainer = 2
32};
33 AliAnalysisManager();
d3106602 34 virtual ~AliAnalysisManager();
35
36 // Selector-specific methods
37 virtual void Init(TTree *tree);
38 virtual void Begin(TTree *tree);
327eaf46 39 virtual Bool_t Notify();
d3106602 40 virtual void SlaveBegin(TTree *tree);
327eaf46 41 virtual Bool_t ProcessCut(Long64_t entry) {return Process(entry);}
d3106602 42 virtual Bool_t Process(Long64_t entry);
327eaf46 43 virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0);
d3106602 44 virtual void SlaveTerminate();
45 virtual void Terminate();
46
47 // Getters
327eaf46 48 TTree *GetTree() const {return fTree;}
d3106602 49 TObjArray *GetContainers() const {return fContainers;}
50 TObjArray *GetInputs() const {return fInputs;}
51 TObjArray *GetOutputs() const {return fOutputs;}
52 TObjArray *GetTasks() const {return fTasks;}
53 TObjArray *GetTopTasks() const {return fTopTasks;}
54 TObjArray *GetZombieTasks() const {return fZombies;}
55// AliAnalysisInfo *GetStatus() const {return fStatus;}
56
57 // Container handling
58 AliAnalysisDataContainer *CreateContainer(const char *name, TClass *datatype,
59 EAliAnalysisContType type=kNormalContainer);
60
61 // Including tasks and getting them
62 void AddTask(AliAnalysisTask *task);
63 AliAnalysisTask *GetTask(const char *name) const;
64
65 // Connecting data containers to task inputs/outputs
66 Bool_t ConnectInput(AliAnalysisTask *task, Int_t islot,
67 AliAnalysisDataContainer *cont);
68 Bool_t ConnectOutput(AliAnalysisTask *task, Int_t islot,
69 AliAnalysisDataContainer *cont);
70 // Garbage collection
71 void CleanContainers();
72
73 // Analysis initialization and execution, status
74 Bool_t InitAnalysis();
75 Bool_t IsInitialized() const {return fInitOK;}
76 void ResetAnalysis();
77 void ExecAnalysis(Option_t *option="");
78 void FinishAnalysis();
79 void PrintStatus(Option_t *option="all") const;
80
81protected:
327eaf46 82 TTree *fTree; // Input tree in case of TSelector model
d3106602 83 Bool_t fInitOK; // Initialisation done
84 TObjArray *fContainers; //-> List of all containers
85 TObjArray *fInputs; //-> List of containers with input data
86 TObjArray *fOutputs; //-> List of containers with results
87 TObjArray *fTasks; //-> List of analysis tasks
88 TObjArray *fTopTasks; //-> List of top tasks
89 TObjArray *fZombies; //-> List of zombie tasks
90// AliAnalysisInfo *fStatus; // Analysis info object
91
5daf9fd2 92private:
93 AliAnalysisManager(const AliAnalysisManager& other);
94 AliAnalysisManager& operator=(const AliAnalysisManager& other);
95
96
d3106602 97 ClassDef(AliAnalysisManager,1) // Analysis manager class
98};
99#endif