digi.C

Vitaliy Schetinin, 11/22/2018 08:33 PM

Download (3.43 KB)

 
1
void digi(Int_t nEvents = 1000)
2
{
3
  TString inputdir = gSystem->Getenv("VMCWORKDIR");
4
  inputdir = inputdir + "/input/";
5

    
6
  TString inFile = inputdir + "he8_05_0002.lmd.root";
7
  TString confFile = inputdir + "myXML.xml";
8

    
9
  // --- Specify output file name (this is just an example)
10
  TString outFile = "myDigi.root";
11

    
12
  std::cout << ">>> input file is " << inFile  << std::endl;
13
  std::cout << ">>> output file is " << outFile << std::endl;
14

    
15
  // --- Source task
16
  ERDigibuilder* builder = new ERDigibuilder();
17
  builder->SetConfigurationFile(confFile);
18
  builder->AddFile(inFile);
19

    
20

    
21
  ERBeamDetUnpack* beamDetUnpack = new ERBeamDetUnpack("Beam_detector");
22
  
23
  ERTelescopeUnpack* rtUnpack = new ERTelescopeUnpack("Right_telescope");
24
  rtUnpack->AddSingleSiStation("SSD20_R",
25
                               "SSD20_R","tSSD20_R",
26
                               inputdir + "/parameters/SSD20_R.cal",
27
                               "X");
28
  rtUnpack->AddSingleSiStation("DSDY_R",
29
                               "DSDY_R","tDSDY_R",
30
                               inputdir + "/parameters/SSDY_R.cal",
31
                               "Y");
32
  rtUnpack->AddSingleSiStation("SSD_R",
33
                               "SSD_R","tSSD_R",
34
                               inputdir + "/parameters/SSD_R.cal",
35
                               "Y");
36

    
37
  ERTelescopeUnpack* ltUnpack = new ERTelescopeUnpack("Left_telescope");
38
  ltUnpack->AddDoubleSiStation("DSD_L",
39
                               "DSDX_L","tDSDX_L",
40
                               "DSDY_L","tDSDY_L",
41
                               inputdir + "/parameters/DSDX_L.cal", inputdir + "/parameters/DSDY_L.cal",
42
                               "XY");
43
  ltUnpack->AddSingleSiStation("SSD20_L",
44
                               "SSD20_L","tSSD20_L",
45
                               inputdir + "/parameters/SSD20_L.cal",
46
                               "X");
47
  ltUnpack->AddSingleSiStation("SSD_L",
48
                               "SSD_L","tSSD_L",
49
                               inputdir + "/parameters/SSD_L.cal",
50
                               "X");
51
  ERTelescopeUnpack* ctUnpack = new ERTelescopeUnpack("Central_telescope");
52
  ctUnpack->AddDoubleSiStation("DSD_C",
53
                               "DSDX_C","tDSDX_C",
54
                               "DSDY_C","tDSDY_C",
55
                               inputdir + "/parameters/DSDX_C.cal", inputdir + "/parameters/DSDY_C.cal",
56
                               "XY");
57
  ctUnpack->AddCsIStation("CsI","CsI","tCsI",inputdir + "/parameters/CsI.cal");
58
  
59
  builder->AddUnpack(beamDetUnpack);
60
  builder->AddUnpack(rtUnpack);
61
  builder->AddUnpack(ltUnpack);
62
  builder->AddUnpack(ctUnpack);  
63
  // --- Run
64
  FairRunOnline *run = new FairRunOnline(builder);
65
  run->SetOutputFile(outFile);
66

    
67
  ERBeamTimeEventHeader* header = new ERBeamTimeEventHeader();
68
  run->SetEventHeader(header);
69

    
70
  // -----   Logger settings --------------------------------------------
71
  FairLogger::GetLogger()->SetLogScreenLevel("DEBUG");
72

    
73
  // --- Start run
74
  TStopwatch timer;
75
  timer.Start();
76
  std::cout << ">>> Starting run..." << std::endl;
77
  run->Init();
78
  run->Run(0,nEvents);
79

    
80
  timer.Stop();
81
  
82
  // --- End-of-run info
83
  Double_t rtime = timer.RealTime();
84
  Double_t ctime = timer.CpuTime();
85
  std::cout << std::endl << std::endl;
86
  std::cout << ">>> Macro finished successfully." << std::endl;
87
  std::cout << ">>> Output file is " << outFile << std::endl;
88
  std::cout << ">>> Real time " << rtime << " s, CPU time "
89
            << ctime << " s" << std::endl;
90
}