#include <SimG4Core/CheckSecondary/interface/StoreSecondary.h>
Public Member Functions | |
void | produce (edm::Event &, const edm::EventSetup &) |
StoreSecondary (const edm::ParameterSet &p) | |
virtual | ~StoreSecondary () |
Private Member Functions | |
const StoreSecondary & | operator= (const StoreSecondary &) |
StoreSecondary (const StoreSecondary &) | |
void | update (const G4Step *step) |
This routine will be called when the appropriate signal arrives. | |
void | update (const BeginOfTrack *trk) |
This routine will be called when the appropriate signal arrives. | |
void | update (const BeginOfEvent *evt) |
This routine will be called when the appropriate signal arrives. | |
Private Attributes | |
int | killAfter |
int | nHad |
std::vector< int > | nsecs |
std::vector< std::string > | procs |
std::vector < math::XYZTLorentzVector > | secondaries |
bool | storeIt |
TreatSecondary * | treatSecondary |
int | verbosity |
Definition at line 19 of file StoreSecondary.h.
StoreSecondary::StoreSecondary | ( | const edm::ParameterSet & | p | ) |
Definition at line 22 of file StoreSecondary.cc.
References edm::ParameterSet::getParameter(), and treatSecondary.
00022 { 00023 00024 edm::ParameterSet m_p = p.getParameter<edm::ParameterSet>("StoreSecondary"); 00025 treatSecondary = new TreatSecondary (m_p); 00026 00027 produces<std::vector<math::XYZTLorentzVector> >("SecondaryMomenta"); 00028 produces<std::vector<int> >("SecondaryParticles"); 00029 // produces<std::vector<std::string> >("SecondaryProcesses"); 00030 00031 edm::LogInfo("CheckSecondary") << "Instantiate StoreSecondary to store " 00032 << "secondaries after 1st hadronic inelastic" 00033 << " interaction"; 00034 }
StoreSecondary::~StoreSecondary | ( | ) | [virtual] |
Definition at line 36 of file StoreSecondary.cc.
References treatSecondary.
00036 { 00037 delete treatSecondary; 00038 }
StoreSecondary::StoreSecondary | ( | const StoreSecondary & | ) | [private] |
const StoreSecondary& StoreSecondary::operator= | ( | const StoreSecondary & | ) | [private] |
void StoreSecondary::produce | ( | edm::Event & | e, | |
const edm::EventSetup & | ||||
) | [virtual] |
Implements SimProducer.
Definition at line 40 of file StoreSecondary.cc.
References i, edm::Event::id(), LogDebug, nsecs, procs, edm::Event::put(), and secondaries.
00040 { 00041 00042 std::auto_ptr<std::vector<math::XYZTLorentzVector> > secMom(new std::vector<math::XYZTLorentzVector>); 00043 *secMom = secondaries; 00044 e.put(secMom, "SecondaryMomenta"); 00045 00046 std::auto_ptr<std::vector<int> > secNumber(new std::vector<int>); 00047 *secNumber = nsecs; 00048 e.put(secNumber, "SecondaryParticles"); 00049 00050 /* 00051 std::auto_ptr<std::vector<std::string> > secProc(new std::vector<std::string>); 00052 *secProc = procs; 00053 e.put(secProc, "SecondaryProcesses"); 00054 */ 00055 00056 LogDebug("CheckSecondary") << "StoreSecondary:: Event " << e.id() << " with " 00057 << nsecs.size() << " hadronic collisions with " 00058 << "secondaries produced in each step"; 00059 for (unsigned int i= 0; i < nsecs.size(); i++) 00060 LogDebug("CheckSecondary") << " " << nsecs[i] << " from " << procs[i]; 00061 LogDebug("CheckSecondary") << " and " << secondaries.size() << " secondaries" 00062 << " produced in the first interactions:"; 00063 for (unsigned int i= 0; i < secondaries.size(); i++) 00064 LogDebug("CheckSecondary") << "Secondary " << i << " " << secondaries[i]; 00065 }
void StoreSecondary::update | ( | const G4Step * | ) | [private, virtual] |
This routine will be called when the appropriate signal arrives.
Implements Observer< const G4Step * >.
Definition at line 83 of file StoreSecondary.cc.
References i, int, name, nHad, nsecs, procs, secondaries, storeIt, TreatSecondary::tracks(), tracks, and treatSecondary.
00083 { 00084 00085 std::string name; 00086 int procID; 00087 bool hadrInt; 00088 double deltaE; 00089 std::vector<int> charge; 00090 std::vector<math::XYZTLorentzVector> tracks = treatSecondary->tracks(aStep, 00091 name, 00092 procID, 00093 hadrInt, 00094 deltaE, 00095 charge); 00096 if (hadrInt) { 00097 nHad++; 00098 if (storeIt) { 00099 int sec = (int)(tracks.size()); 00100 nsecs.push_back(sec); 00101 procs.push_back(name); 00102 if (nHad == 1) { 00103 for (int i=0; i<sec; i++) 00104 secondaries.push_back(tracks[i]); 00105 } 00106 } 00107 } 00108 }
void StoreSecondary::update | ( | const BeginOfTrack * | ) | [private, virtual] |
This routine will be called when the appropriate signal arrives.
Implements Observer< const BeginOfTrack * >.
Definition at line 74 of file StoreSecondary.cc.
References TreatSecondary::initTrack(), nHad, nsecs, storeIt, and treatSecondary.
00074 { 00075 00076 const G4Track * thTk = (*trk)(); 00077 treatSecondary->initTrack(thTk); 00078 if (nsecs.size() == 0 && thTk->GetParentID() <= 0) storeIt = true; 00079 else storeIt = false; 00080 nHad = 0; 00081 }
void StoreSecondary::update | ( | const BeginOfEvent * | ) | [private, virtual] |
This routine will be called when the appropriate signal arrives.
Implements Observer< const BeginOfEvent * >.
Definition at line 67 of file StoreSecondary.cc.
References nsecs, procs, and secondaries.
00067 { 00068 00069 nsecs.clear(); 00070 procs.clear(); 00071 secondaries.clear(); 00072 }
int StoreSecondary::killAfter [private] |
Definition at line 40 of file StoreSecondary.h.
int StoreSecondary::nHad [private] |
std::vector<int> StoreSecondary::nsecs [private] |
std::vector<std::string> StoreSecondary::procs [private] |
std::vector<math::XYZTLorentzVector> StoreSecondary::secondaries [private] |
bool StoreSecondary::storeIt [private] |
TreatSecondary* StoreSecondary::treatSecondary [private] |
Definition at line 46 of file StoreSecondary.h.
Referenced by StoreSecondary(), update(), and ~StoreSecondary().
int StoreSecondary::verbosity [private] |
Definition at line 40 of file StoreSecondary.h.