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_ = nullptr
 
CastorAmplifiertheAmplifier
 
CastorDigitizertheCastorDigitizer
 
CastorHitFilter theCastorHitFilter
 
std::vector< PCaloHittheCastorHits
 
CaloVShapetheCastorIntegratedShape
 
CaloHitResponsetheCastorResponse
 
CaloVShapetheCastorShape
 
CastorCoderFactorytheCoderFactory
 
const edm::ESGetToken< CastorDbService, CastorDbRecordtheConditionsToken
 
CastorElectronicsSimtheElectronicsSim
 
const edm::ESGetToken< CaloGeometry, CaloGeometryRecordtheGeometryToken
 
edm::ESWatcher< CaloGeometryRecordtheGeometryWatcher
 
CastorHitCorrectiontheHitCorrection
 
edm::InputTag theHitsProducerTag
 
CastorSimParameterMaptheParameterMap
 

Detailed Description

Definition at line 34 of file CastorDigiProducer.h.

Member Typedef Documentation

◆ CastorDigitizer

Reconstruction algorithm

Definition at line 61 of file CastorDigiProducer.h.

Constructor & Destructor Documentation

◆ CastorDigiProducer()

CastorDigiProducer::CastorDigiProducer ( const edm::ParameterSet ps,
edm::ProducesCollector  producesCollector,
edm::ConsumesCollector iC 
)
explicit

Definition at line 20 of file CastorDigiProducer.cc.

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 }

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.

◆ ~CastorDigiProducer()

CastorDigiProducer::~CastorDigiProducer ( )
override

Member Function Documentation

◆ accumulate() [1/2]

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

Implements DigiAccumulatorMixMod.

Definition at line 106 of file CastorDigiProducer.cc.

106  {
107  // Step A: Get and accumulate digitized hits
108  edm::Handle<std::vector<PCaloHit>> castorHandle;
109  e.getByLabel(theHitsProducerTag, castorHandle);
110 
111  accumulateCaloHits(*castorHandle.product(), 0);
112 }

References accumulateCaloHits(), MillePedeFileConverter_cfg::e, edm::Handle< T >::product(), and theHitsProducerTag.

◆ accumulate() [2/2]

void CastorDigiProducer::accumulate ( PileUpEventPrincipal const &  e,
edm::EventSetup const &  c,
edm::StreamID const &  streamID 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 114 of file CastorDigiProducer.cc.

116  {
117  // Step A: Get and accumulate digitized hits
118  edm::Handle<std::vector<PCaloHit>> castorHandle;
119  e.getByLabel(theHitsProducerTag, castorHandle);
120 
121  accumulateCaloHits(*castorHandle.product(), e.bunchCrossing());
122 }

References accumulateCaloHits(), MillePedeFileConverter_cfg::e, edm::Handle< T >::product(), and theHitsProducerTag.

◆ accumulateCaloHits()

void CastorDigiProducer::accumulateCaloHits ( std::vector< PCaloHit > const &  hcalHits,
int  bunchCrossing 
)
private

Definition at line 97 of file CastorDigiProducer.cc.

97  {
98  // fillFakeHits();
99 
100  if (theHitCorrection != nullptr) {
101  theHitCorrection->fillChargeSums(hcalHits);
102  }
103  theCastorDigitizer->add(hcalHits, bunchCrossing, randomEngine_);
104 }

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

Referenced by accumulate().

◆ checkGeometry()

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 157 of file CastorDigiProducer.cc.

157  {
158  if (theGeometryWatcher.check(eventSetup)) {
159  const CaloGeometry *geometry = &eventSetup.getData(theGeometryToken);
161 
162  const std::vector<DetId> &castorCells = geometry->getValidDetIds(DetId::Calo, HcalCastorDetId::SubdetectorId);
163 
164  // std::cout<<"CastorDigiProducer::CheckGeometry number of cells:
165  // "<<castorCells.size()<<std::endl;
166  theCastorDigitizer->setDetIds(castorCells);
167  }
168 }

References DetId::Calo, edm::ESWatcher< T >::check(), edm::EventSetup::getData(), CaloTDigitizer< Traits, runHelper >::setDetIds(), CaloHitResponse::setGeometry(), HcalCastorDetId::SubdetectorId, theCastorDigitizer, theCastorResponse, theGeometryToken, and theGeometryWatcher.

Referenced by initializeEvent().

◆ fillFakeHits()

void CastorDigiProducer::fillFakeHits ( )
private

some hits in each subdetector, just for testing purposes

Definition at line 151 of file CastorDigiProducer.cc.

151  {
152  HcalCastorDetId castorDetId(HcalCastorDetId::Section(2), true, 1, 1);
153 
154  theCastorHits.emplace_back(castorDetId.rawId(), 50.0, 0.);
155 }

References DetId::rawId(), and theCastorHits.

◆ finalizeEvent()

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

Implements DigiAccumulatorMixMod.

Definition at line 124 of file CastorDigiProducer.cc.

124  {
125  // Step B: Create empty output
126 
127  std::unique_ptr<CastorDigiCollection> castorResult(new CastorDigiCollection());
128 
129  // Step C: Invoke the algorithm, getting back outputs.
130  theCastorDigitizer->run(*castorResult, randomEngine_);
131 
132  edm::LogInfo("CastorDigiProducer") << "HCAL/Castor digis : " << castorResult->size();
133 
134  // Step D: Put outputs into event
135  e.put(std::move(castorResult));
136 
137  randomEngine_ = nullptr; // to prevent access outside event
138 }

References MillePedeFileConverter_cfg::e, eostools::move(), randomEngine_, CaloTDigitizer< Traits, runHelper >::run(), and theCastorDigitizer.

◆ initializeEvent()

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

Implements DigiAccumulatorMixMod.

Definition at line 76 of file CastorDigiProducer.cc.

76  {
77  // get the appropriate gains, noises, & widths for this event
78  const CastorDbService *conditions = &eventSetup.getData(theConditionsToken);
82 
83  // Cache random number engine
85  randomEngine_ = &rng->getEngine(event.streamID());
86 
87  edm::LogInfo("CastorDigiProducer") << "checking the geometry...";
88 
89  // get the correct geometry
90  checkGeometry(eventSetup);
91 
92  theCastorHits.clear();
93 
95 }

References checkGeometry(), submitPVValidationJobs::conditions, edm::EventSetup::getData(), edm::RandomNumberGenerator::getEngine(), CaloTDigitizer< Traits, runHelper >::initializeHits(), randomEngine_, CastorCoderFactory::setDbService(), CastorAmplifier::setDbService(), CastorSimParameterMap::setDbService(), theAmplifier, theCastorDigitizer, theCastorHits, theCoderFactory, theConditionsToken, and theParameterMap.

◆ sortHits()

void CastorDigiProducer::sortHits ( const edm::PCaloHitContainer hits)
private

fills the vectors for each subdetector

Definition at line 140 of file CastorDigiProducer.cc.

140  {
141  for (edm::PCaloHitContainer::const_iterator hitItr = hits.begin(); hitItr != hits.end(); ++hitItr) {
142  DetId detId = hitItr->id();
143  if (detId.det() == DetId::Calo && detId.subdetId() == HcalCastorDetId::SubdetectorId) {
144  theCastorHits.push_back(*hitItr);
145  } else {
146  edm::LogError("CastorDigiProducer") << "Bad Hit subdetector " << detId.subdetId();
147  }
148  }
149 }

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

Member Data Documentation

◆ randomEngine_

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

Definition at line 81 of file CastorDigiProducer.h.

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

◆ theAmplifier

CastorAmplifier* CastorDigiProducer::theAmplifier
private

Definition at line 69 of file CastorDigiProducer.h.

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

◆ theCastorDigitizer

CastorDigitizer* CastorDigiProducer::theCastorDigitizer
private

◆ theCastorHitFilter

CastorHitFilter CastorDigiProducer::theCastorHitFilter
private

Definition at line 73 of file CastorDigiProducer.h.

Referenced by CastorDigiProducer().

◆ theCastorHits

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

Definition at line 79 of file CastorDigiProducer.h.

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

◆ theCastorIntegratedShape

CaloVShape* CastorDigiProducer::theCastorIntegratedShape
private

Definition at line 65 of file CastorDigiProducer.h.

Referenced by ~CastorDigiProducer().

◆ theCastorResponse

CaloHitResponse* CastorDigiProducer::theCastorResponse
private

Definition at line 67 of file CastorDigiProducer.h.

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

◆ theCastorShape

CaloVShape* CastorDigiProducer::theCastorShape
private

Definition at line 64 of file CastorDigiProducer.h.

Referenced by ~CastorDigiProducer().

◆ theCoderFactory

CastorCoderFactory* CastorDigiProducer::theCoderFactory
private

Definition at line 70 of file CastorDigiProducer.h.

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

◆ theConditionsToken

const edm::ESGetToken<CastorDbService, CastorDbRecord> CastorDigiProducer::theConditionsToken
private

Definition at line 56 of file CastorDigiProducer.h.

Referenced by initializeEvent().

◆ theElectronicsSim

CastorElectronicsSim* CastorDigiProducer::theElectronicsSim
private

Definition at line 71 of file CastorDigiProducer.h.

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

◆ theGeometryToken

const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> CastorDigiProducer::theGeometryToken
private

Definition at line 57 of file CastorDigiProducer.h.

Referenced by checkGeometry().

◆ theGeometryWatcher

edm::ESWatcher<CaloGeometryRecord> CastorDigiProducer::theGeometryWatcher
private

Definition at line 58 of file CastorDigiProducer.h.

Referenced by checkGeometry().

◆ theHitCorrection

CastorHitCorrection* CastorDigiProducer::theHitCorrection
private

◆ theHitsProducerTag

edm::InputTag CastorDigiProducer::theHitsProducerTag
private

Definition at line 55 of file CastorDigiProducer.h.

Referenced by accumulate(), and CastorDigiProducer().

◆ theParameterMap

CastorSimParameterMap* CastorDigiProducer::theParameterMap
private

Definition at line 63 of file CastorDigiProducer.h.

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

CaloTDigitizer::add
void add(const std::vector< PCaloHit > &hits, int bunchCrossing, CLHEP::HepRandomEngine *engine)
Definition: CaloTDigitizer.h:75
edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
CastorDigiProducer::theCastorResponse
CaloHitResponse * theCastorResponse
Definition: CastorDigiProducer.h:67
CastorDigiProducer::theCastorDigitizer
CastorDigitizer * theCastorDigitizer
Definition: CastorDigiProducer.h:77
edm::RandomNumberGenerator::getEngine
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
CastorHitCorrection::fillChargeSums
void fillChargeSums(MixCollection< PCaloHit > &hits)
Definition: CastorHitCorrection.cc:12
edm::Handle::product
T const * product() const
Definition: Handle.h:70
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
CastorDigiProducer::CastorDigitizer
CaloTDigitizer< CastorDigitizerTraits > CastorDigitizer
Definition: CastorDigiProducer.h:61
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
geometry
Definition: geometry.py:1
CastorDigiProducer::theElectronicsSim
CastorElectronicsSim * theElectronicsSim
Definition: CastorDigiProducer.h:71
CaloTDigitizer::initializeHits
void initializeHits()
Definition: CaloTDigitizer.h:83
edm::SortedCollection
Definition: SortedCollection.h:49
CaloTDigitizer::setDetIds
void setDetIds(const std::vector< DetId > &detIds)
Definition: CaloTDigitizer.h:67
CastorElectronicsSim
Definition: CastorElectronicsSim.h:19
HcalCastorDetId::SubdetectorId
static const int SubdetectorId
Definition: HcalCastorDetId.h:28
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
CastorDigiProducer::theCastorHits
std::vector< PCaloHit > theCastorHits
Definition: CastorDigiProducer.h:79
HcalCastorDetId::Section
Section
Definition: HcalCastorDetId.h:25
CaloShapeIntegrator
Definition: CaloShapeIntegrator.h:11
edm::ConsumesCollector::esConsumes
auto esConsumes()
Definition: ConsumesCollector.h:97
edm::Handle
Definition: AssociativeIterator.h:50
DetId::Calo
Definition: DetId.h:29
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
DigiDM_cff.doNoise
doNoise
Definition: DigiDM_cff.py:32
DetId
Definition: DetId.h:17
CastorShape
shaper for Castor
Definition: CastorShape.h:15
CastorSimParameterMap
Definition: CastorSimParameterMap.h:9
CaloGeometry
Definition: CaloGeometry.h:21
CastorDigiProducer::theConditionsToken
const edm::ESGetToken< CastorDbService, CastorDbRecord > theConditionsToken
Definition: CastorDigiProducer.h:56
CastorDigiProducer::checkGeometry
void checkGeometry(const edm::EventSetup &eventSetup)
Definition: CastorDigiProducer.cc:157
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
hcalUnsuppressedDigis_cfi.doTimeSlew
doTimeSlew
Definition: hcalUnsuppressedDigis_cfi.py:20
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
HcalCastorDetId
Definition: HcalCastorDetId.h:23
CastorSimParameterMap::setDbService
void setDbService(const CastorDbService *service)
Definition: CastorSimParameterMap.cc:33
CastorCoderFactory::setDbService
void setDbService(const CastorDbService *service)
Definition: CastorCoderFactory.h:14
CaloHitResponse::setHitFilter
void setHitFilter(const CaloVHitFilter *filter)
Definition: CaloHitResponse.h:70
CaloHitResponse
Creates electronics signals from hits.
Definition: CaloHitResponse.h:33
edm::Service< edm::RandomNumberGenerator >
CastorDbService
Definition: CastorDbService.h:25
CastorDigiProducer::theGeometryToken
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > theGeometryToken
Definition: CastorDigiProducer.h:57
CastorDigiProducer::accumulateCaloHits
void accumulateCaloHits(std::vector< PCaloHit > const &, int bunchCrossing)
Definition: CastorDigiProducer.cc:97
edm::ProducesCollector::produces
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
Definition: ProducesCollector.h:52
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
CastorAmplifier
Definition: CastorAmplifier.h:13
submitPVValidationJobs.conditions
list conditions
Definition: submitPVValidationJobs.py:674
eostools.move
def move(src, dest)
Definition: eostools.py:511
CastorDigiProducer::theGeometryWatcher
edm::ESWatcher< CaloGeometryRecord > theGeometryWatcher
Definition: CastorDigiProducer.h:58
CastorCoderFactory
Definition: CastorCoderFactory.h:8
CastorAmplifier::setDbService
void setDbService(const CastorDbService *service)
the Producer will probably update this every event
Definition: CastorAmplifier.h:19
Exception
Definition: hltDiff.cc:245
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
CaloTDigitizer::run
void run(MixCollection< PCaloHit > &, DigiCollection &)
turns hits into digis
Definition: CaloTDigitizer.h:86
CastorDigiProducer::theCastorShape
CaloVShape * theCastorShape
Definition: CastorDigiProducer.h:64
CaloHitResponse::setHitCorrection
void setHitCorrection(const CaloVHitCorrection *hitCorrection)
If you want to correct hits, for attenuation or delay, set this.
Definition: CaloHitResponse.h:73
CastorDigiCollection
edm::SortedCollection< CastorDataFrame > CastorDigiCollection
Definition: HcalDigiCollections.h:27
CastorDigiProducer::theHitCorrection
CastorHitCorrection * theHitCorrection
Definition: CastorDigiProducer.h:75
event
Definition: event.py:1
CastorDigiProducer::randomEngine_
CLHEP::HepRandomEngine * randomEngine_
Definition: CastorDigiProducer.h:81
CastorDigiProducer::theCoderFactory
CastorCoderFactory * theCoderFactory
Definition: CastorDigiProducer.h:70
CastorCoderFactory::DB
Definition: CastorCoderFactory.h:10
CastorDigiProducer::theCastorHitFilter
CastorHitFilter theCastorHitFilter
Definition: CastorDigiProducer.h:73
CastorDigiProducer::theHitsProducerTag
edm::InputTag theHitsProducerTag
Definition: CastorDigiProducer.h:55
edm::InputTag
Definition: InputTag.h:15
CaloHitResponse::setGeometry
void setGeometry(const CaloGeometry *geometry)
geometry needed for time-of-flight
Definition: CaloHitResponse.h:49
CastorDigiProducer::theCastorIntegratedShape
CaloVShape * theCastorIntegratedShape
Definition: CastorDigiProducer.h:65
CastorDigiProducer::theParameterMap
CastorSimParameterMap * theParameterMap
Definition: CastorDigiProducer.h:63
CastorDigiProducer::theAmplifier
CastorAmplifier * theAmplifier
Definition: CastorDigiProducer.h:69
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37