CMS 3D CMS Logo

SeedingRegionByTracks.cc
Go to the documentation of this file.
1 // Author: Arabella Martelli, Felice Pantaleo, Marco Rovere
2 // arabella.martelli@cern.ch, felice.pantaleo@cern.ch, marco.rovere@cern.ch
3 // Date: 06/2019
4 #include <algorithm>
5 #include <set>
6 #include <vector>
7 
13 
14 using namespace ticl;
15 
17  : SeedingRegionAlgoBase(conf, sumes),
18  tracks_token_(sumes.consumes<reco::TrackCollection>(conf.getParameter<edm::InputTag>("tracks"))),
19  cutTk_(conf.getParameter<std::string>("cutTk")),
20  detector_(conf.getParameter<std::string>("detector")),
21  propName_(conf.getParameter<std::string>("propagator")),
22  bfield_token_(sumes.esConsumes<MagneticField, IdealMagneticFieldRecord, edm::Transition::BeginRun>()),
23  propagator_token_(sumes.esConsumes<Propagator, TrackingComponentsRecord, edm::Transition::BeginRun>(
24  edm::ESInputTag("", propName_))) {
25  std::string detectorName_ = (detector_ == "HFNose") ? "HGCalHFNoseSensitive" : "HGCalEESensitive";
27  edm::ESInputTag("", detectorName_));
28 }
29 
31 
34  hgcons_ = hdc.product();
35 
37 
40 }
41 
43  const edm::EventSetup &es,
44  std::vector<TICLSeedingRegion> &result) {
46  ev.getByToken(tracks_token_, tracks_h);
47  edm::ProductID trkId = tracks_h.id();
48  auto bFieldProd = bfield_.product();
49  const Propagator &prop = (*propagator_);
50 
51  int nTracks = tracks_h->size();
52  for (int i = 0; i < nTracks; ++i) {
53  const reco::Track &tk = (*tracks_h)[i];
54  if (!cutTk_((tk))) {
55  continue;
56  }
57 
59  int iSide = int(tk.eta() > 0);
60  TrajectoryStateOnSurface tsos = prop.propagate(fts, firstDisk_[iSide]->surface());
61  if (tsos.isValid()) {
62  result.emplace_back(tsos.globalPosition(), tsos.globalMomentum(), iSide, i, trkId);
63  }
64  }
65  // sorting seeding region by descending momentum
66  std::sort(result.begin(), result.end(), [](const TICLSeedingRegion &a, const TICLSeedingRegion &b) {
67  return a.directionAtOrigin.perp2() > b.directionAtOrigin.perp2();
68  });
69 }
70 
72  desc.add<edm::InputTag>("tracks", edm::InputTag("generalTracks"));
73  desc.add<std::string>("cutTk",
74  "1.48 < abs(eta) < 3.0 && pt > 1. && quality(\"highPurity\") && "
75  "hitPattern().numberOfLostHits(\"MISSING_OUTER_HITS\") < 5");
76  desc.add<std::string>("propagator", "PropagatorWithMaterial");
77  desc.add<std::string>("detector", "HGCAL");
79 }
80 
82  float zVal = hgcons_->waferZ(1, true);
83  std::pair<double, double> rMinMax = hgcons_->rangeR(zVal, true);
84 
85  for (int iSide = 0; iSide < 2; ++iSide) {
86  float zSide = (iSide == 0) ? (-1. * zVal) : zVal;
87  firstDisk_[iSide] =
88  std::make_unique<GeomDet>(Disk::build(Disk::PositionType(0, 0, zSide),
90  SimpleDiskBounds(rMinMax.first, rMinMax.second, zSide - 0.5, zSide + 0.5))
91  .get());
92  }
93 }
double waferZ(int layer, bool reco) const
static DiskPointer build(Args &&... args)
Definition: BoundDisk.h:38
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::ESHandle< MagneticField > bfield_
edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > hdc_token_
ProductID id() const
Definition: HandleBase.cc:29
edm::ESGetToken< Propagator, TrackingComponentsRecord > propagator_token_
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
T const * product() const
Definition: ESHandle.h:86
Transition
Definition: Transition.h:12
static void fillPSetDescription(edm::ParameterSetDescription &desc)
const HGCalDDDConstants * hgcons_
edm::EDGetTokenT< reco::TrackCollection > tracks_token_
edm::ESHandle< Propagator > propagator_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
std::pair< double, double > rangeR(double z, bool reco) const
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:652
const StringCutObjectSelector< reco::Track > cutTk_
double b
Definition: hdecay.h:118
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > bfield_token_
SeedingRegionByTracks(const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
fixed size matrix
HLT enums.
double a
Definition: hdecay.h:119
Definition: Common.h:8
std::unique_ptr< GeomDet > firstDisk_[2]
void initialize(const edm::EventSetup &es) override
void makeRegions(const edm::Event &ev, const edm::EventSetup &es, std::vector< TICLSeedingRegion > &result) override
FreeTrajectoryState outerFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
static void fillPSetDescription(edm::ParameterSetDescription &desc)