116 events_per_bx = ibooker.
book1D(
"events per BX",
"rp;Event.BX", 4002, -1.5, 4000. + 0.5);
117 events_per_bx_short = ibooker.
book1D(
"events per BX (short)",
"rp;Event.BX", 102, -1.5, 100. + 0.5);
126 RPState = ibooker.
book2D(
"rpstate per LS",
127 "RP State per Lumisection;Luminosity Section;",
135 TH2F *
hist = RPState->getTH2F();
136 hist->SetCanExtend(TH1::kAllAxes);
137 TAxis *ya =
hist->GetYaxis();
138 ya->SetBinLabel(1,
"45, 210, FR-BT");
139 ya->SetBinLabel(2,
"45, 210, FR-HR");
140 ya->SetBinLabel(3,
"45, 210, FR-TP");
141 ya->SetBinLabel(4,
"45, 220, C1");
142 ya->SetBinLabel(5,
"45, 220, FR-BT");
143 ya->SetBinLabel(6,
"45, 220, FR-HR");
144 ya->SetBinLabel(7,
"45, 220, FR-TP");
145 ya->SetBinLabel(8,
"45, 220, NR-BT");
146 ya->SetBinLabel(9,
"45, 220, NR-HR");
147 ya->SetBinLabel(10,
"45, 220, NR-TP");
148 ya->SetBinLabel(11,
"56, 210, FR-BT");
149 ya->SetBinLabel(12,
"56, 210, FR-HR");
150 ya->SetBinLabel(13,
"56, 210, FR-TP");
151 ya->SetBinLabel(14,
"56, 220, C1");
152 ya->SetBinLabel(15,
"56, 220, FR-BT");
153 ya->SetBinLabel(16,
"56, 220, FR-HR");
154 ya->SetBinLabel(17,
"56, 220, FR-TP");
155 ya->SetBinLabel(18,
"56, 220, NR-BT");
156 ya->SetBinLabel(19,
"56, 220, NR-HR");
157 ya->SetBinLabel(20,
"56, 220, NR-TP");
160 h_trackCorr_hor = ibooker.
book2D(
"track correlation hor",
"ctpps_common_rp_hor", 8, -0.5, 7.5, 8, -0.5, 7.5);
162 TH2F *
hist = h_trackCorr_hor->getTH2F();
163 TAxis *xa =
hist->GetXaxis(), *ya =
hist->GetYaxis();
164 xa->SetBinLabel(1,
"45, 210, FR");
165 ya->SetBinLabel(1,
"45, 210, FR");
166 xa->SetBinLabel(2,
"45, 220, NR");
167 ya->SetBinLabel(2,
"45, 220, NR");
168 xa->SetBinLabel(3,
"45, 220, C1");
169 ya->SetBinLabel(3,
"45, 220, C1");
170 xa->SetBinLabel(4,
"45, 220, FR");
171 ya->SetBinLabel(4,
"45, 220, FR");
173 xa->SetBinLabel(5,
"56, 210, FR");
174 ya->SetBinLabel(5,
"56, 210, FR");
175 xa->SetBinLabel(6,
"56, 220, NR");
176 ya->SetBinLabel(6,
"56, 220, NR");
177 xa->SetBinLabel(7,
"56, 220, C1");
178 ya->SetBinLabel(7,
"56, 220, C1");
179 xa->SetBinLabel(8,
"56, 220, FR");
180 ya->SetBinLabel(8,
"56, 220, FR");
183 h_trackCorr_vert = ibooker.
book2D(
"track correlation vert",
"ctpps_common_rp_vert", 8, -0.5, 7.5, 8, -0.5, 7.5);
185 TH2F *
hist = h_trackCorr_vert->getTH2F();
186 TAxis *xa =
hist->GetXaxis(), *ya =
hist->GetYaxis();
187 xa->SetBinLabel(1,
"45, 210, FR-TP");
188 ya->SetBinLabel(1,
"45, 210, FR-TP");
189 xa->SetBinLabel(2,
"45, 210, FR-BT");
190 ya->SetBinLabel(2,
"45, 210, FR-BT");
191 xa->SetBinLabel(3,
"45, 220, FR-TP");
192 ya->SetBinLabel(3,
"45, 220, FR-TP");
193 xa->SetBinLabel(4,
"45, 220, FR-BT");
194 ya->SetBinLabel(4,
"45, 220, FR-BT");
195 xa->SetBinLabel(5,
"56, 210, FR-TP");
196 ya->SetBinLabel(5,
"56, 210, FR-TP");
197 xa->SetBinLabel(6,
"56, 210, FR-BT");
198 ya->SetBinLabel(6,
"56, 210, FR-BT");
199 xa->SetBinLabel(7,
"56, 220, FR-TP");
200 ya->SetBinLabel(7,
"56, 220, FR-TP");
201 xa->SetBinLabel(8,
"56, 220, FR-BT");
202 ya->SetBinLabel(8,
"56, 220, FR-BT");
214 string title =
"ctpps_common_sector_" +
name;
217 ibooker.
book1D(
"number of top RPs with tracks",
title +
";number of top RPs with tracks", 5, -0.5, 4.5);
219 ibooker.
book1D(
"number of hor RPs with tracks",
title +
";number of hor RPs with tracks", 5, -0.5, 4.5);
221 ibooker.
book1D(
"number of bot RPs with tracks",
title +
";number of bot RPs with tracks", 5, -0.5, 4.5);
225 TAxis *xa = h_trackCorr_h->GetXaxis(), *ya = h_trackCorr_h->GetYaxis();
226 xa->SetBinLabel(1,
"210, FR-HR");
227 ya->SetBinLabel(1,
"210, FR-HR");
228 xa->SetBinLabel(2,
"210, FR-TP");
229 ya->SetBinLabel(2,
"210, FR-TP");
230 xa->SetBinLabel(3,
"210, FR-BT");
231 ya->SetBinLabel(3,
"210, FR-BT");
232 xa->SetBinLabel(4,
"220, NR-HR");
233 ya->SetBinLabel(4,
"220, NR-HR");
234 xa->SetBinLabel(5,
"220, C1");
235 ya->SetBinLabel(5,
"220, C1");
236 xa->SetBinLabel(6,
"220, FR-HR");
237 ya->SetBinLabel(6,
"220, FR-HR");
238 xa->SetBinLabel(7,
"220, FR-TP");
239 ya->SetBinLabel(7,
"220, FR-TP");
240 xa->SetBinLabel(8,
"220, FR-BT");
241 ya->SetBinLabel(8,
"220, FR-BT");
245 xa = h_trackCorr_h->GetXaxis();
246 ya = h_trackCorr_h->GetYaxis();
247 xa->SetBinLabel(1,
"210, FR-HR");
248 ya->SetBinLabel(1,
"210, FR-HR");
249 xa->SetBinLabel(2,
"210, FR-TP");
250 ya->SetBinLabel(2,
"210, FR-TP");
251 xa->SetBinLabel(3,
"210, FR-BT");
252 ya->SetBinLabel(3,
"210, FR-BT");
253 xa->SetBinLabel(4,
"220, NR-HR");
254 ya->SetBinLabel(4,
"220, NR-HR");
255 xa->SetBinLabel(5,
"220, C1");
256 ya->SetBinLabel(5,
"220, C1");
257 xa->SetBinLabel(6,
"220, FR-HR");
258 ya->SetBinLabel(6,
"220, FR-HR");
259 xa->SetBinLabel(7,
"220, FR-TP");
260 ya->SetBinLabel(7,
"220, FR-TP");
261 xa->SetBinLabel(8,
"220, FR-BT");
262 ya->SetBinLabel(8,
"220, FR-BT");
266 h_proton_th_x = ibooker.
book1D(
"proton theta st x",
";#theta^{*}_{x} (rad)", 250, -500E-6, +500E-6);
267 h_proton_th_y = ibooker.
book1D(
"proton theta st y",
";#theta^{*}_{y} (rad)", 250, -500E-6, +500E-6);
272 for (
const unsigned int rpDecId : {3, 22, 16, 23}) {
273 unsigned int st = rpDecId / 10, rp = rpDecId % 10, rpFullDecId =
id * 100 + rpDecId;
275 string stName, rpName;
278 rpName = stName +
"_" + rpName;
280 const bool timingRP = (rpDecId == 22 || rpDecId == 16);
284 ibooker.
book1D(rpName +
" - track x histogram",
title +
"/" + rpName +
";track x (mm)", 200, 0., 40.),
286 rpName +
" - track time histogram",
title +
"/" + rpName +
";track time (ns)", 100, -25., +50.)};
289 ibooker.
book1D(rpName +
" - track x histogram",
title +
"/" + rpName +
";track x (mm)", 200, 0., 40.),
290 ibooker.
book1D(rpName +
" - track y histogram",
title +
"/" + rpName +
";track y (mm)", 200, -20., +20.)};
299 :
verbosity(ps.getUntrackedParameter<unsigned
int>(
"verbosity", 0)),
323 for (
unsigned int arm = 0;
arm < 2;
arm++) {
346 LogProblem(
"CTPPSCommonDQMSource") <<
"ERROR in CTPPSCommonDQMSource::analyzeCTPPSRecord > input not available.";
351 auto &
rpstate = *luminosityBlockCache(
event.getLuminosityBlock().index());
353 rpstate.reserve(CTPPSRecord::RomanPot::Last);
354 for (uint8_t
i = 0;
i < CTPPSRecord::RomanPot::Last; ++
i)
369 LogProblem(
"CTPPSCommonDQMSource") <<
"ERROR in CTPPSCommonDQMSource::analyzeTracks > input not available.";
376 set<signed int> s_rp_idx_global_hor, s_rp_idx_global_vert;
377 map<unsigned int, set<signed int>> ms_rp_idx_arm;
379 for (
auto &tr : *hTracks) {
381 const unsigned int arm = rpId.arm();
382 const unsigned int stNum = rpId.station();
383 const unsigned int rpNum = rpId.rp();
384 const unsigned int stRPNum = stNum * 10 + rpNum;
398 s_rp_idx_global_hor.insert(4 *
arm +
idx);
413 s_rp_idx_global_vert.insert(4 *
arm +
idx);
435 const signed int hor = ((rpNum == 2) || (rpNum == 3) || (rpNum == 6)) ? 1 : 0;
438 ms_rp_idx_arm[
arm].insert(
idx * 10 + hor);
448 for (
const auto &idx1 : s_rp_idx_global_hor)
449 for (
const auto &idx2 : s_rp_idx_global_hor)
452 for (
const auto &idx1 : s_rp_idx_global_vert)
453 for (
const auto &idx2 : s_rp_idx_global_vert)
459 map<unsigned int, set<unsigned int>>
mTop, mHor, mBot;
461 for (
auto &tr : *hTracks) {
463 const unsigned int rpNum = rpId.
rp();
464 const unsigned int armIdx = rpId.arm();
466 if (rpNum == 0 || rpNum == 4)
467 mTop[armIdx].insert(rpId);
468 if (rpNum == 2 || rpNum == 3 || rpNum == 6)
469 mHor[armIdx].insert(rpId);
470 if (rpNum == 1 || rpNum == 5)
471 mBot[armIdx].insert(rpId);
474 unsigned int rpDecId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();
478 auto it = ap.trackingRPPlots.find(rpDecId);
479 if (
it != ap.trackingRPPlots.end()) {
480 it->second.h_x->Fill(tr.x());
481 it->second.h_y->Fill(tr.y());
487 auto it = ap.timingRPPlots.find(rpDecId);
488 if (
it != ap.timingRPPlots.end()) {
489 it->second.h_x->Fill(tr.x());
490 it->second.h_time->Fill(tr.time());
496 p.second.h_numRPWithTrack_top->Fill(
mTop[
p.first].size());
497 p.second.h_numRPWithTrack_hor->Fill(mHor[
p.first].size());
498 p.second.h_numRPWithTrack_bot->Fill(mBot[
p.first].size());
504 for (
const auto &ap : ms_rp_idx_arm) {
507 for (
const auto &idx1 : ap.second) {
508 for (
const auto &idx2 : ap.second) {
509 plots.h_trackCorr->Fill(idx1 / 10, idx2 / 10);
511 if ((idx1 % 10) != (idx2 % 10))
512 plots.h_trackCorr_overlap->Fill(idx1 / 10, idx2 / 10);
528 LogProblem(
"CTPPSCommonDQMSource") <<
"ERROR in CTPPSCommonDQMSource::analyzeProtons > input not available.";
534 for (
auto &
p : *hRecoProtons) {
538 signed int armIndex = -1;
548 plots.h_proton_xi->Fill(
p.xi());
549 plots.h_proton_th_x->Fill(
p.thetaX());
550 plots.h_proton_th_y->Fill(
p.thetaY());
551 plots.h_proton_t->Fill(fabs(
p.t()));
552 plots.h_proton_time->Fill(
p.time());
560 return std::make_shared<std::vector<int>>();
566 auto const &
rpstate = *luminosityBlockCache(iLumi.
index());
MonitorElement * h_proton_time
LuminosityBlockNumber_t luminosityBlock() const
std::shared_ptr< std::vector< int > > globalBeginLuminosityBlock(const edm::LuminosityBlock &iLumi, const edm::EventSetup &c) const override
MonitorElement * h_proton_xi
virtual void setCurrentFolder(std::string const &fullpath)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::map< unsigned int, TimingRPPlots > timingRPPlots
Local (=single RP) track with essential information only.
MonitorElement * h_proton_th_y
MonitorElement * h_proton_t
~CTPPSCommonDQMSource() override
const unsigned int verbosity
MonitorElement * h_trackCorr_hor
void globalEndLuminosityBlock(const edm::LuminosityBlock &iLumi, const edm::EventSetup &c) override
MonitorElement * h_trackCorr_overlap
CTPPSCommonDQMSource(const edm::ParameterSet &ps)
std::vector< int > rpstate
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
bool makeProtonRecoPlots_
std::map< unsigned int, ArmPlots > armPlots
MonitorElement * h_numRPWithTrack_bot
void Init(DQMStore::IBooker &ibooker)
static constexpr int MAX_VBINS
const edm::EDGetTokenT< std::vector< reco::ForwardProton > > tokenRecoProtons
MonitorElement * h_numRPWithTrack_top
MonitorElement * events_per_bx
void rpName(std::string &name, NameFlag flag=nFull) const
MonitorElement * events_per_bx_short
void analyzeTracks(edm::Event const &event, edm::EventSetup const &eventSetup)
MonitorElement * h_trackCorr_vert
void armName(std::string &name, NameFlag flag=nFull) const
#define DEFINE_FWK_MODULE(type)
plots related to the whole system
MonitorElement * h_trackCorr
std::map< unsigned int, TrackingRPPlots > trackingRPPlots
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
LuminosityBlockID id() const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Base class for CTPPS detector IDs.
LuminosityBlockIndex index() const
const edm::EDGetTokenT< std::vector< CTPPSLocalTrackLite > > tokenLocalTrackLite
void analyzeProtons(edm::Event const &event, edm::EventSetup const &eventSetup)
Class to contain CTPPS information from soft FED 1022.
void stationName(std::string &name, NameFlag flag=nFull) const
void analyzeCTPPSRecord(edm::Event const &event, edm::EventSetup const &eventSetup)
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
const edm::EDGetTokenT< CTPPSRecord > ctppsRecordToken
MonitorElement * h_numRPWithTrack_hor
MonitorElement * h_proton_th_x
Status status(const uint8_t rp) const
Return the status of the given roman pot.
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
static constexpr int MAX_LUMIS
Log< level::Error, true > LogProblem