CMS 3D CMS Logo

TBHodoActiveVolumeRawInfoProducer Class Reference

#include <SimG4CMS/EcalTestBeam/interface/TBHodoActiveVolumeRawInfoProducer.h>

Inheritance diagram for TBHodoActiveVolumeRawInfoProducer:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

void produce (edm::Event &event, const edm::EventSetup &eventSetup)
 Produce digis out of raw data.
 TBHodoActiveVolumeRawInfoProducer (const edm::ParameterSet &ps)
 Constructor.
virtual ~TBHodoActiveVolumeRawInfoProducer ()
 Destructor.

Private Attributes

double myThreshold
EcalTBHodoscopeGeometrytheTBHodoGeom_


Detailed Description

Definition at line 29 of file TBHodoActiveVolumeRawInfoProducer.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 15 of file TBHodoActiveVolumeRawInfoProducer.cc.

References myThreshold, and theTBHodoGeom_.

00015                                                                                               {
00016 
00017   produces<EcalTBHodoscopeRawInfo>();
00018 
00019   theTBHodoGeom_ = new EcalTBHodoscopeGeometry();
00020 
00021   myThreshold = 0.05E-3;
00022 }

TBHodoActiveVolumeRawInfoProducer::~TBHodoActiveVolumeRawInfoProducer (  )  [virtual]

Destructor.

Definition at line 24 of file TBHodoActiveVolumeRawInfoProducer.cc.

References theTBHodoGeom_.

00024                                                                       {   
00025   delete theTBHodoGeom_; 
00026 }


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(), EcalTBHodoscopeGeometry::getNFibres(), EcalTBHodoscopeGeometry::getNPlanes(), edm::Handle< T >::isValid(), LogDebug, myThreshold, HodoscopeDetId::planeId(), edm::Handle< T >::product(), EcalTBHodoscopePlaneRawHits::setHit(), and theTBHodoGeom_.

00029 {
00030   auto_ptr<EcalTBHodoscopeRawInfo> product(new EcalTBHodoscopeRawInfo());
00031 
00032   // caloHit container
00033   edm::Handle<edm::PCaloHitContainer> pCaloHit;
00034   const edm::PCaloHitContainer* caloHits =0;
00035   event.getByLabel( "g4SimHits", "EcalTBH4BeamHits", pCaloHit);   
00036   if (pCaloHit.isValid()){ 
00037     caloHits = pCaloHit.product();                 
00038     LogDebug("EcalTBHodo") << "total # caloHits: " << caloHits->size() ;
00039   } else {
00040     edm::LogError("EcalTBHodo") << "Error! can't get the caloHitContainer " ;
00041   }  
00042   if (!caloHits){ return; }
00043 
00044 
00045   // detid - energy_sum map
00046   std::map<unsigned int, double> energyMap;  
00047 
00048   int myCount = 0;
00049   for(edm::PCaloHitContainer::const_iterator itch = caloHits->begin(); itch != caloHits->end(); ++itch) {
00050     
00051     double thisHitEne = itch->energy();
00052 
00053     std::map<unsigned int,double>::iterator itmap = energyMap.find(itch->id());
00054     if ( itmap == energyMap.end() )
00055       energyMap.insert(pair<unsigned int, double>( itch->id(), thisHitEne));  
00056     else{
00057       (*itmap).second+=thisHitEne;
00058     }
00059 
00060     myCount++;
00061   }
00062 
00063   
00064   // planes and fibers
00065   int nPlanes=theTBHodoGeom_->getNPlanes();
00066   int nFibers=theTBHodoGeom_->getNFibres();
00067   product->setPlanes(nPlanes);
00068 
00069   bool firedChannels[4][64];
00070   for (int iPlane = 0 ; iPlane < nPlanes ; ++iPlane) 
00071     for (int iFiber = 0; iFiber < nFibers ; ++iFiber) 
00072       firedChannels[iPlane][iFiber] = 0.;
00073 
00074   for(std::map<unsigned int,double>::const_iterator itmap=energyMap.begin();itmap!=energyMap.end();itmap++)
00075     if ( (*itmap).second > myThreshold ){
00076       HodoscopeDetId myHodoDetId = HodoscopeDetId((*itmap).first);   
00077       firedChannels[myHodoDetId.planeId()][myHodoDetId.fibrId()] = 1;
00078     }
00079 
00080   for (int iPlane = 0 ; iPlane < nPlanes ; ++iPlane) {
00081     EcalTBHodoscopePlaneRawHits planeHit(nFibers);
00082     
00083     for (int iFiber = 0; iFiber < nFibers ; ++iFiber) 
00084       planeHit.setHit(iFiber,firedChannels[iPlane][iFiber]);
00085     
00086     product->setPlane((unsigned int)iPlane, planeHit);
00087   }
00088   
00089   LogDebug("EcalTBHodo") << (*product);
00090   
00091   event.put(product); 
00092 }


Member Data Documentation

double TBHodoActiveVolumeRawInfoProducer::myThreshold [private]

Definition at line 45 of file TBHodoActiveVolumeRawInfoProducer.h.

Referenced by produce(), and TBHodoActiveVolumeRawInfoProducer().

EcalTBHodoscopeGeometry* TBHodoActiveVolumeRawInfoProducer::theTBHodoGeom_ [private]

Definition at line 47 of file TBHodoActiveVolumeRawInfoProducer.h.

Referenced by produce(), TBHodoActiveVolumeRawInfoProducer(), and ~TBHodoActiveVolumeRawInfoProducer().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:33:09 2009 for CMSSW by  doxygen 1.5.4