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::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 ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

double myThreshold
 
EcalTBHodoscopeGeometrytheTBHodoGeom_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 28 of file TBHodoActiveVolumeRawInfoProducer.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 15 of file TBHodoActiveVolumeRawInfoProducer.cc.

15  {
16 
17  produces<EcalTBHodoscopeRawInfo>();
18 
20 
21  myThreshold = 0.05E-3;
22 }
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 
)
virtual

Produce digis out of raw data.

Implements edm::EDProducer.

Definition at line 28 of file TBHodoActiveVolumeRawInfoProducer.cc.

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

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

Member Data Documentation

double TBHodoActiveVolumeRawInfoProducer::myThreshold
private

Definition at line 44 of file TBHodoActiveVolumeRawInfoProducer.h.

EcalTBHodoscopeGeometry* TBHodoActiveVolumeRawInfoProducer::theTBHodoGeom_
private

Definition at line 46 of file TBHodoActiveVolumeRawInfoProducer.h.