Skip to content
Snippets Groups Projects
Commit 4fa0c3de authored by lintao@ihep.ac.cn's avatar lintao@ihep.ac.cn
Browse files

WIP: add collections for trackers, including FTD, SIT, TPC, SET.

parent 8d5d2a5a
No related branches found
No related tags found
No related merge requests found
...@@ -36,6 +36,10 @@ ExampleAnaElemTool::EndOfEventAction(const G4Event* anEvent) { ...@@ -36,6 +36,10 @@ ExampleAnaElemTool::EndOfEventAction(const G4Event* anEvent) {
// create collections. // create collections.
auto trackercols = m_trackerCol.createAndPut(); auto trackercols = m_trackerCol.createAndPut();
auto vxdcols = m_VXDCol.createAndPut(); auto vxdcols = m_VXDCol.createAndPut();
auto ftdcols = m_FTDCol.createAndPut();
auto sitcols = m_SITCol.createAndPut();
auto tpccols = m_TPCCol.createAndPut();
auto setcols = m_SETCol.createAndPut();
// readout defined in DD4hep // readout defined in DD4hep
auto lcdd = &(dd4hep::Detector::getInstance()); auto lcdd = &(dd4hep::Detector::getInstance());
...@@ -72,6 +76,14 @@ ExampleAnaElemTool::EndOfEventAction(const G4Event* anEvent) { ...@@ -72,6 +76,14 @@ ExampleAnaElemTool::EndOfEventAction(const G4Event* anEvent) {
if (collect->GetName() == "VXDCollection") { if (collect->GetName() == "VXDCollection") {
tracker_col_ptr = vxdcols; tracker_col_ptr = vxdcols;
} else if (collect->GetName() == "FTDCollection") {
tracker_col_ptr = ftdcols;
} else if (collect->GetName() == "SITCollection") {
tracker_col_ptr = sitcols;
} else if (collect->GetName() == "TPCCollection") {
tracker_col_ptr = tpccols;
} else if (collect->GetName() == "SETCollection") {
tracker_col_ptr = setcols;
} else { } else {
tracker_col_ptr = trackercols; tracker_col_ptr = trackercols;
} }
...@@ -112,6 +124,9 @@ ExampleAnaElemTool::EndOfEventAction(const G4Event* anEvent) { ...@@ -112,6 +124,9 @@ ExampleAnaElemTool::EndOfEventAction(const G4Event* anEvent) {
if (coll2) { if (coll2) {
info() << " cast to G4THitsCollection<dd4hep::sim::Geant4Hit>. " << endmsg; info() << " cast to G4THitsCollection<dd4hep::sim::Geant4Hit>. " << endmsg;
int n_trk_hit = 0;
int n_cal_hit = 0;
for(size_t i=0; i<nhits; ++i) { for(size_t i=0; i<nhits; ++i) {
dd4hep::sim::Geant4Hit* h = dynamic_cast<dd4hep::sim::Geant4Hit*>(coll2->GetHit(i)); dd4hep::sim::Geant4Hit* h = dynamic_cast<dd4hep::sim::Geant4Hit*>(coll2->GetHit(i));
if (!h) { if (!h) {
...@@ -121,8 +136,7 @@ ExampleAnaElemTool::EndOfEventAction(const G4Event* anEvent) { ...@@ -121,8 +136,7 @@ ExampleAnaElemTool::EndOfEventAction(const G4Event* anEvent) {
dd4hep::sim::Geant4TrackerHit* trk_hit = dynamic_cast<dd4hep::sim::Geant4TrackerHit*>(h); dd4hep::sim::Geant4TrackerHit* trk_hit = dynamic_cast<dd4hep::sim::Geant4TrackerHit*>(h);
if (trk_hit) { if (trk_hit) {
info() << " cast to dd4hep::sim::Geant4TrackerHit. " << endmsg; ++n_trk_hit;
// auto edm_trk_hit = trackercols->create(); // auto edm_trk_hit = trackercols->create();
auto edm_trk_hit = tracker_col_ptr->create(); auto edm_trk_hit = tracker_col_ptr->create();
...@@ -146,11 +160,15 @@ ExampleAnaElemTool::EndOfEventAction(const G4Event* anEvent) { ...@@ -146,11 +160,15 @@ ExampleAnaElemTool::EndOfEventAction(const G4Event* anEvent) {
dd4hep::sim::Geant4CalorimeterHit* cal_hit = dynamic_cast<dd4hep::sim::Geant4CalorimeterHit*>(h); dd4hep::sim::Geant4CalorimeterHit* cal_hit = dynamic_cast<dd4hep::sim::Geant4CalorimeterHit*>(h);
if (cal_hit) { if (cal_hit) {
info() << " cast to dd4hep::sim::Geant4CalorimeterHit. " << endmsg; ++n_cal_hit;
} }
} }
info() << n_trk_hit << " hits cast to dd4hep::sim::Geant4TrackerHit. " << endmsg;
info() << n_cal_hit << " hits cast to dd4hep::sim::Geant4CalorimeterHit. " << endmsg;
continue; continue;
} }
......
...@@ -39,6 +39,14 @@ private: ...@@ -39,6 +39,14 @@ private:
Gaudi::DataHandle::Writer, this}; Gaudi::DataHandle::Writer, this};
DataHandle<plcio::SimTrackerHitCollection> m_VXDCol{"VXDCollection", DataHandle<plcio::SimTrackerHitCollection> m_VXDCol{"VXDCollection",
Gaudi::DataHandle::Writer, this}; Gaudi::DataHandle::Writer, this};
DataHandle<plcio::SimTrackerHitCollection> m_FTDCol{"FTDCollection",
Gaudi::DataHandle::Writer, this};
DataHandle<plcio::SimTrackerHitCollection> m_SITCol{"SITCollection",
Gaudi::DataHandle::Writer, this};
DataHandle<plcio::SimTrackerHitCollection> m_TPCCol{"TPCCollection",
Gaudi::DataHandle::Writer, this};
DataHandle<plcio::SimTrackerHitCollection> m_SETCol{"SETCollection",
Gaudi::DataHandle::Writer, this};
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment