]>
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" |
a99c3449 | 26 | #include "AliCDBManager.h" |
aca1050a | 27 | #include "AliCDBRunRange.h" |
23567f21 | 28 | #include "Riostream.h" |
29 | ||
30 | #endif | |
31 | ||
e54bf126 | 32 | /// \ingroup macros |
33 | /// \file MUONTriggerChamberEfficiency.C | |
34 | /// \brief Macro to view and save the trigger chamber efficiency map | |
35 | /// calculated during reconstruction. | |
36 | /// | |
37 | /// Efficiency map can be made available for next simulation. | |
38 | /// | |
39 | /// \author Diego Stocco, INFN Torino | |
23567f21 | 40 | |
41 | void MUONTriggerChamberEfficiency(Bool_t addMapInSimulation=kFALSE, | |
311d0691 | 42 | const char *inputDir=".") |
23567f21 | 43 | { |
e54bf126 | 44 | /// \param addMapInSimulation (default kFALSE); |
45 | /// kTRUE: creates file MUON/Calib/TriggerEfficiency/Run0_99999999_v0_s?.root | |
46 | /// with calculated chamber efficiency which can be used in the next simulation | |
47 | /// \param inputDir | |
48 | /// path to AliESDs.root (default ".") | |
49 | ||
311d0691 | 50 | Char_t filename[150], *className = "AliMUONTriggerEfficiencyCells"; |
23567f21 | 51 | sprintf(filename,"%s/AliESDs.root",inputDir); |
52 | ||
53 | TFile *file = new TFile(filename,"read"); | |
54 | if(!file){ | |
55 | cerr << "Cannot find " << filename << "\nExit!" << endl; | |
56 | return; | |
57 | } | |
58 | ||
59 | TTree *esdTree = (TTree*)file->Get("esdTree"); | |
60 | if(!esdTree){ | |
61 | cerr << "Cannot find esdTree in " << filename << "\nExit!" << endl; | |
62 | return; | |
63 | } | |
64 | ||
311d0691 | 65 | AliMUONTriggerEfficiencyCells *effMap = |
66 | (AliMUONTriggerEfficiencyCells*)esdTree->GetUserInfo()->FindObject(className); | |
67 | if(!effMap){ | |
68 | cerr << "Cannot find " << className << " in esdTree.\nExit!" << endl; | |
23567f21 | 69 | return; |
70 | } | |
71 | ||
311d0691 | 72 | effMap->DisplayEfficiency(); |
23567f21 | 73 | |
74 | if(!addMapInSimulation) return; | |
75 | ||
a99c3449 | 76 | AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); |
77 | AliMUONCDB::WriteToCDB("MUON/Calib/TriggerEfficiency",effMap,0,AliCDBRunRange::Infinity(),true); | |
23567f21 | 78 | } |