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