21 #include "Math/GenVector/VectorUtil.h" 22 #include "Math/GenVector/PxPyPzE4D.h" 44 tok_hlt_( consumes<
trigger::TriggerFilterObjectWithRefs>(config.getParameter<
edm::InputTag>(
"L1GTSeedLabel")) ),
48 config.getParameter<
std::vector<
edm::InputTag> >(
"PixelTracksSources"),
49 [this](
edm::InputTag const &
tag){
return consumes<reco::TrackCollection>(
tag);}) ),
65 produces< reco::IsolatedPixelTrackCandidateCollection >();
72 std::vector<edm::InputTag> tracksrc = {
edm::InputTag(
"hltPixelTracks")};
74 desc.
add<
double>(
"tauAssociationCone", 0.0 );
75 desc.
add<
double>(
"tauUnbiasCone", 1.2 );
76 desc.
add<std::vector<edm::InputTag> >(
"PixelTracksSources",tracksrc);
77 desc.
add<
double>(
"ExtrapolationConeSize", 1.0);
78 desc.
add<
double>(
"PixelIsolationConeSizeAtEC",40);
80 desc.
add<
double>(
"MaxVtxDXYSeed", 101.0);
81 desc.
add<
double>(
"MaxVtxDXYIsol", 101.0);
83 desc.
add<
std::string>(
"MagFieldRecordName",
"VolumeBasedMagneticField");
84 desc.
add<
double>(
"minPTrack", 5.0);
85 desc.
add<
double>(
"maxPTrackForIsolation", 3.0);
86 desc.
add<
double>(
"EBEtaBoundary", 1.479);
87 descriptions.
add(
"isolPixelTrackProd",desc);
110 auto trackCollection = std::make_unique<reco::IsolatedPixelTrackCandidateCollection>();
113 std::vector<reco::TrackRef> pixelTrackRefs;
115 edm::LogInfo(
"HcalIsoTrack") <<
"IsolatedPixelTrakCandidate: with" <<
toks_pix_.size() <<
" candidates to start with\n";
117 for (
unsigned int iPix=0; iPix<
toks_pix_.size(); iPix++) {
120 for (reco::TrackCollection::const_iterator pit=iPixCol->begin(); pit!=iPixCol->end(); pit++) {
121 pixelTrackRefs.push_back(
reco::TrackRef(iPixCol,pit-iPixCol->begin()));
134 std::vector<seedAtEC> VecSeedsatEC;
136 for (
unsigned iS=0; iS<pixelTrackRefs.size(); iS++) {
137 bool vtxMatch =
false;
139 reco::VertexCollection::const_iterator vitSel;
142 for (reco::VertexCollection::const_iterator vit=pVert->begin(); vit!=pVert->end(); vit++) {
143 if (
std::abs(pixelTrackRefs[iS]->
dz(vit->position()))<minDZ) {
144 minDZ =
std::abs(pixelTrackRefs[iS]->
dz(vit->position()));
158 l1extra::L1JetParticleCollection::const_iterator selj;
159 for (l1extra::L1JetParticleCollection::const_iterator tj=l1eTauJets->begin(); tj!=l1eTauJets->end(); tj++) {
160 if (
reco::deltaR(pixelTrackRefs[iS]->momentum().
eta(), pixelTrackRefs[iS]->momentum().
phi(), tj->momentum().eta(), tj->momentum().phi()) > drMaxL1Track_)
continue;
166 std::pair<double,double> seedCooAtEC;
168 if (found) seedCooAtEC=
GetEtaPhiAtEcal(pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi(), pixelTrackRefs[iS]->
pt(), pixelTrackRefs[iS]->
charge(), vitSel->z());
170 else seedCooAtEC=
GetEtaPhiAtEcal(pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi(), pixelTrackRefs[iS]->
pt(), pixelTrackRefs[iS]->
charge(), 0);
171 seedAtEC seed(iS,(tmatch||vtxMatch),seedCooAtEC.first,seedCooAtEC.second);
172 VecSeedsatEC.push_back(seed);
175 edm::LogInfo(
"HcalIsoTrack") <<
"IsolatedPixelTrakCandidate: " << VecSeedsatEC.size() <<
" seeds after propagation\n";
178 for (
unsigned int i=0;
i<VecSeedsatEC.size();
i++) {
179 unsigned int iSeed = VecSeedsatEC[
i].index;
180 if (!VecSeedsatEC[
i].
ok)
continue;
182 l1extra::L1JetParticleCollection::const_iterator selj;
183 for (l1extra::L1JetParticleCollection::const_iterator tj=l1eTauJets->begin(); tj!=l1eTauJets->end(); tj++) {
184 if (
reco::deltaR(pixelTrackRefs[iSeed]->momentum().
eta(),pixelTrackRefs[iSeed]->momentum().
phi(),tj->momentum().eta(),tj->momentum().phi()) > drMaxL1Track_)
continue;
189 for(
unsigned int j=0; j<VecSeedsatEC.size(); j++) {
191 unsigned int iSurr = VecSeedsatEC[j].index;
196 reco::VertexCollection::const_iterator vitSel2;
197 for (reco::VertexCollection::const_iterator vit=pVert->begin(); vit!=pVert->end(); vit++) {
198 if (
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position()))<minDZ2) {
199 minDZ2 =
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position()));
208 sumP+=pixelTrackRefs[iSurr]->p();
209 if(pixelTrackRefs[iSurr]->
p()>maxP) maxP=pixelTrackRefs[iSurr]->p();
222 edm::LogInfo(
"HcalIsoTrack") <<
"IsolatedPixelTrackCandidate: Final # of candiates " << ntr <<
"\n";
229 double theta1=2*atan(
exp(-eta1));
230 double theta2=2*atan(
exp(-eta2));
248 double Rcurv = 9999999;
251 double ecDist =
zEE_;
257 if ((0.5*ecRad/Rcurv)>1) {
261 deltaPhi =-charge*asin(0.5*ecRad/Rcurv);
262 double alpha1 = 2*asin(0.5*ecRad/Rcurv);
263 double z = ecRad/
tan(theta);
264 if (etaIP>0) zNew = z*(Rcurv*alpha1)/ecRad+vtxZ;
265 else zNew =-z*(Rcurv*alpha1)/ecRad+vtxZ;
268 etaEC = -
log(
tan(0.5*atan(ecRad/zAbs)));
269 deltaPhi = -charge*asin(0.5*ecRad/Rcurv);
272 zAbs = (
std::abs(etaIP)/etaIP)*ecDist;
273 double Zflight =
std::abs(zAbs-vtxZ);
274 double alpha = (Zflight*ecRad)/(z*Rcurv);
275 double Rec = 2*Rcurv*
sin(alpha/2);
276 deltaPhi =-charge*alpha/2;
277 etaEC =-
log(
tan(0.5*atan(Rec/ecDist)));
281 zNew = (
std::abs(etaIP)/etaIP)*ecDist;
282 double Zflight =
std::abs(zNew-vtxZ);
284 double Rec = 2*Rcurv*
sin(Rvirt/(2*Rcurv));
285 deltaPhi =-(
charge)*(Rvirt/(2*Rcurv));
286 etaEC =-
log(
tan(0.5*atan(Rec/ecDist)));
289 if (zNew<0) etaEC=-etaEC;
292 if (phiEC<-
M_PI) phiEC += M_2_PI;
293 if (phiEC>
M_PI) phiEC -= M_2_PI;
295 std::pair<double,double> retVal(etaEC,phiEC);
std::pair< double, double > GetEtaPhiAtEcal(double etaIP, double phiIP, double pT, int charge, double vtxZ)
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
const std::vector< edm::EDGetTokenT< reco::TrackCollection > > toks_pix_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const double ebEtaBoundary_
void beginRun(const edm::Run &, const edm::EventSetup &) override
const double tauUnbiasCone_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
GlobalVector inTesla(const GlobalPoint &g) const override
Field value ad specified global point, in Tesla.
const edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_l1_
Sin< T >::type sin(const T &t)
IsolatedPixelTrackCandidateProducer(const edm::ParameterSet &ps)
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 >
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const double tauAssocCone_
Cos< T >::type cos(const T &t)
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
ParameterDescriptionBase * add(U const &iLabel, T const &value)
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
const std::string bfield_
~IsolatedPixelTrackCandidateProducer() override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const edm::EDGetTokenT< reco::VertexCollection > tok_vert_
const double minPTrackValue_
const double pixelIsolationConeSizeAtEC_
const double maxPForIsolationValue_
double getDistInCM(double eta1, double phi1, double eta2, double phi2)
void produce(edm::Event &evt, const edm::EventSetup &es) override
T angle(T x1, T y1, T z1, T x2, T y2, T z2)