FairRoot/PandaRoot
hit_emc_apd.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_apd.root";
10 
11 
12  // Number of events to process
13  Int_t nEvents = 0; // if 0 all the vents will be processed
14 
15  // Parameter file
16  TString parFile = "simparams.root"; // at the moment you do not need it
17 
18  // Output file
19  TString outFile = "hit_emc_apd.root";
20 
21  // Loading libraries
22  // If the macro gives error messages in loading libraries, please check the path of the libs and put it by hands
23 
24 
25  gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");
26  gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
27  rootlogon();
28  basiclibs();
29 
30  // ----- Timer --------------------------------------------------------
31  TStopwatch timer;
32  timer.Start();
33  // ------------------------------------------------------------------------
34 
35  // ----- Reconstruction run -------------------------------------------
36  FairRunAna *fRun= new FairRunAna();
37  fRun->SetInputFile(inFile);
38  fRun->SetOutputFile(outFile);
39 
40  // ----- Parameter database --------------------------------------------
41  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
42  FairParRootFileIo* parInput1 = new FairParRootFileIo();
43  parInput1->open(parFile.Data());
44 
45  rtdb->setFirstInput(parInput1);
46  // ----------------------------------------------------------
47 
48  fRun->LoadGeometry();
49  // ------------------------------------------------------------------------
50 
51  // ----- EMC APD hit producers ---------------------------------
52 
54  fRun->AddTask(emcApdHitProd);
55 
56  // ----- Intialise and run --------------------------------------------
57  cout << "fRun->Init()" << endl;
58  fRun->Init();
59  fRun->Run(0,nEvents);
60  // ------------------------------------------------------------------------
61 
62 
63  // ----- Finish -------------------------------------------------------
64  timer.Stop();
65  Double_t rtime = timer.RealTime();
66  Double_t ctime = timer.CpuTime();
67  cout << endl << endl;
68  cout << "Macro finished successfully." << endl;
69  cout << "Output file is " << outFile << endl;
70  cout << "Parameter file is " << parFile << endl;
71  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
72  cout << endl;
73  // ------------------------------------------------------------------------
74 
75 }
FairRuntimeDb * rtdb
Definition: hit_emc_apd.C:41
TString inFile
Definition: hit_emc_apd.C:9
basiclibs()
FairRunAna * fRun
Definition: hit_emc_apd.C:36
Int_t nEvents
Definition: hit_emc_apd.C:13
PndEmcApdHitProducer * emcApdHitProd
Definition: hit_emc_apd.C:53
Double_t
TStopwatch timer
Definition: hit_emc_apd.C:31
TString outFile
Definition: hit_emc_apd.C:19
Double_t ctime
Definition: hit_dirc.C:114
Int_t iVerbose
Double_t rtime
Definition: hit_dirc.C:113
TString parFile
Definition: hit_emc_apd.C:16
FairParRootFileIo * parInput1
Definition: hit_emc_apd.C:42