CMS 3D CMS Logo

EcalTBDigiProducer.cc
Go to the documentation of this file.
1 
2 #include <memory>
3 
16 
18  edm::ProducesCollector producesCollector,
20  : EcalDigiProducer(params, producesCollector, iC) {
21  std::string const instance("simEcalUnsuppressedDigis");
22  m_EBdigiFinalTag = params.getParameter<std::string>("EBdigiFinalCollection");
23  m_EBdigiTempTag = params.getParameter<std::string>("EBdigiCollection");
24 
25  producesCollector.produces<EBDigiCollection>(instance + m_EBdigiFinalTag); // after selective readout
26  producesCollector.produces<EcalTBTDCRawInfo>(instance);
27 
28  const bool syncPhase(params.getParameter<bool>("syncPhase"));
29 
30  // possible phase shift for asynchronous trigger (e.g. test-beam)
31 
33  m_thisPhaseShift = 1.;
34 
35  typedef std::vector<edm::ParameterSet> Parameters;
36  Parameters ranges = params.getParameter<Parameters>("tdcRanges");
37  for (Parameters::iterator itRanges = ranges.begin(); itRanges != ranges.end(); ++itRanges) {
39  aRange.runRanges.first = itRanges->getParameter<int>("startRun");
40  aRange.runRanges.second = itRanges->getParameter<int>("endRun");
41  aRange.tdcMin = itRanges->getParameter<std::vector<double>>("tdcMin");
42  aRange.tdcMax = itRanges->getParameter<std::vector<double>>("tdcMax");
43  m_tdcRanges.push_back(std::move(aRange));
44  }
45 
46  m_use2004OffsetConvention = params.getUntrackedParameter<bool>("use2004OffsetConvention", false);
47 
48  m_ecalTBInfoLabel = params.getUntrackedParameter<std::string>("EcalTBInfoLabel", "SimEcalTBG4Object");
49 
50  m_doReadout = params.getParameter<bool>("doReadout");
51 
53 
54  m_tunePhaseShift = params.getParameter<double>("tunePhaseShift");
55 
56  if (m_doPhaseShift) {
58  edm::InputTag(params.getUntrackedParameter<std::string>("EcalTBInfoLabel", "SimEcalTBG4Object")));
59  }
60 }
61 
63 
65  std::cout << "====****Entering EcalTBDigiProducer produce()" << std::endl;
67  eventSetup.get<CaloGeometryRecord>().get(hGeometry);
68  const std::vector<DetId> &theBarrelDets(hGeometry->getValidDetIds(DetId::Ecal, EcalBarrel));
69 
70  m_theTBReadout->setDetIds(theBarrelDets);
71 
72  m_TDCproduct = std::make_unique<EcalTBTDCRawInfo>(1);
73  if (m_doPhaseShift) {
74  edm::Handle<PEcalTBInfo> theEcalTBInfo;
75  event.getByLabel(m_ecalTBInfoLabel, theEcalTBInfo);
76  m_thisPhaseShift = theEcalTBInfo->phaseShift();
77 
78  DetId detId(DetId::Ecal, 1);
79  setPhaseShift(detId);
80 
81  fillTBTDCRawInfo(*m_TDCproduct); // fill the TDC info in the event
82  }
84 }
85 
87  m_ebDigis = std::make_unique<EBDigiCollection>();
88 
90 
91  const EBDigiCollection *barrelResult(&*m_ebDigis);
92 
93  std::unique_ptr<EBDigiCollection> barrelReadout(new EBDigiCollection());
94  if (m_doReadout) {
95  m_theTBReadout->performReadout(event, m_theTTmap, *barrelResult, *barrelReadout);
96  } else {
97  *barrelReadout = *barrelResult;
98  }
99 
100  std::cout << "===**** EcalTBDigiProducer: number of barrel digis = " << barrelReadout->size() << std::endl;
101 
102  std::string const instance("simEcalUnsuppressedDigis");
103  event.put(std::move(barrelReadout), instance + m_EBdigiFinalTag);
104  event.put(std::move(m_TDCproduct), instance);
105 
106  m_ebDigis.reset(); // release memory
107  m_eeDigis.reset(); // release memory
108 }
109 
111  const CaloSimParameters &parameters(EcalDigiProducer::m_ParameterMap->simParameters(detId));
112 
113  if (!parameters.syncPhase()) {
114  const int myDet(detId.subdetId());
115 
116  LogDebug("EcalDigi") << "Setting the phase shift " << m_thisPhaseShift << " and the offset " << m_tunePhaseShift
117  << " for the subdetector " << myDet;
118 
119  if (myDet == 1) {
120  double passPhaseShift(m_thisPhaseShift + m_tunePhaseShift);
122  passPhaseShift = 1. - passPhaseShift;
123  EcalDigiProducer::m_EBResponse->setPhaseShift(passPhaseShift);
124  EcalDigiProducer::m_EEResponse->setPhaseShift(passPhaseShift);
125  }
126  }
127 }
128 
130  const unsigned int thisChannel(1);
131 
132  const unsigned int thisCount((unsigned int)(m_thisPhaseShift * (m_tdcRanges[0].tdcMax[0] - m_tdcRanges[0].tdcMin[0]) +
133  m_tdcRanges[0].tdcMin[0]));
134 
135  EcalTBTDCSample theTBTDCSample(thisChannel, thisCount);
136 
137  const unsigned int sampleIndex(0);
138  theTBTDCRawInfo.setSample(sampleIndex, theTBTDCSample);
139 
140  LogDebug("EcalDigi") << theTBTDCSample << "\n" << theTBTDCRawInfo;
141 }
142 
144  m_ebDigis = std::make_unique<EBDigiCollection>();
145  *m_ebDigis = *ebDigiPtr;
146 }
147 
149  std::cout << "===**** EcalTBDigiProducer: number of endcap digis = " << eeDigiPtr->size() << std::endl;
150 }
PEcalTBInfo::phaseShift
double phaseShift() const
Definition: PEcalTBInfo.h:37
diffTwoXMLs.ranges
string ranges
Definition: diffTwoXMLs.py:79
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:30
Handle.h
EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::tdcMin
std::vector< double > tdcMin
Definition: EcalTBTDCRecInfoAlgo.h:16
MessageLogger.h
ecalSimParameterMap_cff.syncPhase
syncPhase
Definition: ecalSimParameterMap_cff.py:10
ESHandle.h
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
EcalDigiProducer::m_EEResponse
std::unique_ptr< EEHitResponse > m_EEResponse
Definition: EcalDigiProducer.h:122
gather_cfg.cout
cout
Definition: gather_cfg.py:144
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89281
EcalTBDigiProducer::m_theTBReadout
EcalTBReadout * m_theTBReadout
Definition: EcalTBDigiProducer.h:37
EEHitResponse.h
EcalTBDigiProducer::~EcalTBDigiProducer
~EcalTBDigiProducer() override
Definition: EcalTBDigiProducer.cc:62
EcalTBDigiProducer::cacheEBDigis
void cacheEBDigis(const EBDigiCollection *ebDigiPtr) const override
Definition: EcalTBDigiProducer.cc:143
EcalTBDigiProducer::initializeEvent
void initializeEvent(edm::Event const &, edm::EventSetup const &) override
Definition: EcalTBDigiProducer.cc:64
EBHitResponse.h
EcalTBReadout::performReadout
void performReadout(edm::Event &event, const EcalTrigTowerConstituentsMap &theTTmap, const EBDigiCollection &input, EBDigiCollection &output)
master function to be called once per event
Definition: EcalTBReadout.cc:150
edm::Handle
Definition: AssociativeIterator.h:50
EcalBarrel
Definition: EcalSubdetector.h:10
EcalSimParameterMap.h
EcalTBDigiProducer::m_ebDigis
std::unique_ptr< EBDigiCollection > m_ebDigis
Definition: EcalTBDigiProducer.h:53
DetId
Definition: DetId.h:17
Ecal2004TBTDCRanges_cff.tdcMin
tdcMin
Definition: Ecal2004TBTDCRanges_cff.py:3
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
EcalDigiProducer::finalizeEvent
void finalizeEvent(edm::Event &e, edm::EventSetup const &c) override
Definition: EcalDigiProducer.cc:373
EcalTBDigiProducer::m_tdcRanges
std::vector< EcalTBTDCRecInfoAlgo::EcalTBTDCRanges > m_tdcRanges
Definition: EcalTBDigiProducer.h:48
CaloSimParameters
Main class for Parameters in different subdetectors.
Definition: CaloSimParameters.h:14
edm::ESHandle< CaloGeometry >
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
EcalTBDigiProducer::m_doReadout
bool m_doReadout
Definition: EcalTBDigiProducer.h:46
EcalTBDigiProducer::fillTBTDCRawInfo
void fillTBTDCRawInfo(EcalTBTDCRawInfo &theTBTDCRawInfo)
Definition: EcalTBDigiProducer.cc:129
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
EcalDigiProducer::m_EBResponse
std::unique_ptr< EBHitResponse > m_EBResponse
Definition: EcalDigiProducer.h:121
CaloGeometryRecord.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalTBTDCSample
Definition: EcalTBTDCSample.h:14
PEcalTBInfo.h
EcalDigiProducer::m_ParameterMap
std::unique_ptr< const EcalSimParameterMap > m_ParameterMap
Definition: EcalDigiProducer.h:112
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::ParameterSet
Definition: ParameterSet.h:47
EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::tdcMax
std::vector< double > tdcMax
Definition: EcalTBTDCRecInfoAlgo.h:17
EcalTBTDCRawInfo::setSample
void setSample(unsigned int i, const EcalTBTDCSample &sam)
Definition: EcalTBTDCRawInfo.h:31
EcalTBDigiProducer::m_doPhaseShift
bool m_doPhaseShift
Definition: EcalTBDigiProducer.h:43
Event.h
EBDigiCollection
Definition: EcalDigiCollections.h:56
EcalTBDigiProducer::m_TDCproduct
std::unique_ptr< EcalTBTDCRawInfo > m_TDCproduct
Definition: EcalTBDigiProducer.h:55
EEDigiCollection
Definition: EcalDigiCollections.h:69
PEcalTBInfo
Definition: PEcalTBInfo.h:18
EcalTBTDCRecInfoAlgo::EcalTBTDCRanges
Definition: EcalTBTDCRecInfoAlgo.h:14
EcalTBTDCRawInfo
Definition: EcalTBTDCRawInfo.h:13
EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::runRanges
std::pair< int, int > runRanges
Definition: EcalTBTDCRecInfoAlgo.h:15
edm::ProducesCollector::produces
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
Definition: ProducesCollector.h:52
Ecal2004TBTDCRanges_cff.tdcMax
tdcMax
Definition: Ecal2004TBTDCRanges_cff.py:4
edm::EventSetup
Definition: EventSetup.h:58
DetId::Ecal
Definition: DetId.h:27
get
#define get
EcalDigiProducer::initializeEvent
void initializeEvent(edm::Event const &e, edm::EventSetup const &c) override
Definition: EcalDigiProducer.cc:271
instance
static PFTauRenderPlugin instance
Definition: PFTauRenderPlugin.cc:70
EcalTBDigiProducer::m_EBdigiFinalTag
std::string m_EBdigiFinalTag
Definition: EcalTBDigiProducer.h:40
EcalTBDigiProducer.h
EcalTBReadout
Definition: EcalTBReadout.h:19
EcalDigiProducer
Definition: EcalDigiProducer.h:59
eostools.move
def move(src, dest)
Definition: eostools.py:511
EcalTBDigiProducer::finalizeEvent
void finalizeEvent(edm::Event &, edm::EventSetup const &) override
Definition: EcalTBDigiProducer.cc:86
EcalTBDigiProducer::EcalTBDigiProducer
EcalTBDigiProducer(const edm::ParameterSet &params, edm::ProducesCollector, edm::ConsumesCollector &iC)
Definition: EcalTBDigiProducer.cc:17
EcalTBDigiProducer::m_eeDigis
std::unique_ptr< EEDigiCollection > m_eeDigis
Definition: EcalTBDigiProducer.h:54
edm::ProducesCollector
Definition: ProducesCollector.h:43
CaloGeometry::getValidDetIds
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:75
EcalTBDigiProducer::cacheEEDigis
void cacheEEDigis(const EEDigiCollection *eeDigiPtr) const override
Definition: EcalTBDigiProducer.cc:148
EcalTBDigiProducer::m_tunePhaseShift
double m_tunePhaseShift
Definition: EcalTBDigiProducer.h:51
EcalTBDigiProducer::m_ecalTBInfoLabel
std::string m_ecalTBInfoLabel
Definition: EcalTBDigiProducer.h:39
CaloGeometry.h
EcalTBDigiProducer::m_theTTmap
const EcalTrigTowerConstituentsMap m_theTTmap
Definition: EcalTBDigiProducer.h:36
ConsumesCollector.h
EcalTBDigiProducer::m_EBdigiTempTag
std::string m_EBdigiTempTag
Definition: EcalTBDigiProducer.h:41
EcalTBDigiProducer::m_use2004OffsetConvention
bool m_use2004OffsetConvention
Definition: EcalTBDigiProducer.h:49
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
Parameters
vector< ParameterSet > Parameters
Definition: HLTMuonPlotter.cc:25
EcalTBDigiProducer::m_thisPhaseShift
double m_thisPhaseShift
Definition: EcalTBDigiProducer.h:44
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
EcalTBReadout::setDetIds
void setDetIds(const std::vector< DetId > &detIds)
tell the readout which cells exist
Definition: EcalTBReadout.h:25
edm::DataFrameContainer::size
size_type size() const
Definition: DataFrameContainer.h:162
EcalTBDigiProducer::setPhaseShift
void setPhaseShift(const DetId &detId)
Definition: EcalTBDigiProducer.cc:110