CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

BeamSplash Class Reference

#include <BeamSplash.h>

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

List of all members.

Public Member Functions

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

Private Member Functions

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

Private Attributes

bool applyfilter
edm::InputTag EBRecHitCollection_
edm::InputTag EERecHitCollection_
double EnergyCutEcal
double EnergyCutHcal
double EnergyCutTot
edm::InputTag HBHERecHitCollection_

Detailed Description

Definition at line 33 of file BeamSplash.h.


Constructor & Destructor Documentation

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

Definition at line 35 of file BeamSplash.cc.

References bsc_activity_cfg::applyfilter, edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

{
  EBRecHitCollection_ = iConfig.getParameter<edm::InputTag>("ebrechitcollection");
  EERecHitCollection_ = iConfig.getParameter<edm::InputTag>("eerechitcollection");
  HBHERecHitCollection_ = iConfig.getParameter<edm::InputTag>("hbherechitcollection");

  EnergyCutTot = iConfig.getUntrackedParameter<double>("energycuttot");
  EnergyCutEcal = iConfig.getUntrackedParameter<double>("energycutecal");
  EnergyCutHcal = iConfig.getUntrackedParameter<double>("energycuthcal");
  applyfilter = iConfig.getUntrackedParameter<bool>("applyfilter",true);
}
BeamSplash::~BeamSplash ( )

Definition at line 47 of file BeamSplash.cc.

{
}

Member Function Documentation

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

Implements edm::EDFilter.

Definition at line 51 of file BeamSplash.cc.

References bsc_activity_cfg::applyfilter, edm::SortedCollection< T, SORT >::begin(), edm::EventBase::bunchCrossing(), gather_cfg::cout, egHLT::errCodes::EBRecHits, egHLT::errCodes::EERecHits, edm::SortedCollection< T, SORT >::end(), edm::EventID::event(), edm::Event::getByLabel(), egHLT::errCodes::HBHERecHits, edm::EventBase::id(), edm::HandleBase::isValid(), edm::EventBase::luminosityBlock(), edm::Handle< T >::product(), and edm::EventID::run().

{
  bool accepted = false;

  bool acceptedtot = false;
  bool acceptedEcal = false;
  bool acceptedHcal = false;

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

  double totene=0;
  double ecalene=0;
  double hcalene=0;


  Handle< EBRecHitCollection > pEBRecHits;
  Handle< EERecHitCollection > pEERecHits;
  Handle< HBHERecHitCollection > pHBHERecHits;
 
  const EBRecHitCollection*  EBRecHits = 0;
  const EERecHitCollection*  EERecHits = 0; 
  const HBHERecHitCollection*  HBHERecHits = 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() ;
      }
    }

  if ( HBHERecHitCollection_.label() != "" )
    {
      iEvent.getByLabel( HBHERecHitCollection_, pHBHERecHits);
      
      if ( pHBHERecHits.isValid() ) 
        {
          HBHERecHits = pHBHERecHits.product(); // get a ptr to the product
        } 
      else 
        {
          edm::LogError("HcalRecHitError") << "Error! can't get the product " << HBHERecHitCollection_.label() ;
      }
    }

  // now sum over them
  if (EBRecHits) 
    {
      for(EBRecHitCollection::const_iterator it  = EBRecHits->begin(); it != EBRecHits->end(); ++it) 
        {
          totene+=it->energy();
          ecalene+=it->energy();
        }
    }
  if (EERecHits) 
    {
      for(EERecHitCollection::const_iterator it  = EERecHits->begin(); it != EERecHits->end(); ++it) 
        {
          totene+=it->energy();
          ecalene+=it->energy();
        }
    }
  if (HBHERecHits) 
    {
      for(HBHERecHitCollection::const_iterator it  = HBHERecHits->begin(); it != HBHERecHits->end(); ++it) 
        {
          totene+=it->energy();
          hcalene+=it->energy();
        }
    }

  if(totene>EnergyCutTot) acceptedtot=true;
  if(ecalene>EnergyCutEcal) acceptedEcal=true;
  if(hcalene>EnergyCutHcal) acceptedHcal=true;

  accepted = acceptedtot|acceptedEcal|acceptedHcal;
  
  
  if (accepted)
        {
    edm::LogVerbatim("BeamSplash") << "!!!!!!!BeamSplash!!!!!!!: run:" << irun << " event:" << ievt << " ls:"<< ils << " bx= " << ibx  <<" totene=" << totene << " ecalene=" << ecalene << " hcalene=" << hcalene ; 
    std::cout << "!!!!!!!BeamSplash!!!!!!!: run:" << irun << " event:" << ievt << " ls:"<< ils << " bx= " << ibx  <<" totene=" <<totene << " ecalene=" << ecalene << " hcalene=" << hcalene << std::endl; 
 } 

  if (applyfilter)
    return accepted;
  else
    return true;

}

Member Data Documentation

bool BeamSplash::applyfilter [private]

Definition at line 47 of file BeamSplash.h.

Definition at line 41 of file BeamSplash.h.

Definition at line 42 of file BeamSplash.h.

double BeamSplash::EnergyCutEcal [private]

Definition at line 45 of file BeamSplash.h.

double BeamSplash::EnergyCutHcal [private]

Definition at line 46 of file BeamSplash.h.

double BeamSplash::EnergyCutTot [private]

Definition at line 44 of file BeamSplash.h.

Definition at line 43 of file BeamSplash.h.