CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgammaHLTEcalIsolationProducersRegional.cc
Go to the documentation of this file.
1 
8 #include <iostream>
9 #include <vector>
10 #include <memory>
11 
12 
14 
15 
16 // Framework
20 
24 
25 
29 
32 
33 
37 
39 
40 
42 {
43 
44  // use configuration file to setup input/output collection names
45 
46  bcBarrelProducer_ = conf_.getParameter<edm::InputTag>("bcBarrelProducer");
47  bcEndcapProducer_ = conf_.getParameter<edm::InputTag>("bcEndcapProducer");
48 
49  scIslandBarrelProducer_ = conf_.getParameter<edm::InputTag>("scIslandBarrelProducer");
50  scIslandEndcapProducer_ = conf_.getParameter<edm::InputTag>("scIslandEndcapProducer");
51 
52  recoEcalCandidateProducer_ = conf_.getParameter<edm::InputTag>("recoEcalCandidateProducer");
53 
54  egEcalIsoEtMin_ = conf_.getParameter<double>("egEcalIsoEtMin");
55  egEcalIsoConeSize_ = conf_.getParameter<double>("egEcalIsoConeSize");
56  algoType_ = conf_.getParameter<int>("SCAlgoType");
57  test_ = new EgammaHLTEcalIsolation(egEcalIsoEtMin_,egEcalIsoConeSize_,algoType_);
58 
59 
60  //register your products
61  produces < reco::RecoEcalCandidateIsolationMap >();
62 }
63 
65 
66 // ------------ method called to produce the data ------------
67 
69 
70  // Get the basic cluster collection in the Barrel
72  iEvent.getByLabel(bcBarrelProducer_, bcBarrelHandle);
73  const reco::BasicClusterCollection* clusterBarrelCollection = bcBarrelHandle.product();
74  // Get the basic cluster collection in the endcap
76  iEvent.getByLabel(bcEndcapProducer_, bcEndcapHandle);
77  const reco::BasicClusterCollection* clusterEndcapCollection = (bcEndcapHandle.product());
78  // Get the Barrel Super Cluster collection
80  iEvent.getByLabel(scIslandBarrelProducer_,scBarrelHandle);
81  const reco::SuperClusterCollection* scBarrelCollection = (scBarrelHandle.product());
82  // Get the Endcap Super Cluster collection
84  iEvent.getByLabel(scIslandEndcapProducer_,scEndcapHandle);
85  const reco::SuperClusterCollection* scEndcapCollection = (scEndcapHandle.product());
86  // Get the RecoEcalCandidate Collection
88  iEvent.getByLabel(recoEcalCandidateProducer_,recoecalcandHandle);
89 
90  std::vector<const reco::BasicCluster*> clusterCollection;
91  for (reco::BasicClusterCollection::const_iterator ibc = clusterBarrelCollection->begin();
92  ibc < clusterBarrelCollection->end(); ibc++ ){clusterCollection.push_back(&(*ibc));}
93  for (reco::BasicClusterCollection::const_iterator iec = clusterEndcapCollection->begin();
94  iec < clusterEndcapCollection->end(); iec++ ){clusterCollection.push_back(&(*iec));}
95  std::vector<const reco::SuperCluster*> scCollection;
96  for (reco::SuperClusterCollection::const_iterator ibsc = scBarrelCollection->begin();
97  ibsc < scBarrelCollection->end(); ibsc++ ){scCollection.push_back(&(*ibsc));}
98  for (reco::SuperClusterCollection::const_iterator iesc = scEndcapCollection->begin();
99  iesc < scEndcapCollection->end(); iesc++ ){scCollection.push_back(&(*iesc));}
100 
102 
103 
104 
105  for (reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand= recoecalcandHandle->begin(); iRecoEcalCand!=recoecalcandHandle->end(); iRecoEcalCand++) {
106 
107 
108  reco::RecoEcalCandidateRef recoecalcandref(reco::RecoEcalCandidateRef(recoecalcandHandle,iRecoEcalCand -recoecalcandHandle ->begin()));
109 
110 
111  const reco::RecoCandidate *tempiRecoEcalCand = &(*recoecalcandref);
112  float isol = test_->isolPtSum(tempiRecoEcalCand,scCollection, clusterCollection);
113 
114  isoMap.insert(recoecalcandref, isol);
115 
116  }
117 
118  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> isolMap(new reco::RecoEcalCandidateIsolationMap(isoMap));
119  iEvent.put(isolMap);
120 
121 }
122 
123 //define this as a plug-in
124 //DEFINE_FWK_MODULE(EgammaHLTEcalIsolationProducersRegional);
T getParameter(std::string const &) const
int iEvent
Definition: GenABIO.cc:243
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
virtual void produce(edm::Event &, const edm::EventSetup &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
void insert(const key_type &k, const data_type &v)
insert an association
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
T const * product() const
Definition: Handle.h:74
#define begin
Definition: vmac.h:31
float isolPtSum(const reco::RecoCandidate *recocandidate, const std::vector< const reco::SuperCluster * > sclusters, const std::vector< const reco::BasicCluster * > bclusters)