#include <CastorDigiProducer.h>
Definition at line 26 of file CastorDigiProducer.h.
typedef CaloTDigitizer<CastorDigitizerTraits> CastorDigiProducer::CastorDigitizer [private] |
Reconstruction algorithm
Definition at line 49 of file CastorDigiProducer.h.
CastorDigiProducer::CastorDigiProducer | ( | const edm::ParameterSet & | ps, |
edm::EDProducer & | mixMod | ||
) | [explicit] |
Definition at line 21 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() { mixMod.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 65 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::accumulate | ( | edm::Event const & | e, |
edm::EventSetup const & | c | ||
) | [virtual] |
Implements DigiAccumulatorMixMod.
Definition at line 104 of file CastorDigiProducer.cc.
References accumulateCaloHits(), edm::Event::getByLabel(), and edm::Handle< T >::product().
{ // Step A: Get and accumulate digitized hits edm::InputTag castorTag("g4SimHits", "CastorFI"); edm::Handle<std::vector<PCaloHit> > castorHandle; e.getByLabel(castorTag, castorHandle); accumulateCaloHits(*castorHandle.product(), 0); }
void CastorDigiProducer::accumulate | ( | PileUpEventPrincipal const & | e, |
edm::EventSetup const & | c | ||
) | [virtual] |
Implements DigiAccumulatorMixMod.
Definition at line 113 of file CastorDigiProducer.cc.
References accumulateCaloHits(), PileUpEventPrincipal::bunchCrossing(), PileUpEventPrincipal::getByLabel(), and edm::Handle< T >::product().
{ // Step A: Get and accumulate digitized hits edm::InputTag castorTag("g4SimHits", "CastorFI"); edm::Handle<std::vector<PCaloHit> > castorHandle; e.getByLabel(castorTag, castorHandle); accumulateCaloHits(*castorHandle.product(), e.bunchCrossing()); }
void CastorDigiProducer::accumulateCaloHits | ( | std::vector< PCaloHit > const & | hcalHits, |
int | bunchCrossing | ||
) | [private] |
Definition at line 95 of file CastorDigiProducer.cc.
References CaloTDigitizer< Traits >::add(), CastorHitCorrection::fillChargeSums(), theCastorDigitizer, and theHitCorrection.
Referenced by accumulate().
{ //fillFakeHits(); if(theHitCorrection != 0) { theHitCorrection->fillChargeSums(hcalHits); } theCastorDigitizer->add(hcalHits, bunchCrossing); }
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 157 of file CastorDigiProducer.cc.
References DetId::Calo, geometry, edm::EventSetup::get(), CaloTDigitizer< Traits >::setDetIds(), CaloHitResponse::setGeometry(), HcalCastorDetId::SubdetectorId, theCastorDigitizer, and theCastorResponse.
Referenced by initializeEvent().
{ // TODO find a way to avoid doing this every event edm::ESHandle<CaloGeometry> geometry; eventSetup.get<CaloGeometryRecord>().get(geometry); theCastorResponse->setGeometry(&*geometry); const std::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 150 of file CastorDigiProducer.cc.
References DetId::rawId(), and theCastorHits.
{ HcalCastorDetId castorDetId(HcalCastorDetId::Section(2),true,1,1); theCastorHits.emplace_back(castorDetId.rawId(), 50.0, 0.); }
void CastorDigiProducer::finalizeEvent | ( | edm::Event & | e, |
edm::EventSetup const & | c | ||
) | [virtual] |
Implements DigiAccumulatorMixMod.
Definition at line 122 of file CastorDigiProducer.cc.
References edm::Event::put(), CaloTDigitizer< Traits >::run(), and theCastorDigitizer.
{ // Step B: Create empty output std::auto_ptr<CastorDigiCollection> castorResult(new CastorDigiCollection()); // Step C: Invoke the algorithm, getting back outputs. theCastorDigitizer->run(*castorResult); edm::LogInfo("CastorDigiProducer") << "HCAL/Castor digis : " << castorResult->size(); // Step D: Put outputs into event e.put(castorResult); }
void CastorDigiProducer::initializeEvent | ( | edm::Event const & | e, |
edm::EventSetup const & | c | ||
) | [virtual] |
Implements DigiAccumulatorMixMod.
Definition at line 77 of file CastorDigiProducer.cc.
References checkGeometry(), edm::EventSetup::get(), CaloTDigitizer< Traits >::initializeHits(), edm::ESHandle< T >::product(), CastorAmplifier::setDbService(), CastorSimParameterMap::setDbService(), CastorCoderFactory::setDbService(), theAmplifier, theCastorDigitizer, theCastorHits, theCoderFactory, 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(); theCastorDigitizer->initializeHits(); }
void CastorDigiProducer::sortHits | ( | const edm::PCaloHitContainer & | hits | ) | [private] |
fills the vectors for each subdetector
Definition at line 137 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 57 of file CastorDigiProducer.h.
Referenced by CastorDigiProducer(), initializeEvent(), and ~CastorDigiProducer().
Definition at line 65 of file CastorDigiProducer.h.
Referenced by accumulateCaloHits(), CastorDigiProducer(), checkGeometry(), finalizeEvent(), initializeEvent(), and ~CastorDigiProducer().
Definition at line 61 of file CastorDigiProducer.h.
Referenced by CastorDigiProducer().
std::vector<PCaloHit> CastorDigiProducer::theCastorHits [private] |
Definition at line 67 of file CastorDigiProducer.h.
Referenced by fillFakeHits(), initializeEvent(), and sortHits().
Definition at line 53 of file CastorDigiProducer.h.
Referenced by ~CastorDigiProducer().
Definition at line 55 of file CastorDigiProducer.h.
Referenced by CastorDigiProducer(), checkGeometry(), and ~CastorDigiProducer().
CaloVShape* CastorDigiProducer::theCastorShape [private] |
Definition at line 52 of file CastorDigiProducer.h.
Referenced by ~CastorDigiProducer().
Definition at line 58 of file CastorDigiProducer.h.
Referenced by CastorDigiProducer(), initializeEvent(), and ~CastorDigiProducer().
Definition at line 59 of file CastorDigiProducer.h.
Referenced by CastorDigiProducer(), and ~CastorDigiProducer().
Definition at line 63 of file CastorDigiProducer.h.
Referenced by accumulateCaloHits(), CastorDigiProducer(), and ~CastorDigiProducer().
Definition at line 51 of file CastorDigiProducer.h.
Referenced by CastorDigiProducer(), initializeEvent(), and ~CastorDigiProducer().