# Output file location

**URL:** <https://root-forum.cern.ch/t/output-file-location/50701>\
**Category:** Newbie\
**Created:** [July 7, 2022, 12:55pm UTC](https://root-forum.cern.ch/t/output-file-location/50701 "2022-07-07T12:55:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pocarski](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pocarski/32/30224_2.png) [@pocarski](https://root-forum.cern.ch/u/pocarski)\
**Post date:** [July 7, 2022, 12:55pm UTC](https://root-forum.cern.ch/t/output-file-location/50701/1 "2022-07-07T12:55:40Z")

</div>

I have ROOT macros which create .png files, but I have no idea where those files are or how to access them. Where does the Print() instruction output the files it creates?

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [July 7, 2022, 12:56pm UTC](https://root-forum.cern.ch/t/output-file-location/50701/2 "2022-07-07T12:56:36Z")

</div>

Welcome to the ROOT forum,  
Can you show us this macro?

---

<div class="post-metadata">

**Author:** ![pocarski](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pocarski/32/30224_2.png) [@pocarski](https://root-forum.cern.ch/u/pocarski)\
**Post date:** [July 7, 2022, 1:02pm UTC](https://root-forum.cern.ch/t/output-file-location/50701/3 "2022-07-07T13:02:58Z")

</div>

```auto
using namespace GeFiCa;
// Draw weighting potential of a segment of Siegfried (6 segments in phi)
void CalculateWeightingPotential()
{
   if (gSystem->Which(".","siegfried.root")) return;
   Segmented detector;
   detector.SetAverageImpurity(0);
   detector.Bias[0]=0*volt; detector.Bias[1]=1*volt; // weighting potential
   detector.Nphi=6;
   detector.SegmentId=2;

   RhoPhi grid;
   grid.SetupWith(detector);
   grid.SuccessiveOverRelax();

   TFile *output = new TFile("siegfried.root", "recreate");
   detector.Write();
   grid.Write();
   output->Close();
}
// ______________________________________________________________________________
//
void DrawWeightingPotential()
{ 
   // load data
   TFile *input = new TFile("siegfried.root");
   RhoPhi *grid = (RhoPhi*) input->Get("rhophi");
   TTree *t = grid->GetTree();
   const int n = t->GetEntries();
   t->Draw("c1*cos(c2):c1*sin(c2):v","","goff");
   TGraph2D *gv = new TGraph2D(n, t->GetV1(), t->GetV2(), t->GetV3());
   gv->SetName("gv"); gv->SetNpx(500); gv->SetNpy(500); // fine bin histogram

   // draw plot
   gStyle->SetPadRightMargin(0.16); gStyle->SetTitleOffset(-0.6,"z");
   TCanvas *c = new TCanvas("c", "c", 600, 520);
   c->SetLogz();
   TH2D *h = gv->GetHistogram();
   h->SetTitle(";x [cm];y [cm];weighting potential [V]");
   h->GetXaxis()->CenterTitle();
   h->GetYaxis()->CenterTitle();
   h->GetZaxis()->CenterTitle();
   h->Draw("colz");
   // widen the color palette
   c->Update(); // https://root.cern.ch/doc/master/classTPaletteAxis.html
   TPaletteAxis *palette = 
      (TPaletteAxis*) h->GetListOfFunctions()->FindObject("palette");
   palette->SetX2NDC(0.92);

   // draw segmentation scheme
   Segmented *detector = (Segmented*) input->Get("sip");
   detector->Draw("top");
   gPad->Print("sip.png");
}
// ______________________________________________________________________________
//
void drawSliceInPhi()
{
   CalculateWeightingPotential();
   DrawWeightingPotential();
}

```

---

<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:** [July 7, 2022, 1:17pm UTC](https://root-forum.cern.ch/t/output-file-location/50701/4 "2022-07-07T13:17:02Z")

</div>

Looks like they are saved in your “current working directory” (the same where your “`siegfried.root`” file resides).

---

<div class="post-metadata">

**Author:** ![pocarski](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pocarski/32/30224_2.png) [@pocarski](https://root-forum.cern.ch/u/pocarski)\
**Post date:** [July 7, 2022, 1:21pm UTC](https://root-forum.cern.ch/t/output-file-location/50701/5 "2022-07-07T13:21:23Z")

</div>

What’s the the current working directory in Ubuntu then? As far as I can tell, ~/gefica/examples/folder is not the same as C:/Users/User/gefica/examples/folder.

---

<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:** [July 7, 2022, 1:25pm UTC](https://root-forum.cern.ch/t/output-file-location/50701/6 "2022-07-07T13:25:26Z")

</div>

[Uncle Google → WSL home directory](https://www.google.com/search?q=WSL+home+directory)
