27 defineParameter(
"InputWidth1", 9);
28 defineParameter(
"InputWidth2", 9);
29 defineParameter(
"MaxTob1", 0);
30 defineParameter(
"MaxTob2", 0);
31 defineParameter(
"NumResultBits", 3);
32 defineParameter(
"MinET1",1,0);
33 defineParameter(
"MinET2",1,0);
34 defineParameter(
"DeltaRMin", 0, 0);
35 defineParameter(
"DeltaRMax", 0, 0);
36 defineParameter(
"MinET1",1,1);
37 defineParameter(
"MinET2",1,1);
38 defineParameter(
"DeltaRMin", 0, 1);
39 defineParameter(
"DeltaRMax", 0, 1);
40 defineParameter(
"MinET1",1,2);
41 defineParameter(
"MinET2",1,2);
42 defineParameter(
"DeltaRMin", 0, 2);
43 defineParameter(
"DeltaRMax", 0, 2);
44 setNumberOutputBits(3);
53 m_NumberLeading1 = parameter(
"InputWidth1").value();
54 m_NumberLeading2 = parameter(
"InputWidth2").value();
55 if(parameter(
"MaxTob1").
value() > 0) m_NumberLeading1 = parameter(
"MaxTob1").value();
56 if(parameter(
"MaxTob2").
value() > 0) m_NumberLeading2 = parameter(
"MaxTob2").value();
58 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
59 m_DeltaRMin[
i] = parameter(
"DeltaRMin",
i).value();
60 m_DeltaRMax[
i] = parameter(
"DeltaRMax",
i).value();
61 m_MinET1[
i] = parameter(
"MinET1",
i).value();
62 m_MinET2[
i] = parameter(
"MinET2",
i).value();
77 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
78 std::string hname_accept =
"hDeltaRSqrIncl2Charge_accept_bit"+
std::to_string(
static_cast<int>(
i));
79 std::string hname_reject =
"hDeltaRSqrIncl2Charge_reject_bit"+
std::to_string(
static_cast<int>(
i));
81 bookHist(m_histAccept, hname_accept,
"DR", 100, std::sqrt(m_DeltaRMin[
i]), std::sqrt(m_DeltaRMax[
i]));
82 bookHist(m_histReject, hname_reject,
"DR", 100, std::sqrt(m_DeltaRMin[
i]), std::sqrt(m_DeltaRMax[
i]));
84 bookHist(m_histAcceptEta1Eta2, hname_accept,
"ETA vs ETA", 100, -70, 70, 100, -70, 70);
85 bookHist(m_histRejectEta1Eta2, hname_reject,
"ETA vs ETA", 100, -70, 70, 100, -70, 70);
94 const std::vector<TCS::TOBArray *> & output,
98 if( input.size() == 2) {
101 tob1 != input[0]->end() &&
distance(input[0]->
begin(), tob1) < m_NumberLeading1;
105 tob2 != input[1]->end() &&
distance(input[1]->
begin(), tob2) < m_NumberLeading2;
108 unsigned int deltaR2 = calcDeltaR2BW( *tob1, *tob2 );
111 int charge1 = (*tob1)->charge();
112 int charge2 = (*tob2)->charge();
113 int totalCharge = charge1 + charge2;
114 bool acceptCharge =
true;
115 if ( std::abs(totalCharge) == 2 ) { acceptCharge =
false; }
116 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
118 if(
parType_t((*tob1)->Et()) <= m_MinET1[
i])
continue;
119 if(
parType_t((*tob2)->Et()) <= m_MinET2[
i])
continue;
121 const bool fillAccept = fillHistos() and (fillHistosBasedOnHardware() ? getDecisionHardwareBit(
i) :
accept);
122 const bool fillReject = fillHistos() and not fillAccept;
123 const bool alreadyFilled = decision.
bit(
i);
128 if(fillAccept and not alreadyFilled) {
129 fillHist1D(m_histAccept[
i],std::sqrt(
static_cast<float>(
deltaR2)));
130 fillHist2D(m_histAcceptEta1Eta2[
i],(*tob1)->eta(),(*tob2)->eta());
131 }
else if(fillReject) {
132 fillHist1D(m_histReject[
i],std::sqrt(
static_cast<float>(
deltaR2)));
133 fillHist2D(m_histRejectEta1Eta2[
i],(*tob1)->eta(),(*tob2)->eta());
139 for (
unsigned int i=0;
i < numberOutputBits(); ++
i) {
142 output[
i]->setAmbiguityFlag(hasAmbiguousInputs);
145 TCS_EXCEPTION(
"DeltaRSqrIncl2Charge alg must have 2 inputs, but got " << input.size());
152 const std::vector<TCS::TOBArray *> & output,
156 if( input.size() == 2) {
159 tob1 != input[0]->end() &&
distance(input[0]->
begin(), tob1) < m_NumberLeading1;
165 tob2 != input[1]->end() &&
distance(input[1]->
begin(), tob2) < m_NumberLeading2;
168 unsigned int deltaR2 = calcDeltaR2( *tob1, *tob2 );
171 int charge1 = (*tob1)->charge();
172 int charge2 = (*tob2)->charge();
173 int totalCharge = charge1 + charge2;
174 bool acceptCharge =
true;
175 if ( std::abs(totalCharge) == 2 ) { acceptCharge =
false; }
176 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
178 if(
parType_t((*tob1)->Et()) <= m_MinET1[
i])
continue;
179 if(
parType_t((*tob2)->Et()) <= m_MinET2[
i])
continue;
181 const bool fillAccept = fillHistos() and (fillHistosBasedOnHardware() ? getDecisionHardwareBit(
i) :
accept);
182 const bool fillReject = fillHistos() and not fillAccept;
183 const bool alreadyFilled = decision.
bit(
i);
188 if(fillAccept and not alreadyFilled) {
189 fillHist1D(m_histAccept[
i],std::sqrt(
static_cast<float>(
deltaR2)));
190 fillHist2D(m_histAcceptEta1Eta2[
i],(*tob1)->eta(),(*tob2)->eta());
191 }
else if(fillReject) {
192 fillHist1D(m_histReject[
i],std::sqrt(
static_cast<float>(
deltaR2)));
193 fillHist2D(m_histRejectEta1Eta2[
i],(*tob1)->eta(),(*tob2)->eta());
200 TCS_EXCEPTION(
"DeltaRSqrIncl2Charge alg must have 2 inputs, but got " << input.size());