15 m_EcalToken = consumes<edm::PCaloHitContainer>(
edm::InputTag(
"g4SimHits",
"EcalTBH4BeamHits"));
16 produces<EcalTBHodoscopeRawInfo>();
20 myThreshold = 0.05E-3;
31 event.getByToken(m_EcalToken, pCaloHit);
34 LogDebug(
"EcalTBHodo") <<
"total # caloHits: " << caloHits->size();
36 edm::LogError(
"EcalTBHodo") <<
"Error! can't get the caloHitContainer ";
43 std::map<unsigned int, double> energyMap;
45 for (
auto &&aHit : *caloHits) {
46 double thisHitEne = aHit.energy();
48 std::map<unsigned int, double>::iterator itmap = energyMap.find(aHit.id());
49 if (itmap == energyMap.end())
50 energyMap.insert(pair<unsigned int, double>(aHit.id(), thisHitEne));
52 (*itmap).second += thisHitEne;
57 int nPlanes = theTBHodoGeom_->getNPlanes();
58 int nFibers = theTBHodoGeom_->getNFibres();
59 product->setPlanes(nPlanes);
61 bool firedChannels[4][64];
62 for (
int iPlane = 0; iPlane < nPlanes; ++iPlane) {
63 for (
int iFiber = 0; iFiber < nFibers; ++iFiber) {
64 firedChannels[iPlane][iFiber] = 0.;
67 for (std::map<unsigned int, double>::const_iterator itmap = energyMap.begin(); itmap != energyMap.end(); ++itmap) {
68 if ((*itmap).second > myThreshold) {
70 firedChannels[myHodoDetId.
planeId()][myHodoDetId.
fibrId()] =
true;
73 for (
int iPlane = 0; iPlane < nPlanes; ++iPlane) {
76 for (
int iFiber = 0; iFiber < nFibers; ++iFiber) {
77 planeHit.
setHit(iFiber, firedChannels[iPlane][iFiber]);
79 product->setPlane((
unsigned int)iPlane, planeHit);
82 LogDebug(
"EcalTBHodo") << (*product);
std::vector< PCaloHit > PCaloHitContainer
void setHit(unsigned int i, bool status)
~TBHodoActiveVolumeRawInfoProducer() override
Destructor.
void produce(edm::Event &event, const edm::EventSetup &eventSetup) override
Produce digis out of raw data.
TBHodoActiveVolumeRawInfoProducer(const edm::ParameterSet &ps)
Constructor.
Namespace of DDCMS conversion namespace.
T const * product() const