48 m_EcalToken = consumes<edm::PCaloHitContainer>(
edm::InputTag(
"g4SimHits",
"EcalTBH4BeamHits"));
49 produces<EcalTBHodoscopeRawInfo>();
53 myThreshold = 0.05E-3;
64 event.getByToken(m_EcalToken, pCaloHit);
67 LogDebug(
"EcalTBHodo") <<
"total # caloHits: " << caloHits->size();
69 edm::LogError(
"EcalTBHodo") <<
"Error! can't get the caloHitContainer ";
76 std::map<unsigned int, double> energyMap;
78 for (
auto &&aHit : *caloHits) {
79 double thisHitEne = aHit.energy();
81 std::map<unsigned int, double>::iterator itmap = energyMap.find(aHit.id());
82 if (itmap == energyMap.end())
83 energyMap.insert(pair<unsigned int, double>(aHit.id(), thisHitEne));
85 (*itmap).second += thisHitEne;
90 int nPlanes = theTBHodoGeom_->getNPlanes();
91 int nFibers = theTBHodoGeom_->getNFibres();
92 product->setPlanes(nPlanes);
94 bool firedChannels[4][64];
95 for (
int iPlane = 0; iPlane < nPlanes; ++iPlane) {
96 for (
int iFiber = 0; iFiber < nFibers; ++iFiber) {
97 firedChannels[iPlane][iFiber] = 0.;
100 for (std::map<unsigned int, double>::const_iterator itmap = energyMap.begin(); itmap != energyMap.end(); ++itmap) {
101 if ((*itmap).second > myThreshold) {
103 firedChannels[myHodoDetId.
planeId()][myHodoDetId.
fibrId()] =
true;
106 for (
int iPlane = 0; iPlane < nPlanes; ++iPlane) {
109 for (
int iFiber = 0; iFiber < nFibers; ++iFiber) {
110 planeHit.
setHit(iFiber, firedChannels[iPlane][iFiber]);
112 product->setPlane((
unsigned int)iPlane, planeHit);
115 LogDebug(
"EcalTBHodo") << (*product);
std::vector< PCaloHit > PCaloHitContainer
void setHit(unsigned int i, bool status)
~TBHodoActiveVolumeRawInfoProducer() override
Destructor.
#define DEFINE_FWK_MODULE(type)
void produce(edm::Event &event, const edm::EventSetup &eventSetup) override
Produce digis out of raw data.
Log< level::Error, false > LogError
TBHodoActiveVolumeRawInfoProducer(const edm::ParameterSet &ps)
Constructor.
T const * product() const
EcalTBHodoscopeGeometry * theTBHodoGeom_
edm::EDGetTokenT< edm::PCaloHitContainer > m_EcalToken