AliPhysics  ec7afe5 (ec7afe5)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AddTaskTrackingSysPropagation.C
Go to the documentation of this file.
3  TString filename = "",
4  TString filenameHistME = "",
5  TString filenameHistTrEff = "",
6  TString postname = "")
7 {
8 
9  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
10  if (!mgr) {
11  ::Error("AddTask", "No analysis manager to connect to.");
12  }
13 
14  // Check the analysis type using the event handlers connected to the analysis manager.
15  //==============================================================================
16  if (!mgr->GetInputEventHandler()) {
17  ::Error("AddTaskImpParDistrib", "This task requires an input event handler");
18  return NULL;
19  }
20 
21 
22  Bool_t stdcuts=kFALSE;
23  TFile* filecuts;
24  if( filename.EqualTo("") ) {
25  stdcuts=kTRUE;
26  } else {
27  filecuts=TFile::Open(filename.Data());
28  if(!filecuts ||(filecuts&& !filecuts->IsOpen())){
29  AliFatal("Cut object not found: analysis will not start!\n");
30  }
31  else printf("Cut object correctly found\n");
32  }
33 
34  //Analysis Task
35 
36  AliRDHFCuts* analysiscuts;
37 
38  if(ch==AliAnalysisTaskTrackingSysPropagation::kDstartoKpipi) analysiscuts = (AliRDHFCuts*)filecuts->Get("DStartoKpipiCuts");
39  else if(ch==AliAnalysisTaskTrackingSysPropagation::kD0toKpi) analysiscuts = (AliRDHFCuts*)filecuts->Get("D0toKpiCuts");
40  else analysiscuts = (AliRDHFCuts*)filecuts->Get("AnalysisCuts");
41 
42  TFile* fileMESys;
43  if( filenameHistME.EqualTo("") ) {
44  AliFatal("Histo with ME syst. not found: analysis will not start!\n");
45  } else {
46  fileMESys=TFile::Open(filenameHistME.Data());
47  if(!fileMESys ||(fileMESys&& !fileMESys->IsOpen())){
48  AliFatal("Histo with ME syst. not found: analysis will not start!\n");
49  }
50  }
51  TH1F *histoME = (TH1F*)fileMESys->Get("h");
52  if(!histoME) AliFatal("Histo with ME syst. not found: analysis will not start!\n");
53 
54 
55  TFile* fileTrEffSys;
56  if( filenameHistTrEff.EqualTo("") ) {
57  AliFatal("Histo with TrEff syst. not found: analysis will not start!\n");
58  } else {
59  fileTrEffSys=TFile::Open(filenameHistTrEff.Data());
60  if(!fileTrEffSys ||(fileTrEffSys&& !fileTrEffSys->IsOpen())){
61  AliFatal("Histo with TrEff syst. not found: analysis will not start!\n");
62  }
63  }
64  TH1F *histoTrEff = (TH1F*)fileTrEffSys->Get("hTrEff");
65  if(!histoTrEff) AliFatal("Histo TrEff not found: analysis will not start!\n");
66 
67 
68  AliAnalysisTaskTrackingSysPropagation *Task = new AliAnalysisTaskTrackingSysPropagation(ch, analysiscuts, histoME, histoTrEff);
69 
70  Task->SetDebugLevel(1);
71  mgr->AddTask(Task);
72 
73  // Create containers for input/output
74  TString outputFileName = AliAnalysisManager::GetCommonFileName();
75  outputFileName += Form(":MatchEff_%s",postname.Data());
76 
77  AliAnalysisDataContainer *coutput =0x0;
78  coutput = mgr->CreateContainer(Form("systUnc_%s",postname.Data()),
79  TList::Class(),
80  AliAnalysisManager::kOutputContainer,
81  outputFileName );
82 
83 
84  mgr->ConnectInput(Task,0,mgr->GetCommonInputContainer());
85  mgr->ConnectOutput(Task,1,coutput);
86 
87  return Task;
88 }
const char * filename
Definition: TestFCM.C:1
int Int_t
Definition: External.C:63
AliAnalysisTaskTrackingSysPropagation * AddTaskTrackingSysPropagation(Int_t system=0, AliAnalysisTaskTrackingSysPropagation::DecChannel ch, TString filename="", TString filenameHistME="", TString filenameHistTrEff="", TString postname="")
bool Bool_t
Definition: External.C:53