Skip to content

Commit 187b40a

Browse files
fix bug ntracks
1 parent fd80ca7 commit 187b40a

File tree

3 files changed

+21
-19
lines changed

3 files changed

+21
-19
lines changed

analyzers/dataframe/VertexFitterActs.cc

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
using namespace VertexFitterActs;
2020
using namespace Acts::UnitLiterals;
21-
using namespace ReconstructedParticle2Track;
2221

2322

2423
VertexingUtils::FCCAnalysesVertex VertexFitterActs::VertexFitterFullBilloir(ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> recoparticles,
@@ -134,18 +133,6 @@ VertexingUtils::FCCAnalysesVertex VertexFitterActs::VertexFitterFullBilloir(ROOT
134133
tracksPtr.push_back(&trk);
135134
}
136135

137-
138-
Acts::Vertex<Acts::BoundTrackParameters> fittedVertex =
139-
billoirFitter.fit(tracksPtr, linearizer, vfOptions, state).value();
140-
//Acts::Vertex<Acts::BoundTrackParameters> fittedVertexConstraint =
141-
// billoirFitter.fit(tracksPtr, linearizer, vfOptionsConstr, state).value();
142-
143-
144-
//std::cout << "Fitting nTracks: " << Ntr << std::endl;
145-
// std::cout << "Fitted Vertex: " << fittedVertex.position() << std::endl;
146-
// std::cout << "Fitted constraint Vertex: "
147-
// << fittedVertexConstraint.position() << std::endl;
148-
149136
VertexingUtils::FCCAnalysesVertex TheVertex;
150137
edm4hep::VertexData edm4hep_vertex;
151138
ROOT::VecOps::RVec<float> reco_chi2;
@@ -162,6 +149,23 @@ VertexingUtils::FCCAnalysesVertex VertexFitterActs::VertexFitterFullBilloir(ROOT
162149
TheVertex.updated_track_momentum_at_vertex = updated_track_momentum_at_vertex;
163150

164151

152+
TheVertex.ntracks = Ntr;
153+
if ( Ntr <= 1) return TheVertex; // can not reconstruct a vertex with only one track...
154+
155+
156+
Acts::Vertex<Acts::BoundTrackParameters> fittedVertex =
157+
billoirFitter.fit(tracksPtr, linearizer, vfOptions, state).value();
158+
//Acts::Vertex<Acts::BoundTrackParameters> fittedVertexConstraint =
159+
// billoirFitter.fit(tracksPtr, linearizer, vfOptionsConstr, state).value();
160+
161+
162+
//std::cout << "Fitting nTracks: " << Ntr << std::endl;
163+
// std::cout << "Fitted Vertex: " << fittedVertex.position() << std::endl;
164+
// std::cout << "Fitted constraint Vertex: "
165+
// << fittedVertexConstraint.position() << std::endl;
166+
167+
168+
165169
TheVertex.ntracks = Ntr;
166170
edm4hep_vertex.chi2 = fittedVertex.fitQuality().first/ fittedVertex.fitQuality().second ;
167171
edm4hep_vertex.position = edm4hep::Vector3f( fittedVertex.position()[0],

analyzers/dataframe/VertexFitterSimple.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
using namespace VertexFitterSimple;
99

10-
using namespace ReconstructedParticle2Track;
11-
1210

1311

1412

examples/FCCee/vertex/analysis.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ def __init__(self, inputlist, outname, ncpu):
3030
if ".root" not in outname:
3131
self.outname+=".root"
3232

33-
#ROOT.ROOT.EnableImplicitMT(ncpu)
33+
ROOT.ROOT.EnableImplicitMT(ncpu)
3434

3535
self.df = ROOT.RDataFrame("events", inputlist)
3636
print (" done")
3737
#__________________________________________________________
3838
def run(self):
39-
df2 = (self.df.Range(0,5000)
40-
#df2 = (self.df
39+
#df2 = (self.df.Range(0,5000)
40+
df2 = (self.df
4141

4242
# MC event primary vertex
4343
.Define("MC_PrimaryVertex", "MCParticle::get_EventPrimaryVertex(21)( Particle )" )
@@ -117,7 +117,7 @@ def run(self):
117117
import os
118118
os.system("mkdir -p {}".format(outDir))
119119
outfile = outDir+infile.split('/')[-1]
120-
ncpus = 1
120+
ncpus = 0
121121
analysis = analysis(infile, outfile, ncpus)
122122
analysis.run()
123123

0 commit comments

Comments
 (0)