78 using namespace cmsdt;
81 typedef std::map<DTChamberId, DTDigiCollection, std::less<DTChamberId>>
DTDigiMap;
109 bool hasPosRF(
int wh,
int sec)
const;
115 void setChiSquareThreshold(
float ch2Thr);
171 std::vector<DTDigiCollection*> distribDigis(
std::queue<std::pair<DTLayerId, DTDigi>>& inQ);
172 void processDigi(
std::queue<std::pair<DTLayerId, DTDigi>>& inQ,
179 void assignIndex(std::vector<metaPrimitive>& inMPaths);
180 void assignIndexPerBX(std::vector<metaPrimitive>& inMPaths);
183 const std::unordered_map<int, int>
qmap_;
188 bool operator()(std::pair<DTLayerId, DTDigi>
a, std::pair<DTLayerId, DTDigi>
b)
const {
189 return (
a.second.time() <
b.second.time());
191 }
const DigiTimeOrdering;
195 : qmap_({{8, 8}, {7, 7}, {6, 6}, {4, 4}, {3, 3}, {2, 2}, {1, 1}}) {
196 produces<L1Phase2MuDTPhContainer>();
197 produces<L1Phase2MuDTThContainer>();
198 produces<L1Phase2MuDTExtPhContainer>();
199 produces<L1Phase2MuDTExtThContainer>();
201 debug_ =
pset.getUntrackedParameter<
bool>(
"debug");
202 dump_ =
pset.getUntrackedParameter<
bool>(
"dump");
204 scenario_ =
pset.getParameter<
int>(
"scenario");
206 df_extended_ =
pset.getParameter<
int>(
"df_extended");
207 max_index_ =
pset.getParameter<
int>(
"max_primitives") - 1;
209 dtDigisToken_ = consumes<DTDigiCollection>(
pset.getParameter<
edm::InputTag>(
"digiTag"));
211 rpcRecHitsLabel_ = consumes<RPCRecHitCollection>(
pset.getParameter<
edm::InputTag>(
"rpcRecHits"));
212 useRPC_ =
pset.getParameter<
bool>(
"useRPC");
215 algo_ =
pset.getParameter<
int>(
"algo");
219 output_mixer_ =
pset.getParameter<
bool>(
"output_mixer");
220 output_latpredictor_ =
pset.getParameter<
bool>(
"output_latpredictor");
221 output_slfitter_ =
pset.getParameter<
bool>(
"output_slfitter");
222 output_slfilter_ =
pset.getParameter<
bool>(
"output_slfilter");
223 output_confirmed_ =
pset.getParameter<
bool>(
"output_confirmed");
224 output_matcher_ =
pset.getParameter<
bool>(
"output_matcher");
225 allow_confirmation_ =
pset.getParameter<
bool>(
"allow_confirmation");
228 globalcoordsobtainer_ = std::make_shared<GlobalCoordsObtainer>(
pset);
229 globalcoordsobtainer_->generate_luts();
233 std::make_unique<PseudoBayesGrouping>(
pset.getParameter<
edm::ParameterSet>(
"PseudoBayesPattern"), consumesColl);
236 std::make_unique<HoughGrouping>(
pset.getParameter<
edm::ParameterSet>(
"HoughGrouping"), consumesColl);
238 grouping_obj_ = std::make_unique<TrapezoidalGrouping>(
pset, consumesColl);
243 LogDebug(
"DTTrigPhase2Prod") <<
"DTp2:constructor: JM analyzer";
244 mpathanalyzer_ = std::make_unique<MuonPathSLFitter>(
pset, consumesColl, globalcoordsobtainer_);
245 latprovider_ = std::make_unique<LateralityCoarsedProvider>(
pset, consumesColl);
248 LogDebug(
"DTTrigPhase2Prod") <<
"DTp2:constructor: Full chamber analyzer";
249 mpathanalyzer_ = std::make_unique<MuonPathAnalyzerInChamber>(
pset, consumesColl, globalcoordsobtainer_);
253 activateBuffer_ =
pset.getParameter<
bool>(
"activateBuffer");
254 superCellhalfspacewidth_ =
pset.getParameter<
int>(
"superCellspacewidth") / 2;
255 superCelltimewidth_ =
pset.getParameter<
double>(
"superCelltimewidth");
257 mpathqualityenhancer_ = std::make_unique<MPSLFilter>(
pset);
258 mpathqualityenhancerbayes_ = std::make_unique<MPQualityEnhancerFilterBayes>(
pset);
259 mpathredundantfilter_ = std::make_unique<MPRedundantFilter>(
pset);
260 mpathhitsfilter_ = std::make_unique<MPCleanHitsFilter>(
pset);
261 mpathconfirmator_ = std::make_unique<MuonPathConfirmator>(
pset, consumesColl);
262 mpathassociator_ = std::make_unique<MuonPathCorFitter>(
pset, consumesColl, globalcoordsobtainer_);
263 mpathcorfilter_ = std::make_unique<MPCorFilter>(
pset);
264 rpc_integrator_ = std::make_unique<RPCIntegrator>(
pset, consumesColl);
266 dtGeomH = esConsumes<DTGeometry, MuonGeometryRecord, edm::Transition::BeginRun>();
271 LogDebug(
"DTTrigPhase2Prod") <<
"DTp2: calling destructor" << std::endl;
276 LogDebug(
"DTTrigPhase2Prod") <<
"beginRun " << iRun.
id().
run();
278 LogDebug(
"DTTrigPhase2Prod") <<
"beginRun: getting DT geometry";
296 LogDebug(
"DTTrigPhase2Prod") <<
"produce";
301 LogDebug(
"DTTrigPhase2Prod") <<
"\t Getting the RPC RecHits" << std::endl;
311 for (
const auto& detUnitIt : *dtdigis) {
312 const DTLayerId& layId = detUnitIt.first;
315 digiMap[chambId].put(
range, layId);
320 LogDebug(
"DTTrigPhase2Prod") <<
"produce - Getting and grouping digis per chamber using a buffer and super cells.";
322 LogDebug(
"DTTrigPhase2Prod") <<
"produce - Getting and grouping digis per chamber.";
324 std::map<int, MuonPathPtrs> muonpaths;
331 if (dmit == digiMap.end())
336 std::vector<std::pair<DTLayerId, DTDigi>> tmpvec;
339 for (
const auto& dtLayerIdIt : (*dmit).second) {
341 digiIt != (dtLayerIdIt.second).second;
343 tmpvec.emplace_back(dtLayerIdIt.first, *digiIt);
352 std::sort(tmpvec.begin(), tmpvec.end(), DigiTimeOrdering);
353 std::queue<std::pair<DTLayerId, DTDigi>> timequeue;
355 for (
const auto& elem : tmpvec)
356 timequeue.emplace(elem);
360 std::vector<DTDigiCollection*> superCells;
366 while (!superCells.empty()) {
368 superCells.pop_back();
377 for (
auto& ch_muonpaths : muonpaths) {
378 for (
unsigned int i = 0;
i < ch_muonpaths.second.size();
i++) {
380 ss <<
iEvent.id().event() <<
" mpath " <<
i <<
": ";
381 for (
int lay = 0; lay < ch_muonpaths.second.at(
i)->nprimitives(); lay++)
382 ss << ch_muonpaths.second.at(
i)->primitive(lay)->channelId() <<
" ";
383 for (
int lay = 0; lay < ch_muonpaths.second.at(
i)->nprimitives(); lay++)
384 ss << ch_muonpaths.second.at(
i)->primitive(lay)->tdcTimeStamp() <<
" ";
385 for (
int lay = 0; lay < ch_muonpaths.second.at(
i)->nprimitives(); lay++)
386 ss << ch_muonpaths.second.at(
i)->primitive(lay)->laterality() <<
" ";
392 std::map<int, std::vector<lat_vector>> lateralities;
394 for (
auto& ch_muonpaths : muonpaths) {
396 latprovider_->run(
iEvent, iEventSetup, ch_muonpaths.second, lateralities[ch_muonpaths.first]);
402 std::map<int, MuonPathPtrs> filteredmuonpaths;
403 for (
auto& ch_muonpaths : muonpaths) {
412 for (
auto& ch_filteredmuonpaths : filteredmuonpaths) {
413 for (
unsigned int i = 0;
i < ch_filteredmuonpaths.second.size();
i++) {
415 ss <<
iEvent.id().event() <<
" filt. mpath " <<
i <<
": ";
416 for (
int lay = 0; lay < ch_filteredmuonpaths.second.at(
i)->nprimitives(); lay++)
417 ss << ch_filteredmuonpaths.second.at(
i)->primitive(lay)->channelId() <<
" ";
418 for (
int lay = 0; lay < ch_filteredmuonpaths.second.at(
i)->nprimitives(); lay++)
419 ss << ch_filteredmuonpaths.second.at(
i)->primitive(lay)->tdcTimeStamp() <<
" ";
432 for (
auto& ch_muonpaths : muonpaths) {
433 LogDebug(
"DTTrigPhase2Prod") <<
"MUON PATHS found: " << ch_muonpaths.second.size() <<
" (" 434 << filteredmuonpaths[ch_muonpaths.first].size() <<
") in event " 439 LogDebug(
"DTTrigPhase2Prod") <<
"filling NmetaPrimtives" << std::endl;
440 std::map<int, std::vector<metaPrimitive>> metaPrimitives;
441 std::map<int, MuonPathPtrs> outmpaths;
444 LogDebug(
"DTTrigPhase2Prod") <<
"Fitting 1SL ";
445 for (
auto& ch_muonpaths : muonpaths) {
450 lateralities[ch_muonpaths.first],
451 metaPrimitives[ch_muonpaths.first]);
453 for (
auto& inMPath : ch_muonpaths.second) {
454 auto sl = inMPath->primitive(0)->superLayerId();
455 int selected_lay = 1;
456 if (inMPath->primitive(0)->tdcTimeStamp() != -1)
458 int dumLayId = inMPath->primitive(selected_lay)->cameraId();
460 DTSuperLayerId MuonPathSLId(dtDumlayerId.wheel(), dtDumlayerId.station(), dtDumlayerId.sector(), sl + 1);
462 metaPrimitives[ch_muonpaths.first].emplace_back(
metaPrimitive({MuonPathSLId.rawId(),
472 inMPath->primitive(0)->channelId(),
473 inMPath->primitive(0)->tdcTimeStamp(),
475 inMPath->primitive(1)->channelId(),
476 inMPath->primitive(1)->tdcTimeStamp(),
478 inMPath->primitive(2)->channelId(),
479 inMPath->primitive(2)->tdcTimeStamp(),
481 inMPath->primitive(3)->channelId(),
482 inMPath->primitive(3)->tdcTimeStamp(),
498 metaPrimitives[ch_muonpaths.first].emplace_back(
metaPrimitive({MuonPathSLId.rawId(),
520 inMPath->primitive(0)->channelId(),
521 inMPath->primitive(0)->tdcTimeStamp(),
523 inMPath->primitive(1)->channelId(),
524 inMPath->primitive(1)->tdcTimeStamp(),
526 inMPath->primitive(2)->channelId(),
527 inMPath->primitive(2)->tdcTimeStamp(),
529 inMPath->primitive(3)->channelId(),
530 inMPath->primitive(3)->tdcTimeStamp(),
536 for (
auto& inMPath : ch_muonpaths.second) {
538 auto sl = inMPath->primitive(0)->superLayerId();
539 int selected_lay = 1;
540 if (inMPath->primitive(0)->tdcTimeStamp() != -1)
542 int dumLayId = inMPath->primitive(selected_lay)->cameraId();
544 DTSuperLayerId MuonPathSLId(dtDumlayerId.wheel(), dtDumlayerId.station(), dtDumlayerId.sector(), sl + 1);
545 for (
auto&
latcomb : lateralities[ch_muonpaths.first][imp]) {
547 metaPrimitives[ch_muonpaths.first].emplace_back(
metaPrimitive({MuonPathSLId.rawId(),
557 inMPath->primitive(0)->channelId(),
558 inMPath->primitive(0)->tdcTimeStamp(),
560 inMPath->primitive(1)->channelId(),
561 inMPath->primitive(1)->tdcTimeStamp(),
563 inMPath->primitive(2)->channelId(),
564 inMPath->primitive(2)->tdcTimeStamp(),
566 inMPath->primitive(3)->channelId(),
567 inMPath->primitive(3)->tdcTimeStamp(),
583 metaPrimitives[ch_muonpaths.first].emplace_back(
metaPrimitive({MuonPathSLId.rawId(),
605 inMPath->primitive(0)->channelId(),
606 inMPath->primitive(0)->tdcTimeStamp(),
608 inMPath->primitive(1)->channelId(),
609 inMPath->primitive(1)->tdcTimeStamp(),
611 inMPath->primitive(2)->channelId(),
612 inMPath->primitive(2)->tdcTimeStamp(),
614 inMPath->primitive(3)->channelId(),
615 inMPath->primitive(3)->tdcTimeStamp(),
625 LogDebug(
"DTTrigPhase2Prod") <<
"Fitting 2SL at once ";
626 for (
auto& ch_muonpaths : muonpaths) {
634 for (
auto& ch_outmpaths : outmpaths) {
635 for (
unsigned int i = 0;
i < ch_outmpaths.second.size();
i++) {
636 LogInfo(
"DTTrigPhase2Prod") <<
iEvent.id().event() <<
" mp " <<
i <<
": " 637 << ch_outmpaths.second.at(
i)->bxTimeValue() <<
" " 638 << ch_outmpaths.second.at(
i)->horizPos() <<
" " 639 << ch_outmpaths.second.at(
i)->tanPhi() <<
" " << ch_outmpaths.second.at(
i)->phi()
640 <<
" " << ch_outmpaths.second.at(
i)->phiB() <<
" " 641 << ch_outmpaths.second.at(
i)->quality() <<
" " 642 << ch_outmpaths.second.at(
i)->chiSquare();
645 for (
auto& ch_metaPrimitives : metaPrimitives) {
646 for (
unsigned int i = 0;
i < ch_metaPrimitives.second.size();
i++) {
648 ss <<
iEvent.id().event() <<
" mp " <<
i <<
": ";
649 printmP(
ss.str(), ch_metaPrimitives.second.at(
i));
655 filteredmuonpaths.clear();
661 std::map<int, std::vector<metaPrimitive>> confirmedMetaPrimitives;
662 for (
auto& ch_metaPrimitives : metaPrimitives) {
665 iEvent, iEventSetup, ch_metaPrimitives.second, dtdigis, confirmedMetaPrimitives[ch_metaPrimitives.first]);
667 for (
auto& mp : ch_metaPrimitives.second) {
668 confirmedMetaPrimitives[ch_metaPrimitives.first].push_back(mp);
672 metaPrimitives.clear();
680 LogDebug(
"DTTrigPhase2Prod") <<
"declaring new vector for filtered" << std::endl;
682 std::map<int, std::vector<metaPrimitive>> filteredMetaPrimitives;
684 for (
auto& ch_confirmedMetaPrimitives : confirmedMetaPrimitives) {
688 ch_confirmedMetaPrimitives.second,
689 filteredMetaPrimitives[ch_confirmedMetaPrimitives.first]);
691 for (
auto& mp : ch_confirmedMetaPrimitives.second) {
692 filteredMetaPrimitives[ch_confirmedMetaPrimitives.first].push_back(mp);
696 for (
auto& ch_filteredMetaPrimitives : filteredMetaPrimitives) {
697 for (
unsigned int i = 0;
i < ch_filteredMetaPrimitives.second.size();
i++) {
699 ss <<
iEvent.id().event() <<
" filtered mp " <<
i <<
": ";
700 printmP(
ss.str(), ch_filteredMetaPrimitives.second.at(
i));
706 confirmedMetaPrimitives.clear();
709 for (
auto& ch_filteredMetaPrimitives : filteredMetaPrimitives) {
710 LogDebug(
"DTTrigPhase2Prod") <<
"DTp2 in event:" <<
iEvent.id().event() <<
" we found " 711 << ch_filteredMetaPrimitives.second.size() <<
" filteredMetaPrimitives (superlayer)" 715 LogDebug(
"DTTrigPhase2Prod") <<
"filteredMetaPrimitives: starting correlations" << std::endl;
721 std::map<int, std::vector<metaPrimitive>> correlatedMetaPrimitives;
723 for (
auto& ch_filteredMetaPrimitives : filteredMetaPrimitives) {
727 ch_filteredMetaPrimitives.second,
728 correlatedMetaPrimitives[ch_filteredMetaPrimitives.first]);
730 for (
auto& mp : ch_filteredMetaPrimitives.second) {
731 correlatedMetaPrimitives[ch_filteredMetaPrimitives.first].push_back(mp);
735 for (
auto& ch_outmpaths : outmpaths) {
736 for (
const auto& muonpath : ch_outmpaths.second) {
737 correlatedMetaPrimitives[ch_outmpaths.first].emplace_back(muonpath->rawId(),
738 (double)muonpath->bxTimeValue(),
739 muonpath->horizPos(),
743 muonpath->phi_cmssw(),
744 muonpath->phiB_cmssw(),
745 muonpath->chiSquare(),
746 (
int)muonpath->quality(),
747 muonpath->primitive(0)->channelId(),
748 muonpath->primitive(0)->tdcTimeStamp(),
749 muonpath->primitive(0)->laterality(),
750 muonpath->primitive(1)->channelId(),
751 muonpath->primitive(1)->tdcTimeStamp(),
752 muonpath->primitive(1)->laterality(),
753 muonpath->primitive(2)->channelId(),
754 muonpath->primitive(2)->tdcTimeStamp(),
755 muonpath->primitive(2)->laterality(),
756 muonpath->primitive(3)->channelId(),
757 muonpath->primitive(3)->tdcTimeStamp(),
758 muonpath->primitive(3)->laterality(),
759 muonpath->primitive(4)->channelId(),
760 muonpath->primitive(4)->tdcTimeStamp(),
761 muonpath->primitive(4)->laterality(),
762 muonpath->primitive(5)->channelId(),
763 muonpath->primitive(5)->tdcTimeStamp(),
764 muonpath->primitive(5)->laterality(),
765 muonpath->primitive(6)->channelId(),
766 muonpath->primitive(6)->tdcTimeStamp(),
767 muonpath->primitive(6)->laterality(),
768 muonpath->primitive(7)->channelId(),
769 muonpath->primitive(7)->tdcTimeStamp(),
770 muonpath->primitive(7)->laterality());
778 for (
auto& ch_correlatedMetaPrimitives : correlatedMetaPrimitives) {
779 LogDebug(
"DTTrigPhase2Prod") <<
"DTp2 in event:" <<
iEvent.id().event() <<
" we found " 780 << ch_correlatedMetaPrimitives.second.size() <<
" correlatedMetPrimitives (chamber)";
783 for (
auto& ch_correlatedMetaPrimitives : correlatedMetaPrimitives) {
784 LogDebug(
"DTTrigPhase2Prod") <<
"DTp2 in event:" <<
iEvent.id().event() <<
" we found " 785 << ch_correlatedMetaPrimitives.second.size() <<
" correlatedMetPrimitives (chamber)";
787 for (
auto& ch_correlatedMetaPrimitives : correlatedMetaPrimitives) {
788 for (
unsigned int i = 0;
i < ch_correlatedMetaPrimitives.second.size();
i++) {
790 ss <<
iEvent.id().event() <<
" correlated mp " <<
i <<
": ";
791 printmPC(
ss.str(), ch_correlatedMetaPrimitives.second.at(
i));
797 std::map<int, std::vector<metaPrimitive>> filtCorrelatedMetaPrimitives;
799 for (
auto& ch_filteredMetaPrimitives : filteredMetaPrimitives) {
803 ch_filteredMetaPrimitives.second,
804 correlatedMetaPrimitives[ch_filteredMetaPrimitives.first],
805 filtCorrelatedMetaPrimitives[ch_filteredMetaPrimitives.first]);
807 for (
auto& mp : ch_filteredMetaPrimitives.second) {
808 filtCorrelatedMetaPrimitives[ch_filteredMetaPrimitives.first].push_back(mp);
811 for (
auto& mp : correlatedMetaPrimitives[ch_filteredMetaPrimitives.first]) {
812 filtCorrelatedMetaPrimitives[ch_filteredMetaPrimitives.first].push_back(mp);
818 correlatedMetaPrimitives.clear();
819 filteredMetaPrimitives.clear();
821 double shift_back = 0;
833 for (
auto& ch_correlatedMetaPrimitives : filtCorrelatedMetaPrimitives) {
834 rpc_integrator_->matchWithDTAndUseRPCTime(ch_correlatedMetaPrimitives.second);
842 vector<L1Phase2MuDTPhDigi> outP2Ph;
843 vector<L1Phase2MuDTExtPhDigi> outExtP2Ph;
844 vector<L1Phase2MuDTThDigi> outP2Th;
845 vector<L1Phase2MuDTExtThDigi> outExtP2Th;
849 for (
auto& ch_correlatedMetaPrimitives : filtCorrelatedMetaPrimitives) {
853 for (
auto& ch_correlatedMetaPrimitives : filtCorrelatedMetaPrimitives) {
854 for (
const auto& metaPrimitiveIt : ch_correlatedMetaPrimitives.second) {
858 LogDebug(
"DTTrigPhase2Prod") <<
"looping in final vector: SuperLayerId" << chId <<
" x=" << metaPrimitiveIt.x
859 <<
" quality=" << metaPrimitiveIt.quality
860 <<
" BX=" << round(metaPrimitiveIt.t0 / 25.) <<
" index=" << metaPrimitiveIt.index;
862 int sectorTP = chId.
sector();
869 sectorTP = sectorTP - 1;
871 if (metaPrimitiveIt.quality <
LOWLOWQ || metaPrimitiveIt.quality ==
CHIGHQ) {
872 if (
inner(metaPrimitiveIt))
882 LogDebug(
"DTTrigPhase2Prod") <<
"pushing back phase-2 dataformat carlo-federica dataformat";
886 int pathWireId[8] = {metaPrimitiveIt.wi1,
893 metaPrimitiveIt.wi8};
895 int pathTDC[8] = {
max((
int)round(metaPrimitiveIt.tdc1 - shift_back *
LHC_CLK_FREQ), -1),
902 max((
int)round(metaPrimitiveIt.tdc8 - shift_back *
LHC_CLK_FREQ), -1)};
904 int pathLat[8] = {metaPrimitiveIt.lat1,
905 metaPrimitiveIt.lat2,
906 metaPrimitiveIt.lat3,
907 metaPrimitiveIt.lat4,
908 metaPrimitiveIt.lat5,
909 metaPrimitiveIt.lat6,
910 metaPrimitiveIt.lat7,
911 metaPrimitiveIt.lat8};
914 outExtP2Ph.emplace_back(
922 metaPrimitiveIt.quality,
923 metaPrimitiveIt.index,
926 (
int)round(metaPrimitiveIt.x * 1000),
927 (
int)round(metaPrimitiveIt.tanPhi * 1000),
930 metaPrimitiveIt.rpcFlag,
938 (
int)round(metaPrimitiveIt.t0 / (
float)
LHC_CLK_FREQ) - shift_back,
945 metaPrimitiveIt.quality,
946 metaPrimitiveIt.index,
949 metaPrimitiveIt.rpcFlag
954 int pathWireId[4] = {metaPrimitiveIt.wi1, metaPrimitiveIt.wi2, metaPrimitiveIt.wi3, metaPrimitiveIt.wi4};
956 int pathTDC[4] = {
max((
int)round(metaPrimitiveIt.tdc1 - shift_back *
LHC_CLK_FREQ), -1),
959 max((
int)round(metaPrimitiveIt.tdc4 - shift_back *
LHC_CLK_FREQ), -1)};
961 int pathLat[4] = {metaPrimitiveIt.lat1, metaPrimitiveIt.lat2, metaPrimitiveIt.lat3, metaPrimitiveIt.lat4};
964 outExtP2Th.emplace_back(
971 metaPrimitiveIt.quality,
972 metaPrimitiveIt.index,
975 (
int)round(metaPrimitiveIt.x * 1000),
978 metaPrimitiveIt.rpcFlag,
986 (
int)round(metaPrimitiveIt.t0 / (
float)
LHC_CLK_FREQ) - shift_back,
992 metaPrimitiveIt.quality,
993 metaPrimitiveIt.index,
996 metaPrimitiveIt.rpcFlag
1005 for (
auto rpc_dt_digi =
rpc_integrator_->rpcRecHits_translated_.begin();
1008 outP2Ph.push_back(*rpc_dt_digi);
1015 resultExtP2Ph->setContainer(outExtP2Ph);
1020 resultP2Ph->setContainer(outP2Ph);
1024 outExtP2Ph.erase(outExtP2Ph.begin(), outExtP2Ph.end());
1026 outP2Ph.erase(outP2Ph.begin(), outP2Ph.end());
1031 resultExtP2Th->setContainer(outExtP2Th);
1036 resultP2Th->setContainer(outP2Th);
1040 outExtP2Th.erase(outExtP2Th.begin(), outExtP2Th.end());
1042 outP2Th.erase(outP2Th.begin(), outP2Th.end());
1070 LogInfo(
"DTTrigPhase2Prod") <<
ss << (
int)slId <<
"\t " << setw(2) << left << mP.
wi1 <<
" " << setw(2) << left
1071 << mP.
wi2 <<
" " << setw(2) << left << mP.
wi3 <<
" " << setw(2) << left << mP.
wi4 <<
" " 1072 << setw(5) << left << mP.
tdc1 <<
" " << setw(5) << left << mP.
tdc2 <<
" " << setw(5)
1073 << left << mP.
tdc3 <<
" " << setw(5) << left << mP.
tdc4 <<
" " << setw(10) << right
1074 << mP.
x <<
" " << setw(9) << left << mP.
tanPhi <<
" " << setw(5) << left << mP.
t0 <<
" " 1075 << setw(13) << left << mP.
chi2 <<
" r:" <<
rango(mP);
1080 LogInfo(
"DTTrigPhase2Prod") << (
int)slId <<
"\t " << setw(2) << left << mP.
wi1 <<
" " << setw(2) << left << mP.
wi2 1081 <<
" " << setw(2) << left << mP.
wi3 <<
" " << setw(2) << left << mP.
wi4 <<
" " << setw(5)
1082 << left << mP.
tdc1 <<
" " << setw(5) << left << mP.
tdc2 <<
" " << setw(5) << left
1083 << mP.
tdc3 <<
" " << setw(5) << left << mP.
tdc4 <<
" " << setw(10) << right << mP.
x <<
" " 1084 << setw(9) << left << mP.
tanPhi <<
" " << setw(5) << left << mP.
t0 <<
" " << setw(13)
1085 << left << mP.
chi2 <<
" r:" <<
rango(mP) << std::endl;
1090 LogInfo(
"DTTrigPhase2Prod") <<
ss << (
int)
ChId <<
"\t " << setw(2) << left << mP.
wi1 <<
" " << setw(2) << left
1091 << mP.
wi2 <<
" " << setw(2) << left << mP.
wi3 <<
" " << setw(2) << left << mP.
wi4 <<
" " 1092 << setw(2) << left << mP.
wi5 <<
" " << setw(2) << left << mP.
wi6 <<
" " << setw(2) << left
1093 << mP.
wi7 <<
" " << setw(2) << left << mP.
wi8 <<
" " << setw(5) << left << mP.
tdc1 <<
" " 1094 << setw(5) << left << mP.
tdc2 <<
" " << setw(5) << left << mP.
tdc3 <<
" " << setw(5)
1095 << left << mP.
tdc4 <<
" " << setw(5) << left << mP.
tdc5 <<
" " << setw(5) << left
1096 << mP.
tdc6 <<
" " << setw(5) << left << mP.
tdc7 <<
" " << setw(5) << left << mP.
tdc8 1097 <<
" " << setw(2) << left << mP.
lat1 <<
" " << setw(2) << left << mP.
lat2 <<
" " 1098 << setw(2) << left << mP.
lat3 <<
" " << setw(2) << left << mP.
lat4 <<
" " << setw(2)
1099 << left << mP.
lat5 <<
" " << setw(2) << left << mP.
lat6 <<
" " << setw(2) << left
1100 << mP.
lat7 <<
" " << setw(2) << left << mP.
lat8 <<
" " << setw(10) << right << mP.
x <<
" " 1101 << setw(9) << left << mP.
tanPhi <<
" " << setw(5) << left << mP.
t0 <<
" " << setw(13)
1102 << left << mP.
chi2 <<
" r:" <<
rango(mP);
1107 LogInfo(
"DTTrigPhase2Prod") << (
int)
ChId <<
"\t " << setw(2) << left << mP.
wi1 <<
" " << setw(2) << left << mP.
wi2 1108 <<
" " << setw(2) << left << mP.
wi3 <<
" " << setw(2) << left << mP.
wi4 <<
" " << setw(2)
1109 << left << mP.
wi5 <<
" " << setw(2) << left << mP.
wi6 <<
" " << setw(2) << left << mP.
wi7 1110 <<
" " << setw(2) << left << mP.
wi8 <<
" " << setw(5) << left << mP.
tdc1 <<
" " << setw(5)
1111 << left << mP.
tdc2 <<
" " << setw(5) << left << mP.
tdc3 <<
" " << setw(5) << left
1112 << mP.
tdc4 <<
" " << setw(5) << left << mP.
tdc5 <<
" " << setw(5) << left << mP.
tdc6 1113 <<
" " << setw(5) << left << mP.
tdc7 <<
" " << setw(5) << left << mP.
tdc8 <<
" " 1114 << setw(2) << left << mP.
lat1 <<
" " << setw(2) << left << mP.
lat2 <<
" " << setw(2)
1115 << left << mP.
lat3 <<
" " << setw(2) << left << mP.
lat4 <<
" " << setw(2) << left
1116 << mP.
lat5 <<
" " << setw(2) << left << mP.
lat6 <<
" " << setw(2) << left << mP.
lat7 1117 <<
" " << setw(2) << left << mP.
lat8 <<
" " << setw(10) << right << mP.
x <<
" " << setw(9)
1118 << left << mP.
tanPhi <<
" " << setw(5) << left << mP.
t0 <<
" " << setw(13) << left
1119 << mP.
chi2 <<
" r:" <<
rango(mP) << std::endl;
1131 std::map<int, std::vector<metaPrimitive>> primsPerBX;
1137 for (
auto& prims : primsPerBX) {
1139 for (
const auto&
primitive : prims.second)
1147 uint32_t
rawId = -1;
1149 for (
auto& metaPrimitiveIt : inMPaths) {
1151 rawId = metaPrimitiveIt.rawId;
1155 for (
auto& metaPrimitiveItN : inMPaths) {
1158 if (
rawId != metaPrimitiveItN.rawId)
1160 if (numP2 == numP) {
1161 metaPrimitiveIt.index =
inf;
1163 }
else if (iOrder < nOrder) {
1165 }
else if (iOrder > nOrder) {
1166 metaPrimitiveItN.index++;
1167 }
else if (iOrder == nOrder) {
1170 }
else if (
std::abs(metaPrimitiveIt.phiB) <
std::abs(metaPrimitiveItN.phiB)) {
1171 metaPrimitiveItN.index++;
1186 std::vector<std::queue<std::pair<DTLayerId, DTDigi>>*> tmpVector;
1188 std::vector<DTDigiCollection*> collVector;
1190 while (!inQ.empty()) {
1193 for (
auto& sQ : tmpVector) {
1195 while (!sQ->empty()) {
1196 tmpColl.insertDigi((sQ->front().first), (sQ->front().second));
1199 collVector.push_back(&tmpColl);
1206 bool classified =
false;
1208 for (
auto& sC : vec) {
1224 std::queue<std::pair<DTLayerId, DTDigi>> newQueue;
1226 std::pair<DTLayerId, DTDigi> tmpPair;
1228 newQueue.push(tmpPair);
1231 vec.push_back(&newQueue);
1238 desc.add<
int>(
"timeTolerance", 999999);
1239 desc.add<
double>(
"tanPhiTh", 1.0);
1240 desc.add<
double>(
"tanPhiThw2max", 1.3);
1241 desc.add<
double>(
"tanPhiThw2min", 0.5);
1242 desc.add<
double>(
"tanPhiThw1max", 0.9);
1243 desc.add<
double>(
"tanPhiThw1min", 0.2);
1244 desc.add<
double>(
"tanPhiThw0", 0.5);
1245 desc.add<
double>(
"chi2Th", 0.01);
1246 desc.add<
double>(
"chi2corTh", 0.1);
1247 desc.add<
bool>(
"useBX_correlation",
false);
1248 desc.add<
double>(
"dT0_correlate_TP", 25.0);
1249 desc.add<
int>(
"dBX_correlate_TP", 0);
1250 desc.add<
double>(
"dTanPsi_correlate_TP", 99999.0);
1251 desc.add<
bool>(
"clean_chi2_correlation",
true);
1252 desc.add<
bool>(
"allow_confirmation",
true);
1253 desc.add<
double>(
"minx_match_2digis", 1.0);
1254 desc.add<
int>(
"scenario", 0);
1255 desc.add<
int>(
"df_extended", 0);
1256 desc.add<
int>(
"max_primitives", 999);
1257 desc.add<
bool>(
"output_mixer",
false);
1258 desc.add<
bool>(
"output_latpredictor",
false);
1259 desc.add<
bool>(
"output_slfitter",
false);
1260 desc.add<
bool>(
"output_slfilter",
false);
1261 desc.add<
bool>(
"output_confirmed",
false);
1262 desc.add<
bool>(
"output_matcher",
false);
1271 edm::FileInPath(
"L1Trigger/DTTriggerPhase2/data/drift_time_per_chamber.txt"));
1274 edm::FileInPath(
"L1Trigger/DTTriggerPhase2/data/global_coord_perp_x_phi0.txt"));
1276 edm::FileInPath(
"L1Trigger/DTTriggerPhase2/data/lat_predictions.dat"));
1277 desc.add<
int>(
"algo", 0);
1278 desc.add<
int>(
"minHits4Fit", 3);
1279 desc.add<
bool>(
"splitPathPerSL",
true);
1280 desc.addUntracked<
bool>(
"debug",
false);
1281 desc.addUntracked<
bool>(
"dump",
false);
1283 desc.add<
bool>(
"useRPC",
false);
1284 desc.add<
int>(
"bx_window", 1);
1285 desc.add<
double>(
"phi_window", 50.0);
1286 desc.add<
int>(
"max_quality_to_overwrite_t0", 9);
1287 desc.add<
bool>(
"storeAllRPCHits",
false);
1288 desc.add<
bool>(
"activateBuffer",
false);
1289 desc.add<
double>(
"superCelltimewidth", 400);
1290 desc.add<
int>(
"superCellspacewidth", 20);
1294 psd0.
add<
double>(
"angletan", 0.3);
1295 psd0.
add<
double>(
"anglebinwidth", 1.0);
1296 psd0.
add<
double>(
"posbinwidth", 2.1);
1297 psd0.
add<
double>(
"maxdeltaAngDeg", 10);
1298 psd0.
add<
double>(
"maxdeltaPos", 10);
1299 psd0.
add<
int>(
"UpperNumber", 6);
1300 psd0.
add<
int>(
"LowerNumber", 4);
1301 psd0.
add<
double>(
"MaxDistanceToWire", 0.03);
1302 psd0.
add<
int>(
"minNLayerHits", 6);
1303 psd0.
add<
int>(
"minSingleSLHitsMax", 3);
1304 psd0.
add<
int>(
"minSingleSLHitsMin", 3);
1305 psd0.
add<
bool>(
"allowUncorrelatedPatterns",
true);
1306 psd0.
add<
int>(
"minUncorrelatedHits", 3);
1312 "pattern_filename",
edm::FileInPath(
"L1Trigger/DTTriggerPhase2/data/PseudoBayesPatterns_uncorrelated_v0.root"));
1314 psd0.
add<
int>(
"minNLayerHits", 3);
1315 psd0.
add<
int>(
"minSingleSLHitsMax", 3);
1316 psd0.
add<
int>(
"minSingleSLHitsMin", 0);
1317 psd0.
add<
int>(
"allowedVariance", 1);
1318 psd0.
add<
bool>(
"allowDuplicates",
false);
1319 psd0.
add<
bool>(
"setLateralities",
true);
1320 psd0.
add<
bool>(
"allowUncorrelatedPatterns",
true);
1321 psd0.
add<
int>(
"minUncorrelatedHits", 3);
1322 psd0.
add<
bool>(
"saveOnPlace",
true);
1323 psd0.
add<
int>(
"maxPathsPerMatch", 256);
1326 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
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_