# Running RPC example on batchmode?

**URL:** <https://root-forum.cern.ch/t/running-rpc-example-on-batchmode/49330>\
**Category:** Garfield++\
**Created:** [March 23, 2022, 11:13pm UTC](https://root-forum.cern.ch/t/running-rpc-example-on-batchmode/49330 "2022-03-23T23:13:07Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Las\_D\_Nestor](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/las_d_nestor/32/28320_2.png) [@Las\_D\_Nestor](https://root-forum.cern.ch/u/Las_D_Nestor)\
**Post date:** [March 23, 2022, 11:13pm UTC](https://root-forum.cern.ch/t/running-rpc-example-on-batchmode/49330/1 "2022-03-23T23:13:07Z")

</div>

Currently I am successfully manage to compile the `Garfield++/garfieldpp/Examples/RPC/` example, on my local computer and as a result, when executing the `./Weight` file I get two plots in a root canvas which I can save, from File → Save as → save the plot as `.pdf`.

Now I wanted to try running it on lxplus but when I run the `./Weight` file on lxplus it just stays on hold on:

```auto
Script: Electrons have drifted. It took 0.07s to run.
Sensor::ExportSignal: File 'SignalNaN.csv.csv' exported.
Sensor::ExportSignal: File 'ChargeNaN.csv.csv' exported.
|

```

I guess waiting for the user input to save the plots, but is there a way to run it like in `batch mode`, like a root file `root -b Weight.C ` ?

What am I overlooking ?

Thanks in advanced

---

<div class="post-metadata">

**Author:** ![jalopezg](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jalopezg/32/25844_2.png) [@jalopezg](https://root-forum.cern.ch/u/jalopezg)\
**Post date:** [March 23, 2022, 11:26pm UTC](https://root-forum.cern.ch/t/running-rpc-example-on-batchmode/49330/2 "2022-03-23T23:26:02Z")

</div>

Hi @Las_D_Nestor,

Based on your description, it seems that the application might be trying to show a GUI (X11?). Can you enable X11 forwarding (i.e., `$ ssh -X ...`)and try again?

Regarding the question about a batch mode, perhaps @hschindl can provide some information here.

Cheers,  
J.

---

<div class="post-metadata">

**Author:** ![Las\_D\_Nestor](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/las_d_nestor/32/28320_2.png) [@Las\_D\_Nestor](https://root-forum.cern.ch/u/Las_D_Nestor)\
**Post date:** [March 23, 2022, 11:31pm UTC](https://root-forum.cern.ch/t/running-rpc-example-on-batchmode/49330/3 "2022-03-23T23:31:39Z")

</div>

I have tried with GUI(x11), but the graphics and stability connection are very bad in my case. I have try it but with no success, that is why I post about the batch mode, because with that I can easily run the file and then copy the results to my local computer, much faster.

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [March 24, 2022, 6:13am UTC](https://root-forum.cern.ch/t/running-rpc-example-on-batchmode/49330/4 "2022-03-24T06:13:38Z")

</div>

Hi,  
try commenting out the last line

```auto
app.Run(kTRUE);

```

and/or adding a line

```auto
gROOT->SetBatch(true);

```

at the beginning of the program.

---

<div class="post-metadata">

**Author:** ![Las\_D\_Nestor](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/las_d_nestor/32/28320_2.png) [@Las\_D\_Nestor](https://root-forum.cern.ch/u/Las_D_Nestor)\
**Post date:** [March 24, 2022, 5:23pm UTC](https://root-forum.cern.ch/t/running-rpc-example-on-batchmode/49330/5 "2022-03-24T17:23:58Z")

</div>

I will give it a try. And I get the error

```auto
: In function 'int main(int, char**)':
../Garfield++/garfieldpp/Examples/RPC/Weight.C:193:1: error: 'gRoot' was not declared in this scope
  193 | gRoot->SetBatch(true);
      | ^ ~~~~
make[2]: *** [CMakeFiles/Weight.dir/Weight.C.o] Error 1
make[1]: *** [CMakeFiles/Weight.dir/all] Error 2
make: *** [all] Error 2

```

Even do I have the header file `#include <TROOT.h> `. I am still looking what might be wrong

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [March 24, 2022, 6:19pm UTC](https://root-forum.cern.ch/t/running-rpc-example-on-batchmode/49330/6 "2022-03-24T18:19:41Z")

</div>

`gROOT`

---

<div class="post-metadata">

**Author:** ![Las\_D\_Nestor](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/las_d_nestor/32/28320_2.png) [@Las\_D\_Nestor](https://root-forum.cern.ch/u/Las_D_Nestor)\
**Post date:** [March 24, 2022, 6:22pm UTC](https://root-forum.cern.ch/t/running-rpc-example-on-batchmode/49330/7 "2022-03-24T18:22:27Z")

</div>

ohh, god I feel so bad. But, it now complies and finishes the job, but how can I save the plots? it finishes with :

```auto
AvalancheGrid::StartGridAvalanche::Avalanche maximum size of 1.6e+07 electrons reached at 0.901481 ns.
AvalancheGrid::StartGridAvalanche::Final avalanche size = 16000000 at t = 0.92892 ns.
Script: Electrons have drifted. It took 0.07s to run.
Sensor::ExportSignal: File 'SignalNaN.csv.csv' exported.
Sensor::ExportSignal: File 'ChargeNaN.csv.csv' exported.

```

and doing an `ls`

```auto
CMakeCache.txt ChargeNaN.csv SignalNaN.csv Weight
CMakeFiles Makefile TimingRPCGas.gas cmake_install.cmake

```

and I see no plot file saved, I mean I could replicate it having the .csv.

---

<div class="post-metadata">

**Author:** ![Las\_D\_Nestor](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/las_d_nestor/32/28320_2.png) [@Las\_D\_Nestor](https://root-forum.cern.ch/u/Las_D_Nestor)\
**Post date:** [March 24, 2022, 10:31pm UTC](https://root-forum.cern.ch/t/running-rpc-example-on-batchmode/49330/8 "2022-03-24T22:31:29Z")

</div>

This is what I have made so far, I can run it in batch mode, and save all canvas in the end right before `gROOT->SetBatch(true);`

```auto
cSignal->SaveAs("cSignal.png");
cCharge->SaveAs("cCharge.png");
cDrift->SaveAs("cDrift.png");

```

But the cSignal.png, cCharge.png are the same image, and cDrfit.png is not saved.

---

<div class="post-metadata">

**Author:** ![Las\_D\_Nestor](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/las_d_nestor/32/28320_2.png) [@Las\_D\_Nestor](https://root-forum.cern.ch/u/Las_D_Nestor)\
**Post date:** [March 25, 2022, 12:10am UTC](https://root-forum.cern.ch/t/running-rpc-example-on-batchmode/49330/9 "2022-03-25T00:10:46Z")

</div>

Well still no luck on the images and `cDrift` has a boolean flag set to `false` which I change to `true` and adding `#include "TPad.h"` and also `gPad->Modified(); gPad->Update();` right before the three saves as, still no image of cDrift is created.

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [March 25, 2022, 5:31am UTC](https://root-forum.cern.ch/t/running-rpc-example-on-batchmode/49330/10 "2022-03-25T05:31:03Z")

</div>

Did you set the flag `plotDrift` to `true`?

---

<div class="post-metadata">

**Author:** ![Las\_D\_Nestor](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/las_d_nestor/32/28320_2.png) [@Las\_D\_Nestor](https://root-forum.cern.ch/u/Las_D_Nestor)\
**Post date:** [March 25, 2022, 5:36am UTC](https://root-forum.cern.ch/t/running-rpc-example-on-batchmode/49330/11 "2022-03-25T05:36:04Z")

</div>

yes, I double checked and it worked, when I added `Pad->Modified(); gPad->Update(); ` before

```auto
cSignal->SaveAs("cSignal.png");
cCharge->SaveAs("cCharge.png");
cDrift->SaveAs("cDrift.png");

```

Thanks, a lot.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [April 8, 2022, 5:37am UTC](https://root-forum.cern.ch/t/running-rpc-example-on-batchmode/49330/12 "2022-04-08T05:37:04Z")

</div>

Closed on April 8, 2022, 5:37am UTC

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