CMS 3D CMS Logo

Public Member Functions | Private Attributes

L1CaloJetExpander Class Reference

Inheritance diagram for L1CaloJetExpander:
L1CaloAlgoBase< l1slhc::L1CaloJetCollection, l1slhc::L1CaloJetCollection > edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

void algorithm (const int &, const int &)
 L1CaloJetExpander (const edm::ParameterSet &)
 ~L1CaloJetExpander ()

Private Attributes

std::vector< std::pair< int,
int > > 
mAddrLUT

Detailed Description

Definition at line 8 of file L1CaloJetExpander.cc.


Constructor & Destructor Documentation

L1CaloJetExpander::L1CaloJetExpander ( const edm::ParameterSet aConfig)

Definition at line 23 of file L1CaloJetExpander.cc.

References mAddrLUT, L1CaloAlgoBase< l1slhc::L1CaloJetCollection, l1slhc::L1CaloJetCollection >::mEtaIncrement, L1CaloAlgoBase< l1slhc::L1CaloJetCollection, l1slhc::L1CaloJetCollection >::mEtaOffset, and L1CaloAlgoBase< l1slhc::L1CaloJetCollection, l1slhc::L1CaloJetCollection >::mPhiIncrement.

                                                                     :
L1CaloAlgoBase < l1slhc::L1CaloJetCollection, l1slhc::L1CaloJetCollection > ( aConfig )
{
        // mPhiOffset = 0;
        mEtaOffset = -3;
        mPhiIncrement = 4;
        mEtaIncrement = 4;

        mAddrLUT.resize(8);

        mAddrLUT[0] = std::make_pair( -4 , -4 );
        mAddrLUT[1] = std::make_pair( -4 , 0 );
        mAddrLUT[2] = std::make_pair( -4 , +4 );

        mAddrLUT[3] = std::make_pair( 0 , -4 );
        mAddrLUT[4] = std::make_pair( 0 , +4 );

        mAddrLUT[5] = std::make_pair( +4 , -4 );
        mAddrLUT[6] = std::make_pair( +4 , 0 );
        mAddrLUT[7] = std::make_pair( +4 , +4 );
}
L1CaloJetExpander::~L1CaloJetExpander ( )

Definition at line 45 of file L1CaloJetExpander.cc.

{
}

Member Function Documentation

void L1CaloJetExpander::algorithm ( const int &  aEta,
const int &  aPhi 
) [virtual]

Implements L1CaloAlgoBase< l1slhc::L1CaloJetCollection, l1slhc::L1CaloJetCollection >.

Definition at line 55 of file L1CaloJetExpander.cc.

References L1CaloAlgoBase< l1slhc::L1CaloJetCollection, l1slhc::L1CaloJetCollection >::fetch(), mAddrLUT, L1CaloAlgoBase< l1slhc::L1CaloJetCollection, l1slhc::L1CaloJetCollection >::mCaloTriggerSetup, L1CaloAlgoBase< l1slhc::L1CaloJetCollection, l1slhc::L1CaloJetCollection >::mInputCollection, and L1CaloAlgoBase< l1slhc::L1CaloJetCollection, l1slhc::L1CaloJetCollection >::mOutputCollection.

{
        l1slhc::L1CaloJetCollection::const_iterator lJetItr = fetch( aEta, aPhi );
        if ( lJetItr != mInputCollection->end(  ) )
        {
                if ( lJetItr->central(  ) )
                {
                        // jet is central
                        // so should always be added to the event
                        // L1CaloJet lExpandedJet( *lJetItr );

                        int lIndex = mCaloTriggerSetup->getBin( aEta, aPhi );
                        std::pair < int, int >lEtaPhi = mCaloTriggerSetup->getTowerEtaPhi( lIndex );
                        l1slhc::L1CaloJetCollection::iterator lItr = mOutputCollection->find( lEtaPhi.first, lEtaPhi.second );
                        if ( lItr == mOutputCollection->end(  ) )
                        {
                                // not already in the collection, but should be, so add a copy of it
                                mOutputCollection->insert( lEtaPhi.first, lEtaPhi.second, *lJetItr );
                        }

                }
                else
                {

                        // not central so
                        // loop and find the highest central neighbor
                        // and give it the constituents
                        l1slhc::L1CaloJetCollection::const_iterator lHighestCentralNeighbourItr = mInputCollection->end(  );
                        int highestCentralNeighbourE = -1000;

                        for ( std::vector< std::pair< int, int > >::iterator lAddrLUTIt = mAddrLUT.begin(); lAddrLUTIt != mAddrLUT.end(); ++lAddrLUTIt  )
                        {
                                l1slhc::L1CaloJetCollection::const_iterator lNeighbourItr = fetch( aEta + (lAddrLUTIt->first), aPhi + (lAddrLUTIt->second) );
                                if ( lNeighbourItr != mInputCollection->end(  ) )
                                {
                                        if ( lNeighbourItr->central(  ) )
                                        {
                                                if ( lNeighbourItr->E(  ) > highestCentralNeighbourE )
                                                {
                                                        highestCentralNeighbourE = lNeighbourItr->E(  );
                                                        lHighestCentralNeighbourItr = lNeighbourItr;
                                                }
                                        }
                                }
                        }

                        if ( lHighestCentralNeighbourItr != mInputCollection->end(  ) )
                        {
                                // If the highestCentralNeighbour is not already in the output collection, then add it to the collection
//                              int lIndex = mCaloTriggerSetup->getBin( lHighestCentralNeighbourItr->iEta(  ), lHighestCentralNeighbourItr->iPhi(  ) );
//                              std::pair < int, int >lEtaPhi = mCaloTriggerSetup->getTowerEtaPhi( lIndex );
//                              l1slhc::L1CaloJetCollection::iterator lItr = mOutputCollection->find( lEtaPhi.first, lEtaPhi.second );
                                l1slhc::L1CaloJetCollection::iterator lItr = mOutputCollection->find( lHighestCentralNeighbourItr->iEta(  ), lHighestCentralNeighbourItr->iPhi(  ) );
                                if ( lItr == mOutputCollection->end(  ) )
                                {
                                        lItr = mOutputCollection->insert( lHighestCentralNeighbourItr->iEta(  ), lHighestCentralNeighbourItr->iPhi(  ), *lHighestCentralNeighbourItr );
                                }

                                // Now the highestCentralNeighbour is definately the output collection already

                                for ( l1slhc::L1CaloRegionRefVector::const_iterator lConstituentItr = lJetItr->getConstituents(  ).begin(  ); lConstituentItr != lJetItr->getConstituents(  ).end(  ); ++lConstituentItr )
                                {
                                        lItr->addConstituent( *lConstituentItr );
                                }

                            lItr->setP4( math::PtEtaPhiMLorentzVector( double( lItr->E() )/2. , lItr->p4().eta() , lItr->p4().phi() , 0.0 ) );


                        }
                }
        }


}

Member Data Documentation

std::vector< std::pair< int, int > > L1CaloJetExpander::mAddrLUT [private]

Definition at line 20 of file L1CaloJetExpander.cc.

Referenced by algorithm(), and L1CaloJetExpander().