CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
TBHodoActiveVolumeRawInfoProducer Class Reference

#include <TBHodoActiveVolumeRawInfoProducer.h>

Inheritance diagram for TBHodoActiveVolumeRawInfoProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void produce (edm::Event &event, const edm::EventSetup &eventSetup)
 Produce digis out of raw data. More...
 
 TBHodoActiveVolumeRawInfoProducer (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~TBHodoActiveVolumeRawInfoProducer ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

double myThreshold
 
EcalTBHodoscopeGeometrytheTBHodoGeom_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 27 of file TBHodoActiveVolumeRawInfoProducer.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 14 of file TBHodoActiveVolumeRawInfoProducer.cc.

14  {
15 
16  produces<EcalTBHodoscopeRawInfo>();
17 
19 
20  myThreshold = 0.05E-3;
21 }
TBHodoActiveVolumeRawInfoProducer::~TBHodoActiveVolumeRawInfoProducer ( )
virtual

Destructor.

Definition at line 23 of file TBHodoActiveVolumeRawInfoProducer.cc.

23  {
24  delete theTBHodoGeom_;
25 }

Member Function Documentation

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

Produce digis out of raw data.

Implements edm::EDProducer.

Definition at line 27 of file TBHodoActiveVolumeRawInfoProducer.cc.

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

28 {
29  auto_ptr<EcalTBHodoscopeRawInfo> product(new EcalTBHodoscopeRawInfo());
30 
31  // caloHit container
33  const edm::PCaloHitContainer* caloHits =0;
34  event.getByLabel( "g4SimHits", "EcalTBH4BeamHits", pCaloHit);
35  if (pCaloHit.isValid()){
36  caloHits = pCaloHit.product();
37  LogDebug("EcalTBHodo") << "total # caloHits: " << caloHits->size() ;
38  } else {
39  edm::LogError("EcalTBHodo") << "Error! can't get the caloHitContainer " ;
40  }
41  if (!caloHits){ return; }
42 
43 
44  // detid - energy_sum map
45  std::map<unsigned int, double> energyMap;
46 
47  int myCount = 0;
48  for(edm::PCaloHitContainer::const_iterator itch = caloHits->begin(); itch != caloHits->end(); ++itch) {
49 
50  double thisHitEne = itch->energy();
51 
52  std::map<unsigned int,double>::iterator itmap = energyMap.find(itch->id());
53  if ( itmap == energyMap.end() )
54  energyMap.insert(pair<unsigned int, double>( itch->id(), thisHitEne));
55  else{
56  (*itmap).second+=thisHitEne;
57  }
58 
59  myCount++;
60  }
61 
62 
63  // planes and fibers
64  int nPlanes=theTBHodoGeom_->getNPlanes();
65  int nFibers=theTBHodoGeom_->getNFibres();
66  product->setPlanes(nPlanes);
67 
68  bool firedChannels[4][64];
69  for (int iPlane = 0 ; iPlane < nPlanes ; ++iPlane)
70  for (int iFiber = 0; iFiber < nFibers ; ++iFiber)
71  firedChannels[iPlane][iFiber] = 0.;
72 
73  for(std::map<unsigned int,double>::const_iterator itmap=energyMap.begin();itmap!=energyMap.end();itmap++)
74  if ( (*itmap).second > myThreshold ){
75  HodoscopeDetId myHodoDetId = HodoscopeDetId((*itmap).first);
76  firedChannels[myHodoDetId.planeId()][myHodoDetId.fibrId()] = 1;
77  }
78 
79  for (int iPlane = 0 ; iPlane < nPlanes ; ++iPlane) {
80  EcalTBHodoscopePlaneRawHits planeHit(nFibers);
81 
82  for (int iFiber = 0; iFiber < nFibers ; ++iFiber)
83  planeHit.setHit(iFiber,firedChannels[iPlane][iFiber]);
84 
85  product->setPlane((unsigned int)iPlane, planeHit);
86  }
87 
88  LogDebug("EcalTBHodo") << (*product);
89 
90  event.put(product);
91 }
#define LogDebug(id)
std::vector< PCaloHit > PCaloHitContainer
bool isValid() const
Definition: HandleBase.h:76
int fibrId() const
T const * product() const
Definition: Handle.h:81
int planeId() const

Member Data Documentation

double TBHodoActiveVolumeRawInfoProducer::myThreshold
private

Definition at line 43 of file TBHodoActiveVolumeRawInfoProducer.h.

EcalTBHodoscopeGeometry* TBHodoActiveVolumeRawInfoProducer::theTBHodoGeom_
private

Definition at line 45 of file TBHodoActiveVolumeRawInfoProducer.h.