79 using namespace cmsdt;
82 typedef std::map<DTChamberId, DTDigiCollection, std::less<DTChamberId>>
DTDigiMap;
110 bool hasPosRF(
int wh,
int sec)
const;
116 void setChiSquareThreshold(
float ch2Thr);
175 std::vector<DTDigiCollection*> distribDigis(
std::queue<std::pair<DTLayerId, DTDigi>>& inQ);
176 void processDigi(
std::queue<std::pair<DTLayerId, DTDigi>>& inQ,
183 void assignIndex(std::vector<metaPrimitive>& inMPaths);
184 void assignIndexPerBX(std::vector<metaPrimitive>& inMPaths);
187 const std::unordered_map<int, int>
qmap_;
192 bool operator()(std::pair<DTLayerId, DTDigi>
a, std::pair<DTLayerId, DTDigi>
b)
const {
193 return (
a.second.time() <
b.second.time());
195 }
const DigiTimeOrdering;
199 : qmap_({{8, 8}, {7, 7}, {6, 6}, {4, 4}, {3, 3}, {2, 2}, {1, 1}}) {
200 produces<L1Phase2MuDTPhContainer>();
201 produces<L1Phase2MuDTThContainer>();
202 produces<L1Phase2MuDTExtPhContainer>();
203 produces<L1Phase2MuDTExtThContainer>();
205 debug_ =
pset.getUntrackedParameter<
bool>(
"debug");
206 dump_ =
pset.getUntrackedParameter<
bool>(
"dump");
208 scenario_ =
pset.getParameter<
int>(
"scenario");
210 df_extended_ =
pset.getParameter<
int>(
"df_extended");
211 co_option_ =
pset.getParameter<
int>(
"co_option");
212 co_quality_ =
pset.getParameter<
int>(
"co_quality");
213 max_index_ =
pset.getParameter<
int>(
"max_primitives") - 1;
215 dtDigisToken_ = consumes<DTDigiCollection>(
pset.getParameter<
edm::InputTag>(
"digiTag"));
217 rpcRecHitsLabel_ = consumes<RPCRecHitCollection>(
pset.getParameter<
edm::InputTag>(
"rpcRecHits"));
218 useRPC_ =
pset.getParameter<
bool>(
"useRPC");
221 algo_ =
pset.getParameter<
int>(
"algo");
225 output_mixer_ =
pset.getParameter<
bool>(
"output_mixer");
226 output_latpredictor_ =
pset.getParameter<
bool>(
"output_latpredictor");
227 output_slfitter_ =
pset.getParameter<
bool>(
"output_slfitter");
228 output_slfilter_ =
pset.getParameter<
bool>(
"output_slfilter");
229 output_confirmed_ =
pset.getParameter<
bool>(
"output_confirmed");
230 output_matcher_ =
pset.getParameter<
bool>(
"output_matcher");
231 allow_confirmation_ =
pset.getParameter<
bool>(
"allow_confirmation");
234 globalcoordsobtainer_ = std::make_shared<GlobalCoordsObtainer>(
pset);
235 globalcoordsobtainer_->generate_luts();
239 std::make_unique<PseudoBayesGrouping>(
pset.getParameter<
edm::ParameterSet>(
"PseudoBayesPattern"), consumesColl);
242 std::make_unique<HoughGrouping>(
pset.getParameter<
edm::ParameterSet>(
"HoughGrouping"), consumesColl);
244 grouping_obj_ = std::make_unique<TrapezoidalGrouping>(
pset, consumesColl);
249 LogDebug(
"DTTrigPhase2Prod") <<
"DTp2:constructor: JM analyzer";
250 mpathanalyzer_ = std::make_unique<MuonPathSLFitter>(
pset, consumesColl, globalcoordsobtainer_);
251 latprovider_ = std::make_unique<LateralityCoarsedProvider>(
pset, consumesColl);
254 LogDebug(
"DTTrigPhase2Prod") <<
"DTp2:constructor: Full chamber analyzer";
255 mpathanalyzer_ = std::make_unique<MuonPathAnalyzerInChamber>(
pset, consumesColl, globalcoordsobtainer_);
259 activateBuffer_ =
pset.getParameter<
bool>(
"activateBuffer");
260 superCellhalfspacewidth_ =
pset.getParameter<
int>(
"superCellspacewidth") / 2;
261 superCelltimewidth_ =
pset.getParameter<
double>(
"superCelltimewidth");
263 mpathqualityenhancer_ = std::make_unique<MPSLFilter>(
pset);
264 mpathqualityenhancerbayes_ = std::make_unique<MPQualityEnhancerFilterBayes>(
pset);
265 mpathredundantfilter_ = std::make_unique<MPRedundantFilter>(
pset);
266 mpathhitsfilter_ = std::make_unique<MPCleanHitsFilter>(
pset);
267 mpathconfirmator_ = std::make_unique<MuonPathConfirmator>(
pset, consumesColl);
268 mpathassociator_ = std::make_unique<MuonPathCorFitter>(
pset, consumesColl, globalcoordsobtainer_);
269 mpathcorfilter_ = std::make_unique<MPCorFilter>(
pset);
270 mpathcoifilter_ = std::make_unique<MPCoincidenceFilter>(
pset);
271 rpc_integrator_ = std::make_unique<RPCIntegrator>(
pset, consumesColl);
273 dtGeomH = esConsumes<DTGeometry, MuonGeometryRecord, edm::Transition::BeginRun>();
278 LogDebug(
"DTTrigPhase2Prod") <<
"DTp2: calling destructor" << std::endl;
283 LogDebug(
"DTTrigPhase2Prod") <<
"beginRun " << iRun.
id().
run();
285 LogDebug(
"DTTrigPhase2Prod") <<
"beginRun: getting DT geometry";
304 LogDebug(
"DTTrigPhase2Prod") <<
"produce";
309 LogDebug(
"DTTrigPhase2Prod") <<
"\t Getting the RPC RecHits" << std::endl;
319 for (
const auto& detUnitIt : *dtdigis) {
320 const DTLayerId& layId = detUnitIt.first;
323 digiMap[chambId].put(
range, layId);
328 LogDebug(
"DTTrigPhase2Prod") <<
"produce - Getting and grouping digis per chamber using a buffer and super cells.";
330 LogDebug(
"DTTrigPhase2Prod") <<
"produce - Getting and grouping digis per chamber.";
332 std::map<int, MuonPathPtrs> muonpaths;
339 if (dmit == digiMap.end())
344 std::vector<std::pair<DTLayerId, DTDigi>> tmpvec;
347 for (
const auto& dtLayerIdIt : (*dmit).second) {
349 digiIt != (dtLayerIdIt.second).second;
351 tmpvec.emplace_back(dtLayerIdIt.first, *digiIt);
360 std::sort(tmpvec.begin(), tmpvec.end(), DigiTimeOrdering);
361 std::queue<std::pair<DTLayerId, DTDigi>> timequeue;
363 for (
const auto& elem : tmpvec)
364 timequeue.emplace(elem);
368 std::vector<DTDigiCollection*> superCells;
374 while (!superCells.empty()) {
376 superCells.pop_back();
385 for (
auto& ch_muonpaths : muonpaths) {
386 for (
unsigned int i = 0;
i < ch_muonpaths.second.size();
i++) {
388 ss <<
iEvent.id().event() <<
" mpath " <<
i <<
": ";
389 for (
int lay = 0; lay < ch_muonpaths.second.at(
i)->nprimitives(); lay++)
390 ss << ch_muonpaths.second.at(
i)->primitive(lay)->channelId() <<
" ";
391 for (
int lay = 0; lay < ch_muonpaths.second.at(
i)->nprimitives(); lay++)
392 ss << ch_muonpaths.second.at(
i)->primitive(lay)->tdcTimeStamp() <<
" ";
393 for (
int lay = 0; lay < ch_muonpaths.second.at(
i)->nprimitives(); lay++)
394 ss << ch_muonpaths.second.at(
i)->primitive(lay)->laterality() <<
" ";
400 std::map<int, std::vector<lat_vector>> lateralities;
402 for (
auto& ch_muonpaths : muonpaths) {
404 latprovider_->run(
iEvent, iEventSetup, ch_muonpaths.second, lateralities[ch_muonpaths.first]);
410 std::map<int, MuonPathPtrs> filteredmuonpaths;
411 for (
auto& ch_muonpaths : muonpaths) {
420 for (
auto& ch_filteredmuonpaths : filteredmuonpaths) {
421 for (
unsigned int i = 0;
i < ch_filteredmuonpaths.second.size();
i++) {
423 ss <<
iEvent.id().event() <<
" filt. mpath " <<
i <<
": ";
424 for (
int lay = 0; lay < ch_filteredmuonpaths.second.at(
i)->nprimitives(); lay++)
425 ss << ch_filteredmuonpaths.second.at(
i)->primitive(lay)->channelId() <<
" ";
426 for (
int lay = 0; lay < ch_filteredmuonpaths.second.at(
i)->nprimitives(); lay++)
427 ss << ch_filteredmuonpaths.second.at(
i)->primitive(lay)->tdcTimeStamp() <<
" ";
440 for (
auto& ch_muonpaths : muonpaths) {
441 LogDebug(
"DTTrigPhase2Prod") <<
"MUON PATHS found: " << ch_muonpaths.second.size() <<
" (" 442 << filteredmuonpaths[ch_muonpaths.first].size() <<
") in event " 447 LogDebug(
"DTTrigPhase2Prod") <<
"filling NmetaPrimtives" << std::endl;
448 std::map<int, std::vector<metaPrimitive>> metaPrimitives;
449 std::map<int, MuonPathPtrs> outmpaths;
452 LogDebug(
"DTTrigPhase2Prod") <<
"Fitting 1SL ";
453 for (
auto& ch_muonpaths : muonpaths) {
458 lateralities[ch_muonpaths.first],
459 metaPrimitives[ch_muonpaths.first]);
461 for (
auto& inMPath : ch_muonpaths.second) {
462 auto sl = inMPath->primitive(0)->superLayerId();
463 int selected_lay = 1;
464 if (inMPath->primitive(0)->tdcTimeStamp() != -1)
466 int dumLayId = inMPath->primitive(selected_lay)->cameraId();
468 DTSuperLayerId MuonPathSLId(dtDumlayerId.wheel(), dtDumlayerId.station(), dtDumlayerId.sector(), sl + 1);
470 metaPrimitives[ch_muonpaths.first].emplace_back(
metaPrimitive({MuonPathSLId.rawId(),
480 inMPath->primitive(0)->channelId(),
481 inMPath->primitive(0)->tdcTimeStamp(),
483 inMPath->primitive(1)->channelId(),
484 inMPath->primitive(1)->tdcTimeStamp(),
486 inMPath->primitive(2)->channelId(),
487 inMPath->primitive(2)->tdcTimeStamp(),
489 inMPath->primitive(3)->channelId(),
490 inMPath->primitive(3)->tdcTimeStamp(),
506 metaPrimitives[ch_muonpaths.first].emplace_back(
metaPrimitive({MuonPathSLId.rawId(),
528 inMPath->primitive(0)->channelId(),
529 inMPath->primitive(0)->tdcTimeStamp(),
531 inMPath->primitive(1)->channelId(),
532 inMPath->primitive(1)->tdcTimeStamp(),
534 inMPath->primitive(2)->channelId(),
535 inMPath->primitive(2)->tdcTimeStamp(),
537 inMPath->primitive(3)->channelId(),
538 inMPath->primitive(3)->tdcTimeStamp(),
544 for (
auto& inMPath : ch_muonpaths.second) {
546 auto sl = inMPath->primitive(0)->superLayerId();
547 int selected_lay = 1;
548 if (inMPath->primitive(0)->tdcTimeStamp() != -1)
550 int dumLayId = inMPath->primitive(selected_lay)->cameraId();
552 DTSuperLayerId MuonPathSLId(dtDumlayerId.wheel(), dtDumlayerId.station(), dtDumlayerId.sector(), sl + 1);
553 for (
auto&
latcomb : lateralities[ch_muonpaths.first][imp]) {
555 metaPrimitives[ch_muonpaths.first].emplace_back(
metaPrimitive({MuonPathSLId.rawId(),
565 inMPath->primitive(0)->channelId(),
566 inMPath->primitive(0)->tdcTimeStamp(),
568 inMPath->primitive(1)->channelId(),
569 inMPath->primitive(1)->tdcTimeStamp(),
571 inMPath->primitive(2)->channelId(),
572 inMPath->primitive(2)->tdcTimeStamp(),
574 inMPath->primitive(3)->channelId(),
575 inMPath->primitive(3)->tdcTimeStamp(),
591 metaPrimitives[ch_muonpaths.first].emplace_back(
metaPrimitive({MuonPathSLId.rawId(),
613 inMPath->primitive(0)->channelId(),
614 inMPath->primitive(0)->tdcTimeStamp(),
616 inMPath->primitive(1)->channelId(),
617 inMPath->primitive(1)->tdcTimeStamp(),
619 inMPath->primitive(2)->channelId(),
620 inMPath->primitive(2)->tdcTimeStamp(),
622 inMPath->primitive(3)->channelId(),
623 inMPath->primitive(3)->tdcTimeStamp(),
633 LogDebug(
"DTTrigPhase2Prod") <<
"Fitting 2SL at once ";
634 for (
auto& ch_muonpaths : muonpaths) {
642 for (
auto& ch_outmpaths : outmpaths) {
643 for (
unsigned int i = 0;
i < ch_outmpaths.second.size();
i++) {
644 LogInfo(
"DTTrigPhase2Prod") <<
iEvent.id().event() <<
" mp " <<
i <<
": " 645 << ch_outmpaths.second.at(
i)->bxTimeValue() <<
" " 646 << ch_outmpaths.second.at(
i)->horizPos() <<
" " 647 << ch_outmpaths.second.at(
i)->tanPhi() <<
" " << ch_outmpaths.second.at(
i)->phi()
648 <<
" " << ch_outmpaths.second.at(
i)->phiB() <<
" " 649 << ch_outmpaths.second.at(
i)->quality() <<
" " 650 << ch_outmpaths.second.at(
i)->chiSquare();
653 for (
auto& ch_metaPrimitives : metaPrimitives) {
654 for (
unsigned int i = 0;
i < ch_metaPrimitives.second.size();
i++) {
656 ss <<
iEvent.id().event() <<
" mp " <<
i <<
": ";
657 printmP(
ss.str(), ch_metaPrimitives.second.at(
i));
663 filteredmuonpaths.clear();
669 std::map<int, std::vector<metaPrimitive>> confirmedMetaPrimitives;
670 for (
auto& ch_metaPrimitives : metaPrimitives) {
673 iEvent, iEventSetup, ch_metaPrimitives.second, dtdigis, confirmedMetaPrimitives[ch_metaPrimitives.first]);
675 for (
auto& mp : ch_metaPrimitives.second) {
676 confirmedMetaPrimitives[ch_metaPrimitives.first].push_back(mp);
680 metaPrimitives.clear();
688 LogDebug(
"DTTrigPhase2Prod") <<
"declaring new vector for filtered" << std::endl;
690 std::map<int, std::vector<metaPrimitive>> filteredMetaPrimitives;
692 for (
auto& ch_confirmedMetaPrimitives : confirmedMetaPrimitives) {
696 ch_confirmedMetaPrimitives.second,
697 filteredMetaPrimitives[ch_confirmedMetaPrimitives.first]);
699 for (
auto& mp : ch_confirmedMetaPrimitives.second) {
700 filteredMetaPrimitives[ch_confirmedMetaPrimitives.first].push_back(mp);
704 for (
auto& ch_filteredMetaPrimitives : filteredMetaPrimitives) {
705 for (
unsigned int i = 0;
i < ch_filteredMetaPrimitives.second.size();
i++) {
707 ss <<
iEvent.id().event() <<
" filtered mp " <<
i <<
": ";
708 printmP(
ss.str(), ch_filteredMetaPrimitives.second.at(
i));
714 confirmedMetaPrimitives.clear();
717 for (
auto& ch_filteredMetaPrimitives : filteredMetaPrimitives) {
718 LogDebug(
"DTTrigPhase2Prod") <<
"DTp2 in event:" <<
iEvent.id().event() <<
" we found " 719 << ch_filteredMetaPrimitives.second.size() <<
" filteredMetaPrimitives (superlayer)" 723 LogDebug(
"DTTrigPhase2Prod") <<
"filteredMetaPrimitives: starting correlations" << std::endl;
729 std::map<int, std::vector<metaPrimitive>> correlatedMetaPrimitives;
731 for (
auto& ch_filteredMetaPrimitives : filteredMetaPrimitives) {
735 ch_filteredMetaPrimitives.second,
736 correlatedMetaPrimitives[ch_filteredMetaPrimitives.first]);
738 for (
auto& mp : ch_filteredMetaPrimitives.second) {
739 correlatedMetaPrimitives[ch_filteredMetaPrimitives.first].push_back(mp);
743 for (
auto& ch_outmpaths : outmpaths) {
744 for (
const auto& muonpath : ch_outmpaths.second) {
745 correlatedMetaPrimitives[ch_outmpaths.first].emplace_back(muonpath->rawId(),
746 (double)muonpath->bxTimeValue(),
747 muonpath->horizPos(),
751 muonpath->phi_cmssw(),
752 muonpath->phiB_cmssw(),
753 muonpath->chiSquare(),
754 (
int)muonpath->quality(),
755 muonpath->primitive(0)->channelId(),
756 muonpath->primitive(0)->tdcTimeStamp(),
757 muonpath->primitive(0)->laterality(),
758 muonpath->primitive(1)->channelId(),
759 muonpath->primitive(1)->tdcTimeStamp(),
760 muonpath->primitive(1)->laterality(),
761 muonpath->primitive(2)->channelId(),
762 muonpath->primitive(2)->tdcTimeStamp(),
763 muonpath->primitive(2)->laterality(),
764 muonpath->primitive(3)->channelId(),
765 muonpath->primitive(3)->tdcTimeStamp(),
766 muonpath->primitive(3)->laterality(),
767 muonpath->primitive(4)->channelId(),
768 muonpath->primitive(4)->tdcTimeStamp(),
769 muonpath->primitive(4)->laterality(),
770 muonpath->primitive(5)->channelId(),
771 muonpath->primitive(5)->tdcTimeStamp(),
772 muonpath->primitive(5)->laterality(),
773 muonpath->primitive(6)->channelId(),
774 muonpath->primitive(6)->tdcTimeStamp(),
775 muonpath->primitive(6)->laterality(),
776 muonpath->primitive(7)->channelId(),
777 muonpath->primitive(7)->tdcTimeStamp(),
778 muonpath->primitive(7)->laterality());
786 for (
auto& ch_correlatedMetaPrimitives : correlatedMetaPrimitives) {
787 LogDebug(
"DTTrigPhase2Prod") <<
"DTp2 in event:" <<
iEvent.id().event() <<
" we found " 788 << ch_correlatedMetaPrimitives.second.size() <<
" correlatedMetPrimitives (chamber)";
791 for (
auto& ch_correlatedMetaPrimitives : correlatedMetaPrimitives) {
792 LogDebug(
"DTTrigPhase2Prod") <<
"DTp2 in event:" <<
iEvent.id().event() <<
" we found " 793 << ch_correlatedMetaPrimitives.second.size() <<
" correlatedMetPrimitives (chamber)";
795 for (
auto& ch_correlatedMetaPrimitives : correlatedMetaPrimitives) {
796 for (
unsigned int i = 0;
i < ch_correlatedMetaPrimitives.second.size();
i++) {
798 ss <<
iEvent.id().event() <<
" correlated mp " <<
i <<
": ";
799 printmPC(
ss.str(), ch_correlatedMetaPrimitives.second.at(
i));
805 std::map<int, std::vector<metaPrimitive>> filtCorrelatedMetaPrimitives;
807 for (
auto& ch_filteredMetaPrimitives : filteredMetaPrimitives) {
811 ch_filteredMetaPrimitives.second,
812 correlatedMetaPrimitives[ch_filteredMetaPrimitives.first],
813 filtCorrelatedMetaPrimitives[ch_filteredMetaPrimitives.first]);
815 for (
auto& mp : ch_filteredMetaPrimitives.second) {
816 filtCorrelatedMetaPrimitives[ch_filteredMetaPrimitives.first].push_back(mp);
819 for (
auto& mp : correlatedMetaPrimitives[ch_filteredMetaPrimitives.first]) {
820 filtCorrelatedMetaPrimitives[ch_filteredMetaPrimitives.first].push_back(mp);
826 correlatedMetaPrimitives.clear();
827 filteredMetaPrimitives.clear();
831 std::vector<metaPrimitive> allMetaPrimitives;
832 for (
auto& ch_filtcorrelatedMetaPrimitives : filtCorrelatedMetaPrimitives) {
833 for (
const auto& metaPrimitiveIt : ch_filtcorrelatedMetaPrimitives.second) {
834 allMetaPrimitives.push_back(metaPrimitiveIt);
838 std::map<int, std::vector<metaPrimitive>> coMetaPrimitives;
840 for (
auto& ch_filtcorrelatedMetaPrimitives : filtCorrelatedMetaPrimitives) {
845 filtCorrelatedMetaPrimitives[ch_filtcorrelatedMetaPrimitives.first],
846 coMetaPrimitives[ch_filtcorrelatedMetaPrimitives.first]);
848 for (
auto& mp : ch_filtcorrelatedMetaPrimitives.second) {
849 coMetaPrimitives[ch_filtcorrelatedMetaPrimitives.first].push_back(mp);
855 allMetaPrimitives.clear();
859 double shift_back = 0;
871 for (
auto& ch_correlatedMetaPrimitives : coMetaPrimitives) {
872 rpc_integrator_->matchWithDTAndUseRPCTime(ch_correlatedMetaPrimitives.second);
880 vector<L1Phase2MuDTPhDigi> outP2Ph;
881 vector<L1Phase2MuDTExtPhDigi> outExtP2Ph;
882 vector<L1Phase2MuDTThDigi> outP2Th;
883 vector<L1Phase2MuDTExtThDigi> outExtP2Th;
887 for (
auto& ch_correlatedMetaPrimitives : coMetaPrimitives) {
891 for (
auto& ch_correlatedMetaPrimitives : coMetaPrimitives) {
892 for (
const auto& metaPrimitiveIt : ch_correlatedMetaPrimitives.second) {
896 LogDebug(
"DTTrigPhase2Prod") <<
"looping in final vector: SuperLayerId" << chId <<
" x=" << metaPrimitiveIt.x
897 <<
" quality=" << metaPrimitiveIt.quality
898 <<
" BX=" << round(metaPrimitiveIt.t0 / 25.) <<
" index=" << metaPrimitiveIt.index;
900 int sectorTP = chId.
sector();
907 sectorTP = sectorTP - 1;
909 if (metaPrimitiveIt.quality <
LOWLOWQ || metaPrimitiveIt.quality ==
CHIGHQ) {
910 if (
inner(metaPrimitiveIt))
920 LogDebug(
"DTTrigPhase2Prod") <<
"pushing back phase-2 dataformat carlo-federica dataformat";
924 int pathWireId[8] = {metaPrimitiveIt.wi1,
931 metaPrimitiveIt.wi8};
933 int pathTDC[8] = {
max((
int)round(metaPrimitiveIt.tdc1 - shift_back *
LHC_CLK_FREQ), -1),
940 max((
int)round(metaPrimitiveIt.tdc8 - shift_back *
LHC_CLK_FREQ), -1)};
942 int pathLat[8] = {metaPrimitiveIt.lat1,
943 metaPrimitiveIt.lat2,
944 metaPrimitiveIt.lat3,
945 metaPrimitiveIt.lat4,
946 metaPrimitiveIt.lat5,
947 metaPrimitiveIt.lat6,
948 metaPrimitiveIt.lat7,
949 metaPrimitiveIt.lat8};
952 outExtP2Ph.emplace_back(
960 metaPrimitiveIt.quality,
961 metaPrimitiveIt.index,
964 (
int)round(metaPrimitiveIt.x * 1000),
965 (
int)round(metaPrimitiveIt.tanPhi * 1000),
968 metaPrimitiveIt.rpcFlag,
976 (
int)round(metaPrimitiveIt.t0 / (
float)
LHC_CLK_FREQ) - shift_back,
983 metaPrimitiveIt.quality,
984 metaPrimitiveIt.index,
987 metaPrimitiveIt.rpcFlag
992 int pathWireId[4] = {metaPrimitiveIt.wi1, metaPrimitiveIt.wi2, metaPrimitiveIt.wi3, metaPrimitiveIt.wi4};
994 int pathTDC[4] = {
max((
int)round(metaPrimitiveIt.tdc1 - shift_back *
LHC_CLK_FREQ), -1),
997 max((
int)round(metaPrimitiveIt.tdc4 - shift_back *
LHC_CLK_FREQ), -1)};
999 int pathLat[4] = {metaPrimitiveIt.lat1, metaPrimitiveIt.lat2, metaPrimitiveIt.lat3, metaPrimitiveIt.lat4};
1002 outExtP2Th.emplace_back(
1009 metaPrimitiveIt.quality,
1010 metaPrimitiveIt.index,
1013 (
int)round(metaPrimitiveIt.x * 1000),
1016 metaPrimitiveIt.rpcFlag,
1024 (
int)round(metaPrimitiveIt.t0 / (
float)
LHC_CLK_FREQ) - shift_back,
1030 metaPrimitiveIt.quality,
1031 metaPrimitiveIt.index,
1034 metaPrimitiveIt.rpcFlag
1043 for (
auto rpc_dt_digi =
rpc_integrator_->rpcRecHits_translated_.begin();
1046 outP2Ph.push_back(*rpc_dt_digi);
1053 resultExtP2Ph->setContainer(outExtP2Ph);
1058 resultP2Ph->setContainer(outP2Ph);
1062 outExtP2Ph.erase(outExtP2Ph.begin(), outExtP2Ph.end());
1064 outP2Ph.erase(outP2Ph.begin(), outP2Ph.end());
1069 resultExtP2Th->setContainer(outExtP2Th);
1074 resultP2Th->setContainer(outP2Th);
1078 outExtP2Th.erase(outExtP2Th.begin(), outExtP2Th.end());
1080 outP2Th.erase(outP2Th.begin(), outP2Th.end());
1108 LogInfo(
"DTTrigPhase2Prod") <<
ss << (
int)slId <<
"\t " << setw(2) << left << mP.
wi1 <<
" " << setw(2) << left
1109 << mP.
wi2 <<
" " << setw(2) << left << mP.
wi3 <<
" " << setw(2) << left << mP.
wi4 <<
" " 1110 << setw(5) << left << mP.
tdc1 <<
" " << setw(5) << left << mP.
tdc2 <<
" " << setw(5)
1111 << left << mP.
tdc3 <<
" " << setw(5) << left << mP.
tdc4 <<
" " << setw(10) << right
1112 << mP.
x <<
" " << setw(9) << left << mP.
tanPhi <<
" " << setw(5) << left << mP.
t0 <<
" " 1113 << setw(13) << left << mP.
chi2 <<
" r:" <<
rango(mP);
1118 LogInfo(
"DTTrigPhase2Prod") << (
int)slId <<
"\t " << setw(2) << left << mP.
wi1 <<
" " << setw(2) << left << mP.
wi2 1119 <<
" " << setw(2) << left << mP.
wi3 <<
" " << setw(2) << left << mP.
wi4 <<
" " << setw(5)
1120 << left << mP.
tdc1 <<
" " << setw(5) << left << mP.
tdc2 <<
" " << setw(5) << left
1121 << mP.
tdc3 <<
" " << setw(5) << left << mP.
tdc4 <<
" " << setw(10) << right << mP.
x <<
" " 1122 << setw(9) << left << mP.
tanPhi <<
" " << setw(5) << left << mP.
t0 <<
" " << setw(13)
1123 << left << mP.
chi2 <<
" r:" <<
rango(mP) << std::endl;
1128 LogInfo(
"DTTrigPhase2Prod") <<
ss << (
int)
ChId <<
"\t " << setw(2) << left << mP.
wi1 <<
" " << setw(2) << left
1129 << mP.
wi2 <<
" " << setw(2) << left << mP.
wi3 <<
" " << setw(2) << left << mP.
wi4 <<
" " 1130 << setw(2) << left << mP.
wi5 <<
" " << setw(2) << left << mP.
wi6 <<
" " << setw(2) << left
1131 << mP.
wi7 <<
" " << setw(2) << left << mP.
wi8 <<
" " << setw(5) << left << mP.
tdc1 <<
" " 1132 << setw(5) << left << mP.
tdc2 <<
" " << setw(5) << left << mP.
tdc3 <<
" " << setw(5)
1133 << left << mP.
tdc4 <<
" " << setw(5) << left << mP.
tdc5 <<
" " << setw(5) << left
1134 << mP.
tdc6 <<
" " << setw(5) << left << mP.
tdc7 <<
" " << setw(5) << left << mP.
tdc8 1135 <<
" " << setw(2) << left << mP.
lat1 <<
" " << setw(2) << left << mP.
lat2 <<
" " 1136 << setw(2) << left << mP.
lat3 <<
" " << setw(2) << left << mP.
lat4 <<
" " << setw(2)
1137 << left << mP.
lat5 <<
" " << setw(2) << left << mP.
lat6 <<
" " << setw(2) << left
1138 << mP.
lat7 <<
" " << setw(2) << left << mP.
lat8 <<
" " << setw(10) << right << mP.
x <<
" " 1139 << setw(9) << left << mP.
tanPhi <<
" " << setw(5) << left << mP.
t0 <<
" " << setw(13)
1140 << left << mP.
chi2 <<
" r:" <<
rango(mP);
1145 LogInfo(
"DTTrigPhase2Prod") << (
int)
ChId <<
"\t " << setw(2) << left << mP.
wi1 <<
" " << setw(2) << left << mP.
wi2 1146 <<
" " << setw(2) << left << mP.
wi3 <<
" " << setw(2) << left << mP.
wi4 <<
" " << setw(2)
1147 << left << mP.
wi5 <<
" " << setw(2) << left << mP.
wi6 <<
" " << setw(2) << left << mP.
wi7 1148 <<
" " << setw(2) << left << mP.
wi8 <<
" " << setw(5) << left << mP.
tdc1 <<
" " << setw(5)
1149 << left << mP.
tdc2 <<
" " << setw(5) << left << mP.
tdc3 <<
" " << setw(5) << left
1150 << mP.
tdc4 <<
" " << setw(5) << left << mP.
tdc5 <<
" " << setw(5) << left << mP.
tdc6 1151 <<
" " << setw(5) << left << mP.
tdc7 <<
" " << setw(5) << left << mP.
tdc8 <<
" " 1152 << setw(2) << left << mP.
lat1 <<
" " << setw(2) << left << mP.
lat2 <<
" " << setw(2)
1153 << left << mP.
lat3 <<
" " << setw(2) << left << mP.
lat4 <<
" " << setw(2) << left
1154 << mP.
lat5 <<
" " << setw(2) << left << mP.
lat6 <<
" " << setw(2) << left << mP.
lat7 1155 <<
" " << setw(2) << left << mP.
lat8 <<
" " << setw(10) << right << mP.
x <<
" " << setw(9)
1156 << left << mP.
tanPhi <<
" " << setw(5) << left << mP.
t0 <<
" " << setw(13) << left
1157 << mP.
chi2 <<
" r:" <<
rango(mP) << std::endl;
1169 std::map<int, std::vector<metaPrimitive>> primsPerBX;
1175 for (
auto& prims : primsPerBX) {
1177 for (
const auto&
primitive : prims.second)
1185 uint32_t
rawId = -1;
1187 for (
auto& metaPrimitiveIt : inMPaths) {
1189 rawId = metaPrimitiveIt.rawId;
1193 for (
auto& metaPrimitiveItN : inMPaths) {
1196 if (
rawId != metaPrimitiveItN.rawId)
1198 if (numP2 == numP) {
1199 metaPrimitiveIt.index =
inf;
1201 }
else if (iOrder < nOrder) {
1203 }
else if (iOrder > nOrder) {
1204 metaPrimitiveItN.index++;
1205 }
else if (iOrder == nOrder) {
1208 }
else if (
std::abs(metaPrimitiveIt.phiB) <
std::abs(metaPrimitiveItN.phiB)) {
1209 metaPrimitiveItN.index++;
1224 std::vector<std::queue<std::pair<DTLayerId, DTDigi>>*> tmpVector;
1226 std::vector<DTDigiCollection*> collVector;
1228 while (!inQ.empty()) {
1231 for (
auto& sQ : tmpVector) {
1233 while (!sQ->empty()) {
1234 tmpColl.insertDigi((sQ->front().first), (sQ->front().second));
1237 collVector.push_back(&tmpColl);
1244 bool classified =
false;
1246 for (
auto& sC : vec) {
1262 std::queue<std::pair<DTLayerId, DTDigi>> newQueue;
1264 std::pair<DTLayerId, DTDigi> tmpPair;
1266 newQueue.push(tmpPair);
1269 vec.push_back(&newQueue);
1276 desc.add<
int>(
"timeTolerance", 999999);
1277 desc.add<
double>(
"tanPhiTh", 1.0);
1278 desc.add<
double>(
"tanPhiThw2max", 1.3);
1279 desc.add<
double>(
"tanPhiThw2min", 0.5);
1280 desc.add<
double>(
"tanPhiThw1max", 0.9);
1281 desc.add<
double>(
"tanPhiThw1min", 0.2);
1282 desc.add<
double>(
"tanPhiThw0", 0.5);
1283 desc.add<
double>(
"chi2Th", 0.01);
1284 desc.add<
double>(
"chi2corTh", 0.1);
1285 desc.add<
bool>(
"useBX_correlation",
false);
1286 desc.add<
double>(
"dT0_correlate_TP", 25.0);
1287 desc.add<
int>(
"dBX_correlate_TP", 0);
1288 desc.add<
double>(
"dTanPsi_correlate_TP", 99999.0);
1289 desc.add<
bool>(
"clean_chi2_correlation",
true);
1290 desc.add<
bool>(
"allow_confirmation",
true);
1291 desc.add<
double>(
"minx_match_2digis", 1.0);
1292 desc.add<
int>(
"scenario", 0);
1293 desc.add<
int>(
"df_extended", 0);
1294 desc.add<
int>(
"co_option", 0);
1295 desc.add<
int>(
"co_quality", 0);
1296 desc.add<
int>(
"max_primitives", 999);
1297 desc.add<
bool>(
"output_mixer",
false);
1298 desc.add<
bool>(
"output_latpredictor",
false);
1299 desc.add<
bool>(
"output_slfitter",
false);
1300 desc.add<
bool>(
"output_slfilter",
false);
1301 desc.add<
bool>(
"output_confirmed",
false);
1302 desc.add<
bool>(
"output_matcher",
false);
1311 edm::FileInPath(
"L1Trigger/DTTriggerPhase2/data/drift_time_per_chamber.txt"));
1314 edm::FileInPath(
"L1Trigger/DTTriggerPhase2/data/global_coord_perp_x_phi0.txt"));
1316 edm::FileInPath(
"L1Trigger/DTTriggerPhase2/data/lat_predictions.dat"));
1317 desc.add<
int>(
"algo", 0);
1318 desc.add<
int>(
"minHits4Fit", 3);
1319 desc.add<
bool>(
"splitPathPerSL",
true);
1320 desc.addUntracked<
bool>(
"debug",
false);
1321 desc.addUntracked<
bool>(
"dump",
false);
1323 desc.add<
bool>(
"useRPC",
false);
1324 desc.add<
int>(
"bx_window", 1);
1325 desc.add<
double>(
"phi_window", 50.0);
1326 desc.add<
int>(
"max_quality_to_overwrite_t0", 9);
1327 desc.add<
bool>(
"storeAllRPCHits",
false);
1328 desc.add<
bool>(
"activateBuffer",
false);
1329 desc.add<
double>(
"superCelltimewidth", 400);
1330 desc.add<
int>(
"superCellspacewidth", 20);
1334 psd0.
add<
double>(
"angletan", 0.3);
1335 psd0.
add<
double>(
"anglebinwidth", 1.0);
1336 psd0.
add<
double>(
"posbinwidth", 2.1);
1337 psd0.
add<
double>(
"maxdeltaAngDeg", 10);
1338 psd0.
add<
double>(
"maxdeltaPos", 10);
1339 psd0.
add<
int>(
"UpperNumber", 6);
1340 psd0.
add<
int>(
"LowerNumber", 4);
1341 psd0.
add<
double>(
"MaxDistanceToWire", 0.03);
1342 psd0.
add<
int>(
"minNLayerHits", 6);
1343 psd0.
add<
int>(
"minSingleSLHitsMax", 3);
1344 psd0.
add<
int>(
"minSingleSLHitsMin", 3);
1345 psd0.
add<
bool>(
"allowUncorrelatedPatterns",
true);
1346 psd0.
add<
int>(
"minUncorrelatedHits", 3);
1352 "pattern_filename",
edm::FileInPath(
"L1Trigger/DTTriggerPhase2/data/PseudoBayesPatterns_uncorrelated_v0.root"));
1354 psd0.
add<
int>(
"minNLayerHits", 3);
1355 psd0.
add<
int>(
"minSingleSLHitsMax", 3);
1356 psd0.
add<
int>(
"minSingleSLHitsMin", 0);
1357 psd0.
add<
int>(
"allowedVariance", 1);
1358 psd0.
add<
bool>(
"allowDuplicates",
false);
1359 psd0.
add<
bool>(
"setLateralities",
true);
1360 psd0.
add<
bool>(
"allowUncorrelatedPatterns",
true);
1361 psd0.
add<
int>(
"minUncorrelatedHits", 3);
1362 psd0.
add<
bool>(
"saveOnPlace",
true);
1363 psd0.
add<
int>(
"maxPathsPerMatch", 256);
1366 descriptions.
add(
"dtTriggerPhase2PrimitiveDigis",
desc);
int station() const
Return the station number.
std::unique_ptr< MotherGrouping > grouping_obj_
std::map< DTChamberId, DTDigiCollection, std::less< DTChamberId > > DTDigiMap
bool hasPosRF(int wh, int sec) const
void produce(edm::Event &iEvent, const edm::EventSetup &iEventSetup) override
Producer: process every event and generates trigger data.
int superLayer() const
Return the superlayer number.
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
constexpr int CHI2RES_CONV
constexpr float PHIBRES_CONV
DTChamberId id() const
Return the DTChamberId of this chamber.
std::unique_ptr< LateralityProvider > latprovider_
DTTrigPhase2Prod(const edm::ParameterSet &pset)
Constructor.
void processDigi(std::queue< std::pair< DTLayerId, DTDigi >> &inQ, std::vector< std::queue< std::pair< DTLayerId, DTDigi >> *> &vec)
std::unique_ptr< MPFilter > mpathhitsfilter_
edm::EDGetTokenT< DTDigiCollection > dtDigisToken_
std::vector< DTDigiCollection * > distribDigis(std::queue< std::pair< DTLayerId, DTDigi >> &inQ)
std::unique_ptr< RPCIntegrator > rpc_integrator_
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomH
std::unique_ptr< MuonPathConfirmator > mpathconfirmator_
edm::EDGetTokenT< RPCRecHitCollection > rpcRecHitsLabel_
bool output_latpredictor_
Primitive< F, X >::type primitive(const F &f)
std::vector< short > latcomb
void assignIndex(std::vector< metaPrimitive > &inMPaths)
int superCellhalfspacewidth_
const DTGeometry * dtGeo_
void printmPC(const std::string &ss, const metaPrimitive &mP) const
DTChamberId chamberId() const
Return the corresponding ChamberId.
bool inner(const metaPrimitive &mp) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
std::unique_ptr< MuonPathAnalyzer > mpathanalyzer_
constexpr float KRES_CONV
std::unique_ptr< MPFilter > mpathqualityenhancer_
Abs< T >::type abs(const T &t)
void printmP(const std::string &ss, const metaPrimitive &mP) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
#define DEFINE_FWK_MODULE(type)
constexpr float ZRES_CONV
ParameterDescriptionBase * add(U const &iLabel, T const &value)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
std::unique_ptr< MPFilter > mpathcoifilter_
float superCelltimewidth_
std::unique_ptr< MPFilter > mpathcorfilter_
Log< level::Info, false > LogInfo
bool outer(const metaPrimitive &mp) const
void endRun(edm::Run const &iRun, const edm::EventSetup &iEventSetup) override
endRun: finish things
std::unique_ptr< MPFilter > mpathredundantfilter_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
constexpr int TIME_TO_TDC_COUNTS
constexpr uint32_t rawId() const
get the raw id
std::shared_ptr< GlobalCoordsObtainer > globalcoordsobtainer_
std::pair< const_iterator, const_iterator > Range
std::unique_ptr< MuonPathAnalyzer > mpathassociator_
std::vector< DigiType >::const_iterator const_iterator
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::unique_ptr< MPFilter > mpathqualityenhancerbayes_
constexpr int LHC_CLK_FREQ
int rango(const metaPrimitive &mp) const
DTDigiMap::iterator DTDigiMap_iterator
int wheel() const
Return the wheel number.
void assignIndexPerBX(std::vector< metaPrimitive > &inMPaths)
~DTTrigPhase2Prod() override
Destructor.
DTDigiMap::const_iterator DTDigiMap_const_iterator
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
constexpr float PHIRES_CONV
int assignQualityOrder(const metaPrimitive &mP) const
const std::unordered_map< int, int > qmap_
void beginRun(edm::Run const &iRun, const edm::EventSetup &iEventSetup) override
Create Trigger Units before starting event processing.
std::vector< std::pair< int, MuonPath > > primitives_