CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
< CastorDigitizerTraits
CastorDigitizer
 

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,
CastorDbRecord
theConditionsToken
 
CastorElectronicsSimtheElectronicsSim
 
const edm::ESGetToken
< CaloGeometry,
CaloGeometryRecord
theGeometryToken
 
edm::ESWatcher
< CaloGeometryRecord
theGeometryWatcher
 
CastorHitCorrectiontheHitCorrection
 
edm::InputTag theHitsProducerTag
 
CastorSimParameterMaptheParameterMap
 

Detailed Description

Definition at line 44 of file CastorDigiProducer.cc.

Member Typedef Documentation

Reconstruction algorithm

Definition at line 71 of file CastorDigiProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 94 of file CastorDigiProducer.cc.

References edm::ConsumesCollector::consumes(), CastorCoderFactory::DB, hcalUnsuppressedDigis_cfi::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.

103  theAmplifier(nullptr),
104  theCoderFactory(nullptr),
105  theElectronicsSim(nullptr),
106  theHitCorrection(nullptr),
107  theCastorDigitizer(nullptr),
108  theCastorHits() {
109  theHitsProducerTag = ps.getParameter<edm::InputTag>("hitsProducer");
110  iC.consumes<std::vector<PCaloHit>>(theHitsProducerTag);
111 
112  producesCollector.produces<CastorDigiCollection>();
113 
115 
116  bool doTimeSlew = ps.getParameter<bool>("doTimeSlew");
117  if (doTimeSlew) {
118  // no time slewing for HF
120  }
121 
122  bool doNoise = ps.getParameter<bool>("doNoise");
126 
128 
130  if (!rng.isAvailable()) {
131  throw cms::Exception("Configuration") << "CastorDigiProducer requires the RandomNumberGeneratorService\n"
132  "which is not present in the configuration file. You must add the "
133  "service\n"
134  "in the configuration file or remove the modules that require it.";
135  }
136 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
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
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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
edm::InputTag theHitsProducerTag
CaloVShape * theCastorIntegratedShape
CastorDigiProducer::~CastorDigiProducer ( )
override

Definition at line 138 of file CastorDigiProducer.cc.

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

138  {
139  delete theCastorDigitizer;
140  delete theParameterMap;
141  delete theCastorShape;
143  delete theCastorResponse;
144  delete theElectronicsSim;
145  delete theAmplifier;
146  delete theCoderFactory;
147  delete theHitCorrection;
148 }
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 180 of file CastorDigiProducer.cc.

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

180  {
181  // Step A: Get and accumulate digitized hits
182  edm::Handle<std::vector<PCaloHit>> castorHandle;
183  e.getByLabel(theHitsProducerTag, castorHandle);
184 
185  accumulateCaloHits(*castorHandle.product(), 0);
186 }
void accumulateCaloHits(std::vector< PCaloHit > const &, int bunchCrossing)
T const * product() const
Definition: Handle.h:70
edm::InputTag theHitsProducerTag
void CastorDigiProducer::accumulate ( PileUpEventPrincipal const &  e,
edm::EventSetup const &  c,
edm::StreamID const &  streamID 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 188 of file CastorDigiProducer.cc.

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

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

Definition at line 171 of file CastorDigiProducer.cc.

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

Referenced by accumulate().

171  {
172  // fillFakeHits();
173 
174  if (theHitCorrection != nullptr) {
175  theHitCorrection->fillChargeSums(hcalHits);
176  }
177  theCastorDigitizer->add(hcalHits, bunchCrossing, randomEngine_);
178 }
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 231 of file CastorDigiProducer.cc.

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

Referenced by initializeEvent().

231  {
232  if (theGeometryWatcher.check(eventSetup)) {
233  const CaloGeometry *geometry = &eventSetup.getData(theGeometryToken);
234  theCastorResponse->setGeometry(geometry);
235 
236  const std::vector<DetId> &castorCells = geometry->getValidDetIds(DetId::Calo, HcalCastorDetId::SubdetectorId);
237 
238  // std::cout<<"CastorDigiProducer::CheckGeometry number of cells:
239  // "<<castorCells.size()<<std::endl;
240  theCastorDigitizer->setDetIds(castorCells);
241  }
242 }
void setGeometry(const CaloGeometry *geometry)
geometry needed for time-of-flight
bool getData(T &iHolder) const
Definition: EventSetup.h:128
CaloHitResponse * theCastorResponse
static const int SubdetectorId
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:75
CastorDigitizer * theCastorDigitizer
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > theGeometryToken
edm::ESWatcher< CaloGeometryRecord > theGeometryWatcher
void setDetIds(const std::vector< DetId > &detIds)
void CastorDigiProducer::fillFakeHits ( )
private

some hits in each subdetector, just for testing purposes

Definition at line 225 of file CastorDigiProducer.cc.

References DetId::rawId(), and theCastorHits.

225  {
226  HcalCastorDetId castorDetId(HcalCastorDetId::Section(2), true, 1, 1);
227 
228  theCastorHits.emplace_back(castorDetId.rawId(), 50.0, 0.);
229 }
std::vector< PCaloHit > theCastorHits
void CastorDigiProducer::finalizeEvent ( edm::Event e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 198 of file CastorDigiProducer.cc.

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

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

Implements DigiAccumulatorMixMod.

Definition at line 150 of file CastorDigiProducer.cc.

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

150  {
151  // get the appropriate gains, noises, & widths for this event
152  const CastorDbService *conditions = &eventSetup.getData(theConditionsToken);
153  theAmplifier->setDbService(conditions);
154  theCoderFactory->setDbService(conditions);
155  theParameterMap->setDbService(conditions);
156 
157  // Cache random number engine
159  randomEngine_ = &rng->getEngine(event.streamID());
160 
161  edm::LogInfo("CastorDigiProducer") << "checking the geometry...";
162 
163  // get the correct geometry
164  checkGeometry(eventSetup);
165 
166  theCastorHits.clear();
167 
169 }
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)
void CastorDigiProducer::sortHits ( const edm::PCaloHitContainer hits)
private

fills the vectors for each subdetector

Definition at line 214 of file CastorDigiProducer.cc.

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

214  {
215  for (edm::PCaloHitContainer::const_iterator hitItr = hits.begin(); hitItr != hits.end(); ++hitItr) {
216  DetId detId = hitItr->id();
217  if (detId.det() == DetId::Calo && detId.subdetId() == HcalCastorDetId::SubdetectorId) {
218  theCastorHits.push_back(*hitItr);
219  } else {
220  edm::LogError("CastorDigiProducer") << "Bad Hit subdetector " << detId.subdetId();
221  }
222  }
223 }
Log< level::Error, false > LogError
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_ = nullptr
private

Definition at line 91 of file CastorDigiProducer.cc.

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

CastorAmplifier* CastorDigiProducer::theAmplifier
private

Definition at line 79 of file CastorDigiProducer.cc.

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

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

Definition at line 83 of file CastorDigiProducer.cc.

Referenced by CastorDigiProducer().

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

Definition at line 89 of file CastorDigiProducer.cc.

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

CaloVShape* CastorDigiProducer::theCastorIntegratedShape
private

Definition at line 75 of file CastorDigiProducer.cc.

Referenced by ~CastorDigiProducer().

CaloHitResponse* CastorDigiProducer::theCastorResponse
private

Definition at line 77 of file CastorDigiProducer.cc.

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

CaloVShape* CastorDigiProducer::theCastorShape
private

Definition at line 74 of file CastorDigiProducer.cc.

Referenced by ~CastorDigiProducer().

CastorCoderFactory* CastorDigiProducer::theCoderFactory
private

Definition at line 80 of file CastorDigiProducer.cc.

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

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

Definition at line 66 of file CastorDigiProducer.cc.

Referenced by initializeEvent().

CastorElectronicsSim* CastorDigiProducer::theElectronicsSim
private

Definition at line 81 of file CastorDigiProducer.cc.

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

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

Definition at line 67 of file CastorDigiProducer.cc.

Referenced by checkGeometry().

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

Definition at line 68 of file CastorDigiProducer.cc.

Referenced by checkGeometry().

CastorHitCorrection* CastorDigiProducer::theHitCorrection
private
edm::InputTag CastorDigiProducer::theHitsProducerTag
private

Definition at line 65 of file CastorDigiProducer.cc.

Referenced by accumulate(), and CastorDigiProducer().

CastorSimParameterMap* CastorDigiProducer::theParameterMap
private

Definition at line 73 of file CastorDigiProducer.cc.

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