]>
Commit | Line | Data |
---|---|---|
23567f21 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | #if !defined(__CINT__) || defined(__MAKECINT__) | |
19 | // ROOT includes | |
20 | #include "TFile.h" | |
21 | #include "TTree.h" | |
22 | ||
23 | // MUON includes | |
24 | #include "AliMUONCDB.h" | |
23567f21 | 25 | #include "AliMUONTriggerEfficiencyCells.h" |
26 | ||
27 | #include "Riostream.h" | |
28 | ||
29 | #endif | |
30 | ||
31 | // Macro to view and save the trigger chamber efficiency map | |
32 | // calculated during reconstruction. | |
33 | // Efficiency map can be made available for next simulation. | |
34 | ||
35 | // Arguments: | |
36 | // | |
37 | // addMapInSimulation (default kFALSE): | |
38 | // kTRUE: creates file MUON/Calib/TriggerEfficiency/Run0_99999999_v0_s?.root | |
39 | // with calculated chamber efficiency which can be used in the next simulation | |
40 | // | |
41 | // inputDir (default "."): | |
42 | // path to AliESDs.root | |
23567f21 | 43 | |
44 | void MUONTriggerChamberEfficiency(Bool_t addMapInSimulation=kFALSE, | |
311d0691 | 45 | const char *inputDir=".") |
23567f21 | 46 | { |
311d0691 | 47 | Char_t filename[150], *className = "AliMUONTriggerEfficiencyCells"; |
23567f21 | 48 | sprintf(filename,"%s/AliESDs.root",inputDir); |
49 | ||
50 | TFile *file = new TFile(filename,"read"); | |
51 | if(!file){ | |
52 | cerr << "Cannot find " << filename << "\nExit!" << endl; | |
53 | return; | |
54 | } | |
55 | ||
56 | TTree *esdTree = (TTree*)file->Get("esdTree"); | |
57 | if(!esdTree){ | |
58 | cerr << "Cannot find esdTree in " << filename << "\nExit!" << endl; | |
59 | return; | |
60 | } | |
61 | ||
311d0691 | 62 | AliMUONTriggerEfficiencyCells *effMap = |
63 | (AliMUONTriggerEfficiencyCells*)esdTree->GetUserInfo()->FindObject(className); | |
64 | if(!effMap){ | |
65 | cerr << "Cannot find " << className << " in esdTree.\nExit!" << endl; | |
23567f21 | 66 | return; |
67 | } | |
68 | ||
311d0691 | 69 | effMap->DisplayEfficiency(); |
23567f21 | 70 | |
71 | if(!addMapInSimulation) return; | |
72 | ||
23567f21 | 73 | AliMUONCDB muonCDB; |
311d0691 | 74 | muonCDB.WriteToCDB("MUON/Calib/TriggerEfficiency",effMap,0,99999999,true); |
23567f21 | 75 | } |