#include <Demo/TempAnaToolkit/src/PhysicsHistograms.cc>
Description: Demonstration of a simple analysis toolkit for starter analyses.
The order how the operations must be executed.
1. we first build our own default histogram groups (electrons, muons, etc)
2. the user-defined histogram groups are added by add*HistoGroup() methods.
3. configure starts: all PhysVarHisto pointers are collected in one big flat array for easy access and speedy processing.
4. various histograms are disabled.
5. various histograms are enabled. configure ends.
At this point we're good to go and ready to see the events.
Definition at line 57 of file PhysicsHistograms.h.
PhysicsHistograms::PhysicsHistograms | ( | KinAxisLimits const & | muonAxis, | |
KinAxisLimits const & | electronAxis, | |||
KinAxisLimits const & | tauAxis, | |||
KinAxisLimits const & | jetAxis, | |||
KinAxisLimits const & | METAxis, | |||
KinAxisLimits const & | photonAxis, | |||
KinAxisLimits const & | trackAxis | |||
) | [explicit] |
Create the objects that manage the histogram groups.
Definition at line 25 of file PhysicsHistograms.cc.
References GenMuonPlsPt100GeV_cfg::cout, electronHistograms_, lat::endl(), jetHistograms_, PhysicsHistograms::KinAxisLimits::m1, PhysicsHistograms::KinAxisLimits::m2, metHistograms_, muonHistograms_, photonHistograms_, PhysicsHistograms::KinAxisLimits::pt1, PhysicsHistograms::KinAxisLimits::pt2, tauHistograms_, and trackHistograms_.
00033 { 00034 //--- Initialize histogram objects 00035 std::cout << "PhysicsHistograms: Creating muon histograms" << std::endl; 00036 muonHistograms_ = 00037 new pat::HistoMuon ( "muon", "Muon", "mu", muonAxis.pt1, muonAxis.pt2, muonAxis.m1, muonAxis.m2 ); 00038 std::cout << "PhysicsHistograms: Creating electron histograms" << std::endl; 00039 electronHistograms_ = 00040 new pat::HistoElectron( "electron", "Electron", "e", electronAxis.pt1, electronAxis.pt2, electronAxis.m1, electronAxis.m2 ); 00041 std::cout << "PhysicsHistograms: Creating tau histograms" << std::endl; 00042 tauHistograms_ = 00043 new pat::HistoTau ( "tau", "Tau", "tau", tauAxis.pt1, tauAxis.pt2, tauAxis.m1, tauAxis.m2 ); 00044 std::cout << "PhysicsHistograms: Creating jet histograms" << std::endl; 00045 jetHistograms_ = 00046 new pat::HistoJet ( "jet", "Jet", "jet", jetAxis.pt1, jetAxis.pt2, jetAxis.m1, jetAxis.m2 ); 00047 std::cout << "PhysicsHistograms: Creating met histograms" << std::endl; 00048 metHistograms_ = 00049 new pat::HistoMET ( "met", "MET", "met", METAxis.pt1, METAxis.pt2, METAxis.m1, METAxis.m2 ); 00050 std::cout << "PhysicsHistograms: Creating photon histograms" << std::endl; 00051 photonHistograms_ = 00052 new pat::HistoPhoton ( "photon", "Photon", "photon", photonAxis.pt1, photonAxis.pt2, photonAxis.m1, photonAxis.m2 ); 00053 std::cout << "PhysicsHistograms: Creating track histograms" << std::endl; 00054 trackHistograms_ = 00055 new pat::HistoTrack ( "track", "Track", "track", trackAxis.pt1, trackAxis.pt2, trackAxis.m1, trackAxis.m2 ); 00056 }
PhysicsHistograms::~PhysicsHistograms | ( | ) | [virtual] |
Destroy the objects that manage the histogram groups.
Note that the TH1's used by PhysVarHistos managed by these histo groups will *not* be deleted in the PhysVarHisto's destructor. So it's safe to delete both HistoGroups and PhysVarHistos.
Definition at line 66 of file PhysicsHistograms.cc.
References allVarHistos_, electronHistograms_, i, jetHistograms_, metHistograms_, muonHistograms_, outputFile_, photonHistograms_, tauHistograms_, and trackHistograms_.
00067 { 00068 delete muonHistograms_ ; 00069 delete electronHistograms_ ; 00070 delete tauHistograms_ ; 00071 delete jetHistograms_ ; 00072 delete metHistograms_ ; 00073 delete photonHistograms_ ; 00074 delete trackHistograms_ ; 00075 00076 for ( unsigned int i = 0; i < allVarHistos_.size(); ++i ) { 00077 if ( allVarHistos_[i] ) delete allVarHistos_[i]; 00078 } 00079 00080 outputFile_.close(); 00081 }
void PhysicsHistograms::addElectronHisto | ( | pat::PhysVarHisto * | h | ) | [inline] |
Definition at line 158 of file PhysicsHistograms.h.
References pat::HistoGroup< PHYS_OBJECT >::addHisto(), and electronHistograms_.
00159 { electronHistograms_->addHisto(h); }
void PhysicsHistograms::addElectronHistoGroup | ( | pat::HistoElectron * | hgr | ) | [inline] |
Definition at line 160 of file PhysicsHistograms.h.
References pat::HistoGroup< PHYS_OBJECT >::addHistoGroup(), and electronHistograms_.
00161 { electronHistograms_->addHistoGroup(hgr); }
void PhysicsHistograms::addHisto | ( | pat::PhysVarHisto * | h | ) | [inline] |
Definition at line 200 of file PhysicsHistograms.h.
References allVarHistos_.
00201 { allVarHistos_.push_back( h ); }
void PhysicsHistograms::addJetHisto | ( | pat::PhysVarHisto * | h | ) | [inline] |
Definition at line 172 of file PhysicsHistograms.h.
References pat::HistoGroup< PHYS_OBJECT >::addHisto(), and jetHistograms_.
00173 { jetHistograms_->addHisto(h); }
void PhysicsHistograms::addJetHistoGroup | ( | pat::HistoJet * | hgr | ) | [inline] |
Definition at line 174 of file PhysicsHistograms.h.
References pat::HistoGroup< PHYS_OBJECT >::addHistoGroup(), and jetHistograms_.
00175 { jetHistograms_->addHistoGroup(hgr); }
void PhysicsHistograms::addMetHisto | ( | pat::PhysVarHisto * | h | ) | [inline] |
Definition at line 179 of file PhysicsHistograms.h.
References pat::HistoGroup< PHYS_OBJECT >::addHisto(), and metHistograms_.
00180 { metHistograms_->addHisto(h); }
void PhysicsHistograms::addMetHistoGroup | ( | pat::HistoMET * | hgr | ) | [inline] |
Definition at line 181 of file PhysicsHistograms.h.
References pat::HistoGroup< PHYS_OBJECT >::addHistoGroup(), and metHistograms_.
00182 { metHistograms_->addHistoGroup(hgr); }
void PhysicsHistograms::addMuonHisto | ( | pat::PhysVarHisto * | h | ) | [inline] |
Definition at line 151 of file PhysicsHistograms.h.
References pat::HistoGroup< PHYS_OBJECT >::addHisto(), and muonHistograms_.
00152 { muonHistograms_->addHisto(h); }
void PhysicsHistograms::addMuonHistoGroup | ( | pat::HistoMuon * | hgr | ) | [inline] |
Definition at line 153 of file PhysicsHistograms.h.
References pat::HistoGroup< PHYS_OBJECT >::addHistoGroup(), and muonHistograms_.
00154 { muonHistograms_->addHistoGroup(hgr); }
void PhysicsHistograms::addPhotonHisto | ( | pat::PhysVarHisto * | h | ) | [inline] |
Definition at line 186 of file PhysicsHistograms.h.
References pat::HistoGroup< PHYS_OBJECT >::addHisto(), and photonHistograms_.
00187 { photonHistograms_->addHisto(h); }
void PhysicsHistograms::addPhotonHistoGroup | ( | pat::HistoPhoton * | hgr | ) | [inline] |
Definition at line 188 of file PhysicsHistograms.h.
References pat::HistoGroup< PHYS_OBJECT >::addHistoGroup(), and photonHistograms_.
00189 { photonHistograms_->addHistoGroup(hgr); }
void PhysicsHistograms::addTauHisto | ( | pat::PhysVarHisto * | h | ) | [inline] |
Definition at line 165 of file PhysicsHistograms.h.
References pat::HistoGroup< PHYS_OBJECT >::addHisto(), and tauHistograms_.
00166 { tauHistograms_->addHisto(h); }
void PhysicsHistograms::addTauHistoGroup | ( | pat::HistoTau * | hgr | ) | [inline] |
Definition at line 167 of file PhysicsHistograms.h.
References pat::HistoGroup< PHYS_OBJECT >::addHistoGroup(), and tauHistograms_.
00168 { tauHistograms_->addHistoGroup(hgr); }
void PhysicsHistograms::addTrackHisto | ( | pat::PhysVarHisto * | h | ) | [inline] |
Definition at line 194 of file PhysicsHistograms.h.
References pat::HistoGroup< PHYS_OBJECT >::addHisto(), and trackHistograms_.
00195 { trackHistograms_->addHisto(h); }
void PhysicsHistograms::addTrackHistoGroup | ( | pat::HistoTrack * | hgr | ) | [inline] |
Definition at line 196 of file PhysicsHistograms.h.
References pat::HistoGroup< PHYS_OBJECT >::addHistoGroup(), and trackHistograms_.
00197 { trackHistograms_->addHistoGroup(hgr); }
initialize before seeing any events
Method called before seeing all events (in CMSSW) or before the event loop in FWLite.
Definition at line 167 of file PhysicsHistograms.cc.
void PhysicsHistograms::clearVec | ( | ) | [virtual] |
Definition at line 148 of file PhysicsHistograms.cc.
References allVarHistos_, pat::HistoMET::clearVec(), pat::HistoPhoton::clearVec(), pat::HistoTrack::clearVec(), pat::HistoJet::clearVec(), pat::HistoTau::clearVec(), pat::HistoElectron::clearVec(), pat::HistoMuon::clearVec(), electronHistograms_, i, jetHistograms_, metHistograms_, muonHistograms_, photonHistograms_, tauHistograms_, and trackHistograms_.
Referenced by pat::PatKitHelper::fillHistograms().
00149 { 00150 muonHistograms_ ->clearVec() ; 00151 electronHistograms_->clearVec() ; 00152 tauHistograms_ ->clearVec() ; 00153 metHistograms_ ->clearVec() ; 00154 jetHistograms_ ->clearVec() ; 00155 photonHistograms_ ->clearVec() ; 00156 trackHistograms_ ->clearVec() ; 00157 for ( uint i = 0; i < allVarHistos_.size(); i++ ) { 00158 allVarHistos_[i]->clearVec(); 00159 } 00160 }
void PhysicsHistograms::configure | ( | std::string & | histos_to_disable, | |
std::string & | histos_to_enable | |||
) | [virtual] |
Methods to configure (enable or disable) various PhysVarHistos one at the time, or in whole groups.
Definition at line 90 of file PhysicsHistograms.cc.
References pat::HistoGroup< PHYS_OBJECT >::configure(), GenMuonPlsPt100GeV_cfg::cout, electronHistograms_, lat::endl(), jetHistograms_, metHistograms_, muonHistograms_, photonHistograms_, tauHistograms_, and trackHistograms_.
00092 { 00093 std::cout << "PhysicsHistograms:: configuring..." 00094 << "\n First disabling: " << histos_to_disable 00095 << "\n Then enabling : " << histos_to_enable 00096 << std::endl; 00097 00098 00099 //--- Pass this information to histogramGroups 00100 muonHistograms_ ->configure( histos_to_disable, histos_to_enable ) ; 00101 electronHistograms_->configure( histos_to_disable, histos_to_enable ) ; 00102 tauHistograms_ ->configure( histos_to_disable, histos_to_enable ) ; 00103 metHistograms_ ->configure( histos_to_disable, histos_to_enable ) ; 00104 jetHistograms_ ->configure( histos_to_disable, histos_to_enable ) ; 00105 photonHistograms_ ->configure( histos_to_disable, histos_to_enable ) ; 00106 trackHistograms_ ->configure( histos_to_disable, histos_to_enable ) ; 00107 00108 }
do whatever is needed after seeing all events
Method called after seeing all events (in CMSSW) or after the event loop in FWLite.
Definition at line 178 of file PhysicsHistograms.cc.
void PhysicsHistograms::fillCollection | ( | const std::vector< reco::RecoChargedCandidate > & | coll, | |
double | w = 1.0 | |||
) | [inline] |
Definition at line 138 of file PhysicsHistograms.h.
References pat::HistoTrack::fillCollection(), trackHistograms_, and w.
00139 { trackHistograms_->fillCollection(coll,w); }
void PhysicsHistograms::fillCollection | ( | const std::vector< pat::Photon > & | coll, | |
double | w = 1.0 | |||
) | [inline] |
Definition at line 133 of file PhysicsHistograms.h.
References pat::HistoPhoton::fillCollection(), photonHistograms_, and w.
00134 { photonHistograms_->fillCollection(coll,w); }
void PhysicsHistograms::fillCollection | ( | const std::vector< pat::MET > & | coll, | |
double | w = 1.0 | |||
) | [inline] |
Definition at line 128 of file PhysicsHistograms.h.
References pat::HistoMET::fillCollection(), metHistograms_, and w.
00129 { metHistograms_->fillCollection(coll,w); }
void PhysicsHistograms::fillCollection | ( | const std::vector< pat::Jet > & | coll, | |
double | w = 1.0 | |||
) | [inline] |
Definition at line 123 of file PhysicsHistograms.h.
References pat::HistoJet::fillCollection(), jetHistograms_, and w.
00124 { jetHistograms_->fillCollection(coll,w); }
void PhysicsHistograms::fillCollection | ( | const std::vector< pat::Tau > & | coll, | |
double | w = 1.0 | |||
) | [inline] |
Definition at line 118 of file PhysicsHistograms.h.
References pat::HistoTau::fillCollection(), tauHistograms_, and w.
00119 { tauHistograms_->fillCollection(coll,w); }
void PhysicsHistograms::fillCollection | ( | const std::vector< pat::Electron > & | coll, | |
double | w = 1.0 | |||
) | [inline] |
Definition at line 113 of file PhysicsHistograms.h.
References electronHistograms_, pat::HistoElectron::fillCollection(), and w.
00114 { electronHistograms_->fillCollection(coll,w); }
void PhysicsHistograms::fillCollection | ( | const std::vector< pat::Muon > & | coll, | |
double | w = 1.0 | |||
) | [inline] |
Definition at line 108 of file PhysicsHistograms.h.
References pat::HistoMuon::fillCollection(), muonHistograms_, and w.
Referenced by pat::PatKitHelper::fillHistograms().
00109 { muonHistograms_->fillCollection(coll,w); }
void PhysicsHistograms::select | ( | std::string | vars_to_select, | |
std::vector< pat::PhysVarHisto * > & | selectedHistos | |||
) | [virtual] |
Selection of a subset of PhysVarHistos.
Definition at line 115 of file PhysicsHistograms.cc.
References allVarHistos_, GenMuonPlsPt100GeV_cfg::cout, electronHistograms_, end, lat::endl(), i, jetHistograms_, metHistograms_, muonHistograms_, photonHistograms_, pat::HistoGroup< PHYS_OBJECT >::select(), tauHistograms_, pyDBSRunClass::temp, parsecf::pyparsing::test(), and trackHistograms_.
00117 { 00118 std::cout << "PhysicsHistograms:: selecting the following variables:\n\t" 00119 << vars_to_select 00120 << std::endl; 00121 00122 00123 //--- Pass this information to histogramGroups 00124 muonHistograms_ ->select( vars_to_select, selectedVars ) ; 00125 electronHistograms_->select( vars_to_select, selectedVars ) ; 00126 tauHistograms_ ->select( vars_to_select, selectedVars ) ; 00127 metHistograms_ ->select( vars_to_select, selectedVars ) ; 00128 jetHistograms_ ->select( vars_to_select, selectedVars ) ; 00129 photonHistograms_ ->select( vars_to_select, selectedVars ) ; 00130 trackHistograms_ ->select( vars_to_select, selectedVars ) ; 00131 00132 std::vector<pat::PhysVarHisto*>::iterator i = allVarHistos_.begin(); 00133 std::vector<pat::PhysVarHisto*>::iterator end = allVarHistos_.end(); 00134 std::string temp = "," + vars_to_select + ","; 00135 for ( ; i != end; ++i ) { 00136 std::string test = "," + (*i)->name() + ","; 00137 std::cout << "testing " << test << std::endl; 00138 if ( temp.find( test ) != std::string::npos || temp == ",all," ) { 00139 std::cout << "FOUND!" << std::endl; 00140 selectedVars.push_back ( *i ); 00141 } 00142 } 00143 00144 std::cout << "PhysicsHistograms:: selected " << selectedVars.size() 00145 << " variables." << std::endl; 00146 }
std::vector< pat::PhysVarHisto* > PhysicsHistograms::allVarHistos_ [private] |
Definition at line 224 of file PhysicsHistograms.h.
Referenced by addHisto(), clearVec(), select(), and ~PhysicsHistograms().
Definition at line 215 of file PhysicsHistograms.h.
Referenced by addElectronHisto(), addElectronHistoGroup(), clearVec(), configure(), fillCollection(), PhysicsHistograms(), select(), and ~PhysicsHistograms().
std::vector< pat::PhysVarHisto* > PhysicsHistograms::enabledVarHistos_ [private] |
Definition at line 225 of file PhysicsHistograms.h.
edm::Service<TFileService> PhysicsHistograms::fs [private] |
Definition at line 211 of file PhysicsHistograms.h.
pat::HistoJet* PhysicsHistograms::jetHistograms_ [private] |
Definition at line 218 of file PhysicsHistograms.h.
Referenced by addJetHisto(), addJetHistoGroup(), clearVec(), configure(), fillCollection(), PhysicsHistograms(), select(), and ~PhysicsHistograms().
pat::HistoMET* PhysicsHistograms::metHistograms_ [private] |
Definition at line 217 of file PhysicsHistograms.h.
Referenced by addMetHisto(), addMetHistoGroup(), clearVec(), configure(), fillCollection(), PhysicsHistograms(), select(), and ~PhysicsHistograms().
pat::HistoMuon* PhysicsHistograms::muonHistograms_ [private] |
Definition at line 214 of file PhysicsHistograms.h.
Referenced by addMuonHisto(), addMuonHistoGroup(), clearVec(), configure(), fillCollection(), PhysicsHistograms(), select(), and ~PhysicsHistograms().
ofstream PhysicsHistograms::outputFile_ [private] |
std::string PhysicsHistograms::outputTextName_ [private] |
Definition at line 208 of file PhysicsHistograms.h.
Definition at line 219 of file PhysicsHistograms.h.
Referenced by addPhotonHisto(), addPhotonHistoGroup(), clearVec(), configure(), fillCollection(), PhysicsHistograms(), select(), and ~PhysicsHistograms().
pat::HistoTau* PhysicsHistograms::tauHistograms_ [private] |
Definition at line 216 of file PhysicsHistograms.h.
Referenced by addTauHisto(), addTauHistoGroup(), clearVec(), configure(), fillCollection(), PhysicsHistograms(), select(), and ~PhysicsHistograms().
Definition at line 220 of file PhysicsHistograms.h.
Referenced by addTrackHisto(), addTrackHistoGroup(), clearVec(), configure(), fillCollection(), PhysicsHistograms(), select(), and ~PhysicsHistograms().