CMS 3D CMS Logo

TICLLayerTileProducer.cc
Go to the documentation of this file.
1 // Author: Marco Rovere, marco.rovere@cern.ch
2 // Date: 05/2019
3 //
4 #include <memory> // unique_ptr
5 
11 
14 
16 
18 public:
19  explicit TICLLayerTileProducer(const edm::ParameterSet &ps);
20  ~TICLLayerTileProducer() override{};
21  void beginRun(edm::Run const &, edm::EventSetup const &) override;
22  void produce(edm::Event &, const edm::EventSetup &) override;
23  static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
24 
25 private:
31  bool doNose_;
32 };
33 
35  : detector_(ps.getParameter<std::string>("detector")) {
37  consumes<std::vector<reco::CaloCluster>>(ps.getParameter<edm::InputTag>("layer_HFNose_clusters"));
38  clusters_token_ = consumes<std::vector<reco::CaloCluster>>(ps.getParameter<edm::InputTag>("layer_clusters"));
39  geometry_token_ = esConsumes<CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun>();
40 
41  doNose_ = (detector_ == "HFNose");
42 
43  if (doNose_)
44  produces<TICLLayerTilesHFNose>();
45  else
46  produces<TICLLayerTiles>();
47 }
48 
52 }
53 
55  auto result = std::make_unique<TICLLayerTiles>();
56  auto resultHFNose = std::make_unique<TICLLayerTilesHFNose>();
57 
59  if (doNose_)
60  evt.getByToken(clusters_HFNose_token_, cluster_h);
61  else
62  evt.getByToken(clusters_token_, cluster_h);
63 
64  const auto &layerClusters = *cluster_h;
65  int lcId = 0;
66  for (auto const &lc : layerClusters) {
67  const auto firstHitDetId = lc.hitsAndFractions()[0].first;
68  int layer = rhtools_.getLayerWithOffset(firstHitDetId) +
69  rhtools_.lastLayer(doNose_) * ((rhtools_.zside(firstHitDetId) + 1) >> 1) - 1;
70 
71  assert(layer >= 0);
72 
73  if (doNose_)
74  resultHFNose->fill(layer, lc.eta(), lc.phi(), lcId);
75  else
76  result->fill(layer, lc.eta(), lc.phi(), lcId);
77  LogDebug("TICLLayerTileProducer") << "Adding layerClusterId: " << lcId << " into bin [eta,phi]: [ "
78  << (*result)[layer].etaBin(lc.eta()) << ", " << (*result)[layer].phiBin(lc.phi())
79  << "] for layer: " << layer << std::endl;
80  lcId++;
81  }
82  if (doNose_)
83  evt.put(std::move(resultHFNose));
84  else
85  evt.put(std::move(result));
86 }
87 
90  desc.add<std::string>("detector", "HGCAL");
91  desc.add<edm::InputTag>("layer_clusters", edm::InputTag("hgcalLayerClusters"));
92  desc.add<edm::InputTag>("layer_HFNose_clusters", edm::InputTag("hgcalLayerClustersHFNose"));
93  descriptions.add("ticlLayerTileProducer", desc);
94 }
95 
ConfigurationDescriptions.h
hgcal::RecHitTools
Definition: RecHitTools.h:23
MessageLogger.h
TICLLayerTileProducer::detector_
std::string detector_
Definition: TICLLayerTileProducer.cc:30
edm::Run
Definition: Run.h:45
edm::EDGetTokenT
Definition: EDGetToken.h:33
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89353
TICLLayerTileProducer::~TICLLayerTileProducer
~TICLLayerTileProducer() override
Definition: TICLLayerTileProducer.cc:20
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
cms::cuda::assert
assert(be >=bs)
EDProducer.h
edm::Handle
Definition: AssociativeIterator.h:50
ESGetToken.h
TICLLayerTileProducer::clusters_token_
edm::EDGetTokenT< std::vector< reco::CaloCluster > > clusters_token_
Definition: TICLLayerTileProducer.cc:26
TICLLayerTile.h
TICLLayerTileProducer::clusters_HFNose_token_
edm::EDGetTokenT< std::vector< reco::CaloCluster > > clusters_HFNose_token_
Definition: TICLLayerTileProducer.cc:27
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
edm::ESHandle< CaloGeometry >
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:531
HLTEgPhaseIITestSequence_cff.layerClusters
layerClusters
Definition: HLTEgPhaseIITestSequence_cff.py:2506
TICLLayerTileProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: TICLLayerTileProducer.cc:88
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TICLLayerTileProducer::TICLLayerTileProducer
TICLLayerTileProducer(const edm::ParameterSet &ps)
Definition: TICLLayerTileProducer.cc:34
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
hgcal::RecHitTools::getLayerWithOffset
unsigned int getLayerWithOffset(const DetId &) const
Definition: RecHitTools.cc:352
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
edm::stream::EDProducer
Definition: EDProducer.h:38
hgcal::RecHitTools::zside
int zside(const DetId &id) const
Definition: RecHitTools.cc:160
edm::EventSetup
Definition: EventSetup.h:57
TICLLayerTileProducer::beginRun
void beginRun(edm::Run const &, edm::EventSetup const &) override
Definition: TICLLayerTileProducer.cc:49
edm::ESGetToken< CaloGeometry, CaloGeometryRecord >
TICLLayerTileProducer::doNose_
bool doNose_
Definition: TICLLayerTileProducer.cc:31
TICLLayerTileProducer
Definition: TICLLayerTileProducer.cc:17
hgcal::RecHitTools::lastLayer
unsigned int lastLayer(bool nose=false) const
Definition: RecHitTools.h:68
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
hgcal::RecHitTools::setGeometry
void setGeometry(CaloGeometry const &)
Definition: RecHitTools.cc:68
TICLLayerTileProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: TICLLayerTileProducer.cc:54
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TICLLayerTileProducer::rhtools_
hgcal::RecHitTools rhtools_
Definition: TICLLayerTileProducer.cc:29
mps_fire.result
result
Definition: mps_fire.py:311
ParameterSet.h
TICLLayerTileProducer::geometry_token_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometry_token_
Definition: TICLLayerTileProducer.cc:28
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
RecHitTools.h
CaloCluster.h