CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
CastorDigiProducer Class Reference

#include <CastorDigiProducer.h>

Inheritance diagram for CastorDigiProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 CastorDigiProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &e, const edm::EventSetup &c)
 
virtual ~CastorDigiProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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 More...
 
void sortHits (const edm::PCaloHitContainer &hits)
 fills the vectors for each subdetector More...
 

Private Attributes

CastorAmplifiertheAmplifier
 
CastorDigitizertheCastorDigitizer
 
CastorHitFilter theCastorHitFilter
 
std::vector< PCaloHittheCastorHits
 
CaloVShapetheCastorIntegratedShape
 
CaloHitResponsetheCastorResponse
 
CaloVShapetheCastorShape
 
CastorCoderFactorytheCoderFactory
 
CastorElectronicsSimtheElectronicsSim
 
CastorHitCorrectiontheHitCorrection
 
CastorSimParameterMaptheParameterMap
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 21 of file CastorDigiProducer.h.

Member Typedef Documentation

Reconstruction algorithm

Definition at line 41 of file CastorDigiProducer.h.

Constructor & Destructor Documentation

CastorDigiProducer::CastorDigiProducer ( const edm::ParameterSet ps)
explicit

Definition at line 22 of file CastorDigiProducer.cc.

References CastorCoderFactory::DB, edm::hlt::Exception, edm::RandomNumberGenerator::getEngine(), edm::ParameterSet::getParameter(), edm::Service< T >::isAvailable(), CaloHitResponse::setHitCorrection(), CaloHitResponse::setHitFilter(), CastorElectronicsSim::setRandomEngine(), theAmplifier, theCastorDigitizer, theCastorHitFilter, theCastorResponse, theCoderFactory, theElectronicsSim, theHitCorrection, and theParameterMap.

27  theAmplifier(0),
28  theCoderFactory(0),
33 {
34 
35 produces<CastorDigiCollection>();
36 
38 
39 bool doTimeSlew = ps.getParameter<bool>("doTimeSlew");
40  if(doTimeSlew) {
41  // no time slewing for HF
43  }
44 
45  bool doNoise = ps.getParameter<bool>("doNoise");
49 
51 
53  if ( ! rng.isAvailable()) {
54  throw cms::Exception("Configuration")
55  << "CastorDigiProducer requires the RandomNumberGeneratorService\n"
56  "which is not present in the configuration file. You must add the service\n"
57  "in the configuration file or remove the modules that require it.";
58  }
59 
60  CLHEP::HepRandomEngine& engine = rng->getEngine();
61  theAmplifier->setRandomEngine(engine);
63 }
T getParameter(std::string const &) const
CastorAmplifier * theAmplifier
CaloVShape * theCastorShape
CaloTDigitizer< CastorDigitizerTraits > CastorDigitizer
CastorSimParameterMap * theParameterMap
CastorElectronicsSim * theElectronicsSim
CastorHitFilter theCastorHitFilter
void setHitFilter(const CaloVHitFilter *filter)
if you want to reject hits, for example, from a certain subdetector, set this
Creates electronics signals from hits.
CaloHitResponse * theCastorResponse
bool isAvailable() const
Definition: Service.h:47
std::vector< PCaloHit > theCastorHits
virtual CLHEP::HepRandomEngine & getEngine() const =0
Use this to get the random number engine, this is the only function most users should call...
void setRandomEngine(CLHEP::HepRandomEngine &engine)
CastorHitCorrection * theHitCorrection
CastorDigitizer * theCastorDigitizer
void setHitCorrection(const CaloVHitCorrection *hitCorrection)
If you want to correct hits, for attenuation or delay, set this.
CastorCoderFactory * theCoderFactory
shaper for Castor
Definition: CastorShape.h:16
CaloVShape * theCastorIntegratedShape
CastorDigiProducer::~CastorDigiProducer ( )
virtual

Definition at line 66 of file CastorDigiProducer.cc.

References theAmplifier, theCastorDigitizer, theCastorIntegratedShape, theCastorResponse, theCastorShape, theCoderFactory, theElectronicsSim, theHitCorrection, and theParameterMap.

66  {
67  delete theCastorDigitizer;
68  delete theParameterMap;
69  delete theCastorShape;
71  delete theCastorResponse;
72  delete theElectronicsSim;
73  delete theAmplifier;
74  delete theCoderFactory;
75  delete theHitCorrection;
76 }
CastorAmplifier * theAmplifier
CaloVShape * theCastorShape
CastorSimParameterMap * theParameterMap
CastorElectronicsSim * theElectronicsSim
CaloHitResponse * theCastorResponse
CastorHitCorrection * theHitCorrection
CastorDigitizer * theCastorDigitizer
CastorCoderFactory * theCoderFactory
CaloVShape * theCastorIntegratedShape

Member Function Documentation

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().

143  {
144  // TODO find a way to avoid doing this every event
146 eventSetup.get<CaloGeometryRecord>().get(geometry);
147 theCastorResponse->setGeometry(&*geometry);
148 
149 const vector<DetId>& castorCells = geometry->getValidDetIds(DetId::Calo, HcalCastorDetId::SubdetectorId);
150 
151 //std::cout<<"CastorDigiProducer::CheckGeometry number of cells: "<<castorCells.size()<<std::endl;
152 theCastorDigitizer->setDetIds(castorCells);
153 }
void setGeometry(const CaloGeometry *geometry)
geometry needed for time-of-flight
CaloHitResponse * theCastorResponse
static const int SubdetectorId
const T & get() const
Definition: EventSetup.h:55
ESHandle< TrackerGeometry > geometry
CastorDigitizer * theCastorDigitizer
void setDetIds(const std::vector< DetId > &detIds)
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.

135  {
136 HcalCastorDetId castorDetId(HcalCastorDetId::Section(2),true,1,1);
137 PCaloHit castorHit(castorDetId.rawId(), 50.0, 0.);
138 
139 theCastorHits.push_back(castorHit);
140 }
std::vector< PCaloHit > theCastorHits
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::Handle< T >::product(), edm::ESHandle< class >::product(), edm::Event::put(), CaloTDigitizer< Traits >::run(), CastorCoderFactory::setDbService(), CastorAmplifier::setDbService(), CastorSimParameterMap::setDbService(), theAmplifier, theCastorDigitizer, theCastorHits, theCoderFactory, theHitCorrection, and theParameterMap.

79  {
80  // get the appropriate gains, noises, & widths for this event
82  eventSetup.get<CastorDbRecord>().get(conditions);
83  theAmplifier->setDbService(conditions.product());
84  theCoderFactory->setDbService(conditions.product());
85  theParameterMap->setDbService(conditions.product());
86 
87 edm::LogInfo("CastorDigiProducer") << "checking the geometry...";
88 
89  // get the correct geometry
90 checkGeometry(eventSetup);
91 
92 theCastorHits.clear();
93 
94  // Step A: Get Inputs
95 //edm::Handle<edm::PCaloHitContainer> castorcf;
97 e.getByLabel("mix", "g4SimHitsCastorFI", castorcf);
98 
99  // test access to SimHits for HcalHits and ZDC hits
100 std::auto_ptr<MixCollection<PCaloHit> > colcastor(new MixCollection<PCaloHit>(castorcf.product()));
101 
102  //fillFakeHits();
103 
104 if(theHitCorrection != 0)
105  {
106 theHitCorrection->fillChargeSums(*colcastor);
107  }
108  // Step B: Create empty output
109 
110 std::auto_ptr<CastorDigiCollection> castorResult(new CastorDigiCollection());
111 
112  // Step C: Invoke the algorithm, passing in inputs and getting back outputs.
113 theCastorDigitizer->run(*colcastor, *castorResult);
114 
115 edm::LogInfo("CastorDigiProducer") << "HCAL/Castor digis : " << castorResult->size();
116 
117  // Step D: Put outputs into event
118 e.put(castorResult);
119 }
CastorAmplifier * theAmplifier
void fillChargeSums(MixCollection< PCaloHit > &hits)
void checkGeometry(const edm::EventSetup &eventSetup)
void setDbService(const CastorDbService *service)
CastorSimParameterMap * theParameterMap
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
void run(MixCollection< PCaloHit > &input, DigiCollection &output)
turns hits into digis
std::vector< PCaloHit > theCastorHits
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
CastorHitCorrection * theHitCorrection
T const * product() const
Definition: ESHandle.h:62
T const * product() const
Definition: Handle.h:74
CastorDigitizer * theCastorDigitizer
CastorCoderFactory * theCoderFactory
edm::SortedCollection< CastorDataFrame > CastorDigiCollection
void setDbService(const CastorDbService *service)
the Producer will probably update this every event
void setDbService(const CastorDbService *service)
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.

122  {
123  for(edm::PCaloHitContainer::const_iterator hitItr = hits.begin();
124  hitItr != hits.end(); ++hitItr){
125  DetId detId = hitItr->id();
126  if (detId.det()==DetId::Calo && detId.subdetId()==HcalCastorDetId::SubdetectorId){
127  theCastorHits.push_back(*hitItr);
128  }
129  else {
130  edm::LogError("CastorDigiProducer") << "Bad Hit subdetector " << detId.subdetId();
131  }
132  }
133 }
std::vector< PCaloHit > theCastorHits
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
static const int SubdetectorId
Definition: DetId.h:20
Detector det() const
get the detector field from this detid
Definition: DetId.h:37

Member Data Documentation

CastorAmplifier* CastorDigiProducer::theAmplifier
private

Definition at line 49 of file CastorDigiProducer.h.

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

CastorDigitizer* CastorDigiProducer::theCastorDigitizer
private
CastorHitFilter CastorDigiProducer::theCastorHitFilter
private

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().

CaloVShape* CastorDigiProducer::theCastorIntegratedShape
private

Definition at line 45 of file CastorDigiProducer.h.

Referenced by ~CastorDigiProducer().

CaloHitResponse* CastorDigiProducer::theCastorResponse
private

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().

CastorCoderFactory* CastorDigiProducer::theCoderFactory
private

Definition at line 50 of file CastorDigiProducer.h.

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

CastorElectronicsSim* CastorDigiProducer::theElectronicsSim
private

Definition at line 51 of file CastorDigiProducer.h.

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

CastorHitCorrection* CastorDigiProducer::theHitCorrection
private

Definition at line 55 of file CastorDigiProducer.h.

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

CastorSimParameterMap* CastorDigiProducer::theParameterMap
private

Definition at line 43 of file CastorDigiProducer.h.

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