From cd085c384318b6e842e1b64cc4a3b3f237907555 Mon Sep 17 00:00:00 2001
From: myliu <201916234@mail.sdu.edu.cn>
Date: Wed, 13 Mar 2024 20:15:24 +0800
Subject: [PATCH] XML file for oblique geometry
---
.../CRD_common_v01/DC_Simple_v01_05.xml | 6 +-
.../CRD_o1_v01/CRD_o1_v01-onlyTracker.xml | 2 +-
.../src/driftchamber/DriftChamber.cpp | 2 +
.../RecGenfitAlg/src/GenfitTrack.cpp | 149 +-----------------
Reconstruction/RecGenfitAlg/src/GenfitTrack.h | 4 -
.../RecGenfitAlg/src/RecGenfitAlgSDT.cpp | 92 +----------
6 files changed, 9 insertions(+), 246 deletions(-)
diff --git a/Detector/DetCRD/compact/CRD_common_v01/DC_Simple_v01_05.xml b/Detector/DetCRD/compact/CRD_common_v01/DC_Simple_v01_05.xml
index 6c05c4fa0..383019ecb 100644
--- a/Detector/DetCRD/compact/CRD_common_v01/DC_Simple_v01_05.xml
+++ b/Detector/DetCRD/compact/CRD_common_v01/DC_Simple_v01_05.xml
@@ -12,12 +12,12 @@
-
+
-
+
@@ -25,7 +25,7 @@
-
+
diff --git a/Detector/DetCRD/compact/CRD_o1_v01/CRD_o1_v01-onlyTracker.xml b/Detector/DetCRD/compact/CRD_o1_v01/CRD_o1_v01-onlyTracker.xml
index 3ac63dc4b..d80301fb2 100644
--- a/Detector/DetCRD/compact/CRD_o1_v01/CRD_o1_v01-onlyTracker.xml
+++ b/Detector/DetCRD/compact/CRD_o1_v01/CRD_o1_v01-onlyTracker.xml
@@ -31,7 +31,7 @@
-
+
diff --git a/Detector/DetDriftChamber/src/driftchamber/DriftChamber.cpp b/Detector/DetDriftChamber/src/driftchamber/DriftChamber.cpp
index 634698ce1..ab80570fc 100644
--- a/Detector/DetDriftChamber/src/driftchamber/DriftChamber.cpp
+++ b/Detector/DetDriftChamber/src/driftchamber/DriftChamber.cpp
@@ -240,6 +240,8 @@ static dd4hep::Ref_t create_detector(dd4hep::Detector& theDetector,
}//end of loop over cell
dd4hep::Transform3D transform_layer(dd4hep::Rotation3D(),
dd4hep::Position(0,0,0));
+ dd4hep::PlacedVolume layer_phy = det_chamber_vol.placeVolume(layer_vol,transform_layer);
+ layer_phy.addPhysVolID("layer", layer_id);
}//end of loop over layers
diff --git a/Reconstruction/RecGenfitAlg/src/GenfitTrack.cpp b/Reconstruction/RecGenfitAlg/src/GenfitTrack.cpp
index ccd4c72a9..19bb23c79 100644
--- a/Reconstruction/RecGenfitAlg/src/GenfitTrack.cpp
+++ b/Reconstruction/RecGenfitAlg/src/GenfitTrack.cpp
@@ -68,27 +68,16 @@ const int GenfitTrack::s_PDG[2][5]
bool
sortDCSimHit(edm4hep::SimTrackerHit hit1,edm4hep::SimTrackerHit hit2)
-//sortDCSimHit(edm4hep::ConstSimTrackerHit hit1,edm4hep::ConstSimTrackerHit hit2)
{
- //std::cout<<"hit1"< hitPair1,std::pair hitPair2)
-//sortDCDigi(std::pair hitPair1,std::pair hitPair2)
{
bool isEarly=hitPair1.first hitPair1,std::pair hitPair2)
-//bool sortDCDigiLayer(std::pair hitPair1,std::pair hitPair2)
-//{
-// bool isEarly=hitPair1.firstend()){iSurface=(*iter).second;}
- //std::multimap< unsigned long, dd4hep::rec::ISurface*>::const_iterator it,itend;
- //it=surfaceMap->begin();
- //itend= surfaceMap->end();
- //std::cout<<" print map "<second;
- // dd4hep::rec::Vector3D origin = surf->origin();
- // std::cout <<"surf id "<< surf->id() << " origin xyz " << origin.x()
- // << " " << origin.y() << " " << origin.z() << std::endl;
- //}
return iSurface;
}
/// Add a 1d strip or 2d pixel smeared by sigma
bool
GenfitTrack::addSiliconMeasurement(edm4hep::TrackerHit* hit,
-//GenfitTrack::addSiliconMeasurement(edm4hep::ConstTrackerHit* hit,
float sigmaU,float sigmaV,int cellID,int hitID)
{
if(m_debug>0) std::cout<<"addSiliconMeasurement "<<*hit<setTrackerHit(hit);
- //genfit::PlanarMeasurement* planarMeasurement=new genfit::PlanarMeasurement(
- // hitCoords,hitCov,cellID,hitID,nullptr);
planarMeasurement->setPlane(plane);
m_track->insertPoint(new genfit::TrackPoint(planarMeasurement,m_track));
@@ -416,9 +391,7 @@ int GenfitTrack::addWireMeasurementsFromList(std::vector&
int sortMethod, bool truthAmbig,float skipCorner,float skipNear)
{
if(m_debug>0){ std::cout<<"addWireMeasurementsFromList"< hits_t=track.getTrackerHits();
std::vector sortedTrackerHits;
- // sortedTrackerHits.reserve(100);
getSortedTrackerHits(hits,assoHits,sortedTrackerHits,sortMethod);
if(m_debug>0){
@@ -593,7 +566,6 @@ void GenfitTrack::setDebugLocal(int debug){
#ifdef GENFIT_MY_DEBUG
if(m_track){
for(unsigned int i=0;igetNumReps();i++){
- //m_track->getTrackRep(i)->setDebugLvlLocal(debug);
}
}
m_debugLocal=debug;
@@ -611,10 +583,8 @@ void GenfitTrack::printSeed() const
mom.Print();
print(pos,mom);
TMatrixDSym covSeed=m_track->getCovSeed();
- //if(m_debug>1)
std::cout << " covSeed = " << std::endl;
covSeed.Print();
- //std::cout<<" pdg "<<0<getTrackRep(i)->Print();
}
}
- //for(unsigned int i=0; igetNumPoints(); i++){
- // m_track->getPoint(i)->print();
- //}
}
/// Get position, momentum, cov on plane of hitID-th hit
@@ -761,7 +728,6 @@ double GenfitTrack::extrapolateToHit(TVector3& poca, TVector3& pocaDir,
int chargeId;
mcParticle.getCharge() >0 ? chargeId=0 : chargeId=1;//s_PDG[0]: positive particle
genfit::RKTrackRep* rep = new genfit::RKTrackRep(s_PDG[chargeId][repID]);
- //genfit::MeasuredStateOnPlane state(rep);
genfit::StateOnPlane state(rep);
rep->setPosMom(state, pos, mom);
@@ -803,35 +769,6 @@ double GenfitTrack::extrapolateToHit(TVector3& poca, TVector3& pocaDir,
return extrapoLen/GenfitUnit::mm*dd4hep::mm;
}//end of extrapolateToHit
-/////Add space point measurement from edm4hep::Track to genfit track
-//int GenfitTrack::addHitsOnEdm4HepTrack(const edm4hep::Track& track,
-// const edm4hep::MCRecoTrackerAssociationCollection* assoHits,
-// std::vector sigma,bool smear,
-// bool measurementTypeSi, bool measurementTypeDC){
-// ///Get TrackerHit on Track
-// int hitID=0;
-// for(unsigned int iHit=0;iHit=2)std::cout<<"addHitsOnEdm4HepTrack "<2){
-// std::cout< sigmaU,std::vector sigmaV)
@@ -844,8 +781,6 @@ int GenfitTrack::addSpacePointsSi(const edm4hep::Track& track,
edm4hep::TrackerHit hit=track.getTrackerHits(iHit);
edm4hep::Vector3d pos=hit.getPosition();
- //edm4hep::Vector3d pos=simTrackerHitAsso.getPosition();
-
TVector3 p(pos.x,pos.y,pos.z);
p.Print();
@@ -919,18 +854,6 @@ int GenfitTrack::addSpacePointsDC(const edm4hep::Track& track,
return nHitAdd;
}//end of addSpacePointsDC
-//double GenfitTrack::extrapolateToPoint(TVector3& pos, TVector3& mom,
-// TMatrixDSym& cov,
-// const TVector3& point,
-// int repID,// same with pidType
-// bool stopAtBoundary,
-// bool calcJacobianNoise) const
-//{
-// return extrapolateToPoint(pos,mom,cov,point,repID,stopAtBoundary,
-// calcJacobianNoise);
-//
-//}//end of extrapolateToPoint
-
double GenfitTrack::extrapolateToPoint(TVector3& pos, TVector3& mom,
TMatrixDSym& cov, const TVector3& point,
int repID,// same with pidType
@@ -975,7 +898,6 @@ double GenfitTrack::extrapolateToPoint(TVector3& pos, TVector3& mom,
"In extrapolateToPoint KalmanFittedStateOnPlane is null"<setDebugLvl(10);
trackLength = rep->extrapolateToPoint(*state,
point*(1/dd4hep::cm),stopAtBoundary, calcJacobianNoise);
@@ -1142,47 +1064,30 @@ bool GenfitTrack::storeTrack(edm4hep::MutableReconstructedParticle& recParticle,
// getNumRawMeasurements
unsigned int nPoints = m_track->getNumPoints();
- std::cout << " nPoints = " << nPoints << std::endl;
unsigned int nPointsWithMea = m_track->getNumPointsWithMeasurement();
- std::cout << " nPointsWithMea = " << nPointsWithMea << std::endl;
std::vector hitMomMag;
- //std::cout << __FILE__ << " " << __LINE__ << std::endl;
while(1){
genfit::TrackPoint* point = m_track->getPointWithFitterInfo(id);
- //std::cout << __FILE__ << " " << __LINE__ << std::endl;
if(!point)break;
- //std::cout << __FILE__ << " " << __LINE__ << " id = " << id << std::endl;
id++;
genfit::AbsMeasurement* absMea = point->getRawMeasurement();
- //std::cout << __FILE__ << " " << __LINE__ << " absMea: " << std::endl;
- //absMea->Print();
// getPoint FitterInfo
genfit::AbsFitterInfo* FitterInfo = point->getFitterInfo();
- //std::cout << __FILE__ << " " << __LINE__ << " FitterInfo: " << std::endl;
- //FitterInfo->Print();
genfit::KalmanFitterInfo *KalmanfitterInfo =
dynamic_cast(FitterInfo);
- //std::cout << __FILE__ << " " << __LINE__ << " KalmanfitterInfo: " << std::endl;
- //KalmanfitterInfo->Print();
-
unsigned int nNumMea = KalmanfitterInfo->getNumMeasurements();
- //std::cout << __FILE__ << " " << __LINE__ << " nNumMea = " << nNumMea << std::endl;
bool flag = false;
for(int i=0;igetMeasurementOnPlane(i);
- //std::cout << __FILE__ << " " << __LINE__ << " MeaOnPlane: " << std::endl;
- //MeaOnPlane->Print();
double weight = MeaOnPlane->getWeight();
- std::cout << __FILE__ << " " << __LINE__ << " weight = " << weight << std::endl;
-
if(weight>0.8) flag = true;
}
if(flag) fitid++;
@@ -1226,15 +1131,9 @@ bool GenfitTrack::storeTrack(edm4hep::MutableReconstructedParticle& recParticle,
}
}
- std::cout << " id = " << id << std::endl;
- std::cout << " fitid = " << fitid << std::endl;
-
nFittedDC = dcFit;
nFittedSDT = SDTHit;
- std::cout<<"nDC: "<0)std::cout< 1e6*dd4hep::cm){
if(m_debug>0)std::cout<getBz(referencePoint)/GenfitUnit::tesla;
@@ -1403,34 +1288,15 @@ bool GenfitTrack::storeTrack(edm4hep::MutableReconstructedParticle& recParticle,
//ngenfitHit = m_genfitHitVec.size();
ngenfitHit = nPoints;
- std::cout << " m_genfitHitVec size = " << m_genfitHitVec.size() << std::endl;
- // for(long unsigned int i=0; i(genfitHit->getTrackerHit());
- //
- // track.addToTrackerHits(*trackHit);
- // }
- //track.setType();
+
track.setChi2(chi2);
track.setNdf(ndf);
- //track.setDEdx();
- //track.setRadiusOfInnermostHit();//FIXME
- //track.addToTrackerHits();
-
- //new ReconstructedParticle
- //recParticle->setType();
- //dcRecParticle->setEnergy();
recParticle.setMomentum(edm4hep::Vector3f(pocaToOrigin_mom.X(),
pocaToOrigin_mom.Y(),pocaToOrigin_mom.Z()));
recParticle.setReferencePoint(edm4hep::Vector3f(referencePoint.X(),
referencePoint.Y(),referencePoint.Z()));
recParticle.setCharge(charge);
- //recParticle->setMass();
- //recParticle.setCovMatrix(trackState->covMatrix);
- //recParticle->setStartVertex();
recParticle.addToTracks(track);
if(m_debug>2){
std::cout<getBz(TVector3{0.,0.,0.})/GenfitUnit::tesla;
+
// FIXME
- //double BZ=GenfitField::getBzFinding(TVector3{0.,0.,0.});
double Bz=3*GenfitUnit::tesla;
double charge_double;
CEPC::getPosMomFromTrackState(edm4HepTrack.getTrackStates(1),Bz,pos,mom,charge_double,cov);
- //std::cout<<__LINE__<<" Bz "< sigmaUVec,
}
if(m_debug){
std::cout<<"sigmaUID "< > sortedDCTrackerHitPair;
for(auto trackerHit : trackerHits){
- //edm4hep::TrackerHit* thisHit = trackerHit;
- //if(!isCDCHit(thisHit))continue;//skip non-DC trackerHit
double time=trackerHit->getTime();
if(0==sortMethod){
diff --git a/Reconstruction/RecGenfitAlg/src/GenfitTrack.h b/Reconstruction/RecGenfitAlg/src/GenfitTrack.h
index 91fe15b9d..58f25014c 100644
--- a/Reconstruction/RecGenfitAlg/src/GenfitTrack.h
+++ b/Reconstruction/RecGenfitAlg/src/GenfitTrack.h
@@ -164,10 +164,6 @@ class GenfitTrack {
/// Output: pos and mom of POCA point to point
/// Input: genfitTrack,point,repID,stopAtBoundary and calcAverageState
/// repID same with pidType
-// double extrapolateToPoint(TVector3& pos, TVector3& mom,TMatrixDSym& cov,
-// const TVector3& point, int repID=0, bool stopAtBoundary = false,
-// bool calcJacobianNoise = true) const;
-
double extrapolateToPoint(TVector3& pos, TVector3& mom, TMatrixDSym& cov,
const TVector3& point, int repID=0,
bool stopAtBoundary = false, bool calcJacobianNoise = true) const;
diff --git a/Reconstruction/RecGenfitAlg/src/RecGenfitAlgSDT.cpp b/Reconstruction/RecGenfitAlg/src/RecGenfitAlgSDT.cpp
index f3a125509..c15dee5e0 100644
--- a/Reconstruction/RecGenfitAlg/src/RecGenfitAlgSDT.cpp
+++ b/Reconstruction/RecGenfitAlg/src/RecGenfitAlgSDT.cpp
@@ -365,13 +365,6 @@ StatusCode RecGenfitAlgSDT::execute()
std::chrono::time_point start;
if(m_tuple) start=std::chrono::high_resolution_clock::now();
- /////retrieve EventHeader
- //auto header = _headerCol.get()->at(0);
- //int evtNo = header.getEventNumber();
- //int runNo = header.getRunNumber();
- //info()<<"run "<setDebug(m_debug);
- //if(m_useTruthTrack){
- // //single track only FIXME
- // if(!genfitTrack->createGenfitTrackFromMCParticle(pidType,
- // *(mcParticleCol->begin()), eventStartTime)){
- // debug()<<"createGenfitTrackFromMCParticle failed!"<createGenfitTrackFromEDM4HepTrack(pidType,
sdtTrack, eventStartTime,m_isUseCovTrack)){
debug()<<"createGenfitTrackFromEDM4HepTrack from SDT track failed!"<addWireMeasurementsOnTrack(sdtTrack,
- // m_sigmaHitU[0],assoDCHitsCol,m_sortMethod,m_truthAmbig,
- // m_skipCorner,m_skipNear);//mm
nHitAdded+=genfitTrack->addWireMeasurementsOnTrack(sdtTrack,
m_sigmaHitU[0],r_SmearAssociationCol.get(),m_sortMethod,m_truthAmbig,
m_skipCorner,m_skipNear);//mm
@@ -505,12 +488,6 @@ StatusCode RecGenfitAlgSDT::execute()
m_genfitFitter->setDebugGenfit(m_debugGenfit);
m_genfitFitter->processTrack(genfitTrack,m_resortHits.value());
- ///----------------------------------
- ///Get TrackLength
- ///---------------------------------
- //TVector3 pos, TVector3 mom;
- //double tracklength = genfitTrack->extrapolateToCylinder();
-
///-----------------------------------
///Store track
///-----------------------------------
@@ -566,23 +543,8 @@ StatusCode RecGenfitAlgSDT::execute()
debugEvent(sdtTrackCol,sdtRecTrackCol,eventStartTime,nFittedSDT);
}
-
-
- //if(m_genfitDisplay) while(1){
- // std::cout<<"Press any key to finish..."<write();
- // time(&timep);
- // std::cout << "Myliu say: the time is "
- // << ctime(&timep)
- // << "at the end of RecGenfitAlgSDT::execute()"
- // << std::endl;
- // system("/scratchfs/bes/myliu/script/memory_rec.sh");
-
return StatusCode::SUCCESS;
}
@@ -612,15 +574,6 @@ void RecGenfitAlgSDT::debugTrack(int iStrack,int pidType,const GenfitTrack* genf
TVector3 pocaToOrigin_pos,TVector3 pocaToOrigin_mom,
TMatrixDSym pocaToOrigin_cov)
{
-
- // time_t timep;
- // time(&timep);
- // std::cout << "Myliu say: the time is "
- // << ctime(&timep)
- // << "at the begin of debugTrack()"
- // << std::endl;
- // system("/scratchfs/bes/myliu/script/memory_rec.sh");
-
/// Get fit status
const genfit::FitStatus* fitState = genfitTrack->getFitStatus();
int charge= fitState->getCharge();
@@ -751,28 +704,12 @@ void RecGenfitAlgSDT::debugTrack(int iStrack,int pidType,const GenfitTrack* genf
<<" ndf "<size();
for(auto sdtTrack: *sdtTrackCol){
@@ -883,12 +820,9 @@ void RecGenfitAlgSDT::debugEvent(const edm4hep::TrackCollection* sdtTrackCol,
m_nSdtRecTrack=sdtRecTrackCol->size();
int isdttrack=0;
for(auto sdtRecTrack: *sdtRecTrackCol){
- std::cout << " sdtRecTrack.trackerHits_size() = " << sdtRecTrack.trackerHits_size() << std::endl;
for(int iHit=0;iHit& dcDigiSelected)
{
-
- // time_t timep;
- // time(&timep);
- // std::cout << "Myliu say: the time is "
- // << ctime(&timep)
- // << "at the begin of selectHits()"
- // << std::endl;
- // system("/scratchfs/bes/myliu/script/memory_rec.sh");
-
-
//for single track only, FIXME
double eventStartTime=0;
unsigned int pidType=1;//mu
@@ -1014,8 +932,6 @@ void RecGenfitAlgSDT::selectHits(const edm4hep::Track&,
double docaExt=1e9;
bool stopAtBoundary=false;
bool calcJacobianNoise=true;
- //for(auto mcParticle : *mcParticleCol){
- //}
edm4hep::MCParticle mcParticle=*(mcParticleCol->begin());//FIXME single track only
genfitTrack->extrapolateToHit(poca,pocaDir,pocaOnWire,docaExt,
@@ -1053,10 +969,4 @@ void RecGenfitAlgSDT::selectHits(const edm4hep::Track&,
}
}//end loop over track
delete genfitTrack;
- // time(&timep);
- // std::cout << "Myliu say: the time is "
- // << ctime(&timep)
- // << "at the end of selectHits()"
- // << std::endl;
- // system("/scratchfs/bes/myliu/script/memory_rec.sh");
}//end of select hit