Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Fix compilation with EDM4hep #271

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Analysis/TrackInspect/src/TrackInspectAlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ StatusCode TrackInspectAlg::execute(){
for (auto relCol: relCols) {
if (relCol){
for (auto rel: *relCol){
std::pair<edm4hep::TrackerHit, edm4hep::MCParticle> p = std::make_pair(rel.getRec(), rel.getSim().getMCParticle());
std::pair<edm4hep::TrackerHit3D, edm4hep::MCParticle> p = std::make_pair(rel.getRec(), rel.getSim().getMCParticle());
if (hitmap.find(p) == hitmap.end()) hitmap[p] = 0.;
hitmap[p] += rel.getWeight();
}
Expand Down Expand Up @@ -212,9 +212,9 @@ double TrackInspectAlg::match(edm4hep::MCParticle particle, edm4hep::Track track
double matchedHits = 0;
double usedHits = 0;
for (int i = 0; i < NHits; i++) {
edm4hep::TrackerHit hit = track.getTrackerHits(i);
edm4hep::TrackerHit3D hit = track.getTrackerHits(i);
usedHits++;
std::pair<edm4hep::TrackerHit, edm4hep::MCParticle> ele = std::make_pair(hit, particle);
std::pair<edm4hep::TrackerHit3D, edm4hep::MCParticle> ele = std::make_pair(hit, particle);
//std::cout << "lookup --> " << ele.first << std::endl;
//if (hitmap.find(ele) != hitmap.end() ) {
//std::cout << "find --> " << hitmap[ele] << std::endl;
Expand Down
16 changes: 15 additions & 1 deletion Analysis/TrackInspect/src/TrackInspectAlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,25 @@
#include "GaudiKernel/Algorithm.h"

#include "edm4hep/TrackCollection.h"
#if __has_include("edm4hep/TrackerHit3D.h")
#include "edm4hep/TrackerHit3D.h"
#else
#include "edm4hep/TrackerHit.h"
namespace edm4hep {
using TrackerHit3D = edm4hep::TrackerHit;
} // namespace edm4hep
#endif
#include "edm4hep/MCParticle.h"
#include "edm4hep/MCParticleCollection.h"
#include "edm4hep/SimTrackerHitCollection.h"
#if __has_include("edm4hep/TrackerHit3DCollection.h")
#include "edm4hep/TrackerHit3DCollection.h"
#else
#include "edm4hep/TrackerHitCollection.h"
namespace edm4hep {
using TrackerHit3DCollection = edm4hep::TrackerHitCollection;
} // namespace edm4hep
#endif
#include "edm4hep/MCRecoTrackerAssociationCollection.h"

#include "GaudiKernel/NTuple.h"
Expand Down Expand Up @@ -42,7 +56,7 @@ class TrackInspectAlg : public Algorithm {
Gaudi::Property<bool> _useSET{this, "useSET", true};
Gaudi::Property<bool> _useFTD{this, "useFTD", true};

std::map<std::pair<edm4hep::TrackerHit, edm4hep::MCParticle>, double> hitmap;
std::map<std::pair<edm4hep::TrackerHit3D, edm4hep::MCParticle>, double> hitmap;
std::vector<std::tuple<edm4hep::MCParticle, edm4hep::Track, double>> matchvec;
double match(edm4hep::MCParticle, edm4hep::Track);

Expand Down
2 changes: 1 addition & 1 deletion Digitisers/DCHDigi/src/DCHDigiAlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ StatusCode DCHDigiAlg::execute()

info() << "Processing " << _nEvt << " events " << endmsg;
if(m_WriteAna) m_evt = _nEvt;
edm4hep::TrackerHitCollection* Vec = w_DigiDCHCol.createAndPut();
edm4hep::TrackerHit3DCollection* Vec = w_DigiDCHCol.createAndPut();
edm4hep::MCRecoTrackerAssociationCollection* AssoVec = w_AssociationCol.createAndPut();
const edm4hep::SimTrackerHitCollection* SimHitCol = r_SimDCHCol.get();
if (SimHitCol->size() == 0) {
Expand Down
9 changes: 8 additions & 1 deletion Digitisers/DCHDigi/src/DCHDigiAlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@
#include "GaudiKernel/NTuple.h"
#include "GaudiAlg/GaudiAlgorithm.h"
#include "edm4hep/SimTrackerHitCollection.h"
#if __has_include("edm4hep/TrackerHit3DCollection.h")
#include "edm4hep/TrackerHit3DCollection.h"
#else
#include "edm4hep/TrackerHitCollection.h"
namespace edm4hep {
using TrackerHit3DCollection = edm4hep::TrackerHitCollection;
} // namespace edm4hep
#endif
#include "edm4hep/MCRecoTrackerAssociationCollection.h"
#include "edm4hep/MCParticle.h"

Expand Down Expand Up @@ -102,7 +109,7 @@ class DCHDigiAlg : public GaudiAlgorithm
// Input collections
DataHandle<edm4hep::SimTrackerHitCollection> r_SimDCHCol{"DriftChamberHitsCollection", Gaudi::DataHandle::Reader, this};
// Output collections
DataHandle<edm4hep::TrackerHitCollection> w_DigiDCHCol{"DigiDCHitCollection", Gaudi::DataHandle::Writer, this};
DataHandle<edm4hep::TrackerHit3DCollection> w_DigiDCHCol{"DigiDCHitCollection", Gaudi::DataHandle::Writer, this};
DataHandle<edm4hep::MCRecoTrackerAssociationCollection> w_AssociationCol{"DCHitAssociationCollection", Gaudi::DataHandle::Writer, this};
};

Expand Down
9 changes: 8 additions & 1 deletion Digitisers/SimpleDigi/src/CylinderDigiAlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@
#include "GaudiKernel/NTuple.h"
#include "GaudiAlg/GaudiAlgorithm.h"
#include "edm4hep/SimTrackerHitCollection.h"
#if __has_include("edm4hep/TrackerHit3DCollection.h")
#include "edm4hep/TrackerHit3DCollection.h"
#else
#include "edm4hep/TrackerHitCollection.h"
namespace edm4hep {
using TrackerHit3DCollection = edm4hep::TrackerHitCollection;
} // namespace edm4hep
#endif
#include "edm4hep/MCRecoTrackerAssociationCollection.h"

#include <DDRec/DetectorData.h>
Expand All @@ -28,7 +35,7 @@ class CylinderDigiAlg : public GaudiAlgorithm{
// Input collections
DataHandle<edm4hep::SimTrackerHitCollection> m_inputColHdls{"DriftChamberHitsCollection", Gaudi::DataHandle::Reader, this};
// Output collections
DataHandle<edm4hep::TrackerHitCollection> m_outputColHdls{"DCTrackerHits", Gaudi::DataHandle::Writer, this};
DataHandle<edm4hep::TrackerHit3DCollection> m_outputColHdls{"DCTrackerHits", Gaudi::DataHandle::Writer, this};
DataHandle<edm4hep::MCRecoTrackerAssociationCollection> m_assColHdls{"DCTrackerHitAssociationCollection", Gaudi::DataHandle::Writer, this};

Gaudi::Property<float> m_resRPhi{this, "ResRPhi", 0.1};
Expand Down
9 changes: 8 additions & 1 deletion Digitisers/SimpleDigi/src/PlanarDigiAlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
#include <gsl/gsl_rng.h>
#include "edm4hep/EventHeaderCollection.h"
#include "edm4hep/SimTrackerHitCollection.h"
#if __has_include("edm4hep/TrackerHit3DCollection.h")
#include "edm4hep/TrackerHit3DCollection.h"
#else
#include "edm4hep/TrackerHitCollection.h"
namespace edm4hep {
using TrackerHit3DCollection = edm4hep::TrackerHitCollection;
} // namespace edm4hep
#endif
#include "edm4hep/MCRecoTrackerAssociationCollection.h"

/** ======= PlanarDigiProcessor / PlanarDigiAlg ========== <br>
Expand Down Expand Up @@ -92,7 +99,7 @@ class PlanarDigiAlg : public GaudiAlgorithm
DataHandle<edm4hep::EventHeaderCollection> _headerCol{"EventHeaderCol", Gaudi::DataHandle::Reader, this};
DataHandle<edm4hep::SimTrackerHitCollection> _inColHdl{"VXDCollection", Gaudi::DataHandle::Reader, this};
// Output collections
DataHandle<edm4hep::TrackerHitCollection> _outColHdl{"VXDTrackerHits", Gaudi::DataHandle::Writer, this};
DataHandle<edm4hep::TrackerHit3DCollection> _outColHdl{"VXDTrackerHits", Gaudi::DataHandle::Writer, this};
DataHandle<edm4hep::MCRecoTrackerAssociationCollection> _outRelColHdl{"VXDTrackerHitRelations", Gaudi::DataHandle::Writer, this};
};

Expand Down
11 changes: 9 additions & 2 deletions Digitisers/SimpleDigi/src/TPCDigiAlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ Steve Aplin 26 June 2009 (DESY)
#include "k4FWCore/DataHandle.h"
#include "edm4hep/EventHeaderCollection.h"
#include "edm4hep/SimTrackerHitCollection.h"
#if __has_include("edm4hep/TrackerHit3DCollection.h")
#include "edm4hep/TrackerHit3DCollection.h"
#else
#include "edm4hep/TrackerHitCollection.h"
namespace edm4hep {
using TrackerHit3DCollection = edm4hep::TrackerHitCollection;
} // namespace edm4hep
#endif
#include "edm4hep/MCParticleCollection.h"
#include "edm4hep/MCRecoTrackerAssociationCollection.h"

Expand Down Expand Up @@ -164,9 +171,9 @@ class TPCDigiAlg: public GaudiAlgorithm{

/** Output collection name.
*/
DataHandle<edm4hep::TrackerHitCollection> _TPCTrackerHitsColHdl{"TPCTrackerHits", Gaudi::DataHandle::Writer, this};
DataHandle<edm4hep::TrackerHit3DCollection> _TPCTrackerHitsColHdl{"TPCTrackerHits", Gaudi::DataHandle::Writer, this};
DataHandle<edm4hep::MCRecoTrackerAssociationCollection> _TPCAssColHdl{"TPCTrackerHitAss", Gaudi::DataHandle::Writer, this};
edm4hep::TrackerHitCollection* _trkhitVec;
edm4hep::TrackerHit3DCollection* _trkhitVec;
edm4hep::MCRecoTrackerAssociationCollection* _relCol;

bool _use_raw_hits_to_store_simhit_pointer;
Expand Down
7 changes: 7 additions & 0 deletions Reconstruction/DCHDedx/src/RecDCHDedxAlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
#include "edm4hep/EventHeaderCollection.h"
#include "edm4hep/MCParticleCollection.h"
#include "edm4hep/SimTrackerHitCollection.h"
#if __has_include("edm4hep/TrackerHit3DCollection.h")
#include "edm4hep/TrackerHit3DCollection.h"
#else
#include "edm4hep/TrackerHitCollection.h"
namespace edm4hep {
using TrackerHit3DCollection = edm4hep::TrackerHitCollection;
} // namespace edm4hep
#endif
#include "edm4hep/TrackCollection.h"
#include "edm4hep/MCRecoTrackerAssociationCollection.h"
#include "edm4hep/MCRecoParticleAssociationCollection.h"
Expand Down
7 changes: 7 additions & 0 deletions Reconstruction/PFA/Arbor/src/ArborToolLCIO.hh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@
#include "edm4hep/ReconstructedParticleCollection.h"
#include "edm4hep/EventHeaderCollection.h"
#include "edm4hep/SimTrackerHitCollection.h"
#if __has_include("edm4hep/TrackerHit3DCollection.h")
#include "edm4hep/TrackerHit3DCollection.h"
#else
#include "edm4hep/TrackerHitCollection.h"
namespace edm4hep {
using TrackerHit3DCollection = edm4hep::TrackerHitCollection;
} // namespace edm4hep
#endif
#include "edm4hep/CalorimeterHitCollection.h"
#include "edm4hep/VertexCollection.h"
#include "edm4hep/TrackCollection.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@
#include "edm4hep/ReconstructedParticleCollection.h"
#include "edm4hep/EventHeaderCollection.h"
#include "edm4hep/SimTrackerHitCollection.h"
#if __has_include("edm4hep/TrackerHit3DCollection.h")
#include "edm4hep/TrackerHit3DCollection.h"
#else
#include "edm4hep/TrackerHitCollection.h"
namespace edm4hep {
using TrackerHit3DCollection = edm4hep::TrackerHitCollection;
} // namespace edm4hep
#endif
#include "edm4hep/CalorimeterHitCollection.h"
#include "edm4hep/VertexCollection.h"
#include "edm4hep/TrackCollection.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ void TrackCreator::TrackReachesECAL(const edm4hep::Track *const pTrack, PandoraA
for (unsigned int i = 0; i < nTrackHits; ++i)
{

const edm4hep::TrackerHit Hit ( pTrack->getTrackerHits(i) );
const edm4hep::TrackerHit3D Hit ( pTrack->getTrackerHits(i) );
const edm4hep::Vector3d pos = Hit.getPosition();

float x = float(pos[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@
#include "edm4hep/ReconstructedParticleCollection.h"
#include "edm4hep/EventHeaderCollection.h"
#include "edm4hep/SimTrackerHitCollection.h"
#if __has_include("edm4hep/TrackerHit3DCollection.h")
#include "edm4hep/TrackerHit3DCollection.h"
#else
#include "edm4hep/TrackerHitCollection.h"
namespace edm4hep {
using TrackerHit3DCollection = edm4hep::TrackerHitCollection;
} // namespace edm4hep
#endif
#include "edm4hep/CalorimeterHitCollection.h"
#include "edm4hep/VertexCollection.h"
#include "edm4hep/TrackCollection.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ void TrackCreator::TrackReachesECAL(edm4hep::Track *const pTrack, PandoraApi::Tr
for (unsigned int i = 0; i < nTrackHits; ++i)
{

const edm4hep::TrackerHit Hit ( pTrack->getTrackerHits(i) );
const edm4hep::TrackerHit3D Hit ( pTrack->getTrackerHits(i) );
const edm4hep::Vector3d pos = Hit.getPosition();

float x = float(pos[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ StatusCode TrackParticleRelationAlg::execute() {
}

// Prepare map from hit to MCParticle
std::map<edm4hep::TrackerHit, edm4hep::MCParticle> mapHitParticle;
std::map<edm4hep::TrackerHit3D, edm4hep::MCParticle> mapHitParticle;
debug() << "reading Association" << endmsg;
for (auto hdl : m_inAssociationColHdls) {
const edm4hep::MCRecoTrackerAssociationCollection* assCol = nullptr;
Expand Down Expand Up @@ -92,7 +92,7 @@ StatusCode TrackParticleRelationAlg::execute() {
}

if(trkCol) {
std::map<edm4hep::MCParticle, std::vector<edm4hep::TrackerHit> > mapParticleHits;
std::map<edm4hep::MCParticle, std::vector<edm4hep::TrackerHit3D> > mapParticleHits;

for (auto track: *trkCol) {
std::map<edm4hep::MCParticle, int> mapParticleNHits;
Expand Down Expand Up @@ -128,7 +128,7 @@ StatusCode TrackParticleRelationAlg::execute() {
}

if (msgLevel(MSG::DEBUG)) {
for (std::map<edm4hep::MCParticle, std::vector<edm4hep::TrackerHit> >::iterator it=mapParticleHits.begin(); it!=mapParticleHits.end(); it++) {
for (std::map<edm4hep::MCParticle, std::vector<edm4hep::TrackerHit3D> >::iterator it=mapParticleHits.begin(); it!=mapParticleHits.end(); it++) {
auto particle = it->first;
auto hits = it->second;
debug() << "=== MCPaticle ===" << particle << endmsg;
Expand Down
9 changes: 8 additions & 1 deletion Reconstruction/RecGenfitAlg/src/GenfitHit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@
#include "DD4hep/DetElement.h"
#include "DD4hep/Segmentations.h"
#include "DD4hep/DD4hepUnits.h"
#if __has_include("edm4hep/TrackerHit3D.h")
#include "edm4hep/TrackerHit3D.h"
#else
#include "edm4hep/TrackerHit.h"
namespace edm4hep {
using TrackerHit3D = edm4hep::TrackerHit;
} // namespace edm4hep
#endif
#include "edm4hep/SimTrackerHit.h"
#include "TRandom.h"

#include <iostream>

GenfitHit::GenfitHit(const edm4hep::TrackerHit* trackerHit,
GenfitHit::GenfitHit(const edm4hep::TrackerHit3D* trackerHit,
const edm4hep::SimTrackerHit* simTrackerHit,
const dd4hep::DDSegmentation::BitFieldCoder* decoder,
const dd4hep::DDSegmentation::GridDriftChamber* gridDriftChamber,
Expand Down
6 changes: 3 additions & 3 deletions Reconstruction/RecGenfitAlg/src/GenfitHit.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace dd4hep {

class GenfitHit{
public:
GenfitHit(const edm4hep::TrackerHit* trackerHit,
GenfitHit(const edm4hep::TrackerHit3D* trackerHit,
const edm4hep::SimTrackerHit* simTrackerHit,
const dd4hep::DDSegmentation::BitFieldCoder* decoder,
const dd4hep::DDSegmentation::GridDriftChamber* gridDriftChamber,
Expand All @@ -38,7 +38,7 @@ class GenfitHit{
double getDriftDistanceErr()const{return m_driftDistanceErr;}
double getDriftDistanceTruth()const{return m_driftDistanceTruth;}
const edm4hep::SimTrackerHit* getSimTrackerHit()const{return m_simTrackerHit;}
const edm4hep::TrackerHit* getTrackerHit()const{return m_trackerHit;}
const edm4hep::TrackerHit3D* getTrackerHit()const{return m_trackerHit;}
TVector3 getEnd0()const;
TVector3 getEnd1()const;
TVector3 getTruthPos()const;
Expand All @@ -54,7 +54,7 @@ class GenfitHit{
private:
const dd4hep::DDSegmentation::BitFieldCoder* m_decoder;
const dd4hep::DDSegmentation::GridDriftChamber* m_gridDriftChamber;
const edm4hep::TrackerHit* m_trackerHit;
const edm4hep::TrackerHit3D* m_trackerHit;
const edm4hep::SimTrackerHit* m_simTrackerHit;
double m_driftDistance;
double m_driftDistanceErr;
Expand Down
Loading
Loading