New implementation of the forward multiplicity analysis.
[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 */
6AliForwardMultiplicity*
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);
18 mgr->AddTask(task);
19
20 AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
21 AliMCEventHandler* mcHandler =
22 dynamic_cast<AliMCEventHandler*>(mgr->GetMCtruthEventHandler());
23 Info("AddTaskFMD", "MC handler %p", mcHandler);
24 if(mcHandler) {
25 pars->SetRealData(kFALSE);
26 pars->SetProcessPrimary(kTRUE);
27 pars->SetProcessHits(kFALSE);
28 }
29 else {
30 pars->SetRealData(kTRUE);
31 pars->SetProcessPrimary(kFALSE);
32 pars->SetProcessHits(kFALSE);
33 }
34 pars->Init();
35
36 TString outputfile = AliAnalysisManager::GetCommonFileName();
37 outputfile += Form(":%s",pars->GetDndetaAnalysisName());
38 AliAnalysisDataContainer* histOut =
39 mgr->CreateContainer("Forward", TList::Class(),
40 AliAnalysisManager::kOutputContainer,outputfile);
41
42
43 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
44 mgr->ConnectOutput(task, 1, histOut);
45
46 return task;
47}