CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions
TotemRPDQMHarvester Class Reference
Inheritance diagram for TotemRPDQMHarvester:

Public Member Functions

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

Protected Member Functions

void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, const edm::LuminosityBlock &, const edm::EventSetup &) override
 

Private Member Functions

void MakeHitNumberRatios (unsigned int id, DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
 
void MakePlaneEfficiencyHistograms (unsigned int id, DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, bool &rpPlotInitialized)
 

Detailed Description

Definition at line 20 of file TotemRPDQMHarvester.cc.

Constructor & Destructor Documentation

TotemRPDQMHarvester::TotemRPDQMHarvester ( const edm::ParameterSet ps)

Definition at line 50 of file TotemRPDQMHarvester.cc.

50 {}
TotemRPDQMHarvester::~TotemRPDQMHarvester ( )
override

Definition at line 54 of file TotemRPDQMHarvester.cc.

54 {}

Member Function Documentation

void TotemRPDQMHarvester::dqmEndJob ( DQMStore::IBooker &  ,
DQMStore::IGetter &   
)
inlineoverrideprotected
void TotemRPDQMHarvester::dqmEndLuminosityBlock ( DQMStore::IBooker &  ibooker,
DQMStore::IGetter &  igetter,
const edm::LuminosityBlock ,
const edm::EventSetup  
)
overrideprotected

Definition at line 181 of file TotemRPDQMHarvester.cc.

References DEFINE_FWK_MODULE, MakeHitNumberRatios(), and MakePlaneEfficiencyHistograms().

Referenced by dqmEndJob().

184  {
185  // loop over arms
186  for (unsigned int arm = 0; arm < 2; arm++) {
187  // loop over stations
188  for (unsigned int st = 0; st < 3; st += 2) {
189  // loop over RPs
190  for (unsigned int rp = 0; rp < 6; ++rp) {
191  if (st == 2) {
192  // unit 220-nr is not equipped
193  if (rp <= 2)
194  continue;
195 
196  // RP 220-fr-hr contains pixels
197  if (rp == 3)
198  continue;
199  }
200 
201  TotemRPDetId rpId(arm, st, rp);
202 
203  MakeHitNumberRatios(rpId, ibooker, igetter);
204 
205  bool rpPlotInitialized = false;
206 
207  // loop over planes
208  for (unsigned int pl = 0; pl < 10; ++pl) {
209  TotemRPDetId plId(arm, st, rp, pl);
210 
211  MakePlaneEfficiencyHistograms(plId, ibooker, igetter, rpPlotInitialized);
212  }
213  }
214  }
215  }
216 }
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:30
void MakeHitNumberRatios(unsigned int id, DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
void MakePlaneEfficiencyHistograms(unsigned int id, DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, bool &rpPlotInitialized)
void TotemRPDQMHarvester::MakeHitNumberRatios ( unsigned int  id,
DQMStore::IBooker &  ibooker,
DQMStore::IGetter &  igetter 
)
private

Definition at line 58 of file TotemRPDQMHarvester.cc.

References HltBtagPostValidation_cff::c, dqm::impl::MonitorElement::getBinContent(), dqm::impl::MonitorElement::getNbinsX(), dqm::impl::MonitorElement::getNbinsY(), dqm::legacy::MonitorElement::getTH1F(), dqm::legacy::MonitorElement::getTH2F(), CTPPSDetId::nFull, CTPPSDetId::nPath, castor_dqm_sourceclient_file_cfg::path, alignCSCRings::r, CTPPSDetId::rpName(), alignCSCRings::s, dqm::impl::MonitorElement::setBinContent(), and overlapproblemtsosanalyzer_cfi::title.

Referenced by dqmEndJob(), and dqmEndLuminosityBlock().

58  {
59  // get source histogram
60  string path;
62 
63  MonitorElement *activity = igetter.get(path + "/activity in planes (2D)");
64 
65  if (!activity)
66  return;
67 
68  // book new histogram, if not yet done
69  const string hit_ratio_name = "hit ratio in hot spot";
70  MonitorElement *hit_ratio = igetter.get(path + "/" + hit_ratio_name);
71 
72  if (hit_ratio == nullptr) {
73  ibooker.setCurrentFolder(path);
74  string title;
76  hit_ratio = ibooker.book1D(hit_ratio_name, title + ";plane;N_hits(320<strip<440) / N_hits(all)", 10, -0.5, 9.5);
77  } else {
78  hit_ratio->getTH1F()->Reset();
79  }
80 
81  // calculate ratios
82  TAxis *y_axis = activity->getTH2F()->GetYaxis();
83  for (int bix = 1; bix <= activity->getNbinsX(); ++bix) {
84  double S_full = 0., S_sel = 0.;
85  for (int biy = 1; biy <= activity->getNbinsY(); ++biy) {
86  double c = activity->getBinContent(bix, biy);
87  double s = y_axis->GetBinCenter(biy);
88 
89  S_full += c;
90 
91  if (s > 320. && s < 440.)
92  S_sel += c;
93  }
94 
95  double r = (S_full > 0.) ? S_sel / S_full : 0.;
96 
97  hit_ratio->setBinContent(bix, r);
98  }
99 }
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:30
virtual TH2F * getTH2F() const
virtual int getNbinsY() const
get # of bins in Y-axis
virtual TH1F * getTH1F() const
virtual int getNbinsX() const
get # of bins in X-axis
void rpName(std::string &name, NameFlag flag=nFull) const
Definition: CTPPSDetId.h:128
virtual double getBinContent(int binx) const
get content of bin (1-D)
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
void TotemRPDQMHarvester::MakePlaneEfficiencyHistograms ( unsigned int  id,
DQMStore::IBooker &  ibooker,
DQMStore::IGetter &  igetter,
bool &  rpPlotInitialized 
)
private

Definition at line 103 of file TotemRPDQMHarvester.cc.

References L1TObjectsTimingClient_cff::efficiency, dqm::impl::MonitorElement::getBinContent(), dqm::impl::MonitorElement::getNbinsX(), dqm::legacy::MonitorElement::getTH1(), dqm::legacy::MonitorElement::getTH1F(), dqm::legacy::MonitorElement::getTH2F(), CTPPSDetId::nFull, CTPPSDetId::nPath, EgammaValidation_cff::num, AlCaHLTBitMon_ParallelJobs::p, castor_dqm_sourceclient_file_cfg::path, TotemRPDetId::plane(), TotemRPDetId::planeName(), CTPPSDetId::rpId(), CTPPSDetId::rpName(), dqm::impl::MonitorElement::setBinContent(), dqm::impl::MonitorElement::setBinError(), mathSSE::sqrt(), and overlapproblemtsosanalyzer_cfi::title.

Referenced by dqmEndJob(), and dqmEndLuminosityBlock().

106  {
107  TotemRPDetId detId(id);
108 
109  // get source histograms
110  string path;
111  detId.planeName(path, TotemRPDetId::nPath);
112 
113  MonitorElement *efficiency_num = igetter.get(path + "/efficiency num");
114  MonitorElement *efficiency_den = igetter.get(path + "/efficiency den");
115 
116  if (!efficiency_num || !efficiency_den)
117  return;
118 
119  // book new plane histogram, if not yet done
120  const string efficiency_name = "efficiency";
121  MonitorElement *efficiency = igetter.get(path + "/" + efficiency_name);
122 
123  if (efficiency == nullptr) {
124  string title;
125  detId.planeName(title, TotemRPDetId::nFull);
126  TAxis *axis = efficiency_den->getTH1()->GetXaxis();
127  ibooker.setCurrentFolder(path);
128  efficiency = ibooker.book1D(
129  efficiency_name, title + ";track position (mm)", axis->GetNbins(), axis->GetXmin(), axis->GetXmax());
130  } else {
131  efficiency->getTH1F()->Reset();
132  }
133 
134  // book new RP histogram, if not yet done
135  CTPPSDetId rpId = detId.rpId();
136  rpId.rpName(path, TotemRPDetId::nPath);
137  const string rp_efficiency_name = "plane efficiency";
138  MonitorElement *rp_efficiency = igetter.get(path + "/" + rp_efficiency_name);
139 
140  if (rp_efficiency == nullptr) {
141  string title;
142  rpId.rpName(title, TotemRPDetId::nFull);
143  TAxis *axis = efficiency_den->getTH1()->GetXaxis();
144  ibooker.setCurrentFolder(path);
145  rp_efficiency = ibooker.book2D(rp_efficiency_name,
146  title + ";plane;track position (mm)",
147  10,
148  -0.5,
149  9.5,
150  axis->GetNbins(),
151  axis->GetXmin(),
152  axis->GetXmax());
153  rpPlotInitialized = true;
154  } else {
155  if (!rpPlotInitialized)
156  rp_efficiency->getTH2F()->Reset();
157  rpPlotInitialized = true;
158  }
159 
160  // calculate and fill efficiencies
161  for (signed int bi = 1; bi <= efficiency->getNbinsX(); bi++) {
162  double num = efficiency_num->getBinContent(bi);
163  double den = efficiency_den->getBinContent(bi);
164 
165  if (den > 0) {
166  double p = num / den;
167  double p_unc = sqrt(p * (1. - p) / den);
168  efficiency->setBinContent(bi, p);
169  efficiency->setBinError(bi, p_unc);
170 
171  int pl_bi = detId.plane() + 1;
172  rp_efficiency->setBinContent(pl_bi, bi, p);
173  } else {
174  efficiency->setBinContent(bi, 0.);
175  }
176  }
177 }
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:30
virtual TH2F * getTH2F() const
virtual TH1F * getTH1F() const
CTPPSDetId rpId() const
Definition: CTPPSDetId.h:78
virtual int getNbinsX() const
get # of bins in X-axis
T sqrt(T t)
Definition: SSEVec.h:19
void rpName(std::string &name, NameFlag flag=nFull) const
Definition: CTPPSDetId.h:128
virtual double getBinContent(int binx) const
get content of bin (1-D)
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
virtual void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
virtual TH1 * getTH1() const