CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes

CastorDigiProducer Class Reference

#include <CastorDigiProducer.h>

Inheritance diagram for CastorDigiProducer:
DigiAccumulatorMixMod

List of all members.

Public Member Functions

virtual void accumulate (edm::Event const &e, edm::EventSetup const &c)
virtual void accumulate (PileUpEventPrincipal const &e, edm::EventSetup const &c)
 CastorDigiProducer (const edm::ParameterSet &ps, edm::EDProducer &mixMod)
virtual void finalizeEvent (edm::Event &e, edm::EventSetup const &c)
virtual void initializeEvent (edm::Event const &e, edm::EventSetup const &c)
virtual ~CastorDigiProducer ()

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
void sortHits (const edm::PCaloHitContainer &hits)
 fills the vectors for each subdetector

Private Attributes

CastorAmplifiertheAmplifier
CastorDigitizertheCastorDigitizer
CastorHitFilter theCastorHitFilter
std::vector< PCaloHittheCastorHits
CaloVShapetheCastorIntegratedShape
CaloHitResponsetheCastorResponse
CaloVShapetheCastorShape
CastorCoderFactorytheCoderFactory
CastorElectronicsSimtheElectronicsSim
CastorHitCorrectiontheHitCorrection
CastorSimParameterMaptheParameterMap

Detailed Description

Definition at line 26 of file CastorDigiProducer.h.


Member Typedef Documentation

Reconstruction algorithm

Definition at line 49 of file CastorDigiProducer.h.


Constructor & Destructor Documentation

CastorDigiProducer::CastorDigiProducer ( const edm::ParameterSet ps,
edm::EDProducer mixMod 
) [explicit]

Definition at line 21 of file CastorDigiProducer.cc.

References CastorCoderFactory::DB, Exception, edm::ParameterSet::getParameter(), edm::Service< T >::isAvailable(), CaloHitResponse::setHitCorrection(), CaloHitResponse::setHitFilter(), CastorElectronicsSim::setRandomEngine(), theAmplifier, theCastorDigitizer, theCastorHitFilter, theCastorResponse, theCoderFactory, theElectronicsSim, theHitCorrection, and theParameterMap.

: theParameterMap(new CastorSimParameterMap(ps)),
  theCastorShape(new CastorShape()),
  theCastorIntegratedShape(new CaloShapeIntegrator(theCastorShape)),
  theCastorResponse(new CaloHitResponse(theParameterMap, theCastorIntegratedShape)),
  theAmplifier(0),
  theCoderFactory(0),
  theElectronicsSim(0),
  theHitCorrection(0),
  theCastorDigitizer(0),
  theCastorHits()
{
  
  mixMod.produces<CastorDigiCollection>();

  theCastorResponse->setHitFilter(&theCastorHitFilter);

  bool doTimeSlew = ps.getParameter<bool>("doTimeSlew");
  if(doTimeSlew) {
    // no time slewing for HF
    theCastorResponse->setHitCorrection(theHitCorrection);
  }

  bool doNoise = ps.getParameter<bool>("doNoise");
  theAmplifier = new CastorAmplifier(theParameterMap, doNoise);
  theCoderFactory = new CastorCoderFactory(CastorCoderFactory::DB);
  theElectronicsSim = new CastorElectronicsSim(theAmplifier, theCoderFactory);

  theCastorDigitizer = new CastorDigitizer(theCastorResponse, theElectronicsSim, doNoise);

  edm::Service<edm::RandomNumberGenerator> rng;
  if ( ! rng.isAvailable()) {
    throw cms::Exception("Configuration")
      << "CastorDigiProducer requires the RandomNumberGeneratorService\n"
         "which is not present in the configuration file.  You must add the service\n"
         "in the configuration file or remove the modules that require it.";
  }

  CLHEP::HepRandomEngine& engine = rng->getEngine();
  theAmplifier->setRandomEngine(engine);
  theElectronicsSim->setRandomEngine(engine);
}
CastorDigiProducer::~CastorDigiProducer ( ) [virtual]

Member Function Documentation

void CastorDigiProducer::accumulate ( edm::Event const &  e,
edm::EventSetup const &  c 
) [virtual]

Implements DigiAccumulatorMixMod.

Definition at line 104 of file CastorDigiProducer.cc.

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

                                                                           {
  // Step A: Get and accumulate digitized hits 
  edm::InputTag castorTag("g4SimHits", "CastorFI");
  edm::Handle<std::vector<PCaloHit> > castorHandle;
  e.getByLabel(castorTag, castorHandle);

  accumulateCaloHits(*castorHandle.product(), 0);
}
void CastorDigiProducer::accumulate ( PileUpEventPrincipal const &  e,
edm::EventSetup const &  c 
) [virtual]

Implements DigiAccumulatorMixMod.

Definition at line 113 of file CastorDigiProducer.cc.

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

                                                                                       {
  // Step A: Get and accumulate digitized hits 
  edm::InputTag castorTag("g4SimHits", "CastorFI");
  edm::Handle<std::vector<PCaloHit> > castorHandle;
  e.getByLabel(castorTag, castorHandle);

  accumulateCaloHits(*castorHandle.product(), e.bunchCrossing());
}
void CastorDigiProducer::accumulateCaloHits ( std::vector< PCaloHit > const &  hcalHits,
int  bunchCrossing 
) [private]

Definition at line 95 of file CastorDigiProducer.cc.

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

Referenced by accumulate().

                                                                                                  {
  //fillFakeHits();

  if(theHitCorrection != 0) {
    theHitCorrection->fillChargeSums(hcalHits);
  }
  theCastorDigitizer->add(hcalHits, bunchCrossing); 
}
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.

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

Referenced by initializeEvent().

                                                                       {
  // TODO find a way to avoid doing this every event
  edm::ESHandle<CaloGeometry> geometry;
  eventSetup.get<CaloGeometryRecord>().get(geometry);
  theCastorResponse->setGeometry(&*geometry);

  const std::vector<DetId>& castorCells = geometry->getValidDetIds(DetId::Calo, HcalCastorDetId::SubdetectorId);

  //std::cout<<"CastorDigiProducer::CheckGeometry number of cells: "<<castorCells.size()<<std::endl;
  theCastorDigitizer->setDetIds(castorCells);
}
void CastorDigiProducer::fillFakeHits ( ) [private]

some hits in each subdetector, just for testing purposes

Definition at line 150 of file CastorDigiProducer.cc.

References DetId::rawId(), and theCastorHits.

                                      {
  HcalCastorDetId castorDetId(HcalCastorDetId::Section(2),true,1,1);

  theCastorHits.emplace_back(castorDetId.rawId(), 50.0, 0.);
}
void CastorDigiProducer::finalizeEvent ( edm::Event e,
edm::EventSetup const &  c 
) [virtual]

Implements DigiAccumulatorMixMod.

Definition at line 122 of file CastorDigiProducer.cc.

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

                                                                                   {
  // Step B: Create empty output

  std::auto_ptr<CastorDigiCollection> castorResult(new CastorDigiCollection());

  // Step C: Invoke the algorithm, getting back outputs.
  theCastorDigitizer->run(*castorResult);

  edm::LogInfo("CastorDigiProducer") << "HCAL/Castor digis   : " << castorResult->size();

  // Step D: Put outputs into event
  e.put(castorResult);
}
void CastorDigiProducer::initializeEvent ( edm::Event const &  e,
edm::EventSetup const &  c 
) [virtual]

Implements DigiAccumulatorMixMod.

Definition at line 77 of file CastorDigiProducer.cc.

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

                                                                                         {
  // get the appropriate gains, noises, & widths for this event
  edm::ESHandle<CastorDbService> conditions;
  eventSetup.get<CastorDbRecord>().get(conditions);
  theAmplifier->setDbService(conditions.product());
  theCoderFactory->setDbService(conditions.product());
  theParameterMap->setDbService(conditions.product());

  edm::LogInfo("CastorDigiProducer") << "checking the geometry...";

  // get the correct geometry
  checkGeometry(eventSetup);
  
  theCastorHits.clear();

  theCastorDigitizer->initializeHits();
}
void CastorDigiProducer::sortHits ( const edm::PCaloHitContainer hits) [private]

fills the vectors for each subdetector

Definition at line 137 of file CastorDigiProducer.cc.

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

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

Member Data Documentation

Definition at line 57 of file CastorDigiProducer.h.

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

Definition at line 61 of file CastorDigiProducer.h.

Referenced by CastorDigiProducer().

Definition at line 67 of file CastorDigiProducer.h.

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

Definition at line 53 of file CastorDigiProducer.h.

Referenced by ~CastorDigiProducer().

Definition at line 55 of file CastorDigiProducer.h.

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

Definition at line 52 of file CastorDigiProducer.h.

Referenced by ~CastorDigiProducer().

Definition at line 58 of file CastorDigiProducer.h.

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

Definition at line 59 of file CastorDigiProducer.h.

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

Definition at line 51 of file CastorDigiProducer.h.

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