Skip to content

Commit

Permalink
save the data in DriftChamberSensitiveDetector
Browse files Browse the repository at this point in the history
  • Loading branch information
wenxingfang committed Nov 9, 2023
1 parent 3aac145 commit 0cbb043
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 25 deletions.
16 changes: 1 addition & 15 deletions Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ Edm4hepWriterAnaElemTool::BeginOfEventAction(const G4Event* anEvent) {
m_track2primary.clear();

auto SimPIonCol = m_SimPrimaryIonizationCol.createAndPut();
if(hasTrackHeedSimTool){
debug() << "reset TrackHeedSimTool" << endmsg;
m_TrackHeedSimTool->reset();
}

}

Expand All @@ -102,11 +98,7 @@ Edm4hepWriterAnaElemTool::EndOfEventAction(const G4Event* anEvent) {
msg() << "mcCol size (after simulation) : " << mcCol->size() << endmsg;
// save all data
auto SimPrimaryIonizationCol = m_SimPrimaryIonizationCol.get();
msg() << "SimPrimaryIonizationCol size ="<<SimPrimaryIonizationCol->size()<<endmsg;
if(hasTrackHeedSimTool){
debug() << "call endOfEvent() for TrackHeedSimTool" << endmsg;
m_TrackHeedSimTool->endOfEvent();
}
//msg() << "SimPrimaryIonizationCol size ="<<SimPrimaryIonizationCol->size()<<endmsg;
// create collections.
auto trackercols = m_trackerCol.createAndPut();
auto calorimetercols = m_calorimeterCol.createAndPut();
Expand Down Expand Up @@ -573,12 +565,6 @@ StatusCode
Edm4hepWriterAnaElemTool::initialize() {
StatusCode sc;

m_TrackHeedSimTool = ToolHandle<IDedxSimTool>("TrackHeedSimTool",nullptr,false);
if(m_TrackHeedSimTool){
msg() << "find TrackHeedSimTool" << endmsg;
hasTrackHeedSimTool = true;
}

return sc;
}

Expand Down
3 changes: 0 additions & 3 deletions Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "edm4hep/SimCalorimeterHitCollection.h"
#include "edm4hep/CaloHitContributionCollection.h"
#include "edm4hep/SimPrimaryIonizationClusterCollection.h"
#include <DetSimInterface/IDedxSimTool.h>

class Edm4hepWriterAnaElemTool: public extends<AlgTool, IAnaElemTool> {

Expand Down Expand Up @@ -156,8 +155,6 @@ class Edm4hepWriterAnaElemTool: public extends<AlgTool, IAnaElemTool> {
double Z = 0;

bool verboseOutput = false;
ToolHandle<IDedxSimTool> m_TrackHeedSimTool;
bool hasTrackHeedSimTool = false;
};

#endif
10 changes: 5 additions & 5 deletions Simulation/DetSimDedx/src/TrackHeedSimTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,19 @@ class TrackHeedSimTool: public extends<AlgTool, IDedxSimTool> {
Sensor* m_sensor;
std::map<int, std::string> m_particle_map;

int m_previous_track_ID;
float m_previous_KE;
int m_previous_track_ID=0;
float m_previous_KE=0;
int m_current_track_ID;
int m_current_Parent_ID;
int m_pdg_code;
G4StepPoint* m_pre_point;
G4StepPoint* m_post_point;
G4double m_total_range;
bool m_isFirst;
bool m_isFirst=true;
bool m_change_track;
edm4hep::MCParticle m_mc_paricle;
float m_tot_edep;
float m_tot_length;
float m_tot_edep=0;
float m_tot_length=0;
float m_pa_KE;

G4double m_pre_x ;
Expand Down
1 change: 0 additions & 1 deletion Simulation/DetSimSD/src/DriftChamberSensDetTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ StatusCode DriftChamberSensDetTool::initialize() {
error() << "Failed to find dedx simtoo." << endmsg;
return StatusCode::FAILURE;
}

return sc;
}

Expand Down
3 changes: 2 additions & 1 deletion Simulation/DetSimSD/src/DriftChamberSensitiveDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,6 @@ DriftChamberSensitiveDetector::ProcessHits(G4Step* step, G4TouchableHistory*) {

void
DriftChamberSensitiveDetector::EndOfEvent(G4HCofThisEvent* HCE) {

m_dedx_simtool->endOfEvent();
m_dedx_simtool->reset();
}

0 comments on commit 0cbb043

Please sign in to comment.