155 InputData inputData(iEvent,
169 const list<TP>& vTPs = inputData.getTPs();
170 const list<Stub*>& vStubs = inputData.stubs();
181 map<string, list<const L1fittedTrack*>> mapFinalTracks;
185 const ConverterToTTTrack converter(&
settings_);
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);
240 if (settings_.muxOutputsHT() > 0) {
244 MuxHToutputs muxHT(&settings_);
245 muxHT.exec(mHtRphis);
249 if (settings_.miniHTstage()) {
250 MiniHTstage miniHTstage(&settings_);
251 miniHTstage.exec(mHtRphis);
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();
261 const HTrphi* htRphi = mHtRphis(iPhiSec, iEtaReg).get();
262 const list<L1track2D>& vecTracksRphi = htRphi->trackCands2D();
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();
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_) {
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();
304 const list<L1track3D>& vecTrk3D = make3Dtrk->trackCands3D(useRZfilt);
307 list<L1fittedTrack>& fitTrksInSec = mapmFitTrks(iPhiSec, iEtaReg)[fitterName];
310 for (
const L1track3D& trk : vecTrk3D) {
312 if (settings_.enableDigitize()) {
313 const vector<Stub*>& stubsOnTrk = trk.stubs();
314 for (Stub*
s : stubsOnTrk) {
322 if (fitTrk.accepted()) {
324 if (settings_.enableDigitize())
325 fitTrk.digitizeTrack(fitterName);
327 fitTrksInSec.push_back(fitTrk);
337 DupFitTrkKiller killDupFitTrks(&settings_);
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++) {
344 const list<L1fittedTrack>& fitTrksInSec = mapmFitTrks(iPhiSec, iEtaReg)[fitterName];
347 list<const L1fittedTrack*> filteredFitTrksInSec = killDupFitTrks.filter(fitTrksInSec);
350 for (
const L1fittedTrack* fitTrk : filteredFitTrksInSec) {
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;
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();
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) {
383 if (settings_.enableDigitize())
384 stub->setDigitizeWarningsOn(
false);
388 hists_.
fill(inputData, mSectors, mHtRphis, mMake3Dtrks, mapFinalTracks);
391 if (settings_.enableOutputIntermediateTTTracks()) {
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);
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
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)
std::vector< std::string > trackFitters_
const TrackerGeometry * trackerGeometry_
Class to store the L1 Track Trigger tracks.
std::list< TrackerModule > listTrackerModule_
unsigned int numEtaRegions() const
unsigned int numPhiSectors() const
StubWindowSuggest & stubWindowSuggest_
edm::EDGetTokenT< TTStubDetSetVec > stubToken_
edm::EDGetTokenT< reco::GenJetCollection > genJetToken_
std::vector< std::string > useRZfilter_