CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType > Class Template Reference
Inheritance diagram for HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >:
edm::stream::EDProducer<>

Public Member Functions

 HLTCaloObjInRegionsProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~HLTCaloObjInRegionsProducer () 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
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

EtaPhiRegionDataBasecreateEtaPhiRegionData (const std::string &, const edm::ParameterSet &, edm::ConsumesCollector &&)
 

Static Private Member Functions

static std::unique_ptr< CaloObjCollType > makeFilteredColl (const edm::Handle< CaloObjCollType > &inputColl, CaloGeometry const &caloGeomHandle, const std::vector< EtaPhiRegion > &regions)
 
static bool validIDForGeom (const DetId &id)
 

Private Attributes

const edm::ESGetToken< CaloGeometry, CaloGeometryRecordcaloGeometryToken_
 
std::vector< std::unique_ptr< EtaPhiRegionDataBase > > etaPhiRegionData_
 
std::vector< edm::InputTaginputCollTags_
 
std::vector< edm::EDGetTokenT< CaloObjCollType > > inputTokens_
 
std::vector< std::string > outputProductNames_
 

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

template<typename CaloObjType, typename CaloObjCollType = edm::SortedCollection<CaloObjType>>
class HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >

Definition at line 95 of file HLTCaloObjInRegionsProducer.cc.

Constructor & Destructor Documentation

◆ HLTCaloObjInRegionsProducer()

template<typename CaloObjType , typename CaloObjCollType >
HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::HLTCaloObjInRegionsProducer ( const edm::ParameterSet ps)

Definition at line 119 of file HLTCaloObjInRegionsProducer.cc.

121  : caloGeometryToken_{esConsumes()} {
122  const std::vector<edm::ParameterSet> etaPhiRegions =
123  para.getParameter<std::vector<edm::ParameterSet>>("etaPhiRegions");
124  for (auto& pset : etaPhiRegions) {
125  const std::string type = pset.getParameter<std::string>("type");
127  type,
128  pset,
129  consumesCollector())); //meh I was going to use a factory but it was going to be overly complex for my needs
130  }
131 
132  outputProductNames_ = para.getParameter<std::vector<std::string>>("outputProductNames");
133  inputCollTags_ = para.getParameter<std::vector<edm::InputTag>>("inputCollTags");
134  if (outputProductNames_.size() != inputCollTags_.size()) {
135  throw cms::Exception("InvalidConfiguration")
136  << " error outputProductNames and inputCollTags must be the same size, they are " << outputProductNames_.size()
137  << " vs " << inputCollTags_.size();
138  }
139  for (unsigned int collNr = 0; collNr < inputCollTags_.size(); collNr++) {
140  inputTokens_.push_back(consumes<CaloObjCollType>(inputCollTags_[collNr]));
141  produces<CaloObjCollType>(outputProductNames_[collNr]);
142  }

◆ ~HLTCaloObjInRegionsProducer()

template<typename CaloObjType , typename CaloObjCollType = edm::SortedCollection<CaloObjType>>
HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::~HLTCaloObjInRegionsProducer ( )
inlineoverride

Definition at line 98 of file HLTCaloObjInRegionsProducer.cc.

99 {}

Member Function Documentation

◆ createEtaPhiRegionData()

template<typename CaloObjType , typename CaloObjCollType >
EtaPhiRegionDataBase * HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::createEtaPhiRegionData ( const std::string &  type,
const edm::ParameterSet para,
edm::ConsumesCollector &&  consumesColl 
)
private

Definition at line 263 of file HLTCaloObjInRegionsProducer.cc.

265  {
266  if (type == "L1EGamma") {
267  return new EtaPhiRegionData<l1t::EGammaBxCollection>(para, consumesColl);
268  } else if (type == "L1Jet") {
269  return new EtaPhiRegionData<l1t::JetBxCollection>(para, consumesColl);
270  } else if (type == "L1Muon") {
271  return new EtaPhiRegionData<l1t::MuonBxCollection>(para, consumesColl);
272  } else if (type == "L1Tau") {
273  return new EtaPhiRegionData<l1t::TauBxCollection>(para, consumesColl);
274  } else if (type == "RecoEcalCandidate") {
275  return new EtaPhiRegionData<reco::RecoEcalCandidateCollection>(para, consumesColl);
276  } else if (type == "RecoChargedCandidate") {
277  return new EtaPhiRegionData<reco::RecoChargedCandidateCollection>(para, consumesColl);
278  } else if (type == "Electron") {
279  return new EtaPhiRegionData<reco::Electron>(para, consumesColl);
280  } else {
281  //this is a major issue and could lead to rather subtle efficiency losses, so if its incorrectly configured, we're aborting the job!
282  throw cms::Exception("InvalidConfig")
283  << " type " << type
284  << " is not recognised, this means the rec-hit you think you are keeping may not be and you should fix this "
285  "error as it can lead to hard to find efficiency loses"
286  << std::endl;
287  }

References Exception.

◆ fillDescriptions()

template<typename CaloObjType , typename CaloObjCollType >
void HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 145 of file HLTCaloObjInRegionsProducer.cc.

147  {
149  std::vector<std::string> outputProductNames;
150  outputProductNames.push_back("EcalRegionalRecHitsEB");
151  desc.add<std::vector<std::string>>("outputProductNames", outputProductNames);
152  std::vector<edm::InputTag> inputColls;
153  inputColls.push_back(edm::InputTag("hltHcalDigis"));
154  desc.add<std::vector<edm::InputTag>>("inputCollTags", inputColls);
155  std::vector<edm::ParameterSet> etaPhiRegions;
156 
157  edm::ParameterSet ecalCandPSet;
158  ecalCandPSet.addParameter<std::string>("type", "RecoEcalCandidate");
159  ecalCandPSet.addParameter<double>("minEt", -1);
160  ecalCandPSet.addParameter<double>("maxEt", -1);
161  ecalCandPSet.addParameter<double>("maxDeltaR", 0.5);
162  ecalCandPSet.addParameter<double>("maxDEta", 0.);
163  ecalCandPSet.addParameter<double>("maxDPhi", 0.);
164  ecalCandPSet.addParameter<edm::InputTag>("inputColl", edm::InputTag("hltEgammaCandidates"));
165  etaPhiRegions.push_back(ecalCandPSet);
166 
167  edm::ParameterSetDescription etaPhiRegionDesc;
168  etaPhiRegionDesc.add<std::string>("type");
169  etaPhiRegionDesc.add<double>("minEt");
170  etaPhiRegionDesc.add<double>("maxEt");
171  etaPhiRegionDesc.add<double>("maxDeltaR");
172  etaPhiRegionDesc.add<double>("maxDEta");
173  etaPhiRegionDesc.add<double>("maxDPhi");
174  etaPhiRegionDesc.add<edm::InputTag>("inputColl");
175  desc.addVPSet("etaPhiRegions", etaPhiRegionDesc, etaPhiRegions);
176 

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSet::addParameter(), defaultModuleLabel(), submitPVResolutionJobs::desc, HLT_FULL_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ makeFilteredColl()

template<typename CaloObjType , typename CaloObjCollType >
std::unique_ptr< CaloObjCollType > HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::makeFilteredColl ( const edm::Handle< CaloObjCollType > &  inputColl,
CaloGeometry const &  caloGeomHandle,
const std::vector< EtaPhiRegion > &  regions 
)
staticprivate

Definition at line 207 of file HLTCaloObjInRegionsProducer.cc.

211  {
212  auto outputColl = std::make_unique<CaloObjCollType>();
213  if (!inputColl->empty()) {
214  const CaloSubdetectorGeometry* subDetGeom = caloGeomHandle.getSubdetectorGeometry(inputColl->begin()->id());
215  if (!regions.empty()) {
216  for (const CaloObjType& obj : *inputColl) {
217  auto objGeom = subDetGeom->getGeometry(obj.id());
218  if (objGeom == nullptr) {
219  //wondering what to do here
220  //something is very very wrong
221  //given HLT should never crash or throw, decided to log an error
222  //update: so turns out HCAL can pass through calibration channels in QIE11 so for that module, its an expected behaviour
223  //so we check if the ID is valid
224  if (validIDForGeom(obj.id())) {
225  edm::LogError("HLTCaloObjInRegionsProducer")
226  << "for an object of type " << typeid(CaloObjType).name() << " the geometry returned null for id "
227  << DetId(obj.id()).rawId() << " with initial ID " << DetId(inputColl->begin()->id()).rawId()
228  << " in HLTCaloObjsInRegion, this shouldnt be possible and something has gone wrong, auto accepting "
229  "hit";
230  }
231  outputColl->push_back(obj);
232  continue;
233  }
234  float eta = objGeom->getPosition().eta();
235  float phi = objGeom->getPosition().phi();
236 
237  for (const auto& region : regions) {
238  if (region(eta, phi)) {
239  outputColl->push_back(obj);
240  break;
241  }
242  }
243  }
244  } //end check of empty regions
245  } //end check of empty rec-hits
246  return outputColl;

References PVValHelper::eta, CaloGeometry::getSubdetectorGeometry(), HLT_FULL_cff::inputColl, Skims_PA_cff::name, getGTfromDQMFile::obj, HLT_FULL_cff::outputColl, PVValHelper::phi, HLT_FULL_cff::region, and GeomDetEnumerators::subDetGeom.

◆ produce()

template<typename CaloObjType , typename CaloObjCollType >
void HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::produce ( edm::Event event,
const edm::EventSetup setup 
)
override

Definition at line 180 of file HLTCaloObjInRegionsProducer.cc.

182  {
183  // get the collection geometry:
184  auto const& caloGeom = setup.getData(caloGeometryToken_);
185 
186  std::vector<EtaPhiRegion> regions;
187  std::for_each(etaPhiRegionData_.begin(),
188  etaPhiRegionData_.end(),
189  [&event, &regions](const std::unique_ptr<EtaPhiRegionDataBase>& input) {
190  input->getEtaPhiRegions(event, regions);
191  });
192 
193  for (size_t inputCollNr = 0; inputCollNr < inputTokens_.size(); inputCollNr++) {
195  event.getByToken(inputTokens_[inputCollNr], inputColl);
196 
197  if (!(inputColl.isValid())) {
198  edm::LogError("ProductNotFound") << "could not get a handle on the " << typeid(CaloObjCollType).name()
199  << " named " << inputCollTags_[inputCollNr].encode() << std::endl;
200  continue;
201  }
202  auto outputColl = makeFilteredColl(inputColl, caloGeom, regions);
203  event.put(std::move(outputColl), outputProductNames_[inputCollNr]);
204  }

References edmPickEvents::event, input, HLT_FULL_cff::inputColl, eostools::move(), Skims_PA_cff::name, HLT_FULL_cff::outputColl, and singleTopDQM_cfi::setup.

◆ validIDForGeom()

template<typename CaloObjType , typename CaloObjCollType >
bool HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::validIDForGeom ( const DetId id)
staticprivate

Definition at line 253 of file HLTCaloObjInRegionsProducer.cc.

254  {
255  if (id.det() == DetId::Hcal) {
256  if (id.subdetId() == HcalSubdetector::HcalEmpty || id.subdetId() == HcalSubdetector::HcalOther) {
257  return false;
258  }
259  }
260  return true;

References DetId::Hcal, HcalEmpty, and HcalOther.

Member Data Documentation

◆ caloGeometryToken_

template<typename CaloObjType , typename CaloObjCollType = edm::SortedCollection<CaloObjType>>
const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::caloGeometryToken_
private

Definition at line 115 of file HLTCaloObjInRegionsProducer.cc.

◆ etaPhiRegionData_

template<typename CaloObjType , typename CaloObjCollType = edm::SortedCollection<CaloObjType>>
std::vector<std::unique_ptr<EtaPhiRegionDataBase> > HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::etaPhiRegionData_
private

Definition at line 114 of file HLTCaloObjInRegionsProducer.cc.

◆ inputCollTags_

template<typename CaloObjType , typename CaloObjCollType = edm::SortedCollection<CaloObjType>>
std::vector<edm::InputTag> HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::inputCollTags_
private

Definition at line 112 of file HLTCaloObjInRegionsProducer.cc.

◆ inputTokens_

template<typename CaloObjType , typename CaloObjCollType = edm::SortedCollection<CaloObjType>>
std::vector<edm::EDGetTokenT<CaloObjCollType> > HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::inputTokens_
private

Definition at line 113 of file HLTCaloObjInRegionsProducer.cc.

◆ outputProductNames_

template<typename CaloObjType , typename CaloObjCollType = edm::SortedCollection<CaloObjType>>
std::vector<std::string> HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::outputProductNames_
private

Definition at line 111 of file HLTCaloObjInRegionsProducer.cc.

HcalOther
Definition: HcalAssistant.h:38
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
input
static const std::string input
Definition: EdmProvDump.cc:48
HLTCaloObjInRegionsProducer::etaPhiRegionData_
std::vector< std::unique_ptr< EtaPhiRegionDataBase > > etaPhiRegionData_
Definition: HLTCaloObjInRegionsProducer.cc:114
DetId::Hcal
Definition: DetId.h:28
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:85964
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
HcalEmpty
Definition: HcalAssistant.h:32
edm::Handle
Definition: AssociativeIterator.h:50
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
EtaPhiRegionData
Definition: HLTCaloObjInRegionsProducer.cc:73
DetId
Definition: DetId.h:17
HLTCaloObjInRegionsProducer::createEtaPhiRegionData
EtaPhiRegionDataBase * createEtaPhiRegionData(const std::string &, const edm::ParameterSet &, edm::ConsumesCollector &&)
Definition: HLTCaloObjInRegionsProducer.cc:263
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
PVValHelper::eta
Definition: PVValidationHelpers.h:69
HLT_FULL_cff.inputColl
inputColl
Definition: HLT_FULL_cff.py:14656
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
defaultModuleLabel
std::string defaultModuleLabel()
Definition: defaultModuleLabel.h:16
HLT_FULL_cff.outputColl
outputColl
Definition: HLT_FULL_cff.py:81248
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
HLTCaloObjInRegionsProducer::makeFilteredColl
static std::unique_ptr< CaloObjCollType > makeFilteredColl(const edm::Handle< CaloObjCollType > &inputColl, CaloGeometry const &caloGeomHandle, const std::vector< EtaPhiRegion > &regions)
Definition: HLTCaloObjInRegionsProducer.cc:207
HLTCaloObjInRegionsProducer::outputProductNames_
std::vector< std::string > outputProductNames_
Definition: HLTCaloObjInRegionsProducer.cc:111
edmPickEvents.event
event
Definition: edmPickEvents.py:273
edm::ParameterSet::addParameter
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:135
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:84949
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
HLTCaloObjInRegionsProducer::inputTokens_
std::vector< edm::EDGetTokenT< CaloObjCollType > > inputTokens_
Definition: HLTCaloObjInRegionsProducer.cc:113
DDAxes::phi
HLTCaloObjInRegionsProducer::inputCollTags_
std::vector< edm::InputTag > inputCollTags_
Definition: HLTCaloObjInRegionsProducer.cc:112
HLTCaloObjInRegionsProducer::validIDForGeom
static bool validIDForGeom(const DetId &id)
Definition: HLTCaloObjInRegionsProducer.cc:253
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
HLTCaloObjInRegionsProducer::caloGeometryToken_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
Definition: HLTCaloObjInRegionsProducer.cc:115
HLTCaloObjInRegionsProducer
Definition: HLTCaloObjInRegionsProducer.cc:95
GeomDetEnumerators::subDetGeom
constexpr SubDetector subDetGeom[21]
Definition: GeomDetEnumerators.h:40
Exception
Definition: hltDiff.cc:246
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
AlignmentPI::regions
regions
Definition: AlignmentPayloadInspectorHelper.h:76
event
Definition: event.py:1
edm::InputTag
Definition: InputTag.h:15
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27