CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
TBHodoActiveVolumeRawInfoProducer Class Reference

#include <TBHodoActiveVolumeRawInfoProducer.h>

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::PCaloHitContainerm_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 25 of file TBHodoActiveVolumeRawInfoProducer.h.

Constructor & Destructor Documentation

◆ TBHodoActiveVolumeRawInfoProducer()

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

Constructor.

Definition at line 14 of file TBHodoActiveVolumeRawInfoProducer.cc.

14  {
15  m_EcalToken = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits", "EcalTBH4BeamHits"));
16  produces<EcalTBHodoscopeRawInfo>();
17 
19 
20  myThreshold = 0.05E-3;
21 }

◆ ~TBHodoActiveVolumeRawInfoProducer()

TBHodoActiveVolumeRawInfoProducer::~TBHodoActiveVolumeRawInfoProducer ( )
override

Destructor.

Definition at line 23 of file TBHodoActiveVolumeRawInfoProducer.cc.

23 { delete theTBHodoGeom_; }

Member Function Documentation

◆ produce()

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

Produce digis out of raw data.

Definition at line 25 of file TBHodoActiveVolumeRawInfoProducer.cc.

25  {
26  unique_ptr<EcalTBHodoscopeRawInfo> product(new EcalTBHodoscopeRawInfo());
27 
28  // caloHit container
30  const edm::PCaloHitContainer *caloHits = nullptr;
31  event.getByToken(m_EcalToken, pCaloHit);
32  if (pCaloHit.isValid()) {
33  caloHits = pCaloHit.product();
34  LogDebug("EcalTBHodo") << "total # caloHits: " << caloHits->size();
35  } else {
36  edm::LogError("EcalTBHodo") << "Error! can't get the caloHitContainer ";
37  }
38  if (!caloHits) {
39  return;
40  }
41 
42  // detid - energy_sum map
43  std::map<unsigned int, double> energyMap;
44 
45  for (auto &&aHit : *caloHits) {
46  double thisHitEne = aHit.energy();
47 
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));
51  else {
52  (*itmap).second += thisHitEne;
53  }
54  }
55 
56  // planes and fibers
57  int nPlanes = theTBHodoGeom_->getNPlanes();
58  int nFibers = theTBHodoGeom_->getNFibres();
59  product->setPlanes(nPlanes);
60 
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.;
65  }
66  }
67  for (std::map<unsigned int, double>::const_iterator itmap = energyMap.begin(); itmap != energyMap.end(); ++itmap) {
68  if ((*itmap).second > myThreshold) {
69  HodoscopeDetId myHodoDetId = HodoscopeDetId((*itmap).first);
70  firedChannels[myHodoDetId.planeId()][myHodoDetId.fibrId()] = true;
71  }
72  }
73  for (int iPlane = 0; iPlane < nPlanes; ++iPlane) {
74  EcalTBHodoscopePlaneRawHits planeHit(nFibers);
75 
76  for (int iFiber = 0; iFiber < nFibers; ++iFiber) {
77  planeHit.setHit(iFiber, firedChannels[iPlane][iFiber]);
78  }
79  product->setPlane((unsigned int)iPlane, planeHit);
80  }
81 
82  LogDebug("EcalTBHodo") << (*product);
83 
84  event.put(std::move(product));
85 }

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

Member Data Documentation

◆ m_EcalToken

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

Definition at line 39 of file TBHodoActiveVolumeRawInfoProducer.h.

◆ myThreshold

double TBHodoActiveVolumeRawInfoProducer::myThreshold
private

Definition at line 37 of file TBHodoActiveVolumeRawInfoProducer.h.

◆ theTBHodoGeom_

EcalTBHodoscopeGeometry* TBHodoActiveVolumeRawInfoProducer::theTBHodoGeom_
private

Definition at line 40 of file TBHodoActiveVolumeRawInfoProducer.h.

TBHodoActiveVolumeRawInfoProducer::m_EcalToken
edm::EDGetTokenT< edm::PCaloHitContainer > m_EcalToken
Definition: TBHodoActiveVolumeRawInfoProducer.h:39
EcalTBHodoscopePlaneRawHits
Definition: EcalTBHodoscopePlaneRawHits.h:13
edm::Handle::product
T const * product() const
Definition: Handle.h:70
EcalTBHodoscopeGeometry
Definition: EcalTBHodoscopeGeometry.h:9
edm::Handle
Definition: AssociativeIterator.h:50
TBHodoActiveVolumeRawInfoProducer::theTBHodoGeom_
EcalTBHodoscopeGeometry * theTBHodoGeom_
Definition: TBHodoActiveVolumeRawInfoProducer.h:40
EcalTBHodoscopeGeometry::getNFibres
static int getNFibres()
Definition: EcalTBHodoscopeGeometry.cc:28
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
TBHodoActiveVolumeRawInfoProducer::myThreshold
double myThreshold
Definition: TBHodoActiveVolumeRawInfoProducer.h:37
EcalTBHodoscopeRawInfo
Definition: EcalTBHodoscopeRawInfo.h:13
HodoscopeDetId::fibrId
int fibrId() const
Definition: HodoscopeDetId.cc:11
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
HodoscopeDetId::planeId
int planeId() const
Definition: HodoscopeDetId.cc:9
eostools.move
def move(src, dest)
Definition: eostools.py:511
EcalTBHodoscopeGeometry::getNPlanes
static int getNPlanes()
Definition: EcalTBHodoscopeGeometry.cc:26
edm::PCaloHitContainer
std::vector< PCaloHit > PCaloHitContainer
Definition: PCaloHitContainer.h:8
HodoscopeDetId
Definition: HodoscopeDetId.h:20
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::InputTag
Definition: InputTag.h:15