20 std::cerr <<
"Use: " << argv[0] <<
" operation <gains(.txt)> <operand> <result(.txt)>" << std::endl;
21 std::cerr <<
" where operation: sadd,ssub,smult,sdiv = +-*/ of a scalar value \n";
22 std::cerr <<
" add,sub,mult,div = +-*/ of vector values (in RespCorr-format)\n";
29 std::ifstream inStream (argv[2]);
34 std::ofstream outStream (argv[4]);
39 s_operation = argv[1];
40 bool vectorop =
false;
44 if ( (std::strcmp(s_operation.c_str(),
"add")==0) ||
45 (std::strcmp(s_operation.c_str(),
"sub")==0) ||
46 (std::strcmp(s_operation.c_str(),
"mult")==0) ||
47 (std::strcmp(s_operation.c_str(),
"div")==0) )
50 std::ifstream inCorr (argv[3]);
53 else if ((std::strcmp(s_operation.c_str(),
"sadd")==0) ||
54 (std::strcmp(s_operation.c_str(),
"ssub")==0) ||
55 (std::strcmp(s_operation.c_str(),
"smult")==0) ||
56 (std::strcmp(s_operation.c_str(),
"sdiv")==0))
59 std::cerr <<
"Scalar operation: using val=" << val << std::endl;
63 std::cerr <<
"Unknown operator. Stopping. \n";
69 std::cerr <<
"size = " << channels.size() << std::endl;
70 for (
unsigned i = 0;
i < channels.size();
i++) {
75 if ((std::strcmp(s_operation.c_str(),
"mult")==0)||(std::strcmp(s_operation.c_str(),
"div")==0)) val = 1.0;
76 if ((std::strcmp(s_operation.c_str(),
"add")==0)||(std::strcmp(s_operation.c_str(),
"sub")==0)) val = 0.0;
82 std::cerr <<
"Vector operation, " <<
i <<
"th channel: using val=" << val << std::endl;
87 if ((std::strcmp(s_operation.c_str(),
"add")==0) || (std::strcmp(s_operation.c_str(),
"sadd")==0))
91 if ((std::strcmp(s_operation.c_str(),
"sub")==0) || (std::strcmp(s_operation.c_str(),
"ssub")==0))
95 if ((std::strcmp(s_operation.c_str(),
"mult")==0) || (std::strcmp(s_operation.c_str(),
"smult")==0))
99 if ((std::strcmp(s_operation.c_str(),
"div")==0) || (std::strcmp(s_operation.c_str(),
"sdiv")==0))
const Item * getValues(DetId fId, bool throwOnFail=true) const
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)
bool addValues(const Item &myItem)