CMS 3D CMS Logo

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"

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 10 of file scaleGains.cc.

References TestMuL1L2Filter_cff::cerr, HcalDbASCIIIO::dumpObject(), lat::endl(), HcalDbASCIIIO::getObject(), i, and scale.

00010                                    {
00011   if (argn < 3) {
00012     std::cerr << "Use: " << argv[0] << " <gains to scale (.txt)> <result (.txt)> <scale factor>" << std::endl;
00013     return 1;
00014   }
00015   std::ifstream inStream (argv[1]);
00016   std::ofstream outStream (argv[2]);
00017   double scale = atof (argv[3]);
00018   HcalGains gainsIn;
00019   HcalDbASCIIIO::getObject (inStream, &gainsIn);
00020   HcalGains gainsOut;
00021   std::vector<DetId> channels = gainsIn.getAllChannels ();
00022   for (unsigned i = 0; i < channels.size(); i++) {
00023     DetId id = channels[i];
00024     HcalGain item(id, gainsIn.getValues(id)->getValue(0) * scale, gainsIn.getValues(id)->getValue(1) * scale, 
00025                   gainsIn.getValues(id)->getValue(2) * scale, gainsIn.getValues(id)->getValue(3) * scale);
00026     gainsOut.addValues(item);
00027   }
00028   HcalDbASCIIIO::dumpObject (outStream, gainsOut);
00029   return 0;
00030 }


Generated on Tue Jun 9 17:51:44 2009 for CMSSW by  doxygen 1.5.4