CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
MCEmbeddingValidationAnalyzer::tauDistributionExtra Struct Reference

Public Member Functions

void bookHistograms (DQMStore &dqmStore)
 
void fillHistograms (int numJets, const edm::Event &evt, double evtWeight)
 
 tauDistributionExtra (int minJets, int maxJets, const edm::InputTag &srcGen, const std::string &cutGen, const edm::InputTag &srcRec, const std::string &cutRec, double dRmatch, const std::string &dqmDirectory)
 
 ~tauDistributionExtra ()
 

Public Attributes

StringCutObjectSelector
< reco::Candidate > * 
cutGen_
 
StringCutObjectSelector
< pat::Tau > * 
cutRec_
 
std::string dqmDirectory_
 
double dRmatch_
 
MonitorElementhistogramGenTauDecayMode_
 
MonitorElementhistogramRecTauDecayMode_
 
int maxJets_
 
int minJets_
 
edm::InputTag srcGen_
 
edm::InputTag srcRec_
 

Detailed Description

Definition at line 959 of file MCEmbeddingValidationAnalyzer.h.

Constructor & Destructor Documentation

MCEmbeddingValidationAnalyzer::tauDistributionExtra::tauDistributionExtra ( int  minJets,
int  maxJets,
const edm::InputTag srcGen,
const std::string &  cutGen,
const edm::InputTag srcRec,
const std::string &  cutRec,
double  dRmatch,
const std::string &  dqmDirectory 
)
inline

Definition at line 961 of file MCEmbeddingValidationAnalyzer.h.

References cutGen_, cutRec_, dqmDirectory_, maxJets_, and minJets_.

963  : minJets_(minJets),
964  maxJets_(maxJets),
965  srcGen_(srcGen),
966  cutGen_(0),
967  srcRec_(srcRec),
968  cutRec_(0),
969  dRmatch_(dRmatch)
970  {
971  if ( cutGen != "" ) cutGen_ = new StringCutObjectSelector<reco::Candidate>(cutGen);
972  if ( cutRec != "" ) cutRec_ = new StringCutObjectSelector<pat::Tau>(cutRec);
973  dqmDirectory_ = dqmDirectory;
974  if ( minJets_ < 0 && maxJets_ < 0 ) dqmDirectory_.append("");
975  else if ( maxJets_ < 0 ) dqmDirectory_.append(Form("_numJetsGe%i", minJets_));
976  else if ( minJets_ < 0 ) dqmDirectory_.append(Form("_numJetsLe%i", maxJets_));
977  else if ( maxJets_ == minJets_ ) dqmDirectory_.append(Form("_numJetsEq%i", minJets_));
978  else dqmDirectory_.append(Form("_numJets%ito%i", minJets_, maxJets_));
979  }
StringCutObjectSelector< reco::Candidate > * cutGen_
MCEmbeddingValidationAnalyzer::tauDistributionExtra::~tauDistributionExtra ( )
inline

Definition at line 980 of file MCEmbeddingValidationAnalyzer.h.

References cutGen_, and cutRec_.

981  {
982  delete cutGen_;
983  delete cutRec_;
984  }
StringCutObjectSelector< reco::Candidate > * cutGen_

Member Function Documentation

void MCEmbeddingValidationAnalyzer::tauDistributionExtra::bookHistograms ( DQMStore dqmStore)
inline

Definition at line 985 of file MCEmbeddingValidationAnalyzer.h.

References DQMStore::book1D(), dqmDirectory_, histogramGenTauDecayMode_, histogramRecTauDecayMode_, and DQMStore::setCurrentFolder().

986  {
987  dqmStore.setCurrentFolder(dqmDirectory_.data());
988  histogramGenTauDecayMode_ = dqmStore.book1D("genTauDecayMode", "genTauDecayMode", 21, -1.5, +19.5);
989  histogramRecTauDecayMode_ = dqmStore.book1D("recTauDecayMode", "recTauDecayMode", 21, -1.5, +19.5);
990  }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:1021
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:727
void MCEmbeddingValidationAnalyzer::tauDistributionExtra::fillHistograms ( int  numJets,
const edm::Event evt,
double  evtWeight 
)
inline

Definition at line 991 of file MCEmbeddingValidationAnalyzer.h.

References cutGen_, cutRec_, deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, dRmatch_, MonitorElement::Fill(), JetMCTagUtils::genTauDecayMode(), edm::Event::getByLabel(), histogramGenTauDecayMode_, histogramRecTauDecayMode_, maxJets_, minJets_, srcGen_, srcRec_, AlCaHLTBitMon_QueryRunRegistry::string, reco::PFTauDecayMode::tauDecay1ChargedPion0PiZero, reco::PFTauDecayMode::tauDecay1ChargedPion1PiZero, reco::PFTauDecayMode::tauDecay1ChargedPion2PiZero, reco::PFTauDecayMode::tauDecay1ChargedPion3PiZero, reco::PFTauDecayMode::tauDecay3ChargedPion0PiZero, reco::PFTauDecayMode::tauDecay3ChargedPion1PiZero, reco::PFTauDecayMode::tauDecay3ChargedPion2PiZero, reco::PFTauDecayMode::tauDecayMuon, reco::PFTauDecayMode::tauDecayOther, and reco::PFTauDecayMode::tauDecaysElectron.

993  {
994  if ( (minJets_ == -1 || numJets >= minJets_) &&
995  (maxJets_ == -1 || numJets <= maxJets_) ) {
997  edm::Handle<CandidateView> genLeptons;
998  evt.getByLabel(srcGen_, genLeptons);
999  typedef std::vector<pat::Tau> recLeptonCollection;
1001  evt.getByLabel(srcRec_, recLeptons);
1002  for ( CandidateView::const_iterator genLepton = genLeptons->begin();
1003  genLepton != genLeptons->end(); ++genLepton ) {
1004  if ( cutGen_ && !(*cutGen_)(*genLepton) ) continue;
1005  const reco::CompositePtrCandidate* genLepton_composite = dynamic_cast<const reco::CompositePtrCandidate*>(&(*genLepton));
1006  for ( recLeptonCollection::const_iterator recLepton = recLeptons->begin();
1007  recLepton != recLeptons->end(); ++recLepton ) {
1008  if ( cutRec_ && !(*cutRec_)(*recLepton) ) continue;
1009  double dR = deltaR(genLepton->p4(), recLepton->p4());
1010  if ( dR < dRmatch_ ) {
1011  std::string genTauDecayMode_string = JetMCTagUtils::genTauDecayMode(*genLepton_composite);
1012  //std::cout << "--> genTauDecayMode: = " << genTauDecayMode_string << std::endl;
1013  int genTauDecayMode = -1;
1014  if ( genTauDecayMode_string == "electron" ) genTauDecayMode = reco::PFTauDecayMode::tauDecaysElectron;
1015  else if ( genTauDecayMode_string == "muon" ) genTauDecayMode = reco::PFTauDecayMode::tauDecayMuon;
1016  else if ( genTauDecayMode_string == "oneProng0Pi0" ) genTauDecayMode = reco::PFTauDecayMode::tauDecay1ChargedPion0PiZero;
1017  else if ( genTauDecayMode_string == "oneProng1Pi0" ) genTauDecayMode = reco::PFTauDecayMode::tauDecay1ChargedPion1PiZero;
1018  else if ( genTauDecayMode_string == "oneProng2Pi0" ) genTauDecayMode = reco::PFTauDecayMode::tauDecay1ChargedPion2PiZero;
1019  else if ( genTauDecayMode_string == "oneProngOther" ) genTauDecayMode = reco::PFTauDecayMode::tauDecay1ChargedPion3PiZero;
1020  else if ( genTauDecayMode_string == "threeProng0Pi0" ) genTauDecayMode = reco::PFTauDecayMode::tauDecay3ChargedPion0PiZero;
1021  else if ( genTauDecayMode_string == "threeProng1Pi0" ) genTauDecayMode = reco::PFTauDecayMode::tauDecay3ChargedPion1PiZero;
1022  else if ( genTauDecayMode_string == "threeProngOther" ) genTauDecayMode = reco::PFTauDecayMode::tauDecay3ChargedPion2PiZero;
1023  else if ( genTauDecayMode_string == "rare" ) genTauDecayMode = reco::PFTauDecayMode::tauDecayOther;
1024  histogramGenTauDecayMode_->Fill(genTauDecayMode, evtWeight);
1025  int recTauDecayMode = recLepton->decayMode();
1026  histogramRecTauDecayMode_->Fill(recTauDecayMode, evtWeight);
1027  }
1028  }
1029  }
1030  //edm::Handle<reco::GenParticleCollection> genParticles;
1031  //evt.getByLabel("genParticles", genParticles);
1032  //for ( reco::GenParticleCollection::const_iterator genParticle = genParticles->begin();
1033  // genParticle != genParticles->end(); ++genParticle ) {
1034  // if ( TMath::Abs(genParticle->pdgId()) == 15 ) {
1035  // for ( recLeptonCollection::const_iterator recLepton = recLeptons->begin();
1036  // recLepton != recLeptons->end(); ++recLepton ) {
1037  // if ( cutRec_ && !(*cutRec_)(*recLepton) ) continue;
1038  // double dR = deltaR(genParticle->p4(), recLepton->p4());
1039  // if ( dR < dRmatch_ ) {
1040  // std::string genTauDecayMode_string = getGenTauDecayMode(&(*genParticle));
1041  // std::cout << "--> genTauDecayMode: = " << genTauDecayMode_string << std::endl;
1042  // }
1043  // }
1044  // }
1045  //}
1046  }
1047  }
std::string genTauDecayMode(const reco::CompositePtrCandidate &c)
Definition: JetMCTag.cc:81
void Fill(long long x)
edm::View< reco::Candidate > CandidateView
StringCutObjectSelector< reco::Candidate > * cutGen_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:418
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81

Member Data Documentation

StringCutObjectSelector<reco::Candidate>* MCEmbeddingValidationAnalyzer::tauDistributionExtra::cutGen_
StringCutObjectSelector<pat::Tau>* MCEmbeddingValidationAnalyzer::tauDistributionExtra::cutRec_
std::string MCEmbeddingValidationAnalyzer::tauDistributionExtra::dqmDirectory_

Definition at line 1055 of file MCEmbeddingValidationAnalyzer.h.

Referenced by bookHistograms(), and tauDistributionExtra().

double MCEmbeddingValidationAnalyzer::tauDistributionExtra::dRmatch_

Definition at line 1054 of file MCEmbeddingValidationAnalyzer.h.

Referenced by fillHistograms().

MonitorElement* MCEmbeddingValidationAnalyzer::tauDistributionExtra::histogramGenTauDecayMode_

Definition at line 1056 of file MCEmbeddingValidationAnalyzer.h.

Referenced by bookHistograms(), and fillHistograms().

MonitorElement* MCEmbeddingValidationAnalyzer::tauDistributionExtra::histogramRecTauDecayMode_

Definition at line 1057 of file MCEmbeddingValidationAnalyzer.h.

Referenced by bookHistograms(), and fillHistograms().

int MCEmbeddingValidationAnalyzer::tauDistributionExtra::maxJets_

Definition at line 1049 of file MCEmbeddingValidationAnalyzer.h.

Referenced by fillHistograms(), and tauDistributionExtra().

int MCEmbeddingValidationAnalyzer::tauDistributionExtra::minJets_

Definition at line 1048 of file MCEmbeddingValidationAnalyzer.h.

Referenced by fillHistograms(), and tauDistributionExtra().

edm::InputTag MCEmbeddingValidationAnalyzer::tauDistributionExtra::srcGen_

Definition at line 1050 of file MCEmbeddingValidationAnalyzer.h.

Referenced by fillHistograms().

edm::InputTag MCEmbeddingValidationAnalyzer::tauDistributionExtra::srcRec_

Definition at line 1052 of file MCEmbeddingValidationAnalyzer.h.

Referenced by fillHistograms().