FairRoot/PandaRoot
digi_emc.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 = 0; // 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  // ----- Timer --------------------------------------------------------
23  TStopwatch timer;
24  timer.Start();
25  // ------------------------------------------------------
26 
27  // ----- Reconstruction run ------------------------------
28  FairRunAna *fRun= new FairRunAna();
29  fRun->SetInputFile(inFile);
30  fRun->SetOutputFile(outFile);
31 
32  // ----- Parameter database --------------------------
33  TString emcDigiFile = gSystem->Getenv("VMCWORKDIR");
34  emcDigiFile += "/macro/params/";
35  emcDigiFile += digiFile;
36 
37  TString parFile = "simparams.root";
38 
39  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
40  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
41  parIo1->open(emcDigiFile.Data(),"in");
42  FairParRootFileIo* parInput1 = new FairParRootFileIo();
43  parInput1->open(parFile.Data());
44 
45 
46  rtdb->setFirstInput(parIo1);
47  rtdb->setSecondInput(parInput1);
48 
49  // ----------------------------------------------------
50 
53  //emcWaveformToDigi->UseDigitizationVersion2();
54 
55  fRun->AddTask(emcHitsToWaveform);
56  fRun->AddTask(emcWaveformToDigi);
57 
58  // ----- Intialise and run -----------------------
59  cout << "fRun->Init()" << endl;
60  fRun->Init();
61  fRun->Run(0,nEvents);
62  // ----------------------------------------------------
63 
64 
65  // ----- Finish -------------------------------------------------------
66  timer.Stop();
67  Double_t rtime = timer.RealTime();
68  Double_t ctime = timer.CpuTime();
69  cout << endl << endl;
70  cout << "Macro finished successfully." << endl;
71  cout << "Output file is " << outFile << endl;
72  cout << "Parameter file is " << parFile << endl;
73  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
74  cout << endl;
75  // ------------------------------------------------------------------------
76 
77 }
Takes list of PndEmcHits and creates PndEmcWaveform.
TStopwatch timer
Definition: digi_emc.C:23
TString outFile
Definition: digi_emc.C:20
TString emcDigiFile
Definition: digi_emc.C:33
TString inFile
Definition: digi_emc.C:8
Int_t nEvents
Definition: digi_emc.C:11
Double_t
FairRuntimeDb * rtdb
Definition: digi_emc.C:39
FairRunAna * fRun
Definition: digi_emc.C:28
TString parFile
Definition: digi_emc.C:17
FairParRootFileIo * parInput1
Definition: digi_emc.C:42
PndEmcHitsToWaveform * emcHitsToWaveform
Definition: digi_emc.C:51
FairParAsciiFileIo * parIo1
Definition: digi_emc.C:40
Double_t ctime
Definition: hit_dirc.C:114
Int_t iVerbose
Takes list of PndEmcWaveform and creates PndEmcDigi.
Double_t rtime
Definition: hit_dirc.C:113
PndEmcWaveformToDigi * emcWaveformToDigi
Definition: digi_emc.C:52
TString digiFile
Definition: digi_emc.C:14