ATLAS Offline Software
count_bunch_neighbors.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // System include(s):
6 #include <algorithm>
7 #include <functional>
8 
9 // Local include(s):
10 #include "count_bunch_neighbors.h"
12 
13 namespace Trig {
14 
16  count_bunch_neighbors( const std::vector< int >& bunches,
17  int maxBunchSpacing )
18  : m_bunches( bunches ), m_maxBunchSpacing( maxBunchSpacing ) {
19 
20  }
21 
22  int count_bunch_neighbors::operator()( int bunch ) const {
23 
24  // Count how many neighbors the bunch has:
25  const int maxBunchSpacing = m_maxBunchSpacing;
26  const int neighbors =
27  std::count_if( m_bunches.begin(), m_bunches.end(),
28  [ maxBunchSpacing, bunch ]( int b ) {
29  return ( Trig::distance( bunch, b ) <=
30  maxBunchSpacing );
31  } );
32 
33  // Remember that the above expression always counts the bunch itself
34  // as its own neighbor. So the real value we're looking for is 1 less.
35  return ( neighbors - 1 );
36  }
37 
38 } // namespace Trig
Trig::count_bunch_neighbors::operator()
int operator()(int bunch) const
Count how many neighbors can be found for the specified bunch crossing.
Definition: count_bunch_neighbors.cxx:22
Trig::count_bunch_neighbors::m_bunches
const std::vector< int > & m_bunches
Filled bunches in the current configuration.
Definition: count_bunch_neighbors.h:36
Trig
The common trigger namespace for trigger analysis tools.
Definition: CaloTowerVecMon.h:44
BunchCrossing.h
Trig::count_bunch_neighbors::count_bunch_neighbors
count_bunch_neighbors(const std::vector< int > &bunches, int maxBunchSpacing)
Constructor with colliding bunches, and maximum bunch spacing.
Definition: count_bunch_neighbors.cxx:16
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
Trig::count_bunch_neighbors::m_maxBunchSpacing
const int m_maxBunchSpacing
Maximum bunch spacing to consider.
Definition: count_bunch_neighbors.h:38
count_bunch_neighbors.h