FairRoot/PandaRoot
Functions
sandbox.C File Reference
#include <TString.h>
#include <TH1.h>
#include <TH2.h>
#include <sstream>
#include <iostream>
#include <vector>
#include <map>
#include <TVectorT.h>
#include <TCanvas.h>
#include <TApplication.h>
#include <TChain.h>
#include <TROOT.h>
#include <TSystem.h>
#include <TClonesArray.h>
#include <TRotation.h>
#include <TFile.h>
#include <TGaxis.h>
#include <PndMCTrack.h>
#include <PndSdsMCPoint.h>
#include <PndLmdDim.h>
#include <FairRunAna.h>
#include <FairGeane.h>
#include <FairRtdbRun.h>
#include <FairRuntimeDb.h>
#include <FairParRootFileIo.h>
#include <TGeoVolume.h>
#include <TGraph.h>
#include <TF1.h>
#include <algorithm>
#include <fstream>
#include <TStyle.h>
#include <TColor.h>
#include <FairGeoLoader.h>
#include <FairGeoInterface.h>
#include <FairGeoBuilder.h>
#include <FairGeoPcon.h>
#include <FairGeoMedia.h>
#include <TGeoManager.h>
#include <TImage.h>
#include <TLine.h>
#include <stdlib.h>
#include <TPolyLine.h>
#include "TH2Poly.h"
#include "TRandom.h"

Go to the source code of this file.

Functions

const int nplanes (120)
 
double last_percent (-1.)
 
void DrawProgressBar (int len, double percent)
 
int main ()
 

Function Documentation

void DrawProgressBar ( int  len,
double  percent 
)

Definition at line 498 of file sandbox.C.

References i, and last_percent().

Referenced by main().

498  {
499  if ((int) (last_percent * 100) == (int) (percent * 100))
500  return;
501  //cout << " drawing " << endl;
502  cout << "\x1B[2K"; // Erase the entire current line.
503  cout << "\x1B[0E"; // Move to the beginning of the current line.
504  string progress;
505  for (int i = 0; i < len; ++i) {
506  if (i < static_cast<int> (len * percent)) {
507  progress += "=";
508  } else {
509  progress += " ";
510  }
511  }
512  cout << "[" << progress << "] " << (static_cast<int> (100 * percent))
513  << "%";
514  flush( cout); // Required.
515  last_percent = percent;
516 }
Int_t i
Definition: run_full.C:25
double last_percent(-1.)
double last_percent ( 1.)

Referenced by DrawProgressBar().

int main ( void  )

Definition at line 520 of file sandbox.C.

References DrawProgressBar(), PndLmdDim::Get_histogram_Moduleside(), PndLmdDim::Get_histogram_Plane(), PndLmdDim::Get_histogram_Sensor(), hist1, hist2, i, PndLmdDim::Instance(), PndLmdDim::Read_transformation_matrices(), x, and y.

520  {
521  TApplication myapp("myapp", 0, 0);
522  //Check_particle_path();
523  PndLmdDim* lmddim = PndLmdDim::Instance();
525  TH2Poly* hist1 = lmddim->Get_histogram_Plane(0,0,true, true, false);
526  TH2Poly* hist2 = lmddim->Get_histogram_Plane(0,1,true, true, false);
527  cout << " creating hist sensor " << endl;
528  TH2Poly* hist_sens_1 = lmddim->Get_histogram_Sensor(0,0,3,0,0,0,true, true);
529  TH2Poly* hist_mod_1 = lmddim->Get_histogram_Moduleside(1,3,1,0,true, true, true);
530  cout << " done " << endl;
531  for (int i=0; i < 10000000; i++){
532  double x = gRandom->Uniform(-10., 10.);
533  double y = gRandom->Uniform(-10., 10.);
534  hist1->Fill(x,y);
535  hist2->Fill(x,y);
536  hist_sens_1->Fill(x,y);
537  hist_mod_1->Fill(x,y);
538  DrawProgressBar(50, (i + 1) / ((double) 1000000));
539  }
540  TCanvas canvas("canvas", "canvas", 1000, 1000);
541  canvas.Divide(2,2);
542  canvas.cd(1);
543  hist1->Draw("COLZ");
544  canvas.cd(2);
545  hist2->Draw("COLZ");
546  canvas.cd(3);
547  //hist_sens_1->Draw("alp");
548  hist_sens_1->Draw("COLZ");
549  canvas.cd(4);
550  hist_mod_1->Draw("COLZ");
551  myapp.Run();
552  return 0;
553 }
TH2Poly * Get_histogram_Plane(int iplane, int iside, bool aligned=true, bool lmd_frame=true, bool pixel_subdivision=false)
Definition: PndLmdDim.cxx:3658
TH2Poly * Get_histogram_Sensor(int ihalf, int iplane, int imodule, int iside, int idie, int isensor, bool aligned=true, bool lmd_frame=true)
Definition: PndLmdDim.cxx:3721
Int_t i
Definition: run_full.C:25
static PndLmdDim * Instance()
Definition: PndLmdDim.cxx:249
TH1D * hist2
Definition: hist-t7.C:82
void DrawProgressBar(int len, double percent)
Definition: sandbox.C:498
TH2Poly * Get_histogram_Moduleside(int ihalf, int iplane, int imodule, int iside, bool aligned=true, bool lmd_frame=true, bool pixel_subdivision=true)
Definition: PndLmdDim.cxx:3689
void Read_transformation_matrices(string filename="", bool aligned=true, int version_number=geometry_version)
Definition: PndLmdDim.cxx:1515
Double_t x
Double_t y
TH1D * hist1
Definition: hist-t7.C:80
const int nplanes ( 120  )