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 Attributes
ReducedESRecHitCollectionProducer Class Reference

#include <ReducedESRecHitCollectionProducer.h>

Inheritance diagram for ReducedESRecHitCollectionProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginRun (edm::Run const &, const edm::EventSetup &) overridefinal
 
void collectIds (const ESDetId strip1, const ESDetId strip2, const int &row=0)
 
void produce (edm::Event &e, const edm::EventSetup &c)
 
 ReducedESRecHitCollectionProducer (const edm::ParameterSet &pset)
 
virtual ~ReducedESRecHitCollectionProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

std::set< DetIdcollectedIds_
 
const EcalPreshowerGeometrygeometry_p
 
edm::EDGetTokenT
< ESRecHitCollection
InputRecHitES_
 
edm::EDGetTokenT
< reco::SuperClusterCollection
InputSuperClusterEE_
 
std::vector< edm::EDGetTokenT
< DetIdCollection > > 
interestingDetIdCollections_
 
std::string OutputLabelES_
 
double scEtThresh_
 
CaloSubdetectorTopologytopology_p
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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

Definition at line 24 of file ReducedESRecHitCollectionProducer.h.

Constructor & Destructor Documentation

ReducedESRecHitCollectionProducer::ReducedESRecHitCollectionProducer ( const edm::ParameterSet pset)

Definition at line 20 of file ReducedESRecHitCollectionProducer.cc.

References edm::ParameterSet::getParameter(), InputRecHitES_, InputSuperClusterEE_, interestingDetIdCollections_, OutputLabelES_, scEtThresh_, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, and edm::vector_transform().

20  :
21  geometry_p(0),
22  topology_p(0)
23 {
24 
25  scEtThresh_ = ps.getParameter<double>("scEtThreshold");
26 
28  consumes<ESRecHitCollection>(ps.getParameter<edm::InputTag>("EcalRecHitCollectionES"));
30  consumes<reco::SuperClusterCollection>(ps.getParameter<edm::InputTag>("EndcapSuperClusterCollection"));
31 
32  OutputLabelES_ = ps.getParameter<std::string>("OutputLabel_ES");
33 
36  ps.getParameter<std::vector<edm::InputTag>>("interestingDetIds"),
37  [this](edm::InputTag const & tag) {
38  return consumes<DetIdCollection>(tag);
39  }
40  );
41 
42  produces< EcalRecHitCollection > (OutputLabelES_);
43 
44 }
std::vector< edm::EDGetTokenT< DetIdCollection > > interestingDetIdCollections_
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
edm::EDGetTokenT< ESRecHitCollection > InputRecHitES_
edm::EDGetTokenT< reco::SuperClusterCollection > InputSuperClusterEE_
ReducedESRecHitCollectionProducer::~ReducedESRecHitCollectionProducer ( )
virtual

Definition at line 46 of file ReducedESRecHitCollectionProducer.cc.

References topology_p.

46  {
47  if (topology_p) delete topology_p;
48 }

Member Function Documentation

void ReducedESRecHitCollectionProducer::beginRun ( edm::Run const &  ,
const edm::EventSetup iSetup 
)
finaloverridevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 50 of file ReducedESRecHitCollectionProducer.cc.

References DetId::Ecal, EcalPreshower, geometry, geometry_p, edm::EventSetup::get(), and topology_p.

50  {
51  ESHandle<CaloGeometry> geoHandle;
52  iSetup.get<CaloGeometryRecord>().get(geoHandle);
53  const CaloSubdetectorGeometry *geometry = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
54  geometry_p = dynamic_cast<const EcalPreshowerGeometry *>(geometry);
55  if (!geometry_p){
56  edm::LogError("WrongGeometry")<<
57  "could not cast the subdet geometry to preshower geometry";
58  }
59 
60  if (geometry) topology_p = new EcalPreshowerTopology(geoHandle);
61 
62 }
const T & get() const
Definition: EventSetup.h:55
ESHandle< TrackerGeometry > geometry
void ReducedESRecHitCollectionProducer::collectIds ( const ESDetId  strip1,
const ESDetId  strip2,
const int &  row = 0 
)

Definition at line 137 of file ReducedESRecHitCollectionProducer.cc.

References collectedIds_, CaloNavigator< T, TOPO >::east(), CaloNavigator< T, TOPO >::home(), i, GetRecoTauVFromDQM_MC_cff::next, CaloNavigator< T, TOPO >::north(), CaloNavigator< T, TOPO >::setHome(), CaloNavigator< T, TOPO >::south(), topology_p, and CaloNavigator< T, TOPO >::west().

Referenced by produce().

137  {
138 
139  //cout<<row<<endl;
140 
141  map<DetId,const EcalRecHit*>::iterator it;
142  map<DetId, int>::iterator itu;
143  ESDetId next;
144  ESDetId strip1;
145  ESDetId strip2;
146 
147  strip1 = esDetId1;
148  strip2 = esDetId2;
149 
150  EcalPreshowerNavigator theESNav1(strip1, topology_p);
151  theESNav1.setHome(strip1);
152 
153  EcalPreshowerNavigator theESNav2(strip2, topology_p);
154  theESNav2.setHome(strip2);
155 
156  if (row == 1) {
157  if (strip1 != ESDetId(0)) strip1 = theESNav1.north();
158  if (strip2 != ESDetId(0)) strip2 = theESNav2.east();
159  } else if (row == -1) {
160  if (strip1 != ESDetId(0)) strip1 = theESNav1.south();
161  if (strip2 != ESDetId(0)) strip2 = theESNav2.west();
162  }
163 
164  // Plane 1
165  if (strip1 == ESDetId(0)) {
166  } else {
167  collectedIds_.insert(strip1);
168  //cout<<"center : "<<strip1<<endl;
169  // east road
170  for (int i=0; i<15; ++i) {
171  next = theESNav1.east();
172  //cout<<"east : "<<i<<" "<<next<<endl;
173  if (next != ESDetId(0)) {
174  collectedIds_.insert(next);
175  } else {
176  break;
177  }
178  }
179 
180  // west road
181  theESNav1.setHome(strip1);
182  theESNav1.home();
183  for (int i=0; i<15; ++i) {
184  next = theESNav1.west();
185  //cout<<"west : "<<i<<" "<<next<<endl;
186  if (next != ESDetId(0)) {
187  collectedIds_.insert(next);
188  } else {
189  break;
190  }
191  }
192 
193  }
194 
195  if (strip2 == ESDetId(0)) {
196  } else {
197  collectedIds_.insert(strip2);
198  //cout<<"center : "<<strip2<<endl;
199  // north road
200  for (int i=0; i<15; ++i) {
201  next = theESNav2.north();
202  //cout<<"north : "<<i<<" "<<next<<endl;
203  if (next != ESDetId(0)) {
204  collectedIds_.insert(next);
205  } else {
206  break;
207  }
208  }
209 
210  // south road
211  theESNav2.setHome(strip2);
212  theESNav2.home();
213  for (int i=0; i<15; ++i) {
214  next = theESNav2.south();
215  //cout<<"south : "<<i<<" "<<next<<endl;
216  if (next != ESDetId(0)) {
217  collectedIds_.insert(next);
218  } else {
219  break;
220  }
221  }
222  }
223 }
int i
Definition: DBlmapReader.cc:9
void ReducedESRecHitCollectionProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Implements edm::stream::EDProducerBase.

Definition at line 64 of file ReducedESRecHitCollectionProducer.cc.

References collectedIds_, collectIds(), geometry_p, edm::Event::getByToken(), EcalPreshowerGeometry::getClosestCellInPlane(), InputRecHitES_, InputSuperClusterEE_, interestingDetIdCollections_, edm::HandleBase::isValid(), tablePrinter::labels, edm::EDConsumerBase::labelsForToken(), edm::EDConsumerBase::Labels::module, convertSQLitetoXML_cfg::output, OutputLabelES_, point, edm::EDConsumerBase::Labels::process, edm::Handle< T >::product(), edm::EDConsumerBase::Labels::productInstance, edm::Event::put(), scEtThresh_, and edmStreamStallGrapher::t.

64  {
65 
66 
68  e.getByToken(InputRecHitES_, ESRecHits_);
69 
70  std::auto_ptr<EcalRecHitCollection> output(new EcalRecHitCollection);
71 
72  edm::Handle<reco::SuperClusterCollection> pEndcapSuperClusters;
73  e.getByToken(InputSuperClusterEE_, pEndcapSuperClusters);
74  {
75  const reco::SuperClusterCollection* eeSuperClusters = pEndcapSuperClusters.product();
76 
77  for (reco::SuperClusterCollection::const_iterator isc = eeSuperClusters->begin(); isc != eeSuperClusters->end(); ++isc) {
78 
79  if (isc->energy() < scEtThresh_) continue;
80  if (fabs(isc->eta()) < 1.65 || fabs(isc->eta()) > 2.6) continue;
81  //cout<<"SC energy : "<<isc->energy()<<" "<<isc->eta()<<endl;
82 
83  //Int_t nBC = 0;
84  reco::CaloCluster_iterator ibc = isc->clustersBegin();
85  for ( ; ibc != isc->clustersEnd(); ++ibc ) {
86 
87  //cout<<"BC : "<<nBC<<endl;
88 
89  const GlobalPoint point((*ibc)->x(),(*ibc)->y(),(*ibc)->z());
90 
93 
94  collectIds(esId1, esId2, 0);
95  collectIds(esId1, esId2, 1);
96  collectIds(esId1, esId2, -1);
97 
98  //nBC++;
99  }
100 
101  }
102 
103  }
104 
105 
107  for( unsigned int t = 0; t < interestingDetIdCollections_.size(); ++t )
108  {
110  if(!detId.isValid())
111  {
112  Labels labels;
114  edm::LogError("MissingInput")<<"no reason to skip detid from : (" << labels.module << ", "
115  << labels.productInstance << ", "
116  << labels.process << ")" << std::endl;
117  continue;
118  }
119  collectedIds_.insert(detId->begin(),detId->end());
120  }
121 
122 
123  output->reserve( collectedIds_.size());
125  for (it = ESRecHits_->begin(); it != ESRecHits_->end(); ++it) {
126  if (it->recoFlag()==1 || it->recoFlag()==14 || (it->recoFlag()<=10 && it->recoFlag()>=5)) continue;
127  if (collectedIds_.find(it->id())!=collectedIds_.end()){
128  output->push_back(*it);
129  }
130  }
131  collectedIds_.clear();
132 
134 
135 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
std::vector< edm::EDGetTokenT< DetIdCollection > > interestingDetIdCollections_
std::vector< EcalRecHit >::const_iterator const_iterator
void collectIds(const ESDetId strip1, const ESDetId strip2, const int &row=0)
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
virtual DetId getClosestCellInPlane(const GlobalPoint &r, int plane) const
bool isValid() const
Definition: HandleBase.h:76
T const * product() const
Definition: Handle.h:81
edm::EDGetTokenT< ESRecHitCollection > InputRecHitES_
edm::EDGetTokenT< reco::SuperClusterCollection > InputSuperClusterEE_
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5

Member Data Documentation

std::set<DetId> ReducedESRecHitCollectionProducer::collectedIds_
private

Definition at line 46 of file ReducedESRecHitCollectionProducer.h.

Referenced by collectIds(), and produce().

const EcalPreshowerGeometry* ReducedESRecHitCollectionProducer::geometry_p
private

Definition at line 36 of file ReducedESRecHitCollectionProducer.h.

Referenced by beginRun(), and produce().

edm::EDGetTokenT<ESRecHitCollection> ReducedESRecHitCollectionProducer::InputRecHitES_
private
edm::EDGetTokenT<reco::SuperClusterCollection> ReducedESRecHitCollectionProducer::InputSuperClusterEE_
private
std::vector<edm::EDGetTokenT<DetIdCollection> > ReducedESRecHitCollectionProducer::interestingDetIdCollections_
private
std::string ReducedESRecHitCollectionProducer::OutputLabelES_
private
double ReducedESRecHitCollectionProducer::scEtThresh_
private
CaloSubdetectorTopology* ReducedESRecHitCollectionProducer::topology_p
private