21 #include "G4SDManager.hh"
22 #include "G4VProcess.hh"
23 #include "G4EventManager.hh"
25 #include "G4VProcess.hh"
38 oldVolume(0), lastId(0), lastTrack(0), eventno(0) {
44 edm::LogInfo(
"PLTSensitiveDetector") <<
"Criteria for Saving Tracker SimTracks: \n "
45 <<
" History: "<<energyHistoryCut<<
" MeV ; Persistency: "<< energyCut<<
" MeV\n"
46 <<
" Constructing a PLTSensitiveDetector with ";
51 std::vector<std::string> lvNames = clg.
logicalNames(name);
53 for (std::vector<std::string>::iterator it = lvNames.begin();
54 it != lvNames.end(); it++) {
55 edm::LogInfo(
"PLTSensitiveDetector")<< name <<
" attaching LV " << *it;
71 LogDebug(
"PLTSensitiveDetector") <<
" Entering a new Step "
72 << aStep->GetTotalEnergyDeposit() <<
" "
73 << aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName();
75 G4Track * gTrack = aStep->GetTrack();
76 if ((
unsigned int)(gTrack->GetTrackID()) !=
lastTrack) {
78 if (gTrack->GetKineticEnergy() >
energyCut){
88 if (aStep->GetTotalEnergyDeposit()>0.) {
89 if (
newHit(aStep) ==
true) {
102 unsigned int detId = 0;
104 LogDebug(
"PLTSensitiveDetector")<<
" DetID = "<<detId;
111 LogDebug(
"PLTSensitiveDetector")<<
" Saving the last hit in a ROU " <<
myName;
139 float theEnergyLoss = aStep->GetTotalEnergyDeposit()/GeV;
145 LogDebug(
"PLTSensitiveDetector") <<
" Updating: new exitpoint " <<
pname <<
" "
146 << theExitPoint <<
" new energy loss " << theEnergyLoss
155 G4Track * theTrack = aStep->GetTrack();
157 unsigned int theTrackID = theTrack->GetTrackID();
160 <<
"), new = (" << theDetUnitId <<
"," << theTrackID <<
") return "
170 const float tolerance = 0.05 * mm;
186 G4Track * theTrack = aStep->GetTrack();
187 G4VPhysicalVolume *
v = aStep->GetPreStepPoint()->GetPhysicalVolume();
192 float thePabs = aStep->GetPreStepPoint()->GetMomentum().mag()/GeV;
193 float theTof = aStep->GetPreStepPoint()->GetGlobalTime()/nanosecond;
194 float theEnergyLoss = aStep->GetTotalEnergyDeposit()/GeV;
200 pname = theTrack->GetDynamicParticle()->GetDefinition()->GetParticleName();
202 unsigned int theTrackID = theTrack->GetTrackID();
204 G4ThreeVector gmd = aStep->GetPreStepPoint()->GetMomentumDirection();
206 G4ThreeVector lmd = ((G4TouchableHistory *)(aStep->GetPreStepPoint()->GetTouchable()))->GetHistory()->GetTopTransform().TransformAxis(gmd);
208 float theThetaAtEntry = lnmd.
theta();
209 float thePhiAtEntry = lnmd.
phi();
212 theEnergyLoss,theParticleType,theDetUnitId,
213 theTrackID,theThetaAtEntry,thePhiAtEntry,
216 LogDebug(
"PLTSensitiveDetector") <<
" Created PSimHit: " <<
pname <<
" "
230 eventno = (*i)()->GetEventID();
236 const G4Track* gTrack = (*bot)();
237 pname = gTrack->GetDynamicParticle()->GetDefinition()->GetParticleName();
245 G4VUserTrackInformation*
temp = gTrack->GetUserInformation();
247 edm::LogError(
"PLTSensitiveDetector") <<
" ERROR: no G4VUserTrackInformation available";
252 edm::LogError(
"PLTSensitiveDetector") <<
" ERROR: TkSimTrackSelection: the UserInformation does not appear to be a TrackInformation";
T getParameter(std::string const &) const
UpdatablePSimHit * mySimHit
virtual void createHit(G4Step *)
std::vector< std::string > logicalNames(std::string &readoutName)
G4TrackToParticleID * myG4TrackToParticleID
void update(const BeginOfEvent *)
This routine will be called when the appropriate signal arrives.
Local3DPoint ConvertToLocal3DPoint(G4ThreeVector point)
virtual ~PLTSensitiveDetector()
Geom::Phi< T > phi() const
TrackInformation * getOrCreateTrackInformation(const G4Track *)
void setExitPoint(const Local3DPoint &exit)
G4ProcessTypeEnumerator * theG4ProcessTypeEnumerator
G4VPhysicalVolume * oldVolume
type of data representation of DDCompactView
virtual bool newHit(G4Step *)
Geom::Theta< T > theta() const
virtual bool closeHit(G4Step *)
std::vector< PSimHit > & hits()
Local3DPoint exitPoint() const
Exit point in the local Det frame.
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
virtual void Initialize()
virtual void updateHit(G4Step *)
void fillHits(edm::PSimHitContainer &, std::string use)
int particleID(const G4Track *)
virtual uint32_t setDetUnitId(G4Step *)
void addEnergyLoss(float eloss)
unsigned int processId(const G4VProcess *)
Local3DPoint globalEntryPoint
virtual void AssignSD(std::string &vname)
float energyLoss() const
The energy deposit in the PSimHit, in ???.
virtual void EndOfEvent(G4HCofThisEvent *)
unsigned int trackId() const
virtual bool ProcessHits(G4Step *, G4TouchableHistory *)
virtual bool processHits(const PSimHit &)
PLTSensitiveDetector(std::string, const DDCompactView &, SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
std::vector< PSimHit > PSimHitContainer
Local3DPoint globalExitPoint
Local3DPoint FinalStepPosition(G4Step *s, coordinates)
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Local3DPoint InitialStepPosition(G4Step *s, coordinates)
unsigned int detUnitId() const