forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFT0readEventsPerBc.C
More file actions
39 lines (33 loc) · 1.17 KB
/
FT0readEventsPerBc.C
File metadata and controls
39 lines (33 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#if !defined(__CLING__) || defined(__ROOTCLING__)
#include <iostream>
#include <array>
#include "CCDB/CcdbApi.h"
#include "TH1F.h"
#include "DataFormatsFT0/EventsPerBc.h"
#include "Framework/Logger.h"
#include "CommonConstants/LHCConstants.h"
#endif
std::unique_ptr<TH1F> hist;
std::unique_ptr<TCanvas> canvas;
void FT0readEventsPerBc(std::string ccdbUrl, long timestamp)
{
o2::ccdb::CcdbApi ccdbApi;
ccdbApi.init(ccdbUrl);
const std::string ccdbPath = "FT0/Calib/EventsPerBc";
std::map<std::string, std::string> metadata;
if (timestamp < 0) {
timestamp = o2::ccdb::getCurrentTimestamp();
}
EventsArray* events = ccdbApi.retrieveFromTFileAny<o2::ft0::EventsPerBc>(ccdbPath, metadata, timestamp);
if (!events) {
LOGP(fatal, "EventsPerBc object not found in {}/{} for timestamp {}.", ccdbUrl, ccdbPath, timestamp);
return;
}
hist = std::make_unique<TH1F>("eventsPerBcHist", "Events per BC", o2::constants::lhc::LHCMaxBunches, 0, o2::constants::lhc::LHCMaxBunches - 1);
for (int idx = 0; idx < o2::constants::lhc::LHCMaxBunches; idx++) {
hist->Fill(idx, events->histogram[idx]);
}
canvas = std::make_unique<TCanvas>();
hist->Draw();
canvas->Draw();
}