diff --git a/classshipDigiReco_1_1ShipDigiReco.html b/classshipDigiReco_1_1ShipDigiReco.html index d791b72ab..721c6f7fd 100644 --- a/classshipDigiReco_1_1ShipDigiReco.html +++ b/classshipDigiReco_1_1ShipDigiReco.html @@ -1005,21 +1005,21 @@

-

Definition at line 1006 of file shipDigiReco.py.

-
1006  def findGoodTracks(self):
-
1007  self.goodTracksVect.clear()
-
1008  nGoodTracks = 0
-
1009  for i,track in enumerate(self.fGenFitArray):
-
1010  fitStatus = track.getFitStatus()
-
1011  if not fitStatus.isFitConverged(): continue
-
1012  nmeas = fitStatus.getNdf()
-
1013  chi2 = fitStatus.getChi2()/nmeas
-
1014  if chi2<50 and not chi2<0:
-
1015  self.goodTracksVect.push_back(i)
-
1016  nGoodTracks+=1
-
1017  self.goodTracksBranch.Fill()
-
1018  return nGoodTracks
-
1019 
+

Definition at line 1007 of file shipDigiReco.py.

+
1007  def findGoodTracks(self):
+
1008  self.goodTracksVect.clear()
+
1009  nGoodTracks = 0
+
1010  for i,track in enumerate(self.fGenFitArray):
+
1011  fitStatus = track.getFitStatus()
+
1012  if not fitStatus.isFitConverged(): continue
+
1013  nmeas = fitStatus.getNdf()
+
1014  chi2 = fitStatus.getChi2()/nmeas
+
1015  if chi2<50 and not chi2<0:
+
1016  self.goodTracksVect.push_back(i)
+
1017  nGoodTracks+=1
+
1018  self.goodTracksBranch.Fill()
+
1019  return nGoodTracks
+
1020 
@@ -1196,40 +1196,41 @@

969  error = "Fit not converged"
970  ut.reportError(error)
971  nmeas = fitStatus.getNdf()
-
972  chi2 = fitStatus.getChi2() / nmeas
-
973  global_variables.h['chi2'].Fill(chi2)
-
974 # make track persistent
-
975  nTrack = self.fGenFitArray.GetEntries()
-
976  if not global_variables.debug:
-
977  theTrack.prune("CFL") # http://sourceforge.net/p/genfit/code/HEAD/tree/trunk/core/include/Track.h#l280
-
978  self.fGenFitArray[nTrack] = theTrack
-
979  # self.fitTrack2MC.push_back(atrack)
-
980  if global_variables.debug:
-
981  print('save track',theTrack,chi2,nmeas,fitStatus.isFitConverged())
-
982  # Save MC link
-
983  track_ids = []
-
984  for index in listOfIndices[atrack]:
-
985  ahit = self.sTree.strawtubesPoint[index]
-
986  track_ids += [ahit.GetTrackID()]
-
987  frac, tmax = self.fracMCsame(track_ids)
-
988  self.fitTrack2MC.push_back(tmax)
-
989  # Save hits indexes of the the fitted tracks
-
990  nTracks = self.fTrackletsArray.GetEntries()
-
991  aTracklet = self.fTrackletsArray.ConstructedAt(nTracks)
-
992  listOfHits = aTracklet.getList()
-
993  aTracklet.setType(1)
-
994  for index in listOfIndices[atrack]:
-
995  listOfHits.push_back(index)
-
996  self.Tracklets.Fill()
-
997  self.fitTracks.Fill()
-
998  self.mcLink.Fill()
-
999 # debug
-
1000  if global_variables.debug:
-
1001  print('save tracklets:')
-
1002  for x in self.sTree.Tracklets:
-
1003  print(x.getType(),x.getList().size())
-
1004  return nTrack+1
-
1005 
+
972  if nmeas > 0:
+
973  chi2 = fitStatus.getChi2() / nmeas
+
974  global_variables.h['chi2'].Fill(chi2)
+
975 # make track persistent
+
976  nTrack = self.fGenFitArray.GetEntries()
+
977  if not global_variables.debug:
+
978  theTrack.prune("CFL") # http://sourceforge.net/p/genfit/code/HEAD/tree/trunk/core/include/Track.h#l280
+
979  self.fGenFitArray[nTrack] = theTrack
+
980  # self.fitTrack2MC.push_back(atrack)
+
981  if global_variables.debug:
+
982  print('save track',theTrack,chi2,nmeas,fitStatus.isFitConverged())
+
983  # Save MC link
+
984  track_ids = []
+
985  for index in listOfIndices[atrack]:
+
986  ahit = self.sTree.strawtubesPoint[index]
+
987  track_ids += [ahit.GetTrackID()]
+
988  frac, tmax = self.fracMCsame(track_ids)
+
989  self.fitTrack2MC.push_back(tmax)
+
990  # Save hits indexes of the the fitted tracks
+
991  nTracks = self.fTrackletsArray.GetEntries()
+
992  aTracklet = self.fTrackletsArray.ConstructedAt(nTracks)
+
993  listOfHits = aTracklet.getList()
+
994  aTracklet.setType(1)
+
995  for index in listOfIndices[atrack]:
+
996  listOfHits.push_back(index)
+
997  self.Tracklets.Fill()
+
998  self.fitTracks.Fill()
+
999  self.mcLink.Fill()
+
1000 # debug
+
1001  if global_variables.debug:
+
1002  print('save tracklets:')
+
1003  for x in self.sTree.Tracklets:
+
1004  print(x.getType(),x.getList().size())
+
1005  return nTrack+1
+
1006 
float array
Definition: TTCluster.py:38
def execute(smeared_hits, ship_geo, method='')
Definition: shipPatRec.py:16
@@ -1261,31 +1262,31 @@

-

Definition at line 1020 of file shipDigiReco.py.

-
1020  def findVetoHitOnTrack(self,track):
-
1021  distMin = 99999.
-
1022  vetoHitOnTrack = ROOT.vetoHitOnTrack()
-
1023  xx = track.getFittedState()
-
1024  rep = ROOT.genfit.RKTrackRep(xx.getPDG())
-
1025  state = ROOT.genfit.StateOnPlane(rep)
-
1026  rep.setPosMom(state,xx.getPos(),xx.getMom())
-
1027  for i,vetoHit in enumerate(self.digiSBT):
-
1028  vetoHitPos = vetoHit.GetXYZ()
-
1029  try:
-
1030  rep.extrapolateToPoint(state,vetoHitPos,False)
-
1031  except:
-
1032  error = "shipDigiReco::findVetoHitOnTrack extrapolation did not worked"
-
1033  ut.reportError(error)
-
1034  if global_variables.debug:
-
1035  print(error)
-
1036  continue
-
1037  dist = (rep.getPos(state) - vetoHitPos).Mag()
-
1038  if dist < distMin:
-
1039  distMin = dist
-
1040  vetoHitOnTrack.SetDist(distMin)
- -
1042  return vetoHitOnTrack
-
1043 
+

Definition at line 1021 of file shipDigiReco.py.

+
1021  def findVetoHitOnTrack(self,track):
+
1022  distMin = 99999.
+
1023  vetoHitOnTrack = ROOT.vetoHitOnTrack()
+
1024  xx = track.getFittedState()
+
1025  rep = ROOT.genfit.RKTrackRep(xx.getPDG())
+
1026  state = ROOT.genfit.StateOnPlane(rep)
+
1027  rep.setPosMom(state,xx.getPos(),xx.getMom())
+
1028  for i,vetoHit in enumerate(self.digiSBT):
+
1029  vetoHitPos = vetoHit.GetXYZ()
+
1030  try:
+
1031  rep.extrapolateToPoint(state,vetoHitPos,False)
+
1032  except:
+
1033  error = "shipDigiReco::findVetoHitOnTrack extrapolation did not worked"
+
1034  ut.reportError(error)
+
1035  if global_variables.debug:
+
1036  print(error)
+
1037  continue
+
1038  dist = (rep.getPos(state) - vetoHitPos).Mag()
+
1039  if dist < distMin:
+
1040  distMin = dist
+
1041  vetoHitOnTrack.SetDist(distMin)
+ +
1043  return vetoHitOnTrack
+
1044 
void SetDist(Float_t d)
void SetHitID(Int_t hitID)
TVector3 GetXYZ()
Definition: vetoHit.cxx:39
@@ -1308,16 +1309,16 @@

-

Definition at line 1072 of file shipDigiReco.py.

-
1072  def finish(self):
-
1073  del self.fitter
-
1074  print('finished writing tree')
-
1075  self.sTree.Write()
-
1076  ut.errorSummary()
-
1077  ut.writeHists(global_variables.h,"recohists.root")
-
1078  if global_variables.realPR:
- -
1080  self.fn.Close()
+

Definition at line 1073 of file shipDigiReco.py.

+
1073  def finish(self):
+
1074  del self.fitter
+
1075  print('finished writing tree')
+
1076  self.sTree.Write()
+
1077  ut.errorSummary()
+
1078  ut.writeHists(global_variables.h,"recohists.root")
+
1079  if global_variables.realPR:
+ +
1081  self.fn.Close()
def finalize()
Definition: shipPatRec.py:47
@@ -1348,25 +1349,25 @@

-

Definition at line 1054 of file shipDigiReco.py.

-
1054  def fracMCsame(self, trackids):
-
1055  track={}
-
1056  nh=len(trackids)
-
1057  for tid in trackids:
-
1058  if tid in track:
-
1059  track[tid] += 1
-
1060  else:
-
1061  track[tid] = 1
-
1062  if track != {}:
-
1063  tmax = max(track, key=track.get)
-
1064  else:
-
1065  track = {-999: 0}
-
1066  tmax = -999
-
1067  frac=0.0
-
1068  if nh > 0:
-
1069  frac = float(track[tmax]) / float(nh)
-
1070  return frac, tmax
-
1071 
+

Definition at line 1055 of file shipDigiReco.py.

+
1055  def fracMCsame(self, trackids):
+
1056  track={}
+
1057  nh=len(trackids)
+
1058  for tid in trackids:
+
1059  if tid in track:
+
1060  track[tid] += 1
+
1061  else:
+
1062  track[tid] = 1
+
1063  if track != {}:
+
1064  tmax = max(track, key=track.get)
+
1065  else:
+
1066  track = {-999: 0}
+
1067  tmax = -999
+
1068  frac=0.0
+
1069  if nh > 0:
+
1070  frac = float(track[tmax]) / float(nh)
+
1071  return frac, tmax
+
1072 
def fracMCsame(trackids)
@@ -1592,17 +1593,17 @@

-

Definition at line 1044 of file shipDigiReco.py.

-
1044  def linkVetoOnTracks(self):
-
1045  self.vetoHitOnTrackArray.Delete()
-
1046  index = 0
-
1047  for goodTrak in self.goodTracksVect:
-
1048  track = self.fGenFitArray[goodTrak]
-
1049  if self.vetoHitOnTrackArray.GetSize() == index: self.vetoHitOnTrackArray.Expand(index+1000)
-
1050  self.vetoHitOnTrackArray[index] = self.findVetoHitOnTrack(track)
-
1051  index+=1
-
1052  self.vetoHitOnTrackBranch.Fill()
-
1053 
+

Definition at line 1045 of file shipDigiReco.py.

+
1045  def linkVetoOnTracks(self):
+
1046  self.vetoHitOnTrackArray.Delete()
+
1047  index = 0
+
1048  for goodTrak in self.goodTracksVect:
+
1049  track = self.fGenFitArray[goodTrak]
+
1050  if self.vetoHitOnTrackArray.GetSize() == index: self.vetoHitOnTrackArray.Expand(index+1000)
+
1051  self.vetoHitOnTrackArray[index] = self.findVetoHitOnTrack(track)
+
1052  index+=1
+
1053  self.vetoHitOnTrackBranch.Fill()
+
1054 

diff --git a/shipDigiReco_8py_source.html b/shipDigiReco_8py_source.html index 7e36f7375..859bfbb5a 100644 --- a/shipDigiReco_8py_source.html +++ b/shipDigiReco_8py_source.html @@ -1052,115 +1052,116 @@
969  error = "Fit not converged"
970  ut.reportError(error)
971  nmeas = fitStatus.getNdf()
-
972  chi2 = fitStatus.getChi2() / nmeas
-
973  global_variables.h['chi2'].Fill(chi2)
-
974 # make track persistent
-
975  nTrack = self.fGenFitArrayfGenFitArray.GetEntries()
-
976  if not global_variables.debug:
-
977  theTrack.prune("CFL") # http://sourceforge.net/p/genfit/code/HEAD/tree/trunk/core/include/Track.h#l280
-
978  self.fGenFitArrayfGenFitArray[nTrack] = theTrack
-
979  # self.fitTrack2MC.push_back(atrack)
-
980  if global_variables.debug:
-
981  print('save track',theTrack,chi2,nmeas,fitStatus.isFitConverged())
-
982  # Save MC link
-
983  track_ids = []
-
984  for index in listOfIndices[atrack]:
-
985  ahit = self.sTreesTree.strawtubesPoint[index]
-
986  track_ids += [ahit.GetTrackID()]
-
987  frac, tmax = self.fracMCsamefracMCsame(track_ids)
-
988  self.fitTrack2MCfitTrack2MC.push_back(tmax)
-
989  # Save hits indexes of the the fitted tracks
-
990  nTracks = self.fTrackletsArrayfTrackletsArray.GetEntries()
-
991  aTracklet = self.fTrackletsArrayfTrackletsArray.ConstructedAt(nTracks)
-
992  listOfHits = aTracklet.getList()
-
993  aTracklet.setType(1)
-
994  for index in listOfIndices[atrack]:
-
995  listOfHits.push_back(index)
-
996  self.TrackletsTracklets.Fill()
-
997  self.fitTracksfitTracks.Fill()
-
998  self.mcLinkmcLink.Fill()
-
999 # debug
-
1000  if global_variables.debug:
-
1001  print('save tracklets:')
-
1002  for x in self.sTreesTree.Tracklets:
-
1003  print(x.getType(),x.getList().size())
-
1004  return nTrack+1
-
1005 
-
1006  def findGoodTracks(self):
-
1007  self.goodTracksVectgoodTracksVect.clear()
-
1008  nGoodTracks = 0
-
1009  for i,track in enumerate(self.fGenFitArrayfGenFitArray):
-
1010  fitStatus = track.getFitStatus()
-
1011  if not fitStatus.isFitConverged(): continue
-
1012  nmeas = fitStatus.getNdf()
-
1013  chi2 = fitStatus.getChi2()/nmeas
-
1014  if chi2<50 and not chi2<0:
-
1015  self.goodTracksVectgoodTracksVect.push_back(i)
-
1016  nGoodTracks+=1
-
1017  self.goodTracksBranchgoodTracksBranch.Fill()
-
1018  return nGoodTracks
-
1019 
-
1020  def findVetoHitOnTrack(self,track):
-
1021  distMin = 99999.
-
1022  vetoHitOnTrack = ROOT.vetoHitOnTrack()
-
1023  xx = track.getFittedState()
-
1024  rep = ROOT.genfit.RKTrackRep(xx.getPDG())
-
1025  state = ROOT.genfit.StateOnPlane(rep)
-
1026  rep.setPosMom(state,xx.getPos(),xx.getMom())
-
1027  for i,vetoHit in enumerate(self.digiSBTdigiSBT):
-
1028  vetoHitPos = vetoHit.GetXYZ()
-
1029  try:
-
1030  rep.extrapolateToPoint(state,vetoHitPos,False)
-
1031  except:
-
1032  error = "shipDigiReco::findVetoHitOnTrack extrapolation did not worked"
-
1033  ut.reportError(error)
-
1034  if global_variables.debug:
-
1035  print(error)
-
1036  continue
-
1037  dist = (rep.getPos(state) - vetoHitPos).Mag()
-
1038  if dist < distMin:
-
1039  distMin = dist
-
1040  vetoHitOnTrack.SetDist(distMin)
- -
1042  return vetoHitOnTrack
-
1043 
-
1044  def linkVetoOnTracks(self):
-
1045  self.vetoHitOnTrackArrayvetoHitOnTrackArray.Delete()
-
1046  index = 0
-
1047  for goodTrak in self.goodTracksVectgoodTracksVect:
-
1048  track = self.fGenFitArrayfGenFitArray[goodTrak]
-
1049  if self.vetoHitOnTrackArrayvetoHitOnTrackArray.GetSize() == index: self.vetoHitOnTrackArrayvetoHitOnTrackArray.Expand(index+1000)
-
1050  self.vetoHitOnTrackArrayvetoHitOnTrackArray[index] = self.findVetoHitOnTrackfindVetoHitOnTrack(track)
-
1051  index+=1
-
1052  self.vetoHitOnTrackBranchvetoHitOnTrackBranch.Fill()
-
1053 
-
1054  def fracMCsame(self, trackids):
-
1055  track={}
-
1056  nh=len(trackids)
-
1057  for tid in trackids:
-
1058  if tid in track:
-
1059  track[tid] += 1
-
1060  else:
-
1061  track[tid] = 1
-
1062  if track != {}:
-
1063  tmax = max(track, key=track.get)
-
1064  else:
-
1065  track = {-999: 0}
-
1066  tmax = -999
-
1067  frac=0.0
-
1068  if nh > 0:
-
1069  frac = float(track[tmax]) / float(nh)
-
1070  return frac, tmax
-
1071 
-
1072  def finish(self):
-
1073  del self.fitterfitter
-
1074  print('finished writing tree')
-
1075  self.sTreesTree.Write()
-
1076  ut.errorSummary()
-
1077  ut.writeHists(global_variables.h,"recohists.root")
-
1078  if global_variables.realPR:
- -
1080  self.fnfn.Close()
+
972  if nmeas > 0:
+
973  chi2 = fitStatus.getChi2() / nmeas
+
974  global_variables.h['chi2'].Fill(chi2)
+
975 # make track persistent
+
976  nTrack = self.fGenFitArrayfGenFitArray.GetEntries()
+
977  if not global_variables.debug:
+
978  theTrack.prune("CFL") # http://sourceforge.net/p/genfit/code/HEAD/tree/trunk/core/include/Track.h#l280
+
979  self.fGenFitArrayfGenFitArray[nTrack] = theTrack
+
980  # self.fitTrack2MC.push_back(atrack)
+
981  if global_variables.debug:
+
982  print('save track',theTrack,chi2,nmeas,fitStatus.isFitConverged())
+
983  # Save MC link
+
984  track_ids = []
+
985  for index in listOfIndices[atrack]:
+
986  ahit = self.sTreesTree.strawtubesPoint[index]
+
987  track_ids += [ahit.GetTrackID()]
+
988  frac, tmax = self.fracMCsamefracMCsame(track_ids)
+
989  self.fitTrack2MCfitTrack2MC.push_back(tmax)
+
990  # Save hits indexes of the the fitted tracks
+
991  nTracks = self.fTrackletsArrayfTrackletsArray.GetEntries()
+
992  aTracklet = self.fTrackletsArrayfTrackletsArray.ConstructedAt(nTracks)
+
993  listOfHits = aTracklet.getList()
+
994  aTracklet.setType(1)
+
995  for index in listOfIndices[atrack]:
+
996  listOfHits.push_back(index)
+
997  self.TrackletsTracklets.Fill()
+
998  self.fitTracksfitTracks.Fill()
+
999  self.mcLinkmcLink.Fill()
+
1000 # debug
+
1001  if global_variables.debug:
+
1002  print('save tracklets:')
+
1003  for x in self.sTreesTree.Tracklets:
+
1004  print(x.getType(),x.getList().size())
+
1005  return nTrack+1
+
1006 
+
1007  def findGoodTracks(self):
+
1008  self.goodTracksVectgoodTracksVect.clear()
+
1009  nGoodTracks = 0
+
1010  for i,track in enumerate(self.fGenFitArrayfGenFitArray):
+
1011  fitStatus = track.getFitStatus()
+
1012  if not fitStatus.isFitConverged(): continue
+
1013  nmeas = fitStatus.getNdf()
+
1014  chi2 = fitStatus.getChi2()/nmeas
+
1015  if chi2<50 and not chi2<0:
+
1016  self.goodTracksVectgoodTracksVect.push_back(i)
+
1017  nGoodTracks+=1
+
1018  self.goodTracksBranchgoodTracksBranch.Fill()
+
1019  return nGoodTracks
+
1020 
+
1021  def findVetoHitOnTrack(self,track):
+
1022  distMin = 99999.
+
1023  vetoHitOnTrack = ROOT.vetoHitOnTrack()
+
1024  xx = track.getFittedState()
+
1025  rep = ROOT.genfit.RKTrackRep(xx.getPDG())
+
1026  state = ROOT.genfit.StateOnPlane(rep)
+
1027  rep.setPosMom(state,xx.getPos(),xx.getMom())
+
1028  for i,vetoHit in enumerate(self.digiSBTdigiSBT):
+
1029  vetoHitPos = vetoHit.GetXYZ()
+
1030  try:
+
1031  rep.extrapolateToPoint(state,vetoHitPos,False)
+
1032  except:
+
1033  error = "shipDigiReco::findVetoHitOnTrack extrapolation did not worked"
+
1034  ut.reportError(error)
+
1035  if global_variables.debug:
+
1036  print(error)
+
1037  continue
+
1038  dist = (rep.getPos(state) - vetoHitPos).Mag()
+
1039  if dist < distMin:
+
1040  distMin = dist
+
1041  vetoHitOnTrack.SetDist(distMin)
+ +
1043  return vetoHitOnTrack
+
1044 
+
1045  def linkVetoOnTracks(self):
+
1046  self.vetoHitOnTrackArrayvetoHitOnTrackArray.Delete()
+
1047  index = 0
+
1048  for goodTrak in self.goodTracksVectgoodTracksVect:
+
1049  track = self.fGenFitArrayfGenFitArray[goodTrak]
+
1050  if self.vetoHitOnTrackArrayvetoHitOnTrackArray.GetSize() == index: self.vetoHitOnTrackArrayvetoHitOnTrackArray.Expand(index+1000)
+
1051  self.vetoHitOnTrackArrayvetoHitOnTrackArray[index] = self.findVetoHitOnTrackfindVetoHitOnTrack(track)
+
1052  index+=1
+
1053  self.vetoHitOnTrackBranchvetoHitOnTrackBranch.Fill()
+
1054 
+
1055  def fracMCsame(self, trackids):
+
1056  track={}
+
1057  nh=len(trackids)
+
1058  for tid in trackids:
+
1059  if tid in track:
+
1060  track[tid] += 1
+
1061  else:
+
1062  track[tid] = 1
+
1063  if track != {}:
+
1064  tmax = max(track, key=track.get)
+
1065  else:
+
1066  track = {-999: 0}
+
1067  tmax = -999
+
1068  frac=0.0
+
1069  if nh > 0:
+
1070  frac = float(track[tmax]) / float(nh)
+
1071  return frac, tmax
+
1072 
+
1073  def finish(self):
+
1074  del self.fitterfitter
+
1075  print('finished writing tree')
+
1076  self.sTreesTree.Write()
+
1077  ut.errorSummary()
+
1078  ut.writeHists(global_variables.h,"recohists.root")
+
1079  if global_variables.realPR:
+ +
1081  self.fnfn.Close()
void InitPython(ecalStructure *structure)
Definition: ecalDigi.cxx:85
Int_t InitPython(TClonesArray *mctracks, TClonesArray *ecalPoints, ecalStructure *structure, TClonesArray *clusters)
Definition: ecalDrawer.cxx:537
void InitPython(ecalStructure *str, TClonesArray *reconstructed, TClonesArray *mctracks)
Definition: ecalMatch.cxx:179
@@ -1178,13 +1179,13 @@ - + - + -
def findVetoHitOnTrack(self, track)
+
def findVetoHitOnTrack(self, track)
def __init__(self, fout, fgeo)
Definition: shipDigiReco.py:16
@@ -1220,7 +1221,7 @@
list_hits_above_threshold
cluster reconstruction #
-
def fracMCsame(self, trackids)
+
def fracMCsame(self, trackids)
@@ -1237,7 +1238,7 @@ - +