CMS 3D CMS Logo

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

#include <MuonME0SegHarvestor.h>

Inheritance diagram for MuonME0SegHarvestor:
DQMEDHarvester edm::one::EDProducer< T > 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 beginJob () override
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &) override
 
virtual void dqmAnalyze (DQMStore::IBooker &, DQMStore::IGetter &, edm::Event const &, edm::EventSetup const &)
 
 DQMEDHarvester (edm::ParameterSet const &iConfig)
 
 DQMEDHarvester ()
 
virtual void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (DQMStore::IBooker &, DQMStore::IGetter &, edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &es) final
 
void endProcessBlockProduce (edm::ProcessBlock &) final
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &es) final
 
 ~DQMEDHarvester () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< T >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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 selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 
- Protected Attributes inherited from DQMEDHarvester
DQMStoredqmstore_
 
edm::GetterOfProducts< DQMTokenjobmegetter_
 
edm::EDPutTokenT< DQMTokenjobToken_
 
edm::GetterOfProducts< DQMTokenlumimegetter_
 
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::GetterOfProducts< DQMTokenrunmegetter_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 17 of file MuonME0SegHarvestor.h.

Constructor & Destructor Documentation

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

constructor

Geometry.

Log messages

Definition at line 31 of file MuonME0SegHarvestor.cc.

References dbe_path_, and AlCaHLTBitMon_QueryRunRegistry::string.

31  {
32  dbe_path_ = std::string("MuonME0RecHitsV/ME0SegmentsTask/");
33 }
MuonME0SegHarvestor::~MuonME0SegHarvestor ( )
override

destructor

Definition at line 35 of file MuonME0SegHarvestor.cc.

35 {}

Member Function Documentation

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

Definition at line 37 of file MuonME0SegHarvestor.cc.

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

Referenced by ProcessBooking().

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

Implements DQMEDHarvester.

Definition at line 94 of file MuonME0SegHarvestor.cc.

References dbe_path_, dqm::implementation::IGetter::get(), ProcessBooking(), and dqm::implementation::NavigatorBase::setCurrentFolder().

94  {
96 
97  TString eta_label_den = TString(dbe_path_) + "me0_simsegment_eta";
98  TString eta_label_num = TString(dbe_path_) + "me0_matchedsimsegment_eta";
99  TString pt_label_den = TString(dbe_path_) + "me0_simsegment_pt";
100  TString pt_label_num = TString(dbe_path_) + "me0_matchedsimsegment_pt";
101  TString phi_label_den = TString(dbe_path_) + "me0_simsegment_phi";
102  TString phi_label_num = TString(dbe_path_) + "me0_matchedsimsegment_phi";
103 
104  if (ig.get(eta_label_num.Data()) != nullptr && ig.get(eta_label_den.Data()) != nullptr) {
105  TH1F *num_vs_eta = (TH1F *)ig.get(eta_label_num.Data())->getTH1F()->Clone();
106  num_vs_eta->Sumw2();
107  TH1F *den_vs_eta = (TH1F *)ig.get(eta_label_den.Data())->getTH1F()->Clone();
108  den_vs_eta->Sumw2();
109 
110  ProcessBooking(ibooker, ig, "me0segment_eff_vs_eta", num_vs_eta, den_vs_eta);
111 
112  delete num_vs_eta;
113  delete den_vs_eta;
114 
115  } else
116  edm::LogWarning("MuonME0SegHarvestor") << "Can not find histograms: " << eta_label_num << " or " << eta_label_den;
117 
118  if (ig.get(pt_label_num.Data()) != nullptr && ig.get(pt_label_den.Data()) != nullptr) {
119  TH1F *num_vs_pt = (TH1F *)ig.get(pt_label_num.Data())->getTH1F()->Clone();
120  num_vs_pt->Sumw2();
121  TH1F *den_vs_pt = (TH1F *)ig.get(pt_label_den.Data())->getTH1F()->Clone();
122  den_vs_pt->Sumw2();
123 
124  ProcessBooking(ibooker, ig, "me0segment_eff_vs_pt", num_vs_pt, den_vs_pt);
125 
126  delete num_vs_pt;
127  delete den_vs_pt;
128 
129  } else
130  edm::LogWarning("MuonME0SegHarvestor") << "Can not find histograms: " << pt_label_num << " or " << pt_label_den;
131 
132  if (ig.get(phi_label_num.Data()) != nullptr && ig.get(phi_label_den.Data()) != nullptr) {
133  TH1F *num_vs_phi = (TH1F *)ig.get(phi_label_num.Data())->getTH1F()->Clone();
134  num_vs_phi->Sumw2();
135  TH1F *den_vs_phi = (TH1F *)ig.get(phi_label_den.Data())->getTH1F()->Clone();
136  den_vs_phi->Sumw2();
137 
138  ProcessBooking(ibooker, ig, "me0segment_eff_vs_phi", num_vs_phi, den_vs_phi);
139 
140  delete num_vs_phi;
141  delete den_vs_phi;
142 
143  } else
144  edm::LogWarning("MuonME0SegHarvestor") << "Can not find histograms: " << phi_label_num << " or " << phi_label_den;
145 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
void ProcessBooking(DQMStore::IBooker &, DQMStore::IGetter &, std::string nameHist, TH1F *num, TH1F *den)
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:673
Log< level::Warning, false > LogWarning
void MuonME0SegHarvestor::ProcessBooking ( DQMStore::IBooker ibooker,
DQMStore::IGetter ig,
std::string  nameHist,
TH1F *  num,
TH1F *  den 
)

Definition at line 71 of file MuonME0SegHarvestor.cc.

References dqm::implementation::IBooker::bookProfile(), ComputeEff(), and runGCPTkAlMap::title.

Referenced by dqmEndJob().

72  {
73  if (num != nullptr && den != nullptr) {
74  TProfile *profile = ComputeEff(num, den, nameHist);
75 
76  TString x_axis_title = TString(num->GetXaxis()->GetTitle());
77  TString title = TString::Format("Segment Efficiency;%s;Eff.", x_axis_title.Data());
78 
79  profile->SetTitle(title.Data());
80  ibooker.bookProfile(profile->GetName(), profile);
81 
82  delete profile;
83 
84  } else {
85  edm::LogWarning("MuonME0SegHarvestor") << "Can not find histograms";
86  if (num == nullptr)
87  edm::LogWarning("MuonME0SegHarvestor") << "num not found";
88  if (den == nullptr)
89  edm::LogWarning("MuonME0SegHarvestor") << "den not found";
90  }
91  return;
92 }
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:322
TProfile * ComputeEff(TH1F *num, TH1F *denum, std::string nameHist)
Log< level::Warning, false > LogWarning

Member Data Documentation

std::string MuonME0SegHarvestor::dbe_path_
private

Definition at line 29 of file MuonME0SegHarvestor.h.

Referenced by dqmEndJob(), and MuonME0SegHarvestor().