27 #include "AliCDBEntry.h"
28 #include "AliCDBManager.h"
30 #include "AliMergeableCollection.h"
38 #include "Riostream.h"
43 #include "TLegendEntry.h"
55 AliCDBManager* cdbm = AliCDBManager::Instance();
57 if (!cdbm->IsDefaultStorageSet()) {
58 cdbm->SetDefaultStorage(
59 "local:///cvmfs/alice-ocdb.cern.ch/calibration/data/2015/OCDB");
68 AliMergeableCollection*
BPEVO(Int_t runNumber,
const char* output =
"mchbepevo.complete.root")
70 AliCDBManager* cdb = AliCDBManager::Instance();
73 if (!cdb->IsDefaultStorageSet()) {
74 cdb->SetDefaultStorage(
75 "local:///cvmfs/alice-ocdb.cern.ch/calibration/data/2015/OCDB");
80 cdb->SetRun(runNumber);
82 AliCDBEntry* e = cdb->Get(
"MUON/Calib/BPEVO");
84 AliMergeableCollection* hc =
static_cast<AliMergeableCollection*
>(e->GetObject()->Clone());
103 AliMergeableCollection*
BPEVO(
const char* daoutput,
const char* output =
"mchbepevo.complete.root")
107 TFile*
f =
TFile::Open(gSystem->ExpandPathName(daoutput));
109 AliMergeableCollection* hc =
static_cast<AliMergeableCollection*
>(f->Get(
120 TFile*
fout =
TFile::Open(gSystem->ExpandPathName(output),
"RECREATE");
133 std::ofstream out(gSystem->ExpandPathName(filename));
137 out <<
"# Histogram the hit counts in 10 and 60 seconds bins" << std::endl
139 out <<
"+timeResolutions: 10s" << std::endl;
140 out <<
"+timeResolutions: 60s" << std::endl << std::endl;
142 out <<
"# maxDuration set to 5 hours" << std::endl << std::endl;
143 out <<
"maxDuration: 18000" << std::endl << std::endl;
145 out <<
"# number of events needed to take a decision" << std::endl
147 out <<
"nofEventsRequiredForDecision: 1000" << std::endl << std::endl;
149 out <<
"# occupancy threshold for alarm" << std::endl << std::endl;
150 out <<
"occupancyThreshold: 0.5" << std::endl << std::endl;
155 std::map<int, int> buspatches;
157 while ((bp = static_cast<AliMpBusPatch*>(next()))) {
171 buspatches[bp->
GetId()] = npads;
174 std::map<int, int>::const_iterator it;
177 out <<
"# +bp: buspatchId:nofPadsInThatBusPatch" << std::endl << std::endl;
179 for (it = buspatches.begin(); it != buspatches.end(); ++it) {
181 out <<
"+bp: " << it->first <<
":" << it->second << std::endl;
184 assert(total == 1064008);
199 while ((bp = static_cast<AliMpBusPatch*>(next()))) {
213 std::cout << Form(
"%s[%d]=%d;", buspatchmapname, bp->
GetId(), npads)
218 assert(total == 1064008);
223 void plot(
const std::vector<TH1*>& v, Double_t min, Double_t max, Double_t factor)
225 if ( !v.size() )
return;
232 TString title = v[0]->GetName();
233 title.ReplaceAll(
"RIGHT",
"");
234 title.ReplaceAll(
"LEFT",
"");
236 TLegend* legend =
new TLegend(0.8,0.1,0.99,0.90,title.Data());
237 legend->SetTextSize(0.08);
238 gPad->SetRightMargin(0.22);
240 for ( std::vector<TH1*>::size_type i = 0; i < v.size(); ++i )
244 TString tf = v[i]->GetXaxis()->GetTimeFormat();
246 tf.ReplaceAll(
":%s",
"");
247 v[i]->GetXaxis()->SetTimeFormat(tf.Data());
250 v[i]->SetMaximum(max);
251 v[i]->SetMinimum(min);
252 v[i]->GetYaxis()->SetLabelSize(0.10);
253 v[i]->GetXaxis()->SetLabelSize(0.10);
254 v[i]->GetYaxis()->SetRange(min,max);
255 Double_t integralError;
256 Double_t integral = v[i]->IntegralAndError(1,v[i]->GetNbinsX(),integralError);
257 integralError /= integral;
258 integral /= v[i]->GetNbinsX();
259 integralError *= integral;
260 TLegendEntry* entry = legend->AddEntry(v[i],Form(
"Mean %5.2g #pm %5.2g %%",integral,integralError));
261 entry->SetTextSize(0.04);
277 int timeResolution = 60) {
279 TCanvas* c =
new TCanvas(
"station",
"station");
282 for (
int i = 1; i <= 5; ++i) {
288 v.push_back(hc.Histo(Form(
"/STATION/OCC/%ds/STATION%dRIGHT", timeResolution, i)));
289 v.push_back(hc.Histo(Form(
"/STATION/OCC/%ds/STATION%dLEFT", timeResolution, i)));
290 v.push_back(hc.Histo(Form(
"/STATION/OCC/%ds/STATION%d", timeResolution, i)));
295 plot(v,1E-2,10,100.0);
303 int timeResolution = 60) {
305 TCanvas* c =
new TCanvas(
"chamber",
"chamber");
309 for (
int i = 1; i <= 2; ++i) {
315 int chamberId = (stationId-1)*2 + i;
317 v.push_back(hc.Histo(Form(
"/CHAMBER/OCC/%ds/CHAMBER%dRIGHT", timeResolution, chamberId)));
318 v.push_back(hc.Histo(Form(
"/CHAMBER/OCC/%ds/CHAMBER%dLEFT", timeResolution, chamberId)));
319 v.push_back(hc.Histo(Form(
"/CHAMBER/OCC/%ds/CHAMBER%d", timeResolution, chamberId)));
323 plot(v,1E-2,10,100.0);
329 int timeResolution = 60) {
331 TCanvas* c =
new TCanvas(
"ddl",
"ddl");
335 for (
int i = 1; i < 20; ++i ) {
341 v.push_back(hc.Histo(Form(
"/DDL/OCC/%ds/DDL%04d", timeResolution, 2560+i)));
345 plot(v,1E-2,10,100.0);
352 int timeResolution = 60) {
356 TCanvas* c =
new TCanvas(
"de",
"de");
362 it.
First(chamberId-1);
374 v.push_back(hc.Histo(Form(
"/DE/OCC/%ds/DE%04d", timeResolution, detElemId)));
380 plot(v,1E-2,10,100.0);
389 int timeResolution = 60) {
393 TCanvas* c =
new TCanvas(
"bp",
"bp");
399 c->DivideSquare(nbuspatches);
401 for (
int i = 1; i < nbuspatches; ++i ) {
407 v.push_back(hc.Histo(Form(
"/BUSPATCH/OCC/%ds/BP%04d", timeResolution, ddl->
GetBusPatchId(i))));
411 plot(v,1E-1,100,100.0);
Int_t GetNofManus() const
TFile * Open(const char *filename, Long64_t &nevents)
The iterator over detection elements.
void PlotDEOccupancies(AliMergeableCollection &hc, int chamberId=5, int timeResolution=60)
void MakeConfigFileForBPEVOda(const char *filename="mchbpevo.conf")
TFile f("CalibObjects.root")
Int_t GetDEfromBus(Int_t busPatchId) const
Int_t CurrentDEId() const
AliMpDetElement * GetDetElement(Int_t detElemId, Bool_t warn=true) const
Int_t GetManuId(Int_t index) const
The class defines the electronics properties of detection element.
The class defined electronics properties of DDL.
void PlotChamberOccupancies(AliMergeableCollection &hc, int stationId=3, int timeResolution=60)
static AliMpDDLStore * Instance(Bool_t warn=true)
Int_t GetNofBusPatches() const
AliMpDDL * GetDDL(Int_t ddlId, Bool_t warn=true) const
AliMergeableCollection * BPEVO(Int_t runNumber, const char *output="mchbepevo.complete.root")
Int_t GetId() const
Return the unique Id.
void PlotDDLOccupancies(AliMergeableCollection &hc, int timeResolution=60)
void PlotBusPatchOccupancies(AliMergeableCollection &hc, int ddlId=2575, int timeResolution=60)
void plot(const std::vector< TH1 * > &v, Double_t min, Double_t max, Double_t factor)
Int_t NofChannelsInManu(Int_t manuId) const
The class defines the properties of BusPatch.
void MakeConfigCodeForBPEVOda(const char *buspatchmapname="buspatches")
Int_t GetBusPatchId(Int_t index) const
Utility class to massage the output of the MCHBPEVO DA.
static Bool_t LoadAll(Bool_t warn=false)
void PlotStationOccupancies(AliMergeableCollection &hc, int timeResolution=60)