CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
ReducedESRecHitCollectionProducer Class Reference

#include <ReducedESRecHitCollectionProducer.h>

Inheritance diagram for ReducedESRecHitCollectionProducer:
edm::stream::EDProducer<>

Public Member Functions

void beginRun (edm::Run const &, const edm::EventSetup &) final
 
void collectIds (const ESDetId strip1, const ESDetId strip2, const int &row=0)
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 
 ReducedESRecHitCollectionProducer (const edm::ParameterSet &pset)
 
 ~ReducedESRecHitCollectionProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

edm::ESGetToken< CaloGeometry, CaloGeometryRecordcaloGeometryToken_
 
std::set< DetIdcollectedIds_
 
const EcalPreshowerGeometrygeometry_p
 
edm::EDGetTokenT< ESRecHitCollectionInputRecHitES_
 
edm::EDGetTokenT< reco::SuperClusterCollectionInputSuperClusterEE_
 
std::vector< edm::EDGetTokenT< DetIdCollection > > interestingDetIdCollections_
 
std::vector< edm::EDGetTokenT< DetIdCollection > > interestingDetIdCollectionsNotToClean_
 
std::string OutputLabelES_
 
double scEtThresh_
 
std::unique_ptr< 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, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 25 of file ReducedESRecHitCollectionProducer.h.

Constructor & Destructor Documentation

◆ ReducedESRecHitCollectionProducer()

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

Definition at line 20 of file ReducedESRecHitCollectionProducer.cc.

21  : geometry_p(nullptr) {
22  scEtThresh_ = ps.getParameter<double>("scEtThreshold");
23 
24  InputRecHitES_ = consumes<ESRecHitCollection>(ps.getParameter<edm::InputTag>("EcalRecHitCollectionES"));
26  consumes<reco::SuperClusterCollection>(ps.getParameter<edm::InputTag>("EndcapSuperClusterCollection"));
27  caloGeometryToken_ = esConsumes<CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun>();
28 
29  OutputLabelES_ = ps.getParameter<std::string>("OutputLabel_ES");
30 
32  edm::vector_transform(ps.getParameter<std::vector<edm::InputTag>>("interestingDetIds"),
33  [this](edm::InputTag const& tag) { return consumes<DetIdCollection>(tag); });
34 
36  edm::vector_transform(ps.getParameter<std::vector<edm::InputTag>>("interestingDetIdsNotToClean"),
37  [this](edm::InputTag const& tag) { return consumes<DetIdCollection>(tag); });
38 
39  produces<EcalRecHitCollection>(OutputLabelES_);
40 }

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

◆ ~ReducedESRecHitCollectionProducer()

ReducedESRecHitCollectionProducer::~ReducedESRecHitCollectionProducer ( )
overridedefault

Member Function Documentation

◆ beginRun()

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

Definition at line 44 of file ReducedESRecHitCollectionProducer.cc.

44  {
46  geometry_p =
47  dynamic_cast<const EcalPreshowerGeometry*>(geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower));
48  if (!geometry_p) {
49  edm::LogError("WrongGeometry") << "could not cast the subdet geometry to preshower geometry";
50  }
51 
52  if (geometry_p)
53  topology_p = std::make_unique<EcalPreshowerTopology>();
54 }

References caloGeometryToken_, DetId::Ecal, EcalPreshower, geometry_p, edm::EventSetup::getHandle(), CaloGeometry::getSubdetectorGeometry(), and topology_p.

◆ collectIds()

void ReducedESRecHitCollectionProducer::collectIds ( const ESDetId  strip1,
const ESDetId  strip2,
const int &  row = 0 
)

Definition at line 145 of file ReducedESRecHitCollectionProducer.cc.

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

References collectedIds_, mps_fire::i, GetRecoTauVFromDQM_MC_cff::next, CaloNavigator< T, TOPO >::setHome(), and topology_p.

Referenced by produce().

◆ produce()

void ReducedESRecHitCollectionProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
override

Definition at line 56 of file ReducedESRecHitCollectionProducer.cc.

56  {
58  e.getByToken(InputRecHitES_, ESRecHits_);
59 
60  auto output = std::make_unique<EcalRecHitCollection>();
61 
62  edm::Handle<reco::SuperClusterCollection> pEndcapSuperClusters;
63  e.getByToken(InputSuperClusterEE_, pEndcapSuperClusters);
64  {
65  const reco::SuperClusterCollection* eeSuperClusters = pEndcapSuperClusters.product();
66 
67  for (reco::SuperClusterCollection::const_iterator isc = eeSuperClusters->begin(); isc != eeSuperClusters->end();
68  ++isc) {
69  if (isc->energy() < scEtThresh_)
70  continue;
71  if (fabs(isc->eta()) < 1.65 || fabs(isc->eta()) > 2.6)
72  continue;
73  //cout<<"SC energy : "<<isc->energy()<<" "<<isc->eta()<<endl;
74 
75  //Int_t nBC = 0;
76  reco::CaloCluster_iterator ibc = isc->clustersBegin();
77  for (; ibc != isc->clustersEnd(); ++ibc) {
78  //cout<<"BC : "<<nBC<<endl;
79 
80  const GlobalPoint point((*ibc)->x(), (*ibc)->y(), (*ibc)->z());
81 
84 
85  collectIds(esId1, esId2, 0);
86  collectIds(esId1, esId2, 1);
87  collectIds(esId1, esId2, -1);
88 
89  //nBC++;
90  }
91  }
92  }
93 
95  for (unsigned int t = 0; t < interestingDetIdCollections_.size(); ++t) {
96  e.getByToken(interestingDetIdCollections_[t], detId);
97  if (!detId.isValid()) {
98  Labels labels;
99  labelsForToken(interestingDetIdCollections_[t], labels);
100  edm::LogError("MissingInput") << "no reason to skip detid from : (" << labels.module << ", "
101  << labels.productInstance << ", " << labels.process << ")" << std::endl;
102  continue;
103  }
104  collectedIds_.insert(detId->begin(), detId->end());
105  }
106 
107  //screw it, cant think of a better solution, not the best but lets run over all the rec hits, remove the ones failing cleaning
108  //and then merge in the collection not to be cleaned
109  //mainly as I suspect its more efficient to find an object in the DetIdSet rather than the rec-hit in the rec-hit collecition
110  //with only a det id
111  //if its a CPU issues then revisit
112  for (const auto& hit : *ESRecHits_) {
113  if (hit.recoFlag() == 1 || hit.recoFlag() == 14 ||
114  (hit.recoFlag() <= 10 && hit.recoFlag() >= 5)) { //right we might need to erase it from the collection
115  auto idIt = collectedIds_.find(hit.id());
116  if (idIt != collectedIds_.end())
117  collectedIds_.erase(idIt);
118  }
119  }
120 
121  for (const auto& token : interestingDetIdCollectionsNotToClean_) {
122  e.getByToken(token, detId);
123  if (!detId.isValid()) { //meh might as well keep the warning
124  Labels labels;
125  labelsForToken(token, labels);
126  edm::LogError("MissingInput") << "no reason to skip detid from : (" << labels.module << ", "
127  << labels.productInstance << ", " << labels.process << ")" << std::endl;
128  continue;
129  }
130  collectedIds_.insert(detId->begin(), detId->end());
131  }
132 
133  output->reserve(collectedIds_.size());
135  for (it = ESRecHits_->begin(); it != ESRecHits_->end(); ++it) {
136  if (collectedIds_.find(it->id()) != collectedIds_.end()) {
137  output->push_back(*it);
138  }
139  }
140  collectedIds_.clear();
141 
143 }

References edm::EDCollection< T >::begin(), collectedIds_, collectIds(), MillePedeFileConverter_cfg::e, edm::EDCollection< T >::end(), geometry_p, EcalPreshowerGeometry::getClosestCellInPlane(), hit::id, InputRecHitES_, InputSuperClusterEE_, interestingDetIdCollections_, interestingDetIdCollectionsNotToClean_, edm::HandleBase::isValid(), SummaryClient_cfi::labels, eostools::move(), convertSQLitetoXML_cfg::output, OutputLabelES_, point, edm::Handle< T >::product(), scEtThresh_, submitPVValidationJobs::t, and unpackBuffers-CaloStage2::token.

Member Data Documentation

◆ caloGeometryToken_

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> ReducedESRecHitCollectionProducer::caloGeometryToken_
private

◆ collectedIds_

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

Definition at line 47 of file ReducedESRecHitCollectionProducer.h.

Referenced by collectIds(), and produce().

◆ geometry_p

const EcalPreshowerGeometry* ReducedESRecHitCollectionProducer::geometry_p
private

Definition at line 34 of file ReducedESRecHitCollectionProducer.h.

Referenced by beginRun(), and produce().

◆ InputRecHitES_

edm::EDGetTokenT<ESRecHitCollection> ReducedESRecHitCollectionProducer::InputRecHitES_
private

◆ InputSuperClusterEE_

edm::EDGetTokenT<reco::SuperClusterCollection> ReducedESRecHitCollectionProducer::InputSuperClusterEE_
private

◆ interestingDetIdCollections_

std::vector<edm::EDGetTokenT<DetIdCollection> > ReducedESRecHitCollectionProducer::interestingDetIdCollections_
private

◆ interestingDetIdCollectionsNotToClean_

std::vector<edm::EDGetTokenT<DetIdCollection> > ReducedESRecHitCollectionProducer::interestingDetIdCollectionsNotToClean_
private

◆ OutputLabelES_

std::string ReducedESRecHitCollectionProducer::OutputLabelES_
private

◆ scEtThresh_

double ReducedESRecHitCollectionProducer::scEtThresh_
private

◆ topology_p

std::unique_ptr<CaloSubdetectorTopology> ReducedESRecHitCollectionProducer::topology_p
private

Definition at line 35 of file ReducedESRecHitCollectionProducer.h.

Referenced by beginRun(), and collectIds().

ReducedESRecHitCollectionProducer::InputRecHitES_
edm::EDGetTokenT< ESRecHitCollection > InputRecHitES_
Definition: ReducedESRecHitCollectionProducer.h:39
SummaryClient_cfi.labels
labels
Definition: SummaryClient_cfi.py:61
edm::EDCollection::begin
const_iterator begin() const
Definition: EDCollection.h:117
mps_fire.i
i
Definition: mps_fire.py:428
edm::SortedCollection< EcalRecHit >::const_iterator
std::vector< EcalRecHit >::const_iterator const_iterator
Definition: SortedCollection.h:80
hit::id
unsigned int id
Definition: SiStripHitEffFromCalibTree.cc:92
edm::Handle::product
T const * product() const
Definition: Handle.h:70
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
CaloGeometry::getSubdetectorGeometry
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
edm::PtrVectorItr
Definition: PtrVector.h:51
ESDetId
Definition: ESDetId.h:15
ReducedESRecHitCollectionProducer::caloGeometryToken_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
Definition: ReducedESRecHitCollectionProducer.h:41
edm::Handle
Definition: AssociativeIterator.h:50
reco::SuperClusterCollection
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
Definition: SuperClusterFwd.h:9
ReducedESRecHitCollectionProducer::collectIds
void collectIds(const ESDetId strip1, const ESDetId strip2, const int &row=0)
Definition: ReducedESRecHitCollectionProducer.cc:145
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
edm::ESHandle< CaloGeometry >
ReducedESRecHitCollectionProducer::InputSuperClusterEE_
edm::EDGetTokenT< reco::SuperClusterCollection > InputSuperClusterEE_
Definition: ReducedESRecHitCollectionProducer.h:40
CaloNavigator::setHome
void setHome(const T &startingPoint)
set the starting position
Definition: CaloNavigator.h:90
ReducedESRecHitCollectionProducer::topology_p
std::unique_ptr< CaloSubdetectorTopology > topology_p
Definition: ReducedESRecHitCollectionProducer.h:35
Point3DBase< float, GlobalTag >
ReducedESRecHitCollectionProducer::scEtThresh_
double scEtThresh_
Definition: ReducedESRecHitCollectionProducer.h:37
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::vector_transform
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
EcalPreshowerGeometry::getClosestCellInPlane
virtual DetId getClosestCellInPlane(const GlobalPoint &r, int plane) const
Definition: EcalPreshowerGeometry.cc:139
ReducedESRecHitCollectionProducer::geometry_p
const EcalPreshowerGeometry * geometry_p
Definition: ReducedESRecHitCollectionProducer.h:34
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
DetId::Ecal
Definition: DetId.h:27
ReducedESRecHitCollectionProducer::interestingDetIdCollectionsNotToClean_
std::vector< edm::EDGetTokenT< DetIdCollection > > interestingDetIdCollectionsNotToClean_
Definition: ReducedESRecHitCollectionProducer.h:45
ReducedESRecHitCollectionProducer::interestingDetIdCollections_
std::vector< edm::EDGetTokenT< DetIdCollection > > interestingDetIdCollections_
Definition: ReducedESRecHitCollectionProducer.h:43
ReducedESRecHitCollectionProducer::collectedIds_
std::set< DetId > collectedIds_
Definition: ReducedESRecHitCollectionProducer.h:47
ReducedESRecHitCollectionProducer::OutputLabelES_
std::string OutputLabelES_
Definition: ReducedESRecHitCollectionProducer.h:42
EcalPreshower
Definition: EcalSubdetector.h:10
CaloNavigator
Definition: CaloNavigator.h:7
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
point
*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
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
edm::InputTag
Definition: InputTag.h:15
edm::EDCollection::end
const_iterator end() const
Definition: EDCollection.h:122
hit
Definition: SiStripHitEffFromCalibTree.cc:88
GetRecoTauVFromDQM_MC_cff.next
next
Definition: GetRecoTauVFromDQM_MC_cff.py:31
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:318