Go to the documentation of this file.00001
00012 #include "HLTrigger/special/interface/HLTPixlMBFilt.h"
00013
00014 #include "FWCore/Framework/interface/Event.h"
00015 #include "FWCore/Framework/interface/EventSetup.h"
00016 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00017
00018 #include "DataFormats/Common/interface/Handle.h"
00019
00020 #include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h"
00021 #include "DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h"
00022
00023 #include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"
00024
00025 #include "DataFormats/TrackReco/interface/Track.h"
00026 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00027
00028 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00029
00030
00031
00032
00033
00034 HLTPixlMBFilt::HLTPixlMBFilt(const edm::ParameterSet& iConfig) : HLTFilter(iConfig),
00035 pixlTag_ (iConfig.getParameter<edm::InputTag>("pixlTag")),
00036 min_Pt_ (iConfig.getParameter<double>("MinPt")),
00037 min_trks_ (iConfig.getParameter<unsigned int>("MinTrks")),
00038 min_sep_ (iConfig.getParameter<double>("MinSep"))
00039
00040 {
00041 LogDebug("") << "MinPt cut " << min_Pt_ << "pixl: " << pixlTag_.encode();
00042 LogDebug("") << "Requesting : " << min_trks_ << " tracks from same vertex ";
00043 LogDebug("") << "Requesting tracks from same vertex eta-phi separation by " << min_sep_;
00044 }
00045
00046 HLTPixlMBFilt::~HLTPixlMBFilt()
00047 {
00048 }
00049
00050
00051
00052
00053
00054
00055 bool HLTPixlMBFilt::hltFilter(edm::Event& iEvent, const edm::EventSetup& iSetup, trigger::TriggerFilterObjectWithRefs & filterproduct)
00056 {
00057 using namespace std;
00058 using namespace edm;
00059 using namespace reco;
00060 using namespace trigger;
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072 Handle<RecoChargedCandidateCollection> tracks;
00073
00074 iEvent.getByLabel(pixlTag_,tracks);
00075
00076
00077 int npixl_tot = 0;
00078 vector<double> etastore;
00079 vector<double> phistore;
00080 vector<int> itstore;
00081 bool accept;
00082 RecoChargedCandidateCollection::const_iterator apixl(tracks->begin());
00083 RecoChargedCandidateCollection::const_iterator epixl(tracks->end());
00084 RecoChargedCandidateCollection::const_iterator ipixl, jpixl;
00085 unsigned int nsame_vtx=0;
00086 int itrk = -1;
00087 if (tracks->size() >= min_trks_) {
00088 for (ipixl=apixl; ipixl!=epixl; ipixl++){
00089 itrk++;
00090 const double& ztrk1 = ipixl->vz();
00091 const double& etatrk1 = ipixl->momentum().eta();
00092 const double& phitrk1 = ipixl->momentum().phi();
00093 nsame_vtx=1;
00094 etastore.clear();
00095 phistore.clear();
00096 itstore.clear();
00097 etastore.push_back(etatrk1);
00098 phistore.push_back(phitrk1);
00099 itstore.push_back(itrk);
00100 if (fabs(ztrk1) < 15.0) {
00101
00102 int jtrk=-1;
00103 for (jpixl=apixl; jpixl!=epixl; jpixl++) {
00104 jtrk++;
00105 if (jpixl==ipixl) continue;
00106 const double& ztrk2 = jpixl->vz();
00107 const double& etatrk2 = jpixl->momentum().eta();
00108 const double& phitrk2 = jpixl->momentum().phi();
00109 double eta_dist=etatrk2-etatrk1;
00110 double phi_dist=phitrk2-phitrk1;
00111 double etaphi_dist=sqrt(eta_dist*eta_dist + phi_dist*phi_dist);
00112 if (fabs(ztrk2-ztrk1) < 1.0 && etaphi_dist > min_sep_) {
00113 if (min_trks_ <= 2 || itstore.size() <= 1) {
00114 etastore.push_back(etatrk2);
00115 phistore.push_back(phitrk2);
00116 itstore.push_back(jtrk);
00117 nsame_vtx++;
00118 } else {
00119
00120 LogDebug("") << "HLTPixlMBFilt: with mintrks=2 we should not be here...";
00121 bool isok = true;
00122 for (unsigned int k=1; k < itstore.size(); k++) {
00123 eta_dist=etatrk2-etastore.at(k);
00124 phi_dist=phitrk2-phistore.at(k);
00125 etaphi_dist=sqrt(eta_dist*eta_dist + phi_dist*phi_dist);
00126 if (etaphi_dist < min_sep_) {
00127 isok=false;
00128 break;
00129 }
00130 }
00131 if (isok) {
00132 etastore.push_back(etatrk2);
00133 phistore.push_back(phitrk2);
00134 itstore.push_back(jtrk);
00135 nsame_vtx++;
00136 }
00137 }
00138 }
00139 if (nsame_vtx >= min_trks_) break;
00140 }
00141 }
00142 npixl_tot++;
00143
00144 if (nsame_vtx >= min_trks_) break;
00145 }
00146
00147
00148
00149 accept = (nsame_vtx >= min_trks_ ) ;
00150
00151 } else {
00152 accept = false;
00153 }
00154
00155
00156
00157
00158 if (accept) {
00159 for (unsigned int ipos=0; ipos < itstore.size(); ipos++) {
00160 int iaddr=itstore.at(ipos);
00161 filterproduct.addObject(TriggerTrack,RecoChargedCandidateRef(tracks,iaddr));
00162 }
00163 }
00164
00165 LogDebug("") << "Number of pixel-track objects accepted:"
00166 << " " << npixl_tot;
00167
00168
00169 return accept;
00170
00171 }