FairRoot/PandaRoot
Functions
runLumiPixel1Digi.C File Reference

Go to the source code of this file.

Functions

int runLumiPixel1Digi (const int nEvents=10, const int startEvent=0, TString storePath="tmpOutput", std::string misalignment_matrices_path="geo/misalignMatrices-SensorsOnly-100.root", bool use_point_transform_misalignment=false, const int verboseLevel=0, const int pitch=1)
 

Function Documentation

int runLumiPixel1Digi ( const int  nEvents = 10,
const int  startEvent = 0,
TString  storePath = "tmpOutput",
std::string  misalignment_matrices_path = "geo/misalignMatrices-SensorsOnly-100.root",
bool  use_point_transform_misalignment = false,
const int  verboseLevel = 0,
const int  pitch = 1 
)

Definition at line 1 of file runLumiPixel1Digi.C.

References ctime, digiparFile, Double_t, fRun, geoPar, gGeoManager, inFile, nEvents, outFile, parFile, parInput1, parInput2, rtdb, rtime, startEvent, storePath, timer, TString, and verboseLevel.

2  {
3  // ----- Timer --------------------------------------------------------
4  TStopwatch timer;
5  timer.Start();
6 
7  // Input file (MC events)
8  TString inFile = storePath + "/Lumi_MC_";
9  inFile += startEvent;
10  inFile += ".root";
11  // Parameter file
12  TString parFile = storePath + "/Lumi_Params_";
13  parFile += startEvent;
14  parFile += ".root";
15 
16  // Parameter file
17  TString digiparFile = "lumi.digi.par";
18 
19  // Output file
20  TString outFile = storePath + "/Lumi_digi_";
21  outFile += startEvent;
22  outFile += ".root";
23  std::cout << "DigiFileName: " << outFile.Data() << std::endl;
24 
25  // ----- Reconstruction run -------------------------------------------
26  FairRunAna *fRun = new FairRunAna();
27 
28  FairFileSource *input_source = new FairFileSource(inFile);
29  // input_source->SetEventMeanTime(50);//[ns] 50= interaction rate 20 MHz;
30  input_source->SetEventMeanTime(80); //[ns] 80= interaction rate 12.5 MHz;
31  // example: cross-section(DPM el+inlel, 1.5 GeV/c)= 125 mb, L=10^32 -> interaction rate 12.5 MHz
32  // input_source->SetEventMeanTime(400);//[ns] 400= interaction rate 5 MHz; //15 GeV
33  fRun->SetSource(input_source);
34  fRun->SetOutputFile(outFile);
35 
36  // ----- Parameter database --------------------------------------------
37  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
38  FairParRootFileIo* parInput1 = new FairParRootFileIo(kTRUE);
39  parInput1->open(parFile.Data(), "UPDATE");
40  rtdb->setFirstInput(parInput1);
41  FairParAsciiFileIo* parInput2 = new FairParAsciiFileIo();
42  parInput2->open(digiparFile.Data(), "in");
43  rtdb->setSecondInput(parInput2);
44 
46  // PndLmdStripHitProducerDif* ssdStripProd = new PndLmdStripHitProducerDif(); //TEST
47  lmdStripProd->SetVerbose(verboseLevel);
48  fRun->AddTask(lmdStripProd);
49 
50  rtdb->setOutput(parInput1);
51  rtdb->print();
52  // ===== End of HitProducers =====
53  // =========================================================================
54  PndSdsGeoPar* geoPar = (PndSdsGeoPar*) (rtdb->getContainer("PndSdsGeoPar"));
55 
56  // MialignmentHandler sits here
57 
58  if (misalignment_matrices_path != "" && !use_point_transform_misalignment) {
59  //load matrices
60  cout << "reading misalignMatrices from: " << misalignment_matrices_path << "\n";
61  TFile *misalignmentMatrixRootfile = new TFile(misalignment_matrices_path.c_str(), "READ");
62 
63  if (misalignmentMatrixRootfile->IsOpen()) {
64  std::map < std::string, TGeoHMatrix > *matrices;
65 
66  gDirectory->GetObject("PndLmdMisalignMatrices", matrices);
67  misalignmentMatrixRootfile->Close();
68 
69  cout << matrices->size() << " matrices successfully read from file.\n";
70 
71  //this call has to be made before fRun->Init();
72  fRun->AddAlignmentMatrices(*matrices);
73  }
74  else {
75  cout << "file could not be read\n";
76  return 1;
77  }
78  cout << "starting digi macro\n";
79  }
80 
81  //we need to Init so the gGeoManager gets populated!
82  fRun->Init();
83 
84  // ----- Intialise and run --------------------------------------------
85  //fRun->Init();
86  fRun->Run(0, nEvents);
87  rtdb->saveOutput();
88  rtdb->print();
89 
90  // ----- Finish -------------------------------------------------------
91  timer.Stop();
92  Double_t rtime = timer.RealTime();
93  Double_t ctime = timer.CpuTime();
94  cout << endl << endl;
95  cout << "Macro finished succesfully." << endl;
96  cout << "Output file is " << outFile << endl;
97  cout << "Parameter file is " << parFile << endl;
98  cout << "Real time " << rtime << " s, CPU time " << ctime << " s\a\a" << endl;
99  cout << endl;
100 
101  // temporary fix to avoid double frees at the destruction of te program for pandaroot/fairroot with root6
102  gGeoManager->GetListOfVolumes()->Delete();
103  gGeoManager->GetListOfShapes()->Delete();
104  delete gGeoManager;
105 
106  return 0;
107 }
int verboseLevel
Definition: Lars/runMvdSim.C:7
PndMvdGeoPar * geoPar
TString outFile
Definition: hit_dirc.C:17
Int_t startEvent
TString storePath
TString inFile
Definition: hit_dirc.C:8
TGeoManager * gGeoManager
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
FairParAsciiFileIo * parInput2
Definition: conMvdDigi.C:26
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
Double_t rtime
Definition: hit_dirc.C:113
TString digiparFile