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 
10 
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:
28 };
29 
31  clusters_token_ = consumes<std::vector<reco::CaloCluster>>(ps.getParameter<edm::InputTag>("layer_clusters"));
32 
33  produces<TICLLayerTiles>();
34 }
35 
37 
39  auto result = std::make_unique<TICLLayerTiles>();
40 
42  evt.getByToken(clusters_token_, cluster_h);
43  const auto &layerClusters = *cluster_h;
44  int lcId = 0;
45  for (auto const &lc : layerClusters) {
46  const auto firstHitDetId = lc.hitsAndFractions()[0].first;
47  int layer = rhtools_.getLayerWithOffset(firstHitDetId) +
48  rhtools_.lastLayerFH() * ((rhtools_.zside(firstHitDetId) + 1) >> 1) - 1;
49  assert(layer >= 0);
50  result->fill(layer, lc.eta(), lc.phi(), lcId);
51  LogDebug("TICLLayerTileProducer") << "Adding layerClusterId: " << lcId << " into bin [eta,phi]: [ "
52  << (*result)[layer].etaBin(lc.eta()) << ", " << (*result)[layer].phiBin(lc.phi())
53  << "] for layer: " << layer << std::endl;
54  lcId++;
55  }
56  evt.put(std::move(result));
57 }
58 
61  desc.add<edm::InputTag>("layer_clusters", edm::InputTag("hgcalLayerClusters"));
62  descriptions.add("ticlLayerTileProducer", desc);
63 }
64 
#define LogDebug(id)
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
int zside(const DetId &id) const
Definition: RecHitTools.cc:163
hgcal::RecHitTools rhtools_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
void produce(edm::Event &, const edm::EventSetup &) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void beginRun(edm::Run const &, edm::EventSetup const &) override
void getEventSetup(const edm::EventSetup &)
Definition: RecHitTools.cc:70
TICLLayerTileProducer(const edm::ParameterSet &ps)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDGetTokenT< std::vector< reco::CaloCluster > > clusters_token_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
unsigned int getLayerWithOffset(const DetId &) const
Definition: RecHitTools.cc:355
void add(std::string const &label, ParameterSetDescription const &psetDescription)
def move(src, dest)
Definition: eostools.py:511
Definition: Run.h:45
unsigned int lastLayerFH() const
Definition: RecHitTools.h:63