FairRoot/PandaRoot
runLumiPixel2fMatrixFinder.C
Go to the documentation of this file.
1 /*
2  * Finds pixel hit pairs and stores them to pair File
3  *
4  * Author: Roman Klasen, roklasen@uni-mainz.de or klasen@kph.uni-mainz.de
5  *
6  *
7  */
8 
9 //#include <string>
10 //#include <PndLmdAlignManager.h>
11 //
12 //int main() {
13 //
14 // std::string pairFilePath = "/home/arbeit/RedPro3TB/simulationData/newGeometry";
15 // std::string binaryPairFilePath = pairFilePath + "/binaryPairs/";
16 // std::string LMDmatrixDir = pairFilePath + "/LMDmatrices/";
17 //
18 // PndLmdAlignManager manager;
19 // manager.setInCentimeters(true);
20 // manager.setBinaryPairFileDirectory(binaryPairFilePath);
21 // manager.setMaxPairs(300e3);
22 // manager.verboseLevel(3);
23 //
24 // cout << "reading binary pair files.\n";
25 // manager.setMatrixOutDir(LMDmatrixDir);
26 // manager.readPairsFromBinaryFiles();
27 // manager.alignAllSensors();
28 //
29 // return 0;
30 //}
31 
32 int runLumiPixel2fMatrixFinder(TString pairFilePath = "tmpOutput",
33  TString binaryPairFilePath = "", TString LMDmatrixDir = "", bool incentimeters = true,
34  const int verboseLevel = 2) {
35  // ----- Timer --------------------------------------------------------
36 
37  //do we really need those?
38  gSystem->Load("libLmd");
39  gSystem->Load("libLmdSensorAligner");
40 
41  // ---------------------- init parameters
42 
43  string pandaDir = getenv("VMCWORKDIR");
44 
45  // don't forget trailing slashes!!
46  if (LMDmatrixDir == "") {
47  LMDmatrixDir = pairFilePath + "/LMDmatrices/";
48  }
49  if (binaryPairFilePath == "") {
50  binaryPairFilePath = pairFilePath + "/binaryPairs/";
51  }
52 
53  int readNoOfFiles = 0; //how many files should be processed? 0 for all
54 
55  // ---------------------- init Matrix Finder
56 
57  cout << "searching available files...\n";
58 
59  PndLmdAlignManager manager;
60  manager.setInCentimeters(incentimeters);
61  manager.setBinaryPairFileDirectory(binaryPairFilePath.Data());
62  manager.setMaxPairs(300e3);
63  manager.verboseLevel(verboseLevel);
64 
65  // ---------------------- check for binary files and sort/write, if necessary
66  bool binaryPairsPresent = manager.checkForBinaryFiles();
67 
68  if (!binaryPairsPresent) {
69  manager.addFilesFromDirectory(pairFilePath.Data(), readNoOfFiles);
70  manager.setMatrixOutDir(LMDmatrixDir.Data());
71 
72  manager.readFilesAndAlign();
73  manager.waitForCompletion();
74  return 0;
75  }
76 
77  //check for LMD Matrix Files
78  bool LMDMatrixFilesPresent = manager.checkForLmdMatrixFiles();
79  if (!LMDMatrixFilesPresent) {
80  cout << "reading binary pair files.\n";
81  manager.setMatrixOutDir(LMDmatrixDir.Data());
82  manager.readPairsFromBinaryFiles();
83  manager.alignAllSensors();
84  }
85 
86  //manager.computeCombinedMatrices();
87 
88  // ---------------------- compute absolute correction matrices from overlap matrices and store to PndLmdDim format, compare to pndLmdDim
89 
90  //TODO: well, this ^
91 
92  // steps:
93  /*
94  * gather all modules
95  * gather all overlapping areas for each module
96  * compute all combined matrices for each module (this can be done multi-threadedly)
97  * store them in a good way (how?)
98  *
99  */
100 
101  // ----- Finish -------------------------------------------------------
102  return 0;
103 }
104 
void setInCentimeters(bool inCentimeters)
int verboseLevel
Definition: Lars/runMvdSim.C:7
void setBinaryPairFileDirectory(const std::string &binaryPairFileDirectory)
void setMatrixOutDir(std::string matrixOutDir)
void verboseLevel(int verbose)
int runLumiPixel2fMatrixFinder(TString pairFilePath="tmpOutput", TString binaryPairFilePath="", TString LMDmatrixDir="", bool incentimeters=true, const int verboseLevel=2)
int addFilesFromDirectory(std::string directory, int maxFiles=0)
void setMaxPairs(int maxPairs)