test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
MuonGEMHitsHarvestor Class Reference

#include <MuonGEMHitsHarvestor.h>

Inheritance diagram for MuonGEMHitsHarvestor:
DQMEDHarvester edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

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 analyze (edm::Event const &, edm::EventSetup const &) final
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
 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
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

std::string dbe_path_
 
std::string outputFile_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
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, i, mergeVDriftHistosByStation::name, mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, and indexGen::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 }
int i
Definition: DBlmapReader.cc:9
T sqrt(T t)
Definition: SSEVec.h:18
tuple cout
Definition: gather_cfg.py:145
void MuonGEMHitsHarvestor::dqmEndJob ( DQMStore::IBooker ibooker,
DQMStore::IGetter ig 
)
virtual

Implements DQMEDHarvester.

Definition at line 105 of file MuonGEMHitsHarvestor.cc.

References GEMDetLabel::c_suffix, DQMStore::IGetter::get(), getTH1F(), i, j, relval_2017::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 ( int i = 0 ; i< 3 ; i++) {
112  track_eta[i]=nullptr;
113  for( int j=0 ; j<3 ; j++) {
114  track_phi[i][j]=nullptr;
115  }
116  }
117 
118  for(int i=0 ; i<3 ; 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(int j=0 ; j<4 ; j++) {
123  suffix = s_suffix[i]+l_suffix[j];
124  ProcessBooking( ibooker, ig, "sh_eta"+suffix,track_eta[i]);
125  }
126  }
127  for(int i=0 ; i<3; i++) {
128  for( int j=0 ; j<3 ; 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 ( int k=0; k<4 ; 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 }
int i
Definition: DBlmapReader.cc:9
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:304
int j
Definition: DBlmapReader.cc:9
TH1F * getTH1F(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
static const std::string l_suffix[4]
Definition: GEMDetLabel.h:2
void ProcessBooking(DQMStore::IBooker &, DQMStore::IGetter &, std::string label_suffix, TH1F *track_hist, TH1F *sh_hist=0)
static const std::string c_suffix[3]
Definition: GEMDetLabel.h:4
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:346
static const std::string s_suffix[3]
Definition: GEMDetLabel.h:3
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(), getTH1F(), estimatePileup::hist, AlCaHLTBitMon_QueryRunRegistry::string, and indexGen::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:304
TProfile * ComputeEff(TH1F *num, TH1F *denum)
TH1F * getTH1F(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)

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.