FairRoot/PandaRoot
digi_emc_simple.C
Go to the documentation of this file.
1 {
2  // This script run simple digitization.
3  // I.e. just convert EmcHit array to EmcDigi array
4  // with enery above certain treshold
5 
6  // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
7  Int_t iVerbose = 0; // just forget about it, for the moment
8 
9  // Input file (MC events)
10  TString inFile = "hit_emc.root";
11 
12  // Simulation file, to obtaine geometry
13  TString simFile = "sim_emc.root";
14 
15  // Number of events to process
16  Int_t nEvents = 0; // if 0 all the vents will be processed
17 
18  // Digitisation file (ascii)
19  TString digiFile = "emc.par";
20 
21  // Parameter file
22  TString parFile = "simparams.root"; // at the moment you do not need it
23 
24  // Output file
25  TString outFile = "digi_emc.root";
26 
27  // Loading libraries
28  // If the macro gives error messages in loading libraries, please check the path of the libs and put it by hands
29 
30  gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");
31  gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
32  rootlogon();
33  basiclibs();
34 
35  // ----- Timer --------------------------------------------------------
36  TStopwatch timer;
37  timer.Start();
38  // ------------------------------------------------------
39 
40  // ----- Reconstruction run ------------------------------
41  FairRunAna *fRun= new FairRunAna();
42  fRun->SetInputFile(simFile);
43  fRun->AddFriend(inFile);
44  fRun->SetOutputFile(outFile);
45 
46  // ----- Parameter database --------------------------
47  TString emcDigiFile = gSystem->Getenv("VMCWORKDIR");
48  emcDigiFile += "/macro/params/";
49  emcDigiFile += digiFile;
50 
51  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
52  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
53  parIo1->open(emcDigiFile.Data(),"in");
54  rtdb->setFirstInput(parIo1);
55 
56  // ----------------------------------------------------
57  fRun->LoadGeometry();
58  // ----------------------------------------------------
59 
61 
62  fRun->AddTask(emcMakeDigi);
63 
64  // ----- Intialise and run -----------------------
65  cout << "fRun->Init()" << endl;
66  fRun->Init();
67  fRun->Run(0,nEvents);
68  // ----------------------------------------------------
69 
70 
71  // ----- Finish -------------------------------------------------------
72  timer.Stop();
73  Double_t rtime = timer.RealTime();
74  Double_t ctime = timer.CpuTime();
75  cout << endl << endl;
76  cout << "Macro finished successfully." << endl;
77  cout << "Output file is " << outFile << endl;
78  cout << "Parameter file is " << parFile << endl;
79  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
80  cout << endl;
81  // ------------------------------------------------------------------------
82 
83 }
TStopwatch timer
TString emcDigiFile
Int_t nEvents
TString outFile
TString simFile
FairRunAna * fRun
Double_t
FairParAsciiFileIo * parIo1
TString parFile
Double_t ctime
Definition: hit_dirc.C:114
TString inFile
basiclibs()
PndEmcMakeDigi * emcMakeDigi
Int_t iVerbose
TString digiFile
Double_t rtime
Definition: hit_dirc.C:113
FairRuntimeDb * rtdb
Task to create PndEmcDigi from PndEmcHit.