CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
EcalGetLaserData Class Reference

#include <EcalGetLaserData.h>

Inheritance diagram for EcalGetLaserData:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &evt, const edm::EventSetup &evtSetup) override
 
 EcalGetLaserData (const edm::ParameterSet &iConfig)
 
 ~EcalGetLaserData () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void beginJob () override
 
void endJob () override
 

Private Attributes

edm::ESGetToken< EcalLaserAlphas, EcalLaserAlphasRcdecalLaserAlphasToken_
 
edm::ESGetToken< EcalLaserAPDPNRatiosRef, EcalLaserAPDPNRatiosRefRcdecalLaserAPDPNRatiosRefToken_
 
edm::ESGetToken< EcalLaserAPDPNRatios, EcalLaserAPDPNRatiosRcdecalLaserAPDPNRatiosToken_
 
std::map< std::string, unsigned long long > m_cacheIDs
 
std::map< std::string, std::string > m_records
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 24 of file EcalGetLaserData.h.

Constructor & Destructor Documentation

◆ EcalGetLaserData()

EcalGetLaserData::EcalGetLaserData ( const edm::ParameterSet iConfig)
explicit

Definition at line 59 of file EcalGetLaserData.cc.

References edm::ParameterSet::getParameter(), m_cacheIDs, m_records, AlCaHarvesting_cff::record, AlCaHLTBitMon_QueryRunRegistry::string, and GlobalPosition_Frontier_DevDB_cff::toGet.

60  : // m_timetype(iConfig.getParameter<std::string>("timetype")),
61  m_cacheIDs(),
62  m_records(),
66  //m_firstRun=(unsigned long long)atoi( iConfig.getParameter<std::string>("firstRun").c_str());
67  //m_lastRun=(unsigned long long)atoi( iConfig.getParameter<std::string>("lastRun").c_str());
68  std::string container;
70  typedef std::vector<edm::ParameterSet> Parameters;
71  Parameters toGet = iConfig.getParameter<Parameters>("toGet");
72  for (const auto& iparam : toGet) {
73  container = iparam.getParameter<std::string>("container");
74  record = iparam.getParameter<std::string>("record");
75  m_cacheIDs.emplace(container, 0);
76  m_records.emplace(container, record);
77 
78  } //now do what ever initialization is needed
79 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::map< std::string, std::string > m_records
std::map< std::string, unsigned long long > m_cacheIDs
edm::ESGetToken< EcalLaserAlphas, EcalLaserAlphasRcd > ecalLaserAlphasToken_
std::vector< AlignmentParameters * > Parameters
Definition: Utilities.h:32
edm::ESGetToken< EcalLaserAPDPNRatios, EcalLaserAPDPNRatiosRcd > ecalLaserAPDPNRatiosToken_
edm::ESGetToken< EcalLaserAPDPNRatiosRef, EcalLaserAPDPNRatiosRefRcd > ecalLaserAPDPNRatiosRefToken_

◆ ~EcalGetLaserData()

EcalGetLaserData::~EcalGetLaserData ( )
override

Definition at line 81 of file EcalGetLaserData.cc.

81  {
82  // do anything here that needs to be done at desctruction time
83  // (e.g. close files, deallocate resources etc.)
84 }

Member Function Documentation

◆ analyze()

void EcalGetLaserData::analyze ( const edm::Event evt,
const edm::EventSetup evtSetup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 91 of file EcalGetLaserData.cc.

References simBeamSpotPI::alpha, ecalLaserAlphasToken_, ecalLaserAPDPNRatiosRefToken_, ecalLaserAPDPNRatiosToken_, edm::EventSetup::getData(), EcalLaserAPDPNRatios::getLaserMap(), EcalLaserAPDPNRatios::getTimeMap(), EBDetId::hashedIndex(), EEDetId::hashedIndex(), mps_fire::i, l1tPhase2CaloJetEmulator_cfi::iEta, EEDetId::IX_MAX, EEDetId::IX_MIN, EEDetId::IY_MAX, EEDetId::IY_MIN, m_records, EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, EcalLaserAPDPNRatios::EcalLaserAPDPNpair::p1, EcalLaserAPDPNRatios::EcalLaserAPDPNpair::p2, EcalCondObjectContainer< T >::size(), AlCaHLTBitMon_QueryRunRegistry::string, cond::timestamp, and EEDetId::validDetId().

91  {
92  using namespace edm;
93 
94  // loop on offline DB conditions to be transferred as from config file
95  for (const auto& irec : m_records) {
96  const std::string& container = irec.first;
97  //record = irec.second;
98 
99  if (container == "EcalLaserAPDPNRatios") {
100  // get from offline DB the last valid laser set
101  const EcalLaserAPDPNRatios* laserapdpnrRatios = &evtSetup.getData(ecalLaserAPDPNRatiosToken_);
102  // this is the offline object
105 
106  const EcalLaserAPDPNRatios::EcalLaserAPDPNRatiosMap& laserRatiosMap = laserapdpnrRatios->getLaserMap();
107  const EcalLaserAPDPNRatios::EcalLaserTimeStampMap& laserTimeMap = laserapdpnrRatios->getTimeMap();
108 
109  // loop through ecal barrel
110  for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) {
111  if (iEta == 0)
112  continue;
113  for (int iPhi = EBDetId::MIN_IPHI; iPhi <= EBDetId::MAX_IPHI; ++iPhi) {
114  EBDetId ebdetid(iEta, iPhi);
115  int hi = ebdetid.hashedIndex();
116 
117  if (hi < static_cast<int>(laserRatiosMap.size())) {
118  apdpnpair = laserRatiosMap[hi];
119  edm::LogInfo("EcalGetLaserData") << "A sample value of APDPN pair EB : " << hi << " : " << apdpnpair.p1
120  << " , " << apdpnpair.p2 << std::endl;
121  } else {
122  edm::LogError("EcalGetLaserData") << "error with laserRatiosMap!" << std::endl;
123  }
124  }
125  }
126 
127  // loop through ecal endcap
128  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
129  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
130  if (!EEDetId::validDetId(iX, iY, 1))
131  continue;
132 
133  EEDetId eedetidpos(iX, iY, 1);
134  int hi = eedetidpos.hashedIndex();
135 
136  if (hi < static_cast<int>(laserRatiosMap.size())) {
137  apdpnpair = laserRatiosMap[hi];
138  edm::LogInfo("EcalGetLaserData") << "A sample value of APDPN pair EE+ : " << hi << " : " << apdpnpair.p1
139  << " , " << apdpnpair.p2 << std::endl;
140  } else {
141  edm::LogError("EcalGetLaserData") << "error with laserRatiosMap!" << std::endl;
142  }
143 
144  if (!EEDetId::validDetId(iX, iY, -1))
145  continue;
146  EEDetId eedetidneg(iX, iY, 1);
147  hi = eedetidneg.hashedIndex();
148 
149  if (hi < static_cast<int>(laserRatiosMap.size())) {
150  apdpnpair = laserRatiosMap[hi];
151  edm::LogInfo("EcalGetLaserData") << "A sample value of APDPN pair EE- : " << hi << " : " << apdpnpair.p1
152  << " , " << apdpnpair.p2 << std::endl;
153  } else {
154  edm::LogError("EcalGetLaserData") << "error with laserRatiosMap!" << std::endl;
155  }
156  }
157  }
158 
159  for (int i = 0; i < 92; i++) {
160  timestamp = laserTimeMap[i];
161  edm::LogInfo("EcalGetLaserData") << "A value of timestamp pair : " << i << " " << timestamp.t1.value() << " , "
162  << timestamp.t2.value() << std::endl;
163  }
164 
165  edm::LogInfo("EcalGetLaserData") << ".. just retrieved the last valid record from DB " << std::endl;
166 
167  } else if (container == "EcalLaserAPDPNRatiosRef") {
168  // get from offline DB the last valid laser set
169  EcalLaserAPDPNref apdpnref;
170  const EcalLaserAPDPNRatiosRefMap& laserRefMap = (&evtSetup.getData(ecalLaserAPDPNRatiosRefToken_))->getMap();
171 
172  // first barrel
173  for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) {
174  if (iEta == 0)
175  continue;
176  for (int iPhi = EBDetId::MIN_IPHI; iPhi <= EBDetId::MAX_IPHI; ++iPhi) {
177  EBDetId ebdetid(iEta, iPhi);
178  int hi = ebdetid.hashedIndex();
179 
180  if (hi < static_cast<int>(laserRefMap.size())) {
181  apdpnref = laserRefMap[hi];
182  edm::LogInfo("EcalGetLaserData")
183  << "A sample value of APDPN Reference value EB : " << hi << " : " << apdpnref << std::endl;
184  } else {
185  edm::LogError("EcalGetLaserData") << "error with laserRefMap!" << std::endl;
186  }
187  }
188  }
189 
190  // now for endcap
191  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
192  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
193  if (!EEDetId::validDetId(iX, iY, 1))
194  continue;
195 
196  EEDetId eedetidpos(iX, iY, 1);
197  int hi = eedetidpos.hashedIndex();
198 
199  if (hi < static_cast<int>(laserRefMap.size())) {
200  apdpnref = laserRefMap[hi];
201  edm::LogInfo("EcalGetLaserData")
202  << "A sample value of APDPN Reference value EE+ : " << hi << " : " << apdpnref << std::endl;
203 
204  } else {
205  edm::LogError("EcalGetLaserData") << "error with laserRefMap!" << std::endl;
206  }
207 
208  if (!EEDetId::validDetId(iX, iY, -1))
209  continue;
210  EEDetId eedetidneg(iX, iY, -1);
211  hi = eedetidneg.hashedIndex();
212 
213  if (hi < static_cast<int>(laserRefMap.size())) {
214  apdpnref = laserRefMap[hi];
215  edm::LogInfo("EcalGetLaserData")
216  << "A sample value of APDPN Reference value EE- : " << hi << " : " << apdpnref << std::endl;
217  } else {
218  edm::LogError("EcalGetLaserData") << "error with laserRefMap!" << std::endl;
219  }
220  }
221  }
222 
223  edm::LogInfo("EcalGetLaserData") << "... just retrieved the last valid record from DB " << std::endl;
224 
225  } else if (container == "EcalLaserAlphas") {
226  // get from offline DB the last valid laser set
227  // this is the offline object
229  const EcalLaserAlphaMap& laserAlphaMap = (&evtSetup.getData(ecalLaserAlphasToken_))->getMap(); // map of apdpns
230 
231  // first barrel
232  for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) {
233  if (iEta == 0)
234  continue;
235  for (int iPhi = EBDetId::MIN_IPHI; iPhi <= EBDetId::MAX_IPHI; ++iPhi) {
236  EBDetId ebdetid(iEta, iPhi);
237  int hi = ebdetid.hashedIndex();
238 
239  if (hi < static_cast<int>(laserAlphaMap.size())) {
240  alpha = laserAlphaMap[hi];
241  edm::LogInfo("EcalGetLaserData")
242  << " A sample value of Alpha value EB : " << hi << " : " << alpha << std::endl;
243  } else {
244  edm::LogError("EcalGetLaserData") << "error with laserAlphaMap!" << std::endl;
245  }
246  }
247  }
248 
249  // next endcap
250  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
251  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
252  if (!EEDetId::validDetId(iX, iY, 1))
253  continue;
254 
255  EEDetId eedetidpos(iX, iY, 1);
256  int hi = eedetidpos.hashedIndex();
257 
258  if (hi < static_cast<int>(laserAlphaMap.size())) {
259  alpha = laserAlphaMap[hi];
260  edm::LogInfo("EcalGetLaserData")
261  << " A sample value of Alpha value EE+ : " << hi << " : " << alpha << std::endl;
262  } else {
263  edm::LogError("EcalGetLaserData") << "error with laserAlphaMap!" << std::endl;
264  }
265 
266  if (!EEDetId::validDetId(iX, iY, -1))
267  continue;
268  EEDetId eedetidneg(iX, iY, -1);
269  hi = eedetidneg.hashedIndex();
270 
271  if (hi < static_cast<int>(laserAlphaMap.size())) {
272  alpha = laserAlphaMap[hi];
273  edm::LogInfo("EcalGetLaserData")
274  << " A sample value of Alpha value EE- : " << hi << " : " << alpha << std::endl;
275  } else {
276  edm::LogError("EcalGetLaserData") << "error with laserAlphaMap!" << std::endl;
277  }
278  }
279  }
280 
281  edm::LogInfo("EcalGetLaserData") << "... just retrieved the last valid record from DB " << std::endl;
282 
283  } else {
284  edm::LogError("EcalGetLaserData") << "Cannot retrieve for container: " << container << std::endl;
285  }
286  }
287 }
const EcalLaserAPDPNRatiosMap & getLaserMap() const
float EcalLaserAlpha
static const int MIN_IPHI
Definition: EBDetId.h:135
std::map< std::string, std::string > m_records
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
Log< level::Error, false > LogError
static const int IX_MIN
Definition: EEDetId.h:290
float EcalLaserAPDPNref
static const int IY_MIN
Definition: EEDetId.h:294
Definition: EPCuts.h:4
const EcalLaserTimeStampMap & getTimeMap() const
static const int IX_MAX
Definition: EEDetId.h:298
Log< level::Info, false > LogInfo
edm::ESGetToken< EcalLaserAlphas, EcalLaserAlphasRcd > ecalLaserAlphasToken_
static const int MAX_IPHI
Definition: EBDetId.h:137
std::vector< EcalLaserTimeStamp > EcalLaserTimeStampMap
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
static const int MAX_IETA
Definition: EBDetId.h:136
HLT enums.
edm::ESGetToken< EcalLaserAPDPNRatios, EcalLaserAPDPNRatiosRcd > ecalLaserAPDPNRatiosToken_
static const int IY_MAX
Definition: EEDetId.h:302
edm::ESGetToken< EcalLaserAPDPNRatiosRef, EcalLaserAPDPNRatiosRefRcd > ecalLaserAPDPNRatiosRefToken_

◆ beginJob()

void EcalGetLaserData::beginJob ( )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 290 of file EcalGetLaserData.cc.

290 {}

◆ endJob()

void EcalGetLaserData::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 293 of file EcalGetLaserData.cc.

293 {}

Member Data Documentation

◆ ecalLaserAlphasToken_

edm::ESGetToken<EcalLaserAlphas, EcalLaserAlphasRcd> EcalGetLaserData::ecalLaserAlphasToken_
private

Definition at line 42 of file EcalGetLaserData.h.

Referenced by analyze().

◆ ecalLaserAPDPNRatiosRefToken_

edm::ESGetToken<EcalLaserAPDPNRatiosRef, EcalLaserAPDPNRatiosRefRcd> EcalGetLaserData::ecalLaserAPDPNRatiosRefToken_
private

Definition at line 41 of file EcalGetLaserData.h.

Referenced by analyze().

◆ ecalLaserAPDPNRatiosToken_

edm::ESGetToken<EcalLaserAPDPNRatios, EcalLaserAPDPNRatiosRcd> EcalGetLaserData::ecalLaserAPDPNRatiosToken_
private

Definition at line 40 of file EcalGetLaserData.h.

Referenced by analyze().

◆ m_cacheIDs

std::map<std::string, unsigned long long> EcalGetLaserData::m_cacheIDs
private

Definition at line 33 of file EcalGetLaserData.h.

Referenced by EcalGetLaserData().

◆ m_records

std::map<std::string, std::string> EcalGetLaserData::m_records
private

Definition at line 34 of file EcalGetLaserData.h.

Referenced by analyze(), and EcalGetLaserData().