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::EDAnalyzer 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::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void beginJob () override
 
void endJob () override
 

Private Attributes

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::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 35 of file EcalGetLaserData.h.

Constructor & Destructor Documentation

◆ EcalGetLaserData()

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

Definition at line 55 of file EcalGetLaserData.cc.

56  : // m_timetype(iConfig.getParameter<std::string>("timetype")),
57  m_cacheIDs(),
58  m_records() {
59  std::string container;
62 
63  //m_firstRun=(unsigned long long)atoi( iConfig.getParameter<std::string>("firstRun").c_str());
64  //m_lastRun=(unsigned long long)atoi( iConfig.getParameter<std::string>("lastRun").c_str());
65 
66  typedef std::vector<edm::ParameterSet> Parameters;
67  Parameters toGet = iConfig.getParameter<Parameters>("toGet");
68  for (Parameters::iterator i = toGet.begin(); i != toGet.end(); ++i) {
69  container = i->getParameter<std::string>("container");
70  record = i->getParameter<std::string>("record");
71  m_cacheIDs.insert(std::make_pair(container, 0));
72  m_records.insert(std::make_pair(container, record));
73 
74  } //now do what ever initialization is needed
75 }

References edm::ParameterSet::getParameter(), mps_fire::i, m_cacheIDs, m_records, GlobalPosition_Frontier_DevDB_cff::record, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, and DBConfiguration_cff::toGet.

◆ ~EcalGetLaserData()

EcalGetLaserData::~EcalGetLaserData ( )
override

Definition at line 77 of file EcalGetLaserData.cc.

77  {
78  // do anything here that needs to be done at desctruction time
79  // (e.g. close files, deallocate resources etc.)
80 }

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 87 of file EcalGetLaserData.cc.

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

References alpha, gather_cfg::cout, edm::EventSetup::get(), get, patZpeak::handle, EBDetId::hashedIndex(), EEDetId::hashedIndex(), mps_fire::i, L1TowerCalibrationProducer_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, GlobalPosition_Frontier_DevDB_cff::record, align_cfg::recordName, EcalCondObjectContainer< T >::size(), AlCaHLTBitMon_QueryRunRegistry::string, cond::timestamp, and EEDetId::validDetId().

◆ beginJob()

void EcalGetLaserData::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 293 of file EcalGetLaserData.cc.

293 {}

◆ endJob()

void EcalGetLaserData::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 296 of file EcalGetLaserData.cc.

296 {}

Member Data Documentation

◆ m_cacheIDs

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

Definition at line 44 of file EcalGetLaserData.h.

Referenced by EcalGetLaserData().

◆ m_records

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

Definition at line 45 of file EcalGetLaserData.h.

Referenced by analyze(), and EcalGetLaserData().

DBConfiguration_cff.toGet
toGet
Definition: DBConfiguration_cff.py:10
EcalLaserAPDPNRatios::EcalLaserAPDPNpair::p1
float p1
Definition: EcalLaserAPDPNRatios.h:18
EcalGetLaserData::m_cacheIDs
std::map< std::string, unsigned long long > m_cacheIDs
Definition: EcalGetLaserData.h:44
mps_fire.i
i
Definition: mps_fire.py:428
EcalLaserAPDPNRatiosRcd
Definition: EcalLaserAPDPNRatiosRcd.h:24
patZpeak.handle
handle
Definition: patZpeak.py:23
EBDetId
Definition: EBDetId.h:17
edm
HLT enums.
Definition: AlignableModifier.h:19
align_cfg.recordName
recordName
Definition: align_cfg.py:66
gather_cfg.cout
cout
Definition: gather_cfg.py:144
GlobalPosition_Frontier_DevDB_cff.record
record
Definition: GlobalPosition_Frontier_DevDB_cff.py:10
EcalLaserAlpha
float EcalLaserAlpha
Definition: EcalLaserAlphas.h:10
EEDetId::IX_MIN
static const int IX_MIN
Definition: EEDetId.h:290
alpha
float alpha
Definition: AMPTWrapper.h:105
EcalCondObjectContainer::size
size_t size() const
Definition: EcalCondObjectContainer.h:80
EEDetId::IY_MIN
static const int IY_MIN
Definition: EEDetId.h:294
EcalCondObjectContainer< EcalLaserAPDPNpair >
EcalLaserAPDPNRatiosRefRcd
Definition: EcalLaserAPDPNRatiosRefRcd.h:24
cond::timestamp
Definition: Time.h:19
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
edm::ESHandle
Definition: DTSurvey.h:22
EBDetId::MAX_IPHI
static const int MAX_IPHI
Definition: EBDetId.h:137
EEDetId::IY_MAX
static const int IY_MAX
Definition: EEDetId.h:302
EEDetId
Definition: EEDetId.h:14
EcalLaserAPDPNref
float EcalLaserAPDPNref
Definition: EcalLaserAPDPNRatiosRef.h:11
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalLaserAPDPNRatios::EcalLaserAPDPNpair
Definition: EcalLaserAPDPNRatios.h:16
EEDetId::IX_MAX
static const int IX_MAX
Definition: EEDetId.h:298
EcalGetLaserData::m_records
std::map< std::string, std::string > m_records
Definition: EcalGetLaserData.h:45
EcalLaserAlphasRcd
Definition: EcalLaserAlphasRcd.h:24
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
EcalLaserAPDPNRatios::EcalLaserTimeStampMap
std::vector< EcalLaserTimeStamp > EcalLaserTimeStampMap
Definition: EcalLaserAPDPNRatios.h:34
get
#define get
hi
Definition: EPCuts.h:4
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
EEDetId::validDetId
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
L1TowerCalibrationProducer_cfi.iEta
iEta
Definition: L1TowerCalibrationProducer_cfi.py:60
Parameters
vector< ParameterSet > Parameters
Definition: HLTMuonPlotter.cc:25
EcalLaserAPDPNRatios::EcalLaserTimeStamp
Definition: EcalLaserAPDPNRatios.h:24
EcalLaserAPDPNRatios::EcalLaserAPDPNpair::p2
float p2
Definition: EcalLaserAPDPNRatios.h:19
EBDetId::MAX_IETA
static const int MAX_IETA
Definition: EBDetId.h:136
EBDetId::MIN_IPHI
static const int MIN_IPHI
Definition: EBDetId.h:135