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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

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...
 
virtual ~TBHodoActiveVolumeRawInfoProducer ()
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::EDGetTokenT< edm::PCaloHitContainerm_EcalToken
 
double myThreshold
 
EcalTBHodoscopeGeometrytheTBHodoGeom_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 26 of file TBHodoActiveVolumeRawInfoProducer.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 14 of file TBHodoActiveVolumeRawInfoProducer.cc.

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

Destructor.

Definition at line 24 of file TBHodoActiveVolumeRawInfoProducer.cc.

24  {
25  delete theTBHodoGeom_;
26 }

Member Function Documentation

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

Produce digis out of raw data.

Definition at line 28 of file TBHodoActiveVolumeRawInfoProducer.cc.

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

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

Member Data Documentation

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

Definition at line 44 of file TBHodoActiveVolumeRawInfoProducer.h.

double TBHodoActiveVolumeRawInfoProducer::myThreshold
private

Definition at line 42 of file TBHodoActiveVolumeRawInfoProducer.h.

EcalTBHodoscopeGeometry* TBHodoActiveVolumeRawInfoProducer::theTBHodoGeom_
private

Definition at line 45 of file TBHodoActiveVolumeRawInfoProducer.h.