digi.C

Vitaliy Schetinin, 07/05/2017 08:08 AM

Download (2.75 KB)

 
1
void digi(Int_t seed,Int_t nEvents){
2
  //---------------------Files-----------------------------------------------
3
  TString inFile;
4
  inFile.Form("sim%d.root",seed);
5
  TString outFile;
6
  outFile.Form("digi%d.root",seed);
7
  TString parFile;
8
  parFile.Form("par%d.root",seed);
9
  // ------------------------------------------------------------------------
10
  // -----   Timer   --------------------------------------------------------
11
  TStopwatch timer;
12
  timer.Start();
13
  // ------------------------------------------------------------------------
14
  
15
  // -----   Digitization run   -------------------------------------------
16
  FairRunAna *fRun= new FairRunAna();
17
  fRun->SetInputFile(inFile);
18
  fRun->SetOutputFile(outFile);
19
  // ------------------------------------------------------------------------
20
  //-------- Set MC event header --------------------------------------------
21
  EREventHeader* header = new EREventHeader();
22
  fRun->SetEventHeader(header);
23
  //------------------------------------------------------------------------
24
  // ------------------------NeuRadDigitizer---------------------------------
25
  Int_t verbose = 1; // 1 - only standard log print, 2 - print digi information 
26
  ERNeuRadDigitizer* digitizer = new ERNeuRadDigitizer(verbose);
27
  //digitizer->SetUseCrosstalks(kFALSE);
28
  digitizer->SetPixelJitter(0.28/2.36);
29
  fRun->AddTask(digitizer);
30
  // ------------------------------------------------------------------------
31
  
32
  // -----------Runtime DataBase info -------------------------------------
33
  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
34
  
35
  FairParAsciiFileIo* parInput1 = new FairParAsciiFileIo();
36
  TString NeuRadDetDigiFile = gSystem->Getenv("VMCWORKDIR");
37
  NeuRadDetDigiFile += "/parameters/NeuRad.digi.v4.par";
38
  parInput1->open(NeuRadDetDigiFile.Data(),"in");
39

    
40
  FairParRootFileIo*  parInput2 = new FairParRootFileIo();
41
  parInput2->open(parFile.Data(), "UPDATE");
42
  
43
  rtdb->setFirstInput(parInput1);
44
  rtdb->setSecondInput(parInput2);
45
  
46
  // -----   Intialise and run   --------------------------------------------
47
  FairLogger::GetLogger()->SetLogScreenLevel("INFO");
48
  fRun->Init();
49
  fRun->Run(0, nEvents);
50
  // ------------------------------------------------------------------------
51
  rtdb->setOutput(parInput2);
52
  rtdb->saveOutput();
53
  
54
  // -----   Finish   -------------------------------------------------------
55
  timer.Stop();
56
  Double_t rtime = timer.RealTime();
57
  Double_t ctime = timer.CpuTime();
58
  cout << endl << endl;
59
  cout << "Macro finished succesfully." << endl;
60
  cout << "Output file writen:  "    << outFile << endl;
61
  cout << "Parameter file writen " << parFile << endl;
62
  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
63
  cout << endl;
64
  // ------------------------------------------------------------------------
65

    
66
}