CMS 3D CMS Logo

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

#include <MuonGEMDigisHarvestor.h>

Inheritance diagram for MuonGEMDigisHarvestor:
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 &)
 
 MuonGEMDigisHarvestor (const edm::ParameterSet &)
 constructor More...
 
void ProcessBooking (DQMStore::IBooker &, DQMStore::IGetter &, const char *label, TString suffix, TH1F *track_hist, TH1F *sh_hist)
 
virtual ~MuonGEMDigisHarvestor ()
 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 compareable_dbe_hist_prefix_
 
std::string compareable_dbe_path_
 
std::string dbe_hist_prefix_
 
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 21 of file MuonGEMDigisHarvestor.h.

Constructor & Destructor Documentation

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

constructor

Definition at line 50 of file MuonGEMDigisHarvestor.cc.

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

51 {
52  dbe_path_ = ps.getParameter<std::string>("dbePath");
53  dbe_hist_prefix_ = ps.getParameter<std::string>("dbeHistPrefix");
54  compareable_dbe_path_ = ps.getParameter<std::string>("compareDBEPath");
55  compareable_dbe_hist_prefix_ = ps.getParameter<std::string>("compareDBEHistPrefix");
56 
57  outputFile_ = ps.getUntrackedParameter<std::string>("outputFile", "myfile.root");
58 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string compareable_dbe_hist_prefix_
MuonGEMDigisHarvestor::~MuonGEMDigisHarvestor ( )
virtual

destructor

Definition at line 61 of file MuonGEMDigisHarvestor.cc.

62 {
63 }

Member Function Documentation

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

Definition at line 64 of file MuonGEMDigisHarvestor.cc.

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

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

Implements DQMEDHarvester.

Definition at line 121 of file MuonGEMDigisHarvestor.cc.

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

122 {
123  ig.setCurrentFolder(dbe_path_.c_str());
124  TH1F* gem_trk_eta[3];
125  TH1F* gem_trk_phi[3][2];
126 
127  TH1F* sh_eta[3][4];
128  TH1F* sh_phi[3][4][3];
129 
130 
131 
132  // simplePlots
133  /*
134  for( int region = -1 ; region <= 1 ; region = region+2) {
135  for ( int station = 0 ; station <2 ; station++) {
136  if ( station ==1 ) station=2 ;
137  TString dcEta_label = TString::Format("%s%s_r%d%s",dbe_path_.c_str(),dbe_hist_prefix_.c_str(), region, s_suffix[station].c_str());
138  TString denum_dcEta_label = TString::Format("%s%s_r%d%s",compareable_dbe_path_.c_str(),compareable_dbe_hist_prefix_.c_str(), region, s_suffix[station].c_str());
139 
140 
141  if ( ig.get( dcEta_label.Data()) != nullptr && ig.get( denum_dcEta_label.Data()) != nullptr) {
142  TH2F* dcEta = (TH2F*)ig.get( dcEta_label.Data())->getTH2F()->Clone();
143  TH2F* denum_dcEta = (TH2F*)ig.get( denum_dcEta_label.Data())->getTH2F()->Clone();
144  dcEta->Divide(denum_dcEta);
145  TH2F* eff_dcEta = (TH2F*)dcEta->Clone();
146 
147  TString eff_dcEta_title = TString::Format("Hits Efficiency on detector component at r%d%s",region,s_suffix[station].c_str());
148  TString eff_dcEta_label = TString::Format("eff_DigiHit_r%d%s",region,s_suffix[station].c_str());
149 
150 
151  eff_dcEta->SetName( eff_dcEta_label.Data());
152  eff_dcEta->SetTitle( eff_dcEta_title.Data());
153 
154  ibooker.book2D(eff_dcEta->GetName(), eff_dcEta);
155  }
156  else {
157  std::cout<<"Failed to get histograms"<<std::endl;
158  std::cout<<dcEta_label<<std::endl;
159  std::cout<<denum_dcEta_label<<std::endl;
160  }
161  }
162  }
163  */
164 
165  // detailPlots
166  for( int i = 0 ; i < 3 ; i++) {
167  TString eta_label = TString(dbe_path_)+"track_eta"+s_suffix[i];
168  TString phi_label;
169  if ( ig.get(eta_label.Data()) != nullptr ) {
170  gem_trk_eta[i] = (TH1F*)ig.get(eta_label.Data())->getTH1F()->Clone();
171  gem_trk_eta[i]->Sumw2();
172  }
173  else LogDebug("MuonGEMDigisHarvestor")<<"Can not found track_eta";
174  for ( int k=0 ; k <3 ; k++) {
175  phi_label = TString(dbe_path_.c_str())+"track_phi"+s_suffix[i]+c_suffix[k];
176  if ( ig.get(phi_label.Data()) !=nullptr ) {
177  gem_trk_phi[i][k] = (TH1F*)ig.get(phi_label.Data())->getTH1F()->Clone();
178  gem_trk_phi[i][k]->Sumw2();
179  }
180  else LogDebug("MuonGEMDigisHarvestor")<<"Can not found track_phi";
181  }
182 
183  if ( ig.get(eta_label.Data()) != nullptr && ig.get(phi_label.Data()) !=nullptr ) {
184  for( int j = 0; j < 4 ; j++) {
185  TString suffix = TString( s_suffix[i] )+TString( l_suffix[j]);
186  TString eta_label = TString(dbe_path_)+"dg_sh_eta"+suffix;
187  if( ig.get(eta_label.Data()) !=nullptr ) {
188  sh_eta[i][j] = (TH1F*)ig.get(eta_label.Data())->getTH1F()->Clone();
189  sh_eta[i][j]->Sumw2();
190  }
191  else LogDebug("MuonGEMDigisHarvestor")<<"Can not found eta histogram : "<<eta_label;
192  ProcessBooking( ibooker, ig, "dg_eta", suffix, gem_trk_eta[i], sh_eta[i][j]);
193  ProcessBooking( ibooker, ig, "pad_eta", suffix, gem_trk_eta[i], sh_eta[i][j]);
194  ProcessBooking( ibooker, ig, "copad_eta", suffix, gem_trk_eta[i], sh_eta[i][j]);
195  for ( int k= 0 ; k< 3 ; k++) {
196  suffix = TString( s_suffix[i])+TString( l_suffix[j]) +TString(c_suffix[k]);
197  TString phi_label = TString(dbe_path_)+"dg_sh_phi"+suffix;
198  if( ig.get(phi_label.Data()) !=nullptr ) {
199  sh_phi[i][j][k] = (TH1F*)ig.get(phi_label.Data())->getTH1F()->Clone();
200  sh_phi[i][j][k]->Sumw2();
201  }
202  else { LogDebug("MuonGEMDigisHarvestor")<<"Can not found phi plots : "<<phi_label; continue; }
203  ProcessBooking( ibooker, ig, "dg_phi",suffix, gem_trk_phi[i][k], sh_phi[i][j][k]);
204  ProcessBooking( ibooker, ig, "pad_phi",suffix,gem_trk_phi[i][k], sh_phi[i][j][k]);
205  ProcessBooking( ibooker, ig, "copad_phi",suffix,gem_trk_phi[i][k], sh_phi[i][j][k]);
206  }
207  }
208  }
209  else LogDebug("MuonGEMDigisHarvestor")<<"Can not find eta or phi of all track";
210  }
211 }
#define LogDebug(id)
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 MuonGEMDigisHarvestor::ProcessBooking ( DQMStore::IBooker ibooker,
DQMStore::IGetter ig,
const char *  label,
TString  suffix,
TH1F *  track_hist,
TH1F *  sh_hist 
)

Definition at line 95 of file MuonGEMDigisHarvestor.cc.

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

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

Definition at line 34 of file MuonGEMDigisHarvestor.h.

std::string MuonGEMDigisHarvestor::compareable_dbe_path_
private

Definition at line 34 of file MuonGEMDigisHarvestor.h.

std::string MuonGEMDigisHarvestor::dbe_hist_prefix_
private

Definition at line 34 of file MuonGEMDigisHarvestor.h.

std::string MuonGEMDigisHarvestor::dbe_path_
private

Definition at line 34 of file MuonGEMDigisHarvestor.h.

std::string MuonGEMDigisHarvestor::outputFile_
private

Definition at line 34 of file MuonGEMDigisHarvestor.h.