CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes
ElasticPlotDQMSource Class Reference
Inheritance diagram for ElasticPlotDQMSource:

Classes

struct  DiagonalPlots
 plots related to one (anti)diagonal More...
 
struct  PotPlots
 plots related to one RP More...
 

Public Member Functions

 ElasticPlotDQMSource (const edm::ParameterSet &ps)
 
 ~ElasticPlotDQMSource () override
 

Protected Member Functions

void analyze (edm::Event const &e, edm::EventSetup const &eSetup) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 

Private Attributes

std::map< unsigned int, DiagonalPlotsdiagonalPlots
 
std::map< unsigned int, PotPlotspotPlots
 
edm::EDGetTokenT< edm::DetSetVector< TotemRPLocalTrack > > tokenLocalTrack
 
edm::EDGetTokenT< edm::DetSetVector< TotemRPRecHit > > tokenRecHit
 
edm::EDGetTokenT< edm::DetSetVector< TotemRPUVPattern > > tokenUVPattern
 
unsigned int verbosity
 

Static Private Attributes

static constexpr double ls_duration_inverse = 1. / 23.357
 
static constexpr unsigned int ls_max = 2000
 
static constexpr unsigned int ls_min = 0
 

Detailed Description

Definition at line 29 of file ElasticPlotDQMSource.cc.

Constructor & Destructor Documentation

◆ ElasticPlotDQMSource()

ElasticPlotDQMSource::ElasticPlotDQMSource ( const edm::ParameterSet ps)

Definition at line 186 of file ElasticPlotDQMSource.cc.

References edm::ParameterSet::getUntrackedParameter(), tokenLocalTrack, tokenRecHit, and tokenUVPattern.

187  : verbosity(ps.getUntrackedParameter<unsigned int>("verbosity", 0)) {
188  tokenRecHit = consumes<edm::DetSetVector<TotemRPRecHit>>(ps.getUntrackedParameter<edm::InputTag>("tagRecHit"));
189  tokenUVPattern = consumes<DetSetVector<TotemRPUVPattern>>(ps.getUntrackedParameter<edm::InputTag>("tagUVPattern"));
190  tokenLocalTrack = consumes<DetSetVector<TotemRPLocalTrack>>(ps.getUntrackedParameter<edm::InputTag>("tagLocalTrack"));
191 }
edm::EDGetTokenT< edm::DetSetVector< TotemRPRecHit > > tokenRecHit
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::DetSetVector< TotemRPLocalTrack > > tokenLocalTrack
edm::EDGetTokenT< edm::DetSetVector< TotemRPUVPattern > > tokenUVPattern

◆ ~ElasticPlotDQMSource()

ElasticPlotDQMSource::~ElasticPlotDQMSource ( )
override

Definition at line 195 of file ElasticPlotDQMSource.cc.

195 {}

Member Function Documentation

◆ analyze()

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

Definition at line 224 of file ElasticPlotDQMSource.cc.

References hcalRecHitTable_cff::detId, diagonalPlots, Calorimetry_cff::dp, hfClusterShapes_cfi::hits, mps_fire::i, edm::HandleBase::isValid(), dqmiolumiharvest::j, ls_duration_inverse, AlCaHLTBitMon_ParallelJobs::p, potPlots, createTree::pp, TotemRPUVPattern::projU, TotemRPUVPattern::projV, tokenLocalTrack, tokenRecHit, tokenUVPattern, HLT_2024v12_cff::track, DiMuonV_cfg::tracks, validateGeometry_cfg::valid, verbosity, TotemRPLocalTrack::x0(), and TotemRPLocalTrack::y0().

224  {
225  // get event data
227  event.getByToken(tokenRecHit, hits);
228 
230  event.getByToken(tokenUVPattern, patterns);
231 
233  event.getByToken(tokenLocalTrack, tracks);
234 
235  // check validity
236  bool valid = true;
237  valid &= hits.isValid();
238  valid &= patterns.isValid();
239  valid &= tracks.isValid();
240 
241  if (!valid) {
242  if (verbosity) {
243  LogProblem("ElasticPlotDQMSource") << "ERROR in ElasticPlotDQMSource::analyze > some of the required inputs are "
244  "not valid. Skipping this event.\n"
245  << " hits.isValid = " << hits.isValid() << "\n"
246  << " patterns.isValid = " << patterns.isValid() << "\n"
247  << " tracks.isValid = " << tracks.isValid();
248  }
249 
250  return;
251  }
252 
253  //------------------------------
254  // categorise RP data
255  map<unsigned int, unsigned int> rp_planes_u_too_full, rp_planes_v_too_full;
256  map<unsigned int, bool> rp_pat_suff;
257  map<unsigned int, const TotemRPLocalTrack *> rp_track;
258 
259  for (const auto &ds : *hits) {
260  TotemRPDetId detId(ds.detId());
261  CTPPSDetId rpId = detId.rpId();
262 
263  if (ds.size() > 5) {
264  if (detId.isStripsCoordinateUDirection())
265  rp_planes_u_too_full[rpId]++;
266  else
267  rp_planes_v_too_full[rpId]++;
268  }
269  }
270 
271  for (auto &ds : *patterns) {
272  CTPPSDetId rpId(ds.detId());
273 
274  // count U and V patterns
275  unsigned int n_pat_u = 0, n_pat_v = 0;
276  for (auto &p : ds) {
277  if (!p.fittable())
278  continue;
279 
280  if (p.projection() == TotemRPUVPattern::projU)
281  n_pat_u++;
282  else if (p.projection() == TotemRPUVPattern::projV)
283  n_pat_v++;
284  }
285 
286  rp_pat_suff[rpId] =
287  (n_pat_u > 0 || rp_planes_u_too_full[rpId] >= 3) && (n_pat_v > 0 || rp_planes_v_too_full[rpId] >= 3);
288  }
289 
290  for (auto &ds : *tracks) {
291  CTPPSDetId rpId(ds.detId());
292 
293  const TotemRPLocalTrack *track = nullptr;
294  for (auto &ft : ds) {
295  if (ft.isValid()) {
296  track = &ft;
297  break;
298  }
299  }
300 
301  rp_track[rpId] = track;
302  }
303 
304  //------------------------------
305  // diagonal plots
306 
307  for (auto &dpp : diagonalPlots) {
308  auto &dp = dpp.second;
309 
310  // determine diagonal conditions
311  bool cond_4rp = true, cond_2rp = true;
312  for (unsigned int i = 0; i < 4; i++) {
313  if (rp_track[dp.rpIds[i]] == nullptr)
314  cond_4rp = false;
315 
316  if ((i == 0 || i == 3) && rp_track[dp.rpIds[i]] == nullptr)
317  cond_2rp = false;
318  }
319 
320  if (cond_4rp)
321  dp.h_rate_vs_time_dgn_4rp->Fill(event.luminosityBlock(), ls_duration_inverse);
322 
323  if (cond_2rp)
324  dp.h_rate_vs_time_dgn_2rp->Fill(event.luminosityBlock(), ls_duration_inverse);
325 
326  for (unsigned int i = 0; i < 4; i++) {
327  const TotemRPLocalTrack *tr_i = rp_track[dp.rpIds[i]];
328 
329  if (tr_i == nullptr)
330  continue;
331 
332  if (cond_4rp)
333  dp.v_h2_y_vs_x_dgn_4rp[i]->Fill(tr_i->x0(), tr_i->y0());
334 
335  if (cond_2rp)
336  dp.v_h2_y_vs_x_dgn_2rp[i]->Fill(tr_i->x0(), tr_i->y0());
337 
338  for (unsigned int j = 0; j < 4; j++) {
339  if (rp_track[dp.rpIds[j]] == nullptr)
340  continue;
341 
342  dp.h2_track_corr_vert->Fill(i, j);
343 
344  dp.v_h_y[i][j]->Fill(tr_i->y0());
345  }
346  }
347  }
348 
349  //------------------------------
350  // pot plots
351 
352  for (const auto &p : rp_pat_suff) {
353  const auto &rpId = p.first;
354  auto pp_it = potPlots.find(rpId);
355  if (pp_it == potPlots.end())
356  continue;
357  auto &pp = pp_it->second;
358 
359  const auto &pat_suff = rp_pat_suff[rpId];
360  const auto &has_track = (rp_track[rpId] != nullptr);
361 
362  if (pat_suff)
363  pp.h_rate_vs_time_suff->Fill(event.luminosityBlock(), ls_duration_inverse);
364  if (has_track)
365  pp.h_rate_vs_time_track->Fill(event.luminosityBlock(), ls_duration_inverse);
366  if (pat_suff && !has_track)
367  pp.h_rate_vs_time_unresolved->Fill(event.luminosityBlock(), ls_duration_inverse);
368  }
369 }
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:30
edm::EDGetTokenT< edm::DetSetVector< TotemRPRecHit > > tokenRecHit
double y0() const
static constexpr double ls_duration_inverse
A track fit through a single RP.
edm::EDGetTokenT< edm::DetSetVector< TotemRPLocalTrack > > tokenLocalTrack
edm::EDGetTokenT< edm::DetSetVector< TotemRPUVPattern > > tokenUVPattern
std::map< unsigned int, PotPlots > potPlots
std::map< unsigned int, DiagonalPlots > diagonalPlots
bool isValid() const
Definition: HandleBase.h:70
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
double x0() const
Definition: event.py:1
Log< level::Error, true > LogProblem

◆ bookHistograms()

void ElasticPlotDQMSource::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotected

Definition at line 199 of file ElasticPlotDQMSource.cc.

References protons_cff::arm, dqm::implementation::NavigatorBase::cd(), diagonalPlots, potPlots, and dqm::implementation::NavigatorBase::setCurrentFolder().

199  {
200  ibooker.cd();
201  ibooker.setCurrentFolder("CTPPS");
202 
203  // initialize (anti-)diagonal plots
204  diagonalPlots[0] = DiagonalPlots(ibooker, 0); // 45 bot - 56 bot
205  diagonalPlots[1] = DiagonalPlots(ibooker, 1); // 45 bot - 56 top
206  diagonalPlots[2] = DiagonalPlots(ibooker, 2); // 45 top - 56 bot
207  diagonalPlots[3] = DiagonalPlots(ibooker, 3); // 45 top - 56 top
208 
209  // loop over arms
210  for (unsigned int arm = 0; arm < 2; arm++) {
211  // loop over stations
212  for (unsigned int st : {0, 2}) {
213  // loop over RPs
214  for (unsigned int rp : {4, 5}) {
215  TotemRPDetId rpId(arm, st, rp);
216  potPlots[rpId] = PotPlots(ibooker, rpId);
217  }
218  }
219  }
220 }
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:30
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
std::map< unsigned int, PotPlots > potPlots
std::map< unsigned int, DiagonalPlots > diagonalPlots

Member Data Documentation

◆ diagonalPlots

std::map<unsigned int, DiagonalPlots> ElasticPlotDQMSource::diagonalPlots
private

Definition at line 76 of file ElasticPlotDQMSource.cc.

Referenced by analyze(), and bookHistograms().

◆ ls_duration_inverse

constexpr double ElasticPlotDQMSource::ls_duration_inverse = 1. / 23.357
staticprivate

Definition at line 40 of file ElasticPlotDQMSource.cc.

Referenced by analyze().

◆ ls_max

constexpr unsigned int ElasticPlotDQMSource::ls_max = 2000
staticprivate

Definition at line 42 of file ElasticPlotDQMSource.cc.

◆ ls_min

constexpr unsigned int ElasticPlotDQMSource::ls_min = 0
staticprivate

Definition at line 41 of file ElasticPlotDQMSource.cc.

◆ potPlots

std::map<unsigned int, PotPlots> ElasticPlotDQMSource::potPlots
private

Definition at line 92 of file ElasticPlotDQMSource.cc.

Referenced by analyze(), and bookHistograms().

◆ tokenLocalTrack

edm::EDGetTokenT<edm::DetSetVector<TotemRPLocalTrack> > ElasticPlotDQMSource::tokenLocalTrack
private

Definition at line 48 of file ElasticPlotDQMSource.cc.

Referenced by analyze(), and ElasticPlotDQMSource().

◆ tokenRecHit

edm::EDGetTokenT<edm::DetSetVector<TotemRPRecHit> > ElasticPlotDQMSource::tokenRecHit
private

Definition at line 46 of file ElasticPlotDQMSource.cc.

Referenced by analyze(), and ElasticPlotDQMSource().

◆ tokenUVPattern

edm::EDGetTokenT<edm::DetSetVector<TotemRPUVPattern> > ElasticPlotDQMSource::tokenUVPattern
private

Definition at line 47 of file ElasticPlotDQMSource.cc.

Referenced by analyze(), and ElasticPlotDQMSource().

◆ verbosity

unsigned int ElasticPlotDQMSource::verbosity
private

Definition at line 44 of file ElasticPlotDQMSource.cc.

Referenced by analyze().