Fixing an error in the computation of the efficiency of a whole chamber (Matthieu)
[u/mrichter/AliRoot.git] / PWG3 / muondep / AddTaskMUONTrackingEfficiency.C
CommitLineData
6db6876c 1AliAnalysisTaskMuonTrackingEff *AddTaskMUONTrackingEfficiency(Bool_t isCosmicData = kFALSE)
2{
3 //
4 // Task for the determination of the MUON trigger chamber efficiency
5 //
6 // lenhardt@subatech.in2p3.fr
7 //
8
9
10 // Get the pointer to the existing analysis manager via the static access method.
11 //==============================================================================
12 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
13 if (!mgr) {
14 ::Error("AddTask", "No analysis manager to connect to.");
15 return NULL;
16 }
17
18
19 const Char_t* fileName = "MUON.TrackerEfficiency.root";
20
21
22 // Load the geometry
23 AliMUONGeometryTransformer transformer = new AliMUONGeometryTransformer();
24 transformer->LoadGeometryData();
25
26
27 // Create the task
28 AliAnalysisTaskMuonTrackingEff* taskMuonTrackingEff = new AliAnalysisTaskMuonTrackingEff("MuonTrackingEfficiency", transformer, isCosmicData);
29 // Add to the manager
30 mgr->AddTask(taskMuonTrackingEff);
31
32
33 //
34 // Create containers for input/output
35 AliAnalysisDataContainer* cinput0 = mgr->GetCommonInputContainer();
36
37 AliAnalysisDataContainer *coutput0 =
38 mgr->CreateContainer("TracksDetectedPerDE", TClonesArray::Class(),AliAnalysisManager::kOutputContainer, fileName);
39 AliAnalysisDataContainer *coutput1 =
40 mgr->CreateContainer("TotalTracksPerDE", TClonesArray::Class(),AliAnalysisManager::kOutputContainer, fileName);
41 AliAnalysisDataContainer *coutput2 =
42 mgr->CreateContainer("EfficiencyPerDE", TClonesArray::Class(),AliAnalysisManager::kOutputContainer, fileName);
43 AliAnalysisDataContainer *coutput3 =
44 mgr->CreateContainer("TracksDetectedPerChamber", TClonesArray::Class(),AliAnalysisManager::kOutputContainer, fileName);
45 AliAnalysisDataContainer *coutput4 =
46 mgr->CreateContainer("TotalTracksPerChamber", TClonesArray::Class(),AliAnalysisManager::kOutputContainer, fileName);
47 AliAnalysisDataContainer *coutput5 =
48 mgr->CreateContainer("EfficiencyPerChamber", TClonesArray::Class(),AliAnalysisManager::kOutputContainer, fileName);
49
50 // Attach input
51 mgr->ConnectInput (taskMuonTrackingEff, 0, cinput0 );
52 // Attach output
53 mgr->ConnectOutput(taskMuonTrackingEff, 0, coutput0);
54 mgr->ConnectOutput(taskMuonTrackingEff, 1, coutput1);
55 mgr->ConnectOutput(taskMuonTrackingEff, 2, coutput2);
56 mgr->ConnectOutput(taskMuonTrackingEff, 3, coutput3);
57 mgr->ConnectOutput(taskMuonTrackingEff, 4, coutput4);
58 mgr->ConnectOutput(taskMuonTrackingEff, 5, coutput5);
59
60 delete transformer;
61 return taskMuonTrackingEff;
62}