13 using namespace cmsdt;
21 debug_ =
pset.getUntrackedParameter<
bool>(
"debug");
33 LogDebug(
"PseudoBayesGrouping") <<
"PseudoBayesGrouping:: constructor";
38 LogDebug(
"PseudoBayesGrouping") <<
"PseudoBayesGrouping:: destructor";
49 LogDebug(
"PseudoBayesGrouping") <<
"PseudoBayesGrouping::initialiase";
55 std::vector<std::vector<std::vector<int>>>* pattern_reader =
56 (std::vector<std::vector<std::vector<int>>>*)
f->Get(
"allPatterns");
57 for (std::vector<std::vector<std::vector<int>>>::iterator itPattern = (*pattern_reader).begin();
58 itPattern != (*pattern_reader).end();
64 LogDebug(
"PseudoBayesGrouping") <<
"PseudoBayesGrouping::initialiase Total number of loaded patterns: "
70 allMatches_ = std::make_unique<CandidateGroupPtrs>();
76 LogDebug(
"PseudoBayesGrouping") <<
"PseudoBayesGrouping::LoadPattern Loading patterns seeded by: "
77 << itPattern->at(0).at(0) <<
", " << itPattern->at(0).at(1) <<
", "
78 << itPattern->at(0).at(2) <<
", ";
83 for (
const auto& itHits : *itPattern) {
86 p =
DTPattern(itHits.at(0), itHits.at(1), itHits.at(2));
91 if (itHits.begin() == itHits.end())
94 else if (itHits.at(0) % 2 == 0) {
95 p.addHit(std::make_tuple(itHits.at(0), itHits.at(1), itHits.at(2)));
96 }
else if (itHits.at(0) % 2 == 1) {
97 p.addHit(std::make_tuple(itHits.at(0), itHits.at(1) - 1, itHits.at(2)));
185 LogDebug(
"PseudoBayesGrouping") <<
"PseudoBayesGrouping::run";
195 LogDebug(
"PseudoBayesGrouping") <<
"PseudoBayesGrouping::run Pattern qualities before cleaning: ";
197 LogDebug(
"PseudoBayesGrouping") << cand_it->nLayerhits() <<
", " << cand_it->nisGood() <<
", " << cand_it->nhits()
198 <<
", " << cand_it->quality() <<
", " << cand_it->candId();
204 LogDebug(
"PseudoBayesGrouping") <<
"PseudoBayesGrouping::run Number of found patterns: " <<
finalMatches_->size();
209 LogDebug(
"PseudoBayesGrouping") <<
"PseudoBayesGrouping::run ended run";
216 LogDebug(
"PseudoBayesGrouping") <<
"PseudoBayesGrouping::run Create pointers ";
218 for (
int i = 0;
i < 8;
i++)
219 ptrPrimitive.push_back(std::make_shared<DTPrimitive>());
224 for (
auto& itDTP : (*itCand)->candHits()) {
226 LogDebug(
"PseudoBayesGrouping") <<
"PseudoBayesGrouping::run loop over dt hits to fill pointer";
228 int layerHit = (*itDTP).layerId();
231 (*itDTP).setLayerId(layerHit - 4);
236 int predLat = (*itCand)->pattern()->latHitIn(layerHit, (*itDTP).channelId(),
allowedVariance_);
237 if (predLat == -10 || predLat == 0) {
238 (*itDTP).setLaterality(
NONE);
239 }
else if (predLat == -1) {
240 (*itDTP).setLaterality(
LEFT);
241 }
else if (predLat == +1) {
242 (*itDTP).setLaterality(
RIGHT);
246 if (qualityDTP != (qualityDTP | ref8Hit)) {
248 LogDebug(
"PseudoBayesGrouping") <<
"PseudoBayesGrouping::run Adding hit to muon path";
249 qualityDTP = (qualityDTP | ref8Hit);
252 ptrPrimitive.at(layerHit) = std::make_shared<DTPrimitive>((*itDTP));
257 ptrPrimitive.at(intHit) = std::make_shared<DTPrimitive>((*itDTP));
263 for (
int i = 0;
i <= 7;
i++) {
266 ptrPrimitive.at(
i) = std::make_shared<DTPrimitive>();
271 std::make_shared<MuonPath>(ptrPrimitive, (
short)(*itCand)->nLayerUp(), (short)(*itCand)->nLayerDown()));
318 std::vector<DTPrimitive> digisinLUp,
319 std::vector<DTPattern*> patterns) {
322 for (
auto dtPD_it = digisinLDown.begin(); dtPD_it != digisinLDown.end(); dtPD_it++) {
323 int LDown = dtPD_it->layerId();
324 int wireDown = dtPD_it->channelId();
325 for (
auto dtPU_it = digisinLUp.begin(); dtPU_it != digisinLUp.end(); dtPU_it++) {
326 int LUp = dtPU_it->layerId();
327 int wireUp = dtPU_it->channelId();
328 int diff = wireUp - wireDown;
329 for (
auto pat_it = patterns.begin(); pat_it != patterns.end(); pat_it++) {
331 if ((*pat_it)->sl1() != (LDown) || (*pat_it)->sl2() != (LUp) || (*pat_it)->diff() !=
diff)
334 (*pat_it)->setHitDown(wireDown);
335 auto cand = std::make_shared<CandidateGroup>(*pat_it);
338 if (((*pat_it)->latHitIn(dtTest_it->layerId(), dtTest_it->channelId(),
allowedVariance_)) != -999) {
339 if (((*pat_it)->latHitIn(dtTest_it->layerId(), dtTest_it->channelId(),
allowedVariance_)) == -10)
340 cand->addHit((*dtTest_it), dtTest_it->layerId(),
false);
342 cand->addHit((*dtTest_it), dtTest_it->layerId(),
true);
351 LogDebug(
"PseudoBayesGrouping") <<
"PseudoBayesGrouping::RecognisePatterns Pattern found for pair in "
352 << LDown <<
" ," << wireDown <<
" ," << LUp <<
" ," << wireUp;
354 <<
"Candidate has " <<
cand->nhits() <<
" hits with quality " <<
cand->quality();
355 LogDebug(
"PseudoBayesGrouping") << *(*pat_it);
371 LogDebug(
"PseudoBayesGrouping") <<
"PseudoBayesGrouping::FillDigisByLayer Classifying digis by layer";
373 for (
const auto& dtDigi_It : *digis) {
376 for (
auto digiIt = (dtDigi_It.second).first; digiIt != (dtDigi_It.second).second; digiIt++) {
380 int layer = dtLId.
layer() - 1;
391 LogDebug(
"PseudoBayesGrouping") <<
"Hit in L " << layer <<
" SL " << dtLId.
superlayer() <<
" WIRE "
392 << digiIt->wire() - 1;
436 for (
const auto& dt_it : (*itSel)->candHits()) {
437 (*cand_it)->removeHit((*dt_it));
443 LogDebug(
"PseudoBayesGrouping") <<
"Pattern qualities: ";
445 LogDebug(
"PseudoBayesGrouping") << cand_it->nLayerhits() <<
", " << cand_it->nisGood() <<
", "
446 << cand_it->nhits() <<
", " << cand_it->quality() <<
", " << cand_it->candId()
470 LogDebug(
"PseudoBayesGrouping") <<
"PseudoBayesGrouping: finish";