Skip to content

Commit

Permalink
Merge pull request #254 from tmadlener/podio-maybe-shared-ptr
Browse files Browse the repository at this point in the history
Move to makeEmpty factory methods for initializing empty edm4hep objects
  • Loading branch information
mirguest authored Nov 22, 2023
2 parents 5789738 + e3a5e47 commit cc6174b
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 3 deletions.
6 changes: 6 additions & 0 deletions Analysis/TrackInspect/src/TrackInspectAlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

#include "DataHelper/HelixClass.h"

#include "podio/podioVersion.h"

#include "CLHEP/Units/SystemOfUnits.h"
#include <math.h>
#include <TTree.h>
Expand Down Expand Up @@ -179,7 +181,11 @@ StatusCode TrackInspectAlg::execute(){
if (theTracks.size() == 0) {
totalCandidates[m_nParticles] = 0;
nCandidate[m_nParticles] = -1;
#if PODIO_BUILD_VERSION < PODIO_VERSION(0, 17, 4)
Fill(particle, edm4hep::Track(nullptr));
#else
Fill(particle, edm4hep::Track::makeEmpty());
#endif
m_nParticles++;
}
else {
Expand Down
7 changes: 7 additions & 0 deletions Reconstruction/PFA/Arbor/src/ArborToolLCIO.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#include <DDRec/CellIDPositionConverter.h>
#include "DetInterface/IGeomSvc.h"

#include "podio/podioVersion.h"

using namespace std;
/*
void ClusterBuilding( LCEvent * evtPP, std::string Name, std::vector<CalorimeterHit*> Hits, std::vector< std::vector<int> > BranchOrder, int DHCALFlag )
Expand Down Expand Up @@ -859,7 +861,12 @@ edm4hep::ClusterCollection* ArborToolLCIO::ClusterVecMerge( std::vector<edm4hep:
edm4hep::Cluster Mergebranch_A;
edm4hep::Cluster Mergebranch_B;
edm4hep::Cluster tmpMergebranch;
#if PODIO_BUILD_VERSION < PODIO_VERSION(0, 17, 4)
edm4hep::Cluster Mainbranch (0);
#else
auto Mainbranch = edm4hep::Cluster::makeEmpty();
#endif


TVector3 tmpClusterSeedPos, MBSeedPos;

Expand Down
13 changes: 12 additions & 1 deletion Reconstruction/Tracking/src/Clupatra/clupatra_new.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
#include "k4FWCore/DataHandle.h"
#include "GaudiAlg/GaudiAlgorithm.h"
#include "GearSvc/IGearSvc.h"

#include "podio/podioVersion.h"

using namespace MarlinTrk ;

namespace lcio{
Expand Down Expand Up @@ -287,8 +290,12 @@ namespace clupatra_new{
UTIL::BitField64 encoder( UTIL::ILDCellID0::encoder_string ) ;
encoder[UTIL::ILDCellID0::subdet] = UTIL::ILDDetID::TPC ;

#if PODIO_BUILD_VERSION < PODIO_VERSION(0, 17, 4)
edm4hep::TrackerHit firstHit = 0;
// = 0 equal to unlink()
#else
auto firstHit = edm4hep::TrackerHit::makeEmpty();
#endif
// = 0 equal to unlink()
//firstHit.unlink();

IMarlinTrack* bwTrk = 0 ;
Expand Down Expand Up @@ -1410,7 +1417,11 @@ namespace clupatra_new{
#if use_fit_at_last_hit
code = mtrk->getTrackState( lHit, tsLH, chi2, ndf ) ;
#else // get the track state at the last hit by propagating from the last(first) constrained fit position (a la MarlinTrkUtils)
#if PODIO_BUILD_VERSION < PODIO_VERSION(0, 17, 4)
edm4hep::TrackerHit last_constrained_hit(0);
#else
auto last_constrained_hit = edm4hep::TrackerHit::makeEmpty();
#endif
code = mtrk->getTrackerHitAtPositiveNDF( last_constrained_hit );
//code = mtrk->smooth() ;
if( code != MarlinTrk::IMarlinTrack::success ){
Expand Down
6 changes: 6 additions & 0 deletions Reconstruction/Tracking/src/Clupatra/clupatra_new.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include "TrackSystemSvc/IMarlinTrack.h"
#include "TrackSystemSvc/IMarlinTrkSystem.h"

#include "podio/podioVersion.h"

// ----- include for verbosity dependend logging ---------
// #include "marlin/VerbosityLevels.h"

Expand Down Expand Up @@ -57,7 +59,11 @@ namespace clupatra_new{
ClupaHit() :layer(-1),
zIndex(-1),
phiIndex(-1),
#if PODIO_BUILD_VERSION < PODIO_VERSION(0, 17, 4)
edm4hepHit(0),
#else
edm4hepHit(edm4hep::TrackerHit::makeEmpty()),
#endif
pos(0.,0.,0.) {}
int layer ;
int zIndex ;
Expand Down
10 changes: 8 additions & 2 deletions Service/TrackSystemSvc/src/MarlinKalTestTrack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include "gear/GEAR.h"
#include "gear/BField.h"

#include "podio/podioVersion.h"

//#include "streamlog/streamlog.h"


Expand Down Expand Up @@ -76,8 +78,12 @@ namespace MarlinTrk {


MarlinKalTestTrack::MarlinKalTestTrack(MarlinKalTest* ktest)
: _ktest(ktest), _trackHitAtPositiveNDF(edm4hep::TrackerHit(0)) {

: _ktest(ktest),
#if PODIO_BUILD_VERSION < PODIO_VERSION(0, 17, 4)
_trackHitAtPositiveNDF(edm4hep::TrackerHit(0)) {
#else
_trackHitAtPositiveNDF(edm4hep::TrackerHit::makeEmpty()) {
#endif
_kaltrack = new TKalTrack() ;
_kaltrack->SetOwner() ;

Expand Down
7 changes: 7 additions & 0 deletions Service/TrackSystemSvc/src/MarlinTrkUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

#include "TMatrixD.h"

#include "podio/podioVersion.h"

#define MIN_NDF 6

namespace MarlinTrk {
Expand Down Expand Up @@ -492,9 +494,14 @@ namespace MarlinTrk {
///////////////////////////////////////////////////////

edm4hep::TrackState* trkStateAtLastHit = new edm4hep::TrackState() ;

edm4hep::TrackerHit lastHit = hits_in_fit.front().first;

#if PODIO_BUILD_VERSION < PODIO_VERSION(0, 17, 4)
edm4hep::TrackerHit last_constrained_hit(0);// = 0 ;
#else
auto last_constrained_hit = edm4hep::TrackerHit::makeEmpty();
#endif
marlintrk->getTrackerHitAtPositiveNDF(last_constrained_hit);

return_error = marlintrk->smooth(lastHit);
Expand Down
12 changes: 12 additions & 0 deletions Utilities/DataHelper/src/TrackExtended.cc
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
#include "DataHelper/ClusterExtended.h"
#include "DataHelper/TrackerHitExtended.h"
#include "DataHelper/TrackExtended.h"

#include "podio/podioVersion.h"

#include <math.h>
#include <iostream>

TrackExtended::TrackExtended( ) {
#if PODIO_BUILD_VERSION < PODIO_VERSION(0, 17, 4)
_track = NULL;
#else
_track = edm4hep::Track::makeEmpty();
#endif
_superCluster = NULL;
_trackerHitVector.clear();
_clusterVec.clear();
Expand All @@ -23,7 +31,11 @@ TrackExtended::TrackExtended(Track track) {
TrackExtended::TrackExtended( TrackerHitExtended * trackerhit) {
_trackerHitVector.clear();
_trackerHitVector.push_back(trackerhit);
#if PODIO_BUILD_VERSION < PODIO_VERSION(0, 17, 4)
_track = NULL;
#else
_track = edm4hep::Track::makeEmpty();
#endif
_superCluster = NULL;
_clusterVec.clear();
_group = NULL;
Expand Down

0 comments on commit cc6174b

Please sign in to comment.