CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
IsolatedPixelTrackCandidateProducer Class Reference

#include <IsolatedPixelTrackCandidateProducer.h>

Inheritance diagram for IsolatedPixelTrackCandidateProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginJob ()
 
virtual void beginRun (edm::Run &, const edm::EventSetup &)
 
double getDistInCM (double eta1, double phi1, double eta2, double phi2)
 
std::pair< double, double > GetEtaPhiAtEcal (const edm::EventSetup &iSetup, double etaIP, double phiIP, double pT, int charge, double vtxZ)
 
 IsolatedPixelTrackCandidateProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &evt, const edm::EventSetup &es)
 
 ~IsolatedPixelTrackCandidateProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

std::string bfield_
 
double ebEtaBoundary_
 
edm::InputTag hltGTseedlabel_
 
edm::InputTag l1eTauJetsSource_
 
double maxPForIsolationValue_
 
double minPTrackValue_
 
edm::ParameterSet parameters
 
double pixelIsolationConeSizeAtEC_
 
std::vector< edm::InputTagpixelTracksSources_
 
double prelimCone_
 
double rEB_
 
double tauAssocCone_
 
double tauUnbiasCone_
 
edm::InputTag vertexLabel_
 
double vtxCutIsol_
 
double vtxCutSeed_
 
double zEE_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 24 of file IsolatedPixelTrackCandidateProducer.h.

Constructor & Destructor Documentation

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

Definition at line 57 of file IsolatedPixelTrackCandidateProducer.cc.

References bfield_, ebEtaBoundary_, edm::ParameterSet::getParameter(), hltGTseedlabel_, l1eTauJetsSource_, maxPForIsolationValue_, minPTrackValue_, pixelIsolationConeSizeAtEC_, pixelTracksSources_, prelimCone_, rEB_, tauAssocCone_, tauUnbiasCone_, vertexLabel_, vtxCutIsol_, vtxCutSeed_, and zEE_.

57  {
58 
59  l1eTauJetsSource_ = config.getParameter<edm::InputTag>("L1eTauJetsSource");
60  tauAssocCone_ = config.getParameter<double>("tauAssociationCone");
61  tauUnbiasCone_ = config.getParameter<double>("tauUnbiasCone");
62  pixelTracksSources_ = config.getParameter<std::vector<edm::InputTag> >("PixelTracksSources");
63  prelimCone_ = config.getParameter<double>("ExtrapolationConeSize");
64  pixelIsolationConeSizeAtEC_ = config.getParameter<double>("PixelIsolationConeSizeAtEC");
65  hltGTseedlabel_ = config.getParameter<edm::InputTag>("L1GTSeedLabel");
66  vtxCutSeed_ = config.getParameter<double>("MaxVtxDXYSeed");
67  vtxCutIsol_ = config.getParameter<double>("MaxVtxDXYIsol");
68  vertexLabel_ = config.getParameter<edm::InputTag>("VertexLabel");
69  bfield_ = config.getParameter<std::string>("MagFieldRecordName");
70  minPTrackValue_ = config.getParameter<double>("minPTrack");
71  maxPForIsolationValue_ = config.getParameter<double>("maxPTrackForIsolation");
72  ebEtaBoundary_ = config.getParameter<double>("EBEtaBoundary");
73  rEB_ = zEE_ = -1;
74 
75  // Register the product
76  produces< reco::IsolatedPixelTrackCandidateCollection >();
77 }
tuple config
Definition: cmsDriver.py:17
IsolatedPixelTrackCandidateProducer::~IsolatedPixelTrackCandidateProducer ( )

Definition at line 79 of file IsolatedPixelTrackCandidateProducer.cc.

79  {
80 
81 }

Member Function Documentation

void IsolatedPixelTrackCandidateProducer::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 83 of file IsolatedPixelTrackCandidateProducer.cc.

83 {}
void IsolatedPixelTrackCandidateProducer::beginRun ( edm::Run run,
const edm::EventSetup theEventSetup 
)
virtual

Reimplemented from edm::EDProducer.

Definition at line 85 of file IsolatedPixelTrackCandidateProducer.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, edm::EventSetup::get(), rEB_, and zEE_.

86 {
87 
89  theEventSetup.get<CaloGeometryRecord>().get(pG);
90 
91  const double rad (dynamic_cast<const EcalBarrelGeometry*>( pG->getSubdetectorGeometry(DetId::Ecal, EcalBarrel ))->avgRadiusXYFrontFaceCenter() ) ;
92 
93  const double zz (dynamic_cast<const EcalEndcapGeometry*>( pG->getSubdetectorGeometry(DetId::Ecal, EcalEndcap ))->avgAbsZFrontFaceCenter() ) ;
94 
95  rEB_=rad;
96  zEE_=zz;
97 
98 }
const T & get() const
Definition: EventSetup.h:55
double IsolatedPixelTrackCandidateProducer::getDistInCM ( double  eta1,
double  phi1,
double  eta2,
double  phi2 
)

Definition at line 268 of file IsolatedPixelTrackCandidateProducer.cc.

References angle(), funct::cos(), funct::exp(), funct::sin(), and funct::tan().

Referenced by produce().

269 {
270  double Rec;
271  double theta1=2*atan(exp(-eta1));
272  double theta2=2*atan(exp(-eta2));
273  if (fabs(eta1)<1.479) Rec=129; //radius of ECAL barrel
274  else if (fabs(eta1)>1.479&&fabs(eta1)<7.0) Rec=tan(theta1)*317; //distance from IP to ECAL endcap
275  else return 1000;
276 
277  //|vect| times tg of acos(scalar product)
278  double angle=acos((sin(theta1)*sin(theta2)*(sin(phi1)*sin(phi2)+cos(phi1)*cos(phi2))+cos(theta1)*cos(theta2)));
279  if (angle<acos(-1)/2) return fabs((Rec/sin(theta1))*tan(angle));
280  else return 1000;
281 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.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 ( const edm::EventSetup iSetup,
double  etaIP,
double  phiIP,
double  pT,
int  charge,
double  vtxZ 
)

Definition at line 285 of file IsolatedPixelTrackCandidateProducer.cc.

References alpha, SQLiteEnsembleGenerator_cfg::BField, DeDxDiscriminatorTools::charge(), Geom::deltaPhi(), ebEtaBoundary_, funct::exp(), edm::EventSetup::get(), VolumeBasedMagneticField::inTesla(), funct::log(), PV3DBase< T, PVType, FrameType >::mag(), rEB_, funct::sin(), funct::tan(), theta(), z, and zEE_.

Referenced by produce().

286 {
288  iSetup.get<IdealMagneticFieldRecord>().get(vbfField);
289  const VolumeBasedMagneticField* vbfCPtr = dynamic_cast<const VolumeBasedMagneticField*>(&(*vbfField));
290  GlobalVector BField=vbfCPtr->inTesla(GlobalPoint(0,0,0));
291  //test
292  //int curvSgn=int(BField.z()/fabs(BField.z()));
293 
294  double bfVal=BField.mag();
295 
296  double deltaPhi=0;
297  double etaEC = 100;
298  double phiEC = 100;
299 
300  double Rcurv = 9999999;
301  if (bfVal!=0) Rcurv=pT*33.3*100/(bfVal*10); //r(m)=pT(GeV)*33.3/B(kG)
302 
303  double ecDist = zEE_; //distance to ECAL andcap from IP (cm), 317 - ecal (not preshower), preshower -300
304  double ecRad = rEB_; //radius of ECAL barrel (cm)
305  double theta=2*atan(exp(-etaIP));
306  double zNew=0;
307  if (theta>0.5*acos(-1)) theta=acos(-1)-theta;
308  if (fabs(etaIP)<ebEtaBoundary_)
309  {
310  if ((0.5*ecRad/Rcurv)>1)
311  {
312  etaEC=10000;
313  deltaPhi=0;
314  }
315  else
316  {
317  deltaPhi =-charge*asin(0.5*ecRad/Rcurv);
318  double alpha1 = 2*asin(0.5*ecRad/Rcurv);
319  double z = ecRad/tan(theta);
320  if (etaIP>0) zNew = z*(Rcurv*alpha1)/ecRad+vtxZ; //new z-coordinate of track
321  else zNew =-z*(Rcurv*alpha1)/ecRad+vtxZ; //new z-coordinate of track
322  double zAbs=fabs(zNew);
323  if (zAbs<ecDist)
324  {
325  etaEC = -log(tan(0.5*atan(ecRad/zAbs)));
326  deltaPhi = -charge*asin(0.5*ecRad/Rcurv);
327  }
328  if (zAbs>ecDist)
329  {
330  zAbs = (fabs(etaIP)/etaIP)*ecDist;
331  double Zflight = fabs(zAbs-vtxZ);
332  double alpha = (Zflight*ecRad)/(z*Rcurv);
333  double Rec = 2*Rcurv*sin(alpha/2);
334  deltaPhi =-charge*alpha/2;
335  etaEC =-log(tan(0.5*atan(Rec/ecDist)));
336  }
337  }
338  }
339  else
340  {
341  zNew = (fabs(etaIP)/etaIP)*ecDist;
342  double Zflight = fabs(zNew-vtxZ);
343  double Rvirt = fabs(Zflight*tan(theta));
344  double Rec = 2*Rcurv*sin(Rvirt/(2*Rcurv));
345  deltaPhi =-(charge)*(Rvirt/(2*Rcurv));
346  etaEC =-log(tan(0.5*atan(Rec/ecDist)));
347  }
348 
349  if (zNew<0) etaEC=-etaEC;
350  phiEC = phiIP+deltaPhi;
351 
352  if (phiEC<-acos(-1)) phiEC = 2*acos(-1)+phiEC;
353  if (phiEC>acos(-1)) phiEC =-2*acos(-1)+phiEC;
354 
355  std::pair<double,double> retVal(etaEC,phiEC);
356  return retVal;
357 }
float alpha
Definition: AMPTWrapper.h:95
double deltaPhi(float phi1, float phi2)
Definition: VectorUtil.h:30
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Geom::Theta< T > theta() const
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
double charge(const std::vector< uint8_t > &Ampls)
T mag() const
Definition: PV3DBase.h:61
Definition: DDAxes.h:10
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
GlobalVector inTesla(const GlobalPoint &g) const
Field value ad specified global point, in Tesla.
Log< T >::type log(const T &t)
Definition: Log.h:22
const T & get() const
Definition: EventSetup.h:55
void IsolatedPixelTrackCandidateProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 100 of file IsolatedPixelTrackCandidateProducer.cc.

References DeDxDiscriminatorTools::charge(), deltaR(), eta(), edm::Event::getByLabel(), getDistInCM(), GetEtaPhiAtEcal(), hltGTseedlabel_, l1eTauJetsSource_, maxPForIsolationValue_, minPTrackValue_, L1TEmulatorMonitor_cff::p, phi, pixelIsolationConeSizeAtEC_, pixelTracksSources_, prelimCone_, ExpressReco_HICollisions_FallBack::pt, edm::Event::put(), dttmaxenums::R, tauAssocCone_, tauUnbiasCone_, ExpressReco_HICollisions_FallBack::trackCollection, trigger::TriggerL1CenJet, trigger::TriggerL1ForJet, trigger::TriggerL1TauJet, vertexLabel_, vtxCutIsol_, and vtxCutSeed_.

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

100  {
101 
103 
104  //create vector of refs from input collections
105  std::vector<reco::TrackRef> pixelTrackRefs;
106 
107  for (unsigned int iPix=0; iPix<pixelTracksSources_.size(); iPix++)
108  {
110  theEvent.getByLabel(pixelTracksSources_[iPix],iPixCol);
111  for (reco::TrackCollection::const_iterator pit=iPixCol->begin(); pit!=iPixCol->end(); pit++)
112  {
113  pixelTrackRefs.push_back(reco::TrackRef(iPixCol,pit-iPixCol->begin()));
114  }
115  }
116 
118  theEvent.getByLabel(l1eTauJetsSource_,l1eTauJets);
119 
121  theEvent.getByLabel(vertexLabel_,pVert);
122 
123  double ptTriggered = -10;
124  double etaTriggered = -100;
125  double phiTriggered = -100;
126 
128  theEvent.getByLabel(hltGTseedlabel_, l1trigobj);
129 
130  std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1tauobjref;
131  std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1jetobjref;
132  std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1forjetobjref;
133 
134  l1trigobj->getObjects(trigger::TriggerL1TauJet, l1tauobjref);
135  l1trigobj->getObjects(trigger::TriggerL1CenJet, l1jetobjref);
136  l1trigobj->getObjects(trigger::TriggerL1ForJet, l1forjetobjref);
137 
138  for (unsigned int p=0; p<l1tauobjref.size(); p++)
139  {
140  if (l1tauobjref[p]->pt()>ptTriggered)
141  {
142  ptTriggered = l1tauobjref[p]->pt();
143  phiTriggered = l1tauobjref[p]->phi();
144  etaTriggered = l1tauobjref[p]->eta();
145  }
146  }
147  for (unsigned int p=0; p<l1jetobjref.size(); p++)
148  {
149  if (l1jetobjref[p]->pt()>ptTriggered)
150  {
151  ptTriggered = l1jetobjref[p]->pt();
152  phiTriggered = l1jetobjref[p]->phi();
153  etaTriggered = l1jetobjref[p]->eta();
154  }
155  }
156  for (unsigned int p=0; p<l1forjetobjref.size(); p++)
157  {
158  if (l1forjetobjref[p]->pt()>ptTriggered)
159  {
160  ptTriggered=l1forjetobjref[p]->pt();
161  phiTriggered=l1forjetobjref[p]->phi();
162  etaTriggered=l1forjetobjref[p]->eta();
163  }
164  }
165 
166  double minPTrack_ = minPTrackValue_;
167  double drMaxL1Track_ = tauAssocCone_;
168 
169  int ntr = 0;
170 
171  //loop to select isolated tracks
172  for (unsigned iSeed=0; iSeed<pixelTrackRefs.size(); iSeed++)
173  {
174  if(pixelTrackRefs[iSeed]->p()<minPTrack_) continue;
175 
176  bool good = false;
177  bool vtxMatch = false;
178 
179  //associate to vertex (in Z)
180  reco::VertexCollection::const_iterator vitSel;
181  double minDZ = 100;
182  for (reco::VertexCollection::const_iterator vit=pVert->begin(); vit!=pVert->end(); vit++)
183  {
184  if (fabs(pixelTrackRefs[iSeed]->dz(vit->position()))<minDZ)
185  {
186  minDZ = fabs(pixelTrackRefs[iSeed]->dz(vit->position()));
187  vitSel = vit;
188  }
189  }
190  //cut on dYX:
191  if (minDZ!=100&&fabs(pixelTrackRefs[iSeed]->dxy(vitSel->position()))<vtxCutSeed_) vtxMatch=true;
192  if (minDZ==100) vtxMatch=true;
193 
194  //select tracks not matched to triggered L1 jet
195  double R=deltaR(etaTriggered, phiTriggered, pixelTrackRefs[iSeed]->eta(), pixelTrackRefs[iSeed]->phi());
196  if (R<tauUnbiasCone_) continue;
197 
198  //check taujet matching
199  bool tmatch=false;
200  l1extra::L1JetParticleCollection::const_iterator selj;
201  for (l1extra::L1JetParticleCollection::const_iterator tj=l1eTauJets->begin(); tj!=l1eTauJets->end(); tj++)
202  {
203  if(ROOT::Math::VectorUtil::DeltaR(pixelTrackRefs[iSeed]->momentum(),tj->momentum()) > drMaxL1Track_) continue;
204  selj = tj;
205  tmatch = true;
206  } //loop over L1 tau
207 
208  //propagate seed track to ECAL surface:
209  std::pair<double,double> seedCooAtEC;
210  // in case vertex is found:
211  if (minDZ!=100) seedCooAtEC=GetEtaPhiAtEcal(theEventSetup, pixelTrackRefs[iSeed]->eta(), pixelTrackRefs[iSeed]->phi(), pixelTrackRefs[iSeed]->pt(), pixelTrackRefs[iSeed]->charge(), vitSel->z());
212  //in case vertex is not found:
213  else seedCooAtEC=GetEtaPhiAtEcal(theEventSetup, pixelTrackRefs[iSeed]->eta(), pixelTrackRefs[iSeed]->phi(), pixelTrackRefs[iSeed]->pt(), pixelTrackRefs[iSeed]->charge(), 0);
214 
215  //calculate isolation
216  double maxP = 0;
217  double sumP = 0;
218  for (unsigned iSurr=0; iSurr<pixelTrackRefs.size(); iSurr++)
219  {
220  if(iSeed==iSurr) continue;
221  //define preliminary cone around seed track impact point from which tracks will be extrapolated:
222  if (deltaR(seedCooAtEC.first, seedCooAtEC.second, pixelTrackRefs[iSurr]->eta(), pixelTrackRefs[iSurr]->phi())>prelimCone_) continue;
223  //associate to vertex (in Z):
224  double minDZ2=100;
225  reco::VertexCollection::const_iterator vitSel2;
226  for (reco::VertexCollection::const_iterator vit=pVert->begin(); vit!=pVert->end(); vit++)
227  {
228  if (fabs(pixelTrackRefs[iSurr]->dz(vit->position()))<minDZ2)
229  {
230  minDZ2 = fabs(pixelTrackRefs[iSurr]->dz(vit->position()));
231  vitSel2 = vit;
232  }
233  }
234  //cut ot dXY:
235  if (minDZ2!=100&&fabs(pixelTrackRefs[iSurr]->dxy(vitSel2->position()))>vtxCutIsol_) continue;
236  //propagate to ECAL surface:
237  std::pair<double,double> cooAtEC;
238  // in case vertex is found:
239  if (minDZ2!=100) cooAtEC=GetEtaPhiAtEcal(theEventSetup, pixelTrackRefs[iSurr]->eta(), pixelTrackRefs[iSurr]->phi(), pixelTrackRefs[iSurr]->pt(), pixelTrackRefs[iSurr]->charge(), vitSel2->z());
240  // in case vertex is not found:
241  else cooAtEC=GetEtaPhiAtEcal(theEventSetup, pixelTrackRefs[iSurr]->eta(), pixelTrackRefs[iSurr]->phi(), pixelTrackRefs[iSurr]->pt(), pixelTrackRefs[iSurr]->charge(), 0);
242 
243  //calculate distance at ECAL surface and update isolation:
244  if (getDistInCM(seedCooAtEC.first, seedCooAtEC.second, cooAtEC.first, cooAtEC.second)<pixelIsolationConeSizeAtEC_)
245  {
246  sumP+=pixelTrackRefs[iSurr]->p();
247  if(pixelTrackRefs[iSurr]->p()>maxP) maxP=pixelTrackRefs[iSurr]->p();
248  }
249  }
250 
251  if (tmatch||vtxMatch) good=true;
252 
253  if (good&&maxP<maxPForIsolationValue_)
254  {
255  reco::IsolatedPixelTrackCandidate newCandidate(pixelTrackRefs[iSeed], l1extra::L1JetParticleRef(l1eTauJets,selj-l1eTauJets->begin()), maxP, sumP);
256  trackCollection->push_back(newCandidate);
257  ntr++;
258  }
259  }//loop over pixel tracks
260 
261  // put the product in the event
262  std::auto_ptr< reco::IsolatedPixelTrackCandidateCollection > outCollection(trackCollection);
263  theEvent.put(outCollection);
264 
265 }
double charge(const std::vector< uint8_t > &Ampls)
T eta() const
std::pair< double, double > GetEtaPhiAtEcal(const edm::EventSetup &iSetup, double etaIP, double phiIP, double pT, int charge, double vtxZ)
std::vector< IsolatedPixelTrackCandidate > IsolatedPixelTrackCandidateCollection
collectin of IsolatedPixelTrackCandidate objects
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
double getDistInCM(double eta1, double phi1, double eta2, double phi2)
Definition: DDAxes.h:10

Member Data Documentation

std::string IsolatedPixelTrackCandidateProducer::bfield_
private
double IsolatedPixelTrackCandidateProducer::ebEtaBoundary_
private
edm::InputTag IsolatedPixelTrackCandidateProducer::hltGTseedlabel_
private
edm::InputTag IsolatedPixelTrackCandidateProducer::l1eTauJetsSource_
private
double IsolatedPixelTrackCandidateProducer::maxPForIsolationValue_
private
double IsolatedPixelTrackCandidateProducer::minPTrackValue_
private
edm::ParameterSet IsolatedPixelTrackCandidateProducer::parameters
private
double IsolatedPixelTrackCandidateProducer::pixelIsolationConeSizeAtEC_
private
std::vector<edm::InputTag> IsolatedPixelTrackCandidateProducer::pixelTracksSources_
private
double IsolatedPixelTrackCandidateProducer::prelimCone_
private
double IsolatedPixelTrackCandidateProducer::rEB_
private
double IsolatedPixelTrackCandidateProducer::tauAssocCone_
private
double IsolatedPixelTrackCandidateProducer::tauUnbiasCone_
private
edm::InputTag IsolatedPixelTrackCandidateProducer::vertexLabel_
private
double IsolatedPixelTrackCandidateProducer::vtxCutIsol_
private
double IsolatedPixelTrackCandidateProducer::vtxCutSeed_
private
double IsolatedPixelTrackCandidateProducer::zEE_
private