ATLAS Offline Software
McEventCollectionCnv_utils.h
Go to the documentation of this file.
1 namespace {
2  // helper method to compute the number of particles and vertices in a
3  // whole McEventCollection
4  std::pair<unsigned int,unsigned int>
5  nbrParticlesAndVertices( const McEventCollection* mcEvents ) {
6  unsigned int nParts = 0;
7  unsigned int nVerts = 0;
8  const McEventCollection::const_iterator itrEnd = mcEvents->end();
9  for ( McEventCollection::const_iterator itr = mcEvents->begin();
10  itr != itrEnd;
11  ++itr ) {
12  nParts += (*itr)->particles_size();
13  nVerts += (*itr)->vertices_size();
14  }
15 
16  return std::make_pair( nParts, nVerts );
17  }
18 #ifdef HEPMC3
19 std::map<std::string, unsigned long int> names_to_name_index_map(const std::vector<std::string> &input )
20 {
21 std::map<std::string, unsigned long int> result;
22 unsigned long int i=0;
23 for (const auto& a: input) {result[a]=i; i++;}
24 return result;
25 }
26 
27 std::vector<std::pair<int,int> > vector_to_vector_int_int(const std::vector<int> &input )
28 {
29 // The "i" values used here now match HepMC2 most of the time, but still differ sometimes.
30 std::vector<std::pair<int,int> > result;
31 unsigned long int i=1;
32 for (const auto& a: input) {result.push_back(std::pair<int,int>(i,a)); i++;}
33 return result;
34 }
35 #endif
36 }
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
get_generator_info.result
result
Definition: get_generator_info.py:21
lumiFormat.i
int i
Definition: lumiFormat.py:85
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
Definition: McEventCollection.h:33
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
a
TList * a
Definition: liststreamerinfos.cxx:10
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.