20 #include "G4TrackingManager.hh"
21 #include "G4EventManager.hh"
22 #include "G4VSteppingVerbose.hh"
23 #include "G4UnitsTable.hh"
28 theTrackingManager(0), fVerbose(0) {
49 G4cout <<
"TV: fTVTrackMin " << fTVTrackMin
50 <<
" fTVTrackMax " << fTVTrackMax
51 <<
" fTVTrackStep " << fTVTrackStep
52 <<
" fTVEventMin " << fTVEventMin
53 <<
" fTVEventMax " << fTVEventMax
54 <<
" fTVEventStep " << fTVEventStep
55 <<
" fVerboseLevel " << fVerboseLevel
56 <<
" fG4Verbose " << fG4Verbose
57 <<
" PDGIds " << fPdgIds.size() << G4endl;
58 for (
unsigned int ii=0;
ii<fPdgIds.size(); ++
ii)
59 G4cout <<
"TV: PDGId[" <<
ii <<
"] = " << fPdgIds[
ii] << G4endl;
66 G4cout <<
" TrackingVerbose constructed " << G4endl;
73 dynamic_cast<TrackingAction*
>(G4EventManager::GetEventManager()->GetUserTrackingAction());
75 fVerbose = G4VSteppingVerbose::GetInstance();
78 <<
" and the SteppingVerbose: " <<
fVerbose << G4endl;
83 const G4Event * anEvent = (*evt)();
84 if (anEvent==0)
return;
87 int eventNo = anEvent->GetEventID();
88 if (
fDEBUG) G4cout <<
"TV: trackID: NEW EVENT " << eventNo << G4endl;
105 if (
fDEBUG) G4cout <<
"TV: VERBOSEet1 " << eventNo << G4endl;
110 if (
fDEBUG) G4cout <<
"TV: VERBOSEet0 " << eventNo << G4endl;
116 const G4Track * aTrack = (*trk)();
121 double tkP = aTrack->GetMomentum().mag();
122 double tkPx = aTrack->GetMomentum().x();
123 double tkPy = aTrack->GetMomentum().y();
124 double tkPz = aTrack->GetMomentum().z();
126 double tvtx = aTrack->GetVertexPosition().x();
127 double tvty = aTrack->GetVertexPosition().y();
128 double tvtz = aTrack->GetVertexPosition().z();
130 double g4t_phi=atan2(tkPy,tkPx);
132 double drpart=
sqrt(tkPx*tkPx + tkPy*tkPy);
134 double mythetapart=acos(tkPz/
sqrt(drpart*drpart+tkPz*tkPz));
136 double g4t_eta=-
log(
tan(mythetapart/2.));
137 G4int MytrackNo = aTrack->GetTrackID();
140 if (aTrack->GetDefinition()->GetParticleName() ==
"gamma" && aTrack->GetParentID() !=0) {
141 if((tkPx*tkPx + tkPy*tkPy + tkPz*tkPz)>1000.0*1000.0 &&
142 aTrack->GetCreatorProcess()->GetProcessName() ==
"LCapture") {
143 G4cout <<
"MY NEW GAMMA " << G4endl;
144 G4cout <<
"**********************************************************************" << G4endl;
145 G4cout <<
"MY NEW TRACK ID = " << MytrackNo <<
"("
146 << aTrack->GetDefinition()->GetParticleName()
147 <<
")"<<
" PARENT ="<< aTrack->GetParentID() << G4endl;
148 G4cout <<
"Primary particle: "
149 << aTrack->GetDynamicParticle()->GetPrimaryParticle() << G4endl;
150 G4cout <<
"Process type: " << aTrack->GetCreatorProcess()->GetProcessType()
152 << aTrack->GetCreatorProcess()->GetProcessName() << G4endl;
153 G4cout <<
"ToT E = " << aTrack->GetTotalEnergy()
154 <<
" KineE = " << aTrack->GetKineticEnergy()
155 <<
" Tot P = " << tkP <<
" Pt = " <<
sqrt(tkPx*tkPx + tkPy*tkPy)
156 <<
" VTX=(" << tvtx <<
"," << tvty <<
"," << tvtz <<
")" << G4endl;
157 if (aTrack->GetKineticEnergy() > 1.*GeV
158 && aTrack->GetCreatorProcess()->GetProcessName() !=
"LCapture")
159 G4cout <<
" KineE > 1 GeV !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << G4endl;
160 const G4VTouchable* touchable=aTrack->GetTouchable();
161 if (touchable!=0 && touchable->GetVolume()!=0 &&
162 touchable->GetVolume()->GetLogicalVolume()!=0) {
163 G4Material* material=touchable->GetVolume()->GetLogicalVolume()->GetMaterial();
164 G4cout <<
"G4LCapture Gamma E(GeV) "
165 << aTrack->GetTotalEnergy()/GeV <<
" "
166 << material->GetName()<<
" "
167 << touchable->GetVolume()->GetName() << G4endl;
168 G4cout <<
"G4LCapture Gamma position(m): "
169 << aTrack->GetPosition()/
m << G4endl;
170 G4cout <<
"G4LCapture created Gamma direction "
171 << aTrack->GetMomentumDirection() << G4endl;
172 G4cout <<
"G4LCapture gamma (eta,phi) = "
173 <<
"(" << g4t_eta <<
"," << g4t_phi <<
")" << G4endl;
175 aTrack->GetUserInformation()->Print();
176 G4cout <<
"**********************************************************************" << G4endl;
180 if (aTrack->GetDefinition()->GetParticleName() ==
"gamma") {
181 const G4VProcess *
proc = aTrack->GetCreatorProcess();
182 double Tgamma = aTrack->GetKineticEnergy();
185 if (proc) ProcName = proc->GetProcessName();
186 else ProcName = nullstr;
187 if (Tgamma > 2.5*GeV ) {
190 G4Material * material = 0;
191 G4VPhysicalVolume * pvolume = 0;
192 G4LogicalVolume * lvolume = 0;
193 const G4VTouchable * touchable = aTrack->GetTouchable();
194 if (touchable) pvolume = touchable->GetVolume();
196 volumeName = pvolume->GetName();
197 lvolume = pvolume->GetLogicalVolume();
199 if (lvolume) material = lvolume->GetMaterial();
200 if (material) materialName = material->GetName();
201 G4cout <<
"**** ALL photons > 2.5 GeV ****" << G4endl;
202 G4cout << ProcName <<
"**** ALL photons: gamma E(GeV) "
203 << aTrack->GetTotalEnergy()/GeV <<
" "
204 << materialName <<
" " << volumeName << G4endl;
205 G4cout << ProcName <<
"**** ALL photons: gamma position(m): "
206 << aTrack->GetPosition()/
m << G4endl;
207 G4cout << ProcName <<
"**** ALL photons: gamma direction "
208 << aTrack->GetMomentumDirection() << G4endl;
209 G4cout <<
"**********************************************************************" << G4endl;
223 if (
fDEBUG) G4cout <<
"TV: VERBOSEtt1 " << aTrack->GetTrackID()
229 if (
fDEBUG) G4cout <<
"TV: VERBOSEtt0 " << aTrack->GetTrackID()
236 const G4Track * aTrack = (*trk)();
243 if (
fDEBUG) G4cout <<
"TV: VERBOSEtt0 " << aTrack->GetTrackID()
252 G4Track* fTrack = fStep->GetTrack();
253 G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() <<
" "
254 << std::setw( 8) << G4BestUnit(fTrack->GetPosition().x() ,
"Length") <<
" "
255 << std::setw( 8) << G4BestUnit(fTrack->GetPosition().y() ,
"Length") <<
" "
256 << std::setw( 8) << G4BestUnit(fTrack->GetPosition().z() ,
"Length") <<
" "
257 << std::setw( 9) << G4BestUnit(fTrack->GetKineticEnergy() ,
"Energy") <<
" "
258 << std::setw( 8) << G4BestUnit(fStep->GetTotalEnergyDeposit(),
"Energy") <<
" "
259 << std::setw( 8) << G4BestUnit(fStep->GetStepLength() ,
"Length") <<
" "
260 << std::setw( 9) << G4BestUnit(fTrack->GetTrackLength() ,
"Length") <<
" "
261 << std::setw( 9) << G4BestUnit(fTrack->GetGlobalTime(),
"Time") <<
" ";
264 if( fTrack->GetNextVolume() != 0 ) {
265 G4cout << std::setw(11) << fTrack->GetNextVolume()->GetName() <<
" ";
267 G4cout << std::setw(11) <<
"OutOfWorld" <<
" ";
269 if(fStep->GetPostStepPoint()->GetProcessDefinedStep() !=
NULL){
270 G4cout << fStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName();
272 G4cout <<
"User Limit";
279 if (
fDEBUG) G4cout <<
" setting verbose level " << verblev << G4endl;
284 int trackNo = aTrack->GetTrackID();
285 bool trackingVerboseThisTrack =
false;
290 if (trackingVerboseThisTrack && (
fPdgIds.size()>0)) {
291 int pdgId = aTrack->GetDefinition()->GetPDGEncoding();
294 return trackingVerboseThisTrack;
299 <<
"*******************************************************"
300 <<
"**************************************************" << G4endl
301 <<
"* G4Track Information: "
302 <<
" Particle = " << aTrack->GetDefinition()->GetParticleName()
304 <<
" Track ID = " << aTrack->GetTrackID()
306 <<
" Parent ID = " << aTrack->GetParentID() << G4endl
307 <<
"*******************************************************"
308 <<
"**************************************************"
T getUntrackedParameter(std::string const &, T const &) const
TrainProcessor *const proc
std::vector< int > fPdgIds
bool checkTrackingVerbose(const G4Track *)
void printTrackInfo(const G4Track *)
G4TrackingManager * theTrackingManager
G4TrackingManager * getTrackManager()
Tan< T >::type tan(const T &t)
G4VSteppingVerbose * fVerbose
void update(const BeginOfRun *)
This routine will be called when the appropriate signal arrives.
void setTrackingVerbose(int verblev)
TrackingVerboseAction(edm::ParameterSet const &p)