ATLAS Offline Software
LAr.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  * LAr.cpp
6  * Created by Joerg Stelzer on 11/16/12.
7  * Modified by V SOrin 2014
8  *
9  * @brief algorithm calculates the phi-distance between one lists and applies delta-phi criteria
10  *
11  * @param NumberLeading
12 **********************************/
13 
14 #include <cmath>
15 
16 #include "L1TopoAlgorithms/LAr.h"
17 #include "L1TopoCommon/Exception.h"
19 
21 
22 
23 TCS::LAr::LAr(const std::string & name) : DecisionAlg(name)
24 {
25  defineParameter("InputWidth", 3);
26  defineParameter("MaxTob", 0);
27  defineParameter("NumResultBits", 1);
28  defineParameter("PhiMin", 0);
29  defineParameter("PhiMax", 63);
30  defineParameter("EtaMin", 0);
31  defineParameter("EtaMax", 5);
32  defineParameter("MinET",1);
33  setNumberOutputBits(1);
34 }
35 
37 
38 
41  p_NumberLeading1 = parameter("InputWidth").value();
42  if(parameter("MaxTob").value() > 0) p_NumberLeading1 = parameter("MaxTob").value();
43  p_PhiMin = parameter("PhiMin").value();
44  p_PhiMax = parameter("PhiMax").value();
45  p_EtaMin = parameter("EtaMin").value();
46  p_EtaMax = parameter("EtaMax").value();
47  p_MinET = parameter("MinET").value();
48 
49  TRG_MSG_INFO("NumberLeading1 : " << p_NumberLeading1); // note that the reading of generic parameters doesn't work yet
50  TRG_MSG_INFO("PhiMin : " << p_PhiMin);
51  TRG_MSG_INFO("PhiMax : " << p_PhiMax);
52  TRG_MSG_INFO("EtaMin : " << p_EtaMin);
53  TRG_MSG_INFO("EtaMax : " << p_EtaMax);
54  TRG_MSG_INFO("MinET : " << p_MinET);
55  TRG_MSG_INFO("nummber output : " << numberOutputBits());
56 
57  return StatusCode::SUCCESS;
58 }
59 
61 TCS::LAr::processBitCorrect( const std::vector<TCS::TOBArray const *> & input,
62  const std::vector<TCS::TOBArray *> & output,
63  Decision & decision )
64 
65 {
66  if(input.size() == 1) {
67 
68  TRG_MSG_DEBUG("input size : " << input[0]->size());
69 
70  unsigned int nLeading = p_NumberLeading1;
71  bool accept{false};
72 
73  for( TOBArray::const_iterator tob1 = input[0]->begin();
74  tob1 != input[0]->end() && distance( input[0]->begin(), tob1) < nLeading;
75  ++tob1)
76  {
77 
78  if( parType_t((*tob1)->Et()) <= p_MinET ) continue; // ET cut
79  if( parType_t((*tob1)->eta()) <= p_EtaMin ) continue; // ETa cut
80  if( parType_t((*tob1)->eta()) >= p_EtaMax ) continue; // ETa cut
81  if( parType_t(abs((*tob1)->phi())) <= p_PhiMin ) continue; // phi cut
82  if( parType_t(abs((*tob1)->phi())) >= p_PhiMax ) continue; // phi cut
83 
84 
85 
86  accept = true;
87 
88  output[0]->push_back(TCS::CompositeTOB(*tob1));
89 
90  TRG_MSG_DEBUG("TOB " << distance(input[0]->begin(), tob1) << " ET = " << (*tob1)->Et() << " ETa = " << (*tob1)->eta() << " phi = " << (*tob1)->phi() );
91  }
92 
93  decision.setBit( 0, accept );
94 
95 
96 
97  } else {
98 
99  TCS_EXCEPTION("LAr alg must have 1 input, but got " << input.size());
100 
101  }
103 }
104 
105 
107 TCS::LAr::process( const std::vector<TCS::TOBArray const *> & input,
108  const std::vector<TCS::TOBArray *> & output,
109  Decision & decision )
110 {
111 
112  if(input.size() == 1) {
113 
114  TRG_MSG_DEBUG("input size : " << input[0]->size());
115 
116  unsigned int nLeading = p_NumberLeading1;
117  bool accept{false};
118 
119  for( TOBArray::const_iterator tob1 = input[0]->begin();
120  tob1 != input[0]->end() && distance( input[0]->begin(), tob1) < nLeading;
121  ++tob1)
122  {
123 
124  if( parType_t((*tob1)->Et()) <= p_MinET ) continue; // ET cut
125  if( parType_t((*tob1)->eta()) <= p_EtaMin ) continue; // ETa cut
126  if( parType_t((*tob1)->eta()) >= p_EtaMax ) continue; // ETa cut
127  if( parType_t(abs((*tob1)->phi())) <= p_PhiMin ) continue; // phi cut
128  if( parType_t(abs((*tob1)->phi())) >= p_PhiMax ) continue; // phi cut
129 
130 
131 
132  accept = true;
133 
134  output[0]->push_back(TCS::CompositeTOB(*tob1));
135 
136  TRG_MSG_DEBUG("TOB " << distance(input[0]->begin(), tob1) << " ET = " << (*tob1)->Et() << " ETa = " << (*tob1)->eta() << " phi = " << (*tob1)->phi() );
137  }
138 
139  decision.setBit( 0, accept );
140 
141 
142 
143  } else {
144 
145  TCS_EXCEPTION("LAr alg must have 1 input, but got " << input.size());
146 
147  }
149 }
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
LAr
Definition: LArVolumeBuilder.h:36
CutsMETMaker::accept
StatusCode accept(const xAOD::Muon *mu)
Definition: CutsMETMaker.cxx:18
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
athena.value
value
Definition: athena.py:122
TCS::LAr::process
virtual StatusCode process(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition: LAr.cxx:107
Decision.h
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:562
TCS::DecisionAlg
Definition: Trigger/TrigT1/L1Topo/L1TopoInterfaces/L1TopoInterfaces/DecisionAlg.h:22
TCS::LAr::~LAr
virtual ~LAr()
Definition: LAr.cxx:36
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
TCS::Decision::setBit
void setBit(unsigned int index, bool value)
Definition: L1Topo/L1TopoInterfaces/Root/Decision.cxx:12
LAr.h
TCS::CompositeTOB
Definition: CompositeTOB.h:16
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
TCS::LAr::processBitCorrect
virtual StatusCode processBitCorrect(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition: LAr.cxx:61
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:192
TCS::LAr::initialize
virtual StatusCode initialize()
Definition: LAr.cxx:40
TCS
Definition: Global/GlobalSimulation/src/IO/Decision.h:18
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