Skip to content
Snippets Groups Projects
Commit 8f51ee0c authored by Johannes Junggeburth's avatar Johannes Junggeburth :dog2: Committed by Adam Edward Barton
Browse files

MuonHoughTransformTester - Add Nsw hits to the Hough tester n-tuple

MuonHoughTransformTester - Add Nsw hits to the Hough tester n-tuple
parent 3e5a023b
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,18 @@ from AthenaConfiguration.ComponentFactory import CompFactory
def MuonHoughTransformTesterCfg(flags, name = "MuonHoughTransformTester", **kwargs):
result = ComponentAccumulator()
theAlg = CompFactory.MuonValR4.MuonHoughTransformTester(name, **kwargs)
containerNames = []
if flags.Detector.EnableMDT:
containerNames+=["xMdtSimHits"]
if flags.Detector.EnableMM:
containerNames+=["xMmSimHits"]
if flags.Detector.EnableRPC:
containerNames+=["xRpcSimHits"]
if flags.Detector.EnableTGC:
containerNames+=["xTgcSimHits"]
if flags.Detector.EnablesTGC:
containerNames+=["xStgcSimHits"]
kwargs.setdefault("SimHitKeys", containerNames)
result.addEventAlgo(theAlg, primary=True)
return result
......@@ -26,14 +38,17 @@ if __name__=="__main__":
args = parser.parse_args()
flags, cfg = setupGeoR4TestCfg(args)
from xAODMuonSimHitCnv.MuonSimHitCnvCfg import MuonSimHitToMeasurementCfg
from MuonPatternRecognitionAlgs.MuonHoughTransformAlgConfig import MuonEtaHoughTransformAlgCfg, MuonPhiHoughTransformAlgCfg
from PerfMonComps.PerfMonCompsConfig import PerfMonMTSvcCfg
# from PerfMonVTune.PerfMonVTuneConfig import VTuneProfilerServiceCfg
cfg.merge(setupHistSvcCfg(flags,out_file=args.outRootFile,out_stream="MuonEtaHoughTransformTest"))
from xAODMuonSimHitCnv.MuonSimHitCnvCfg import MuonSimHitToMeasurementCfg
cfg.merge(MuonSimHitToMeasurementCfg(flags))
from MuonSpacePointFormation.SpacePointFormationConfig import MuonSpacePointMakerAlgCfg
cfg.merge(MuonSpacePointMakerAlgCfg(flags))
from MuonSpacePointFormation.SpacePointFormationConfig import MuonSpacePointFormationCfg
cfg.merge(MuonSpacePointFormationCfg(flags))
cfg.merge(MuonEtaHoughTransformAlgCfg(flags))
cfg.merge(MuonPhiHoughTransformAlgCfg(flags))
cfg.merge(MuonHoughTransformTesterCfg(flags,
......
......@@ -125,15 +125,19 @@ namespace MuonValR4 {
m_out_gen_Phi= genParticlePtr->momentum().phi();
m_out_gen_Pt= genParticlePtr->momentum().perp();
m_out_gen_nHits = hits.size();
unsigned int nMdt{0}, nRpc{0}, nTgc{0};
unsigned int nMdt{0}, nRpc{0}, nTgc{0}, nMm{0}, nsTgc{0};
for (const xAOD::MuonSimHit* hit : hits){
nMdt += m_idHelperSvc->isMdt(hit->identify());
nRpc += m_idHelperSvc->isRpc(hit->identify());
nTgc += m_idHelperSvc->isTgc(hit->identify());
nTgc += m_idHelperSvc->isTgc(hit->identify());
nMm += m_idHelperSvc->isMM(hit->identify());
nsTgc += m_idHelperSvc->issTgc(hit->identify());
}
m_out_gen_nRPCHits = nRpc;
m_out_gen_nMDTHits = nMdt;
m_out_gen_nTGCHits = nTgc;
m_out_gen_nMMits = nMm;
m_out_gen_nsTGCHits = nsTgc;
m_out_gen_tantheta = (std::abs(chamberDir.z()) > 1.e-8 ? chamberDir.y()/chamberDir.z() : 1.e10);
m_out_gen_tanphi = (std::abs(chamberDir.z()) > 1.e-8 ? chamberDir.x()/chamberDir.z() : 1.e10);
......@@ -152,13 +156,9 @@ namespace MuonValR4 {
}
const MuonR4::HoughSegmentSeed* foundMax = nullptr;
// find the best hough maximum
size_t max_hits{0};
size_t max_etaHits{0};
size_t max_phiHits{0};
size_t max_hits{0}, max_etaHits{0}, max_phiHits{0};
for (const MuonR4::HoughSegmentSeed & max : houghMaxima){
size_t nFound{0};
size_t nEta{0};
size_t nPhi{0};
size_t nFound{0}, nEta{0}, nPhi{0};
for (const xAOD::MuonSimHit* simHit : hits) {
for (const MuonR4::HoughHitType & hitOnMax : max.getHitsInMax()) {
......@@ -171,8 +171,8 @@ namespace MuonValR4 {
/// the hit is in the same gas gap
else if (m_idHelperSvc->gasGapId(hitOnMax->identify()) == simHit->identify()) {
++nFound;
if (hitOnMax->measuresEta()) ++nEta;
if (hitOnMax->measuresPhi()) ++nPhi;
nEta+=hitOnMax->measuresEta();
nPhi+=hitOnMax->measuresPhi();
}
}
}
......@@ -196,7 +196,7 @@ namespace MuonValR4 {
m_out_max_nHits = max_hits;
m_out_max_nEtaHits = max_etaHits;
m_out_max_nPhiHits = max_phiHits;
unsigned int nMdt{0}, nRpc{0}, nTgc{0};
unsigned int nMdt{0}, nRpc{0}, nTgc{0}, nMm{0}, nsTgc{0};
for (const MuonR4::HoughHitType & houghSP: foundMax->getHitsInMax()){
/// Skip all space points that don' contain any phi measurement
......@@ -226,6 +226,22 @@ namespace MuonValR4 {
m_max_tgcHitErrorY.push_back(houghSP->uncertainty()[1]);
++nTgc;
break;
case xAOD::UncalibMeasType::sTgcStripType:
m_max_stgcHitId.push_back(houghSP->identify());
m_max_stgcHitPos.push_back(houghSP->positionInChamber());
m_max_stgcHitHasPhiMeas.push_back(houghSP->measuresPhi());
m_max_stgcHitErrorX.push_back(houghSP->uncertainty()[0]);
m_max_stgcHitErrorY.push_back(houghSP->uncertainty()[1]);
++nsTgc;
break;
case xAOD::UncalibMeasType::MMClusterType:
m_max_MmHitId.push_back(houghSP->identify());
m_max_MmHitPos.push_back(houghSP->positionInChamber());
m_max_MmHitIsStero.push_back(m_idHelperSvc->mmIdHelper().isStereo(houghSP->identify()));
m_max_MmHitErrorX.push_back(houghSP->uncertainty()[0]);
m_max_MmHitErrorY.push_back(houghSP->uncertainty()[1]);
++nMm;
break;
default:
ATH_MSG_WARNING("Technology "<<m_idHelperSvc->toString(houghSP->identify())
<<" not yet implemented");
......@@ -234,6 +250,8 @@ namespace MuonValR4 {
m_out_max_nMdt = nMdt;
m_out_max_nRpc = nRpc;
m_out_max_nTgc = nTgc;
m_out_max_nsTgc = nsTgc;
m_out_max_nMm = nMm;
if (m_drawEvtDisplaySuccess) {
ATH_CHECK(drawEventDisplay(ctx, hits, foundMax));
}
......
......@@ -73,6 +73,9 @@ namespace MuonValR4{
MuonVal::ScalarBranch<unsigned int>& m_out_gen_nRPCHits{m_tree.newScalar<unsigned int>("genNRpcHits",0)};
MuonVal::ScalarBranch<unsigned int>& m_out_gen_nMDTHits{m_tree.newScalar<unsigned int>("genNMdtHits",0)};
MuonVal::ScalarBranch<unsigned int>& m_out_gen_nTGCHits{m_tree.newScalar<unsigned int>("genNTgcHits",0)};
MuonVal::ScalarBranch<unsigned int>& m_out_gen_nsTGCHits{m_tree.newScalar<unsigned int>("genNsTgcHits",0)};
MuonVal::ScalarBranch<unsigned int>& m_out_gen_nMMits{m_tree.newScalar<unsigned int>("genNMmHits",0)};
MuonVal::ScalarBranch<float>& m_out_gen_tantheta{m_tree.newScalar<float>("genTanTheta", 0.0)};
MuonVal::ScalarBranch<float>& m_out_gen_z0{m_tree.newScalar<float>("genZ0", 0.0)};
......@@ -90,7 +93,10 @@ namespace MuonValR4{
MuonVal::ScalarBranch<unsigned int>& m_out_max_nPhiHits{m_tree.newScalar<unsigned int>("maxNPhiHits", 0)};
MuonVal::ScalarBranch<unsigned int>& m_out_max_nMdt{m_tree.newScalar<unsigned int>("maxNMdtHits", 0)};
MuonVal::ScalarBranch<unsigned int>& m_out_max_nRpc{m_tree.newScalar<unsigned int>("maxNRpcHits", 0)};
MuonVal::ScalarBranch<unsigned int>& m_out_max_nTgc{m_tree.newScalar<unsigned int>("maxNTgcHits", 0)};
MuonVal::ScalarBranch<unsigned int>& m_out_max_nTgc{m_tree.newScalar<unsigned int>("maxNTgcHits", 0)};
MuonVal::ScalarBranch<unsigned int>& m_out_max_nsTgc{m_tree.newScalar<unsigned int>("maxNsTgcHits", 0)};
MuonVal::ScalarBranch<unsigned int>& m_out_max_nMm{m_tree.newScalar<unsigned int>("maxNMmHits", 0)};
/// Dump of the Mdt hits on maximum
MuonVal::MdtIdentifierBranch m_max_driftCircleId{m_tree, "maxMdtId"};
MuonVal::VectorBranch<float>& m_max_driftCirclRadius{m_tree.newVector<float>("maxMdtDriftR")};
......@@ -112,6 +118,19 @@ namespace MuonValR4{
MuonVal::VectorBranch<float>& m_max_tgcHitErrorX{m_tree.newVector<float>("maxTgcEtaMeasError")};
MuonVal::VectorBranch<float>& m_max_tgcHitErrorY{m_tree.newVector<float>("maxTgcPhiMeasError")};
MuonVal::sTgcIdentifierBranch m_max_stgcHitId{m_tree, "maxsTgcId"};
MuonVal::ThreeVectorBranch m_max_stgcHitPos{m_tree,"maxsTgcHitPos"};
MuonVal::VectorBranch<bool> & m_max_stgcHitHasPhiMeas{m_tree.newVector<bool>("maxsTgcHasPhiMeas")};
MuonVal::VectorBranch<float>& m_max_stgcHitErrorX{m_tree.newVector<float>("maxsTgcEtaMeasError")};
MuonVal::VectorBranch<float>& m_max_stgcHitErrorY{m_tree.newVector<float>("maxsTgcPhiMeasError")};
MuonVal::MmIdentifierBranch m_max_MmHitId{m_tree, "maxMmId"};
MuonVal::ThreeVectorBranch m_max_MmHitPos{m_tree,"maxMmHitPos"};
MuonVal::VectorBranch<bool> & m_max_MmHitIsStero{m_tree.newVector<bool>("maxMmIsStero")};
MuonVal::VectorBranch<float>& m_max_MmHitErrorX{m_tree.newVector<float>("maxMmEtaMeasError")};
MuonVal::VectorBranch<float>& m_max_MmHitErrorY{m_tree.newVector<float>("maxMmPhiMeasError")};
/// Draw the event display for the cases where the hough transform did not find any hough maximum
Gaudi::Property<bool> m_drawEvtDisplayFailure{this, "drawDisplayFailed", false};
/// Draw the event dispalty for the successful cases
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment