CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Protected Member Functions | 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 bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 

Private Attributes

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

Detailed Description

Definition at line 28 of file CTPPSCommonDQMSource.cc.

Constructor & Destructor Documentation

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

Definition at line 157 of file CTPPSCommonDQMSource.cc.

References edm::ParameterSet::getParameter(), and tokenLocalTrackLite.

157  :
158  verbosity(ps.getUntrackedParameter<unsigned int>("verbosity", 0))
159 {
160  tokenLocalTrackLite = consumes< vector<CTPPSLocalTrackLite> >(ps.getParameter<edm::InputTag>("tagLocalTrackLite"));
161 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< std::vector< CTPPSLocalTrackLite > > tokenLocalTrackLite
CTPPSCommonDQMSource::~CTPPSCommonDQMSource ( )
override

Definition at line 165 of file CTPPSCommonDQMSource.cc.

166 {
167 }

Member Function Documentation

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

Definition at line 185 of file CTPPSCommonDQMSource.cc.

References CTPPSDetId::arm(), armPlots, edm::EventBase::bunchCrossing(), DEFINE_FWK_MODULE, 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_cfi::plots, CTPPSDetId::rp(), tokenLocalTrackLite, l1t::tracks, and verbosity.

186 {
187  // get event data
189  event.getByToken(tokenLocalTrackLite, tracks);
190 
191  // check validity
192  bool valid = true;
193  valid &= tracks.isValid();
194 
195  if (!valid)
196  {
197  if (verbosity)
198  {
199  LogProblem("CTPPSCommonDQMSource")
200  << " trackLites.isValid = " << tracks.isValid();
201  }
202 
203  return;
204  }
205 
206  //------------------------------
207  // collect indeces of RP with tracks, for each correlation plot
208  set<signed int> s_rp_idx_global_hor, s_rp_idx_global_vert;
209  map<unsigned int, set<signed int>> ms_rp_idx_arm;
210 
211  for (auto &tr : *tracks)
212  {
213  const CTPPSDetId rpId(tr.getRPId());
214  const unsigned int arm = rpId.arm();
215  const unsigned int stNum = rpId.station();
216  const unsigned int rpNum = rpId.rp();
217  const unsigned int stRPNum = stNum * 10 + rpNum;
218 
219  {
220  signed int idx = -1;
221  if (stRPNum == 3) idx = 0;
222  if (stRPNum == 23) idx = 1;
223  if (stRPNum == 16) idx = 2;
224 
225  if (idx >= 0)
226  s_rp_idx_global_hor.insert(3*arm + idx);
227  }
228 
229  {
230  signed int idx = -1;
231  if (stRPNum == 4) idx = 0;
232  if (stRPNum == 5) idx = 1;
233  if (stRPNum == 24) idx = 2;
234  if (stRPNum == 25) idx = 3;
235 
236  if (idx >= 0)
237  s_rp_idx_global_vert.insert(4*arm + idx);
238  }
239 
240  {
241  signed int idx = -1;
242  if (stRPNum == 3) idx = 0;
243  if (stRPNum == 4) idx = 1;
244  if (stRPNum == 5) idx = 2;
245  if (stRPNum == 16) idx = 3;
246  if (stRPNum == 23) idx = 4;
247  if (stRPNum == 24) idx = 5;
248  if (stRPNum == 25) idx = 6;
249 
250  const signed int hor = ((rpNum == 2) || (rpNum == 3) || (rpNum == 6)) ? 1 : 0;
251 
252  if (idx >= 0)
253  ms_rp_idx_arm[arm].insert(idx * 10 + hor);
254  }
255  }
256 
257  //------------------------------
258  // Global Plots
259 
260  globalPlots.events_per_bx->Fill(event.bunchCrossing());
261  globalPlots.events_per_bx_short->Fill(event.bunchCrossing());
262 
263  for (const auto &idx1 : s_rp_idx_global_hor)
264  for (const auto &idx2 : s_rp_idx_global_hor)
265  globalPlots.h_trackCorr_hor->Fill(idx1, idx2);
266 
267  for (const auto &idx1 : s_rp_idx_global_vert)
268  for (const auto &idx2 : s_rp_idx_global_vert)
269  globalPlots.h_trackCorr_vert->Fill(idx1, idx2);
270 
271  //------------------------------
272  // Arm Plots
273 
274  map<unsigned int, set<unsigned int>> mTop, mHor, mBot;
275 
276  for (auto &tr : *tracks)
277  {
278  CTPPSDetId rpId(tr.getRPId());
279  const unsigned int rpNum = rpId.rp();
280  const unsigned int armIdx = rpId.arm();
281 
282  if (rpNum == 0 || rpNum == 4)
283  mTop[armIdx].insert(rpId);
284  if (rpNum == 2 || rpNum == 3 || rpNum == 6)
285  mHor[armIdx].insert(rpId);
286  if (rpNum == 1 || rpNum == 5)
287  mBot[armIdx].insert(rpId);
288  }
289 
290  for (auto &p : armPlots)
291  {
292  p.second.h_numRPWithTrack_top->Fill(mTop[p.first].size());
293  p.second.h_numRPWithTrack_hor->Fill(mHor[p.first].size());
294  p.second.h_numRPWithTrack_bot->Fill(mBot[p.first].size());
295  }
296 
297  // track RP correlation
298  for (const auto &ap : ms_rp_idx_arm)
299  {
300  auto &plots = armPlots[ap.first];
301 
302  for (const auto &idx1 : ap.second)
303  {
304  for (const auto &idx2 : ap.second)
305  {
306  plots.h_trackCorr->Fill(idx1/10, idx2/10);
307 
308  if ((idx1 % 10) != (idx2 % 10))
309  plots.h_trackCorr_overlap->Fill(idx1/10, idx2/10);
310  }
311  }
312  }
313 }
edm::EDGetTokenT< std::vector< CTPPSLocalTrackLite > > tokenLocalTrackLite
void Fill(long long x)
std::map< unsigned int, ArmPlots > armPlots
uint32_t arm() const
Definition: CTPPSDetId.h:52
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:74
void CTPPSCommonDQMSource::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotected

Definition at line 171 of file CTPPSCommonDQMSource.cc.

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

172 {
173  // global plots
174  globalPlots.Init(ibooker);
175 
176  // loop over arms
177  for (unsigned int arm = 0; arm < 2; arm++)
178  {
179  armPlots[arm] = ArmPlots(ibooker, arm);
180  }
181 }
std::map< unsigned int, ArmPlots > armPlots
void Init(DQMStore::IBooker &ibooker)

Member Data Documentation

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

Definition at line 71 of file CTPPSCommonDQMSource.cc.

Referenced by analyze(), and bookHistograms().

GlobalPlots CTPPSCommonDQMSource::globalPlots
private

Definition at line 56 of file CTPPSCommonDQMSource.cc.

Referenced by analyze(), and bookHistograms().

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

Definition at line 45 of file CTPPSCommonDQMSource.cc.

Referenced by analyze(), and CTPPSCommonDQMSource().

unsigned int CTPPSCommonDQMSource::verbosity
private

Definition at line 43 of file CTPPSCommonDQMSource.cc.

Referenced by analyze().