#include <CastorDigiProducer.h>
Public Member Functions | |
CastorDigiProducer (const edm::ParameterSet &ps) | |
virtual void | produce (edm::Event &e, const edm::EventSetup &c) |
virtual | ~CastorDigiProducer () |
Private Types | |
typedef CaloTDigitizer < CastorDigitizerTraits > | CastorDigitizer |
Private Member Functions | |
void | checkGeometry (const edm::EventSetup &eventSetup) |
void | fillFakeHits () |
some hits in each subdetector, just for testing purposes | |
void | sortHits (const edm::PCaloHitContainer &hits) |
fills the vectors for each subdetector | |
Private Attributes | |
CastorAmplifier * | theAmplifier |
CastorDigitizer * | theCastorDigitizer |
CastorHitFilter | theCastorHitFilter |
std::vector< PCaloHit > | theCastorHits |
CaloVShape * | theCastorIntegratedShape |
CaloHitResponse * | theCastorResponse |
CaloVShape * | theCastorShape |
CastorCoderFactory * | theCoderFactory |
CastorElectronicsSim * | theElectronicsSim |
CastorHitCorrection * | theHitCorrection |
CastorSimParameterMap * | theParameterMap |
Definition at line 21 of file CastorDigiProducer.h.
typedef CaloTDigitizer<CastorDigitizerTraits> CastorDigiProducer::CastorDigitizer [private] |
Reconstruction algorithm
Definition at line 41 of file CastorDigiProducer.h.
CastorDigiProducer::CastorDigiProducer | ( | const edm::ParameterSet & | ps | ) | [explicit] |
Definition at line 22 of file CastorDigiProducer.cc.
References CastorCoderFactory::DB, Exception, edm::ParameterSet::getParameter(), edm::Service< T >::isAvailable(), CaloHitResponse::setHitCorrection(), CaloHitResponse::setHitFilter(), CastorElectronicsSim::setRandomEngine(), theAmplifier, theCastorDigitizer, theCastorHitFilter, theCastorResponse, theCoderFactory, theElectronicsSim, theHitCorrection, and theParameterMap.
: theParameterMap(new CastorSimParameterMap(ps)), theCastorShape(new CastorShape()), theCastorIntegratedShape(new CaloShapeIntegrator(theCastorShape)), theCastorResponse(new CaloHitResponse(theParameterMap, theCastorIntegratedShape)), theAmplifier(0), theCoderFactory(0), theElectronicsSim(0), theHitCorrection(0), theCastorDigitizer(0), theCastorHits() { produces<CastorDigiCollection>(); theCastorResponse->setHitFilter(&theCastorHitFilter); bool doTimeSlew = ps.getParameter<bool>("doTimeSlew"); if(doTimeSlew) { // no time slewing for HF theCastorResponse->setHitCorrection(theHitCorrection); } bool doNoise = ps.getParameter<bool>("doNoise"); theAmplifier = new CastorAmplifier(theParameterMap, doNoise); theCoderFactory = new CastorCoderFactory(CastorCoderFactory::DB); theElectronicsSim = new CastorElectronicsSim(theAmplifier, theCoderFactory); theCastorDigitizer = new CastorDigitizer(theCastorResponse, theElectronicsSim, doNoise); edm::Service<edm::RandomNumberGenerator> rng; if ( ! rng.isAvailable()) { throw cms::Exception("Configuration") << "CastorDigiProducer requires the RandomNumberGeneratorService\n" "which is not present in the configuration file. You must add the service\n" "in the configuration file or remove the modules that require it."; } CLHEP::HepRandomEngine& engine = rng->getEngine(); theAmplifier->setRandomEngine(engine); theElectronicsSim->setRandomEngine(engine); }
CastorDigiProducer::~CastorDigiProducer | ( | ) | [virtual] |
Definition at line 66 of file CastorDigiProducer.cc.
References theAmplifier, theCastorDigitizer, theCastorIntegratedShape, theCastorResponse, theCastorShape, theCoderFactory, theElectronicsSim, theHitCorrection, and theParameterMap.
{ delete theCastorDigitizer; delete theParameterMap; delete theCastorShape; delete theCastorIntegratedShape; delete theCastorResponse; delete theElectronicsSim; delete theAmplifier; delete theCoderFactory; delete theHitCorrection; }
void CastorDigiProducer::checkGeometry | ( | const edm::EventSetup & | eventSetup | ) | [private] |
make sure the digitizer has the correct list of all cells that exist in the geometry
Definition at line 143 of file CastorDigiProducer.cc.
References DetId::Calo, geometry, edm::EventSetup::get(), CaloTDigitizer< Traits >::setDetIds(), CaloHitResponse::setGeometry(), HcalCastorDetId::SubdetectorId, theCastorDigitizer, and theCastorResponse.
Referenced by produce().
{ // TODO find a way to avoid doing this every event edm::ESHandle<CaloGeometry> geometry; eventSetup.get<CaloGeometryRecord>().get(geometry); theCastorResponse->setGeometry(&*geometry); const vector<DetId>& castorCells = geometry->getValidDetIds(DetId::Calo, HcalCastorDetId::SubdetectorId); //std::cout<<"CastorDigiProducer::CheckGeometry number of cells: "<<castorCells.size()<<std::endl; theCastorDigitizer->setDetIds(castorCells); }
void CastorDigiProducer::fillFakeHits | ( | ) | [private] |
some hits in each subdetector, just for testing purposes
Definition at line 135 of file CastorDigiProducer.cc.
References DetId::rawId(), and theCastorHits.
{ HcalCastorDetId castorDetId(HcalCastorDetId::Section(2),true,1,1); PCaloHit castorHit(castorDetId.rawId(), 50.0, 0.); theCastorHits.push_back(castorHit); }
void CastorDigiProducer::produce | ( | edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [virtual] |
Produces the EDM products,
Implements edm::EDProducer.
Definition at line 79 of file CastorDigiProducer.cc.
References checkGeometry(), CastorHitCorrection::fillChargeSums(), edm::EventSetup::get(), edm::Event::getByLabel(), edm::ESHandle< T >::product(), edm::Handle< T >::product(), edm::Event::put(), CaloTDigitizer< Traits >::run(), CastorAmplifier::setDbService(), CastorSimParameterMap::setDbService(), CastorCoderFactory::setDbService(), theAmplifier, theCastorDigitizer, theCastorHits, theCoderFactory, theHitCorrection, and theParameterMap.
{ // get the appropriate gains, noises, & widths for this event edm::ESHandle<CastorDbService> conditions; eventSetup.get<CastorDbRecord>().get(conditions); theAmplifier->setDbService(conditions.product()); theCoderFactory->setDbService(conditions.product()); theParameterMap->setDbService(conditions.product()); edm::LogInfo("CastorDigiProducer") << "checking the geometry..."; // get the correct geometry checkGeometry(eventSetup); theCastorHits.clear(); // Step A: Get Inputs //edm::Handle<edm::PCaloHitContainer> castorcf; edm::Handle<CrossingFrame<PCaloHit> > castorcf; e.getByLabel("mix", "g4SimHitsCastorFI", castorcf); // test access to SimHits for HcalHits and ZDC hits std::auto_ptr<MixCollection<PCaloHit> > colcastor(new MixCollection<PCaloHit>(castorcf.product())); //fillFakeHits(); if(theHitCorrection != 0) { theHitCorrection->fillChargeSums(*colcastor); } // Step B: Create empty output std::auto_ptr<CastorDigiCollection> castorResult(new CastorDigiCollection()); // Step C: Invoke the algorithm, passing in inputs and getting back outputs. theCastorDigitizer->run(*colcastor, *castorResult); edm::LogInfo("CastorDigiProducer") << "HCAL/Castor digis : " << castorResult->size(); // Step D: Put outputs into event e.put(castorResult); }
void CastorDigiProducer::sortHits | ( | const edm::PCaloHitContainer & | hits | ) | [private] |
fills the vectors for each subdetector
Definition at line 122 of file CastorDigiProducer.cc.
References DetId::Calo, DetId::det(), HcalCastorDetId::SubdetectorId, DetId::subdetId(), and theCastorHits.
{ for(edm::PCaloHitContainer::const_iterator hitItr = hits.begin(); hitItr != hits.end(); ++hitItr){ DetId detId = hitItr->id(); if (detId.det()==DetId::Calo && detId.subdetId()==HcalCastorDetId::SubdetectorId){ theCastorHits.push_back(*hitItr); } else { edm::LogError("CastorDigiProducer") << "Bad Hit subdetector " << detId.subdetId(); } } }
CastorAmplifier* CastorDigiProducer::theAmplifier [private] |
Definition at line 49 of file CastorDigiProducer.h.
Referenced by CastorDigiProducer(), produce(), and ~CastorDigiProducer().
Definition at line 57 of file CastorDigiProducer.h.
Referenced by CastorDigiProducer(), checkGeometry(), produce(), and ~CastorDigiProducer().
Definition at line 53 of file CastorDigiProducer.h.
Referenced by CastorDigiProducer().
std::vector<PCaloHit> CastorDigiProducer::theCastorHits [private] |
Definition at line 59 of file CastorDigiProducer.h.
Referenced by fillFakeHits(), produce(), and sortHits().
Definition at line 45 of file CastorDigiProducer.h.
Referenced by ~CastorDigiProducer().
Definition at line 47 of file CastorDigiProducer.h.
Referenced by CastorDigiProducer(), checkGeometry(), and ~CastorDigiProducer().
CaloVShape* CastorDigiProducer::theCastorShape [private] |
Definition at line 44 of file CastorDigiProducer.h.
Referenced by ~CastorDigiProducer().
Definition at line 50 of file CastorDigiProducer.h.
Referenced by CastorDigiProducer(), produce(), and ~CastorDigiProducer().
Definition at line 51 of file CastorDigiProducer.h.
Referenced by CastorDigiProducer(), and ~CastorDigiProducer().
Definition at line 55 of file CastorDigiProducer.h.
Referenced by CastorDigiProducer(), produce(), and ~CastorDigiProducer().
Definition at line 43 of file CastorDigiProducer.h.
Referenced by CastorDigiProducer(), produce(), and ~CastorDigiProducer().