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
L1TrackJetProducer Class Reference
Inheritance diagram for L1TrackJetProducer:
edm::stream::EDProducer<>

Public Types

typedef vector< L1TTTrackTypeL1TTTrackCollectionType
 
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

virtual EtaPhiBinL1_cluster (EtaPhiBin *phislice)
 
 L1TrackJetProducer (const ParameterSet &)
 
void L2_cluster (vector< Ptr< L1TTTrackType > > L1TrkPtrs_, vector< int > ttrk_, vector< int > tdtrk_, vector< int > ttdtrk_, MaxZBin &mzb)
 
bool trackQualityCuts (float trk_pt, int trk_nstub, float trk_chi2, float trk_bendchi2, float trk_d0)
 
 ~L1TrackJetProducer () 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 (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void beginStream (StreamID) override
 
void endStream () override
 
void produce (Event &, const EventSetup &) override
 

Private Attributes

float d0CutNStubs4_
 
float d0CutNStubs5_
 
bool displaced_
 
int etaBins_
 
float etaStep_
 
int highpTJetMinTrackMultiplicity_
 
vector< Ptr< L1TTTrackType > > L1TrkPtrs_
 
int lowpTJetMinTrackMultiplicity_
 
double minJetEtHighPt_
 
double minJetEtLowPt_
 
double minTrkJetpT_
 
float nStubs4DisplacedBendLoose_
 
float nStubs4DisplacedBendTight_
 
float nStubs4DisplacedChi2Loose_
 
float nStubs4DisplacedChi2Tight_
 
float nStubs5DisplacedBendLoose_
 
float nStubs5DisplacedBendTight_
 
float nStubs5DisplacedChi2Loose_
 
float nStubs5DisplacedChi2Tight_
 
int phiBins_
 
float phiStep_
 
vector< int > tdtrk_
 
const EDGetTokenT< vector
< TTTrack
< Ref_Phase2TrackerDigi_ > > > 
trackToken_
 
float trkBendChi2Max_
 
float trkChi2dofMax_
 
float trkEtaMax_
 
int trkNPSStubMin_
 
float trkPtMax_
 
float trkPtMin_
 
float trkZMax_
 
vector< int > ttdtrk_
 
edm::ESGetToken
< TrackerTopology,
TrackerTopologyRcd
tTopoToken_
 
vector< int > ttrk_
 
vector< int > zBinCount_
 
int zBins_
 
float zStep_
 

Detailed Description

Definition at line 43 of file L1TrackJetProducer.cc.

Member Typedef Documentation

Definition at line 48 of file L1TrackJetProducer.cc.

Definition at line 47 of file L1TrackJetProducer.cc.

Constructor & Destructor Documentation

L1TrackJetProducer::L1TrackJetProducer ( const ParameterSet iConfig)
explicit

Definition at line 102 of file L1TrackJetProducer.cc.

References d0CutNStubs4_, d0CutNStubs5_, displaced_, etaBins_, etaStep_, edm::ParameterSet::getParameter(), highpTJetMinTrackMultiplicity_, lowpTJetMinTrackMultiplicity_, M_PI, minJetEtHighPt_, minJetEtLowPt_, minTrkJetpT_, nStubs4DisplacedBendLoose_, nStubs4DisplacedBendTight_, nStubs4DisplacedChi2Loose_, nStubs4DisplacedChi2Tight_, nStubs5DisplacedBendLoose_, nStubs5DisplacedBendTight_, nStubs5DisplacedChi2Loose_, nStubs5DisplacedChi2Tight_, phiBins_, phiStep_, trkBendChi2Max_, trkChi2dofMax_, trkEtaMax_, trkNPSStubMin_, trkPtMax_, trkPtMin_, trkZMax_, zBins_, and zStep_.

103  : trackToken_(
104  consumes<vector<TTTrack<Ref_Phase2TrackerDigi_> > >(iConfig.getParameter<InputTag>("L1TrackInputTag"))),
105  tTopoToken_(esConsumes<TrackerTopology, TrackerTopologyRcd>(edm::ESInputTag("", ""))) {
106  trkZMax_ = (float)iConfig.getParameter<double>("trk_zMax");
107  trkPtMax_ = (float)iConfig.getParameter<double>("trk_ptMax");
108  trkPtMin_ = (float)iConfig.getParameter<double>("trk_ptMin");
109  trkEtaMax_ = (float)iConfig.getParameter<double>("trk_etaMax");
110  trkChi2dofMax_ = (float)iConfig.getParameter<double>("trk_chi2dofMax");
111  trkBendChi2Max_ = (float)iConfig.getParameter<double>("trk_bendChi2Max");
112  trkNPSStubMin_ = (int)iConfig.getParameter<int>("trk_nPSStubMin");
113  minTrkJetpT_ = iConfig.getParameter<double>("minTrkJetpT");
114  minJetEtLowPt_ = iConfig.getParameter<double>("minJetEtLowPt");
115  minJetEtHighPt_ = iConfig.getParameter<double>("minJetEtHighPt");
116  etaBins_ = (int)iConfig.getParameter<int>("etaBins");
117  phiBins_ = (int)iConfig.getParameter<int>("phiBins");
118  zBins_ = (int)iConfig.getParameter<int>("zBins");
119  d0CutNStubs4_ = (float)iConfig.getParameter<double>("d0_cutNStubs4");
120  d0CutNStubs5_ = (float)iConfig.getParameter<double>("d0_cutNStubs5");
121  lowpTJetMinTrackMultiplicity_ = (int)iConfig.getParameter<int>("lowpTJetMinTrackMultiplicity");
122  highpTJetMinTrackMultiplicity_ = (int)iConfig.getParameter<int>("highpTJetMinTrackMultiplicity");
123  displaced_ = iConfig.getParameter<bool>("displaced");
124  nStubs4DisplacedChi2Loose_ = (float)iConfig.getParameter<double>("nStubs4DisplacedChi2_Loose");
125  nStubs5DisplacedChi2Loose_ = (float)iConfig.getParameter<double>("nStubs5DisplacedChi2_Loose");
126  nStubs4DisplacedBendLoose_ = (float)iConfig.getParameter<double>("nStubs4Displacedbend_Loose");
127  nStubs5DisplacedBendLoose_ = (float)iConfig.getParameter<double>("nStubs5Displacedbend_Loose");
128  nStubs4DisplacedChi2Tight_ = (float)iConfig.getParameter<double>("nStubs4DisplacedChi2_Tight");
129  nStubs5DisplacedChi2Tight_ = (float)iConfig.getParameter<double>("nStubs5DisplacedChi2_Tight");
130  nStubs4DisplacedBendTight_ = (float)iConfig.getParameter<double>("nStubs4Displacedbend_Tight");
131  nStubs5DisplacedBendTight_ = (float)iConfig.getParameter<double>("nStubs5Displacedbend_Tight");
132 
133  zStep_ = 2.0 * trkZMax_ / zBins_;
134  etaStep_ = 2.0 * trkEtaMax_ / etaBins_; //etaStep is the width of an etabin
135  phiStep_ = 2 * M_PI / phiBins_;
136 
137  if (displaced_)
138  produces<TkJetCollection>("L1TrackJetsExtended");
139  else
140  produces<TkJetCollection>("L1TrackJets");
141 }
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
#define M_PI
Class to store the L1 Track Trigger tracks.
Definition: TTTrack.h:29
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const EDGetTokenT< vector< TTTrack< Ref_Phase2TrackerDigi_ > > > trackToken_
L1TrackJetProducer::~L1TrackJetProducer ( )
override

Definition at line 143 of file L1TrackJetProducer.cc.

143 {}

Member Function Documentation

void L1TrackJetProducer::beginStream ( StreamID  )
overrideprivate

Definition at line 642 of file L1TrackJetProducer.cc.

642 {}
void L1TrackJetProducer::endStream ( )
overrideprivate

Definition at line 644 of file L1TrackJetProducer.cc.

644 {}
void L1TrackJetProducer::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 662 of file L1TrackJetProducer.cc.

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

662  {
663  //The following says we do not know what parameters are allowed so do no validation
664  // Please change this to state exactly what you do use, even if it is no parameters
666  desc.setUnknown();
667  descriptions.addDefault(desc);
668 }
void addDefault(ParameterSetDescription const &psetDescription)
EtaPhiBin * L1TrackJetProducer::L1_cluster ( EtaPhiBin phislice)
virtual

Definition at line 554 of file L1TrackJetProducer.cc.

References HLT_FULL_cff::clusters, EtaPhiBin::eta, PVValHelper::eta, etaBins_, etaStep_, mps_fire::i, visualization-live-secondInstance_cfg::m, DeadROCCounter::nclust, EtaPhiBin::numtdtrks, EtaPhiBin::numtracks, EtaPhiBin::numttdtrks, EtaPhiBin::numttrks, EtaPhiBin::pTtot, and EtaPhiBin::used.

Referenced by L2_cluster().

554  {
555  EtaPhiBin *clusters = new EtaPhiBin[etaBins_ / 2];
556  if (clusters == nullptr)
557  edm::LogWarning("L1TrackJetProducer") << "Clusters memory not assigned!\n";
558 
559  // Find eta-phibin with maxpT, make center of cluster, add neighbors if not already used
560  float my_pt, left_pt, right_pt, right2pt;
561  int nclust = 0;
562  right2pt = 0;
563  for (int etabin = 0; etabin < etaBins_; ++etabin) {
564  // assign values for my pT and neighbors' pT
565  if (phislice[etabin].used)
566  continue;
567  my_pt = phislice[etabin].pTtot;
568  if (etabin > 0 && !phislice[etabin - 1].used) {
569  left_pt = phislice[etabin - 1].pTtot;
570  } else
571  left_pt = 0;
572  if (etabin < etaBins_ - 1 && !phislice[etabin + 1].used) {
573  right_pt = phislice[etabin + 1].pTtot;
574  if (etabin < etaBins_ - 2 && !phislice[etabin + 2].used) {
575  right2pt = phislice[etabin + 2].pTtot;
576  } else
577  right2pt = 0;
578  } else
579  right_pt = 0;
580 
581  // if I'm not a cluster, move on
582  if (my_pt < left_pt || my_pt <= right_pt) {
583  // if unused pT in the left neighbor, spit it out as a cluster
584  if (left_pt > 0) {
585  clusters[nclust] = phislice[etabin - 1];
586  phislice[etabin - 1].used = true;
587  nclust++;
588  }
589  continue;
590  }
591 
592  // I guess I'm a cluster-- should I use my right neighbor?
593  // Note: left neighbor will definitely be used because if it
594  // didn't belong to me it would have been used already
595  clusters[nclust] = phislice[etabin];
596  phislice[etabin].used = true;
597  if (left_pt > 0) {
598  if (clusters != nullptr) {
599  clusters[nclust].pTtot += left_pt;
600  clusters[nclust].numtracks += phislice[etabin - 1].numtracks;
601  clusters[nclust].numttrks += phislice[etabin - 1].numttrks;
602  clusters[nclust].numtdtrks += phislice[etabin - 1].numtdtrks;
603  clusters[nclust].numttdtrks += phislice[etabin - 1].numttdtrks;
604  }
605  }
606  if (my_pt >= right2pt && right_pt > 0) {
607  if (clusters != nullptr) {
608  clusters[nclust].pTtot += right_pt;
609  clusters[nclust].numtracks += phislice[etabin + 1].numtracks;
610  clusters[nclust].numttrks += phislice[etabin + 1].numttrks;
611  clusters[nclust].numtdtrks += phislice[etabin + 1].numtdtrks;
612  clusters[nclust].numttdtrks += phislice[etabin + 1].numttdtrks;
613  phislice[etabin + 1].used = true;
614  }
615  }
616  nclust++;
617  } // for each etabin
618 
619  // Now merge clusters, if necessary
620  for (int m = 0; m < nclust - 1; ++m) {
621  if (fabs(clusters[m + 1].eta - clusters[m].eta) < 1.5 * etaStep_) {
622  if (clusters[m + 1].pTtot > clusters[m].pTtot) {
623  clusters[m].eta = clusters[m + 1].eta;
624  }
625  clusters[m].pTtot += clusters[m + 1].pTtot;
626  clusters[m].numtracks += clusters[m + 1].numtracks; // Previous version didn't add tracks when merging
627  clusters[m].numttrks += clusters[m + 1].numttrks;
628  clusters[m].numtdtrks += clusters[m + 1].numtdtrks;
629  clusters[m].numttdtrks += clusters[m + 1].numttdtrks;
630  for (int m1 = m + 1; m1 < nclust - 1; ++m1)
631  clusters[m1] = clusters[m1 + 1];
632  nclust--;
633  m = -1;
634  } // end if clusters neighbor in eta
635  } // end for (m) loop
636 
637  for (int i = nclust; i < etaBins_ / 2; ++i) // zero out remaining unused clusters
638  clusters[i].pTtot = 0;
639  return clusters;
640 }
Log< level::Warning, false > LogWarning
void L1TrackJetProducer::L2_cluster ( vector< Ptr< L1TTTrackType > >  L1TrkPtrs_,
vector< int >  ttrk_,
vector< int >  tdtrk_,
vector< int >  ttdtrk_,
MaxZBin mzb 
)

Definition at line 271 of file L1TrackJetProducer.cc.

References MaxZBin::clusters, EtaPhiBin::eta, PVValHelper::eta, etaBins_, etaStep_, highpTJetMinTrackMultiplicity_, MaxZBin::ht, mps_fire::i, dqmiolumiharvest::j, isotrackApplyRegressor::k, L1_cluster(), L1TrkPtrs_, lowpTJetMinTrackMultiplicity_, visualization-live-secondInstance_cfg::m, M_PI, minJetEtHighPt_, minJetEtLowPt_, minTrkJetpT_, dqmiodumpmetadata::n, MaxZBin::nclust, DeadROCCounter::nclust, EtaPhiBin::numtdtrks, EtaPhiBin::numtracks, EtaPhiBin::numttdtrks, EtaPhiBin::numttrks, phi, EtaPhiBin::phi, phiBins_, phimax, phimin, phiStep_, EtaPhiBin::pTtot, trkEtaMax_, trkPtMax_, trkZMax_, EtaPhiBin::used, z, MaxZBin::zbincenter, zBinCount_, zBins_, MaxZBin::znum, and zStep_.

Referenced by produce().

272  {
273  const int nz = zBins_;
274  MaxZBin all_zBins[nz];
275  for (int z = 0; z < nz; ++z)
276  all_zBins[z] = MaxZBin{0, 0, 0, nullptr, 0};
277 
278  float zmin = -1.0 * trkZMax_;
279  float zmax = zmin + 2 * zStep_;
280 
281  EtaPhiBin epbins[phiBins_][etaBins_]; // create grid of phiBins
282  float phi = -1.0 * M_PI;
283  float eta;
284  float etamin, etamax, phimin, phimax;
285  for (int i = 0; i < phiBins_; ++i) {
286  eta = -1.0 * trkEtaMax_;
287  for (int j = 0; j < etaBins_; ++j) {
288  phimin = phi;
289  phimax = phi + phiStep_;
290  etamin = eta;
291  eta = eta + etaStep_;
292  etamax = eta;
293  epbins[i][j].phi = (phimin + phimax) / 2.0;
294  epbins[i][j].eta = (etamin + etamax) / 2.0;
295  } // for each etabin
296  phi = phi + phiStep_;
297  } // for each phibin (finished creating epbins)
298  mzb = all_zBins[0];
299  int ntracks = L1TrkPtrs_.size();
300  // uninitalized arrays
301  EtaPhiBin *L1clusters[phiBins_];
302  EtaPhiBin L2cluster[ntracks];
303 
304  for (int zbin = 0; zbin < zBins_ - 1; ++zbin) {
305  for (int i = 0; i < phiBins_; ++i) { //First initialize pT, numtracks, used to 0 (or false)
306  for (int j = 0; j < etaBins_; ++j) {
307  epbins[i][j].pTtot = 0;
308  epbins[i][j].used = false;
309  epbins[i][j].numtracks = 0;
310  epbins[i][j].numttrks = 0;
311  epbins[i][j].numtdtrks = 0;
312  epbins[i][j].numttdtrks = 0;
313  } //for each etabin
314  L1clusters[i] = epbins[i];
315  } //for each phibin
316 
317  for (unsigned int k = 0; k < L1TrkPtrs_.size(); ++k) {
318  float trkpt = L1TrkPtrs_[k]->momentum().perp();
319  float trketa = L1TrkPtrs_[k]->momentum().eta();
320  float trkphi = L1TrkPtrs_[k]->momentum().phi();
321  float trkZ = L1TrkPtrs_[k]->z0();
322 
323  for (int i = 0; i < phiBins_; ++i) {
324  for (int j = 0; j < etaBins_; ++j) {
325  L2cluster[k] = epbins[i][j];
326  if ((zmin <= trkZ && zmax >= trkZ) &&
327  ((epbins[i][j].eta - etaStep_ / 2.0 <= trketa && epbins[i][j].eta + etaStep_ / 2.0 >= trketa) &&
328  epbins[i][j].phi - phiStep_ / 2.0 <= trkphi && epbins[i][j].phi + phiStep_ / 2.0 >= trkphi &&
329  (zBinCount_[k] != 2))) {
330  zBinCount_.at(k) = zBinCount_.at(k) + 1;
331  if (trkpt < trkPtMax_)
332  epbins[i][j].pTtot += trkpt;
333  else
334  epbins[i][j].pTtot += trkPtMax_;
335  epbins[i][j].numttrks += ttrk_[k];
336  epbins[i][j].numtdtrks += tdtrk_[k];
337  epbins[i][j].numttdtrks += ttdtrk_[k];
338  ++epbins[i][j].numtracks;
339  } // if right bin
340  } // for each phibin: j loop
341  } // for each phibin: i loop
342  } // end loop over tracks
343 
344  for (int phislice = 0; phislice < phiBins_; ++phislice) {
345  L1clusters[phislice] = L1_cluster(epbins[phislice]);
346  if (L1clusters[phislice] != nullptr) {
347  for (int ind = 0; L1clusters[phislice][ind].pTtot != 0; ++ind) {
348  L1clusters[phislice][ind].used = false;
349  }
350  }
351  }
352 
353  //Create clusters array to hold output cluster data for Layer2; can't have more clusters than tracks.
354  //Find eta-phibin with maxpT, make center of cluster, add neighbors if not already used.
355  float hipT = 0;
356  int nclust = 0;
357  int phibin = 0;
358  int imax = -1;
359  int index1; //index of clusters array for each phislice
360  float E1 = 0;
361  float E0 = 0;
362  float E2 = 0;
363  int trx1, trx2;
364  int ttrk1, ttrk2;
365  int tdtrk1, tdtrk2;
366  int ttdtrk1, ttdtrk2;
367  int used1, used2, used3, used4;
368 
369  for (phibin = 0; phibin < phiBins_; ++phibin) { //Find eta-phibin with highest pT
370  while (true) {
371  hipT = 0;
372  for (index1 = 0; L1clusters[phibin][index1].pTtot > 0; ++index1) {
373  if (!L1clusters[phibin][index1].used && L1clusters[phibin][index1].pTtot >= hipT) {
374  hipT = L1clusters[phibin][index1].pTtot;
375  imax = index1;
376  }
377  } // for each index within the phibin
378 
379  if (hipT == 0)
380  break; // If highest pT is 0, all bins are used
381  E0 = hipT; // E0 is pT of first phibin of the cluster
382  E1 = 0;
383  E2 = 0;
384  trx1 = 0;
385  trx2 = 0;
386  ttrk1 = 0;
387  ttrk2 = 0;
388  tdtrk1 = 0;
389  tdtrk2 = 0;
390  ttdtrk1 = 0;
391  ttdtrk2 = 0;
392  L2cluster[nclust] = L1clusters[phibin][imax];
393  L1clusters[phibin][imax].used = true;
394  // Add pT of upper neighbor
395  // E1 is pT of the middle phibin (should be highest pT)
396  if (phibin != phiBins_ - 1) {
397  used1 = -1;
398  used2 = -1;
399  for (index1 = 0; L1clusters[phibin + 1][index1].pTtot != 0; ++index1) {
400  if (L1clusters[phibin + 1][index1].used)
401  continue;
402  if (fabs(L1clusters[phibin + 1][index1].eta - L1clusters[phibin][imax].eta) <= 1.5 * etaStep_) {
403  E1 += L1clusters[phibin + 1][index1].pTtot;
404  trx1 += L1clusters[phibin + 1][index1].numtracks;
405  ttrk1 += L1clusters[phibin + 1][index1].numttrks;
406  tdtrk1 += L1clusters[phibin + 1][index1].numtdtrks;
407  ttdtrk1 += L1clusters[phibin + 1][index1].numttdtrks;
408  if (used1 < 0)
409  used1 = index1;
410  else
411  used2 = index1;
412  } // if cluster is within one phibin
413  } // for each cluster in above phibin
414 
415  if (E1 < E0) { // if E1 isn't higher, E0 and E1 are their own cluster
416  L2cluster[nclust].pTtot += E1;
417  L2cluster[nclust].numtracks += trx1;
418  L2cluster[nclust].numttrks += ttrk1;
419  L2cluster[nclust].numtdtrks += tdtrk1;
420  L2cluster[nclust].numttdtrks += ttdtrk1;
421  if (used1 >= 0)
422  L1clusters[phibin + 1][used1].used = true;
423  if (used2 >= 0)
424  L1clusters[phibin + 1][used2].used = true;
425  nclust++;
426  continue;
427  }
428 
429  if (phibin != phiBins_ - 2) { // E2 will be the pT of the third phibin (should be lower than E1)
430  used3 = -1;
431  used4 = -1;
432  for (index1 = 0; L1clusters[phibin + 2][index1].pTtot != 0; ++index1) {
433  if (L1clusters[phibin + 2][index1].used)
434  continue;
435  if (fabs(L1clusters[phibin + 2][index1].eta - L1clusters[phibin][imax].eta) <= 1.5 * etaStep_) {
436  E2 += L1clusters[phibin + 2][index1].pTtot;
437  trx2 += L1clusters[phibin + 2][index1].numtracks;
438  ttrk2 += L1clusters[phibin + 2][index1].numttrks;
439  tdtrk2 += L1clusters[phibin + 2][index1].numtdtrks;
440  ttdtrk2 += L1clusters[phibin + 2][index1].numttdtrks;
441  if (used3 < 0)
442  used3 = index1;
443  else
444  used4 = index1;
445  }
446  }
447  // if indeed E2 < E1, add E1 and E2 to E0, they're all a cluster together
448  // otherwise, E0 is its own cluster
449  if (E2 < E1) {
450  L2cluster[nclust].pTtot += E1 + E2;
451  L2cluster[nclust].numtracks += trx1 + trx2;
452  L2cluster[nclust].numttrks += ttrk1 + ttrk2;
453  L2cluster[nclust].numtdtrks += tdtrk1 + tdtrk2;
454  L2cluster[nclust].numttdtrks += ttdtrk1 + ttdtrk2;
455  L2cluster[nclust].phi = L1clusters[phibin + 1][used1].phi;
456  if (used1 >= 0)
457  L1clusters[phibin + 1][used1].used = true;
458  if (used2 >= 0)
459  L1clusters[phibin + 1][used2].used = true;
460  if (used3 >= 0)
461  L1clusters[phibin + 2][used3].used = true;
462  if (used4 >= 0)
463  L1clusters[phibin + 2][used4].used = true;
464  }
465  nclust++;
466  continue;
467  } // end Not phiBins-2
468  else {
469  L2cluster[nclust].pTtot += E1;
470  L2cluster[nclust].numtracks += trx1;
471  L2cluster[nclust].numttrks += ttrk1;
472  L2cluster[nclust].numtdtrks += tdtrk1;
473  L2cluster[nclust].numttdtrks += ttdtrk1;
474  L2cluster[nclust].phi = L1clusters[phibin + 1][used1].phi;
475  if (used1 >= 0)
476  L1clusters[phibin + 1][used1].used = true;
477  if (used2 >= 0)
478  L1clusters[phibin + 1][used2].used = true;
479  nclust++;
480  continue;
481  }
482  } //End not last phibin(23)
483  else { //if it is phibin 23
484  L1clusters[phibin][imax].used = true;
485  nclust++;
486  }
487  } // while hipT not 0
488  } // for each phibin
489 
490  for (phibin = 0; phibin < phiBins_; ++phibin)
491  delete[] L1clusters[phibin];
492 
493  // Now merge clusters, if necessary
494  for (int m = 0; m < nclust - 1; ++m) {
495  for (int n = m + 1; n < nclust; ++n)
496  if (L2cluster[n].eta == L2cluster[m].eta && (fabs(L2cluster[n].phi - L2cluster[m].phi) < 1.5 * phiStep_ ||
497  fabs(L2cluster[n].phi - L2cluster[m].phi) > 6.0)) {
498  if (L2cluster[n].pTtot > L2cluster[m].pTtot)
499  L2cluster[m].phi = L2cluster[n].phi;
500  L2cluster[m].pTtot += L2cluster[n].pTtot;
501  L2cluster[m].numtracks += L2cluster[n].numtracks;
502  L2cluster[m].numttrks += L2cluster[n].numttrks;
503  L2cluster[m].numtdtrks += L2cluster[n].numtdtrks;
504  L2cluster[m].numttdtrks += L2cluster[n].numttdtrks;
505  for (int m1 = n; m1 < nclust - 1; ++m1)
506  L2cluster[m1] = L2cluster[m1 + 1];
507  nclust--;
508  m = -1;
509  break; //?????
510  } // end if clusters neighbor in eta
511  } // end for (m) loop
512 
513  // sum up all pTs in this zbin to find ht
514  float ht = 0;
515  for (int k = 0; k < nclust; ++k) {
516  if (L2cluster[k].pTtot > minJetEtLowPt_ && L2cluster[k].numtracks < lowpTJetMinTrackMultiplicity_)
517  continue;
518  if (L2cluster[k].pTtot > minJetEtHighPt_ && L2cluster[k].numtracks < highpTJetMinTrackMultiplicity_)
519  continue;
520  if (L2cluster[k].pTtot > minTrkJetpT_)
521  ht += L2cluster[k].pTtot;
522  }
523 
524  // if ht is larger than previous max, this is the new vertex zbin
525  all_zBins[zbin].znum = zbin;
526  all_zBins[zbin].clusters = new EtaPhiBin[nclust];
527  all_zBins[zbin].nclust = nclust;
528  all_zBins[zbin].zbincenter = (zmin + zmax) / 2.0;
529  for (int k = 0; k < nclust; ++k) {
530  all_zBins[zbin].clusters[k].phi = L2cluster[k].phi;
531  all_zBins[zbin].clusters[k].eta = L2cluster[k].eta;
532  all_zBins[zbin].clusters[k].pTtot = L2cluster[k].pTtot;
533  all_zBins[zbin].clusters[k].numtracks = L2cluster[k].numtracks;
534  all_zBins[zbin].clusters[k].numttrks = L2cluster[k].numttrks;
535  all_zBins[zbin].clusters[k].numtdtrks = L2cluster[k].numtdtrks;
536  all_zBins[zbin].clusters[k].numttdtrks = L2cluster[k].numttdtrks;
537  }
538  all_zBins[zbin].ht = ht;
539  if (ht >= mzb.ht) {
540  mzb = all_zBins[zbin];
541  mzb.zbincenter = (zmin + zmax) / 2.0;
542  }
543  // Prepare for next zbin!
544  zmin = zmin + zStep_;
545  zmax = zmax + zStep_;
546  } // for each zbin
547  for (int zbin = 0; zbin < zBins_ - 1; ++zbin) {
548  if (zbin == mzb.znum)
549  continue;
550  delete[] all_zBins[zbin].clusters;
551  }
552 }
EtaPhiBin * clusters
float zbincenter
vector< Ptr< L1TTTrackType > > L1TrkPtrs_
virtual EtaPhiBin * L1_cluster(EtaPhiBin *phislice)
vector< int > zBinCount_
#define M_PI
void L1TrackJetProducer::produce ( Event iEvent,
const EventSetup iSetup 
)
overrideprivate

Definition at line 145 of file L1TrackJetProducer.cc.

References MaxZBin::clusters, funct::cos(), d0CutNStubs4_, d0CutNStubs5_, displaced_, EtaPhiBin::eta, etaStep_, edm::Event::getByToken(), edm::EventSetup::getData(), dqmiolumiharvest::j, reco::btau::jetEta, reco::btau::jetPhi, reco::btau::jetPt, L1TrkPtrs_, L2_cluster(), eostools::move(), MaxZBin::nclust, nStubs4DisplacedBendTight_, nStubs4DisplacedChi2Tight_, nStubs5DisplacedBendTight_, nStubs5DisplacedChi2Tight_, EtaPhiBin::numtdtrks, EtaPhiBin::numtracks, EtaPhiBin::numttdtrks, EtaPhiBin::numttrks, EtaPhiBin::phi, phiStep_, EtaPhiBin::pTtot, edm::Event::put(), funct::sin(), submitPVValidationJobs::t, tdtrk_, StripSubdetector::TID, TrackerTopology::tidRing(), StripSubdetector::TOB, TrackerTopology::tobLayer(), align::Tracker, trackQualityCuts(), trackToken_, trkEtaMax_, trkNPSStubMin_, trkPtMin_, trkZMax_, ttdtrk_, tTopoToken_, ttrk_, MaxZBin::zbincenter, zBinCount_, and zStep_.

145  {
146  unique_ptr<TkJetCollection> L1L1TrackJetProducer(new TkJetCollection);
147 
148  // For TTStubs
149  const TrackerTopology &tTopo = iSetup.getData(tTopoToken_);
150 
152  iEvent.getByToken(trackToken_, TTTrackHandle);
153  vector<TTTrack<Ref_Phase2TrackerDigi_> >::const_iterator iterL1Track;
154 
155  L1TrkPtrs_.clear();
156  zBinCount_.clear();
157  ttrk_.clear();
158  tdtrk_.clear();
159  ttdtrk_.clear();
160 
161  unsigned int this_l1track = 0;
162  for (iterL1Track = TTTrackHandle->begin(); iterL1Track != TTTrackHandle->end(); iterL1Track++) {
163  edm::Ptr<L1TTTrackType> trkPtr(TTTrackHandle, this_l1track);
164  this_l1track++;
165  float trk_pt = trkPtr->momentum().perp();
166  int trk_nstubs = (int)trkPtr->getStubRefs().size();
167  float trk_chi2dof = trkPtr->chi2Red();
168  float trk_d0 = trkPtr->d0();
169  float trk_bendchi2 = trkPtr->stubPtConsistency();
170 
171  int trk_nPS = 0;
172  for (int istub = 0; istub < trk_nstubs; istub++) { // loop over the stubs
173  DetId detId(trkPtr->getStubRefs().at(istub)->getDetId());
174  if (detId.det() == DetId::Detector::Tracker) {
175  if ((detId.subdetId() == StripSubdetector::TOB && tTopo.tobLayer(detId) <= 3) ||
176  (detId.subdetId() == StripSubdetector::TID && tTopo.tidRing(detId) <= 9))
177  trk_nPS++;
178  }
179  }
180 
181  if (trk_nPS < trkNPSStubMin_)
182  continue;
183  if (!trackQualityCuts(trk_pt, trk_nstubs, trk_chi2dof, trk_bendchi2, fabs(trk_d0)))
184  continue;
185  if (fabs(iterL1Track->z0()) > trkZMax_)
186  continue;
187  if (fabs(iterL1Track->momentum().eta()) > trkEtaMax_)
188  continue;
189  if (trk_pt < trkPtMin_)
190  continue;
191  L1TrkPtrs_.push_back(trkPtr);
192  zBinCount_.push_back(0);
193 
194  if ((fabs(trk_d0) > d0CutNStubs5_ && trk_nstubs >= 5) || (trk_nstubs == 4 && fabs(trk_d0) > d0CutNStubs4_))
195  tdtrk_.push_back(1);
196  else
197  tdtrk_.push_back(0); //displaced track
198  if ((trk_nstubs >= 5 && trk_chi2dof < nStubs5DisplacedChi2Tight_ && trk_bendchi2 < nStubs5DisplacedBendTight_) ||
199  (trk_nstubs == 4 && trk_chi2dof < nStubs4DisplacedChi2Tight_ && trk_bendchi2 < nStubs4DisplacedBendTight_))
200  ttrk_.push_back(1);
201  else
202  ttrk_.push_back(0);
203  if ((trk_nstubs >= 5 && trk_chi2dof < nStubs5DisplacedChi2Tight_ && trk_bendchi2 < nStubs5DisplacedBendTight_ &&
204  fabs(trk_d0) > d0CutNStubs5_) ||
205  (trk_nstubs == 4 && trk_chi2dof < nStubs4DisplacedChi2Tight_ && trk_bendchi2 < nStubs4DisplacedBendTight_ &&
206  fabs(trk_d0) > d0CutNStubs4_))
207  ttdtrk_.push_back(1);
208  else
209  ttdtrk_.push_back(0);
210  }
211 
212  if (!L1TrkPtrs_.empty()) {
213  MaxZBin mzb;
214 
216  edm::Ref<JetBxCollection> jetRef; //null, no Calo Jet Ref
217  vector<Ptr<L1TTTrackType> > L1TrackAssocJet;
218  if (mzb.clusters != nullptr) {
219  for (int j = 0; j < mzb.nclust; ++j) {
220  //FILL Two Layer Jets for Jet Collection
221  if (mzb.clusters[j].pTtot <= trkPtMin_)
222  continue; //protects against reading bad memory
223  if (mzb.clusters[j].numtracks < 1)
224  continue;
225  if (mzb.clusters[j].numtracks > 5000)
226  continue;
227  float jetEta = mzb.clusters[j].eta;
228  float jetPhi = mzb.clusters[j].phi;
229  float jetPt = mzb.clusters[j].pTtot;
230  float jetPx = jetPt * cos(jetPhi);
231  float jetPy = jetPt * sin(jetPhi);
232  float jetPz = jetPt * sinh(jetEta);
233  float jetP = jetPt * cosh(jetEta);
234  int totalTighttrk_ = mzb.clusters[j].numttrks;
235  int totalDisptrk = mzb.clusters[j].numtdtrks;
236  int totalTightDisptrk = mzb.clusters[j].numttdtrks;
237 
238  math::XYZTLorentzVector jetP4(jetPx, jetPy, jetPz, jetP);
239  L1TrackAssocJet.clear();
240  for (unsigned int t = 0; t < L1TrkPtrs_.size(); ++t) {
241  if (L1TrackAssocJet.size() == (unsigned int)mzb.clusters[j].numtracks)
242  break;
243  float deta = L1TrkPtrs_[t]->momentum().eta() - jetEta;
244  float dphi = L1TrkPtrs_[t]->momentum().phi() - jetPhi;
245  float dZ = fabs(mzb.zbincenter - L1TrkPtrs_[t]->z0());
246  if (dZ < zStep_ && fabs(deta) < etaStep_ * 2.0 && fabs(dphi) < phiStep_ * 2.0) {
247  L1TrackAssocJet.push_back(L1TrkPtrs_[t]);
248  }
249  }
250  TkJet trkJet(jetP4,
251  L1TrackAssocJet,
252  mzb.zbincenter,
253  mzb.clusters[j].numtracks,
254  totalTighttrk_,
255  totalDisptrk,
256  totalTightDisptrk);
257  //trkJet.setDispCounters(DispCounters);
258  if (!L1TrackAssocJet.empty())
259  L1L1TrackJetProducer->push_back(trkJet);
260  }
261  }
262  //free(mzb.clusters);
263  if (displaced_)
264  iEvent.put(std::move(L1L1TrackJetProducer), "L1TrackJetsExtended");
265  else
266  iEvent.put(std::move(L1L1TrackJetProducer), "L1TrackJets");
267  delete[] mzb.clusters;
268  }
269 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
unsigned int tidRing(const DetId &id) const
bool trackQualityCuts(float trk_pt, int trk_nstub, float trk_chi2, float trk_bendchi2, float trk_d0)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
EtaPhiBin * clusters
void L2_cluster(vector< Ptr< L1TTTrackType > > L1TrkPtrs_, vector< int > ttrk_, vector< int > tdtrk_, vector< int > ttdtrk_, MaxZBin &mzb)
bool getData(T &iHolder) const
Definition: EventSetup.h:128
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
float zbincenter
vector< Ptr< L1TTTrackType > > L1TrkPtrs_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
def move
Definition: eostools.py:511
vector< int > zBinCount_
static constexpr auto TOB
Definition: DetId.h:17
const EDGetTokenT< vector< TTTrack< Ref_Phase2TrackerDigi_ > > > trackToken_
std::vector< TkJet > TkJetCollection
Definition: TkJetFwd.h:20
static constexpr auto TID
unsigned int tobLayer(const DetId &id) const
bool L1TrackJetProducer::trackQualityCuts ( float  trk_pt,
int  trk_nstub,
float  trk_chi2,
float  trk_bendchi2,
float  trk_d0 
)

Definition at line 646 of file L1TrackJetProducer.cc.

References d0CutNStubs4_, displaced_, nStubs4DisplacedBendLoose_, nStubs4DisplacedBendTight_, nStubs4DisplacedChi2Loose_, nStubs4DisplacedChi2Tight_, nStubs5DisplacedBendLoose_, and trkBendChi2Max_.

Referenced by produce().

647  {
648  bool PassQuality = false;
649  if (trk_bendchi2 < trkBendChi2Max_ && trk_chi2 < trkChi2dofMax_ && trk_nstub >= 4 && !displaced_)
650  PassQuality = true;
651  if (displaced_ && trk_bendchi2 < nStubs4DisplacedBendTight_ && trk_chi2 < nStubs4DisplacedChi2Tight_ &&
652  trk_nstub == 4 && trk_d0 <= d0CutNStubs4_)
653  PassQuality = true;
654  if (displaced_ && trk_bendchi2 < nStubs4DisplacedBendLoose_ && trk_chi2 < nStubs4DisplacedChi2Loose_ &&
655  trk_nstub == 4 && trk_d0 > d0CutNStubs4_)
656  PassQuality = true;
657  if (displaced_ && trk_bendchi2 < nStubs5DisplacedBendLoose_ && trk_chi2 < nStubs5DisplacedChi2Loose_ && trk_nstub > 4)
658  PassQuality = true;
659  return PassQuality;
660 }

Member Data Documentation

float L1TrackJetProducer::d0CutNStubs4_
private

Definition at line 90 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), produce(), and trackQualityCuts().

float L1TrackJetProducer::d0CutNStubs5_
private

Definition at line 91 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), and produce().

bool L1TrackJetProducer::displaced_
private

Definition at line 89 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), produce(), and trackQualityCuts().

int L1TrackJetProducer::etaBins_
private

Definition at line 81 of file L1TrackJetProducer.cc.

Referenced by L1_cluster(), L1TrackJetProducer(), and L2_cluster().

float L1TrackJetProducer::etaStep_
private

Definition at line 87 of file L1TrackJetProducer.cc.

Referenced by L1_cluster(), L1TrackJetProducer(), L2_cluster(), and produce().

int L1TrackJetProducer::highpTJetMinTrackMultiplicity_
private

Definition at line 79 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), and L2_cluster().

vector<Ptr<L1TTTrackType> > L1TrackJetProducer::L1TrkPtrs_
private

Definition at line 66 of file L1TrackJetProducer.cc.

Referenced by L2_cluster(), and produce().

int L1TrackJetProducer::lowpTJetMinTrackMultiplicity_
private

Definition at line 78 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), and L2_cluster().

double L1TrackJetProducer::minJetEtHighPt_
private

Definition at line 85 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), and L2_cluster().

double L1TrackJetProducer::minJetEtLowPt_
private

Definition at line 84 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), and L2_cluster().

double L1TrackJetProducer::minTrkJetpT_
private

Definition at line 83 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), and L2_cluster().

float L1TrackJetProducer::nStubs4DisplacedBendLoose_
private

Definition at line 94 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), and trackQualityCuts().

float L1TrackJetProducer::nStubs4DisplacedBendTight_
private

Definition at line 98 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), produce(), and trackQualityCuts().

float L1TrackJetProducer::nStubs4DisplacedChi2Loose_
private

Definition at line 92 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), and trackQualityCuts().

float L1TrackJetProducer::nStubs4DisplacedChi2Tight_
private

Definition at line 96 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), produce(), and trackQualityCuts().

float L1TrackJetProducer::nStubs5DisplacedBendLoose_
private

Definition at line 95 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), and trackQualityCuts().

float L1TrackJetProducer::nStubs5DisplacedBendTight_
private

Definition at line 99 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), and produce().

float L1TrackJetProducer::nStubs5DisplacedChi2Loose_
private

Definition at line 93 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer().

float L1TrackJetProducer::nStubs5DisplacedChi2Tight_
private

Definition at line 97 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), and produce().

int L1TrackJetProducer::phiBins_
private

Definition at line 82 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), and L2_cluster().

float L1TrackJetProducer::phiStep_
private

Definition at line 88 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), L2_cluster(), and produce().

vector<int> L1TrackJetProducer::tdtrk_
private

Definition at line 69 of file L1TrackJetProducer.cc.

Referenced by produce().

const EDGetTokenT<vector<TTTrack<Ref_Phase2TrackerDigi_> > > L1TrackJetProducer::trackToken_
private

Definition at line 63 of file L1TrackJetProducer.cc.

Referenced by produce().

float L1TrackJetProducer::trkBendChi2Max_
private

Definition at line 76 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), and trackQualityCuts().

float L1TrackJetProducer::trkChi2dofMax_
private

Definition at line 75 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer().

float L1TrackJetProducer::trkEtaMax_
private

Definition at line 74 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), L2_cluster(), and produce().

int L1TrackJetProducer::trkNPSStubMin_
private

Definition at line 77 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), and produce().

float L1TrackJetProducer::trkPtMax_
private

Definition at line 72 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), and L2_cluster().

float L1TrackJetProducer::trkPtMin_
private

Definition at line 73 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), and produce().

float L1TrackJetProducer::trkZMax_
private

Definition at line 71 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), L2_cluster(), and produce().

vector<int> L1TrackJetProducer::ttdtrk_
private

Definition at line 70 of file L1TrackJetProducer.cc.

Referenced by produce().

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> L1TrackJetProducer::tTopoToken_
private

Definition at line 64 of file L1TrackJetProducer.cc.

Referenced by produce().

vector<int> L1TrackJetProducer::ttrk_
private

Definition at line 68 of file L1TrackJetProducer.cc.

Referenced by produce().

vector<int> L1TrackJetProducer::zBinCount_
private

Definition at line 67 of file L1TrackJetProducer.cc.

Referenced by L2_cluster(), and produce().

int L1TrackJetProducer::zBins_
private

Definition at line 80 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), and L2_cluster().

float L1TrackJetProducer::zStep_
private

Definition at line 86 of file L1TrackJetProducer.cc.

Referenced by L1TrackJetProducer(), L2_cluster(), and produce().