29 defineParameter(
"InputWidth1", 9);
30 defineParameter(
"InputWidth2", 9);
31 defineParameter(
"MaxTob1", 0);
32 defineParameter(
"MaxTob2", 0);
33 defineParameter(
"NumResultBits", 6);
34 defineParameter(
"MinMSqr", 0, 0);
35 defineParameter(
"MaxMSqr", 999, 0);
36 defineParameter(
"MinMSqr", 0, 1);
37 defineParameter(
"MaxMSqr", 999, 1);
38 defineParameter(
"MinMSqr", 0, 2);
39 defineParameter(
"MaxMSqr", 999, 2);
40 defineParameter(
"MinMSqr", 0, 3);
41 defineParameter(
"MaxMSqr", 999, 3);
42 defineParameter(
"MinMSqr", 0, 4);
43 defineParameter(
"MaxMSqr", 999, 4);
44 defineParameter(
"MinMSqr", 0, 5);
45 defineParameter(
"MaxMSqr", 999, 5);
46 defineParameter(
"MinET1",0,0);
47 defineParameter(
"MinET2",0,0);
48 defineParameter(
"MinET1",0,1);
49 defineParameter(
"MinET2",0,1);
50 defineParameter(
"MinET1",0,2);
51 defineParameter(
"MinET2",0,2);
52 defineParameter(
"MinET1",0,3);
53 defineParameter(
"MinET2",0,3);
54 defineParameter(
"MinET1",0,4);
55 defineParameter(
"MinET2",0,4);
56 defineParameter(
"MinET1",0,5);
57 defineParameter(
"MinET2",0,5);
58 defineParameter(
"ApplyEtaCut", 0);
59 defineParameter(
"MinEta1", 0);
60 defineParameter(
"MaxEta1", 31);
61 defineParameter(
"MinEta2", 0);
62 defineParameter(
"MaxEta2", 31);
63 defineParameter(
"DeltaRMin", 0, 0);
64 defineParameter(
"DeltaRMax", 0, 0);
65 defineParameter(
"DeltaRMin", 0, 1);
66 defineParameter(
"DeltaRMax", 0, 1);
67 defineParameter(
"DeltaRMin", 0, 2);
68 defineParameter(
"DeltaRMax", 0, 2);
69 defineParameter(
"DeltaRMin", 0, 3);
70 defineParameter(
"DeltaRMax", 0, 3);
71 defineParameter(
"DeltaRMin", 0, 4);
72 defineParameter(
"DeltaRMax", 0, 4);
73 defineParameter(
"DeltaRMin", 0, 5);
74 defineParameter(
"DeltaRMax", 0, 5);
76 setNumberOutputBits(6);
85 m_NumberLeading1 = parameter(
"InputWidth1").value();
86 m_NumberLeading2 = parameter(
"InputWidth2").value();
87 if(parameter(
"MaxTob1").
value() > 0) m_NumberLeading1 = parameter(
"MaxTob1").value();
88 if(parameter(
"MaxTob2").
value() > 0) m_NumberLeading2 = parameter(
"MaxTob2").value();
92 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
94 m_InvMassMin[
i] = parameter(
"MinMSqr",
i).value();
95 m_InvMassMax[
i] = parameter(
"MaxMSqr",
i).value();
96 m_MinET1[
i] = parameter(
"MinET1",
i).value();
97 m_MinET2[
i] = parameter(
"MinET2",
i).value();
98 m_DeltaRMin[
i] = parameter(
"DeltaRMin",
i).value();
99 m_DeltaRMax[
i] = parameter(
"DeltaRMax",
i).value();
110 m_ApplyEtaCut = parameter(
"ApplyEtaCut").value();
111 m_MinEta1 = parameter(
"MinEta1" ).value();
112 m_MaxEta1 = parameter(
"MaxEta1" ).value();
113 m_MinEta2 = parameter(
"MinEta2" ).value();
114 m_MaxEta2 = parameter(
"MaxEta2" ).value();
124 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
125 std::string hname_accept =
"hInvariantMassInclusiveDeltaRSqrIncl2Charge_accept_bit"+
std::to_string(
static_cast<int>(
i));
126 std::string hname_reject =
"hInvariantMassInclusiveDeltaRSqrIncl2Charge_reject_bit"+
std::to_string(
static_cast<int>(
i));
128 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]));
129 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]));
131 bookHist(m_histAcceptEta1Eta2, hname_accept,
"ETA vs ETA", 100, -70, 70, 100, -70, 70);
132 bookHist(m_histRejectEta1Eta2, hname_reject,
"ETA vs ETA", 100, -70, 70, 100, -70, 70);
142 const std::vector<TCS::TOBArray *> & output,
146 if( input.size() == 2) {
148 tob1 != input[0]->end() &&
distance(input[0]->
begin(), tob1) < m_NumberLeading1;
154 tob2 != input[1]->end() &&
distance(input[1]->
begin(), tob2) < m_NumberLeading2;
157 unsigned int invmass2 = calcInvMassBW( *tob1, *tob2 );
159 unsigned int deltaR2 = calcDeltaR2BW( *tob1, *tob2 );
160 TRG_MSG_DEBUG(
"Jet1 = " << **tob1 <<
", Jet2 = " << **tob2 <<
", invmass2 = " << invmass2 <<
", deltaR2 = " <<
deltaR2);
161 const int eta1 = (*tob1)->eta();
162 const int eta2 = (*tob2)->eta();
163 const unsigned int aeta1 = std::abs(
eta1);
164 const unsigned int aeta2 = std::abs(
eta2);
166 int charge1 = (*tob1)->charge();
167 int charge2 = (*tob2)->charge();
168 int totalCharge = charge1 + charge2;
169 bool acceptCharge =
true;
170 if ( std::abs(totalCharge) == 2 ) { acceptCharge =
false; }
171 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
173 if(
parType_t((*tob1)->Et()) <= m_MinET1[
i])
continue;
174 if(
parType_t((*tob2)->Et()) <= m_MinET2[
i])
continue;
176 ((aeta1 < m_MinEta1 || aeta1 > m_MaxEta1 ) ||
177 (aeta2 < m_MinEta2 || aeta2 > m_MaxEta2 ) ))
continue;
178 accept = invmass2 >= m_InvMassMin[
i] && invmass2 <= m_InvMassMax[
i] &&
180 const bool fillAccept = fillHistos() and (fillHistosBasedOnHardware() ? getDecisionHardwareBit(
i) :
accept);
181 const bool fillReject = fillHistos() and not fillAccept;
182 const bool alreadyFilled = decision.
bit(
i);
187 if(fillAccept and not alreadyFilled) {
188 fillHist2D(m_histAcceptM[
i],std::sqrt(
static_cast<float>(invmass2)),std::sqrt(
static_cast<float>(
deltaR2)));
189 fillHist2D(m_histAcceptEta1Eta2[
i],(*tob1)->eta(),(*tob2)->eta());
190 }
else if(fillReject) {
191 fillHist2D(m_histRejectM[
i],std::sqrt(
static_cast<float>(invmass2)),std::sqrt(
static_cast<float>(
deltaR2)));
192 fillHist2D(m_histRejectEta1Eta2[
i],(*tob1)->eta(),(*tob2)->eta());
198 for (
unsigned int i=0;
i < numberOutputBits(); ++
i) {
201 output[
i]->setAmbiguityFlag(hasAmbiguousInputs);
205 TCS_EXCEPTION(
"InvariantMassInclusiveDeltaRSqrIncl2Charge alg must have 2 inputs, but got " << input.size());
214 const std::vector<TCS::TOBArray *> & output,
219 if( input.size() == 2) {
221 tob1 != input[0]->end() &&
distance(input[0]->
begin(), tob1) < m_NumberLeading1;
225 tob2 != input[1]->end() &&
distance(input[1]->
begin(), tob2) < m_NumberLeading2;
229 unsigned int invmass2 = calcInvMass( *tob1, *tob2 );
231 unsigned int deltaR2 = calcDeltaR2( *tob1, *tob2 );
232 TRG_MSG_DEBUG(
"Jet1 = " << **tob1 <<
", Jet2 = " << **tob2 <<
", invmass2 = " << invmass2 <<
", deltaR2 = " <<
deltaR2);
233 const int eta1 = (*tob1)->eta();
234 const int eta2 = (*tob2)->eta();
235 const unsigned int aeta1 = std::abs(
eta1);
236 const unsigned int aeta2 = std::abs(
eta2);
238 int charge1 = (*tob1)->charge();
239 int charge2 = (*tob2)->charge();
240 int totalCharge = charge1 + charge2;
241 bool acceptCharge =
true;
242 if ( std::abs(totalCharge) == 2 ) { acceptCharge =
false; }
243 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
244 if(
parType_t((*tob1)->Et()) <= m_MinET1[
i])
continue;
245 if(
parType_t((*tob2)->Et()) <= m_MinET2[
i])
continue;
247 ((aeta1 < m_MinEta1 || aeta1 > m_MaxEta1 ) ||
248 (aeta2 < m_MinEta2 || aeta2 > m_MaxEta2 ) ))
continue;
249 bool accept = invmass2 >= m_InvMassMin[
i] && invmass2 <= m_InvMassMax[
i] &&
251 const bool fillAccept = fillHistos() and (fillHistosBasedOnHardware() ? getDecisionHardwareBit(
i) :
accept);
252 const bool fillReject = fillHistos() and not fillAccept;
253 const bool alreadyFilled = decision.
bit(
i);
258 if(fillAccept and not alreadyFilled) {
259 fillHist2D(m_histAcceptM[
i],std::sqrt(
static_cast<float>(invmass2)),std::sqrt(
static_cast<float>(
deltaR2)));
260 fillHist2D(m_histAcceptEta1Eta2[
i],(*tob1)->eta(),(*tob2)->eta());
261 }
else if(fillReject) {
262 fillHist2D(m_histRejectM[
i],std::sqrt(
static_cast<float>(invmass2)),std::sqrt(
static_cast<float>(
deltaR2)));
263 fillHist2D(m_histRejectEta1Eta2[
i],(*tob1)->eta(),(*tob2)->eta());
270 TCS_EXCEPTION(
"InvariantMassInclusiveDeltaRSqrIncl2Charge alg must have 2 inputs, but got " << input.size());