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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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 40 of file CTPPSPixelLocalTrackProducer.cc.

Constructor & Destructor Documentation

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_, patternFinder_, AlCaHLTBitMon_QueryRunRegistry::string, tokenCTPPSPixelRecHit_, trackFinder_, and verbosity_.

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

116  {
117 }

Member Function Documentation

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

Definition at line 121 of file CTPPSPixelLocalTrackProducer.cc.

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

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

Definition at line 162 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(), CTPPSDetId::getRPId(), CTPPSGeometry::getRPTranslation(), maxHitPerPlane_, maxHitPerRomanPot_, maxTrackPerPattern_, maxTrackPerRomanPot_, listBenchmarks::pattern, patternFinder_, edm::DetSet< T >::push_back(), edm::Event::put(), tokenCTPPSPixelRecHit_, HiIsolationCommonParameters_cff::track, trackFinder_, and verbosity_.

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

Referenced by produce().

edm::InputTag CTPPSPixelLocalTrackProducer::inputTag_
private

Definition at line 57 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer().

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

Definition at line 61 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer().

int CTPPSPixelLocalTrackProducer::maxHitPerPlane_
private

Definition at line 52 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().

int CTPPSPixelLocalTrackProducer::maxHitPerRomanPot_
private

Definition at line 53 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().

int CTPPSPixelLocalTrackProducer::maxTrackPerPattern_
private

Definition at line 55 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().

int CTPPSPixelLocalTrackProducer::maxTrackPerRomanPot_
private

Definition at line 54 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().

uint32_t CTPPSPixelLocalTrackProducer::numberOfPlanesPerPot_
private

Definition at line 60 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer().

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

Definition at line 63 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().

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

Definition at line 58 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().

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

Definition at line 64 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().

int CTPPSPixelLocalTrackProducer::verbosity_
private

Definition at line 51 of file CTPPSPixelLocalTrackProducer.cc.

Referenced by CTPPSPixelLocalTrackProducer(), and produce().