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

Member Typedef Documentation

Reconstruction algorithm

Definition at line 70 of file CastorDigiProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 93 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.

102  theAmplifier(nullptr),
103  theCoderFactory(nullptr),
104  theElectronicsSim(nullptr),
105  theHitCorrection(nullptr),
106  theCastorDigitizer(nullptr),
107  theCastorHits() {
108  theHitsProducerTag = ps.getParameter<edm::InputTag>("hitsProducer");
109  iC.consumes<std::vector<PCaloHit>>(theHitsProducerTag);
110 
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
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 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

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

Implements DigiAccumulatorMixMod.

Definition at line 179 of file CastorDigiProducer.cc.

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

179  {
180  // Step A: Get and accumulate digitized hits
181  edm::Handle<std::vector<PCaloHit>> castorHandle;
182  e.getByLabel(theHitsProducerTag, castorHandle);
183 
184  accumulateCaloHits(*castorHandle.product(), 0);
185 }
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 187 of file CastorDigiProducer.cc.

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

189  {
190  // Step A: Get and accumulate digitized hits
191  edm::Handle<std::vector<PCaloHit>> castorHandle;
192  e.getByLabel(theHitsProducerTag, castorHandle);
193 
194  accumulateCaloHits(*castorHandle.product(), e.bunchCrossing());
195 }
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 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
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 230 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().

230  {
231  if (theGeometryWatcher.check(eventSetup)) {
232  const CaloGeometry *geometry = &eventSetup.getData(theGeometryToken);
233  theCastorResponse->setGeometry(geometry);
234 
235  const std::vector<DetId> &castorCells = geometry->getValidDetIds(DetId::Calo, HcalCastorDetId::SubdetectorId);
236 
237  // std::cout<<"CastorDigiProducer::CheckGeometry number of cells:
238  // "<<castorCells.size()<<std::endl;
239  theCastorDigitizer->setDetIds(castorCells);
240  }
241 }
void setGeometry(const CaloGeometry *geometry)
geometry needed for time-of-flight
bool getData(T &iHolder) const
Definition: EventSetup.h:122
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 224 of file CastorDigiProducer.cc.

References DetId::rawId(), and theCastorHits.

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

Implements DigiAccumulatorMixMod.

Definition at line 197 of file CastorDigiProducer.cc.

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

197  {
198  // Step B: Create empty output
199 
200  std::unique_ptr<CastorDigiCollection> castorResult(new CastorDigiCollection());
201 
202  // Step C: Invoke the algorithm, getting back outputs.
203  theCastorDigitizer->run(*castorResult, randomEngine_);
204 
205  edm::LogInfo("CastorDigiProducer") << "HCAL/Castor digis : " << castorResult->size();
206 
207  // Step D: Put outputs into event
208  e.put(std::move(castorResult));
209 
210  randomEngine_ = nullptr; // to prevent access outside event
211 }
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 149 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.

149  {
150  // get the appropriate gains, noises, & widths for this event
151  const CastorDbService *conditions = &eventSetup.getData(theConditionsToken);
152  theAmplifier->setDbService(conditions);
153  theCoderFactory->setDbService(conditions);
154  theParameterMap->setDbService(conditions);
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
163  checkGeometry(eventSetup);
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)
void CastorDigiProducer::sortHits ( const edm::PCaloHitContainer hits)
private

fills the vectors for each subdetector

Definition at line 213 of file CastorDigiProducer.cc.

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

213  {
214  for (edm::PCaloHitContainer::const_iterator hitItr = hits.begin(); hitItr != hits.end(); ++hitItr) {
215  DetId detId = hitItr->id();
216  if (detId.det() == DetId::Calo && detId.subdetId() == HcalCastorDetId::SubdetectorId) {
217  theCastorHits.push_back(*hitItr);
218  } else {
219  edm::LogError("CastorDigiProducer") << "Bad Hit subdetector " << detId.subdetId();
220  }
221  }
222 }
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 90 of file CastorDigiProducer.cc.

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

CastorAmplifier* CastorDigiProducer::theAmplifier
private

Definition at line 78 of file CastorDigiProducer.cc.

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

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

Definition at line 82 of file CastorDigiProducer.cc.

Referenced by CastorDigiProducer().

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

Definition at line 88 of file CastorDigiProducer.cc.

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

CaloVShape* CastorDigiProducer::theCastorIntegratedShape
private

Definition at line 74 of file CastorDigiProducer.cc.

Referenced by ~CastorDigiProducer().

CaloHitResponse* CastorDigiProducer::theCastorResponse
private

Definition at line 76 of file CastorDigiProducer.cc.

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

CaloVShape* CastorDigiProducer::theCastorShape
private

Definition at line 73 of file CastorDigiProducer.cc.

Referenced by ~CastorDigiProducer().

CastorCoderFactory* CastorDigiProducer::theCoderFactory
private

Definition at line 79 of file CastorDigiProducer.cc.

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

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

Definition at line 65 of file CastorDigiProducer.cc.

Referenced by initializeEvent().

CastorElectronicsSim* CastorDigiProducer::theElectronicsSim
private

Definition at line 80 of file CastorDigiProducer.cc.

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

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

Definition at line 66 of file CastorDigiProducer.cc.

Referenced by checkGeometry().

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

Definition at line 67 of file CastorDigiProducer.cc.

Referenced by checkGeometry().

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

Definition at line 64 of file CastorDigiProducer.cc.

Referenced by accumulate(), and CastorDigiProducer().

CastorSimParameterMap* CastorDigiProducer::theParameterMap
private

Definition at line 72 of file CastorDigiProducer.cc.

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