#include <SimG4Core/TrackingVerbose/interface/TrackingVerboseAction.h>
Public Member Functions | |
TrackingVerboseAction (edm::ParameterSet const &p) | |
void | update (const EndOfTrack *) |
This routine will be called when the appropriate signal arrives. | |
void | update (const BeginOfTrack *) |
This routine will be called when the appropriate signal arrives. | |
void | update (const BeginOfEvent *) |
This routine will be called when the appropriate signal arrives. | |
void | update (const BeginOfRun *) |
This routine will be called when the appropriate signal arrives. | |
~TrackingVerboseAction () | |
Private Member Functions | |
bool | checkTrackingVerbose (const G4Track *) |
void | printTrackInfo (const G4Track *) |
void | setTrackingVerbose (int verblev) |
Private Attributes | |
bool | fDEBUG |
bool | fHighEtPhotons |
int | fLarge |
bool | fTkVerbThisEventON |
bool | fTrackingVerboseON |
int | fTVEventMax |
int | fTVEventMin |
int | fTVEventStep |
int | fTVTrackMax |
int | fTVTrackMin |
int | fTVTrackStep |
G4VSteppingVerbose * | fVerbose |
int | fVerboseLevel |
G4TrackingManager * | theTrackingManager |
Definition at line 33 of file TrackingVerboseAction.h.
TrackingVerboseAction::TrackingVerboseAction | ( | edm::ParameterSet const & | p | ) |
Definition at line 27 of file TrackingVerboseAction.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), fDEBUG, fHighEtPhotons, fLarge, fTkVerbThisEventON, fTrackingVerboseON, fTVEventMax, fTVEventMin, fTVEventStep, fTVTrackMax, fTVTrackMin, fTVTrackStep, fVerboseLevel, edm::ParameterSet::getUntrackedParameter(), and int.
00027 : 00028 theTrackingManager(0), fVerbose(0) { 00029 00030 fLarge = int(1E10); 00031 fDEBUG = p.getUntrackedParameter<bool>("DEBUG",false); 00032 fHighEtPhotons = p.getUntrackedParameter<bool>("CheckForHighEtPhotons",false); 00033 00034 //----- Set which events are verbose 00035 fTVEventMin = p.getUntrackedParameter<int>("EventMin",0); 00036 fTVEventMax = p.getUntrackedParameter<int>("EventMax",fLarge); 00037 fTVEventStep = p.getUntrackedParameter<int>("EventStep",1); 00038 00039 //----- Set which tracks of those events are verbose 00040 fTVTrackMin = p.getUntrackedParameter<int>("TrackMin",0); 00041 fTVTrackMax = p.getUntrackedParameter<int>("TrackMax",fLarge); 00042 fTVTrackStep = p.getUntrackedParameter<int>("TrackStep",1); 00043 00044 //----- Set the verbosity level 00045 fVerboseLevel = p.getUntrackedParameter<int>("VerboseLevel",1); 00046 00047 if (fDEBUG) 00048 cout << "TV: fTVTrackMin " << fTVTrackMin << " fTVTrackMax " << fTVTrackMax 00049 << " fTVTrackStep " << fTVTrackStep << " fTVEventMin " << fTVEventMin 00050 << " fTVEventMax " << fTVEventMax << " fTVEventStep " << fTVEventStep 00051 << " fVerboseLevel " << fVerboseLevel << endl; 00052 00053 //----- Set verbosity off to start 00054 fTrackingVerboseON = false; 00055 fTkVerbThisEventON = false; 00056 00057 cout << " TrackingVerbose constructed " << endl; 00058 }
TrackingVerboseAction::~TrackingVerboseAction | ( | ) |
bool TrackingVerboseAction::checkTrackingVerbose | ( | const G4Track * | aTrack | ) | [private] |
Definition at line 268 of file TrackingVerboseAction.cc.
References fTVTrackMax, fTVTrackMin, and fTVTrackStep.
Referenced by update().
00269 { 00270 int trackNo = aTrack->GetTrackID(); 00271 bool trackingVerboseThisTrack = false; 00272 //----- Check if track is in the selected range 00273 if (trackNo >= fTVTrackMin && trackNo <= fTVTrackMax) 00274 { 00275 if ((trackNo-fTVTrackMin) % fTVTrackStep == 0) trackingVerboseThisTrack = true; 00276 } 00277 return trackingVerboseThisTrack; 00278 }
void TrackingVerboseAction::printTrackInfo | ( | const G4Track * | aTrack | ) | [private] |
Definition at line 280 of file TrackingVerboseAction.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and fVerbose.
Referenced by update().
00281 { 00282 cout << endl 00283 << "*******************************************************" 00284 << "**************************************************" << endl 00285 << "* G4Track Information: " 00286 << " Particle = " << aTrack->GetDefinition()->GetParticleName() 00287 << "," 00288 << " Track ID = " << aTrack->GetTrackID() 00289 << "," 00290 << " Parent ID = " << aTrack->GetParentID() << endl 00291 << "*******************************************************" 00292 << "**************************************************" 00293 << endl << endl; 00294 if (fVerbose) fVerbose->TrackingStarted(); 00295 }
Definition at line 262 of file TrackingVerboseAction.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), fDEBUG, and theTrackingManager.
Referenced by update().
00263 { 00264 if (fDEBUG) cout << " setting verbose level " << verblev << endl; 00265 if (theTrackingManager!=0) theTrackingManager->SetVerboseLevel(verblev); 00266 }
void TrackingVerboseAction::update | ( | const EndOfTrack * | ) | [virtual] |
This routine will be called when the appropriate signal arrives.
Implements Observer< const EndOfTrack * >.
Definition at line 245 of file TrackingVerboseAction.cc.
References checkTrackingVerbose(), GenMuonPlsPt100GeV_cfg::cout, lat::endl(), fDEBUG, fLarge, fTkVerbThisEventON, fTrackingVerboseON, fTVTrackMax, fTVTrackStep, and setTrackingVerbose().
00246 { 00247 const G4Track * aTrack = (*trk)(); 00248 if (fTkVerbThisEventON) 00249 { 00250 bool trackingVerboseThisTrack = checkTrackingVerbose(aTrack); 00251 if ((trackingVerboseThisTrack) && (fTrackingVerboseON ) && 00252 (fTVTrackMax < fLarge || fTVTrackStep != 1)) 00253 { 00254 setTrackingVerbose(0); 00255 fTrackingVerboseON = false; 00256 if (fDEBUG) cout << "TV: VERBOSEtt0 " << aTrack->GetTrackID() 00257 << endl; 00258 } 00259 } 00260 }
void TrackingVerboseAction::update | ( | const BeginOfTrack * | ) | [virtual] |
This routine will be called when the appropriate signal arrives.
Implements Observer< const BeginOfTrack * >.
Definition at line 113 of file TrackingVerboseAction.cc.
References checkTrackingVerbose(), GenMuonPlsPt100GeV_cfg::cout, lat::endl(), fDEBUG, fHighEtPhotons, fTkVerbThisEventON, fTrackingVerboseON, fVerboseLevel, funct::log(), m, printTrackInfo(), proc, setTrackingVerbose(), funct::sqrt(), and funct::tan().
00114 { 00115 const G4Track * aTrack = (*trk)(); 00116 00117 //----- High ET photon printout 00118 //---------- Set /tracking/verbose 00119 //----- track is verbose only if event is verbose 00120 double tkP = aTrack->GetMomentum().mag(); 00121 double tkPx = aTrack->GetMomentum().x(); 00122 double tkPy = aTrack->GetMomentum().y(); 00123 double tkPz = aTrack->GetMomentum().z(); 00124 00125 double tvtx = aTrack->GetVertexPosition().x(); 00126 double tvty = aTrack->GetVertexPosition().y(); 00127 double tvtz = aTrack->GetVertexPosition().z(); 00128 00129 double g4t_phi=atan2(tkPy,tkPx); 00130 00131 double drpart=sqrt(tkPx*tkPx + tkPy*tkPy); 00132 00133 double mythetapart=acos(tkPz/sqrt(drpart*drpart+tkPz*tkPz)); 00134 00135 double g4t_eta=-log(tan(mythetapart/2.)); 00136 G4int MytrackNo = aTrack->GetTrackID(); 00137 00138 if (fHighEtPhotons) 00139 { 00140 if (aTrack->GetDefinition()->GetParticleName() == "gamma" && aTrack->GetParentID() !=0) 00141 { 00142 if((tkPx*tkPx + tkPy*tkPy + tkPz*tkPz)>1000.0*1000.0 && 00143 aTrack->GetCreatorProcess()->GetProcessName() == "LCapture") 00144 { 00145 cout << "MY NEW GAMMA " << endl; 00146 cout << "**********************************************************************" << endl; 00147 cout << "MY NEW TRACK ID = " << MytrackNo << "(" 00148 << aTrack->GetDefinition()->GetParticleName() 00149 <<")"<< " PARENT ="<< aTrack->GetParentID() << endl; 00150 cout << "Primary particle: " 00151 << aTrack->GetDynamicParticle()->GetPrimaryParticle() << endl; 00152 cout << "Process type: " << aTrack->GetCreatorProcess()->GetProcessType() 00153 << " Process name: " 00154 << aTrack->GetCreatorProcess()->GetProcessName() << endl; 00155 cout << "ToT E = " << aTrack->GetTotalEnergy() 00156 << " KineE = " << aTrack->GetKineticEnergy() 00157 << " Tot P = " << tkP << " Pt = " << sqrt(tkPx*tkPx + tkPy*tkPy) 00158 << " VTX=(" << tvtx << "," << tvty << "," << tvtz << ")" << endl; 00159 if (aTrack->GetKineticEnergy() > 1.*GeV 00160 && aTrack->GetCreatorProcess()->GetProcessName() != "LCapture") 00161 cout << " KineE > 1 GeV !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; 00162 const G4VTouchable* touchable=aTrack->GetTouchable(); 00163 if (touchable!=0 && touchable->GetVolume()!=0 00164 && touchable->GetVolume()->GetLogicalVolume()!=0) 00165 { 00166 G4Material* material=touchable->GetVolume()->GetLogicalVolume()->GetMaterial(); 00167 cout << "G4LCapture Gamma E(GeV) " 00168 << aTrack->GetTotalEnergy()/GeV << " " 00169 << material->GetName()<< " " 00170 << touchable->GetVolume()->GetName() << endl; 00171 cout << "G4LCapture Gamma position(m): " 00172 << aTrack->GetPosition()/m << endl; 00173 cout << "G4LCapture created Gamma direction " 00174 << aTrack->GetMomentumDirection() << endl; 00175 cout << "G4LCapture gamma (eta,phi) = " 00176 << "(" << g4t_eta << "," << g4t_phi << ")" << endl; 00177 } 00178 aTrack->GetUserInformation()->Print(); 00179 cout << "**********************************************************************" << endl; 00180 } 00181 } 00182 00183 if (aTrack->GetDefinition()->GetParticleName() == "gamma") 00184 { 00185 const G4VProcess * proc = aTrack->GetCreatorProcess(); 00186 double Tgamma = aTrack->GetKineticEnergy(); 00187 std::string ProcName; 00188 const std::string nullstr ("Null_prc"); 00189 if (proc) ProcName = proc->GetProcessName(); 00190 else ProcName = nullstr; 00191 if (Tgamma > 2.5*GeV ) //&& ProcName!="Decay" && ProcName!="eBrem") 00192 { 00193 std::string volumeName("_Unknown_Vol_"); 00194 std::string materialName("_Unknown_Mat_"); 00195 G4Material * material = 0; 00196 G4VPhysicalVolume * pvolume = 0; 00197 G4LogicalVolume * lvolume = 0; 00198 const G4VTouchable * touchable = aTrack->GetTouchable(); 00199 if (touchable) pvolume = touchable->GetVolume(); 00200 if (pvolume) 00201 { 00202 volumeName = pvolume->GetName(); 00203 lvolume = pvolume->GetLogicalVolume(); 00204 } 00205 if (lvolume) material = lvolume->GetMaterial(); 00206 if (material) materialName = material->GetName(); 00207 cout << "**** ALL photons > 2.5 GeV ****" << endl; 00208 cout << ProcName << "**** ALL photons: gamma E(GeV) " 00209 << aTrack->GetTotalEnergy()/GeV << " " 00210 << materialName << " " << volumeName << endl; 00211 cout << ProcName << "**** ALL photons: gamma position(m): " 00212 << aTrack->GetPosition()/m << endl; 00213 cout << ProcName << "**** ALL photons: gamma direction " 00214 << aTrack->GetMomentumDirection() << endl; 00215 cout << "**********************************************************************" << endl; 00216 } 00217 } 00218 } 00219 00220 //---------- Set /tracking/verbose 00221 //----- track is verbose only if event is verbose 00222 if (fTkVerbThisEventON) 00223 { 00224 bool trackingVerboseThisTrack = checkTrackingVerbose(aTrack); 00225 00226 //----- Set the /tracking/verbose for this track 00227 if ((trackingVerboseThisTrack) && (!fTrackingVerboseON) ) 00228 { 00229 setTrackingVerbose(fVerboseLevel); 00230 fTrackingVerboseON = true; 00231 if (fDEBUG) cout << "TV: VERBOSEtt1 " << aTrack->GetTrackID() 00232 << endl; 00233 printTrackInfo(aTrack); 00234 } 00235 else if ((!trackingVerboseThisTrack) && ( fTrackingVerboseON )) 00236 { 00237 setTrackingVerbose(0); 00238 fTrackingVerboseON = false; 00239 if (fDEBUG) cout << "TV: VERBOSEtt0 " << aTrack->GetTrackID() 00240 << endl; 00241 } 00242 } 00243 }
void TrackingVerboseAction::update | ( | const BeginOfEvent * | ) | [virtual] |
This routine will be called when the appropriate signal arrives.
Implements Observer< const BeginOfEvent * >.
Definition at line 73 of file TrackingVerboseAction.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), fDEBUG, fLarge, fTkVerbThisEventON, fTrackingVerboseON, fTVEventMax, fTVEventMin, fTVEventStep, fTVTrackMax, fTVTrackMin, fTVTrackStep, fVerboseLevel, and setTrackingVerbose().
00074 { 00075 if (evt==0) return; 00076 const G4Event * anEvent = (*evt)(); 00077 if (anEvent==0) return; 00078 00079 //----------- Set /tracking/verbose for this event 00080 int eventNo = anEvent->GetEventID(); 00081 if (fDEBUG) cout << "TV: trackID: NEW EVENT " << eventNo << endl; 00082 00083 fTkVerbThisEventON = false; 00084 //----- Check if event is in the selected range 00085 if (eventNo >= fTVEventMin && eventNo <= fTVEventMax) 00086 { 00087 if ((eventNo-fTVEventMin) % fTVEventStep == 0) fTkVerbThisEventON = true; 00088 } 00089 00090 if (fDEBUG) 00091 cout << " TV: fTkVerbThisEventON " << fTkVerbThisEventON 00092 << " fTrackingVerboseON " << fTrackingVerboseON 00093 << " fTVEventMin " << fTVEventMin << " fTVEventMax " << fTVEventMax << endl; 00094 //----- check if verbosity has to be changed 00095 if ((fTkVerbThisEventON) && (!fTrackingVerboseON)) 00096 { 00097 if (fTVTrackMin == 0 && fTVTrackMax == fLarge && fTVTrackStep != 1) 00098 { 00099 setTrackingVerbose(fVerboseLevel); 00100 fTrackingVerboseON = true; 00101 if (fDEBUG) cout << "TV: VERBOSEet1 " << eventNo << endl; 00102 } 00103 } 00104 else if ((!fTkVerbThisEventON) && (fTrackingVerboseON) ) 00105 { 00106 setTrackingVerbose(0); 00107 fTrackingVerboseON = false; 00108 if (fDEBUG) cout << "TV: VERBOSEet0 " << eventNo << endl; 00109 } 00110 00111 }
void TrackingVerboseAction::update | ( | const BeginOfRun * | ) | [virtual] |
This routine will be called when the appropriate signal arrives.
Implements Observer< const BeginOfRun * >.
Definition at line 62 of file TrackingVerboseAction.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), fDEBUG, fVerbose, TrackingAction::getTrackManager(), and theTrackingManager.
00063 { 00064 TrackingAction * ta = 00065 dynamic_cast<TrackingAction*>(G4EventManager::GetEventManager()->GetUserTrackingAction()); 00066 theTrackingManager = ta->getTrackManager(); 00067 fVerbose = G4VSteppingVerbose::GetInstance(); 00068 if (fDEBUG) 00069 cout << " TV: Get the Tracking Manager: " << theTrackingManager 00070 << " and the SteppingVerbose: " << fVerbose << endl; 00071 }
bool TrackingVerboseAction::fDEBUG [private] |
Definition at line 52 of file TrackingVerboseAction.h.
Referenced by setTrackingVerbose(), TrackingVerboseAction(), and update().
bool TrackingVerboseAction::fHighEtPhotons [private] |
Definition at line 53 of file TrackingVerboseAction.h.
Referenced by TrackingVerboseAction(), and update().
int TrackingVerboseAction::fLarge [private] |
Definition at line 51 of file TrackingVerboseAction.h.
Referenced by TrackingVerboseAction(), and update().
Definition at line 62 of file TrackingVerboseAction.h.
Referenced by TrackingVerboseAction(), and update().
Definition at line 61 of file TrackingVerboseAction.h.
Referenced by TrackingVerboseAction(), and update().
int TrackingVerboseAction::fTVEventMax [private] |
Definition at line 58 of file TrackingVerboseAction.h.
Referenced by TrackingVerboseAction(), and update().
int TrackingVerboseAction::fTVEventMin [private] |
Definition at line 57 of file TrackingVerboseAction.h.
Referenced by TrackingVerboseAction(), and update().
int TrackingVerboseAction::fTVEventStep [private] |
Definition at line 59 of file TrackingVerboseAction.h.
Referenced by TrackingVerboseAction(), and update().
int TrackingVerboseAction::fTVTrackMax [private] |
Definition at line 55 of file TrackingVerboseAction.h.
Referenced by checkTrackingVerbose(), TrackingVerboseAction(), and update().
int TrackingVerboseAction::fTVTrackMin [private] |
Definition at line 54 of file TrackingVerboseAction.h.
Referenced by checkTrackingVerbose(), TrackingVerboseAction(), and update().
int TrackingVerboseAction::fTVTrackStep [private] |
Definition at line 56 of file TrackingVerboseAction.h.
Referenced by checkTrackingVerbose(), TrackingVerboseAction(), and update().
G4VSteppingVerbose* TrackingVerboseAction::fVerbose [private] |
Definition at line 64 of file TrackingVerboseAction.h.
Referenced by printTrackInfo(), and update().
int TrackingVerboseAction::fVerboseLevel [private] |
Definition at line 60 of file TrackingVerboseAction.h.
Referenced by TrackingVerboseAction(), and update().
G4TrackingManager* TrackingVerboseAction::theTrackingManager [private] |
Definition at line 63 of file TrackingVerboseAction.h.
Referenced by setTrackingVerbose(), and update().