CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
tmtt::TMTrackProducer Class Reference

#include <TMTrackProducer.h>

Inheritance diagram for tmtt::TMTrackProducer:
edm::stream::EDProducer< edm::GlobalCache< GlobalCacheTMTT > >

Public Member Functions

 TMTrackProducer (const edm::ParameterSet &, GlobalCacheTMTT const *globalCacheTMTT)
 
 ~TMTrackProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< GlobalCacheTMTT > >
 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 globalEndJob (GlobalCacheTMTT *globalCacheTMTT)
 
static std::unique_ptr
< GlobalCacheTMTT
initializeGlobalCache (edm::ParameterSet const &iConfig)
 

Private Types

typedef std::vector< TTTrack
< Ref_Phase2TrackerDigi_ > > 
TTTrackCollection
 

Private Member Functions

void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::EDGetTokenT< TTClusterAssMapclusterTruthToken_
 
bool debug_
 
std::unique_ptr< DegradeBenddegradeBend_
 
std::map< std::string,
std::unique_ptr
< TrackFitGeneric > > 
fitterWorkerMap_
 
edm::EDGetTokenT
< reco::GenJetCollection
genJetToken_
 
Histoshists_
 
HTrphi::ErrorMonitorhtRphiErrMon_
 
std::list< TrackerModulelistTrackerModule_
 
edm::ESGetToken< MagneticField,
IdealMagneticFieldRecord
magneticFieldToken_
 
bool runRZfilter_
 
Settings settings_
 
const StubAlgorithmOfficialstubAlgo_
 
std::unique_ptr< StubFEWindowsstubFEWindows_
 
edm::EDGetTokenT< TTStubDetSetVecstubToken_
 
edm::EDGetTokenT< TTStubAssMapstubTruthToken_
 
StubWindowSuggeststubWindowSuggest_
 
edm::EDGetTokenT
< TrackingParticleCollection
tpToken_
 
const TrackerGeometrytrackerGeometry_
 
edm::ESGetToken
< TrackerGeometry,
TrackerDigiGeometryRecord
trackerGeometryToken_
 
const TrackerTopologytrackerTopology_
 
edm::ESGetToken
< TrackerTopology,
TrackerTopologyRcd
trackerTopologyToken_
 
std::vector< std::string > trackFitters_
 
edm::ESGetToken< StubAlgorithm,
TTStubAlgorithmRecord
ttStubAlgoToken_
 
std::vector< std::string > useRZfilter_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< GlobalCacheTMTT > >
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 42 of file TMTrackProducer.h.

Member Typedef Documentation

Definition at line 52 of file TMTrackProducer.h.

Constructor & Destructor Documentation

tmtt::TMTrackProducer::TMTrackProducer ( const edm::ParameterSet iConfig,
GlobalCacheTMTT const *  globalCacheTMTT 
)
explicit

Definition at line 38 of file TMTrackProducer.cc.

References tmtt::Settings::clusterTruthInputTag(), clusterTruthToken_, tmtt::trackFitFactory::create(), tmtt::Settings::enableMCtruth(), tmtt::Settings::enableOutputIntermediateTTTracks(), fitterWorkerMap_, tmtt::Settings::genJetInputTag(), genJetToken_, tmtt::Settings::magneticFieldInputTag(), magneticFieldToken_, runRZfilter_, settings_, AlCaHLTBitMon_QueryRunRegistry::string, tmtt::Settings::stubInputTag(), stubToken_, tmtt::Settings::stubTruthInputTag(), stubTruthToken_, tmtt::Settings::tpInputTag(), tpToken_, tmtt::Settings::trackerGeometryInputTag(), trackerGeometryToken_, tmtt::Settings::trackerTopologyInputTag(), trackerTopologyToken_, tmtt::Settings::trackFitters(), trackFitters_, tmtt::Settings::ttStubAlgoInputTag(), ttStubAlgoToken_, tmtt::Settings::useRZfilter(), and useRZfilter_.

39  : settings_(iConfig), // Set configuration parameters
40  stubWindowSuggest_(globalCacheTMTT->stubWindowSuggest()), // For tuning FE stub window sizes
41  hists_(globalCacheTMTT->hists()), // Initialize histograms
42  htRphiErrMon_(globalCacheTMTT->htRphiErrMon()), // rphi HT error monitoring
43  debug_(true) // Debug printout
44  {
45  using namespace edm;
46 
47  // Get tokens for ES data access.
49  esConsumes<MagneticField, IdealMagneticFieldRecord, Transition::BeginRun>(settings_.magneticFieldInputTag());
50  trackerGeometryToken_ = esConsumes<TrackerGeometry, TrackerDigiGeometryRecord, Transition::BeginRun>(
53  esConsumes<TrackerTopology, TrackerTopologyRcd, Transition::BeginRun>(settings_.trackerTopologyInputTag());
55  esConsumes<StubAlgorithm, TTStubAlgorithmRecord, Transition::BeginRun>(settings_.ttStubAlgoInputTag());
56 
57  // Get tokens for ED data access.
58  stubToken_ = consumes<TTStubDetSetVec>(settings_.stubInputTag());
59  if (settings_.enableMCtruth()) {
60  // These lines use lots of CPU, even if no use of truth info is made later.
61  tpToken_ = consumes<TrackingParticleCollection>(settings_.tpInputTag());
62  stubTruthToken_ = consumes<TTStubAssMap>(settings_.stubTruthInputTag());
63  clusterTruthToken_ = consumes<TTClusterAssMap>(settings_.clusterTruthInputTag());
64  genJetToken_ = consumes<reco::GenJetCollection>(settings_.genJetInputTag());
65  }
66 
69  runRZfilter_ = (not useRZfilter_.empty()); // Do any fitters require an r-z track filter to be run?
70 
71  // Book histograms.
72  //hists_.book();
73 
74  // Create track fitting algorithm
75  for (const string& fitterName : trackFitters_) {
76  fitterWorkerMap_[fitterName] = trackFitFactory::create(fitterName, &settings_);
77  }
78 
79  //--- Define EDM output to be written to file (if required)
80 
82  // L1 tracks found by Hough Transform
83  produces<TTTrackCollection>("TML1TracksHT").setBranchAlias("TML1TracksHT");
84  // L1 tracks found by r-z track filter.
85  if (runRZfilter_)
86  produces<TTTrackCollection>("TML1TracksRZ").setBranchAlias("TML1TracksRZ");
87  }
88  // L1 tracks after track fit by each of the fitting algorithms under study
89  for (const string& fitterName : trackFitters_) {
90  string edmName = string("TML1Tracks") + fitterName;
91  produces<TTTrackCollection>(edmName).setBranchAlias(edmName);
92  }
93  }
edm::InputTag clusterTruthInputTag() const
Definition: Settings.h:34
const std::vector< std::string > & useRZfilter() const
Definition: Settings.h:251
const std::vector< std::string > & trackFitters() const
Definition: Settings.h:248
HTrphi::ErrorMonitor & htRphiErrMon_
edm::ESInputTag ttStubAlgoInputTag() const
Definition: Settings.h:29
edm::ESInputTag trackerGeometryInputTag() const
Definition: Settings.h:27
std::map< std::string, std::unique_ptr< TrackFitGeneric > > fitterWorkerMap_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
edm::EDGetTokenT< TrackingParticleCollection > tpToken_
edm::EDGetTokenT< TTClusterAssMap > clusterTruthToken_
edm::EDGetTokenT< TTStubAssMap > stubTruthToken_
std::vector< std::string > trackFitters_
edm::InputTag genJetInputTag() const
Definition: Settings.h:35
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyToken_
std::unique_ptr< TrackFitGeneric > create(const std::string &fitterName, const Settings *settings)
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
edm::ESGetToken< StubAlgorithm, TTStubAlgorithmRecord > ttStubAlgoToken_
edm::InputTag stubTruthInputTag() const
Definition: Settings.h:33
edm::InputTag tpInputTag() const
Definition: Settings.h:32
edm::ESInputTag magneticFieldInputTag() const
Definition: Settings.h:26
bool enableMCtruth() const
Definition: Settings.h:40
StubWindowSuggest & stubWindowSuggest_
edm::EDGetTokenT< TTStubDetSetVec > stubToken_
edm::ESInputTag trackerTopologyInputTag() const
Definition: Settings.h:28
edm::EDGetTokenT< reco::GenJetCollection > genJetToken_
edm::InputTag stubInputTag() const
Definition: Settings.h:31
std::vector< std::string > useRZfilter_
bool enableOutputIntermediateTTTracks() const
Definition: Settings.h:44
tmtt::TMTrackProducer::~TMTrackProducer ( )
inlineoverride

Definition at line 45 of file TMTrackProducer.h.

45 {}

Member Function Documentation

void tmtt::TMTrackProducer::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 97 of file TMTrackProducer.cc.

References tmtt::TrackerModule::ModuleTypeCfg::barrelVsType, tmtt::Settings::barrelVsType(), ecalTB2006H4_GenSimDigiReco_cfg::bField, degradeBend_, edm::ESHandleBase::description(), edm::EventSetup::getData(), edm::EventSetup::getHandle(), edm::getParameterSet(), MagneticField::inTesla(), TrackerTopology::isLower(), listTrackerModule_, magneticFieldToken_, edm::eventsetup::ComponentDescription::pid_, tmtt::TrackerModule::ModuleTypeCfg::pitchVsType, tmtt::Settings::pitchVsType(), tmtt::TrackerModule::ModuleTypeCfg::psVsType, tmtt::Settings::psVsType(), tmtt::StubWindowSuggest::setFEWindows(), tmtt::Settings::setMagneticField(), settings_, tmtt::TrackerModule::ModuleTypeCfg::spaceVsType, tmtt::Settings::spaceVsType(), stubAlgo_, stubFEWindows_, stubWindowSuggest_, DetId::subdetId(), submitPVValidationJobs::t, runonSM::text, StripSubdetector::TID, tmtt::TrackerModule::ModuleTypeCfg::tiltedVsType, tmtt::Settings::tiltedVsType(), StripSubdetector::TOB, trackerGeometry_, trackerGeometryToken_, trackerTopology_, trackerTopologyToken_, ttStubAlgoToken_, and PV3DBase< T, PVType, FrameType >::z().

97  {
98  // Get the B-field and store its value in the Settings class.
99  const MagneticField* theMagneticField = &(iSetup.getData(magneticFieldToken_));
100  float bField = theMagneticField->inTesla(GlobalPoint(0, 0, 0)).z(); // B field in Tesla.
101  settings_.setMagneticField(bField);
102 
103  // Set also B field in GlobalCacheTMTT (used only for Histogramming)
104  globalCache()->settings().setMagneticField(bField);
105 
106  std::stringstream text;
107  text << "\n--- B field = " << bField << " Tesla ---\n";
108  std::call_once(
109  printOnce, [](string t) { PrintL1trk() << t; }, text.str());
110 
111  // Get tracker geometry
114 
115  // Loop over tracker modules to get module info.
116 
117  // Identifies tracker module type for firmware.
118  TrackerModule::ModuleTypeCfg moduleTypeCfg;
119  moduleTypeCfg.pitchVsType = settings_.pitchVsType();
120  moduleTypeCfg.spaceVsType = settings_.spaceVsType();
121  moduleTypeCfg.barrelVsType = settings_.barrelVsType();
122  moduleTypeCfg.psVsType = settings_.psVsType();
123  moduleTypeCfg.tiltedVsType = settings_.tiltedVsType();
124 
125  listTrackerModule_.clear();
126  for (const GeomDet* gd : trackerGeometry_->dets()) {
127  DetId detId = gd->geographicalId();
128  // Phase 2 Outer Tracker uses TOB for entire barrel & TID for entire endcap.
129  if (detId.subdetId() != StripSubdetector::TOB && detId.subdetId() != StripSubdetector::TID)
130  continue;
131  if (trackerTopology_->isLower(detId)) { // Select only lower of the two sensors in a module.
132  // Store info about this tracker module.
133  listTrackerModule_.emplace_back(trackerGeometry_, trackerTopology_, moduleTypeCfg, detId);
134  }
135  }
136 
137  // Takes one copy of this to GlobalCacheTMTT for later histogramming.
138  globalCache()->setListTrackerModule(listTrackerModule_);
139 
140  // Get TTStubProducerAlgorithm algorithm, to adjust stub bend FE encoding.
141  stubAlgo_ = dynamic_cast<const StubAlgorithmOfficial*>(&iSetup.getData(ttStubAlgoToken_));
142  // Get FE stub window size from TTStub producer configuration
143  const edm::ESHandle<StubAlgorithm> stubAlgoHandle = iSetup.getHandle(ttStubAlgoToken_);
144  const edm::ParameterSet& pSetStubAlgo = getParameterSet(stubAlgoHandle.description()->pid_);
145  stubFEWindows_ = std::make_unique<StubFEWindows>(pSetStubAlgo);
146  // Initialize utilities needing FE window size.
147  stubWindowSuggest_.setFEWindows(stubFEWindows_.get());
148  degradeBend_ = std::make_unique<DegradeBend>(trackerTopology_, stubFEWindows_.get(), stubAlgo_);
149  }
const StubAlgorithmOfficial * stubAlgo_
const std::vector< double > & pitchVsType() const
Definition: Settings.h:95
std::unique_ptr< DegradeBend > degradeBend_
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
const TrackerTopology * trackerTopology_
ParameterSet const & getParameterSet(ParameterSetID const &id)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
void setFEWindows(const StubFEWindows *sw)
edm::eventsetup::ComponentDescription const * description() const
Definition: ESHandle.cc:9
std::unique_ptr< StubFEWindows > stubFEWindows_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
bool isLower(const DetId &id) const
bool getData(T &iHolder) const
Definition: EventSetup.h:122
T z() const
Definition: PV3DBase.h:61
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyToken_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
tuple text
Definition: runonSM.py:43
static constexpr auto TOB
void setMagneticField(float magneticField) const
Definition: Settings.h:400
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
const TrackerGeometry * trackerGeometry_
edm::ESGetToken< StubAlgorithm, TTStubAlgorithmRecord > ttStubAlgoToken_
const std::vector< bool > & tiltedVsType() const
Definition: Settings.h:99
Definition: DetId.h:17
const std::vector< double > & spaceVsType() const
Definition: Settings.h:96
std::list< TrackerModule > listTrackerModule_
const std::vector< bool > & barrelVsType() const
Definition: Settings.h:97
const std::vector< bool > & psVsType() const
Definition: Settings.h:98
TTStubAlgorithm_official< Ref_Phase2TrackerDigi_ > StubAlgorithmOfficial
StubWindowSuggest & stubWindowSuggest_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
static constexpr auto TID
void tmtt::TMTrackProducer::globalEndJob ( GlobalCacheTMTT globalCacheTMTT)
static

Definition at line 402 of file TMTrackProducer.cc.

References tmtt::Histos::endJobAnalysis(), tmtt::GlobalCacheTMTT::hists(), tmtt::GlobalCacheTMTT::htRphiErrMon(), tmtt::GlobalCacheTMTT::listTrackerModule(), tmtt::Settings::numEtaRegions(), tmtt::Settings::numPhiSectors(), tmtt::StubWindowSuggest::printResults(), tmtt::Settings::printStubWindows(), tmtt::GlobalCacheTMTT::settings(), tmtt::GlobalCacheTMTT::stubWindowSuggest(), and tmtt::Histos::trackerGeometryAnalysis().

402  {
403  const Settings& settings = globalCacheTMTT->settings();
404 
405  // Print stub window sizes that TMTT recommends CMS uses in FE chips.
406  if (settings.printStubWindows())
407  globalCacheTMTT->stubWindowSuggest().printResults();
408 
409  // Print (once) info about tracker geometry.
410  globalCacheTMTT->hists().trackerGeometryAnalysis(globalCacheTMTT->listTrackerModule());
411 
412  PrintL1trk() << "\n Number of (eta,phi) sectors used = (" << settings.numEtaRegions() << ","
413  << settings.numPhiSectors() << ")";
414 
415  // Print job summary
416  globalCacheTMTT->hists().endJobAnalysis(&(globalCacheTMTT->htRphiErrMon()));
417  }
std::unique_ptr< GlobalCacheTMTT > tmtt::TMTrackProducer::initializeGlobalCache ( edm::ParameterSet const &  iConfig)
static

Definition at line 34 of file TMTrackProducer.cc.

References iConfig.

34  {
35  return std::make_unique<GlobalCacheTMTT>(iConfig);
36  }
void tmtt::TMTrackProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 153 of file TMTrackProducer.cc.

References tmtt::L1fittedTrack::accepted(), clusterTruthToken_, submitPVResolutionJobs::count, debug_, degradeBend_, tmtt::L1fittedTrack::digitizeTrack(), tmtt::Settings::enableDigitize(), tmtt::Settings::enableOutputIntermediateTTTracks(), dataset::end, tmtt::Sector::etaMax(), tmtt::Sector::etaMin(), tmtt::MiniHTstage::exec(), tmtt::MuxHToutputs::exec(), tmtt::Histos::fill(), tmtt::DupFitTrkKiller::filter(), fitterWorkerMap_, genJetToken_, tmtt::InputData::getTPs(), tmtt::Stub::GP, hists_, tmtt::Stub::HT, htRphiErrMon_, listTrackerModule_, tmtt::ConverterToTTTrack::makeTTTrack(), tmtt::Settings::miniHTstage(), eostools::move(), tmtt::Settings::muxOutputsHT(), tmtt::Settings::numEtaRegions(), tmtt::Settings::numPhiSectors(), AlCaHLTBitMon_ParallelJobs::p, tmtt::Sector::phiCentre(), edm::Event::put(), tmtt::Make3Dtracks::run(), runRZfilter_, alignCSCRings::s, settings_, tmtt::HTrphi::store(), AlCaHLTBitMon_QueryRunRegistry::string, stubToken_, stubTruthToken_, stubWindowSuggest_, tmtt::Stub::TF, tpToken_, tmtt::HTbase::trackCands2D(), tmtt::Make3Dtracks::trackCands3D(), trackerGeometry_, trackerTopology_, trackFitters_, and useRZfilter_.

153  {
154  // Note useful info about MC truth particles and about reconstructed stubs .
155  InputData inputData(iEvent,
156  iSetup,
157  &settings_,
159  degradeBend_.get(),
163  tpToken_,
164  stubToken_,
167  genJetToken_);
168 
169  const list<TP>& vTPs = inputData.getTPs();
170  const list<Stub*>& vStubs = inputData.stubs();
171 
172  // Creates matrix of Sector objects, which decide which stubs are in which (eta,phi) sector
173  Array2D<unique_ptr<Sector>> mSectors(settings_.numPhiSectors(), settings_.numEtaRegions());
174  // Create matrix of r-phi Hough-Transform arrays, with one-to-one correspondence to sectors.
175  Array2D<unique_ptr<HTrphi>> mHtRphis(settings_.numPhiSectors(), settings_.numEtaRegions());
176  // Create matrix of Make3Dtracks objects, to run optional r-z track filter, with one-to-one correspondence to sectors.
177  Array2D<unique_ptr<Make3Dtracks>> mMake3Dtrks(settings_.numPhiSectors(), settings_.numEtaRegions());
178  // Create matrix of tracks from each fitter in each sector
179  Array2D<map<string, std::list<L1fittedTrack>>> mapmFitTrks(settings_.numPhiSectors(), settings_.numEtaRegions());
180  // Final tracks after duplicate removal from each track fitter in entire tracker.
181  map<string, list<const L1fittedTrack*>> mapFinalTracks;
182 
183  //=== Initialization
184  // Create utility for converting L1 tracks from our private format to official CMSSW EDM format.
185  const ConverterToTTTrack converter(&settings_);
186 
187  // Pointers to TTTrack collections for ED output.
188  auto htTTTracksForOutput = std::make_unique<TTTrackCollection>();
189  auto rzTTTracksForOutput = std::make_unique<TTTrackCollection>();
190  map<string, unique_ptr<TTTrackCollection>> allFitTTTracksForOutput;
191  for (const string& fitterName : trackFitters_) {
192  auto fitTTTracksForOutput = std::make_unique<TTTrackCollection>();
193  allFitTTTracksForOutput[fitterName] = std::move(fitTTTracksForOutput);
194  }
195 
196  //=== Do tracking in the r-phi Hough transform within each sector.
197 
198  // Fill Hough-Transform arrays with stubs.
199  for (unsigned int iPhiSec = 0; iPhiSec < settings_.numPhiSectors(); iPhiSec++) {
200  for (unsigned int iEtaReg = 0; iEtaReg < settings_.numEtaRegions(); iEtaReg++) {
201  // Initialize constants for this sector.
202  mSectors(iPhiSec, iEtaReg) = std::make_unique<Sector>(&settings_, iPhiSec, iEtaReg);
203  Sector* sector = mSectors(iPhiSec, iEtaReg).get();
204 
205  mHtRphis(iPhiSec, iEtaReg) = std::make_unique<HTrphi>(
206  &settings_, iPhiSec, iEtaReg, sector->etaMin(), sector->etaMax(), sector->phiCentre(), &htRphiErrMon_);
207  HTrphi* htRphi = mHtRphis(iPhiSec, iEtaReg).get();
208 
209  // Check sector is enabled (always true, except if user disabled some for special studies).
210  if (settings_.isHTRPhiEtaRegWhitelisted(iEtaReg)) {
211  for (Stub* stub : vStubs) {
212  // Digitize stub as would be at input to GP. This doesn't need the nonant number, since we assumed an integer number of
213  // phi digitisation bins inside an nonant. N.B. This changes the coordinates & bend stored in the stub.
214 
215  if (settings_.enableDigitize())
216  stub->digitize(iPhiSec, Stub::DigiStage::GP);
217 
218  // Check if stub is inside this sector
219  bool inside = sector->inside(stub);
220 
221  if (inside) {
222  // Check which eta subsectors within the sector the stub is compatible with (if subsectors being used).
223  const vector<bool> inEtaSubSecs = sector->insideEtaSubSecs(stub);
224 
225  // Digitize stub if as would be at input to HT, which slightly degrades its coord. & bend resolution, affecting the HT performance.
226  if (settings_.enableDigitize())
227  stub->digitize(iPhiSec, Stub::DigiStage::HT);
228 
229  // Store stub in Hough transform array for this sector, indicating its compatibility with eta subsectors with sector.
230  htRphi->store(stub, inEtaSubSecs);
231  }
232  }
233  }
234 
235  // Find tracks in r-phi HT array.
236  htRphi->end(); // Calls htArrayRphi_.end() -> HTBase::end()
237  }
238  }
239 
240  if (settings_.muxOutputsHT() > 0) {
241  // Multiplex outputs of several HT onto one pair of output opto-links.
242  // This only affects tracking performance if option busySectorKill is enabled, so that tracks that
243  // can't be sent down the link within the time-multiplexed period are killed.
244  MuxHToutputs muxHT(&settings_);
245  muxHT.exec(mHtRphis);
246  }
247 
248  // Optionally, run 2nd stage mini HT -- WITHOUT TRUNCATION ???
249  if (settings_.miniHTstage()) {
250  MiniHTstage miniHTstage(&settings_);
251  miniHTstage.exec(mHtRphis);
252  }
253 
254  //=== Make 3D tracks, optionally running r-z track filters (such as Seed Filter) & duplicate track removal.
255 
256  for (unsigned int iPhiSec = 0; iPhiSec < settings_.numPhiSectors(); iPhiSec++) {
257  for (unsigned int iEtaReg = 0; iEtaReg < settings_.numEtaRegions(); iEtaReg++) {
258  const Sector* sector = mSectors(iPhiSec, iEtaReg).get();
259 
260  // Get tracks found by r-phi HT.
261  const HTrphi* htRphi = mHtRphis(iPhiSec, iEtaReg).get();
262  const list<L1track2D>& vecTracksRphi = htRphi->trackCands2D();
263 
264  // Initialize utility for making 3D tracks from 2D ones.
265  mMake3Dtrks(iPhiSec, iEtaReg) = std::make_unique<Make3Dtracks>(
266  &settings_, iPhiSec, iEtaReg, sector->etaMin(), sector->etaMax(), sector->phiCentre());
267  Make3Dtracks* make3Dtrk = mMake3Dtrks(iPhiSec, iEtaReg).get();
268 
269  // Convert 2D tracks found by HT to 3D tracks (optionally by running r-z filters & duplicate track removal)
270  make3Dtrk->run(vecTracksRphi);
271 
272  if (settings_.enableOutputIntermediateTTTracks()) {
273  // Convert these tracks to EDM format for output (used for collaborative work outside TMTT group).
274  // Do this for tracks output by HT & optionally also for those output by r-z track filter.
275  const list<L1track3D>& vecTrk3D_ht = make3Dtrk->trackCands3D(false);
276  for (const L1track3D& trk : vecTrk3D_ht) {
277  TTTrack<Ref_Phase2TrackerDigi_> htTTTrack = converter.makeTTTrack(&trk, iPhiSec, iEtaReg);
278  htTTTracksForOutput->push_back(htTTTrack);
279  }
280 
281  if (runRZfilter_) {
282  const list<L1track3D>& vecTrk3D_rz = make3Dtrk->trackCands3D(true);
283  for (const L1track3D& trk : vecTrk3D_rz) {
284  TTTrack<Ref_Phase2TrackerDigi_> rzTTTrack = converter.makeTTTrack(&trk, iPhiSec, iEtaReg);
285  rzTTTracksForOutput->push_back(rzTTTrack);
286  }
287  }
288  }
289  }
290  }
291 
292  //=== Do a helix fit to all the track candidates.
293 
294  // Loop over all the fitting algorithms we are trying.
295  for (const string& fitterName : trackFitters_) {
296  for (unsigned int iPhiSec = 0; iPhiSec < settings_.numPhiSectors(); iPhiSec++) {
297  for (unsigned int iEtaReg = 0; iEtaReg < settings_.numEtaRegions(); iEtaReg++) {
298  const Make3Dtracks* make3Dtrk = mMake3Dtrks(iPhiSec, iEtaReg).get();
299 
300  // Does this fitter require r-z track filter to be run before it?
301  bool useRZfilt = (std::count(useRZfilter_.begin(), useRZfilter_.end(), fitterName) > 0);
302 
303  // Get 3D track candidates found by Hough transform (plus optional r-z filters/duplicate removal) in this sector.
304  const list<L1track3D>& vecTrk3D = make3Dtrk->trackCands3D(useRZfilt);
305 
306  // Find list where fitted tracks will be stored.
307  list<L1fittedTrack>& fitTrksInSec = mapmFitTrks(iPhiSec, iEtaReg)[fitterName];
308 
309  // Fit all tracks in this sector
310  for (const L1track3D& trk : vecTrk3D) {
311  // Ensure stubs assigned to this track is digitized with respect to the phi sector the track is in.
312  if (settings_.enableDigitize()) {
313  const vector<Stub*>& stubsOnTrk = trk.stubs();
314  for (Stub* s : stubsOnTrk) {
315  // Also digitize stub in way this specific track fitter uses it.
316  s->digitize(iPhiSec, Stub::DigiStage::TF);
317  }
318  }
319 
320  L1fittedTrack fitTrk = fitterWorkerMap_[fitterName]->fit(trk);
321 
322  if (fitTrk.accepted()) { // If fitter accepted track, then store it.
323  // Optionally digitize fitted track, degrading slightly resolution.
324  if (settings_.enableDigitize())
325  fitTrk.digitizeTrack(fitterName);
326  // Store fitted tracks, such that there is one fittedTracks corresponding to each HT tracks.
327  fitTrksInSec.push_back(fitTrk);
328  }
329  }
330  }
331  }
332  }
333 
334  // Run duplicate track removal on the fitted tracks if requested.
335 
336  // Initialize the duplicate track removal algorithm that can optionally be run after the track fit.
337  DupFitTrkKiller killDupFitTrks(&settings_);
338 
339  // Loop over all the fitting algorithms we used.
340  for (const string& fitterName : trackFitters_) {
341  for (unsigned int iPhiSec = 0; iPhiSec < settings_.numPhiSectors(); iPhiSec++) {
342  for (unsigned int iEtaReg = 0; iEtaReg < settings_.numEtaRegions(); iEtaReg++) {
343  // Get fitted tracks in sector
344  const list<L1fittedTrack>& fitTrksInSec = mapmFitTrks(iPhiSec, iEtaReg)[fitterName];
345 
346  // Run duplicate removal
347  list<const L1fittedTrack*> filteredFitTrksInSec = killDupFitTrks.filter(fitTrksInSec);
348 
349  // Prepare TTTrack collection.
350  for (const L1fittedTrack* fitTrk : filteredFitTrksInSec) {
351  // Convert these fitted tracks to EDM format for output (used for collaborative work outside TMTT group).
352  TTTrack<Ref_Phase2TrackerDigi_> fitTTTrack = converter.makeTTTrack(fitTrk, iPhiSec, iEtaReg);
353  allFitTTTracksForOutput[fitterName]->push_back(fitTTTrack);
354  }
355 
356  // Store fitted tracks from entire tracker.
357  mapFinalTracks[fitterName].insert(
358  mapFinalTracks[fitterName].end(), filteredFitTrksInSec.begin(), filteredFitTrksInSec.end());
359  }
360  }
361  }
362 
363  // Debug printout
364  if (debug_) {
365  PrintL1trk() << "INPUT #TPs = " << vTPs.size() << " #STUBs = " << vStubs.size();
366  unsigned int numHTtracks = 0;
367  for (unsigned int iPhiSec = 0; iPhiSec < settings_.numPhiSectors(); iPhiSec++) {
368  for (unsigned int iEtaReg = 0; iEtaReg < settings_.numEtaRegions(); iEtaReg++) {
369  const Make3Dtracks* make3Dtrk = mMake3Dtrks(iPhiSec, iEtaReg).get();
370  numHTtracks += make3Dtrk->trackCands3D(false).size();
371  }
372  }
373  PrintL1trk() << "Number of tracks after HT = " << numHTtracks;
374  for (const auto& p : mapFinalTracks) {
375  const string& fitName = p.first;
376  const list<const L1fittedTrack*> fittedTracks = p.second;
377  PrintL1trk() << "Number of tracks after " << fitName << " track helix fit = " << fittedTracks.size();
378  }
379  }
380 
381  // Allow histogramming to plot undigitized variables.
382  for (Stub* stub : vStubs) {
383  if (settings_.enableDigitize())
384  stub->setDigitizeWarningsOn(false);
385  }
386 
387  // Fill histograms to monitor input data & tracking performance.
388  hists_.fill(inputData, mSectors, mHtRphis, mMake3Dtrks, mapFinalTracks);
389 
390  //=== Store output EDM track and hardware stub collections.
391  if (settings_.enableOutputIntermediateTTTracks()) {
392  iEvent.put(std::move(htTTTracksForOutput), "TML1TracksHT");
393  if (runRZfilter_)
394  iEvent.put(std::move(rzTTTracksForOutput), "TML1TracksRZ");
395  }
396  for (const string& fitterName : trackFitters_) {
397  string edmName = string("TML1Tracks") + fitterName;
398  iEvent.put(std::move(allFitTTTracksForOutput[fitterName]), edmName);
399  }
400  }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
HTrphi::ErrorMonitor & htRphiErrMon_
std::unique_ptr< DegradeBend > degradeBend_
const TrackerTopology * trackerTopology_
std::map< std::string, std::unique_ptr< TrackFitGeneric > > fitterWorkerMap_
edm::EDGetTokenT< TrackingParticleCollection > tpToken_
edm::EDGetTokenT< TTClusterAssMap > clusterTruthToken_
edm::EDGetTokenT< TTStubAssMap > stubTruthToken_
virtual void fill(const InputData &inputData, const Array2D< std::unique_ptr< Sector >> &mSectors, const Array2D< std::unique_ptr< HTrphi >> &mHtPhis, const Array2D< std::unique_ptr< Make3Dtracks >> &mGet3Dtrks, const std::map< std::string, std::list< const L1fittedTrack * >> &mapFinalTracks)
Definition: Histos.cc:83
std::vector< std::string > trackFitters_
def move
Definition: eostools.py:511
const TrackerGeometry * trackerGeometry_
Class to store the L1 Track Trigger tracks.
Definition: TTTrack.h:29
std::list< TrackerModule > listTrackerModule_
unsigned int numEtaRegions() const
Definition: Settings.h:125
string end
Definition: dataset.py:937
unsigned int numPhiSectors() const
Definition: Settings.h:110
StubWindowSuggest & stubWindowSuggest_
edm::EDGetTokenT< TTStubDetSetVec > stubToken_
edm::EDGetTokenT< reco::GenJetCollection > genJetToken_
std::vector< std::string > useRZfilter_

Member Data Documentation

edm::EDGetTokenT<TTClusterAssMap> tmtt::TMTrackProducer::clusterTruthToken_
private

Definition at line 68 of file TMTrackProducer.h.

Referenced by produce(), and TMTrackProducer().

bool tmtt::TMTrackProducer::debug_
private

Definition at line 93 of file TMTrackProducer.h.

Referenced by produce().

std::unique_ptr<DegradeBend> tmtt::TMTrackProducer::degradeBend_
private

Definition at line 86 of file TMTrackProducer.h.

Referenced by beginRun(), and produce().

std::map<std::string, std::unique_ptr<TrackFitGeneric> > tmtt::TMTrackProducer::fitterWorkerMap_
private

Definition at line 91 of file TMTrackProducer.h.

Referenced by produce(), and TMTrackProducer().

edm::EDGetTokenT<reco::GenJetCollection> tmtt::TMTrackProducer::genJetToken_
private

Definition at line 69 of file TMTrackProducer.h.

Referenced by produce(), and TMTrackProducer().

Histos& tmtt::TMTrackProducer::hists_
private

Definition at line 88 of file TMTrackProducer.h.

Referenced by produce().

HTrphi::ErrorMonitor& tmtt::TMTrackProducer::htRphiErrMon_
private

Definition at line 89 of file TMTrackProducer.h.

Referenced by produce().

std::list<TrackerModule> tmtt::TMTrackProducer::listTrackerModule_
private

Definition at line 74 of file TMTrackProducer.h.

Referenced by beginRun(), and produce().

edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> tmtt::TMTrackProducer::magneticFieldToken_
private

Definition at line 60 of file TMTrackProducer.h.

Referenced by beginRun(), and TMTrackProducer().

bool tmtt::TMTrackProducer::runRZfilter_
private

Definition at line 80 of file TMTrackProducer.h.

Referenced by produce(), and TMTrackProducer().

Settings tmtt::TMTrackProducer::settings_
private

Definition at line 77 of file TMTrackProducer.h.

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

const StubAlgorithmOfficial* tmtt::TMTrackProducer::stubAlgo_
private

Definition at line 83 of file TMTrackProducer.h.

Referenced by beginRun().

std::unique_ptr<StubFEWindows> tmtt::TMTrackProducer::stubFEWindows_
private

Definition at line 84 of file TMTrackProducer.h.

Referenced by beginRun().

edm::EDGetTokenT<TTStubDetSetVec> tmtt::TMTrackProducer::stubToken_
private

Definition at line 65 of file TMTrackProducer.h.

Referenced by produce(), and TMTrackProducer().

edm::EDGetTokenT<TTStubAssMap> tmtt::TMTrackProducer::stubTruthToken_
private

Definition at line 67 of file TMTrackProducer.h.

Referenced by produce(), and TMTrackProducer().

StubWindowSuggest& tmtt::TMTrackProducer::stubWindowSuggest_
private

Definition at line 85 of file TMTrackProducer.h.

Referenced by beginRun(), and produce().

edm::EDGetTokenT<TrackingParticleCollection> tmtt::TMTrackProducer::tpToken_
private

Definition at line 66 of file TMTrackProducer.h.

Referenced by produce(), and TMTrackProducer().

const TrackerGeometry* tmtt::TMTrackProducer::trackerGeometry_
private

Definition at line 72 of file TMTrackProducer.h.

Referenced by beginRun(), and produce().

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> tmtt::TMTrackProducer::trackerGeometryToken_
private

Definition at line 61 of file TMTrackProducer.h.

Referenced by beginRun(), and TMTrackProducer().

const TrackerTopology* tmtt::TMTrackProducer::trackerTopology_
private

Definition at line 73 of file TMTrackProducer.h.

Referenced by beginRun(), and produce().

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tmtt::TMTrackProducer::trackerTopologyToken_
private

Definition at line 62 of file TMTrackProducer.h.

Referenced by beginRun(), and TMTrackProducer().

std::vector<std::string> tmtt::TMTrackProducer::trackFitters_
private

Definition at line 78 of file TMTrackProducer.h.

Referenced by produce(), and TMTrackProducer().

edm::ESGetToken<StubAlgorithm, TTStubAlgorithmRecord> tmtt::TMTrackProducer::ttStubAlgoToken_
private

Definition at line 63 of file TMTrackProducer.h.

Referenced by beginRun(), and TMTrackProducer().

std::vector<std::string> tmtt::TMTrackProducer::useRZfilter_
private

Definition at line 79 of file TMTrackProducer.h.

Referenced by produce(), and TMTrackProducer().