CMS 3D CMS Logo

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

#include <MuonGEMHitsHarvestor.h>

Inheritance diagram for MuonGEMHitsHarvestor:
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)
 
void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
 MuonGEMHitsHarvestor (const edm::ParameterSet &)
 constructor More...
 
void ProcessBooking (DQMStore::IBooker &, DQMStore::IGetter &, std::string label_suffix, TH1F *track_hist, TH1F *sh_hist=0)
 
 ~MuonGEMHitsHarvestor () 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_
 
std::string outputFile_
 

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 19 of file MuonGEMHitsHarvestor.h.

Constructor & Destructor Documentation

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

constructor

Definition at line 50 of file MuonGEMHitsHarvestor.cc.

References edm::ParameterSet::getUntrackedParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

50  {
51  dbe_path_ = std::string("MuonGEMHitsV/GEMHitsTask/");
52  outputFile_ = ps.getUntrackedParameter<std::string>("outputFile", "myfile.root");
53 }
T getUntrackedParameter(std::string const &, T const &) const
MuonGEMHitsHarvestor::~MuonGEMHitsHarvestor ( )
override

destructor

Definition at line 55 of file MuonGEMHitsHarvestor.cc.

55 {}

Member Function Documentation

TProfile * MuonGEMHitsHarvestor::ComputeEff ( TH1F *  num,
TH1F *  denum 
)

Definition at line 56 of file MuonGEMHitsHarvestor.cc.

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

56  {
57  if (num == nullptr || denum == nullptr) {
58  std::cout << "num or denum are missing" << std::endl;
59  return nullptr;
60  }
61  if (num->GetNbinsX() != denum->GetNbinsX()) {
62  std::cout << "Wrong Xbin. Please, check histogram's name" << std::endl;
63  return nullptr;
64  }
65  std::string name = "eff_" + std::string(num->GetName());
66  std::string title = "Eff. " + std::string(num->GetTitle());
67  TProfile* efficHist = new TProfile(
68  name.c_str(), title.c_str(), num->GetXaxis()->GetNbins(), num->GetXaxis()->GetXmin(), num->GetXaxis()->GetXmax());
69  for (int i = 1; i <= num->GetNbinsX(); i++) {
70  const double nNum = num->GetBinContent(i);
71  const double nDenum = denum->GetBinContent(i);
72  if (nDenum == 0 || nNum > nDenum)
73  continue;
74  if (nNum == 0)
75  continue;
76  const double effVal = nNum / nDenum;
77  const double errLo = TEfficiency::ClopperPearson((int)nDenum, (int)nNum, 0.683, false);
78  const double errUp = TEfficiency::ClopperPearson((int)nDenum, (int)nNum, 0.683, true);
79  const double errVal = (effVal - errLo > errUp - effVal) ? effVal - errLo : errUp - effVal;
80  efficHist->SetBinContent(i, effVal);
81  efficHist->SetBinEntries(i, 1);
82  efficHist->SetBinError(i, sqrt(effVal * effVal + errVal * errVal));
83  }
84  return efficHist;
85 }
T sqrt(T t)
Definition: SSEVec.h:19
void MuonGEMHitsHarvestor::dqmEndJob ( DQMStore::IBooker ibooker,
DQMStore::IGetter ig 
)
overridevirtual

Implements DQMEDHarvester.

Definition at line 112 of file MuonGEMHitsHarvestor.cc.

References GEMDetLabel::c_suffix, DEFINE_FWK_MODULE, dqm::dqmstoreimpl::DQMStore::IGetter::get(), dqm::legacy::MonitorElement::getTH1F(), mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, GEMDetLabel::l_suffix, GEMDetLabel::s_suffix, dqm::dqmstoreimpl::DQMStore::IGetter::setCurrentFolder(), and createPayload::suffix.

112  {
113  ig.setCurrentFolder(dbe_path_);
114  TH1F* track_eta[3];
115  TH1F* track_phi[3][3];
116 
117  for (unsigned int i = 0; i < 3; i++) {
118  track_eta[i] = nullptr;
119  for (unsigned int j = 0; j < 3; j++) {
120  track_phi[i][j] = nullptr;
121  }
122  }
123 
124  for (unsigned int i = 0; i < s_suffix.size(); i++) {
125  string suffix = s_suffix[i];
126  string track_eta_name = dbe_path_ + "track_eta" + suffix;
127  if (ig.get(track_eta_name) != nullptr)
128  track_eta[i] = (TH1F*)ig.get(track_eta_name)->getTH1F()->Clone();
129  for (unsigned int j = 0; j < l_suffix.size(); j++) {
130  suffix = s_suffix[i] + l_suffix[j];
131  ProcessBooking(ibooker, ig, "sh_eta" + suffix, track_eta[i]);
132  }
133  }
134  for (unsigned int i = 0; i < s_suffix.size(); i++) {
135  for (unsigned int j = 0; j < c_suffix.size(); j++) {
136  string suffix = s_suffix[i] + c_suffix[j];
137  string track_phi_name = dbe_path_ + "track_phi" + suffix;
138  if (ig.get(track_phi_name) != nullptr)
139  track_phi[i][j] = (TH1F*)ig.get(track_phi_name)->getTH1F()->Clone();
140  for (unsigned int k = 0; k < l_suffix.size(); k++) {
141  suffix = s_suffix[i] + l_suffix[k] + c_suffix[j];
142  ProcessBooking(ibooker, ig, "sh_phi" + suffix, track_phi[i][j]);
143  }
144  }
145  }
146 }
static const std::array< std::string, 4 > l_suffix
Definition: GEMDetLabel.h:4
static const std::array< std::string, 2 > s_suffix
Definition: GEMDetLabel.h:5
void ProcessBooking(DQMStore::IBooker &, DQMStore::IGetter &, std::string label_suffix, TH1F *track_hist, TH1F *sh_hist=0)
static const std::array< std::string, 3 > c_suffix
Definition: GEMDetLabel.h:6
void MuonGEMHitsHarvestor::ProcessBooking ( DQMStore::IBooker ibooker,
DQMStore::IGetter ig,
std::string  label_suffix,
TH1F *  track_hist,
TH1F *  sh_hist = 0 
)

Definition at line 86 of file MuonGEMHitsHarvestor.cc.

References dqm::dqmstoreimpl::DQMStore::IBooker::bookProfile(), dqm::dqmstoreimpl::DQMStore::IGetter::get(), compare::hist, PostProcessor_cff::profile, AlCaHLTBitMon_QueryRunRegistry::string, and overlapproblemtsosanalyzer_cfi::title.

87  {
88  TString dbe_label = TString(dbe_path_) + label_suffix;
89  //std::cout<<dbe_label<<" "<<track_hist->GetName()<<std::endl;
90  if (ig.get(dbe_label.Data()) != nullptr && track_hist != nullptr) {
91  TH1F* hist = (TH1F*)ig.get(dbe_label.Data())->getTH1F()->Clone();
92  TProfile* profile = ComputeEff(hist, track_hist);
93  TString x_axis_title = TString(hist->GetXaxis()->GetTitle());
94  TString title = TString::Format(
95  "Eff. for a SimTrack to have an associated GEM Strip in %s;%s;Eff.", label_suffix.c_str(), x_axis_title.Data());
96  profile->SetTitle(title.Data());
97  ibooker.bookProfile(profile->GetName(), profile);
98  if (sh_hist != nullptr) {
99  TProfile* profile_sh = ComputeEff(hist, sh_hist);
100  profile_sh->SetName((profile->GetName() + std::string("_sh")).c_str());
101  TString title2 =
102  TString::Format("Eff. for a SimTrack to have an associated GEM Strip in %s with a matched SimHit;%s;Eff.",
103  label_suffix.c_str(),
104  x_axis_title.Data());
105  profile_sh->SetTitle(title2.Data());
106  ibooker.bookProfile(profile_sh->GetName(), profile_sh);
107  }
108  }
109  return;
110 }
TProfile * ComputeEff(TH1F *num, TH1F *denum)

Member Data Documentation

std::string MuonGEMHitsHarvestor::dbe_path_
private

Definition at line 32 of file MuonGEMHitsHarvestor.h.

std::string MuonGEMHitsHarvestor::outputFile_
private

Definition at line 32 of file MuonGEMHitsHarvestor.h.