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));
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;
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; }
176 ((aeta1 < m_MinEta1 || aeta1 >
m_MaxEta1 ) ||
177 (aeta2 < m_MinEta2 || aeta2 >
m_MaxEta2 ) ))
continue;
181 const bool fillReject =
fillHistos() and not fillAccept;
182 const bool alreadyFilled = decision.
bit(i);
187 if(fillAccept and not alreadyFilled) {
190 }
else if(fillReject) {
194 TRG_MSG_DEBUG(
"Decision " << i <<
": " << (accept?
"pass":
"fail") <<
" invmass2 = " << invmass2 <<
" deltaR2 = " << deltaR2 );
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; }
247 ((aeta1 < m_MinEta1 || aeta1 >
m_MaxEta1 ) ||
248 (aeta2 < m_MinEta2 || aeta2 >
m_MaxEta2 ) ))
continue;
252 const bool fillReject =
fillHistos() and not fillAccept;
253 const bool alreadyFilled = decision.
bit(i);
258 if(fillAccept and not alreadyFilled) {
261 }
else if(fillReject) {
265 TRG_MSG_DEBUG(
"Decision " << i <<
": " << (accept?
"pass":
"fail") <<
" invmass2 = " << invmass2 <<
" deltaR2 = " << deltaR2 );
270 TCS_EXCEPTION(
"InvariantMassInclusiveDeltaRSqrIncl2Charge alg must have 2 inputs, but got " << input.size());
#define REGISTER_ALG_TCS(CLASS)
#define TCS_EXCEPTION(MSG)
const Parameter & parameter(const std::string ¶meterName) const
const std::string & name() const
void bookHist(std::vector< std::string > ®Name, const std::string &name, const std::string &title, const int binx, const int xmin, const int xmax)
unsigned int calcDeltaR2BW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
unsigned int calcInvMassBW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
void defineParameter(const std::string &name, TCS::parType_t value)
unsigned int calcDeltaR2(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
unsigned int calcInvMass(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
void fillHist2D(const std::string &histName, double x, double y)
data_t::const_iterator const_iterator
std::vector< std::string > m_histAcceptEta1Eta2
std::vector< std::string > m_histAcceptM
void setNumberOutputBits(unsigned int numberOutputBits)
DecisionAlg(const std::string &name)
std::vector< std::string > m_histRejectEta1Eta2
bool fillHistosBasedOnHardware() const
! getter
bool fillHistos() const
whether the monitoring histograms should be filled
unsigned int numberOutputBits() const
bool getDecisionHardwareBit(const unsigned int &bitNumber) const
! get one hardware decision bit from this algo
std::vector< std::string > m_histRejectM
bool bit(unsigned int index) const
void setBit(unsigned int index, bool value)
parType_t m_InvMassMin[6]
parType_t m_NumberLeading2
InvariantMassInclusiveDeltaRSqrIncl2Charge(const std::string &name)
virtual StatusCode initialize() override final
parType_t m_InvMassMax[6]
virtual StatusCode process(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison) override final
virtual ~InvariantMassInclusiveDeltaRSqrIncl2Charge()
virtual StatusCode processBitCorrect(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison) override final
parType_t m_NumberLeading1
bool isAmbiguousTruncation(TCS::TOBArray const *tobs, size_t pos, unsigned minEt=0)