diff --git a/DDG4/include/DDG4/Geant4StepHandler.h b/DDG4/include/DDG4/Geant4StepHandler.h index 3322e3b1203de641c9aa2293fc0ab0484c5e95f1..2765fed6977e251d7e3de5c8355059c86cd41618 100644 --- a/DDG4/include/DDG4/Geant4StepHandler.h +++ b/DDG4/include/DDG4/Geant4StepHandler.h @@ -59,8 +59,14 @@ namespace dd4hep { track = s->GetTrack(); applyBirksLaw = false; } + /// No copy constructor + Geant4StepHandler(const Geant4StepHandler& copy) = delete; + /// No move constructor + Geant4StepHandler(Geant4StepHandler&& copy) = delete; /// Assignment operator inhibited. Should not be copied Geant4StepHandler& operator=(const Geant4StepHandler& copy) = delete; + /// Move operator inhibited. Should not be copied + Geant4StepHandler& operator=(Geant4StepHandler&& copy) = delete; G4ParticleDefinition* trackDef() const { return track->GetDefinition(); diff --git a/DDG4/plugins/Geant4TrackerWeightedSD.cpp b/DDG4/plugins/Geant4TrackerWeightedSD.cpp index 74496c7d5afc11e775167a8a0894544fd8b6286d..22b408bab7a18f47e6e495e392b860ee1332bc37 100644 --- a/DDG4/plugins/Geant4TrackerWeightedSD.cpp +++ b/DDG4/plugins/Geant4TrackerWeightedSD.cpp @@ -118,11 +118,11 @@ namespace dd4hep { /// Start a new hit TrackerWeighted& start(const G4Step* step, const G4StepPoint* point) { - if( DEBUG == printLevel() ) { - std::cout<<" DEBUG: Geant4TrackerWeightedSD::start(const G4Step* step, const G4StepPoint* point) ...."<<std::endl; - Geant4StepHandler h(step); - dumpStep( h, step); - } + if( DEBUG == printLevel() ) { + std::cout<<" DEBUG: Geant4TrackerWeightedSD::start(const G4Step* step, const G4StepPoint* point) ...."<<std::endl; + Geant4StepHandler h(step); + dumpStep( h, step); + } clear(); pre.storePoint(step,point); @@ -142,11 +142,11 @@ namespace dd4hep { /// Update energy and track information during hit info accumulation TrackerWeighted& update(const G4Step* step) { - if( DEBUG == printLevel() ) { - std::cout<<" DEBUG: Geant4TrackerWeightedSD::update(const G4Step* step) ...."<<std::endl; - Geant4StepHandler h(step); - dumpStep( h, step); - } + if( DEBUG == printLevel() ) { + std::cout<<" DEBUG: Geant4TrackerWeightedSD::update(const G4Step* step) ...."<<std::endl; + Geant4StepHandler h(step); + dumpStep( h, step); + } post.storePoint(step,step->GetPostStepPoint()); Position mean = (post.position+pre.position)*0.5; @@ -196,10 +196,10 @@ namespace dd4hep { } void extractHit(Geant4HitCollection* collection, EInside ended) { - if( DEBUG == printLevel() ) { - std::cout<<" DEBUG: Geant4TrackerWeightedSD::extractHit(Geant4HitCollection* collection, EInside ended) ...."<<std::endl; - std::cout<<" DEBUG: =================================================="<<std::endl; - } + if( DEBUG == printLevel() ) { + std::cout<<" DEBUG: Geant4TrackerWeightedSD::extractHit(Geant4HitCollection* collection, EInside ended) ...."<<std::endl; + std::cout<<" DEBUG: =================================================="<<std::endl; + } double deposit = pre.truth.deposit; if ( current != -1 ) { @@ -267,13 +267,13 @@ namespace dd4hep { /// Method for generating hit(s) using the information of G4Step object. G4bool process(const G4Step* step, G4TouchableHistory* ) { Geant4StepHandler h(step); - if( DEBUG == printLevel() ) { - std::cout<<" DEBUG: Geant4TrackerWeightedSD::process(const G4Step* step, G4TouchableHistory* ) ...."<<std::endl; - dumpStep( h, step); - } + if( DEBUG == printLevel() ) { + std::cout<<" DEBUG: Geant4TrackerWeightedSD::process(const G4Step* step, G4TouchableHistory* ) ...."<<std::endl; + dumpStep( h, step); + } - // std::cout << " process called - pre pos: " << h.prePos() << " post pos " << h.postPos() - // << " edep: " << h.deposit() << std::endl ; + // std::cout << " process called - pre pos: " << h.prePos() << " post pos " << h.postPos() + // << " edep: " << h.deposit() << std::endl ; G4VSolid* preSolid = h.solid(h.pre); G4VSolid* postSolid = h.solid(h.post); @@ -289,11 +289,11 @@ namespace dd4hep { G4VSolid* solid = (preSD == thisSD) ? preSolid : postSolid; // Track went into new Volume, extracted the hit in prePV, then start a new hit in thisPV. if ( current == h.trkID() && thisPV != 0 && prePV != thisPV ) { - if( DEBUG == printLevel() ) { - std::cout<<" DEBUG: Geant4TrackerWeightedSD: if ( current == h.trkID() && thisPV != 0 && prePV != thisPV )," - <<" Track went into new Volume, extracted the hit in prePV, then start a new hit in thisPV." - << std::endl; - } + if( DEBUG == printLevel() ) { + std::cout<<" DEBUG: Geant4TrackerWeightedSD: if ( current == h.trkID() && thisPV != 0 && prePV != thisPV )," + <<" Track went into new Volume, extracted the hit in prePV, then start a new hit in thisPV." + << std::endl; + } extractHit(post_inside); start(step, h.pre); } @@ -405,22 +405,25 @@ namespace dd4hep { } ///dumpStep - void dumpStep( Geant4StepHandler h, const G4Step* s){ - - std::cout << " ----- step in detector " << h.sdName( s->GetPreStepPoint() ) - << " prePos " << h.prePos() - << " postPos " << h.postPos() - << " preStatus " << h.preStepStatus() - << " postStatus " << h.postStepStatus() - << " preVolume " << h.volName( s->GetPreStepPoint() ) - << " postVolume " << h.volName( s->GetPostStepPoint() ) - << std::endl - << " momentum : " << std::scientific - << s->GetPreStepPoint()->GetMomentum()[0] << ", " << s->GetPreStepPoint()->GetMomentum()[1]<< ", " << s->GetPreStepPoint()->GetMomentum()[2] - << " / " - << s->GetPostStepPoint()->GetMomentum()[0] << ", " << s->GetPostStepPoint()->GetMomentum()[1]<< ", " << s->GetPostStepPoint()->GetMomentum()[2] - << ", PDG: " << s->GetTrack()->GetDefinition()->GetPDGEncoding() - << std::endl ; + void dumpStep(const Geant4StepHandler& h, const G4Step* s) { + std::cout << " ----- step in detector " << h.sdName( s->GetPreStepPoint() ) + << " prePos " << h.prePos() + << " postPos " << h.postPos() + << " preStatus " << h.preStepStatus() + << " postStatus " << h.postStepStatus() + << " preVolume " << h.volName( s->GetPreStepPoint() ) + << " postVolume " << h.volName( s->GetPostStepPoint() ) + << std::endl + << " momentum : " << std::scientific + << s->GetPreStepPoint()->GetMomentum()[0] << ", " + << s->GetPreStepPoint()->GetMomentum()[1]<< ", " + << s->GetPreStepPoint()->GetMomentum()[2] + << " / " + << s->GetPostStepPoint()->GetMomentum()[0] << ", " + << s->GetPostStepPoint()->GetMomentum()[1] << ", " + << s->GetPostStepPoint()->GetMomentum()[2] + << ", PDG: " << s->GetTrack()->GetDefinition()->GetPDGEncoding() + << std::endl ; } }; diff --git a/examples/ClientTests/ref/Check_Shape_PseudoTrap.xml b/examples/ClientTests/ref/Check_Shape_PseudoTrap.xml new file mode 100644 index 0000000000000000000000000000000000000000..671f134afaba6df83f59ddfa1dc02373a551d5b2 --- /dev/null +++ b/examples/ClientTests/ref/Check_Shape_PseudoTrap.xml @@ -0,0 +1,24 @@ +<lccdd> + <includes> + <gdmlFile ref="CheckShape.xml"/> + </includes> + + <detectors> + <detector id="1" name="Shape_PseudoTrap" type="DD4hep_TestShape_Creator"> + <check vis="Shape1_vis"> + <shape type="PseudoTrap" z="30*cm" radius="10*cm" + x1="10*cm" x2="3*cm" y1="30*cm" y2="10*cm" minusZ="false"/> + <position x="30*cm" y="30*cm" z="50*cm"/> + <rotation x="0" y="0" z="0"/> + </check> + + <check vis="Shape2_vis"> + <shape type="PseudoTrap" z="30*cm" radius="5*cm" + x1="3*cm" x2="10*cm" y1="30*cm" y2="10*cm" minusZ="true"/> + <position x="30*cm" y="30*cm" z="-50*cm"/> + <rotation x="0" y="0" z="0"/> + </check> + <test type="DD4hep_Mesh_Verifier" ref="${DD4hepINSTALL}/examples/ClientTests/ref/Ref_PseudoTrap.txt" create="CheckShape_create"/> + </detector> + </detectors> +</lccdd>