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 
31 
32 using namespace edm;
33 using namespace std;
34 using namespace reco;
35 
37  BarrelClusterCollection = iConfig.getParameter<edm::InputTag>("barrelClusterCollection");
38  EndcapClusterCollection = iConfig.getParameter<edm::InputTag>("endcapClusterCollection");
39 
40  EnergyCutEB = iConfig.getUntrackedParameter<double>("energyCutEB");
41  EnergyCutEE = iConfig.getUntrackedParameter<double>("energyCutEE");
42 }
43 
45 
47  int ievt = iEvent.id().event();
48 
51 
52  iEvent.getByLabel("cosmicSuperClusters", "CosmicBarrelSuperClusters", bccHandle);
53  if (!(bccHandle.isValid())) {
54  LogWarning("EcalSkim") << BarrelClusterCollection << " not available in event " << ievt;
55  return false;
56  } else {
57  // edm::LogVerbatim("") << "I took the right barrel collection" ;
58  }
59  iEvent.getByLabel("cosmicSuperClusters", "CosmicEndcapSuperClusters", eccHandle);
60 
61  if (!(eccHandle.isValid())) {
62  LogWarning("EcalSkim") << EndcapClusterCollection << " not available";
63  //return false;
64  } else {
65  //edm::LogVerbatim("") << "I took the right endcap collection " ;
66  }
67 
68  bool accepted = false;
69  bool acceptedEB = false;
70  bool acceptedEE = false;
71 
72  // barrel
73  const reco::SuperClusterCollection* clusterCollectionEB = bccHandle.product();
74  for (reco::SuperClusterCollection::const_iterator clus = clusterCollectionEB->begin();
75  clus != clusterCollectionEB->end();
76  ++clus) {
77  if (clus->energy() >= EnergyCutEB) {
78  acceptedEB = true;
79  break;
80  }
81  }
82 
83  // endcap
84  const reco::SuperClusterCollection* clusterCollectionEE = eccHandle.product();
85  for (reco::SuperClusterCollection::const_iterator clus = clusterCollectionEE->begin();
86  clus != clusterCollectionEE->end();
87  ++clus) {
88  if (clus->energy() >= EnergyCutEE) {
89  acceptedEE = true;
90  break;
91  }
92  }
93 
94  // if there is at least one high energy cluster in EB OR EE, accept
95  if (acceptedEB || acceptedEE)
96  accepted = true;
97 
98  return accepted;
99 }
100 
101 //define this as a plug-in
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
T const * product() const
Definition: Handle.h:70
T getUntrackedParameter(std::string const &, T const &) const
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:46
EcalSkim(const edm::ParameterSet &)
Definition: EcalSkim.cc:36
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool isValid() const
Definition: HandleBase.h:70
fixed size matrix
HLT enums.
~EcalSkim() override
Definition: EcalSkim.cc:44
Log< level::Warning, false > LogWarning