CMS 3D CMS Logo

Public Types | Public Member Functions | Protected Member Functions | Private Attributes | Friends

L1GctElectronFinalSort Class Reference

#include <L1GctElectronFinalSort.h>

Inheritance diagram for L1GctElectronFinalSort:
L1GctProcessor

List of all members.

Public Types

typedef
L1GctElectronSorter::prioritisedEmCand 
prioritisedEmCand
 Use some definitions from the ElectronSorter in the leaf cards.
typedef
L1GctElectronSorter::rank_gt 
rank_gt

Public Member Functions

virtual void fetchInput ()
std::vector< L1GctEmCandgetInputCands () const
std::vector< L1GctEmCandgetOutputCands () const
 L1GctElectronFinalSort (bool iso, L1GctEmLeafCard *posEtaCard, L1GctEmLeafCard *negEtaCard)
virtual void process ()
void setInputEmCand (unsigned i, const L1GctEmCand &cand)
bool setupOk () const
 ~L1GctElectronFinalSort ()

Protected Member Functions

virtual void resetPipelines ()
virtual void resetProcessor ()
 Separate reset methods for the processor itself and any data stored in pipelines.
virtual void setupObjects ()
 Initialise inputs with null objects for the correct bunch crossing if required.

Private Attributes

bool m_emCandsType
std::vector< L1GctEmCandm_inputCands
Pipeline< L1GctEmCandm_outputCands
bool m_setupOk
 Check the setup.
L1GctEmLeafCardm_theNegEtaLeafCard
L1GctEmLeafCardm_thePosEtaLeafCard

Friends

std::ostream & operator<< (std::ostream &s, const L1GctElectronFinalSort &cand)

Detailed Description

Definition at line 29 of file L1GctElectronFinalSort.h.


Member Typedef Documentation

Use some definitions from the ElectronSorter in the leaf cards.

Definition at line 33 of file L1GctElectronFinalSort.h.

Definition at line 34 of file L1GctElectronFinalSort.h.


Constructor & Destructor Documentation

L1GctElectronFinalSort::L1GctElectronFinalSort ( bool  iso,
L1GctEmLeafCard posEtaCard,
L1GctEmLeafCard negEtaCard 
)

constructor

Definition at line 9 of file L1GctElectronFinalSort.cc.

References m_setupOk, m_theNegEtaLeafCard, m_thePosEtaLeafCard, and L1GctProcessor::m_verbose.

                                                                                     :
  L1GctProcessor(),
  m_emCandsType(iso),
  m_thePosEtaLeafCard(0), m_theNegEtaLeafCard(0),
  m_inputCands(16),
  m_outputCands(4),
  m_setupOk(true)
{
  if(posEtaCard!=0){
    m_thePosEtaLeafCard = posEtaCard;
  }else{
    m_setupOk = false;
    if (m_verbose) {
      edm::LogWarning("L1GctSetupError")
        <<"L1GctElectronFinalSort::Constructor() : 1st EmLeafCard passed is zero";
    }
  }
  if(negEtaCard!=0){
    m_theNegEtaLeafCard = negEtaCard;
  }else{
    m_setupOk = false;
    if (m_verbose) {
      edm::LogWarning("L1GctSetupError")
        <<"L1GctElectronFinalSort::Constructor() : 2nd EmLeafCard passed is zero";
    }
  }
  if (!m_setupOk && m_verbose) {
    edm::LogError("L1GctSetupError") << "L1GctElectronFinalSort has been incorrectly constructed";
  }
}
L1GctElectronFinalSort::~L1GctElectronFinalSort ( )

destructor

Definition at line 41 of file L1GctElectronFinalSort.cc.

References m_inputCands, and m_outputCands.

                                               {
  m_inputCands.clear();
  m_outputCands.contents.clear();
}

Member Function Documentation

void L1GctElectronFinalSort::fetchInput ( ) [virtual]
std::vector<L1GctEmCand> L1GctElectronFinalSort::getInputCands ( ) const [inline]

return input data

Definition at line 53 of file L1GctElectronFinalSort.h.

References m_inputCands.

{ return m_inputCands; }
std::vector<L1GctEmCand> L1GctElectronFinalSort::getOutputCands ( ) const [inline]

return output data

Definition at line 56 of file L1GctElectronFinalSort.h.

References m_outputCands.

Referenced by L1GlobalCaloTrigger::getIsoElectrons(), and L1GlobalCaloTrigger::getNonIsoElectrons().

{ return m_outputCands.contents; }
void L1GctElectronFinalSort::process ( ) [virtual]

process the data, fill output buffers

Implements L1GctProcessor.

Definition at line 74 of file L1GctElectronFinalSort.cc.

References L1GctProcessor::bxRel(), trackerHits::c, data, i, m_inputCands, m_outputCands, m_setupOk, python::multivaluedict::sort(), and groupFilesInBlocks::temp.

Referenced by L1GlobalCaloTrigger::bxProcess().

                                    {

  if (m_setupOk) {
    std::vector<prioritisedEmCand> data(m_inputCands.size());
    // Assign a "priority" for sorting - this assumes the candidates
    // have already been filled in "priority order"
    for (unsigned i=0; i<m_inputCands.size(); i++) {
      prioritisedEmCand c(m_inputCands.at(i), i);
      data.at(i) = c;
    }

    //Then sort it
    sort(data.begin(),data.end(),rank_gt());
  
    //Copy data to output buffer
    std::vector<L1GctEmCand> temp(4);
    for(int i = 0; i<4; i++){
      temp.at(i) = data.at(i).emCand;
    }
    m_outputCands.store(temp, bxRel());
  }
}
void L1GctElectronFinalSort::resetPipelines ( ) [protected, virtual]

Implements L1GctProcessor.

Definition at line 51 of file L1GctElectronFinalSort.cc.

References m_outputCands, and L1GctProcessor::numOfBx().

                                            {
  m_outputCands.reset(numOfBx());
}
void L1GctElectronFinalSort::resetProcessor ( ) [protected, virtual]

Separate reset methods for the processor itself and any data stored in pipelines.

Implements L1GctProcessor.

Definition at line 46 of file L1GctElectronFinalSort.cc.

References m_inputCands.

                                            {
  m_inputCands.clear();
  m_inputCands.resize(16);
}
void L1GctElectronFinalSort::setInputEmCand ( unsigned  i,
const L1GctEmCand cand 
)

set input data

Definition at line 97 of file L1GctElectronFinalSort.cc.

References L1GctEmCand::bx(), L1GctProcessor::bxAbs(), and m_inputCands.

Referenced by fetchInput().

                                                                              {
  if ((i<m_inputCands.size()) 
    && (cand.bx()==bxAbs())) {
    m_inputCands.at(i) = cand;
  }
}
virtual void L1GctElectronFinalSort::setupObjects ( ) [inline, protected, virtual]

Initialise inputs with null objects for the correct bunch crossing if required.

Implements L1GctProcessor.

Definition at line 71 of file L1GctElectronFinalSort.h.

{}
bool L1GctElectronFinalSort::setupOk ( ) const [inline]

check setup

Reimplemented from L1GctProcessor.

Definition at line 62 of file L1GctElectronFinalSort.h.

References m_setupOk.

Referenced by L1GlobalCaloTrigger::setupOk().

{ return m_setupOk; }

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  s,
const L1GctElectronFinalSort cand 
) [friend]

overload of cout operator

Definition at line 104 of file L1GctElectronFinalSort.cc.

                                                                          {
  s << "===ElectronFinalSort===" << std::endl;
  s << "Card type = " << ( cand.m_emCandsType ? "isolated" : "non-isolated" ) <<std::endl;
  s << "Pointers to the Electron Leaf cards are: "<<std::endl;
  s << "   Pos. eta: " << cand.m_thePosEtaLeafCard;
  s << "   Neg. eta: " << cand.m_theNegEtaLeafCard;
  s << std::endl;
  s << "No of Electron Input Candidates " << cand.m_inputCands.size() << std::endl;
  s << "No of Electron Output Candidates " << cand.m_outputCands.contents.size() << std::endl;
   
  return s;
}

Member Data Documentation

type of electron candidate (iso(0) or non-iso(1))

Definition at line 76 of file L1GctElectronFinalSort.h.

Referenced by fetchInput(), and operator<<().

output data

Definition at line 86 of file L1GctElectronFinalSort.h.

Referenced by getOutputCands(), operator<<(), process(), resetPipelines(), and ~L1GctElectronFinalSort().

Check the setup.

Definition at line 89 of file L1GctElectronFinalSort.h.

Referenced by fetchInput(), L1GctElectronFinalSort(), process(), and setupOk().

Definition at line 80 of file L1GctElectronFinalSort.h.

Referenced by fetchInput(), L1GctElectronFinalSort(), and operator<<().

the 1st stage electron sorters

Definition at line 79 of file L1GctElectronFinalSort.h.

Referenced by fetchInput(), L1GctElectronFinalSort(), and operator<<().