#include <SimCalorimetry/CastorSim/plugins/CastorDigiProducer.h>
Definition at line 21 of file CastorDigiProducer.h.
typedef CaloTDigitizer<CastorDigitizerTraits> CastorDigiProducer::CastorDigitizer [private] |
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.
00023 : theParameterMap(new CastorSimParameterMap(ps)), 00024 theCastorShape(new CastorShape()), 00025 theCastorIntegratedShape(new CaloShapeIntegrator(theCastorShape)), 00026 theCastorResponse(new CaloHitResponse(theParameterMap, theCastorIntegratedShape)), 00027 theAmplifier(0), 00028 theCoderFactory(0), 00029 theElectronicsSim(0), 00030 theHitCorrection(0), 00031 theCastorDigitizer(0), 00032 theCastorHits() 00033 { 00034 00035 produces<CastorDigiCollection>(); 00036 00037 theCastorResponse->setHitFilter(&theCastorHitFilter); 00038 00039 bool doTimeSlew = ps.getParameter<bool>("doTimeSlew"); 00040 if(doTimeSlew) { 00041 // no time slewing for HF 00042 theCastorResponse->setHitCorrection(theHitCorrection); 00043 } 00044 00045 bool doNoise = ps.getParameter<bool>("doNoise"); 00046 theAmplifier = new CastorAmplifier(theParameterMap, doNoise); 00047 theCoderFactory = new CastorCoderFactory(CastorCoderFactory::DB); 00048 theElectronicsSim = new CastorElectronicsSim(theAmplifier, theCoderFactory); 00049 00050 theCastorDigitizer = new CastorDigitizer(theCastorResponse, theElectronicsSim, doNoise); 00051 00052 edm::Service<edm::RandomNumberGenerator> rng; 00053 if ( ! rng.isAvailable()) { 00054 throw cms::Exception("Configuration") 00055 << "CastorDigiProducer requires the RandomNumberGeneratorService\n" 00056 "which is not present in the configuration file. You must add the service\n" 00057 "in the configuration file or remove the modules that require it."; 00058 } 00059 00060 CLHEP::HepRandomEngine& engine = rng->getEngine(); 00061 theAmplifier->setRandomEngine(engine); 00062 theElectronicsSim->setRandomEngine(engine); 00063 }
CastorDigiProducer::~CastorDigiProducer | ( | ) | [virtual] |
Definition at line 66 of file CastorDigiProducer.cc.
References theAmplifier, theCastorDigitizer, theCastorIntegratedShape, theCastorResponse, theCastorShape, theCoderFactory, theElectronicsSim, theHitCorrection, and theParameterMap.
00066 { 00067 delete theCastorDigitizer; 00068 delete theParameterMap; 00069 delete theCastorShape; 00070 delete theCastorIntegratedShape; 00071 delete theCastorResponse; 00072 delete theElectronicsSim; 00073 delete theAmplifier; 00074 delete theCoderFactory; 00075 delete theHitCorrection; 00076 }
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 140 of file CastorDigiProducer.cc.
References DetId::Calo, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), edm::EventSetup::get(), CaloTDigitizer< Traits >::setDetIds(), CaloHitResponse::setGeometry(), HcalCastorDetId::SubdetectorId, theCastorDigitizer, and theCastorResponse.
Referenced by produce().
00140 { 00141 // TODO find a way to avoid doing this every event 00142 edm::ESHandle<CaloGeometry> geometry; 00143 eventSetup.get<CaloGeometryRecord>().get(geometry); 00144 theCastorResponse->setGeometry(&*geometry); 00145 00146 const vector<DetId>& castorCells = geometry->getValidDetIds(DetId::Calo, HcalCastorDetId::SubdetectorId); 00147 00148 std::cout<<"HcalDigiProducer::CheckGeometry number of cells: "<<castorCells.size()<<std::endl; 00149 theCastorDigitizer->setDetIds(castorCells); 00150 }
void CastorDigiProducer::fillFakeHits | ( | ) | [private] |
some hits in each subdetector, just for testing purposes
Definition at line 132 of file CastorDigiProducer.cc.
References DetId::rawId(), and theCastorHits.
00132 { 00133 HcalCastorDetId castorDetId(HcalCastorDetId::Section(2),true,1,1); 00134 PCaloHit castorHit(castorDetId.rawId(), 50.0, 0.); 00135 00136 theCastorHits.push_back(castorHit); 00137 }
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.
00079 { 00080 // get the appropriate gains, noises, & widths for this event 00081 edm::ESHandle<CastorDbService> conditions; 00082 eventSetup.get<CastorDbRecord>().get(conditions); 00083 theAmplifier->setDbService(conditions.product()); 00084 theCoderFactory->setDbService(conditions.product()); 00085 theParameterMap->setDbService(conditions.product()); 00086 00087 // get the correct geometry 00088 checkGeometry(eventSetup); 00089 00090 theCastorHits.clear(); 00091 00092 // Step A: Get Inputs 00093 edm::Handle<CrossingFrame<PCaloHit> > castorcf; 00094 e.getByLabel("mix", "CastorHits", castorcf); 00095 00096 // test access to SimHits for HcalHits and ZDC hits 00097 std::auto_ptr<MixCollection<PCaloHit> > colcastor(new MixCollection<PCaloHit>(castorcf.product())); 00098 00099 //fillFakeHits(); 00100 00101 if(theHitCorrection != 0) 00102 { 00103 theHitCorrection->fillChargeSums(*colcastor); 00104 } 00105 // Step B: Create empty output 00106 00107 std::auto_ptr<CastorDigiCollection> castorResult(new CastorDigiCollection()); 00108 00109 // Step C: Invoke the algorithm, passing in inputs and getting back outputs. 00110 theCastorDigitizer->run(*colcastor, *castorResult); 00111 00112 edm::LogInfo("CastorDigiProducer") << "HCAL/Castor digis : " << castorResult->size(); 00113 00114 // Step D: Put outputs into event 00115 e.put(castorResult); 00116 }
void CastorDigiProducer::sortHits | ( | const edm::PCaloHitContainer & | hits | ) | [private] |
fills the vectors for each subdetector
Definition at line 119 of file CastorDigiProducer.cc.
References DetId::Calo, DetId::det(), detId, HcalCastorDetId::SubdetectorId, DetId::subdetId(), and theCastorHits.
00119 { 00120 for(edm::PCaloHitContainer::const_iterator hitItr = hits.begin(); 00121 hitItr != hits.end(); ++hitItr){ 00122 DetId detId = hitItr->id(); 00123 if (detId.det()==DetId::Calo && detId.subdetId()==HcalCastorDetId::SubdetectorId){ 00124 theCastorHits.push_back(*hitItr); 00125 } 00126 else { 00127 edm::LogError("CastorDigiProducer") << "Bad Hit subdetector " << detId.subdetId(); 00128 } 00129 } 00130 }
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().
std::vector<PCaloHit> CastorDigiProducer::theCastorHits [private] |
Definition at line 59 of file CastorDigiProducer.h.
Referenced by fillFakeHits(), produce(), and sortHits().
Definition at line 47 of file CastorDigiProducer.h.
Referenced by CastorDigiProducer(), checkGeometry(), and ~CastorDigiProducer().
CaloVShape* CastorDigiProducer::theCastorShape [private] |
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().