33 #include <boost/format.hpp> 38 #include "TDirectory.h" 42 #include <Math/VectorUtil.h> 145 std::vector<edm::ParameterSet>
filters =
146 pset.
getParameter<std::vector<edm::ParameterSet> >(
"filters");
149 for(std::vector<edm::ParameterSet>::iterator filterconf = filters.begin() ; filterconf != filters.end() ; filterconf++)
157 std::vector<double> bounds = filterconf->getParameter<std::vector<double> >(
"PlotBounds");
159 assert(bounds.size() == 2);
160 plotBounds.push_back(std::pair<double,double>(bounds[0],bounds[1]));
161 isoNames.push_back(filterconf->getParameter<std::vector<edm::InputTag> >(
"IsoCollections"));
163 for (
unsigned int i=0; i<
isoNames.back().size(); i++) {
181 throw(
cms::Exception(
"Release Validation Error") <<
"HLT output type not implemented: theHLTOutputTypes[n]" );
187 if (
isoNames.back().at(0).label()==
"none") {
205 bool isHltConfigChanged =
false;
234 histName=
"total_eff_RECO_matched";
235 histTitle=
"total events passing (Reco matched)";
236 totalmatchreco = iBooker.
book1D(histName.c_str(),histTitle.c_str(),numOfHLTCollectionLabels+2,0,numOfHLTCollectionLabels+2);
250 pdgIdString=
"Electron";
break;
252 pdgIdString=
"Photon";
break;
254 pdgIdString=
"Particle";
264 "%s of " + pdgIdString +
"s" 273 "%s of " + pdgIdString +
"s monpath" 295 std::vector<std::string> HltHistTitle;
329 HltHistTitle[
i]+
" %s (ALL)" 355 HltHistTitle[
i]+
" %s (RECO matched)" 382 HltHistTitle[
i]+
" %s (RECO matched, monpath)" 408 HltHistTitle[
i]+
" %s (reco)" 435 histTitle = HltHistTitle[
i]+
" isolation vs #eta (all)";
441 histTitle = HltHistTitle[
i]+
" isolation vs Et (all)";
447 histTitle = HltHistTitle[
i]+
" isolation vs #phi (all)";
457 histTitle = HltHistTitle[
i]+
" isolation vs #eta (reco matched)";
463 histTitle = HltHistTitle[
i]+
" isolation vs Et (reco matched)";
469 histTitle = HltHistTitle[
i]+
" isolation vs #phi (reco matched)";
480 histTitle = HltHistTitle[
i]+
" isolation vs #eta (reco)";
486 histTitle = HltHistTitle[
i]+
" isolation vs Et (reco)";
492 histTitle = HltHistTitle[
i]+
" isolation vs #phi (reco)";
520 bool plotMonpath =
false;
521 bool plotReco =
true;
531 if (recoObjects->size() < (
unsigned int)
recocut_) {
535 }
else if (
pdgGen == 22) {
540 if (recoObjectsEB->size() + recoObjectsEE->size() < (
unsigned int)
recocut_) {
564 unsigned int triggerIndex;
568 bool isFired =
false;
569 if (triggerIndex < HLTR->
size()){
570 isFired = HLTR->
accept(triggerIndex);
579 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);
634 std::sort(sortedReco.begin(),sortedReco.end(),
pTComparator_ );
640 sortedReco.erase(sortedReco.begin()+
recocut_,sortedReco.end());
689 throw(
cms::Exception(
"Release Validation Error") <<
"HLT output type not implemented: theHLTOutputTypes[n]" );
701 std::vector<edm::Ref<T> > recoecalcands;
702 if ( ( triggerObj->
filterIndex(
dqm->theHLTCollectionLabels[n])>=triggerObj->
size() )){
713 std::vector<edm::Ref<T> > isocands;
715 if (isocands.size()>0)
717 for (
unsigned int i=0;
i < isocands.size();
i++)
718 recoecalcands.push_back(isocands[
i]);
723 if (recoecalcands.size() < 1){
728 if (recoecalcands.size() >=
dqm->reqNum )
729 dqm->totalreco->Fill(n+0.5);
736 for (
unsigned int j=0; j<recoecalcands.size(); j++){
737 if(!( recoecalcands.at(j).isAvailable())){
738 edm::LogError(
"EmDQMReco") <<
"Event content inconsistent: TriggerEventWithRefs contains invalid Refs" << std::endl <<
"invalid refs for: " <<
dqm->theHLTCollectionLabels[
n].label();
749 for (
unsigned int i=0;
i<recoecalcands.size();
i++) {
751 dqm->standardHist[
n].fill(recoecalcands[
i]->
p4());
757 if ( n+1 <
dqm->numOfHLTCollectionLabels ) {
758 if (
dqm->plotiso[n+1]) {
764 if (mapi!=depMap->end()){
765 dqm->etahistiso[n+1]->Fill(recoecalcands[i]->
eta(),mapi->val);
766 dqm->ethistiso[n+1]->Fill(recoecalcands[i]->
et() ,mapi->val);
767 dqm->phiHistIso[n+1]->Fill(recoecalcands[i]->
phi(),mapi->val);
779 if (plotReco ==
true) {
780 for (
unsigned int i=0;
i <
dqm->recocut_;
i++) {
784 float closestRecoDeltaR = 1000.;
785 int closestRecoEcalCandIndex = -1;
786 for (
unsigned int j=0; j<recoecalcands.size(); j++) {
787 float deltaR =
DeltaR(recoecalcands[j]->momentum(),currentRecoParticleMomentum);
789 if (deltaR < closestRecoDeltaR) {
790 closestRecoDeltaR =
deltaR;
791 closestRecoEcalCandIndex = j;
797 if ( closestRecoEcalCandIndex >= 0 ) {
802 dqm->histHltObjMatchToReco[
n].fill(recoecalcands[closestRecoEcalCandIndex]->
p4());
805 if (n+1 <
dqm->numOfHLTCollectionLabels){
806 if (
dqm->plotiso[n+1] ){
812 if (mapi!=depMap->end()) {
813 dqm->histEtaIsoOfHltObjMatchToReco[n+1]->Fill( recoecalcands[closestRecoEcalCandIndex]->
eta(),mapi->val);
814 dqm->histEtIsoOfHltObjMatchToReco[n+1] ->Fill( recoecalcands[closestRecoEcalCandIndex]->
et(), mapi->val);
815 dqm->histPhiIsoOfHltObjMatchToReco[n+1] ->Fill( recoecalcands[closestRecoEcalCandIndex]->
phi(), mapi->val);
827 unsigned int mtachedRecoParts = 0;
828 float minrecodist=0.3;
829 if(n==0) minrecodist=0.5;
830 for(
unsigned int i =0;
i <
dqm->recocut_;
i++){
832 bool matchThis=
false;
834 unsigned int closest = 0;
835 double closestDr = 1000.;
836 for(
unsigned int trigOb = 0 ; trigOb < recoecalcands.size(); trigOb++){
837 double dr =
DeltaR(recoecalcands[trigOb]->momentum(),candDir);
838 if (dr < closestDr) {
842 if (closestDr > minrecodist) {
849 if ( !matchThis )
continue;
854 dqm->histMatchReco[
n].fill(sortedReco[
i].
p4());
860 dqm->histMatchRecoMonPath[
n].fill(sortedReco[
i].
p4());
867 if (n+1 <
dqm->numOfHLTCollectionLabels){
868 if (
dqm->plotiso[n+1] ){
874 if (mapi!=depMapReco->end()){
875 dqm->etahistisomatchreco[n+1]->Fill(sortedReco[
i].
eta(),mapi->val);
876 dqm->ethistisomatchreco[n+1]->Fill(sortedReco[
i].
et(),mapi->val);
877 dqm->phiHistIsoMatchReco[n+1]->Fill(sortedReco[
i].
eta(),mapi->val);
885 if (mtachedRecoParts >=
dqm->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
double energy() const
energy
HistoFillerReco< reco::RecoEcalCandidateCollection > * histoFillerPho
HistoFillerReco< reco::ElectronCollection > * histoFillerEle
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
boost::ptr_vector< FourVectorMonitorElements > histMatchReco
#define DEFINE_FWK_MODULE(type)
bool accept() const
Has at least one path accepted the event?
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.
def setup(process, global_tag, zero_tesla=False)
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)
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_
FourVectorMonitorElements(EmDQMReco *_parent, DQMStore::IBooker &iBooker, const std::string &histogramNameTemplate, const std::string &histogramTitleTemplate)
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.
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 * book1D(Args &&...args)
void analyze(const edm::Event &event, const edm::EventSetup &) override
MonitorElement * totalmatchreco
format
Some error handling for the usage.
std::vector< MonitorElement * > ethistisomatchreco
std::string triggerNameRecoMonPath
std::vector< bool > plotiso
edm::EDGetTokenT< reco::GsfElectronCollection > recoElectronsInput
bool useHumanReadableHistTitles
size_type filterIndex(const edm::InputTag &filterTag) const
index from tag
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
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
std::vector< MonitorElement * > etahistisomatchreco
void getObjects(size_type filter, Vids &ids, VRphoton &photons) const
extract Ref<C>s for a specific filter and of specific physics type
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_
size_type size() const
number of filters
std::vector< edm::InputTag > theHLTCollectionLabels
et
define resolution functions of each parameter
math::XYZTLorentzVector LorentzVector
Lorentz vector.
MonitorElement * etMonitorElement
edm::EDGetTokenT< edm::TriggerResults > hltResultsT
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
boost::ptr_vector< FourVectorMonitorElements > histHltObjMatchToReco
std::vector< MonitorElement * > ethistiso
std::string processNameRecoMonPath
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
boost::scoped_ptr< FourVectorMonitorElements > histReco
std::vector< MonitorElement * > phiHistIsoMatchReco
Power< A, B >::type pow(const A &a, const B &b)
std::vector< MonitorElement * > histPhiIsoOfHltObjMatchToReco
HistoFillerReco< reco::RecoEcalCandidateCollection > * histoFillerClu