Commit 5250f613 authored by Tony Tong's avatar Tony Tong Committed by Graeme Stewart
Browse files

turn on parabolic extrapolation as default (MuonHoughPatternTools-01-00-36)

	* Turn on parabolic extrapolation as default
	* Tagging as MuonHoughPatternTools-01-00-36

2016-09-19 Baojia Tong
	* fix bug in findPhiMaxima
	* fix TGC T4 sublayer information
	* add ExtrapolationDistance option
	* Tagging as MuonHoughPatternTools-01-00-35

2016-09-17 Baojia Tong
	* add parabolic extrapolation option (ATLASRECTS-2785)
	* needs MuonLayerHough-00-00-32
	* Tagging as MuonHoughPatternTools-01-00-34

2016-09-14 Baojia Tong
	* solving ambiguous behavior sorting maxima (ATLASRECTS-3357)
	* Tagging as MuonHoughPatternTools-01-00-33

2016-08-23 Jochen Meyer
	* endreq -> endmsg
...
(Long ChangeLog diff - truncated)
parent cdb9745a
......@@ -276,6 +276,8 @@ namespace Muon {
bool m_onlyUseCurrentBunch;
bool m_doTruth;
bool m_debugHough;
bool m_doParabolicExtrapolation; // if true, do parabolic; if false, do linear extrapolation
float m_extrapolationDistance; // default value is 1500
unsigned int m_ntechnologies;
CollectionsPerSectorVec m_collectionsPerSector;
......@@ -338,8 +340,9 @@ namespace Muon {
sublayer = m_idHelper->tgcIdHelper().gasGap(id)-1;
Muon::MuonStationIndex::StIndex stIndex = m_idHelper->stationIndex(id);
if( stIndex == Muon::MuonStationIndex::EM ) {
//T1 gets +3; T2 gets +3+3; T3 gets +3+6; T4 gets0 (because it is also EI)
Muon::MuonStationIndex::PhiIndex phiIndex = m_idHelper->phiIndex(id);
sublayer += 3;
if( phiIndex == Muon::MuonStationIndex::T2 ) sublayer += 3;
else if( phiIndex == Muon::MuonStationIndex::T3 ) sublayer += 6;
// float fz = fabs(z);
......
......@@ -229,9 +229,9 @@ namespace Muon {
// summary
if (m_summary==true || this->msgLvl(MSG::DEBUG)) {
if( patCombiCol->empty() ) msg() << MSG::DEBUG << " summarizing output: Combined pattern combination empty" << endreq;
if( patCombiCol->empty() ) msg() << MSG::DEBUG << " summarizing output: Combined pattern combination empty" << endmsg;
else msg() << MSG::DEBUG << " summarizing Combined pattern combination output: " << std::endl
<< m_printer->print( *patCombiCol ) << endreq;
<< m_printer->print( *patCombiCol ) << endmsg;
}
// clean up tool for next call
......@@ -285,10 +285,10 @@ namespace Muon {
MuonPrdPatternCollection* etapatterns = m_muonHoughPatternTool->getEtaMuonPatterns();
if (m_summary==true || this->msgLvl(MSG::DEBUG)) {
if( phipatterns->empty() ) msg() << MSG::DEBUG << " summarizing input: Phi pattern combination empty" << endreq;
else msg() << MSG::DEBUG << " summarizing Phi pattern combination input: " << std::endl << m_printer->print( *phipatterns ) << endreq;
if( etapatterns->empty() ) msg() << MSG::DEBUG << " summarizing input: Eta pattern combination empty" << endreq;
else msg() << MSG::DEBUG << " summarizing Eta pattern combination input: " << std::endl << m_printer->print( *etapatterns ) << endreq;
if( phipatterns->empty() ) msg() << MSG::DEBUG << " summarizing input: Phi pattern combination empty" << endmsg;
else msg() << MSG::DEBUG << " summarizing Phi pattern combination input: " << std::endl << m_printer->print( *phipatterns ) << endmsg;
if( etapatterns->empty() ) msg() << MSG::DEBUG << " summarizing input: Eta pattern combination empty" << endmsg;
else msg() << MSG::DEBUG << " summarizing Eta pattern combination input: " << std::endl << m_printer->print( *etapatterns ) << endmsg;
}
ATH_MSG_DEBUG ("writePatterns");
......@@ -552,12 +552,12 @@ namespace Muon {
{
if (1)
{
//msg() << MSG::VERBOSE << "Event through Cut()" << endreq;
//msg() << MSG::VERBOSE << "Event through Cut()" << endmsg;
return true;
}
else {
//msg() << MSG::VERBOSE << "Event not through Cut()" << endreq;
//msg() << MSG::VERBOSE << "Event not through Cut()" << endmsg;
return false;
}
}
......@@ -1024,7 +1024,7 @@ namespace Muon {
m_weighthistogram->Fill(0);
m_weighthistogrammdt->Fill(0);
}
//msg() << MSG::DEBUG << "Hit accepted" << endreq;
//msg() << MSG::DEBUG << "Hit accepted" << endmsg;
} // collection
return;
......@@ -1271,7 +1271,7 @@ namespace Muon {
m_weighthistogram->Fill(weights[i]);
m_weighthistogrammdt->Fill(weights[i]);
}
//msg() << MSG::DEBUG << "Hit accepted" << endreq;
//msg() << MSG::DEBUG << "Hit accepted" << endmsg;
} // collection
}
......@@ -1406,11 +1406,11 @@ namespace Muon {
}
// if (evtStore()->record(cscAssMap,m_cscAssoOutputLocation).isSuccess())
// {
// msg() << MSG::DEBUG << "stored Csc MuonSegPatAssociations at " << m_cscAssoOutputLocation << endreq;
// msg() << MSG::DEBUG << "stored Csc MuonSegPatAssociations at " << m_cscAssoOutputLocation << endmsg;
// }
// else
// {
// msg() << MSG::DEBUG << "Failed to store Csc MuonSegPatAssociations at " << m_cscAssoOutputLocation << endreq;
// msg() << MSG::DEBUG << "Failed to store Csc MuonSegPatAssociations at " << m_cscAssoOutputLocation << endmsg;
// }
}
......
......@@ -162,7 +162,7 @@ void MuonHoughPatternTool::makePatterns(const MuonHoughHitContainer* hitcontaine
if( msgLvl(MSG::VERBOSE) ) {
msg(MSG::VERBOSE) << "Event Info";
msg(MSG::VERBOSE) << "Size: " << m_event->size() << endreq;
msg(MSG::VERBOSE) << "Size: " << m_event->size() << endmsg;
for (unsigned int i=0; i<m_event->size(); i++) {
msg(MSG::VERBOSE) << m_event->getHit(i)->getHitx() << " "
......@@ -173,7 +173,7 @@ void MuonHoughPatternTool::makePatterns(const MuonHoughHitContainer* hitcontaine
<< m_event->getHit(i)->getProbability() << " "
<< m_event->getHit(i)->getWeight() << " "
<< m_event->getHit(i)->getAssociated() <<
endreq;
endmsg;
}
}
......@@ -205,7 +205,7 @@ void MuonHoughPatternTool::makePatterns(int id_number)
MuonHoughHitContainer* event_for_association = whichEventAssociation(id_number, m_event);
if (msgLvl(MSG::VERBOSE)) {
msg(MSG::VERBOSE) << "Size event fill: " << event_for_hough->size() << endreq;
msg(MSG::VERBOSE) << "Size event fill: " << event_for_hough->size() << endmsg;
for (unsigned int i=0; i<event_for_hough->size(); i++) {
msg(MSG::VERBOSE) << event_for_hough->getHit(i)->getHitx() << " "
<< event_for_hough->getHit(i)->getHity() << " "
......@@ -215,11 +215,11 @@ void MuonHoughPatternTool::makePatterns(int id_number)
<< event_for_hough->getHit(i)->getProbability() << " "
<< event_for_hough->getHit(i)->getWeight() << " "
<< event_for_hough->getHit(i)->getAssociated() <<
endreq;
endmsg;
}
if( msgLvl(MSG::VERBOSE) ) {
msg(MSG::VERBOSE) << "Size event association: " << event_for_association->size() << endreq;
msg(MSG::VERBOSE) << "Size event association: " << event_for_association->size() << endmsg;
for (unsigned int i=0; i<event_for_association->size(); i++) {
msg(MSG::VERBOSE) << event_for_association->getHit(i)->getHitx() << " "
<< event_for_association->getHit(i)->getHity() << " "
......@@ -229,7 +229,7 @@ void MuonHoughPatternTool::makePatterns(int id_number)
<< event_for_association->getHit(i)->getProbability() << " "
<< event_for_association->getHit(i)->getWeight() << " "
<< event_for_association->getHit(i)->getAssociated() <<
endreq;
endmsg;
}
}
}
......@@ -1658,7 +1658,7 @@ Muon::MuonPrdPattern* MuonHoughPatternTool::houghPatternToCleanPhiPattern(MuonHo
<< houghpattern->getHit(i)->getMeasuresPhi() << " "
<< houghpattern->getHit(i)->getWhichDetector() << " "
<< houghpattern->getHit(i)->getWeight() << " "
<< houghpattern->getHit(i)->getAssociated() << endreq;
<< houghpattern->getHit(i)->getAssociated() << endmsg;
}
}
......@@ -1745,7 +1745,7 @@ Muon::MuonPrdPattern* MuonHoughPatternTool::houghPatternToCleanPhiPattern(MuonHo
ATH_MSG_DEBUG("END Clean Phi hits " << newsize << " theta " << thetanew);
if (msgLvl(MSG::VERBOSE)) {
msg(MSG::VERBOSE) << "cleaned pattern: " << endreq;
msg(MSG::VERBOSE) << "cleaned pattern: " << endmsg;
printPattern(muonpattern);
}
......
......@@ -81,7 +81,7 @@ StatusCode MuonLayerHoughAlg::execute()
}else{
ATH_MSG_DEBUG("Recorded MuonPatternCombinationCollection at MuonLayerHoughCombis: size " << combis->size());
if( m_printSummary || msgLvl(MSG::DEBUG) ){
msg() << msg().level() << "Number of MuonPatternCombinations " << combis->size() << std::endl << m_printer->print(*combis) << endreq;
msg() << msg().level() << "Number of MuonPatternCombinations " << combis->size() << std::endl << m_printer->print(*combis) << endmsg;
}
}
}
......
......@@ -47,6 +47,8 @@ namespace Muon {
declareProperty("DoTruth",m_doTruth = false );
declareProperty("DebugHough",m_debugHough = false );
declareProperty("UseSeeds",m_useSeeds = true );
declareProperty("DoParabolicExtrapolation",m_doParabolicExtrapolation = true );
declareProperty("ExtrapolationDistance",m_extrapolationDistance = 1500. );
}
......@@ -595,27 +597,21 @@ namespace Muon {
road.phiMaxima.clear();
road.phiMaxima.insert(road.phiMaxima.end(),road.phiMaximumSet.begin(),road.phiMaximumSet.end());
auto maximaSortingLambda = []( const MuonHough::MuonPhiLayerHough::Maximum* m1, const MuonHough::MuonPhiLayerHough::Maximum* m2 ) {
auto maximaSortingLambda = [road]( const MuonHough::MuonPhiLayerHough::Maximum* m1, const MuonHough::MuonPhiLayerHough::Maximum* m2 ) {
if( m1->max == m2->max ){
if( m1->hits.size() == m2->hits.size() ) {
if( m1->pos == m2->pos ) {
std::set<unsigned int> nbrlaym1;
std::set<unsigned int> nbrlaym2;
for( unsigned int k=0; k < m1->hits.size(); ++k ){
nbrlaym1.insert((m1->hits)[k]->layer);
nbrlaym2.insert((m2->hits)[k]->layer);
}
if( nbrlaym1.size() == nbrlaym2.size() ){
if (m1->sector == m2->sector){ // prefer the same sector as the seed sector
if( m1->hits.size() == m2->hits.size() ) {
if( m1->pos == m2->pos ) {
if( std::abs(m1->binposmax - m1->binposmin) == std::abs(m2->binposmax - m2->binposmin) ) {
return (m1->sector)%2 > (m2->sector)%2;
return (m1->binposmin) < (m2->binposmin);
}
return std::abs(m1->binposmax - m1->binposmin) < std::abs(m2->binposmax - m2->binposmin);
}
return nbrlaym1.size() < nbrlaym2.size();
return m1->pos < m2->pos;
}
return m1->pos < m2->pos;
return m1->hits.size() < m2->hits.size(); // least hits -> most collimated maximum
}
return m1->hits.size() < m2->hits.size(); // least hits -> most collimated maximum
return m1->sector == road.seed->hough->m_descriptor.sector;
}
return m1->max > m2->max;
};
......@@ -705,7 +701,7 @@ namespace Muon {
// untrue -> look in neighboring layer
// true -> look only in this layer
double distanceCut = layer == seedLayer ? 500. : 1500.;
double distanceCut = layer == seedLayer ? 500. : m_extrapolationDistance;
unsigned int layerHash = MuonStationIndex::sectorLayerHash(region,layer);
......@@ -718,20 +714,17 @@ namespace Muon {
// loop over maxima in layer
for( auto mit = maxima.begin();mit!=maxima.end();++mit ){
MuonHough::MuonLayerHough::Maximum* candMaximum = *mit;
// extrapolate seed to layer assuming a pointing straight line, swap coordinates for BEE
float yloc = layer != MuonStationIndex::BarrelExtended ? // yloc is linear extrapolation -> here change for making the straight line a bent line
candMaximum->hough->m_descriptor.referencePosition*seed.pos/seed.hough->m_descriptor.referencePosition :
candMaximum->hough->m_descriptor.referencePosition*seed.hough->m_descriptor.referencePosition/seed.pos;
// extrapolate seed to layer assuming a pointing straight line or parabolic
// add maximum to road if close enough
if( fabs(yloc - candMaximum->pos) < distanceCut ) {
ATH_MSG_VERBOSE(" Adding maximum position " << candMaximum->pos << " intersect " << yloc );
float yloc_diff = MuonHough::extrapolate(seed, *candMaximum, m_doParabolicExtrapolation);
if( fabs( MuonHough::extrapolate(seed, *candMaximum, m_doParabolicExtrapolation) ) < distanceCut ) {
ATH_MSG_VERBOSE(" Adding maximum position " << candMaximum->pos << " intersect diff" << yloc_diff );
road.add(candMaximum);
}else{
ATH_MSG_VERBOSE(" Maximum position: y " << candMaximum->pos
<< " x " << candMaximum->hough->m_descriptor.referencePosition
<< " seed y " << seed.hough->m_descriptor.referencePosition
<< " x " << seed.pos << " intersect " << yloc );
<< " x " << seed.pos << " intersect diff " << yloc_diff );
}
}
}
......@@ -775,15 +768,14 @@ namespace Muon {
for( auto mit = maxima.begin();mit!=maxima.end();++mit ){
MuonHough::MuonLayerHough::Maximum* candMaximum = *mit;
// extrapolate seed to layer assuming a pointing straight line, swap coordinates
float yloc = candMaximum->hough->m_descriptor.referencePosition*seed.hough->m_descriptor.referencePosition/seed.pos;
float yloc_diff = MuonHough::extrapolate(seed, *candMaximum, m_doParabolicExtrapolation);
ATH_MSG_VERBOSE(" Maximum position: y " << candMaximum->pos
<< " x " << candMaximum->hough->m_descriptor.referencePosition
<< " seed y " << seed.hough->m_descriptor.referencePosition
<< " x " << seed.pos
<< " intersect " << yloc );
<< " intersect diff " << yloc_diff );
if( fabs(yloc - candMaximum->pos) < distanceCut ) {
if( fabs(yloc_diff) < distanceCut ) {
road.add(candMaximum);
road.neighbouringRegion = neighbourRegion;
}
......@@ -1723,18 +1715,49 @@ namespace Muon {
}
maximum.sector = sector; // very fragile passing on of sector
maxima.push_back( new MuonHough::MuonPhiLayerHough::Maximum(maximum) );
//check if the maximum is already filled, if so, don't add it again
bool maximum_matched = false;
for( auto pit = maxima.begin();pit!=maxima.end();++pit ){
// reference to phi maximum
MuonHough::MuonPhiLayerHough::Maximum& pmaximum = **pit;
if (pmaximum.sector == maximum.sector && pmaximum.max == maximum.max && pmaximum.pos == maximum.pos &&
pmaximum.hits.size() == maximum.hits.size() && pmaximum.binpos == maximum.binpos &&
pmaximum.binposmin == maximum.binposmin && pmaximum.binposmax == maximum.binposmax){
ATH_MSG_DEBUG("extendSeed: sector has already been added! Skip. ");
bool maximum_hitmatched = true;// check if there is a hit that is not the same
for ( unsigned int k=0; k < maximum.hits.size(); ++k){
if (maximum.hits[k] != pmaximum.hits[k]){// directly compare pointer address
maximum_hitmatched = false;
break;
}
}
if (maximum_hitmatched){
maximum_matched = true;
break;
}
}
}
//remove the hits from hough
hough.fillLayer2(maximum.hits,true);
++nmaxima;
if (maximum_matched){
//++nmaxima;
continue;
}
else{
if( nmaxima > 0 ) {
ATH_MSG_VERBOSE("findMaxima(Phi): No more maxima found " << nmaxima );
}
// ?!? same here, the function should return false if nothing was found, right?
break;
maxima.push_back( new MuonHough::MuonPhiLayerHough::Maximum(maximum) );
++nmaxima;
}
}
else{
if( nmaxima > 0 ) {
ATH_MSG_VERBOSE("findMaxima(Phi): No more maxima found " << nmaxima );
}
// ?!? same here, the function should return false if nothing was found, right?
break;
}
}
hough.reset();
return true;
}
......@@ -2085,7 +2108,7 @@ namespace Muon {
ATH_MSG_DEBUG("TgcHitClusteringObj, no 3D clusters! ");
if( msgLvl(MSG::DEBUG) ){
for(std::vector<const TgcPrepData*>::iterator it=prds.begin();it!=prds.end();++it ){
msg(MSG::DEBUG) << " " << m_idHelper->toString( (*it)->identify() ) << endreq;
msg(MSG::DEBUG) << " " << m_idHelper->toString( (*it)->identify() ) << endmsg;
}
}
return;
......@@ -2094,7 +2117,7 @@ namespace Muon {
ATH_MSG_DEBUG("TgcHitClusteringObj, no eta cluster selected! ");
if( msgLvl(MSG::DEBUG) ){
for(std::vector<const TgcPrepData*>::iterator it=prds.begin();it!=prds.end();++it ){
msg(MSG::DEBUG) << " " << m_idHelper->toString( (*it)->identify() ) << endreq;
msg(MSG::DEBUG) << " " << m_idHelper->toString( (*it)->identify() ) << endmsg;
}
}
return;
......@@ -2306,7 +2329,7 @@ namespace Muon {
}
if( msgLvl(MSG::DEBUG) ) msg(MSG::DEBUG) << std::endl;
}
if( msgLvl(MSG::DEBUG) ) msg(MSG::DEBUG) << endreq;
if( msgLvl(MSG::DEBUG) ) msg(MSG::DEBUG) << endmsg;
}
void MuonLayerHoughTool::HoughDataPerSector::cleanUp() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment