ATLAS Offline Software
Loading...
Searching...
No Matches
JetMatch.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 * JetMatch.cpp
6 * Created by V.Sorin, Joerg Stelzer on 11/16/12.
7 *
8 * @brief algorithm calculates mult of jets passing cuts on 8x8 and 4x4 sizes, cut on mult of jets
9 *
10 * @param NumberLeading
11**********************************/
12
13#include <cmath>
14
18
19
20REGISTER_ALG_TCS(JetMatch)
21
22
23// not the best solution but we will move to athena where this comes for free
24#define LOG std::cout << name() << ": "
25
26
28{
29 defineParameter("InputWidth", 3);
30 defineParameter("MaxTob", 0);
31 defineParameter("NumResultBits", 1);
32 defineParameter("MinET1",0);
33 defineParameter("MinET2",0);
34 defineParameter("EtaMin",0);
35 defineParameter("EtaMax",49);
37}
38
41
42
45 p_NumberLeading1 = parameter("InputWidth").value();
46 if(parameter("MaxTob").value() > 0) p_NumberLeading1 = parameter("MaxTob").value();
47 p_MinET1 = parameter("MinET1").value();
48 p_MinET2 = parameter("MinET2").value();
49 p_EtaMin = parameter("EtaMin").value();
50 p_EtaMax = parameter("EtaMax").value();
51
52 TRG_MSG_INFO("MaxTob : " << p_NumberLeading1);
53 TRG_MSG_INFO("MinET1 : " << p_MinET1);
54 TRG_MSG_INFO("MinET2 : " << p_MinET2);
55 TRG_MSG_INFO("EtaMin : " << p_EtaMin);
56 TRG_MSG_INFO("EtaMax : " << p_EtaMax);
57 TRG_MSG_INFO("number output : " << numberOutputBits());
59}
60
62TCS::JetMatch::processBitCorrect( const std::vector<TCS::TOBArray const *> & input,
63 const std::vector<TCS::TOBArray *> & output,
64 Decision & decision )
65
66{
67 return process(input,output,decision);
68}
69
70
72TCS::JetMatch::process( const std::vector<TCS::TOBArray const *> & input,
73 const std::vector<TCS::TOBArray *> & output,
74 Decision & decision )
75{
76
77 if(input.size()!=1) {
78 TCS_EXCEPTION("JetMatch alg must have exactly 1 input list, but got " << input.size());
79 }
80
81 // vector of passing tob
82 std::vector<TCS::GenericTOB*> TOBvector;
83
84 // loop over all jets
85 unsigned int objC(0);
86 for( TCS::GenericTOB * tob : *input[0]) {
87 ++objC;
88
89 if( parType_t(std::abs(tob->eta())) > p_EtaMax ) continue; // Eta cut
90 if( parType_t(std::abs(tob->eta())) < p_EtaMin ) continue; // Eta cut
91 if( tob->EtWide() <= p_MinET1 ) continue; // E_T cut
92
93 if( tob->EtNarrow() <= p_MinET2 ) continue; // E_T cut
94
95 TRG_MSG_DEBUG("Jet " << objC-1 << ": ETWide = " << tob->EtWide() << ", ETNarrow = " << tob->EtNarrow());
96
97 // keep a list of all TOB that contributed
98 TOBvector.push_back( tob );
99
100 }
101
102 for(unsigned int i=0; i<numberOutputBits(); ++i) {
103
104 bool accept = TOBvector.size() >= p_NumberLeading1 ;
105
106 decision.setBit( i, accept );
107
108 if(accept)
109 output[i]->push_back( TCS::CompositeTOB(TOBvector));
110
111 TRG_MSG_DEBUG("Decision " << i << ": " << (accept?"pass":"fail") << " Njets = " << TOBvector.size());
112
113 }
114
116}
#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)
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
virtual StatusCode initialize()
Definition JetMatch.cxx:44
parType_t p_MinET2
Definition JetMatch.h:35
parType_t p_EtaMax
Definition JetMatch.h:37
virtual ~JetMatch()
Definition JetMatch.cxx:39
parType_t p_MinET1
Definition JetMatch.h:34
virtual StatusCode processBitCorrect(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition JetMatch.cxx:62
JetMatch(const std::string &name)
Definition JetMatch.cxx:27
virtual StatusCode process(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition JetMatch.cxx:72
parType_t p_EtaMin
Definition JetMatch.h:36
parType_t p_NumberLeading1
Definition JetMatch.h:33
const std::string process
uint32_t parType_t
Definition Parameter.h:22