CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
MuonME0DigisHarvestor Class Reference

#include <MuonME0DigisHarvestor.h>

Inheritance diagram for MuonME0DigisHarvestor:
DQMEDHarvester edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

TH1F * ComputeBKG (TH1F *hist1, TH1F *hist2, std::string nameHist)
 
TProfile * ComputeEff (TH1F *num, TH1F *denum, std::string nameHist)
 
void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
 MuonME0DigisHarvestor (const edm::ParameterSet &)
 constructor More...
 
void ProcessBooking (DQMStore::IBooker &, DQMStore::IGetter &, std::string nameHist, TH1F *num, TH1F *den)
 
void ProcessBookingBKG (DQMStore::IBooker &ibooker, DQMStore::IGetter &ig, std::string nameHist, TH1F *hist, TH1F *hist2)
 
 ~MuonME0DigisHarvestor () override
 destructor More...
 
- Public Member Functions inherited from DQMEDHarvester
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 DQMEDHarvester ()
 
virtual void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
void endJob () final
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &, edm::EventSetup const &) final
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) override
 
 ~DQMEDHarvester () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

std::string dbe_path_
 

Additional Inherited Members

- Public Types inherited from DQMEDHarvester
typedef dqm::harvesting::DQMStore DQMStore
 
typedef dqm::harvesting::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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)
 
- Protected Attributes inherited from DQMEDHarvester
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 18 of file MuonME0DigisHarvestor.h.

Constructor & Destructor Documentation

MuonME0DigisHarvestor::MuonME0DigisHarvestor ( const edm::ParameterSet ps)
explicit

constructor

Geometry.

Log messages

Definition at line 32 of file MuonME0DigisHarvestor.cc.

References dbe_path_, and AlCaHLTBitMon_QueryRunRegistry::string.

32  {
33  dbe_path_ = std::string("MuonME0DigisV/ME0DigisTask/");
34 }
MuonME0DigisHarvestor::~MuonME0DigisHarvestor ( )
override

destructor

Definition at line 36 of file MuonME0DigisHarvestor.cc.

36 {}

Member Function Documentation

TH1F * MuonME0DigisHarvestor::ComputeBKG ( TH1F *  hist1,
TH1F *  hist2,
std::string  nameHist 
)

Definition at line 95 of file MuonME0DigisHarvestor.cc.

References newFWLiteAna::bin, MillePedeFileConverter_cfg::e, Skims_PA_cff::name, nEvts, Pi, Scenarios_cff::scale, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ProcessBookingBKG().

95  {
96  std::string name = "rate_" + nameHist;
97  hist1->SetName(name.c_str());
98  for (int bin = 1; bin <= hist1->GetNbinsX(); ++bin) {
99  double R_min = hist1->GetBinCenter(bin) - 0.5 * hist1->GetBinWidth(bin);
100  double R_max = hist1->GetBinCenter(bin) + 0.5 * hist1->GetBinWidth(bin);
101 
102  double Area = TMath::Pi() * (R_max * R_max - R_min * R_min);
103  hist1->SetBinContent(bin, (hist1->GetBinContent(bin)) / Area);
104  hist1->SetBinError(bin, (hist1->GetBinError(bin)) / Area);
105  }
106 
107  int nEvts = hist2->GetEntries();
108  float scale = 6 * 2 * nEvts * 3 * 25e-9; // New redigitizer saves hits only in the BX range: [-1,+1], so the
109  // number of background hits has to be divided by 3
110  hist1->Scale(1.0 / scale);
111  return hist1;
112 }
const double Pi
const int nEvts
TProfile * MuonME0DigisHarvestor::ComputeEff ( TH1F *  num,
TH1F *  denum,
std::string  nameHist 
)

Definition at line 38 of file MuonME0DigisHarvestor.cc.

References mps_fire::i, Skims_PA_cff::name, mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, and overlapproblemtsosanalyzer_cfi::title.

Referenced by ProcessBooking().

38  {
39  std::string name = "eff_" + nameHist;
40  std::string title = "Digi Efficiency" + std::string(num->GetTitle());
41  TProfile *efficHist = new TProfile(name.c_str(),
42  title.c_str(),
43  denum->GetXaxis()->GetNbins(),
44  denum->GetXaxis()->GetXmin(),
45  denum->GetXaxis()->GetXmax());
46 
47  for (int i = 1; i <= denum->GetNbinsX(); i++) {
48  double nNum = num->GetBinContent(i);
49  double nDenum = denum->GetBinContent(i);
50  if (nDenum == 0 || nNum == 0) {
51  continue;
52  }
53  if (nNum > nDenum) {
54  double temp = nDenum;
55  nDenum = nNum;
56  nNum = temp;
57  edm::LogWarning("MuonME0DigisHarvestor")
58  << "Alert! specific bin's num is bigger than denum " << i << " " << nNum << " " << nDenum;
59  }
60  const double effVal = nNum / nDenum;
61  efficHist->SetBinContent(i, effVal);
62  efficHist->SetBinEntries(i, 1);
63  efficHist->SetBinError(i, 0);
64  const double errLo = TEfficiency::ClopperPearson((int)nDenum, (int)nNum, 0.683, false);
65  const double errUp = TEfficiency::ClopperPearson((int)nDenum, (int)nNum, 0.683, true);
66  const double errVal = (effVal - errLo > errUp - effVal) ? effVal - errLo : errUp - effVal;
67  efficHist->SetBinError(i, sqrt(effVal * effVal + errVal * errVal));
68  }
69  return efficHist;
70 }
T sqrt(T t)
Definition: SSEVec.h:19
void MuonME0DigisHarvestor::dqmEndJob ( DQMStore::IBooker ibooker,
DQMStore::IGetter ig 
)
overridevirtual

Implements DQMEDHarvester.

Definition at line 136 of file MuonME0DigisHarvestor.cc.

References dbe_path_, DEFINE_FWK_MODULE, dqm::dqmstoreimpl::DQMStore::IGetter::get(), mps_fire::i, dqmiolumiharvest::j, GEMDetLabel::l_suffix, Skims_PA_cff::name, ProcessBooking(), ProcessBookingBKG(), dqm::dqmstoreimpl::DQMStore::IGetter::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

136  {
137  ig.setCurrentFolder(dbe_path_);
138 
139  const char *l_suffix[6] = {"_l1", "_l2", "_l3", "_l4", "_l5", "_l6"};
140  const char *r_suffix[2] = {"-1", "1"};
141 
142  TString eta_label_den_tot = TString(dbe_path_) + "me0_strip_dg_den_eta_tot";
143  TString eta_label_num_tot = TString(dbe_path_) + "me0_strip_dg_num_eta_tot";
144  if (ig.get(eta_label_num_tot.Data()) != nullptr && ig.get(eta_label_den_tot.Data()) != nullptr) {
145  TH1F *num_vs_eta_tot = (TH1F *)ig.get(eta_label_num_tot.Data())->getTH1F()->Clone();
146  num_vs_eta_tot->Sumw2();
147  TH1F *den_vs_eta_tot = (TH1F *)ig.get(eta_label_den_tot.Data())->getTH1F()->Clone();
148  den_vs_eta_tot->Sumw2();
149 
150  ProcessBooking(ibooker, ig, "me0_strip_dg_eta_tot", num_vs_eta_tot, den_vs_eta_tot);
151 
152  delete num_vs_eta_tot;
153  delete den_vs_eta_tot;
154 
155  } else
156  edm::LogWarning("MuonME0DigisHarvestor")
157  << "Can not find histograms: " << eta_label_num_tot << " or " << eta_label_den_tot;
158 
159  for (int i = 0; i < 2; i++) {
160  for (int j = 0; j < 6; j++) {
161  TString eta_label_den = TString(dbe_path_) + "me0_strip_dg_den_eta" + r_suffix[i] + l_suffix[j];
162  TString eta_label_num = TString(dbe_path_) + "me0_strip_dg_num_eta" + r_suffix[i] + l_suffix[j];
163 
164  if (ig.get(eta_label_num.Data()) != nullptr && ig.get(eta_label_den.Data()) != nullptr) {
165  TH1F *num_vs_eta = (TH1F *)ig.get(eta_label_num.Data())->getTH1F()->Clone();
166  num_vs_eta->Sumw2();
167  TH1F *den_vs_eta = (TH1F *)ig.get(eta_label_den.Data())->getTH1F()->Clone();
168  den_vs_eta->Sumw2();
169 
170  std::string r_s = r_suffix[i];
171  std::string l_s = l_suffix[j];
172  std::string name = "me0_strip_dg_eta" + r_s + l_s;
173  ProcessBooking(ibooker, ig, name, num_vs_eta, den_vs_eta);
174 
175  delete num_vs_eta;
176  delete den_vs_eta;
177 
178  } else
179  edm::LogWarning("MuonME0DigisHarvestor")
180  << "Can not find histograms: " << eta_label_num << " " << eta_label_den;
181  }
182  }
183 
184  TString label_eleBkg = TString(dbe_path_) + "me0_strip_dg_bkgElePos_radius";
185  TString label_neuBkg = TString(dbe_path_) + "me0_strip_dg_bkgNeutral_radius";
186  TString label_totBkg = TString(dbe_path_) + "me0_strip_dg_bkg_radius_tot";
187  TString label_evts = TString(dbe_path_) + "num_evts";
188 
189  if (ig.get(label_evts.Data()) != nullptr) {
190  TH1F *numEvts = (TH1F *)ig.get(label_evts.Data())->getTH1F()->Clone();
191 
192  if (ig.get(label_eleBkg.Data()) != nullptr) {
193  TH1F *eleBkg = (TH1F *)ig.get(label_eleBkg.Data())->getTH1F()->Clone();
194  eleBkg->Sumw2();
195  ProcessBookingBKG(ibooker, ig, "me0_strip_dg_elePosBkg_rad", eleBkg, numEvts);
196 
197  delete eleBkg;
198  }
199  if (ig.get(label_neuBkg.Data()) != nullptr) {
200  TH1F *neuBkg = (TH1F *)ig.get(label_neuBkg.Data())->getTH1F()->Clone();
201  neuBkg->Sumw2();
202  ProcessBookingBKG(ibooker, ig, "me0_strip_dg_neuBkg_rad", neuBkg, numEvts);
203 
204  delete neuBkg;
205  }
206  if (ig.get(label_totBkg.Data()) != nullptr) {
207  TH1F *totBkg = (TH1F *)ig.get(label_totBkg.Data())->getTH1F()->Clone();
208  totBkg->Sumw2();
209  ProcessBookingBKG(ibooker, ig, "me0_strip_dg_totBkg_rad", totBkg, numEvts);
210 
211  delete totBkg;
212  }
213 
214  delete numEvts;
215  }
216 }
static const std::array< std::string, 4 > l_suffix
Definition: GEMDetLabel.h:4
void ProcessBookingBKG(DQMStore::IBooker &ibooker, DQMStore::IGetter &ig, std::string nameHist, TH1F *hist, TH1F *hist2)
void ProcessBooking(DQMStore::IBooker &, DQMStore::IGetter &, std::string nameHist, TH1F *num, TH1F *den)
void MuonME0DigisHarvestor::ProcessBooking ( DQMStore::IBooker ibooker,
DQMStore::IGetter ig,
std::string  nameHist,
TH1F *  num,
TH1F *  den 
)

Definition at line 72 of file MuonME0DigisHarvestor.cc.

References dqm::dqmstoreimpl::DQMStore::IBooker::bookProfile(), ComputeEff(), PostProcessor_cff::profile, and overlapproblemtsosanalyzer_cfi::title.

Referenced by dqmEndJob().

73  {
74  if (num != nullptr && den != nullptr) {
75  TProfile *profile = ComputeEff(num, den, nameHist);
76 
77  TString x_axis_title = TString(num->GetXaxis()->GetTitle());
78  TString title = TString::Format("Digi Efficiency;%s;Eff.", x_axis_title.Data());
79 
80  profile->SetTitle(title.Data());
81  ibooker.bookProfile(profile->GetName(), profile);
82 
83  delete profile;
84 
85  } else {
86  edm::LogWarning("MuonME0DigisHarvestor") << "Can not find histograms";
87  if (num == nullptr)
88  edm::LogWarning("MuonME0DigisHarvestor") << "num not found";
89  if (den == nullptr)
90  edm::LogWarning("MuonME0DigisHarvestor") << "den not found";
91  }
92  return;
93 }
TProfile * ComputeEff(TH1F *num, TH1F *denum, std::string nameHist)
void MuonME0DigisHarvestor::ProcessBookingBKG ( DQMStore::IBooker ibooker,
DQMStore::IGetter ig,
std::string  nameHist,
TH1F *  hist,
TH1F *  hist2 
)

Definition at line 114 of file MuonME0DigisHarvestor.cc.

References dqm::dqmstoreimpl::DQMStore::IBooker::book1D(), ComputeBKG(), RPCpg::rate(), and overlapproblemtsosanalyzer_cfi::title.

Referenced by dqmEndJob().

115  {
116  if (hist1 != nullptr && hist2 != nullptr) {
117  TH1F *rate = ComputeBKG(hist1, hist2, nameHist);
118 
119  TString x_axis_title = TString(hist1->GetXaxis()->GetTitle());
120  TString origTitle = TString(hist1->GetTitle());
121  TString title = TString::Format((origTitle + ";%s;Rate [Hz/cm^{2}]").Data(), x_axis_title.Data());
122 
123  rate->SetTitle(title.Data());
124  ibooker.book1D(rate->GetName(), rate);
125 
126  } else {
127  edm::LogWarning("MuonME0DigisHarvestor") << "Can not find histograms";
128  if (hist1 == nullptr)
129  edm::LogWarning("MuonME0DigisHarvestor") << "num not found";
130  if (hist2 == nullptr)
131  edm::LogWarning("MuonME0DigisHarvestor") << "den not found";
132  }
133  return;
134 }
TH1F * ComputeBKG(TH1F *hist1, TH1F *hist2, std::string nameHist)
double rate(double x)
Definition: Constants.cc:3

Member Data Documentation

std::string MuonME0DigisHarvestor::dbe_path_
private

Definition at line 33 of file MuonME0DigisHarvestor.h.

Referenced by dqmEndJob(), and MuonME0DigisHarvestor().