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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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::EDGetTokenT< edm::DetSetVector< CTPPSPixelRecHit > > tokenCTPPSPixelRecHit_
 
std::unique_ptr< RPixDetTrackFindertrackFinder_
 
int verbosity_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 38 of file CTPPSPixelLocalTrackProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 68 of file CTPPSPixelLocalTrackProducer.cc.

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

68  {
69  inputTag_ = parameterSet.getParameter<std::string>("label");
70  verbosity_ = parameterSet.getUntrackedParameter<int>("verbosity");
71  maxHitPerRomanPot_ = parameterSet.getParameter<int>("maxHitPerRomanPot");
72  maxHitPerPlane_ = parameterSet.getParameter<int>("maxHitPerPlane");
73  maxTrackPerRomanPot_ = parameterSet.getParameter<int>("maxTrackPerRomanPot");
74  maxTrackPerPattern_ = parameterSet.getParameter<int>("maxTrackPerPattern");
75  numberOfPlanesPerPot_ = parameterSet.getParameter<int>("numberOfPlanesPerPot");
76 
77  std::string patternFinderAlgorithm = parameterSet.getParameter<std::string>("patternFinderAlgorithm");
78  std::string trackFitterAlgorithm = parameterSet.getParameter<std::string>("trackFinderAlgorithm");
79 
80  // pattern algorithm selector
81  if (patternFinderAlgorithm == "RPixRoadFinder") {
82  patternFinder_ = std::unique_ptr<RPixRoadFinder>(new RPixRoadFinder(parameterSet));
83  } else {
84  throw cms::Exception("CTPPSPixelLocalTrackProducer")
85  << "Pattern finder algorithm" << patternFinderAlgorithm << " does not exist";
86  }
87 
88  listOfAllPlanes_.reserve(6);
89  for (uint32_t i = 0; i < numberOfPlanesPerPot_; ++i) {
90  listOfAllPlanes_.push_back(i);
91  }
92 
93  //tracking algorithm selector
94  if (trackFitterAlgorithm == "RPixPlaneCombinatoryTracking") {
95  trackFinder_ = std::unique_ptr<RPixPlaneCombinatoryTracking>(new RPixPlaneCombinatoryTracking(parameterSet));
96  } else {
97  throw cms::Exception("CTPPSPixelLocalTrackProducer")
98  << "Tracking fitter algorithm" << trackFitterAlgorithm << " does not exist";
99  }
100  trackFinder_->setListOfPlanes(listOfAllPlanes_);
101  trackFinder_->initialize();
102 
103  tokenCTPPSPixelRecHit_ = consumes<edm::DetSetVector<CTPPSPixelRecHit>>(edm::InputTag(inputTag_));
104 
105  produces<edm::DetSetVector<CTPPSPixelLocalTrack>>();
106 }
T getParameter(std::string const &) const
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 ( )
override

Definition at line 110 of file CTPPSPixelLocalTrackProducer.cc.

110 {}

Member Function Documentation

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

Definition at line 114 of file CTPPSPixelLocalTrackProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), edm::ParameterDescriptionNode::setComment(), AlCaHLTBitMon_QueryRunRegistry::string, and parallelization::uint.

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

Definition at line 147 of file CTPPSPixelLocalTrackProducer.cc.

References edm::ESWatcher< T >::check(), edm::DetSet< T >::clear(), DEFINE_FWK_MODULE, Exception, spr::find(), edm::DetSetVector< T >::find_or_insert(), geometryWatcher_, edm::EventSetup::get(), edm::Event::getByToken(), edm::Event::getRun(), edm::RunBase::id(), maxHitPerPlane_, maxHitPerRomanPot_, maxTrackPerPattern_, maxTrackPerRomanPot_, topSingleLeptonDQM_PU_cfi::pattern, patternFinder_, edm::DetSet< T >::push_back(), edm::Event::put(), FastTrackerRecHitMaskProducer_cfi::recHits, CTPPSDetId::rpId(), CTPPSGeometry::rpTranslation(), edm::RunID::run(), tokenCTPPSPixelRecHit_, HLT_2018_cff::track, trackFinder_, and verbosity_.

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

Member Data Documentation

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

Definition at line 56 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by produce().

edm::InputTag CTPPSPixelLocalTrackProducer::inputTag_
private

Definition at line 54 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer().

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

Definition at line 58 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer().

int CTPPSPixelLocalTrackProducer::maxHitPerPlane_
private

Definition at line 49 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().

int CTPPSPixelLocalTrackProducer::maxHitPerRomanPot_
private

Definition at line 50 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().

int CTPPSPixelLocalTrackProducer::maxTrackPerPattern_
private

Definition at line 52 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().

int CTPPSPixelLocalTrackProducer::maxTrackPerRomanPot_
private

Definition at line 51 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().

uint32_t CTPPSPixelLocalTrackProducer::numberOfPlanesPerPot_
private

Definition at line 57 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer().

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

Definition at line 60 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().

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

Definition at line 55 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().

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

Definition at line 61 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().

int CTPPSPixelLocalTrackProducer::verbosity_
private

Definition at line 48 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().