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");
47  bool dummy1 = false;
48  bool dummy2 = false; // extra arguments for premixing
49  theAmplifier = new HcalAmplifier(theParameterMap, doNoise, dummy1, dummy2);
52 
55 
56  tunePhaseShift = ps.getUntrackedParameter<double>("tunePhaseShiftTB", 1.);
57  ecalTBInfoLabel = ps.getUntrackedParameter<std::string>("EcalTBInfoLabel","SimEcalTBG4Object");
58  edm::LogInfo("HcalSim") << "HcalTBDigiProducer initialized with doNoise = "
59  << doNoise << ", doTimeSlew = " << doTimeSlew
60  << " and doPhaseShift = " << doPhaseShift
61  << " tunePhasShift = " << tunePhaseShift;
62 
63  if (doPhaseShift) {
65  }
66 }
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 68 of file HcalTBDigiProducer.cc.

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

68  {
69 
71  if (theHODigitizer) delete theHODigitizer;
72  if (theParameterMap) delete theParameterMap;
73  if (theHcalShape) delete theHcalShape;
75  if (theHBHEResponse) delete theHBHEResponse;
76  if (theHOResponse) delete theHOResponse;
78  if (theAmplifier) delete theAmplifier;
79  if (theCoderFactory) delete theCoderFactory;
81 }
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 127 of file HcalTBDigiProducer.cc.

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

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

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

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

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

Referenced by accumulate().

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

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

Referenced by initializeEvent().

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

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

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

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

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

Referenced by initializeEvent().

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

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

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

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

195  {
196 
199 
200  // Get cells for HB and HE
201  hbheCells.clear();
203  std::vector<DetId> heCells = theGeometry->getValidDetIds(DetId::Hcal, HcalEndcap);
204  // combine HB & HE
205  hbheCells.insert(hbheCells.end(), heCells.begin(), heCells.end());
206 
207  // Get cells for HO
208  hoCells.clear();
210 
211  edm::LogInfo("HcalSim") << "HcalTBDigiProducer update Geometry with "
212  << hbheCells.size() << " cells in HB/HE and "
213  << hoCells.size() << " cells in HO";
214 
216  LogDebug("HcalSim") << "HcalTBDigiProducer: Set DetID's for HB/HE";
218  LogDebug("HcalSim") << "HcalTBDigiProducer: Set DetID's for HO";
219 }
#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().