CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
scaleGains.cc File Reference
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <vector>
#include "CalibCalorimetry/HcalAlgos/interface/HcalDbASCIIIO.h"
#include "CondFormats/HcalObjects/interface/HcalGains.h"
#include "Geometry/CaloTopology/interface/HcalTopology.h"

Go to the source code of this file.

Functions

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

Function Documentation

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

Definition at line 11 of file scaleGains.cc.

References HcalCondObjectContainer< Item >::addValues(), ecal_dqm_sourceclient-live_cfg::cerr, HcalDbASCIIIO::dumpObject(), HcalCondObjectContainer< Item >::getAllChannels(), HcalDbASCIIIO::getObject(), HcalGain::getValue(), HcalCondObjectContainer< Item >::getValues(), i, HcalTopologyMode::LHC, and pileupReCalc_HLTpaths::scale.

11  {
12  if (argn < 3) {
13  std::cerr << "Use: " << argv[0] << " <gains to scale (.txt)> <result (.txt)> <scale factor>" << std::endl;
14  return 1;
15  }
17 
18  std::ifstream inStream (argv[1]);
19  std::ofstream outStream (argv[2]);
20  double scale = atof (argv[3]);
21  HcalGains gainsIn(&topo);;
22  HcalDbASCIIIO::getObject (inStream, &gainsIn);
23  HcalGains gainsOut(&topo);;
24  std::vector<DetId> channels = gainsIn.getAllChannels ();
25  for (unsigned i = 0; i < channels.size(); i++) {
26  DetId id = channels[i];
27  HcalGain item(id, gainsIn.getValues(id)->getValue(0) * scale, gainsIn.getValues(id)->getValue(1) * scale,
28  gainsIn.getValues(id)->getValue(2) * scale, gainsIn.getValues(id)->getValue(3) * scale);
29  gainsOut.addValues(item);
30  }
31  HcalDbASCIIIO::dumpObject (outStream, gainsOut);
32  return 0;
33 }
int i
Definition: DBlmapReader.cc:9
Definition: DetId.h:18
bool getObject(std::istream &fInput, HcalPedestals *fObject)
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)