19 std::cerr <<
"Use: " << argv[0] <<
" operation <gains(.txt)> <operand> <result(.txt)>" << std::endl;
20 std::cerr <<
" where operation: sadd,ssub,smult,sdiv = +-*/ of a scalar value \n";
21 std::cerr <<
" add,sub,mult,div = +-*/ of vector values (in RespCorr-format)\n";
27 std::ifstream inStream (argv[2]);
32 std::ofstream outStream (argv[4]);
36 std::string s_operation;
37 s_operation = argv[1];
38 bool vectorop =
false;
42 if ( (std::strcmp(s_operation.c_str(),
"add")==0) ||
43 (std::strcmp(s_operation.c_str(),
"sub")==0) ||
44 (std::strcmp(s_operation.c_str(),
"mult")==0) ||
45 (std::strcmp(s_operation.c_str(),
"div")==0) )
48 std::ifstream inCorr (argv[3]);
51 else if ((std::strcmp(s_operation.c_str(),
"sadd")==0) ||
52 (std::strcmp(s_operation.c_str(),
"ssub")==0) ||
53 (std::strcmp(s_operation.c_str(),
"smult")==0) ||
54 (std::strcmp(s_operation.c_str(),
"sdiv")==0))
57 std::cerr <<
"Scalar operation: using val=" << val << std::endl;
61 std::cerr <<
"Unknown operator. Stopping. \n";
67 std::cerr <<
"size = " << channels.size() << std::endl;
68 for (
unsigned i = 0;
i < channels.size();
i++) {
73 if ((std::strcmp(s_operation.c_str(),
"mult")==0)||(std::strcmp(s_operation.c_str(),
"div")==0)) val = 1.0;
74 if ((std::strcmp(s_operation.c_str(),
"add")==0)||(std::strcmp(s_operation.c_str(),
"sub")==0)) val = 0.0;
80 std::cerr <<
"Vector operation, " <<
i <<
"th channel: using val=" << val << std::endl;
85 if ((std::strcmp(s_operation.c_str(),
"add")==0) || (std::strcmp(s_operation.c_str(),
"sadd")==0))
89 if ((std::strcmp(s_operation.c_str(),
"sub")==0) || (std::strcmp(s_operation.c_str(),
"ssub")==0))
93 if ((std::strcmp(s_operation.c_str(),
"mult")==0) || (std::strcmp(s_operation.c_str(),
"smult")==0))
97 if ((std::strcmp(s_operation.c_str(),
"div")==0) || (std::strcmp(s_operation.c_str(),
"sdiv")==0))
bool addValues(const Item &myItem, bool h2mode_=false)
float getValue(int fCapId) const
get value for capId = 0..3
int main(int argc, char **argv)
const bool exists(DetId fId) const
std::vector< DetId > getAllChannels() const
bool getObject(std::istream &fInput, HcalPedestals *fObject)
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
const Item * getValues(DetId fId) const