74 MonitorElement *h_numRPWithTrack_top =
nullptr, *h_numRPWithTrack_hor =
nullptr, *h_numRPWithTrack_bot =
nullptr;
77 MonitorElement *h_proton_xi =
nullptr, *h_proton_t =
nullptr, *h_proton_time =
nullptr;
124 "RP State per Lumisection;Luminosity Section;",
133 hist->SetCanExtend(TH1::kAllAxes);
134 TAxis *ya = hist->GetYaxis();
135 ya->SetBinLabel(1,
"45, 210, FR-BT");
136 ya->SetBinLabel(2,
"45, 210, FR-HR");
137 ya->SetBinLabel(3,
"45, 210, FR-TP");
138 ya->SetBinLabel(4,
"45, 220, C1");
139 ya->SetBinLabel(5,
"45, 220, FR-BT");
140 ya->SetBinLabel(6,
"45, 220, FR-HR");
141 ya->SetBinLabel(7,
"45, 220, FR-TP");
142 ya->SetBinLabel(8,
"45, 220, NR-BP");
143 ya->SetBinLabel(9,
"45, 220, NR-TP");
144 ya->SetBinLabel(10,
"56, 210, FR-BT");
145 ya->SetBinLabel(11,
"56, 210, FR-HR");
146 ya->SetBinLabel(12,
"56, 210, FR-TP");
147 ya->SetBinLabel(13,
"56, 220, C1");
148 ya->SetBinLabel(14,
"56, 220, FR-BT");
149 ya->SetBinLabel(15,
"56, 220, FR-HR");
150 ya->SetBinLabel(16,
"56, 220, FR-TP");
151 ya->SetBinLabel(17,
"56, 220, NR-BP");
152 ya->SetBinLabel(18,
"56, 220, NR-TP");
155 h_trackCorr_hor = ibooker.
book2D(
"track correlation hor",
"ctpps_common_rp_hor", 6, -0.5, 5.5, 6, -0.5, 5.5);
158 TAxis *xa = hist->GetXaxis(), *ya = hist->GetYaxis();
159 xa->SetBinLabel(1,
"45, 210, far");
160 ya->SetBinLabel(1,
"45, 210, far");
161 xa->SetBinLabel(2,
"45, 220, far");
162 ya->SetBinLabel(2,
"45, 220, far");
163 xa->SetBinLabel(3,
"45, 220, cyl");
164 ya->SetBinLabel(3,
"45, 220, cyl");
165 xa->SetBinLabel(4,
"56, 210, far");
166 ya->SetBinLabel(4,
"56, 210, far");
167 xa->SetBinLabel(5,
"56, 220, far");
168 ya->SetBinLabel(5,
"56, 220, far");
169 xa->SetBinLabel(6,
"56, 220, cyl");
170 ya->SetBinLabel(6,
"56, 220, cyl");
173 h_trackCorr_vert = ibooker.
book2D(
"track correlation vert",
"ctpps_common_rp_vert", 8, -0.5, 7.5, 8, -0.5, 7.5);
176 TAxis *xa = hist->GetXaxis(), *ya = hist->GetYaxis();
177 xa->SetBinLabel(1,
"45, 210, far, top");
178 ya->SetBinLabel(1,
"45, 210, far, top");
179 xa->SetBinLabel(2,
"45, 210, far, bot");
180 ya->SetBinLabel(2,
"45, 210, far, bot");
181 xa->SetBinLabel(3,
"45, 220, far, top");
182 ya->SetBinLabel(3,
"45, 220, far, top");
183 xa->SetBinLabel(4,
"45, 220, far, bot");
184 ya->SetBinLabel(4,
"45, 220, far, bot");
185 xa->SetBinLabel(5,
"56, 210, far, top");
186 ya->SetBinLabel(5,
"56, 210, far, top");
187 xa->SetBinLabel(6,
"56, 210, far, bot");
188 ya->SetBinLabel(6,
"56, 210, far, bot");
189 xa->SetBinLabel(7,
"56, 220, far, top");
190 ya->SetBinLabel(7,
"56, 220, far, top");
191 xa->SetBinLabel(8,
"56, 220, far, bot");
192 ya->SetBinLabel(8,
"56, 220, far, bot");
204 string title =
"ctpps_common_sector_" +
name;
207 ibooker.
book1D(
"number of top RPs with tracks", title +
";number of top RPs with tracks", 5, -0.5, 4.5);
209 ibooker.
book1D(
"number of hor RPs with tracks", title +
";number of hor RPs with tracks", 5, -0.5, 4.5);
211 ibooker.
book1D(
"number of bot RPs with tracks", title +
";number of bot RPs with tracks", 5, -0.5, 4.5);
213 h_trackCorr = ibooker.
book2D(
"track correlation", title, 7, -0.5, 6.5, 7, -0.5, 6.5);
215 TAxis *xa = h_trackCorr_h->GetXaxis(), *ya = h_trackCorr_h->GetYaxis();
216 xa->SetBinLabel(1,
"210, far, hor");
217 ya->SetBinLabel(1,
"210, far, hor");
218 xa->SetBinLabel(2,
"210, far, top");
219 ya->SetBinLabel(2,
"210, far, top");
220 xa->SetBinLabel(3,
"210, far, bot");
221 ya->SetBinLabel(3,
"210, far, bot");
222 xa->SetBinLabel(4,
"220, cyl");
223 ya->SetBinLabel(4,
"220, cyl");
224 xa->SetBinLabel(5,
"220, far, hor");
225 ya->SetBinLabel(5,
"220, far, hor");
226 xa->SetBinLabel(6,
"220, far, top");
227 ya->SetBinLabel(6,
"220, far, top");
228 xa->SetBinLabel(7,
"220, far, bot");
229 ya->SetBinLabel(7,
"220, far, bot");
233 xa = h_trackCorr_h->GetXaxis();
234 ya = h_trackCorr_h->GetYaxis();
235 xa->SetBinLabel(1,
"210, far, hor");
236 ya->SetBinLabel(1,
"210, far, hor");
237 xa->SetBinLabel(2,
"210, far, top");
238 ya->SetBinLabel(2,
"210, far, top");
239 xa->SetBinLabel(3,
"210, far, bot");
240 ya->SetBinLabel(3,
"210, far, bot");
241 xa->SetBinLabel(4,
"220, cyl");
242 ya->SetBinLabel(4,
"220, cyl");
243 xa->SetBinLabel(5,
"220, far, hor");
244 ya->SetBinLabel(5,
"220, far, hor");
245 xa->SetBinLabel(6,
"220, far, top");
246 ya->SetBinLabel(6,
"220, far, top");
247 xa->SetBinLabel(7,
"220, far, bot");
248 ya->SetBinLabel(7,
"220, far, bot");
251 h_proton_t = ibooker.
book1D(
"proton t", title +
";|t| GeV^{2}", 100, 0., 5.);
254 for (
const unsigned int &rpDecId : {2, 3, 16, 23}) {
255 unsigned int st = rpDecId / 10, rp = rpDecId % 10, rpFullDecId =
id * 100 + rpDecId;
257 string stName, rpName;
260 rpName = stName +
"_" + rpName;
264 ibooker.
book1D(rpName +
" - track x histogram", title +
"/" + rpName +
";track x (mm)", 200, 0., 40.),
266 rpName +
" - track time histogram", title +
"/" + rpName +
";track time (ns)", 100, -25., +50.)};
269 ibooker.
book1D(rpName +
" - track x histogram", title +
"/" + rpName +
";track x (mm)", 200, 0., 40.),
270 ibooker.
book1D(rpName +
" - track y histogram", title +
"/" + rpName +
";track y (mm)", 200, -20., +20.)};
279 :
verbosity(ps.getUntrackedParameter<unsigned
int>(
"verbosity", 0)),
299 for (
unsigned int arm = 0; arm < 2; arm++) {
320 LogProblem(
"CTPPSCommonDQMSource") <<
"ERROR in CTPPSCommonDQMSource::analyzeCTPPSRecord > input not available.";
327 rpstate.reserve(CTPPSRecord::RomanPot::Last);
328 for (uint8_t
i = 0;
i < CTPPSRecord::RomanPot::Last; ++
i)
343 LogProblem(
"CTPPSCommonDQMSource") <<
"ERROR in CTPPSCommonDQMSource::analyzeTracks > input not available.";
350 set<signed int> s_rp_idx_global_hor, s_rp_idx_global_vert;
351 map<unsigned int, set<signed int>> ms_rp_idx_arm;
353 for (
auto &tr : *hTracks) {
355 const unsigned int arm = rpId.
arm();
356 const unsigned int stNum = rpId.station();
357 const unsigned int rpNum = rpId.rp();
358 const unsigned int stRPNum = stNum * 10 + rpNum;
370 s_rp_idx_global_hor.insert(3 * arm + idx);
385 s_rp_idx_global_vert.insert(4 * arm + idx);
405 const signed int hor = ((rpNum == 2) || (rpNum == 3) || (rpNum == 6)) ? 1 : 0;
408 ms_rp_idx_arm[arm].insert(idx * 10 + hor);
418 for (
const auto &idx1 : s_rp_idx_global_hor)
419 for (
const auto &idx2 : s_rp_idx_global_hor)
422 for (
const auto &idx1 : s_rp_idx_global_vert)
423 for (
const auto &idx2 : s_rp_idx_global_vert)
429 map<unsigned int, set<unsigned int>>
mTop, mHor, mBot;
431 for (
auto &tr : *hTracks) {
433 const unsigned int rpNum = rpId.
rp();
434 const unsigned int armIdx = rpId.arm();
436 if (rpNum == 0 || rpNum == 4)
437 mTop[armIdx].insert(rpId);
438 if (rpNum == 2 || rpNum == 3 || rpNum == 6)
439 mHor[armIdx].insert(rpId);
440 if (rpNum == 1 || rpNum == 5)
441 mBot[armIdx].insert(rpId);
444 unsigned int rpDecId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();
448 auto it = ap.trackingRPPlots.find(rpDecId);
449 if (it != ap.trackingRPPlots.end()) {
450 it->second.h_x->Fill(tr.x());
451 it->second.h_y->Fill(tr.y());
457 auto it = ap.timingRPPlots.find(rpDecId);
458 if (it != ap.timingRPPlots.end()) {
459 it->second.h_x->Fill(tr.x());
460 it->second.h_time->Fill(tr.time());
466 p.second.h_numRPWithTrack_top->Fill(mTop[
p.first].size());
467 p.second.h_numRPWithTrack_hor->Fill(mHor[
p.first].size());
468 p.second.h_numRPWithTrack_bot->Fill(mBot[
p.first].size());
474 for (
const auto &ap : ms_rp_idx_arm) {
475 auto &
plots = armPlots[ap.first];
477 for (
const auto &idx1 : ap.second) {
478 for (
const auto &idx2 : ap.second) {
479 plots.h_trackCorr->Fill(idx1 / 10, idx2 / 10);
481 if ((idx1 % 10) != (idx2 % 10))
482 plots.h_trackCorr_overlap->Fill(idx1 / 10, idx2 / 10);
498 LogProblem(
"CTPPSCommonDQMSource") <<
"ERROR in CTPPSCommonDQMSource::analyzeProtons > input not available.";
504 for (
auto &
p : *hRecoProtons) {
508 signed int armIndex = -1;
518 plots.h_proton_xi->Fill(
p.xi());
519 plots.h_proton_t->Fill(fabs(
p.t()));
520 plots.h_proton_time->Fill(
p.time());
528 return std::make_shared<std::vector<int>>();
534 auto const &
rpstate = *luminosityBlockCache(iLumi.
index());
LuminosityBlockID id() const
MonitorElement * h_proton_time
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
MonitorElement * h_proton_xi
LuminosityBlockIndex index() const
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_t
void setCurrentFolder(std::string const &fullpath)
~CTPPSCommonDQMSource() override
int bunchCrossing() const
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)
std::map< unsigned int, ArmPlots > armPlots
MonitorElement * h_numRPWithTrack_bot
void Init(DQMStore::IBooker &ibooker)
const edm::EDGetTokenT< std::vector< reco::ForwardProton > > tokenRecoProtons
#define DEFINE_FWK_MODULE(type)
MonitorElement * h_numRPWithTrack_top
MonitorElement * events_per_bx
MonitorElement * events_per_bx_short
void analyzeTracks(edm::Event const &event, edm::EventSetup const &eventSetup)
void rpName(std::string &name, NameFlag flag=nFull) const
MonitorElement * h_trackCorr_vert
LuminosityBlock const & getLuminosityBlock() const
void armName(std::string &name, NameFlag flag=nFull) const
std::shared_ptr< std::vector< int > > globalBeginLuminosityBlock(const edm::LuminosityBlock &iLumi, const edm::EventSetup &c) const override
plots related to the whole system
MonitorElement * h_trackCorr
std::map< unsigned int, TrackingRPPlots > trackingRPPlots
Status status(const uint8_t rp) const
Return the status of the given roman pot.
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
LuminosityBlockNumber_t luminosityBlock() const
Base class for CTPPS detector IDs.
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 analyzeCTPPSRecord(edm::Event const &event, edm::EventSetup const &eventSetup)
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
void stationName(std::string &name, NameFlag flag=nFull) const
const edm::EDGetTokenT< CTPPSRecord > ctppsRecordToken
MonitorElement * h_numRPWithTrack_hor