CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &)
 
 StoreSecondary (const edm::ParameterSet &p)
 
virtual ~StoreSecondary ()
 
- Public Member Functions inherited from SimProducer
void registerProducts (edm::ProducerBase &iProd)
 
 SimProducer ()
 
- Public Member Functions inherited from SimWatcher
 SimWatcher ()
 
virtual ~SimWatcher ()
 
- Public Member Functions inherited from Observer< const BeginOfEvent * >
 Observer ()
 
void slotForUpdate (const BeginOfEvent *iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfTrack * >
 Observer ()
 
void slotForUpdate (const BeginOfTrack *iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const G4Step * >
 Observer ()
 
void slotForUpdate (const G4Step *iT)
 
virtual ~Observer ()
 

Private Member Functions

const StoreSecondaryoperator= (const StoreSecondary &)
 
 StoreSecondary (const StoreSecondary &)
 
void update (const BeginOfEvent *evt)
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfTrack *trk)
 This routine will be called when the appropriate signal arrives. More...
 
void update (const G4Step *step)
 This routine will be called when the appropriate signal arrives. More...
 

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
 

Additional Inherited Members

- Protected Member Functions inherited from SimProducer
template<class T >
void produces ()
 
template<class T >
void produces (const std::string &instanceName)
 

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.

22  {
23 
24  edm::ParameterSet m_p = p.getParameter<edm::ParameterSet>("StoreSecondary");
25  treatSecondary = new TreatSecondary (m_p);
26 
27  produces<std::vector<math::XYZTLorentzVector> >("SecondaryMomenta");
28  produces<std::vector<int> >("SecondaryParticles");
29 
30  edm::LogInfo("CheckSecondary") << "Instantiate StoreSecondary to store "
31  << "secondaries after 1st hadronic inelastic"
32  << " interaction";
33 }
T getParameter(std::string const &) const
TreatSecondary * treatSecondary
StoreSecondary::~StoreSecondary ( )
virtual

Definition at line 35 of file StoreSecondary.cc.

References treatSecondary.

35  {
36  delete treatSecondary;
37 }
TreatSecondary * 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 39 of file StoreSecondary.cc.

References i, edm::EventBase::id(), LogDebug, nsecs, procs, edm::Event::put(), and secondaries.

39  {
40 
41  std::auto_ptr<std::vector<math::XYZTLorentzVector> > secMom(new std::vector<math::XYZTLorentzVector>);
42  *secMom = secondaries;
43  e.put(secMom, "SecondaryMomenta");
44 
45  std::auto_ptr<std::vector<int> > secNumber(new std::vector<int>);
46  *secNumber = nsecs;
47  e.put(secNumber, "SecondaryParticles");
48 
49  LogDebug("CheckSecondary") << "StoreSecondary:: Event " << e.id() << " with "
50  << nsecs.size() << " hadronic collisions with "
51  << "secondaries produced in each step";
52  for (unsigned int i= 0; i < nsecs.size(); i++) {
53  LogDebug("CheckSecondary") << " " << nsecs[i] << " from " << procs[i];
54  }
55  LogDebug("CheckSecondary") << " and " << secondaries.size() << " secondaries"
56  << " produced in the first interactions:";
57  for (unsigned int i= 0; i < secondaries.size(); i++)
58  LogDebug("CheckSecondary") << "Secondary " << i << " " << secondaries[i];
59 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::vector< int > nsecs
std::vector< math::XYZTLorentzVector > secondaries
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
std::vector< std::string > procs
edm::EventID id() const
Definition: EventBase.h:59
void StoreSecondary::update ( const BeginOfEvent )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 61 of file StoreSecondary.cc.

References nsecs, procs, and secondaries.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

61  {
62 
63  nsecs.clear();
64  procs.clear();
65  secondaries.clear();
66 }
std::vector< int > nsecs
std::vector< math::XYZTLorentzVector > secondaries
std::vector< std::string > procs
void StoreSecondary::update ( const BeginOfTrack )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfTrack * >.

Definition at line 68 of file StoreSecondary.cc.

References TreatSecondary::initTrack(), nHad, nsecs, storeIt, and treatSecondary.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

68  {
69 
70  const G4Track * thTk = (*trk)();
72  if (nsecs.size() == 0 && thTk->GetParentID() <= 0) storeIt = true;
73  else storeIt = false;
74  nHad = 0;
75 }
std::vector< int > nsecs
void initTrack(const G4Track *trk)
TreatSecondary * treatSecondary
void StoreSecondary::update ( const G4Step *  )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const G4Step * >.

Definition at line 77 of file StoreSecondary.cc.

References RecoTauCleanerPlugins::charge, i, mergeVDriftHistosByStation::name, nHad, nsecs, procs, secondaries, storeIt, AlCaHLTBitMon_QueryRunRegistry::string, TreatSecondary::tracks(), testEve_cfg::tracks, and treatSecondary.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

77  {
78 
80  int procID;
81  bool hadrInt;
82  double deltaE;
83  std::vector<int> charge;
84  std::vector<math::XYZTLorentzVector> tracks = treatSecondary->tracks(aStep,
85  name,
86  procID,
87  hadrInt,
88  deltaE,
89  charge);
90  if (hadrInt) {
91  ++nHad;
92  if (storeIt) {
93  int sec = (int)(tracks.size());
94  nsecs.push_back(sec);
95  procs.push_back(name);
96  if (nHad == 1) {
97  for (int i=0; i<sec; i++)
98  secondaries.push_back(tracks[i]);
99  }
100  }
101  }
102 }
int i
Definition: DBlmapReader.cc:9
std::vector< int > nsecs
std::vector< math::XYZTLorentzVector > tracks(const G4Step *step, std::string &procName, int &procID, bool &intr, double &deltaE, std::vector< int > &charges)
std::vector< math::XYZTLorentzVector > secondaries
std::vector< std::string > procs
tuple tracks
Definition: testEve_cfg.py:39
TreatSecondary * treatSecondary

Member Data Documentation

int StoreSecondary::killAfter
private

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().

std::vector<math::XYZTLorentzVector> StoreSecondary::secondaries
private

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().

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.