ATLAS Offline Software
Loading...
Searching...
No Matches
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
20
21REGISTER_ALG_TCS(Multiplicity)
22
23
25{
26 defineParameter("InputWidth", 3);
27 defineParameter("NumResultBits", 2);
28 defineParameter("MinET",1);
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
45}
46
48TCS::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
59TCS::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}
#define REGISTER_ALG_TCS(CLASS)
Definition AlgFactory.h:62
const Parameter & parameter(const std::string &parameterName) const
const std::string & name() const
void defineParameter(const std::string &name, TCS::parType_t value)
data_t::const_iterator const_iterator
void setNumberOutputBits(unsigned int numberOutputBits)
Definition DecisionAlg.h:40
DecisionAlg(const std::string &name)
Definition DecisionAlg.h:25
unsigned int numberOutputBits() const
Definition DecisionAlg.h:39
void setBit(unsigned int index, bool value)
Definition Decision.cxx:12
parType_t p_NumberLeading1
Multiplicity(const std::string &name)
virtual ~Multiplicity()
virtual StatusCode initialize()
virtual StatusCode process(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
virtual StatusCode processBitCorrect(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
const std::string process
uint32_t parType_t
Definition Parameter.h:22
STL namespace.