CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

L1ExtraTranslator Class Reference

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

List of all members.

Public Member Functions

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

Private Member Functions

double calculateTowerEtaPosition (int)
virtual void endJob ()
virtual void produce (edm::Event &, const edm::EventSetup &)

Private Attributes

double maxJetTowerEta
edm::InputTag mClusters
edm::InputTag mJets
std::size_t mNjets
std::size_t mNparticles
edm::InputTag mTowers

Detailed Description

Definition at line 37 of file L1ExtraTranslator.cc.


Constructor & Destructor Documentation

L1ExtraTranslator::L1ExtraTranslator ( const edm::ParameterSet iConfig) [explicit]

Definition at line 61 of file L1ExtraTranslator.cc.

                                                                     :
mClusters( iConfig.getParameter < edm::InputTag > ( "Clusters" ) ),
mJets( iConfig.getParameter < edm::InputTag > ( "Jets" ) ), 
mTowers( iConfig.getParameter < edm::InputTag > ( "Towers" ) ), 
mNparticles( iConfig.getParameter < unsigned int >( "NParticles" ) ), 
mNjets( iConfig.getParameter < unsigned int >( "NJets" ) ),
maxJetTowerEta( iConfig.getParameter < double >( "maxJetTowerEta" ) )
{

        // Register Product
        produces < l1extra::L1EmParticleCollection > ( "EGamma" );
        produces < l1extra::L1EmParticleCollection > ( "IsoEGamma" );
        produces < l1extra::L1JetParticleCollection > ( "Taus" );
        produces < l1extra::L1JetParticleCollection > ( "IsoTaus" );
        produces < l1extra::L1JetParticleCollection > ( "Jets" );
        produces < l1extra::L1EtMissParticleCollection > ( "MHT" );
        produces < l1extra::L1EtMissParticleCollection > ( "MET" );
}
L1ExtraTranslator::~L1ExtraTranslator ( )

Definition at line 81 of file L1ExtraTranslator.cc.

{
}

Member Function Documentation

double L1ExtraTranslator::calculateTowerEtaPosition ( int  iEta) [private]

Definition at line 232 of file L1ExtraTranslator.cc.

References abs, eta, and i.

Referenced by produce().

{

  double eta;
  double halfTowerOffset = 0.0435;


  int abs_ieta =abs(iEta);

  if ( abs_ieta < 21 )
    eta = ( abs_ieta * 0.0870 ) - halfTowerOffset;   

  else

  {
    const double endcapEta[8] = { 0.09, 0.1, 0.113, 0.129, 0.15, 0.178, 0.15, 0.35 };
 
    abs_ieta -= 21;

    eta = 1.74 ;

    for ( int i = 0; i <= abs_ieta; i++ ) eta += endcapEta[i];
    
    eta -= endcapEta[abs_ieta]/2.0;
   
  }

  if (iEta<0) eta=-eta;

  //  std::cout<<"ieta = "<<iEta<<"   eta = "<<eta<<"\n";
  
  return eta;


} 
void L1ExtraTranslator::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 272 of file L1ExtraTranslator.cc.

{
}
void L1ExtraTranslator::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 86 of file L1ExtraTranslator.cc.

References abs, EtaPhiContainer< T >::begin(), calculateTowerEtaPosition(), EtaPhiContainer< T >::end(), edm::Event::getByLabel(), i, analyzePatCleaning_cfg::jets, l1extra::L1EtMissParticle::kMET, l1extra::L1EtMissParticle::kMHT, maxJetTowerEta, mClusters, mJets, mNjets, mNparticles, mTowers, edm::Event::put(), and EtaPhiContainer< T >::sort().

{
        edm::Handle < l1slhc::L1CaloClusterCollection > clusters;
        if ( iEvent.getByLabel( mClusters, clusters ) )
        {

                std::auto_ptr < l1extra::L1EmParticleCollection > l1EGamma( new l1extra::L1EmParticleCollection );
                std::auto_ptr < l1extra::L1EmParticleCollection > l1IsoEGamma( new l1extra::L1EmParticleCollection );
                std::auto_ptr < l1extra::L1JetParticleCollection > l1Tau( new l1extra::L1JetParticleCollection );
                std::auto_ptr < l1extra::L1JetParticleCollection > l1IsoTau( new l1extra::L1JetParticleCollection );

                l1slhc::L1CaloClusterCollection finalClusters ( *clusters );
                finalClusters.sort(  );

                for ( l1slhc::L1CaloClusterCollection::const_iterator i = finalClusters.begin(  ); i != finalClusters.end(  ); ++i )
                {
                        // EGamma
                        if ( l1EGamma->size() != mNparticles )
                        {
                                if ( i->isEGamma(  ) )
                                {
                                        l1EGamma->push_back( l1extra::L1EmParticle( i->p4(  ) ) );
                                }
                        }

                        // Isolated EGamma
                        if ( l1IsoEGamma->size() != mNparticles )
                        {
                                if ( i->isIsoEGamma(  ) )
                                {
                                        l1IsoEGamma->push_back( l1extra::L1EmParticle( i->p4(  ) ) );
                                }
                        }

                        if( abs( i->iEta(  ) ) <= 26 )
                        {
                                // Taus
                                if ( l1Tau->size() != mNparticles )
                                {
                                        if ( i->isTau(  ) )
                                        {
                                                l1Tau->push_back( l1extra::L1JetParticle( i->p4(  ) ) );
                                        }
                                }

                                // IsoTaus
                                if ( l1IsoTau->size() != mNparticles )
                                {
                                        if ( i->isIsoTau(  ) )
                                        {
                                                l1IsoTau->push_back( l1extra::L1JetParticle( i->p4(  ) ) );
                                        }
                                }
                        }

                }

                iEvent.put( l1EGamma, "EGamma" );
                iEvent.put( l1IsoEGamma, "IsoEGamma" );
                iEvent.put( l1Tau, "Taus" );
                iEvent.put( l1IsoTau, "IsoTaus" );
        }



        // Jets
        edm::Handle < l1slhc::L1CaloJetCollection > jets;
        if ( iEvent.getByLabel( mJets, jets ) )
        {
          LorentzVector Htvec(0,0,0,0);
          std::auto_ptr < l1extra::L1JetParticleCollection > l1Jet( new l1extra::L1JetParticleCollection );
          std::auto_ptr < l1extra::L1EtMissParticleCollection> l1MHt( new l1extra::L1EtMissParticleCollection );
         
                l1slhc::L1CaloJetCollection lJets = *jets;
                lJets.sort(  );

                for ( l1slhc::L1CaloJetCollection::const_iterator i = lJets.begin(  ); i != lJets.end(  ) ; ++i )
                {
                  
                  l1Jet->push_back( l1extra::L1JetParticle( i->p4(  ) ) );
                        
                        if ( fabs(i->p4().eta())< maxJetTowerEta ) {
                        LorentzVector jet4v(0,0,0,0);
                        jet4v.SetCoordinates(i->p4().Pt(), 0.0, i->p4().Phi(), 0.0);
                        Htvec += jet4v;
                        }
                        
                        if( l1Jet->size() == mNjets ) break;
                        
                }

                double Ht = Htvec.Et();
                Htvec.SetCoordinates(Htvec.Pt(), 0.0, Htvec.Phi(), 0.0);
                
                l1MHt->push_back( l1extra::L1EtMissParticle( 
                                                            -Htvec,
                                                            l1extra::L1EtMissParticle::kMHT,
                                                            Ht,
                                                            edm::Ref< L1GctEtMissCollection >(),
                                                            edm::Ref< L1GctEtTotalCollection >(),
                                                            edm::Ref< L1GctHtMissCollection >(),
                                                            edm::Ref< L1GctEtHadCollection >(),
                                                            0 ) );
                
                iEvent.put( l1Jet, "Jets" );
                iEvent.put( l1MHt, "MHT" );
        
        }

        
        edm::Handle < l1slhc::L1CaloTowerCollection > towers;
        if ( iEvent.getByLabel( mTowers, towers ) )
          {
            LorentzVector Etvec(0,0,0,0);
            
            std::auto_ptr < l1extra::L1EtMissParticleCollection> l1Met( new l1extra::L1EtMissParticleCollection );
            
            l1slhc::L1CaloTowerCollection lTowers = *towers;
            
            for( l1slhc::L1CaloTowerCollection::const_iterator i = lTowers.begin() ; i != lTowers.end() ; ++i ){
              
              //              if ( fabs(0.087*i->iEta())< maxJetTowerEta ) {
              if ( calculateTowerEtaPosition(i->iEta())< maxJetTowerEta ) {
              LorentzVector twr4v(0,0,0,0);

              twr4v.SetCoordinates(i->E()+i->H(), 0.0, 0.087*i->iPhi(), 0.0);
              Etvec += twr4v;      
              }
            }

            double Et = Etvec.Et();
            Etvec.SetCoordinates(Etvec.Pt(), 0.0, Etvec.Phi(), 0.0);
            l1Met->push_back( l1extra::L1EtMissParticle(   -Etvec,
                                                           l1extra::L1EtMissParticle::kMET,
                                                           Et,
                                                           edm::Ref< L1GctEtMissCollection >(),
                                                           edm::Ref< L1GctEtTotalCollection >(),
                                                           edm::Ref< L1GctHtMissCollection >(),
                                                           edm::Ref< L1GctEtHadCollection >(),
                                                           0 ) );
            iEvent.put( l1Met, "MET" );
          }
        
}

Member Data Documentation

Definition at line 54 of file L1ExtraTranslator.cc.

Referenced by produce().

Definition at line 49 of file L1ExtraTranslator.cc.

Referenced by produce().

Definition at line 50 of file L1ExtraTranslator.cc.

Referenced by produce().

std::size_t L1ExtraTranslator::mNjets [private]

Definition at line 53 of file L1ExtraTranslator.cc.

Referenced by produce().

std::size_t L1ExtraTranslator::mNparticles [private]

Definition at line 52 of file L1ExtraTranslator.cc.

Referenced by produce().

Definition at line 51 of file L1ExtraTranslator.cc.

Referenced by produce().