]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/muondep/RunRecoCheck.C
Extacting the OCDB in a separate module. The detectors have write permission in the...
[u/mrichter/AliRoot.git] / PWG3 / muondep / RunRecoCheck.C
1 //--------------------------------------------------------------------------
2 // Base macro for submitting AliMUONRecoCheck analysis.
3 //
4 // The macro reads ESDs, Kinematics and TrackRefs and outputs file:
5 // - RecoCheck.root
6 //--------------------------------------------------------------------------
7
8 void RunRecoCheck(Bool_t local = kFALSE) {
9
10   TStopwatch timer;
11   timer.Start();
12
13   gSystem->Load("libANALYSIS");
14   gSystem->Load("libANALYSISalice");
15
16   gSystem->Load("libPWG3muondep.so");
17
18   TChain* chain = new TChain("esdTree");
19
20   if (!local) {
21
22     printf("*** Connect to AliEn ***\n");
23     TGrid::Connect("alien://");
24     gSystem->Load("libProofPlayer.so");
25
26     TAlienCollection* coll = TAlienCollection::Open("wn.xml");
27     TGridResult* result = coll->GetGridResult("",0,0);
28     for(Int_t i = 0; i < result->GetEntries(); i++) {
29       printf("TURL = %s \n",result->GetKey(i,"turl"));
30       chain->Add(result->GetKey(i,"turl"));
31     }
32   } else {
33     chain->Add("/path_1_to/AliESDs.root");
34     chain->Add("/path_2_to/AliESDs.root");
35     chain->Add("/path_3_to/AliESDs.root");
36   }
37
38   // set the magnetic field for track extrapolations
39   // look in the OCDB for the value of the magnet current
40   AliCDBManager* cdb = AliCDBManager::Instance();
41   cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
42   //cdb->SetDefaultStorage("alien://Folder=/alice/simulation/2008/v4-10-Release/Ideal/");
43   cdb->SetRun(0);
44
45   AliCDBEntry *entry;
46   entry = cdb->Get("GRP/GRP/Data");
47   AliGRPObject *obj = (AliGRPObject*)entry->GetObject();
48   Float_t currentL3 = obj->GetL3Current(0);
49   printf("Loading field map for L3 current = %f A ...\n",currentL3);
50
51   AliLog::SetGlobalLogLevel(AliLog::kError);
52
53   //____________________________________________//
54   // Make the analysis manager
55   AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
56   AliVEventHandler* esdH = new AliESDInputHandler;
57   mgr->SetInputEventHandler(esdH);  
58   AliMCEventHandler *mc = new AliMCEventHandler();
59   mgr->SetMCtruthEventHandler(mc);
60
61   //____________________________________________//
62   // ntuple task
63   AliAnalysisTaskRecoCheck *task = new AliAnalysisTaskRecoCheck("TaskRecoCheck");
64   task->SetL3Current(currentL3);
65   mgr->AddTask(task);
66   
67   // Create containers for input/output
68
69   // input
70   AliAnalysisDataContainer *cinput = mgr->CreateContainer("cchain",TChain::Class(),AliAnalysisManager::kInputContainer);
71
72   // output
73   AliAnalysisDataContainer *coutput = mgr->CreateContainer("ctree", TTree::Class(),AliAnalysisManager::kOutputContainer,"RecoCheck.root");
74
75   //____________________________________________//
76   mgr->ConnectInput(task,0,cinput);
77   mgr->ConnectOutput(task,0,coutput);
78
79   if (mgr->InitAnalysis()) {
80     mgr->PrintStatus();
81
82     mgr->StartAnalysis("local",chain);
83
84   }
85
86   timer.Stop();
87   timer.Print();
88
89 }
90