21 #include "Math/GenVector/VectorUtil.h" 22 #include "Math/GenVector/PxPyPzE4D.h" 43 tok_hlt_( consumes<
trigger::TriggerFilterObjectWithRefs>(config.getParameter<
edm::InputTag>(
"L1GTSeedLabel")) ),
47 config.getParameter<
std::vector<
edm::InputTag> >(
"PixelTracksSources"),
48 [this](
edm::InputTag const &
tag){
return consumes<reco::TrackCollection>(
tag);}) ),
64 produces< reco::IsolatedPixelTrackCandidateCollection >();
71 std::vector<edm::InputTag> tracksrc = {
edm::InputTag(
"hltPixelTracks")};
73 desc.
add<
double>(
"tauAssociationCone", 0.0 );
74 desc.
add<
double>(
"tauUnbiasCone", 1.2 );
75 desc.
add<std::vector<edm::InputTag> >(
"PixelTracksSources",tracksrc);
76 desc.
add<
double>(
"ExtrapolationConeSize", 1.0);
77 desc.
add<
double>(
"PixelIsolationConeSizeAtEC",40);
79 desc.
add<
double>(
"MaxVtxDXYSeed", 101.0);
80 desc.
add<
double>(
"MaxVtxDXYIsol", 101.0);
82 desc.
add<
std::string>(
"MagFieldRecordName",
"VolumeBasedMagneticField");
83 desc.
add<
double>(
"minPTrack", 5.0);
84 desc.
add<
double>(
"maxPTrackForIsolation", 3.0);
85 desc.
add<
double>(
"EBEtaBoundary", 1.479);
86 descriptions.
add(
"isolPixelTrackProdL1T",desc);
111 auto trackCollection = std::make_unique<reco::IsolatedPixelTrackCandidateCollection>();
114 std::vector<reco::TrackRef> pixelTrackRefs;
116 for (
unsigned int iPix=0; iPix<
toks_pix_.size(); iPix++) {
119 for (reco::TrackCollection::const_iterator pit=iPixCol->begin(); pit!=iPixCol->end(); pit++) {
120 pixelTrackRefs.push_back(
reco::TrackRef(iPixCol,pit-iPixCol->begin()));
130 double ptTriggered = -10;
131 double etaTriggered = -100;
132 double phiTriggered = -100;
137 std::vector< edm::Ref<l1t::TauBxCollection> > l1tauobjref;
138 std::vector< edm::Ref<l1t::JetBxCollection> > l1jetobjref;
145 for (
auto p : l1tauobjref) {
146 if (
p->pt()>ptTriggered) {
147 ptTriggered =
p->pt();
148 phiTriggered =
p->phi();
149 etaTriggered =
p->eta();
152 for (
auto p : l1jetobjref) {
153 if (
p->pt()>ptTriggered) {
154 ptTriggered =
p->pt();
155 phiTriggered =
p->phi();
156 etaTriggered =
p->eta();
160 << l1jetobjref.size() <<
" Trig " << ptTriggered
161 <<
":" << etaTriggered <<
":" << phiTriggered
166 std::vector<seedAtEC> VecSeedsatEC;
168 for (
unsigned iS=0; iS<pixelTrackRefs.size(); iS++) {
169 bool vtxMatch =
false;
171 reco::VertexCollection::const_iterator vitSel;
174 for (reco::VertexCollection::const_iterator vit=pVert->begin(); vit!=pVert->end(); vit++) {
175 if (
std::abs(pixelTrackRefs[iS]->
dz(vit->position()))<minDZ) {
176 minDZ =
std::abs(pixelTrackRefs[iS]->
dz(vit->position()));
188 <<
":" << vtxMatch << std::endl;
192 pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi());
202 if (
reco::deltaR(pixelTrackRefs[iS]->momentum().
eta(), pixelTrackRefs[iS]->momentum().
phi(), tj->momentum().eta(), tj->momentum().phi()) > drMaxL1Track_)
continue;
209 std::pair<double,double> seedCooAtEC;
211 if (found) seedCooAtEC=
GetEtaPhiAtEcal(pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi(), pixelTrackRefs[iS]->
pt(), pixelTrackRefs[iS]->
charge(), vitSel->z());
213 else seedCooAtEC=
GetEtaPhiAtEcal(pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi(), pixelTrackRefs[iS]->
pt(), pixelTrackRefs[iS]->
charge(), 0);
214 seedAtEC seed(iS,(tmatch||vtxMatch),seedCooAtEC.first,seedCooAtEC.second);
215 VecSeedsatEC.push_back(seed);
217 << seedCooAtEC.second << std::endl;
219 for (
unsigned int i=0;
i<VecSeedsatEC.size();
i++) {
220 unsigned int iSeed = VecSeedsatEC[
i].index;
221 if (!VecSeedsatEC[
i].
ok)
continue;
225 if (
reco::deltaR(pixelTrackRefs[iSeed]->momentum().
eta(),pixelTrackRefs[iSeed]->momentum().
phi(),tj->momentum().eta(),tj->momentum().phi()) > drMaxL1Track_)
continue;
230 for(
unsigned int j=0; j<VecSeedsatEC.size(); j++) {
232 unsigned int iSurr = VecSeedsatEC[j].index;
237 reco::VertexCollection::const_iterator vitSel2;
238 for (reco::VertexCollection::const_iterator vit=pVert->begin(); vit!=pVert->end(); vit++) {
239 if (
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position()))<minDZ2) {
240 minDZ2 =
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position()));
249 sumP+=pixelTrackRefs[iSurr]->p();
250 if(pixelTrackRefs[iSurr]->
p()>maxP) maxP=pixelTrackRefs[iSurr]->p();
268 double theta1=2*atan(
exp(-eta1));
269 double theta2=2*atan(
exp(-eta2));
287 double Rcurv = 9999999;
290 double ecDist =
zEE_;
296 if ((0.5*ecRad/Rcurv)>1) {
300 deltaPhi =-charge*asin(0.5*ecRad/Rcurv);
301 double alpha1 = 2*asin(0.5*ecRad/Rcurv);
302 double z = ecRad/
tan(theta);
303 if (etaIP>0) zNew = z*(Rcurv*alpha1)/ecRad+vtxZ;
304 else zNew =-z*(Rcurv*alpha1)/ecRad+vtxZ;
307 etaEC = -
log(
tan(0.5*atan(ecRad/zAbs)));
308 deltaPhi = -charge*asin(0.5*ecRad/Rcurv);
311 zAbs = (
std::abs(etaIP)/etaIP)*ecDist;
312 double Zflight =
std::abs(zAbs-vtxZ);
313 double alpha = (Zflight*ecRad)/(z*Rcurv);
314 double Rec = 2*Rcurv*
sin(alpha/2);
315 deltaPhi =-charge*alpha/2;
316 etaEC =-
log(
tan(0.5*atan(Rec/ecDist)));
320 zNew = (
std::abs(etaIP)/etaIP)*ecDist;
321 double Zflight =
std::abs(zNew-vtxZ);
323 double Rec = 2*Rcurv*
sin(Rvirt/(2*Rcurv));
324 deltaPhi =-(
charge)*(Rvirt/(2*Rcurv));
325 etaEC =-
log(
tan(0.5*atan(Rec/ecDist)));
328 if (zNew<0) etaEC=-etaEC;
331 if (phiEC<-
M_PI) phiEC += M_2_PI;
332 if (phiEC>
M_PI) phiEC -= M_2_PI;
334 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
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:
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
IsolatedPixelTrackCandidateL1TProducer(const edm::ParameterSet &ps)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void beginRun(const edm::Run &, const edm::EventSetup &) override
GlobalVector inTesla(const GlobalPoint &g) const override
Field value ad specified global point, in Tesla.
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_
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)
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)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
const double tauAssocCone_
const double ebEtaBoundary_
~IsolatedPixelTrackCandidateL1TProducer() override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
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_