CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
IsolatedPixelTrackCandidateProducer Class Reference

#include <IsolatedPixelTrackCandidateProducer.h>

Inheritance diagram for IsolatedPixelTrackCandidateProducer:
edm::stream::EDProducer<>

Classes

struct  seedAtEC
 

Public Member Functions

void beginRun (const edm::Run &, const edm::EventSetup &) override
 
double getDistInCM (double eta1, double phi1, double eta2, double phi2)
 
std::pair< double, double > GetEtaPhiAtEcal (double etaIP, double phiIP, double pT, int charge, double vtxZ)
 
 IsolatedPixelTrackCandidateProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &evt, const edm::EventSetup &es) override
 
 ~IsolatedPixelTrackCandidateProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Attributes

const std::string bfield_
 
double bfVal_
 
const double ebEtaBoundary_
 
const double maxPForIsolationValue_
 
const double minPTrackValue_
 
const double pixelIsolationConeSizeAtEC_
 
const double prelimCone_
 
double rEB_
 
const double tauAssocCone_
 
const double tauUnbiasCone_
 
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefstok_hlt_
 
const edm::EDGetTokenT< l1extra::L1JetParticleCollectiontok_l1_
 
const edm::EDGetTokenT< reco::VertexCollectiontok_vert_
 
const std::vector< edm::EDGetTokenT< reco::TrackCollection > > toks_pix_
 
const double vtxCutIsol_
 
const double vtxCutSeed_
 
double zEE_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 41 of file IsolatedPixelTrackCandidateProducer.h.

Constructor & Destructor Documentation

IsolatedPixelTrackCandidateProducer::IsolatedPixelTrackCandidateProducer ( const edm::ParameterSet ps)

Definition at line 42 of file IsolatedPixelTrackCandidateProducer.cc.

References bfield_, bfVal_, ebEtaBoundary_, maxPForIsolationValue_, minPTrackValue_, pixelIsolationConeSizeAtEC_, prelimCone_, rEB_, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, tauAssocCone_, tauUnbiasCone_, vtxCutIsol_, vtxCutSeed_, and zEE_.

42  :
43  tok_hlt_( consumes<trigger::TriggerFilterObjectWithRefs>(config.getParameter<edm::InputTag>("L1GTSeedLabel")) ),
44  tok_l1_( consumes<l1extra::L1JetParticleCollection>(config.getParameter<edm::InputTag>("L1eTauJetsSource")) ),
45  tok_vert_( consumes<reco::VertexCollection>(config.getParameter<edm::InputTag>("VertexLabel")) ),
47  config.getParameter<std::vector<edm::InputTag> >("PixelTracksSources"),
48  [this](edm::InputTag const & tag){return consumes<reco::TrackCollection>(tag);}) ),
49  bfield_( config.getParameter<std::string>("MagFieldRecordName") ),
50  prelimCone_( config.getParameter<double>("ExtrapolationConeSize") ),
51  pixelIsolationConeSizeAtEC_( config.getParameter<double>("PixelIsolationConeSizeAtEC") ),
52  vtxCutSeed_( config.getParameter<double>("MaxVtxDXYSeed") ),
53  vtxCutIsol_( config.getParameter<double>("MaxVtxDXYIsol") ),
54  tauAssocCone_( config.getParameter<double>("tauAssociationCone") ),
55  tauUnbiasCone_( config.getParameter<double>("tauUnbiasCone") ),
56  minPTrackValue_( config.getParameter<double>("minPTrack") ),
57  maxPForIsolationValue_( config.getParameter<double>("maxPTrackForIsolation") ),
58  ebEtaBoundary_( config.getParameter<double>("EBEtaBoundary") ),
59  rEB_( -1 ),
60  zEE_( -1 ),
61  bfVal_( 0 )
62 {
63  // Register the product
64  produces< reco::IsolatedPixelTrackCandidateCollection >();
65 }
const std::vector< edm::EDGetTokenT< reco::TrackCollection > > toks_pix_
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hlt_
const edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_l1_
Definition: config.py:1
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 >
Definition: transform.h:11
const edm::EDGetTokenT< reco::VertexCollection > tok_vert_
IsolatedPixelTrackCandidateProducer::~IsolatedPixelTrackCandidateProducer ( )
override

Definition at line 67 of file IsolatedPixelTrackCandidateProducer.cc.

67  {
68 
69 }

Member Function Documentation

void IsolatedPixelTrackCandidateProducer::beginRun ( const edm::Run run,
const edm::EventSetup theEventSetup 
)
override

Definition at line 71 of file IsolatedPixelTrackCandidateProducer.cc.

References g4SimHits_cfi::BField, bfVal_, DetId::Ecal, EcalBarrel, EcalEndcap, edm::EventSetup::get(), CaloGeometry::getSubdetectorGeometry(), VolumeBasedMagneticField::inTesla(), PV3DBase< T, PVType, FrameType >::mag(), rEB_, zEE_, and geometryCSVtoXML::zz.

71  {
72 
74  theEventSetup.get<CaloGeometryRecord>().get(pG);
75 
76  const double rad (dynamic_cast<const EcalBarrelGeometry*>( pG->getSubdetectorGeometry(DetId::Ecal, EcalBarrel ))->avgRadiusXYFrontFaceCenter() ) ;
77  const double zz (dynamic_cast<const EcalEndcapGeometry*>( pG->getSubdetectorGeometry(DetId::Ecal, EcalEndcap ))->avgAbsZFrontFaceCenter() ) ;
78 
79  rEB_ = rad;
80  zEE_ = zz;
81 
83  theEventSetup.get<IdealMagneticFieldRecord>().get(vbfField);
84  const VolumeBasedMagneticField* vbfCPtr = dynamic_cast<const VolumeBasedMagneticField*>(&(*vbfField));
85  GlobalVector BField = vbfCPtr->inTesla(GlobalPoint(0,0,0));
86  bfVal_=BField.mag();
87 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:44
GlobalVector inTesla(const GlobalPoint &g) const override
Field value ad specified global point, in Tesla.
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T mag() const
Definition: PV3DBase.h:67
const T & get() const
Definition: EventSetup.h:59
double IsolatedPixelTrackCandidateProducer::getDistInCM ( double  eta1,
double  phi1,
double  eta2,
double  phi2 
)

Definition at line 208 of file IsolatedPixelTrackCandidateProducer.cc.

References funct::abs(), angle(), funct::cos(), JetChargeProducer_cfi::exp, M_PI_2, rEB_, funct::sin(), funct::tan(), and zEE_.

Referenced by produce().

208  {
209  double Rec;
210  double theta1=2*atan(exp(-eta1));
211  double theta2=2*atan(exp(-eta2));
212  if (std::abs(eta1)<1.479) Rec=rEB_; //radius of ECAL barrel
213  else if (std::abs(eta1)>1.479&&std::abs(eta1)<7.0) Rec=tan(theta1)*zEE_; //distance from IP to ECAL endcap
214  else return 1000;
215 
216  //|vect| times tg of acos(scalar product)
217  double angle=acos((sin(theta1)*sin(theta2)*(sin(phi1)*sin(phi2)+cos(phi1)*cos(phi2))+cos(theta1)*cos(theta2)));
218  if (angle<M_PI_2) return std::abs((Rec/sin(theta1))*tan(angle));
219  else return 1000;
220 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
#define M_PI_2
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
std::pair< double, double > IsolatedPixelTrackCandidateProducer::GetEtaPhiAtEcal ( double  etaIP,
double  phiIP,
double  pT,
int  charge,
double  vtxZ 
)

Definition at line 223 of file IsolatedPixelTrackCandidateProducer.cc.

References funct::abs(), alpha, bfVal_, ALCARECOTkAlJpsiMuMu_cff::charge, hiPixelPairStep_cff::deltaPhi, ebEtaBoundary_, JetChargeProducer_cfi::exp, cmsBatch::log, M_PI, M_PI_2, rEB_, funct::sin(), funct::tan(), theta(), z, and zEE_.

Referenced by produce().

223  {
224 
225  double deltaPhi=0;
226  double etaEC = 100;
227  double phiEC = 100;
228 
229  double Rcurv = 9999999;
230  if (bfVal_!=0) Rcurv=pT*33.3*100/(bfVal_*10); //r(m)=pT(GeV)*33.3/B(kG)
231 
232  double ecDist = zEE_; //distance to ECAL andcap from IP (cm), 317 - ecal (not preshower), preshower -300
233  double ecRad = rEB_; //radius of ECAL barrel (cm)
234  double theta = 2*atan(exp(-etaIP));
235  double zNew = 0;
236  if (theta>M_PI_2) theta=M_PI-theta;
237  if (std::abs(etaIP)<ebEtaBoundary_) {
238  if ((0.5*ecRad/Rcurv)>1) {
239  etaEC = 10000;
240  deltaPhi = 0;
241  } else {
242  deltaPhi =-charge*asin(0.5*ecRad/Rcurv);
243  double alpha1 = 2*asin(0.5*ecRad/Rcurv);
244  double z = ecRad/tan(theta);
245  if (etaIP>0) zNew = z*(Rcurv*alpha1)/ecRad+vtxZ; //new z-coordinate of track
246  else zNew =-z*(Rcurv*alpha1)/ecRad+vtxZ; //new z-coordinate of track
247  double zAbs=std::abs(zNew);
248  if (zAbs<ecDist) {
249  etaEC = -log(tan(0.5*atan(ecRad/zAbs)));
250  deltaPhi = -charge*asin(0.5*ecRad/Rcurv);
251  }
252  if (zAbs>ecDist) {
253  zAbs = (std::abs(etaIP)/etaIP)*ecDist;
254  double Zflight = std::abs(zAbs-vtxZ);
255  double alpha = (Zflight*ecRad)/(z*Rcurv);
256  double Rec = 2*Rcurv*sin(alpha/2);
257  deltaPhi =-charge*alpha/2;
258  etaEC =-log(tan(0.5*atan(Rec/ecDist)));
259  }
260  }
261  } else {
262  zNew = (std::abs(etaIP)/etaIP)*ecDist;
263  double Zflight = std::abs(zNew-vtxZ);
264  double Rvirt = std::abs(Zflight*tan(theta));
265  double Rec = 2*Rcurv*sin(Rvirt/(2*Rcurv));
266  deltaPhi =-(charge)*(Rvirt/(2*Rcurv));
267  etaEC =-log(tan(0.5*atan(Rec/ecDist)));
268  }
269 
270  if (zNew<0) etaEC=-etaEC;
271  phiEC = phiIP+deltaPhi;
272 
273  if (phiEC<-M_PI) phiEC += M_2_PI;
274  if (phiEC>M_PI) phiEC -= M_2_PI;
275 
276  std::pair<double,double> retVal(etaEC,phiEC);
277  return retVal;
278 }
float alpha
Definition: AMPTWrapper.h:95
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
#define M_PI_2
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define M_PI
void IsolatedPixelTrackCandidateProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
override

Definition at line 89 of file IsolatedPixelTrackCandidateProducer.cc.

References funct::abs(), ALCARECOTkAlJpsiMuMu_cff::charge, reco::deltaR(), PVValHelper::dxy, PVValHelper::dz, PVValHelper::eta, runEdmFileComparison::found, edm::Event::getByToken(), getDistInCM(), GetEtaPhiAtEcal(), mps_fire::i, RecoMuonValidator_cfi::maxP, maxPForIsolationValue_, minPTrackValue_, eostools::move(), convertSQLiteXML::ok, AlCaHLTBitMon_ParallelJobs::p, phi, pixelIsolationConeSizeAtEC_, prelimCone_, EnergyCorrector::pt, edm::Event::put(), SurveyInfoScenario_cff::seed, reco::IsolatedPixelTrackCandidate::setEtaPhiEcal(), tauAssocCone_, tok_l1_, tok_vert_, toks_pix_, findElectronsInSiStrips_cfi::trackCollection, vtxCutIsol_, and vtxCutSeed_.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

89  {
90 
91  auto trackCollection = std::make_unique<reco::IsolatedPixelTrackCandidateCollection>();
92 
93  //create vector of refs from input collections
94  std::vector<reco::TrackRef> pixelTrackRefs;
95 #ifdef DebugLog
96  edm::LogInfo("HcalIsoTrack") << "IsolatedPixelTrakCandidate: with" << toks_pix_.size() << " candidates to start with\n";
97 #endif
98  for (unsigned int iPix=0; iPix<toks_pix_.size(); iPix++) {
100  theEvent.getByToken(toks_pix_[iPix],iPixCol);
101  for (reco::TrackCollection::const_iterator pit=iPixCol->begin(); pit!=iPixCol->end(); pit++) {
102  pixelTrackRefs.push_back(reco::TrackRef(iPixCol,pit-iPixCol->begin()));
103  }
104  }
105 
107  theEvent.getByToken(tok_l1_,l1eTauJets);
108 
110  theEvent.getByToken(tok_vert_,pVert);
111 
112  double drMaxL1Track_ = tauAssocCone_;
113 
114  int ntr = 0;
115  std::vector<seedAtEC> VecSeedsatEC;
116  //loop to select isolated tracks
117  for (unsigned iS=0; iS<pixelTrackRefs.size(); iS++) {
118  bool vtxMatch = false;
119  //associate to vertex (in Z)
120  reco::VertexCollection::const_iterator vitSel;
121  double minDZ = 1000;
122  bool found(false);
123  for (reco::VertexCollection::const_iterator vit=pVert->begin(); vit!=pVert->end(); vit++) {
124  if (std::abs(pixelTrackRefs[iS]->dz(vit->position()))<minDZ) {
125  minDZ = std::abs(pixelTrackRefs[iS]->dz(vit->position()));
126  vitSel = vit;
127  found = true;
128  }
129  }
130  //cut on dYX:
131  if (found) {
132  if(std::abs(pixelTrackRefs[iS]->dxy(vitSel->position()))<vtxCutSeed_) vtxMatch=true;
133  } else {
134  vtxMatch=true;
135  }
136 
137  //check taujet matching
138  bool tmatch=false;
139  l1extra::L1JetParticleCollection::const_iterator selj;
140  for (l1extra::L1JetParticleCollection::const_iterator tj=l1eTauJets->begin(); tj!=l1eTauJets->end(); tj++) {
141  if (reco::deltaR(pixelTrackRefs[iS]->momentum().eta(), pixelTrackRefs[iS]->momentum().phi(), tj->momentum().eta(), tj->momentum().phi()) > drMaxL1Track_) continue;
142  selj = tj;
143  tmatch = true;
144  } //loop over L1 tau
145 
146  //propagate seed track to ECAL surface:
147  std::pair<double,double> seedCooAtEC;
148  // in case vertex is found:
149  if (found) seedCooAtEC=GetEtaPhiAtEcal(pixelTrackRefs[iS]->eta(), pixelTrackRefs[iS]->phi(), pixelTrackRefs[iS]->pt(), pixelTrackRefs[iS]->charge(), vitSel->z());
150  //in case vertex is not found:
151  else seedCooAtEC=GetEtaPhiAtEcal(pixelTrackRefs[iS]->eta(), pixelTrackRefs[iS]->phi(), pixelTrackRefs[iS]->pt(), pixelTrackRefs[iS]->charge(), 0);
152  seedAtEC seed(iS,(tmatch||vtxMatch),seedCooAtEC.first,seedCooAtEC.second);
153  VecSeedsatEC.push_back(seed);
154  }
155 #ifdef DebugLog
156  edm::LogInfo("HcalIsoTrack") << "IsolatedPixelTrakCandidate: " << VecSeedsatEC.size() << " seeds after propagation\n";
157 #endif
158 
159  for (unsigned int i=0; i<VecSeedsatEC.size(); i++) {
160  unsigned int iSeed = VecSeedsatEC[i].index;
161  if (!VecSeedsatEC[i].ok) continue;
162  if(pixelTrackRefs[iSeed]->p()<minPTrackValue_) continue;
163  l1extra::L1JetParticleCollection::const_iterator selj;
164  for (l1extra::L1JetParticleCollection::const_iterator tj=l1eTauJets->begin(); tj!=l1eTauJets->end(); tj++) {
165  if (reco::deltaR(pixelTrackRefs[iSeed]->momentum().eta(),pixelTrackRefs[iSeed]->momentum().phi(),tj->momentum().eta(),tj->momentum().phi()) > drMaxL1Track_) continue;
166  selj = tj;
167  } //loop over L1 tau
168  double maxP = 0;
169  double sumP = 0;
170  for(unsigned int j=0; j<VecSeedsatEC.size(); j++) {
171  if (i==j) continue;
172  unsigned int iSurr = VecSeedsatEC[j].index;
173  //define preliminary cone around seed track impact point from which tracks will be extrapolated:
174  if (reco::deltaR(pixelTrackRefs[iSeed]->eta(), pixelTrackRefs[iSeed]->phi(), pixelTrackRefs[iSurr]->eta(), pixelTrackRefs[iSurr]->phi())>prelimCone_) continue;
175  double minDZ2(1000);
176  bool found(false);
177  reco::VertexCollection::const_iterator vitSel2;
178  for (reco::VertexCollection::const_iterator vit=pVert->begin(); vit!=pVert->end(); vit++) {
179  if (std::abs(pixelTrackRefs[iSurr]->dz(vit->position()))<minDZ2) {
180  minDZ2 = std::abs(pixelTrackRefs[iSurr]->dz(vit->position()));
181  vitSel2 = vit;
182  found = true;
183  }
184  }
185  //cut ot dXY:
186  if (found&&std::abs(pixelTrackRefs[iSurr]->dxy(vitSel2->position()))>vtxCutIsol_) continue;
187  //calculate distance at ECAL surface and update isolation:
188  if (getDistInCM(VecSeedsatEC[i].eta, VecSeedsatEC[i].phi, VecSeedsatEC[j].eta, VecSeedsatEC[j].phi)<pixelIsolationConeSizeAtEC_) {
189  sumP+=pixelTrackRefs[iSurr]->p();
190  if(pixelTrackRefs[iSurr]->p()>maxP) maxP=pixelTrackRefs[iSurr]->p();
191  }
192  }
193  if (maxP<maxPForIsolationValue_) {
194  reco::IsolatedPixelTrackCandidate newCandidate(pixelTrackRefs[iSeed], l1extra::L1JetParticleRef(l1eTauJets,selj-l1eTauJets->begin()), maxP, sumP);
195  newCandidate.setEtaPhiEcal(VecSeedsatEC[i].eta, VecSeedsatEC[i].phi);
196  trackCollection->push_back(newCandidate);
197  ntr++;
198  }
199  }
200  // put the product in the event
201  theEvent.put(std::move(trackCollection));
202 #ifdef DebugLog
203  edm::LogInfo("HcalIsoTrack") << "IsolatedPixelTrackCandidate: Final # of candiates " << ntr << "\n";
204 #endif
205 }
std::pair< double, double > GetEtaPhiAtEcal(double etaIP, double phiIP, double pT, int charge, double vtxZ)
const std::vector< edm::EDGetTokenT< reco::TrackCollection > > toks_pix_
const edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_l1_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
const edm::EDGetTokenT< reco::VertexCollection > tok_vert_
double getDistInCM(double eta1, double phi1, double eta2, double phi2)
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

const std::string IsolatedPixelTrackCandidateProducer::bfield_
private
double IsolatedPixelTrackCandidateProducer::bfVal_
private
const double IsolatedPixelTrackCandidateProducer::ebEtaBoundary_
private
const double IsolatedPixelTrackCandidateProducer::maxPForIsolationValue_
private
const double IsolatedPixelTrackCandidateProducer::minPTrackValue_
private
const double IsolatedPixelTrackCandidateProducer::pixelIsolationConeSizeAtEC_
private
const double IsolatedPixelTrackCandidateProducer::prelimCone_
private
double IsolatedPixelTrackCandidateProducer::rEB_
private
const double IsolatedPixelTrackCandidateProducer::tauAssocCone_
private
const double IsolatedPixelTrackCandidateProducer::tauUnbiasCone_
private
const edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs> IsolatedPixelTrackCandidateProducer::tok_hlt_
private

Definition at line 63 of file IsolatedPixelTrackCandidateProducer.h.

const edm::EDGetTokenT<l1extra::L1JetParticleCollection> IsolatedPixelTrackCandidateProducer::tok_l1_
private

Definition at line 64 of file IsolatedPixelTrackCandidateProducer.h.

Referenced by produce().

const edm::EDGetTokenT<reco::VertexCollection> IsolatedPixelTrackCandidateProducer::tok_vert_
private

Definition at line 65 of file IsolatedPixelTrackCandidateProducer.h.

Referenced by produce().

const std::vector<edm::EDGetTokenT<reco::TrackCollection> > IsolatedPixelTrackCandidateProducer::toks_pix_
private

Definition at line 66 of file IsolatedPixelTrackCandidateProducer.h.

Referenced by produce().

const double IsolatedPixelTrackCandidateProducer::vtxCutIsol_
private
const double IsolatedPixelTrackCandidateProducer::vtxCutSeed_
private
double IsolatedPixelTrackCandidateProducer::zEE_
private