CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions
TotemRPDQMHarvester Class Reference
Inheritance diagram for TotemRPDQMHarvester:
DQMEDHarvester edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 TotemRPDQMHarvester (const edm::ParameterSet &ps)
 
virtual ~TotemRPDQMHarvester ()
 
- Public Member Functions inherited from DQMEDHarvester
virtual void analyze (edm::Event const &, edm::EventSetup const &) final
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDHarvester (void)
 
virtual void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void endJob () final
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, const edm::LuminosityBlock &, const edm::EventSetup &) override
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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)
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

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 ( )
virtual

Definition at line 52 of file TotemRPDQMHarvester.cc.

53 {
54 }

Member Function Documentation

void TotemRPDQMHarvester::dqmEndJob ( DQMStore::IBooker ,
DQMStore::IGetter  
)
inlineoverrideprotectedvirtual
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, NULL, 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 == NULL)
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)
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:305
#define NULL
Definition: scimark2.h:8
int getNbinsY(void) const
get # of bins in Y-axis
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void rpName(std::string &name, NameFlag flag=nFull) const
Definition: CTPPSDetId.h:139
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
TH1F * getTH1F(void) const
double getBinContent(int binx) const
get content of bin (1-D)
int getNbinsX(void) const
get # of bins in X-axis
TH2F * getTH2F(void) const
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, NULL, 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 == NULL)
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 == NULL)
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)
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:305
#define NULL
Definition: scimark2.h:8
T sqrt(T t)
Definition: SSEVec.h:18
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void rpName(std::string &name, NameFlag flag=nFull) const
Definition: CTPPSDetId.h:139
TH1 * getTH1(void) const
CTPPSDetId getRPId() const
Definition: CTPPSDetId.h:97
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
TH1F * getTH1F(void) const
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
double getBinContent(int binx) const
get content of bin (1-D)
int getNbinsX(void) const
get # of bins in X-axis
TH2F * getTH2F(void) const