diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcRoadDefiner.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcRoadDefiner.h index 9176b40c1d901d3981aa45a0588a6eb3bc77dbbf..add5d3bb67957e11fa6bccf013b06375f349b451 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcRoadDefiner.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcRoadDefiner.h @@ -39,7 +39,7 @@ class TgcRoadDefiner inline MSG::Level msgLvl() const { return (m_msg != 0) ? m_msg->level() : MSG::NIL; } - bool defineRoad(const LVL1::RecMuonRoI* p_roi, + bool defineRoad(const LVL1::RecMuonRoI* p_roi, const TrigL2MuonSA::TgcHits& tgcHits, TrigL2MuonSA::MuonRoad& muonRoad, TrigL2MuonSA::TgcFitResult& tgcFitResult); diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtRegionDefiner.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtRegionDefiner.cxx index 6e22b9d4bd3d04a6016264a125acb1dc5bcbf86b..91da31a9d28dfdbc65a1a3198148bfcd11b65868 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtRegionDefiner.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtRegionDefiner.cxx @@ -16,8 +16,9 @@ // -------------------------------------------------------------------------------- TrigL2MuonSA::MdtRegionDefiner::MdtRegionDefiner(MsgStream* msg) : - m_msg(msg) + m_msg(0) { + if ( msg ) m_msg = msg; } // -------------------------------------------------------------------------------- diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastStationFitter.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastStationFitter.cxx index 85b9bed674b3d7e3e30c8e86fcc7b4982dca18ac..cb5c21755c547babfb9122b8ef55380ad8f3d1cb 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastStationFitter.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastStationFitter.cxx @@ -1462,81 +1462,78 @@ int TrigL2MuonSA::MuFastStationFitter::Evlfit(int Ifla, TrigL2MuonSA::PBFitResul for(j=0;j<pbFitResult.NPOI;j++) if(pbFitResult.IGLIN[j]>=1) pbFitResult.NDOF++; - for( ; ;) { + while(pbFitResult.NDOF>=1) { - while(pbFitResult.NDOF>=1) { + // printf("pbFitResult.NDOF = %2d\n",pbFitResult.NDOF); + Ntry++; + Circles(pbFitResult.NPOI,pbFitResult.XILIN,pbFitResult.YILIN,pbFitResult.RILIN,pbFitResult.WILIN, + pbFitResult.IGLIN,&pbFitResult.ALIN,&pbFitResult.BLIN,pbFitResult.DABLIN,&pbFitResult.CHI2, + &pbFitResult.PCHI2); - // printf("pbFitResult.NDOF = %2d\n",pbFitResult.NDOF); - Ntry++; - Circles(pbFitResult.NPOI,pbFitResult.XILIN,pbFitResult.YILIN,pbFitResult.RILIN,pbFitResult.WILIN, - pbFitResult.IGLIN,&pbFitResult.ALIN,&pbFitResult.BLIN,pbFitResult.DABLIN,&pbFitResult.CHI2, - &pbFitResult.PCHI2); + if(pbFitResult.CHI2<=ZERO_LIMIT) break; - if(pbFitResult.CHI2<=ZERO_LIMIT) break; + Xnor = 1. / sqrt(1. + pbFitResult.ALIN * pbFitResult.ALIN); - Xnor = 1. / sqrt(1. + pbFitResult.ALIN * pbFitResult.ALIN); + for(i=0;i<pbFitResult.NPOI;i++) pbFitResult.RESI[i] = 0.; - for(i=0;i<pbFitResult.NPOI;i++) pbFitResult.RESI[i] = 0.; + for(j=0;j<pbFitResult.NPOI;j++) { - for(j=0;j<pbFitResult.NPOI;j++) { + pbFitResult.DISTJ[j] = (pbFitResult.ALIN * pbFitResult.XILIN[j] + pbFitResult.BLIN - pbFitResult.YILIN[j]) * Xnor; + IGcur = abs(pbFitResult.IGLIN[j])%100; - pbFitResult.DISTJ[j] = (pbFitResult.ALIN * pbFitResult.XILIN[j] + pbFitResult.BLIN - pbFitResult.YILIN[j]) * Xnor; - IGcur = abs(pbFitResult.IGLIN[j])%100; - - if (IGcur==1) { - pbFitResult.RESI[j] = pbFitResult.DISTJ[j]; - } else if (IGcur==2) { - rlin = (pbFitResult.DISTJ[j]>=0.) ? pbFitResult.RILIN[j] : -pbFitResult.RILIN[j]; - pbFitResult.RESI[j] = pbFitResult.DISTJ[j] - rlin; - } else if (IGcur==3) { - pbFitResult.RESI[j] = pbFitResult.DISTJ[j] - pbFitResult.RILIN[j]; - } - } + if (IGcur==1) { + pbFitResult.RESI[j] = pbFitResult.DISTJ[j]; + } else if (IGcur==2) { + rlin = (pbFitResult.DISTJ[j]>=0.) ? pbFitResult.RILIN[j] : -pbFitResult.RILIN[j]; + pbFitResult.RESI[j] = pbFitResult.DISTJ[j] - rlin; + } else if (IGcur==3) { + pbFitResult.RESI[j] = pbFitResult.DISTJ[j] - pbFitResult.RILIN[j]; + } + } - if(pbFitResult.PCHI2>=0.01||Ifla==1) return Ifit; - - if (pbFitResult.NDOF<=1||Ntry>=6) { - - Ifit = 1; - pbFitResult.NDOF = 0; - pbFitResult.ALIN = 0.; - pbFitResult.BLIN = 0.; - pbFitResult.CHI2 = -1.; - pbFitResult.PCHI2 = -.5; - - for (i=0;i<2;i++) { - for(k=0;k<2;k++) { - pbFitResult.DABLIN[i][k] = 0.; - } + if(pbFitResult.PCHI2>=0.01||Ifla==1) return Ifit; + + if (pbFitResult.NDOF<=1||Ntry>=6) { + + Ifit = 1; + pbFitResult.NDOF = 0; + pbFitResult.ALIN = 0.; + pbFitResult.BLIN = 0.; + pbFitResult.CHI2 = -1.; + pbFitResult.PCHI2 = -.5; + + for (i=0;i<2;i++) { + for(k=0;k<2;k++) { + pbFitResult.DABLIN[i][k] = 0.; } + } - for(j=0;j<pbFitResult.NPOI;j++) pbFitResult.IGLIN[j] = - abs(pbFitResult.IGLIN[j])%100; + for(j=0;j<pbFitResult.NPOI;j++) pbFitResult.IGLIN[j] = - abs(pbFitResult.IGLIN[j])%100; - return Ifit; - } - - // Exclude the worst point - Jbad = 0; - Xbad = -1.; - for (j=0;j<pbFitResult.NPOI;j++) { - if (pbFitResult.IGLIN[j]>=1) { - test = pbFitResult.RESI[j] * pbFitResult.RESI[j] * pbFitResult.WILIN[j]; - if (test>=Xbad) { - Xbad = test; - Jbad = j; - } + return Ifit; + } + + // Exclude the worst point + Jbad = 0; + Xbad = -1.; + for (j=0;j<pbFitResult.NPOI;j++) { + if (pbFitResult.IGLIN[j]>=1) { + test = pbFitResult.RESI[j] * pbFitResult.RESI[j] * pbFitResult.WILIN[j]; + if (test>=Xbad) { + Xbad = test; + Jbad = j; } } - - // Try again - - pbFitResult.IGLIN[Jbad] = - pbFitResult.IGLIN[Jbad] - 100; - pbFitResult.NDOF = pbFitResult.NDOF - 1; - } - - return Ifit; + + // Try again + + pbFitResult.IGLIN[Jbad] = - pbFitResult.IGLIN[Jbad] - 100; + pbFitResult.NDOF = pbFitResult.NDOF - 1; + } + + return Ifit; } // -------------------------------------------------------------------------------- diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastTrackExtrapolator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastTrackExtrapolator.cxx index e2ceda263761011f95b02ac2116165c21dbf2eb7..7cdcc46250bbc6e578966ae24e73b260cd967304 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastTrackExtrapolator.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastTrackExtrapolator.cxx @@ -23,8 +23,8 @@ const InterfaceID& TrigL2MuonSA::MuFastTrackExtrapolator::interfaceID() { return // -------------------------------------------------------------------------------- TrigL2MuonSA::MuFastTrackExtrapolator::MuFastTrackExtrapolator(const std::string& type, - const std::string& name, - const IInterface* parent): + const std::string& name, + const IInterface* parent): AthAlgTool(type,name,parent), m_msg(0), m_storeGateSvc( "StoreGateSvc", name ) @@ -85,7 +85,7 @@ void TrigL2MuonSA::MuFastTrackExtrapolator::setExtrapolatorTool(ToolHandle<ITrig // -------------------------------------------------------------------------------- StatusCode TrigL2MuonSA::MuFastTrackExtrapolator::extrapolateTrack(std::vector<TrigL2MuonSA::TrackPattern>& v_trackPatterns, - double winPt) + double winPt) { msg() << MSG::DEBUG << "in extrapolateTrack" << endreq; @@ -113,16 +113,25 @@ StatusCode TrigL2MuonSA::MuFastTrackExtrapolator::extrapolateTrack(std::vector<T double eptinv = getMuFastRes(m_muFastRes_barrel, (itTrack->pt)*(itTrack->charge), itTrack->s_address, itTrack->etaMap, itTrack->phiMS); - sc = (*m_backExtrapolatorTool)->give_eta_phi_at_vertex(muonSA, etaVtx, sigEta, phiVtx, sigPhi, winPt); + if (m_backExtrapolatorTool) { + + sc = (*m_backExtrapolatorTool)->give_eta_phi_at_vertex(muonSA, etaVtx, sigEta, phiVtx, sigPhi, winPt); - if (sc.isFailure()) { - msg() << MSG::DEBUG << "BackExtrapolator problem: " - << "Pt of Muon Feature out of BackExtrapolator range." - << endreq; - msg() << MSG::DEBUG << "Use Muon Feature position to fill the " - << "TrigRoiDescriptor for IDSCAN." << endreq; - etaVtx = itTrack->etaMap; - phiVtx = itTrack->phiMS; + if (sc.isFailure()) { + msg() << MSG::DEBUG << "BackExtrapolator problem: " + << "Pt of Muon Feature out of BackExtrapolator range." + << endreq; + msg() << MSG::DEBUG << "Use Muon Feature position to fill the " + << "TrigRoiDescriptor for IDSCAN." << endreq; + etaVtx = itTrack->etaMap; + phiVtx = itTrack->phiMS; + } + + } else { + + msg() << MSG::ERROR << "Null pointer to ITrigMuonBackExtrapolator" << endreq; + return StatusCode::FAILURE; + } itTrack->deltaPt = (eptinv!=0.)? eptinv * (itTrack->pt) * (itTrack->pt): 1.0e10; @@ -154,7 +163,7 @@ StatusCode TrigL2MuonSA::MuFastTrackExtrapolator::finalize() // -------------------------------------------------------------------------------- void TrigL2MuonSA::MuFastTrackExtrapolator::setMuFastRes(std::vector<double>& vec, double p1,double p2, - double p3,double p4,double p5,double p6) { + double p3,double p4,double p5,double p6) { vec.clear(); vec.push_back(p1); vec.push_back(p2); @@ -171,8 +180,8 @@ void TrigL2MuonSA::MuFastTrackExtrapolator::setMuFastRes(std::vector<double>& ve // Original author: Stefano Giagu // Copied from TrigmuComb/muCombUtil.cxx double TrigL2MuonSA::MuFastTrackExtrapolator::getMuFastRes(std::vector<double> vec, - const double pt, const int add, - const double eta, const double phi) { + const double pt, const int add, + const double eta, const double phi) { if (pt == 0) return 1.0e30; @@ -186,7 +195,7 @@ double TrigL2MuonSA::MuFastTrackExtrapolator::getMuFastRes(std::vector<double> v else { double AbsPtInv3 = AbsPtInv*AbsPtInv*AbsPtInv; double AbsPtInv2 = AbsPtInv*AbsPtInv; - return vec[2]*AbsPtInv3 + vec[3]*AbsPtInv2 + vec[4]*AbsPtInv +vec[5]; + return vec[2]*AbsPtInv3 + vec[3]*AbsPtInv2 + vec[4]*AbsPtInv +vec[5]; } } else {//Takuya/Kunihiro updated numbers @@ -215,15 +224,15 @@ double TrigL2MuonSA::MuFastTrackExtrapolator::getMuFastRes(std::vector<double> v if ( spReg==1 ) { vpar = vparECA; } else if( spReg==2 ) { vpar = vparECB; } else { - if ( AbsEta < 1.20) { vpar = vparEC1; } - else if( AbsEta < 1.35) { vpar = vparEC2; } - else if( AbsEta < 1.50) { vpar = vparEC3; } - else if( AbsEta < 1.65) { vpar = vparEC4; } - else if( AbsEta < 1.80) { vpar = vparEC5; } - else if( AbsEta < 1.95) { vpar = vparEC6; } - else if( AbsEta < 2.10) { vpar = vparEC7; } - else if( AbsEta < 2.35) { vpar = vparEC8; } - else { vpar = vparEC9; } + if ( AbsEta < 1.20) { vpar = vparEC1; } + else if( AbsEta < 1.35) { vpar = vparEC2; } + else if( AbsEta < 1.50) { vpar = vparEC3; } + else if( AbsEta < 1.65) { vpar = vparEC4; } + else if( AbsEta < 1.80) { vpar = vparEC5; } + else if( AbsEta < 1.95) { vpar = vparEC6; } + else if( AbsEta < 2.10) { vpar = vparEC7; } + else if( AbsEta < 2.35) { vpar = vparEC8; } + else { vpar = vparEC9; } } double fracRes = vpar[0] + vpar[1]*AbsPtInv @@ -233,10 +242,8 @@ double TrigL2MuonSA::MuFastTrackExtrapolator::getMuFastRes(std::vector<double> v return fabs(fracRes * AbsPtInv); } - - return 9999.; } - + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -255,16 +262,16 @@ int TrigL2MuonSA::MuFastTrackExtrapolator::whichECRegion( const double eta, cons (M_PI*23./48. <= fabs(phi) && fabs(phi) < M_PI*25./48. ) || (M_PI*35./48. <= fabs(phi) && fabs(phi) < M_PI*37./48. ) || (M_PI*47./48. <= fabs(phi) && fabs(phi) < M_PI ) - ) + ) ) return 1; else if ( ( 1.5 <= absEta && absEta < 1.65 ) && - ( (M_PI*3./32. <= fabs(phi) && fabs(phi) < M_PI*5./32. ) || - (M_PI*11./32. <= fabs(phi) && fabs(phi) < M_PI*13./32.) || - (M_PI*19./32. <= fabs(phi) && fabs(phi) < M_PI*21./32.) || - (M_PI*27./32. <= fabs(phi) && fabs(phi) < M_PI*29./32.) - ) - ) return 2; + ( (M_PI*3./32. <= fabs(phi) && fabs(phi) < M_PI*5./32. ) || + (M_PI*11./32. <= fabs(phi) && fabs(phi) < M_PI*13./32.) || + (M_PI*19./32. <= fabs(phi) && fabs(phi) < M_PI*21./32.) || + (M_PI*27./32. <= fabs(phi) && fabs(phi) < M_PI*29./32.) + ) + ) return 2; else return 0; } diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx index 3b7f1aebd7efb69c0e077ece4bbbc647b42bb6e8..9706bc6550e7e58ffff623b2d03bcc698e7e8dd8 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx @@ -35,8 +35,8 @@ const InterfaceID& TrigL2MuonSA::RpcDataPreparator::interfaceID() { return IID_R // -------------------------------------------------------------------------------- TrigL2MuonSA::RpcDataPreparator::RpcDataPreparator(const std::string& type, - const std::string& name, - const IInterface* parent): + const std::string& name, + const IInterface* parent): AthAlgTool(type,name,parent), m_msg(0), m_storeGateSvc( "StoreGateSvc", name ), @@ -132,8 +132,8 @@ StatusCode TrigL2MuonSA::RpcDataPreparator::initialize() // -------------------------------------------------------------------------------- StatusCode TrigL2MuonSA::RpcDataPreparator::prepareData(const TrigRoiDescriptor* p_roids, - TrigL2MuonSA::RpcHits& rpcHits, - TrigL2MuonSA::RpcPatFinder* rpcPatFinder) + TrigL2MuonSA::RpcHits& rpcHits, + TrigL2MuonSA::RpcPatFinder* rpcPatFinder) { // RPC data extraction referring TrigMuonEFStandaloneTrackTool and MuonHoughPatternFinderTool rpcHits.clear(); @@ -159,14 +159,18 @@ StatusCode TrigL2MuonSA::RpcDataPreparator::prepareData(const TrigRoiDescriptor* const RpcPrepDataContainer* rpcPrds = 0; std::string rpcKey = "RPC_Measurements"; - StatusCode sc = (*m_activeStore)->retrieve(rpcPrds, rpcKey); - if ( sc.isFailure() ) { - msg() << MSG::ERROR << " Cannot retrieve RPC PRD Container " << rpcKey << endreq; + if (m_activeStore) { + StatusCode sc = (*m_activeStore)->retrieve(rpcPrds, rpcKey); + if ( sc.isFailure() ) { + msg() << MSG::ERROR << " Cannot retrieve RPC PRD Container " << rpcKey << endreq; + return StatusCode::FAILURE;; + } else { + msg()<< MSG::DEBUG << " RPC PRD Container retrieved with key " << rpcKey << endreq; + } + } else { + msg() << MSG::ERROR << "Null pointer to ActiveStore" << endreq; return StatusCode::FAILURE;; - } else { - msg()<< MSG::DEBUG << " RPC PRD Container retrieved with key " << rpcKey << endreq; } - // Get RPC collections RpcPrepDataContainer::const_iterator RPCcoll; @@ -175,12 +179,12 @@ StatusCode TrigL2MuonSA::RpcDataPreparator::prepareData(const TrigRoiDescriptor* RPCcoll = rpcPrds->indexFind(*idit); if( RPCcoll == rpcPrds->end() ) { - continue; + continue; } if( (*RPCcoll)->size() == 0) { - msg() << MSG::DEBUG << "Empty RPC list" << endreq; - continue; + msg() << MSG::DEBUG << "Empty RPC list" << endreq; + continue; } rpcHashList_cache.push_back(*idit); @@ -188,7 +192,7 @@ StatusCode TrigL2MuonSA::RpcDataPreparator::prepareData(const TrigRoiDescriptor* rpcCols.push_back(*RPCcoll); if (rpcCols.empty()) { - msg() << MSG::DEBUG << "No Rpc data collections selected" << endreq; + msg() << MSG::DEBUG << "No Rpc data collections selected" << endreq; } } } @@ -229,11 +233,11 @@ StatusCode TrigL2MuonSA::RpcDataPreparator::prepareData(const TrigRoiDescriptor* const double hitz=globalpos.z(); msg() << MSG::DEBUG << "Selected Rpc Collection: " - << " station name:" << stationName - << " global positions x/y/z=" << hitx << "/" << hity << "/" << hitz - << " doubletR: " << doubletR << " doubletZ: " << doubletZ << " doubletPhi " << doubletPhi - << " gasGap " << gasGap << " layer " << layer - << endreq; + << " station name:" << stationName + << " global positions x/y/z=" << hitx << "/" << hity << "/" << hitz + << " doubletR: " << doubletR << " doubletZ: " << doubletZ << " doubletPhi " << doubletPhi + << " gasGap " << gasGap << " layer " << layer + << endreq; TrigL2MuonSA::RpcHitData lutDigit; diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcRoadDefiner.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcRoadDefiner.cxx index ee841f9bbd0d9bbaae566451b4d1e04ad2b2be39..69b5051777f5e878d93173f6d780a2386f10d6fc 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcRoadDefiner.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcRoadDefiner.cxx @@ -12,10 +12,10 @@ // -------------------------------------------------------------------------------- TrigL2MuonSA::RpcRoadDefiner::RpcRoadDefiner(MsgStream* msg) - : m_msg(msg), m_roadData(0), + : m_msg(), m_roadData(0), m_rWidth_RPC_Failed(0), m_use_rpc(0) { - + if ( msg ) m_msg = msg; } // -------------------------------------------------------------------------------- diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/SagittaRadiusEstimate.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/SagittaRadiusEstimate.cxx index ad1b1572808bcdd291838504de18f1721cfb7ca2..aa569b8a77726f76c92a4e22579318f126b4c58a 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/SagittaRadiusEstimate.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/SagittaRadiusEstimate.cxx @@ -16,10 +16,11 @@ TrigL2MuonSA::SagittaRadiusEstimate::SagittaRadiusEstimate(MsgStream* msg, BooleanProperty use_mcLUT, const TrigL2MuonSA::AlignmentBarrelLUTSvc* alignmentBarrelLUTSvc): - m_msg(msg), + m_msg(0), m_use_mcLUT(use_mcLUT), m_alignmentBarrelLUT(0) { + if ( msg ) m_msg = msg; if ( alignmentBarrelLUTSvc && !m_use_mcLUT ) m_alignmentBarrelLUT = alignmentBarrelLUTSvc->alignmentBarrelLUT(); } diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx index 026ed499015b8a171a89e08979b24292acf0684e..dd480930912d2d7f87e4ffd409d4cc93a77bbac2 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx @@ -252,13 +252,18 @@ StatusCode TrigL2MuonSA::TgcDataPreparator::prepareData(const LVL1::RecMuonRoI* return StatusCode::FAILURE; } - StatusCode sc_read = (*m_activeStore)->retrieve( tgcPrepContainer, "TGC_Measurements" ); - if (sc_read.isFailure()){ - msg() << MSG::ERROR << "Could not retrieve PrepDataContainer." << endreq; - return sc_read; - } - msg() << MSG::DEBUG << "Retrieved PrepDataContainer: " << tgcPrepContainer->numberOfCollections() << endreq; - + if ( m_activeStore ) { + StatusCode sc_read = (*m_activeStore)->retrieve( tgcPrepContainer, "TGC_Measurements" ); + if (sc_read.isFailure()){ + msg() << MSG::ERROR << "Could not retrieve PrepDataContainer." << endreq; + return sc_read; + } + msg() << MSG::DEBUG << "Retrieved PrepDataContainer: " << tgcPrepContainer->numberOfCollections() << endreq; + } else { + msg() << MSG::ERROR << "Null pointer to ActiveStore" << endreq; + return StatusCode::FAILURE;; + } + Muon::TgcPrepDataContainer::const_iterator it = tgcPrepContainer->begin(); Muon::TgcPrepDataContainer::const_iterator it_end = tgcPrepContainer->end(); for( ; it!=it_end; ++it ) { // loop over collections diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcRoadDefiner.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcRoadDefiner.cxx index c15e6c38f99a7bec33d72b2a929804ad2c2eaeb9..bf8d5b5228c852cfc9a6d04e01d64eb5878aae10 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcRoadDefiner.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcRoadDefiner.cxx @@ -15,10 +15,11 @@ // -------------------------------------------------------------------------------- TrigL2MuonSA::TgcRoadDefiner::TgcRoadDefiner(MsgStream* msg) - : m_msg(msg), + : m_msg(), m_tgcFit(msg,10), // chi2 value 10 given by hand for now m_rWidth_TGC_Failed(0) { + if ( msg ) m_msg = msg; } // -------------------------------------------------------------------------------- @@ -66,10 +67,10 @@ void TrigL2MuonSA::TgcRoadDefiner::setPtLUT(const TrigL2MuonSA::PtEndcapLUTSvc* // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- -bool TrigL2MuonSA::TgcRoadDefiner::defineRoad(const LVL1::RecMuonRoI* p_roi, - const TrigL2MuonSA::TgcHits& tgcHits, - TrigL2MuonSA::MuonRoad& muonRoad, - TrigL2MuonSA::TgcFitResult& tgcFitResult) +bool TrigL2MuonSA::TgcRoadDefiner::defineRoad(const LVL1::RecMuonRoI* p_roi, + const TrigL2MuonSA::TgcHits& tgcHits, + TrigL2MuonSA::MuonRoad& muonRoad, + TrigL2MuonSA::TgcFitResult& tgcFitResult) { const int N_STATION = 8; @@ -127,17 +128,17 @@ bool TrigL2MuonSA::TgcRoadDefiner::defineRoad(const LVL1::RecMuonRoI* p_roi, } msg() << MSG::DEBUG << "tgcFitResult.tgcInn[0/1/2/3]=" << tgcFitResult.tgcInn[0] << "/" << tgcFitResult.tgcInn[1] - << "/" << tgcFitResult.tgcInn[2] << "/" << tgcFitResult.tgcInn[3] << endreq; + << "/" << tgcFitResult.tgcInn[2] << "/" << tgcFitResult.tgcInn[3] << endreq; msg() << MSG::DEBUG << "tgcFitResult.tgcMid1[0/1/2/3]=" << tgcFitResult.tgcMid1[0] << "/" << tgcFitResult.tgcMid1[1] - << "/" << tgcFitResult.tgcMid1[2] << "/" << tgcFitResult.tgcMid1[3] << endreq; + << "/" << tgcFitResult.tgcMid1[2] << "/" << tgcFitResult.tgcMid1[3] << endreq; msg() << MSG::DEBUG << "tgcFitResult.tgcMid2[0/1/2/3]=" << tgcFitResult.tgcMid2[0] << "/" << tgcFitResult.tgcMid2[1] - << "/" << tgcFitResult.tgcMid2[2] << "/" << tgcFitResult.tgcMid2[3] << endreq; + << "/" << tgcFitResult.tgcMid2[2] << "/" << tgcFitResult.tgcMid2[3] << endreq; // PT calculation by using TGC fit result const double PHI_RANGE = 12./(CLHEP::pi/8.); side = (tgcFitResult.tgcMid2[3]<=0) ? 0 : 1; double alpha = m_ptEndcapLUT->alpha(tgcFitResult.tgcMid1[3], tgcFitResult.tgcMid1[2], - tgcFitResult.tgcMid2[3], tgcFitResult.tgcMid2[2]); + tgcFitResult.tgcMid2[3], tgcFitResult.tgcMid2[2]); int Octant = (int)(tgcFitResult.tgcMid1[1] / (CLHEP::pi/4.)); double PhiInOctant = fabs(tgcFitResult.tgcMid1[1] - Octant * (CLHEP::pi/4.)); @@ -163,25 +164,25 @@ bool TrigL2MuonSA::TgcRoadDefiner::defineRoad(const LVL1::RecMuonRoI* p_roi, tgcFitResult.isPhiDir = true; if( tgcFitResult.tgcMid1[1]*tgcFitResult.tgcMid2[1] < 0 - && fabsf(tgcFitResult.tgcMid1[1])>CLHEP::pi/2. ) { + && fabsf(tgcFitResult.tgcMid1[1])>CLHEP::pi/2. ) { - double tmp1 = (tgcFitResult.tgcMid1[1]>0)? - tgcFitResult.tgcMid1[1] - CLHEP::pi : tgcFitResult.tgcMid1[1] + CLHEP::pi; + double tmp1 = (tgcFitResult.tgcMid1[1]>0)? + tgcFitResult.tgcMid1[1] - CLHEP::pi : tgcFitResult.tgcMid1[1] + CLHEP::pi; - double tmp2 = (tgcFitResult.tgcMid2[1]>0)? - tgcFitResult.tgcMid2[1] - CLHEP::pi : tgcFitResult.tgcMid2[1] + CLHEP::pi; + double tmp2 = (tgcFitResult.tgcMid2[1]>0)? + tgcFitResult.tgcMid2[1] - CLHEP::pi : tgcFitResult.tgcMid2[1] + CLHEP::pi; - double tmp = (tmp1+tmp2)/2.; + double tmp = (tmp1+tmp2)/2.; - tgcFitResult.dPhidZ = (fabs(tgcFitResult.tgcMid2[3]-tgcFitResult.tgcMid1[3])>0.)? - (tmp2-tmp1)/fabs(tgcFitResult.tgcMid2[3]-tgcFitResult.tgcMid1[3]): 0; + tgcFitResult.dPhidZ = (fabs(tgcFitResult.tgcMid2[3]-tgcFitResult.tgcMid1[3])>0.)? + (tmp2-tmp1)/fabs(tgcFitResult.tgcMid2[3]-tgcFitResult.tgcMid1[3]): 0; - tgcFitResult.phi = (tmp>0.)? tmp - CLHEP::pi : tmp + CLHEP::pi; + tgcFitResult.phi = (tmp>0.)? tmp - CLHEP::pi : tmp + CLHEP::pi; } else { - tgcFitResult.dPhidZ = (tgcFitResult.tgcMid2[1]-tgcFitResult.tgcMid1[1])/fabs(tgcFitResult.tgcMid2[3]-tgcFitResult.tgcMid1[3]); - tgcFitResult.phi = (tgcFitResult.tgcMid2[1]+tgcFitResult.tgcMid1[1])/2.; + tgcFitResult.dPhidZ = (tgcFitResult.tgcMid2[1]-tgcFitResult.tgcMid1[1])/fabs(tgcFitResult.tgcMid2[3]-tgcFitResult.tgcMid1[3]); + tgcFitResult.phi = (tgcFitResult.tgcMid2[1]+tgcFitResult.tgcMid1[1])/2.; } } @@ -200,9 +201,9 @@ bool TrigL2MuonSA::TgcRoadDefiner::defineRoad(const LVL1::RecMuonRoI* p_roi, muonRoad.aw[endcap_extra][0] = tgcFitResult.slope; muonRoad.bw[endcap_extra][0] = tgcFitResult.intercept; for (int i_layer=0; i_layer<8; i_layer++) { - muonRoad.rWidth[endcap_middle][i_layer] = R_WIDTH_DEFAULT; - muonRoad.rWidth[endcap_outer][i_layer] = R_WIDTH_DEFAULT; - muonRoad.rWidth[endcap_extra][i_layer] = R_WIDTH_DEFAULT; + muonRoad.rWidth[endcap_middle][i_layer] = R_WIDTH_DEFAULT; + muonRoad.rWidth[endcap_outer][i_layer] = R_WIDTH_DEFAULT; + muonRoad.rWidth[endcap_extra][i_layer] = R_WIDTH_DEFAULT; } } else { roiEta = p_roi->eta(); @@ -215,9 +216,9 @@ bool TrigL2MuonSA::TgcRoadDefiner::defineRoad(const LVL1::RecMuonRoI* p_roi, muonRoad.aw[endcap_extra][0] = aw; muonRoad.bw[endcap_extra][0] = 0; for (int i_layer=0; i_layer<8; i_layer++) { - muonRoad.rWidth[endcap_middle][i_layer] = R_WIDTH_MIDDLE_NO_HIT; - muonRoad.rWidth[endcap_outer][i_layer] = R_WIDTH_MIDDLE_NO_HIT; - muonRoad.rWidth[endcap_extra][i_layer] = R_WIDTH_MIDDLE_NO_HIT; + muonRoad.rWidth[endcap_middle][i_layer] = R_WIDTH_MIDDLE_NO_HIT; + muonRoad.rWidth[endcap_outer][i_layer] = R_WIDTH_MIDDLE_NO_HIT; + muonRoad.rWidth[endcap_extra][i_layer] = R_WIDTH_MIDDLE_NO_HIT; } } @@ -249,26 +250,32 @@ bool TrigL2MuonSA::TgcRoadDefiner::defineRoad(const LVL1::RecMuonRoI* p_roi, double phi; double sigma_phi; - StatusCode sc - = (*m_backExtrapolatorTool)->give_eta_phi_at_vertex(muonSA, eta,sigma_eta,phi,sigma_phi,0.); - if (sc.isSuccess() ){ - extrInnerEta = eta; + + if (m_backExtrapolatorTool) { + StatusCode sc + = (*m_backExtrapolatorTool)->give_eta_phi_at_vertex(muonSA, eta,sigma_eta,phi,sigma_phi,0.); + if (sc.isSuccess() ){ + extrInnerEta = eta; + } else { + extrInnerEta = etaMiddle; + } } else { - extrInnerEta = etaMiddle; + msg() << MSG::ERROR << "Null pointer to ITrigMuonBackExtrapolator" << endreq; + return StatusCode::FAILURE; } if (muonSA) delete muonSA; double theta = 0.; if (extrInnerEta != 0.) { - theta = atan(exp(-fabs(extrInnerEta)))*2.; - muonRoad.aw[endcap_inner][0] = tan(theta)*(fabs(extrInnerEta)/extrInnerEta); - muonRoad.aw[barrel_inner][0] = tan(theta)*(fabs(extrInnerEta)/extrInnerEta); - muonRoad.aw[csc][0] = tan(theta)*(fabs(extrInnerEta)/extrInnerEta); + theta = atan(exp(-fabs(extrInnerEta)))*2.; + muonRoad.aw[endcap_inner][0] = tan(theta)*(fabs(extrInnerEta)/extrInnerEta); + muonRoad.aw[barrel_inner][0] = tan(theta)*(fabs(extrInnerEta)/extrInnerEta); + muonRoad.aw[csc][0] = tan(theta)*(fabs(extrInnerEta)/extrInnerEta); } else { - muonRoad.aw[endcap_inner][0] = 0; - muonRoad.aw[barrel_inner][0] = 0; - muonRoad.aw[csc][0] = 0; + muonRoad.aw[endcap_inner][0] = 0; + muonRoad.aw[barrel_inner][0] = 0; + muonRoad.aw[csc][0] = 0; } for (int i_layer=0; i_layer<8; i_layer++) muonRoad.rWidth[endcap_inner][i_layer] = R_WIDTH_INNER_NO_HIT; @@ -425,16 +432,16 @@ bool TrigL2MuonSA::TgcRoadDefiner::prepareTgcPoints(const TrigL2MuonSA::TgcHits& double w = 12.0 / hit.width / hit.width; if (hit.isStrip) { - w *= hit.r * hit.r; - double phi = hit.phi; - if( phi < 0 && ( (CLHEP::pi+phi)<PHI_BOUNDARY) ) phi += CLHEP::pi*2; - if ( hit.sta < 3 ) { m_tgcStripMidPoints.push_back(TgcFit::Point(iHit + 1, hit.sta, hit.z, phi, w)); } - else if ( hit.sta ==3 ) { m_tgcStripInnPoints.push_back(TgcFit::Point(iHit + 1, hit.sta, hit.z, phi, w)); } + w *= hit.r * hit.r; + double phi = hit.phi; + if( phi < 0 && ( (CLHEP::pi+phi)<PHI_BOUNDARY) ) phi += CLHEP::pi*2; + if ( hit.sta < 3 ) { m_tgcStripMidPoints.push_back(TgcFit::Point(iHit + 1, hit.sta, hit.z, phi, w)); } + else if ( hit.sta ==3 ) { m_tgcStripInnPoints.push_back(TgcFit::Point(iHit + 1, hit.sta, hit.z, phi, w)); } } else { - if ( hit.sta < 3 ) { m_tgcWireMidPoints.push_back(TgcFit::Point(iHit + 1, hit.sta, hit.z, hit.r, w)); } - else if ( hit.sta ==3 ) { m_tgcWireInnPoints.push_back(TgcFit::Point(iHit + 1, hit.sta, hit.z, hit.r, w)); } + if ( hit.sta < 3 ) { m_tgcWireMidPoints.push_back(TgcFit::Point(iHit + 1, hit.sta, hit.z, hit.r, w)); } + else if ( hit.sta ==3 ) { m_tgcWireInnPoints.push_back(TgcFit::Point(iHit + 1, hit.sta, hit.z, hit.r, w)); } } }