Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-organized directory for a facilitated workflow #162

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
468 changes: 468 additions & 0 deletions TrackerMillepedeAlignment/Fun4All_SiliconOnlyAlignment.C

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions TrackerMillepedeAlignment/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Alignment Workflow ##
### A directory containing scripts and macros for doing alignment ###

Workflow:
* Edit `scripts/alignment_setup.sh` for your environment
* Define `MYINSTALL` to the location of your custom-built sPHENIX libraries (if you need custom libraries--you do not necessarily need this)
* Define `ALIGN_DATA_DIR` to the top-level directory where you want data output (.root files, pede binaries, large .txt files)
* The setup script will NOT create top-level directories if they do not already exist
* (But it will create subdirectories for you)
* Run `scripts/alignment_setup.sh` for the first time
* Check that an `iteration_0` subdirectory appears under `ALIGN_DATA_DIR`
* Check that an `txt/iteration.txt` file appers (which only contains "0")
* Run `scripts/submit_fun4all_jobs.sh`
* Copies `localAlignmentParamsFile.txt` to `ALIGN_DATA_DIR/iteration_0` (only if this is the 0th iteration)
* Creates a file list with one line per segment for each run in the `RUN_NUMS` variable
* You can edit this variable (and will likely need to edit the `FILE_FORMAT` variable depending on the range)
* This creates a job file to submit a job for each segment--the job is `scripts/Fun4All_SiliconOnlyAlignment.sh`
* The output is under `ALIGN_DATA_DIR/iteration_0/dat`, the `out` files are in `out/`
* Run `scripts/run_pede.sh`
* This runs millepede over the expansion `ALIGN_DATA_DIR/iteration_0/dat/*.bin`
* It creates the steering file with ls and sets the scale errors to the end of this file
* It then runs several macros in sequences to get the next localAlignmentParamsFile.txt and create plots
* Run `scripts/increment.sh`
* This increments the contents `txt/iteration.txt` and copies the `newLocalAlignmentParamsFile.txt` to `localAlignmentParamsFile.txt` for the next iteration

12 changes: 9 additions & 3 deletions TrackerMillepedeAlignment/detailed_alignment_parameter_plots.C
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,21 @@ static const std::array<double,3> tpc_sector_mean[3] = {
legvec.push_back( "Input");
col.push_back(kRed);
*/
/*

finvec.push_back("tmp.root");
legvec.push_back( "ideal");
col.push_back(kBlue);
*/

/*
finvec.push_back("/sphenix/tg/tg01/hf/frawley/residuals1/kshort_proc_25.rootseedresiduals.root");
legvec.push_back( "ideal");
col.push_back(kBlue);

*/

for(int ifile = 0; ifile < finvec.size(); ++ifile)
{
TFile *fin = new TFile(finvec[ifile].c_str());
if (!fin) continue;

for(unsigned int layer = 0; layer <3; ++layer)
{
Expand Down Expand Up @@ -255,4 +256,9 @@ static const std::array<double,3> tpc_sector_mean[3] = {
}

}


cmvtx->SaveAs("cmvtx.png");
cintt->SaveAs("cintt.png");
ctpc->SaveAs("ctpc.png");
}
14 changes: 10 additions & 4 deletions TrackerMillepedeAlignment/makeAlignmentParsSumFile.C
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@ void makeAlignmentParsSumFile()

std::cout << " Add new parameters to existing ones" << std::endl;

ifstream foriginal("sumAlignmentParams_run20_iter1.txt");
if(!foriginal.is_open()) std::cout << "Unable to open original misalignment params file" << std::endl;
ifstream foriginal("localAlignmentParamsFile.txt");
if(!foriginal.is_open()) {
std::cout << "Unable to open original misalignment params file" << std::endl;
return;
}

ifstream fupdated("new_alignment_corrections.txt");
if(!fupdated.is_open()) std::cout << "Unable to open updated params file" << std::endl;
if(!fupdated.is_open()) {
std::cout << "Unable to open updated params file" << std::endl;
return;
}

ofstream fsum("sumAlignmentParams_run20_iter2.txt");
ofstream fsum("newLocalAlignmentParamsFile.txt");

TrkrDefs::hitsetkey key_original, key_updated;
float pars_original[6], pars_updated[6];
Expand Down
10 changes: 6 additions & 4 deletions TrackerMillepedeAlignment/plot_alignment_residuals.C
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ unsigned int getSensor(TrkrDefs::hitsetkey hitsetkey)

}

void plot_alignment_residuals(std::string inputfilename = "data.txt",
std::string outfilename = "tmp.root")
void plot_alignment_residuals(std::string outfilename = "tmp.root")
{
gStyle->SetStatW(0.3);
gStyle->SetStatH(0.3);
Expand All @@ -68,10 +67,13 @@ void plot_alignment_residuals(std::string inputfilename = "data.txt",
//ifstream fin("/sphenix/user/frawley/march17_2023/macros/detectors/sPHENIX/localAlignmentParamsFile.txt");
//ifstream fin("/sphenix/user/frawley/march17_2023/macros/detectors/sPHENIX/sumAlignmentParams_run18_iter2.txt");
// ifstream fin("/sphenix/user/frawley/march17_2023/macros/detectors/sPHENIX/sumAlignmentParams_run18_iter6_fixed_noconstraints.txt");
ifstream fin("/sphenix/user/frawley/march17_2023/macros/detectors/sPHENIX/localAlignmentParamsFile.txt");
ifstream fin("localAlignmentParamsFile.txt");


if(!fin.is_open()) std::cout << "Unable to open input alignment params file" << std::endl;
if(!fin.is_open()) {
std::cout << "Unable to open input alignment params file" << std::endl;
return;
}

TH2D *hpar[57][6];
for(int ilayer=0;ilayer<57;++ilayer)
Expand Down
Loading