35 defineParameter(
"InputWidth", 3);
36 defineParameter(
"MaxTob", 0);
37 defineParameter(
"NumResultBits", 6);
38 defineParameter(
"RequireOneBarrel", 0);
39 defineParameter(
"MinMSqr", 0, 0);
40 defineParameter(
"MaxMSqr", 999, 0);
41 defineParameter(
"MinMSqr", 0, 1);
42 defineParameter(
"MaxMSqr", 999, 1);
43 defineParameter(
"MinMSqr", 0, 2);
44 defineParameter(
"MaxMSqr", 999, 2);
45 defineParameter(
"MinMSqr", 0, 3);
46 defineParameter(
"MaxMSqr", 999, 3);
47 defineParameter(
"MinMSqr", 0, 4);
48 defineParameter(
"MaxMSqr", 999, 4);
49 defineParameter(
"MinMSqr", 0, 5);
50 defineParameter(
"MaxMSqr", 999, 5);
51 defineParameter(
"MinET1",0,0);
52 defineParameter(
"MinET1",0,1);
53 defineParameter(
"MinET1",0,2);
54 defineParameter(
"MinET1",0,3);
55 defineParameter(
"MinET1",0,4);
56 defineParameter(
"MinET1",0,5);
58 setNumberOutputBits(6);
66 if(parameter(
"MaxTob").
value() > 0) {
67 p_NumberLeading1 = parameter(
"MaxTob").value();
69 p_NumberLeading1 = parameter(
"InputWidth").value();
72 p_OneBarrel = parameter(
"RequireOneBarrel").value();
74 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
75 p_InvMassMin[
i] = parameter(
"MinMSqr",
i).value();
76 p_InvMassMax[
i] = parameter(
"MaxMSqr",
i).value();
78 p_MinET1[
i] = parameter(
"MinET1",
i).value();
82 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
91 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
92 std::string hname_accept =
"hInvariantMassThreeTOBsIncl1Charge_accept_bit"+
std::to_string(
static_cast<int>(
i));
93 std::string hname_reject =
"hInvariantMassThreeTOBsIncl1Charge_reject_bit"+
std::to_string(
static_cast<int>(
i));
94 std::string hname_acceptEta1Eta2 =
"hInvariantMassThreeTOBsIncl1Charge_acceptEta1Eta2_bit"+
std::to_string(
static_cast<int>(
i));
95 std::string hname_rejectEta1Eta2 =
"hInvariantMassThreeTOBsIncl1Charge_rejectEta1Eta2_bit"+
std::to_string(
static_cast<int>(
i));
96 std::string hname_acceptEta2Eta3 =
"hInvariantMassThreeTOBsIncl1Charge_acceptEta2Eta3_bit"+
std::to_string(
static_cast<int>(
i));
97 std::string hname_rejectEta2Eta3 =
"hInvariantMassThreeTOBsIncl1Charge_rejectEta2Eta3_bit"+
std::to_string(
static_cast<int>(
i));
98 std::string hname_acceptEta3Eta1 =
"hInvariantMassThreeTOBsIncl1Charge_acceptEta3Eta1_bit"+
std::to_string(
static_cast<int>(
i));
99 std::string hname_rejectEta3Eta1 =
"hInvariantMassThreeTOBsIncl1Charge_rejectEta3Eta1_bit"+
std::to_string(
static_cast<int>(
i));
101 bookHist(m_histAccept, hname_accept,
"INVM", 100, std::sqrt(p_InvMassMin[
i]), std::sqrt(p_InvMassMax[
i]));
102 bookHist(m_histReject, hname_reject,
"INVM", 100, std::sqrt(p_InvMassMin[
i]), std::sqrt(p_InvMassMax[
i]));
104 bookHist(m_histAcceptEta1Eta2, hname_acceptEta1Eta2,
"ETA vs ETA", 100, -70, 70, 100, -70, 70);
105 bookHist(m_histRejectEta1Eta2, hname_rejectEta1Eta2,
"ETA vs ETA", 100, -70, 70, 100, -70, 70);
106 bookHist(m_histAcceptEta2Eta3, hname_acceptEta2Eta3,
"ETA vs ETA", 100, -70, 70, 100, -70, 70);
107 bookHist(m_histRejectEta2Eta3, hname_rejectEta2Eta3,
"ETA vs ETA", 100, -70, 70, 100, -70, 70);
108 bookHist(m_histAcceptEta3Eta1, hname_acceptEta3Eta1,
"ETA vs ETA", 100, -70, 70, 100, -70, 70);
109 bookHist(m_histRejectEta3Eta1, hname_rejectEta3Eta1,
"ETA vs ETA", 100, -70, 70, 100, -70, 70);
121 const std::vector<TCS::TOBArray *> &
output,
125 if(
input.size() == 1) {
142 if (p_OneBarrel &&
static_cast<parType_t>(std::abs((*tob1)->eta())) > 10 &&
static_cast<parType_t>(std::abs((*tob2)->eta())) > 10 &&
static_cast<parType_t>(std::abs((*tob3)->eta())) > 10 )
continue;
145 unsigned int invmass2_12 = calcInvMassBW( *tob1, *tob2 );
146 unsigned int invmass2_13 = calcInvMassBW( *tob1, *tob3 );
147 unsigned int invmass2_23 = calcInvMassBW( *tob2, *tob3 );
148 unsigned int invmass2 = invmass2_12 + invmass2_13 + invmass2_23;
150 int charge1 = (*tob1)->charge();
151 int charge2 = (*tob2)->charge();
152 int charge3 = (*tob3)->charge();
153 int totalCharge = charge1 + charge2 +
charge3;
154 bool acceptCharge =
true;
155 if ( std::abs(totalCharge) == 3 ) { acceptCharge =
false; }
156 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
158 if(
static_cast<parType_t>((*tob1)->Et()) <= p_MinET1[
i])
continue;
159 if(
static_cast<parType_t>((*tob2)->Et()) <= p_MinET1[
i])
continue;
160 if(
static_cast<parType_t>((*tob3)->Et()) <= p_MinET1[
i])
continue;
162 accept = invmass2 >= p_InvMassMin[
i] && invmass2 <= p_InvMassMax[
i] && acceptCharge;
163 const bool fillAccept = fillHistos() and (fillHistosBasedOnHardware() ? getDecisionHardwareBit(
i) :
accept);
164 const bool fillReject = fillHistos() and not fillAccept;
165 const bool alreadyFilled = decision.
bit(
i);
167 std::vector<TCS::GenericTOB*> TOBvector;
168 TOBvector.push_back( *tob1 );
169 TOBvector.push_back( *tob2 );
170 TOBvector.push_back( *tob3 );
175 if(fillAccept and not alreadyFilled) {
176 fillHist1D(m_histAccept[
i],std::sqrt(invmass2));
177 fillHist2D(m_histAcceptEta1Eta2[
i],(*tob1)->eta(),(*tob2)->eta());
178 fillHist2D(m_histAcceptEta2Eta3[
i],(*tob2)->eta(),(*tob3)->eta());
179 fillHist2D(m_histAcceptEta3Eta1[
i],(*tob3)->eta(),(*tob1)->eta());
180 }
else if(fillReject) {
181 fillHist1D(m_histReject[
i],std::sqrt(invmass2));
182 fillHist2D(m_histRejectEta1Eta2[
i],(*tob1)->eta(),(*tob2)->eta());
183 fillHist2D(m_histRejectEta2Eta3[
i],(*tob2)->eta(),(*tob3)->eta());
184 fillHist2D(m_histRejectEta3Eta1[
i],(*tob3)->eta(),(*tob1)->eta());
186 TRG_MSG_DEBUG(
"Decision " <<
i <<
": " << (
accept?
"pass":
"fail") <<
" invmass2 = " << invmass2);
194 TCS_EXCEPTION(
"InvariantMassThreeTOBsIncl1Charge alg must have 1 input list, but got " <<
input.size());
204 const std::vector<TCS::TOBArray *> &
output,
208 if(
input.size() == 1) {
225 if (p_OneBarrel &&
static_cast<parType_t>(std::abs((*tob1)->eta())) > 10 &&
static_cast<parType_t>(std::abs((*tob2)->eta())) > 10 &&
static_cast<parType_t>(std::abs((*tob3)->eta())) > 10 )
continue;
228 unsigned int invmass2_12 = calcInvMass( *tob1, *tob2 );
229 unsigned int invmass2_13 = calcInvMass( *tob1, *tob3 );
230 unsigned int invmass2_23 = calcInvMass( *tob2, *tob3 );
231 unsigned int invmass2 = invmass2_12 + invmass2_13 + invmass2_23;
233 int charge1 = (*tob1)->charge();
234 int charge2 = (*tob2)->charge();
235 int charge3 = (*tob3)->charge();
236 int totalCharge = charge1 + charge2 +
charge3;
237 bool acceptCharge =
true;
238 if ( std::abs(totalCharge) == 3 ) { acceptCharge =
false; }
239 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
241 if(
static_cast<parType_t>((*tob1)->Et()) <= p_MinET1[
i])
continue;
242 if(
static_cast<parType_t>((*tob2)->Et()) <= p_MinET1[
i])
continue;
243 if(
static_cast<parType_t>((*tob3)->Et()) <= p_MinET1[
i])
continue;
245 accept = invmass2 >= p_InvMassMin[
i] && invmass2 <= p_InvMassMax[
i] && acceptCharge;
246 const bool fillAccept = fillHistos() and (fillHistosBasedOnHardware() ? getDecisionHardwareBit(
i) :
accept);
247 const bool fillReject = fillHistos() and not fillAccept;
248 const bool alreadyFilled = decision.
bit(
i);
250 std::vector<TCS::GenericTOB*> TOBvector;
251 TOBvector.push_back( *tob1 );
252 TOBvector.push_back( *tob2 );
253 TOBvector.push_back( *tob3 );
258 if(fillAccept and not alreadyFilled) {
259 fillHist1D(m_histAccept[
i],std::sqrt(invmass2));
260 fillHist2D(m_histAcceptEta1Eta2[
i],(*tob1)->eta(),(*tob2)->eta());
261 fillHist2D(m_histAcceptEta2Eta3[
i],(*tob2)->eta(),(*tob3)->eta());
262 fillHist2D(m_histAcceptEta3Eta1[
i],(*tob3)->eta(),(*tob1)->eta());
263 }
else if(fillReject) {
264 fillHist1D(m_histReject[
i],std::sqrt(invmass2));
265 fillHist2D(m_histRejectEta1Eta2[
i],(*tob1)->eta(),(*tob2)->eta());
266 fillHist2D(m_histRejectEta2Eta3[
i],(*tob2)->eta(),(*tob3)->eta());
267 fillHist2D(m_histRejectEta3Eta1[
i],(*tob3)->eta(),(*tob1)->eta());
269 TRG_MSG_DEBUG(
"Decision " <<
i <<
": " << (
accept?
"pass":
"fail") <<
" invmass2 = " << invmass2);
277 TCS_EXCEPTION(
"InvariantMassThreeTOBsIncl1Charge alg must have either 1 input list, but got " <<
input.size());