diff --git a/Detector/DetCRD/compact/CRD_common_v01/OTKBarrel_v01_01.xml b/Detector/DetCRD/compact/CRD_common_v01/OTKBarrel_v01_01.xml index 4f503c9ee8405372ecf2fc3757d0e9bc9c1e4292..e52d972280054749f73a41caf510796060d347e9 100644 --- a/Detector/DetCRD/compact/CRD_common_v01/OTKBarrel_v01_01.xml +++ b/Detector/DetCRD/compact/CRD_common_v01/OTKBarrel_v01_01.xml @@ -37,7 +37,7 @@ <detectors> <!--detector id="DetID_OTKBarrel" limits="otk_limits" name="OTKBarrel" type="SiTracker_otkbarrel_v01" vis="OTKBarrelVis" readout="OTKBarrelCollection" insideTrackingVolume="true"--> - <detector id="DetID_OTKBarrel" name="OTKBarrel" type="SiTracker_otkbarrel_v01" vis="OTKBarrelVis" readout="OTKBarrelCollection" insideTrackingVolume="true"> + <detector id="DetID_OTKBarrel" name="OTKBarrel" type="SiTracker_otkbarrel_v01" vis="OTKBarrelVis" readout="OTKBarrelCollection" combineHits="true" insideTrackingVolume="true"> <envelope> <shape type="Tube" rmin="OTKBarrel_inner_radius" rmax="OTKBarrel_outer_radius" dz="OTKBarrel_half_length" material="Air"/> </envelope> diff --git a/Detector/DetCRD/compact/CRD_common_v02/FTD_SkewRing_v01_07.xml b/Detector/DetCRD/compact/CRD_common_v02/FTD_SkewRing_v01_07.xml index 6656cb2a9122b4882e29e7e7a70ab7800d40fcf0..7d84b7a79c5794fd9a46ac712df3a6fbb13b1111 100644 --- a/Detector/DetCRD/compact/CRD_common_v02/FTD_SkewRing_v01_07.xml +++ b/Detector/DetCRD/compact/CRD_common_v02/FTD_SkewRing_v01_07.xml @@ -8,7 +8,8 @@ </define> <detectors> - <detector id="DetID_FTD" name="FTD" type="SiTrackerSkewRing_v01" vis="FTDVis" readout="FTDCollection" insideTrackingVolume="true" reflect="true"> + <detector id="DetID_FTD" name="FTD" type="SiTrackerSkewRing_v01" vis="FTDVis" readout="FTDCollection" combineHits="true" + insideTrackingVolume="true" reflect="true"> <envelope> <shape type="Assembly"/> </envelope> diff --git a/Detector/DetCRD/compact/CRD_common_v02/SIT_StaggeredStave_v02.xml b/Detector/DetCRD/compact/CRD_common_v02/SIT_StaggeredStave_v02.xml index f7eb74a70f9d72bb71c92f46aebbbfc3b581863a..4329abb09aa5800daace93ac185206d5a6200356 100644 --- a/Detector/DetCRD/compact/CRD_common_v02/SIT_StaggeredStave_v02.xml +++ b/Detector/DetCRD/compact/CRD_common_v02/SIT_StaggeredStave_v02.xml @@ -13,7 +13,7 @@ </define> <detectors> - <detector id="DetID_SIT" name="SIT" type="SiTracker_itkbarrel_v02" vis="SITVis" readout="SITCollection" insideTrackingVolume="true"> + <detector id="DetID_SIT" name="SIT" type="SiTracker_itkbarrel_v02" vis="SITVis" readout="SITCollection" combineHits="true" insideTrackingVolume="true"> <envelope> <shape type="Assembly"/> <!--shape type="BooleanShape" operation="Union" material="Air" > diff --git a/Detector/DetCRD/compact/CRD_common_v02/VXD_Composite_v01_02.xml b/Detector/DetCRD/compact/CRD_common_v02/VXD_Composite_v01_02.xml index 1fea5860d98e406c2ce82bedd524f51634588cf6..8ea458a581725b5c4f85b1c1f9dacf59b3b1c9b7 100644 --- a/Detector/DetCRD/compact/CRD_common_v02/VXD_Composite_v01_02.xml +++ b/Detector/DetCRD/compact/CRD_common_v02/VXD_Composite_v01_02.xml @@ -19,7 +19,7 @@ </define> <detectors> - <detector id="DetID_VXD" name="VXD" type="SiTrackerComposite_v02" vis="VXDVis" readout="VXDCollection" insideTrackingVolume="true" printLevel="INFO"> + <detector id="DetID_VXD" name="VXD" type="SiTrackerComposite_v02" vis="VXDVis" readout="VXDCollection" combineHits="true" insideTrackingVolume="true" printLevel="INFO"> <envelope> <shape type="Assembly"/> </envelope> diff --git a/Detector/DetCRD/scripts/TDR_o1_v01/tracking.py b/Detector/DetCRD/scripts/TDR_o1_v01/tracking.py index ab968e5236594c4cd130beb16046fc1b48f6b9e8..a5f9324f580f7227a234858d914f6936b6985053 100644 --- a/Detector/DetCRD/scripts/TDR_o1_v01/tracking.py +++ b/Detector/DetCRD/scripts/TDR_o1_v01/tracking.py @@ -71,19 +71,14 @@ sethitname = "OTKBarrelTrackerHits" setspname = "OTKBarrelSpacePoints" ftdhitname = "FTDTrackerHits" ftdspname = "FTDSpacePoints" -from Configurables import SmearDigiTool +from Configurables import SmearDigiTool,SiTrackerDigiAlg + +## VXD ## vxdtool = SmearDigiTool("VXD") vxdtool.ResolutionU = [0.005] vxdtool.ResolutionV = [0.005] -vxdtool.UsePlanarTag = True -vxdtool.ParameterizeResolution = False -vxdtool.ParametersU = [5.60959e-03, 5.74913e-03, 7.03433e-03, 1.99516, -663.952, 3.752e-03, 0, -0.0704734, 0.0454867e-03, 1.07359] -vxdtool.ParametersV = [5.60959e-03, 5.74913e-03, 7.03433e-03, 1.99516, -663.952, 3.752e-03, 0, -0.0704734, 0.0454867e-03, 1.07359] #vxdtool.OutputLevel = DEBUG - -## VXD ## -from Configurables import SiTrackerDigiAlg digiVXD = SiTrackerDigiAlg("VXDDigi") digiVXD.SimTrackHitCollection = "VXDCollection" digiVXD.TrackerHitCollection = vxdhitname @@ -91,50 +86,43 @@ digiVXD.TrackerHitAssociationCollection = "VXDTrackerHitAssociation" digiVXD.DigiTool = "SmearDigiTool/VXD" #digiVXD.OutputLevel = DEBUG - ## SIT ## -from Configurables import PlanarDigiAlg -digiSIT = PlanarDigiAlg("SITDigi") -digiSIT.IsStrip = False +sittool = SmearDigiTool("SIT") +sittool.ResolutionU = [0.0098] +sittool.ResolutionV = [0.0433] +#sittool.OutputLevel = DEBUG + +digiSIT = SiTrackerDigiAlg("SITDigi") digiSIT.SimTrackHitCollection = "SITCollection" digiSIT.TrackerHitCollection = sithitname digiSIT.TrackerHitAssociationCollection = "SITTrackerHitAssociation" -digiSIT.ResolutionU = [0.0098] -digiSIT.ResolutionV = [0.0433] -digiSIT.UsePlanarTag = True -digiSIT.ParameterizeResolution = False -digiSIT.ParametersU = [2.29655e-03, 0.965899e-03, 0.584699e-03, 17.0856, 84.566, 12.4695e-03, -0.0643059, 0.168662, 1.87998e-03, 0.514452] -digiSIT.ParametersV = [1.44629e-02, 2.20108e-03, 1.03044e-02, 4.39195e+00, 3.29641e+00, 1.55167e+18, -5.41954e+01, 5.72986e+00, -6.80699e-03, 5.04095e-01] +digiSIT.DigiTool = "SmearDigiTool/SIT" #digiSIT.OutputLevel = DEBUG +## OTKBarrel ## +otkbtool = SmearDigiTool("OTKBarrel") +otkbtool.ResolutionU = [0.010] +otkbtool.ResolutionV = [1.000] +#otkbtool.OutputLevel = DEBUG -## SET ## -digiSET = PlanarDigiAlg("SETDigi") -digiSET.IsStrip = False -digiSET.SimTrackHitCollection = "OTKBarrelCollection" -digiSET.TrackerHitCollection = sethitname -digiSET.TrackerHitAssociationCollection = "OTKBarrelTrackerHitAssociation" -digiSET.ResolutionU = [0.010] -digiSET.ResolutionV = [1.000] -digiSET.UsePlanarTag = True -digiSET.ParameterizeResolution = False -digiSET.ParametersU = [2.29655e-03, 0.965899e-03, 0.584699e-03, 17.0856, 84.566, 12.4695e-03, -0.0643059, 0.168662, 1.87998e-03, 0.514452] -digiSET.ParametersV = [1.44629e-02, 2.20108e-03, 1.03044e-02, 4.39195e+00, 3.29641e+00, 1.55167e+18, -5.41954e+01, 5.72986e+00, -6.80699e-03, 5.04095e-01] -#digiSET.OutputLevel = DEBUG - +digiOTKB = SiTrackerDigiAlg("OTKBarrelDigi") +digiOTKB.SimTrackHitCollection = "OTKBarrelCollection" +digiOTKB.TrackerHitCollection = sethitname +digiOTKB.TrackerHitAssociationCollection = "OTKBarrelTrackerHitAssociation" +digiOTKB.DigiTool = "SmearDigiTool/OTKBarrel" +#digiOTKB.OutputLevel = DEBUG ## FTD ## -digiFTD = PlanarDigiAlg("FTDDigi") -digiFTD.IsStrip = False +ftdtool = SmearDigiTool("FTD") +ftdtool.ResolutionU = [0.0072] +ftdtool.ResolutionV = [0.086] +#ftdtool.OutputLevel = DEBUG + +digiFTD = SiTrackerDigiAlg("FTDDigi") digiFTD.SimTrackHitCollection = "FTDCollection" digiFTD.TrackerHitCollection = ftdhitname digiFTD.TrackerHitAssociationCollection = "FTDTrackerHitAssociation" -digiFTD.ResolutionU = [0.0072] -digiFTD.ResolutionV = [0.086] -digiFTD.UsePlanarTag = True -digiFTD.ParameterizeResolution = False -digiFTD.ParametersU = [2.29655e-03, 0.965899e-03, 0.584699e-03, 17.0856, 84.566, 12.4695e-03, -0.0643059, 0.168662, 1.87998e-03, 0.514452] -digiFTD.ParametersV = [1.44629e-02, 2.20108e-03, 1.03044e-02, 4.39195e+00, 3.29641e+00, 1.55167e+18, -5.41954e+01, 5.72986e+00, -6.80699e-03, 5.04095e-01] +digiFTD.DigiTool = "SmearDigiTool/FTD" #digiFTD.OutputLevel = DEBUG ## TPC ## @@ -290,7 +278,7 @@ out.outputCommands = ["keep *"] # ApplicationMgr from Configurables import ApplicationMgr mgr = ApplicationMgr( - TopAlg = [podioinput, digiVXD, digiSIT, digiSET, digiFTD, digiTPC, digiMuon, tracking, forward, subset, clupatra, full, tpr, tpc_dndx, tmt, out], + TopAlg = [podioinput, digiVXD, digiSIT, digiOTKB, digiFTD, digiTPC, digiMuon, tracking, forward, subset, clupatra, full, tpr, tpc_dndx, tmt, out], EvtSel = 'NONE', EvtMax = 50, ExtSvc = [rndmengine, rndmgensvc, dsvc, evtseeder, geosvc, gearsvc, tracksystemsvc, pidsvc], diff --git a/Detector/DetCRD/src/Tracker/SiTracker_itkbarrel_v02_geo.cpp b/Detector/DetCRD/src/Tracker/SiTracker_itkbarrel_v02_geo.cpp index 037fe8443e0c30682b06005685a6eaa3c58db425..3fbbff8dd7d72a4895fdb702b4dd50c2ebaa156f 100644 --- a/Detector/DetCRD/src/Tracker/SiTracker_itkbarrel_v02_geo.cpp +++ b/Detector/DetCRD/src/Tracker/SiTracker_itkbarrel_v02_geo.cpp @@ -679,8 +679,8 @@ static dd4hep::Ref_t create_element(dd4hep::Detector& theDetector, xml_h e, dd4h //====== create the meassurement surface =================== dd4hep::rec::Vector3D o(0,0,0); - dd4hep::rec::Vector3D u( 0., 0., 1.); - dd4hep::rec::Vector3D v( 0., 1., 0.); + dd4hep::rec::Vector3D u( 0., 1., 0.); + dd4hep::rec::Vector3D v( 0., 0., 1.); dd4hep::rec::Vector3D n( 1., 0., 0.); double inner_thick = tube_outer_radius*2. + support_thickness + module_thickness/2.0; double outer_thick = max_connector_thickness + flex_thickness + module_thickness / 2.0; @@ -731,7 +731,7 @@ static dd4hep::Ref_t create_element(dd4hep::Detector& theDetector, xml_h e, dd4h //Layer.lengthModule = module_active_length; Layer.lengthSensor = module_length;//sensor_active_length; Layer.distanceSupport = stave_radius*cos(stave_phi0) + StaveSupportenv_start_height; //sensitive_radius; - Layer.thicknessSupport = support_thickness / 2.0; + Layer.thicknessSupport = support_thickness; Layer.offsetSupport = stave_radius*sin(stave_phi0);//-stave_offset; Layer.widthSupport = support_width; Layer.zHalfSupport = module_length*n_modules_per_stave/2.0;//support_half_length; diff --git a/Detector/DetCRD/src/Tracker/SiTracker_otkbarrel_v01_geo.cpp b/Detector/DetCRD/src/Tracker/SiTracker_otkbarrel_v01_geo.cpp index 711c90f6f2ffeb3fd35845d0e97f92e8cd4ef6f7..762f80f1d140807ba7a30138865d0f862a8286ae 100644 --- a/Detector/DetCRD/src/Tracker/SiTracker_otkbarrel_v01_geo.cpp +++ b/Detector/DetCRD/src/Tracker/SiTracker_otkbarrel_v01_geo.cpp @@ -324,8 +324,8 @@ static dd4hep::Ref_t create_element(dd4hep::Detector& theDetector, xml_h e, dd4h //====== create the meassurement surface =================== dd4hep::rec::Vector3D o(0,0,0); - dd4hep::rec::Vector3D u( 0., 0., 1.); - dd4hep::rec::Vector3D v( 0., 1., 0.); + dd4hep::rec::Vector3D u( 0., 1., 0.); + dd4hep::rec::Vector3D v( 0., 0., 1.); dd4hep::rec::Vector3D n( 1., 0., 0.); double inner_thick = sensor_thickness/2.0; double outer_thick = (support_height + sensor_thickness)/2.0; diff --git a/Digitization/DigiSimple/src/SmearDigiTool.cpp b/Digitization/DigiSimple/src/SmearDigiTool.cpp index a99c6ac40507c949043b6a20d8ea3fd5629532b0..474b13778ee5d774e327008900e900886abcf51d 100644 --- a/Digitization/DigiSimple/src/SmearDigiTool.cpp +++ b/Digitization/DigiSimple/src/SmearDigiTool.cpp @@ -43,8 +43,13 @@ StatusCode SmearDigiTool::initialize() { return StatusCode::FAILURE; } - m_surfaces = m_geosvc->getSurfaceMap(m_detName); - debug() << "Surface map size: " << m_surfaces->size() << endmsg; + if (m_detName=="") { + std::string toolName = name(); + m_detName = toolName.substr(toolName.find(".")+1); + debug() << toolName << " --> " << m_detName.value() << endmsg; + } + m_surfaces = m_geosvc->getSurfaceMap(m_detName.value()); + debug() << "Surface map size of " << m_detName.value() << ": " << m_surfaces->size() << endmsg; if (msgLevel(MSG::VERBOSE)) { unsigned long old = 0; for (const auto& pair : *m_surfaces) { @@ -54,8 +59,9 @@ StatusCode SmearDigiTool::initialize() { } } - debug() << "Readout name: " << m_readoutName << endmsg; - m_decoder = m_geosvc->getDecoder(m_readoutName); + if (m_readoutName=="") m_readoutName = m_detName.value() + "Collection"; + debug() << "Readout name: " << m_readoutName.value() << endmsg; + m_decoder = m_geosvc->getDecoder(m_readoutName.value()); if(!m_decoder){ error() << "Failed to get the decoder. " << endmsg; return StatusCode::FAILURE; @@ -114,7 +120,8 @@ StatusCode SmearDigiTool::Call(edm4hep::SimTrackerHit simhit, edm4hep::TrackerHi return StatusCode::FAILURE; } - dd4hep::rec::Vector3D oldPos(pos.x*dd4hep::mm/CLHEP::mm, pos.y*dd4hep::mm/CLHEP::mm, pos.z*dd4hep::mm/CLHEP::mm); + // CLHEP::mm is divided while Edm4hepWriterAnaElemTool write, so pos without unit + dd4hep::rec::Vector3D oldPos(pos.x*dd4hep::mm, pos.y*dd4hep::mm, pos.z*dd4hep::mm); dd4hep::rec::Vector3D uVec = surface->u(oldPos); dd4hep::rec::Vector3D vVec = surface->v(oldPos); float u_direction[2]; @@ -158,8 +165,8 @@ StatusCode SmearDigiTool::Call(edm4hep::SimTrackerHit simhit, edm4hep::TrackerHi resV = m_parV[0] + m_parV[1] * y + m_parV[2] * exp(-m_parV[9] * y) * cos(m_parV[3] * y + m_parV[4]) + m_parV[5] * exp(-0.5 * pow(((y - m_parV[6]) / m_parV[7]), 2)) + m_parV[8] * pow(y, 0.5); } - resU *= dd4hep::mm/CLHEP::mm; - resV *= dd4hep::mm/CLHEP::mm; + resU *= dd4hep::mm; + resV *= dd4hep::mm; // parameterize only for position now, todo resT = (m_resT.size() > 1 ? m_resT.value().at(layer) : m_resT.value().at(0)); // from ps (input unit) to ns (record unit, Geant4) @@ -174,6 +181,17 @@ StatusCode SmearDigiTool::Call(edm4hep::SimTrackerHit simhit, edm4hep::TrackerHi if (typeSurface.isPlane() || typeSurface.isCylinder()) { dd4hep::rec::Vector2D localPoint = surface->globalToLocal(oldPos); + if (typeSurface.isCylinder()) { + dd4hep::rec::Vector3D mom_ddrec(mom.x*dd4hep::GeV, mom.y*dd4hep::GeV, mom.z*dd4hep::GeV); + double length = simhit.getPathLength()*dd4hep::mm; + dd4hep::rec::Vector3D pre = oldPos - (0.5*length)*mom_ddrec.unit(); + dd4hep::rec::Vector3D post = oldPos + (0.5*length)*mom_ddrec.unit(); + dd4hep::rec::Vector2D localPre = surface->globalToLocal(pre); + dd4hep::rec::Vector2D localPost = surface->globalToLocal(post); + localPoint = dd4hep::rec::Vector2D(0.5*(localPre.u()+localPost.u()), 0.5*(localPre.v()+localPost.v())); + debug() << "pre: (" << pre.x() << " " << pre.y() << " " << pre.z() << " ) local (" << localPre.u() << ", " << localPre.v() << " ) " + << "post: (" << post.x() << " " << post.y() << " " << post.z() << " ) local (" << localPost.u() << ", " << localPost.v() << " ) " << endmsg; + } dd4hep::rec::Vector3D local3D(localPoint.u(), localPoint.v(), 0); // A small check, if the hit is in the boundaries: if (!surface->insideBounds(oldPos)) { @@ -186,7 +204,7 @@ StatusCode SmearDigiTool::Call(edm4hep::SimTrackerHit simhit, edm4hep::TrackerHi dd4hep::rec::Vector3D globalPointSmeared;//CLHEP::Hep3Vector globalPoint(pos[0],pos[1],pos[2]); dd4hep::rec::Vector2D localPointSmeared; - debug() << std::setprecision(8) << " Before smearing global: (" << pos[0]/CLHEP::mm << " " << pos[1]/CLHEP::mm << " " << pos[2]/CLHEP::mm << ") " + debug() << std::setprecision(8) << " Before smearing global: (" << pos[0] << " " << pos[1] << " " << pos[2] << ") " << "local: (" << localPoint.u()/dd4hep::mm << " " << localPoint.v()/dd4hep::mm << ")" << endmsg; unsigned tries = 0; @@ -234,13 +252,13 @@ StatusCode SmearDigiTool::Call(edm4hep::SimTrackerHit simhit, edm4hep::TrackerHi auto outhit = hitCol->create(); outhit.setCellID(cellId); - edm4hep::Vector3d smearedPos(globalPointSmeared.x()*CLHEP::mm/dd4hep::mm, - globalPointSmeared.y()*CLHEP::mm/dd4hep::mm, - globalPointSmeared.z()*CLHEP::mm/dd4hep::mm); + edm4hep::Vector3d smearedPos(globalPointSmeared.x()/dd4hep::mm, + globalPointSmeared.y()/dd4hep::mm, + globalPointSmeared.z()/dd4hep::mm); outhit.setPosition(smearedPos); // recover CLHEP/Geant4 unit - resU /= dd4hep::mm/CLHEP::mm; - resV /= dd4hep::mm/CLHEP::mm; + resU /= dd4hep::mm; + resV /= dd4hep::mm; std::bitset<32> type; if (typeSurface.isPlane() && m_usePlanarTag) { diff --git a/Digitization/DigiSimple/src/SmearDigiTool.h b/Digitization/DigiSimple/src/SmearDigiTool.h index 2f8f9fa112f7f1bfdab8f900f51487896fd7ce20..273e12decbcdf4f28770bd3f11028f33ab419a13 100644 --- a/Digitization/DigiSimple/src/SmearDigiTool.h +++ b/Digitization/DigiSimple/src/SmearDigiTool.h @@ -30,8 +30,8 @@ class SmearDigiTool : public extends<AlgTool, IDigiTool> { StatusCode finalize() override; private: - Gaudi::Property<std::string> m_detName{this, "DetName", "VXD"}; - Gaudi::Property<std::string> m_readoutName{this, "Readout", "VXDCollection"}; + Gaudi::Property<std::string> m_detName{this, "DetName", ""}; + Gaudi::Property<std::string> m_readoutName{this, "Readout", ""}; Gaudi::Property<float> m_eThreshold{this, "EnergyThreshold", 0}; Gaudi::Property<float> m_efficiency{this, "Efficiency", 1}; @@ -53,8 +53,8 @@ class SmearDigiTool : public extends<AlgTool, IDigiTool> { Gaudi::Property<std::vector<float> > m_parV{this, "ParametersV", {0}}; SmartIF<IRndmGenSvc> m_randSvc; - SmartIF<IGeomSvc> m_geosvc; - dd4hep::DDSegmentation::BitFieldCoder* m_decoder; + SmartIF<IGeomSvc> m_geosvc; + dd4hep::DDSegmentation::BitFieldCoder* m_decoder = nullptr; const dd4hep::rec::SurfaceMap* m_surfaces; //void* m_pAlgUsing = nullptr; }; diff --git a/Simulation/DetSimSD/src/TrackerCombineSensitiveDetector.h b/Simulation/DetSimSD/src/TrackerCombineSensitiveDetector.h index cf0cb844eb64a076d8c39477c94a6fd62f677402..b2ba6828a57b4c16c3df1c8de1a883123a0a3d3a 100644 --- a/Simulation/DetSimSD/src/TrackerCombineSensitiveDetector.h +++ b/Simulation/DetSimSD/src/TrackerCombineSensitiveDetector.h @@ -45,13 +45,18 @@ namespace dd4hep { clear(); return 0; } + Position pos = 0.5 * (pre.position + post.position); + Position path = post.position - pre.position; + double hit_len = path.R(); + +#ifdef CylinderOnly + // calculate point at center of two surface for cylinder measurement + // obsolete, deal in digitization for both planar and cylinder double rho1 = pre.position.Rho(); - double rho2 = post.position.Rho(); - double rho = 0.5*(rho1+rho2); - Position pos = 0.5 * (pre.position + post.position); + double rho2 = post.position.Rho(); + double rho = 0.5*(rho1+rho2); double z = pos.z(); double r = sqrt(rho*rho+z*z); - Position path = post.position - pre.position; double angle_O_pre_post = acos(-pre.position.Unit().Dot(path.Unit())); double angle_O_post_pre = acos(post.position.Unit().Dot(path.Unit())); double angle_O_P_pre = asin(pre.position.R()*sin(angle_O_pre_post)/r); @@ -61,6 +66,7 @@ namespace dd4hep { double pre2P = r/sin(angle_O_pre_post)*sin(angle_O_pre_post+angle_O_P_pre); pos = pre.position + pre2P*path.Unit(); } +#endif Momentum mom = 0.5 * (pre.momentum + post.momentum); Geant4TrackerHit* hit = new Geant4TrackerHit(pre.truth.trackID, pre.truth.pdgID, @@ -68,8 +74,8 @@ namespace dd4hep { pre.truth.time); hit->cellID = cellID; hit->position = pos; - hit->momentum = mom; - hit->length = path.R();; + hit->momentum = path.Unit()*mom.R(); + hit->length = hit_len; clear(); c->insert(hit); return hit;