1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 #if !defined(__CINT__) || defined(__MAKECINT__)
24 #include "AliMUONCDB.h"
25 #include "AliMUONTriggerEfficiencyCells.h"
26 #include "AliCDBManager.h"
27 #include "AliCDBRunRange.h"
28 #include "Riostream.h"
33 /// \file MUONTriggerChamberEfficiency.C
34 /// \brief Macro to view and save the trigger chamber efficiency map
35 /// calculated during reconstruction.
37 /// Efficiency map can be made available for next simulation.
39 /// \author Diego Stocco, INFN Torino
41 void MUONTriggerChamberEfficiency(Bool_t addMapInSimulation=kFALSE,
42 const char *inputDir=".")
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
48 /// path to AliESDs.root (default ".")
50 Char_t filename[150], *className = "AliMUONTriggerEfficiencyCells";
51 sprintf(filename,"%s/AliESDs.root",inputDir);
53 TFile *file = new TFile(filename,"read");
55 cerr << "Cannot find " << filename << "\nExit!" << endl;
59 TTree *esdTree = (TTree*)file->Get("esdTree");
61 cerr << "Cannot find esdTree in " << filename << "\nExit!" << endl;
65 AliMUONTriggerEfficiencyCells *effMap =
66 (AliMUONTriggerEfficiencyCells*)esdTree->GetUserInfo()->FindObject(className);
68 cerr << "Cannot find " << className << " in esdTree.\nExit!" << endl;
72 effMap->DisplayEfficiency();
74 if(!addMapInSimulation) return;
76 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
77 AliMUONCDB::WriteToCDB("MUON/Calib/TriggerEfficiency",effMap,0,AliCDBRunRange::Infinity(),true);