2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
6 // Author: Ketevi A. Assamagan
9 template<class Selector>
10 void PileUpType::signal_particles( std::vector<HepMC::ConstGenParticlePtr>& particleList,
11 const Selector& select ) const
13 unsigned int colSize = m_particleList->size();
15 for ( auto istart: *(m_particleList->at(0))) {
16 if ( select(istart) ) particleList.push_back ( istart );
21 template<class Selector>
22 void PileUpType::in_time_minimum_bias_particles( std::vector<HepMC::ConstGenParticlePtr>& particleList,
23 const Selector& select ) const
25 McEventCollection::const_iterator ievent_begin = this->in_time_minimum_bias_event_begin();
26 McEventCollection::const_iterator ievent_end = this->in_time_minimum_bias_event_end();
27 for ( ; ievent_begin != ievent_end; ++ievent_begin ) {
28 for ( auto it : **ievent_begin ) {
29 if ( select(it) ) particleList.push_back(it);
34 template<class Selector>
35 void PileUpType::in_time_particles( std::vector<HepMC::ConstGenParticlePtr>& particleList,
36 const Selector& select ) const
39 this->signal_particles( particleList, select );
40 this->in_time_minimum_bias_particles( particleList, select );
44 /** return the MC events in [-2BC, +2BC], including the signal McEvent at BC=0 */
45 template<class Selector>
46 void PileUpType::particles_in_two_bunch_crossings( std::vector<HepMC::ConstGenParticlePtr>& particleList,
47 const Selector& select ) const
51 /** add the in-time particles at BC=0 */
52 this->in_time_particles( particleList, select );
54 /** find the ranges of the out-of-time particles in [-2BC, +2BC] */
55 const unsigned int colSize = m_particleList->size();
56 unsigned int istart = 0;
57 unsigned int iend = 0;
58 for (unsigned int i=1; i<colSize; ++i)
60 // start of the out-of-time in [-2BC,+2BC]
61 if ( (m_particleList->at(i))->event_number() == -1 && HepMC::signal_process_id(m_particleList->at(i)) == 0 ) istart=i+1;
64 // end of the out-of-time in [-2BC,+2BC]
65 if ( (m_particleList->at(i))->event_number() == -1 && HepMC::signal_process_id(m_particleList->at(i)) == 0 )
73 /** collect the out-of-time particles within [-2BC,+2BC] */
74 for (unsigned int i=istart; i<iend; ++i)
76 for (auto it: *(m_particleList->at(i))) {
77 if ( select(it) ) particleList.push_back(it);
82 /** return the MC events in [-inf,-2BC] and [+2BC,+inf], excluding the cavern background and the beam halo */
83 template<class Selector>
84 void PileUpType::particles_outside_two_bunch_crossings( std::vector<HepMC::ConstGenParticlePtr>& particleList,
85 const Selector& select ) const
88 const unsigned int colSize = m_particleList->size();
89 unsigned int istart = 0;
90 unsigned int iend = 0;
91 for (unsigned int i=1; i<colSize; ++i)
93 // start of the out-of-time in [-2BC, +2BC]
94 if ( (m_particleList->at(i))->event_number() == -1 && HepMC::signal_process_id(m_particleList->at(i)) == 0 ) istart=i+1;
97 // start of the out-of-time in [-Inf,-2BC] and [+2BC,+Inf]
98 if ( (m_particleList->at(i))->event_number() == -1 && HepMC::signal_process_id(m_particleList->at(i)) == 0 ) istart=i+1;
101 // end of the out-of-time in [-Inf,-2BC] and [+2Bc,+Inf]
102 if ( (m_particleList->at(i))->event_number() == -1 && HepMC::signal_process_id(m_particleList->at(i)) == 0 )
111 /** collect the out-of-time particles within [-Inf, -2BC] and [+2BC,+Inf] */
112 for (unsigned int i=istart; i<iend; ++i)
114 for (auto it: *(m_particleList->at(i))) {
115 if ( select(it) ) particleList.push_back(it);
120 /** return the MC events of the cavern background */
121 template<class Selector>
122 void PileUpType::cavern_background_particles( std::vector<HepMC::ConstGenParticlePtr>& particleList,
123 const Selector& select ) const
125 particleList.clear();
126 const unsigned int colSize = m_particleList->size();
127 unsigned int istart = 0;
128 for (unsigned int i=1; i<colSize; ++i)
130 // the cavern is at the end so, the last of this condition is the start of the cavern
131 if ( (m_particleList->at(i))->event_number() == -1 && HepMC::signal_process_id(m_particleList->at(i)) == 0 ) istart=i;
134 /** collect the cavern background particles */
135 for (unsigned int i=istart+1; i<colSize; ++i)
137 for (auto it: *(m_particleList->at(i))) {
138 if ( select(it) ) particleList.push_back(it);