#include <DPGAnalysis/Skims/interface/EcalSkim.h>
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 |
Definition at line 44 of file EcalSkim.h.
EcalSkim::EcalSkim | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 37 of file EcalSkim.cc.
References BarrelClusterCollection, EndcapClusterCollection, EnergyCutEB, EnergyCutEE, edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().
00038 { 00039 BarrelClusterCollection = iConfig.getParameter<edm::InputTag>("barrelClusterCollection"); 00040 EndcapClusterCollection = iConfig.getParameter<edm::InputTag>("endcapClusterCollection"); 00041 00042 EnergyCutEB = iConfig.getUntrackedParameter<double>("energyCutEB"); 00043 EnergyCutEE = iConfig.getUntrackedParameter<double>("energyCutEE"); 00044 00045 }
EcalSkim::~EcalSkim | ( | ) |
bool EcalSkim::filter | ( | edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [private, virtual] |
Implements edm::EDFilter.
Definition at line 51 of file EcalSkim.cc.
References BarrelClusterCollection, EndcapClusterCollection, EnergyCutEB, EnergyCutEE, edm::EventID::event(), edm::Event::getByLabel(), edm::Event::id(), edm::Handle< T >::isValid(), and edm::Handle< T >::product().
00052 { 00053 int ievt = iEvent.id().event(); 00054 00055 edm::Handle<reco::SuperClusterCollection> bccHandle; // barrel 00056 edm::Handle<reco::SuperClusterCollection> eccHandle; // endcap 00057 00058 iEvent.getByLabel("cosmicSuperClusters","CosmicBarrelSuperClusters", bccHandle); 00059 if (!(bccHandle.isValid())) 00060 { 00061 LogWarning("EcalSkim") << BarrelClusterCollection << " not available in event " << ievt; 00062 return false; 00063 } 00064 else 00065 { 00066 // edm::LogVerbatim("") << "I took the right barrel collection" ; 00067 } 00068 iEvent.getByLabel("cosmicSuperClusters","CosmicEndcapSuperClusters", eccHandle); 00069 00070 if (!(eccHandle.isValid())) 00071 { 00072 LogWarning("EcalSkim") << EndcapClusterCollection << " not available"; 00073 //return false; 00074 } 00075 else 00076 { 00077 //edm::LogVerbatim("") << "I took the right endcap collection " ; 00078 } 00079 00080 bool accepted = false; 00081 bool acceptedEB = false; 00082 bool acceptedEE = false; 00083 00084 // barrel 00085 const reco::SuperClusterCollection *clusterCollectionEB = bccHandle.product(); 00086 for (reco::SuperClusterCollection::const_iterator clus = clusterCollectionEB->begin(); clus != clusterCollectionEB->end(); ++clus) 00087 { 00088 if ( clus->energy() >= EnergyCutEB ) 00089 { 00090 acceptedEB = true; 00091 break; 00092 } 00093 } 00094 00095 // endcap 00096 const reco::SuperClusterCollection *clusterCollectionEE = eccHandle.product(); 00097 for (reco::SuperClusterCollection::const_iterator clus = clusterCollectionEE->begin(); clus != clusterCollectionEE->end(); ++clus) 00098 { 00099 if ( clus->energy() >= EnergyCutEE ) 00100 { 00101 acceptedEE = true; 00102 break; 00103 } 00104 } 00105 00106 // if there is at least one high energy cluster in EB OR EE, accept 00107 if (acceptedEB||acceptedEE) accepted = true; 00108 00109 return accepted; 00110 00111 }
double EcalSkim::EnergyCutEB [private] |
double EcalSkim::EnergyCutEE [private] |