ATLAS Offline Software
Ratio2.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  * Ratio2.cpp
6  * Created by Joerg Stelzer on 11/16/12.
7  *
8  * @brief algorithm calculates the phi-distance between one or two lists and applies delta-phi criteria
9  *
10  * @param NumberLeading
11 **********************************/
12 
13 #include <cmath>
14 
16 #include "L1TopoCommon/Exception.h"
18 
19 
20 REGISTER_ALG_TCS(Ratio2)
21 
22 // not the best solution but we will move to athena where this comes for free
23 #define LOG std::cout << name() << ": "
24 
25 
26 TCS::Ratio2::Ratio2(const std::string & name) : DecisionAlg(name)
27 {
28  defineParameter("InputWidth1", 9);
29  defineParameter("InputWidth2", 9);
30  defineParameter("MaxTob1", 0);
31  defineParameter("MaxTob2", 0);
32  defineParameter("NumResultBits", 2);
33  defineParameter("MinET1",0);
34  defineParameter("MinET2",0);
35  defineParameter("EtaMin",0);
36  defineParameter("EtaMax",49);
37  defineParameter("HT",0);
38  defineParameter("Ratio2",0,0);
39  defineParameter("Ratio2",0,1);
41 }
42 
44 {}
45 
46 
49  p_MinET1 = parameter("MinET1").value();
50  p_MinET2 = parameter("MinET2").value();
51  p_EtaMin = parameter("EtaMin").value();
52  p_EtaMax = parameter("EtaMax").value();
53  p_HT = parameter("HT").value();
54  TRG_MSG_INFO("MinET1 : " << p_MinET1);
55  TRG_MSG_INFO("MinET2 : " << p_MinET2);
56  TRG_MSG_INFO("EtaMin : " << p_EtaMin);
57  TRG_MSG_INFO("EtaMax : " << p_EtaMax);
58  TRG_MSG_INFO("HT : " << p_HT);
59 
60  for(int i=0; i<2; ++i) {
61  p_Ratio2[i] = parameter("Ratio2", i).value();
62  TRG_MSG_INFO("Ratio2 " << i << " : " << p_Ratio2[i]);
63  }
64  TRG_MSG_INFO("number output : " << numberOutputBits());
65  return StatusCode::SUCCESS;
66 }
67 
69 TCS::Ratio2::processBitCorrect( const std::vector<TCS::TOBArray const *> & input,
70  const std::vector<TCS::TOBArray *> & output,
71  Decision & decision )
72 
73 {
74  return process(input,output,decision);
75 }
76 
77 
79 TCS::Ratio2::process( const std::vector<TCS::TOBArray const *> & input,
80  const std::vector<TCS::TOBArray *> & output,
81  Decision & decision )
82 {
83 
84  if(input.size()!=2) {
85  TCS_EXCEPTION("Ratio2 alg must have exactly 2 input lists, but got " << input.size());
86  }
87 
88  unsigned int sumET = 0;
89 
90 
91  const TCS::GenericTOB & met = (*input[0])[0];
92 
93  // loop over all jets
94  unsigned int objC(0);
95  for( TCS::GenericTOB * tob : *input[1]) {
96 
97 
98  if( parType_t(std::abs(tob->eta())) > p_EtaMax ) continue; // Eta cut
99  if( parType_t(std::abs(tob->eta())) < p_EtaMin ) continue; // Eta cut
100  if( tob->Et() <= p_MinET2 ) continue; // E_T cut
101 
102  TRG_MSG_DEBUG("Jet : ET = " << tob->Et());
103  ++objC;
104  sumET += tob->Et();
105  }
106 
107  for(unsigned int i=0; i<numberOutputBits(); ++i) {
108 
109  bool accept = objC!=0 && met.Et() > p_MinET1 && 10*(met.Et()*met.Et()) >= p_Ratio2[i]*sumET;
110 
111  decision.setBit( i, accept );
112 
113  if(accept)
114  output[i]->push_back( CompositeTOB( GenericTOB::createOnHeap( GenericTOB(sumET,0,0) ) ));
115 
116  TRG_MSG_DEBUG("Decision " << i << ": " << (accept?"pass":"fail") << " HT = " << sumET << " XE = " << met.Et() );
117 
118  }
119 
121 }
TCS::StatusCode::SUCCESS
@ SUCCESS
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:17
TCS::parType_t
uint32_t parType_t
Definition: Parameter.h:22
CutsMETMaker::accept
StatusCode accept(const xAOD::Muon *mu)
Definition: CutsMETMaker.cxx:18
Decision.h
Ratio2.h
SUSY_SimplifiedModel_PostInclude.process
string process
Definition: SUSY_SimplifiedModel_PostInclude.py:42
TCS::DecisionAlg
Definition: Trigger/TrigT1/L1Topo/L1TopoInterfaces/L1TopoInterfaces/DecisionAlg.h:22
TCS::Ratio2::~Ratio2
virtual ~Ratio2()
Definition: Ratio2.cxx:43
TCS::GenericTOB::createOnHeap
static GenericTOB * createOnHeap(const GenericTOB &)
Definition: GenericTOB.cxx:264
TCS::Decision::setBit
void setBit(unsigned int index, bool value)
Definition: L1Topo/L1TopoInterfaces/Root/Decision.cxx:12
met
Definition: IMETSignificance.h:24
TCS::Ratio2::process
virtual StatusCode process(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition: Ratio2.cxx:79
lumiFormat.i
int i
Definition: lumiFormat.py:85
TCS::ConfigurableAlg::defineParameter
void defineParameter(const std::string &name, TCS::parType_t value)
Definition: ConfigurableAlg.cxx:201
TCS::CompositeTOB
Definition: CompositeTOB.h:16
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
TCS::Ratio2::processBitCorrect
virtual StatusCode processBitCorrect(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition: Ratio2.cxx:69
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
TCS::Ratio2::initialize
virtual StatusCode initialize()
Definition: Ratio2.cxx:48
merge.output
output
Definition: merge.py:17
TCS::GenericTOB
Definition: GenericTOB.h:35
REGISTER_ALG_TCS
#define REGISTER_ALG_TCS(CLASS)
Definition: AlgFactory.h:62
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TCS::Ratio2::Ratio2
Ratio2(const std::string &name)
Definition: Ratio2.cxx:26
TCS::DecisionAlg::setNumberOutputBits
void setNumberOutputBits(unsigned int numberOutputBits)
Definition: Trigger/TrigT1/L1Topo/L1TopoInterfaces/L1TopoInterfaces/DecisionAlg.h:40
Exception.h
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