25 #define LOG cout << "TCS::InvariantMassInclusive2: "
73 p_NumberLeading1 = parameter(
"InputWidth1").value();
74 p_NumberLeading2 = parameter(
"InputWidth2").value();
75 if(parameter(
"MaxTob1").
value() > 0) p_NumberLeading1 = parameter(
"MaxTob1").value();
76 if(parameter(
"MaxTob2").
value() > 0) p_NumberLeading2 = parameter(
"MaxTob2").value();
78 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
79 p_InvMassMin[
i] = parameter(
"MinMSqr",
i).value();
80 p_InvMassMax[
i] = parameter(
"MaxMSqr",
i).value();
82 p_MinET1[
i] = parameter(
"MinET1",
i).value();
83 p_MinET2[
i] = parameter(
"MinET2",
i).value();
87 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
94 p_ApplyEtaCut = parameter(
"ApplyEtaCut").value();
95 p_MinEta1 = parameter(
"MinEta1" ).value();
96 p_MaxEta1 = parameter(
"MaxEta1" ).value();
97 p_MinEta2 = parameter(
"MinEta2" ).value();
98 p_MaxEta2 = parameter(
"MaxEta2" ).value();
108 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
109 std::string hname_accept =
"hInvariantMassInclusive2_accept_bit"+
std::to_string((
int)
i);
110 std::string hname_reject =
"hInvariantMassInclusive2_reject_bit"+
std::to_string((
int)
i);
112 bookHist(m_histAcceptM, hname_accept,
"INVM", 100, sqrt(p_InvMassMin[
i]), sqrt(p_InvMassMax[
i]));
113 bookHist(m_histRejectM, hname_reject,
"INVM", 100, sqrt(p_InvMassMin[
i]), sqrt(p_InvMassMax[
i]));
115 bookHist(m_histAcceptEta1Eta2, hname_accept,
"ETA vs ETA", 100, p_MinEta1, p_MaxEta1, 100, p_MinEta2, p_MaxEta2);
116 bookHist(m_histRejectEta1Eta2, hname_reject,
"ETA vs ETA", 100, p_MinEta1, p_MaxEta1, 100, p_MinEta2, p_MaxEta2);
126 const std::vector<TCS::TOBArray *> &
output,
130 if(
input.size() == 2) {
135 if (p_NumberLeading1 <
input[0]->
size()) {
137 if ((*tob1)->Et() == (*tob1_plus1)->Et() &&
distance(
input[0]->
begin(), tob1) == p_NumberLeading1 - 1) {
138 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
139 output[
i]->setAmbiguityFlag(
true);
147 unsigned int invmass2 = calcInvMassBW( *tob1, *tob2 );
148 const int eta1 = (*tob1)->eta();
149 const int eta2 = (*tob2)->eta();
150 const unsigned int aeta1 = std::abs(
eta1);
151 const unsigned int aeta2 = std::abs(
eta2);
152 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
154 if(
parType_t((*tob1)->Et()) <= p_MinET1[
i])
continue;
155 if(
parType_t((*tob2)->Et()) <= p_MinET2[
i])
continue;
157 ((aeta1 < p_MinEta1 || aeta1 > p_MaxEta1 ) ||
158 (aeta2 < p_MinEta2 || aeta2 > p_MaxEta2 ) ))
continue;
159 accept = invmass2 >= p_InvMassMin[
i] && invmass2 <= p_InvMassMax[
i];
160 const bool fillAccept = fillHistos() and (fillHistosBasedOnHardware() ? getDecisionHardwareBit(
i) :
accept);
161 const bool fillReject = fillHistos() and not fillAccept;
162 const bool alreadyFilled = decision.
bit(
i);
167 if(fillAccept and not alreadyFilled) {
168 fillHist1D(m_histAcceptM[
i],sqrt((
float)invmass2));
169 fillHist2D(m_histAcceptEta1Eta2[
i],
eta1,
eta2);
170 }
else if(fillReject) {
171 fillHist1D(m_histRejectM[
i],sqrt((
float)invmass2));
172 fillHist2D(m_histRejectEta1Eta2[
i],
eta1,
eta2);
174 TRG_MSG_DEBUG(
"Decision " <<
i <<
": " << (
accept?
"pass":
"fail") <<
" invmass2 = " << invmass2);
180 TCS_EXCEPTION(
"InvariantMassInclusive2 alg must have 2 inputs, but got " <<
input.size());
189 const std::vector<TCS::TOBArray *> &
output,
194 if(
input.size() == 2) {
199 if (p_NumberLeading1 <
input[0]->
size()) {
201 if ((*tob1)->Et() == (*tob1_plus1)->Et() &&
distance(
input[0]->
begin(), tob1) == p_NumberLeading1 - 1) {
202 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
203 output[
i]->setAmbiguityFlag(
true);
211 unsigned int invmass2 = calcInvMass( *tob1, *tob2 );
212 const int eta1 = (*tob1)->eta();
213 const int eta2 = (*tob2)->eta();
214 const unsigned int aeta1 = std::abs(
eta1);
215 const unsigned int aeta2 = std::abs(
eta2);
216 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
217 if(
parType_t((*tob1)->Et()) <= p_MinET1[
i])
continue;
218 if(
parType_t((*tob2)->Et()) <= p_MinET2[
i])
continue;
220 ((aeta1 < p_MinEta1 || aeta1 > p_MaxEta1 ) ||
221 (aeta2 < p_MinEta2 || aeta2 > p_MaxEta2 ) ))
continue;
222 bool accept = invmass2 >= p_InvMassMin[
i] && invmass2 <= p_InvMassMax[
i];
223 const bool fillAccept = fillHistos() and (fillHistosBasedOnHardware() ? getDecisionHardwareBit(
i) :
accept);
224 const bool fillReject = fillHistos() and not fillAccept;
225 const bool alreadyFilled = decision.
bit(
i);
230 if(fillAccept and not alreadyFilled) {
231 fillHist1D(m_histAcceptM[
i],sqrt((
float)invmass2));
232 fillHist2D(m_histAcceptEta1Eta2[
i],
eta1,
eta2);
233 }
else if(fillReject) {
234 fillHist1D(m_histRejectM[
i],sqrt((
float)invmass2));
235 fillHist2D(m_histRejectEta1Eta2[
i],
eta1,
eta2);
237 TRG_MSG_DEBUG(
"Decision " <<
i <<
": " << (
accept ?
"pass":
"fail") <<
" invmass2 = " << invmass2);
242 TCS_EXCEPTION(
"InvariantMassInclusive2 alg must have 2 inputs, but got " <<
input.size());