test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 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 ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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

Implements DQMEDHarvester.

Definition at line 28 of file TotemRPDQMHarvester.cc.

28 {}
void TotemRPDQMHarvester::dqmEndLuminosityBlock ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
const edm::LuminosityBlock ,
const edm::EventSetup  
)
overrideprotectedvirtual

Reimplemented from DQMEDHarvester.

Definition at line 176 of file TotemRPDQMHarvester.cc.

178 {
179  // loop over arms
180  for (unsigned int arm = 0; arm < 2; arm++)
181  {
182  // loop over stations
183  for (unsigned int st = 0; st < 3; st += 2)
184  {
185  unsigned int stId = 10*arm + st;
186 
187  // loop over RPs
188  for (unsigned int rp = 0; rp < 6; ++rp)
189  {
190  unsigned int rpId = 10*stId + rp;
191 
192  MakeHitNumberRatios(rpId, ibooker, igetter);
193 
194  bool rpPlotInitialized = false;
195 
196  // loop over planes
197  for (unsigned int pl = 0; pl < 10; ++pl)
198  {
199  unsigned int plId = 10*rpId + pl;
200 
201  MakePlaneEfficiencyHistograms(plId, ibooker, igetter, rpPlotInitialized);
202  }
203  }
204  }
205  }
206 }
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(), TotemRPDetId::nFull, TotemRPDetId::nPath, NULL, fed_dqm_sourceclient-live_cfg::path, alignCSCRings::r, TotemRPDetId::rpName(), alignCSCRings::s, MonitorElement::setBinContent(), DQMStore::IBooker::setCurrentFolder(), and indexGen::title.

59 {
60  // get source histogram
62  path.replace(0, 2, "CTPPS/TrackingStrip");
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);
77  hit_ratio = ibooker.book1D(hit_ratio_name, title+";plane;N_hits(320<strip<440) / N_hits(all)", 10, -0.5, 9.5);
78  } else {
79  hit_ratio->getTH1F()->Reset();
80  }
81 
82  // calculate ratios
83  TAxis *y_axis = activity->getTH2F()->GetYaxis();
84  for (int bix = 1; bix <= activity->getNbinsX(); ++bix)
85  {
86  double S_full = 0., S_sel = 0.;
87  for (int biy = 1; biy <= activity->getNbinsY(); ++biy)
88  {
89  double c = activity->getBinContent(bix, biy);
90  double s = y_axis->GetBinCenter(biy);
91 
92  S_full += c;
93 
94  if (s > 320. && s < 440.)
95  S_sel += c;
96  }
97 
98  double r = (S_full > 0.) ? S_sel / S_full : 0.;
99 
100  hit_ratio->setBinContent(bix, r);
101  }
102 }
static std::string rpName(unsigned int id, NameFlag flag=nFull)
returns official name of a RP characterized by &#39;&#39;id&#39;&#39;; if &#39;&#39;full&#39;&#39; is true, name of station is prefix...
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:304
#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 setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
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 106 of file TotemRPDQMHarvester.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), postValidation_cfi::efficiency, DQMStore::IGetter::get(), MonitorElement::getBinContent(), MonitorElement::getNbinsX(), MonitorElement::getTH1(), MonitorElement::getTH1F(), MonitorElement::getTH2F(), TotemRPDetId::nFull, TotemRPDetId::nPath, NULL, pileupDistInMC::num, AlCaHLTBitMon_ParallelJobs::p, fed_dqm_sourceclient-live_cfg::path, TotemRPDetId::planeName(), TotemRPDetId::rpName(), MonitorElement::setBinContent(), MonitorElement::setBinError(), DQMStore::IBooker::setCurrentFolder(), mathSSE::sqrt(), and indexGen::title.

108 {
109  // get source histograms
111  path.replace(0, 2, "CTPPS/TrackingStrip");
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 == NULL)
124  {
126  TAxis *axis = efficiency_den->getTH1()->GetXaxis();
127  ibooker.setCurrentFolder(path);
128  efficiency = ibooker.book1D(efficiency_name, title+";track position (mm)", axis->GetNbins(), axis->GetXmin(), axis->GetXmax());
129  } else {
130  efficiency->getTH1F()->Reset();
131  }
132 
133  // book new RP histogram, if not yet done
135  path.replace(0, 2, "CTPPS/TrackingStrip");
136  const string rp_efficiency_name = "plane efficiency";
137  MonitorElement *rp_efficiency = igetter.get(path + "/" + rp_efficiency_name);
138 
139  if (rp_efficiency == NULL)
140  {
141  string title = TotemRPDetId::rpName(id/10, TotemRPDetId::nFull);
142  TAxis *axis = efficiency_den->getTH1()->GetXaxis();
143  ibooker.setCurrentFolder(path);
144  rp_efficiency = ibooker.book2D(rp_efficiency_name, title+";plane;track position (mm)",
145  10, -0.5, 9.5, axis->GetNbins(), axis->GetXmin(), axis->GetXmax());
146  rpPlotInitialized = true;
147  } else {
148  if (!rpPlotInitialized)
149  rp_efficiency->getTH2F()->Reset();
150  rpPlotInitialized = true;
151  }
152 
153  // calculate and fill efficiencies
154  for (signed int bi = 1; bi <= efficiency->getNbinsX(); bi++)
155  {
156  double num = efficiency_num->getBinContent(bi);
157  double den = efficiency_den->getBinContent(bi);
158 
159  if (den > 0)
160  {
161  double p = num / den;
162  double p_unc = sqrt(p * (1. - p) / den);
163  efficiency->setBinContent(bi, p);
164  efficiency->setBinError(bi, p_unc);
165 
166  int pl_bi = (id%10) + 1;
167  rp_efficiency->setBinContent(pl_bi, bi, p);
168  } else {
169  efficiency->setBinContent(bi, 0.);
170  }
171  }
172 }
static std::string rpName(unsigned int id, NameFlag flag=nFull)
returns official name of a RP characterized by &#39;&#39;id&#39;&#39;; if &#39;&#39;full&#39;&#39; is true, name of station is prefix...
void setBinContent(int binx, double content)
set content of bin (1-D)
static std::string planeName(unsigned int id, NameFlag flag=nFull)
returns official name of a plane characterized by &#39;&#39;id&#39;&#39;; if &#39;&#39;full&#39;&#39; is true, name of RP is prefixed...
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:304
#define NULL
Definition: scimark2.h:8
T sqrt(T t)
Definition: SSEVec.h:18
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
TH1 * getTH1(void) const
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
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