AliPhysics  vAN-20150429 (ffa5c54)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AddTaskMuonPerformance.C
Go to the documentation of this file.
1 AliAnalysisTaskMuonPerformance *AddTaskMuonPerformance(Bool_t correctClusterResForSystematics = kTRUE,
2  Bool_t fitClusterResiduals = kTRUE)
3 {
5 
6  // Get the pointer to the existing analysis manager via the static access method.
7  //==============================================================================
8  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
9  if (!mgr) {
10  ::Error("AddTaskMuonPerformance", "No analysis manager to connect to.");
11  return NULL;
12  }
13 
14  // This task requires an ESD input handler.
15  // Check this using the analysis manager.
16  //===============================================================================
17  TString type = mgr->GetInputEventHandler()->GetDataType();
18  if (!type.Contains("ESD")) {
19  ::Error("AddTaskMuonPerformance", "MuonPerformance task needs the manager to have an ESD input handler.");
20  return NULL;
21  }
22 
23  TString baseOutName = "muonPerformance.root";
24  TString outputfile = mgr->GetCommonFileName();
25  if ( ! outputfile.IsNull() ) outputfile += ":MUON_Performances";
26  else outputfile = baseOutName;
27 
28  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("EffContainer",AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,outputfile);
29  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("TriggerResolution",TObjArray::Class(),AliAnalysisManager::kOutputContainer,outputfile);
30  AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("TrackerResolution",TObjArray::Class(),AliAnalysisManager::kOutputContainer,outputfile);
31  AliAnalysisDataContainer *coutput4 = mgr->CreateContainer("Efficiency",TObjArray::Class(),AliAnalysisManager::kParamContainer,outputfile);
32  AliAnalysisDataContainer *coutput5 = mgr->CreateContainer("MomentumAtVtx",TObjArray::Class(),AliAnalysisManager::kParamContainer,outputfile);
33  AliAnalysisDataContainer *coutput6 = mgr->CreateContainer("SlopeAtVtx",TObjArray::Class(),AliAnalysisManager::kParamContainer,outputfile);
34  AliAnalysisDataContainer *coutput7 = mgr->CreateContainer("EtaAtVtx",TObjArray::Class(),AliAnalysisManager::kParamContainer,outputfile);
35  AliAnalysisDataContainer *coutput8 = mgr->CreateContainer("PhiAtVtx",TObjArray::Class(),AliAnalysisManager::kParamContainer,outputfile);
36  AliAnalysisDataContainer *coutput9 = mgr->CreateContainer("MomentumAtFirstCl",TObjArray::Class(),AliAnalysisManager::kParamContainer,outputfile);
37  AliAnalysisDataContainer *coutput10 = mgr->CreateContainer("SlopeAtFirstCl",TObjArray::Class(),AliAnalysisManager::kParamContainer,outputfile);
38  AliAnalysisDataContainer *coutput11 = mgr->CreateContainer("DCA",TObjArray::Class(),AliAnalysisManager::kParamContainer,outputfile);
39  AliAnalysisDataContainer *coutput12 = mgr->CreateContainer("Clusters",TObjArray::Class(),AliAnalysisManager::kParamContainer,outputfile);
40 
41  // Create the task, add it to the manager and configure it.
42  //===========================================================================
43  AliAnalysisTaskMuonPerformance *muonPerformanceTask = new AliAnalysisTaskMuonPerformance("muonPerformanceTask");
44  mgr->AddTask(muonPerformanceTask);
45  muonPerformanceTask->CorrectClusterResForSystematics(correctClusterResForSystematics);
46  muonPerformanceTask->FitClusterResiduals(fitClusterResiduals);
47 
48  // Create ONLY the output containers for the data produced by the task.
49  // Get and connect other common input/output containers via the manager as below
50  //==============================================================================
51  mgr->ConnectInput (muonPerformanceTask, 0, mgr->GetCommonInputContainer());
52  mgr->ConnectOutput (muonPerformanceTask, 1, coutput1);
53  mgr->ConnectOutput (muonPerformanceTask, 2, coutput2);
54  mgr->ConnectOutput (muonPerformanceTask, 3, coutput3);
55  mgr->ConnectOutput (muonPerformanceTask, 4, coutput4);
56  mgr->ConnectOutput (muonPerformanceTask, 5, coutput5);
57  mgr->ConnectOutput (muonPerformanceTask, 6, coutput6);
58  mgr->ConnectOutput (muonPerformanceTask, 7, coutput7);
59  mgr->ConnectOutput (muonPerformanceTask, 8, coutput8);
60  mgr->ConnectOutput (muonPerformanceTask, 9, coutput9);
61  mgr->ConnectOutput (muonPerformanceTask, 10, coutput10);
62  mgr->ConnectOutput (muonPerformanceTask, 11, coutput11);
63  mgr->ConnectOutput (muonPerformanceTask, 12, coutput12);
64 
65  return muonPerformanceTask;
66 }
void CorrectClusterResForSystematics(Bool_t flag=kTRUE)
set the flag to add or not the systematic shifts of the residuals to the resolution ...
void FitClusterResiduals(Bool_t flag=kTRUE)
set the flag to fit or not the cluster residuals to extract means and sigmas
AliAnalysisTaskMuonPerformance * AddTaskMuonPerformance(Bool_t correctClusterResForSystematics=kTRUE, Bool_t fitClusterResiduals=kTRUE)