20 #include "Math/GenVector/VectorUtil.h" 21 #include "Math/GenVector/PxPyPzE4D.h" 42 tok_hlt_( consumes<
trigger::TriggerFilterObjectWithRefs>(config.getParameter<
edm::InputTag>(
"L1GTSeedLabel")) ),
46 config.getParameter<
std::vector<
edm::InputTag> >(
"PixelTracksSources"),
47 [this](
edm::InputTag const &
tag){
return consumes<reco::TrackCollection>(
tag);}) ),
63 produces< reco::IsolatedPixelTrackCandidateCollection >();
92 auto trackCollection = std::make_unique<reco::IsolatedPixelTrackCandidateCollection>();
95 std::vector<reco::TrackRef> pixelTrackRefs;
97 for (
unsigned int iPix=0; iPix<
toks_pix_.size(); iPix++) {
100 for (reco::TrackCollection::const_iterator pit=iPixCol->begin(); pit!=iPixCol->end(); pit++) {
101 pixelTrackRefs.push_back(
reco::TrackRef(iPixCol,pit-iPixCol->begin()));
111 double ptTriggered = -10;
112 double etaTriggered = -100;
113 double phiTriggered = -100;
118 std::vector< edm::Ref<l1t::TauBxCollection> > l1tauobjref;
119 std::vector< edm::Ref<l1t::JetBxCollection> > l1jetobjref;
126 for (
auto p : l1tauobjref) {
127 if (
p->pt()>ptTriggered) {
128 ptTriggered =
p->pt();
129 phiTriggered =
p->phi();
130 etaTriggered =
p->eta();
133 for (
auto p : l1jetobjref) {
134 if (
p->pt()>ptTriggered) {
135 ptTriggered =
p->pt();
136 phiTriggered =
p->phi();
137 etaTriggered =
p->eta();
141 << l1jetobjref.size() <<
" Trig " << ptTriggered
142 <<
":" << etaTriggered <<
":" << phiTriggered
147 std::vector<seedAtEC> VecSeedsatEC;
149 for (
unsigned iS=0; iS<pixelTrackRefs.size(); iS++) {
150 bool vtxMatch =
false;
152 reco::VertexCollection::const_iterator vitSel;
155 for (reco::VertexCollection::const_iterator vit=pVert->begin(); vit!=pVert->end(); vit++) {
156 if (
std::abs(pixelTrackRefs[iS]->
dz(vit->position()))<minDZ) {
157 minDZ =
std::abs(pixelTrackRefs[iS]->
dz(vit->position()));
169 <<
":" << vtxMatch << std::endl;
173 pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi());
183 if (
reco::deltaR(pixelTrackRefs[iS]->momentum().
eta(), pixelTrackRefs[iS]->momentum().
phi(), tj->momentum().eta(), tj->momentum().phi()) > drMaxL1Track_)
continue;
190 std::pair<double,double> seedCooAtEC;
192 if (found) seedCooAtEC=
GetEtaPhiAtEcal(pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi(), pixelTrackRefs[iS]->
pt(), pixelTrackRefs[iS]->
charge(), vitSel->z());
194 else seedCooAtEC=
GetEtaPhiAtEcal(pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi(), pixelTrackRefs[iS]->
pt(), pixelTrackRefs[iS]->
charge(), 0);
195 seedAtEC seed(iS,(tmatch||vtxMatch),seedCooAtEC.first,seedCooAtEC.second);
196 VecSeedsatEC.push_back(seed);
198 << seedCooAtEC.second << std::endl;
200 for (
unsigned int i=0;
i<VecSeedsatEC.size();
i++) {
201 unsigned int iSeed = VecSeedsatEC[
i].index;
202 if (!VecSeedsatEC[
i].
ok)
continue;
206 if (
reco::deltaR(pixelTrackRefs[iSeed]->momentum().
eta(),pixelTrackRefs[iSeed]->momentum().
phi(),tj->momentum().eta(),tj->momentum().phi()) > drMaxL1Track_)
continue;
211 for(
unsigned int j=0; j<VecSeedsatEC.size(); j++) {
213 unsigned int iSurr = VecSeedsatEC[j].index;
218 reco::VertexCollection::const_iterator vitSel2;
219 for (reco::VertexCollection::const_iterator vit=pVert->begin(); vit!=pVert->end(); vit++) {
220 if (
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position()))<minDZ2) {
221 minDZ2 =
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position()));
230 sumP+=pixelTrackRefs[iSurr]->p();
231 if(pixelTrackRefs[iSurr]->
p()>maxP) maxP=pixelTrackRefs[iSurr]->p();
249 double theta1=2*atan(
exp(-eta1));
250 double theta2=2*atan(
exp(-eta2));
268 double Rcurv = 9999999;
271 double ecDist =
zEE_;
277 if ((0.5*ecRad/Rcurv)>1) {
281 deltaPhi =-charge*asin(0.5*ecRad/Rcurv);
282 double alpha1 = 2*asin(0.5*ecRad/Rcurv);
283 double z = ecRad/
tan(theta);
284 if (etaIP>0) zNew = z*(Rcurv*alpha1)/ecRad+vtxZ;
285 else zNew =-z*(Rcurv*alpha1)/ecRad+vtxZ;
288 etaEC = -
log(
tan(0.5*atan(ecRad/zAbs)));
289 deltaPhi = -charge*asin(0.5*ecRad/Rcurv);
292 zAbs = (
std::abs(etaIP)/etaIP)*ecDist;
293 double Zflight =
std::abs(zAbs-vtxZ);
294 double alpha = (Zflight*ecRad)/(z*Rcurv);
295 double Rec = 2*Rcurv*
sin(alpha/2);
296 deltaPhi =-charge*alpha/2;
297 etaEC =-
log(
tan(0.5*atan(Rec/ecDist)));
301 zNew = (
std::abs(etaIP)/etaIP)*ecDist;
302 double Zflight =
std::abs(zNew-vtxZ);
304 double Rec = 2*Rcurv*
sin(Rvirt/(2*Rcurv));
305 deltaPhi =-(
charge)*(Rvirt/(2*Rcurv));
306 etaEC =-
log(
tan(0.5*atan(Rec/ecDist)));
309 if (zNew<0) etaEC=-etaEC;
312 if (phiEC<-
M_PI) phiEC += M_2_PI;
313 if (phiEC>
M_PI) phiEC -= M_2_PI;
315 std::pair<double,double> retVal(etaEC,phiEC);
const_iterator end(int bx) const
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
virtual void produce(edm::Event &evt, const edm::EventSetup &es) override
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
IsolatedPixelTrackCandidateL1TProducer(const edm::ParameterSet &ps)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual void beginRun(const edm::Run &, const edm::EventSetup &) override
const double maxPForIsolationValue_
double getDistInCM(double eta1, double phi1, double eta2, double phi2)
const double pixelIsolationConeSizeAtEC_
Sin< T >::type sin(const T &t)
Global3DPoint GlobalPoint
Geom::Theta< T > theta() const
std::vector< Vertex > VertexCollection
collection of Vertex objects
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
const double minPTrackValue_
BXVector< Tau > TauBxCollection
const edm::EDGetTokenT< reco::VertexCollection > tok_vert_
~IsolatedPixelTrackCandidateL1TProducer()
const edm::EDGetTokenT< l1t::TauBxCollection > tok_l1_
Cos< T >::type cos(const T &t)
const std::vector< edm::EDGetTokenT< reco::TrackCollection > > toks_pix_
const double tauUnbiasCone_
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
void setEtaPhiEcal(double eta, double phi)
eta, phi at ECAL surface
std::pair< double, double > GetEtaPhiAtEcal(double etaIP, double phiIP, double pT, int charge, double vtxZ)
GlobalVector inTesla(const GlobalPoint &g) const
Field value ad specified global point, in Tesla.
const double tauAssocCone_
const double ebEtaBoundary_
const_iterator begin(int bx) const
const std::string bfield_
std::vector< Tau >::const_iterator const_iterator
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hlt_