Error in TCutg :: Proof Selector

Hello,

I am using Proof selector to display my histograms and make gates.

My Master Process is pasted below.

I have defined three different macros with three different cuts. But when I try to execute my program, I get the following errors -

Entries (from chain): 16401561
 +++ Starting PROOF-Lite with 16 workers +++
Opening connections to workers: OK (16 workers)                 
Setting up worker servers: OK (16 workers)                 
PROOF set to parallel mode (16 workers)
Info in <TProofLite::SetPerfTree>: saving of the performance tree enabled (perftree.root)
Number of workers set to: 16
Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1
/home/mansi/57ZnBetaP/e18018_proof/./gates/PID57Zn.C:6:11: error: redefinition of 'cutg'
   TCutG *cutg = new TCutG("Zn57",14);
          ^
/home/mansi/57ZnBetaP/e18018_proof/./gates/pin.C:6:11: note: previous definition is here
   TCutG *cutg = new TCutG("Pin",6);
          ^
input_line_98:2:50: error: use of undeclared identifier 'Zn57'
 (((*(class TProof **)0x7f9387b5c030))->AddInput(Zn57))
                                                 ^
terminate called after throwing an instance of 'cling::CompilationException'
  what():  Error evaluating expression (((*(class TProof **)0x7f9387b5c030))->AddInput(Zn57))

Please help me out !!!
I have attached the gates macros also.

Thanks,

MansiPID56Cu.C (833 Bytes) pin.C (490 Bytes)

// MASTERPROCESS.C
*******************************************************************************************************

{
  gSystem->SetAclicMode(TSystem::kDebug);
  gSystem->SetAclicMode(TSystem::kOpt);

  // Get the shared object file which contains the beta decay classes
  //gSystem->Load("/user/e18018/RootAnalysis/libParametersddas.so");
  gSystem->Load("/home/mansi/57ZnBetaP/RootAnalysis/libParametersddas.so");

  // Make the libraries
  Int_t error;
  gROOT->ProcessLine(".L e18018Selector.C+", &error); if(error) exit(EXIT_FAILURE);
    
  gROOT->ProcessLine(".L Chain.C");
  TChain *data = new TChain("data");
  
  // Data runs
   Chain(data,168);
   Chain(data,169);
  cout << "Entries (from chain): " << data->GetEntries() << endl;
  // data->Print();

  Int_t nwrks = 16;
  TProof* proof = TProof::Open(Form("workers=%i",nwrks));
  proof->SetPerfTree("perftree.root",kFALSE);
  // Check number workers
  if(proof->GetParallel() < nwrks) {
    cout << "MasterProcess.C: request for " << nwrks << " workers larger then available - ignored" << endl;
  }  
  cout << "Number of workers set to: " << proof->GetParallel() << endl;
  // proof->Print();

  data->SetProof(proof);

  // Gates
   gROOT->ProcessLine(".x gates/pin.C");
    proof->AddInput(Pin); 

  gROOT->ProcessLine(".x gates/PID57Zn.C");
  gROOT->ProcessLine(".x gates/PID56Cu.C");

 
  // Add the gates to the input list//  
  proof->AddInput(Zn57);
  proof->AddInput(Cu56);

  
  // Print out the input list, should include gates
  cout << "Input objects (from MasterProcess.C):" << endl;
  TIter next_object(proof->GetInputList());
  TObject *this_object = 0;
  while ((this_object = next_object())) {
    cout << this_object->ClassName() << " " << this_object->GetName() << endl;
  }

  // Process data
  data->Process("e18018Selector.C+");
  proof->Print("F");

  data->SetProof(0); // Detach from the PROOF session
}

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


The error seems quite clear, your program redefines the variable cutg. Check your code to see if cutg is declared several times.

Hi
Thanks for replying.
I checked again -

I have defined three different macros which contain the gates -
pin.C. // contains a CUTG named PIN
PID57Zn.C // contains CUTG named Zn57
PID56Cu.C // contains CUTG named Cu56

I am trying to load all three macros and using them to plot my histograms.
The cutg defined in pin.C is used to fill a histogram which defines the PID histogram. Further, a define two different cutg on the PID histogram, to further sort the histograms.

But, as soon as I define the pin.C macros and try to load this extra gate, I start getting the error.

I am not sure, what to do now?
Mansi

So what you I do with the 2 macros you sent to reproduce the problem ?

I load the macros in the MasterProcess.C code like below -

// Gates
   gROOT->ProcessLine(".x gates/pin.C");
    proof->AddInput(Pin); 

  gROOT->ProcessLine(".x gates/PID57Zn.C");
  gROOT->ProcessLine(".x gates/PID56Cu.C");

 
  // Add the gates to the input list//  
  proof->AddInput(Zn57);
  proof->AddInput(Cu56);


and then try to use them in the selector.C code.

If that was your question?

Ok I can do:

{
   gROOT->ProcessLine(".x pin.C");
   gROOT->ProcessLine(".x PID56Cu.C");
}

But then what ? do not have anything else to reproduce your issue.
Note that pin.C and PID56Cu.C bot define cutg.

Yes, that’s my question then.
How do I define two different cutg in two different histograms. And then use them.

I want all three together, pin.C, PID57Zn and PID56Cu.

I hope I am explaining well.

If I remove gROOT->ProcessLine(".x pin.C"); from my code, and just keep

gROOT->ProcessLine(".x gates/PID57Zn.C");
gROOT->ProcessLine(".x gates/PID56Cu.C");

I get no error. But I want all three gates.

You send me only two. Can you give me some code reproducing the error ? right now I do not see any error. Therefore it is difficult to help you. I need a macro or a set of macro showing the error.

Sure

I can attach the macros.pin.C (490 Bytes) PID56Cu.C (833 Bytes) PID57Zn.C (791 Bytes) MasterProcess.C (3.9 KB)

I think, I understand my mistake here.
I am using the same object cutg to define all my gates.
I must rename them for all .

I think I overlooked this :frowning:

Yes that’s what I suggested. Let me know.

Its works :slight_smile:
Thanks
Mansi

1 Like

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