CMS 3D CMS Logo

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 &) override
 
 StoreSecondary (const edm::ParameterSet &p)
 
 ~StoreSecondary () override
 
- Public Member Functions inherited from SimProducer
void registerProducts (edm::ProducesCollector producesCollector)
 
 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 &)=delete
 
 StoreSecondary (const StoreSecondary &)=delete
 
void update (const BeginOfEvent *evt) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfTrack *trk) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const G4Step *step) override
 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::XYZTLorentzVectorsecondaries
 
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() [1/2]

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

Definition at line 22 of file StoreSecondary.cc.

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

References AlCaHLTBitMon_ParallelJobs::p, and treatSecondary.

◆ ~StoreSecondary()

StoreSecondary::~StoreSecondary ( )
override

Definition at line 34 of file StoreSecondary.cc.

34 { delete treatSecondary; }

References treatSecondary.

◆ StoreSecondary() [2/2]

StoreSecondary::StoreSecondary ( const StoreSecondary )
privatedelete

Member Function Documentation

◆ operator=()

const StoreSecondary& StoreSecondary::operator= ( const StoreSecondary )
privatedelete

◆ produce()

void StoreSecondary::produce ( edm::Event e,
const edm::EventSetup  
)
overridevirtual

Implements SimProducer.

Definition at line 36 of file StoreSecondary.cc.

36  {
37  std::unique_ptr<std::vector<math::XYZTLorentzVector>> secMom(new std::vector<math::XYZTLorentzVector>);
38  *secMom = secondaries;
39  e.put(std::move(secMom), "SecondaryMomenta");
40 
41  std::unique_ptr<std::vector<int>> secNumber(new std::vector<int>);
42  *secNumber = nsecs;
43  e.put(std::move(secNumber), "SecondaryParticles");
44 
45  LogDebug("CheckSecondary") << "StoreSecondary:: Event " << e.id() << " with " << nsecs.size()
46  << " hadronic collisions with "
47  << "secondaries produced in each step";
48  for (unsigned int i = 0; i < nsecs.size(); i++) {
49  LogDebug("CheckSecondary") << " " << nsecs[i] << " from " << procs[i];
50  }
51  LogDebug("CheckSecondary") << " and " << secondaries.size() << " secondaries"
52  << " produced in the first interactions:";
53  for (unsigned int i = 0; i < secondaries.size(); i++)
54  LogDebug("CheckSecondary") << "Secondary " << i << " " << secondaries[i];
55 }

References MillePedeFileConverter_cfg::e, mps_fire::i, LogDebug, eostools::move(), nsecs, procs, and secondaries.

◆ update() [1/3]

void StoreSecondary::update ( const BeginOfEvent )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 57 of file StoreSecondary.cc.

57  {
58  nsecs.clear();
59  procs.clear();
60  secondaries.clear();
61 }

References nsecs, procs, and secondaries.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

◆ update() [2/3]

void StoreSecondary::update ( const BeginOfTrack )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfTrack * >.

Definition at line 63 of file StoreSecondary.cc.

63  {
64  const G4Track *thTk = (*trk)();
66  if (nsecs.empty() && thTk->GetParentID() <= 0)
67  storeIt = true;
68  else
69  storeIt = false;
70  nHad = 0;
71 }

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

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

◆ update() [3/3]

void StoreSecondary::update ( const G4Step *  )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const G4Step * >.

Definition at line 73 of file StoreSecondary.cc.

73  {
75  int procID;
76  bool hadrInt;
77  double deltaE;
78  std::vector<int> charge;
79  std::vector<math::XYZTLorentzVector> tracks = treatSecondary->tracks(aStep, name, procID, hadrInt, deltaE, charge);
80  if (hadrInt) {
81  ++nHad;
82  if (storeIt) {
83  int sec = (int)(tracks.size());
84  nsecs.push_back(sec);
85  procs.push_back(name);
86  if (nHad == 1) {
87  for (int i = 0; i < sec; i++)
88  secondaries.push_back(tracks[i]);
89  }
90  }
91  }
92 }

References ALCARECOTkAlJpsiMuMu_cff::charge, EgHLTOffHistBins_cfi::deltaE, mps_fire::i, createfilelist::int, Skims_PA_cff::name, nHad, nsecs, procs, fileinputsource_cfi::sec, secondaries, storeIt, AlCaHLTBitMon_QueryRunRegistry::string, TreatSecondary::tracks(), PDWG_EXOHSCP_cff::tracks, and treatSecondary.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

Member Data Documentation

◆ killAfter

int StoreSecondary::killAfter
private

Definition at line 39 of file StoreSecondary.h.

◆ nHad

int StoreSecondary::nHad
private

Definition at line 40 of file StoreSecondary.h.

Referenced by update().

◆ nsecs

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

Definition at line 43 of file StoreSecondary.h.

Referenced by produce(), and update().

◆ procs

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

Definition at line 44 of file StoreSecondary.h.

Referenced by produce(), and update().

◆ secondaries

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

Definition at line 42 of file StoreSecondary.h.

Referenced by produce(), and update().

◆ storeIt

bool StoreSecondary::storeIt
private

Definition at line 41 of file StoreSecondary.h.

Referenced by update().

◆ treatSecondary

TreatSecondary* StoreSecondary::treatSecondary
private

Definition at line 45 of file StoreSecondary.h.

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

◆ verbosity

int StoreSecondary::verbosity
private

Definition at line 39 of file StoreSecondary.h.

PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
TreatSecondary
Definition: TreatSecondary.h:16
mps_fire.i
i
Definition: mps_fire.py:428
TreatSecondary::tracks
std::vector< math::XYZTLorentzVector > tracks(const G4Step *step, std::string &procName, int &procID, bool &intr, double &deltaE, std::vector< int > &charges)
Definition: TreatSecondary.cc:46
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
StoreSecondary::storeIt
bool storeIt
Definition: StoreSecondary.h:41
StoreSecondary::nHad
int nHad
Definition: StoreSecondary.h:40
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
StoreSecondary::nsecs
std::vector< int > nsecs
Definition: StoreSecondary.h:43
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
EgHLTOffHistBins_cfi.deltaE
deltaE
Definition: EgHLTOffHistBins_cfi.py:28
StoreSecondary::procs
std::vector< std::string > procs
Definition: StoreSecondary.h:44
StoreSecondary::secondaries
std::vector< math::XYZTLorentzVector > secondaries
Definition: StoreSecondary.h:42
createfilelist.int
int
Definition: createfilelist.py:10
fileinputsource_cfi.sec
sec
Definition: fileinputsource_cfi.py:87
eostools.move
def move(src, dest)
Definition: eostools.py:511
TreatSecondary::initTrack
void initTrack(const G4Track *trk)
Definition: TreatSecondary.cc:35
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
StoreSecondary::treatSecondary
TreatSecondary * treatSecondary
Definition: StoreSecondary.h:45
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37