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 }
static constexpr int kSizeForDenseIndexing
Definition: EEDetId.h:328
static int writeXML(const std::string &filename, const EcalCondHeader &header, const EcalFloatCondObjectContainer &record)
static EEDetId unhashIndex(int hi)
Definition: EEDetId.cc:65
static bool validHashIndex(int i)
Definition: EEDetId.h:239
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: EBDetId.h:110
int main(int argc, char *argv[])
Definition: array2xmlEB.cc:21
void usage()
Definition: array2xmlEB.cc:14
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
def exit(msg="")