CMS 3D CMS Logo

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

#include <MuonME0SegHarvestor.h>

Inheritance diagram for MuonME0SegHarvestor:
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

TProfile * ComputeEff (TH1F *num, TH1F *denum, std::string nameHist)
 
void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
 MuonME0SegHarvestor (const edm::ParameterSet &)
 constructor More...
 
void ProcessBooking (DQMStore::IBooker &, DQMStore::IGetter &, std::string nameHist, TH1F *num, TH1F *den)
 
 ~MuonME0SegHarvestor () 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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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
 
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)
 
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
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::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)
 
- Protected Attributes inherited from DQMEDHarvester
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 18 of file MuonME0SegHarvestor.h.

Constructor & Destructor Documentation

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

constructor

Geometry.

Log messages

Definition at line 34 of file MuonME0SegHarvestor.cc.

References dbe_path_, and AlCaHLTBitMon_QueryRunRegistry::string.

35 {
36  dbe_path_ = std::string("MuonME0RecHitsV/ME0SegmentsTask/");
37 }
MuonME0SegHarvestor::~MuonME0SegHarvestor ( )
override

destructor

Definition at line 40 of file MuonME0SegHarvestor.cc.

41 {
42 }

Member Function Documentation

TProfile * MuonME0SegHarvestor::ComputeEff ( TH1F *  num,
TH1F *  denum,
std::string  nameHist 
)

Definition at line 45 of file MuonME0SegHarvestor.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 = "Segment 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("MuonME0SegHarvestor")<<"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 MuonME0SegHarvestor::dqmEndJob ( DQMStore::IBooker ibooker,
DQMStore::IGetter ig 
)
overridevirtual

Implements DQMEDHarvester.

Definition at line 106 of file MuonME0SegHarvestor.cc.

References dbe_path_, DEFINE_FWK_MODULE, DQMStore::IGetter::get(), ProcessBooking(), and DQMStore::IGetter::setCurrentFolder().

107 {
109 
110  TString eta_label_den = TString(dbe_path_)+"me0_simsegment_eta";
111  TString eta_label_num = TString(dbe_path_)+"me0_matchedsimsegment_eta";
112  TString pt_label_den = TString(dbe_path_)+"me0_simsegment_pt";
113  TString pt_label_num = TString(dbe_path_)+"me0_matchedsimsegment_pt";
114  TString phi_label_den = TString(dbe_path_)+"me0_simsegment_phi";
115  TString phi_label_num = TString(dbe_path_)+"me0_matchedsimsegment_phi";
116 
117  if( ig.get(eta_label_num.Data()) !=nullptr && ig.get(eta_label_den.Data()) !=nullptr ) {
118 
119  TH1F* num_vs_eta = (TH1F*)ig.get(eta_label_num.Data())->getTH1F()->Clone();
120  num_vs_eta->Sumw2();
121  TH1F *den_vs_eta = (TH1F*)ig.get(eta_label_den.Data())->getTH1F()->Clone();
122  den_vs_eta->Sumw2();
123 
124  ProcessBooking( ibooker, ig, "me0segment_eff_vs_eta", num_vs_eta, den_vs_eta );
125 
126  delete num_vs_eta;
127  delete den_vs_eta;
128 
129  }
130  else edm::LogWarning("MuonME0SegHarvestor")<<"Can not find histograms: "<<eta_label_num<<" or "<<eta_label_den;
131 
132  if( ig.get(pt_label_num.Data()) !=nullptr && ig.get(pt_label_den.Data()) !=nullptr ) {
133 
134  TH1F* num_vs_pt = (TH1F*)ig.get(pt_label_num.Data())->getTH1F()->Clone();
135  num_vs_pt->Sumw2();
136  TH1F *den_vs_pt = (TH1F*)ig.get(pt_label_den.Data())->getTH1F()->Clone();
137  den_vs_pt->Sumw2();
138 
139  ProcessBooking( ibooker, ig, "me0segment_eff_vs_pt", num_vs_pt, den_vs_pt );
140 
141  delete num_vs_pt;
142  delete den_vs_pt;
143 
144  }
145  else edm::LogWarning("MuonME0SegHarvestor")<<"Can not find histograms: "<<pt_label_num<<" or "<<pt_label_den;
146 
147  if( ig.get(phi_label_num.Data()) !=nullptr && ig.get(phi_label_den.Data()) !=nullptr ) {
148 
149  TH1F* num_vs_phi = (TH1F*)ig.get(phi_label_num.Data())->getTH1F()->Clone();
150  num_vs_phi->Sumw2();
151  TH1F *den_vs_phi = (TH1F*)ig.get(phi_label_den.Data())->getTH1F()->Clone();
152  den_vs_phi->Sumw2();
153 
154  ProcessBooking( ibooker, ig, "me0segment_eff_vs_phi", num_vs_phi, den_vs_phi );
155 
156  delete num_vs_phi;
157  delete den_vs_phi;
158 
159  }
160  else edm::LogWarning("MuonME0SegHarvestor")<<"Can not find histograms: "<<phi_label_num<<" or "<<phi_label_den;
161 
162 
163 }
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:302
void ProcessBooking(DQMStore::IBooker &, DQMStore::IGetter &, std::string nameHist, TH1F *num, TH1F *den)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:344
void MuonME0SegHarvestor::ProcessBooking ( DQMStore::IBooker ibooker,
DQMStore::IGetter ig,
std::string  nameHist,
TH1F *  num,
TH1F *  den 
)

Definition at line 77 of file MuonME0SegHarvestor.cc.

References DQMStore::IBooker::bookProfile(), ComputeEff(), PostProcessor_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("Segment 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("MuonME0SegHarvestor")<<"Can not find histograms";
96  if ( num == nullptr) edm::LogWarning("MuonME0SegHarvestor")<<"num not found";
97  if ( den == nullptr) edm::LogWarning("MuonME0SegHarvestor")<<"den not found";
98 
99  }
100  return;
101 
102 }
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:160
TProfile * ComputeEff(TH1F *num, TH1F *denum, std::string nameHist)

Member Data Documentation

std::string MuonME0SegHarvestor::dbe_path_
private

Definition at line 31 of file MuonME0SegHarvestor.h.

Referenced by dqmEndJob(), and MuonME0SegHarvestor().