AliPhysics  b555aef (b555aef)
TrackletAODTrain.C
Go to the documentation of this file.
1 
10 #include "TrainSetup.C"
11 #include <sstream>
12 
13 //====================================================================
21 class TrackletAODTrain : public TrainSetup
22 {
23 public:
29  TrackletAODTrain(const TString& name)
30  : TrainSetup(name)
31  {
32  // Other options
33  fOptions.Add("copy", "LIST", "',' separated list to copy","cent");
34  fOptions.Add("mc-tracks", "Enable MC track filter", false);
35  fOptions.Add("tpc-ep", "Use TPC event plane");
36  fOptions.Add("cent", "Use centrality");
37  // SPD tracklet options
38  fOptions.Add("max-delta", "X","Cut on weighted distance",25.);
39  fOptions.Add("scale-dtheta", "Scale dTheta" , true);
40  fOptions.Add("dphi-window", "X","dPhi window", 0.06);
41  fOptions.Add("dtheta-window", "X","dTheta window", 0.025);
42  fOptions.Add("dphi-shift", "X","Bending shift", 0.0045);
43  fOptions.Add("phi-overlap-cut", "X","Phi overlap cut", 0.005);
44  fOptions.Add("z-eta-overlap-cut","X","Z-Eta overlap cut", 0.05);
45  fOptions.Add("filter-mode", "MODE","Filter strange clusters", 0);
46  fOptions.Add("filter-weight", "FILE","File with filter weights", "");
47  fOptions.Add("need-clusters", "If set, insist on RecPoints",false);
48  fOptions.Set("type", "ESD");
49  }
50 protected:
61  AliVEventHandler* CreateInputHandler(UShort_t type, Bool_t needRec=false)
62  {
63  Bool_t needRP = fOptions.AsBool("need-clusters");
64  return TrainSetup::CreateInputHandler(type, needRP);
65  }
75  AliVEventHandler* CreateMCHandler(UShort_t type, bool mc)
76  {
77  AliMCEventHandler* ret =
78  static_cast<AliMCEventHandler*>(TrainSetup::CreateMCHandler(type,mc));
79  if (ret) ret->SetPreReadMode(AliMCEventHandler::kLmPreRead);
80  return ret;
81  }
82 
91  {
92  // --- Add TPC eventplane task
93  if (fOptions.Has("tpc-ep")) CoupleSECar("AddTaskEventplane.C","", mask);
94 
95  // --- Task to copy header information ---------------------------
96  TString cpy = fOptions.Get("copy");
97  Info("", "What to copy: %s", cpy.Data());
98  CoupleSECar("AddTaskCopyHeader.C", Form("\"%s\"", cpy.Data()), mask);
99  }
108  {
109  // --- Output file name ------------------------------------------
110  AliAnalysisManager::SetCommonFileName("tracklet.root");
111 
112  // Load our sources
113  fRailway->LoadSource("FixPaths.C");
114  fRailway->LoadSource("AliAODSimpleHeader.C");
115  fRailway->LoadSource("AliSimpleHeaderTask.C");
116  fRailway->LoadSource("AliAODTracklet.C");
117  fRailway->LoadSource("AliTrackletWeights.C");
118  fRailway->LoadSource("AliTrackletAODUtils.C");
119  fRailway->LoadSource("AliTrackletAODTask.C");
120 
121  // --- Task to create simple header ------------------------------
122  if (!gROOT->ProcessLine("AliSimpleHeaderTask::Create()"))
123  Fatal("CoupleTrackletTask", "Failed to make simple header task");
124 
125  // --- Create the task using interpreter -------------------------
126  Long_t ret =
127  gROOT->ProcessLine(Form("AliTrackletAODTask::Create(\"%s\")",
128  fOptions.AsString("filter-weight")));
129  AliAnalysisTaskSE* task = reinterpret_cast<AliAnalysisTaskSE*>(ret);
130  if (!task)
131  Fatal("CoupleTrackletCar", "Failed to make tracklet task");
132 
133  // --- Set various options on task -------------------------------
134  FromOption(task, "MaxDelta", "max-delta", 25.);
135  FromOption(task, "ScaleDTheta", "scale-dtheta", true);
136  FromOption(task, "DPhiWindow", "dphi-window", 0.06);
137  FromOption(task, "DThetaWindow", "dtheta-window", 0.025);
138  FromOption(task, "DPhiShift", "dphi-shift", 0.0045);
139  FromOption(task, "PhiOverlapCut", "phi-overlap-cut" , 0.005);
140  FromOption(task, "ZEtaOverlapCut", "z-eta-overlap-cut", 0.05);
141  FromOption(task, "FilterMode", "filter-mode", 0);
142  }
151  {
152  // --- Output file name ------------------------------------------
153  AliAnalysisManager::SetCommonFileName("AnalysisResults.root");
154  // --- Add MC particle task --------------------------------------
155  if (!mc || !fOptions.Has("mc-tracks")) return;
156  CoupleSECar("AddTaskMCParticleFilter.C","", mask);
157  }
164  {
165  // --- Load libraries/pars ---------------------------------------
166  fRailway->LoadLibrary("PWGLFforward2");
167 
168  // --- Set load path ---------------------------------------------
169  TString mp(gROOT->GetMacroPath());
170  mp.Append(":$(ALICE_PHYSICS)/PWGLF/FORWARD/analysis2");
171  mp.Append(":$(ALICE_ROOT)/ANALYSIS/macros");
172  mp.Append(":$(ALICE_PHYSICS)/PWGLF/FORWARD/analysis2/dndeta/tracklets3");
173  gROOT->SetMacroPath(mp);
174 
175  // --- Check if this is MC ---------------------------------------
176  Bool_t mc = mgr->GetMCtruthEventHandler() != 0;
177  UInt_t mask = AliVEvent::kAny;
178 
179  // --- Couple our tasks ------------------------------------------
180  CouplePreCars (mgr, mc, mask);
181  CoupleTrackletCar(mgr, mc, mask);
182  CouplePostCars (mgr, mc, mask);
183  }
184  //__________________________________________________________________
191  {
192  if (!fOptions.Has("cent")) return;
194  }
195  //__________________________________________________________________
196  const char* ClassName() const { return "TrackletAODTrain"; }
197  //__________________________________________________________________
204  void SaveSetup(Bool_t asShellScript)
205  {
206  TrainSetup::SaveSetup(asShellScript);
207  }
213  void PostShellCode(std::ostream& f)
214  {
215  f << " echo \"=== Summarizing results ...\"\n"
216  << " aliroot -l -b -q ${prefix}Summarize.C\n"
217  << std::endl;
218  }
219 };
220 //
221 // EOF
222 //
virtual void CreateCentralitySelection(Bool_t mc)
Definition: TrainSetup.C:760
virtual AliVEventHandler * CreateInputHandler(UShort_t type, Bool_t esdRecPoints=false)
Definition: TrainSetup.C:539
void CoupleTrackletCar(AliAnalysisManager *mgr, Bool_t mc, UInt_t mask)
Railway * fRailway
Definition: TrainSetup.C:1674
void PostShellCode(std::ostream &f)
TrackletAODTrain(const TString &name)
Bool_t AsBool(const TString &name) const
Definition: Option.C:631
AliVEventHandler * CreateInputHandler(UShort_t type, Bool_t needRec=false)
virtual AliVEventHandler * CreateMCHandler(UShort_t, bool mc)
Definition: TrainSetup.C:583
const char * AsString(const TString &name, const TString &def="") const
Definition: Option.C:687
void CreateCentralitySelection(Bool_t mc)
const TString & Get(const TString &name) const
Definition: Option.C:596
Bool_t Has(const TString &name) const
Definition: Option.C:584
unsigned int UInt_t
Definition: External.C:33
void SaveSetup(Bool_t asShellScript)
void Set(const TString &name, const TString &value)
Definition: Option.C:736
void CouplePostCars(AliAnalysisManager *mgr, Bool_t mc, UInt_t mask)
const char * ClassName() const
Base classs for train specifications.
Option * Add(const TString &name, const TString &arg, const TString &desc, const TString &val="")
Definition: Option.C:421
virtual void SaveSetup(Bool_t asShellScript)
Definition: TrainSetup.C:1479
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, Double_t defval)
Definition: TrainSetup.C:1236
OptionList fOptions
Definition: TrainSetup.C:1673
unsigned short UShort_t
Definition: External.C:28
AliVEventHandler * CreateMCHandler(UShort_t type, bool mc)
void CreateTasks(AliAnalysisManager *mgr)
bool Bool_t
Definition: External.C:53
void CouplePreCars(AliAnalysisManager *mgr, Bool_t mc, UInt_t mask)
virtual AliAnalysisTaskSE * CoupleSECar(const TString &macro, const TString &args, UInt_t mask=0)
Definition: TrainSetup.C:883
virtual Bool_t LoadLibrary(const TString &name, Bool_t slave=true, Bool_t forcePar=false)=0
virtual Bool_t LoadSource(const TString &name, bool copy=false)
Definition: Railway.C:231