CMS 3D CMS Logo

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

CastorDigiProducer Class Reference

#include <CastorDigiProducer.h>

Inheritance diagram for CastorDigiProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 CastorDigiProducer (const edm::ParameterSet &ps)
virtual void produce (edm::Event &e, const edm::EventSetup &c)
virtual ~CastorDigiProducer ()

Private Types

typedef CaloTDigitizer
< CastorDigitizerTraits
CastorDigitizer

Private Member Functions

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


Member Typedef Documentation

Reconstruction algorithm

Definition at line 41 of file CastorDigiProducer.h.


Constructor & Destructor Documentation

CastorDigiProducer::CastorDigiProducer ( const edm::ParameterSet ps) [explicit]

Definition at line 22 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()
{
  
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::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 143 of file CastorDigiProducer.cc.

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

Referenced by produce().

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

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

References DetId::rawId(), and theCastorHits.

                                      {
HcalCastorDetId castorDetId(HcalCastorDetId::Section(2),true,1,1);
PCaloHit castorHit(castorDetId.rawId(), 50.0, 0.);

theCastorHits.push_back(castorHit);
}
void CastorDigiProducer::produce ( edm::Event e,
const edm::EventSetup c 
) [virtual]

Produces the EDM products,

Implements edm::EDProducer.

Definition at line 79 of file CastorDigiProducer.cc.

References checkGeometry(), CastorHitCorrection::fillChargeSums(), edm::EventSetup::get(), edm::Event::getByLabel(), edm::ESHandle< T >::product(), edm::Handle< T >::product(), edm::Event::put(), CaloTDigitizer< Traits >::run(), CastorAmplifier::setDbService(), CastorSimParameterMap::setDbService(), CastorCoderFactory::setDbService(), theAmplifier, theCastorDigitizer, theCastorHits, theCoderFactory, theHitCorrection, 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();

  // Step A: Get Inputs
//edm::Handle<edm::PCaloHitContainer> castorcf;
edm::Handle<CrossingFrame<PCaloHit> > castorcf;
e.getByLabel("mix", "g4SimHitsCastorFI", castorcf);

  // test access to SimHits for HcalHits and ZDC hits
std::auto_ptr<MixCollection<PCaloHit> > colcastor(new MixCollection<PCaloHit>(castorcf.product()));

  //fillFakeHits();

if(theHitCorrection != 0)
  {
theHitCorrection->fillChargeSums(*colcastor);
  }
  // Step B: Create empty output

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

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

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

  // Step D: Put outputs into event
e.put(castorResult);
}
void CastorDigiProducer::sortHits ( const edm::PCaloHitContainer hits) [private]

fills the vectors for each subdetector

Definition at line 122 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 49 of file CastorDigiProducer.h.

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

Definition at line 53 of file CastorDigiProducer.h.

Referenced by CastorDigiProducer().

Definition at line 59 of file CastorDigiProducer.h.

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

Definition at line 45 of file CastorDigiProducer.h.

Referenced by ~CastorDigiProducer().

Definition at line 47 of file CastorDigiProducer.h.

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

Definition at line 44 of file CastorDigiProducer.h.

Referenced by ~CastorDigiProducer().

Definition at line 50 of file CastorDigiProducer.h.

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

Definition at line 51 of file CastorDigiProducer.h.

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

Definition at line 55 of file CastorDigiProducer.h.

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

Definition at line 43 of file CastorDigiProducer.h.

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