CMS 3D CMS Logo

HcalDigiProducer Class Reference

#include <SimCalorimetry/HcalSimProducers/src/HcalDigiProducer.h>

Inheritance diagram for HcalDigiProducer:

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

List of all members.

Public Member Functions

 HcalDigiProducer (const edm::ParameterSet &ps)
virtual void produce (edm::Event &e, const edm::EventSetup &c)
 Produces the EDM products,.
virtual ~HcalDigiProducer ()

Private Types

typedef CaloTDigitizer
< HBHEDigitizerTraits
HBHEDigitizer
 Reconstruction algorithm.
typedef CaloTDigitizer
< HFDigitizerTraits
HFDigitizer
typedef CaloTDigitizer
< HODigitizerTraits
HODigitizer
typedef CaloTDigitizer
< ZDCDigitizerTraits
ZDCDigitizer

Private Member Functions

void checkGeometry (const edm::EventSetup &eventSetup)
 make sure the digitizer has the correct list of all cells that exist in the geometry
void fillFakeHits ()
 some hits in each subdetector, just for testing purposes

Private Attributes

bool doZDC
std::string hitsProducer_
HcalAmplifiertheAmplifier
HcalCoderFactorytheCoderFactory
HcalElectronicsSimtheElectronicsSim
HBHEDigitizertheHBHEDigitizer
HBHEHitFilter theHBHEHitFilter
CaloHitResponsetheHBHEResponse
CaloVShapetheHcalIntegratedShape
CaloVShapetheHcalShape
HFDigitizertheHFDigitizer
HFHitFilter theHFHitFilter
CaloVShapetheHFIntegratedShape
CaloHitResponsetheHFResponse
CaloVShapetheHFShape
HcalHitCorrectiontheHitCorrection
HODigitizertheHODigitizer
HOHitFilter theHOHitFilter
CaloHitResponsetheHOResponse
CaloVNoiseSignalGeneratortheHPDNoiseGenerator
HcalSimParameterMaptheParameterMap
ZDCDigitizertheZDCDigitizer
ZDCHitFilter theZDCHitFilter
CaloVShapetheZDCIntegratedShape
CaloHitResponsetheZDCResponse
CaloVShapetheZDCShape


Detailed Description

Definition at line 27 of file HcalDigiProducer.h.


Member Typedef Documentation

typedef CaloTDigitizer<HBHEDigitizerTraits> HcalDigiProducer::HBHEDigitizer [private]

Reconstruction algorithm.

Definition at line 45 of file HcalDigiProducer.h.

typedef CaloTDigitizer<HFDigitizerTraits> HcalDigiProducer::HFDigitizer [private]

Definition at line 47 of file HcalDigiProducer.h.

typedef CaloTDigitizer<HODigitizerTraits> HcalDigiProducer::HODigitizer [private]

Definition at line 46 of file HcalDigiProducer.h.

typedef CaloTDigitizer<ZDCDigitizerTraits> HcalDigiProducer::ZDCDigitizer [private]

Definition at line 48 of file HcalDigiProducer.h.


Constructor & Destructor Documentation

HcalDigiProducer::HcalDigiProducer ( const edm::ParameterSet ps  )  [explicit]

Definition at line 22 of file HcalDigiProducer.cc.

References HcalCoderFactory::DB, Exception, edm::ParameterSet::getParameter(), hitsProducer_, edm::Service< T >::isAvailable(), CaloHitResponse::setHitCorrection(), CaloHitResponse::setHitFilter(), CaloTDigitizer< Traits >::setNoiseSignalGenerator(), HcalElectronicsSim::setRandomEngine(), theAmplifier, theCoderFactory, theElectronicsSim, theHBHEDigitizer, theHBHEHitFilter, theHBHEResponse, theHFDigitizer, theHFHitFilter, theHFResponse, theHitCorrection, theHODigitizer, theHOHitFilter, theHOResponse, theHPDNoiseGenerator, theParameterMap, theZDCDigitizer, theZDCHitFilter, and theZDCResponse.

00023 : theParameterMap(new HcalSimParameterMap(ps)),
00024   theHcalShape(new HcalShape()),
00025   theHFShape(new HFShape()),
00026   theZDCShape(new ZDCShape()),
00027   theHcalIntegratedShape(new CaloShapeIntegrator(theHcalShape)),
00028   theHFIntegratedShape(new CaloShapeIntegrator(theHFShape)),
00029   theZDCIntegratedShape(new CaloShapeIntegrator(theZDCShape)),
00030   theHBHEResponse(new CaloHitResponse(theParameterMap, theHcalIntegratedShape)),
00031   theHOResponse(new CaloHitResponse(theParameterMap, theHcalIntegratedShape)),   
00032   theHFResponse(new CaloHitResponse(theParameterMap, theHFIntegratedShape)),
00033   theZDCResponse(new CaloHitResponse(theParameterMap, theZDCIntegratedShape)),
00034   theAmplifier(0),
00035   theCoderFactory(0),
00036   theElectronicsSim(0),
00037   theHitCorrection(0),
00038   theHPDNoiseGenerator(0),
00039   theHBHEDigitizer(0),
00040   theHODigitizer(0),
00041   theHFDigitizer(0),
00042   theZDCDigitizer(0),
00043   doZDC(true)
00044 {
00045   
00046   produces<HBHEDigiCollection>();
00047   produces<HODigiCollection>();
00048   produces<HFDigiCollection>();
00049   produces<ZDCDigiCollection>();
00050 
00051   theHBHEResponse->setHitFilter(&theHBHEHitFilter);
00052   theHOResponse->setHitFilter(&theHOHitFilter);
00053   theHFResponse->setHitFilter(&theHFHitFilter);
00054   theZDCResponse->setHitFilter(&theZDCHitFilter);
00055 
00056   bool doTimeSlew = ps.getParameter<bool>("doTimeSlew");
00057   if(doTimeSlew) {
00058     // no time slewing for HF
00059     theHitCorrection = new HcalHitCorrection(theParameterMap);
00060     theHBHEResponse->setHitCorrection(theHitCorrection);
00061     theHOResponse->setHitCorrection(theHitCorrection);
00062     theZDCResponse->setHitCorrection(theHitCorrection);
00063   }
00064 
00065   bool doNoise = ps.getParameter<bool>("doNoise");
00066   theAmplifier = new HcalAmplifier(theParameterMap, doNoise);
00067   theCoderFactory = new HcalCoderFactory(HcalCoderFactory::DB);
00068   theElectronicsSim = new HcalElectronicsSim(theAmplifier, theCoderFactory);
00069 
00070   theHBHEDigitizer = new HBHEDigitizer(theHBHEResponse, theElectronicsSim, doNoise);
00071   theHODigitizer = new HODigitizer(theHOResponse, theElectronicsSim, doNoise);
00072   theHFDigitizer = new HFDigitizer(theHFResponse, theElectronicsSim, doNoise);
00073   theZDCDigitizer = new ZDCDigitizer(theZDCResponse, theElectronicsSim, doNoise);
00074 
00075   bool doHPDNoise = ps.getParameter<bool>("doHPDNoise");
00076   if(doHPDNoise) {
00077     theHPDNoiseGenerator = new HPDNoiseGenerator(theParameterMap); 
00078     theHBHEDigitizer->setNoiseSignalGenerator(theHPDNoiseGenerator);
00079   }
00080 
00081   edm::Service<edm::RandomNumberGenerator> rng;
00082   if ( ! rng.isAvailable()) {
00083     throw cms::Exception("Configuration")
00084       << "HcalDigiProducer requires the RandomNumberGeneratorService\n"
00085          "which is not present in the configuration file.  You must add the service\n"
00086          "in the configuration file or remove the modules that require it.";
00087   }
00088 
00089   CLHEP::HepRandomEngine& engine = rng->getEngine();
00090   theAmplifier->setRandomEngine(engine);
00091   theElectronicsSim->setRandomEngine(engine);
00092 
00093   hitsProducer_ = ps.getParameter<std::string>("hitsProducer");
00094 
00095 }

HcalDigiProducer::~HcalDigiProducer (  )  [virtual]

Definition at line 98 of file HcalDigiProducer.cc.

References theAmplifier, theCoderFactory, theElectronicsSim, theHBHEDigitizer, theHBHEResponse, theHcalIntegratedShape, theHcalShape, theHFDigitizer, theHFIntegratedShape, theHFResponse, theHFShape, theHitCorrection, theHODigitizer, theHOResponse, theHPDNoiseGenerator, theParameterMap, theZDCDigitizer, theZDCIntegratedShape, theZDCResponse, and theZDCShape.

00098                                     {
00099   delete theHBHEDigitizer;
00100   delete theHODigitizer;
00101   delete theHFDigitizer;
00102   delete theZDCDigitizer;
00103   delete theParameterMap;
00104   delete theHcalShape;
00105   delete theHFShape;
00106   delete theZDCShape;
00107   delete theHcalIntegratedShape;
00108   delete theHFIntegratedShape;
00109   delete theZDCIntegratedShape;
00110   delete theHBHEResponse;
00111   delete theHOResponse;
00112   delete theHFResponse;
00113   delete theZDCResponse;
00114   delete theElectronicsSim;
00115   delete theAmplifier;
00116   delete theCoderFactory;
00117   delete theHitCorrection;
00118   delete theHPDNoiseGenerator;
00119 }


Member Function Documentation

void HcalDigiProducer::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 179 of file HcalDigiProducer.cc.

References DetId::Calo, doZDC, edm::EventSetup::get(), DetId::Hcal, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, CaloTDigitizer< Traits >::setDetIds(), CaloHitResponse::setGeometry(), HcalZDCDetId::SubdetectorId, theHBHEDigitizer, theHBHEResponse, theHFDigitizer, theHFResponse, theHODigitizer, theHOResponse, theZDCDigitizer, and theZDCResponse.

Referenced by produce().

00179                                                                      {
00180   // TODO find a way to avoid doing this every event
00181   edm::ESHandle<CaloGeometry> geometry;
00182   eventSetup.get<CaloGeometryRecord>().get(geometry);
00183   theHBHEResponse->setGeometry(&*geometry);
00184   theHOResponse->setGeometry(&*geometry);
00185   theHFResponse->setGeometry(&*geometry);
00186   theZDCResponse->setGeometry(&*geometry);
00187 
00188   const vector<DetId>& hbCells =  geometry->getValidDetIds(DetId::Hcal, HcalBarrel);
00189   const vector<DetId>& heCells =  geometry->getValidDetIds(DetId::Hcal, HcalEndcap);
00190   const vector<DetId>& hoCells =  geometry->getValidDetIds(DetId::Hcal, HcalOuter);
00191   const vector<DetId>& hfCells =  geometry->getValidDetIds(DetId::Hcal, HcalForward);
00192   const vector<DetId>& zdcCells = geometry->getValidDetIds(DetId::Calo, HcalZDCDetId::SubdetectorId);
00193 
00194   //std::cout<<"HcalDigiProducer::CheckGeometry number of cells: "<<zdcCells.size()<<std::endl;
00195   if(zdcCells.size()==0) doZDC = false;
00196   // combine HB & HE
00197 
00198   vector<DetId> hbheCells = hbCells;
00199   hbheCells.insert(hbheCells.end(), heCells.begin(), heCells.end());
00200 
00201   theHBHEDigitizer->setDetIds(hbheCells);
00202   theHODigitizer->setDetIds(hoCells);
00203   theHFDigitizer->setDetIds(hfCells);
00204   theZDCDigitizer->setDetIds(zdcCells); 
00205 }

void HcalDigiProducer::fillFakeHits (  )  [private]

some hits in each subdetector, just for testing purposes

void HcalDigiProducer::produce ( edm::Event e,
const edm::EventSetup c 
) [virtual]

Produces the EDM products,.

Implements edm::EDProducer.

Definition at line 122 of file HcalDigiProducer.cc.

References checkGeometry(), HcalHitCorrection::clear(), parsecf::pyparsing::col(), doZDC, HcalHitCorrection::fillChargeSums(), edm::EventSetup::get(), edm::Event::getByLabel(), hitsProducer_, edm::ESHandle< T >::product(), edm::Handle< T >::product(), edm::Event::put(), CaloTDigitizer< Traits >::run(), HcalSimParameterMap::setDbService(), HcalCoderFactory::setDbService(), HcalAmplifier::setDbService(), theAmplifier, theCoderFactory, theHBHEDigitizer, theHFDigitizer, theHitCorrection, theHODigitizer, and theParameterMap.

00122                                                                            {
00123   // get the appropriate gains, noises, & widths for this event
00124   edm::ESHandle<HcalDbService> conditions;
00125   eventSetup.get<HcalDbRecord>().get(conditions);
00126   theAmplifier->setDbService(conditions.product());
00127   theCoderFactory->setDbService(conditions.product());
00128   theParameterMap->setDbService(conditions.product());
00129 
00130   // get the correct geometry
00131   checkGeometry(eventSetup);
00132   
00133   // Step A: Get Inputs
00134   edm::Handle<CrossingFrame<PCaloHit> > cf, zdccf;
00135 
00136   const std::string hcalHitsName(hitsProducer_+"HcalHits");
00137   const std::string zdcHitsName(hitsProducer_+"ZDCHITS");
00138 
00139   e.getByLabel("mix", hcalHitsName ,cf);
00140   e.getByLabel("mix", zdcHitsName , zdccf);
00141 
00142   // test access to SimHits for HcalHits and ZDC hits
00143   std::auto_ptr<MixCollection<PCaloHit> > col(new MixCollection<PCaloHit>(cf.product()));
00144   std::auto_ptr<MixCollection<PCaloHit> > colzdc(new MixCollection<PCaloHit>(zdccf.product()));
00145 
00146   if(theHitCorrection != 0)
00147   {
00148     theHitCorrection->clear();
00149     theHitCorrection->fillChargeSums(*col);
00150     theHitCorrection->fillChargeSums(*colzdc);
00151   }
00152   // Step B: Create empty output
00153 
00154   std::auto_ptr<HBHEDigiCollection> hbheResult(new HBHEDigiCollection());
00155   std::auto_ptr<HODigiCollection> hoResult(new HODigiCollection());
00156   std::auto_ptr<HFDigiCollection> hfResult(new HFDigiCollection());
00157   std::auto_ptr<ZDCDigiCollection> zdcResult(new ZDCDigiCollection());
00158 
00159   // Step C: Invoke the algorithm, passing in inputs and getting back outputs.
00160   theHBHEDigitizer->run(*col, *hbheResult);
00161   theHODigitizer->run(*col, *hoResult);
00162   theHFDigitizer->run(*col, *hfResult);
00163   if(doZDC) {
00164     //theZDCDigitizer->run(*colzdc, *zdcResult);
00165   }
00166   edm::LogInfo("HcalDigiProducer") << "HCAL HBHE digis : " << hbheResult->size();
00167   edm::LogInfo("HcalDigiProducer") << "HCAL HO digis   : " << hoResult->size();
00168   edm::LogInfo("HcalDigiProducer") << "HCAL HF digis   : " << hfResult->size();
00169   edm::LogInfo("HcalDigiProducer") << "HCAL ZDC digis   : " << zdcResult->size();
00170 
00171   // Step D: Put outputs into event
00172   e.put(hbheResult);
00173   e.put(hoResult);
00174   e.put(hfResult);
00175   e.put(zdcResult);
00176 }


Member Data Documentation

bool HcalDigiProducer::doZDC [private]

Definition at line 80 of file HcalDigiProducer.h.

Referenced by checkGeometry(), and produce().

std::string HcalDigiProducer::hitsProducer_ [private]

Definition at line 82 of file HcalDigiProducer.h.

Referenced by HcalDigiProducer(), and produce().

HcalAmplifier* HcalDigiProducer::theAmplifier [private]

Definition at line 63 of file HcalDigiProducer.h.

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

HcalCoderFactory* HcalDigiProducer::theCoderFactory [private]

Definition at line 64 of file HcalDigiProducer.h.

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

HcalElectronicsSim* HcalDigiProducer::theElectronicsSim [private]

Definition at line 65 of file HcalDigiProducer.h.

Referenced by HcalDigiProducer(), and ~HcalDigiProducer().

HBHEDigitizer* HcalDigiProducer::theHBHEDigitizer [private]

Definition at line 75 of file HcalDigiProducer.h.

Referenced by checkGeometry(), HcalDigiProducer(), produce(), and ~HcalDigiProducer().

HBHEHitFilter HcalDigiProducer::theHBHEHitFilter [private]

Definition at line 67 of file HcalDigiProducer.h.

Referenced by HcalDigiProducer().

CaloHitResponse* HcalDigiProducer::theHBHEResponse [private]

Definition at line 58 of file HcalDigiProducer.h.

Referenced by checkGeometry(), HcalDigiProducer(), and ~HcalDigiProducer().

CaloVShape* HcalDigiProducer::theHcalIntegratedShape [private]

Definition at line 54 of file HcalDigiProducer.h.

Referenced by ~HcalDigiProducer().

CaloVShape* HcalDigiProducer::theHcalShape [private]

Definition at line 51 of file HcalDigiProducer.h.

Referenced by ~HcalDigiProducer().

HFDigitizer* HcalDigiProducer::theHFDigitizer [private]

Definition at line 77 of file HcalDigiProducer.h.

Referenced by checkGeometry(), HcalDigiProducer(), produce(), and ~HcalDigiProducer().

HFHitFilter HcalDigiProducer::theHFHitFilter [private]

Definition at line 68 of file HcalDigiProducer.h.

Referenced by HcalDigiProducer().

CaloVShape* HcalDigiProducer::theHFIntegratedShape [private]

Definition at line 55 of file HcalDigiProducer.h.

Referenced by ~HcalDigiProducer().

CaloHitResponse* HcalDigiProducer::theHFResponse [private]

Definition at line 60 of file HcalDigiProducer.h.

Referenced by checkGeometry(), HcalDigiProducer(), and ~HcalDigiProducer().

CaloVShape* HcalDigiProducer::theHFShape [private]

Definition at line 52 of file HcalDigiProducer.h.

Referenced by ~HcalDigiProducer().

HcalHitCorrection* HcalDigiProducer::theHitCorrection [private]

Definition at line 72 of file HcalDigiProducer.h.

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

HODigitizer* HcalDigiProducer::theHODigitizer [private]

Definition at line 76 of file HcalDigiProducer.h.

Referenced by checkGeometry(), HcalDigiProducer(), produce(), and ~HcalDigiProducer().

HOHitFilter HcalDigiProducer::theHOHitFilter [private]

Definition at line 69 of file HcalDigiProducer.h.

Referenced by HcalDigiProducer().

CaloHitResponse* HcalDigiProducer::theHOResponse [private]

Definition at line 59 of file HcalDigiProducer.h.

Referenced by checkGeometry(), HcalDigiProducer(), and ~HcalDigiProducer().

CaloVNoiseSignalGenerator* HcalDigiProducer::theHPDNoiseGenerator [private]

Definition at line 73 of file HcalDigiProducer.h.

Referenced by HcalDigiProducer(), and ~HcalDigiProducer().

HcalSimParameterMap* HcalDigiProducer::theParameterMap [private]

Definition at line 50 of file HcalDigiProducer.h.

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

ZDCDigitizer* HcalDigiProducer::theZDCDigitizer [private]

Definition at line 78 of file HcalDigiProducer.h.

Referenced by checkGeometry(), HcalDigiProducer(), and ~HcalDigiProducer().

ZDCHitFilter HcalDigiProducer::theZDCHitFilter [private]

Definition at line 70 of file HcalDigiProducer.h.

Referenced by HcalDigiProducer().

CaloVShape* HcalDigiProducer::theZDCIntegratedShape [private]

Definition at line 56 of file HcalDigiProducer.h.

Referenced by ~HcalDigiProducer().

CaloHitResponse* HcalDigiProducer::theZDCResponse [private]

Definition at line 61 of file HcalDigiProducer.h.

Referenced by checkGeometry(), HcalDigiProducer(), and ~HcalDigiProducer().

CaloVShape* HcalDigiProducer::theZDCShape [private]

Definition at line 53 of file HcalDigiProducer.h.

Referenced by ~HcalDigiProducer().


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