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 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
 
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 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 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 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 ( )
override

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 runGCPTkAlMap::title.

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

Implements DQMEDHarvester.

Definition at line 111 of file MuonGEMHitsHarvestor.cc.

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

112 {
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) track_eta[i] = (TH1F*)ig.get(track_eta_name)->getTH1F()->Clone();
128  for (unsigned int j = 0; j < l_suffix.size(); j++) {
129  suffix = s_suffix[i]+l_suffix[j];
130  ProcessBooking( ibooker, ig, "sh_eta"+suffix,track_eta[i]);
131  }
132  }
133  for (unsigned int i = 0; i < s_suffix.size(); i++) {
134  for (unsigned int j = 0 ; j < c_suffix.size(); j++) {
135  string suffix = s_suffix[i]+c_suffix[j];
136  string track_phi_name = dbe_path_+"track_phi"+suffix;
137  if ( ig.get(track_phi_name) != nullptr) track_phi[i][j] = (TH1F*)ig.get(track_phi_name)->getTH1F()->Clone();
138  for (unsigned int k = 0; k < l_suffix.size(); k++) {
139  suffix = s_suffix[i]+l_suffix[k]+c_suffix[j];
140  ProcessBooking( ibooker, ig, "sh_phi"+suffix,track_phi[i][j]);
141  }
142  }
143  }
144 }
static const std::array< std::string, 4 > l_suffix
Definition: GEMDetLabel.h:4
TH1F * getTH1F() const
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:361
static const std::array< std::string, 2 > s_suffix
Definition: GEMDetLabel.h:5
MonitorElement * get(std::string const &path)
Definition: DQMStore.cc:303
int k[5][pyjets_maxn]
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 88 of file MuonGEMHitsHarvestor.cc.

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

89 {
90  TString dbe_label = TString(dbe_path_)+label_suffix;
91  //std::cout<<dbe_label<<" "<<track_hist->GetName()<<std::endl;
92  if( ig.get(dbe_label.Data()) != nullptr && track_hist !=nullptr ) {
93  TH1F* hist = (TH1F*)ig.get( dbe_label.Data() )->getTH1F()->Clone();
94  TProfile* profile = ComputeEff( hist, track_hist);
95  TString x_axis_title = TString(hist->GetXaxis()->GetTitle());
96  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());
97  profile->SetTitle( title.Data());
98  ibooker.bookProfile( profile->GetName(),profile);
99  if ( sh_hist!=nullptr) {
100  TProfile* profile_sh = ComputeEff( hist, sh_hist );
101  profile_sh->SetName( (profile->GetName()+std::string("_sh")).c_str());
102  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() );
103  profile_sh->SetTitle( title2.Data() );
104  ibooker.bookProfile( profile_sh->GetName(),profile_sh);
105  }
106  }
107  return;
108 }
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:113
TProfile * ComputeEff(TH1F *num, TH1F *denum)
MonitorElement * get(std::string const &path)
Definition: DQMStore.cc:303

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.