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::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 &)
 
 MuonGEMRecHitsHarvestor (const edm::ParameterSet &)
 constructor More...
 
void ProcessBooking (DQMStore::IBooker &, DQMStore::IGetter &, const char *label, TString suffix, TH1F *track_hist, TH1F *sh_hist)
 
virtual ~MuonGEMRecHitsHarvestor ()
 destructor More...
 
- Public Member Functions inherited from DQMEDHarvester
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 DQMEDHarvester (void)
 
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 endRun (edm::Run const &, edm::EventSetup const &) override
 
void produce (edm::Event &, edm::EventSetup const &) final
 
 ~DQMEDHarvester () override=default
 
- 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
 
 ~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)
 
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
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 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 18 of file MuonGEMRecHitsHarvestor.h.

Constructor & Destructor Documentation

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

constructor

Data Format.

Geometry Log messages

Definition at line 49 of file MuonGEMRecHitsHarvestor.cc.

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

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

destructor

Definition at line 56 of file MuonGEMRecHitsHarvestor.cc.

57 {
58 }

Member Function Documentation

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

Definition at line 59 of file MuonGEMRecHitsHarvestor.cc.

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

Referenced by ProcessBooking().

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

Implements DQMEDHarvester.

Definition at line 116 of file MuonGEMRecHitsHarvestor.cc.

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

117 {
118  ig.setCurrentFolder(dbe_path_.c_str());
119 
120  const char* l_suffix[4] = {"_l1","_l2","_l1or2","_l1and2"};
121  const char* s_suffix[2] = {"_st1","_st2"};
122  const char* c_suffix[3] = {"_even","_odd","_all"};
123 
124  TH1F* gem_trk_eta[2];
125  TH1F* gem_trk_phi[2][2];
126 
127  TH1F* sh_eta[2][4];
128  TH1F* sh_phi[2][4][3];
129 
130  for( int i = 0 ; i < 2 ; i++) {
131  TString eta_label = TString(dbe_path_)+"track_eta"+s_suffix[i];
132  TString phi_label;
133  if ( ig.get(eta_label.Data()) != nullptr ) {
134  gem_trk_eta[i] = (TH1F*)ig.get(eta_label.Data())->getTH1F()->Clone();
135  gem_trk_eta[i]->Sumw2();
136  }
137  else std::cout<<"Can not found track_eta"<<std::endl;
138  for ( int k=0 ; k <3 ; k++) {
139  phi_label = TString(dbe_path_.c_str())+"track_phi"+s_suffix[i]+c_suffix[k];
140  if ( ig.get(phi_label.Data()) !=nullptr ) {
141  gem_trk_phi[i][k] = (TH1F*)ig.get(phi_label.Data())->getTH1F()->Clone();
142  gem_trk_phi[i][k]->Sumw2();
143  }
144  else std::cout<<"Can not found track_phi"<<std::endl;
145  }
146 
147  if ( ig.get(eta_label.Data()) != nullptr && ig.get(phi_label.Data()) !=nullptr ) {
148  for( int j = 0; j < 4 ; j++) {
149  TString suffix = TString( s_suffix[i] )+TString( l_suffix[j]);
150  TString eta_label = TString(dbe_path_)+"rh_sh_eta"+suffix;
151  if( ig.get(eta_label.Data()) !=nullptr ) {
152  sh_eta[i][j] = (TH1F*)ig.get(eta_label.Data())->getTH1F()->Clone();
153  sh_eta[i][j]->Sumw2();
154  }
155  else std::cout<<"Can not found eta histogram : "<<eta_label<<std::endl;
156  ProcessBooking( ibooker, ig, "rh_eta", suffix, gem_trk_eta[i], sh_eta[i][j]);
157  for ( int k= 0 ; k< 3 ; k++) {
158  suffix = TString( s_suffix[i])+TString( l_suffix[j]) +TString(c_suffix[k]);
159  TString phi_label = TString(dbe_path_)+"rh_sh_phi"+suffix;
160  if( ig.get(phi_label.Data()) !=nullptr ) {
161  sh_phi[i][j][k] = (TH1F*)ig.get(phi_label.Data())->getTH1F()->Clone();
162  sh_phi[i][j][k]->Sumw2();
163  }
164  else { std::cout<<"Can not found phi plots : "<<phi_label<<std::endl; continue; }
165  ProcessBooking( ibooker, ig, "rh_phi",suffix, gem_trk_phi[i][k], sh_phi[i][j][k]);
166  }
167  }
168  }
169  else std::cout<<"Can not find eta or phi of all track"<<std::endl;
170  }
171 }
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 setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:347
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 90 of file MuonGEMRecHitsHarvestor.cc.

References DQMStore::IBooker::bookProfile(), ComputeEff(), gather_cfg::cout, dbe_path_, DQMStore::IGetter::get(), create_public_lumi_plots::hist, NewPostProcessor_cff::profile, AlCaHLTBitMon_QueryRunRegistry::string, createPayload::suffix, and fftjetcommon_cfi::title.

Referenced by dqmEndJob().

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