Home | News | Documentation | Download

Preprocessor macros on TChain Process / PROOF

When using plain C++ I can define a preprocessor macro using the -D option in gcc:

$ gcc -Wall -DTEST test.C

How can I achieve the same result (i.e defining TEST so i can use #ifndef TEST) when using proof interactively? (#ifndef TEST will be used in MySelector.C)

// Caller.C
Bool_t IsData //coming from args
TChain* fChain = new TChain("Events");
...
  TProof *fProof = TProof::Open(Form("workers=%d",fWorkers));
  fProof->SetProgressDialog(false);

  fChain->SetProof();
  fChain->Process("MySelector.C+");

I want to define TEST depending if IsData. Is that possible?

Maybe @Axel knows if there is a solution to this

@ganis any suggestion how to inject -D into proof workers?

Is it possible within a root shell ?
If yes, then with gProof->Exec("...") should be possible in PROOF as well.

But, given that the code needs to be recompiled anyhow, and that you are not going to do that all the time, the easiest is to #define TEST in a small header file that gets always included and edit the file when needed.

G Ganis

Thank you all. It is possible to execute fProof->Exec("#define TEST"), however TEST remains undefined at the fChain->Process(..) stage, so I ended up using the header file you suggested

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.