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 }
18std::map<std::string, unsigned long int> names_to_name_index_map(const std::vector<std::string> &input )
19{
20std::map<std::string, unsigned long int> result;
21unsigned long int i=0;
22for (const auto& a: input) {result[a]=i; i++;}
23return result;
24}
25
26std::vector<std::pair<int,int> > vector_to_vector_int_int(const std::vector<int> &input )
27{
28// The "i" values used here now match HepMC2 most of the time, but still differ sometimes.
29std::vector<std::pair<int,int> > result;
30unsigned long int i=1;
31for (const auto& a: input) {result.push_back(std::pair<int,int>(i,a)); i++;}
32return result;
33}
34}
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...