CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes
CTPPSCommonDQMSource Class Reference
Inheritance diagram for CTPPSCommonDQMSource:
one::DQMEDAnalyzer< edm::LuminosityBlockCache< std::vector< int > > > one::dqmimplementation::DQMBaseClass< T... >

Classes

struct  ArmPlots
 plots related to one arm More...
 
struct  GlobalPlots
 plots related to the whole system More...
 

Public Member Functions

 CTPPSCommonDQMSource (const edm::ParameterSet &ps)
 
 ~CTPPSCommonDQMSource () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< edm::LuminosityBlockCache< std::vector< int > > >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Protected Member Functions

void analyze (edm::Event const &e, edm::EventSetup const &eSetup) override
 
void analyzeCTPPSRecord (edm::Event const &event, edm::EventSetup const &eventSetup)
 
void analyzeProtons (edm::Event const &event, edm::EventSetup const &eventSetup)
 
void analyzeTracks (edm::Event const &event, edm::EventSetup const &eventSetup)
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
std::shared_ptr< std::vector< int > > globalBeginLuminosityBlock (const edm::LuminosityBlock &iLumi, const edm::EventSetup &c) const override
 
void globalEndLuminosityBlock (const edm::LuminosityBlock &iLumi, const edm::EventSetup &c) override
 

Private Attributes

std::map< unsigned int, ArmPlotsarmPlots
 
const edm::EDGetTokenT< CTPPSRecordctppsRecordToken
 
int currentLS
 
int endLS
 
GlobalPlots globalPlots
 
std::vector< int > rpstate
 
const edm::EDGetTokenT< std::vector< CTPPSLocalTrackLite > > tokenLocalTrackLite
 
const edm::EDGetTokenT< std::vector< reco::ForwardProton > > tokenRecoProtons
 
const unsigned int verbosity
 

Static Private Attributes

static int MAX_LUMIS = 6000
 
static int MAX_VBINS = 18
 

Detailed Description

Definition at line 30 of file CTPPSCommonDQMSource.cc.

Constructor & Destructor Documentation

CTPPSCommonDQMSource::CTPPSCommonDQMSource ( const edm::ParameterSet ps)

Definition at line 249 of file CTPPSCommonDQMSource.cc.

References currentLS, endLS, and rpstate.

249  :
250  verbosity(ps.getUntrackedParameter<unsigned int>("verbosity", 0)),
251  ctppsRecordToken(consumes<CTPPSRecord>(ps.getUntrackedParameter<edm::InputTag>("ctppsmetadata"))),
252  tokenLocalTrackLite(consumes< vector<CTPPSLocalTrackLite> >(ps.getParameter<edm::InputTag>("tagLocalTrackLite"))),
253  tokenRecoProtons(consumes<std::vector<reco::ForwardProton>>(ps.getParameter<InputTag>("tagRecoProtons")))
254 {
255  currentLS = 0;
256  endLS = 0;
257  rpstate.clear();
258 }
const edm::EDGetTokenT< std::vector< CTPPSLocalTrackLite > > tokenLocalTrackLite
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const unsigned int verbosity
std::vector< int > rpstate
const edm::EDGetTokenT< std::vector< reco::ForwardProton > > tokenRecoProtons
const edm::EDGetTokenT< CTPPSRecord > ctppsRecordToken
CTPPSCommonDQMSource::~CTPPSCommonDQMSource ( )
override

Definition at line 262 of file CTPPSCommonDQMSource.cc.

263 {
264 }

Member Function Documentation

void CTPPSCommonDQMSource::analyze ( edm::Event const &  e,
edm::EventSetup const &  eSetup 
)
overrideprotected

Definition at line 282 of file CTPPSCommonDQMSource.cc.

References analyzeCTPPSRecord(), analyzeProtons(), and analyzeTracks().

283 {
284  analyzeCTPPSRecord(event, eventSetup);
285  analyzeTracks(event, eventSetup);
286  analyzeProtons(event, eventSetup);
287 }
void analyzeTracks(edm::Event const &event, edm::EventSetup const &eventSetup)
void analyzeProtons(edm::Event const &event, edm::EventSetup const &eventSetup)
void analyzeCTPPSRecord(edm::Event const &event, edm::EventSetup const &eventSetup)
Definition: event.py:1
void CTPPSCommonDQMSource::analyzeCTPPSRecord ( edm::Event const &  event,
edm::EventSetup const &  eventSetup 
)
protected

Definition at line 291 of file CTPPSCommonDQMSource.cc.

References ctppsRecordToken, edm::Event::getLuminosityBlock(), mps_fire::i, edm::LuminosityBlock::index(), edm::HandleBase::isValid(), rpstate, CTPPSRecord::status(), and verbosity.

Referenced by analyze().

292 {
293  Handle<CTPPSRecord> hCTPPSRecord;
294  event.getByToken(ctppsRecordToken, hCTPPSRecord);
295 
296  if (!hCTPPSRecord.isValid())
297  {
298  if (verbosity)
299  LogProblem("CTPPSCommonDQMSource") << "ERROR in CTPPSCommonDQMSource::analyzeCTPPSRecord > input not available.";
300 
301  return;
302  }
303 
304  auto& rpstate = *luminosityBlockCache(event.getLuminosityBlock().index());
305  if (rpstate.empty())
306  {
307  rpstate.reserve(CTPPSRecord::RomanPot::Last);
308  for (uint8_t i = 0; i < CTPPSRecord::RomanPot::Last; ++i)
309  rpstate.push_back(hCTPPSRecord->status(i));
310  }
311 }
const unsigned int verbosity
std::vector< int > rpstate
bool isValid() const
Definition: HandleBase.h:74
Status status(const uint8_t rp) const
Return the status of the given roman pot.
Definition: CTPPSRecord.h:70
const edm::EDGetTokenT< CTPPSRecord > ctppsRecordToken
Definition: event.py:1
void CTPPSCommonDQMSource::analyzeProtons ( edm::Event const &  event,
edm::EventSetup const &  eventSetup 
)
protected

Definition at line 466 of file CTPPSCommonDQMSource.cc.

References armPlots, edm::HandleBase::isValid(), AlCaHLTBitMon_ParallelJobs::p, nanoDQM_cff::plots, reco::ForwardProton::sector45, reco::ForwardProton::sector56, tokenRecoProtons, and verbosity.

Referenced by analyze().

467 {
468  // get event data
470  event.getByToken(tokenRecoProtons, hRecoProtons);
471 
472  // check validity
473  if (!hRecoProtons.isValid())
474  {
475  if (verbosity)
476  LogProblem("CTPPSCommonDQMSource") << "ERROR in CTPPSCommonDQMSource::analyzeProtons > input not available.";
477 
478  return;
479  }
480 
481  // loop over protons
482  for (auto &p : *hRecoProtons)
483  {
484  if (!p.validFit())
485  continue;
486 
487  signed int armIndex = -1;
488  if (p.lhcSector() == reco::ForwardProton::LHCSector::sector45)
489  armIndex = 0;
490  if (p.lhcSector() == reco::ForwardProton::LHCSector::sector56)
491  armIndex = 1;
492  if (armIndex < 0)
493  continue;
494 
495  auto &plots = armPlots[armIndex];
496 
497  plots.h_proton_xi->Fill(p.xi());
498  plots.h_proton_t->Fill(fabs(p.t()));
499  plots.h_proton_time->Fill(p.time());
500  }
501 }
const unsigned int verbosity
std::map< unsigned int, ArmPlots > armPlots
const edm::EDGetTokenT< std::vector< reco::ForwardProton > > tokenRecoProtons
bool isValid() const
Definition: HandleBase.h:74
void CTPPSCommonDQMSource::analyzeTracks ( edm::Event const &  event,
edm::EventSetup const &  eventSetup 
)
protected

Definition at line 315 of file CTPPSCommonDQMSource.cc.

References CTPPSDetId::arm(), armPlots, edm::EventBase::bunchCrossing(), CTPPSCommonDQMSource::GlobalPlots::events_per_bx, CTPPSCommonDQMSource::GlobalPlots::events_per_bx_short, MonitorElement::Fill(), globalPlots, CTPPSCommonDQMSource::GlobalPlots::h_trackCorr_hor, CTPPSCommonDQMSource::GlobalPlots::h_trackCorr_vert, training_settings::idx, edm::HandleBase::isValid(), TtSemiLepHitFitProducer_Electrons_cfi::mTop, AlCaHLTBitMon_ParallelJobs::p, nanoDQM_cff::plots, CTPPSDetId::rp(), tokenLocalTrackLite, and verbosity.

Referenced by analyze().

316 {
317  // get event data
319  event.getByToken(tokenLocalTrackLite, hTracks);
320 
321  // check validity
322  if (!hTracks.isValid())
323  {
324  if (verbosity)
325  LogProblem("CTPPSCommonDQMSource") << "ERROR in CTPPSCommonDQMSource::analyzeTracks > input not available.";
326 
327  return;
328  }
329 
330  //------------------------------
331  // collect indeces of RP with tracks, for each correlation plot
332  set<signed int> s_rp_idx_global_hor, s_rp_idx_global_vert;
333  map<unsigned int, set<signed int>> ms_rp_idx_arm;
334 
335  for (auto &tr : *hTracks)
336  {
337  const CTPPSDetId rpId(tr.getRPId());
338  const unsigned int arm = rpId.arm();
339  const unsigned int stNum = rpId.station();
340  const unsigned int rpNum = rpId.rp();
341  const unsigned int stRPNum = stNum * 10 + rpNum;
342 
343  {
344  signed int idx = -1;
345  if (stRPNum == 3) idx = 0;
346  if (stRPNum == 23) idx = 1;
347  if (stRPNum == 16) idx = 2;
348 
349  if (idx >= 0)
350  s_rp_idx_global_hor.insert(3*arm + idx);
351  }
352 
353  {
354  signed int idx = -1;
355  if (stRPNum == 4) idx = 0;
356  if (stRPNum == 5) idx = 1;
357  if (stRPNum == 24) idx = 2;
358  if (stRPNum == 25) idx = 3;
359 
360  if (idx >= 0)
361  s_rp_idx_global_vert.insert(4*arm + idx);
362  }
363 
364  {
365  signed int idx = -1;
366  if (stRPNum == 3) idx = 0;
367  if (stRPNum == 4) idx = 1;
368  if (stRPNum == 5) idx = 2;
369  if (stRPNum == 16) idx = 3;
370  if (stRPNum == 23) idx = 4;
371  if (stRPNum == 24) idx = 5;
372  if (stRPNum == 25) idx = 6;
373 
374  const signed int hor = ((rpNum == 2) || (rpNum == 3) || (rpNum == 6)) ? 1 : 0;
375 
376  if (idx >= 0)
377  ms_rp_idx_arm[arm].insert(idx * 10 + hor);
378  }
379  }
380 
381  //------------------------------
382  // Global Plots
383 
384  globalPlots.events_per_bx->Fill(event.bunchCrossing());
385  globalPlots.events_per_bx_short->Fill(event.bunchCrossing());
386 
387  for (const auto &idx1 : s_rp_idx_global_hor)
388  for (const auto &idx2 : s_rp_idx_global_hor)
389  globalPlots.h_trackCorr_hor->Fill(idx1, idx2);
390 
391  for (const auto &idx1 : s_rp_idx_global_vert)
392  for (const auto &idx2 : s_rp_idx_global_vert)
393  globalPlots.h_trackCorr_vert->Fill(idx1, idx2);
394 
395  //------------------------------
396  // Arm Plots
397 
398  map<unsigned int, set<unsigned int>> mTop, mHor, mBot;
399 
400  for (auto &tr : *hTracks)
401  {
402  CTPPSDetId rpId(tr.getRPId());
403  const unsigned int rpNum = rpId.rp();
404  const unsigned int armIdx = rpId.arm();
405 
406  if (rpNum == 0 || rpNum == 4)
407  mTop[armIdx].insert(rpId);
408  if (rpNum == 2 || rpNum == 3 || rpNum == 6)
409  mHor[armIdx].insert(rpId);
410  if (rpNum == 1 || rpNum == 5)
411  mBot[armIdx].insert(rpId);
412 
413  auto &ap = armPlots[rpId.arm()];
414  unsigned int rpDecId = rpId.arm()*100 + rpId.station()*10 + rpId.rp();
415 
416  // fill in reference tracking-RP plots
417  {
418  auto it = ap.trackingRPPlots.find(rpDecId);
419  if (it != ap.trackingRPPlots.end())
420  {
421  it->second.h_x->Fill(tr.getX());
422  it->second.h_y->Fill(tr.getY());
423  }
424  }
425 
426  // fill in reference timing-RP plots
427  {
428  auto it = ap.timingRPPlots.find(rpDecId);
429  if (it != ap.timingRPPlots.end())
430  {
431  it->second.h_x->Fill(tr.getX());
432  it->second.h_time->Fill(tr.getTime());
433  }
434  }
435  }
436 
437  for (auto &p : armPlots)
438  {
439  p.second.h_numRPWithTrack_top->Fill(mTop[p.first].size());
440  p.second.h_numRPWithTrack_hor->Fill(mHor[p.first].size());
441  p.second.h_numRPWithTrack_bot->Fill(mBot[p.first].size());
442  }
443 
444  //------------------------------
445  // Correlation plots
446 
447  for (const auto &ap : ms_rp_idx_arm)
448  {
449  auto &plots = armPlots[ap.first];
450 
451  for (const auto &idx1 : ap.second)
452  {
453  for (const auto &idx2 : ap.second)
454  {
455  plots.h_trackCorr->Fill(idx1/10, idx2/10);
456 
457  if ((idx1 % 10) != (idx2 % 10))
458  plots.h_trackCorr_overlap->Fill(idx1/10, idx2/10);
459  }
460  }
461  }
462 }
const edm::EDGetTokenT< std::vector< CTPPSLocalTrackLite > > tokenLocalTrackLite
const unsigned int verbosity
void Fill(long long x)
std::map< unsigned int, ArmPlots > armPlots
uint32_t arm() const
Definition: CTPPSDetId.h:51
bool isValid() const
Definition: HandleBase.h:74
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
Definition: event.py:1
uint32_t rp() const
Definition: CTPPSDetId.h:65
void CTPPSCommonDQMSource::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotected

Definition at line 268 of file CTPPSCommonDQMSource.cc.

References armPlots, globalPlots, and CTPPSCommonDQMSource::GlobalPlots::Init().

269 {
270  // global plots
271  globalPlots.Init(ibooker);
272 
273  // loop over arms
274  for (unsigned int arm = 0; arm < 2; arm++)
275  {
276  armPlots[arm] = ArmPlots(ibooker, arm);
277  }
278 }
std::map< unsigned int, ArmPlots > armPlots
void Init(DQMStore::IBooker &ibooker)
std::shared_ptr< std::vector< int > > CTPPSCommonDQMSource::globalBeginLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup c 
) const
overrideprotected

Definition at line 505 of file CTPPSCommonDQMSource.cc.

506 {
507  return std::make_shared<std::vector<int>>();
508 }
void CTPPSCommonDQMSource::globalEndLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup c 
)
overrideprotected

Definition at line 512 of file CTPPSCommonDQMSource.cc.

References currentLS, DEFINE_FWK_MODULE, globalPlots, mps_fire::i, edm::LuminosityBlockBase::id(), edm::LuminosityBlock::index(), edm::LuminosityBlockID::luminosityBlock(), rpstate, CTPPSCommonDQMSource::GlobalPlots::RPState, and MonitorElement::setBinContent().

513 {
514  auto const& rpstate = *luminosityBlockCache(iLumi.index());
515  auto currentLS = iLumi.id().luminosityBlock();
516  for(std::vector<int>::size_type i=0; i<rpstate.size();i++)
517  globalPlots.RPState->setBinContent(currentLS, i+1, rpstate[i]);
518 }
LuminosityBlockID id() const
void setBinContent(int binx, double content)
set content of bin (1-D)
LuminosityBlockIndex index() const
uint16_t size_type
std::vector< int > rpstate
LuminosityBlockNumber_t luminosityBlock() const

Member Data Documentation

std::map<unsigned int, ArmPlots> CTPPSCommonDQMSource::armPlots
private

Definition at line 101 of file CTPPSCommonDQMSource.cc.

Referenced by analyzeProtons(), analyzeTracks(), and bookHistograms().

const edm::EDGetTokenT<CTPPSRecord> CTPPSCommonDQMSource::ctppsRecordToken
private

Definition at line 51 of file CTPPSCommonDQMSource.cc.

Referenced by analyzeCTPPSRecord().

int CTPPSCommonDQMSource::currentLS
private

Definition at line 55 of file CTPPSCommonDQMSource.cc.

Referenced by CTPPSCommonDQMSource(), and globalEndLuminosityBlock().

int CTPPSCommonDQMSource::endLS
private

Definition at line 56 of file CTPPSCommonDQMSource.cc.

Referenced by CTPPSCommonDQMSource().

GlobalPlots CTPPSCommonDQMSource::globalPlots
private

Definition at line 70 of file CTPPSCommonDQMSource.cc.

Referenced by analyzeTracks(), bookHistograms(), and globalEndLuminosityBlock().

const int CTPPSCommonDQMSource::MAX_LUMIS = 6000
staticprivate

Definition at line 48 of file CTPPSCommonDQMSource.cc.

Referenced by CTPPSCommonDQMSource::GlobalPlots::Init().

const int CTPPSCommonDQMSource::MAX_VBINS = 18
staticprivate

Definition at line 49 of file CTPPSCommonDQMSource.cc.

Referenced by CTPPSCommonDQMSource::GlobalPlots::Init().

std::vector<int> CTPPSCommonDQMSource::rpstate
private
const edm::EDGetTokenT< std::vector<CTPPSLocalTrackLite> > CTPPSCommonDQMSource::tokenLocalTrackLite
private

Definition at line 52 of file CTPPSCommonDQMSource.cc.

Referenced by analyzeTracks().

const edm::EDGetTokenT<std::vector<reco::ForwardProton> > CTPPSCommonDQMSource::tokenRecoProtons
private

Definition at line 53 of file CTPPSCommonDQMSource.cc.

Referenced by analyzeProtons().

const unsigned int CTPPSCommonDQMSource::verbosity
private

Definition at line 47 of file CTPPSCommonDQMSource.cc.

Referenced by analyzeCTPPSRecord(), analyzeProtons(), and analyzeTracks().