CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EcalTimeDigiProducer.cc
Go to the documentation of this file.
13 
14 //#define ecal_time_debug 1
15 
17  edm::ProducesCollector producesCollector,
20  m_EBdigiCollection(params.getParameter<std::string>("EBtimeDigiCollection")),
21  m_hitsProducerTagEB(params.getParameter<edm::InputTag>("hitsProducerEB")),
22  m_hitsProducerTokenEB(sumes.consumes<std::vector<PCaloHit>>(m_hitsProducerTagEB)),
23  m_geometryToken(sumes.esConsumes()),
24  m_timeLayerEB(params.getParameter<int>("timeLayerBarrel")),
25  m_Geometry(nullptr) {
27 
29 
30 #ifdef ecal_time_debug
31  std::cout << "[EcalTimeDigiProducer]::Create EB " << m_EBdigiCollection << " "
32  << " collection and digitizer" << std::endl;
33 #endif
34 
35  m_BarrelDigitizer->setTimeLayerId(m_timeLayerEB);
36 }
37 
39 
41  checkGeometry(eventSetup);
42  // checkCalibrations( event, eventSetup );
43  // here the methods to clean the maps
45 }
46 
47 void EcalTimeDigiProducer::accumulateCaloHits(HitsHandle const &ebHandle, int bunchCrossing) {
48  // accumulate the simHits and do the averages in a given layer per bunch
49  // crossing
50  if (ebHandle.isValid()) {
51  m_BarrelDigitizer->add(*ebHandle.product(), bunchCrossing);
52  }
53 }
54 
56  // Step A: Get Inputs
58  e.getByToken(m_hitsProducerTokenEB, ebHandle);
59 
60 #ifdef ecal_time_debug
61  std::cout << "[EcalTimeDigiProducer]::Accumulate Hits HS event" << std::endl;
62 #endif
63 
64  accumulateCaloHits(ebHandle, 0);
65 }
66 
68  edm::EventSetup const &eventSetup,
69  edm::StreamID const &) {
71  e.getByLabel(m_hitsProducerTagEB, ebHandle);
72 
73 #ifdef ecal_time_debug
74  std::cout << "[EcalTimeDigiProducer]::Accumulate Hits for BC " << e.bunchCrossing() << std::endl;
75 #endif
76  accumulateCaloHits(ebHandle, e.bunchCrossing());
77 }
78 
80  std::unique_ptr<EcalTimeDigiCollection> barrelResult = std::make_unique<EcalTimeDigiCollection>();
81 
82 #ifdef ecal_time_debug
83  std::cout << "[EcalTimeDigiProducer]::finalizeEvent" << std::endl;
84 #endif
85 
86  // here basically just put everything in the final collections
87  m_BarrelDigitizer->run(*barrelResult);
88 
89 #ifdef ecal_time_debug
90  std::cout << "[EcalTimeDigiProducer]::EB Digi size " << barrelResult->size() << std::endl;
91 #endif
92 
93  edm::LogInfo("TimeDigiInfo") << "EB time Digis: " << barrelResult->size();
94 
95 #ifdef ecal_time_debug
96  std::cout << "[EcalTimeDigiProducer]::putting EcalTimeDigiCollection into the event " << std::endl;
97 #endif
98 
99  event.put(std::move(barrelResult), m_EBdigiCollection);
100 }
101 
103  if (m_geometryWatcher.check(eventSetup)) {
104  m_Geometry = &eventSetup.getData(m_geometryToken);
105  updateGeometry();
106  }
107 }
108 
111 }
void initializeEvent(edm::Event const &e, edm::EventSetup const &c) override
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
void finalizeEvent(edm::Event &e, edm::EventSetup const &c) override
void run(EcalTimeDigiCollection &output)
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > m_geometryToken
EcalTimeDigiProducer(const edm::ParameterSet &params, edm::ProducesCollector, edm::ConsumesCollector &)
void setGeometry(const CaloSubdetectorGeometry *geometry)
edm::ESWatcher< CaloGeometryRecord > m_geometryWatcher
bool getData(T &iHolder) const
Definition: EventSetup.h:128
const edm::EDGetTokenT< std::vector< PCaloHit > > m_hitsProducerTokenEB
const edm::InputTag m_hitsProducerTagEB
def move
Definition: eostools.py:511
bool isValid() const
Definition: HandleBase.h:70
void accumulate(edm::Event const &e, edm::EventSetup const &c) override
Log< level::Info, false > LogInfo
T const * product() const
Definition: Handle.h:70
EcalTimeMapDigitizer * m_BarrelDigitizer
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
void add(const std::vector< PCaloHit > &hits, int bunchCrossing)
bool getByLabel(edm::InputTag const &tag, edm::Handle< T > &result) const
const CaloGeometry * m_Geometry
tuple cout
Definition: gather_cfg.py:144
void accumulateCaloHits(HitsHandle const &ebHandle, int bunchCrossing)
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
void checkGeometry(const edm::EventSetup &eventSetup)
const std::string m_EBdigiCollection