AliPhysics  db95e02 (db95e02)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AddTaskMuonResolution.C
Go to the documentation of this file.
2  Double_t minPt = 0.,
3  Bool_t correctForSystematics = kTRUE,
4  Int_t extrapMode = 1)
5 {
7 
8 
9  // Get the pointer to the existing analysis manager via the static access method.
10  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
11  if(!mgr) {
12  Error("AddTaskMuonResolution","AliAnalysisManager not set!");
13  return NULL;
14  }
15 
16  // This task run on ESDs
17  TString type = mgr->GetInputEventHandler()->GetDataType();
18  if (!type.Contains("ESD")) {
19  Error("AddTaskMuonResolution", "ESD input handler needed!");
20  return NULL;
21  }
22 
23  // Create and configure task
25  if (!task) {
26  Error("AddTaskMuonResolution", "Muon resolution task cannot be created!");
27  return NULL;
28  }
29  task->SetMinMomentum(minMomentum);
30  task->SetMinPt(minPt);
31  task->CorrectForSystematics(correctForSystematics);
32  task->SetExtrapMode(extrapMode);
33 
34  // Add task to analysis manager
35  mgr->AddTask(task);
36 
37  // Connect input container
38  mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
39 
40  // Define output file directory
41  TString outputfile = AliAnalysisManager::GetCommonFileName();
42  if ( outputfile.IsNull() ) {
43  Error("AddTaskMuonResolution", "Common output file is not defined!");
44  return NULL;
45  }
46  outputfile += ":MUON_Resolution";
47 
48  // Create and connect output containers
49  AliAnalysisDataContainer *cout_histo1 = mgr->CreateContainer("Residuals", TObjArray::Class(), AliAnalysisManager::kOutputContainer, outputfile);
50  AliAnalysisDataContainer *cout_histo2 = mgr->CreateContainer("ResidualsVsP", TObjArray::Class(), AliAnalysisManager::kOutputContainer, outputfile);
51  AliAnalysisDataContainer *cout_histo3 = mgr->CreateContainer("ResidualsVsCent", TObjArray::Class(), AliAnalysisManager::kOutputContainer, outputfile);
52  AliAnalysisDataContainer *cout_histo4 = mgr->CreateContainer("ResidualsVsAngle", TObjArray::Class(), AliAnalysisManager::kOutputContainer, outputfile);
53  AliAnalysisDataContainer *cout_histo5 = mgr->CreateContainer("TrackRes", TObjArray::Class(), AliAnalysisManager::kOutputContainer, outputfile);
54  AliAnalysisDataContainer *cout_histo6 = mgr->CreateContainer("LocalChi2", TObjArray::Class(), AliAnalysisManager::kParamContainer, outputfile);
55  AliAnalysisDataContainer *cout_histo7 = mgr->CreateContainer("ChamberRes", TObjArray::Class(), AliAnalysisManager::kParamContainer, outputfile);
56  mgr->ConnectOutput(task, 1, cout_histo1);
57  mgr->ConnectOutput(task, 2, cout_histo2);
58  mgr->ConnectOutput(task, 3, cout_histo3);
59  mgr->ConnectOutput(task, 4, cout_histo4);
60  mgr->ConnectOutput(task, 5, cout_histo5);
61  mgr->ConnectOutput(task, 6, cout_histo6);
62  mgr->ConnectOutput(task, 7, cout_histo7);
63 
64  return task;
65 }
double Double_t
Definition: External.C:58
int Int_t
Definition: External.C:63
AliAnalysisTaskMuonResolution * AddTaskMuonResolution(Double_t minMomentum=0., Double_t minPt=0., Bool_t correctForSystematics=kTRUE, Int_t extrapMode=1)
Muon spectrometer resolution.
void SetMinPt(Double_t val)
set the minimum pT value of the tracks used to compute the resolution
void CorrectForSystematics(Bool_t flag=kTRUE)
set the flag to add or not the systematic shifts of the residuals to the resolution ...
bool Bool_t
Definition: External.C:53
void SetMinMomentum(Double_t val)
set the minimum momentum value of the tracks used to compute the resolution