CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
MuonME0DigisHarvestor Class Reference

#include <MuonME0DigisHarvestor.h>

Inheritance diagram for MuonME0DigisHarvestor:
DQMEDHarvester edm::one::EDProducer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources, edm::EndLuminosityBlockProducer > 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)
 
virtual void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &)
 
 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 ()
 destructor More...
 
- Public Member Functions inherited from DQMEDHarvester
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 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
 
void endLuminosityBlockProduce (edm::LuminosityBlock &, edm::EventSetup const &) override final
 
virtual void endRun (edm::Run const &, edm::EventSetup const &) override
 
virtual void produce (edm::Event &, edm::EventSetup const &) override final
 
- Public Member Functions inherited from edm::one::EDProducer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources, edm::EndLuminosityBlockProducer >
 EDProducer ()=default
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- 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
 
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)
 

Private Attributes

std::string dbe_path_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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::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)
 

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 34 of file MuonME0DigisHarvestor.cc.

References dbe_path_, and AlCaHLTBitMon_QueryRunRegistry::string.

35 {
36  dbe_path_ = std::string("MuonME0DigisV/ME0DigisTask/");
37 }
MuonME0DigisHarvestor::~MuonME0DigisHarvestor ( )

destructor

Definition at line 40 of file MuonME0DigisHarvestor.cc.

41 {
42 }

Member Function Documentation

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

Definition at line 105 of file MuonME0DigisHarvestor.cc.

References stringResolutionProvider_cfi::bin, MillePedeFileConverter_cfg::e, dataset::name, nEvts, Pi, Scenarios_cff::scale, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ProcessBookingBKG().

106 {
107 
108  std::string name = "rate_"+nameHist;
109  hist1->SetName(name.c_str());
110  for (int bin = 1; bin<=hist1->GetNbinsX();++bin){
111 
112  double R_min = hist1->GetBinCenter(bin) - 0.5 * hist1->GetBinWidth(bin);
113  double R_max = hist1->GetBinCenter(bin) + 0.5 * hist1->GetBinWidth(bin);
114 
115  double Area = TMath::Pi() * ( R_max*R_max - R_min*R_min );
116  hist1->SetBinContent(bin,(hist1->GetBinContent(bin))/Area);
117  hist1->SetBinError(bin,(hist1->GetBinError(bin))/Area);
118 
119  }
120 
121  int nEvts = hist2->GetEntries();
122  float scale = 6*2*nEvts*3*25e-9; //New redigitizer saves hits only in the BX range: [-1,+1], so the number of background hits has to be divided by 3
123  hist1->Scale(1.0/scale);
124  return hist1;
125 
126 }
const double Pi
bin
set the eta bin as selection string.
const int nEvts
TProfile * MuonME0DigisHarvestor::ComputeEff ( TH1F *  num,
TH1F *  denum,
std::string  nameHist 
)

Definition at line 45 of file MuonME0DigisHarvestor.cc.

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

Referenced by ProcessBooking().

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

Implements DQMEDHarvester.

Definition at line 157 of file MuonME0DigisHarvestor.cc.

References dbe_path_, DEFINE_FWK_MODULE, DQMStore::IGetter::get(), mps_fire::i, GEMDetLabel::l_suffix, dataset::name, ProcessBooking(), ProcessBookingBKG(), DQMStore::IGetter::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

158 {
159  ig.setCurrentFolder(dbe_path_.c_str());
160 
161  const char* l_suffix[6] = {"_l1","_l2","_l3","_l4","_l5","_l6"};
162  const char* r_suffix[2] = {"-1","1"};
163 
164  TString eta_label_den_tot = TString(dbe_path_)+"me0_strip_dg_den_eta_tot";
165  TString eta_label_num_tot = TString(dbe_path_)+"me0_strip_dg_num_eta_tot";
166  if( ig.get(eta_label_num_tot.Data()) !=nullptr && ig.get(eta_label_den_tot.Data()) !=nullptr ) {
167 
168  TH1F* num_vs_eta_tot = (TH1F*)ig.get(eta_label_num_tot.Data())->getTH1F()->Clone();
169  num_vs_eta_tot->Sumw2();
170  TH1F *den_vs_eta_tot = (TH1F*)ig.get(eta_label_den_tot.Data())->getTH1F()->Clone();
171  den_vs_eta_tot->Sumw2();
172 
173  ProcessBooking( ibooker, ig, "me0_strip_dg_eta_tot", num_vs_eta_tot, den_vs_eta_tot );
174 
175  delete num_vs_eta_tot;
176  delete den_vs_eta_tot;
177 
178  }
179  else edm::LogWarning("MuonME0DigisHarvestor")<<"Can not find histograms: "<<eta_label_num_tot<<" or "<<eta_label_den_tot;
180 
181  for( int i = 0 ; i < 2 ; i++) {
182 
183  for( int j = 0; j < 6 ; j++) {
184 
185  TString eta_label_den = TString(dbe_path_)+"me0_strip_dg_den_eta"+r_suffix[i]+l_suffix[j];
186  TString eta_label_num = TString(dbe_path_)+"me0_strip_dg_num_eta"+r_suffix[i]+l_suffix[j];
187 
188  if( ig.get(eta_label_num.Data()) !=nullptr && ig.get(eta_label_den.Data()) !=nullptr) {
189 
190  TH1F* num_vs_eta = (TH1F*)ig.get(eta_label_num.Data())->getTH1F()->Clone();
191  num_vs_eta->Sumw2();
192  TH1F* den_vs_eta = (TH1F*)ig.get(eta_label_den.Data())->getTH1F()->Clone();
193  den_vs_eta->Sumw2();
194 
195  std::string r_s = r_suffix[i];
196  std::string l_s = l_suffix[j];
197  std::string name = "me0_strip_dg_eta"+r_s+l_s;
198  ProcessBooking( ibooker, ig, name, num_vs_eta, den_vs_eta );
199 
200  delete num_vs_eta;
201  delete den_vs_eta;
202 
203  }
204  else edm::LogWarning("MuonME0DigisHarvestor")<<"Can not find histograms: "<<eta_label_num<<" "<<eta_label_den;
205 
206  }
207 
208  }
209 
210  TString label_eleBkg = TString(dbe_path_)+"me0_strip_dg_bkgElePos_radius";
211  TString label_neuBkg = TString(dbe_path_)+"me0_strip_dg_bkgNeutral_radius";
212  TString label_totBkg = TString(dbe_path_)+"me0_strip_dg_bkg_radius_tot";
213  TString label_evts = TString(dbe_path_)+"num_evts";
214 
215  if( ig.get(label_evts.Data()) !=nullptr ) {
216 
217  TH1F* numEvts = (TH1F*)ig.get(label_evts.Data())->getTH1F()->Clone();
218 
219  if( ig.get(label_eleBkg.Data()) !=nullptr ) {
220 
221  TH1F* eleBkg = (TH1F*)ig.get(label_eleBkg.Data())->getTH1F()->Clone();
222  eleBkg->Sumw2();
223  ProcessBookingBKG( ibooker, ig, "me0_strip_dg_elePosBkg_rad", eleBkg, numEvts);
224 
225  delete eleBkg;
226 
227  }
228  if( ig.get(label_neuBkg.Data()) !=nullptr ) {
229 
230  TH1F* neuBkg = (TH1F*)ig.get(label_neuBkg.Data())->getTH1F()->Clone();
231  neuBkg->Sumw2();
232  ProcessBookingBKG( ibooker, ig, "me0_strip_dg_neuBkg_rad", neuBkg, numEvts);
233 
234  delete neuBkg;
235 
236  }
237  if( ig.get(label_totBkg.Data()) !=nullptr ) {
238 
239  TH1F* totBkg = (TH1F*)ig.get(label_totBkg.Data())->getTH1F()->Clone();
240  totBkg->Sumw2();
241  ProcessBookingBKG( ibooker, ig, "me0_strip_dg_totBkg_rad", totBkg, numEvts);
242 
243  delete totBkg;
244 
245  }
246 
247  delete numEvts;
248 
249  }
250 
251 }
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)
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:305
void ProcessBooking(DQMStore::IBooker &, DQMStore::IGetter &, std::string nameHist, TH1F *num, TH1F *den)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:347
void MuonME0DigisHarvestor::ProcessBooking ( DQMStore::IBooker ibooker,
DQMStore::IGetter ig,
std::string  nameHist,
TH1F *  num,
TH1F *  den 
)

Definition at line 77 of file MuonME0DigisHarvestor.cc.

References DQMStore::IBooker::bookProfile(), ComputeEff(), NewPostProcessor_cff::profile, and fftjetcommon_cfi::title.

Referenced by dqmEndJob().

78 {
79 
80  if( num !=nullptr && den !=nullptr ) {
81 
82  TProfile* profile = ComputeEff(num, den, nameHist);
83 
84  TString x_axis_title = TString(num->GetXaxis()->GetTitle());
85  TString title = TString::Format("Digi Efficiency;%s;Eff.",x_axis_title.Data());
86 
87  profile->SetTitle( title.Data());
88  ibooker.bookProfile( profile->GetName(),profile);
89 
90  delete profile;
91 
92  }
93  else {
94 
95  edm::LogWarning("MuonME0DigisHarvestor")<<"Can not find histograms";
96  if ( num == nullptr) edm::LogWarning("MuonME0DigisHarvestor")<<"num not found";
97  if ( den == nullptr) edm::LogWarning("MuonME0DigisHarvestor")<<"den not found";
98 
99  }
100  return;
101 
102 }
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
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 129 of file MuonME0DigisHarvestor.cc.

References DQMStore::IBooker::book1D(), ComputeBKG(), RPCpg::rate(), and fftjetcommon_cfi::title.

Referenced by dqmEndJob().

130 {
131 
132  if( hist1 !=nullptr && hist2 !=nullptr ) {
133 
134  TH1F* rate = ComputeBKG(hist1, hist2, nameHist);
135 
136  TString x_axis_title = TString(hist1->GetXaxis()->GetTitle());
137  TString origTitle = TString(hist1->GetTitle());
138  TString title = TString::Format((origTitle+";%s;Rate [Hz/cm^{2}]").Data(),x_axis_title.Data());
139 
140  rate->SetTitle( title.Data() );
141  ibooker.book1D( rate->GetName(),rate );
142 
143  }
144  else {
145 
146  edm::LogWarning("MuonME0DigisHarvestor")<<"Can not find histograms";
147  if ( hist1 == nullptr ) edm::LogWarning("MuonME0DigisHarvestor")<<"num not found";
148  if ( hist2 == nullptr ) edm::LogWarning("MuonME0DigisHarvestor")<<"den not found";
149 
150  }
151  return;
152 
153 }
TH1F * ComputeBKG(TH1F *hist1, TH1F *hist2, std::string nameHist)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
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().