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
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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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 Attributes

std::set< DetIdcollectedIds_
 
const EcalPreshowerGeometrygeometry_p
 
edm::EDGetTokenT
< ESRecHitCollection
InputRecHitES_
 
edm::EDGetTokenT
< reco::SuperClusterCollection
InputSuperClusterEE_
 
std::vector< edm::EDGetTokenT
< DetIdCollection > > 
interestingDetIdCollections_
 
std::vector< edm::EDGetTokenT
< DetIdCollection > > 
interestingDetIdCollectionsNotToClean_
 
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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::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  interestingDetIdCollectionsNotToClean_ = edm::vector_transform(ps.getParameter<std::vector<edm::InputTag>>("interestingDetIdsNotToClean"),
43  [this](edm::InputTag const & tag)
44  { return consumes<DetIdCollection>(tag); }
45  );
46 
47  produces< EcalRecHitCollection > (OutputLabelES_);
48 
49 }
std::vector< edm::EDGetTokenT< DetIdCollection > > interestingDetIdCollectionsNotToClean_
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 51 of file ReducedESRecHitCollectionProducer.cc.

References topology_p.

51  {
52  if (topology_p) delete topology_p;
53 }

Member Function Documentation

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

Reimplemented from edm::stream::EDProducerBase.

Definition at line 55 of file ReducedESRecHitCollectionProducer.cc.

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

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

Definition at line 169 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().

169  {
170 
171  //cout<<row<<endl;
172 
173  map<DetId,const EcalRecHit*>::iterator it;
174  map<DetId, int>::iterator itu;
175  ESDetId next;
176  ESDetId strip1;
177  ESDetId strip2;
178 
179  strip1 = esDetId1;
180  strip2 = esDetId2;
181 
182  EcalPreshowerNavigator theESNav1(strip1, topology_p);
183  theESNav1.setHome(strip1);
184 
185  EcalPreshowerNavigator theESNav2(strip2, topology_p);
186  theESNav2.setHome(strip2);
187 
188  if (row == 1) {
189  if (strip1 != ESDetId(0)) strip1 = theESNav1.north();
190  if (strip2 != ESDetId(0)) strip2 = theESNav2.east();
191  } else if (row == -1) {
192  if (strip1 != ESDetId(0)) strip1 = theESNav1.south();
193  if (strip2 != ESDetId(0)) strip2 = theESNav2.west();
194  }
195 
196  // Plane 1
197  if (strip1 == ESDetId(0)) {
198  } else {
199  collectedIds_.insert(strip1);
200  //cout<<"center : "<<strip1<<endl;
201  // east road
202  for (int i=0; i<15; ++i) {
203  next = theESNav1.east();
204  //cout<<"east : "<<i<<" "<<next<<endl;
205  if (next != ESDetId(0)) {
206  collectedIds_.insert(next);
207  } else {
208  break;
209  }
210  }
211 
212  // west road
213  theESNav1.setHome(strip1);
214  theESNav1.home();
215  for (int i=0; i<15; ++i) {
216  next = theESNav1.west();
217  //cout<<"west : "<<i<<" "<<next<<endl;
218  if (next != ESDetId(0)) {
219  collectedIds_.insert(next);
220  } else {
221  break;
222  }
223  }
224 
225  }
226 
227  if (strip2 == ESDetId(0)) {
228  } else {
229  collectedIds_.insert(strip2);
230  //cout<<"center : "<<strip2<<endl;
231  // north road
232  for (int i=0; i<15; ++i) {
233  next = theESNav2.north();
234  //cout<<"north : "<<i<<" "<<next<<endl;
235  if (next != ESDetId(0)) {
236  collectedIds_.insert(next);
237  } else {
238  break;
239  }
240  }
241 
242  // south road
243  theESNav2.setHome(strip2);
244  theESNav2.home();
245  for (int i=0; i<15; ++i) {
246  next = theESNav2.south();
247  //cout<<"south : "<<i<<" "<<next<<endl;
248  if (next != ESDetId(0)) {
249  collectedIds_.insert(next);
250  } else {
251  break;
252  }
253  }
254  }
255 }
int i
Definition: DBlmapReader.cc:9
void ReducedESRecHitCollectionProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Implements edm::stream::EDProducerBase.

Definition at line 69 of file ReducedESRecHitCollectionProducer.cc.

References collectedIds_, collectIds(), geometry_p, edm::Event::getByToken(), EcalPreshowerGeometry::getClosestCellInPlane(), hit::id, InputRecHitES_, InputSuperClusterEE_, interestingDetIdCollections_, interestingDetIdCollectionsNotToClean_, edm::HandleBase::isValid(), HLT_25ns10e33_v2_cff::labels, edm::EDConsumerBase::labelsForToken(), edm::ProductLabels::module, convertSQLitetoXML_cfg::output, OutputLabelES_, point, edm::ProductLabels::process, edm::Handle< T >::product(), edm::ProductLabels::productInstance, edm::Event::put(), scEtThresh_, lumiQTWidget::t, and unpackBuffers-CaloStage2::token.

69  {
70 
71 
73  e.getByToken(InputRecHitES_, ESRecHits_);
74 
75  std::auto_ptr<EcalRecHitCollection> output(new EcalRecHitCollection);
76 
77  edm::Handle<reco::SuperClusterCollection> pEndcapSuperClusters;
78  e.getByToken(InputSuperClusterEE_, pEndcapSuperClusters);
79  {
80  const reco::SuperClusterCollection* eeSuperClusters = pEndcapSuperClusters.product();
81 
82  for (reco::SuperClusterCollection::const_iterator isc = eeSuperClusters->begin(); isc != eeSuperClusters->end(); ++isc) {
83 
84  if (isc->energy() < scEtThresh_) continue;
85  if (fabs(isc->eta()) < 1.65 || fabs(isc->eta()) > 2.6) continue;
86  //cout<<"SC energy : "<<isc->energy()<<" "<<isc->eta()<<endl;
87 
88  //Int_t nBC = 0;
89  reco::CaloCluster_iterator ibc = isc->clustersBegin();
90  for ( ; ibc != isc->clustersEnd(); ++ibc ) {
91 
92  //cout<<"BC : "<<nBC<<endl;
93 
94  const GlobalPoint point((*ibc)->x(),(*ibc)->y(),(*ibc)->z());
95 
98 
99  collectIds(esId1, esId2, 0);
100  collectIds(esId1, esId2, 1);
101  collectIds(esId1, esId2, -1);
102 
103  //nBC++;
104  }
105 
106  }
107 
108  }
109 
110 
112  for( unsigned int t = 0; t < interestingDetIdCollections_.size(); ++t )
113  {
115  if(!detId.isValid())
116  {
117  Labels labels;
119  edm::LogError("MissingInput")<<"no reason to skip detid from : (" << labels.module << ", "
120  << labels.productInstance << ", "
121  << labels.process << ")" << std::endl;
122  continue;
123  }
124  collectedIds_.insert(detId->begin(),detId->end());
125  }
126 
127 
128  //screw it, cant think of a better solution, not the best but lets run over all the rec hits, remove the ones failing cleaning
129  //and then merge in the collection not to be cleaned
130  //mainly as I suspect its more efficient to find an object in the DetIdSet rather than the rec-hit in the rec-hit collecition
131  //with only a det id
132  //if its a CPU issues then revisit
133  for(const auto& hit : *ESRecHits_) {
134  if(hit.recoFlag()==1 || hit.recoFlag()==14 || (hit.recoFlag()<=10 && hit.recoFlag()>=5)){ //right we might need to erase it from the collection
135  auto idIt = collectedIds_.find(hit.id());
136  if(idIt!=collectedIds_.end()) collectedIds_.erase(idIt);
137  }
138  }
139 
140 
141  for(const auto& token : interestingDetIdCollectionsNotToClean_) {
142  e.getByToken(token,detId);
143  if(!detId.isValid()){ //meh might as well keep the warning
144  Labels labels;
145  labelsForToken(token, labels);
146  edm::LogError("MissingInput")<<"no reason to skip detid from : (" << labels.module << ", "
147  << labels.productInstance << ", "
148  << labels.process << ")" << std::endl;
149  continue;
150  }
151  collectedIds_.insert(detId->begin(),detId->end());
152  }
153 
154 
155  output->reserve( collectedIds_.size());
157  for (it = ESRecHits_->begin(); it != ESRecHits_->end(); ++it) {
158  if (collectedIds_.find(it->id())!=collectedIds_.end()){
159  output->push_back(*it);
160  }
161  }
162  collectedIds_.clear();
163 
165 
166 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
std::vector< edm::EDGetTokenT< DetIdCollection > > interestingDetIdCollectionsNotToClean_
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:121
virtual DetId getClosestCellInPlane(const GlobalPoint &r, int plane) const
bool isValid() const
Definition: HandleBase.h:75
unsigned int id
ProductLabels Labels
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 47 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::vector<edm::EDGetTokenT<DetIdCollection> > ReducedESRecHitCollectionProducer::interestingDetIdCollectionsNotToClean_
private

Definition at line 45 of file ReducedESRecHitCollectionProducer.h.

Referenced by produce().

std::string ReducedESRecHitCollectionProducer::OutputLabelES_
private
double ReducedESRecHitCollectionProducer::scEtThresh_
private
CaloSubdetectorTopology* ReducedESRecHitCollectionProducer::topology_p
private