CMS 3D CMS Logo

SaveSimTrack Class Reference

#include <SimG4Core/SaveSimTrackAction/interface/SaveSimTrack.h>

Inheritance diagram for SaveSimTrack:

SimWatcher Observer< const BeginOfTrack * >

List of all members.

Public Member Functions

 SaveSimTrack (edm::ParameterSet const &p)
void update (const BeginOfTrack *trk)
 This routine will be called when the appropriate signal arrives.
 ~SaveSimTrack ()

Private Attributes

int pdgMax
int pdgMin


Detailed Description

Definition at line 9 of file SaveSimTrack.h.


Constructor & Destructor Documentation

SaveSimTrack::SaveSimTrack ( edm::ParameterSet const &  p  ) 

Definition at line 10 of file SaveSimTrack.cc.

References edm::ParameterSet::getUntrackedParameter(), pdgMax, and pdgMin.

00010                                                     {
00011 
00012   pdgMin     = p.getUntrackedParameter<int>("MinimumPDGCode", 1000000);
00013   pdgMax     = p.getUntrackedParameter<int>("MaximumPDGCode", 2000000);
00014 
00015   edm::LogInfo("SaveSimTrack") << "SaveSimTrack:: Save Sim Track if PDG code "
00016                                << "lies between "  << pdgMin << " and " 
00017                                << pdgMax;
00018 }

SaveSimTrack::~SaveSimTrack (  ) 

Definition at line 20 of file SaveSimTrack.cc.

00020 {}


Member Function Documentation

void SaveSimTrack::update ( const BeginOfTrack  )  [virtual]

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfTrack * >.

Definition at line 22 of file SaveSimTrack.cc.

References funct::abs(), LogDebug, pdgMax, pdgMin, and TrackInformation::storeTrack().

00022                                                   {
00023 
00024   G4Track* theTrack = (G4Track*)((*trk)());
00025   TrackInformation * trkInfo = (TrackInformation *)(theTrack->GetUserInformation());
00026   if (trkInfo) {
00027     int pdg = std::abs(theTrack->GetDefinition()->GetPDGEncoding());
00028     if (pdg >= pdgMin && pdg <= pdgMax) {
00029       trkInfo->storeTrack(true);
00030       LogDebug("SaveSimTrack") << "Save SimTrack the Track " 
00031                                << theTrack->GetTrackID() << " Type " 
00032                                << theTrack->GetDefinition()->GetParticleName()
00033                                << " Momentum " << theTrack->GetMomentum()/MeV 
00034                                << " MeV/c";
00035     }
00036   }
00037 }


Member Data Documentation

int SaveSimTrack::pdgMax [private]

Definition at line 18 of file SaveSimTrack.h.

Referenced by SaveSimTrack(), and update().

int SaveSimTrack::pdgMin [private]

Definition at line 18 of file SaveSimTrack.h.

Referenced by SaveSimTrack(), and update().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:31:14 2009 for CMSSW by  doxygen 1.5.4