#include "Riostream.h" #include ////////////////////////////////////////////////////// // // CREATE_OPTIONS_FILES.C: // // Root macro creating the option files necessary // for the number of alignment runs requested // // Usage: // root [0] .L Alignment_analysis.C // root [1] create_options_files(n_runs) // // S.V. 05/09/07 // ////////////////////////////////////////////////////// void create_options_files(int n_run) { for (int k=0; kReset(); char options_file_name[150]; sprintf(options_file_name,"VeloAlignment_%d.opts",run_numb); // // Initialization of variables // // Scales are in mm for translations, rad for rotations // Scale of misalignments for the modules double tx_m_scale = 0.03; double ty_m_scale = 0.03; double tz_m_scale = 0.1; double rx_m_scale = 0.002; double ry_m_scale = 0.002; double rz_m_scale = 0.002; // Scale of misalignments for the halves double tx_h_scale = 0.1; double ty_h_scale = 0.1; double tz_h_scale = 0.1; double rx_h_scale = 0.0005; double ry_h_scale = 0.0005; double rz_h_scale = 0.001; // // Then create the corresponding Alignment.xml file // cout << "" << endl; cout << "...Writing " << options_file_name << " file in the current directory..." << endl; cout << "" << endl; char numb[2]; fileout = new ofstream(options_file_name); (*fileout) << "//" << endl; (*fileout) << "// This is a randomly generated geometry for a misaligned VELO" << endl; (*fileout) << "//" << endl; (*fileout) << endl; (*fileout) << "UpdateManagerSvc.ConditionsOverride += {" << endl; // // 1. The modules // for (int k=0; k<42; k++) { (k < 10) ? sprintf(numb, "0%d",k) : sprintf(numb, "%d",k); (*fileout) << "\"Conditions/Alignment/Velo/Module" << numb << " :=" << endl; (*fileout) << " double_v dPosXYZ = " << misal->Gaus(0.,tx_m_scale) << " " << misal->Gaus(0.,ty_m_scale) << " " << misal->Gaus(0.,tz_m_scale) << " ;" << endl; (*fileout) << " double_v dRotXYZ = " << misal->Gaus(0.,rx_m_scale) << " " << misal->Gaus(0.,ry_m_scale) << " " << misal->Gaus(0.,rz_m_scale) << " ;\"," << endl; } // // 2. The boxes // (*fileout) << "\"Conditions/Alignment/Velo/VeloLeft :=" << endl; (*fileout) << " double_v dPosXYZ = " << misal->Gaus(0.,tx_h_scale) << " " << misal->Gaus(0.,ty_h_scale) << " " << misal->Gaus(0.,tz_h_scale) << " ;" << endl; (*fileout) << " double_v dRotXYZ = " << misal->Gaus(0.,rx_h_scale) << " " << misal->Gaus(0.,ry_h_scale) << " " << misal->Gaus(0.,rz_h_scale) << " ;\"," << endl; (*fileout) << "\"Conditions/Alignment/Velo/VeloRight :=" << endl; (*fileout) << " double_v dPosXYZ = " << misal->Gaus(0.,tx_h_scale) << " " << misal->Gaus(0.,ty_h_scale) << " " << misal->Gaus(0.,tz_h_scale) << " ;" << endl; (*fileout) << " double_v dRotXYZ = " << misal->Gaus(0.,rx_h_scale) << " " << misal->Gaus(0.,ry_h_scale) << " " << misal->Gaus(0.,rz_h_scale) << " ;\"" << endl; (*fileout) << "};" << endl; fileout->close(); }