26 defineParameter(
"InputWidth1", 5);
27 defineParameter(
"InputWidth2", 3);
28 defineParameter(
"MaxTob1", 0);
29 defineParameter(
"MaxTob2", 0);
30 defineParameter(
"NumResultBits", 3);
31 defineParameter(
"MinET1",1,0);
32 defineParameter(
"MinET2",1,0);
33 defineParameter(
"DeltaEtaMin", 0, 0);
34 defineParameter(
"DeltaEtaMax", 63, 0);
35 defineParameter(
"DeltaPhiMin", 0, 0);
36 defineParameter(
"DeltaPhiMax", 63, 0);
37 defineParameter(
"MinET1",1,1);
38 defineParameter(
"MinET2",1,1);
39 defineParameter(
"DeltaEtaMin", 0, 1);
40 defineParameter(
"DeltaEtaMax", 5, 1);
41 defineParameter(
"DeltaPhiMin", 0, 1);
42 defineParameter(
"DeltaPhiMax", 5, 1);
43 defineParameter(
"MinET1",1,2);
44 defineParameter(
"MinET2",1,2);
45 defineParameter(
"DeltaEtaMin", 25, 2);
46 defineParameter(
"DeltaEtaMax", 32, 2);
47 defineParameter(
"DeltaPhiMin", 25, 2);
48 defineParameter(
"DeltaPhiMax", 32, 2);
49 setNumberOutputBits(3);
57 p_NumberLeading1 = parameter(
"InputWidth1").value();
58 p_NumberLeading2 = parameter(
"InputWidth2").value();
59 if(parameter(
"MaxTob1").
value() > 0) p_NumberLeading1 = parameter(
"MaxTob1").value();
60 if(parameter(
"MaxTob2").
value() > 0) p_NumberLeading2 = parameter(
"MaxTob2").value();
62 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
63 p_DeltaPhiMin[
i] = parameter(
"DeltaPhiMin",
i).value();
64 p_DeltaPhiMax[
i] = parameter(
"DeltaPhiMax",
i).value();
65 p_DeltaEtaMin[
i] = parameter(
"DeltaEtaMin",
i).value();
66 p_DeltaEtaMax[
i] = parameter(
"DeltaEtaMax",
i).value();
67 p_MinET1[
i] = parameter(
"MinET1",
i).value();
68 p_MinET2[
i] = parameter(
"MinET2",
i).value();
86 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
87 std::string hname_accept =
"hDeltaEtaPhiIncl2_accept_bit"+
std::to_string((
int)
i);
88 std::string hname_reject =
"hDeltaEtaPhiIncl2_reject_bit"+
std::to_string((
int)
i);
90 bookHist(m_histAccept, hname_accept,
"DETA vs DPHI", 100, p_DeltaEtaMin[
i], p_DeltaEtaMax[
i], 100, p_DeltaPhiMin[
i], p_DeltaPhiMax[
i]);
91 bookHist(m_histReject, hname_reject,
"DETA vs DPHI", 100, p_DeltaEtaMin[
i], p_DeltaEtaMax[
i], 100, p_DeltaPhiMin[
i], p_DeltaPhiMax[
i]);
101 const std::vector<TCS::TOBArray *> & output,
104 if(input.size() == 2) {
106 unsigned int nLeading = p_NumberLeading1;
108 tob1 != input[0]->end() &&
distance( input[0]->
begin(), tob1) < nLeading;
112 tob2 != input[1]->end() &&
distance( input[1]->
begin(), tob2) < p_NumberLeading2;
115 unsigned int deltaPhi = calcDeltaPhiBW( *tob1, *tob2 );
117 unsigned int deltaEta = calcDeltaEtaBW( *tob1, *tob2 );
120 std::stringstream msgss;
121 msgss <<
" phi1=" << (*tob1)->phi() <<
" , phi2=" << (*tob2)->phi()
123 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
125 if(
parType_t((*tob1)->Et()) <= p_MinET1[
i] )
continue;
126 if(
parType_t((*tob2)->Et()) <= p_MinET2[
i])
continue;
128 const bool fillAccept = fillHistos() and (fillHistosBasedOnHardware() ? getDecisionHardwareBit(
i) :
accept);
129 const bool fillReject = fillHistos() and not fillAccept;
130 const bool alreadyFilled = decision.
bit(
i);
135 if(fillAccept and not alreadyFilled) {
137 }
else if(fillReject) {
140 msgss <<
"DeltaRApproxBoxCutIncl2 alg bit" <<
i << (
accept?
" pass":
" fail") <<
"|";
145 for (
unsigned int i=0;
i < numberOutputBits(); ++
i) {
148 output[
i]->setAmbiguityFlag(hasAmbiguousInputs);
151 TCS_EXCEPTION(
"DeltaEtaPhiIncl2 alg must have 2 inputs, but got " << input.size());
159 const std::vector<TCS::TOBArray *> & output,
162 if(input.size() == 2) {
164 unsigned int nLeading = p_NumberLeading1;
166 tob1 != input[0]->end() &&
distance( input[0]->
begin(), tob1) < nLeading;
170 tob2 != input[1]->end() &&
distance( input[1]->
begin(), tob2) < p_NumberLeading2;
173 unsigned int deltaPhi = calcDeltaPhi( *tob1, *tob2 );
175 unsigned int deltaEta = calcDeltaEta( *tob1, *tob2 );
178 std::stringstream msgss;
179 msgss <<
" Combination : " <<
distance( input[0]->
begin(), tob1) <<
" x " <<
distance( input[1]->
begin(), tob2) <<
" phi1=" << (*tob1)->phi() <<
" , phi2=" << (*tob2)->phi()
181 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
183 if(
parType_t((*tob1)->Et()) <= p_MinET1[
i] )
continue;
184 if(
parType_t((*tob2)->Et()) <= p_MinET2[
i])
continue;
186 const bool fillAccept = fillHistos() and (fillHistosBasedOnHardware() ? getDecisionHardwareBit(
i) :
accept);
187 const bool fillReject = fillHistos() and not fillAccept;
188 const bool alreadyFilled = decision.
bit(
i);
193 if(fillAccept and not alreadyFilled) {
195 }
else if(fillReject) {
198 msgss <<
"DeltaRApproxBoxCutIncl2 alg bit" <<
i << (
accept?
" pass":
" fail") <<
"|";
204 TCS_EXCEPTION(
"DeltaEtaPhiIncl2 alg must have 2 inputs, but got " << input.size());