AliPhysics  8d00e07 (8d00e07)
AliMultEventClassifierTask.cxx
Go to the documentation of this file.
2 #include "AliAODMultEventClass.h"
3 #include "AliLog.h"
4 #include "AliAnalysisManager.h"
5 #include "AliAODHandler.h"
6 #include "AliESDEvent.h"
7 
8 //____________________________________________________________________
11  fClassifier(),
12  fData(),
13  fList(0)
14 {}
15 
16 //____________________________________________________________________
18  : AliAnalysisTaskSE(name),
19  fClassifier("dummy"),
20  fData(),
21  fList(0)
22 {
23  DefineOutput(1,TList::Class());
24 }
25 //____________________________________________________________________
28  : AliAnalysisTaskSE(o),
30  fData(o.fData),
31  fList(0)
32 {
33  if (o.fList) fList = static_cast<TList*>(o.fList->Clone());
34 }
35 //____________________________________________________________________
38 {
39  if (&o == this) return *this;
40 
41  AliAnalysisTaskSE::operator=(o);
42 
44  fData = o.fData;
45 
46  if (fList) { delete fList; fList = 0; }
47  if (o.fList) fList = static_cast<TList*>(o.fList->Clone());
48 
50 
51  return *this;
52 }
53 
54 //____________________________________________________________________
55 Bool_t
57 {
58  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
59  if (!mgr) {
60  Error("AddTaskForwardMult", "No analysis manager to connect to.");
61  return false;
62  }
63 
64  // Add to the manager
65  mgr->AddTask(this);
66 
67  // Create and connect output containers
68  TString sumOut;
69  if (sumFile && sumFile[0] != '\0') sumOut = sumFile;
70  // If the string is null or 'default' connect to standard output file
71  if (sumOut.IsNull() || sumOut.EqualTo("default", TString::kIgnoreCase))
72  sumOut = AliAnalysisManager::GetCommonFileName();
73 
74  // Always connect input
75  mgr->ConnectInput(this, 0, mgr->GetCommonInputContainer());
76 
77  // Connect sum list unless the output 'none' is specified
78  if (!sumOut.EqualTo("none", TString::kIgnoreCase)) {
79  TString sumName(Form("%s%s", GetName(), "Sums"));
80  AliAnalysisDataContainer* sumCon =
81  mgr->CreateContainer(sumName, TList::Class(),
82  AliAnalysisManager::kOutputContainer, sumOut);
83  mgr->ConnectOutput(this, 1, sumCon);
84  }
85 
86  return true;
87 }
88 
89 //____________________________________________________________________
90 void
92 {
93  fList = new TList;
94  fList->SetOwner();
95  fList->SetName("MultClass");
96 
98 
99  AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
100  AliAODHandler* ah =
101  dynamic_cast<AliAODHandler*>(am->GetOutputEventHandler());
102 
103  if (ah) {
104  TObject* data = &fData;
105  ah->AddBranch(fData.ClassName(), &data);
106  }
107 
108  PostData(1, fList);
109 }
110 //____________________________________________________________________
111 void
113 {
114  fData.Clear();
115 
116  LoadBranches();
117 
118  AliESDEvent* esd = dynamic_cast<AliESDEvent*>(InputEvent());
119  if (!esd) {
120  AliWarning("No ESD event found for input event");
121  return;
122  }
123 
124  fClassifier.Process(esd, &fData);
125 
126  AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
127  AliAODHandler* ah =
128  dynamic_cast<AliAODHandler*>(am->GetOutputEventHandler());
129  if (ah) ah->SetFillAOD(kTRUE);
130 
131  PostData(1,fList);
132 }
133 //____________________________________________________________________
134 void
136 {}
137 //____________________________________________________________________
138 //
139 // EOF
140 //
void Process(AliESDEvent *esd, AliAODMultEventClass *data)
AliMultEventClassifierTask & operator=(const AliMultEventClassifierTask &o)
virtual void Clear(Option_t *option="")
Bool_t Connect(const char *sumFile)
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53