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:
DigiAccumulatorMixMod

Public Member Functions

virtual void accumulate (edm::Event const &e, edm::EventSetup const &c) override
 
virtual void accumulate (PileUpEventPrincipal const &e, edm::EventSetup const &c, edm::StreamID const &) override
 
 CastorDigiProducer (const edm::ParameterSet &ps, edm::one::EDProducerBase &mixMod, edm::ConsumesCollector &iC)
 
virtual void finalizeEvent (edm::Event &e, edm::EventSetup const &c) override
 
virtual void initializeEvent (edm::Event const &e, edm::EventSetup const &c) override
 
virtual ~CastorDigiProducer ()
 
- Public Member Functions inherited from DigiAccumulatorMixMod
virtual void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup)
 
virtual void beginRun (edm::Run const &run, edm::EventSetup const &setup)
 
 DigiAccumulatorMixMod ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup)
 
virtual void endRun (edm::Run const &run, edm::EventSetup const &setup)
 
virtual void finalizeBunchCrossing (edm::Event &event, edm::EventSetup const &setup, int bunchCrossing)
 
virtual PileupMixingContentgetEventPileupInfo ()
 
virtual void initializeBunchCrossing (edm::Event const &event, edm::EventSetup const &setup, int bunchCrossing)
 
virtual void StorePileupInformation (std::vector< int > &numInteractionList, std::vector< int > &bunchCrossingList, std::vector< float > &TrueInteractionList)
 
virtual ~DigiAccumulatorMixMod ()
 

Private Types

typedef CaloTDigitizer
< CastorDigitizerTraits
CastorDigitizer
 

Private Member Functions

void accumulateCaloHits (std::vector< PCaloHit > const &, int bunchCrossing, CLHEP::HepRandomEngine *)
 
void checkGeometry (const edm::EventSetup &eventSetup)
 
void fillFakeHits ()
 some hits in each subdetector, just for testing purposes More...
 
CLHEP::HepRandomEngine * randomEngine (edm::StreamID const &streamID)
 
void sortHits (const edm::PCaloHitContainer &hits)
 fills the vectors for each subdetector More...
 

Private Attributes

std::vector
< CLHEP::HepRandomEngine * > 
randomEngines_
 
CastorAmplifiertheAmplifier
 
CastorDigitizertheCastorDigitizer
 
CastorHitFilter theCastorHitFilter
 
std::vector< PCaloHittheCastorHits
 
CaloVShapetheCastorIntegratedShape
 
CaloHitResponsetheCastorResponse
 
CaloVShapetheCastorShape
 
CastorCoderFactorytheCoderFactory
 
CastorElectronicsSimtheElectronicsSim
 
CastorHitCorrectiontheHitCorrection
 
CastorSimParameterMaptheParameterMap
 

Detailed Description

Definition at line 34 of file CastorDigiProducer.h.

Member Typedef Documentation

Reconstruction algorithm

Definition at line 59 of file CastorDigiProducer.h.

Constructor & Destructor Documentation

CastorDigiProducer::CastorDigiProducer ( const edm::ParameterSet ps,
edm::one::EDProducerBase mixMod,
edm::ConsumesCollector iC 
)
explicit

Definition at line 22 of file CastorDigiProducer.cc.

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

27  theAmplifier(0),
28  theCoderFactory(0),
33 {
34  iC.consumes<std::vector<PCaloHit> >(edm::InputTag("g4SimHits", "CastorFI"));
35 
36  mixMod.produces<CastorDigiCollection>();
37 
39 
40  bool doTimeSlew = ps.getParameter<bool>("doTimeSlew");
41  if(doTimeSlew) {
42  // no time slewing for HF
44  }
45 
46  bool doNoise = ps.getParameter<bool>("doNoise");
50 
52 
54  if ( ! rng.isAvailable()) {
55  throw cms::Exception("Configuration")
56  << "CastorDigiProducer requires the RandomNumberGeneratorService\n"
57  "which is not present in the configuration file. You must add the service\n"
58  "in the configuration file or remove the modules that require it.";
59  }
60 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
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:46
std::vector< PCaloHit > theCastorHits
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 63 of file CastorDigiProducer.cc.

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

63  {
64  delete theCastorDigitizer;
65  delete theParameterMap;
66  delete theCastorShape;
68  delete theCastorResponse;
69  delete theElectronicsSim;
70  delete theAmplifier;
71  delete theCoderFactory;
72  delete theHitCorrection;
73 }
CastorAmplifier * theAmplifier
CaloVShape * theCastorShape
CastorSimParameterMap * theParameterMap
CastorElectronicsSim * theElectronicsSim
CaloHitResponse * theCastorResponse
CastorHitCorrection * theHitCorrection
CastorDigitizer * theCastorDigitizer
CastorCoderFactory * theCoderFactory
CaloVShape * theCastorIntegratedShape

Member Function Documentation

void CastorDigiProducer::accumulate ( edm::Event const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 102 of file CastorDigiProducer.cc.

References accumulateCaloHits(), edm::Event::getByLabel(), edm::Handle< T >::product(), randomEngine(), and edm::Event::streamID().

102  {
103  // Step A: Get and accumulate digitized hits
104  edm::Handle<std::vector<PCaloHit> > castorHandle;
105  e.getByLabel(edm::InputTag("g4SimHits", "CastorFI"), castorHandle);
106 
107  accumulateCaloHits(*castorHandle.product(), 0, randomEngine(e.streamID()));
108 }
void accumulateCaloHits(std::vector< PCaloHit > const &, int bunchCrossing, CLHEP::HepRandomEngine *)
T const * product() const
Definition: Handle.h:81
CLHEP::HepRandomEngine * randomEngine(edm::StreamID const &streamID)
void CastorDigiProducer::accumulate ( PileUpEventPrincipal const &  e,
edm::EventSetup const &  c,
edm::StreamID const &  streamID 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 110 of file CastorDigiProducer.cc.

References accumulateCaloHits(), PileUpEventPrincipal::bunchCrossing(), PileUpEventPrincipal::getByLabel(), edm::Handle< T >::product(), and randomEngine().

110  {
111  // Step A: Get and accumulate digitized hits
112  edm::Handle<std::vector<PCaloHit> > castorHandle;
113  e.getByLabel(edm::InputTag("g4SimHits", "CastorFI"), castorHandle);
114 
115  accumulateCaloHits(*castorHandle.product(), e.bunchCrossing(), randomEngine(streamID));
116 }
void accumulateCaloHits(std::vector< PCaloHit > const &, int bunchCrossing, CLHEP::HepRandomEngine *)
T const * product() const
Definition: Handle.h:81
CLHEP::HepRandomEngine * randomEngine(edm::StreamID const &streamID)
void CastorDigiProducer::accumulateCaloHits ( std::vector< PCaloHit > const &  hcalHits,
int  bunchCrossing,
CLHEP::HepRandomEngine *  engine 
)
private

Definition at line 93 of file CastorDigiProducer.cc.

References CaloTDigitizer< Traits >::add(), CastorHitCorrection::fillChargeSums(), theCastorDigitizer, and theHitCorrection.

Referenced by accumulate().

93  {
94  //fillFakeHits();
95 
96  if(theHitCorrection != 0) {
98  }
99  theCastorDigitizer->add(hcalHits, bunchCrossing, engine);
100 }
void fillChargeSums(MixCollection< PCaloHit > &hits)
void add(const std::vector< PCaloHit > &hits, int bunchCrossing, CLHEP::HepRandomEngine *engine)
CastorHitCorrection * theHitCorrection
CastorDigitizer * theCastorDigitizer
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 153 of file CastorDigiProducer.cc.

References DetId::Calo, geometry, edm::EventSetup::get(), CaloTDigitizer< Traits >::setDetIds(), CaloHitResponse::setGeometry(), HcalCastorDetId::SubdetectorId, theCastorDigitizer, and theCastorResponse.

Referenced by initializeEvent().

153  {
154  // TODO find a way to avoid doing this every event
156  eventSetup.get<CaloGeometryRecord>().get(geometry);
157  theCastorResponse->setGeometry(&*geometry);
158 
159  const std::vector<DetId>& castorCells = geometry->getValidDetIds(DetId::Calo, HcalCastorDetId::SubdetectorId);
160 
161  //std::cout<<"CastorDigiProducer::CheckGeometry number of cells: "<<castorCells.size()<<std::endl;
162  theCastorDigitizer->setDetIds(castorCells);
163 }
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 146 of file CastorDigiProducer.cc.

References DetId::rawId(), and theCastorHits.

146  {
147  HcalCastorDetId castorDetId(HcalCastorDetId::Section(2),true,1,1);
148 
149  theCastorHits.emplace_back(castorDetId.rawId(), 50.0, 0.);
150 }
std::vector< PCaloHit > theCastorHits
void CastorDigiProducer::finalizeEvent ( edm::Event e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 118 of file CastorDigiProducer.cc.

References edm::Event::put(), randomEngine(), CaloTDigitizer< Traits >::run(), edm::Event::streamID(), and theCastorDigitizer.

118  {
119  // Step B: Create empty output
120 
121  std::auto_ptr<CastorDigiCollection> castorResult(new CastorDigiCollection());
122 
123  // Step C: Invoke the algorithm, getting back outputs.
124  theCastorDigitizer->run(*castorResult, randomEngine(e.streamID()));
125 
126  edm::LogInfo("CastorDigiProducer") << "HCAL/Castor digis : " << castorResult->size();
127 
128  // Step D: Put outputs into event
129  e.put(castorResult);
130 }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
void run(MixCollection< PCaloHit > &, DigiCollection &)
turns hits into digis
CastorDigitizer * theCastorDigitizer
StreamID streamID() const
Definition: Event.h:75
edm::SortedCollection< CastorDataFrame > CastorDigiCollection
CLHEP::HepRandomEngine * randomEngine(edm::StreamID const &streamID)
void CastorDigiProducer::initializeEvent ( edm::Event const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 75 of file CastorDigiProducer.cc.

References checkGeometry(), edm::EventSetup::get(), CaloTDigitizer< Traits >::initializeHits(), edm::ESHandle< class >::product(), CastorCoderFactory::setDbService(), CastorAmplifier::setDbService(), CastorSimParameterMap::setDbService(), theAmplifier, theCastorDigitizer, theCastorHits, theCoderFactory, and theParameterMap.

75  {
76  // get the appropriate gains, noises, & widths for this event
78  eventSetup.get<CastorDbRecord>().get(conditions);
79  theAmplifier->setDbService(conditions.product());
80  theCoderFactory->setDbService(conditions.product());
81  theParameterMap->setDbService(conditions.product());
82 
83  edm::LogInfo("CastorDigiProducer") << "checking the geometry...";
84 
85  // get the correct geometry
86  checkGeometry(eventSetup);
87 
88  theCastorHits.clear();
89 
91 }
CastorAmplifier * theAmplifier
void initializeHits()
void checkGeometry(const edm::EventSetup &eventSetup)
void setDbService(const CastorDbService *service)
CastorSimParameterMap * theParameterMap
std::vector< PCaloHit > theCastorHits
T const * product() const
Definition: ESHandle.h:62
CastorDigitizer * theCastorDigitizer
CastorCoderFactory * theCoderFactory
void setDbService(const CastorDbService *service)
the Producer will probably update this every event
void setDbService(const CastorDbService *service)
CLHEP::HepRandomEngine * CastorDigiProducer::randomEngine ( edm::StreamID const &  streamID)
private

Definition at line 165 of file CastorDigiProducer.cc.

References edm::RandomNumberGenerator::getEngine(), cmsHarvester::index, randomEngines_, and edm::StreamID::value().

Referenced by accumulate(), and finalizeEvent().

165  {
166  unsigned int index = streamID.value();
167  if(index >= randomEngines_.size()) {
168  randomEngines_.resize(index + 1, nullptr);
169  }
170  CLHEP::HepRandomEngine* ptr = randomEngines_[index];
171  if(!ptr) {
173  ptr = &rng->getEngine(streamID);
174  randomEngines_[index] = ptr;
175  }
176  return ptr;
177 }
std::vector< CLHEP::HepRandomEngine * > randomEngines_
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &) const =0
Use this engine in event methods.
void CastorDigiProducer::sortHits ( const edm::PCaloHitContainer hits)
private

fills the vectors for each subdetector

Definition at line 133 of file CastorDigiProducer.cc.

References DetId::Calo, DetId::det(), HcalCastorDetId::SubdetectorId, DetId::subdetId(), and theCastorHits.

133  {
134  for(edm::PCaloHitContainer::const_iterator hitItr = hits.begin();
135  hitItr != hits.end(); ++hitItr){
136  DetId detId = hitItr->id();
137  if (detId.det()==DetId::Calo && detId.subdetId()==HcalCastorDetId::SubdetectorId){
138  theCastorHits.push_back(*hitItr);
139  }
140  else {
141  edm::LogError("CastorDigiProducer") << "Bad Hit subdetector " << detId.subdetId();
142  }
143  }
144 }
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:37
static const int SubdetectorId
Definition: DetId.h:18
Detector det() const
get the detector field from this detid
Definition: DetId.h:35

Member Data Documentation

std::vector<CLHEP::HepRandomEngine*> CastorDigiProducer::randomEngines_
private

Definition at line 79 of file CastorDigiProducer.h.

Referenced by randomEngine().

CastorAmplifier* CastorDigiProducer::theAmplifier
private

Definition at line 67 of file CastorDigiProducer.h.

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

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

Definition at line 71 of file CastorDigiProducer.h.

Referenced by CastorDigiProducer().

std::vector<PCaloHit> CastorDigiProducer::theCastorHits
private

Definition at line 77 of file CastorDigiProducer.h.

Referenced by fillFakeHits(), initializeEvent(), and sortHits().

CaloVShape* CastorDigiProducer::theCastorIntegratedShape
private

Definition at line 63 of file CastorDigiProducer.h.

Referenced by ~CastorDigiProducer().

CaloHitResponse* CastorDigiProducer::theCastorResponse
private

Definition at line 65 of file CastorDigiProducer.h.

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

CaloVShape* CastorDigiProducer::theCastorShape
private

Definition at line 62 of file CastorDigiProducer.h.

Referenced by ~CastorDigiProducer().

CastorCoderFactory* CastorDigiProducer::theCoderFactory
private

Definition at line 68 of file CastorDigiProducer.h.

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

CastorElectronicsSim* CastorDigiProducer::theElectronicsSim
private

Definition at line 69 of file CastorDigiProducer.h.

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

CastorHitCorrection* CastorDigiProducer::theHitCorrection
private
CastorSimParameterMap* CastorDigiProducer::theParameterMap
private

Definition at line 61 of file CastorDigiProducer.h.

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