33 #include <boost/format.hpp>
38 #include "TDirectory.h"
42 #include <Math/VectorUtil.h>
43 using namespace ROOT::Math::VectorUtil ;
49 const std::string &histogramNameTemplate,
50 const std::string &histogramTitleTemplate
56 std::string histTitle;
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() );
146 std::vector<edm::ParameterSet>
filters =
147 pset.
getParameter<std::vector<edm::ParameterSet> >(
"filters");
150 for(std::vector<edm::ParameterSet>::iterator filterconf = filters.begin() ; filterconf != filters.end() ; filterconf++)
158 std::vector<double> bounds = filterconf->getParameter<std::vector<double> >(
"PlotBounds");
160 assert(bounds.size() == 2);
161 plotBounds.push_back(std::pair<double,double>(bounds[0],bounds[1]));
162 isoNames.push_back(filterconf->getParameter<std::vector<edm::InputTag> >(
"IsoCollections"));
165 if (
isoNames.back().at(0).label()==
"none") {
185 bool isHltConfigChanged =
false;
209 std::string histName=
"total_eff";
210 std::string histTitle =
"total events passing";
218 histName=
"total_eff_RECO_matched";
219 histTitle=
"total events passing (Reco matched)";
220 totalmatchreco =
dbe->
book1D(histName.c_str(),histTitle.c_str(),numOfHLTCollectionLabels+2,0,numOfHLTCollectionLabels+2);
231 std::string pdgIdString;
234 pdgIdString=
"Electron";
break;
236 pdgIdString=
"Photon";
break;
238 pdgIdString=
"Particle";
248 "%s of " + pdgIdString +
"s"
257 "%s of " + pdgIdString +
"s monpath"
279 std::vector<std::string> HltHistTitle;
313 HltHistTitle[
i]+
" %s (ALL)"
339 HltHistTitle[
i]+
" %s (RECO matched)"
366 HltHistTitle[
i]+
" %s (RECO matched, monpath)"
392 HltHistTitle[
i]+
" %s (reco)"
419 histTitle = HltHistTitle[
i]+
" isolation vs #eta (all)";
425 histTitle = HltHistTitle[
i]+
" isolation vs Et (all)";
431 histTitle = HltHistTitle[
i]+
" isolation vs #phi (all)";
441 histTitle = HltHistTitle[
i]+
" isolation vs #eta (reco matched)";
447 histTitle = HltHistTitle[
i]+
" isolation vs Et (reco matched)";
453 histTitle = HltHistTitle[
i]+
" isolation vs #phi (reco matched)";
464 histTitle = HltHistTitle[
i]+
" isolation vs #eta (reco)";
470 histTitle = HltHistTitle[
i]+
" isolation vs Et (reco)";
476 histTitle = HltHistTitle[
i]+
" isolation vs #phi (reco)";
505 bool plotMonpath =
false;
506 bool plotReco =
true;
516 if (recoObjects->size() < (
unsigned int)
recocut_) {
520 }
else if (
pdgGen == 22) {
522 event.getByLabel(
"correctedHybridSuperClusters", recoObjectsEB);
523 event.getByLabel(
"correctedMulti5x5SuperClustersWithPreshower", recoObjectsEE);
525 if (recoObjectsEB->size() + recoObjectsEE->size() < (
unsigned int)
recocut_) {
549 unsigned int triggerIndex;
553 bool isFired =
false;
554 if (triggerIndex < HLTR->
size()){
555 isFired = HLTR->accept(triggerIndex);
561 event.getByLabel(
"hltTriggerSummaryRAW",triggerObj);
563 edm::LogWarning(
"EmDQMReco") <<
"RAW-type HLT results not found, skipping event";
603 std::vector<reco::Particle> sortedReco;
604 if (plotReco ==
true) {
607 reco::Particle tmpcand( recopart->charge(), recopart->p4(), recopart->vertex(),recopart->pdgId(),recopart->status() );
608 sortedReco.push_back(tmpcand);
612 for(std::vector<reco::SuperCluster>::const_iterator recopart2 = recoObjectsEB->begin(); recopart2 != recoObjectsEB->end();recopart2++){
613 float en = recopart2->
energy();
614 float er =
sqrt(
pow(recopart2->x(),2) +
pow(recopart2->y(),2) +
pow(recopart2->z(),2) );
615 float px = recopart2->energy()*recopart2->x()/er;
616 float py = recopart2->energy()*recopart2->y()/er;
617 float pz = recopart2->energy()*recopart2->z()/er;
620 sortedReco.push_back(tmpcand);
622 for(std::vector<reco::SuperCluster>::const_iterator recopart2 = recoObjectsEE->begin(); recopart2 != recoObjectsEE->end();recopart2++){
623 float en = recopart2->energy();
624 float er =
sqrt(
pow(recopart2->x(),2) +
pow(recopart2->y(),2) +
pow(recopart2->z(),2) );
625 float px = recopart2->energy()*recopart2->x()/er;
626 float py = recopart2->energy()*recopart2->y()/er;
627 float pz = recopart2->energy()*recopart2->z()/er;
630 sortedReco.push_back(tmpcand);
640 sortedReco.erase(sortedReco.begin()+
recocut_,sortedReco.end());
674 fillHistos<l1extra::L1EmParticleCollection>(triggerObj,
event,
n, sortedReco, plotReco, plotMonpath);
break;
676 fillHistos<l1extra::L1EmParticleCollection>(triggerObj,
event,
n, sortedReco, plotReco, plotMonpath);
break;
678 fillHistos<reco::RecoEcalCandidateCollection>(triggerObj,
event,
n, sortedReco, plotReco, plotMonpath);
break;
680 fillHistos<reco::ElectronCollection>(triggerObj,
event,
n, sortedReco, plotReco, plotMonpath);
break;
682 fillHistos<reco::RecoEcalCandidateCollection>(triggerObj,
event,
n, sortedReco, plotReco, plotMonpath);
break;
684 throw(
cms::Exception(
"Release Validation Error") <<
"HLT output type not implemented: theHLTOutputTypes[n]" );
696 std::vector<edm::Ref<T> > recoecalcands;
708 std::vector<edm::Ref<T> > isocands;
710 if (isocands.size()>0)
712 for (
unsigned int i=0;
i < isocands.size();
i++)
713 recoecalcands.push_back(isocands[
i]);
718 if (recoecalcands.size() < 1){
723 if (recoecalcands.size() >=
reqNum )
731 for (
unsigned int j=0;
j<recoecalcands.size();
j++){
732 if(!( recoecalcands.at(
j).isAvailable())){
733 edm::LogError(
"EmDQMReco") <<
"Event content inconsistent: TriggerEventWithRefs contains invalid Refs" << std::endl <<
"invalid refs for: " <<
theHLTCollectionLabels[
n].label();
744 for (
unsigned int i=0;
i<recoecalcands.size();
i++) {
754 for (
unsigned int j = 0 ;
j <
isoNames[n+1].size() ;
j++ ){
759 if (mapi!=depMap->end()){
761 ethistiso[n+1]->Fill(recoecalcands[i]->et() ,mapi->val);
774 if (plotReco ==
true) {
779 float closestRecoDeltaR = 1000.;
780 int closestRecoEcalCandIndex = -1;
781 for (
unsigned int j=0;
j<recoecalcands.size();
j++) {
782 float deltaR =
DeltaR(recoecalcands[
j]->momentum(),currentRecoParticleMomentum);
784 if (deltaR < closestRecoDeltaR) {
785 closestRecoDeltaR =
deltaR;
786 closestRecoEcalCandIndex =
j;
792 if ( closestRecoEcalCandIndex >= 0 ) {
802 for (
unsigned int j = 0 ;
j <
isoNames[n+1].size() ;
j++ ){
807 if (mapi!=depMap->end()) {
822 unsigned int mtachedRecoParts = 0;
823 float minrecodist=0.3;
824 if(n==0) minrecodist=0.5;
827 bool matchThis=
false;
829 unsigned int closest = 0;
830 double closestDr = 1000.;
831 for(
unsigned int trigOb = 0 ; trigOb < recoecalcands.size(); trigOb++){
832 double dr =
DeltaR(recoecalcands[trigOb]->momentum(),candDir);
833 if (dr < closestDr) {
837 if (closestDr > minrecodist) {
844 if ( !matchThis )
continue;
864 for (
unsigned int j = 0 ;
j <
isoNames[n+1].size() ;
j++ ){
869 if (mapi!=depMapReco->end()){
880 if (mtachedRecoParts >=
reqNum )
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
double energy() const
energy
void analyze(const edm::Event &event, const edm::EventSetup &)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
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
std::vector< MonitorElement * > phiHistIso
std::vector< MonitorElement * > histEtaIsoOfHltObjMatchToReco
std::vector< TPRegexp > filters
bool isHltConfigInitialized_
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
MonitorElement * totalreco
MonitorElement * etaMonitorElement
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
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
std::string triggerNameRecoMonPath
std::vector< bool > plotiso
bool useHumanReadableHistTitles
double deltaR(double eta1, double eta2, double phi1, double phi2)
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)
std::vector< std::pair< double, double > > plotBounds
std::vector< edm::InputTag > theHLTCollectionLabels
math::XYZTLorentzVector LorentzVector
Lorentz vector.
void fillHistos(edm::Handle< trigger::TriggerEventWithRefs > &, const edm::Event &, unsigned int, std::vector< reco::Particle > &, bool, bool)
MonitorElement * etMonitorElement
edm::InputTag recoElectronsInputTag
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