FairRoot/PandaRoot
hit_emc.C
Go to the documentation of this file.
1 {
2  // Macro created 20/09/2006 by S.Spataro
3  // It loads a simulation file and digitize hits for EMC
4 
5  // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
6  Int_t iVerbose = 0; // just forget about it, for the moment
7 
8  // Input file (MC events)
9  TString inFile = "sim_emc.root";
10 
11 
12  // Number of events to process
13  Int_t nEvents = 0; // if 0 all the vents will be processed
14 
15  // Parameter file
16  TString parFile = "simparams.root"; // The geometry is here! (M. Al-Turany)
17 
18  // Digitisation file (ascii)
19  TString digiFile = "emc.par";
20 
21  // Output file
22  TString outFile = "hit_emc.root";
23 
24  // Loading libraries
25  // If the macro gives error messages in loading libraries, please check the path of the libs and put it by hands
26  gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");
27  gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
28  rootlogon();
29  basiclibs();
30 
31  // ----- Timer --------------------------------------------------------
32  TStopwatch timer;
33  timer.Start();
34  // ------------------------------------------------------------------------
35 
36  // ----- Reconstruction run -------------------------------------------
37  FairRunAna *fRun= new FairRunAna();
38  fRun->SetInputFile(inFile);
39  fRun->SetOutputFile(outFile);
40 
41  // ----- Parameter database --------------------------------------------
42  TString emcDigiFile = gSystem->Getenv("VMCWORKDIR");
43  emcDigiFile += "/macro/params/";
44  emcDigiFile += digiFile;
45 
46  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
47  FairParRootFileIo* parInput1 = new FairParRootFileIo();
48  parInput1->open(parFile.Data());
49 
50  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
51  parIo1->open(emcDigiFile.Data(),"in");
52 
53  rtdb->setFirstInput(parInput1);
54  rtdb->setSecondInput(parIo1);
55  // ----------------------------------------------------------
56 
57 
58  // ----- EMC hit producers ---------------------------------
59  // The file name should be the same of the geometry file which was used for the simulation
60 
61 
63  fRun->AddTask(emcHitProd);
64 
65  // ----- Intialise and run --------------------------------------------
66  cout << "fRun->Init()" << endl;
67  fRun->Init();
68  fRun->Run(0,nEvents);
69  // ------------------------------------------------------------------------
70 
71 
72  // ----- Finish -------------------------------------------------------
73  timer.Stop();
74  Double_t rtime = timer.RealTime();
75  Double_t ctime = timer.CpuTime();
76  cout << endl << endl;
77  cout << "Macro finished successfully." << endl;
78  cout << "Output file is " << outFile << endl;
79  cout << "Parameter file is " << parFile << endl;
80  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
81  cout << endl;
82  // ------------------------------------------------------------------------
83 
84 }
TString digiFile
Definition: hit_emc.C:19
TStopwatch timer
Definition: hit_emc.C:32
creates PndEmcHits from PndEmcPoints
PndEmcHitProducer * emcHitProd
Definition: hit_emc.C:62
FairRuntimeDb * rtdb
Definition: hit_emc.C:46
TString emcDigiFile
Definition: hit_emc.C:42
FairRunAna * fRun
Definition: hit_emc.C:37
Double_t
basiclibs()
Double_t ctime
Definition: hit_dirc.C:114
Int_t nEvents
Definition: hit_emc.C:13
TString inFile
Definition: hit_emc.C:9
Int_t iVerbose
FairParRootFileIo * parInput1
Definition: hit_emc.C:47
Double_t rtime
Definition: hit_dirc.C:113
TString outFile
Definition: hit_emc.C:22
TString parFile
Definition: hit_emc.C:16
FairParAsciiFileIo * parIo1
Definition: hit_emc.C:50