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:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

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
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 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 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 double ls_duration_inverse = 1./23.357
 
static unsigned int ls_max = 2000
 
static unsigned int ls_min = 0
 

Detailed Description

Definition at line 30 of file ElasticPlotDQMSource.cc.

Constructor & Destructor Documentation

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

Definition at line 188 of file ElasticPlotDQMSource.cc.

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

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

Definition at line 198 of file ElasticPlotDQMSource.cc.

199 {
200 }

Member Function Documentation

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

Definition at line 233 of file ElasticPlotDQMSource.cc.

References DEFINE_FWK_MODULE, diagonalPlots, TotemRPLocalTrack::getX0(), TotemRPLocalTrack::getY0(), hfClusterShapes_cfi::hits, mps_fire::i, edm::HandleBase::isValid(), ls_duration_inverse, edm::EventBase::luminosityBlock(), AlCaHLTBitMon_ParallelJobs::p, potPlots, createTree::pp, TotemRPUVPattern::projU, TotemRPUVPattern::projV, year_2016_postTS2_cff::rpId, tokenLocalTrack, tokenRecHit, tokenUVPattern, HiIsolationCommonParameters_cff::track, l1t::tracks, and verbosity.

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

Definition at line 204 of file ElasticPlotDQMSource.cc.

References protons_cff::arm, DQMStore::IBooker::cd(), diagonalPlots, potPlots, year_2016_postTS2_cff::rpId, and DQMStore::IBooker::setCurrentFolder().

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

Member Data Documentation

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

Definition at line 79 of file ElasticPlotDQMSource.cc.

Referenced by analyze(), and bookHistograms().

double ElasticPlotDQMSource::ls_duration_inverse = 1./23.357
staticprivate

Definition at line 42 of file ElasticPlotDQMSource.cc.

Referenced by analyze().

unsigned int ElasticPlotDQMSource::ls_max = 2000
staticprivate
unsigned int ElasticPlotDQMSource::ls_min = 0
staticprivate
std::map<unsigned int, PotPlots> ElasticPlotDQMSource::potPlots
private

Definition at line 96 of file ElasticPlotDQMSource.cc.

Referenced by analyze(), and bookHistograms().

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

Definition at line 50 of file ElasticPlotDQMSource.cc.

Referenced by analyze(), and ElasticPlotDQMSource().

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

Definition at line 48 of file ElasticPlotDQMSource.cc.

Referenced by analyze(), and ElasticPlotDQMSource().

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

Definition at line 49 of file ElasticPlotDQMSource.cc.

Referenced by analyze(), and ElasticPlotDQMSource().

unsigned int ElasticPlotDQMSource::verbosity
private

Definition at line 46 of file ElasticPlotDQMSource.cc.

Referenced by analyze().