CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
CastorDigiProducer Class Reference
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 ()
 
 DigiAccumulatorMixMod (DigiAccumulatorMixMod const &)=delete
 
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)
 
DigiAccumulatorMixMod const & operator= (DigiAccumulatorMixMod const &)=delete
 
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

const edm::EDGetTokenT< std::vector< PCaloHit > > hitToken_
 
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
 
const edm::InputTag theHitsProducerTag
 
CastorSimParameterMaptheParameterMap
 

Detailed Description

Definition at line 43 of file CastorDigiProducer.cc.

Member Typedef Documentation

◆ CastorDigitizer

Reconstruction algorithm

Definition at line 71 of file CastorDigiProducer.cc.

Constructor & Destructor Documentation

◆ CastorDigiProducer()

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

Definition at line 94 of file CastorDigiProducer.cc.

References 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, and theParameterMap.

99  theHitsProducerTag(ps.getParameter<edm::InputTag>("hitsProducer")),
100  hitToken_(iC.consumes<std::vector<PCaloHit>>(theHitsProducerTag)),
105  theAmplifier(nullptr),
106  theCoderFactory(nullptr),
107  theElectronicsSim(nullptr),
108  theHitCorrection(nullptr),
109  theCastorDigitizer(nullptr),
110  theCastorHits() {
111  producesCollector.produces<CastorDigiCollection>();
112 
114 
115  bool doTimeSlew = ps.getParameter<bool>("doTimeSlew");
116  if (doTimeSlew) {
117  // no time slewing for HF
119  }
120 
121  bool doNoise = ps.getParameter<bool>("doNoise");
125 
127 
129  if (!rng.isAvailable()) {
130  throw cms::Exception("Configuration") << "CastorDigiProducer requires the RandomNumberGeneratorService\n"
131  "which is not present in the configuration file. You must add the "
132  "service\n"
133  "in the configuration file or remove the modules that require it.";
134  }
135 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
CastorAmplifier * theAmplifier
CaloVShape * theCastorShape
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
CaloTDigitizer< CastorDigitizerTraits > CastorDigitizer
CastorSimParameterMap * theParameterMap
const edm::InputTag theHitsProducerTag
CastorElectronicsSim * theElectronicsSim
CastorHitFilter theCastorHitFilter
void setHitFilter(const CaloVHitFilter *filter)
Creates electronics signals from hits.
CaloHitResponse * theCastorResponse
std::vector< PCaloHit > theCastorHits
const edm::EDGetTokenT< std::vector< PCaloHit > > hitToken_
CastorHitCorrection * theHitCorrection
const edm::ESGetToken< CastorDbService, CastorDbRecord > theConditionsToken
CastorDigitizer * theCastorDigitizer
void setHitCorrection(const CaloVHitCorrection *hitCorrection)
If you want to correct hits, for attenuation or delay, set this.
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > theGeometryToken
CastorCoderFactory * theCoderFactory
shaper for Castor
Definition: CastorShape.h:15
bool isAvailable() const
Definition: Service.h:40
CaloVShape * theCastorIntegratedShape

◆ ~CastorDigiProducer()

CastorDigiProducer::~CastorDigiProducer ( )
override

Definition at line 137 of file CastorDigiProducer.cc.

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

137  {
138  delete theCastorDigitizer;
139  delete theParameterMap;
140  delete theCastorShape;
142  delete theCastorResponse;
143  delete theElectronicsSim;
144  delete theAmplifier;
145  delete theCoderFactory;
146  delete theHitCorrection;
147 }
CastorAmplifier * theAmplifier
CaloVShape * theCastorShape
CastorSimParameterMap * theParameterMap
CastorElectronicsSim * theElectronicsSim
CaloHitResponse * theCastorResponse
CastorHitCorrection * theHitCorrection
CastorDigitizer * theCastorDigitizer
CastorCoderFactory * theCoderFactory
CaloVShape * theCastorIntegratedShape

Member Function Documentation

◆ accumulate() [1/2]

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

Implements DigiAccumulatorMixMod.

Definition at line 179 of file CastorDigiProducer.cc.

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

179  {
180  // Step A: Get and accumulate digitized hits
181  const edm::Handle<std::vector<PCaloHit>> &castorHandle = e.getHandle(hitToken_);
182 
183  accumulateCaloHits(*castorHandle.product(), 0);
184 }
T const * product() const
Definition: Handle.h:70
void accumulateCaloHits(std::vector< PCaloHit > const &, int bunchCrossing)
const edm::EDGetTokenT< std::vector< PCaloHit > > hitToken_

◆ accumulate() [2/2]

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

Implements DigiAccumulatorMixMod.

Definition at line 186 of file CastorDigiProducer.cc.

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

188  {
189  // Step A: Get and accumulate digitized hits
190  edm::Handle<std::vector<PCaloHit>> castorHandle;
191  e.getByLabel(theHitsProducerTag, castorHandle);
192 
193  accumulateCaloHits(*castorHandle.product(), e.bunchCrossing());
194 }
T const * product() const
Definition: Handle.h:70
const edm::InputTag theHitsProducerTag
void accumulateCaloHits(std::vector< PCaloHit > const &, int bunchCrossing)

◆ accumulateCaloHits()

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

Definition at line 170 of file CastorDigiProducer.cc.

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

Referenced by accumulate().

170  {
171  // fillFakeHits();
172 
173  if (theHitCorrection != nullptr) {
174  theHitCorrection->fillChargeSums(hcalHits);
175  }
176  theCastorDigitizer->add(hcalHits, bunchCrossing, randomEngine_);
177 }
void add(const std::vector< PCaloHit > &hits, int bunchCrossing, CLHEP::HepRandomEngine *engine)
void fillChargeSums(MixCollection< PCaloHit > &hits)
CLHEP::HepRandomEngine * randomEngine_
CastorHitCorrection * theHitCorrection
CastorDigitizer * theCastorDigitizer

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

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

Referenced by initializeEvent().

229  {
233 
234  const std::vector<DetId> &castorCells = geometry->getValidDetIds(DetId::Calo, HcalCastorDetId::SubdetectorId);
235 
236  // // edm::LogInfo("CastorDigiProducer") << "CastorDigiProducer::CheckGeometry number of cells:" << castorCells.size()
237  ;
238  theCastorDigitizer->setDetIds(castorCells);
239  }
240 }
void setGeometry(const CaloGeometry *geometry)
geometry needed for time-of-flight
CaloHitResponse * theCastorResponse
static const int SubdetectorId
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
CastorDigitizer * theCastorDigitizer
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > theGeometryToken
edm::ESWatcher< CaloGeometryRecord > theGeometryWatcher
void setDetIds(const std::vector< DetId > &detIds)

◆ fillFakeHits()

void CastorDigiProducer::fillFakeHits ( )
private

some hits in each subdetector, just for testing purposes

Definition at line 223 of file CastorDigiProducer.cc.

References DetId::rawId(), and theCastorHits.

223  {
224  HcalCastorDetId castorDetId(HcalCastorDetId::Section(2), true, 1, 1);
225 
226  theCastorHits.emplace_back(castorDetId.rawId(), 50.0, 0.);
227 }
std::vector< PCaloHit > theCastorHits

◆ finalizeEvent()

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

Implements DigiAccumulatorMixMod.

Definition at line 196 of file CastorDigiProducer.cc.

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

196  {
197  // Step B: Create empty output
198 
199  std::unique_ptr<CastorDigiCollection> castorResult(new CastorDigiCollection());
200 
201  // Step C: Invoke the algorithm, getting back outputs.
202  theCastorDigitizer->run(*castorResult, randomEngine_);
203 
204  edm::LogInfo("CastorDigiProducer") << "HCAL/Castor digis : " << castorResult->size();
205 
206  // Step D: Put outputs into event
207  e.put(std::move(castorResult));
208 
209  randomEngine_ = nullptr; // to prevent access outside event
210 }
CLHEP::HepRandomEngine * randomEngine_
Log< level::Info, false > LogInfo
void run(MixCollection< PCaloHit > &, DigiCollection &)
turns hits into digis
CastorDigitizer * theCastorDigitizer
edm::SortedCollection< CastorDataFrame > CastorDigiCollection
def move(src, dest)
Definition: eostools.py:511

◆ initializeEvent()

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

Implements DigiAccumulatorMixMod.

Definition at line 149 of file CastorDigiProducer.cc.

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

149  {
150  // get the appropriate gains, noises, & widths for this event
155 
156  // Cache random number engine
158  randomEngine_ = &rng->getEngine(event.streamID());
159 
160  edm::LogInfo("CastorDigiProducer") << "checking the geometry...";
161 
162  // get the correct geometry
164 
165  theCastorHits.clear();
166 
168 }
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
Log< level::Info, false > LogInfo
const edm::ESGetToken< CastorDbService, CastorDbRecord > theConditionsToken
CastorDigitizer * theCastorDigitizer
CastorCoderFactory * theCoderFactory
void setDbService(const CastorDbService *service)
the Producer will probably update this every event
void setDbService(const CastorDbService *service)
Definition: event.py:1

◆ sortHits()

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

fills the vectors for each subdetector

Definition at line 212 of file CastorDigiProducer.cc.

References DetId::Calo, hcalRecHitTable_cff::detId, hfClusterShapes_cfi::hits, HcalCastorDetId::SubdetectorId, and theCastorHits.

212  {
213  for (edm::PCaloHitContainer::const_iterator hitItr = hits.begin(); hitItr != hits.end(); ++hitItr) {
214  DetId detId = hitItr->id();
215  if (detId.det() == DetId::Calo && detId.subdetId() == HcalCastorDetId::SubdetectorId) {
216  theCastorHits.push_back(*hitItr);
217  } else {
218  edm::LogError("CastorDigiProducer") << "Bad Hit subdetector " << detId.subdetId();
219  }
220  }
221 }
Log< level::Error, false > LogError
std::vector< PCaloHit > theCastorHits
static const int SubdetectorId
Definition: DetId.h:17

Member Data Documentation

◆ hitToken_

const edm::EDGetTokenT<std::vector<PCaloHit> > CastorDigiProducer::hitToken_
private

Definition at line 68 of file CastorDigiProducer.cc.

Referenced by accumulate().

◆ randomEngine_

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

Definition at line 91 of file CastorDigiProducer.cc.

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

◆ theAmplifier

CastorAmplifier* CastorDigiProducer::theAmplifier
private

Definition at line 79 of file CastorDigiProducer.cc.

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

◆ theCastorDigitizer

CastorDigitizer* CastorDigiProducer::theCastorDigitizer
private

◆ theCastorHitFilter

CastorHitFilter CastorDigiProducer::theCastorHitFilter
private

Definition at line 83 of file CastorDigiProducer.cc.

Referenced by CastorDigiProducer().

◆ theCastorHits

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

Definition at line 89 of file CastorDigiProducer.cc.

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

◆ theCastorIntegratedShape

CaloVShape* CastorDigiProducer::theCastorIntegratedShape
private

Definition at line 75 of file CastorDigiProducer.cc.

Referenced by ~CastorDigiProducer().

◆ theCastorResponse

CaloHitResponse* CastorDigiProducer::theCastorResponse
private

Definition at line 77 of file CastorDigiProducer.cc.

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

◆ theCastorShape

CaloVShape* CastorDigiProducer::theCastorShape
private

Definition at line 74 of file CastorDigiProducer.cc.

Referenced by ~CastorDigiProducer().

◆ theCoderFactory

CastorCoderFactory* CastorDigiProducer::theCoderFactory
private

Definition at line 80 of file CastorDigiProducer.cc.

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

◆ theConditionsToken

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

Definition at line 64 of file CastorDigiProducer.cc.

Referenced by initializeEvent().

◆ theElectronicsSim

CastorElectronicsSim* CastorDigiProducer::theElectronicsSim
private

Definition at line 81 of file CastorDigiProducer.cc.

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

◆ theGeometryToken

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

Definition at line 65 of file CastorDigiProducer.cc.

Referenced by checkGeometry().

◆ theGeometryWatcher

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

Definition at line 66 of file CastorDigiProducer.cc.

Referenced by checkGeometry().

◆ theHitCorrection

CastorHitCorrection* CastorDigiProducer::theHitCorrection
private

◆ theHitsProducerTag

const edm::InputTag CastorDigiProducer::theHitsProducerTag
private

Definition at line 67 of file CastorDigiProducer.cc.

Referenced by accumulate().

◆ theParameterMap

CastorSimParameterMap* CastorDigiProducer::theParameterMap
private

Definition at line 73 of file CastorDigiProducer.cc.

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