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 21 of file TotemRPDQMHarvester.cc.

Constructor & Destructor Documentation

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

Definition at line 46 of file TotemRPDQMHarvester.cc.

47 {
48 }
TotemRPDQMHarvester::~TotemRPDQMHarvester ( )
override

Definition at line 52 of file TotemRPDQMHarvester.cc.

53 {
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().

183 {
184  // loop over arms
185  for (unsigned int arm = 0; arm < 2; arm++)
186  {
187  // loop over stations
188  for (unsigned int st = 0; st < 3; st += 2)
189  {
190  // loop over RPs
191  for (unsigned int rp = 0; rp < 6; ++rp)
192  {
193  if (st == 2)
194  {
195  // unit 220-nr is not equipped
196  if (rp <= 2)
197  continue;
198 
199  // RP 220-fr-hr contains pixels
200  if (rp == 3)
201  continue;
202  }
203 
204  TotemRPDetId rpId(arm, st, rp);
205 
206  MakeHitNumberRatios(rpId, ibooker, igetter);
207 
208  bool rpPlotInitialized = false;
209 
210  // loop over planes
211  for (unsigned int pl = 0; pl < 10; ++pl)
212  {
213  TotemRPDetId plId(arm, st, rp, pl);
214 
215  MakePlaneEfficiencyHistograms(plId, ibooker, igetter, rpPlotInitialized);
216  }
217  }
218  }
219  }
220 }
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 DQMStore::IBooker::book1D(), EnergyCorrector::c, DQMStore::IGetter::get(), MonitorElement::getBinContent(), MonitorElement::getNbinsX(), MonitorElement::getNbinsY(), MonitorElement::getTH1F(), MonitorElement::getTH2F(), CTPPSDetId::nFull, CTPPSDetId::nPath, callgraph::path, alignCSCRings::r, CTPPSDetId::rpName(), alignCSCRings::s, MonitorElement::setBinContent(), DQMStore::IBooker::setCurrentFolder(), and fftjetcommon_cfi::title.

Referenced by dqmEndJob(), and dqmEndLuminosityBlock().

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

Definition at line 107 of file TotemRPDQMHarvester.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), PostProcessor_cff::efficiency, DQMStore::IGetter::get(), MonitorElement::getBinContent(), MonitorElement::getNbinsX(), CTPPSDetId::getRPId(), MonitorElement::getTH1(), MonitorElement::getTH1F(), MonitorElement::getTH2F(), CTPPSDetId::nFull, CTPPSDetId::nPath, pileupDistInMC::num, AlCaHLTBitMon_ParallelJobs::p, callgraph::path, TotemRPDetId::plane(), TotemRPDetId::planeName(), CTPPSDetId::rpName(), MonitorElement::setBinContent(), MonitorElement::setBinError(), DQMStore::IBooker::setCurrentFolder(), mathSSE::sqrt(), and fftjetcommon_cfi::title.

Referenced by dqmEndJob(), and dqmEndLuminosityBlock().

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