17 " convert FairSHiP MC hits / digitized hits to measurements"
19 self.
fn = ROOT.TFile.Open(fout,
'update')
21 if self.
sTree.GetBranch(
"FitTracks"):
22 print(
"remove RECO branches and rerun reconstruction")
27 if sTree.GetBranch(
"FitTracks"): sTree.SetBranchStatus(
"FitTracks",0)
28 if sTree.GetBranch(
"goodTracks"): sTree.SetBranchStatus(
"goodTracks",0)
29 if sTree.GetBranch(
"VetoHitOnTrack"): sTree.SetBranchStatus(
"VetoHitOnTrack",0)
30 if sTree.GetBranch(
"Particles"): sTree.SetBranchStatus(
"Particles",0)
31 if sTree.GetBranch(
"fitTrack2MC"): sTree.SetBranchStatus(
"fitTrack2MC",0)
32 if sTree.GetBranch(
"EcalClusters"): sTree.SetBranchStatus(
"EcalClusters",0)
33 if sTree.GetBranch(
"EcalReconstructed"): sTree.SetBranchStatus(
"EcalReconstructed",0)
34 if sTree.GetBranch(
"Pid"): sTree.SetBranchStatus(
"Pid",0)
35 if sTree.GetBranch(
"Digi_StrawtubesHits"): sTree.SetBranchStatus(
"Digi_StrawtubesHits",0)
36 if sTree.GetBranch(
"Digi_SBTHits"): sTree.SetBranchStatus(
"Digi_SBTHits",0)
37 if sTree.GetBranch(
"digiSBT2MC"): sTree.SetBranchStatus(
"digiSBT2MC",0)
38 if sTree.GetBranch(
"Digi_TimeDetHits"): sTree.SetBranchStatus(
"Digi_TimeDetHits",0)
39 if sTree.GetBranch(
"Digi_UpstreamTaggerHits"): sTree.SetBranchStatus(
"Digi_UpstreamTaggerHits",0)
40 if sTree.GetBranch(
"Digi_MuonHits"): sTree.SetBranchStatus(
"Digi_MuonHits",0)
42 rawFile = fout.replace(
"_rec.root",
"_raw.root")
43 recf = ROOT.TFile(rawFile,
"recreate")
44 newTree = sTree.CloneTree(0)
45 for n
in range(sTree.GetEntries()):
52 os.system(
'cp '+rawFile +
' '+fout)
53 self.
fn = ROOT.TFile(fout,
'update')
57 branch_class = {
"vetoPoint":
"vetoPoint",
"ShipRpcPoint":
"ShipRpcPoint",
"TargetPoint":
"TargetPoint",\
58 "strawtubesPoint":
"strawtubesPoint",
"EcalPointLite":
"ecalPoint",\
59 "TimeDetPoint":
"TimeDetPoint",
"muonPoint":
"muonPoint",
"UpstreamTaggerPoint":
"UpstreamTaggerPoint"}
60 for x
in branch_class:
61 if not self.
sTree.GetBranch(x):
67 if self.
sTree.GetBranch(
"GeoTracks"): self.
sTree.SetBranchStatus(
"GeoTracks",0)
85 self.
digiSBT = ROOT.TClonesArray(
"vetoHit")
89 self.
digiSBT2MC = ROOT.std.vector(
'std::vector< int >')()
98 self.
v_drift = global_variables.modules[
"Strawtubes"].StrawVdrift()
99 self.
sigma_spatial = global_variables.modules[
"Strawtubes"].StrawSigmaSpatial()
101 if self.
sTree.GetBranch(
"splitcalPoint"):
109 if self.
sTree.GetBranch(
"EcalPoint")
and not self.
sTree.GetBranch(
"splitcalPoint"):
111 dflag = 10
if global_variables.debug
else 0
112 ecalGeo = global_variables.ecalGeoFile +
'z' + str(global_variables.ShipGeo.ecal.z) +
".geo"
113 if not ecalGeo
in os.listdir(os.environ[
"FAIRSHIP"]+
"/geometry"):
115 ecalFiller=ROOT.ecalStructureFiller(
"ecalFiller", dflag,ecalGeo)
116 ecalFiller.SetUseMCPoints(ROOT.kTRUE)
117 ecalFiller.StoreTrackInformation()
120 ecalDigi=ROOT.ecalDigi(
"ecalDigi",0)
123 ecalPrepare=ROOT.ecalPrepare(
"ecalPrepare",0)
126 ecalMaximumFind=ROOT.ecalMaximumLocator(
"maximumFinder",dflag)
129 ecalClusterCalib=ROOT.ecalClusterCalibration(
"ecalClusterCalibration", 0)
131 ecalCl3PhS=ROOT.TFormula(
"ecalCl3PhS",
"[0]+x*([1]+x*([2]+x*[3]))")
132 ecalCl3PhS.SetParameters(6.77797e-04, 5.75385e+00, 3.42690e-03, -1.16383e-04)
133 ecalClusterCalib.SetStraightCalibration(3, ecalCl3PhS)
134 ecalCl3Ph=ROOT.TFormula(
"ecalCl3Ph",
"[0]+x*([1]+x*([2]+x*[3]))+[4]*x*y+[5]*x*y*y")
135 ecalCl3Ph.SetParameters(0.000750975, 5.7552, 0.00282783, -8.0025e-05, -0.000823651, 0.000111561)
136 ecalClusterCalib.SetCalibration(3, ecalCl3Ph)
138 ecalCl2PhS=ROOT.TFormula(
"ecalCl2PhS",
"[0]+x*([1]+x*([2]+x*[3]))")
139 ecalCl2PhS.SetParameters(8.14724e-04, 5.67428e+00, 3.39030e-03, -1.28388e-04)
140 ecalClusterCalib.SetStraightCalibration(2, ecalCl2PhS)
141 ecalCl2Ph=ROOT.TFormula(
"ecalCl2Ph",
"[0]+x*([1]+x*([2]+x*[3]))+[4]*x*y+[5]*x*y*y")
142 ecalCl2Ph.SetParameters(0.000948095, 5.67471, 0.00339177, -0.000122629, -0.000169109, 8.33448e-06)
143 ecalClusterCalib.SetCalibration(2, ecalCl2Ph)
146 ecalClusterFind=ROOT.ecalClusterFinder(
"clusterFinder",dflag)
149 ecalReco=ROOT.ecalReco(
'ecalReco',0)
152 ecalMatch=ROOT.ecalMatch(
'ecalMatch',0)
154 if global_variables.EcalDebugDraw:
156 ecalDrawer=ROOT.ecalDrawer(
"clusterFinder",10)
165 ROOT.gRandom.SetSeed(13)
166 self.
PDG = ROOT.TDatabasePDG.Instance()
168 self.
sTree.GetEvent(0)
170 print(
"** initialize Calo reconstruction **")
181 if global_variables.EcalDebugDraw:
184 ecalClusters = ROOT.TClonesArray(
"ecalCluster")
185 ecalReconstructed = ROOT.TClonesArray(
"ecalReconstructed")
190 gMan = ROOT.gGeoManager
191 self.
geoMat = ROOT.genfit.TGeoMaterialInterface()
193 self.
bfield = ROOT.genfit.FairShipFields()
194 self.
bfield.setField(global_variables.fieldMaker.getGlobalField())
195 self.
fM = ROOT.genfit.FieldManager.getInstance()
197 ROOT.genfit.MaterialEffects.getInstance().init(self.
geoMat)
203 self.
fitter.setMaxIterations(50)
204 if global_variables.debug:
205 self.
fitter.setDebugLvl(1)
216 if hasattr(x,
'execute'): x.execute()
217 elif x.GetName() ==
'ecalFiller': x.Exec(
'start',self.
sTree.EcalPointLite)
219 else : x.Exec(
'start')
223 if global_variables.vertexing:
230 self.
header.SetRunId( self.
sTree.MCEventHeader.GetRunID() )
231 self.
header.SetMCEntryNumber( self.
sTree.MCEventHeader.GetEventID() )
250 if self.
sTree.GetBranch(
"splitcalPoint"):
260 for aMCPoint
in self.
sTree.splitcalPoint:
261 aHit = ROOT.splitcalHit(aMCPoint,self.
sTree.t0)
262 detID = aHit.GetDetectorID()
263 if detID
not in listOfDetID:
266 listOfDetID[detID] = index
270 indexOfExistingHit = listOfDetID[detID]
271 self.
digiSplitcal[indexOfExistingHit].UpdateEnergy(aHit.GetEnergy())
280 noise_energy_threshold = 0.002
282 list_hits_above_threshold = []
285 if hit.GetEnergy() > noise_energy_threshold:
288 list_hits_above_threshold.append(hit)
305 list_final_clusters = {}
306 index_final_cluster = 0
308 for i
in list_clusters_of_hits:
312 for hit
in list_clusters_of_hits[i]:
314 if hit.IsX(): list_hits_x.append(hit)
315 if hit.IsY(): list_hits_y.append(hit)
321 list_subclusters_of_x_hits = self.
Clustering()
330 weights_from_x_splitting = {}
331 for index_subcluster
in list_of_subclusters_x:
332 subcluster_energy_x = self.
GetClusterEnergy(list_of_subclusters_x[index_subcluster])
333 weight = subcluster_energy_x/cluster_energy_x
335 weights_from_x_splitting[index_subcluster] = weight
341 list_subclusters_of_y_hits = self.
Clustering()
350 weights_from_y_splitting = {}
351 for index_subcluster
in list_of_subclusters_y:
352 subcluster_energy_y = self.
GetClusterEnergy(list_of_subclusters_y[index_subcluster])
353 weight = subcluster_energy_y/cluster_energy_y
355 weights_from_y_splitting[index_subcluster] = weight
364 if list_of_subclusters_x == 1
and list_of_subclusters_y == 1:
365 list_final_clusters[index_final_cluster] = list_clusters_of_hits[i]
366 for hit
in list_final_clusters[index_final_cluster]:
367 hit.AddClusterIndex(index_final_cluster)
368 hit.AddEnergyWeight(1.)
369 index_final_cluster += 1
374 for ix
in list_of_subclusters_x:
375 for iy
in list_of_subclusters_y:
377 for hit
in list_of_subclusters_y[iy]:
378 hit.AddClusterIndex(index_final_cluster)
379 hit.AddEnergyWeight(weights_from_x_splitting[ix])
381 for hit
in list_of_subclusters_x[ix]:
382 hit.AddClusterIndex(index_final_cluster)
383 hit.AddEnergyWeight(weights_from_y_splitting[iy])
385 list_final_clusters[index_final_cluster] = list_of_subclusters_y[iy] + list_of_subclusters_x[ix]
386 index_final_cluster += 1
415 for i
in list_final_clusters:
420 for j,h
in enumerate(list_final_clusters[i]):
421 if j==0: aCluster = ROOT.splitcalCluster(h)
422 else: aCluster.AddHit(h)
424 aCluster.SetIndex(int(i))
425 aCluster.ComputeEtaPhiE()
477 list_subclusters_excluding_fragments = {}
479 fragment_indices = []
480 subclusters_indices = []
483 if subcluster_size < 5:
484 fragment_indices.append(k)
486 subclusters_indices.append(k)
496 if len(subclusters_indices) == 0
and len(fragment_indices) != 0:
497 subclusters_indices.append(0)
499 for index_fragment
in fragment_indices:
502 for index_subcluster
in subclusters_indices:
505 if first_hit_fragment.IsX():
506 distance = fabs(first_hit_fragment.GetX()-first_hit_subcluster.GetX())
508 distance = fabs(first_hit_fragment.GetY()-first_hit_subcluster.GetY())
509 if (minDistance < 0
or distance < minDistance):
510 minDistance = distance
511 minIndex = index_subcluster
517 if minIndex != index_fragment:
523 for counter, index_subcluster
in enumerate(subclusters_indices):
526 return list_subclusters_excluding_fragments
532 for hit
in list_hits:
533 energy += hit.GetEnergy()
539 list_hits_in_cluster = {}
551 if len(neighbours) < 1:
556 cluster_index = cluster_index + 1
559 list_hits_in_cluster[cluster_index] = []
560 list_hits_in_cluster[cluster_index].append(hit)
563 for neighbouringHit
in neighbours:
566 if neighbouringHit.IsUsed()==1:
570 neighbouringHit.SetIsUsed(1)
571 list_hits_in_cluster[cluster_index].append(neighbouringHit)
583 if len(expand_neighbours) >= 1:
584 for additionalHit
in expand_neighbours:
585 if additionalHit
not in neighbours:
586 neighbours.append(additionalHit)
588 return list_hits_in_cluster
595 err_x_1 = hit.GetXError()
596 err_y_1 = hit.GetYError()
597 err_z_1 = hit.GetZError()
599 layer_1 = hit.GetLayerNumber()
603 if hit.IsX(): err_x_1 = err_x_1*max_gap
604 if hit.IsY(): err_y_1 = err_y_1*max_gap
608 Dx = fabs(hit2.GetX()-hit.GetX())
609 Dy = fabs(hit2.GetY()-hit.GetY())
610 Dz = fabs(hit2.GetZ()-hit.GetZ())
611 err_x_2 = hit2.GetXError()
612 err_y_2 = hit2.GetYError()
613 err_z_2 = hit2.GetZError()
619 if hit2.IsX(): err_x_2 = err_x_2*max_gap
620 if hit2.IsY(): err_y_2 = err_y_2*max_gap
627 if (Dx<=(err_x_1+err_x_2)
and Dz<=2*(err_z_1+err_z_2)
and ((Dy<=(err_y_1+err_y_2)
and Dz>0.)
or (Dy==0)) ):
628 list_neighbours.append(hit2)
630 if (Dy<=(err_y_1+err_y_2)
and Dz<=2*(err_z_1+err_z_2)
and ((Dx<=(err_x_1+err_x_2)
and Dz>0.)
or (Dx==0)) ):
631 list_neighbours.append(hit2)
638 if (Dx<=(err_x_1+err_x_2)
and Dz<=6*(err_z_1+err_z_2)
and ((Dy<=(err_y_1+err_y_2)
and Dz>0.)
or (Dy==0)) ):
640 list_neighbours.append(hit2)
642 if (Dy<=(err_y_1+err_y_2)
and Dz<=6*(err_z_1+err_z_2)
and ((Dx<=(err_x_1+err_x_2)
and Dz>0.)
or (Dx==0)) ):
644 list_neighbours.append(hit2)
646 print(
"-- getNeighbours: ERROR: step not defined ")
648 return list_neighbours
656 for aMCPoint
in self.
sTree.TimeDetPoint:
657 aHit = ROOT.TimeDetHit(aMCPoint,self.
sTree.t0)
660 detID = aHit.GetDetectorID()
662 if detID
in hitsPerDetId:
663 t = aHit.GetMeasurements()
664 ct = aHit.GetMeasurements()
668 if t[0]>ct[0]
or t[1]>ct[1]:
671 hitsPerDetId[detID] = index
677 for aMCPoint
in self.
sTree.UpstreamTaggerPoint:
678 aHit = ROOT.UpstreamTaggerHit(aMCPoint, global_variables.modules[
"UpstreamTagger"], self.
sTree.t0)
681 detID = aHit.GetDetectorID()
683 if detID
in hitsPerDetId:
684 t = aHit.GetMeasurements()
685 ct = aHit.GetMeasurements()
689 if t[0]>ct[0]
or t[1]>ct[1]:
692 hitsPerDetId[detID] = index
699 for aMCPoint
in self.
sTree.muonPoint:
700 aHit = ROOT.muonHit(aMCPoint,self.
sTree.t0)
703 detID = aHit.GetDetectorID()
705 if detID
in hitsPerDetId:
706 if self.
digiMuon[hitsPerDetId[detID]].GetDigi() > aHit.GetDigi():
708 self.
digiMuon[hitsPerDetId[detID]].setValidity(0)
709 hitsPerDetId[detID] = index
715 listOfVetoPoints = {}
717 for aMCPoint
in self.
sTree.vetoPoint:
719 detID=aMCPoint.GetDetectorID()
720 Eloss=aMCPoint.GetEnergyLoss()
721 if detID
not in ElossPerDetId:
722 ElossPerDetId[detID]=0
723 listOfVetoPoints[detID]=[]
725 ElossPerDetId[detID] += Eloss
726 listOfVetoPoints[detID].append(key)
727 tOfFlight[detID].append(aMCPoint.GetTime())
729 for seg
in ElossPerDetId:
730 aHit = ROOT.vetoHit(seg,ElossPerDetId[seg])
731 aHit.SetTDC(min( tOfFlight[seg] ) + self.
sTree.t0 )
732 if self.
digiSBT.GetSize() == index:
733 self.
digiSBT.Expand(index+1000)
734 if ElossPerDetId[seg]<0.045: aHit.setInvalid()
736 v = ROOT.std.vector(
'int')()
737 for x
in listOfVetoPoints[seg]:
745 for aMCPoint
in self.
sTree.strawtubesPoint:
746 aHit = ROOT.strawtubesHit(aMCPoint,self.
sTree.t0)
750 detID = aHit.GetDetectorID()
751 if detID
in hitsPerDetId:
752 if self.
digiStraw[hitsPerDetId[detID]].GetTDC() > aHit.GetTDC():
754 self.
digiStraw[hitsPerDetId[detID]].setInvalid()
755 hitsPerDetId[detID] = index
764 v_drift = global_variables.modules[
"Strawtubes"].StrawVdrift()
765 global_variables.modules[
"Strawtubes"].StrawEndPoints(10002001, start, stop)
769 if not aDigi.isValid():
continue
770 detID = aDigi.GetDetectorID()
772 station = int(detID//10000000)
773 if station > 4 :
continue
774 global_variables.modules[
"Strawtubes"].StrawEndPoints(detID, start, stop)
775 delt1 = (start[2]-z1)/u.speedOfLight
776 t0+=aDigi.GetDigi()-delt1
777 SmearedHits.append( {
'digiHit':key,
'xtop':stop.x(),
'ytop':stop.y(),
'z':stop.z(),
'xbot':start.x(),
'ybot':start.y(),
'dist':aDigi.GetDigi(),
'detID':detID} )
779 if n>0: t0 = t0/n - 73.2*u.ns
780 for s
in SmearedHits:
781 delt1 = (s[
'z']-z1)/u.speedOfLight
782 s[
'dist'] = (s[
'dist'] -delt1 -t0)*v_drift
789 v_drift = global_variables.modules[
"Strawtubes"].StrawVdrift()
790 global_variables.modules[
"Strawtubes"].StrawEndPoints(10002001, start, stop)
794 if not aDigi.isValid():
continue
795 detID = aDigi.GetDetectorID()
797 station = int(detID//10000000)
798 if station > 4 :
continue
799 global_variables.modules[
"Strawtubes"].StrawEndPoints(detID, start, stop)
801 delt1 = (start[2]-z1)/u.speedOfLight
805 smear = (aDigi.GetDigi() - self.
sTree.t0 - p.GetTime() - ( stop[0]-p.GetX() )/ u.speedOfLight) * v_drift
806 if no_amb: smear = p.dist2Wire()
807 SmearedHits.append( {
'digiHit':key,
'xtop':stop.x(),
'ytop':stop.y(),
'z':stop.z(),
'xbot':start.x(),
'ybot':start.y(),
'dist':smear,
'detID':detID} )
809 if abs(stop.y()) == abs(start.y()):
810 global_variables.h[
'disty'].Fill(smear)
811 elif abs(stop.y()) > abs(start.y()):
812 global_variables.h[
'distu'].Fill(smear)
813 elif abs(stop.y()) < abs(start.y()):
814 global_variables.h[
'distv'].Fill(smear)
828 if global_variables.withT0:
837 if global_variables.realPR:
841 for i_track
in track_hits.keys():
842 atrack = track_hits[i_track]
843 atrack_y12 = atrack[
'y12']
844 atrack_stereo12 = atrack[
'stereo12']
845 atrack_y34 = atrack[
'y34']
846 atrack_stereo34 = atrack[
'stereo34']
847 atrack_smeared_hits = list(atrack_y12) + list(atrack_stereo12) + list(atrack_y34) + list(atrack_stereo34)
848 for sm
in atrack_smeared_hits:
850 station = int(detID//10000000)
853 if trID
not in hitPosLists:
854 hitPosLists[trID] = ROOT.std.vector(
'TVectorD')()
855 listOfIndices[trID] = []
856 stationCrossed[trID] = {}
857 m = array(
'd',[sm[
'xtop'],sm[
'ytop'],sm[
'z'],sm[
'xbot'],sm[
'ybot'],sm[
'z'],sm[
'dist']])
858 hitPosLists[trID].push_back(ROOT.TVectorD(7,m))
859 listOfIndices[trID].append(sm[
'digiHit'])
860 if station
not in stationCrossed[trID]:
861 stationCrossed[trID][station] = 0
862 stationCrossed[trID][station] += 1
865 detID = self.
digiStraw[sm[
'digiHit']].GetDetectorID()
866 station = int(detID//10000000)
867 trID = self.
sTree.strawtubesPoint[sm[
'digiHit']].GetTrackID()
868 if trID
not in hitPosLists:
869 hitPosLists[trID] = ROOT.std.vector(
'TVectorD')()
870 listOfIndices[trID] = []
871 stationCrossed[trID] = {}
872 m = array(
'd',[sm[
'xtop'],sm[
'ytop'],sm[
'z'],sm[
'xbot'],sm[
'ybot'],sm[
'z'],sm[
'dist']])
873 hitPosLists[trID].push_back(ROOT.TVectorD(7,m))
874 listOfIndices[trID].append(sm[
'digiHit'])
875 if station
not in stationCrossed[trID]: stationCrossed[trID][station]=0
876 stationCrossed[trID][station]+=1
887 for atrack
in hitPosLists:
888 if atrack < 0:
continue
889 pdg = self.
sTree.MCTrack[atrack].GetPdgCode()
890 if not self.
PDG.GetParticle(pdg):
continue
892 meas = hitPosLists[atrack]
894 if nM < 25 :
continue
895 if len(stationCrossed[atrack]) < 3 :
continue
896 if global_variables.debug:
897 mctrack = self.
sTree.MCTrack[atrack]
899 posM = ROOT.TVector3(0, 0, 0)
900 momM = ROOT.TVector3(0,0,3.*u.GeV)
902 covM = ROOT.TMatrixDSym(6)
904 if global_variables.withT0:
906 for i
in range(3): covM[i][i] = resolution*resolution
907 covM[0][0]=resolution*resolution*100.
908 for i
in range(3,6): covM[i][i] = ROOT.TMath.Power(resolution / nM / ROOT.TMath.Sqrt(3), 2)
910 rep = ROOT.genfit.RKTrackRep(pdg)
912 stateSmeared = ROOT.genfit.MeasuredStateOnPlane(rep)
913 rep.setPosMomCov(stateSmeared, posM, momM, covM)
915 seedState = ROOT.TVectorD(6)
916 seedCov = ROOT.TMatrixDSym(6)
917 rep.get6DStateCov(stateSmeared, seedState, seedCov)
918 theTrack = ROOT.genfit.Track(rep, seedState, seedCov)
919 hitCov = ROOT.TMatrixDSym(7)
920 hitCov[6][6] = resolution*resolution
922 tp = ROOT.genfit.TrackPoint(theTrack)
923 measurement = ROOT.genfit.WireMeasurement(m,hitCov,1,6,tp)
925 measurement.setMaxDistance(global_variables.ShipGeo.strawtubes.InnerStrawDiameter / 2.)
927 tp.addRawMeasurement(measurement)
928 theTrack.insertPoint(tp)
930 trackCandidates.append([theTrack,atrack])
932 for entry
in trackCandidates:
936 if not theTrack.checkConsistency():
937 print(
'Problem with track before fit, not consistent',atrack,theTrack)
940 try: self.
fitter.processTrack(theTrack)
942 if global_variables.debug:
943 print(
"genfit failed to fit track")
944 error =
"genfit failed to fit track"
945 ut.reportError(error)
948 if not theTrack.checkConsistency():
949 if global_variables.debug:
950 print(
'Problem with track after fit, not consistent', atrack, theTrack)
951 error =
"Problem with track after fit, not consistent"
952 ut.reportError(error)
955 fittedState = theTrack.getFittedState()
956 fittedMom = fittedState.getMomMag()
958 error =
"Problem with fittedstate"
959 ut.reportError(error)
961 fitStatus = theTrack.getFitStatus()
962 nmeas = fitStatus.getNdf()
963 chi2 = fitStatus.getChi2()/nmeas
964 global_variables.h[
'chi2'].Fill(chi2)
967 if not global_variables.debug:
968 theTrack.prune(
"CFL")
971 if global_variables.debug:
972 print(
'save track',theTrack,chi2,nmeas,fitStatus.isFitConverged())
975 for index
in listOfIndices[atrack]:
976 ahit = self.
sTree.strawtubesPoint[index]
977 track_ids += [ahit.GetTrackID()]
983 listOfHits = aTracklet.getList()
985 for index
in listOfIndices[atrack]:
986 listOfHits.push_back(index)
991 if global_variables.debug:
992 print(
'save tracklets:')
993 for x
in self.
sTree.Tracklets:
994 print(x.getType(),x.getList().size())
1001 fitStatus = track.getFitStatus()
1002 if not fitStatus.isFitConverged():
continue
1003 nmeas = fitStatus.getNdf()
1004 chi2 = fitStatus.getChi2()/nmeas
1005 if chi2<50
and not chi2<0:
1013 vetoHitOnTrack = ROOT.vetoHitOnTrack()
1014 xx = track.getFittedState()
1015 rep = ROOT.genfit.RKTrackRep(xx.getPDG())
1016 state = ROOT.genfit.StateOnPlane(rep)
1017 rep.setPosMom(state,xx.getPos(),xx.getMom())
1018 for i,vetoHit
in enumerate(self.
digiSBT):
1021 rep.extrapolateToPoint(state,vetoHitPos,
False)
1023 error =
"shipDigiReco::findVetoHitOnTrack extrapolation did not worked"
1024 ut.reportError(error)
1025 if global_variables.debug:
1028 dist = (rep.getPos(state) - vetoHitPos).Mag()
1033 return vetoHitOnTrack
1048 for tid
in trackids:
1054 tmax = max(track, key=track.get)
1060 frac = float(track[tmax]) / float(nh)
1065 print(
'finished writing tree')
1068 ut.writeHists(global_variables.h,
"recohists.root")
1069 if global_variables.realPR: