CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
EventNumber_t event() const
Definition: EventID.h:40
T getUntrackedParameter(std::string const &, T const &) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
int iEvent
Definition: GenABIO.cc:224
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
bool filter(edm::Event &, const edm::EventSetup &) override
Definition: EcalSkim.cc:47
EcalSkim(const edm::ParameterSet &)
Definition: EcalSkim.cc:37
bool isValid() const
Definition: HandleBase.h:70
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:500
T const * product() const
Definition: Handle.h:70
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EventID id() const
Definition: EventBase.h:59
~EcalSkim() override
Definition: EcalSkim.cc:45
Log< level::Warning, false > LogWarning