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 m_NumberLeading1 = parameter(
"InputWidth1").value();
85 m_NumberLeading2 = parameter(
"InputWidth2").value();
86 if(parameter(
"MaxTob1").
value() > 0) m_NumberLeading1 = parameter(
"MaxTob1").value();
87 if(parameter(
"MaxTob2").
value() > 0) m_NumberLeading2 = parameter(
"MaxTob2").value();
91 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
93 m_InvMassMin[
i] = parameter(
"MinMSqr",
i).value();
94 m_InvMassMax[
i] = parameter(
"MaxMSqr",
i).value();
95 m_MinET1[
i] = parameter(
"MinET1",
i).value();
96 m_MinET2[
i] = parameter(
"MinET2",
i).value();
97 m_DeltaRMin[
i] = parameter(
"DeltaRMin",
i).value();
98 m_DeltaRMax[
i] = parameter(
"DeltaRMax",
i).value();
109 m_ApplyEtaCut = parameter(
"ApplyEtaCut").value();
110 m_MinEta1 = parameter(
"MinEta1" ).value();
111 m_MaxEta1 = parameter(
"MaxEta1" ).value();
112 m_MinEta2 = parameter(
"MinEta2" ).value();
113 m_MaxEta2 = parameter(
"MaxEta2" ).value();
123 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
124 std::string hname_accept =
"hInvariantMassInclusiveDeltaRSqrIncl2Charge_accept_bit"+
std::to_string(
static_cast<int>(
i));
125 std::string hname_reject =
"hInvariantMassInclusiveDeltaRSqrIncl2Charge_reject_bit"+
std::to_string(
static_cast<int>(
i));
127 bookHist(m_histAcceptM, hname_accept,
"INVM vs DR", 100, std::sqrt(m_InvMassMin[
i]), std::sqrt(m_InvMassMax[
i]), 100, std::sqrt(m_DeltaRMin[
i]), std::sqrt(m_DeltaRMax[
i]));
128 bookHist(m_histRejectM, hname_reject,
"INVM vs DR", 100, std::sqrt(m_InvMassMin[
i]), std::sqrt(m_InvMassMax[
i]), 100, std::sqrt(m_DeltaRMin[
i]), std::sqrt(m_DeltaRMax[
i]));
130 bookHist(m_histAcceptEta1Eta2, hname_accept,
"ETA vs ETA", 100, -70, 70, 100, -70, 70);
131 bookHist(m_histRejectEta1Eta2, hname_reject,
"ETA vs ETA", 100, -70, 70, 100, -70, 70);
141 const std::vector<TCS::TOBArray *> &
output,
145 if(
input.size() == 2) {
156 unsigned int invmass2 = calcInvMassBW( *tob1, *tob2 );
158 unsigned int deltaR2 = calcDeltaR2BW( *tob1, *tob2 );
159 TRG_MSG_DEBUG(
"Jet1 = " << **tob1 <<
", Jet2 = " << **tob2 <<
", invmass2 = " << invmass2 <<
", deltaR2 = " <<
deltaR2);
160 const int eta1 = (*tob1)->eta();
161 const int eta2 = (*tob2)->eta();
162 const unsigned int aeta1 = std::abs(
eta1);
163 const unsigned int aeta2 = std::abs(
eta2);
165 int charge1 = (*tob1)->charge();
166 int charge2 = (*tob2)->charge();
167 int totalCharge = charge1 + charge2;
168 bool acceptCharge =
true;
169 if ( std::abs(totalCharge) == 2 ) { acceptCharge =
false; }
170 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
172 if(
parType_t((*tob1)->Et()) <= m_MinET1[
i])
continue;
173 if(
parType_t((*tob2)->Et()) <= m_MinET2[
i])
continue;
175 ((aeta1 < m_MinEta1 || aeta1 > m_MaxEta1 ) ||
176 (aeta2 < m_MinEta2 || aeta2 > m_MaxEta2 ) ))
continue;
177 accept = invmass2 >= m_InvMassMin[
i] && invmass2 <= m_InvMassMax[
i] &&
179 const bool fillAccept = fillHistos() and (fillHistosBasedOnHardware() ? getDecisionHardwareBit(
i) :
accept);
180 const bool fillReject = fillHistos() and not fillAccept;
181 const bool alreadyFilled = decision.
bit(
i);
186 if(fillAccept and not alreadyFilled) {
187 fillHist2D(m_histAcceptM[
i],std::sqrt(
static_cast<float>(invmass2)),std::sqrt(
static_cast<float>(
deltaR2)));
188 fillHist2D(m_histAcceptEta1Eta2[
i],(*tob1)->eta(),(*tob2)->eta());
189 }
else if(fillReject) {
190 fillHist2D(m_histRejectM[
i],std::sqrt(
static_cast<float>(invmass2)),std::sqrt(
static_cast<float>(
deltaR2)));
191 fillHist2D(m_histRejectEta1Eta2[
i],(*tob1)->eta(),(*tob2)->eta());
199 TCS_EXCEPTION(
"InvariantMassInclusiveDeltaRSqrIncl2Charge alg must have 2 inputs, but got " <<
input.size());
208 const std::vector<TCS::TOBArray *> &
output,
213 if(
input.size() == 2) {
223 unsigned int invmass2 = calcInvMass( *tob1, *tob2 );
225 unsigned int deltaR2 = calcDeltaR2( *tob1, *tob2 );
226 TRG_MSG_DEBUG(
"Jet1 = " << **tob1 <<
", Jet2 = " << **tob2 <<
", invmass2 = " << invmass2 <<
", deltaR2 = " <<
deltaR2);
227 const int eta1 = (*tob1)->eta();
228 const int eta2 = (*tob2)->eta();
229 const unsigned int aeta1 = std::abs(
eta1);
230 const unsigned int aeta2 = std::abs(
eta2);
232 int charge1 = (*tob1)->charge();
233 int charge2 = (*tob2)->charge();
234 int totalCharge = charge1 + charge2;
235 bool acceptCharge =
true;
236 if ( std::abs(totalCharge) == 2 ) { acceptCharge =
false; }
237 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
238 if(
parType_t((*tob1)->Et()) <= m_MinET1[
i])
continue;
239 if(
parType_t((*tob2)->Et()) <= m_MinET2[
i])
continue;
241 ((aeta1 < m_MinEta1 || aeta1 > m_MaxEta1 ) ||
242 (aeta2 < m_MinEta2 || aeta2 > m_MaxEta2 ) ))
continue;
243 bool accept = invmass2 >= m_InvMassMin[
i] && invmass2 <= m_InvMassMax[
i] &&
245 const bool fillAccept = fillHistos() and (fillHistosBasedOnHardware() ? getDecisionHardwareBit(
i) :
accept);
246 const bool fillReject = fillHistos() and not fillAccept;
247 const bool alreadyFilled = decision.
bit(
i);
252 if(fillAccept and not alreadyFilled) {
253 fillHist2D(m_histAcceptM[
i],std::sqrt(
static_cast<float>(invmass2)),std::sqrt(
static_cast<float>(
deltaR2)));
254 fillHist2D(m_histAcceptEta1Eta2[
i],(*tob1)->eta(),(*tob2)->eta());
255 }
else if(fillReject) {
256 fillHist2D(m_histRejectM[
i],std::sqrt(
static_cast<float>(invmass2)),std::sqrt(
static_cast<float>(
deltaR2)));
257 fillHist2D(m_histRejectEta1Eta2[
i],(*tob1)->eta(),(*tob2)->eta());
264 TCS_EXCEPTION(
"InvariantMassInclusiveDeltaRSqrIncl2Charge alg must have 2 inputs, but got " <<
input.size());