AliPhysics  9fe175b (9fe175b)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AddTaskMUONTrackingEfficiency.C
Go to the documentation of this file.
1 AliAnalysisTaskMuonTrackingEff *AddTaskMUONTrackingEfficiency(Bool_t setDefaultTrackCuts, Bool_t isMC, TString extension = "")
2 {
3  //
4  // Task for the determination of the MUON tracking chamber efficiency
5  //
6  // lenhardt@subatech.in2p3.fr
7  // lardeux@subatech.in2p3.fr
8  //
9 
10  // Get the pointer to the existing analysis manager via the static access method
11  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
12  if (!mgr) {
13  ::Error("AddTaskMUONTrackingEfficiency", "No analysis manager to connect to.");
14  return NULL;
15  }
16 
17  // This task run on ESDs
18  TString type = mgr->GetInputEventHandler()->GetDataType();
19  if (!type.Contains("ESD")) {
20  ::Error("AddTaskMUONTrackingEfficiency", "ESD input handler needed!");
21  return NULL;
22  }
23 
24  // Define output file directory
25  TString fileName = AliAnalysisManager::GetCommonFileName();
26  if (fileName.IsNull()) {
27  ::Error("AddTaskMUONTrackingEfficiency", "Common output file is not defined!");
28  return NULL;
29  }
30  fileName += ":MUON_Efficiency";
31  TString suffix = (!extension.IsNull()) ? Form("_%s",extension.Data()) : "";
32  fileName += suffix;
33 
34 
35  // Create and configure task
36  TString name = Form("MuonTrackingEfficiency%s",extension.Data());
37  AliAnalysisTaskMuonTrackingEff* taskMuonTrackingEff = new AliAnalysisTaskMuonTrackingEff(name.Data());
38  if (setDefaultTrackCuts) taskMuonTrackingEff->SetDefaultMuonTrackCuts(isMC);
39 
40  // Add to the manager
41  mgr->AddTask(taskMuonTrackingEff);
42 
43  // Connect input container
44  mgr->ConnectInput (taskMuonTrackingEff, 0, mgr->GetCommonInputContainer());
45 
46  // Create and connect output containers
47  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(Form("ClustersCounters%s",suffix.Data()), AliCounterCollection::Class(), AliAnalysisManager::kOutputContainer, fileName);
48  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(Form("EventsCounters%s",suffix.Data()), AliCounterCollection::Class(), AliAnalysisManager::kOutputContainer, fileName);
49  AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(Form("TracksDetectedPerChamber%s",suffix.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);
50  AliAnalysisDataContainer *coutput4 = mgr->CreateContainer(Form("TotalTracksPerChamber%s",suffix.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);
51  AliAnalysisDataContainer *coutput5 = mgr->CreateContainer(Form("SingleDetectedPerChamber%s",suffix.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);
52  AliAnalysisDataContainer *coutput6 = mgr->CreateContainer(Form("ExtraHistos%s",suffix.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);
53  mgr->ConnectOutput(taskMuonTrackingEff, 1, coutput1);
54  mgr->ConnectOutput(taskMuonTrackingEff, 2, coutput2);
55  mgr->ConnectOutput(taskMuonTrackingEff, 3, coutput3);
56  mgr->ConnectOutput(taskMuonTrackingEff, 4, coutput4);
57  mgr->ConnectOutput(taskMuonTrackingEff, 5, coutput5);
58  mgr->ConnectOutput(taskMuonTrackingEff, 6, coutput6);
59 
60  return taskMuonTrackingEff;
61 }
62 
TString fileName
tracking chamber efficiency from ESD data
Bool_t isMC
AliAnalysisTaskMuonTrackingEff * AddTaskMUONTrackingEfficiency(Bool_t setDefaultTrackCuts, Bool_t isMC, TString extension="")