FairRoot/PandaRoot
sortTopix4TBData.C
Go to the documentation of this file.
1 int sortTopix4TBData(TString inFileName, Int_t nEvents = 0)
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_complete.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 = "SortedData.root";
20 
21  // ----- Timer --------------------------------------------------------
22  TStopwatch timer;
23 
24  // ----- Reconstruction run -------------------------------------------
25  FairRunAna *fRun= new FairRunAna();
26  fRun->SetInputFile(inFileName);
27  fRun->SetOutputFile(outFile);
28  fRun->SetWriteRunInfoFile(kFALSE);
29 
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 
46  PndMapSorterTask* sortTask = new PndMapSorterTask("ToPix4Hits", "ToPix4HitsSorted","Mvd");
47 
48  fRun->AddTask(sortTask);
49 
50 
51  // ----- Intialise and run --------------------------------------------
52  fRun->Init();
53 
54  timer.Start();
55  fRun->Run(0,nEvents);
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 }
int sortTopix4TBData(TString inFileName, Int_t nEvents=0)
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
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
FairParAsciiFileIo * parIo1
Definition: bump_emc.C:53
Int_t iVerbose
Double_t rtime
Definition: hit_dirc.C:113