CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

StoreSecondary Class Reference

#include <StoreSecondary.h>

Inheritance diagram for StoreSecondary:
SimProducer Observer< const BeginOfEvent * > Observer< const BeginOfTrack * > Observer< const G4Step * > SimWatcher

List of all members.

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &)
 StoreSecondary (const edm::ParameterSet &p)
virtual ~StoreSecondary ()

Private Member Functions

const StoreSecondaryoperator= (const StoreSecondary &)
 StoreSecondary (const StoreSecondary &)
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.
void update (const G4Step *step)
 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
TreatSecondarytreatSecondary
int verbosity

Detailed Description

Definition at line 19 of file StoreSecondary.h.


Constructor & Destructor Documentation

StoreSecondary::StoreSecondary ( const edm::ParameterSet p)

Definition at line 22 of file StoreSecondary.cc.

References edm::ParameterSet::getParameter(), and treatSecondary.

                                                       {

  edm::ParameterSet m_p = p.getParameter<edm::ParameterSet>("StoreSecondary");
  treatSecondary    = new TreatSecondary (m_p);

  produces<std::vector<math::XYZTLorentzVector> >("SecondaryMomenta");
  produces<std::vector<int> >("SecondaryParticles");
  //  produces<std::vector<std::string> >("SecondaryProcesses");

  edm::LogInfo("CheckSecondary") << "Instantiate StoreSecondary to store "
                                 << "secondaries after 1st hadronic inelastic"
                                 << " interaction";
} 
StoreSecondary::~StoreSecondary ( ) [virtual]

Definition at line 36 of file StoreSecondary.cc.

References treatSecondary.

                                {
  delete treatSecondary;
}
StoreSecondary::StoreSecondary ( const StoreSecondary ) [private]

Member Function Documentation

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::EventBase::id(), LogDebug, nsecs, procs, edm::Event::put(), and secondaries.

                                                              {

  std::auto_ptr<std::vector<math::XYZTLorentzVector> > secMom(new std::vector<math::XYZTLorentzVector>);
  *secMom = secondaries;
  e.put(secMom, "SecondaryMomenta");

  std::auto_ptr<std::vector<int> > secNumber(new std::vector<int>);
  *secNumber = nsecs;
  e.put(secNumber, "SecondaryParticles");

  /*
  std::auto_ptr<std::vector<std::string> > secProc(new std::vector<std::string>);
  *secProc = procs;
  e.put(secProc, "SecondaryProcesses");
  */

  LogDebug("CheckSecondary") << "StoreSecondary:: Event " << e.id() << " with "
                             << nsecs.size() << " hadronic collisions with "
                             << "secondaries produced in each step";
  for (unsigned int i= 0; i < nsecs.size(); i++) 
    LogDebug("CheckSecondary") << " " << nsecs[i] << " from " << procs[i];
  LogDebug("CheckSecondary") << " and " << secondaries.size() << " secondaries"
                             << " produced in the first interactions:";
  for (unsigned int i= 0; i < secondaries.size(); i++) 
    LogDebug("CheckSecondary") << "Secondary " << i << " " << secondaries[i];
}
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.

                                                    {

  const G4Track * thTk = (*trk)();
  treatSecondary->initTrack(thTk);
  if (nsecs.size() == 0 && thTk->GetParentID() <= 0) storeIt = true;
  else                                               storeIt = false;
  nHad  = 0;
}
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.

                                                {

  nsecs.clear();
  procs.clear();
  secondaries.clear();
}
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 DeDxDiscriminatorTools::charge(), i, mergeVDriftHistosByStation::name, nHad, nsecs, procs, secondaries, storeIt, TreatSecondary::tracks(), testEve_cfg::tracks, and treatSecondary.

                                                {

  std::string      name;
  int              procID;
  bool             hadrInt;
  double           deltaE;
  std::vector<int> charge;
  std::vector<math::XYZTLorentzVector> tracks = treatSecondary->tracks(aStep,
                                                                       name,
                                                                       procID,
                                                                       hadrInt,
                                                                       deltaE,
                                                                       charge);
  if (hadrInt) {
    nHad++;
    if (storeIt) {
      int sec = (int)(tracks.size());
      nsecs.push_back(sec);
      procs.push_back(name);
      if (nHad == 1) {
        for (int i=0; i<sec; i++) 
          secondaries.push_back(tracks[i]);
      }
    }
  }
}

Member Data Documentation

Definition at line 40 of file StoreSecondary.h.

int StoreSecondary::nHad [private]

Definition at line 41 of file StoreSecondary.h.

Referenced by update().

std::vector<int> StoreSecondary::nsecs [private]

Definition at line 44 of file StoreSecondary.h.

Referenced by produce(), and update().

std::vector<std::string> StoreSecondary::procs [private]

Definition at line 45 of file StoreSecondary.h.

Referenced by produce(), and update().

Definition at line 43 of file StoreSecondary.h.

Referenced by produce(), and update().

bool StoreSecondary::storeIt [private]

Definition at line 42 of file StoreSecondary.h.

Referenced by update().

Definition at line 46 of file StoreSecondary.h.

Referenced by StoreSecondary(), update(), and ~StoreSecondary().

Definition at line 40 of file StoreSecondary.h.