CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
TBHodoActiveVolumeRawInfoProducer Class Reference
Inheritance diagram for TBHodoActiveVolumeRawInfoProducer:
edm::stream::EDProducer<>

Public Member Functions

void produce (edm::Event &event, const edm::EventSetup &eventSetup) override
 Produce digis out of raw data. More...
 
 TBHodoActiveVolumeRawInfoProducer (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~TBHodoActiveVolumeRawInfoProducer () override
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

edm::EDGetTokenT
< edm::PCaloHitContainer
m_EcalToken
 
double myThreshold
 
EcalTBHodoscopeGeometrytheTBHodoGeom_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 26 of file TBHodoActiveVolumeRawInfoProducer.cc.

Constructor & Destructor Documentation

TBHodoActiveVolumeRawInfoProducer::TBHodoActiveVolumeRawInfoProducer ( const edm::ParameterSet ps)
explicit

Constructor.

Definition at line 47 of file TBHodoActiveVolumeRawInfoProducer.cc.

References HLT_FULL_cff::InputTag.

47  {
48  m_EcalToken = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits", "EcalTBH4BeamHits"));
49  produces<EcalTBHodoscopeRawInfo>();
50 
52 
53  myThreshold = 0.05E-3;
54 }
edm::EDGetTokenT< edm::PCaloHitContainer > m_EcalToken
TBHodoActiveVolumeRawInfoProducer::~TBHodoActiveVolumeRawInfoProducer ( )
override

Destructor.

Definition at line 56 of file TBHodoActiveVolumeRawInfoProducer.cc.

56 { delete theTBHodoGeom_; }

Member Function Documentation

void TBHodoActiveVolumeRawInfoProducer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
)
override

Produce digis out of raw data.

Definition at line 58 of file TBHodoActiveVolumeRawInfoProducer.cc.

References HodoscopeDetId::fibrId(), edm::HandleBase::isValid(), LogDebug, eostools::move(), HodoscopeDetId::planeId(), edm::Handle< T >::product(), and EcalTBHodoscopePlaneRawHits::setHit().

58  {
59  unique_ptr<EcalTBHodoscopeRawInfo> product(new EcalTBHodoscopeRawInfo());
60 
61  // caloHit container
63  const edm::PCaloHitContainer *caloHits = nullptr;
64  event.getByToken(m_EcalToken, pCaloHit);
65  if (pCaloHit.isValid()) {
66  caloHits = pCaloHit.product();
67  LogDebug("EcalTBHodo") << "total # caloHits: " << caloHits->size();
68  } else {
69  edm::LogError("EcalTBHodo") << "Error! can't get the caloHitContainer ";
70  }
71  if (!caloHits) {
72  return;
73  }
74 
75  // detid - energy_sum map
76  std::map<unsigned int, double> energyMap;
77 
78  for (auto &&aHit : *caloHits) {
79  double thisHitEne = aHit.energy();
80 
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));
84  else {
85  (*itmap).second += thisHitEne;
86  }
87  }
88 
89  // planes and fibers
90  int nPlanes = theTBHodoGeom_->getNPlanes();
91  int nFibers = theTBHodoGeom_->getNFibres();
92  product->setPlanes(nPlanes);
93 
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.;
98  }
99  }
100  for (std::map<unsigned int, double>::const_iterator itmap = energyMap.begin(); itmap != energyMap.end(); ++itmap) {
101  if ((*itmap).second > myThreshold) {
102  HodoscopeDetId myHodoDetId = HodoscopeDetId((*itmap).first);
103  firedChannels[myHodoDetId.planeId()][myHodoDetId.fibrId()] = true;
104  }
105  }
106  for (int iPlane = 0; iPlane < nPlanes; ++iPlane) {
107  EcalTBHodoscopePlaneRawHits planeHit(nFibers);
108 
109  for (int iFiber = 0; iFiber < nFibers; ++iFiber) {
110  planeHit.setHit(iFiber, firedChannels[iPlane][iFiber]);
111  }
112  product->setPlane((unsigned int)iPlane, planeHit);
113  }
114 
115  LogDebug("EcalTBHodo") << (*product);
116 
117  event.put(std::move(product));
118 }
std::vector< PCaloHit > PCaloHitContainer
Log< level::Error, false > LogError
def move
Definition: eostools.py:511
bool isValid() const
Definition: HandleBase.h:70
int fibrId() const
T const * product() const
Definition: Handle.h:70
int planeId() const
#define LogDebug(id)
edm::EDGetTokenT< edm::PCaloHitContainer > m_EcalToken

Member Data Documentation

edm::EDGetTokenT<edm::PCaloHitContainer> TBHodoActiveVolumeRawInfoProducer::m_EcalToken
private

Definition at line 40 of file TBHodoActiveVolumeRawInfoProducer.cc.

double TBHodoActiveVolumeRawInfoProducer::myThreshold
private

Definition at line 38 of file TBHodoActiveVolumeRawInfoProducer.cc.

EcalTBHodoscopeGeometry* TBHodoActiveVolumeRawInfoProducer::theTBHodoGeom_
private

Definition at line 41 of file TBHodoActiveVolumeRawInfoProducer.cc.