CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
HcalTBDigiProducer Class Reference

#include <HcalTBDigiProducer.h>

Inheritance diagram for HcalTBDigiProducer:
DigiAccumulatorMixMod

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 ()
 
- 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 ()
 
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 void initializeBunchCrossing (edm::Event const &event, edm::EventSetup const &setup, int bunchCrossing)
 
virtual ~DigiAccumulatorMixMod ()
 

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 More...
 
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.

16  :
18  theHcalShape(new HcalShape()),
25  std::string const instance("simHcalDigis");
26  mixMod.produces<HBHEDigiCollection>(instance);
27  mixMod.produces<HODigiCollection>(instance);
28 
29  DetId detId(DetId::Hcal, 1);
30  bool syncPhase = (theParameterMap->simParameters(detId)).syncPhase();
31  doPhaseShift = !syncPhase;
32 
35 
36  bool doTimeSlew = ps.getParameter<bool>("doTimeSlew");
37  if(doTimeSlew) {
38  // no time slewing for HF
42  }
43 
44  bool doNoise = ps.getParameter<bool>("doNoise");
48 
51 
52  tunePhaseShift = ps.getUntrackedParameter<double>("tunePhaseShiftTB", 1.);
53  ecalTBInfoLabel = ps.getUntrackedParameter<std::string>("EcalTBInfoLabel","SimEcalTBG4Object");
54  edm::LogInfo("HcalSim") << "HcalTBDigiProducer initialized with doNoise = "
55  << doNoise << ", doTimeSlew = " << doTimeSlew
56  << " and doPhaseShift = " << doPhaseShift
57  << " tunePhasShift = " << tunePhaseShift;
58 
59 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual const CaloSimParameters & simParameters(const DetId &id) const
CaloHitResponse * theHBHEResponse
static PFTauRenderPlugin instance
HBHEHitFilter theHBHEHitFilter
HODigitizer * theHODigitizer
HcalElectronicsSim * theElectronicsSim
HOHitFilter theHOHitFilter
HcalTBSimParameterMap * theParameterMap
CaloTDigitizer< HBHEDigitizerTraits > HBHEDigitizer
std::vector< PCaloHit > theHBHEHits
CaloTDigitizer< HODigitizerTraits > HODigitizer
CaloVShape * theHcalIntegratedShape
void setHitFilter(const CaloVHitFilter *filter)
if you want to reject hits, for example, from a certain subdetector, set this
Creates electronics signals from hits.
HBHEDigitizer * theHBHEDigitizer
shaper for Hcal (not for HF)
Definition: HcalShape.h:15
std::vector< PCaloHit > theHOHits
Definition: DetId.h:20
CaloHitResponse * theHOResponse
HcalHitCorrection * theHitCorrection
HcalAmplifier * theAmplifier
std::string ecalTBInfoLabel
HcalCoderFactory * theCoderFactory
CaloVShape * theHcalShape
void setHitCorrection(const CaloVHitCorrection *hitCorrection)
If you want to correct hits, for attenuation or delay, set this.
HcalTBDigiProducer::~HcalTBDigiProducer ( )
virtual

Definition at line 61 of file HcalTBDigiProducer.cc.

References theAmplifier, theCoderFactory, theElectronicsSim, theHBHEDigitizer, theHBHEResponse, theHcalIntegratedShape, theHcalShape, theHitCorrection, theHODigitizer, theHOResponse, and theParameterMap.

61  {
62 
64  if (theHODigitizer) delete theHODigitizer;
65  if (theParameterMap) delete theParameterMap;
66  if (theHcalShape) delete theHcalShape;
68  if (theHBHEResponse) delete theHBHEResponse;
69  if (theHOResponse) delete theHOResponse;
71  if (theAmplifier) delete theAmplifier;
72  if (theCoderFactory) delete theCoderFactory;
74 }
CaloHitResponse * theHBHEResponse
HODigitizer * theHODigitizer
HcalElectronicsSim * theElectronicsSim
HcalTBSimParameterMap * theParameterMap
CaloVShape * theHcalIntegratedShape
HBHEDigitizer * theHBHEDigitizer
CaloHitResponse * theHOResponse
HcalHitCorrection * theHitCorrection
HcalAmplifier * theAmplifier
HcalCoderFactory * theCoderFactory
CaloVShape * theHcalShape

Member Function Documentation

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

Implements DigiAccumulatorMixMod.

Definition at line 120 of file HcalTBDigiProducer.cc.

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

120  {
121  // Step A: Get Inputs, and accumulate digis
122 
123  edm::InputTag hcalTag("g4SimHits", "HcalHits");
125  e.getByLabel(hcalTag, hcalHandle);
126 
127  accumulateCaloHits(hcalHandle, 0);
128 }
void accumulateCaloHits(edm::Handle< std::vector< PCaloHit > > const &hits, int bunchCrossing)
void HcalTBDigiProducer::accumulate ( PileUpEventPrincipal const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 130 of file HcalTBDigiProducer.cc.

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

130  {
131  // Step A: Get Inputs, and accumulate digis
132 
133  edm::InputTag hcalTag("g4SimHits", "HcalHits");
135  e.getByLabel(hcalTag, hcalHandle);
136 
137  accumulateCaloHits(hcalHandle, e.bunchCrossing());
138 }
void accumulateCaloHits(edm::Handle< std::vector< PCaloHit > > const &hits, int 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().

105  {
106 
107  LogDebug("HcalSim") << "HcalTBDigiProducer::accumulate trying to get SimHit";
108 
109  if(hcalHandle.isValid()) {
110  std::vector<PCaloHit> hits = *hcalHandle.product();
111  if(theHitCorrection != 0) {
113  }
114  LogDebug("HcalSim") << "HcalTBDigiProducer::accumulate Hits corrected";
115  theHBHEDigitizer->add(hits, bunchCrossing);
116  theHODigitizer->add(hits, bunchCrossing);
117  }
118 }
#define LogDebug(id)
HODigitizer * theHODigitizer
void add(const std::vector< PCaloHit > &hits, int bunchCrossing)
HBHEDigitizer * theHBHEDigitizer
void fillChargeSums(MixCollection< PCaloHit > &hits)
HcalHitCorrection * theHitCorrection
T const * product() const
Definition: Handle.h:74
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().

173  {
174 
175  // TODO find a way to avoid doing this every event
177  eventSetup.get<CaloGeometryRecord>().get(geometry);
178 
179  const CaloGeometry * pGeometry = &*geometry;
180 
181  // see if we need to update
182  if(pGeometry != theGeometry) {
183  theGeometry = pGeometry;
184  updateGeometry();
185  }
186 }
const CaloGeometry * theGeometry
const T & get() const
Definition: EventSetup.h:55
ESHandle< TrackerGeometry > geometry
void HcalTBDigiProducer::finalizeEvent ( edm::Event e,
edm::EventSetup const &  c 
)
overridevirtual

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.

140  {
141  // Step B: Create empty output
142  std::auto_ptr<HBHEDigiCollection> hbheResult(new HBHEDigiCollection());
143  std::auto_ptr<HODigiCollection> hoResult(new HODigiCollection());
144  LogDebug("HcalSim") << "HcalTBDigiProducer::produce Empty collection created";
145  // Step C: Invoke the algorithm, getting back outputs.
146  theHBHEDigitizer->run(*hbheResult);
147  edm::LogInfo("HcalSim") << "HcalTBDigiProducer: HBHE digis : " << hbheResult->size();
148  theHODigitizer->run(*hoResult);
149  edm::LogInfo("HcalSim") << "HcalTBDigiProducer: HO digis : " << hoResult->size();
150 
151  // Step D: Put outputs into event
152  std::string const instance("simHcalDigis");
153  e.put(hbheResult, instance);
154  e.put(hoResult, instance);
155 
156 }
#define LogDebug(id)
static PFTauRenderPlugin instance
HODigitizer * theHODigitizer
edm::SortedCollection< HODataFrame > HODigiCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
HBHEDigitizer * theHBHEDigitizer
void run(MixCollection< PCaloHit > &, DigiCollection &)
turns hits into digis
edm::SortedCollection< HBHEDataFrame > HBHEDigiCollection
void HcalTBDigiProducer::initializeEvent ( edm::Event const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 77 of file HcalTBDigiProducer.cc.

References checkGeometry(), doPhaseShift, ecalTBInfoLabel, edm::EventSetup::get(), edm::Event::getByLabel(), DetId::Hcal, CaloTDigitizer< Traits >::initializeHits(), edm::ESHandle< class >::product(), HcalCoderFactory::setDbService(), HcalAmplifier::setDbService(), setPhaseShift(), theAmplifier, theCoderFactory, theHBHEDigitizer, theHBHEHits, theHODigitizer, theHOHits, and thisPhaseShift.

77  {
78  // get the appropriate gains, noises, & widths for this event
80  eventSetup.get<HcalDbRecord>().get(conditions);
81  theAmplifier->setDbService(conditions.product());
82  theCoderFactory->setDbService(conditions.product());
83 
84  // get the correct geometry
85  checkGeometry(eventSetup);
86 
87  theHBHEHits.clear();
88  theHOHits.clear();
89  if (doPhaseShift) {
90 
91  edm::Handle<PEcalTBInfo> theEcalTBInfo;
92  e.getByLabel(ecalTBInfoLabel,theEcalTBInfo);
93  thisPhaseShift = theEcalTBInfo->phaseShift();
94 
95  DetId detIdHB(DetId::Hcal, 1);
96  setPhaseShift(detIdHB);
97  DetId detIdHO(DetId::Hcal, 3);
98  setPhaseShift(detIdHO);
99  }
100 
103 }
void setPhaseShift(const DetId &detId)
void setDbService(const HcalDbService *service)
the Producer will probably update this every event
void initializeHits()
HODigitizer * theHODigitizer
std::vector< PCaloHit > theHBHEHits
HBHEDigitizer * theHBHEDigitizer
void checkGeometry(const edm::EventSetup &eventSetup)
std::vector< PCaloHit > theHOHits
Definition: DetId.h:20
void setDbService(const HcalDbService *service)
T const * product() const
Definition: ESHandle.h:62
HcalAmplifier * theAmplifier
std::string ecalTBInfoLabel
HcalCoderFactory * theCoderFactory
void HcalTBDigiProducer::setPhaseShift ( const DetId detId)
private

Definition at line 214 of file HcalTBDigiProducer.cc.

References Parameters::parameters, CaloHitResponse::setPhaseShift(), HcalTBSimParameterMap::simParameters(), DetId::subdetId(), CaloSimParameters::syncPhase(), theHBHEResponse, theHOResponse, theParameterMap, thisPhaseShift, and tunePhaseShift.

Referenced by initializeEvent().

214  {
215 
217  if ( !parameters.syncPhase() ) {
218  int myDet = detId.subdetId();
219  double passPhaseShift = thisPhaseShift + tunePhaseShift;
220  if (myDet <= 2) {
221  theHBHEResponse->setPhaseShift(passPhaseShift);
222  } else {
223  theHOResponse->setPhaseShift(passPhaseShift);
224  }
225  }
226 }
dictionary parameters
Definition: Parameters.py:2
virtual const CaloSimParameters & simParameters(const DetId &id) const
CaloHitResponse * theHBHEResponse
HcalTBSimParameterMap * theParameterMap
Main class for Parameters in different subdetectors.
void setPhaseShift(const double &thePhaseShift)
setting the phase shift for asynchronous trigger (e.g. test beams)
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
CaloHitResponse * theHOResponse
bool syncPhase() const
choice of the ADC time alignment (synchronous for LHC, asynchronous for test beams) ...
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.

158  {
159 
160  for (edm::PCaloHitContainer::const_iterator hitItr = hits.begin();
161  hitItr != hits.end(); ++hitItr) {
162  HcalSubdetector subdet = HcalDetId(hitItr->id()).subdet();
163  if(subdet == HcalBarrel || subdet == HcalEndcap) {
164  theHBHEHits.push_back(*hitItr);
165  } else if(subdet == HcalOuter) {
166  theHOHits.push_back(*hitItr);
167  } else {
168  edm::LogError("HcalSim") << "Bad HcalHit subdetector " << subdet;
169  }
170  }
171 }
std::vector< PCaloHit > theHBHEHits
HcalSubdetector
Definition: HcalAssistant.h:32
std::vector< PCaloHit > theHOHits
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().

188  {
189 
192 
193  // Get cells for HB and HE
194  hbheCells.clear();
196  std::vector<DetId> heCells = theGeometry->getValidDetIds(DetId::Hcal, HcalEndcap);
197  // combine HB & HE
198  hbheCells.insert(hbheCells.end(), heCells.begin(), heCells.end());
199 
200  // Get cells for HO
201  hoCells.clear();
203 
204  edm::LogInfo("HcalSim") << "HcalTBDigiProducer update Geometry with "
205  << hbheCells.size() << " cells in HB/HE and "
206  << hoCells.size() << " cells in HO";
207 
209  LogDebug("HcalSim") << "HcalTBDigiProducer: Set DetID's for HB/HE";
211  LogDebug("HcalSim") << "HcalTBDigiProducer: Set DetID's for HO";
212 }
#define LogDebug(id)
void setGeometry(const CaloGeometry *geometry)
geometry needed for time-of-flight
std::vector< DetId > hoCells
CaloHitResponse * theHBHEResponse
HODigitizer * theHODigitizer
const CaloGeometry * theGeometry
HBHEDigitizer * theHBHEDigitizer
std::vector< DetId > hbheCells
CaloHitResponse * theHOResponse
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:90
void setDetIds(const std::vector< DetId > &detIds)

Member Data Documentation

bool HcalTBDigiProducer::doPhaseShift
private

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().

HcalAmplifier* HcalTBDigiProducer::theAmplifier
private

Definition at line 61 of file HcalTBDigiProducer.h.

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

HcalCoderFactory* HcalTBDigiProducer::theCoderFactory
private

Definition at line 62 of file HcalTBDigiProducer.h.

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

HcalElectronicsSim* HcalTBDigiProducer::theElectronicsSim
private

Definition at line 63 of file HcalTBDigiProducer.h.

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

const CaloGeometry* HcalTBDigiProducer::theGeometry
private

Definition at line 73 of file HcalTBDigiProducer.h.

Referenced by checkGeometry(), and updateGeometry().

HBHEDigitizer* HcalTBDigiProducer::theHBHEDigitizer
private
HBHEHitFilter HcalTBDigiProducer::theHBHEHitFilter
private

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().

CaloHitResponse* HcalTBDigiProducer::theHBHEResponse
private
CaloVShape* HcalTBDigiProducer::theHcalIntegratedShape
private

Definition at line 56 of file HcalTBDigiProducer.h.

Referenced by ~HcalTBDigiProducer().

CaloVShape* HcalTBDigiProducer::theHcalShape
private

Definition at line 55 of file HcalTBDigiProducer.h.

Referenced by ~HcalTBDigiProducer().

HcalHitCorrection* HcalTBDigiProducer::theHitCorrection
private
HODigitizer* HcalTBDigiProducer::theHODigitizer
private
HOHitFilter HcalTBDigiProducer::theHOHitFilter
private

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().

CaloHitResponse* HcalTBDigiProducer::theHOResponse
private
HcalTBSimParameterMap* HcalTBDigiProducer::theParameterMap
private

Definition at line 54 of file HcalTBDigiProducer.h.

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

double HcalTBDigiProducer::thisPhaseShift
private

Definition at line 80 of file HcalTBDigiProducer.h.

Referenced by initializeEvent(), and setPhaseShift().

double HcalTBDigiProducer::tunePhaseShift
private

Definition at line 83 of file HcalTBDigiProducer.h.

Referenced by HcalTBDigiProducer(), and setPhaseShift().