CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
ReducedESRecHitCollectionProducer Class Reference
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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 31 of file ReducedESRecHitCollectionProducer.cc.

Constructor & Destructor Documentation

◆ ReducedESRecHitCollectionProducer()

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

Definition at line 63 of file ReducedESRecHitCollectionProducer.cc.

64  : geometry_p(nullptr) {
65  scEtThresh_ = ps.getParameter<double>("scEtThreshold");
66 
67  InputRecHitES_ = consumes<ESRecHitCollection>(ps.getParameter<edm::InputTag>("EcalRecHitCollectionES"));
69  consumes<reco::SuperClusterCollection>(ps.getParameter<edm::InputTag>("EndcapSuperClusterCollection"));
70  caloGeometryToken_ = esConsumes<CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun>();
71 
72  OutputLabelES_ = ps.getParameter<std::string>("OutputLabel_ES");
73 
75  edm::vector_transform(ps.getParameter<std::vector<edm::InputTag>>("interestingDetIds"),
76  [this](edm::InputTag const& tag) { return consumes<DetIdCollection>(tag); });
77 
79  edm::vector_transform(ps.getParameter<std::vector<edm::InputTag>>("interestingDetIdsNotToClean"),
80  [this](edm::InputTag const& tag) { return consumes<DetIdCollection>(tag); });
81 
82  produces<EcalRecHitCollection>(OutputLabelES_);
83 }

References caloGeometryToken_, edm::ParameterSet::getParameter(), InputRecHitES_, InputSuperClusterEE_, interestingDetIdCollections_, interestingDetIdCollectionsNotToClean_, OutputLabelES_, scEtThresh_, AlCaHLTBitMon_QueryRunRegistry::string, makeGlobalPositionRcd_cfg::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 87 of file ReducedESRecHitCollectionProducer.cc.

87  {
89  geometry_p =
90  dynamic_cast<const EcalPreshowerGeometry*>(geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower));
91  if (!geometry_p) {
92  edm::LogError("WrongGeometry") << "could not cast the subdet geometry to preshower geometry";
93  }
94 
95  if (geometry_p)
96  topology_p = std::make_unique<EcalPreshowerTopology>();
97 }

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 188 of file ReducedESRecHitCollectionProducer.cc.

188  {
189  //cout<<row<<endl;
190 
191  map<DetId, const EcalRecHit*>::iterator it;
192  map<DetId, int>::iterator itu;
193  ESDetId next;
194  ESDetId strip1;
195  ESDetId strip2;
196 
197  strip1 = esDetId1;
198  strip2 = esDetId2;
199 
200  EcalPreshowerNavigator theESNav1(strip1, topology_p.get());
201  theESNav1.setHome(strip1);
202 
203  EcalPreshowerNavigator theESNav2(strip2, topology_p.get());
204  theESNav2.setHome(strip2);
205 
206  if (row == 1) {
207  if (strip1 != ESDetId(0))
208  strip1 = theESNav1.north();
209  if (strip2 != ESDetId(0))
210  strip2 = theESNav2.east();
211  } else if (row == -1) {
212  if (strip1 != ESDetId(0))
213  strip1 = theESNav1.south();
214  if (strip2 != ESDetId(0))
215  strip2 = theESNav2.west();
216  }
217 
218  // Plane 1
219  if (strip1 == ESDetId(0)) {
220  } else {
221  collectedIds_.insert(strip1);
222  //cout<<"center : "<<strip1<<endl;
223  // east road
224  for (int i = 0; i < 15; ++i) {
225  next = theESNav1.east();
226  //cout<<"east : "<<i<<" "<<next<<endl;
227  if (next != ESDetId(0)) {
228  collectedIds_.insert(next);
229  } else {
230  break;
231  }
232  }
233 
234  // west road
235  theESNav1.setHome(strip1);
236  theESNav1.home();
237  for (int i = 0; i < 15; ++i) {
238  next = theESNav1.west();
239  //cout<<"west : "<<i<<" "<<next<<endl;
240  if (next != ESDetId(0)) {
241  collectedIds_.insert(next);
242  } else {
243  break;
244  }
245  }
246  }
247 
248  if (strip2 == ESDetId(0)) {
249  } else {
250  collectedIds_.insert(strip2);
251  //cout<<"center : "<<strip2<<endl;
252  // north road
253  for (int i = 0; i < 15; ++i) {
254  next = theESNav2.north();
255  //cout<<"north : "<<i<<" "<<next<<endl;
256  if (next != ESDetId(0)) {
257  collectedIds_.insert(next);
258  } else {
259  break;
260  }
261  }
262 
263  // south road
264  theESNav2.setHome(strip2);
265  theESNav2.home();
266  for (int i = 0; i < 15; ++i) {
267  next = theESNav2.south();
268  //cout<<"south : "<<i<<" "<<next<<endl;
269  if (next != ESDetId(0)) {
270  collectedIds_.insert(next);
271  } else {
272  break;
273  }
274  }
275  }
276 }

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 99 of file ReducedESRecHitCollectionProducer.cc.

99  {
101  e.getByToken(InputRecHitES_, ESRecHits_);
102 
103  auto output = std::make_unique<EcalRecHitCollection>();
104 
105  edm::Handle<reco::SuperClusterCollection> pEndcapSuperClusters;
106  e.getByToken(InputSuperClusterEE_, pEndcapSuperClusters);
107  {
108  const reco::SuperClusterCollection* eeSuperClusters = pEndcapSuperClusters.product();
109 
110  for (reco::SuperClusterCollection::const_iterator isc = eeSuperClusters->begin(); isc != eeSuperClusters->end();
111  ++isc) {
112  if (isc->energy() < scEtThresh_)
113  continue;
114  if (fabs(isc->eta()) < 1.65 || fabs(isc->eta()) > 2.6)
115  continue;
116  //cout<<"SC energy : "<<isc->energy()<<" "<<isc->eta()<<endl;
117 
118  //Int_t nBC = 0;
119  reco::CaloCluster_iterator ibc = isc->clustersBegin();
120  for (; ibc != isc->clustersEnd(); ++ibc) {
121  //cout<<"BC : "<<nBC<<endl;
122 
123  const GlobalPoint point((*ibc)->x(), (*ibc)->y(), (*ibc)->z());
124 
127 
128  collectIds(esId1, esId2, 0);
129  collectIds(esId1, esId2, 1);
130  collectIds(esId1, esId2, -1);
131 
132  //nBC++;
133  }
134  }
135  }
136 
138  for (unsigned int t = 0; t < interestingDetIdCollections_.size(); ++t) {
139  e.getByToken(interestingDetIdCollections_[t], detId);
140  if (!detId.isValid()) {
141  Labels labels;
142  labelsForToken(interestingDetIdCollections_[t], labels);
143  edm::LogError("MissingInput") << "no reason to skip detid from : (" << labels.module << ", "
144  << labels.productInstance << ", " << labels.process << ")" << std::endl;
145  continue;
146  }
147  collectedIds_.insert(detId->begin(), detId->end());
148  }
149 
150  //screw it, cant think of a better solution, not the best but lets run over all the rec hits, remove the ones failing cleaning
151  //and then merge in the collection not to be cleaned
152  //mainly as I suspect its more efficient to find an object in the DetIdSet rather than the rec-hit in the rec-hit collecition
153  //with only a det id
154  //if its a CPU issues then revisit
155  for (const auto& hit : *ESRecHits_) {
156  if (hit.recoFlag() == 1 || hit.recoFlag() == 14 ||
157  (hit.recoFlag() <= 10 && hit.recoFlag() >= 5)) { //right we might need to erase it from the collection
158  auto idIt = collectedIds_.find(hit.id());
159  if (idIt != collectedIds_.end())
160  collectedIds_.erase(idIt);
161  }
162  }
163 
164  for (const auto& token : interestingDetIdCollectionsNotToClean_) {
165  e.getByToken(token, detId);
166  if (!detId.isValid()) { //meh might as well keep the warning
167  Labels labels;
168  labelsForToken(token, labels);
169  edm::LogError("MissingInput") << "no reason to skip detid from : (" << labels.module << ", "
170  << labels.productInstance << ", " << labels.process << ")" << std::endl;
171  continue;
172  }
173  collectedIds_.insert(detId->begin(), detId->end());
174  }
175 
176  output->reserve(collectedIds_.size());
178  for (it = ESRecHits_->begin(); it != ESRecHits_->end(); ++it) {
179  if (collectedIds_.find(it->id()) != collectedIds_.end()) {
180  output->push_back(*it);
181  }
182  }
183  collectedIds_.clear();
184 
186 }

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 53 of file ReducedESRecHitCollectionProducer.cc.

Referenced by collectIds(), and produce().

◆ geometry_p

const EcalPreshowerGeometry* ReducedESRecHitCollectionProducer::geometry_p
private

Definition at line 40 of file ReducedESRecHitCollectionProducer.cc.

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 41 of file ReducedESRecHitCollectionProducer.cc.

Referenced by beginRun(), and collectIds().

ReducedESRecHitCollectionProducer::InputRecHitES_
edm::EDGetTokenT< ESRecHitCollection > InputRecHitES_
Definition: ReducedESRecHitCollectionProducer.cc:45
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.cc:47
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:188
edm::ESHandle< CaloGeometry >
ReducedESRecHitCollectionProducer::InputSuperClusterEE_
edm::EDGetTokenT< reco::SuperClusterCollection > InputSuperClusterEE_
Definition: ReducedESRecHitCollectionProducer.cc:46
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.cc:41
Point3DBase< float, GlobalTag >
ReducedESRecHitCollectionProducer::scEtThresh_
double scEtThresh_
Definition: ReducedESRecHitCollectionProducer.cc:43
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
makeGlobalPositionRcd_cfg.tag
tag
Definition: makeGlobalPositionRcd_cfg.py:6
ReducedESRecHitCollectionProducer::geometry_p
const EcalPreshowerGeometry * geometry_p
Definition: ReducedESRecHitCollectionProducer.cc:40
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
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.cc:51
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ReducedESRecHitCollectionProducer::interestingDetIdCollections_
std::vector< edm::EDGetTokenT< DetIdCollection > > interestingDetIdCollections_
Definition: ReducedESRecHitCollectionProducer.cc:49
ReducedESRecHitCollectionProducer::collectedIds_
std::set< DetId > collectedIds_
Definition: ReducedESRecHitCollectionProducer.cc:53
ReducedESRecHitCollectionProducer::OutputLabelES_
std::string OutputLabelES_
Definition: ReducedESRecHitCollectionProducer.cc:48
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:316