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
 
CastorElectronicsSimtheElectronicsSim
 
CastorHitCorrectiontheHitCorrection
 
edm::InputTag theHitsProducerTag
 
CastorSimParameterMaptheParameterMap
 

Detailed Description

Definition at line 35 of file CastorDigiProducer.h.

Member Typedef Documentation

◆ CastorDigitizer

Reconstruction algorithm

Definition at line 59 of file CastorDigiProducer.h.

Constructor & Destructor Documentation

◆ CastorDigiProducer()

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

Definition at line 22 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 107 of file CastorDigiProducer.cc.

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 }

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

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 }

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

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

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

158  {
159  // TODO find a way to avoid doing this every event
161  eventSetup.get<CaloGeometryRecord>().get(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 }

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

Referenced by initializeEvent().

◆ fillFakeHits()

void CastorDigiProducer::fillFakeHits ( )
private

some hits in each subdetector, just for testing purposes

Definition at line 152 of file CastorDigiProducer.cc.

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

References DetId::rawId(), and theCastorHits.

◆ finalizeEvent()

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

Implements DigiAccumulatorMixMod.

Definition at line 125 of file CastorDigiProducer.cc.

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 }

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
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 }

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

◆ sortHits()

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

fills the vectors for each subdetector

Definition at line 141 of file CastorDigiProducer.cc.

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 }

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 79 of file CastorDigiProducer.h.

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

◆ theAmplifier

CastorAmplifier* CastorDigiProducer::theAmplifier
private

Definition at line 67 of file CastorDigiProducer.h.

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

◆ theCastorDigitizer

CastorDigitizer* CastorDigiProducer::theCastorDigitizer
private

◆ theCastorHitFilter

CastorHitFilter CastorDigiProducer::theCastorHitFilter
private

Definition at line 71 of file CastorDigiProducer.h.

Referenced by CastorDigiProducer().

◆ theCastorHits

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

Definition at line 77 of file CastorDigiProducer.h.

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

◆ theCastorIntegratedShape

CaloVShape* CastorDigiProducer::theCastorIntegratedShape
private

Definition at line 63 of file CastorDigiProducer.h.

Referenced by ~CastorDigiProducer().

◆ theCastorResponse

CaloHitResponse* CastorDigiProducer::theCastorResponse
private

Definition at line 65 of file CastorDigiProducer.h.

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

◆ theCastorShape

CaloVShape* CastorDigiProducer::theCastorShape
private

Definition at line 62 of file CastorDigiProducer.h.

Referenced by ~CastorDigiProducer().

◆ theCoderFactory

CastorCoderFactory* CastorDigiProducer::theCoderFactory
private

Definition at line 68 of file CastorDigiProducer.h.

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

◆ theElectronicsSim

CastorElectronicsSim* CastorDigiProducer::theElectronicsSim
private

Definition at line 69 of file CastorDigiProducer.h.

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

◆ theHitCorrection

CastorHitCorrection* CastorDigiProducer::theHitCorrection
private

◆ theHitsProducerTag

edm::InputTag CastorDigiProducer::theHitsProducerTag
private

Definition at line 56 of file CastorDigiProducer.h.

Referenced by accumulate(), and CastorDigiProducer().

◆ theParameterMap

CastorSimParameterMap* CastorDigiProducer::theParameterMap
private

Definition at line 61 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
CastorDigiProducer::theCastorResponse
CaloHitResponse * theCastorResponse
Definition: CastorDigiProducer.h:65
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
CastorDigiProducer::theCastorDigitizer
CastorDigitizer * theCastorDigitizer
Definition: CastorDigiProducer.h:75
edm::RandomNumberGenerator::getEngine
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
geometry
ESHandle< TrackerGeometry > geometry
Definition: TkLasBeamFitter.cc:200
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:59
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
geometry
Definition: geometry.py:1
edm::LogInfo
Definition: MessageLogger.h:254
CastorDigiProducer::theElectronicsSim
CastorElectronicsSim * theElectronicsSim
Definition: CastorDigiProducer.h:69
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
CastorDigiProducer::theCastorHits
std::vector< PCaloHit > theCastorHits
Definition: CastorDigiProducer.h:77
HcalCastorDetId::Section
Section
Definition: HcalCastorDetId.h:25
CaloShapeIntegrator
Definition: CaloShapeIntegrator.h:11
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
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
CastorDigiProducer::checkGeometry
void checkGeometry(const edm::EventSetup &eventSetup)
Definition: CastorDigiProducer.cc:158
edm::ESHandle< CaloGeometry >
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:49
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
edm::LogError
Definition: MessageLogger.h:183
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 >
CastorDigiProducer::accumulateCaloHits
void accumulateCaloHits(std::vector< PCaloHit > const &, int bunchCrossing)
Definition: CastorDigiProducer.cc:98
edm::ProducesCollector::produces
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
Definition: ProducesCollector.h:52
get
#define get
CastorAmplifier
Definition: CastorAmplifier.h:13
CastorDbRecord
Definition: CastorDbRecord.h:29
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
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:246
CaloTDigitizer::run
void run(MixCollection< PCaloHit > &, DigiCollection &)
turns hits into digis
Definition: CaloTDigitizer.h:86
CastorDigiProducer::theCastorShape
CaloVShape * theCastorShape
Definition: CastorDigiProducer.h:62
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:73
event
Definition: event.py:1
CastorDigiProducer::randomEngine_
CLHEP::HepRandomEngine * randomEngine_
Definition: CastorDigiProducer.h:79
CastorDigiProducer::theCoderFactory
CastorCoderFactory * theCoderFactory
Definition: CastorDigiProducer.h:68
CastorCoderFactory::DB
Definition: CastorCoderFactory.h:10
CastorDigiProducer::theCastorHitFilter
CastorHitFilter theCastorHitFilter
Definition: CastorDigiProducer.h:71
CastorDigiProducer::theHitsProducerTag
edm::InputTag theHitsProducerTag
Definition: CastorDigiProducer.h:56
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:63
CastorDigiProducer::theParameterMap
CastorSimParameterMap * theParameterMap
Definition: CastorDigiProducer.h:61
CastorDigiProducer::theAmplifier
CastorAmplifier * theAmplifier
Definition: CastorDigiProducer.h:67
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37