CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
L1TkElectronTrackProducer Class Reference
Inheritance diagram for L1TkElectronTrackProducer:
edm::stream::EDProducer<>

Public Types

typedef std::vector
< L1TTTrackType
L1TTTrackCollectionType
 
typedef TTTrack
< Ref_Phase2TrackerDigi_
L1TTTrackType
 
- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Public Member Functions

 L1TkElectronTrackProducer (const edm::ParameterSet &)
 
 ~L1TkElectronTrackProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

double getPtScaledCut (double pt, std::vector< double > &parameters)
 
float isolation (const edm::Handle< L1TTTrackCollectionType > &trkHandle, int match_index)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
bool selectMatchedTrack (double &d_r, double &d_phi, double &d_eta, double &tk_pt, float &eg_eta)
 

Private Attributes

float deltaZ_
 
std::vector< double > dEtaCutoff_
 
std::vector< double > dPhiCutoff_
 
std::vector< double > dRCutoff_
 
float dRMax_
 
float dRMin_
 
const edm::EDGetTokenT
< EGammaBxCollection
egToken_
 
float etMin_
 
const edm::ESGetToken
< TrackerGeometry,
TrackerDigiGeometryRecord
geomToken_
 
float isoCut_
 
std::string label
 
std::string matchType_
 
float maxChi2IsoTracks_
 
unsigned int minNStubsIsoTracks_
 
bool primaryVtxConstrain_
 
float pTMinTra_
 
bool relativeIsolation_
 
const edm::EDGetTokenT
< std::vector< TTTrack
< Ref_Phase2TrackerDigi_ > > > 
trackToken_
 
float trkQualityChi2_
 
float trkQualityPtMin_
 
bool useClusterET_
 
bool useTwoStubsPT_
 

Detailed Description

Definition at line 54 of file L1TkElectronTrackProducer.cc.

Member Typedef Documentation

Definition at line 57 of file L1TkElectronTrackProducer.cc.

Definition at line 56 of file L1TkElectronTrackProducer.cc.

Constructor & Destructor Documentation

L1TkElectronTrackProducer::L1TkElectronTrackProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 107 of file L1TkElectronTrackProducer.cc.

References deltaZ_, dEtaCutoff_, dPhiCutoff_, dRCutoff_, dRMax_, dRMin_, etMin_, edm::ParameterSet::getParameter(), isoCut_, label, matchType_, maxChi2IsoTracks_, minNStubsIsoTracks_, pTMinTra_, relativeIsolation_, AlCaHLTBitMon_QueryRunRegistry::string, trkQualityChi2_, trkQualityPtMin_, useClusterET_, and useTwoStubsPT_.

108  : egToken_(consumes<EGammaBxCollection>(iConfig.getParameter<edm::InputTag>("L1EGammaInputTag"))),
110  iConfig.getParameter<edm::InputTag>("L1TrackInputTag"))),
111  geomToken_(esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>()) {
112  // label of the collection produced
113  // e.g. EG or IsoEG if all objects are kept
114  // EGIsoTrk or IsoEGIsoTrk if only the EG or IsoEG
115  // objects that pass a cut RelIso < isoCut_ are written
116  // in the new collection.
117  label = iConfig.getParameter<std::string>("label");
118 
119  etMin_ = (float)iConfig.getParameter<double>("ETmin");
120 
121  // parameters for the calculation of the isolation :
122  pTMinTra_ = (float)iConfig.getParameter<double>("PTMINTRA");
123  dRMin_ = (float)iConfig.getParameter<double>("DRmin");
124  dRMax_ = (float)iConfig.getParameter<double>("DRmax");
125  deltaZ_ = (float)iConfig.getParameter<double>("DeltaZ");
126  maxChi2IsoTracks_ = iConfig.getParameter<double>("maxChi2IsoTracks");
127  minNStubsIsoTracks_ = iConfig.getParameter<int>("minNStubsIsoTracks");
128  // cut applied on the isolation (if this number is <= 0, no cut is applied)
129  isoCut_ = (float)iConfig.getParameter<double>("IsoCut");
130  relativeIsolation_ = iConfig.getParameter<bool>("RelativeIsolation");
131 
132  // parameters to select tracks to match with L1EG
133  trkQualityChi2_ = (float)iConfig.getParameter<double>("TrackChi2");
134  trkQualityPtMin_ = (float)iConfig.getParameter<double>("TrackMinPt");
135  useTwoStubsPT_ = iConfig.getParameter<bool>("useTwoStubsPT");
136  useClusterET_ = iConfig.getParameter<bool>("useClusterET");
137  dPhiCutoff_ = iConfig.getParameter<std::vector<double> >("TrackEGammaDeltaPhi");
138  dRCutoff_ = iConfig.getParameter<std::vector<double> >("TrackEGammaDeltaR");
139  dEtaCutoff_ = iConfig.getParameter<std::vector<double> >("TrackEGammaDeltaEta");
140  matchType_ = iConfig.getParameter<std::string>("TrackEGammaMatchType");
141 
142  produces<TkElectronCollection>(label);
143 }
const edm::EDGetTokenT< EGammaBxCollection > egToken_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
const edm::EDGetTokenT< std::vector< TTTrack< Ref_Phase2TrackerDigi_ > > > trackToken_
Class to store the L1 Track Trigger tracks.
Definition: TTTrack.h:29
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
L1TkElectronTrackProducer::~L1TkElectronTrackProducer ( )
override

Definition at line 145 of file L1TkElectronTrackProducer.cc.

145 {}

Member Function Documentation

void L1TkElectronTrackProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 290 of file L1TkElectronTrackProducer.cc.

References edm::ConfigurationDescriptions::addDefault(), submitPVResolutionJobs::desc, and edm::ParameterSetDescription::setUnknown().

290  {
291  //The following says we do not know what parameters are allowed so do no validation
292  // Please change this to state exactly what you do use, even if it is no parameters
294  desc.setUnknown();
295  descriptions.addDefault(desc);
296 }
void addDefault(ParameterSetDescription const &psetDescription)
double L1TkElectronTrackProducer::getPtScaledCut ( double  pt,
std::vector< double > &  parameters 
)
private

Definition at line 331 of file L1TkElectronTrackProducer.cc.

References funct::exp().

Referenced by selectMatchedTrack().

331  {
332  return (parameters[0] + parameters[1] * exp(parameters[2] * pt));
333 }
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
float L1TkElectronTrackProducer::isolation ( const edm::Handle< L1TTTrackCollectionType > &  trkHandle,
int  match_index 
)
private

Definition at line 298 of file L1TkElectronTrackProducer.cc.

References funct::abs(), reco::deltaPhi(), dRMax_, dRMin_, maxChi2IsoTracks_, minNStubsIsoTracks_, and pTMinTra_.

Referenced by produce().

298  {
299  edm::Ptr<L1TTTrackType> matchedTrkPtr(trkHandle, match_index);
300  L1TTTrackCollectionType::const_iterator trackIter;
301 
302  float sumPt = 0.0;
303  int itr = 0;
304 
305  float dRMin2 = dRMin_ * dRMin_;
306  float dRMax2 = dRMax_ * dRMax_;
307 
308  for (trackIter = trkHandle->begin(); trackIter != trkHandle->end(); ++trackIter) {
309  if (itr++ != match_index) {
310  if (trackIter->chi2() > maxChi2IsoTracks_ || trackIter->momentum().perp() <= pTMinTra_ ||
311  trackIter->getStubRefs().size() < minNStubsIsoTracks_) {
312  continue;
313  }
314 
315  float dZ = std::abs(trackIter->POCA().z() - matchedTrkPtr->POCA().z());
316 
317  float phi1 = trackIter->momentum().phi();
318  float phi2 = matchedTrkPtr->momentum().phi();
319  float dPhi = reco::deltaPhi(phi1, phi2);
320  float dEta = (trackIter->momentum().eta() - matchedTrkPtr->momentum().eta());
321  float dR2 = (dPhi * dPhi + dEta * dEta);
322 
323  if (dR2 > dRMin2 && dR2 < dRMax2 && dZ < deltaZ_ && trackIter->momentum().perp() > pTMinTra_) {
324  sumPt += trackIter->momentum().perp();
325  }
326  }
327  }
328 
329  return sumPt;
330 }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void L1TkElectronTrackProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 148 of file L1TkElectronTrackProducer.cc.

References BXVector< T >::begin(), L1TkElectronTrackMatchAlgo::doMatch(), L1TkElectronTrackMatchAlgo::doMatchClusterET(), egToken_, BXVector< T >::end(), etMin_, Exception, geomToken_, edm::Event::getByToken(), edm::EventSetup::getHandle(), isoCut_, isolation(), edm::HandleBase::isValid(), label, eostools::move(), edm::Handle< T >::product(), edm::ESHandle< class >::product(), pTFrom2Stubs::pTFrom2(), edm::Event::put(), relativeIsolation_, mps_fire::result, selectMatchedTrack(), l1t::TkElectron::setTrackCurvature(), trackToken_, trkQualityChi2_, trkQualityPtMin_, useClusterET_, and useTwoStubsPT_.

148  {
149  std::unique_ptr<TkElectronCollection> result(new TkElectronCollection);
150 
151  // geometry needed to call pTFrom2Stubs
153  const TrackerGeometry* tGeom = geomHandle.product();
154 
155  // the L1EGamma objects
156  edm::Handle<EGammaBxCollection> eGammaHandle;
157  iEvent.getByToken(egToken_, eGammaHandle);
158  EGammaBxCollection eGammaCollection = (*eGammaHandle.product());
160 
161  // the L1Tracks
162  edm::Handle<L1TTTrackCollectionType> L1TTTrackHandle;
163  iEvent.getByToken(trackToken_, L1TTTrackHandle);
164  L1TTTrackCollectionType::const_iterator trackIter;
165 
166  if (!eGammaHandle.isValid()) {
167  throw cms::Exception("L1TkElectronTrackProducer")
168  << "\nWarning: L1EmCollection not found in the event. Exit" << std::endl;
169  return;
170  }
171  if (!L1TTTrackHandle.isValid()) {
172  throw cms::Exception("TkEmProducer") << "\nWarning: L1TTTrackCollectionType not found in the event. Exit."
173  << std::endl;
174  return;
175  }
176 
177  int ieg = 0;
178  for (egIter = eGammaCollection.begin(0); egIter != eGammaCollection.end(0); ++egIter) { // considering BX = only
179  edm::Ref<EGammaBxCollection> EGammaRef(eGammaHandle, ieg);
180  ieg++;
181 
182  float e_ele = egIter->energy();
183  float eta_ele = egIter->eta();
184  float et_ele = 0;
185  float cosh_eta_ele = cosh(eta_ele);
186  if (cosh_eta_ele > 0.0)
187  et_ele = e_ele / cosh_eta_ele;
188  else
189  et_ele = -1.0;
190  if (etMin_ > 0.0 && et_ele <= etMin_)
191  continue;
192  // match the L1EG object with a L1Track
193  float drmin = 999;
194  int itr = 0;
195  int itrack = -1;
196  for (trackIter = L1TTTrackHandle->begin(); trackIter != L1TTTrackHandle->end(); ++trackIter) {
197  edm::Ptr<L1TTTrackType> L1TrackPtr(L1TTTrackHandle, itr);
198  double trkPt_fit = trackIter->momentum().perp();
199  double trkPt_stubs = pTFrom2Stubs::pTFrom2(trackIter, tGeom);
200  double trkPt = trkPt_fit;
201  if (useTwoStubsPT_)
202  trkPt = trkPt_stubs;
203 
204  if (trkPt > trkQualityPtMin_ && trackIter->chi2() < trkQualityChi2_) {
205  double dPhi = 99.;
206  double dR = 99.;
207  double dEta = 99.;
208  if (useClusterET_)
209  L1TkElectronTrackMatchAlgo::doMatchClusterET(egIter, L1TrackPtr, dPhi, dR, dEta);
210  else
211  L1TkElectronTrackMatchAlgo::doMatch(egIter, L1TrackPtr, dPhi, dR, dEta);
212  if (dR < drmin && selectMatchedTrack(dR, dPhi, dEta, trkPt, eta_ele)) {
213  drmin = dR;
214  itrack = itr;
215  }
216  }
217  itr++;
218  }
219  if (itrack >= 0) {
220  edm::Ptr<L1TTTrackType> matchedL1TrackPtr(L1TTTrackHandle, itrack);
221 
222  const math::XYZTLorentzVector P4 = egIter->p4();
223  float trkisol = isolation(L1TTTrackHandle, itrack);
224  if (relativeIsolation_ && et_ele > 0.0) { // relative isolation
225  trkisol = trkisol / et_ele;
226  }
227 
228  TkElectron trkEm(P4, EGammaRef, matchedL1TrackPtr, trkisol);
229 
230  trkEm.setTrackCurvature(matchedL1TrackPtr->rInv()); // should this have npars? 4? 5?
231 
232  //std::cout<<matchedL1TrackPtr->rInv()<<" "<<matchedL1TrackPtr->rInv(4)<<" "<<matchedL1TrackPtr->rInv()<<std::endl;
233 
234  if (isoCut_ <= 0) {
235  // write the L1TkEm particle to the collection,
236  // irrespective of its relative isolation
237  result->push_back(trkEm);
238  } else {
239  // the object is written to the collection only
240  // if it passes the isolation cut
241  if (trkisol <= isoCut_)
242  result->push_back(trkEm);
243  }
244  }
245 
246  } // end loop over EGamma objects
247 
248  iEvent.put(std::move(result), label);
249 }
const_iterator end(int bx) const
const edm::EDGetTokenT< EGammaBxCollection > egToken_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
std::vector< TkElectron > TkElectronCollection
Definition: TkElectronFwd.h:15
edm::Ref< EGammaBxCollection > EGammaRef
Definition: TkEGTau.h:35
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
void doMatchClusterET(BXVector< l1t::EGamma >::const_iterator egIter, const edm::Ptr< L1TTTrackType > &pTrk, double &dph, double &dr, double &deta)
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
tuple result
Definition: mps_fire.py:311
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
bool selectMatchedTrack(double &d_r, double &d_phi, double &d_eta, double &tk_pt, float &eg_eta)
std::vector< T >::const_iterator const_iterator
Definition: BXVector.h:18
const edm::EDGetTokenT< std::vector< TTTrack< Ref_Phase2TrackerDigi_ > > > trackToken_
def move
Definition: eostools.py:511
void doMatch(BXVector< l1t::EGamma >::const_iterator egIter, const edm::Ptr< L1TTTrackType > &pTrk, double &dph, double &dr, double &deta)
bool isValid() const
Definition: HandleBase.h:70
float isolation(const edm::Handle< L1TTTrackCollectionType > &trkHandle, int match_index)
T const * product() const
Definition: Handle.h:70
T const * product() const
Definition: ESHandle.h:86
float pTFrom2(std::vector< TTTrack< Ref_Phase2TrackerDigi_ > >::const_iterator trk, const TrackerGeometry *tkGeometry)
Definition: pTFrom2Stubs.cc:72
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
const_iterator begin(int bx) const
bool L1TkElectronTrackProducer::selectMatchedTrack ( double &  d_r,
double &  d_phi,
double &  d_eta,
double &  tk_pt,
float &  eg_eta 
)
private

Definition at line 334 of file L1TkElectronTrackProducer.cc.

References funct::abs(), dEtaCutoff_, dPhiCutoff_, dRCutoff_, EB_MaxEta, getPtScaledCut(), and matchType_.

Referenced by produce().

335  {
336  if (matchType_ == "PtDependentCut") {
337  if (std::abs(d_phi) < getPtScaledCut(tk_pt, dPhiCutoff_) && d_r < getPtScaledCut(tk_pt, dRCutoff_))
338  return true;
339  } else {
340  double deta_max = dEtaCutoff_[0];
341  if (std::abs(eg_eta) < EB_MaxEta)
342  deta_max = dEtaCutoff_[1];
343  double dphi_max = dPhiCutoff_[0];
344  if ((d_eta / deta_max) * (d_eta / deta_max) + (d_phi / dphi_max) * (d_phi / dphi_max) < 1)
345  return true;
346  }
347  return false;
348 }
static constexpr float EB_MaxEta
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double getPtScaledCut(double pt, std::vector< double > &parameters)

Member Data Documentation

float L1TkElectronTrackProducer::deltaZ_
private

Definition at line 85 of file L1TkElectronTrackProducer.cc.

Referenced by L1TkElectronTrackProducer().

std::vector<double> L1TkElectronTrackProducer::dEtaCutoff_
private

Definition at line 96 of file L1TkElectronTrackProducer.cc.

Referenced by L1TkElectronTrackProducer(), and selectMatchedTrack().

std::vector<double> L1TkElectronTrackProducer::dPhiCutoff_
private

Definition at line 94 of file L1TkElectronTrackProducer.cc.

Referenced by L1TkElectronTrackProducer(), and selectMatchedTrack().

std::vector<double> L1TkElectronTrackProducer::dRCutoff_
private

Definition at line 95 of file L1TkElectronTrackProducer.cc.

Referenced by L1TkElectronTrackProducer(), and selectMatchedTrack().

float L1TkElectronTrackProducer::dRMax_
private

Definition at line 79 of file L1TkElectronTrackProducer.cc.

Referenced by isolation(), and L1TkElectronTrackProducer().

float L1TkElectronTrackProducer::dRMin_
private

Definition at line 78 of file L1TkElectronTrackProducer.cc.

Referenced by isolation(), and L1TkElectronTrackProducer().

const edm::EDGetTokenT<EGammaBxCollection> L1TkElectronTrackProducer::egToken_
private

Definition at line 99 of file L1TkElectronTrackProducer.cc.

Referenced by produce().

float L1TkElectronTrackProducer::etMin_
private

Definition at line 76 of file L1TkElectronTrackProducer.cc.

Referenced by L1TkElectronTrackProducer(), and produce().

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> L1TkElectronTrackProducer::geomToken_
private

Definition at line 101 of file L1TkElectronTrackProducer.cc.

Referenced by produce().

float L1TkElectronTrackProducer::isoCut_
private

Definition at line 87 of file L1TkElectronTrackProducer.cc.

Referenced by L1TkElectronTrackProducer(), and produce().

std::string L1TkElectronTrackProducer::label
private
std::string L1TkElectronTrackProducer::matchType_
private

Definition at line 97 of file L1TkElectronTrackProducer.cc.

Referenced by L1TkElectronTrackProducer(), and selectMatchedTrack().

float L1TkElectronTrackProducer::maxChi2IsoTracks_
private

Definition at line 81 of file L1TkElectronTrackProducer.cc.

Referenced by isolation(), and L1TkElectronTrackProducer().

unsigned int L1TkElectronTrackProducer::minNStubsIsoTracks_
private

Definition at line 82 of file L1TkElectronTrackProducer.cc.

Referenced by isolation(), and L1TkElectronTrackProducer().

bool L1TkElectronTrackProducer::primaryVtxConstrain_
private

Definition at line 84 of file L1TkElectronTrackProducer.cc.

float L1TkElectronTrackProducer::pTMinTra_
private

Definition at line 80 of file L1TkElectronTrackProducer.cc.

Referenced by isolation(), and L1TkElectronTrackProducer().

bool L1TkElectronTrackProducer::relativeIsolation_
private

Definition at line 88 of file L1TkElectronTrackProducer.cc.

Referenced by L1TkElectronTrackProducer(), and produce().

const edm::EDGetTokenT<std::vector<TTTrack<Ref_Phase2TrackerDigi_> > > L1TkElectronTrackProducer::trackToken_
private

Definition at line 100 of file L1TkElectronTrackProducer.cc.

Referenced by produce().

float L1TkElectronTrackProducer::trkQualityChi2_
private

Definition at line 90 of file L1TkElectronTrackProducer.cc.

Referenced by L1TkElectronTrackProducer(), and produce().

float L1TkElectronTrackProducer::trkQualityPtMin_
private

Definition at line 93 of file L1TkElectronTrackProducer.cc.

Referenced by L1TkElectronTrackProducer(), and produce().

bool L1TkElectronTrackProducer::useClusterET_
private

Definition at line 92 of file L1TkElectronTrackProducer.cc.

Referenced by L1TkElectronTrackProducer(), and produce().

bool L1TkElectronTrackProducer::useTwoStubsPT_
private

Definition at line 91 of file L1TkElectronTrackProducer.cc.

Referenced by L1TkElectronTrackProducer(), and produce().