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::one::EDProducerBase &mixMod, edm::ConsumesCollector &iC)
 
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 27 of file HcalTBDigiProducer.h.

Member Typedef Documentation

Reconstruction algorithm

Definition at line 53 of file HcalTBDigiProducer.h.

Definition at line 54 of file HcalTBDigiProducer.h.

Constructor & Destructor Documentation

HcalTBDigiProducer::HcalTBDigiProducer ( const edm::ParameterSet ps,
edm::one::EDProducerBase mixMod,
edm::ConsumesCollector iC 
)
explicit

Definition at line 17 of file HcalTBDigiProducer.cc.

References edm::ConsumesCollector::consumes(), 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.

17  :
19  theHcalShape(new HcalShape()),
26  std::string const instance("simHcalDigis");
27  mixMod.produces<HBHEDigiCollection>(instance);
28  mixMod.produces<HODigiCollection>(instance);
29  iC.consumes<std::vector<PCaloHit> >(edm::InputTag("g4SimHits", "HcalHits"));
30 
31  DetId detId(DetId::Hcal, 1);
32  bool syncPhase = (theParameterMap->simParameters(detId)).syncPhase();
33  doPhaseShift = !syncPhase;
34 
37 
38  bool doTimeSlew = ps.getParameter<bool>("doTimeSlew");
39  if(doTimeSlew) {
40  // no time slewing for HF
44  }
45 
46  bool doNoise = ps.getParameter<bool>("doNoise");
50 
53 
54  tunePhaseShift = ps.getUntrackedParameter<double>("tunePhaseShiftTB", 1.);
55  ecalTBInfoLabel = ps.getUntrackedParameter<std::string>("EcalTBInfoLabel","SimEcalTBG4Object");
56  edm::LogInfo("HcalSim") << "HcalTBDigiProducer initialized with doNoise = "
57  << doNoise << ", doTimeSlew = " << doTimeSlew
58  << " and doPhaseShift = " << doPhaseShift
59  << " tunePhasShift = " << tunePhaseShift;
60 
61  if (doPhaseShift) {
63  }
64 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
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:18
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 66 of file HcalTBDigiProducer.cc.

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

66  {
67 
69  if (theHODigitizer) delete theHODigitizer;
70  if (theParameterMap) delete theParameterMap;
71  if (theHcalShape) delete theHcalShape;
73  if (theHBHEResponse) delete theHBHEResponse;
74  if (theHOResponse) delete theHOResponse;
76  if (theAmplifier) delete theAmplifier;
77  if (theCoderFactory) delete theCoderFactory;
79 }
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 125 of file HcalTBDigiProducer.cc.

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

125  {
126  // Step A: Get Inputs, and accumulate digis
127 
128  edm::InputTag hcalTag("g4SimHits", "HcalHits");
130  e.getByLabel(hcalTag, hcalHandle);
131 
132  accumulateCaloHits(hcalHandle, 0);
133 }
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 135 of file HcalTBDigiProducer.cc.

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

135  {
136  // Step A: Get Inputs, and accumulate digis
137 
138  edm::InputTag hcalTag("g4SimHits", "HcalHits");
140  e.getByLabel(hcalTag, hcalHandle);
141 
142  accumulateCaloHits(hcalHandle, e.bunchCrossing());
143 }
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 110 of file HcalTBDigiProducer.cc.

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

Referenced by accumulate().

110  {
111 
112  LogDebug("HcalSim") << "HcalTBDigiProducer::accumulate trying to get SimHit";
113 
114  if(hcalHandle.isValid()) {
115  std::vector<PCaloHit> hits = *hcalHandle.product();
116  if(theHitCorrection != 0) {
118  }
119  LogDebug("HcalSim") << "HcalTBDigiProducer::accumulate Hits corrected";
120  theHBHEDigitizer->add(hits, bunchCrossing);
121  theHODigitizer->add(hits, bunchCrossing);
122  }
123 }
#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:81
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 178 of file HcalTBDigiProducer.cc.

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

Referenced by initializeEvent().

178  {
179 
180  // TODO find a way to avoid doing this every event
182  eventSetup.get<CaloGeometryRecord>().get(geometry);
183 
184  const CaloGeometry * pGeometry = &*geometry;
185 
186  // see if we need to update
187  if(pGeometry != theGeometry) {
188  theGeometry = pGeometry;
189  updateGeometry();
190  }
191 }
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 145 of file HcalTBDigiProducer.cc.

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

145  {
146  // Step B: Create empty output
147  std::auto_ptr<HBHEDigiCollection> hbheResult(new HBHEDigiCollection());
148  std::auto_ptr<HODigiCollection> hoResult(new HODigiCollection());
149  LogDebug("HcalSim") << "HcalTBDigiProducer::produce Empty collection created";
150  // Step C: Invoke the algorithm, getting back outputs.
151  theHBHEDigitizer->run(*hbheResult);
152  edm::LogInfo("HcalSim") << "HcalTBDigiProducer: HBHE digis : " << hbheResult->size();
153  theHODigitizer->run(*hoResult);
154  edm::LogInfo("HcalSim") << "HcalTBDigiProducer: HO digis : " << hoResult->size();
155 
156  // Step D: Put outputs into event
157  std::string const instance("simHcalDigis");
158  e.put(hbheResult, instance);
159  e.put(hoResult, instance);
160 
161 }
#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:116
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 82 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.

82  {
83  // get the appropriate gains, noises, & widths for this event
85  eventSetup.get<HcalDbRecord>().get(conditions);
86  theAmplifier->setDbService(conditions.product());
87  theCoderFactory->setDbService(conditions.product());
88 
89  // get the correct geometry
90  checkGeometry(eventSetup);
91 
92  theHBHEHits.clear();
93  theHOHits.clear();
94  if (doPhaseShift) {
95 
96  edm::Handle<PEcalTBInfo> theEcalTBInfo;
97  e.getByLabel(ecalTBInfoLabel,theEcalTBInfo);
98  thisPhaseShift = theEcalTBInfo->phaseShift();
99 
100  DetId detIdHB(DetId::Hcal, 1);
101  setPhaseShift(detIdHB);
102  DetId detIdHO(DetId::Hcal, 3);
103  setPhaseShift(detIdHO);
104  }
105 
108 }
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:18
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 219 of file HcalTBDigiProducer.cc.

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

Referenced by initializeEvent().

219  {
220 
222  if ( !parameters.syncPhase() ) {
223  int myDet = detId.subdetId();
224  double passPhaseShift = thisPhaseShift + tunePhaseShift;
225  if (myDet <= 2) {
226  theHBHEResponse->setPhaseShift(passPhaseShift);
227  } else {
228  theHOResponse->setPhaseShift(passPhaseShift);
229  }
230  }
231 }
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:37
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 163 of file HcalTBDigiProducer.cc.

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

163  {
164 
165  for (edm::PCaloHitContainer::const_iterator hitItr = hits.begin();
166  hitItr != hits.end(); ++hitItr) {
167  HcalSubdetector subdet = HcalDetId(hitItr->id()).subdet();
168  if(subdet == HcalBarrel || subdet == HcalEndcap) {
169  theHBHEHits.push_back(*hitItr);
170  } else if(subdet == HcalOuter) {
171  theHOHits.push_back(*hitItr);
172  } else {
173  edm::LogError("HcalSim") << "Bad HcalHit subdetector " << subdet;
174  }
175  }
176 }
std::vector< PCaloHit > theHBHEHits
HcalSubdetector
Definition: HcalAssistant.h:31
std::vector< PCaloHit > theHOHits
void HcalTBDigiProducer::updateGeometry ( )
private

Definition at line 193 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().

193  {
194 
197 
198  // Get cells for HB and HE
199  hbheCells.clear();
201  std::vector<DetId> heCells = theGeometry->getValidDetIds(DetId::Hcal, HcalEndcap);
202  // combine HB & HE
203  hbheCells.insert(hbheCells.end(), heCells.begin(), heCells.end());
204 
205  // Get cells for HO
206  hoCells.clear();
208 
209  edm::LogInfo("HcalSim") << "HcalTBDigiProducer update Geometry with "
210  << hbheCells.size() << " cells in HB/HE and "
211  << hoCells.size() << " cells in HO";
212 
214  LogDebug("HcalSim") << "HcalTBDigiProducer: Set DetID's for HB/HE";
216  LogDebug("HcalSim") << "HcalTBDigiProducer: Set DetID's for HO";
217 }
#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 84 of file HcalTBDigiProducer.h.

Referenced by HcalTBDigiProducer(), and initializeEvent().

std::string HcalTBDigiProducer::ecalTBInfoLabel
private

Definition at line 81 of file HcalTBDigiProducer.h.

Referenced by HcalTBDigiProducer(), and initializeEvent().

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

Definition at line 76 of file HcalTBDigiProducer.h.

Referenced by updateGeometry().

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

Definition at line 77 of file HcalTBDigiProducer.h.

Referenced by updateGeometry().

HcalAmplifier* HcalTBDigiProducer::theAmplifier
private

Definition at line 63 of file HcalTBDigiProducer.h.

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

HcalCoderFactory* HcalTBDigiProducer::theCoderFactory
private

Definition at line 64 of file HcalTBDigiProducer.h.

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

HcalElectronicsSim* HcalTBDigiProducer::theElectronicsSim
private

Definition at line 65 of file HcalTBDigiProducer.h.

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

const CaloGeometry* HcalTBDigiProducer::theGeometry
private

Definition at line 75 of file HcalTBDigiProducer.h.

Referenced by checkGeometry(), and updateGeometry().

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

Definition at line 67 of file HcalTBDigiProducer.h.

Referenced by HcalTBDigiProducer().

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

Definition at line 79 of file HcalTBDigiProducer.h.

Referenced by initializeEvent(), and sortHits().

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

Definition at line 58 of file HcalTBDigiProducer.h.

Referenced by ~HcalTBDigiProducer().

CaloVShape* HcalTBDigiProducer::theHcalShape
private

Definition at line 57 of file HcalTBDigiProducer.h.

Referenced by ~HcalTBDigiProducer().

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

Definition at line 68 of file HcalTBDigiProducer.h.

Referenced by HcalTBDigiProducer().

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

Definition at line 79 of file HcalTBDigiProducer.h.

Referenced by initializeEvent(), and sortHits().

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

Definition at line 56 of file HcalTBDigiProducer.h.

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

double HcalTBDigiProducer::thisPhaseShift
private

Definition at line 82 of file HcalTBDigiProducer.h.

Referenced by initializeEvent(), and setPhaseShift().

double HcalTBDigiProducer::tunePhaseShift
private

Definition at line 85 of file HcalTBDigiProducer.h.

Referenced by HcalTBDigiProducer(), and setPhaseShift().