CMS 3D CMS Logo

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

HcalTBDigiProducer Class Reference

#include <HcalTBDigiProducer.h>

Inheritance diagram for HcalTBDigiProducer:
DigiAccumulatorMixMod

List of all members.

Public Member Functions

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

Private Types

typedef CaloTDigitizer
< HBHEDigitizerTraits
HBHEDigitizer
typedef CaloTDigitizer
< HODigitizerTraits
HODigitizer

Private Member Functions

void accumulateCaloHits (edm::Handle< std::vector< PCaloHit > > const &hits, int bunchCrossing)
void checkGeometry (const edm::EventSetup &eventSetup)
void setPhaseShift (const DetId &detId)
void sortHits (const edm::PCaloHitContainer &hits)
 fills the vectors for each subdetector
void updateGeometry ()

Private Attributes

bool doPhaseShift
std::string ecalTBInfoLabel
std::vector< DetIdhbheCells
std::vector< DetIdhoCells
HcalAmplifiertheAmplifier
HcalCoderFactorytheCoderFactory
HcalElectronicsSimtheElectronicsSim
const CaloGeometrytheGeometry
HBHEDigitizertheHBHEDigitizer
HBHEHitFilter theHBHEHitFilter
std::vector< PCaloHittheHBHEHits
CaloHitResponsetheHBHEResponse
CaloVShapetheHcalIntegratedShape
CaloVShapetheHcalShape
HcalHitCorrectiontheHitCorrection
HODigitizertheHODigitizer
HOHitFilter theHOHitFilter
std::vector< PCaloHittheHOHits
CaloHitResponsetheHOResponse
HcalTBSimParameterMaptheParameterMap
double thisPhaseShift
double tunePhaseShift

Detailed Description

Definition at line 25 of file HcalTBDigiProducer.h.


Member Typedef Documentation

Reconstruction algorithm

Definition at line 51 of file HcalTBDigiProducer.h.

Definition at line 52 of file HcalTBDigiProducer.h.


Constructor & Destructor Documentation

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

Definition at line 16 of file HcalTBDigiProducer.cc.

References HcalCoderFactory::DB, doPhaseShift, ecalTBInfoLabel, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), DetId::Hcal, instance, CaloHitResponse::setHitCorrection(), CaloHitResponse::setHitFilter(), HcalTBSimParameterMap::simParameters(), AlCaHLTBitMon_QueryRunRegistry::string, theAmplifier, theCoderFactory, theElectronicsSim, theHBHEDigitizer, theHBHEHitFilter, theHBHEResponse, theHitCorrection, theHODigitizer, theHOHitFilter, theHOResponse, theParameterMap, and tunePhaseShift.

                                                                                       :
  theParameterMap(new HcalTBSimParameterMap(ps)), 
  theHcalShape(new HcalShape()),
  theHcalIntegratedShape(new CaloShapeIntegrator(theHcalShape)),
  theHBHEResponse(new CaloHitResponse(theParameterMap, theHcalIntegratedShape)),
  theHOResponse(new CaloHitResponse(theParameterMap, theHcalIntegratedShape)),
  theAmplifier(0), theCoderFactory(0), theElectronicsSim(0), 
  theHitCorrection(0), theHBHEDigitizer(0), theHODigitizer(0), theHBHEHits(),
  theHOHits(), thisPhaseShift(0) {
  std::string const instance("simHcalDigis");
  mixMod.produces<HBHEDigiCollection>(instance);
  mixMod.produces<HODigiCollection>(instance);

  DetId detId(DetId::Hcal, 1);
  bool syncPhase = (theParameterMap->simParameters(detId)).syncPhase();
  doPhaseShift   = !syncPhase;

  theHBHEResponse->setHitFilter(&theHBHEHitFilter);
  theHOResponse->setHitFilter(&theHOHitFilter);

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

  bool doNoise = ps.getParameter<bool>("doNoise");
  theAmplifier = new HcalAmplifier(theParameterMap, doNoise);
  theCoderFactory = new HcalCoderFactory(HcalCoderFactory::DB);
  theElectronicsSim = new HcalElectronicsSim(theAmplifier, theCoderFactory);

  theHBHEDigitizer = new HBHEDigitizer(theHBHEResponse, theElectronicsSim, doNoise);
  theHODigitizer = new HODigitizer(theHOResponse, theElectronicsSim, doNoise);

  tunePhaseShift =  ps.getUntrackedParameter<double>("tunePhaseShiftTB", 1.);
  ecalTBInfoLabel = ps.getUntrackedParameter<std::string>("EcalTBInfoLabel","SimEcalTBG4Object");
  edm::LogInfo("HcalSim") << "HcalTBDigiProducer initialized with doNoise = "
                          << doNoise << ", doTimeSlew = " << doTimeSlew
                          << " and doPhaseShift = " << doPhaseShift
                          << " tunePhasShift = " << tunePhaseShift;

}
HcalTBDigiProducer::~HcalTBDigiProducer ( ) [virtual]

Member Function Documentation

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

Implements DigiAccumulatorMixMod.

Definition at line 120 of file HcalTBDigiProducer.cc.

References accumulateCaloHits(), and edm::Event::getByLabel().

                                                                           {
  // Step A: Get Inputs, and accumulate digis

  edm::InputTag hcalTag("g4SimHits", "HcalHits");
  edm::Handle<std::vector<PCaloHit> > hcalHandle;
  e.getByLabel(hcalTag, hcalHandle);

  accumulateCaloHits(hcalHandle, 0);
}
void HcalTBDigiProducer::accumulate ( PileUpEventPrincipal const &  e,
edm::EventSetup const &  c 
) [override, virtual]

Implements DigiAccumulatorMixMod.

Definition at line 130 of file HcalTBDigiProducer.cc.

References accumulateCaloHits(), PileUpEventPrincipal::bunchCrossing(), and PileUpEventPrincipal::getByLabel().

                                                                                       {
  // Step A: Get Inputs, and accumulate digis

  edm::InputTag hcalTag("g4SimHits", "HcalHits");
  edm::Handle<std::vector<PCaloHit> > hcalHandle;
  e.getByLabel(hcalTag, hcalHandle);

  accumulateCaloHits(hcalHandle, e.bunchCrossing());
}
void HcalTBDigiProducer::accumulateCaloHits ( edm::Handle< std::vector< PCaloHit > > const &  hits,
int  bunchCrossing 
) [private]

Definition at line 105 of file HcalTBDigiProducer.cc.

References CaloTDigitizer< Traits >::add(), HcalHitCorrection::fillChargeSums(), LogDebug, theHBHEDigitizer, theHitCorrection, and theHODigitizer.

Referenced by accumulate().

                                                                                                                {

  LogDebug("HcalSim") << "HcalTBDigiProducer::accumulate trying to get SimHit";

  if(hcalHandle.isValid()) {
    std::vector<PCaloHit> hits = *hcalHandle.product();
    if(theHitCorrection != 0) {
      theHitCorrection->fillChargeSums(hits);
    }
    LogDebug("HcalSim") << "HcalTBDigiProducer::accumulate Hits corrected";
    theHBHEDigitizer->add(hits, bunchCrossing);
    theHODigitizer->add(hits, bunchCrossing);
  }
}
void HcalTBDigiProducer::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 173 of file HcalTBDigiProducer.cc.

References geometry, edm::EventSetup::get(), theGeometry, and updateGeometry().

Referenced by initializeEvent().

                                                                       {

  // TODO find a way to avoid doing this every event
  edm::ESHandle<CaloGeometry> geometry;
  eventSetup.get<CaloGeometryRecord>().get(geometry);
 
  const CaloGeometry * pGeometry = &*geometry;

  // see if we need to update
  if(pGeometry != theGeometry) {
    theGeometry = pGeometry;
    updateGeometry();
  }
}
void HcalTBDigiProducer::finalizeEvent ( edm::Event e,
edm::EventSetup const &  c 
) [override, virtual]

Implements DigiAccumulatorMixMod.

Definition at line 140 of file HcalTBDigiProducer.cc.

References instance, LogDebug, edm::Event::put(), CaloTDigitizer< Traits >::run(), AlCaHLTBitMon_QueryRunRegistry::string, theHBHEDigitizer, and theHODigitizer.

                                                                                   {
  // Step B: Create empty output
  std::auto_ptr<HBHEDigiCollection> hbheResult(new HBHEDigiCollection());
  std::auto_ptr<HODigiCollection> hoResult(new HODigiCollection());
  LogDebug("HcalSim") << "HcalTBDigiProducer::produce Empty collection created";
  // Step C: Invoke the algorithm, getting back outputs.
  theHBHEDigitizer->run(*hbheResult);
  edm::LogInfo("HcalSim") << "HcalTBDigiProducer: HBHE digis : " << hbheResult->size();
  theHODigitizer->run(*hoResult);
  edm::LogInfo("HcalSim") << "HcalTBDigiProducer: HO digis   : " << hoResult->size();

  // Step D: Put outputs into event
  std::string const instance("simHcalDigis");
  e.put(hbheResult, instance);
  e.put(hoResult, instance);

}
void HcalTBDigiProducer::initializeEvent ( edm::Event const &  e,
edm::EventSetup const &  c 
) [override, virtual]
void HcalTBDigiProducer::setPhaseShift ( const DetId detId) [private]
void HcalTBDigiProducer::sortHits ( const edm::PCaloHitContainer hits) [private]

fills the vectors for each subdetector

Definition at line 158 of file HcalTBDigiProducer.cc.

References HcalBarrel, HcalEndcap, HcalOuter, theHBHEHits, and theHOHits.

                                                                   {

  for (edm::PCaloHitContainer::const_iterator hitItr = hits.begin();
       hitItr != hits.end(); ++hitItr) {
    HcalSubdetector subdet = HcalDetId(hitItr->id()).subdet();
    if(subdet == HcalBarrel || subdet == HcalEndcap) {
      theHBHEHits.push_back(*hitItr);
    } else if(subdet == HcalOuter) {
      theHOHits.push_back(*hitItr);
    } else {
      edm::LogError("HcalSim") << "Bad HcalHit subdetector " << subdet;
    }
  }
}
void HcalTBDigiProducer::updateGeometry ( ) [private]

Definition at line 188 of file HcalTBDigiProducer.cc.

References CaloGeometry::getValidDetIds(), hbheCells, DetId::Hcal, HcalBarrel, HcalEndcap, HcalOuter, hoCells, LogDebug, CaloTDigitizer< Traits >::setDetIds(), CaloHitResponse::setGeometry(), theGeometry, theHBHEDigitizer, theHBHEResponse, theHODigitizer, and theHOResponse.

Referenced by checkGeometry().

                                        {

  theHBHEResponse->setGeometry(theGeometry);
  theHOResponse->setGeometry(theGeometry);

  // Get cells for HB and HE
  hbheCells.clear();
  hbheCells = theGeometry->getValidDetIds(DetId::Hcal, HcalBarrel);
  std::vector<DetId> heCells = theGeometry->getValidDetIds(DetId::Hcal, HcalEndcap);
  // combine HB & HE
  hbheCells.insert(hbheCells.end(), heCells.begin(), heCells.end());

  // Get cells for HO
  hoCells.clear();
  hoCells = theGeometry->getValidDetIds(DetId::Hcal, HcalOuter);

  edm::LogInfo("HcalSim") << "HcalTBDigiProducer update Geometry with "
                          << hbheCells.size() << " cells in HB/HE and "
                          << hoCells.size() << " cells in HO";

  theHBHEDigitizer->setDetIds(hbheCells);
  LogDebug("HcalSim") << "HcalTBDigiProducer: Set DetID's for HB/HE";
  theHODigitizer->setDetIds(hoCells);
  LogDebug("HcalSim") << "HcalTBDigiProducer: Set DetID's for HO";
}

Member Data Documentation

Definition at line 82 of file HcalTBDigiProducer.h.

Referenced by HcalTBDigiProducer(), and initializeEvent().

std::string HcalTBDigiProducer::ecalTBInfoLabel [private]

Definition at line 79 of file HcalTBDigiProducer.h.

Referenced by HcalTBDigiProducer(), and initializeEvent().

std::vector<DetId> HcalTBDigiProducer::hbheCells [private]

Definition at line 74 of file HcalTBDigiProducer.h.

Referenced by updateGeometry().

std::vector<DetId> HcalTBDigiProducer::hoCells [private]

Definition at line 75 of file HcalTBDigiProducer.h.

Referenced by updateGeometry().

Definition at line 61 of file HcalTBDigiProducer.h.

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

Definition at line 62 of file HcalTBDigiProducer.h.

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

Definition at line 63 of file HcalTBDigiProducer.h.

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

Definition at line 73 of file HcalTBDigiProducer.h.

Referenced by checkGeometry(), and updateGeometry().

Definition at line 65 of file HcalTBDigiProducer.h.

Referenced by HcalTBDigiProducer().

std::vector<PCaloHit> HcalTBDigiProducer::theHBHEHits [private]

Definition at line 77 of file HcalTBDigiProducer.h.

Referenced by initializeEvent(), and sortHits().

Definition at line 56 of file HcalTBDigiProducer.h.

Referenced by ~HcalTBDigiProducer().

Definition at line 55 of file HcalTBDigiProducer.h.

Referenced by ~HcalTBDigiProducer().

Definition at line 66 of file HcalTBDigiProducer.h.

Referenced by HcalTBDigiProducer().

std::vector<PCaloHit> HcalTBDigiProducer::theHOHits [private]

Definition at line 77 of file HcalTBDigiProducer.h.

Referenced by initializeEvent(), and sortHits().

Definition at line 54 of file HcalTBDigiProducer.h.

Referenced by HcalTBDigiProducer(), setPhaseShift(), and ~HcalTBDigiProducer().

Definition at line 80 of file HcalTBDigiProducer.h.

Referenced by initializeEvent(), and setPhaseShift().

Definition at line 83 of file HcalTBDigiProducer.h.

Referenced by HcalTBDigiProducer(), and setPhaseShift().