28 defineParameter(
"InputWidth1", 9);
29 defineParameter(
"InputWidth2", 9);
30 defineParameter(
"MaxTob1", 0);
31 defineParameter(
"MaxTob2", 0);
32 defineParameter(
"NumResultBits", 6);
33 defineParameter(
"MinMSqr", 0, 0);
34 defineParameter(
"MaxMSqr", 999, 0);
35 defineParameter(
"MinMSqr", 0, 1);
36 defineParameter(
"MaxMSqr", 999, 1);
37 defineParameter(
"MinMSqr", 0, 2);
38 defineParameter(
"MaxMSqr", 999, 2);
39 defineParameter(
"MinMSqr", 0, 3);
40 defineParameter(
"MaxMSqr", 999, 3);
41 defineParameter(
"MinMSqr", 0, 4);
42 defineParameter(
"MaxMSqr", 999, 4);
43 defineParameter(
"MinMSqr", 0, 5);
44 defineParameter(
"MaxMSqr", 999, 5);
45 defineParameter(
"MinET1",0,0);
46 defineParameter(
"MinET2",0,0);
47 defineParameter(
"MinET1",0,1);
48 defineParameter(
"MinET2",0,1);
49 defineParameter(
"MinET1",0,2);
50 defineParameter(
"MinET2",0,2);
51 defineParameter(
"MinET1",0,3);
52 defineParameter(
"MinET2",0,3);
53 defineParameter(
"MinET1",0,4);
54 defineParameter(
"MinET2",0,4);
55 defineParameter(
"MinET1",0,5);
56 defineParameter(
"MinET2",0,5);
57 defineParameter(
"ApplyEtaCut", 0);
58 defineParameter(
"MinEta1", 0);
59 defineParameter(
"MaxEta1", 31);
60 defineParameter(
"MinEta2", 0);
61 defineParameter(
"MaxEta2", 31);
62 defineParameter(
"DeltaRMin", 0, 0);
63 defineParameter(
"DeltaRMax", 0, 0);
64 defineParameter(
"DeltaRMin", 0, 1);
65 defineParameter(
"DeltaRMax", 0, 1);
66 defineParameter(
"DeltaRMin", 0, 2);
67 defineParameter(
"DeltaRMax", 0, 2);
68 defineParameter(
"DeltaRMin", 0, 3);
69 defineParameter(
"DeltaRMax", 0, 3);
70 defineParameter(
"DeltaRMin", 0, 4);
71 defineParameter(
"DeltaRMax", 0, 4);
72 defineParameter(
"DeltaRMin", 0, 5);
73 defineParameter(
"DeltaRMax", 0, 5);
75 setNumberOutputBits(6);
84 p_NumberLeading1 = parameter(
"InputWidth1").value();
85 p_NumberLeading2 = parameter(
"InputWidth2").value();
86 if(parameter(
"MaxTob1").
value() > 0) p_NumberLeading1 = parameter(
"MaxTob1").value();
87 if(parameter(
"MaxTob2").
value() > 0) p_NumberLeading2 = parameter(
"MaxTob2").value();
91 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
93 p_InvMassMin[
i] = parameter(
"MinMSqr",
i).value();
94 p_InvMassMax[
i] = parameter(
"MaxMSqr",
i).value();
95 p_MinET1[
i] = parameter(
"MinET1",
i).value();
96 p_MinET2[
i] = parameter(
"MinET2",
i).value();
97 p_DeltaRMin[
i] = parameter(
"DeltaRMin",
i).value();
98 p_DeltaRMax[
i] = parameter(
"DeltaRMax",
i).value();
109 p_ApplyEtaCut = parameter(
"ApplyEtaCut").value();
110 p_MinEta1 = parameter(
"MinEta1" ).value();
111 p_MaxEta1 = parameter(
"MaxEta1" ).value();
112 p_MinEta2 = parameter(
"MinEta2" ).value();
113 p_MaxEta2 = parameter(
"MaxEta2" ).value();
123 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
124 std::string hname_accept =
"hInvariantMassInclusiveDeltaRSqrIncl2_accept_bit"+
std::to_string((
int)
i);
125 std::string hname_reject =
"hInvariantMassInclusiveDeltaRSqrIncl2_reject_bit"+
std::to_string((
int)
i);
127 bookHist(m_histAcceptM, hname_accept,
"INVM vs DR", 100, sqrt(p_InvMassMin[
i]), sqrt(p_InvMassMax[
i]), 100, sqrt(p_DeltaRMin[
i]), sqrt(p_DeltaRMax[
i]));
128 bookHist(m_histRejectM, hname_reject,
"INVM vs DR", 100, sqrt(p_InvMassMin[
i]), sqrt(p_InvMassMax[
i]), 100, sqrt(p_DeltaRMin[
i]), sqrt(p_DeltaRMax[
i]));
139 const std::vector<TCS::TOBArray *> &
output,
143 if(
input.size() == 2) {
154 unsigned int invmass2 = calcInvMassBW( *tob1, *tob2 );
156 unsigned int deltaR2 = calcDeltaR2BW( *tob1, *tob2 );
157 TRG_MSG_DEBUG(
"Jet1 = " << **tob1 <<
", Jet2 = " << **tob2 <<
", invmass2 = " << invmass2 <<
", deltaR2 = " <<
deltaR2);
158 const int eta1 = (*tob1)->eta();
159 const int eta2 = (*tob2)->eta();
160 const unsigned int aeta1 = std::abs(
eta1);
161 const unsigned int aeta2 = std::abs(
eta2);
162 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
164 if(
parType_t((*tob1)->Et()) <= p_MinET1[
i])
continue;
165 if(
parType_t((*tob2)->Et()) <= p_MinET2[
i])
continue;
167 ((aeta1 < p_MinEta1 || aeta1 > p_MaxEta1 ) ||
168 (aeta2 < p_MinEta2 || aeta2 > p_MaxEta2 ) ))
continue;
169 accept = invmass2 >= p_InvMassMin[
i] && invmass2 <= p_InvMassMax[i] && deltaR2 >= p_DeltaRMin[
i] &&
deltaR2 <= p_DeltaRMax[
i];
170 const bool fillAccept = fillHistos() and (fillHistosBasedOnHardware() ? getDecisionHardwareBit(
i) :
accept);
171 const bool fillReject = fillHistos() and not fillAccept;
172 const bool alreadyFilled = decision.
bit(
i);
177 if(fillAccept and not alreadyFilled) {
178 fillHist2D(m_histAcceptM[
i],sqrt((
float)invmass2),sqrt((
float)
deltaR2));
179 }
else if(fillReject) {
180 fillHist2D(m_histRejectM[
i],sqrt((
float)invmass2),sqrt((
float)
deltaR2));
188 TCS_EXCEPTION(
"InvariantMassInclusiveDeltaRSqrIncl2 alg must have 2 inputs, but got " <<
input.size());
197 const std::vector<TCS::TOBArray *> &
output,
202 if(
input.size() == 2) {
211 unsigned int invmass2 = calcInvMass( *tob1, *tob2 );
213 unsigned int deltaR2 = calcDeltaR2( *tob1, *tob2 );
214 TRG_MSG_DEBUG(
"Jet1 = " << **tob1 <<
", Jet2 = " << **tob2 <<
", invmass2 = " << invmass2 <<
", deltaR2 = " <<
deltaR2);
215 const int eta1 = (*tob1)->eta();
216 const int eta2 = (*tob2)->eta();
217 const unsigned int aeta1 = std::abs(
eta1);
218 const unsigned int aeta2 = std::abs(
eta2);
219 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
220 if(
parType_t((*tob1)->Et()) <= p_MinET1[
i])
continue;
221 if(
parType_t((*tob2)->Et()) <= p_MinET2[
i])
continue;
223 ((aeta1 < p_MinEta1 || aeta1 > p_MaxEta1 ) ||
224 (aeta2 < p_MinEta2 || aeta2 > p_MaxEta2 ) ))
continue;
225 bool accept = invmass2 >= p_InvMassMin[
i] && invmass2 <= p_InvMassMax[i] && deltaR2 >= p_DeltaRMin[
i] &&
deltaR2 <= p_DeltaRMax[
i];
226 const bool fillAccept = fillHistos() and (fillHistosBasedOnHardware() ? getDecisionHardwareBit(
i) :
accept);
227 const bool fillReject = fillHistos() and not fillAccept;
228 const bool alreadyFilled = decision.
bit(
i);
233 if(fillAccept and not alreadyFilled) {
234 fillHist2D(m_histAcceptM[
i],sqrt((
float)invmass2),sqrt((
float)
deltaR2));
235 }
else if(fillReject) {
236 fillHist2D(m_histRejectM[
i],sqrt((
float)invmass2),sqrt((
float)
deltaR2));
243 TCS_EXCEPTION(
"InvariantMassInclusiveDeltaRSqrIncl2 alg must have 2 inputs, but got " <<
input.size());