Automatically add files *AliESDs*.root in src directory to chain
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / AddTaskFMD.C
CommitLineData
7e4038b5 1/**
2 * This is the macro to include the Forward multiplicity in a train.
3 *
4 * @ingroup pwg2_forward_analysis_scripts
5 */
2d68d438 6AliAnalysisTask*
7e4038b5 7AddTaskFMD(Int_t nCutBins=1, Float_t correctionCut=0.1)
8{
9 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
10 if (!mgr) {
11 Error("AddTaskFMD", "No analysis manager to connect to.");
12 return NULL;
13 }
14
15 AliForwardMultiplicity* task = new AliForwardMultiplicity("FMD");
16 task->GetHistCollector().SetNCutBins(nCutBins);
17 task->GetHistCollector().SetCorrectionCut(correctionCut);
fea27ee0 18 task->SetLowFluxCut(1000);
7e4038b5 19 mgr->AddTask(task);
20
21 AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
22 AliMCEventHandler* mcHandler =
23 dynamic_cast<AliMCEventHandler*>(mgr->GetMCtruthEventHandler());
24 Info("AddTaskFMD", "MC handler %p", mcHandler);
25 if(mcHandler) {
26 pars->SetRealData(kFALSE);
27 pars->SetProcessPrimary(kTRUE);
28 pars->SetProcessHits(kFALSE);
29 }
30 else {
31 pars->SetRealData(kTRUE);
32 pars->SetProcessPrimary(kFALSE);
33 pars->SetProcessHits(kFALSE);
34 }
35 pars->Init();
36
37 TString outputfile = AliAnalysisManager::GetCommonFileName();
38 outputfile += Form(":%s",pars->GetDndetaAnalysisName());
39 AliAnalysisDataContainer* histOut =
40 mgr->CreateContainer("Forward", TList::Class(),
41 AliAnalysisManager::kOutputContainer,outputfile);
42
43
44 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
45 mgr->ConnectOutput(task, 1, histOut);
46
47 return task;
48}