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:

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
 

Protected Member Functions

void analyze (edm::Event const &e, edm::EventSetup const &eSetup) override
 
void beginLuminosityBlock (const edm::LuminosityBlock &iLumi, const edm::EventSetup &c) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void endLuminosityBlock (const edm::LuminosityBlock &iLumi, const edm::EventSetup &c) override
 

Private Attributes

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

Static Private Attributes

static const int MAX_LUMIS = 6000
 
static const int MAX_VBINS = 18
 

Detailed Description

Definition at line 29 of file CTPPSCommonDQMSource.cc.

Constructor & Destructor Documentation

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

Definition at line 196 of file CTPPSCommonDQMSource.cc.

References ctppsRecordToken, currentLS, endLS, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), rpstate, and tokenLocalTrackLite.

196  :
197  verbosity(ps.getUntrackedParameter<unsigned int>("verbosity", 0))
198 {
199  tokenLocalTrackLite = consumes< vector<CTPPSLocalTrackLite> >(ps.getParameter<edm::InputTag>("tagLocalTrackLite"));
200  ctppsRecordToken = consumes<CTPPSRecord>(ps.getUntrackedParameter<edm::InputTag>("ctppsmetadata"));
201 
202  currentLS = 0;
203  endLS = 0;
204  rpstate.clear();
205 
206 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< std::vector< CTPPSLocalTrackLite > > tokenLocalTrackLite
std::vector< int > rpstate
edm::EDGetTokenT< CTPPSRecord > ctppsRecordToken
CTPPSCommonDQMSource::~CTPPSCommonDQMSource ( )
override

Definition at line 210 of file CTPPSCommonDQMSource.cc.

211 {
212 }

Member Function Documentation

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

Definition at line 230 of file CTPPSCommonDQMSource.cc.

References CTPPSDetId::arm(), armPlots, edm::EventBase::bunchCrossing(), ctppsRecordToken, currentLS, endLS, CTPPSCommonDQMSource::GlobalPlots::events_per_bx, CTPPSCommonDQMSource::GlobalPlots::events_per_bx_short, MonitorElement::Fill(), globalPlots, CTPPSCommonDQMSource::GlobalPlots::h_trackCorr_hor, CTPPSCommonDQMSource::GlobalPlots::h_trackCorr_vert, mps_fire::i, training_settings::idx, edm::HandleBase::isValid(), TtSemiLepHitFitProducer_Electrons_cfi::mTop, AlCaHLTBitMon_ParallelJobs::p, nanoDQM_cff::plots, CTPPSDetId::rp(), rpstate, CTPPSRecord::status(), tokenLocalTrackLite, l1t::tracks, and verbosity.

231 {
232 
233  // get CTPPS Event Record
235  event.getByToken(ctppsRecordToken, rp);
236 
237  /*
238  RP State (HV & LV & Insertion):
239  0 -> not used
240  1 -> bad
241  2 -> warning
242  3 -> ok
243 
244  CTPPSRecord Order:
245  RP name: RP_45_210_FR_BT
246  RP name: RP_45_210_FR_HR
247  RP name: RP_45_210_FR_TP
248  RP name: RP_45_220_C1
249  RP name: RP_45_220_FR_BT
250  RP name: RP_45_220_FR_HR
251  RP name: RP_45_220_FR_TP
252  RP name: RP_45_220_NR_BT
253  RP name: RP_45_220_NR_TP
254  RP name: RP_56_210_FR_BT
255  RP name: RP_56_210_FR_HR
256  RP name: RP_56_210_FR_TP
257  RP name: RP_56_220_C1
258  RP name: RP_56_220_FR_BT
259  RP name: RP_56_220_FR_HR
260  RP name: RP_56_220_FR_TP
261  RP name: RP_56_220_NR_BT
262  RP name: RP_56_220_NR_TP
263  */
264 
265  if(currentLS > endLS){
266  rpstate.clear();
267  for (uint8_t i = 0; i < CTPPSRecord::RomanPot::Last; ++i) {
268  rpstate.push_back(rp->status(i));
269  }
271  }
272 
273  // get event data
275  event.getByToken(tokenLocalTrackLite, tracks);
276 
277  // check validity
278  bool valid = true;
279  valid &= tracks.isValid();
280 
281  if (!valid)
282  {
283  if (verbosity)
284  {
285  LogProblem("CTPPSCommonDQMSource")
286  << " trackLites.isValid = " << tracks.isValid();
287  }
288 
289  return;
290  }
291 
292  //------------------------------
293  // collect indeces of RP with tracks, for each correlation plot
294  set<signed int> s_rp_idx_global_hor, s_rp_idx_global_vert;
295  map<unsigned int, set<signed int>> ms_rp_idx_arm;
296 
297  for (auto &tr : *tracks)
298  {
299  const CTPPSDetId rpId(tr.getRPId());
300  const unsigned int arm = rpId.arm();
301  const unsigned int stNum = rpId.station();
302  const unsigned int rpNum = rpId.rp();
303  const unsigned int stRPNum = stNum * 10 + rpNum;
304 
305  {
306  signed int idx = -1;
307  if (stRPNum == 3) idx = 0;
308  if (stRPNum == 23) idx = 1;
309  if (stRPNum == 16) idx = 2;
310 
311  if (idx >= 0)
312  s_rp_idx_global_hor.insert(3*arm + idx);
313  }
314 
315  {
316  signed int idx = -1;
317  if (stRPNum == 4) idx = 0;
318  if (stRPNum == 5) idx = 1;
319  if (stRPNum == 24) idx = 2;
320  if (stRPNum == 25) idx = 3;
321 
322  if (idx >= 0)
323  s_rp_idx_global_vert.insert(4*arm + idx);
324  }
325 
326  {
327  signed int idx = -1;
328  if (stRPNum == 3) idx = 0;
329  if (stRPNum == 4) idx = 1;
330  if (stRPNum == 5) idx = 2;
331  if (stRPNum == 16) idx = 3;
332  if (stRPNum == 23) idx = 4;
333  if (stRPNum == 24) idx = 5;
334  if (stRPNum == 25) idx = 6;
335 
336  const signed int hor = ((rpNum == 2) || (rpNum == 3) || (rpNum == 6)) ? 1 : 0;
337 
338  if (idx >= 0)
339  ms_rp_idx_arm[arm].insert(idx * 10 + hor);
340  }
341  }
342 
343  //------------------------------
344  // Global Plots
345 
346  globalPlots.events_per_bx->Fill(event.bunchCrossing());
347  globalPlots.events_per_bx_short->Fill(event.bunchCrossing());
348 
349  for (const auto &idx1 : s_rp_idx_global_hor)
350  for (const auto &idx2 : s_rp_idx_global_hor)
351  globalPlots.h_trackCorr_hor->Fill(idx1, idx2);
352 
353  for (const auto &idx1 : s_rp_idx_global_vert)
354  for (const auto &idx2 : s_rp_idx_global_vert)
355  globalPlots.h_trackCorr_vert->Fill(idx1, idx2);
356 
357  //------------------------------
358  // Arm Plots
359 
360  map<unsigned int, set<unsigned int>> mTop, mHor, mBot;
361 
362  for (auto &tr : *tracks)
363  {
364  CTPPSDetId rpId(tr.getRPId());
365  const unsigned int rpNum = rpId.rp();
366  const unsigned int armIdx = rpId.arm();
367 
368  if (rpNum == 0 || rpNum == 4)
369  mTop[armIdx].insert(rpId);
370  if (rpNum == 2 || rpNum == 3 || rpNum == 6)
371  mHor[armIdx].insert(rpId);
372  if (rpNum == 1 || rpNum == 5)
373  mBot[armIdx].insert(rpId);
374  }
375 
376  for (auto &p : armPlots)
377  {
378  p.second.h_numRPWithTrack_top->Fill(mTop[p.first].size());
379  p.second.h_numRPWithTrack_hor->Fill(mHor[p.first].size());
380  p.second.h_numRPWithTrack_bot->Fill(mBot[p.first].size());
381  }
382 
383  // track RP correlation
384  for (const auto &ap : ms_rp_idx_arm)
385  {
386  auto &plots = armPlots[ap.first];
387 
388  for (const auto &idx1 : ap.second)
389  {
390  for (const auto &idx2 : ap.second)
391  {
392  plots.h_trackCorr->Fill(idx1/10, idx2/10);
393 
394  if ((idx1 % 10) != (idx2 % 10))
395  plots.h_trackCorr_overlap->Fill(idx1/10, idx2/10);
396  }
397  }
398  }
399 
400 }
edm::EDGetTokenT< std::vector< CTPPSLocalTrackLite > > tokenLocalTrackLite
std::vector< int > rpstate
void Fill(long long x)
std::map< unsigned int, ArmPlots > armPlots
edm::EDGetTokenT< CTPPSRecord > ctppsRecordToken
uint32_t arm() const
Definition: CTPPSDetId.h:52
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
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
Definition: event.py:1
uint32_t rp() const
Definition: CTPPSDetId.h:74
void CTPPSCommonDQMSource::beginLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup c 
)
overrideprotected

Definition at line 403 of file CTPPSCommonDQMSource.cc.

References currentLS, edm::LuminosityBlockBase::id(), and edm::LuminosityBlockID::luminosityBlock().

403  {
404 
405  currentLS = iLumi.id().luminosityBlock();
406 
407 }
LuminosityBlockID id() const
LuminosityBlockNumber_t luminosityBlock() const
void CTPPSCommonDQMSource::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotected

Definition at line 216 of file CTPPSCommonDQMSource.cc.

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

217 {
218  // global plots
219  globalPlots.Init(ibooker);
220 
221  // loop over arms
222  for (unsigned int arm = 0; arm < 2; arm++)
223  {
224  armPlots[arm] = ArmPlots(ibooker, arm);
225  }
226 }
std::map< unsigned int, ArmPlots > armPlots
void Init(DQMStore::IBooker &ibooker)
void CTPPSCommonDQMSource::endLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup c 
)
overrideprotected

Definition at line 411 of file CTPPSCommonDQMSource.cc.

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

411  {
412 
413  for(std::vector<int>::size_type i=0; i<rpstate.size();i++){
415  }
416 
417  endLS = iLumi.luminosityBlock();
418  rpstate.clear();
419 
420 }
void setBinContent(int binx, double content)
set content of bin (1-D)
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 82 of file CTPPSCommonDQMSource.cc.

Referenced by analyze(), and bookHistograms().

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

Definition at line 50 of file CTPPSCommonDQMSource.cc.

Referenced by analyze(), and CTPPSCommonDQMSource().

int CTPPSCommonDQMSource::currentLS
private
int CTPPSCommonDQMSource::endLS
private

Definition at line 53 of file CTPPSCommonDQMSource.cc.

Referenced by analyze(), CTPPSCommonDQMSource(), and endLuminosityBlock().

GlobalPlots CTPPSCommonDQMSource::globalPlots
private

Definition at line 67 of file CTPPSCommonDQMSource.cc.

Referenced by analyze(), bookHistograms(), and endLuminosityBlock().

const int CTPPSCommonDQMSource::MAX_LUMIS = 6000
staticprivate

Definition at line 46 of file CTPPSCommonDQMSource.cc.

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

const int CTPPSCommonDQMSource::MAX_VBINS = 18
staticprivate

Definition at line 47 of file CTPPSCommonDQMSource.cc.

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

std::vector<int> CTPPSCommonDQMSource::rpstate
private

Definition at line 55 of file CTPPSCommonDQMSource.cc.

Referenced by analyze(), CTPPSCommonDQMSource(), and endLuminosityBlock().

edm::EDGetTokenT< std::vector<CTPPSLocalTrackLite> > CTPPSCommonDQMSource::tokenLocalTrackLite
private

Definition at line 49 of file CTPPSCommonDQMSource.cc.

Referenced by analyze(), and CTPPSCommonDQMSource().

unsigned int CTPPSCommonDQMSource::verbosity
private

Definition at line 45 of file CTPPSCommonDQMSource.cc.

Referenced by analyze().