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 28 of file ElasticPlotDQMSource.cc.

Constructor & Destructor Documentation

◆ ElasticPlotDQMSource()

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

Definition at line 185 of file ElasticPlotDQMSource.cc.

187  : verbosity(ps.getUntrackedParameter<unsigned int>("verbosity", 0)) {
188  tokenRecHit = consumes<edm::DetSetVector<TotemRPRecHit>>(ps.getParameter<edm::InputTag>("tagRecHit"));
189  tokenUVPattern = consumes<DetSetVector<TotemRPUVPattern>>(ps.getParameter<edm::InputTag>("tagUVPattern"));
190  tokenLocalTrack = consumes<DetSetVector<TotemRPLocalTrack>>(ps.getParameter<edm::InputTag>("tagLocalTrack"));

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

◆ ~ElasticPlotDQMSource()

ElasticPlotDQMSource::~ElasticPlotDQMSource ( )
override

Definition at line 194 of file ElasticPlotDQMSource.cc.

Member Function Documentation

◆ analyze()

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

Definition at line 223 of file ElasticPlotDQMSource.cc.

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  }

References 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, profile_2016_postTS2_cff::rpId, tokenLocalTrack, tokenRecHit, tokenUVPattern, HLT_FULL_cff::track, tracks, RunInfoPI::valid, verbosity, TotemRPLocalTrack::x0(), and TotemRPLocalTrack::y0().

◆ bookHistograms()

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

Definition at line 198 of file ElasticPlotDQMSource.cc.

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  }

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

Member Data Documentation

◆ diagonalPlots

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

Definition at line 79 of file ElasticPlotDQMSource.cc.

Referenced by analyze(), and bookHistograms().

◆ ls_duration_inverse

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

Definition at line 43 of file ElasticPlotDQMSource.cc.

Referenced by analyze().

◆ ls_max

constexpr unsigned int ElasticPlotDQMSource::ls_max = 2000
staticconstexprprivate

Definition at line 45 of file ElasticPlotDQMSource.cc.

◆ ls_min

constexpr unsigned int ElasticPlotDQMSource::ls_min = 0
staticconstexprprivate

Definition at line 44 of file ElasticPlotDQMSource.cc.

◆ potPlots

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

Definition at line 95 of file ElasticPlotDQMSource.cc.

Referenced by analyze(), and bookHistograms().

◆ tokenLocalTrack

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

Definition at line 51 of file ElasticPlotDQMSource.cc.

Referenced by analyze(), and ElasticPlotDQMSource().

◆ tokenRecHit

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

Definition at line 49 of file ElasticPlotDQMSource.cc.

Referenced by analyze(), and ElasticPlotDQMSource().

◆ tokenUVPattern

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

Definition at line 50 of file ElasticPlotDQMSource.cc.

Referenced by analyze(), and ElasticPlotDQMSource().

◆ verbosity

unsigned int ElasticPlotDQMSource::verbosity
private

Definition at line 47 of file ElasticPlotDQMSource.cc.

Referenced by analyze().

TotemRPUVPattern::projV
Definition: TotemRPUVPattern.h:34
TotemRPLocalTrack::y0
double y0() const
Definition: TotemRPLocalTrack.h:89
mps_fire.i
i
Definition: mps_fire.py:428
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11724
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
ElasticPlotDQMSource::tokenLocalTrack
edm::EDGetTokenT< edm::DetSetVector< TotemRPLocalTrack > > tokenLocalTrack
Definition: ElasticPlotDQMSource.cc:51
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
ElasticPlotDQMSource::ls_duration_inverse
static constexpr double ls_duration_inverse
Definition: ElasticPlotDQMSource.cc:43
edm::Handle
Definition: AssociativeIterator.h:50
ElasticPlotDQMSource::potPlots
std::map< unsigned int, PotPlots > potPlots
Definition: ElasticPlotDQMSource.cc:95
Calorimetry_cff.dp
dp
Definition: Calorimetry_cff.py:158
edm::LogProblem
Log< level::Error, true > LogProblem
Definition: MessageLogger.h:131
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
ElasticPlotDQMSource::diagonalPlots
std::map< unsigned int, DiagonalPlots > diagonalPlots
Definition: ElasticPlotDQMSource.cc:79
ElasticPlotDQMSource::tokenUVPattern
edm::EDGetTokenT< edm::DetSetVector< TotemRPUVPattern > > tokenUVPattern
Definition: ElasticPlotDQMSource.cc:50
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:176
ElasticPlotDQMSource::verbosity
unsigned int verbosity
Definition: ElasticPlotDQMSource.cc:47
CTPPSDetId
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:31
protons_cff.arm
arm
Definition: protons_cff.py:39
profile_2016_postTS2_cff.rpId
rpId
Definition: profile_2016_postTS2_cff.py:21
TotemRPLocalTrack
A track fit through a single RP.
Definition: TotemRPLocalTrack.h:30
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TotemRPUVPattern::projU
Definition: TotemRPUVPattern.h:34
RunInfoPI::valid
Definition: RunInfoPayloadInspectoHelper.h:16
createTree.pp
pp
Definition: createTree.py:17
ElasticPlotDQMSource::tokenRecHit
edm::EDGetTokenT< edm::DetSetVector< TotemRPRecHit > > tokenRecHit
Definition: ElasticPlotDQMSource.cc:49
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
TotemRPLocalTrack::x0
double x0() const
Definition: TotemRPLocalTrack.h:85
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
event
Definition: event.py:1
TotemRPDetId
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:29
edm::InputTag
Definition: InputTag.h:15