39 defineParameter(
"InputWidth", 3);
40 defineParameter(
"MaxTob", 0);
41 defineParameter(
"NumResultBits", 6);
42 defineParameter(
"RequireOneBarrel", 0);
43 defineParameter(
"MinMSqr", 0, 0);
44 defineParameter(
"MaxMSqr", 999, 0);
45 defineParameter(
"MinMSqr", 0, 1);
46 defineParameter(
"MaxMSqr", 999, 1);
47 defineParameter(
"MinMSqr", 0, 2);
48 defineParameter(
"MaxMSqr", 999, 2);
49 defineParameter(
"MinMSqr", 0, 3);
50 defineParameter(
"MaxMSqr", 999, 3);
51 defineParameter(
"MinMSqr", 0, 4);
52 defineParameter(
"MaxMSqr", 999, 4);
53 defineParameter(
"MinMSqr", 0, 5);
54 defineParameter(
"MaxMSqr", 999, 5);
55 defineParameter(
"MinET1",0,0);
56 defineParameter(
"MinET2",0,0);
57 defineParameter(
"MinET1",0,1);
58 defineParameter(
"MinET2",0,1);
59 defineParameter(
"MinET1",0,2);
60 defineParameter(
"MinET2",0,2);
61 defineParameter(
"MinET1",0,3);
62 defineParameter(
"MinET2",0,3);
63 defineParameter(
"MinET1",0,4);
64 defineParameter(
"MinET2",0,4);
65 defineParameter(
"MinET1",0,5);
66 defineParameter(
"MinET2",0,5);
67 defineParameter(
"DeltaRMin", 0, 0);
68 defineParameter(
"DeltaRMax", 0, 0);
69 defineParameter(
"DeltaRMin", 0, 1);
70 defineParameter(
"DeltaRMax", 0, 1);
71 defineParameter(
"DeltaRMin", 0, 2);
72 defineParameter(
"DeltaRMax", 0, 2);
73 defineParameter(
"DeltaRMin", 0, 3);
74 defineParameter(
"DeltaRMax", 0, 3);
75 defineParameter(
"DeltaRMin", 0, 4);
76 defineParameter(
"DeltaRMax", 0, 4);
77 defineParameter(
"DeltaRMin", 0, 5);
78 defineParameter(
"DeltaRMax", 0, 5);
81 setNumberOutputBits(6);
89 if(parameter(
"MaxTob").
value() > 0) {
90 p_NumberLeading1 = parameter(
"MaxTob").value();
91 p_NumberLeading2 = parameter(
"MaxTob").value();
93 p_NumberLeading1 = parameter(
"InputWidth").value();
94 p_NumberLeading2 = parameter(
"InputWidth").value();
97 p_OneBarrel = parameter(
"RequireOneBarrel").value();
103 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
104 p_InvMassMin[
i] = parameter(
"MinMSqr",
i).value();
105 p_InvMassMax[
i] = parameter(
"MaxMSqr",
i).value();
106 p_DeltaRMin[
i] = parameter(
"DeltaRMin",
i).value();
107 p_DeltaRMax[
i] = parameter(
"DeltaRMax",
i).value();
108 p_MinET1[
i] = parameter(
"MinET1",
i).value();
109 p_MinET2[
i] = parameter(
"MinET2",
i).value();
122 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
123 std::string hname_accept =
"hInvariantMassInclusiveDeltaRSqrIncl1Charge_accept_bit"+
std::to_string(
static_cast<int>(
i));
124 std::string hname_reject =
"hInvariantMassInclusiveDeltaRSqrIncl1Charge_reject_bit"+
std::to_string(
static_cast<int>(
i));
126 bookHist(m_histAcceptM, hname_accept,
"INVM vs DR", 100, std::sqrt(p_InvMassMin[
i]), std::sqrt(p_InvMassMax[
i]), 100, std::sqrt(p_DeltaRMin[
i]), std::sqrt(p_DeltaRMax[
i]));
127 bookHist(m_histRejectM, hname_reject,
"INVM vs DR", 100, std::sqrt(p_InvMassMin[
i]), std::sqrt(p_InvMassMax[
i]), 100, std::sqrt(p_DeltaRMin[
i]), std::sqrt(p_DeltaRMax[
i]));
129 bookHist(m_histAcceptEta1Eta2, hname_accept,
"ETA vs ETA", 100, -70, 70, 100, -70, 70);
130 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() == 1) {
148 tob1 != input[0]->end() &&
distance( input[0]->
begin(), tob1) < p_NumberLeading1;
155 tob2 != input[0]->end() &&
distance( input[0]->
begin(), tob2) < p_NumberLeading2;
160 if (p_OneBarrel &&
parType_t(std::abs((*tob1)->eta())) > 10 &&
parType_t(std::abs((*tob2)->eta())) > 10 )
continue;
163 unsigned int invmass2 = calcInvMassBW( *tob1, *tob2 );
165 unsigned int deltaR2 = calcDeltaR2BW( *tob1, *tob2 );
166 TRG_MSG_DEBUG(
"Jet1 = " << **tob1 <<
", Jet2 = " << **tob2 <<
", invmass2 = " << invmass2 <<
", deltaR2 = " <<
deltaR2);
168 int charge1 = (*tob1)->charge();
169 int charge2 = (*tob2)->charge();
170 int totalCharge = charge1 + charge2;
171 bool acceptCharge =
true;
172 if ( std::abs(totalCharge) == 2 ) { acceptCharge =
false; }
173 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
178 accept = invmass2 >= p_InvMassMin[
i] && invmass2 <= p_InvMassMax[i] && deltaR2 >= p_DeltaRMin[
i] &&
deltaR2 <= p_DeltaRMax[
i] && acceptCharge;
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());
197 for (
unsigned int i=0;
i < numberOutputBits(); ++
i) {
200 output[
i]->setAmbiguityFlag(hasAmbiguousInputs);
204 TCS_EXCEPTION(
"InvariantMassInclusiveDeltaRSqrIncl1Charge alg must have either 1 inputs, but got " << input.size());
214 const std::vector<TCS::TOBArray *> & output,
218 if(input.size() == 1) {
220 tob1 != input[0]->end() &&
distance( input[0]->
begin(), tob1) < p_NumberLeading1;
227 tob2 != input[0]->end() &&
distance( input[0]->
begin(), tob2) < p_NumberLeading2;
232 if (p_OneBarrel &&
parType_t(std::abs((*tob1)->eta())) > 10 &&
parType_t(std::abs((*tob2)->eta())) > 10 )
continue;
235 unsigned int invmass2 = calcInvMass( *tob1, *tob2 );
237 unsigned int deltaR2 = calcDeltaR2( *tob1, *tob2 );
238 TRG_MSG_DEBUG(
"Jet1 = " << **tob1 <<
", Jet2 = " << **tob2 <<
", invmass2 = " << invmass2 <<
", deltaR2 = " <<
deltaR2);
240 int charge1 = (*tob1)->charge();
241 int charge2 = (*tob2)->charge();
242 int totalCharge = charge1 + charge2;
243 bool acceptCharge =
true;
244 if ( std::abs(totalCharge) == 2 ) { acceptCharge =
false; }
245 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
250 accept = invmass2 >= p_InvMassMin[
i] && invmass2 <= p_InvMassMax[i] && deltaR2 >= p_DeltaRMin[
i] &&
deltaR2 <= p_DeltaRMax[
i] && acceptCharge;
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());
271 TCS_EXCEPTION(
"InvariantMassInclusiveDeltaRSqrIncl1Charge alg must have either 1 inputs, but got " << input.size());