FairRoot/PandaRoot
full_emc.C
Go to the documentation of this file.
1 {
2  // Macro created 20/09/2006 by S.Spataro
3  // It loads a simulation file and digitize hits for EMC
4 
5  // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
6  Int_t iVerbose = 0; // just forget about it, for the moment
7 
8  // Input file (MC events)
9  TString inFile = "sim_emc.root";
10 
11  // Number of events to process
12  Int_t nEvents = 0; // if 0 all the vents will be processed
13 
14  // Parameter file
15  TString parFile = "simparams.root"; // at the moment you do not need it
16 
17  // Digitisation file (ascii)
18  TString digiFile = "emc.par";
19 
20  // Output file
21  TString outFile = "full_emc.root";
22 
23  // Loading libraries
24  // If the macro gives error messages in loading libraries, please check the path of the libs and put it by hands
25 
26  gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");
27  rootlogon();
28 
29  // ----- Timer --------------------------------------------------------
30  TStopwatch timer;
31  timer.Start();
32  // ------------------------------------------------------------------------
33 
34  // ----- Reconstruction run -------------------------------------------
35  FairRunAna *fRun= new FairRunAna();
36  fRun->SetInputFile(inFile);
37  fRun->SetOutputFile(outFile);
38 
39  // ----- Parameter database --------------------------------------------
40  TString emcDigiFile = gSystem->Getenv("VMCWORKDIR");
41  emcDigiFile += "/macro/params/";
42  emcDigiFile += digiFile;
43 
44  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
45  FairParRootFileIo* parInput1 = new FairParRootFileIo();
46  parInput1->open(parFile.Data());
47 
48  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
49  parIo1->open(emcDigiFile.Data(),"in");
50 
51  rtdb->setFirstInput(parInput1);
52  rtdb->setSecondInput(parIo1);
53  // ----------------------------------------------------------
54 
55  // ----- EMC hit producers ---------------------------------
56  // The file name should be the same of the geometry file which was used for the simulation
57  // PndEmcMakeDigi* emcMakeDigi=new PndEmcMakeDigi();
58  // fRun->AddTask(emcMakeDigi); // fast digitization
59 
62  fRun->AddTask(emcHitsToWaveform); // full digitization
63  fRun->AddTask(emcWaveformToDigi); // full digitization
64 
66  fRun->AddTask(emcMakeCluster);
67 
69  fRun->AddTask(emcHdrFiller); // ECM header
70 
72  fRun->AddTask(emcMakeBump);
73 
74  // ----- Intialise and run --------------------------------------------
75  cout << "fRun->Init()" << endl;
76  fRun->Init();
77  fRun->Run(0,nEvents);
78  // ------------------------------------------------------------------------
79 
80 
81  // ----- Finish -------------------------------------------------------
82  timer.Stop();
83  Double_t rtime = timer.RealTime();
84  Double_t ctime = timer.CpuTime();
85  cout << endl << endl;
86  cout << "Macro finished successfully." << endl;
87  cout << "Output file is " << outFile << endl;
88  cout << "Parameter file is " << parFile << endl;
89  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
90  cout << endl;
91  // ------------------------------------------------------------------------
92 
93 }
Takes list of PndEmcHits and creates PndEmcWaveform.
FairRunAna * fRun
Definition: full_emc.C:35
Int_t nEvents
Definition: full_emc.C:12
PndEmcHitsToWaveform * emcHitsToWaveform
Definition: full_emc.C:60
PndEmcMakeBump * emcMakeBump
Definition: full_emc.C:71
FairParRootFileIo * parInput1
Definition: full_emc.C:45
TString outFile
Definition: full_emc.C:21
TString parFile
Definition: full_emc.C:15
PndEmcHdrFiller * emcHdrFiller
Definition: full_emc.C:68
TStopwatch timer
Definition: full_emc.C:30
Double_t
TString digiFile
Definition: full_emc.C:18
PndEmcMakeCluster * emcMakeCluster
Definition: full_emc.C:65
FairRuntimeDb * rtdb
Definition: full_emc.C:44
TString inFile
Definition: full_emc.C:9
Takes clusters and slits them up into bumps.
Double_t ctime
Definition: hit_dirc.C:114
PndEmcWaveformToDigi * emcWaveformToDigi
Definition: full_emc.C:61
Task to cluster PndEmcDigis.
Int_t iVerbose
Takes list of PndEmcWaveform and creates PndEmcDigi.
Double_t rtime
Definition: hit_dirc.C:113
Task to create Emc header.
TString emcDigiFile
Definition: full_emc.C:40
FairParAsciiFileIo * parIo1
Definition: full_emc.C:48