FairRoot/PandaRoot
digi_emc_timebased.C
Go to the documentation of this file.
1 {
2  // Loads a filewith hits and makes digitization for EMC
3 
4  // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
5  Int_t iVerbose = 3; // just forget about it, for the moment
6 
7  // Input file (MC events)
8  TString inFile = "sim_emc.root";
9 
10  // Number of events to process
11  Int_t nEvents = 0; // if 0 all the vents will be processed
12 
13  // Digitisation file (ascii)
14  TString digiFile = "emc.par";
15 
16  // Parameter file
17  TString parFile = "simparams.root"; // at the moment you do not need it
18 
19  // Output file
20  TString outFile = "digi_emc.root";
21 
22  // Loading libraries
23  // If the macro gives error messages in loading libraries, please check the path of the libs and put it by hands
24 
25  gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");
26  gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
27  rootlogon();
28  basiclibs();
29 
30  // ----- Timer --------------------------------------------------------
31  TStopwatch timer;
32  timer.Start();
33  // ------------------------------------------------------
34 
35  // ----- Reconstruction run ------------------------------
36  FairRunAna *fRun= new FairRunAna();
37  fRun->SetInputFile(inFile);
38  fRun->SetOutputFile(outFile);
39  fRun->SetEventMeanTime(50);
40 
41  // ----- Parameter database --------------------------
42  TString emcDigiFile = gSystem->Getenv("VMCWORKDIR");
43  emcDigiFile += "/macro/params/";
44  emcDigiFile += digiFile;
45 
46  TString parFile = "simparams.root";
47 
48  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
49  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
50  parIo1->open(emcDigiFile.Data(),"in");
51  FairParRootFileIo* parInput1 = new FairParRootFileIo();
52  parInput1->open(parFile.Data());
53 
54 
55  rtdb->setFirstInput(parIo1);
56  rtdb->setSecondInput(parInput1);
57 
58  // ----------------------------------------------------
59 
62  emcWaveformToDigi->RunTimeBased();
63 
64  fRun->AddTask(emcHitsToWaveform);
65  fRun->AddTask(emcWaveformToDigi);
66 
67  PndEmcDigiSorterTask* emcSortedDigi = new PndEmcDigiSorterTask(300, 1, "EmcDigi", "EmcSortedDigi", "Emc");
68  fRun->AddTask(emcSortedDigi);
69 
70  // ----- Intialise and run -----------------------
71  cout << "fRun->Init()" << endl;
72  fRun->Init();
73  fRun->Run(0,nEvents);
74  // ----------------------------------------------------
75 
76 
77  // ----- Finish -------------------------------------------------------
78  timer.Stop();
79  Double_t rtime = timer.RealTime();
80  Double_t ctime = timer.CpuTime();
81  cout << endl << endl;
82  cout << "Macro finished successfully." << endl;
83  cout << "Output file is " << outFile << endl;
84  cout << "Parameter file is " << parFile << endl;
85  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
86  cout << endl;
87  // ------------------------------------------------------------------------
88 
89 }
Takes list of PndEmcHits and creates PndEmcWaveform.
basiclibs()
PndEmcHitsToWaveform * emcHitsToWaveform
Definition: full_emc.C:60
PndEmcDigiSorterTask * emcSortedDigi
TString outFile
Definition: hit_dirc.C:17
TString digiFile
Definition: bump_emc.C:20
TString emcDigiFile
Definition: bump_emc.C:45
FairRunAna * fRun
Definition: hit_dirc.C:58
TString inFile
Definition: hit_dirc.C:8
Double_t
TString parFile
Definition: hit_dirc.C:14
Int_t nEvents
Definition: hit_dirc.C:11
TStopwatch timer
Definition: hit_dirc.C:51
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
PndEmcWaveformToDigi * emcWaveformToDigi
Definition: full_emc.C:61
FairParAsciiFileIo * parIo1
Definition: bump_emc.C:53
Int_t iVerbose
Takes list of PndEmcWaveform and creates PndEmcDigi.
Double_t rtime
Definition: hit_dirc.C:113