]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/MUONTriggerChamberEfficiency.C
Adapting to CORRFW changes (Chiara)
[u/mrichter/AliRoot.git] / MUON / MUONTriggerChamberEfficiency.C
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 "TGrid.h"
21 #include "TString.h"
22
23 // MUON includes
24 #include "AliMUONCDB.h"
25 #include "AliMUONCalibrationData.h"
26 #include "AliMUONTriggerEfficiencyCells.h"
27 #include "AliCDBManager.h"
28 #include "AliCDBRunRange.h"
29 #include "Riostream.h"
30
31 #endif
32
33 /// \ingroup macros
34 /// \file MUONTriggerChamberEfficiency.C
35 /// \brief Macro to view and save the trigger chamber efficiency map 
36 /// calculated during reconstruction.
37 ///
38 /// Efficiency map can be made available for next simulation.
39 ///
40 /// \author Diego Stocco, INFN Torino
41
42 void MUONTriggerChamberEfficiency(Char_t* inputFile="./MUON.TriggerEfficiencyMap.root",
43                                   Bool_t addMapInLocalOCDB = kFALSE,
44                                   Int_t firstRun=0, Int_t lastRun = AliCDBRunRange::Infinity(),
45                                   Bool_t useMeanValues = kFALSE)
46 {
47 /// \param inputFile (default "./MUON.TriggerEfficiencyMaps.root")
48 ///     File with the numerator and denominator histos for efficiency calculation
49 ///     (It is the output of the PWG3/muon/AliAnalysisTaskTrigChEff analysis
50 /// \param addMapInLocalOCDB (default kFALSE)
51 ///     if the map is OK, add it in local OCDB
52 /// \param firstRun (default 0)
53 ///     first run of validity for CDB object
54 /// \param lastRun (default AliCDBRunRange::Infinity())
55 ///     last run of validity for CDB Object
56 /// \param useMeanValues (default kFALSE)
57 ///     Fill local board maps with the average RPC efficiency
58 ///    (useful when the statistics is low (i.e. for cosmic runs))
59
60   AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
61
62   AliMUONTriggerEfficiencyCells* effMap = new AliMUONTriggerEfficiencyCells(inputFile);
63   if ( useMeanValues ){
64     AliCDBManager::Instance()->SetRun(firstRun);
65     effMap->LowStatisticsSettings();
66   }
67
68   if ( !addMapInLocalOCDB ){
69     AliCDBManager::Instance()->SetRun(firstRun);
70     effMap->DisplayEfficiency();
71   }
72   else
73     AliMUONCDB::WriteToCDB("MUON/Calib/TriggerEfficiency", effMap, firstRun, lastRun,true);
74 }
75
76 //____________________________________________________________
77 void ShowOCDBmap(Int_t runNumber = 0, TString ocdbPath="local://$ALICE_ROOT/OCDB")
78 {
79 /// \param runNumber (default 0)
80 ///     run number
81 /// \param ocdbPath(default "local://$ALICE_ROOT/OCDB")
82 ///     path to OCDB
83   if ( ocdbPath.BeginsWith("alien://") || ocdbPath.BeginsWith("raw://"))
84     TGrid::Connect("alien://");
85
86   AliCDBManager::Instance()->SetDefaultStorage(ocdbPath.Data());
87   AliCDBManager::Instance()->SetRun(runNumber);
88   AliMUONCalibrationData calib(runNumber);
89
90   calib.TriggerEfficiency()->DisplayEfficiency();
91 }
92