16 m_EcalToken = consumes<edm::PCaloHitContainer>(
edm::InputTag(
"g4SimHits",
"EcalTBH4BeamHits"));
17 produces<EcalTBHodoscopeRawInfo>();
21 myThreshold = 0.05E-3;
25 delete theTBHodoGeom_;
35 event.getByToken(m_EcalToken, pCaloHit);
38 LogDebug(
"EcalTBHodo") <<
"total # caloHits: " << caloHits->size() ;
40 edm::LogError(
"EcalTBHodo") <<
"Error! can't get the caloHitContainer " ;
42 if (!caloHits){
return; }
45 std::map<unsigned int, double> energyMap;
47 for(
auto&& aHit : *caloHits) {
48 double thisHitEne = aHit.energy();
50 std::map<unsigned int,double>::iterator itmap = energyMap.find(aHit.id());
51 if ( itmap == energyMap.end() )
52 energyMap.insert(pair<unsigned int, double>( aHit.id(), thisHitEne));
54 (*itmap).second += thisHitEne;
59 int nPlanes=theTBHodoGeom_->getNPlanes();
60 int nFibers=theTBHodoGeom_->getNFibres();
61 product->setPlanes(nPlanes);
63 bool firedChannels[4][64];
64 for (
int iPlane = 0 ; iPlane < nPlanes ; ++iPlane) {
65 for (
int iFiber = 0; iFiber < nFibers ; ++iFiber) {
66 firedChannels[iPlane][iFiber] = 0.;
69 for(std::map<unsigned int,double>::const_iterator itmap=energyMap.begin();itmap!=energyMap.end();++itmap) {
70 if ( (*itmap).second > myThreshold ){
72 firedChannels[myHodoDetId.
planeId()][myHodoDetId.
fibrId()] =
true;
75 for (
int iPlane = 0 ; iPlane < nPlanes ; ++iPlane) {
78 for (
int iFiber = 0; iFiber < nFibers ; ++iFiber) {
79 planeHit.
setHit(iFiber,firedChannels[iPlane][iFiber]);
81 product->setPlane((
unsigned int)iPlane, planeHit);
84 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