5 unsigned int seed = 128;
 
   17         double sigmaX, sigmaY, sigmaZ;
 
   25         sigmaZ = 
PRNG->Gaus(mean, angleSigma);
 
   28         shift[0] = 
PRNG->Gaus(mean, shiftSigma);
 
   29         shift[1] = 
PRNG->Gaus(mean, shiftSigma);
 
   41         result.RotateZ(sigmaZ);
 
   42         result.SetTranslation(shift);
 
   51         string misMatricesFilePath = 
"misalignMatrices-SensorsOnly.root";
 
   53         cout << 
"creating dummy geometry...\n";
 
   56         TString geometryFile = 
"Luminosity-Detector.root";
 
   60         FairRunSim *
fRun = 
new FairRunSim();
 
   61         fRun->SetName(
"TGeant4");
 
   62         fRun->SetOutputFile(simOutput);
 
   63         fRun->SetMaterials(
"media_pnd.geo");
 
   65         Cave->SetGeometryFileName(
"pndcave.geo");
 
   66         fRun->AddModule(Cave);
 
   68         Pipe->SetGeometryFileName(
"beampipe_201309.root");
 
   69         fRun->AddModule(Pipe);
 
   71         Magnet->SetGeometryFileName(
"FullSolenoid_V842.root");
 
   72         fRun->AddModule(Magnet);
 
   74         Dipole->SetGeometryFileName(
"dipole.geo");
 
   75         fRun->AddModule(Dipole);
 
   78         Lum->SetGeometryFileName(geometryFile);
 
   85         cout << 
"PndLmd: creating misalignment matrices.\n";
 
   88         vector < string > paths = helper.
getAllAlignPaths(
true, 
false, 
false, 
false, 
false);
 
   90         cout << 
"got paths.\n";
 
   92         std::map < std::string, TGeoHMatrix > matrices;
 
   97                 misMatricesFilePath = 
"misalignMatrices-Sensor-0.root";
 
  100                 std::string examplePath = 
"/cave_1/lmd_root_0/half_0/plane_0/module_0/sensor_0/";
 
  102                 TGeoHMatrix misalignTestMat;
 
  103                 double translation[3] = { 0.5, 0.5, 0.0 };
 
  104                 misalignTestMat.SetTranslation(translation);
 
  105                 matrices[examplePath] = misalignTestMat;
 
  109                 for (
auto &
i : paths) {
 
  112                         double shift = 1000e-4;                         
 
  113                         double rot = TMath::RadToDeg() * 1000e-3;       
 
  116                         matrices[
i] = tempMat;
 
  122                 for (
auto &
i : matrices) {
 
  123                         cout << 
"\n---\n" << 
i.first << 
"\n";
 
  128         TFile *misalignmentMatrixRootfile = 
new TFile(misMatricesFilePath.c_str(), 
"NEW");
 
  129         if (misalignmentMatrixRootfile->IsOpen()) {
 
  130                 printf(
"File opened successfully\n");
 
  132                 gDirectory->WriteObject(&matrices, 
"PndLmdMisalignMatrices");
 
  133                 misalignmentMatrixRootfile->Write();
 
  134                 misalignmentMatrixRootfile->Close();
 
  136                 cout << 
"All matrices written to file!\n";
 
  138                 cerr << 
"WARNING! Could not write to " << misMatricesFilePath << 
"\n";
 
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
TGeoHMatrix createRandomMatrix(double angleSigma, double shiftSigma)
void SetExclusiveSensorType(const TString sens)
static PndLmdGeometryHelper & getInstance()
int createPndLmdMisalignmentMatrices(bool debug=false)
std::vector< std::string > getAllAlignPaths(bool sensors=true, bool modules=false, bool planes=false, bool halfs=false, bool detector=false)