CMS 3D CMS Logo

Public Member Functions | Private Attributes

L1CaloClusterProducer Class Reference

Inheritance diagram for L1CaloClusterProducer:
L1CaloAlgoBase< l1slhc::L1CaloTowerCollection, l1slhc::L1CaloClusterCollection > edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

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

Private Attributes

int mElectronThrA
int mElectronThrB

Detailed Description

Definition at line 10 of file L1CaloClusterProducer.cc.


Constructor & Destructor Documentation

L1CaloClusterProducer::L1CaloClusterProducer ( const edm::ParameterSet aConfig)
L1CaloClusterProducer::~L1CaloClusterProducer ( )

Definition at line 37 of file L1CaloClusterProducer.cc.

{
}

Member Function Documentation

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

Implements L1CaloAlgoBase< l1slhc::L1CaloTowerCollection, l1slhc::L1CaloClusterCollection >.

Definition at line 50 of file L1CaloClusterProducer.cc.

References l1slhc::L1CaloCluster::addConstituent(), l1slhc::L1CaloCluster::E(), L1CaloAlgoBase< l1slhc::L1CaloTowerCollection, l1slhc::L1CaloClusterCollection >::fetch(), L1CaloAlgoBase< l1slhc::L1CaloTowerCollection, l1slhc::L1CaloClusterCollection >::mCaloTriggerSetup, mElectronThrA, mElectronThrB, L1CaloAlgoBase< l1slhc::L1CaloTowerCollection, l1slhc::L1CaloClusterCollection >::mInputCollection, L1CaloAlgoBase< l1slhc::L1CaloTowerCollection, l1slhc::L1CaloClusterCollection >::mOutputCollection, l1slhc::L1CaloCluster::setEGamma(), l1slhc::L1CaloCluster::setEGammaValue(), l1slhc::L1CaloCluster::setFg(), l1slhc::L1CaloCluster::setLeadTower(), and l1slhc::L1CaloCluster::setLeadTowerE().

{
  int lClusterIndex = mCaloTriggerSetup->getBin( aEta, aPhi );
  std::pair < int, int >lClusterEtaPhi = mCaloTriggerSetup->getTowerEtaPhi( lClusterIndex );

  l1slhc::L1CaloCluster lCaloCluster( lClusterEtaPhi.first, lClusterEtaPhi.second );

  bool lFineGrain = false;
  int lClusterEcalE = 0;
  int lClusterTotalE = 0;
  int lLeadTower = 0;
  int lSecondTower = 0;

  for ( int lTowerEta = aEta; lTowerEta <= aEta + 1; ++lTowerEta )
  {
    for ( int lTowerPhi = aPhi; lTowerPhi <= aPhi + 1; ++lTowerPhi )
    {

      // ---------- new way ------------
      l1slhc::L1CaloTowerCollection::const_iterator lTowerItr = fetch( lTowerEta, lTowerPhi );
      if ( lTowerItr != mInputCollection->end(  ) )
      {
        int lTowerTotalE = lTowerItr->E(  ) + lTowerItr->H(  );
        // this is no longer done in filling map, so do it here
        if ( lTowerTotalE > 0 )
        {
          // Skip over fine grain bit calculation if desired
          if ( mCaloTriggerSetup->fineGrainPass(  ) == 1 )
          {
            lFineGrain = false;
          }
          else
          {
            lFineGrain = lFineGrain || lTowerItr->EcalFG(  );
          }

          lClusterTotalE += lTowerTotalE;
          lClusterEcalE += lTowerItr->E(  );

          l1slhc::L1CaloTowerRef lRef( mInputCollection, lTowerItr - mInputCollection->begin(  ) );
          lCaloCluster.addConstituent( lRef );

          if ( lTowerTotalE > lLeadTower )
            lSecondTower = lLeadTower;
            lLeadTower = lTowerTotalE;
        }
        else if(lTowerTotalE > lSecondTower && lTowerTotalE < lLeadTower){
          lSecondTower = lTowerTotalE;
        }
      }
      // ---------- new way ------------

    }
  }

  // we only register the Cluster into the event if this condition is satisfied....
  if ( lCaloCluster.E(  ) > 0 )
  {
    // Calculate Electron Cut and Save it in the Cluster
    int lElectronValue = ( int )( 100. * ( ( double )lClusterEcalE ) / ( ( double )lClusterTotalE ) );
    lCaloCluster.setEGammaValue( lElectronValue );

    lCaloCluster.setLeadTower( lLeadTower >= mCaloTriggerSetup->seedTowerThr(  ) );

    lCaloCluster.setLeadTowerE( lLeadTower+lSecondTower );

    // Electron Bit Decision
    bool lLowPtElectron = lCaloCluster.E(  ) <= mCaloTriggerSetup->electronThr( 1 ) && lElectronValue > mCaloTriggerSetup->electronThr( 0 );

    bool lHighPtElectron = lCaloCluster.E(  ) > mCaloTriggerSetup->electronThr( 1 ) && lElectronValue > ( mElectronThrB - ( mElectronThrA * lCaloCluster.E(  ) ) );

    lCaloCluster.setEGamma( lLowPtElectron || lHighPtElectron );

    // FineGrain bit
    lCaloCluster.setFg( lFineGrain );

    mOutputCollection->insert( lClusterEtaPhi.first, lClusterEtaPhi.second , lCaloCluster );
  }

}
void L1CaloClusterProducer::initialize ( ) [virtual]

Reimplemented from L1CaloAlgoBase< l1slhc::L1CaloTowerCollection, l1slhc::L1CaloClusterCollection >.

Definition at line 42 of file L1CaloClusterProducer.cc.

References L1CaloAlgoBase< l1slhc::L1CaloTowerCollection, l1slhc::L1CaloClusterCollection >::mCaloTriggerSetup, mElectronThrA, and mElectronThrB.

{
  // these values are constant within an event, so do not recalculate them every time...
  mElectronThrA = int ( double ( mCaloTriggerSetup->electronThr( 2 ) ) / 10. );
  mElectronThrB = mCaloTriggerSetup->electronThr( 0 ) + ( mElectronThrA * mCaloTriggerSetup->electronThr( 1 ) );
}

Member Data Documentation

Definition at line 21 of file L1CaloClusterProducer.cc.

Referenced by algorithm(), and initialize().

Definition at line 21 of file L1CaloClusterProducer.cc.

Referenced by algorithm(), and initialize().