CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
L1FPGATrackProducer Class Reference
Inheritance diagram for L1FPGATrackProducer:
edm::one::EDProducer< edm::one::WatchRuns > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 L1FPGATrackProducer (const edm::ParameterSet &iConfig)
 Constructor/destructor. More...
 
 ~L1FPGATrackProducer () override
 
- Public Member Functions inherited from edm::one::EDProducer< edm::one::WatchRuns >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
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
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void beginRun (const edm::Run &run, const edm::EventSetup &iSetup) override
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 

Private Attributes

std::ofstream asciiEventOut_
 
string asciiEventOutName_
 
const edm::EDGetTokenT< reco::BeamSpotbsToken_
 
edm::ParameterSet config
 Containers of parameters passed by python configuration file. More...
 
std::map< string, vector< int > > dtclayerdisk
 
edm::ESGetToken< trackerDTC::Setup, trackerDTC::SetupRcdesGetToken_
 
int eventnum
 
trklet::TrackletEventProcessor eventProcessor
 
bool extended_
 
edm::FileInPath fitPatternFile
 File path for configuration files. More...
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagneticFieldToken_
 
edm::InputTag MCTruthClusterInputTag
 
edm::InputTag MCTruthStubInputTag
 
edm::FileInPath memoryModulesFile
 
unsigned int nHelixPar_
 
edm::FileInPath processingModulesFile
 
bool readMoreMcTruth_
 
trklet::Settings settings
 
trackerDTC::Setup setup_
 
edm::FileInPath tableTEDFile
 
edm::FileInPath tableTREFile
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtGeomToken_
 
edm::EDGetTokenT< TTDTCtokenDTC_
 
edm::InputTag TrackingParticleInputTag
 
edm::EDGetTokenT< std::vector< TrackingParticle > > TrackingParticleToken_
 
bool trackQuality_
 
std::unique_ptr< TrackQualitytrackQualityModel_
 
edm::EDGetTokenT< TTClusterAssociationMap< Ref_Phase2TrackerDigi_ > > ttClusterMCTruthToken_
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtTopoToken_
 
edm::FileInPath wiresFile
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 133 of file L1FPGATrackProducer.cc.

Constructor & Destructor Documentation

◆ L1FPGATrackProducer()

L1FPGATrackProducer::L1FPGATrackProducer ( const edm::ParameterSet iConfig)
explicit

Constructor/destructor.

Definition at line 202 of file L1FPGATrackProducer.cc.

203  : config(iConfig),
204  readMoreMcTruth_(iConfig.getParameter<bool>("readMoreMcTruth")),
205  MCTruthClusterInputTag(readMoreMcTruth_ ? config.getParameter<edm::InputTag>("MCTruthClusterInputTag")
206  : edm::InputTag()),
207  MCTruthStubInputTag(readMoreMcTruth_ ? config.getParameter<edm::InputTag>("MCTruthStubInputTag")
208  : edm::InputTag()),
209  TrackingParticleInputTag(readMoreMcTruth_ ? iConfig.getParameter<edm::InputTag>("TrackingParticleInputTag")
210  : edm::InputTag()),
211  bsToken_(consumes<reco::BeamSpot>(config.getParameter<edm::InputTag>("BeamSpotSource"))),
212  tokenDTC_(consumes<TTDTC>(edm::InputTag(iConfig.getParameter<edm::InputTag>("InputTagTTDTC")))),
213  magneticFieldToken_(esConsumes<edm::Transition::BeginRun>()),
216  if (readMoreMcTruth_) {
217  ttClusterMCTruthToken_ = consumes<TTClusterAssociationMap<Ref_Phase2TrackerDigi_>>(MCTruthClusterInputTag);
218  TrackingParticleToken_ = consumes<std::vector<TrackingParticle>>(TrackingParticleInputTag);
219  }
220 
221  produces<std::vector<TTTrack<Ref_Phase2TrackerDigi_>>>("Level1TTTracks").setBranchAlias("Level1TTTracks");
222 
223  asciiEventOutName_ = iConfig.getUntrackedParameter<string>("asciiFileName", "");
224 
225  fitPatternFile = iConfig.getParameter<edm::FileInPath>("fitPatternFile");
226  processingModulesFile = iConfig.getParameter<edm::FileInPath>("processingModulesFile");
227  memoryModulesFile = iConfig.getParameter<edm::FileInPath>("memoryModulesFile");
228  wiresFile = iConfig.getParameter<edm::FileInPath>("wiresFile");
229 
230  extended_ = iConfig.getParameter<bool>("Extended");
231  nHelixPar_ = iConfig.getParameter<unsigned int>("Hnpar");
232 
233  if (extended_) {
234  tableTEDFile = iConfig.getParameter<edm::FileInPath>("tableTEDFile");
235  tableTREFile = iConfig.getParameter<edm::FileInPath>("tableTREFile");
236  }
237 
238  // book ES product
239  esGetToken_ = esConsumes<trackerDTC::Setup, trackerDTC::SetupRcd, edm::Transition::BeginRun>();
240 
241  // --------------------------------------------------------------------------------
242  // set options in Settings based on inputs from configuration files
243  // --------------------------------------------------------------------------------
244 
247 
252 
253  if (extended_) {
256 
257  //FIXME: The TED and TRE tables are currently disabled by default, so we
258  //need to allow for the additional tracklets that will eventually be
259  //removed by these tables, once they are finalized
261  }
262 
263  eventnum = 0;
264  if (not asciiEventOutName_.empty()) {
265  asciiEventOut_.open(asciiEventOutName_.c_str());
266  }
267 
268  if (settings.debugTracklet()) {
269  edm::LogVerbatim("Tracklet") << "fit pattern : " << fitPatternFile.fullPath()
270  << "\n process modules : " << processingModulesFile.fullPath()
271  << "\n memory modules : " << memoryModulesFile.fullPath()
272  << "\n wires : " << wiresFile.fullPath();
273  if (extended_) {
274  edm::LogVerbatim("Tracklet") << "table_TED : " << tableTEDFile.fullPath()
275  << "\n table_TRE : " << tableTREFile.fullPath();
276  }
277  }
278 
279  trackQuality_ = iConfig.getParameter<bool>("TrackQuality");
280  if (trackQuality_) {
281  trackQualityModel_ = std::make_unique<TrackQuality>(iConfig.getParameter<edm::ParameterSet>("TrackQualityPSet"));
282  }
283 }

References asciiEventOut_, asciiEventOutName_, trklet::Settings::debugTracklet(), esGetToken_, eventnum, extended_, fitPatternFile, edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), MCTruthClusterInputTag, memoryModulesFile, nHelixPar_, processingModulesFile, readMoreMcTruth_, trklet::Settings::setExtended(), trklet::Settings::setFitPatternFile(), trklet::Settings::setMemoryModulesFile(), trklet::Settings::setNbitstrackletindex(), trklet::Settings::setNHelixPar(), trklet::Settings::setProcessingModulesFile(), trklet::Settings::setTableTEDFile(), trklet::Settings::setTableTREFile(), settings, trklet::Settings::setWiresFile(), tableTEDFile, tableTREFile, TrackingParticleInputTag, TrackingParticleToken_, trackQuality_, trackQualityModel_, ttClusterMCTruthToken_, and wiresFile.

◆ ~L1FPGATrackProducer()

L1FPGATrackProducer::~L1FPGATrackProducer ( )
override

Definition at line 287 of file L1FPGATrackProducer.cc.

287  {
288  if (asciiEventOut_.is_open()) {
289  asciiEventOut_.close();
290  }
291 }

References asciiEventOut_.

Member Function Documentation

◆ beginRun()

void L1FPGATrackProducer::beginRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprivate

///////////////// /// MANDATORY METHODS ///

Definition at line 299 of file L1FPGATrackProducer.cc.

299  {
301  // GET MAGNETIC FIELD //
302  const MagneticField* theMagneticField = &iSetup.getData(magneticFieldToken_);
303  double mMagneticFieldStrength = theMagneticField->inTesla(GlobalPoint(0, 0, 0)).z();
304  settings.setBfield(mMagneticFieldStrength);
305 
306  setup_ = iSetup.getData(esGetToken_);
307 
308  // initialize the tracklet event processing (this sets all the processing & memory modules, wiring, etc)
310 }

References esGetToken_, eventProcessor, edm::EventSetup::getData(), trklet::TrackletEventProcessor::init(), MagneticField::inTesla(), magneticFieldToken_, trklet::Settings::setBfield(), settings, setup_, and PV3DBase< T, PVType, FrameType >::z().

◆ endRun()

void L1FPGATrackProducer::endRun ( edm::Run const &  run,
edm::EventSetup const &  iSetup 
)
overrideprivate

Definition at line 295 of file L1FPGATrackProducer.cc.

295 {}

◆ produce()

void L1FPGATrackProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Prepare output

LOOP OVER TRACKING PARTICLES & GET SIMTRACKS

READ DTC STUB INFORMATION ///

Get the Inner and Outer TTCluster

Implements edm::one::EDProducerBase.

Definition at line 314 of file L1FPGATrackProducer.cc.

314  {
315  typedef std::map<trklet::L1TStub,
318  stubMapType;
320  TTClusterRef;
321 
323  auto L1TkTracksForOutput = std::make_unique<std::vector<TTTrack<Ref_Phase2TrackerDigi_>>>();
324 
325  stubMapType stubMap;
326 
328  // GET BS //
329  edm::Handle<reco::BeamSpot> beamSpotHandle;
330  iEvent.getByToken(bsToken_, beamSpotHandle);
331  math::XYZPoint bsPosition = beamSpotHandle->position();
332 
333  eventnum++;
335  ev.setEventNum(eventnum);
336  ev.setIP(bsPosition.x(), bsPosition.y());
337 
338  // tracking particles
339  edm::Handle<std::vector<TrackingParticle>> TrackingParticleHandle;
340  if (readMoreMcTruth_)
341  iEvent.getByToken(TrackingParticleToken_, TrackingParticleHandle);
342 
343  // tracker topology
344  const TrackerTopology* const tTopo = &iSetup.getData(tTopoToken_);
345  const TrackerGeometry* const theTrackerGeom = &iSetup.getData(tGeomToken_);
346 
348  // GET THE PRIMITIVES //
349  edm::Handle<TTDTC> handleDTC;
350  iEvent.getByToken<TTDTC>(tokenDTC_, handleDTC);
351 
352  // must be defined for code to compile, even if it's not used unless readMoreMcTruth_ is true
353  map<edm::Ptr<TrackingParticle>, int> translateTP;
354 
355  // MC truth association maps
357  if (readMoreMcTruth_) {
358  iEvent.getByToken(ttClusterMCTruthToken_, MCTruthTTClusterHandle);
359 
362 
363  int ntps = 1; //count from 1 ; 0 will mean invalid
364 
365  int this_tp = 0;
366  for (const auto& iterTP : *TrackingParticleHandle) {
367  edm::Ptr<TrackingParticle> tp_ptr(TrackingParticleHandle, this_tp);
368  this_tp++;
369 
370  // only keep TPs producing a cluster
371  if (MCTruthTTClusterHandle->findTTClusterRefs(tp_ptr).empty())
372  continue;
373 
374  if (iterTP.g4Tracks().empty()) {
375  continue;
376  }
377 
378  int sim_eventid = iterTP.g4Tracks().at(0).eventId().event();
379  int sim_type = iterTP.pdgId();
380  float sim_pt = iterTP.pt();
381  float sim_eta = iterTP.eta();
382  float sim_phi = iterTP.phi();
383 
384  float vx = iterTP.vertex().x();
385  float vy = iterTP.vertex().y();
386  float vz = iterTP.vertex().z();
387 
388  if (sim_pt < 1.0 || std::abs(vz) > 100.0 || hypot(vx, vy) > 50.0)
389  continue;
390 
391  ev.addL1SimTrack(sim_eventid, ntps, sim_type, sim_pt, sim_eta, sim_phi, vx, vy, vz);
392 
393  translateTP[tp_ptr] = ntps;
394  ntps++;
395 
396  } //end loop over TPs
397 
398  } // end if (readMoreMcTruth_)
399 
403 
404  // Process stubs in each region and channel within that region
405  for (const int& region : handleDTC->tfpRegions()) {
406  for (const int& channel : handleDTC->tfpChannels()) {
407  // Get the DTC name form the channel
408 
409  static string dtcbasenames[12] = {
410  "PS10G_1", "PS10G_2", "PS10G_3", "PS10G_4", "PS_1", "PS_2", "2S_1", "2S_2", "2S_3", "2S_4", "2S_5", "2S_6"};
411 
412  string dtcname = dtcbasenames[channel % 12];
413 
414  if (channel % 24 >= 12)
415  dtcname = "neg" + dtcname;
416 
417  dtcname += (channel < 24) ? "_A" : "_B";
418 
419  // Get the stubs from the DTC
420  const TTDTC::Stream& streamFromDTC{handleDTC->stream(region, channel)};
421 
422  // Prepare the DTC stubs for the IR
423  for (size_t stubIndex = 0; stubIndex < streamFromDTC.size(); ++stubIndex) {
424  const TTDTC::Frame& stub{streamFromDTC[stubIndex]};
425 
426  if (stub.first.isNull()) {
427  continue;
428  }
429 
430  const GlobalPoint& ttPos = setup_.stubPos(stub.first);
431 
432  //Get the 2 bits for the layercode
433  string layerword = stub.second.to_string().substr(61, 2);
434  unsigned int layercode = 2 * (layerword[0] - '0') + layerword[1] - '0';
435  assert(layercode < 4);
436 
437  //translation from the two bit layercode to the layer/disk number of each of the
438  //12 channels (dtcs)
439  static int layerdisktab[12][4] = {{0, 6, 8, 10},
440  {0, 7, 9, -1},
441  {1, 7, -1, -1},
442  {6, 8, 10, -1},
443  {2, 7, -1, -1},
444  {2, 9, -1, -1},
445  {3, 4, -1, -1},
446  {4, -1, -1, -1},
447  {5, -1, -1, -1},
448  {5, 8, -1, -1},
449  {6, 9, -1, -1},
450  {7, 10, -1, -1}};
451 
452  int layerdisk = layerdisktab[channel % 12][layercode];
453  assert(layerdisk != -1);
454 
455  //Get the 36 bit word - skip the lowest 3 buts (status and layer code)
456  constexpr int DTCLinkWordSize = 64;
457  constexpr int StubWordSize = 36;
458  constexpr int LayerandStatusCodeSize = 3;
459  string stubword =
460  stub.second.to_string().substr(DTCLinkWordSize - StubWordSize - LayerandStatusCodeSize, StubWordSize);
461  string stubwordhex = "";
462 
463  //Loop over the 9 words in the 36 bit stub word
464  for (unsigned int i = 0; i < 9; i++) {
465  bitset<4> bits(stubword.substr(i * 4, 4));
466  ulong val = bits.to_ulong();
467  stubwordhex += ((val < 10) ? ('0' + val) : ('A' + val - 10));
468  }
469 
472  innerCluster = stub.first->clusterRef(0);
474  outerCluster = stub.first->clusterRef(1);
475 
476  // -----------------------------------------------------
477  // check module orientation, if flipped, need to store that information for track fit
478  // -----------------------------------------------------
479 
480  const DetId innerDetId = innerCluster->getDetId();
481  const GeomDetUnit* det_inner = theTrackerGeom->idToDetUnit(innerDetId);
482  const auto* theGeomDet_inner = dynamic_cast<const PixelGeomDetUnit*>(det_inner);
483  const PixelTopology* topol_inner = dynamic_cast<const PixelTopology*>(&(theGeomDet_inner->specificTopology()));
484 
485  MeasurementPoint coords_inner = innerCluster->findAverageLocalCoordinatesCentered();
486  LocalPoint clustlp_inner = topol_inner->localPosition(coords_inner);
487  GlobalPoint posStub_inner = theGeomDet_inner->surface().toGlobal(clustlp_inner);
488 
489  const DetId outerDetId = outerCluster->getDetId();
490  const GeomDetUnit* det_outer = theTrackerGeom->idToDetUnit(outerDetId);
491  const auto* theGeomDet_outer = dynamic_cast<const PixelGeomDetUnit*>(det_outer);
492  const PixelTopology* topol_outer = dynamic_cast<const PixelTopology*>(&(theGeomDet_outer->specificTopology()));
493 
494  MeasurementPoint coords_outer = outerCluster->findAverageLocalCoordinatesCentered();
495  LocalPoint clustlp_outer = topol_outer->localPosition(coords_outer);
496  GlobalPoint posStub_outer = theGeomDet_outer->surface().toGlobal(clustlp_outer);
497 
498  bool isFlipped = (posStub_outer.mag() < posStub_inner.mag());
499 
500  vector<int> assocTPs;
501 
502  for (unsigned int iClus = 0; iClus <= 1; iClus++) { // Loop over both clusters that make up stub.
503 
504  const TTClusterRef& ttClusterRef = stub.first->clusterRef(iClus);
505 
506  // Now identify all TP's contributing to either cluster in stub.
507  vector<edm::Ptr<TrackingParticle>> vecTpPtr = MCTruthTTClusterHandle->findTrackingParticlePtrs(ttClusterRef);
508 
509  for (const edm::Ptr<TrackingParticle>& tpPtr : vecTpPtr) {
510  if (translateTP.find(tpPtr) != translateTP.end()) {
511  if (iClus == 0) {
512  assocTPs.push_back(translateTP.at(tpPtr));
513  } else {
514  assocTPs.push_back(-translateTP.at(tpPtr));
515  }
516  // N.B. Since not all tracking particles are stored in InputData::vTPs_, sometimes no match will be found.
517  } else {
518  assocTPs.push_back(0);
519  }
520  }
521  }
522 
523  double stubbend = stub.first->bendFE(); //stub.first->rawBend()
524  if (ttPos.z() < -120) {
525  stubbend = -stubbend;
526  }
527 
528  ev.addStub(dtcname,
529  region,
530  layerdisk,
531  stubwordhex,
532  setup_.psModule(setup_.dtcId(region, channel)),
533  isFlipped,
534  ttPos.x(),
535  ttPos.y(),
536  ttPos.z(),
537  stubbend,
538  stub.first->innerClusterPosition(),
539  assocTPs);
540 
541  const trklet::L1TStub& lastStub = ev.lastStub();
542  stubMap[lastStub] = stub.first;
543  }
544  }
545  }
546 
548  // NOW RUN THE L1 tracking
549 
550  if (!asciiEventOutName_.empty()) {
551  ev.write(asciiEventOut_);
552  }
553 
554  const std::vector<trklet::Track>& tracks = eventProcessor.tracks();
555 
556  // this performs the actual tracklet event processing
558 
559  int ntracks = 0;
560 
561  for (const auto& track : tracks) {
562  if (track.duplicate())
563  continue;
564 
565  ntracks++;
566 
567  // this is where we create the TTTrack object
568  double tmp_rinv = track.rinv(settings);
569  double tmp_phi = track.phi0(settings);
570  double tmp_tanL = track.tanL(settings);
571  double tmp_z0 = track.z0(settings);
572  double tmp_d0 = track.d0(settings);
573  double tmp_chi2rphi = track.chisqrphi();
574  double tmp_chi2rz = track.chisqrz();
575  unsigned int tmp_hit = track.hitpattern();
576 
577  TTTrack<Ref_Phase2TrackerDigi_> aTrack(tmp_rinv,
578  tmp_phi,
579  tmp_tanL,
580  tmp_z0,
581  tmp_d0,
582  tmp_chi2rphi,
583  tmp_chi2rz,
584  0,
585  0,
586  0,
587  tmp_hit,
589  settings.bfield());
590 
591  unsigned int trksector = track.sector();
592  unsigned int trkseed = (unsigned int)abs(track.seed());
593 
594  aTrack.setPhiSector(trksector);
595  aTrack.setTrackSeedType(trkseed);
596 
597  const vector<trklet::L1TStub>& stubptrs = track.stubs();
598  vector<trklet::L1TStub> stubs;
599 
600  stubs.reserve(stubptrs.size());
601  for (const auto& stubptr : stubptrs) {
602  stubs.push_back(stubptr);
603  }
604 
605  stubMapType::const_iterator it;
606  for (const auto& itstubs : stubs) {
607  it = stubMap.find(itstubs);
608  if (it != stubMap.end()) {
609  aTrack.addStubRef(it->second);
610  } else {
611  // could not find stub in stub map
612  }
613  }
614 
615  // pt consistency
616  aTrack.setStubPtConsistency(
617  StubPtConsistency::getConsistency(aTrack, theTrackerGeom, tTopo, settings.bfield(), settings.nHelixPar()));
618 
619  // set TTTrack word
620  aTrack.setTrackWordBits();
621 
622  if (trackQuality_) {
623  trackQualityModel_->setTrackQuality(aTrack);
624  }
625 
626  // test track word
627  //aTrack.testTrackWordBits();
628 
629  L1TkTracksForOutput->push_back(aTrack);
630  }
631 
632  iEvent.put(std::move(L1TkTracksForOutput), "Level1TTTracks");
633 
634 }

References funct::abs(), asciiEventOut_, asciiEventOutName_, cms::cuda::assert(), trklet::Settings::bfield(), bsToken_, trackerDTC::Setup::dtcId(), ev, trklet::TrackletEventProcessor::event(), eventnum, eventProcessor, StubPtConsistency::getConsistency(), edm::EventSetup::getData(), mps_fire::i, TrackerGeometry::idToDetUnit(), iEvent, createfilelist::int, Topology::localPosition(), PV3DBase< T, PVType, FrameType >::mag(), genParticles_cff::map, eostools::move(), trklet::Settings::nHelixPar(), vertices_cff::ntracks, reco::BeamSpot::position(), trackerDTC::Setup::psModule(), readMoreMcTruth_, HLT_FULL_cff::region, settings, setup_, TTDTC::stream(), trackerDTC::Setup::stubPos(), TTDTC::tfpChannels(), TTDTC::tfpRegions(), tGeomToken_, tokenDTC_, HLT_FULL_cff::track, TrackingParticleToken_, trackQuality_, trackQualityModel_, trklet::TrackletEventProcessor::tracks(), tracks, ttClusterMCTruthToken_, tTopoToken_, heppy_batch::val, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Member Data Documentation

◆ asciiEventOut_

std::ofstream L1FPGATrackProducer::asciiEventOut_
private

Definition at line 157 of file L1FPGATrackProducer.cc.

Referenced by L1FPGATrackProducer(), produce(), and ~L1FPGATrackProducer().

◆ asciiEventOutName_

string L1FPGATrackProducer::asciiEventOutName_
private

Definition at line 156 of file L1FPGATrackProducer.cc.

Referenced by L1FPGATrackProducer(), and produce().

◆ bsToken_

const edm::EDGetTokenT<reco::BeamSpot> L1FPGATrackProducer::bsToken_
private

Definition at line 177 of file L1FPGATrackProducer.cc.

Referenced by produce().

◆ config

edm::ParameterSet L1FPGATrackProducer::config
private

Containers of parameters passed by python configuration file.

Definition at line 143 of file L1FPGATrackProducer.cc.

◆ dtclayerdisk

std::map<string, vector<int> > L1FPGATrackProducer::dtclayerdisk
private

Definition at line 171 of file L1FPGATrackProducer.cc.

◆ esGetToken_

edm::ESGetToken<trackerDTC::Setup, trackerDTC::SetupRcd> L1FPGATrackProducer::esGetToken_
private

Definition at line 187 of file L1FPGATrackProducer.cc.

Referenced by beginRun(), and L1FPGATrackProducer().

◆ eventnum

int L1FPGATrackProducer::eventnum
private

Definition at line 140 of file L1FPGATrackProducer.cc.

Referenced by L1FPGATrackProducer(), and produce().

◆ eventProcessor

trklet::TrackletEventProcessor L1FPGATrackProducer::eventProcessor
private

Definition at line 163 of file L1FPGATrackProducer.cc.

Referenced by beginRun(), and produce().

◆ extended_

bool L1FPGATrackProducer::extended_
private

Definition at line 166 of file L1FPGATrackProducer.cc.

Referenced by L1FPGATrackProducer().

◆ fitPatternFile

edm::FileInPath L1FPGATrackProducer::fitPatternFile
private

File path for configuration files.

Definition at line 148 of file L1FPGATrackProducer.cc.

Referenced by L1FPGATrackProducer().

◆ magneticFieldToken_

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> L1FPGATrackProducer::magneticFieldToken_
private

Definition at line 188 of file L1FPGATrackProducer.cc.

Referenced by beginRun().

◆ MCTruthClusterInputTag

edm::InputTag L1FPGATrackProducer::MCTruthClusterInputTag
private

Definition at line 173 of file L1FPGATrackProducer.cc.

Referenced by L1FPGATrackProducer().

◆ MCTruthStubInputTag

edm::InputTag L1FPGATrackProducer::MCTruthStubInputTag
private

Definition at line 174 of file L1FPGATrackProducer.cc.

◆ memoryModulesFile

edm::FileInPath L1FPGATrackProducer::memoryModulesFile
private

Definition at line 149 of file L1FPGATrackProducer.cc.

Referenced by L1FPGATrackProducer().

◆ nHelixPar_

unsigned int L1FPGATrackProducer::nHelixPar_
private

Definition at line 165 of file L1FPGATrackProducer.cc.

Referenced by L1FPGATrackProducer().

◆ processingModulesFile

edm::FileInPath L1FPGATrackProducer::processingModulesFile
private

Definition at line 150 of file L1FPGATrackProducer.cc.

Referenced by L1FPGATrackProducer().

◆ readMoreMcTruth_

bool L1FPGATrackProducer::readMoreMcTruth_
private

Definition at line 145 of file L1FPGATrackProducer.cc.

Referenced by L1FPGATrackProducer(), and produce().

◆ settings

trklet::Settings L1FPGATrackProducer::settings
private

Definition at line 160 of file L1FPGATrackProducer.cc.

Referenced by beginRun(), L1FPGATrackProducer(), and produce().

◆ setup_

trackerDTC::Setup L1FPGATrackProducer::setup_
private

◆ tableTEDFile

edm::FileInPath L1FPGATrackProducer::tableTEDFile
private

Definition at line 153 of file L1FPGATrackProducer.cc.

Referenced by L1FPGATrackProducer().

◆ tableTREFile

edm::FileInPath L1FPGATrackProducer::tableTREFile
private

Definition at line 154 of file L1FPGATrackProducer.cc.

Referenced by L1FPGATrackProducer().

◆ tGeomToken_

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> L1FPGATrackProducer::tGeomToken_
private

Definition at line 190 of file L1FPGATrackProducer.cc.

Referenced by produce().

◆ tokenDTC_

edm::EDGetTokenT<TTDTC> L1FPGATrackProducer::tokenDTC_
private

Definition at line 181 of file L1FPGATrackProducer.cc.

Referenced by produce().

◆ TrackingParticleInputTag

edm::InputTag L1FPGATrackProducer::TrackingParticleInputTag
private

Definition at line 175 of file L1FPGATrackProducer.cc.

Referenced by L1FPGATrackProducer().

◆ TrackingParticleToken_

edm::EDGetTokenT<std::vector<TrackingParticle> > L1FPGATrackProducer::TrackingParticleToken_
private

Definition at line 180 of file L1FPGATrackProducer.cc.

Referenced by L1FPGATrackProducer(), and produce().

◆ trackQuality_

bool L1FPGATrackProducer::trackQuality_
private

Definition at line 168 of file L1FPGATrackProducer.cc.

Referenced by L1FPGATrackProducer(), and produce().

◆ trackQualityModel_

std::unique_ptr<TrackQuality> L1FPGATrackProducer::trackQualityModel_
private

Definition at line 169 of file L1FPGATrackProducer.cc.

Referenced by L1FPGATrackProducer(), and produce().

◆ ttClusterMCTruthToken_

edm::EDGetTokenT<TTClusterAssociationMap<Ref_Phase2TrackerDigi_> > L1FPGATrackProducer::ttClusterMCTruthToken_
private

Definition at line 179 of file L1FPGATrackProducer.cc.

Referenced by L1FPGATrackProducer(), and produce().

◆ tTopoToken_

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> L1FPGATrackProducer::tTopoToken_
private

Definition at line 191 of file L1FPGATrackProducer.cc.

Referenced by produce().

◆ wiresFile

edm::FileInPath L1FPGATrackProducer::wiresFile
private

Definition at line 151 of file L1FPGATrackProducer.cc.

Referenced by L1FPGATrackProducer().

trklet::Settings::setWiresFile
void setWiresFile(std::string wiresFileName)
Definition: Settings.h:78
L1FPGATrackProducer::tokenDTC_
edm::EDGetTokenT< TTDTC > tokenDTC_
Definition: L1FPGATrackProducer.cc:181
L1FPGATrackProducer::processingModulesFile
edm::FileInPath processingModulesFile
Definition: L1FPGATrackProducer.cc:150
Point2DBase
Definition: Point2DBase.h:9
trklet::TrackletEventProcessor::event
void event(SLHCEvent &ev)
Definition: TrackletEventProcessor.cc:176
MagneticField::inTesla
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
TTDTC
Class to store hardware like structured TTStub Collection used by Track Trigger emulators.
Definition: TTDTC.h:17
mps_fire.i
i
Definition: mps_fire.py:428
L1FPGATrackProducer::settings
trklet::Settings settings
Definition: L1FPGATrackProducer.cc:160
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11724
L1FPGATrackProducer::esGetToken_
edm::ESGetToken< trackerDTC::Setup, trackerDTC::SetupRcd > esGetToken_
Definition: L1FPGATrackProducer.cc:187
GeomDet
Definition: GeomDet.h:27
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
trklet::Settings::setTableTEDFile
void setTableTEDFile(std::string tableTEDFileName)
Definition: Settings.h:79
L1FPGATrackProducer::trackQualityModel_
std::unique_ptr< TrackQuality > trackQualityModel_
Definition: L1FPGATrackProducer.cc:169
L1FPGATrackProducer::TrackingParticleInputTag
edm::InputTag TrackingParticleInputTag
Definition: L1FPGATrackProducer.cc:175
TrackerTopology
Definition: TrackerTopology.h:16
trklet::TrackletEventProcessor::init
void init(Settings const &theSettings)
Definition: TrackletEventProcessor.cc:27
trklet::L1TStub
Definition: L1TStub.h:14
cms::cuda::assert
assert(be >=bs)
TTTrack
Class to store the L1 Track Trigger tracks.
Definition: TTTrack.h:29
Topology::localPosition
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
L1FPGATrackProducer::memoryModulesFile
edm::FileInPath memoryModulesFile
Definition: L1FPGATrackProducer.cc:149
L1FPGATrackProducer::ttClusterMCTruthToken_
edm::EDGetTokenT< TTClusterAssociationMap< Ref_Phase2TrackerDigi_ > > ttClusterMCTruthToken_
Definition: L1FPGATrackProducer.cc:179
vertices_cff.ntracks
ntracks
Definition: vertices_cff.py:34
edm::Handle< reco::BeamSpot >
trklet::Settings::bfield
double bfield() const
Definition: Settings.h:253
edm::Ref
Definition: AssociativeIterator.h:58
TrackerGeometry::idToDetUnit
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: TrackerGeometry.cc:183
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
L1FPGATrackProducer::bsToken_
const edm::EDGetTokenT< reco::BeamSpot > bsToken_
Definition: L1FPGATrackProducer.cc:177
L1FPGATrackProducer::readMoreMcTruth_
bool readMoreMcTruth_
Definition: L1FPGATrackProducer.cc:145
config
Definition: config.py:1
DetId
Definition: DetId.h:17
TTDTC::tfpChannels
const std::vector< int > & tfpChannels() const
Definition: TTDTC.h:35
edm::FileInPath
Definition: FileInPath.h:61
L1FPGATrackProducer::fitPatternFile
edm::FileInPath fitPatternFile
File path for configuration files.
Definition: L1FPGATrackProducer.cc:148
L1FPGATrackProducer::nHelixPar_
unsigned int nHelixPar_
Definition: L1FPGATrackProducer.cc:165
L1FPGATrackProducer::config
edm::ParameterSet config
Containers of parameters passed by python configuration file.
Definition: L1FPGATrackProducer.cc:143
L1FPGATrackProducer::setup_
trackerDTC::Setup setup_
Definition: L1FPGATrackProducer.cc:184
L1FPGATrackProducer::tableTREFile
edm::FileInPath tableTREFile
Definition: L1FPGATrackProducer.cc:154
TTDTC::Stream
std::vector< Frame > Stream
Definition: TTDTC.h:24
TTStub
Class to store the L1 Track Trigger stubs.
Definition: TTStub.h:22
L1FPGATrackProducer::eventnum
int eventnum
Definition: L1FPGATrackProducer.cc:140
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
reco::BeamSpot::position
const Point & position() const
position
Definition: BeamSpot.h:59
TTDTC::tfpRegions
const std::vector< int > & tfpRegions() const
Definition: TTDTC.h:33
Point3DBase< float, GlobalTag >
PixelTopology
Definition: PixelTopology.h:10
trackerDTC::Setup::dtcId
int dtcId(int tklId) const
Definition: Setup.cc:272
TTDTC::stream
const Stream & stream(int tfpRegion, int tfpChannel) const
Definition: TTDTC.cc:47
trklet::TrackletEventProcessor::tracks
const std::vector< Track > & tracks() const
Definition: TrackletEventProcessor.h:33
edm::ParameterSet
Definition: ParameterSet.h:47
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
L1FPGATrackProducer::MCTruthStubInputTag
edm::InputTag MCTruthStubInputTag
Definition: L1FPGATrackProducer.cc:174
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:176
L1FPGATrackProducer::eventProcessor
trklet::TrackletEventProcessor eventProcessor
Definition: L1FPGATrackProducer.cc:163
trklet::Settings::nHelixPar
unsigned int nHelixPar() const
Definition: Settings.h:245
trklet::SLHCEvent
Definition: SLHCEvent.h:17
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88286
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
L1TStubCompare
Definition: L1FPGATrackProducer.cc:119
L1FPGATrackProducer::tGeomToken_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tGeomToken_
Definition: L1FPGATrackProducer.cc:190
trklet::Settings::setBfield
void setBfield(double bfield)
Definition: Settings.h:254
TTClusterRef
TTClusterRefT< Ref_Phase2TrackerDigi_ > TTClusterRef
Definition: TTTypes.h:44
trklet::Settings::setNHelixPar
void setNHelixPar(unsigned int nHelixPar)
Definition: Settings.h:246
edm::Ptr< TrackingParticle >
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
trklet::Settings::setTableTREFile
void setTableTREFile(std::string tableTREFileName)
Definition: Settings.h:80
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64
L1FPGATrackProducer::MCTruthClusterInputTag
edm::InputTag MCTruthClusterInputTag
Definition: L1FPGATrackProducer.cc:173
heppy_batch.val
val
Definition: heppy_batch.py:351
eostools.move
def move(src, dest)
Definition: eostools.py:511
trklet::Settings::setExtended
void setExtended(bool extended)
Definition: Settings.h:249
trackerDTC::Setup::psModule
bool psModule(int dtcId) const
Definition: Setup.cc:300
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
L1FPGATrackProducer::asciiEventOutName_
string asciiEventOutName_
Definition: L1FPGATrackProducer.cc:156
ev
bool ev
Definition: Hydjet2Hadronizer.cc:97
L1FPGATrackProducer::extended_
bool extended_
Definition: L1FPGATrackProducer.cc:166
trackerDTC::Setup::stubPos
GlobalPoint stubPos(bool hybrid, const TTDTC::Frame &frame, int tfpRegion, int tfpChannel) const
Definition: Setup.cc:615
trklet::Settings::setMemoryModulesFile
void setMemoryModulesFile(std::string memoryModulesFileName)
Definition: Settings.h:77
TTDTC::Frame
std::pair< TTStubRef, BV > Frame
Definition: TTDTC.h:22
trklet::Settings::debugTracklet
bool debugTracklet() const
Definition: Settings.h:182
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TTCluster
NOTE: this is needed even if it seems not.
Definition: TTCluster.h:27
edm::EDConsumerBase::esConsumes
auto esConsumes()
Definition: EDConsumerBase.h:206
StubPtConsistency::getConsistency
float getConsistency(TTTrack< Ref_Phase2TrackerDigi_ > aTrack, const TrackerGeometry *theTrackerGeom, const TrackerTopology *tTopo, double mMagneticFieldStrength, int nPar)
Definition: StubPtConsistency.cc:9
L1FPGATrackProducer::tableTEDFile
edm::FileInPath tableTEDFile
Definition: L1FPGATrackProducer.cc:153
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
genParticles_cff.map
map
Definition: genParticles_cff.py:11
L1FPGATrackProducer::TrackingParticleToken_
edm::EDGetTokenT< std::vector< TrackingParticle > > TrackingParticleToken_
Definition: L1FPGATrackProducer.cc:180
trklet::Settings::setProcessingModulesFile
void setProcessingModulesFile(std::string processingModulesFileName)
Definition: Settings.h:74
trklet::Settings::setFitPatternFile
void setFitPatternFile(std::string fitPatternFileName)
Definition: Settings.h:73
L1FPGATrackProducer::asciiEventOut_
std::ofstream asciiEventOut_
Definition: L1FPGATrackProducer.cc:157
L1FPGATrackProducer::wiresFile
edm::FileInPath wiresFile
Definition: L1FPGATrackProducer.cc:151
MagneticField
Definition: MagneticField.h:19
L1FPGATrackProducer::magneticFieldToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
Definition: L1FPGATrackProducer.cc:188
edm::InputTag
Definition: InputTag.h:15
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:161
L1FPGATrackProducer::trackQuality_
bool trackQuality_
Definition: L1FPGATrackProducer.cc:168
L1FPGATrackProducer::tTopoToken_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
Definition: L1FPGATrackProducer.cc:191
trklet::Settings::setNbitstrackletindex
void setNbitstrackletindex(unsigned int nbitstrackletindex)
Definition: Settings.h:272
TrackerGeometry
Definition: TrackerGeometry.h:14