CMS 3D CMS Logo

EcalSkim.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EcalSkim
4 // Class: EcalSkim
5 //
6 //class EcalSkim EcalSkim.cc
7 //
8 // Original Author: Serena OGGERO
9 // Created: We May 14 10:10:52 CEST 2008
10 // Modified: Toyoko ORIMOTO
11 
12 #include <memory>
13 #include <vector>
14 #include <map>
15 #include <set>
16 
17 // user include files
19 
32 
33 using namespace edm;
34 using namespace std;
35 using namespace reco;
36 
38  BarrelClusterCollection = iConfig.getParameter<edm::InputTag>("barrelClusterCollection");
39  EndcapClusterCollection = iConfig.getParameter<edm::InputTag>("endcapClusterCollection");
40 
41  EnergyCutEB = iConfig.getUntrackedParameter<double>("energyCutEB");
42  EnergyCutEE = iConfig.getUntrackedParameter<double>("energyCutEE");
43 }
44 
46 
48  int ievt = iEvent.id().event();
49 
52 
53  iEvent.getByLabel("cosmicSuperClusters", "CosmicBarrelSuperClusters", bccHandle);
54  if (!(bccHandle.isValid())) {
55  LogWarning("EcalSkim") << BarrelClusterCollection << " not available in event " << ievt;
56  return false;
57  } else {
58  // edm::LogVerbatim("") << "I took the right barrel collection" ;
59  }
60  iEvent.getByLabel("cosmicSuperClusters", "CosmicEndcapSuperClusters", eccHandle);
61 
62  if (!(eccHandle.isValid())) {
63  LogWarning("EcalSkim") << EndcapClusterCollection << " not available";
64  //return false;
65  } else {
66  //edm::LogVerbatim("") << "I took the right endcap collection " ;
67  }
68 
69  bool accepted = false;
70  bool acceptedEB = false;
71  bool acceptedEE = false;
72 
73  // barrel
74  const reco::SuperClusterCollection* clusterCollectionEB = bccHandle.product();
75  for (reco::SuperClusterCollection::const_iterator clus = clusterCollectionEB->begin();
76  clus != clusterCollectionEB->end();
77  ++clus) {
78  if (clus->energy() >= EnergyCutEB) {
79  acceptedEB = true;
80  break;
81  }
82  }
83 
84  // endcap
85  const reco::SuperClusterCollection* clusterCollectionEE = eccHandle.product();
86  for (reco::SuperClusterCollection::const_iterator clus = clusterCollectionEE->begin();
87  clus != clusterCollectionEE->end();
88  ++clus) {
89  if (clus->energy() >= EnergyCutEE) {
90  acceptedEE = true;
91  break;
92  }
93  }
94 
95  // if there is at least one high energy cluster in EB OR EE, accept
96  if (acceptedEB || acceptedEE)
97  accepted = true;
98 
99  return accepted;
100 }
101 
102 //define this as a plug-in
MessageLogger.h
edm::Handle::product
T const * product() const
Definition: Handle.h:70
ESHandle.h
edm
HLT enums.
Definition: AlignableModifier.h:19
EDFilter.h
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
EcalSkim
Definition: EcalSkim.h:44
edm::Handle
Definition: AssociativeIterator.h:50
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
reco::SuperClusterCollection
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
Definition: SuperClusterFwd.h:9
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
EcalSkim.h
EcalSkim::EcalSkim
EcalSkim(const edm::ParameterSet &)
Definition: EcalSkim.cc:37
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
EcalSkim::filter
bool filter(edm::Event &, const edm::EventSetup &) override
Definition: EcalSkim.cc:47
edm::EventSetup
Definition: EventSetup.h:58
InputTag.h
CaloTopology.h
CaloTopologyRecord.h
std
Definition: JetResolutionObject.h:76
SuperClusterFwd.h
Frameworkfwd.h
SuperCluster.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ParameterSet.h
EcalSkim::~EcalSkim
~EcalSkim() override
Definition: EcalSkim.cc:45
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15