CMS 3D CMS Logo

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

#include <HcalQIEDataCheck.h>

Inheritance diagram for HcalQIEDataCheck:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &ev, const edm::EventSetup &es) override
 
 HcalQIEDataCheck (edm::ParameterSet const &ps)
 
 ~HcalQIEDataCheck () 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::vector< ModuleDescription const * > &modules, 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 Attributes

bool checkemapflag
 
std::string dumprefs
 
std::string dumpupdate
 
std::string outfile
 
bool validateflag
 

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 38 of file HcalQIEDataCheck.h.

Constructor & Destructor Documentation

◆ HcalQIEDataCheck()

HcalQIEDataCheck::HcalQIEDataCheck ( edm::ParameterSet const &  ps)

Definition at line 3 of file HcalQIEDataCheck.cc.

3  {
4  outfile = ps.getUntrackedParameter<std::string>("outFile", "null");
5  dumprefs = ps.getUntrackedParameter<std::string>("dumpRefQIEsTo", "null");
6  dumpupdate = ps.getUntrackedParameter<std::string>("dumpUpdateQIEsTo", "null");
7  checkemapflag = ps.getUntrackedParameter<bool>("checkEmap", false);
8  validateflag = ps.getUntrackedParameter<bool>("validateQIEs", false);
9  // epsilon = ps.getUntrackedParameter<double>("deltaQIE",0);
10 }

References checkemapflag, dumprefs, dumpupdate, edm::ParameterSet::getUntrackedParameter(), outfile, AlCaHLTBitMon_QueryRunRegistry::string, and validateflag.

◆ ~HcalQIEDataCheck()

HcalQIEDataCheck::~HcalQIEDataCheck ( )
override

Definition at line 12 of file HcalQIEDataCheck.cc.

12 {}

Member Function Documentation

◆ analyze()

void HcalQIEDataCheck::analyze ( const edm::Event ev,
const edm::EventSetup es 
)
overridevirtual

Implements edm::EDAnalyzer.

Definition at line 14 of file HcalQIEDataCheck.cc.

14  {
15  using namespace edm::eventsetup;
16 
18  es.get<HcalQIEDataRcd>().get("update", newQIEs);
19  const HcalQIEData* myNewQIEs = newQIEs.product();
20 
22  es.get<HcalQIEDataRcd>().get("reference", refQIEs);
23  const HcalQIEData* myRefQIEs = refQIEs.product();
24 
26  es.get<HcalElectronicsMapRcd>().get("reference", refEMap);
27  const HcalElectronicsMap* myRefEMap = refEMap.product();
28 
29  if (dumpupdate != "null") {
30  std::ofstream outStream(dumpupdate.c_str());
31  std::cout << "--- Dumping QIEs - update ---" << std::endl;
32  HcalDbASCIIIO::dumpObject(outStream, (*myNewQIEs));
33  }
34  if (dumprefs != "null") {
35  std::ofstream outStream2(dumprefs.c_str());
36  std::cout << "--- Dumping QIEs - reference ---" << std::endl;
37  HcalDbASCIIIO::dumpObject(outStream2, (*myRefQIEs));
38  }
39 
40  // first get the list of all channels from the update
41  std::vector<DetId> listNewChan = myNewQIEs->getAllChannels();
42 
43  HcalQIEData* resultQIEs = new HcalQIEData(myRefQIEs->topo());
44  std::vector<DetId> listRefChan = myRefQIEs->getAllChannels();
45  std::vector<DetId>::iterator cell;
46 
47  if (validateflag) {
48  for (std::vector<DetId>::iterator it = listRefChan.begin(); it != listRefChan.end(); it++) {
49  DetId mydetid = *it;
50  cell = std::find(listNewChan.begin(), listNewChan.end(), mydetid);
51  if (cell == listNewChan.end()) // not present in new list
52  {
53  throw cms::Exception("DataDoesNotMatch") << "Value not found in reference" << std::endl;
54  } else // present in new list
55  {
56  const HcalQIECoder* first = myNewQIEs->getCoder(mydetid);
57  const HcalQIECoder* second = myRefQIEs->getCoder(mydetid);
58  {
59  bool failflag = false;
60  if (first->offset(0, 0) != second->offset(0, 0))
61  failflag = true;
62  if (first->offset(0, 1) != second->offset(0, 1))
63  failflag = true;
64  if (first->offset(0, 2) != second->offset(0, 2))
65  failflag = true;
66  if (first->offset(0, 3) != second->offset(0, 3))
67  failflag = true;
68  if (first->offset(1, 0) != second->offset(1, 0))
69  failflag = true;
70  if (first->offset(1, 1) != second->offset(1, 1))
71  failflag = true;
72  if (first->offset(1, 2) != second->offset(1, 2))
73  failflag = true;
74  if (first->offset(1, 3) != second->offset(1, 3))
75  failflag = true;
76  if (first->offset(2, 0) != second->offset(2, 0))
77  failflag = true;
78  if (first->offset(2, 1) != second->offset(2, 1))
79  failflag = true;
80  if (first->offset(2, 2) != second->offset(2, 2))
81  failflag = true;
82  if (first->offset(2, 3) != second->offset(2, 3))
83  failflag = true;
84  if (first->offset(3, 0) != second->offset(3, 0))
85  failflag = true;
86  if (first->offset(3, 1) != second->offset(3, 1))
87  failflag = true;
88  if (first->offset(3, 2) != second->offset(3, 2))
89  failflag = true;
90  if (first->offset(3, 3) != second->offset(3, 3))
91  failflag = true;
92  if (first->slope(0, 0) != second->slope(0, 0))
93  failflag = true;
94  if (first->slope(0, 1) != second->slope(0, 1))
95  failflag = true;
96  if (first->slope(0, 2) != second->slope(0, 2))
97  failflag = true;
98  if (first->slope(0, 3) != second->slope(0, 3))
99  failflag = true;
100  if (first->slope(1, 0) != second->slope(1, 0))
101  failflag = true;
102  if (first->slope(1, 1) != second->slope(1, 1))
103  failflag = true;
104  if (first->slope(1, 2) != second->slope(1, 2))
105  failflag = true;
106  if (first->slope(1, 3) != second->slope(1, 3))
107  failflag = true;
108  if (first->slope(2, 0) != second->slope(2, 0))
109  failflag = true;
110  if (first->slope(2, 1) != second->slope(2, 1))
111  failflag = true;
112  if (first->slope(2, 2) != second->slope(2, 2))
113  failflag = true;
114  if (first->slope(2, 3) != second->slope(2, 3))
115  failflag = true;
116  if (first->slope(3, 0) != second->slope(3, 0))
117  failflag = true;
118  if (first->slope(3, 1) != second->slope(3, 1))
119  failflag = true;
120  if (first->slope(3, 2) != second->slope(3, 2))
121  failflag = true;
122  if (first->slope(3, 3) != second->slope(3, 3))
123  failflag = true;
124  if (failflag)
125  throw cms::Exception("DataDoesNotMatch") << "Values are do not match";
126  }
127  listNewChan.erase(cell); // fix 25.02.08
128  }
129  }
130  std::cout << "These are identical" << std::endl;
131  }
132 
133  // if(epsilon!=0){
134  //implement compare qies -- different epsilon for slope and offset?
135  // }
136 
137  if (outfile != "null") {
138  for (std::vector<DetId>::iterator it = listRefChan.begin(); it != listRefChan.end(); it++) {
139  DetId mydetid = *it;
140  cell = std::find(listNewChan.begin(), listNewChan.end(), mydetid);
141  if (cell == listNewChan.end()) // not present in new list
142  {
143  const HcalQIECoder* myCoder = myRefQIEs->getCoder(mydetid);
144  std::cout << "o";
145  resultQIEs->addCoder(*myCoder);
146  } else // present in new list
147  {
148  const HcalQIECoder* myCoder = myNewQIEs->getCoder(mydetid);
149  std::cout << "n";
150  resultQIEs->addCoder(*myCoder);
151  listNewChan.erase(cell); // fix 25.02.08
152  }
153  }
154  for (std::vector<DetId>::iterator it = listNewChan.begin(); it != listNewChan.end(); it++) // fix 25.02.08
155  {
156  DetId mydetid = *it;
157  const HcalQIECoder* myCoder = myNewQIEs->getCoder(mydetid);
158  std::cout << "N";
159  resultQIEs->addCoder(*myCoder);
160  }
161 
162  std::ofstream outStream3(outfile.c_str());
163  std::cout << "--- Dumping QIEs - the combined ones ---" << std::endl;
164  resultQIEs->sort();
165  HcalDbASCIIIO::dumpObject(outStream3, (*resultQIEs));
166  }
167 
168  std::cout << std::endl;
169  if (checkemapflag) {
170  std::vector<DetId> listResult = resultQIEs->getAllChannels();
171  // get the e-map list of channels
172  std::vector<HcalGenericDetId> listEMap = myRefEMap->allPrecisionId();
173  for (std::vector<HcalGenericDetId>::const_iterator it = listEMap.begin(); it != listEMap.end(); it++) {
174  DetId mydetid = DetId(it->rawId());
175  if (std::find(listResult.begin(), listResult.end(), mydetid) == listResult.end()) {
176  std::cout << "Conditions not found for DetId = " << HcalGenericDetId(it->rawId()) << std::endl;
177  }
178  }
179  }
180 }

References HcalQIEData::addCoder(), HcalElectronicsMap::allPrecisionId(), checkemapflag, gather_cfg::cout, HcalDbASCIIIO::dumpObject(), dumprefs, dumpupdate, Exception, spr::find(), dqmdumpme::first, edm::EventSetup::get(), get, HcalCondObjectContainer< Item >::getAllChannels(), HcalQIEData::getCoder(), outfile, edm::ESHandle< T >::product(), edm::second(), HcalQIEData::sort(), HcalCondObjectContainerBase::topo(), and validateflag.

Member Data Documentation

◆ checkemapflag

bool HcalQIEDataCheck::checkemapflag
private

Definition at line 50 of file HcalQIEDataCheck.h.

Referenced by analyze(), and HcalQIEDataCheck().

◆ dumprefs

std::string HcalQIEDataCheck::dumprefs
private

Definition at line 48 of file HcalQIEDataCheck.h.

Referenced by analyze(), and HcalQIEDataCheck().

◆ dumpupdate

std::string HcalQIEDataCheck::dumpupdate
private

Definition at line 49 of file HcalQIEDataCheck.h.

Referenced by analyze(), and HcalQIEDataCheck().

◆ outfile

std::string HcalQIEDataCheck::outfile
private

Definition at line 47 of file HcalQIEDataCheck.h.

Referenced by analyze(), and HcalQIEDataCheck().

◆ validateflag

bool HcalQIEDataCheck::validateflag
private

Definition at line 51 of file HcalQIEDataCheck.h.

Referenced by analyze(), and HcalQIEDataCheck().

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
HcalElectronicsMapRcd
Definition: HcalElectronicsMapRcd.h:8
HcalGenericDetId
Definition: HcalGenericDetId.h:15
gather_cfg.cout
cout
Definition: gather_cfg.py:144
HcalQIEDataCheck::checkemapflag
bool checkemapflag
Definition: HcalQIEDataCheck.h:50
HcalQIEDataCheck::dumprefs
std::string dumprefs
Definition: HcalQIEDataCheck.h:48
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
dqmdumpme.first
first
Definition: dqmdumpme.py:55
HcalQIEData::getCoder
const HcalQIECoder * getCoder(DetId fId) const
get QIE parameters
Definition: HcalQIEData.h:37
HcalElectronicsMap::allPrecisionId
std::vector< HcalGenericDetId > allPrecisionId() const
Definition: HcalElectronicsMap.cc:139
DetId
Definition: DetId.h:17
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
HcalQIEData::addCoder
bool addCoder(const HcalQIECoder &fCoder)
Definition: HcalQIEData.h:41
HcalQIEDataCheck::validateflag
bool validateflag
Definition: HcalQIEDataCheck.h:51
edm::ESHandle
Definition: DTSurvey.h:22
HcalQIEDataCheck::outfile
std::string outfile
Definition: HcalQIEDataCheck.h:47
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HcalQIEDataCheck::dumpupdate
std::string dumpupdate
Definition: HcalQIEDataCheck.h:49
HcalQIEData::sort
void sort()
Definition: HcalQIEData.h:43
HcalCondObjectContainer::getAllChannels
std::vector< DetId > getAllChannels() const
Definition: HcalCondObjectContainer.h:312
HcalCondObjectContainerBase::topo
const HcalTopology * topo() const
Definition: HcalCondObjectContainer.h:22
get
#define get
HcalQIEData
Definition: HcalQIEData.h:24
HcalQIECoder
Definition: HcalQIECoder.h:20
HcalElectronicsMap
Definition: HcalElectronicsMap.h:31
HcalDbASCIIIO::dumpObject
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
HcalQIEDataRcd
Definition: HcalQIEDataRcd.h:8
Exception
Definition: hltDiff.cc:246
edm::eventsetup
Definition: ES_DDDetector.cc:16