FairRoot/PandaRoot
detectors/disc/digi.C
Go to the documentation of this file.
1 int digi()
2 {
3  // Macro created 20/09/2006 by S.Spataro
4  // It loads a simulation file and digitize hits
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 = "sim.root";
11 
12  // Parameter file
13  TString parFile = "simparams.root"; // at the moment you do not need it
14 
15  // Digitisation file (ascii)
16  TString digiFile = "all.par";
17 
18  // Output file
19  TString outFile = "digi.root";
20 
21  // ----- Timer --------------------------------------------------------
22  TStopwatch timer;
23 
24  // ----- Reconstruction run -------------------------------------------
25  FairRunAna *fRun= new FairRunAna();
26  fRun->SetInputFile(inFile);
27  fRun->SetOutputFile(outFile);
28  fRun->SetGenerateRunInfo(kFALSE);
29  fRun->SetUseFairLinks(kTRUE);
30  // ----- Parameter database --------------------------------------------
31  TString allDigiFile = gSystem->Getenv("VMCWORKDIR");
32  allDigiFile += "/macro/params/";
33  allDigiFile += digiFile;
34 
35  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
36  FairParRootFileIo* parInput1 = new FairParRootFileIo();
37  parInput1->open(parFile.Data());
38 
39  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
40  parIo1->open(allDigiFile.Data(),"in");
41 
42  rtdb->setFirstInput(parInput1);
43  rtdb->setSecondInput(parIo1);
44 
45  // ----- Disc DIRC hit producers ---------------------------
46  PndDiscTaskDigitization* ddirc_digitization = new PndDiscTaskDigitization();
47  ddirc_digitization->RunTimeBased(kTRUE); // Run time based
48  //ddirc_digitization->SetRunMixed(kTRUE); // Run with mixed input
49  fRun->AddTask(ddirc_digitization);
50 
51  // ----- Intialise and run --------------------------------------------
52  fRun->Init();
53 
54  timer.Start();
55  fRun->Run();
56 
57  // ----- Finish -------------------------------------------------------
58  timer.Stop();
59  Double_t rtime = timer.RealTime();
60  Double_t ctime = timer.CpuTime();
61  cout << endl << endl;
62  cout << "Macro finished successfully." << endl;
63  cout << "Output file is " << outFile << endl;
64  cout << "Parameter file is " << parFile << endl;
65  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
66  cout << endl;
67  // ------------------------------------------------------------------------
68  cout << " Test passed" << endl;
69  cout << " All ok " << endl;
70 
71  return 0;
72 }
TClonesArray * digi
TString outFile
Definition: hit_dirc.C:17
TString digiFile
Definition: bump_emc.C:20
TString allDigiFile
Definition: hit_muo.C:36
FairRunAna * fRun
Definition: hit_dirc.C:58
TString inFile
Definition: hit_dirc.C:8
Double_t
TString parFile
Definition: hit_dirc.C:14
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
FairParAsciiFileIo * parIo1
Definition: bump_emc.C:53
Int_t iVerbose
void RunTimeBased(Bool_t time_based)
Double_t rtime
Definition: hit_dirc.C:113