CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
AlCaECALRecHitReducer Class Reference

#include <Calibration/EcalAlCaRecoProducers/src/AlCaECALRecHitReducer.cc>

Inheritance diagram for AlCaECALRecHitReducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 AlCaECALRecHitReducer (const edm::ParameterSet &)
 ctor More...
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 producer More...
 
 ~AlCaECALRecHitReducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void AddMiniRecHitCollection (const reco::SuperCluster &sc, std::set< DetId > &reducedRecHitMap, const CaloTopology *caloTopology)
 

Private Attributes

std::string alcaBarrelHitsCollection_
 
std::string alcaCaloClusterCollection_
 
std::string alcaEndcapHitsCollection_
 
std::string alcaPreshowerHitsCollection_
 
edm::EDGetTokenT
< EcalRecHitCollection
ebRecHitsToken_
 
edm::EDGetTokenT
< EcalRecHitCollection
eeRecHitsToken_
 
edm::EDGetTokenT
< reco::SuperClusterCollection
EESuperClusterToken_
 
edm::EDGetTokenT
< reco::GsfElectronCollection
electronToken_
 
std::vector< edm::EDGetTokenT
< edm::View
< reco::RecoCandidate > > > 
eleViewTokens_
 
edm::EDGetTokenT
< EcalRecHitCollection
esRecHitsToken_
 
int etaSize_
 
double minEta_highEtaSC_
 
int phiSize_
 
edm::EDGetTokenT
< reco::PhotonCollection
photonToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

class declaration

Description: Example of a producer of AlCa electrons

Implementation: <Notes on="" implementation>="">

Description: This plugin saves tracks and trackExtras that are associated to an electron creating two new track and track extra collections

Definition at line 48 of file AlCaECALRecHitReducer.h.

Constructor & Destructor Documentation

AlCaECALRecHitReducer::AlCaECALRecHitReducer ( const edm::ParameterSet iConfig)
explicit

ctor

This module reduces the recHitCollections and the caloCalusterCollections in input keeping only those associated to the given electrons/photons

Definition at line 23 of file AlCaECALRecHitReducer.cc.

References alcaBarrelHitsCollection_, alcaCaloClusterCollection_, alcaEndcapHitsCollection_, edm::EDConsumerBase::consumes(), ebRecHitsToken_, eeRecHitsToken_, EESuperClusterToken_, eleViewTokens_, etaSize_, edm::ParameterSet::getParameter(), beam_dqm_sourceclient-live_cfg::inputTag, minEta_highEtaSC_, phiSize_, photonToken_, and AlCaHLTBitMon_QueryRunRegistry::string.

24 {
25 
26  ebRecHitsToken_ = consumes<EcalRecHitCollection>(iConfig.getParameter< edm::InputTag > ("ebRecHitsLabel"));
27  eeRecHitsToken_ = consumes<EcalRecHitCollection>(iConfig.getParameter< edm::InputTag > ("eeRecHitsLabel"));
28  // esRecHitsLabel_ = iConfig.getParameter< edm::InputTag > ("esRecHitsLabel");
29 
30  std::vector<edm::InputTag> srcLabels = iConfig.getParameter< std::vector<edm::InputTag> >("srcLabels");
31  for ( auto inputTag = srcLabels.begin(); inputTag != srcLabels.end(); ++inputTag){
33  }
34 
35  //eleViewToken_ = consumes<edm::View <reco::RecoCandidate> > (iConfig.getParameter< edm::InputTag > ("electronLabel"));
36  photonToken_ = consumes<reco::PhotonCollection>(iConfig.getParameter< edm::InputTag > ("photonLabel"));
37  EESuperClusterToken_ = consumes<reco::SuperClusterCollection>(iConfig.getParameter< edm::InputTag>("EESuperClusterCollection"));
38 
39  minEta_highEtaSC_ = iConfig.getParameter< double >("minEta_highEtaSC");
40 
41  alcaBarrelHitsCollection_ = iConfig.getParameter<std::string>("alcaBarrelHitCollection");
42  alcaEndcapHitsCollection_ = iConfig.getParameter<std::string>("alcaEndcapHitCollection");
43  alcaCaloClusterCollection_ = iConfig.getParameter<std::string>("alcaCaloClusterCollection");
44 
45  // alcaPreshowerHitsCollection_ = iConfig.getParameter<std::string>("alcaPreshowerHitCollection");
46 
47  etaSize_ = iConfig.getParameter<int> ("etaSize");
48  phiSize_ = iConfig.getParameter<int> ("phiSize");
49  // FIXME: minimum size of etaSize_ and phiSize_
50  if ( phiSize_ % 2 == 0 || etaSize_ % 2 == 0)
51  edm::LogError("AlCaECALRecHitReducerError") << "Size of eta/phi should be odd numbers";
52 
53  // esNstrips_ = iConfig.getParameter<int> ("esNstrips");
54  // esNcolumns_ = iConfig.getParameter<int> ("esNcolumns");
55 
56  //register your products
57  produces< EBRecHitCollection > (alcaBarrelHitsCollection_) ;
58  produces< EERecHitCollection > (alcaEndcapHitsCollection_) ;
59  produces< reco::CaloClusterCollection > (alcaCaloClusterCollection_) ;
60  // produces< ESRecHitCollection > (alcaPreshowerHitsCollection_) ;
61 }
T getParameter(std::string const &) const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< reco::SuperClusterCollection > EESuperClusterToken_
std::vector< edm::EDGetTokenT< edm::View< reco::RecoCandidate > > > eleViewTokens_
std::string alcaCaloClusterCollection_
edm::EDGetTokenT< reco::PhotonCollection > photonToken_
edm::EDGetTokenT< EcalRecHitCollection > eeRecHitsToken_
edm::EDGetTokenT< EcalRecHitCollection > ebRecHitsToken_
AlCaECALRecHitReducer::~AlCaECALRecHitReducer ( )

Definition at line 64 of file AlCaECALRecHitReducer.cc.

65 {}

Member Function Documentation

void AlCaECALRecHitReducer::AddMiniRecHitCollection ( const reco::SuperCluster sc,
std::set< DetId > &  reducedRecHitMap,
const CaloTopology caloTopology 
)
private

Definition at line 209 of file AlCaECALRecHitReducer.cc.

References EcalBarrel, etaSize_, CaloTopology::getWindow(), reco::CaloCluster::hitsAndFractions(), i, bookConverter::max, phiSize_, reco::SuperCluster::seed(), fileCollector::seed, and DetId::subdetId().

Referenced by produce().

212  {
213  DetId seed=(sc.seed()->seed());
214  int phiSize=phiSize_, etaSize=etaSize_;
215  if(seed.subdetId()!=EcalBarrel){ // if not EB, take a square window
216  etaSize= std::max(phiSize_,etaSize_);
217  phiSize=etaSize;
218  }
219 
220  std::vector<DetId> recHit_window = caloTopology->getWindow(seed, phiSize, etaSize);
221  for(unsigned int i =0; i < recHit_window.size(); i++){
222  reducedRecHitMap.insert(recHit_window[i]);
223  }
224 
225  const std::vector< std::pair<DetId, float> > & scHits = sc.hitsAndFractions();
226  for(std::vector< std::pair<DetId, float> >::const_iterator scHit_itr = scHits.begin();
227  scHit_itr != scHits.end(); scHit_itr++){
228  // the map fills just one time (avoiding double insert of recHits)
229  reducedRecHitMap.insert(scHit_itr->first);
230  }
231 
232 
233  return;
234 }
int i
Definition: DBlmapReader.cc:9
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:192
std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
Get the neighbors of the given cell in a window of given size.
Definition: CaloTopology.cc:73
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:66
void AlCaECALRecHitReducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

producer

Implements edm::EDProducer.

Definition at line 70 of file AlCaECALRecHitReducer.cc.

References AddMiniRecHitCollection(), alcaBarrelHitsCollection_, alcaCaloClusterCollection_, alcaEndcapHitsCollection_, reco::SuperCluster::clustersBegin(), reco::SuperCluster::clustersEnd(), ebRecHitsToken_, eeRecHitsToken_, EESuperClusterToken_, eleViewTokens_, reco::CaloCluster::eta(), edm::EventSetup::get(), edm::Event::getByToken(), minEta_highEtaSC_, photonToken_, and edm::Event::put().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

72 {
73  using namespace edm;
74  //using namespace std;
75 
77 
78  edm::ESHandle<CaloTopology> theCaloTopology;
79  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
80  const CaloTopology *caloTopology = theCaloTopology.product();
81 
82 
83  // Get Photons
85  iEvent.getByToken(photonToken_, phoHandle);
86 
87  // get RecHits
88  Handle<EBRecHitCollection> barrelRecHitsHandle;
89  iEvent.getByToken(ebRecHitsToken_,barrelRecHitsHandle);
90  const EBRecHitCollection *barrelHitsCollection = barrelRecHitsHandle.product () ;
91 
92  // get RecHits
93  Handle<EERecHitCollection> endcapRecHitsHandle;
94  iEvent.getByToken(eeRecHitsToken_,endcapRecHitsHandle);
95  const EERecHitCollection *endcapHitsCollection = endcapRecHitsHandle.product () ;
96 
97  // // get ES RecHits
98  // Handle<ESRecHitCollection> preshowerRecHitsHandle;
99  // iEvent.getByToken(esRecHitsToken_,preshowerRecHitsHandle);
100 
101  // const ESRecHitCollection * preshowerHitsCollection = 0 ;
102  // if (preshowerIsFull)
103  // preshowerHitsCollection = preshowerRecHitsHandle.product () ;
104 
105  // // make a vector to store the used ES rechits:
106  // set<ESDetId> used_strips;
107  // used_strips.clear();
108 
109  // for Z->ele+SC
111  iEvent.getByToken(EESuperClusterToken_, EESCHandle);
112 
113  //Create empty output collections
114  std::auto_ptr< EBRecHitCollection > miniEBRecHitCollection (new EBRecHitCollection) ;
115  std::auto_ptr< EERecHitCollection > miniEERecHitCollection (new EERecHitCollection) ;
116  // std::auto_ptr< ESRecHitCollection > miniESRecHitCollection (new ESRecHitCollection) ;
117 
118  std::set<DetId> reducedRecHit_EBmap;
119  std::set<DetId> reducedRecHit_EEmap;
120 
121  // std::set< edm::Ref<reco::CaloCluster> > reducedCaloClusters_map;
122 
123  std::auto_ptr< reco::CaloClusterCollection > reducedCaloClusterCollection (new reco::CaloClusterCollection);
124 
125  //Photons:
126 #ifdef shervin
127  for (reco::PhotonCollection::const_iterator phoIt=phoHandle->begin(); phoIt!=phoHandle->end(); phoIt++) {
128  const reco::SuperCluster& sc = *(phoIt->superCluster()) ;
129 
130  if (phoIt->isEB()) {
131  AddMiniRecHitCollection(sc, reducedRecHit_EBmap, caloTopology);
132  } else { // endcap
133  AddMiniRecHitCollection(sc, reducedRecHit_EEmap, caloTopology);
134  } // end of endcap
135 
139  for ( ; it !=itend; ++it) {
140  reco::CaloCluster caloClus(**it);
141  reducedCaloClusterCollection->push_back(caloClus);
142  }
143  }
144 #endif
145 
147  for(auto iToken=eleViewTokens_.begin(); iToken!=eleViewTokens_.end(); iToken++){
148  iEvent.getByToken(*iToken, eleViewHandle);
149 
150  //Electrons:
151  for (auto eleIt=eleViewHandle->begin(); eleIt!=eleViewHandle->end(); eleIt++) {
152  const reco::SuperCluster& sc = *(eleIt->superCluster()) ;
153 
154  if (fabs(sc.eta())<1.479) {
155  AddMiniRecHitCollection(sc, reducedRecHit_EBmap, caloTopology);
156  } else { // endcap
157  AddMiniRecHitCollection(sc, reducedRecHit_EEmap, caloTopology);
158  } // end of endcap
159 
162  for ( ; it !=itend; ++it) {
163  reco::CaloCluster caloClus(**it);
164  reducedCaloClusterCollection->push_back(caloClus);
165  }
166  }
167  }
168 
169 
170 
171  //saving recHits for highEta SCs for highEta studies
172  for(reco::SuperClusterCollection::const_iterator SC_iter = EESCHandle->begin();
173  SC_iter!=EESCHandle->end();
174  SC_iter++){
175  if(fabs(SC_iter->eta()) < minEta_highEtaSC_) continue;
176  AddMiniRecHitCollection(*SC_iter, reducedRecHit_EEmap, caloTopology);
177 
178  const reco::SuperCluster& sc = *(SC_iter);
181  for ( ; it !=itend; ++it) {
182  reco::CaloCluster caloClus(**it);
183  reducedCaloClusterCollection->push_back(caloClus);
184  }
185  }
186 
187 
188  //------------------------------ fill the alcareco reduced recHit collection
189  for(std::set<DetId>::const_iterator itr = reducedRecHit_EBmap.begin();
190  itr != reducedRecHit_EBmap.end(); itr++){
191  if (barrelHitsCollection->find(*itr) != barrelHitsCollection->end())
192  miniEBRecHitCollection->push_back(*(barrelHitsCollection->find(*itr)));
193  }
194 
195  for(std::set<DetId>::const_iterator itr = reducedRecHit_EEmap.begin();
196  itr != reducedRecHit_EEmap.end(); itr++){
197  if (endcapHitsCollection->find(*itr) != endcapHitsCollection->end())
198  miniEERecHitCollection->push_back(*(endcapHitsCollection->find(*itr)));
199  }
200 
201 
202  //--------------------------------------- Put selected information in the event
203  iEvent.put( miniEBRecHitCollection,alcaBarrelHitsCollection_ );
204  iEvent.put( miniEERecHitCollection,alcaEndcapHitsCollection_ );
205  // iEvent.put( miniESRecHitCollection,alcaPreshowerHitsCollection_ );
206  iEvent.put( reducedCaloClusterCollection, alcaCaloClusterCollection_);
207 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
std::vector< EcalRecHit >::const_iterator const_iterator
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:163
void AddMiniRecHitCollection(const reco::SuperCluster &sc, std::set< DetId > &reducedRecHitMap, const CaloTopology *caloTopology)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
std::vector< CaloCluster > CaloClusterCollection
collection of CaloCluster objects
edm::EDGetTokenT< reco::SuperClusterCollection > EESuperClusterToken_
std::vector< edm::EDGetTokenT< edm::View< reco::RecoCandidate > > > eleViewTokens_
const T & get() const
Definition: EventSetup.h:55
std::string alcaCaloClusterCollection_
edm::EDGetTokenT< reco::PhotonCollection > photonToken_
edm::EDGetTokenT< EcalRecHitCollection > eeRecHitsToken_
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
Definition: SuperCluster.h:75
edm::EDGetTokenT< EcalRecHitCollection > ebRecHitsToken_
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
Definition: SuperCluster.h:78

Member Data Documentation

std::string AlCaECALRecHitReducer::alcaBarrelHitsCollection_
private

Definition at line 71 of file AlCaECALRecHitReducer.h.

Referenced by AlCaECALRecHitReducer(), and produce().

std::string AlCaECALRecHitReducer::alcaCaloClusterCollection_
private

Definition at line 84 of file AlCaECALRecHitReducer.h.

Referenced by AlCaECALRecHitReducer(), and produce().

std::string AlCaECALRecHitReducer::alcaEndcapHitsCollection_
private

Definition at line 72 of file AlCaECALRecHitReducer.h.

Referenced by AlCaECALRecHitReducer(), and produce().

std::string AlCaECALRecHitReducer::alcaPreshowerHitsCollection_
private

Definition at line 73 of file AlCaECALRecHitReducer.h.

edm::EDGetTokenT<EcalRecHitCollection> AlCaECALRecHitReducer::ebRecHitsToken_
private

Definition at line 63 of file AlCaECALRecHitReducer.h.

Referenced by AlCaECALRecHitReducer(), and produce().

edm::EDGetTokenT<EcalRecHitCollection> AlCaECALRecHitReducer::eeRecHitsToken_
private

Definition at line 64 of file AlCaECALRecHitReducer.h.

Referenced by AlCaECALRecHitReducer(), and produce().

edm::EDGetTokenT<reco::SuperClusterCollection> AlCaECALRecHitReducer::EESuperClusterToken_
private

Definition at line 70 of file AlCaECALRecHitReducer.h.

Referenced by AlCaECALRecHitReducer(), and produce().

edm::EDGetTokenT<reco::GsfElectronCollection> AlCaECALRecHitReducer::electronToken_
private

Definition at line 66 of file AlCaECALRecHitReducer.h.

std::vector< edm::EDGetTokenT<edm::View < reco::RecoCandidate> > > AlCaECALRecHitReducer::eleViewTokens_
private

Definition at line 67 of file AlCaECALRecHitReducer.h.

Referenced by AlCaECALRecHitReducer(), and produce().

edm::EDGetTokenT<EcalRecHitCollection> AlCaECALRecHitReducer::esRecHitsToken_
private

Definition at line 65 of file AlCaECALRecHitReducer.h.

int AlCaECALRecHitReducer::etaSize_
private

Definition at line 74 of file AlCaECALRecHitReducer.h.

Referenced by AddMiniRecHitCollection(), and AlCaECALRecHitReducer().

double AlCaECALRecHitReducer::minEta_highEtaSC_
private

Definition at line 83 of file AlCaECALRecHitReducer.h.

Referenced by AlCaECALRecHitReducer(), and produce().

int AlCaECALRecHitReducer::phiSize_
private

Definition at line 75 of file AlCaECALRecHitReducer.h.

Referenced by AddMiniRecHitCollection(), and AlCaECALRecHitReducer().

edm::EDGetTokenT<reco::PhotonCollection> AlCaECALRecHitReducer::photonToken_
private

Definition at line 69 of file AlCaECALRecHitReducer.h.

Referenced by AlCaECALRecHitReducer(), and produce().