39 trigobjectsToken_(consumes<
trigger::TriggerEvent>(iConfig.getParameter<
edm::
InputTag> (
"triggerobjects"))),
40 HLTFilter_(iConfig.getParameter<vector<
string> >(
"HLTFilter")),
41 HLTPath_(iConfig.getParameter<vector<
string> >(
"HLTPath"))
101 using namespace std;
using namespace edm;
using namespace reco;
108 for (
unsigned int ip=0; ip<HLTPath.size(); ip++){
109 int N_Triggers = trigResults->
size();
111 for(
int i_Trig = 0; i_Trig < N_Triggers; ++i_Trig ) {
112 if (!trigResults->
accept(i_Trig))
continue;
114 if (TrigPath.find(HLTPath[ip]) != std::string::npos) fire=
true;
121 using namespace std;
using namespace edm;
using namespace reco;
128 std::vector<std::array<float,5>> max_per_trigger;
130 for (
unsigned int ipath=0; ipath<Seed.size(); ipath++){
131 std::vector<std::array<float, 5>> tot_tr_obj_pt_eta_phi;
132 if (!triggerObjectsSummary.
isValid())
continue;
133 size_t filterIndex = (*triggerObjectsSummary).filterIndex(
InputTag(Seed[ipath],
"",
"HLT"));
135 if (filterIndex < (*triggerObjectsSummary).sizeFilters()) {
137 for (
size_t j = 0; j < keys.size(); j++) {
139 std::array<float, 5> tr_obj_pt_eta_phi;
140 if (fabs(foundObject.
id())!=13)
continue;
141 tr_obj_pt_eta_phi[0]=foundObject.
pt();
142 tr_obj_pt_eta_phi[1]=foundObject.
eta();
143 tr_obj_pt_eta_phi[2]=foundObject.
phi();
144 tr_obj_pt_eta_phi[3]=foundObject.
id()/fabs(foundObject.
id());
145 tot_tr_obj_pt_eta_phi.push_back(tr_obj_pt_eta_phi);
149 if (!tot_tr_obj_pt_eta_phi.empty()){
150 std::sort(tot_tr_obj_pt_eta_phi.begin(),tot_tr_obj_pt_eta_phi.end(),
151 [](
const std::array<float, 5>&
a,
const std::array<float, 5>&
b) {
154 max_per_trigger.push_back(tot_tr_obj_pt_eta_phi.at(0)); }
158 std::sort( max_per_trigger.begin(), max_per_trigger.end(),
159 [](
const std::array<float,5>&
a,
const std::array<float,5>&
b) {
162 return max_per_trigger.at(0);
175 using namespace reco;
202 if (vertices->empty())
return false;
229 bool isFake =
vtx.isFake();
230 if (isFake)
continue;
248 if ( deltaRmu<MuTrgMatchCone && SelectedMu_DR>deltaRmu ){
253 bool tight=
false,soft=
false;
254 if(vertices.isValid()){
258 const Track * mutrack=
mu.bestTrack();
262 auto muTrack=std::make_shared<reco::Track>(*mutrack);
278 unsigned int count_el=-1;
282 if (!passConvVeto)
continue;
284 if ( seed.
isNull() )
continue;
287 const Track * eltrack= el.bestTrack();
290 auto ElTrack=std::make_shared<reco::Track>(*eltrack);
292 el_pt.push_back(eltrack->pt());
el_eta.push_back(eltrack->eta());
el_phi.push_back(eltrack->phi());
304 if(trk.charge()==0)
continue;
312 auto cleanTrack=std::make_shared<reco::Track>(trk);
322 TLorentzVector vel1,vel2;
323 std::vector<std::shared_ptr<reco::Track>> cleanedObjects;
326 for(
auto & vec:
MuTracks) cleanedObjects.push_back(vec);}
329 for(
auto & vec:
ElTracks) cleanedObjects.push_back(vec);}
331 if (cleanedObjects.empty())
334 for(
auto&
obj: cleanedObjects){
336 unsigned int iobj=&
obj-&cleanedObjects[0];
338 float massLep=0.0005;
339 if (
object_id.at(iobj)==13 ) massLep=0.105;
345 vel1.SetPtEtaPhiM(
obj->pt(),
obj->eta(),
obj->phi(),massLep);
348 unsigned int itrk2=&trk2-&cleanedTracks[0];
350 if (
obj->charge()*trk2->charge()==1)
continue;
352 vel2.SetPtEtaPhiM(trk2->pt(),trk2->eta(),trk2->phi(),massLep);
361 float InvMassLepLep=(vel1+vel2).M();
363 auto trantrk2=std::make_shared<reco::TransientTrack>(
reco::TransientTrack(*trk2,&(*bFieldHandle)));
364 std::vector<reco::TransientTrack> tempTracks;
365 tempTracks.reserve(2);
366 tempTracks.push_back(*tranobj); tempTracks.push_back(*trantrk2);
367 LLvertex = theKalmanFitter.
vertex(tempTracks);
368 if (!LLvertex.
isValid())
continue;
375 float tempCos=vperp.Dot(pperp)/(vperp.R()*pperp.R());
390 auto tranobj=std::make_shared<reco::TransientTrack>(
reco::TransientTrack(*objtrk,&(*bFieldHandle)));
391 auto tranpair=std::make_shared<reco::TransientTrack>(
reco::TransientTrack(*pairtrk,&(*bFieldHandle)));
393 float massLep=0.0005;
395 vel1.SetPtEtaPhiM(objtrk->pt(),objtrk->eta(),objtrk->phi(),massLep);
396 vel2.SetPtEtaPhiM(pairtrk->pt(),pairtrk->eta(),pairtrk->phi(),massLep);
399 if( trk->charge()==objtrk->charge() &&
deltaR(objtrk->eta(),objtrk->phi(),trk->eta(),trk->phi())<
TrkObjExclusionCone)
continue;
404 vK.SetPtEtaPhiM(trk->pt(),trk->eta(),trk->phi(),0.493);
406 float InvMass=(vel1+vel2+vK).M();
408 if ((vel1+vel2+vK).Pt()<
PtB_Cut)
continue;
409 auto trantrk=std::make_shared<reco::TransientTrack>(
reco::TransientTrack(*trk,&(*bFieldHandle)));
410 std::vector<reco::TransientTrack> tempTracks;
411 tempTracks.reserve(3);
412 tempTracks.push_back(*tranobj); tempTracks.push_back(*tranpair);
413 tempTracks.push_back(*trantrk);
414 LLvertex = theKalmanFitter.
vertex(tempTracks);
415 if (!LLvertex.
isValid())
continue;
421 float tempCos=vperp.Dot(pperp)/(vperp.R()*pperp.R());
GlobalError positionError() const
std::vector< float > muon_eta
T getParameter(std::string const &) const
double z0() const
z coordinate
std::vector< std::shared_ptr< reco::Track > > cleanedTracks
std::vector< unsigned int > object_id
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
bool filter(edm::Event &, const edm::EventSetup &) override
bool accept() const
Has at least one path accepted the event?
float totalChiSquared() const
edm::EDGetTokenT< reco::VertexCollection > vtxToken_
double TrkObjExclusionCone
edm::EDGetTokenT< edm::TriggerResults > trgresultsToken_
std::vector< std::shared_ptr< reco::Track > > cleanedPairTracks
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
std::vector< unsigned int > Epair_ObjectId
std::vector< string > HLTFilter_
std::vector< unsigned int > Epair_ObjectIndex
std::vector< std::shared_ptr< reco::Track > > MuTracks
std::vector< unsigned int > Epair_TrkIndex
Single trigger physics object (e.g., an isolated muon)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
reco::TrackBase::Point vertex_point
double dydz() const
dydz slope
std::vector< float > SelectedTrgObj_PtEtaPhiCharge
double eta() const
pseudorapidity of momentum vector
void addDefault(ParameterSetDescription const &psetDescription)
edm::EDGetToken electronsToken_
std::vector< float > el_pt
edm::EDGetTokenT< edm::ValueMap< float > > eleBWPToken_
std::vector< unsigned int > object_container
float degreesOfFreedom() const
const TriggerObjectCollection & getObjects() const
unsigned int size() const
Get number of paths stored.
GlobalPoint position() const
double pt() const
track transverse momentum
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
float ChiSquaredProbability(double chiSquared, double nrDOF)
std::vector< float > el_eta
bool isTightMuonCustom(const reco::Muon &recoMu, const reco::Vertex recoVtx)
std::vector< unsigned int > Trk_container
bool isMediumMuonCustom(const reco::Muon &recoMu)
std::vector< float > muon_medium
bool isSoftMuon(const reco::Muon &, const reco::Vertex &, bool run2016_hip_mitigation=false)
double ElTrgExclusionCone
edm::EDGetTokenT< trigger::TriggerEvent > trigobjectsToken_
bool isNull() const
Checks for null.
std::vector< std::shared_ptr< reco::Track > > cleanedObjTracks
double dxdz() const
dxdz slope
double deltaR(double eta1, double eta2, double phi1, double phi2)
std::vector< std::shared_ptr< reco::Track > > ElTracks
std::vector< float > muon_pt
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
double MuTrgExclusionCone
XYZVectorD XYZVector
spatial vector with cartesian internal representation
std::string const & triggerName(unsigned int index) const
edm::EDGetTokenT< reco::ConversionCollection > conversionsToken_
std::vector< size_type > Keys
T rerr(const GlobalPoint &aPoint) const
std::vector< float > el_phi
edm::EDGetToken muonsToken_
~LeptonSkimming() override
std::vector< float > muon_tight
bool hltFired(const edm::Event &iEvent, const edm::EventSetup &iSetup, std::vector< string > HLTPath)
bool ObjPtLargerThanTrack
std::vector< float > muon_soft
edm::EDGetTokenT< edm::ValueMap< float > > eleUnBWPToken_
std::vector< string > HLTPath_
std::vector< float > muon_phi
void beginStream(edm::StreamID) override
double y0() const
y coordinate
std::array< float, 5 > hltObject(const edm::Event &iEvent, const edm::EventSetup &iSetup, std::vector< string > Seed)
const Point & position() const
position
LeptonSkimming(const edm::ParameterSet &)
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
double x0() const
x coordinate
void endStream() override