CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
CTPPSPixelLocalTrackProducer Class Reference
Inheritance diagram for CTPPSPixelLocalTrackProducer:
edm::stream::EDProducer<>

Public Member Functions

 CTPPSPixelLocalTrackProducer (const edm::ParameterSet &parameterSet)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~CTPPSPixelLocalTrackProducer () 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

void run (const edm::DetSetVector< CTPPSPixelRecHit > &input, edm::DetSetVector< CTPPSPixelLocalTrack > &output)
 

Private Attributes

edm::ESWatcher< VeryForwardRealGeometryRecordgeometryWatcher_
 
edm::InputTag inputTag_
 
std::vector< uint32_t > listOfAllPlanes_
 
int maxHitPerPlane_
 
int maxHitPerRomanPot_
 
int maxTrackPerPattern_
 
int maxTrackPerRomanPot_
 
uint32_t numberOfPlanesPerPot_
 
std::unique_ptr< RPixDetPatternFinderpatternFinder_
 
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecordtokenCTPPSGeometry_
 
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelRecHit > > tokenCTPPSPixelRecHit_
 
std::unique_ptr< RPixDetTrackFindertrackFinder_
 
int verbosity_
 

Additional Inherited Members

- 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
 

Detailed Description

Definition at line 41 of file CTPPSPixelLocalTrackProducer.cc.

Constructor & Destructor Documentation

◆ CTPPSPixelLocalTrackProducer()

CTPPSPixelLocalTrackProducer::CTPPSPixelLocalTrackProducer ( const edm::ParameterSet parameterSet)
explicit

Definition at line 72 of file CTPPSPixelLocalTrackProducer.cc.

References Exception, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), mps_fire::i, inputTag_, listOfAllPlanes_, maxHitPerPlane_, maxHitPerRomanPot_, maxTrackPerPattern_, maxTrackPerRomanPot_, numberOfPlanesPerPot_, edm::parameterSet(), patternFinder_, HLT_2022v11_cff::patternFinderAlgorithm, AlCaHLTBitMon_QueryRunRegistry::string, tokenCTPPSGeometry_, tokenCTPPSPixelRecHit_, trackFinder_, and verbosity_.

72  {
74  verbosity_ = parameterSet.getUntrackedParameter<int>("verbosity");
75  maxHitPerRomanPot_ = parameterSet.getParameter<int>("maxHitPerRomanPot");
76  maxHitPerPlane_ = parameterSet.getParameter<int>("maxHitPerPlane");
77  maxTrackPerRomanPot_ = parameterSet.getParameter<int>("maxTrackPerRomanPot");
78  maxTrackPerPattern_ = parameterSet.getParameter<int>("maxTrackPerPattern");
79  numberOfPlanesPerPot_ = parameterSet.getParameter<int>("numberOfPlanesPerPot");
80 
82  std::string trackFitterAlgorithm = parameterSet.getParameter<std::string>("trackFinderAlgorithm");
83 
84  // pattern algorithm selector
85  if (patternFinderAlgorithm == "RPixRoadFinder") {
86  patternFinder_ = std::make_unique<RPixRoadFinder>(parameterSet);
87  } else {
88  throw cms::Exception("CTPPSPixelLocalTrackProducer")
89  << "Pattern finder algorithm" << patternFinderAlgorithm << " does not exist";
90  }
91 
92  listOfAllPlanes_.reserve(6);
93  for (uint32_t i = 0; i < numberOfPlanesPerPot_; ++i) {
94  listOfAllPlanes_.push_back(i);
95  }
96 
97  //tracking algorithm selector
98  if (trackFitterAlgorithm == "RPixPlaneCombinatoryTracking") {
99  trackFinder_ = std::make_unique<RPixPlaneCombinatoryTracking>(parameterSet);
100  } else {
101  throw cms::Exception("CTPPSPixelLocalTrackProducer")
102  << "Tracking fitter algorithm" << trackFitterAlgorithm << " does not exist";
103  }
104  trackFinder_->setListOfPlanes(listOfAllPlanes_);
105  trackFinder_->initialize();
106 
107  tokenCTPPSPixelRecHit_ = consumes<edm::DetSetVector<CTPPSPixelRecHit>>(inputTag_);
108  tokenCTPPSGeometry_ = esConsumes<CTPPSGeometry, VeryForwardRealGeometryRecord>();
109 
110  produces<edm::DetSetVector<CTPPSPixelLocalTrack>>();
111 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > tokenCTPPSGeometry_
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
T getUntrackedParameter(std::string const &, T const &) const
std::unique_ptr< RPixDetTrackFinder > trackFinder_
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelRecHit > > tokenCTPPSPixelRecHit_
std::unique_ptr< RPixDetPatternFinder > patternFinder_

◆ ~CTPPSPixelLocalTrackProducer()

CTPPSPixelLocalTrackProducer::~CTPPSPixelLocalTrackProducer ( )
override

Definition at line 115 of file CTPPSPixelLocalTrackProducer.cc.

115 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 119 of file CTPPSPixelLocalTrackProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, HLT_2022v11_cff::InputTag, AlCaHLTBitMon_QueryRunRegistry::string, and parallelization::uint.

119  {
121 
122  desc.add<edm::InputTag>("tag", edm::InputTag("ctppsPixelRecHits"))
123  ->setComment("inputTag of the RecHits input for the tracking algorithm");
124  desc.add<std::string>("patternFinderAlgorithm", "RPixRoadFinder")->setComment("algorithm type for pattern finder");
125  desc.add<std::string>("trackFinderAlgorithm", "RPixPlaneCombinatoryTracking")
126  ->setComment("algorithm type for track finder");
127  desc.add<uint>("trackMinNumberOfPoints", 3)->setComment("minimum number of planes to produce a track");
128  desc.addUntracked<int>("verbosity", 0)->setComment("verbosity for track producer");
129  desc.add<double>("maximumChi2OverNDF", 5.)->setComment("maximum Chi2OverNDF for accepting the track");
130  desc.add<double>("maximumXLocalDistanceFromTrack", 0.2)
131  ->setComment("maximum x distance in mm to associate a point not used for fit to the track");
132  desc.add<double>("maximumYLocalDistanceFromTrack", 0.3)
133  ->setComment("maximum y distance in mm to associate a point not used for fit to the track");
134  desc.add<int>("maxHitPerPlane", 20)
135  ->setComment("maximum hits per plane, events with higher number will not be fitted");
136  desc.add<int>("maxHitPerRomanPot", 60)
137  ->setComment("maximum hits per roman pot, events with higher number will not be fitted");
138  desc.add<int>("maxTrackPerRomanPot", 10)
139  ->setComment("maximum tracks per roman pot, events with higher track will not be saved");
140  desc.add<int>("maxTrackPerPattern", 5)
141  ->setComment("maximum tracks per pattern, events with higher track will not be saved");
142  desc.add<int>("numberOfPlanesPerPot", 6)->setComment("number of planes per pot");
143  desc.add<double>("roadRadius", 1.0)->setComment("radius of pattern search window");
144  desc.add<int>("minRoadSize", 3)->setComment("minimum number of points in a pattern");
145  desc.add<int>("maxRoadSize", 20)->setComment("maximum number of points in a pattern");
146 
147  descriptions.add("ctppsPixelLocalTracks", desc);
148 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void CTPPSPixelLocalTrackProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 152 of file CTPPSPixelLocalTrackProducer.cc.

References edm::ESWatcher< T >::check(), edm::DetSet< T >::clear(), Exception, spr::find(), edm::DetSetVector< T >::find_or_insert(), geometryWatcher_, edm::EventSetup::getHandle(), iEvent, maxHitPerPlane_, maxHitPerRomanPot_, maxTrackPerPattern_, maxTrackPerRomanPot_, topSingleLeptonDQM_PU_cfi::pattern, patternFinder_, edm::DetSet< T >::push_back(), FastTrackerRecHitMaskProducer_cfi::recHits, CTPPSDetId::rpId(), tokenCTPPSGeometry_, tokenCTPPSPixelRecHit_, HLT_2022v11_cff::track, trackFinder_, and verbosity_.

152  {
153  // Step A: get inputs
154 
158 
159  // get geometry
161  const CTPPSGeometry &geometry = *geometryHandler;
162  geometryWatcher_.check(iSetup);
163 
164  std::vector<CTPPSPixelDetId> listOfPotWithHighOccupancyPlanes;
165  std::map<CTPPSPixelDetId, uint32_t> mapHitPerPot;
166 
167  for (const auto &recHitSet : recHitVector) {
168  if (verbosity_ > 2)
169  edm::LogInfo("CTPPSPixelLocalTrackProducer")
170  << "Hits found in plane = " << recHitSet.detId() << " number = " << recHitSet.size();
171  CTPPSPixelDetId tmpRomanPotId = CTPPSPixelDetId(recHitSet.detId()).rpId();
172  uint32_t hitOnPlane = recHitSet.size();
173 
174  //Get the number of hits per pot
175  if (mapHitPerPot.find(tmpRomanPotId) == mapHitPerPot.end()) {
176  mapHitPerPot[tmpRomanPotId] = hitOnPlane;
177  } else
178  mapHitPerPot[tmpRomanPotId] += hitOnPlane;
179 
180  //check is the plane occupancy is too high and save the corresponding pot
181  if (maxHitPerPlane_ >= 0 && hitOnPlane > (uint32_t)maxHitPerPlane_) {
182  if (verbosity_ > 2)
183  edm::LogInfo("CTPPSPixelLocalTrackProducer")
184  << " ---> To many hits in the plane, pot will be excluded from tracking cleared";
185  listOfPotWithHighOccupancyPlanes.push_back(tmpRomanPotId);
186  }
187  }
188 
189  //remove rechit for pot with too many hits or containing planes with too many hits
190  for (const auto &recHitSet : recHitVector) {
191  const auto tmpDetectorId = CTPPSPixelDetId(recHitSet.detId());
192  const auto tmpRomanPotId = tmpDetectorId.rpId();
193 
194  if ((maxHitPerRomanPot_ >= 0 && mapHitPerPot[tmpRomanPotId] > (uint32_t)maxHitPerRomanPot_) ||
195  find(listOfPotWithHighOccupancyPlanes.begin(), listOfPotWithHighOccupancyPlanes.end(), tmpRomanPotId) !=
196  listOfPotWithHighOccupancyPlanes.end()) {
197  edm::DetSet<CTPPSPixelRecHit> &tmpDetSet = recHitVector[tmpDetectorId];
198  tmpDetSet.clear();
199  }
200  }
201 
203 
204  // Pattern finder
205 
206  patternFinder_->clear();
207  patternFinder_->setHits(&recHitVector);
208  patternFinder_->setGeometry(&geometry);
209  patternFinder_->findPattern();
210  std::vector<RPixDetPatternFinder::Road> patternVector = patternFinder_->getPatterns();
211 
212  //loop on all the patterns
213  int numberOfTracks = 0;
214 
215  for (const auto &pattern : patternVector) {
216  CTPPSPixelDetId firstHitDetId = CTPPSPixelDetId(pattern.at(0).detId);
217  CTPPSPixelDetId romanPotId = firstHitDetId.rpId();
218 
219  std::map<CTPPSPixelDetId, std::vector<RPixDetPatternFinder::PointInPlane>>
220  hitOnPlaneMap; //hit of the pattern organized by plane
221 
222  //loop on all the hits of the pattern
223  for (const auto &hit : pattern) {
224  CTPPSPixelDetId hitDetId = CTPPSPixelDetId(hit.detId);
225  CTPPSPixelDetId tmpRomanPotId = hitDetId.rpId();
226 
227  if (tmpRomanPotId != romanPotId) { //check that the hits belong to the same tracking station
228  throw cms::Exception("CTPPSPixelLocalTrackProducer")
229  << "Hits in the pattern must belong to the same tracking station";
230  }
231 
232  if (hitOnPlaneMap.find(hitDetId) ==
233  hitOnPlaneMap.end()) { //add the plane key in case it is the first hit of that plane
234  std::vector<RPixDetPatternFinder::PointInPlane> hitOnPlane;
235  hitOnPlane.push_back(hit);
236  hitOnPlaneMap[hitDetId] = hitOnPlane;
237  } else
238  hitOnPlaneMap[hitDetId].push_back(hit); //add the hit to an existing plane key
239  }
240 
241  trackFinder_->clear();
242  trackFinder_->setRomanPotId(romanPotId);
243  trackFinder_->setHits(&hitOnPlaneMap);
244  trackFinder_->setGeometry(&geometry);
245  trackFinder_->setZ0(geometry.rpTranslation(romanPotId).z());
246  trackFinder_->findTracks(iEvent.getRun().id().run());
247  std::vector<CTPPSPixelLocalTrack> tmpTracksVector = trackFinder_->getLocalTracks();
248 
249  if (verbosity_ > 2)
250  edm::LogInfo("CTPPSPixelLocalTrackProducer") << "tmpTracksVector = " << tmpTracksVector.size();
251  if (maxTrackPerPattern_ >= 0 && tmpTracksVector.size() > (uint32_t)maxTrackPerPattern_) {
252  if (verbosity_ > 2)
253  edm::LogInfo("CTPPSPixelLocalTrackProducer") << " ---> To many tracks in the pattern, cleared";
254  continue;
255  }
256 
257  for (const auto &track : tmpTracksVector) {
258  ++numberOfTracks;
259  edm::DetSet<CTPPSPixelLocalTrack> &tmpDetSet = foundTracks.find_or_insert(romanPotId);
260  tmpDetSet.push_back(track);
261  }
262  }
263 
264  if (verbosity_ > 1)
265  edm::LogInfo("CTPPSPixelLocalTrackProducer") << "Number of tracks will be saved = " << numberOfTracks;
266 
267  for (const auto &track : foundTracks) {
268  if (verbosity_ > 1)
269  edm::LogInfo("CTPPSPixelLocalTrackProducer")
270  << "Track found in detId = " << track.detId() << " number = " << track.size();
271  if (maxTrackPerRomanPot_ >= 0 && track.size() > (uint32_t)maxTrackPerRomanPot_) {
272  if (verbosity_ > 1)
273  edm::LogInfo("CTPPSPixelLocalTrackProducer") << " ---> Too many tracks in the pot, cleared";
274  CTPPSPixelDetId tmpRomanPotId = CTPPSPixelDetId(track.detId());
275  edm::DetSet<CTPPSPixelLocalTrack> &tmpDetSet = foundTracks[tmpRomanPotId];
276  tmpDetSet.clear();
277  }
278  }
279 
280  iEvent.put(std::make_unique<edm::DetSetVector<CTPPSPixelLocalTrack>>(foundTracks));
281 
282  return;
283 }
edm::ESWatcher< VeryForwardRealGeometryRecord > geometryWatcher_
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > tokenCTPPSGeometry_
void push_back(const T &t)
Definition: DetSet.h:66
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
reference find_or_insert(det_id_type id)
Definition: DetSetVector.h:234
int iEvent
Definition: GenABIO.cc:224
std::unique_ptr< RPixDetTrackFinder > trackFinder_
CTPPSDetId rpId() const
Definition: CTPPSDetId.h:78
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
The manager class for TOTEM RP geometry.
Definition: CTPPSGeometry.h:30
Log< level::Info, false > LogInfo
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelRecHit > > tokenCTPPSPixelRecHit_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
std::unique_ptr< RPixDetPatternFinder > patternFinder_
void clear()
Definition: DetSet.h:71

◆ run()

void CTPPSPixelLocalTrackProducer::run ( const edm::DetSetVector< CTPPSPixelRecHit > &  input,
edm::DetSetVector< CTPPSPixelLocalTrack > &  output 
)
private

Member Data Documentation

◆ geometryWatcher_

edm::ESWatcher<VeryForwardRealGeometryRecord> CTPPSPixelLocalTrackProducer::geometryWatcher_
private

Definition at line 60 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by produce().

◆ inputTag_

edm::InputTag CTPPSPixelLocalTrackProducer::inputTag_
private

Definition at line 57 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer().

◆ listOfAllPlanes_

std::vector<uint32_t> CTPPSPixelLocalTrackProducer::listOfAllPlanes_
private

Definition at line 62 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer().

◆ maxHitPerPlane_

int CTPPSPixelLocalTrackProducer::maxHitPerPlane_
private

Definition at line 52 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().

◆ maxHitPerRomanPot_

int CTPPSPixelLocalTrackProducer::maxHitPerRomanPot_
private

Definition at line 53 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().

◆ maxTrackPerPattern_

int CTPPSPixelLocalTrackProducer::maxTrackPerPattern_
private

Definition at line 55 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().

◆ maxTrackPerRomanPot_

int CTPPSPixelLocalTrackProducer::maxTrackPerRomanPot_
private

Definition at line 54 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().

◆ numberOfPlanesPerPot_

uint32_t CTPPSPixelLocalTrackProducer::numberOfPlanesPerPot_
private

Definition at line 61 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer().

◆ patternFinder_

std::unique_ptr<RPixDetPatternFinder> CTPPSPixelLocalTrackProducer::patternFinder_
private

Definition at line 64 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().

◆ tokenCTPPSGeometry_

edm::ESGetToken<CTPPSGeometry, VeryForwardRealGeometryRecord> CTPPSPixelLocalTrackProducer::tokenCTPPSGeometry_
private

Definition at line 59 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().

◆ tokenCTPPSPixelRecHit_

edm::EDGetTokenT<edm::DetSetVector<CTPPSPixelRecHit> > CTPPSPixelLocalTrackProducer::tokenCTPPSPixelRecHit_
private

Definition at line 58 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().

◆ trackFinder_

std::unique_ptr<RPixDetTrackFinder> CTPPSPixelLocalTrackProducer::trackFinder_
private

Definition at line 65 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().

◆ verbosity_

int CTPPSPixelLocalTrackProducer::verbosity_
private

Definition at line 51 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().