CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

ECALActivity Class Reference

#include <ECALActivity.h>

Inheritance diagram for ECALActivity:
edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

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

Private Member Functions

virtual bool filter (edm::Event &, const edm::EventSetup &)

Private Attributes

bool applyfilter
int EBnum
edm::InputTag EBRecHitCollection_
double EBthresh
int EEnum
edm::InputTag EERecHitCollection_
double EEthresh
int ETOTnum
double ETOTthresh

Detailed Description

Definition at line 33 of file ECALActivity.h.


Constructor & Destructor Documentation

ECALActivity::ECALActivity ( const edm::ParameterSet iConfig) [explicit]
ECALActivity::~ECALActivity ( )

Definition at line 47 of file ECALActivity.cc.

{
}

Member Function Documentation

bool ECALActivity::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDFilter.

Definition at line 51 of file ECALActivity.cc.

References bsc_activity_cfg::applyfilter, edm::SortedCollection< T, SORT >::begin(), bsc_activity_cfg::EBnum, egHLT::errCodes::EBRecHits, bsc_activity_cfg::EBthresh, bsc_activity_cfg::EEnum, egHLT::errCodes::EERecHits, bsc_activity_cfg::EEthresh, edm::SortedCollection< T, SORT >::end(), bsc_activity_cfg::ETOTnum, bsc_activity_cfg::ETOTthresh, edm::Event::getByLabel(), edm::HandleBase::isValid(), and edm::Handle< T >::product().

{
  bool accepted = false;
  bool eb= false;
  bool ee= false;
  bool etot= false;

  //int ievt = iEvent.id().event();
  //int irun = iEvent.id().run();
  //int ils = iEvent.luminosityBlock();

  int  ebabovethresh=0;
  int  eeabovethresh=0;
  int  etotabovethresh=0;


  Handle< EBRecHitCollection > pEBRecHits;
  Handle< EERecHitCollection > pEERecHits;
 
  const EBRecHitCollection*  EBRecHits = 0;
  const EERecHitCollection*  EERecHits = 0; 
  
  if ( EBRecHitCollection_.label() != "" && EBRecHitCollection_.instance() != "" ) 
    {
      iEvent.getByLabel( EBRecHitCollection_, pEBRecHits);
      if ( pEBRecHits.isValid() ) 
        {
          EBRecHits = pEBRecHits.product(); // get a ptr to the product
        } 
      else 
        {
          edm::LogError("EcalRecHitError") << "Error! can't get the product " << EBRecHitCollection_.label() ;
        }
    }

  if ( EERecHitCollection_.label() != "" && EERecHitCollection_.instance() != "" ) 
    {
      iEvent.getByLabel( EERecHitCollection_, pEERecHits);
      
      if ( pEERecHits.isValid() ) 
        {
          EERecHits = pEERecHits.product(); // get a ptr to the product
        } 
      else 
        {
          edm::LogError("EcalRecHitError") << "Error! can't get the product " << EERecHitCollection_.label() ;
      }
    }


  // now loop over them
  if (EBRecHits) 
    {
      for(EBRecHitCollection::const_iterator it  = EBRecHits->begin(); it != EBRecHits->end(); ++it) 
        {
          if (it->energy()>EBthresh) ebabovethresh++;
          if (it->energy()>ETOTthresh) etotabovethresh++;
        }
    }
  if (EERecHits) 
    {
      for(EERecHitCollection::const_iterator it  = EERecHits->begin(); it != EERecHits->end(); ++it) 
        {
          if (it->energy()>EEthresh) eeabovethresh++;
          if (it->energy()>ETOTthresh) etotabovethresh++;
        }
    }

  if(ebabovethresh>=EBnum) eb=true;
  if(eeabovethresh>=EEnum) ee=true;
  if(etotabovethresh>=ETOTnum) etot=true;

  accepted = eb|ee|etot;
  
  if (applyfilter)
    return accepted;
  else
    return true;

}

Member Data Documentation

bool ECALActivity::applyfilter [private]

Definition at line 50 of file ECALActivity.h.

int ECALActivity::EBnum [private]

Definition at line 44 of file ECALActivity.h.

Definition at line 41 of file ECALActivity.h.

double ECALActivity::EBthresh [private]

Definition at line 45 of file ECALActivity.h.

int ECALActivity::EEnum [private]

Definition at line 46 of file ECALActivity.h.

Definition at line 42 of file ECALActivity.h.

double ECALActivity::EEthresh [private]

Definition at line 47 of file ECALActivity.h.

int ECALActivity::ETOTnum [private]

Definition at line 48 of file ECALActivity.h.

double ECALActivity::ETOTthresh [private]

Definition at line 49 of file ECALActivity.h.