30 std::once_flag printOnce;
31 std::once_flag callOnce;
35 return std::make_unique<GlobalCacheTMTT>(
iConfig);
40 stubWindowSuggest_(globalCacheTMTT->stubWindowSuggest()),
41 hists_(globalCacheTMTT->
hists()),
42 htRphiErrMon_(globalCacheTMTT->htRphiErrMon()),
83 produces<TTTrackCollection>(
"TML1TracksHT").setBranchAlias(
"TML1TracksHT");
86 produces<TTTrackCollection>(
"TML1TracksRZ").setBranchAlias(
"TML1TracksRZ");
89 for (
const string& fitterName : trackFitters_) {
90 string edmName =
string(
"TML1Tracks") + fitterName;
91 produces<TTTrackCollection>(edmName).setBranchAlias(edmName);
104 globalCache()->settings().setMagneticField(bField);
106 std::stringstream
text;
107 text <<
"\n--- B field = " << bField <<
" Tesla ---\n";
109 printOnce, [](
string t) {
PrintL1trk() <<
t; }, text.str());
126 for (
const GeomDet* gd : trackerGeometry_->dets()) {
127 DetId detId = gd->geographicalId();
169 const list<TP>& vTPs = inputData.
getTPs();
170 const list<Stub*>& vStubs = inputData.stubs();
181 map<string, list<const L1fittedTrack*>> mapFinalTracks;
188 auto htTTTracksForOutput = std::make_unique<TTTrackCollection>();
189 auto rzTTTracksForOutput = std::make_unique<TTTrackCollection>();
190 map<string, unique_ptr<TTTrackCollection>> allFitTTTracksForOutput;
192 auto fitTTTracksForOutput = std::make_unique<TTTrackCollection>();
193 allFitTTTracksForOutput[fitterName] =
std::move(fitTTTracksForOutput);
202 mSectors(iPhiSec, iEtaReg) = std::make_unique<Sector>(&
settings_, iPhiSec, iEtaReg);
203 Sector* sector = mSectors(iPhiSec, iEtaReg).get();
205 mHtRphis(iPhiSec, iEtaReg) = std::make_unique<HTrphi>(
207 HTrphi* htRphi = mHtRphis(iPhiSec, iEtaReg).get();
210 if (settings_.isHTRPhiEtaRegWhitelisted(iEtaReg)) {
211 for (
Stub* stub : vStubs) {
215 if (settings_.enableDigitize())
219 bool inside = sector->inside(stub);
223 const vector<bool> inEtaSubSecs = sector->insideEtaSubSecs(stub);
226 if (settings_.enableDigitize())
230 htRphi->
store(stub, inEtaSubSecs);
245 muxHT.
exec(mHtRphis);
251 miniHTstage.
exec(mHtRphis);
258 const Sector* sector = mSectors(iPhiSec, iEtaReg).get();
261 const HTrphi* htRphi = mHtRphis(iPhiSec, iEtaReg).get();
262 const list<L1track2D>& vecTracksRphi = htRphi->
trackCands2D();
265 mMake3Dtrks(iPhiSec, iEtaReg) = std::make_unique<Make3Dtracks>(
267 Make3Dtracks* make3Dtrk = mMake3Dtrks(iPhiSec, iEtaReg).get();
270 make3Dtrk->
run(vecTracksRphi);
272 if (settings_.enableOutputIntermediateTTTracks()) {
275 const list<L1track3D>& vecTrk3D_ht = make3Dtrk->trackCands3D(
false);
276 for (
const L1track3D& trk : vecTrk3D_ht) {
278 htTTTracksForOutput->push_back(htTTTrack);
282 const list<L1track3D>& vecTrk3D_rz = make3Dtrk->trackCands3D(
true);
283 for (
const L1track3D& trk : vecTrk3D_rz) {
285 rzTTTracksForOutput->push_back(rzTTTrack);
295 for (
const string& fitterName : trackFitters_) {
298 const Make3Dtracks* make3Dtrk = mMake3Dtrks(iPhiSec, iEtaReg).get();
304 const list<L1track3D>& vecTrk3D = make3Dtrk->
trackCands3D(useRZfilt);
307 list<L1fittedTrack>& fitTrksInSec = mapmFitTrks(iPhiSec, iEtaReg)[fitterName];
313 const vector<Stub*>& stubsOnTrk = trk.stubs();
314 for (
Stub*
s : stubsOnTrk) {
327 fitTrksInSec.push_back(fitTrk);
340 for (
const string& fitterName : trackFitters_) {
344 const list<L1fittedTrack>& fitTrksInSec = mapmFitTrks(iPhiSec, iEtaReg)[fitterName];
347 list<const L1fittedTrack*> filteredFitTrksInSec = killDupFitTrks.
filter(fitTrksInSec);
353 allFitTTTracksForOutput[fitterName]->push_back(fitTTTrack);
357 mapFinalTracks[fitterName].insert(
358 mapFinalTracks[fitterName].
end(), filteredFitTrksInSec.begin(), filteredFitTrksInSec.end());
365 PrintL1trk() <<
"INPUT #TPs = " << vTPs.size() <<
" #STUBs = " << vStubs.size();
366 unsigned int numHTtracks = 0;
369 const Make3Dtracks* make3Dtrk = mMake3Dtrks(iPhiSec, iEtaReg).get();
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();
382 for (
Stub* stub : vStubs) {
384 stub->setDigitizeWarningsOn(
false);
388 hists_.
fill(inputData, mSectors, mHtRphis, mMake3Dtrks, mapFinalTracks);
392 iEvent.
put(
std::move(htTTTracksForOutput),
"TML1TracksHT");
394 iEvent.
put(
std::move(rzTTTracksForOutput),
"TML1TracksRZ");
396 for (
const string& fitterName : trackFitters_) {
397 string edmName =
string(
"TML1Tracks") + fitterName;
398 iEvent.
put(
std::move(allFitTTTracksForOutput[fitterName]), edmName);
Class for "official" algorithm to be used in TTStubBuilder.
const Settings & settings() const
bool enableDigitize() const
const StubAlgorithmOfficial * stubAlgo_
edm::InputTag clusterTruthInputTag() const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const std::vector< std::string > & useRZfilter() const
const std::vector< std::string > & trackFitters() const
HTrphi::ErrorMonitor & htRphiErrMon_
const std::vector< double > & pitchVsType() const
std::unique_ptr< DegradeBend > degradeBend_
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
#define DEFINE_FWK_MODULE(type)
void store(Stub *stub, const std::vector< bool > &inEtaSubSecs)
const TrackerTopology * trackerTopology_
ParameterSet const & getParameterSet(ParameterSetID const &id)
Global3DPoint GlobalPoint
void setFEWindows(const StubFEWindows *sw)
edm::eventsetup::ComponentDescription const * description() const
std::list< const L1fittedTrack * > filter(const std::list< L1fittedTrack > &vecTracks) const
edm::ESInputTag ttStubAlgoInputTag() const
std::unique_ptr< StubFEWindows > stubFEWindows_
void digitizeTrack(const std::string &fitterName)
edm::ESInputTag trackerGeometryInputTag() const
virtual void endJobAnalysis(const HTrphi::ErrorMonitor *htRphiErrMon=nullptr)
StubWindowSuggest & stubWindowSuggest() const
std::map< std::string, std::unique_ptr< TrackFitGeneric > > fitterWorkerMap_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
edm::EDGetTokenT< TrackingParticleCollection > tpToken_
std::vector< bool > tiltedVsType
bool isLower(const DetId &id) const
bool getData(T &iHolder) const
edm::EDGetTokenT< TTClusterAssMap > clusterTruthToken_
void exec(Array2D< std::unique_ptr< HTrphi >> &mHtRphis) const
edm::EDGetTokenT< TTStubAssMap > stubTruthToken_
static void globalEndJob(GlobalCacheTMTT *globalCacheTMTT)
virtual const std::list< L1track2D > & trackCands2D() const
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)
void produce(edm::Event &, const edm::EventSetup &) override
std::vector< std::string > trackFitters_
edm::InputTag genJetInputTag() const
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyToken_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
void exec(Array2D< std::unique_ptr< HTrphi >> &mHtRphis)
static constexpr auto TOB
std::unique_ptr< TrackFitGeneric > create(const std::string &fitterName, const Settings *settings)
void setMagneticField(float magneticField) const
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
const TrackerGeometry * trackerGeometry_
const std::list< TrackerModule > & listTrackerModule() const
edm::ESGetToken< StubAlgorithm, TTStubAlgorithmRecord > ttStubAlgoToken_
std::vector< bool > psVsType
const std::vector< bool > & tiltedVsType() const
const std::list< L1track3D > & trackCands3D(bool rzFiltered) const
const std::vector< double > & spaceVsType() const
void run(const std::list< L1track2D > &vecTracksRphi)
Class to store the L1 Track Trigger tracks.
void printResults() const
void beginRun(const edm::Run &, const edm::EventSetup &) override
edm::InputTag stubTruthInputTag() const
std::list< TrackerModule > listTrackerModule_
edm::InputTag tpInputTag() const
HTrphi::ErrorMonitor & htRphiErrMon() const
std::vector< double > pitchVsType
bool printStubWindows() const
const std::vector< bool > & barrelVsType() const
const std::vector< bool > & psVsType() const
edm::ESInputTag magneticFieldInputTag() const
unsigned int muxOutputsHT() const
std::vector< double > spaceVsType
bool enableMCtruth() const
unsigned int numEtaRegions() const
virtual void trackerGeometryAnalysis(const std::list< TrackerModule > &listTrackerModule)
unsigned int numPhiSectors() const
StubWindowSuggest & stubWindowSuggest_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
std::vector< bool > barrelVsType
edm::EDGetTokenT< TTStubDetSetVec > stubToken_
edm::ESInputTag trackerTopologyInputTag() const
static constexpr auto TID
edm::EDGetTokenT< reco::GenJetCollection > genJetToken_
TTTrack< Ref_Phase2TrackerDigi_ > makeTTTrack(const L1trackBase *trk, unsigned int iPhiSec, unsigned int iEtaReg) const
edm::InputTag stubInputTag() const
std::vector< std::string > useRZfilter_
bool enableOutputIntermediateTTTracks() const