CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

L1CaloTowerProducer Class Reference

Inheritance diagram for L1CaloTowerProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 L1CaloTowerProducer (const edm::ParameterSet &)
 ~L1CaloTowerProducer ()

Private Member Functions

void addEcal (const int &, const int &, const int &, const bool &)
void addHcal (const int &, const int &, const int &, const bool &)
virtual void endJob ()
virtual void produce (edm::Event &, const edm::EventSetup &)

Private Attributes

std::auto_ptr
< l1slhc::L1CaloTowerCollection
mCaloTowers
const L1CaloTriggerSetupmCaloTriggerSetup
edm::InputTag mEcalDigiInputTag
const L1CaloEcalScalemEcalScale
edm::InputTag mHcalDigiInputTag
const L1CaloHcalScalemHcalScale
bool mUseupgradehcal

Detailed Description

Definition at line 39 of file L1CaloTowerProducer.cc.


Constructor & Destructor Documentation

L1CaloTowerProducer::L1CaloTowerProducer ( const edm::ParameterSet aConfig) [explicit]

Definition at line 69 of file L1CaloTowerProducer.cc.

                                                                         :
  mCaloTowers( NULL ),
  mEcalDigiInputTag( aConfig.getParameter < edm::InputTag > ( "ECALDigis" ) ),
  mHcalDigiInputTag( aConfig.getParameter < edm::InputTag > ( "HCALDigis" ) ),
  mUseupgradehcal( aConfig.getParameter < bool > ( "UseUpgradeHCAL" ) )
{
  // Register Product
  produces < l1slhc::L1CaloTowerCollection > (  );
}
L1CaloTowerProducer::~L1CaloTowerProducer ( )

Definition at line 80 of file L1CaloTowerProducer.cc.

{

}

Member Function Documentation

void L1CaloTowerProducer::addEcal ( const int &  aCompressedEt,
const int &  aIeta,
const int &  aIphi,
const bool &  aFG 
) [private]

Definition at line 111 of file L1CaloTowerProducer.cc.

References abs, L1CaloTriggerSetup::ecalActivityThr(), L1CaloEcalScale::et(), mCaloTowers, mCaloTriggerSetup, mEcalScale, and l1slhc::L1CaloTower::setEcal().

Referenced by produce().

{
        if ( aCompressedEt > 0 )
        {
                int lET = ( int )( 2 * mEcalScale->et( aCompressedEt,
                                                                                           abs( aIeta ),
                                                                                           ( aIeta > 0 ? +1 : -1 ) ) );

                l1slhc::L1CaloTower lCaloTower( aIeta, aIphi );
                lCaloTower.setEcal( lET, aFG );

                if ( lET > mCaloTriggerSetup->ecalActivityThr(  ) )
                        mCaloTowers->insert( aIeta , aIphi , lCaloTower );

        }
}
void L1CaloTowerProducer::addHcal ( const int &  aCompressedEt,
const int &  aIeta,
const int &  aIphi,
const bool &  aFG 
) [private]

Definition at line 85 of file L1CaloTowerProducer.cc.

References abs, L1CaloHcalScale::et(), spr::find(), L1CaloTriggerSetup::hcalActivityThr(), mCaloTowers, mCaloTriggerSetup, mHcalScale, and l1slhc::L1CaloTower::setHcal().

Referenced by produce().

{
        if ( aCompressedEt > 0 )
        {
                int lET = ( int )( 2 * mHcalScale->et( aCompressedEt,
                                                                                           abs( aIeta ),
                                                                                           ( aIeta > 0 ? +1 : -1 ) ) );

                l1slhc::L1CaloTowerCollection::iterator lItr = mCaloTowers -> find ( aIeta, aIphi  );

                if ( lItr != ( *mCaloTowers ).end(  ) )
                {
                        if ( lET > mCaloTriggerSetup->hcalActivityThr(  ) )
                                lItr->setHcal( lET, aFG );
                }
                else
                {
                        l1slhc::L1CaloTower lCaloTower( aIeta, aIphi );
                        lCaloTower.setHcal( lET, aFG );
                        if ( lET > mCaloTriggerSetup->hcalActivityThr(  ) )
                                mCaloTowers->insert( aIeta , aIphi , lCaloTower );
                }
        }
}
void L1CaloTowerProducer::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 196 of file L1CaloTowerProducer.cc.

{

}
void L1CaloTowerProducer::produce ( edm::Event aEvent,
const edm::EventSetup aSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 129 of file L1CaloTowerProducer.cc.

References addEcal(), addHcal(), Exception, edm::EventSetup::get(), edm::Event::getByLabel(), mCaloTowers, mCaloTriggerSetup, mEcalDigiInputTag, mEcalScale, mHcalDigiInputTag, mHcalScale, mUseupgradehcal, edm::ESHandle< T >::product(), and edm::Event::put().

{

        // create a new l1slhc::L1CaloTowerCollection (auto_ptr should handle deletion of the last one correctly)
        mCaloTowers = std::auto_ptr < l1slhc::L1CaloTowerCollection > ( new l1slhc::L1CaloTowerCollection );

        // Setup Calo Scales
        edm::ESHandle < L1CaloEcalScale > lEcalScaleHandle;
        aSetup.get < L1CaloEcalScaleRcd > (  ).get( lEcalScaleHandle );
        mEcalScale = lEcalScaleHandle.product(  );

        edm::ESHandle < L1CaloHcalScale > lHcalScaleHandle;
        aSetup.get < L1CaloHcalScaleRcd > (  ).get( lHcalScaleHandle );
        mHcalScale = lHcalScaleHandle.product(  );

        // get Tower Thresholds
        edm::ESHandle < L1CaloTriggerSetup > mCaloTriggerSetupHandle;
        aSetup.get < L1CaloTriggerSetupRcd > (  ).get( mCaloTriggerSetupHandle );
        mCaloTriggerSetup = mCaloTriggerSetupHandle.product(  );


        // Loop through the TPGs
        //getting data from event takes 3 orders of magnitude longer than anything else in the program : O(10-100ms) cf O(10-100us)
        edm::Handle < EcalTrigPrimDigiCollection > lEcalDigiHandle;
        aEvent.getByLabel( mEcalDigiInputTag, lEcalDigiHandle );

        for ( EcalTrigPrimDigiCollection::const_iterator lEcalTPItr = lEcalDigiHandle->begin(  ); lEcalTPItr != lEcalDigiHandle->end(  ); ++lEcalTPItr )
                addEcal( lEcalTPItr->compressedEt(  ), lEcalTPItr->id(  ).ieta(  ), lEcalTPItr->id(  ).iphi(  ), lEcalTPItr->fineGrain(  ) );

        if ( !mUseupgradehcal )
        {
                //getting data from event takes 3 orders of magnitude longer than anything else in the program : O(10-100ms) cf O(10-100us)
                edm::Handle < HcalTrigPrimDigiCollection > lHcalDigiHandle;
                aEvent.getByLabel( mHcalDigiInputTag, lHcalDigiHandle );

                for ( HcalTrigPrimDigiCollection::const_iterator lHcalTPItr = lHcalDigiHandle->begin(  ); lHcalTPItr != lHcalDigiHandle->end(  ); ++lHcalTPItr )
                        addHcal( lHcalTPItr->SOI_compressedEt(  ), lHcalTPItr->id(  ).ieta(  ), lHcalTPItr->id(  ).iphi(  ), lHcalTPItr->SOI_fineGrain(  ) );
        }
        else
        {
          // Detect if the upgrade HCAL header file is included
#ifdef DIGIHCAL_HCALUPGRADETRIGGERPRIMITIVEDIGI_H
#warning Not really a warning: just letting you know that Im enabling upgrade HCAL digis
                //getting data from event takes 3 orders of magnitude longer than anything else in the program : O(10-100ms) cf O(10-100us)
                edm::Handle < HcalUpgradeTrigPrimDigiCollection > lHcalDigiHandle;
                aEvent.getByLabel( mHcalDigiInputTag, lHcalDigiHandle );

                for ( HcalUpgradeTrigPrimDigiCollection::const_iterator lHcalTPItr = lHcalDigiHandle->begin(  ); lHcalTPItr != lHcalDigiHandle->end(  ); ++lHcalTPItr )
                        addHcal( lHcalTPItr->SOI_compressedEt(  ), lHcalTPItr->id(  ).ieta(  ), lHcalTPItr->id(  ).iphi(  ), lHcalTPItr->SOI_fineGrain(  ) );
#else
#warning Not really a warning: just letting you know that Im NOT enabling upgrade HCAL digis
                // If the user tries to specify this option, but it isn't
                // available, throw an exception.
                throw cms::Exception("NotImplmented") <<
                  "You requested to use the upgrade HCAL digis.  However the "
                  << "L1CaloTowerProducer.cc module was not compiled with "
                  << "support for them.  "
                  << "Please edit SLHCUpSims/L1CaloTrig/plugins/L1CaloTowerProducer.cc" << std::endl;
#endif
        }
        aEvent.put( mCaloTowers );
}

Member Data Documentation

Definition at line 53 of file L1CaloTowerProducer.cc.

Referenced by addEcal(), addHcal(), and produce().

Definition at line 55 of file L1CaloTowerProducer.cc.

Referenced by addEcal(), addHcal(), and produce().

Definition at line 60 of file L1CaloTowerProducer.cc.

Referenced by produce().

Definition at line 56 of file L1CaloTowerProducer.cc.

Referenced by addEcal(), and produce().

Definition at line 61 of file L1CaloTowerProducer.cc.

Referenced by produce().

Definition at line 57 of file L1CaloTowerProducer.cc.

Referenced by addHcal(), and produce().

Definition at line 63 of file L1CaloTowerProducer.cc.

Referenced by produce().