Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <memory>
00013 #include <vector>
00014 #include <map>
00015 #include <set>
00016
00017
00018 #include "DPGAnalysis/Skims/interface/EcalSkim.h"
00019
00020 #include "FWCore/Utilities/interface/InputTag.h"
00021 #include "FWCore/Framework/interface/Frameworkfwd.h"
00022 #include "FWCore/Framework/interface/EDFilter.h"
00023 #include "FWCore/Framework/interface/Event.h"
00024 #include "FWCore/Framework/interface/MakerMacros.h"
00025 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00026 #include "FWCore/Framework/interface/ESHandle.h"
00027 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00028 #include "Geometry/CaloTopology/interface/CaloTopology.h"
00029 #include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
00030 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00031 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
00032
00033 using namespace edm;
00034 using namespace std;
00035 using namespace reco;
00036
00037 EcalSkim::EcalSkim(const edm::ParameterSet& iConfig)
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 }
00046
00047 EcalSkim::~EcalSkim()
00048 {
00049 }
00050
00051 bool EcalSkim::filter( edm::Event& iEvent, const edm::EventSetup& iSetup)
00052 {
00053 int ievt = iEvent.id().event();
00054
00055 edm::Handle<reco::SuperClusterCollection> bccHandle;
00056 edm::Handle<reco::SuperClusterCollection> eccHandle;
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
00067 }
00068 iEvent.getByLabel("cosmicSuperClusters","CosmicEndcapSuperClusters", eccHandle);
00069
00070 if (!(eccHandle.isValid()))
00071 {
00072 LogWarning("EcalSkim") << EndcapClusterCollection << " not available";
00073
00074 }
00075 else
00076 {
00077
00078 }
00079
00080 bool accepted = false;
00081 bool acceptedEB = false;
00082 bool acceptedEE = false;
00083
00084
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
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
00107 if (acceptedEB||acceptedEE) accepted = true;
00108
00109 return accepted;
00110
00111 }
00112
00113
00114 DEFINE_FWK_MODULE(EcalSkim);