ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
Trig::count_bunch_neighbors Class Reference

Functor counting how many neighbors a given bunch crossing has. More...

#include <count_bunch_neighbors.h>

Collaboration diagram for Trig::count_bunch_neighbors:

Public Member Functions

 count_bunch_neighbors (const std::vector< int > &bunches, int maxBunchSpacing)
 Constructor with colliding bunches, and maximum bunch spacing. More...
 
int operator() (int bunch) const
 Count how many neighbors can be found for the specified bunch crossing. More...
 

Private Attributes

const std::vector< int > & m_bunches
 Filled bunches in the current configuration. More...
 
const int m_maxBunchSpacing
 Maximum bunch spacing to consider. More...
 

Detailed Description

Functor counting how many neighbors a given bunch crossing has.

This is used as an unary predicate when counting how many bunches have neighbors closer than X. To determine the minimum bunch spacing of the configurations, before the code would start looking for single bunches and bunch trains.

Author
Attila Krasznahorkay Attil.nosp@m.a.Kr.nosp@m.aszna.nosp@m.hork.nosp@m.ay@ce.nosp@m.rn.c.nosp@m.h

Definition at line 24 of file count_bunch_neighbors.h.

Constructor & Destructor Documentation

◆ count_bunch_neighbors()

Trig::count_bunch_neighbors::count_bunch_neighbors ( const std::vector< int > &  bunches,
int  maxBunchSpacing 
)

Constructor with colliding bunches, and maximum bunch spacing.

Definition at line 15 of file count_bunch_neighbors.cxx.

18  : m_bunches( bunches ), m_maxBunchSpacing( maxBunchSpacing ) {
19 
20  }

Member Function Documentation

◆ operator()()

int Trig::count_bunch_neighbors::operator() ( int  bunch) const

Count how many neighbors can be found for the specified bunch crossing.

Definition at line 22 of file count_bunch_neighbors.cxx.

22  {
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  }

Member Data Documentation

◆ m_bunches

const std::vector< int >& Trig::count_bunch_neighbors::m_bunches
private

Filled bunches in the current configuration.

Definition at line 36 of file count_bunch_neighbors.h.

◆ m_maxBunchSpacing

const int Trig::count_bunch_neighbors::m_maxBunchSpacing
private

Maximum bunch spacing to consider.

Definition at line 38 of file count_bunch_neighbors.h.


The documentation for this class was generated from the following files:
Trig::count_bunch_neighbors::m_bunches
const std::vector< int > & m_bunches
Filled bunches in the current configuration.
Definition: count_bunch_neighbors.h:36
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