Skip to content

Commit

Permalink
Fix: Pass correct detector IDs to Genfit
Browse files Browse the repository at this point in the history
  • Loading branch information
olantwin committed Dec 11, 2024
1 parent 3437d92 commit f033109
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ it in future.
* Use ConstructedAt + std::swap to replace removed pythonization for TCA
* Octant symmetry was incorrect for B_z when using field maps (reported and fixed by M. Ferro-Luzzi)
* Tof calculation corrected in GenieGenerator.cxx, wrong units previously used.
* Genfit measurements now give the correct detector ID

### Changed

Expand Down
18 changes: 16 additions & 2 deletions python/shipDigiReco.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@ def smearHits(self,no_amb=None):

def findTracks(self):
hitPosLists = {}
hit_detector_ids = {}
stationCrossed = {}
fittedtrackids=[]
listOfIndices = {}
Expand Down Expand Up @@ -852,6 +853,8 @@ def findTracks(self):
hitPosLists[trID] = ROOT.std.vector('TVectorD')()
listOfIndices[trID] = []
stationCrossed[trID] = {}
hit_detector_ids[trID] = ROOT.std.vector('int')()
hit_detector_ids[trID].push_back(detID)
m = array('d',[sm['xtop'],sm['ytop'],sm['z'],sm['xbot'],sm['ybot'],sm['z'],sm['dist']])
hitPosLists[trID].push_back(ROOT.TVectorD(7,m))
listOfIndices[trID].append(sm['digiHit'])
Expand All @@ -867,6 +870,8 @@ def findTracks(self):
hitPosLists[trID] = ROOT.std.vector('TVectorD')()
listOfIndices[trID] = []
stationCrossed[trID] = {}
hit_detector_ids[trID] = ROOT.std.vector('int')()
hit_detector_ids[trID].push_back(detID)
m = array('d',[sm['xtop'],sm['ytop'],sm['z'],sm['xbot'],sm['ybot'],sm['z'],sm['dist']])
hitPosLists[trID].push_back(ROOT.TVectorD(7,m))
listOfIndices[trID].append(sm['digiHit'])
Expand All @@ -888,6 +893,7 @@ def findTracks(self):
if not self.PDG.GetParticle(pdg): continue # unknown particle
# pdg = 13
meas = hitPosLists[atrack]
detIDs = hit_detector_ids[atrack]
nM = meas.size()
if nM < 25 : continue # not enough hits to make a good trackfit
if len(stationCrossed[atrack]) < 3 : continue # not enough stations crossed to make a good trackfit
Expand Down Expand Up @@ -916,14 +922,22 @@ def findTracks(self):
theTrack = ROOT.genfit.Track(rep, seedState, seedCov)
hitCov = ROOT.TMatrixDSym(7)
hitCov[6][6] = resolution*resolution
for m in meas:
hitID = 0
for m, detID in zip(meas, detIDs):
tp = ROOT.genfit.TrackPoint(theTrack) # note how the point is told which track it belongs to
measurement = ROOT.genfit.WireMeasurement(m,hitCov,1,6,tp) # the measurement is told which trackpoint it belongs to
measurement = ROOT.genfit.WireMeasurement(
m,
hitCov,
detID,
hitID,
tp
) # the measurement is told which trackpoint it belongs to
# print measurement.getMaxDistance()
measurement.setMaxDistance(global_variables.ShipGeo.strawtubes.InnerStrawDiameter / 2.)
# measurement.setLeftRightResolution(-1)
tp.addRawMeasurement(measurement) # package measurement in the TrackPoint
theTrack.insertPoint(tp) # add point to Track
hitID += 1
# print "debug meas",atrack,nM,stationCrossed[atrack],self.sTree.MCTrack[atrack],pdg
trackCandidates.append([theTrack,atrack])

Expand Down

0 comments on commit f033109

Please sign in to comment.