we cannot access the variables of gHaCuts like this. This does not work.
-----Original Message-----
From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch] On Behalf Of Fine, Valeri
Sent: 30 November 2007 02:35
To: roottalk_at_root.cern.ch
Subject: FW: [ROOT] How to define the expression to check if a big char string contai ns small char string
The message is correct. I believe your method "Define" has no idea those listClients, ordClient are defined as the variables within the scope of another method.
Try something like this:
gHaCuts->Define("Expr",Form("((size < 1000) && (vol < (0.001 * ADV)) && gHaCuts->(prod == value) && strstr(\"%s\",\"%s\") )", gHaCuts->listClients,ordClient));
Best Regards
Valeri Fine
Hi,
I am trying to "Define" an expression to check whether a long char string contains another small char string.
For this, I am using strstr() library function in C++.
Expression is like this:
THaVarList * gHaVars = new THaVarList();
THaCutList * gHaCuts = new THaCutList(gHaVars);
const char* listClients="ABCD,EFGH,HIJK,NEWONE,JUNK,DONE";
const char* ordClient = "DONE";
gHaVars->Define("listClients",listClients);
gHaVars->Define("ordClient",ordClient);
gHaCuts->Define("Expr","((size < 1000) && (vol < (0.001 * ADV)) && (prod == value) && strstr(listClients,ordClient) )"); Program compiles fine, but when I run this program, the Define() function call fails with an error message:
Error in <THaCut::Compile>: strstr requires 2 string arguments Error in <THaCutList::Define>: expression error, cut not created: Expr ((size < 1000) && (vol < (0.001 * ADV)) && (prod == value) && strstr((listClients),(ordClient)) ) block: Default I have given the correct number & type of input parameters to strstr, but then why is the "::Compile" still failing?
How can we achieve this type of checks?
Please help.
Thanks and Regards,
Ganesh
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
This archive was generated by hypermail 2.2.0 : Fri Nov 30 2007 - 11:50:01 CET