Commit 2d7facac authored by Davide Gerbaudo's avatar Davide Gerbaudo Committed by Graeme Stewart
Browse files

tag 00-00-68, fixes ATR-14913 (L1TopoAlgorithms-00-00-68)


Former-commit-id: a79bb2f6
parent b0ccad85
......@@ -49,8 +49,7 @@ TCS::ClusterSelect::sort(const InputTOBArray & input, TOBArray & output) {
if( parType_t((*cl)->Et()) <= m_et ) continue; // ET cut
// isolation cut
if (m_iso != 0 ) {
unsigned int isobit(0x1 << (m_iso-1));
if((parType_t((*cl)->isolation()) & isobit) != isobit ) continue;
if((parType_t((*cl)->isolation()) & m_iso) != m_iso ) continue;
}
// eta cut
if (parType_t(std::abs((*cl)-> eta())) < m_minEta) continue;
......
......@@ -76,11 +76,11 @@ TCS::DeltaEtaIncl1::initialize() {
p_NumberLeading1 = parameter("InputWidth").value();
p_NumberLeading2 = parameter("InputWidth").value();
}
for(unsigned int i=0; i<numberOutputBits(); ++i) {
p_DeltaEtaMin[i] = parameter("MinDeltaEta", i).value();
p_DeltaEtaMax[i] = parameter("MaxDeltaEta", i).value();
p_MinET1[i] = parameter("MinET1",i).value();
p_MinET2[i] = parameter("MinET2",i).value();
}
......@@ -98,9 +98,9 @@ TCS::DeltaEtaIncl1::initialize() {
// create strings for histogram names
std::vector<std::ostringstream> MyAcceptHist(numberOutputBits());
std::vector<std::ostringstream> MyRejectHist(numberOutputBits());
for (unsigned int i=0;i<numberOutputBits();i++) {
MyAcceptHist[i] << "Accept" << p_DeltaEtaMin[i] << "DEta";
MyAcceptHist[i] << "Accept" << p_DeltaEtaMin[i] << "DEta";
MyRejectHist[i] << "Reject" << p_DeltaEtaMin[i] << "DEta";
}
......@@ -108,11 +108,11 @@ TCS::DeltaEtaIncl1::initialize() {
const std::string& MyTitle1 = MyAcceptHist[i].str();
const std::string& MyTitle2 = MyRejectHist[i].str();
registerHist(m_histAcceptDEta1[i] = new TH1F(MyTitle1.c_str(),MyTitle1.c_str(),100,0.,4.));
registerHist(m_histRejectDEta1[i] = new TH1F(MyTitle2.c_str(),MyTitle2.c_str(),100,0.,4.));
}
return StatusCode::SUCCESS;
}
......@@ -131,66 +131,51 @@ TCS::DeltaEtaIncl1::process( const std::vector<TCS::TOBArray const *> & input,
const std::vector<TCS::TOBArray *> & output,
Decision & decison )
{
if(input.size() == 1) {
bool iaccept[numberOutputBits()];
std::fill_n(iaccept,numberOutputBits(),0);
//LOG << "input size : " << input[0]->size() << endl;
unsigned int nLeading = p_NumberLeading1;
unsigned int nLeading2 = p_NumberLeading2;
for( TOBArray::const_iterator tob1 = input[0]->begin();
tob1 != input[0]->end() && distance( input[0]->begin(), tob1) < nLeading;
++tob1)
{
TCS::TOBArray::const_iterator tob2 = tob1; ++tob2;
for( ;
tob2 != input[0]->end() && distance( input[0]->begin(), tob2) < nLeading2;
++tob2) {
bool accept[numberOutputBits()];
for(unsigned int i=0; i < numberOutputBits(); ++i) {
if( parType_t((*tob1)->Et()) <= min(p_MinET1[i],p_MinET2[i])) continue; // ET cut
if( parType_t((*tob2)->Et()) <= min(p_MinET1[i],p_MinET2[i])) continue; // ET cut
if( (parType_t((*tob1)->Et()) <= max(p_MinET1[i],p_MinET2[i])) && (parType_t((*tob2)->Et()) <= max(p_MinET1[i],p_MinET2[i]))) continue;
// DeltaEta cuts
unsigned int deltaEta = calcDeltaEta( *tob1, *tob2 );
std::stringstream msgss;
msgss << "Combination : " << distance( input[0]->begin(), tob1) << " x " << distance( input[0]->begin(), tob2) << " eta=" << (*tob1)->eta() << " , eta=" << (*tob2)->eta()
<< ", DeltaEta = " << deltaEta << " -> ";
accept[i] = deltaEta >= p_DeltaEtaMin[i] && deltaEta <= p_DeltaEtaMax[i];
if( accept[i] ) {
decison.setBit(i, true);
output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) );
if (!(iaccept[i])) {
iaccept[i]=1;
m_histAcceptDEta1[i]->Fill((float)deltaEta/10.);
}
bool iaccept[numberOutputBits()];
std::fill_n(iaccept,numberOutputBits(),0);
//LOG << "input size : " << input[0]->size() << endl;
unsigned int nLeading = p_NumberLeading1;
unsigned int nLeading2 = p_NumberLeading2;
for( TOBArray::const_iterator tob1 = input[0]->begin();
tob1 != input[0]->end() && distance( input[0]->begin(), tob1) < nLeading;
++tob1)
{
TCS::TOBArray::const_iterator tob2 = tob1; ++tob2;
for( ;
tob2 != input[0]->end() && distance( input[0]->begin(), tob2) < nLeading2;
++tob2) {
for(unsigned int i=0; i < numberOutputBits(); ++i) {
bool accept = false;
if( parType_t((*tob1)->Et()) <= min(p_MinET1[i],p_MinET2[i])) continue; // ET cut
if( parType_t((*tob2)->Et()) <= min(p_MinET1[i],p_MinET2[i])) continue; // ET cut
if( (parType_t((*tob1)->Et()) <= max(p_MinET1[i],p_MinET2[i])) && (parType_t((*tob2)->Et()) <= max(p_MinET1[i],p_MinET2[i]))) continue;
// DeltaEta cuts
unsigned int deltaEta = calcDeltaEta( *tob1, *tob2 );
std::stringstream msgss;
msgss << "Combination : " << distance( input[0]->begin(), tob1)
<< " x " << distance( input[0]->begin(), tob2)
<< " eta=" << (*tob1)->eta()
<< " , eta=" << (*tob2)->eta()
<< ", DeltaEta = " << deltaEta << " -> ";
accept = deltaEta >= p_DeltaEtaMin[i] && deltaEta <= p_DeltaEtaMax[i];
if( accept ) {
decison.setBit(i, true);
output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) );
if (!(iaccept[i])) {
iaccept[i]=1;
m_histAcceptDEta1[i]->Fill((float)deltaEta/10.);
}
}
else
m_histRejectDEta1[i]->Fill((float)deltaEta/10.);
msgss << (accept?"pass":"fail") << "|";
TRG_MSG_DEBUG(msgss.str());
}
}
else
m_histRejectDEta1[i]->Fill((float)deltaEta/10.);
msgss << (accept[i]?"pass":"fail") << "|";
TRG_MSG_DEBUG(msgss.str());
}
}
}
}
} else {
TCS_EXCEPTION("DeltaEtaIncl1 alg must have 1 input, but got " << input.size());
TCS_EXCEPTION("DeltaEtaIncl1 alg must have 1 input, but got " << input.size());
}
return TCS::StatusCode::SUCCESS;
}
......@@ -129,54 +129,41 @@ TCS::DeltaEtaIncl2::process( const std::vector<TCS::TOBArray const *> & input,
const std::vector<TCS::TOBArray *> & output,
Decision & decison )
{
if( input.size() == 2) {
bool iaccept[numberOutputBits()];
std::fill_n(iaccept,numberOutputBits(),0);
for( TOBArray::const_iterator tob1 = input[0]->begin();
tob1 != input[0]->end() && distance(input[0]->begin(), tob1) < p_NumberLeading1;
++tob1)
{
for( TCS::TOBArray::const_iterator tob2 = input[1]->begin();
tob2 != input[1]->end() && distance(input[1]->begin(), tob2) < p_NumberLeading2;
++tob2) {
// test DeltaEtaMin, DeltaEtaMax
unsigned int deltaEta = calcDeltaEta( *tob1, *tob2 );
bool accept[numberOutputBits()];
for(unsigned int i=0; i<numberOutputBits(); ++i) {
if( parType_t((*tob1)->Et()) <= p_MinET1[i]) continue; // ET cut
if( parType_t((*tob2)->Et()) <= p_MinET2[i]) continue; // ET cut
accept[i] = deltaEta >= p_DeltaEtaMin[i] && deltaEta <= p_DeltaEtaMax[i];
if( accept[i] ) {
decison.setBit(i, true);
output[i]->push_back(TCS::CompositeTOB(*tob1, *tob2));
if (!(iaccept[i])) {
iaccept[i]=1;
m_histAcceptDEta2[i]->Fill(deltaEta);
}
}
else
m_histRejectDEta2[i]->Fill(deltaEta);
TRG_MSG_DEBUG("DeltaEta = " << deltaEta << " -> accept bit " << i << " -> "
<< (accept[i]?"pass":"fail"));
}
if( input.size() == 2) {
bool iaccept[numberOutputBits()];
std::fill_n(iaccept,numberOutputBits(),0);
for( TOBArray::const_iterator tob1 = input[0]->begin();
tob1 != input[0]->end() && distance(input[0]->begin(), tob1) < p_NumberLeading1;
++tob1)
{
for( TCS::TOBArray::const_iterator tob2 = input[1]->begin();
tob2 != input[1]->end() && distance(input[1]->begin(), tob2) < p_NumberLeading2;
++tob2) {
// test DeltaEtaMin, DeltaEtaMax
unsigned int deltaEta = calcDeltaEta( *tob1, *tob2 );
for(unsigned int i=0; i<numberOutputBits(); ++i) {
bool accept = false;
if( parType_t((*tob1)->Et()) <= p_MinET1[i]) continue; // ET cut
if( parType_t((*tob2)->Et()) <= p_MinET2[i]) continue; // ET cut
accept = deltaEta >= p_DeltaEtaMin[i] && deltaEta <= p_DeltaEtaMax[i];
if( accept ) {
decison.setBit(i, true);
output[i]->push_back(TCS::CompositeTOB(*tob1, *tob2));
if (!(iaccept[i])) {
iaccept[i]=1;
m_histAcceptDEta2[i]->Fill(deltaEta);
}
}
else
m_histRejectDEta2[i]->Fill(deltaEta);
TRG_MSG_DEBUG("DeltaEta = " << deltaEta << " -> accept bit " << i << " -> "
<< (accept?"pass":"fail"));
}
}
}
}
} else {
TCS_EXCEPTION("DeltaEtaIncl2 alg must have 2 inputs, but got " << input.size());
}
return TCS::StatusCode::SUCCESS;
} else {
TCS_EXCEPTION("DeltaEtaIncl2 alg must have 2 inputs, but got " << input.size());
}
return TCS::StatusCode::SUCCESS;
}
......@@ -117,64 +117,45 @@ TCS::DeltaEtaPhiIncl1::processBitCorrect( const std::vector<TCS::TOBArray const
const std::vector<TCS::TOBArray *> & output,
Decision & decison )
{
if(input.size() == 1) {
TRG_MSG_DEBUG("input size : " << input[0]->size());
unsigned int nLeading = p_NumberLeading1;
for( TOBArray::const_iterator tob1 = input[0]->begin();
tob1 != input[0]->end() && distance( input[0]->begin(), tob1) < nLeading;
++tob1)
{
TCS::TOBArray::const_iterator tob2 = tob1; ++tob2;
for( ;
tob2 != input[0]->end() && distance( input[0]->begin(), tob2) < p_NumberLeading2;
++tob2) {
// DeltaPhi cuts
unsigned int deltaPhi = calcDeltaPhiBW( *tob1, *tob2 );
// DeltaEta cuts
unsigned int deltaEta = calcDeltaEta( *tob1, *tob2 );
//
// to-do change message output
std::stringstream msgss;
msgss << " phi1=" << (*tob1)->phi() << " , phi2=" << (*tob2)->phi()
<< ", DeltaPhi = " << deltaPhi << ", DeltaEta = " << deltaEta << " -> ";
bool accept[3];
for(unsigned int i=0; i<numberOutputBits(); ++i) {
if( parType_t((*tob1)->Et()) <= min(p_MinET1[i],p_MinET2[i])) continue; // ET cut
if( parType_t((*tob2)->Et()) <= min(p_MinET1[i],p_MinET2[i])) continue; // ET cut
if( (parType_t((*tob1)->Et()) <= max(p_MinET1[i],p_MinET2[i])) && (parType_t((*tob2)->Et()) <= max(p_MinET1[i],p_MinET2[i]))) continue;
accept[i] = ( deltaEta >= p_DeltaEtaMin[i] || deltaPhi >= p_DeltaPhiMin[i] ) && deltaPhi <= p_DeltaPhiMax[i] && deltaEta <= p_DeltaEtaMax[i];
if( accept[i] ) {
decison.setBit(i, true);
output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) );
}
msgss << (accept[i]?"pass":"fail") << "|";
if(input.size() == 1) {
TRG_MSG_DEBUG("input size : " << input[0]->size());
unsigned int nLeading = p_NumberLeading1;
for( TOBArray::const_iterator tob1 = input[0]->begin();
tob1 != input[0]->end() && distance( input[0]->begin(), tob1) < nLeading;
++tob1)
{
TCS::TOBArray::const_iterator tob2 = tob1; ++tob2;
for( ;
tob2 != input[0]->end() && distance( input[0]->begin(), tob2) < p_NumberLeading2;
++tob2) {
// DeltaPhi cuts
unsigned int deltaPhi = calcDeltaPhiBW( *tob1, *tob2 );
// DeltaEta cuts
unsigned int deltaEta = calcDeltaEta( *tob1, *tob2 );
//
// to-do change message output
std::stringstream msgss;
msgss << " phi1=" << (*tob1)->phi() << " , phi2=" << (*tob2)->phi()
<< ", DeltaPhi = " << deltaPhi << ", DeltaEta = " << deltaEta << " -> ";
for(unsigned int i=0; i<numberOutputBits(); ++i) {
bool accept = false;
if( parType_t((*tob1)->Et()) <= min(p_MinET1[i],p_MinET2[i])) continue; // ET cut
if( parType_t((*tob2)->Et()) <= min(p_MinET1[i],p_MinET2[i])) continue; // ET cut
if( (parType_t((*tob1)->Et()) <= max(p_MinET1[i],p_MinET2[i])) && (parType_t((*tob2)->Et()) <= max(p_MinET1[i],p_MinET2[i]))) continue;
accept = ( deltaEta >= p_DeltaEtaMin[i] || deltaPhi >= p_DeltaPhiMin[i] ) && deltaPhi <= p_DeltaPhiMax[i] && deltaEta <= p_DeltaEtaMax[i];
if( accept ) {
decison.setBit(i, true);
output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) );
}
msgss << (accept?"pass":"fail") << "|";
}
TRG_MSG_DEBUG(msgss.str());
}
TRG_MSG_DEBUG(msgss.str());
}
}
} else {
TCS_EXCEPTION("DeltaEtaPhiIncl1 alg must have 1 input, but got " << input.size());
}
return TCS::StatusCode::SUCCESS;
}
} else {
TCS_EXCEPTION("DeltaEtaPhiIncl1 alg must have 1 input, but got " << input.size());
}
return TCS::StatusCode::SUCCESS;
}
TCS::StatusCode
......@@ -182,59 +163,47 @@ TCS::DeltaEtaPhiIncl1::process( const std::vector<TCS::TOBArray const *> & input
const std::vector<TCS::TOBArray *> & output,
Decision & decison )
{
if(input.size() == 1) {
TRG_MSG_DEBUG("input size : " << input[0]->size());
unsigned int nLeading = p_NumberLeading1;
for( TOBArray::const_iterator tob1 = input[0]->begin();
tob1 != input[0]->end() && distance( input[0]->begin(), tob1) < nLeading;
++tob1)
{
TCS::TOBArray::const_iterator tob2 = tob1; ++tob2;
for( ;
tob2 != input[0]->end() && distance( input[0]->begin(), tob2) < p_NumberLeading2;
++tob2) {
// DeltaPhi cuts
unsigned int deltaPhi = calcDeltaPhi( *tob1, *tob2 );
// DeltaEta cuts
unsigned int deltaEta = calcDeltaEta( *tob1, *tob2 );
//
// to-do change message output
std::stringstream msgss;
msgss << " Combination : " << distance( input[0]->begin(), tob1) << " x " << distance( input[0]->begin(), tob2) << " phi1=" << (*tob1)->phi() << " , phi2=" << (*tob2)->phi()
<< ", DeltaPhi = " << deltaPhi << ", DeltaEta = " << deltaEta << " -> ";
bool accept[3];
for(unsigned int i=0; i<numberOutputBits(); ++i) {
if( parType_t((*tob1)->Et()) <= min(p_MinET1[i],p_MinET2[i])) continue; // ET cut
if( parType_t((*tob2)->Et()) <= min(p_MinET1[i],p_MinET2[i])) continue; // ET cut
if( (parType_t((*tob1)->Et()) <= max(p_MinET1[i],p_MinET2[i])) && (parType_t((*tob2)->Et()) <= max(p_MinET1[i],p_MinET2[i]))) continue;
accept[i] = ( deltaEta >= p_DeltaEtaMin[i] || deltaPhi >= p_DeltaPhiMin[i] ) && deltaPhi <= p_DeltaPhiMax[i] && deltaEta <= p_DeltaEtaMax[i];
if( accept[i] ) {
decison.setBit(i, true);
output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) );
}
msgss << (accept[i]?"pass":"fail") << "|";
}
TRG_MSG_DEBUG(msgss.str());
if(input.size() == 1) {
TRG_MSG_DEBUG("input size : " << input[0]->size());
unsigned int nLeading = p_NumberLeading1;
for( TOBArray::const_iterator tob1 = input[0]->begin();
tob1 != input[0]->end() && distance( input[0]->begin(), tob1) < nLeading;
++tob1)
{
TCS::TOBArray::const_iterator tob2 = tob1; ++tob2;
for( ;
tob2 != input[0]->end() && distance( input[0]->begin(), tob2) < p_NumberLeading2;
++tob2) {
// DeltaPhi cuts
unsigned int deltaPhi = calcDeltaPhi( *tob1, *tob2 );
// DeltaEta cuts
unsigned int deltaEta = calcDeltaEta( *tob1, *tob2 );
//
// to-do change message output
std::stringstream msgss;
msgss << " Combination : " << distance( input[0]->begin(), tob1)
<< " x " << distance( input[0]->begin(), tob2)
<< " phi1=" << (*tob1)->phi()
<< " , phi2=" << (*tob2)->phi()
<< ", DeltaPhi = " << deltaPhi
<< ", DeltaEta = " << deltaEta << " -> ";
for(unsigned int i=0; i<numberOutputBits(); ++i) {
bool accept = false;
if( parType_t((*tob1)->Et()) <= min(p_MinET1[i],p_MinET2[i])) continue; // ET cut
if( parType_t((*tob2)->Et()) <= min(p_MinET1[i],p_MinET2[i])) continue; // ET cut
if( (parType_t((*tob1)->Et()) <= max(p_MinET1[i],p_MinET2[i])) && (parType_t((*tob2)->Et()) <= max(p_MinET1[i],p_MinET2[i]))) continue;
accept = ( deltaEta >= p_DeltaEtaMin[i] || deltaPhi >= p_DeltaPhiMin[i] ) && deltaPhi <= p_DeltaPhiMax[i] && deltaEta <= p_DeltaEtaMax[i];
if( accept ) {
decison.setBit(i, true);
output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) );
}
msgss << (accept?"pass":"fail") << "|";
}
TRG_MSG_DEBUG(msgss.str());
}
}
}
} else {
TCS_EXCEPTION("DeltaEtaPhiIncl1 alg must have 1 input, but got " << input.size());
}
return TCS::StatusCode::SUCCESS;
} else {
TCS_EXCEPTION("DeltaEtaPhiIncl1 alg must have 1 input, but got " << input.size());
}
return TCS::StatusCode::SUCCESS;
}
......@@ -117,60 +117,43 @@ TCS::DeltaEtaPhiIncl2::processBitCorrect( const std::vector<TCS::TOBArray const
const std::vector<TCS::TOBArray *> & output,
Decision & decison )
{
if(input.size() == 2) {
TRG_MSG_DEBUG("input size : " << input[0]->size());
unsigned int nLeading = p_NumberLeading1;
for( TOBArray::const_iterator tob1 = input[0]->begin();
tob1 != input[0]->end() && distance( input[0]->begin(), tob1) < nLeading;
++tob1)
{
for( TOBArray::const_iterator tob2 = input[1]->begin();
tob2 != input[1]->end() && distance( input[1]->begin(), tob2) < p_NumberLeading2;
++tob2) {
// DeltaPhi cuts
unsigned int deltaPhi = calcDeltaPhiBW( *tob1, *tob2 );
// DeltaEta cuts
unsigned int deltaEta = calcDeltaEta( *tob1, *tob2 );
//
// to-do change message output
std::stringstream msgss;
msgss << " phi1=" << (*tob1)->phi() << " , phi2=" << (*tob2)->phi()
<< ", DeltaPhi = " << deltaPhi << ", DeltaEta = " << deltaEta <<" -> ";
bool accept[3];
for(unsigned int i=0; i<numberOutputBits(); ++i) {
if( parType_t((*tob1)->Et()) <= p_MinET1[i] ) continue; // ET cut
if( parType_t((*tob2)->Et()) <= p_MinET2[i]) continue; // ET cut
accept[i] = ( deltaEta >= p_DeltaEtaMin[i] || deltaPhi >= p_DeltaPhiMin[i] ) && deltaPhi <= p_DeltaPhiMax[i] && deltaEta <= p_DeltaEtaMax[i];
if( accept[i] ) {
decison.setBit(i, true);
output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) );
}
msgss << (accept[i]?"pass":"fail") << "|";
}
TRG_MSG_DEBUG(msgss.str());
if(input.size() == 2) {
TRG_MSG_DEBUG("input size : " << input[0]->size());
unsigned int nLeading = p_NumberLeading1;
for( TOBArray::const_iterator tob1 = input[0]->begin();
tob1 != input[0]->end() && distance( input[0]->begin(), tob1) < nLeading;
++tob1)
{
for( TOBArray::const_iterator tob2 = input[1]->begin();
tob2 != input[1]->end() && distance( input[1]->begin(), tob2) < p_NumberLeading2;
++tob2) {
// DeltaPhi cuts
unsigned int deltaPhi = calcDeltaPhiBW( *tob1, *tob2 );
// DeltaEta cuts
unsigned int deltaEta = calcDeltaEta( *tob1, *tob2 );
//
// to-do change message output
std::stringstream msgss;
msgss << " phi1=" << (*tob1)->phi() << " , phi2=" << (*tob2)->phi()
<< ", DeltaPhi = " << deltaPhi << ", DeltaEta = " << deltaEta <<" -> ";
for(unsigned int i=0; i<numberOutputBits(); ++i) {
bool accept = false;
if( parType_t((*tob1)->Et()) <= p_MinET1[i] ) continue; // ET cut
if( parType_t((*tob2)->Et()) <= p_MinET2[i]) continue; // ET cut
accept = ( deltaEta >= p_DeltaEtaMin[i] || deltaPhi >= p_DeltaPhiMin[i] ) && deltaPhi <= p_DeltaPhiMax[i] && deltaEta <= p_DeltaEtaMax[i];
if( accept ) {
decison.setBit(i, true);
output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) );
}
msgss << (accept?"pass":"fail") << "|";
}
TRG_MSG_DEBUG(msgss.str());
}
}
}
} else {
TCS_EXCEPTION("DeltaEtaPhiIncl2 alg must have 2 inputs, but got " << input.size());
}
return TCS::StatusCode::SUCCESS;
} else {
TCS_EXCEPTION("DeltaEtaPhiIncl2 alg must have 2 inputs, but got " << input.size());
}
return TCS::StatusCode::SUCCESS;