Skip to content

Commit

Permalink
Merge pull request #76 from clementhelsens/master
Browse files Browse the repository at this point in the history
fix bug ntracks
  • Loading branch information
clementhelsens authored Feb 25, 2021
2 parents fd80ca7 + 187b40a commit ec78602
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
30 changes: 17 additions & 13 deletions analyzers/dataframe/VertexFitterActs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

using namespace VertexFitterActs;
using namespace Acts::UnitLiterals;
using namespace ReconstructedParticle2Track;


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


Acts::Vertex<Acts::BoundTrackParameters> fittedVertex =
billoirFitter.fit(tracksPtr, linearizer, vfOptions, state).value();
//Acts::Vertex<Acts::BoundTrackParameters> fittedVertexConstraint =
// billoirFitter.fit(tracksPtr, linearizer, vfOptionsConstr, state).value();


//std::cout << "Fitting nTracks: " << Ntr << std::endl;
// std::cout << "Fitted Vertex: " << fittedVertex.position() << std::endl;
// std::cout << "Fitted constraint Vertex: "
// << fittedVertexConstraint.position() << std::endl;

VertexingUtils::FCCAnalysesVertex TheVertex;
edm4hep::VertexData edm4hep_vertex;
ROOT::VecOps::RVec<float> reco_chi2;
Expand All @@ -162,6 +149,23 @@ VertexingUtils::FCCAnalysesVertex VertexFitterActs::VertexFitterFullBilloir(ROOT
TheVertex.updated_track_momentum_at_vertex = updated_track_momentum_at_vertex;


TheVertex.ntracks = Ntr;
if ( Ntr <= 1) return TheVertex; // can not reconstruct a vertex with only one track...


Acts::Vertex<Acts::BoundTrackParameters> fittedVertex =
billoirFitter.fit(tracksPtr, linearizer, vfOptions, state).value();
//Acts::Vertex<Acts::BoundTrackParameters> fittedVertexConstraint =
// billoirFitter.fit(tracksPtr, linearizer, vfOptionsConstr, state).value();


//std::cout << "Fitting nTracks: " << Ntr << std::endl;
// std::cout << "Fitted Vertex: " << fittedVertex.position() << std::endl;
// std::cout << "Fitted constraint Vertex: "
// << fittedVertexConstraint.position() << std::endl;



TheVertex.ntracks = Ntr;
edm4hep_vertex.chi2 = fittedVertex.fitQuality().first/ fittedVertex.fitQuality().second ;
edm4hep_vertex.position = edm4hep::Vector3f( fittedVertex.position()[0],
Expand Down
2 changes: 0 additions & 2 deletions analyzers/dataframe/VertexFitterSimple.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

using namespace VertexFitterSimple;

using namespace ReconstructedParticle2Track;




Expand Down
8 changes: 4 additions & 4 deletions examples/FCCee/vertex/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ def __init__(self, inputlist, outname, ncpu):
if ".root" not in outname:
self.outname+=".root"

#ROOT.ROOT.EnableImplicitMT(ncpu)
ROOT.ROOT.EnableImplicitMT(ncpu)

self.df = ROOT.RDataFrame("events", inputlist)
print (" done")
#__________________________________________________________
def run(self):
df2 = (self.df.Range(0,5000)
#df2 = (self.df
#df2 = (self.df.Range(0,5000)
df2 = (self.df

# MC event primary vertex
.Define("MC_PrimaryVertex", "MCParticle::get_EventPrimaryVertex(21)( Particle )" )
Expand Down Expand Up @@ -117,7 +117,7 @@ def run(self):
import os
os.system("mkdir -p {}".format(outDir))
outfile = outDir+infile.split('/')[-1]
ncpus = 1
ncpus = 0
analysis = analysis(infile, outfile, ncpus)
analysis.run()

Expand Down

0 comments on commit ec78602

Please sign in to comment.