ATLAS Offline Software
Loading...
Searching...
No Matches
McEventCollectionCnv_utils.h
Go to the documentation of this file.
1namespace {
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
19std::map<std::string, unsigned long int> names_to_name_index_map(const std::vector<std::string> &input )
20{
21std::map<std::string, unsigned long int> result;
22unsigned long int i=0;
23for (const auto& a: input) {result[a]=i; i++;}
24return result;
25}
26
27std::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.
30std::vector<std::pair<int,int> > result;
31unsigned long int i=1;
32for (const auto& a: input) {result.push_back(std::pair<int,int>(i,a)); i++;}
33return result;
34}
35#endif
36}
static Double_t a
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...