33 #include <boost/format.hpp>
38 #include "TDirectory.h"
42 #include <Math/VectorUtil.h>
43 using namespace ROOT::Math::VectorUtil ;
59 histName = boost::str(
boost::format(histogramNameTemplate) %
"et");
60 histTitle = boost::str(
boost::format(histogramTitleTemplate) %
"E_{T}");
68 histName = boost::str(
boost::format(histogramNameTemplate) %
"eta");
69 histTitle= boost::str(
boost::format(histogramTitleTemplate) %
"#eta");
77 histName = boost::str(
boost::format(histogramNameTemplate) %
"phi");
78 histTitle= boost::str(
boost::format(histogramTitleTemplate) %
"#phi");
91 etMonitorElement->Fill(momentum.Et());
92 etaMonitorElement->Fill(momentum.eta() );
93 phiMonitorElement->Fill(momentum.phi() );
150 std::vector<edm::ParameterSet>
filters =
151 pset.
getParameter<std::vector<edm::ParameterSet> >(
"filters");
154 for(std::vector<edm::ParameterSet>::iterator filterconf = filters.begin() ; filterconf != filters.end() ; filterconf++)
162 std::vector<double> bounds = filterconf->getParameter<std::vector<double> >(
"PlotBounds");
164 assert(bounds.size() == 2);
165 plotBounds.push_back(std::pair<double,double>(bounds[0],bounds[1]));
166 isoNames.push_back(filterconf->getParameter<std::vector<edm::InputTag> >(
"IsoCollections"));
168 for (
unsigned int i=0; i<
isoNames.back().size(); i++) {
186 throw(
cms::Exception(
"Release Validation Error") <<
"HLT output type not implemented: theHLTOutputTypes[n]" );
192 if (
isoNames.back().at(0).label()==
"none") {
212 bool isHltConfigChanged =
false;
245 histName=
"total_eff_RECO_matched";
246 histTitle=
"total events passing (Reco matched)";
247 totalmatchreco =
dbe->
book1D(histName.c_str(),histTitle.c_str(),numOfHLTCollectionLabels+2,0,numOfHLTCollectionLabels+2);
261 pdgIdString=
"Electron";
break;
263 pdgIdString=
"Photon";
break;
265 pdgIdString=
"Particle";
275 "%s of " + pdgIdString +
"s"
284 "%s of " + pdgIdString +
"s monpath"
306 std::vector<std::string> HltHistTitle;
340 HltHistTitle[
i]+
" %s (ALL)"
366 HltHistTitle[
i]+
" %s (RECO matched)"
393 HltHistTitle[
i]+
" %s (RECO matched, monpath)"
419 HltHistTitle[
i]+
" %s (reco)"
446 histTitle = HltHistTitle[
i]+
" isolation vs #eta (all)";
452 histTitle = HltHistTitle[
i]+
" isolation vs Et (all)";
458 histTitle = HltHistTitle[
i]+
" isolation vs #phi (all)";
468 histTitle = HltHistTitle[
i]+
" isolation vs #eta (reco matched)";
474 histTitle = HltHistTitle[
i]+
" isolation vs Et (reco matched)";
480 histTitle = HltHistTitle[
i]+
" isolation vs #phi (reco matched)";
491 histTitle = HltHistTitle[
i]+
" isolation vs #eta (reco)";
497 histTitle = HltHistTitle[
i]+
" isolation vs Et (reco)";
503 histTitle = HltHistTitle[
i]+
" isolation vs #phi (reco)";
532 bool plotMonpath =
false;
533 bool plotReco =
true;
543 if (recoObjects->size() < (
unsigned int)
recocut_) {
547 }
else if (
pdgGen == 22) {
552 if (recoObjectsEB->size() + recoObjectsEE->size() < (
unsigned int)
recocut_) {
576 unsigned int triggerIndex;
580 bool isFired =
false;
581 if (triggerIndex < HLTR->
size()){
582 isFired = HLTR->accept(triggerIndex);
591 edm::LogWarning(
"EmDQMReco") <<
"RAW-type HLT results not found, skipping event";
631 std::vector<reco::Particle> sortedReco;
632 if (plotReco ==
true) {
635 reco::Particle tmpcand( recopart->charge(), recopart->p4(), recopart->vertex(),recopart->pdgId(),recopart->status() );
636 sortedReco.push_back(tmpcand);
640 for(std::vector<reco::SuperCluster>::const_iterator recopart2 = recoObjectsEB->begin(); recopart2 != recoObjectsEB->end();recopart2++){
641 float en = recopart2->
energy();
642 float er =
sqrt(
pow(recopart2->x(),2) +
pow(recopart2->y(),2) +
pow(recopart2->z(),2) );
643 float px = recopart2->energy()*recopart2->x()/er;
644 float py = recopart2->energy()*recopart2->y()/er;
645 float pz = recopart2->energy()*recopart2->z()/er;
648 sortedReco.push_back(tmpcand);
650 for(std::vector<reco::SuperCluster>::const_iterator recopart2 = recoObjectsEE->begin(); recopart2 != recoObjectsEE->end();recopart2++){
651 float en = recopart2->energy();
652 float er =
sqrt(
pow(recopart2->x(),2) +
pow(recopart2->y(),2) +
pow(recopart2->z(),2) );
653 float px = recopart2->energy()*recopart2->x()/er;
654 float py = recopart2->energy()*recopart2->y()/er;
655 float pz = recopart2->energy()*recopart2->z()/er;
658 sortedReco.push_back(tmpcand);
668 sortedReco.erase(sortedReco.begin()+
recocut_,sortedReco.end());
717 throw(
cms::Exception(
"Release Validation Error") <<
"HLT output type not implemented: theHLTOutputTypes[n]" );
729 std::vector<edm::Ref<T> > recoecalcands;
741 std::vector<edm::Ref<T> > isocands;
743 if (isocands.size()>0)
745 for (
unsigned int i=0;
i < isocands.size();
i++)
746 recoecalcands.push_back(isocands[
i]);
751 if (recoecalcands.size() < 1){
756 if (recoecalcands.size() >=
dqm->
reqNum )
764 for (
unsigned int j=0;
j<recoecalcands.size();
j++){
765 if(!( recoecalcands.at(
j).isAvailable())){
777 for (
unsigned int i=0;
i<recoecalcands.size();
i++) {
792 if (mapi!=depMap->end()){
794 dqm->
ethistiso[n+1]->Fill(recoecalcands[i]->et() ,mapi->val);
807 if (plotReco ==
true) {
812 float closestRecoDeltaR = 1000.;
813 int closestRecoEcalCandIndex = -1;
814 for (
unsigned int j=0;
j<recoecalcands.size();
j++) {
815 float deltaR =
DeltaR(recoecalcands[
j]->momentum(),currentRecoParticleMomentum);
817 if (deltaR < closestRecoDeltaR) {
818 closestRecoDeltaR =
deltaR;
819 closestRecoEcalCandIndex =
j;
825 if ( closestRecoEcalCandIndex >= 0 ) {
840 if (mapi!=depMap->end()) {
855 unsigned int mtachedRecoParts = 0;
856 float minrecodist=0.3;
857 if(n==0) minrecodist=0.5;
860 bool matchThis=
false;
862 unsigned int closest = 0;
863 double closestDr = 1000.;
864 for(
unsigned int trigOb = 0 ; trigOb < recoecalcands.size(); trigOb++){
865 double dr =
DeltaR(recoecalcands[trigOb]->momentum(),candDir);
866 if (dr < closestDr) {
870 if (closestDr > minrecodist) {
877 if ( !matchThis )
continue;
902 if (mapi!=depMapReco->end()){
void fill(const math::XYZTLorentzVector &momentum)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
boost::ptr_vector< FourVectorMonitorElements > standardHist
std::vector< std::vector< edm::InputTag > > isoNames
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
void analyze(const edm::Event &event, const edm::EventSetup &)
double energy() const
energy
HistoFillerReco< reco::RecoEcalCandidateCollection > * histoFillerPho
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
HistoFillerReco< reco::ElectronCollection > * histoFillerEle
bool getByToken(EDGetToken token, Handle< PROD > &result) const
boost::ptr_vector< FourVectorMonitorElements > histMatchReco
#define DEFINE_FWK_MODULE(type)
std::vector< MonitorElement * > histEtIsoOfHltObjMatchToReco
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
EmDQMReco(const edm::ParameterSet &pset)
Constructor.
std::vector< int > theHLTOutputTypes
void fillHistos(edm::Handle< trigger::TriggerEventWithRefs > &triggerObj, const edm::Event &iEvent, unsigned int n, std::vector< reco::Particle > &sortedReco, bool plotReco, bool plotMonpath)
string format
Some error handling for the usage.
edm::EDGetTokenT< std::vector< reco::SuperCluster > > recoObjectsEET
std::vector< MonitorElement * > phiHistIso
std::vector< MonitorElement * > histEtaIsoOfHltObjMatchToReco
std::vector< TPRegexp > filters
bool isHltConfigInitialized_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
HLTConfigProvider hltConfig_
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
void beginRun(const edm::Run &, const edm::EventSetup &)
boost::ptr_vector< FourVectorMonitorElements > histMatchRecoMonPath
GreaterByPt< reco::Particle > pTComparator_
std::vector< std::string > theHLTCollectionHumanNames
unsigned int numOfHLTCollectionLabels
HistoFillerReco< l1extra::L1EmParticleCollection > * histoFillerL1Iso
MonitorElement * totalreco
MonitorElement * etaMonitorElement
edm::EDGetTokenT< std::vector< reco::SuperCluster > > recoObjectsEBT
MonitorElement * totalmatchreco
FourVectorMonitorElements(EmDQMReco *_parent, const std::string &histogramNameTemplate, const std::string &histogramTitleTemplate)
void setVerbose(unsigned level)
std::vector< MonitorElement * > ethistisomatchreco
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
std::string triggerNameRecoMonPath
std::vector< bool > plotiso
edm::EDGetTokenT< reco::GsfElectronCollection > recoElectronsInput
bool useHumanReadableHistTitles
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerObjT
double deltaR(double eta1, double eta2, double phi1, double phi2)
HistoFillerReco< l1extra::L1EmParticleCollection > * histoFillerL1NonIso
MonitorElement * phiMonitorElement
boost::scoped_ptr< FourVectorMonitorElements > histRecoMonpath
std::vector< MonitorElement * > etahistiso
boost::scoped_ptr< FourVectorMonitorElements > histMonpath
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
std::vector< MonitorElement * > etahistisomatchreco
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
std::vector< std::pair< double, double > > plotBounds
std::vector< edm::EDGetTokenT< edm::AssociationMap< edm::OneToValue< T, float > > > > isoNameTokens_
std::vector< edm::InputTag > theHLTCollectionLabels
math::XYZTLorentzVector LorentzVector
Lorentz vector.
MonitorElement * etMonitorElement
edm::EDGetTokenT< edm::TriggerResults > hltResultsT
boost::ptr_vector< FourVectorMonitorElements > histHltObjMatchToReco
std::vector< MonitorElement * > ethistiso
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
std::string processNameRecoMonPath
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
boost::scoped_ptr< FourVectorMonitorElements > histReco
tuple size
Write out results.
std::vector< MonitorElement * > phiHistIsoMatchReco
Power< A, B >::type pow(const A &a, const B &b)
void setCurrentFolder(const std::string &fullpath)
std::vector< MonitorElement * > histPhiIsoOfHltObjMatchToReco
HistoFillerReco< reco::RecoEcalCandidateCollection > * histoFillerClu