CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
corrResps.cc File Reference
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <vector>
#include "CalibCalorimetry/HcalAlgos/interface/HcalDbASCIIIO.h"
#include "CondFormats/HcalObjects/interface/HcalRespCorrs.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 10 of file corrResps.cc.

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

10  {
11  if (argn < 3) {
12  std::cerr << "Use: " << argv[0] << " <RespCorrs to scale (.txt)> <resultRespCorrs (.txt)> <correction-respcorr (.txt)>" << std::endl;
13  return 1;
14  }
16  std::ifstream inStream (argv[1]);
17  std::ofstream outStream (argv[2]);
18  std::ifstream inCorr (argv[3]);
19  HcalRespCorrs respIn(&topo);
20  HcalDbASCIIIO::getObject (inStream, &respIn);
21  HcalRespCorrs corrsIn(&topo);
22  HcalDbASCIIIO::getObject (inCorr, &corrsIn);
23 
24  HcalRespCorrs respOut(&topo);
25  std::vector<DetId> channels = respIn.getAllChannels ();
26  for (unsigned i = 0; i < channels.size(); i++) {
27  DetId id = channels[i];
28  float scale = 1.0;
29  if (corrsIn.exists(id)) scale = corrsIn.getValues(id)->getValue();
30  HcalRespCorr item (id, respIn.getValues(id)->getValue() * scale);
31  respOut.addValues(item);
32  }
33  HcalDbASCIIIO::dumpObject (outStream, respOut);
34  return 0;
35 }
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)