CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

EcalSkim Class Reference

#include <EcalSkim.h>

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

List of all members.

Public Member Functions

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

Private Member Functions

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

Private Attributes

edm::InputTag BarrelClusterCollection
edm::InputTag EndcapClusterCollection
double EnergyCutEB
double EnergyCutEE

Detailed Description

Definition at line 44 of file EcalSkim.h.


Constructor & Destructor Documentation

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

Definition at line 37 of file EcalSkim.cc.

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

{
  BarrelClusterCollection = iConfig.getParameter<edm::InputTag>("barrelClusterCollection");
  EndcapClusterCollection = iConfig.getParameter<edm::InputTag>("endcapClusterCollection");

  EnergyCutEB = iConfig.getUntrackedParameter<double>("energyCutEB");
  EnergyCutEE = iConfig.getUntrackedParameter<double>("energyCutEE");

}
EcalSkim::~EcalSkim ( )

Definition at line 47 of file EcalSkim.cc.

{
}

Member Function Documentation

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

Implements edm::EDFilter.

Definition at line 51 of file EcalSkim.cc.

References edm::EventID::event(), edm::Event::getByLabel(), edm::EventBase::id(), edm::HandleBase::isValid(), and edm::Handle< T >::product().

{
 int ievt = iEvent.id().event();

 edm::Handle<reco::SuperClusterCollection> bccHandle; // barrel
 edm::Handle<reco::SuperClusterCollection> eccHandle; // endcap 
 
 iEvent.getByLabel("cosmicSuperClusters","CosmicBarrelSuperClusters", bccHandle);
 if (!(bccHandle.isValid()))
 {
   LogWarning("EcalSkim") << BarrelClusterCollection << " not available in event " << ievt;
   return false;
 }
 else 
 {
   //   edm::LogVerbatim("") << "I took the right barrel collection" ;
 }
 iEvent.getByLabel("cosmicSuperClusters","CosmicEndcapSuperClusters", eccHandle);
 
 if (!(eccHandle.isValid()))
 {
   LogWarning("EcalSkim") << EndcapClusterCollection << " not available";
   //return false;
 }
 else 
 {
   //edm::LogVerbatim("") << "I took the right endcap collection " ;
 }

 bool accepted = false;
 bool acceptedEB = false;
 bool acceptedEE = false;

 // barrel
 const reco::SuperClusterCollection *clusterCollectionEB = bccHandle.product();
 for (reco::SuperClusterCollection::const_iterator clus = clusterCollectionEB->begin(); clus != clusterCollectionEB->end(); ++clus)
   {
     if ( clus->energy() >= EnergyCutEB )
       {
         acceptedEB = true;
         break;
       }
   }
 
 // endcap
 const reco::SuperClusterCollection *clusterCollectionEE = eccHandle.product();
 for (reco::SuperClusterCollection::const_iterator clus = clusterCollectionEE->begin(); clus != clusterCollectionEE->end(); ++clus)
   {
     if ( clus->energy() >= EnergyCutEE )
       {
         acceptedEE = true;
         break;
       }
   }
 
 // if there is at least one high energy cluster in EB OR EE, accept
 if (acceptedEB||acceptedEE) accepted = true;  

 return accepted;

}

Member Data Documentation

Definition at line 52 of file EcalSkim.h.

Definition at line 53 of file EcalSkim.h.

double EcalSkim::EnergyCutEB [private]

Definition at line 54 of file EcalSkim.h.

double EcalSkim::EnergyCutEE [private]

Definition at line 55 of file EcalSkim.h.