Jpp  master_rocky-43-ge265d140c
the software that should make you happy
multiplicity.hh
Go to the documentation of this file.
1 #ifndef __TOOLS_MULTIPLICITY__
2 #define __TOOLS_MULTIPLICITY__
3 
6 
7 
8 /**
9  * Retrieve bundle multiplicity of given event.
10  *
11  * \param event event
12  */
13 inline int get_multiplicity(const Evt& event)
14 {
15  using namespace std;
16 
17  // Bundle multiplicity is stored in the `len` member variable for `track_bundle`s.
18 
19  for ( auto& t : event.mc_trks ) {
20  if ( t.status == TRK_ST_MUONBUNDLE ) { return (int) t.len; }
21  }
22 
23  ostream& out = Exception::getOstream();
24  out << "get_multiplicity(): The following event does not correspond to a muon bundle:" << endl;
25  event.print(out);
26  throw Exception(static_cast<ostringstream&>(out).str());
27 }
28 
29 #endif
General exception.
Definition: Exception.hh:13
static std::ostream & getOstream()
Get output stream for conversion of exception.
Definition: Exception.hh:63
int get_multiplicity(const Evt &event)
Retrieve bundle multiplicity of given event.
Definition: multiplicity.hh:13
Definition: JSTDTypes.hh:14
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:21
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition: Evt.hh:49
static const int TRK_ST_MUONBUNDLE
initial state muon bundle (mupage)
Definition: trkmembers.hh:18