38 defineParameter(
"InputWidth", 3);
39 defineParameter(
"MaxTob", 0);
40 defineParameter(
"NumResultBits", 6);
41 defineParameter(
"RequireOneBarrel", 0);
42 defineParameter(
"MinMSqr", 0, 0);
43 defineParameter(
"MaxMSqr", 999, 0);
44 defineParameter(
"MinMSqr", 0, 1);
45 defineParameter(
"MaxMSqr", 999, 1);
46 defineParameter(
"MinMSqr", 0, 2);
47 defineParameter(
"MaxMSqr", 999, 2);
48 defineParameter(
"MinMSqr", 0, 3);
49 defineParameter(
"MaxMSqr", 999, 3);
50 defineParameter(
"MinMSqr", 0, 4);
51 defineParameter(
"MaxMSqr", 999, 4);
52 defineParameter(
"MinMSqr", 0, 5);
53 defineParameter(
"MaxMSqr", 999, 5);
54 defineParameter(
"MinET1",0,0);
55 defineParameter(
"MinET2",0,0);
56 defineParameter(
"MinET1",0,1);
57 defineParameter(
"MinET2",0,1);
58 defineParameter(
"MinET1",0,2);
59 defineParameter(
"MinET2",0,2);
60 defineParameter(
"MinET1",0,3);
61 defineParameter(
"MinET2",0,3);
62 defineParameter(
"MinET1",0,4);
63 defineParameter(
"MinET2",0,4);
64 defineParameter(
"MinET1",0,5);
65 defineParameter(
"MinET2",0,5);
66 defineParameter(
"DeltaRMin", 0, 0);
67 defineParameter(
"DeltaRMax", 0, 0);
68 defineParameter(
"DeltaRMin", 0, 1);
69 defineParameter(
"DeltaRMax", 0, 1);
70 defineParameter(
"DeltaRMin", 0, 2);
71 defineParameter(
"DeltaRMax", 0, 2);
72 defineParameter(
"DeltaRMin", 0, 3);
73 defineParameter(
"DeltaRMax", 0, 3);
74 defineParameter(
"DeltaRMin", 0, 4);
75 defineParameter(
"DeltaRMax", 0, 4);
76 defineParameter(
"DeltaRMin", 0, 5);
77 defineParameter(
"DeltaRMax", 0, 5);
80 setNumberOutputBits(6);
88 if(parameter(
"MaxTob").
value() > 0) {
89 p_NumberLeading1 = parameter(
"MaxTob").value();
90 p_NumberLeading2 = parameter(
"MaxTob").value();
92 p_NumberLeading1 = parameter(
"InputWidth").value();
93 p_NumberLeading2 = parameter(
"InputWidth").value();
96 p_OneBarrel = parameter(
"RequireOneBarrel").value();
102 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
103 p_InvMassMin[
i] = parameter(
"MinMSqr",
i).value();
104 p_InvMassMax[
i] = parameter(
"MaxMSqr",
i).value();
105 p_DeltaRMin[
i] = parameter(
"DeltaRMin",
i).value();
106 p_DeltaRMax[
i] = parameter(
"DeltaRMax",
i).value();
107 p_MinET1[
i] = parameter(
"MinET1",
i).value();
108 p_MinET2[
i] = parameter(
"MinET2",
i).value();
121 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
122 std::string hname_accept =
"hInvariantMassInclusiveDeltaRSqrIncl1Charge_accept_bit"+
std::to_string(
static_cast<int>(
i));
123 std::string hname_reject =
"hInvariantMassInclusiveDeltaRSqrIncl1Charge_reject_bit"+
std::to_string(
static_cast<int>(
i));
125 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]));
126 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]));
128 bookHist(m_histAcceptEta1Eta2, hname_accept,
"ETA vs ETA", 100, -70, 70, 100, -70, 70);
129 bookHist(m_histRejectEta1Eta2, hname_reject,
"ETA vs ETA", 100, -70, 70, 100, -70, 70);
140 const std::vector<TCS::TOBArray *> &
output,
144 if(
input.size() == 1) {
159 if (p_OneBarrel &&
parType_t(std::abs((*tob1)->eta())) > 10 &&
parType_t(std::abs((*tob2)->eta())) > 10 )
continue;
162 unsigned int invmass2 = calcInvMassBW( *tob1, *tob2 );
164 unsigned int deltaR2 = calcDeltaR2BW( *tob1, *tob2 );
165 TRG_MSG_DEBUG(
"Jet1 = " << **tob1 <<
", Jet2 = " << **tob2 <<
", invmass2 = " << invmass2 <<
", deltaR2 = " <<
deltaR2);
167 int charge1 = (*tob1)->charge();
168 int charge2 = (*tob2)->charge();
169 int totalCharge = charge1 + charge2;
170 bool acceptCharge =
true;
171 if ( std::abs(totalCharge) == 2 ) { acceptCharge =
false; }
172 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
177 accept = invmass2 >= p_InvMassMin[
i] && invmass2 <= p_InvMassMax[i] && deltaR2 >= p_DeltaRMin[
i] &&
deltaR2 <= p_DeltaRMax[
i] && acceptCharge;
178 const bool fillAccept = fillHistos() and (fillHistosBasedOnHardware() ? getDecisionHardwareBit(
i) :
accept);
179 const bool fillReject = fillHistos() and not fillAccept;
180 const bool alreadyFilled = decision.
bit(
i);
185 if(fillAccept and not alreadyFilled) {
186 fillHist2D(m_histAcceptM[
i],std::sqrt(
static_cast<float>(invmass2)),std::sqrt(
static_cast<float>(
deltaR2)));
187 fillHist2D(m_histAcceptEta1Eta2[
i],(*tob1)->eta(),(*tob2)->eta());
188 }
else if(fillReject) {
189 fillHist2D(m_histRejectM[
i],std::sqrt(
static_cast<float>(invmass2)),std::sqrt(
static_cast<float>(
deltaR2)));
190 fillHist2D(m_histRejectEta1Eta2[
i],(*tob1)->eta(),(*tob2)->eta());
198 TCS_EXCEPTION(
"InvariantMassInclusiveDeltaRSqrIncl1Charge alg must have either 1 inputs, but got " <<
input.size());
208 const std::vector<TCS::TOBArray *> &
output,
212 if(
input.size() == 1) {
226 if (p_OneBarrel &&
parType_t(std::abs((*tob1)->eta())) > 10 &&
parType_t(std::abs((*tob2)->eta())) > 10 )
continue;
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);
234 int charge1 = (*tob1)->charge();
235 int charge2 = (*tob2)->charge();
236 int totalCharge = charge1 + charge2;
237 bool acceptCharge =
true;
238 if ( std::abs(totalCharge) == 2 ) { acceptCharge =
false; }
239 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
244 accept = invmass2 >= p_InvMassMin[
i] && invmass2 <= p_InvMassMax[i] && deltaR2 >= p_DeltaRMin[
i] &&
deltaR2 <= p_DeltaRMax[
i] && acceptCharge;
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());
265 TCS_EXCEPTION(
"InvariantMassInclusiveDeltaRSqrIncl1Charge alg must have either 1 inputs, but got " <<
input.size());