CMS 3D CMS Logo

Functions
array2xmlEB.cc File Reference
#include <iostream>
#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h"
#include "CondTools/Ecal/interface/EcalIntercalibConstantsXMLTranslator.h"
#include "CondTools/Ecal/interface/EcalCondHeader.h"
#include "DataFormats/EcalDetId/interface/EBDetId.h"
#include "DataFormats/EcalDetId/interface/EEDetId.h"
#include <string>
#include <sstream>
#include <fstream>

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 
void usage ()
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 21 of file array2xmlEB.cc.

References dir2webdir::argc, GCPpyPlots::argv, c, gather_cfg::cout, beamvalidation::exit(), h, l1ctLayer2EG_cff::id, heavyIonCSV_trainingSettings::idx, recoMuon::in, EEDetId::kSizeForDenseIndexing, EBDetId::unhashIndex(), EEDetId::unhashIndex(), usage(), EEDetId::validHashIndex(), and EcalFloatCondObjectContainerXMLTranslator::writeXML().

21  {
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 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
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="")

◆ usage()

void usage ( )

Definition at line 14 of file array2xmlEB.cc.

References gather_cfg::cout.

Referenced by edm::service::getChildrenCPU(), edm::service::getCPU(), and main().

14  {
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 }