CMS 3D CMS Logo

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

void accumulate (edm::Event const &e, edm::EventSetup const &c) override
 
void accumulate (PileUpEventPrincipal const &e, edm::EventSetup const &c, edm::StreamID const &) override
 
 CastorDigiProducer (const edm::ParameterSet &ps, edm::ProducesCollector, edm::ConsumesCollector &iC)
 
void finalizeEvent (edm::Event &e, edm::EventSetup const &c) override
 
void initializeEvent (edm::Event const &e, edm::EventSetup const &c) override
 
 ~CastorDigiProducer () override
 
- 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, std::vector< edm::EventID > &eventList, int bunchSpace)
 
virtual ~DigiAccumulatorMixMod ()
 

Private Types

typedef CaloTDigitizer< CastorDigitizerTraitsCastorDigitizer
 

Private Member Functions

void accumulateCaloHits (std::vector< PCaloHit > const &, int bunchCrossing)
 
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

CLHEP::HepRandomEngine * randomEngine_ = 0
 
CastorAmplifiertheAmplifier
 
CastorDigitizertheCastorDigitizer
 
CastorHitFilter theCastorHitFilter
 
std::vector< PCaloHittheCastorHits
 
CaloVShapetheCastorIntegratedShape
 
CaloHitResponsetheCastorResponse
 
CaloVShapetheCastorShape
 
CastorCoderFactorytheCoderFactory
 
CastorElectronicsSimtheElectronicsSim
 
CastorHitCorrectiontheHitCorrection
 
edm::InputTag theHitsProducerTag
 
CastorSimParameterMaptheParameterMap
 

Detailed Description

Definition at line 35 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::ProducesCollector  producesCollector,
edm::ConsumesCollector iC 
)
explicit

Definition at line 22 of file CastorDigiProducer.cc.

References edm::ConsumesCollector::consumes(), CastorCoderFactory::DB, DigiDM_cff::doNoise, hcalUnsuppressedDigis_cfi::doTimeSlew, Exception, edm::ParameterSet::getParameter(), edm::Service< T >::isAvailable(), edm::ProducesCollector::produces(), CaloHitResponse::setHitCorrection(), CaloHitResponse::setHitFilter(), theAmplifier, theCastorDigitizer, theCastorHitFilter, theCastorResponse, theCoderFactory, theElectronicsSim, theHitCorrection, theHitsProducerTag, and theParameterMap.

29  theAmplifier(nullptr),
30  theCoderFactory(nullptr),
31  theElectronicsSim(nullptr),
32  theHitCorrection(nullptr),
33  theCastorDigitizer(nullptr),
34  theCastorHits() {
35  theHitsProducerTag = ps.getParameter<edm::InputTag>("hitsProducer");
36  iC.consumes<std::vector<PCaloHit>>(theHitsProducerTag);
37 
38  producesCollector.produces<CastorDigiCollection>();
39 
41 
42  bool doTimeSlew = ps.getParameter<bool>("doTimeSlew");
43  if (doTimeSlew) {
44  // no time slewing for HF
46  }
47 
48  bool doNoise = ps.getParameter<bool>("doNoise");
52 
54 
56  if (!rng.isAvailable()) {
57  throw cms::Exception("Configuration") << "CastorDigiProducer requires the RandomNumberGeneratorService\n"
58  "which is not present in the configuration file. You must add the "
59  "service\n"
60  "in the configuration file or remove the modules that require it.";
61  }
62 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
CastorAmplifier * theAmplifier
CaloVShape * theCastorShape
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
CaloTDigitizer< CastorDigitizerTraits > CastorDigitizer
CastorSimParameterMap * theParameterMap
CastorElectronicsSim * theElectronicsSim
CastorHitFilter theCastorHitFilter
void setHitFilter(const CaloVHitFilter *filter)
Creates electronics signals from hits.
CaloHitResponse * theCastorResponse
bool isAvailable() const
Definition: Service.h:40
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:15
edm::InputTag theHitsProducerTag
CaloVShape * theCastorIntegratedShape
CastorDigiProducer::~CastorDigiProducer ( )
override

Definition at line 64 of file CastorDigiProducer.cc.

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

64  {
65  delete theCastorDigitizer;
66  delete theParameterMap;
67  delete theCastorShape;
69  delete theCastorResponse;
70  delete theElectronicsSim;
71  delete theAmplifier;
72  delete theCoderFactory;
73  delete theHitCorrection;
74 }
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 107 of file CastorDigiProducer.cc.

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

107  {
108  // Step A: Get and accumulate digitized hits
109  edm::Handle<std::vector<PCaloHit>> castorHandle;
110  e.getByLabel(theHitsProducerTag, castorHandle);
111 
112  accumulateCaloHits(*castorHandle.product(), 0);
113 }
void accumulateCaloHits(std::vector< PCaloHit > const &, int bunchCrossing)
T const * product() const
Definition: Handle.h:69
edm::InputTag theHitsProducerTag
void CastorDigiProducer::accumulate ( PileUpEventPrincipal const &  e,
edm::EventSetup const &  c,
edm::StreamID const &  streamID 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 115 of file CastorDigiProducer.cc.

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

117  {
118  // Step A: Get and accumulate digitized hits
119  edm::Handle<std::vector<PCaloHit>> castorHandle;
120  e.getByLabel(theHitsProducerTag, castorHandle);
121 
122  accumulateCaloHits(*castorHandle.product(), e.bunchCrossing());
123 }
void accumulateCaloHits(std::vector< PCaloHit > const &, int bunchCrossing)
T const * product() const
Definition: Handle.h:69
edm::InputTag theHitsProducerTag
void CastorDigiProducer::accumulateCaloHits ( std::vector< PCaloHit > const &  hcalHits,
int  bunchCrossing 
)
private

Definition at line 98 of file CastorDigiProducer.cc.

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

Referenced by accumulate().

98  {
99  // fillFakeHits();
100 
101  if (theHitCorrection != nullptr) {
102  theHitCorrection->fillChargeSums(hcalHits);
103  }
104  theCastorDigitizer->add(hcalHits, bunchCrossing, randomEngine_);
105 }
void add(const std::vector< PCaloHit > &hits, int bunchCrossing, CLHEP::HepRandomEngine *engine)
void fillChargeSums(MixCollection< PCaloHit > &hits)
CLHEP::HepRandomEngine * randomEngine_
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 158 of file CastorDigiProducer.cc.

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

Referenced by initializeEvent().

158  {
159  // TODO find a way to avoid doing this every event
161  eventSetup.get<CaloGeometryRecord>().get(geometry);
162  theCastorResponse->setGeometry(&*geometry);
163 
164  const std::vector<DetId> &castorCells = geometry->getValidDetIds(DetId::Calo, HcalCastorDetId::SubdetectorId);
165 
166  // std::cout<<"CastorDigiProducer::CheckGeometry number of cells:
167  // "<<castorCells.size()<<std::endl;
168  theCastorDigitizer->setDetIds(castorCells);
169 }
void setGeometry(const CaloGeometry *geometry)
geometry needed for time-of-flight
CaloHitResponse * theCastorResponse
static const int SubdetectorId
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:75
ESHandle< TrackerGeometry > geometry
CastorDigitizer * theCastorDigitizer
T get() const
Definition: EventSetup.h:73
void setDetIds(const std::vector< DetId > &detIds)
void CastorDigiProducer::fillFakeHits ( )
private

some hits in each subdetector, just for testing purposes

Definition at line 152 of file CastorDigiProducer.cc.

References DetId::rawId(), and theCastorHits.

152  {
153  HcalCastorDetId castorDetId(HcalCastorDetId::Section(2), true, 1, 1);
154 
155  theCastorHits.emplace_back(castorDetId.rawId(), 50.0, 0.);
156 }
std::vector< PCaloHit > theCastorHits
void CastorDigiProducer::finalizeEvent ( edm::Event e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 125 of file CastorDigiProducer.cc.

References eostools::move(), edm::Event::put(), randomEngine_, CaloTDigitizer< Traits, runHelper >::run(), and theCastorDigitizer.

125  {
126  // Step B: Create empty output
127 
128  std::unique_ptr<CastorDigiCollection> castorResult(new CastorDigiCollection());
129 
130  // Step C: Invoke the algorithm, getting back outputs.
131  theCastorDigitizer->run(*castorResult, randomEngine_);
132 
133  edm::LogInfo("CastorDigiProducer") << "HCAL/Castor digis : " << castorResult->size();
134 
135  // Step D: Put outputs into event
136  e.put(std::move(castorResult));
137 
138  randomEngine_ = nullptr; // to prevent access outside event
139 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
CLHEP::HepRandomEngine * randomEngine_
void run(MixCollection< PCaloHit > &, DigiCollection &)
turns hits into digis
CastorDigitizer * theCastorDigitizer
edm::SortedCollection< CastorDataFrame > CastorDigiCollection
def move(src, dest)
Definition: eostools.py:511
void CastorDigiProducer::initializeEvent ( edm::Event const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 76 of file CastorDigiProducer.cc.

References checkGeometry(), edm::EventSetup::get(), edm::RandomNumberGenerator::getEngine(), CaloTDigitizer< Traits, runHelper >::initializeHits(), edm::ESHandle< T >::product(), randomEngine_, CastorCoderFactory::setDbService(), CastorAmplifier::setDbService(), CastorSimParameterMap::setDbService(), edm::Event::streamID(), theAmplifier, theCastorDigitizer, theCastorHits, theCoderFactory, and theParameterMap.

76  {
77  // get the appropriate gains, noises, & widths for this event
79  eventSetup.get<CastorDbRecord>().get(conditions);
80  theAmplifier->setDbService(conditions.product());
81  theCoderFactory->setDbService(conditions.product());
82  theParameterMap->setDbService(conditions.product());
83 
84  // Cache random number engine
86  randomEngine_ = &rng->getEngine(event.streamID());
87 
88  edm::LogInfo("CastorDigiProducer") << "checking the geometry...";
89 
90  // get the correct geometry
91  checkGeometry(eventSetup);
92 
93  theCastorHits.clear();
94 
96 }
CastorAmplifier * theAmplifier
void checkGeometry(const edm::EventSetup &eventSetup)
void setDbService(const CastorDbService *service)
CastorSimParameterMap * theParameterMap
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
CLHEP::HepRandomEngine * randomEngine_
void initializeHits()
std::vector< PCaloHit > theCastorHits
CastorDigitizer * theCastorDigitizer
CastorCoderFactory * theCoderFactory
void setDbService(const CastorDbService *service)
the Producer will probably update this every event
void setDbService(const CastorDbService *service)
T const * product() const
Definition: ESHandle.h:86
Definition: event.py:1
void CastorDigiProducer::sortHits ( const edm::PCaloHitContainer hits)
private

fills the vectors for each subdetector

Definition at line 141 of file CastorDigiProducer.cc.

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

141  {
142  for (edm::PCaloHitContainer::const_iterator hitItr = hits.begin(); hitItr != hits.end(); ++hitItr) {
143  DetId detId = hitItr->id();
144  if (detId.det() == DetId::Calo && detId.subdetId() == HcalCastorDetId::SubdetectorId) {
145  theCastorHits.push_back(*hitItr);
146  } else {
147  edm::LogError("CastorDigiProducer") << "Bad Hit subdetector " << detId.subdetId();
148  }
149  }
150 }
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
std::vector< PCaloHit > theCastorHits
static const int SubdetectorId
Definition: DetId.h:17
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46

Member Data Documentation

CLHEP::HepRandomEngine* CastorDigiProducer::randomEngine_ = 0
private

Definition at line 79 of file CastorDigiProducer.h.

Referenced by accumulateCaloHits(), finalizeEvent(), and initializeEvent().

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
edm::InputTag CastorDigiProducer::theHitsProducerTag
private

Definition at line 56 of file CastorDigiProducer.h.

Referenced by accumulate(), and CastorDigiProducer().

CastorSimParameterMap* CastorDigiProducer::theParameterMap
private

Definition at line 61 of file CastorDigiProducer.h.

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