Extacting the OCDB in a separate module. The detectors have write permission in the...
[u/mrichter/AliRoot.git] / PWG3 / muondep / MuonTrackingEffAnalysis.C
1 // 2008
2 // Macro for the running of the AliAnalysisTaskMuonTrackingEff
3 //
4
5 // ROOT includes
6 #include <TROOT.h>
7 #include <TSystem.h>
8 #include <TChain.h>
9 #include <TFile.h>
10 #include <TClonesArray.h>
11
12 // PWG3 includes
13 #include "AliAnalysisTaskMuonTrackingEff.h"
14
15 // ANALYSIS includes
16 #include "AliAnalysisManager.h"
17 #include "AliAnalysisDataContainer.h"
18
19 // STEER includes
20 #include "AliESDInputHandler.h"
21 #include "AliCDBManager.h"
22
23 // MUON includes
24 #include "AliMUONGeometryTransformer.h"
25
26
27
28 void MuonTrackingEffAnalysis(const Bool_t alien = false, const Int_t run = 100, const char * fileName = "AliESDs.root", const char * geometryFileName = "geometry.root")
29 {
30 //Chain construction
31     TChain *chain = new TChain("esdTree");
32     chain->Add(fileName);
33
34 //Load OCD
35     AliCDBManager* man = AliCDBManager::Instance();
36     TString ocdbPath;
37     if(alien)
38     {
39       ocdbPath = "alien://folder=/alice/data/2008/LHC08a/OCDB";
40     }
41     else
42     {
43       ocdbPath = "local://$ALICE_ROOT/OCDB";
44     }
45
46     man->SetDefaultStorage(ocdbPath.Data());
47     man->SetSpecificStorage("MUON/Calib/Mapping",ocdbPath);
48     man->SetRun(run);
49  
50 //Load Geometry
51     AliMUONGeometryTransformer* transformer = new AliMUONGeometryTransformer();
52     transformer->LoadGeometryData(geometryFileName);
53
54
55 //Make analysis manager:
56     AliAnalysisManager* mgr = new AliAnalysisManager("Manager", "Manager");  
57     AliAnalysisTaskMuonTrackingEff* ESDTask = new AliAnalysisTaskMuonTrackingEff("ESDTask", transformer);
58     AliESDInputHandler* inHandler = new AliESDInputHandler();
59
60     mgr->SetInputEventHandler  (inHandler );
61 //     mgr->SetDebugLevel(10);
62     mgr->AddTask(ESDTask);
63
64 //Create containers for input/output
65     AliAnalysisDataContainer* cinput1  =
66         mgr->CreateContainer("cchain1",TChain::Class(),AliAnalysisManager::kInputContainer);
67     AliAnalysisDataContainer *coutput1 =
68         mgr->CreateContainer("chistlist1", TClonesArray::Class(),AliAnalysisManager::kOutputContainer, "MuonTrackingChamberEffHistos.root"); 
69
70 //Connection
71     mgr->ConnectInput (ESDTask, 0, cinput1 );
72     mgr->ConnectOutput(ESDTask, 0, coutput1);
73    
74 //Run analysis
75     if(mgr->InitAnalysis())
76     {
77       //mgr->PrintStatus();
78       mgr->StartAnalysis("Local", chain);
79     }
80