AliPhysics  vAN-20150630 (513c479)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AddTaskMUONTrackingEfficiency.C
Go to the documentation of this file.
1 AliAnalysisTaskMuonTrackingEff *AddTaskMUONTrackingEfficiency(AliMuonTrackCuts &trackCuts, 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  taskMuonTrackingEff->SetMuonTrackCuts(trackCuts);
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("TracksDetectedPerChamber%s",suffix.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);
49  AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(Form("TotalTracksPerChamber%s",suffix.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);
50  AliAnalysisDataContainer *coutput4 = mgr->CreateContainer(Form("SingleDetectedPerChamber%s",suffix.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);
51  AliAnalysisDataContainer *coutput5 = mgr->CreateContainer(Form("ExtraHistos%s",suffix.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);
52  mgr->ConnectOutput(taskMuonTrackingEff, 1, coutput1);
53  mgr->ConnectOutput(taskMuonTrackingEff, 2, coutput2);
54  mgr->ConnectOutput(taskMuonTrackingEff, 3, coutput3);
55  mgr->ConnectOutput(taskMuonTrackingEff, 4, coutput4);
56  mgr->ConnectOutput(taskMuonTrackingEff, 5, coutput5);
57 
58  return taskMuonTrackingEff;
59 }
60 
void SetMuonTrackCuts(AliMuonTrackCuts &trackCuts)
tracking chamber efficiency from ESD data
AliAnalysisTaskMuonTrackingEff * AddTaskMUONTrackingEfficiency(AliMuonTrackCuts &trackCuts, TString extension="")