CMS 3D CMS Logo

array2xmlEB.cc
Go to the documentation of this file.
1 #include <iostream>
7 
8 #include <string>
9 #include <sstream>
10 #include <fstream>
11 
12 using namespace std;
13 
14 void usage() {
15  cout << endl;
16  cout << "array2xml [arrayfile] [xmlfile]" << endl;
17  cout << "Read coefficients from straight array [denseindex]" << endl;
18  cout << "and write in xml format" << endl;
19 }
20 
21 int main(int argc, char* argv[]) {
22  if (argc != 3) {
23  usage();
24  exit(0);
25  }
26 
27  string arrayfilename(argv[1]);
28  string xmlfilename(argv[2]);
29  fstream arrayfile(arrayfilename.c_str(), ios::in);
30 
32 
33  float c = 0;
34  int idx = 0;
35 
36  while (arrayfile >> c) {
37  uint32_t id = EBDetId::unhashIndex(idx);
38  rcd[id] = c;
39  ++idx;
40  }
41  cout << idx << endl;
42 
43  for (int cellid = 0; cellid < EEDetId::kSizeForDenseIndexing; ++cellid) { // loop on EB cells
44 
45  if (EEDetId::validHashIndex(cellid)) {
46  uint32_t rawid = EEDetId::unhashIndex(cellid);
47 
48  rcd[rawid] = 0.0;
49 
50  } // if
51  }
52 
53  // write new format
56 }
cmsBatch.argv
argv
Definition: cmsBatch.py:279
EcalIntercalibConstants.h
dir2webdir.argc
argc
Definition: dir2webdir.py:39
EEDetId::unhashIndex
static EEDetId unhashIndex(int hi)
Definition: EEDetId.cc:65
h
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition: L1TUtmAlgorithmRcd.h:4
gather_cfg.cout
cout
Definition: gather_cfg.py:144
EBDetId.h
EEDetId.h
EBDetId::unhashIndex
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: EBDetId.h:110
EcalIntercalibConstantsXMLTranslator.h
EcalCondObjectContainer
Definition: EcalCondObjectContainer.h:13
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
main
int main(int argc, char *argv[])
Definition: array2xmlEB.cc:21
h
EEDetId::kSizeForDenseIndexing
Definition: EEDetId.h:329
EcalCondHeader
Definition: EcalCondHeader.h:16
recoMuon::in
Definition: RecoMuonEnumerators.h:6
EEDetId::validHashIndex
static bool validHashIndex(int i)
Definition: EEDetId.h:239
std
Definition: JetResolutionObject.h:76
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
EcalCondHeader.h
usage
void usage()
Definition: array2xmlEB.cc:14
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:53
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
EcalFloatCondObjectContainerXMLTranslator::writeXML
static int writeXML(const std::string &filename, const EcalCondHeader &header, const EcalFloatCondObjectContainer &record)
Definition: EcalFloatCondObjectContainerXMLTranslator.cc:246