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::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources, edm::EndLuminosityBlockProducer > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

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

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 21 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.

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

destructor

Definition at line 57 of file MuonGEMHitsHarvestor.cc.

58 {
59 }

Member Function Documentation

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

Definition at line 60 of file MuonGEMHitsHarvestor.cc.

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

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

Implements DQMEDHarvester.

Definition at line 105 of file MuonGEMHitsHarvestor.cc.

References GEMDetLabel::c_suffix, DEFINE_FWK_MODULE, DQMStore::IGetter::get(), mps_fire::i, gen::k, GEMDetLabel::l_suffix, GEMDetLabel::s_suffix, DQMStore::IGetter::setCurrentFolder(), and createPayload::suffix.

106 {
107  ig.setCurrentFolder(dbe_path_.c_str());
108  TH1F* track_eta[3];
109  TH1F* track_phi[3][3];
110 
111  for (unsigned int i = 0; i < 3; i++) {
112  track_eta[i]=nullptr;
113  for (unsigned int j=0; j < 3; j++) {
114  track_phi[i][j]=nullptr;
115  }
116  }
117 
118  for (unsigned int i = 0; i < s_suffix.size(); i++) {
119  string suffix = s_suffix[i];
120  string track_eta_name = dbe_path_+"track_eta"+suffix;
121  if ( ig.get(track_eta_name.c_str()) != nullptr) track_eta[i] = (TH1F*)ig.get(track_eta_name.c_str())->getTH1F()->Clone();
122  for (unsigned int j = 0; j < l_suffix.size(); j++) {
123  suffix = s_suffix[i]+l_suffix[j];
124  ProcessBooking( ibooker, ig, "sh_eta"+suffix,track_eta[i]);
125  }
126  }
127  for (unsigned int i = 0; i < s_suffix.size(); i++) {
128  for (unsigned int j = 0 ; j < c_suffix.size(); j++) {
129  string suffix = s_suffix[i]+c_suffix[j];
130  string track_phi_name = dbe_path_+"track_phi"+suffix;
131  if ( ig.get(track_phi_name.c_str()) != nullptr) track_phi[i][j] = (TH1F*)ig.get(track_phi_name.c_str())->getTH1F()->Clone();
132  for (unsigned int k = 0; k < l_suffix.size(); k++) {
133  suffix = s_suffix[i]+l_suffix[k]+c_suffix[j];
134  ProcessBooking( ibooker, ig, "sh_phi"+suffix,track_phi[i][j]);
135  }
136  }
137  }
138 }
static const std::array< std::string, 4 > l_suffix
Definition: GEMDetLabel.h:4
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:305
static const std::array< std::string, 2 > s_suffix
Definition: GEMDetLabel.h:5
int k[5][pyjets_maxn]
void ProcessBooking(DQMStore::IBooker &, DQMStore::IGetter &, std::string label_suffix, TH1F *track_hist, TH1F *sh_hist=0)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:347
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 82 of file MuonGEMHitsHarvestor.cc.

References DQMStore::IBooker::bookProfile(), DQMStore::IGetter::get(), create_public_lumi_plots::hist, NewPostProcessor_cff::profile, AlCaHLTBitMon_QueryRunRegistry::string, and fftjetcommon_cfi::title.

83 {
84  TString dbe_label = TString(dbe_path_)+label_suffix;
85  //std::cout<<dbe_label<<" "<<track_hist->GetName()<<std::endl;
86  if( ig.get(dbe_label.Data()) != nullptr && track_hist !=nullptr ) {
87  TH1F* hist = (TH1F*)ig.get( dbe_label.Data() )->getTH1F()->Clone();
88  TProfile* profile = ComputeEff( hist, track_hist);
89  TString x_axis_title = TString(hist->GetXaxis()->GetTitle());
90  TString title = TString::Format("Eff. for a SimTrack to have an associated GEM Strip in %s;%s;Eff.",label_suffix.c_str(),x_axis_title.Data());
91  profile->SetTitle( title.Data());
92  ibooker.bookProfile( profile->GetName(),profile);
93  if ( sh_hist!=nullptr) {
94  TProfile* profile_sh = ComputeEff( hist, sh_hist );
95  profile_sh->SetName( (profile->GetName()+std::string("_sh")).c_str());
96  TString title2 = TString::Format("Eff. for a SimTrack to have an associated GEM Strip in %s with a matched SimHit;%s;Eff.",label_suffix.c_str(),x_axis_title.Data() );
97  profile_sh->SetTitle( title2.Data() );
98  ibooker.bookProfile( profile_sh->GetName(),profile_sh);
99  }
100  }
101  return;
102 }
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:305
TProfile * ComputeEff(TH1F *num, TH1F *denum)

Member Data Documentation

std::string MuonGEMHitsHarvestor::dbe_path_
private

Definition at line 35 of file MuonGEMHitsHarvestor.h.

std::string MuonGEMHitsHarvestor::outputFile_
private

Definition at line 35 of file MuonGEMHitsHarvestor.h.