In MUONTriggerChamberEfficiency.C:
[u/mrichter/AliRoot.git] / MUON / MUONTriggerChamberEfficiency.C
CommitLineData
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
a4342473 20#include "TGrid.h"
21#include "TString.h"
23567f21 22
23// MUON includes
24#include "AliMUONCDB.h"
a4342473 25#include "AliMUONCalibrationData.h"
23567f21 26#include "AliMUONTriggerEfficiencyCells.h"
f3d288ab 27#include "AliMUONTriggerChamberEfficiency.h"
a99c3449 28#include "AliCDBManager.h"
aca1050a 29#include "AliCDBRunRange.h"
23567f21 30#include "Riostream.h"
31
32#endif
33
e54bf126 34/// \ingroup macros
35/// \file MUONTriggerChamberEfficiency.C
36/// \brief Macro to view and save the trigger chamber efficiency map
37/// calculated during reconstruction.
38///
39/// Efficiency map can be made available for next simulation.
40///
f3d288ab 41/// \author Diego Stocco, Subatech, Nantes
23567f21 42
db438806 43void MUONTriggerChamberEfficiency(TString inputFile = "./MUON.TriggerEfficiencyMap.root",
44 TString outputCDB = "",
b36e1ffe 45 Int_t firstRun=0, Int_t lastRun = AliCDBRunRange::Infinity()
46)
23567f21 47{
a4342473 48/// \param inputFile (default "./MUON.TriggerEfficiencyMaps.root")
49/// File with the numerator and denominator histos for efficiency calculation
50/// (It is the output of the PWG3/muon/AliAnalysisTaskTrigChEff analysis
b36e1ffe 51/// \param outputCDB (default "")
52/// add the map on the specified CDB
a4342473 53/// \param firstRun (default 0)
54/// first run of validity for CDB object
55/// \param lastRun (default AliCDBRunRange::Infinity())
56/// last run of validity for CDB Object
e54bf126 57
a4342473 58 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
23567f21 59
db438806 60 AliMUONTriggerEfficiencyCells* effMap = new AliMUONTriggerEfficiencyCells(inputFile.Data());
b36e1ffe 61
db438806 62 if ( outputCDB.IsNull() ){
b36e1ffe 63 // Draw the efficiency and exit
a4342473 64 AliCDBManager::Instance()->SetRun(firstRun);
b36e1ffe 65 AliMUONTriggerChamberEfficiency* trigChEff = new AliMUONTriggerChamberEfficiency(effMap);
f3d288ab 66
b36e1ffe 67 trigChEff->DisplayEfficiency(kFALSE,kFALSE);
68 return;
a4342473 69 }
b36e1ffe 70
71
72 // Write efficiency on OCDB
73
db438806 74 AliCDBManager::Instance()->SetSpecificStorage("MUON/Calib/TriggerEfficiency", outputCDB.Data());
b36e1ffe 75
76 AliMUONCDB::WriteToCDB(effMap, "MUON/Calib/TriggerEfficiency", firstRun, lastRun, "Measured efficiencies");
a4342473 77}
78
79//____________________________________________________________
b36e1ffe 80void ShowOCDBmap(Int_t runNumber = 0, TString specificCDB="", TString ocdbPath = "local://$ALICE_ROOT/OCDB")
a4342473 81{
82/// \param runNumber (default 0)
83/// run number
b36e1ffe 84/// \param specificCDB (default "")
85/// specific CDB for trigger efficiency
a4342473 86/// \param ocdbPath(default "local://$ALICE_ROOT/OCDB")
87/// path to OCDB
88 if ( ocdbPath.BeginsWith("alien://") || ocdbPath.BeginsWith("raw://"))
89 TGrid::Connect("alien://");
23567f21 90
a4342473 91 AliCDBManager::Instance()->SetDefaultStorage(ocdbPath.Data());
b36e1ffe 92 if ( !specificCDB.IsNull() )
93 AliCDBManager::Instance()->SetSpecificStorage("MUON/Calib/TriggerEfficiency", specificCDB.Data());
a4342473 94 AliCDBManager::Instance()->SetRun(runNumber);
95 AliMUONCalibrationData calib(runNumber);
23567f21 96
b36e1ffe 97 AliMUONTriggerChamberEfficiency* trigChEff = new AliMUONTriggerChamberEfficiency(calib.TriggerEfficiency());
98 trigChEff->DisplayEfficiency();
23567f21 99}
a4342473 100