ATLAS Offline Software
Multiplicity.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 /*********************************
5  * Multiplicity.cpp
6  * Created by Joerg Stelzer on 11/16/12.
7  * Modified by V SOrin 2014
8  *
9  * @brief algorithm that check muon multiplicity and return 2 output lines, which will give information on how many muons were found
10  * line 1: 0 or 1, line 1 and 2 : 2 or more, uses 2 bits
11  *
12  * @param NumberLeading
13 **********************************/
14 
15 #include <cmath>
16 
18 #include "L1TopoCommon/Exception.h"
20 
21 REGISTER_ALG_TCS(Multiplicity)
22 
23 
25 {
26  defineParameter("InputWidth", 3);
27  defineParameter("NumResultBits", 2);
28  defineParameter("MinET",1);
29  setNumberOutputBits(2);
30 }
31 
33 
34 
37  p_NumberLeading1 = parameter("InputWidth").value();
38  p_MinET = parameter("MinET").value();
39 
40  TRG_MSG_INFO("NumberLeading1 : " << p_NumberLeading1); // note that the reading of generic parameters doesn't work yet
41  TRG_MSG_INFO("MinET : " << p_MinET);
42  TRG_MSG_INFO("number output : " << numberOutputBits());
43 
44  return StatusCode::SUCCESS;
45 }
46 
48 TCS::Multiplicity::processBitCorrect( const std::vector<TCS::TOBArray const *> & input,
49  const std::vector<TCS::TOBArray *> & output,
50  Decision & decision )
51 
52 {
53  return process(input,output,decision);
54 }
55 
56 
57 
59 TCS::Multiplicity::process( const std::vector<TCS::TOBArray const *> & input,
60  const std::vector<TCS::TOBArray *> & output,
61  Decision & decision )
62 {
63 
64  if(input.size() == 1) {
65 
66  // loop over muons
67  unsigned int nLeading = p_NumberLeading1;
68 
69  // counter
70  int nmuon = 0;
71  // vector of tobs passing cuts
72  std::vector<TCS::GenericTOB*> TOBvector;
73 
74  for( TOBArray::const_iterator tob1 = input[0]->begin();
75  tob1 != input[0]->end() && distance( input[0]->begin(), tob1) < nLeading;
76  ++tob1)
77  {
78 
79  if( parType_t((*tob1)->Et()) <= p_MinET ) continue; // E_T cut
80  //
81  TRG_MSG_DEBUG("Muon : ET = " << parType_t((*tob1)->Et()));
82  ++nmuon;
83  // keep a list of all TOB that contributed
84  TOBvector.push_back( *tob1 );
85 
86  }
87  //
88 
89 
90 
91  if (nmuon == 0 or nmuon == 2) decision.setBit( 0, false );
92  if (nmuon == 1 or nmuon > 2) decision.setBit( 0, true );
93  if (nmuon < 2 ) decision.setBit( 1, false );
94  if (nmuon > 1 ) decision.setBit( 1, true );
95 
96  if (nmuon == 1) output[0]->push_back(TCS::CompositeTOB(TOBvector));
97  else if (nmuon > 1 ) output[1]->push_back(TCS::CompositeTOB(TOBvector));
98 
99  } else {
100 
101  TCS_EXCEPTION("Multiplicity alg must have 1 input, but got " << input.size());
102 
103  }
105 }
Multiplicity.h
TCS::StatusCode::SUCCESS
@ SUCCESS
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:17
TCS::parType_t
uint32_t parType_t
Definition: Parameter.h:22
TCS::DataArrayImpl< GenericTOB >::const_iterator
data_t::const_iterator const_iterator
Definition: DataArrayImpl.h:18
TCS::Multiplicity::processBitCorrect
virtual StatusCode processBitCorrect(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition: Multiplicity.cxx:48
TCS::Multiplicity::~Multiplicity
virtual ~Multiplicity()
Definition: Multiplicity.cxx:32
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
TCS::Multiplicity::process
virtual StatusCode process(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition: Multiplicity.cxx:59
Decision.h
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
TCS::Multiplicity::initialize
virtual StatusCode initialize()
Definition: Multiplicity.cxx:36
SUSY_SimplifiedModel_PostInclude.process
string process
Definition: SUSY_SimplifiedModel_PostInclude.py:42
TCS::DecisionAlg
Definition: Trigger/TrigT1/L1Topo/L1TopoInterfaces/L1TopoInterfaces/DecisionAlg.h:22
TCS::Decision::setBit
void setBit(unsigned int index, bool value)
Definition: L1Topo/L1TopoInterfaces/Root/Decision.cxx:12
TCS::CompositeTOB
Definition: CompositeTOB.h:16
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
TCS_EXCEPTION
#define TCS_EXCEPTION(MSG)
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/Exception.h:14
TCS::Decision
Definition: L1Topo/L1TopoInterfaces/L1TopoInterfaces/Decision.h:19
TRG_MSG_INFO
#define TRG_MSG_INFO(x)
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:27
merge.output
output
Definition: merge.py:17
REGISTER_ALG_TCS
#define REGISTER_ALG_TCS(CLASS)
Definition: AlgFactory.h:62
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TCS
Definition: Global/GlobalSimulation/src/IO/Decision.h:18
TCS::Multiplicity
Definition: Multiplicity.h:16
Exception.h
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
TRG_MSG_DEBUG
#define TRG_MSG_DEBUG(x)
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:25
TCS::StatusCode
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:15