CMS 3D CMS Logo

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

#include <MuonGEMRecHitsHarvestor.h>

Inheritance diagram for MuonGEMRecHitsHarvestor:
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
 
 MuonGEMRecHitsHarvestor (const edm::ParameterSet &)
 constructor More...
 
void ProcessBooking (DQMStore::IBooker &, DQMStore::IGetter &, const char *label, TString suffix, TH1F *track_hist, TH1F *sh_hist)
 
 ~MuonGEMRecHitsHarvestor () 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 18 of file MuonGEMRecHitsHarvestor.h.

Constructor & Destructor Documentation

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

constructor

Data Format.

Geometry Log messages

Definition at line 48 of file MuonGEMRecHitsHarvestor.cc.

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

48  {
49  dbe_path_ = std::string("MuonGEMRecHitsV/GEMRecHitsTask/");
50  outputFile_ = ps.getUntrackedParameter<std::string>("outputFile", "myfile.root");
51 }
T getUntrackedParameter(std::string const &, T const &) const
MuonGEMRecHitsHarvestor::~MuonGEMRecHitsHarvestor ( )
override

destructor

Definition at line 53 of file MuonGEMRecHitsHarvestor.cc.

53 {}

Member Function Documentation

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

Definition at line 54 of file MuonGEMRecHitsHarvestor.cc.

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

Referenced by ProcessBooking().

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

Implements DQMEDHarvester.

Definition at line 121 of file MuonGEMRecHitsHarvestor.cc.

References GEMDetLabel::c_suffix, gather_cfg::cout, dbe_path_, DEFINE_FWK_MODULE, dqm::dqmstoreimpl::DQMStore::IGetter::get(), mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, GEMDetLabel::l_suffix, ProcessBooking(), GEMDetLabel::s_suffix, dqm::dqmstoreimpl::DQMStore::IGetter::setCurrentFolder(), and createPayload::suffix.

121  {
122  ig.setCurrentFolder(dbe_path_);
123 
124  using namespace GEMDetLabel;
125 
126  TH1F *gem_trk_eta[s_suffix.size()];
127  TH1F *gem_trk_phi[s_suffix.size()][c_suffix.size()];
128 
129  TH1F *sh_eta[s_suffix.size()][l_suffix.size()];
130  TH1F *sh_phi[s_suffix.size()][l_suffix.size()][c_suffix.size()];
131 
132  for (unsigned int i = 0; i < s_suffix.size(); i++) {
133  TString eta_label = TString(dbe_path_) + "track_eta" + s_suffix[i];
134  TString phi_label;
135  if (ig.get(eta_label.Data()) != nullptr) {
136  gem_trk_eta[i] = (TH1F *)ig.get(eta_label.Data())->getTH1F()->Clone();
137  gem_trk_eta[i]->Sumw2();
138  } else
139  std::cout << "Can not found track_eta" << std::endl;
140  for (unsigned int k = 0; k < c_suffix.size(); k++) {
141  phi_label = TString(dbe_path_.c_str()) + "track_phi" + s_suffix[i] + c_suffix[k];
142  if (ig.get(phi_label.Data()) != nullptr) {
143  gem_trk_phi[i][k] = (TH1F *)ig.get(phi_label.Data())->getTH1F()->Clone();
144  gem_trk_phi[i][k]->Sumw2();
145  } else
146  std::cout << "Can not found track_phi" << std::endl;
147  }
148 
149  if (ig.get(eta_label.Data()) != nullptr && ig.get(phi_label.Data()) != nullptr) {
150  for (unsigned int j = 0; j < l_suffix.size(); j++) {
151  TString suffix = TString(s_suffix[i]) + TString(l_suffix[j]);
152  TString eta_label = TString(dbe_path_) + "rh_sh_eta" + suffix;
153  if (ig.get(eta_label.Data()) != nullptr) {
154  sh_eta[i][j] = (TH1F *)ig.get(eta_label.Data())->getTH1F()->Clone();
155  sh_eta[i][j]->Sumw2();
156  } else
157  std::cout << "Can not found eta histogram : " << eta_label << std::endl;
158  ProcessBooking(ibooker, ig, "rh_eta", suffix, gem_trk_eta[i], sh_eta[i][j]);
159  for (unsigned int k = 0; k < c_suffix.size(); k++) {
160  suffix = TString(s_suffix[i]) + TString(l_suffix[j]) + TString(c_suffix[k]);
161  TString phi_label = TString(dbe_path_) + "rh_sh_phi" + suffix;
162  if (ig.get(phi_label.Data()) != nullptr) {
163  sh_phi[i][j][k] = (TH1F *)ig.get(phi_label.Data())->getTH1F()->Clone();
164  sh_phi[i][j][k]->Sumw2();
165  } else {
166  std::cout << "Can not found phi plots : " << phi_label << std::endl;
167  continue;
168  }
169  ProcessBooking(ibooker, ig, "rh_phi", suffix, gem_trk_phi[i][k], sh_phi[i][j][k]);
170  }
171  }
172  } else
173  std::cout << "Can not find eta or phi of all track" << std::endl;
174  }
175 }
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 &, const char *label, TString suffix, TH1F *track_hist, TH1F *sh_hist)
static const std::array< std::string, 3 > c_suffix
Definition: GEMDetLabel.h:6
void MuonGEMRecHitsHarvestor::ProcessBooking ( DQMStore::IBooker ibooker,
DQMStore::IGetter ig,
const char *  label,
TString  suffix,
TH1F *  track_hist,
TH1F *  sh_hist 
)

Definition at line 87 of file MuonGEMRecHitsHarvestor.cc.

References dqm::dqmstoreimpl::DQMStore::IBooker::bookProfile(), ComputeEff(), gather_cfg::cout, dbe_path_, dqm::dqmstoreimpl::DQMStore::IGetter::get(), compare::hist, PostProcessor_cff::profile, AlCaHLTBitMon_QueryRunRegistry::string, createPayload::suffix, and overlapproblemtsosanalyzer_cfi::title.

Referenced by dqmEndJob().

92  {
93  TString dbe_label = TString(dbe_path_) + label + suffix;
94  if (ig.get(dbe_label.Data()) != nullptr && sh_hist != nullptr && track_hist != nullptr) {
95  TH1F *hist = (TH1F *)ig.get(dbe_label.Data())->getTH1F()->Clone();
96  TProfile *profile = ComputeEff(hist, track_hist);
97  TProfile *profile_sh = ComputeEff(hist, sh_hist);
98  profile_sh->SetName((profile->GetName() + std::string("_sh")).c_str());
99  TString x_axis_title = TString(hist->GetXaxis()->GetTitle());
100  TString title = TString::Format(
101  "Eff. for a SimTrack to have an associated GEM RecHits in %s;%s;Eff.", suffix.Data(), x_axis_title.Data());
102  TString title2 = TString::Format(
103  "Eff. for a SimTrack to have an associated GEM RecHits "
104  "in %s with a matched SimHit;%s;Eff.",
105  suffix.Data(),
106  x_axis_title.Data());
107  profile->SetTitle(title.Data());
108  profile_sh->SetTitle(title2.Data());
109  ibooker.bookProfile(profile->GetName(), profile);
110  ibooker.bookProfile(profile_sh->GetName(), profile_sh);
111  } else {
112  std::cout << "Can not found histogram of " << dbe_label << std::endl;
113  if (track_hist == nullptr)
114  std::cout << "track not found" << std::endl;
115  if (sh_hist == nullptr)
116  std::cout << "sh_hist not found" << std::endl;
117  }
118  return;
119 }
char const * label
TProfile * ComputeEff(TH1F *num, TH1F *denum)

Member Data Documentation

std::string MuonGEMRecHitsHarvestor::dbe_path_
private

Definition at line 31 of file MuonGEMRecHitsHarvestor.h.

Referenced by dqmEndJob(), MuonGEMRecHitsHarvestor(), and ProcessBooking().

std::string MuonGEMRecHitsHarvestor::outputFile_
private

Definition at line 31 of file MuonGEMRecHitsHarvestor.h.

Referenced by MuonGEMRecHitsHarvestor().