Compare commits
7 Commits
devel_vign
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20bf766dc5 | ||
|
|
f5a4b750fc | ||
|
|
f18b51e334 | ||
|
|
9bf83f8028 | ||
|
|
d8b11bdcf3 | ||
|
|
7a8b64c805 | ||
|
|
862c4012eb |
29
.gitignore
vendored
29
.gitignore
vendored
|
|
@ -1,36 +1,13 @@
|
|||
EventBuilder*
|
||||
*.d
|
||||
*.so
|
||||
*.pcm
|
||||
*.root
|
||||
*.exe
|
||||
*.txt
|
||||
*.err
|
||||
*.seq
|
||||
*.png
|
||||
*.gif
|
||||
*.msh
|
||||
*.vtk
|
||||
|
||||
Mapper
|
||||
AnasenMS
|
||||
|
||||
data/
|
||||
data_proton/
|
||||
Sudarshan/
|
||||
wires2d/
|
||||
myenv/
|
||||
Analyzer_C_ACLiC_dict0713aaa966_dictContent.h
|
||||
.gitignore
|
||||
Analyzer_C_ACLiC_dict5411fecd5c_dictUmbrella.h
|
||||
gainmatch.C
|
||||
gainmatch.h
|
||||
MakePlotsQQQ.C
|
||||
MakePlotsQQQ.h
|
||||
MakePlotsSX3.C
|
||||
MakePlotsSX3.h
|
||||
Armory/CorrelateQQQ.h
|
||||
QQQStage2.C
|
||||
anasen_fem/scalars.dat.names
|
||||
anasen_fem/He96_CO2_4_260Torr.gas
|
||||
anasen_fem/heavy_ion_track.csv
|
||||
Armory/EventBuilder
|
||||
EventBuilder
|
||||
root_data/
|
||||
|
|
|
|||
15
.vscode/c_cpp_properties.json
vendored
15
.vscode/c_cpp_properties.json
vendored
|
|
@ -59,20 +59,7 @@
|
|||
"includePath": [
|
||||
"${workspaceFolder}/**",
|
||||
"/usr/include/x86_64-linux-gnu/qt6/**",
|
||||
"/usr/local/cern/root/include/**"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "gnu++17",
|
||||
"intelliSenseMode": "linux-gcc-x64"
|
||||
},
|
||||
{
|
||||
"name": "VigneshROG",
|
||||
"includePath": [
|
||||
"/home/vsitaraman/**",
|
||||
"${workspaceFolder}/**",
|
||||
"/home/vsitaraman/root/include/**"
|
||||
"/usr/local/cern/root/include/**",
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
|
|
|
|||
29
.vscode/settings.json
vendored
29
.vscode/settings.json
vendored
|
|
@ -100,32 +100,7 @@
|
|||
"PCPulser_All_new.C": "cpp",
|
||||
"PosCal_2.C": "cpp",
|
||||
"AutoFit.C": "cpp",
|
||||
"Fitting.C": "cpp",
|
||||
"PCGainMatch.C": "cpp",
|
||||
"Analyzer1.C": "cpp",
|
||||
"FitHistogramsWithTSpectrum_Sequential_Improved.C": "cpp",
|
||||
"PlotAndFitCentroids.C": "cpp",
|
||||
"MatchAndPlotCentroids.C": "cpp",
|
||||
"GainMatch.C": "cpp",
|
||||
"GainMatchSX3.C": "cpp",
|
||||
"RelBack_Fix_new.C": "cpp",
|
||||
"SiRelativeGains_Step1_new.C": "cpp",
|
||||
"charconv": "cpp",
|
||||
"format": "cpp",
|
||||
"GainMatchSX3Front.C": "cpp",
|
||||
"GainMatchSX3Front1.C": "cpp",
|
||||
"Calibration.C": "cpp",
|
||||
"GainMatchQQQ.C": "cpp",
|
||||
"UTF-8gainmatch.C": "cpp",
|
||||
"MakePlotsQQQ.C": "cpp",
|
||||
"MakePlotsSX3.C": "cpp",
|
||||
"QQQ_Calibcheck.C": "cpp",
|
||||
"QQQ_Calcheck.C": "cpp",
|
||||
"makeplots.C": "cpp",
|
||||
"GlobalMinimizeQQQ.C": "cpp",
|
||||
"QQQStage2.C": "cpp",
|
||||
"inspect.C": "cpp"
|
||||
"Fitting.C": "cpp"
|
||||
},
|
||||
"github-enterprise.uri": "https://fsunuc.physics.fsu.edu",
|
||||
"C_Cpp.default.compilerPath": "/usr/bin/gcc"
|
||||
"github-enterprise.uri": "https://fsunuc.physics.fsu.edu"
|
||||
}
|
||||
|
|
@ -16,5 +16,5 @@ void Analysis(int start, int end) {
|
|||
|
||||
// Define a macro with the same name as the script
|
||||
void Analysis() {
|
||||
Analysis(72, 194); // Adjust the range if needed
|
||||
Analysis(150, 194); // Adjust the range if needed
|
||||
}
|
||||
820
Analyzer.C
820
Analyzer.C
|
|
@ -1,31 +1,26 @@
|
|||
#define Analyzer_cxx
|
||||
|
||||
#include "Analyzer.h"
|
||||
#include "Armory/ClassSX3.h"
|
||||
#include "Armory/ClassPW.h"
|
||||
|
||||
#include <TH2.h>
|
||||
#include <TStyle.h>
|
||||
#include <TCanvas.h>
|
||||
#include <TMath.h>
|
||||
#include "TVector3.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <map>
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
|
||||
#include "Armory/ClassSX3.h"
|
||||
#include "Armory/ClassPW.h"
|
||||
|
||||
#include "TVector3.h"
|
||||
|
||||
TH2F *hsx3IndexVE;
|
||||
TH2F *hqqqIndexVE;
|
||||
TH2F *hpcIndexVE;
|
||||
|
||||
TH2F *hpcIndexVE_GM;
|
||||
TH2F *hsx3Coin;
|
||||
TH2F *hqqqCoin;
|
||||
TH2F *hpcCoin;
|
||||
TH2F *hAVCcoin;
|
||||
|
||||
TH2F *hqqqPolar;
|
||||
TH2F *hsx3VpcIndex;
|
||||
|
|
@ -33,203 +28,53 @@ TH2F *hqqqVpcIndex;
|
|||
TH2F *hqqqVpcE;
|
||||
TH2F *hsx3VpcE;
|
||||
TH2F *hanVScatsum;
|
||||
TH2F *hanVScatsum_a[24];
|
||||
TH1F *hPC_E[48];
|
||||
TH1F *hCat4An;
|
||||
TH1F *hCat0An;
|
||||
TH1F *hAnodehits;
|
||||
TH2F *hNosvAe;
|
||||
|
||||
int padID = 0;
|
||||
|
||||
SX3 sx3_contr;
|
||||
PW pw_contr;
|
||||
PW pwinstance;
|
||||
TVector3 hitPos;
|
||||
// TVector3 anodeIntersection;
|
||||
std::map<int, std::pair<double, double>> slopeInterceptMap;
|
||||
// SX3 Calibration Arrays
|
||||
const int MAX_DET = 24;
|
||||
const int MAX_UP = 4;
|
||||
const int MAX_DOWN = 4;
|
||||
const int MAX_BK = 4;
|
||||
double backGain[MAX_DET][MAX_BK] = {{0}};
|
||||
bool backGainValid[MAX_DET][MAX_BK] = {{false}};
|
||||
double frontGain[MAX_DET][MAX_BK][MAX_UP][MAX_DOWN] = {{{{0}}}};
|
||||
bool frontGainValid[MAX_DET][MAX_BK][MAX_UP][MAX_DOWN] = {{{{false}}}};
|
||||
|
||||
// QQQ Calibration Arrays
|
||||
const int MAX_QQQ = 4;
|
||||
const int MAX_RING = 16;
|
||||
const int MAX_WEDGE = 16;
|
||||
double qqqGain[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{0}}};
|
||||
bool qqqGainValid[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{false}}};
|
||||
double qqqCalib[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{0}}};
|
||||
bool qqqCalibValid[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{false}}};
|
||||
|
||||
bool HitNonZero;
|
||||
bool sx3ecut;
|
||||
bool qqqEcut;
|
||||
|
||||
TH1F *hZProj;
|
||||
TH1F *hPCZProj;
|
||||
|
||||
void Analyzer::Begin(TTree * /*tree*/)
|
||||
{
|
||||
TString option = GetOption();
|
||||
|
||||
hsx3IndexVE = new TH2F("hsx3IndexVE", "SX3 index vs Energy; sx3 index ; Energy", 24 * 12, 0, 24 * 12, 400, 0, 5000);
|
||||
hsx3IndexVE->SetNdivisions(-612, "x");
|
||||
hqqqIndexVE = new TH2F("hqqqIndexVE", "QQQ index vs Energy; QQQ index ; Energy", 4 * 2 * 16, 0, 4 * 2 * 16, 400, 0, 5000);
|
||||
hpcIndexVE = new TH2F("hpcIndexVE", "PC index vs Energy; PC index ; Energy", 2 * 24, 0, 2 * 24, 400, 0, 16000);
|
||||
hpcIndexVE_GM = new TH2F("hpcIndexVE_GM", "PC index vs Energy; PC index ; Energy", 2 * 24, 0, 2 * 24, 400, 0, 16000);
|
||||
hqqqIndexVE->SetNdivisions(-1204, "x");
|
||||
hpcIndexVE = new TH2F("hpcIndexVE", "PC index vs Energy; PC index ; Energy", 2 * 24, 0, 2 * 24, 400, 0, 4000);
|
||||
hpcIndexVE->SetNdivisions(-1204, "x");
|
||||
|
||||
hsx3Coin = new TH2F("hsx3Coin", "SX3 Coincident", 24 * 12, 0, 24 * 12, 24 * 12, 0, 24 * 12);
|
||||
hqqqCoin = new TH2F("hqqqCoin", "QQQ Coincident", 4 * 2 * 16, 0, 4 * 2 * 16, 4 * 2 * 16, 0, 4 * 2 * 16);
|
||||
hpcCoin = new TH2F("hpcCoin", "PC Coincident", 2 * 24, 0, 2 * 24, 2 * 24, 0, 2 * 24);
|
||||
hAVCcoin = new TH2F("hAVCcoin", "Anode vs Cathode Coincident", 24, 0, 24, 24, 0, 24);
|
||||
|
||||
hqqqPolar = new TH2F("hqqqPolar", "QQQ Polar ID", 16 * 4, -TMath::Pi(), TMath::Pi(), 16, 10, 50);
|
||||
|
||||
hsx3VpcIndex = new TH2F("hsx3Vpcindex", "sx3 vs pc; sx3 index; pc index", 24 * 12, 0, 24 * 12, 48, 0, 48);
|
||||
hsx3VpcIndex->SetNdivisions(-612, "x");
|
||||
hsx3VpcIndex->SetNdivisions(-12, "y");
|
||||
hqqqVpcIndex = new TH2F("hqqqVpcindex", "qqq vs pc; qqq index; pc index", 4 * 2 * 16, 0, 4 * 2 * 16, 48, 0, 48);
|
||||
hqqqVpcIndex->SetNdivisions(-612, "x");
|
||||
hqqqVpcIndex->SetNdivisions(-12, "y");
|
||||
|
||||
hqqqVpcE = new TH2F("hqqqVpcEnergy", "qqq vs pc; qqq energy; pc energy", 400, 0, 5000, 800, 0, 16000);
|
||||
hqqqVpcE->SetNdivisions(-612, "x");
|
||||
hqqqVpcE->SetNdivisions(-12, "y");
|
||||
|
||||
hsx3VpcE = new TH2F("hsx3VpcEnergy", "sx3 vs pc; sx3 energy; pc energy", 400, 0, 5000, 800, 0, 16000);
|
||||
hsx3VpcE->SetNdivisions(-612, "x");
|
||||
hsx3VpcE->SetNdivisions(-12, "y");
|
||||
|
||||
hZProj = new TH1F("hZProj", "Z Projection", 1200, -600, 600);
|
||||
hPCZProj = new TH1F("hPCZProj", "PC Z Projection", 600, -300, 300);
|
||||
hZProj = new TH1F("hZProj", "Z Projection", 200, -600, 600);
|
||||
|
||||
hanVScatsum = new TH2F("hanVScatsum", "Anode vs Cathode Sum; Anode E; Cathode E", 400, 0, 16000, 400, 0, 20000);
|
||||
hCat4An = new TH1F("hCat4An", "Number of Cathodes/Anode", 24, 0, 24);
|
||||
hCat0An = new TH1F("hCat0An", "Number of Cathodes without Anode", 24, 0, 24);
|
||||
hAnodehits = new TH1F("hAnodehits", "Number of Anode hits", 24, 0, 24);
|
||||
hNosvAe = new TH2F("hnosvAe", "Number of Cathodes/Anode vs Anode Energy", 20, 0, 20, 400, 0, 16000);
|
||||
// for (int i = 0; i < 24; i++)
|
||||
// {
|
||||
// TString histName = Form("hAnodeVsCathode_%d", i);
|
||||
// TString histTitle = Form("Anode %d vs Cathode Sum; Anode E; Cathode Sum E", i);
|
||||
// hanVScatsum_a[i] = new TH2F(histName, histTitle, 400, 0, 16000, 400, 0, 20000);
|
||||
// }
|
||||
// for (int i = 0; i < 48; i++)
|
||||
// {
|
||||
// TString histName = Form("hCathode_%d", i);
|
||||
// TString histTitle = Form("Cathode_E_%d;", i);
|
||||
// hPC_E[i] = new TH1F(histName, histTitle, 3200, 0, 32000);
|
||||
// }
|
||||
hanVScatsum = new TH2F("hanVScatsum", "Anode vs Cathode Sum; Anode E; Cathode E", 400, 0, 10000, 400, 0, 16000);
|
||||
sx3_contr.ConstructGeo();
|
||||
pw_contr.ConstructGeo();
|
||||
|
||||
std::ifstream inputFile("slope_intercept_results.txt");
|
||||
|
||||
if (inputFile.is_open())
|
||||
{
|
||||
std::string line;
|
||||
int index;
|
||||
double slope, intercept;
|
||||
while (std::getline(inputFile, line))
|
||||
{
|
||||
std::stringstream ss(line);
|
||||
ss >> index >> slope >> intercept;
|
||||
// wires 37, 39, 44 have fit data that is incorrect or not present, they have thus been set to 1,0 (slope, intercept) for convenience
|
||||
// wire 19 the 4th point was genereated using the slope of the line produced uising the other 3 points from the wire 1 vs wire 19 plot
|
||||
if (index >= 0 && index <= 47)
|
||||
{
|
||||
slopeInterceptMap[index] = std::make_pair(slope, intercept);
|
||||
}
|
||||
}
|
||||
inputFile.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Error opening slope_intercept.txt" << std::endl;
|
||||
}
|
||||
|
||||
std::string filename = "sx3_GainMatchback.txt";
|
||||
|
||||
std::ifstream infile(filename);
|
||||
if (!infile.is_open())
|
||||
{
|
||||
std::cerr << "Error opening " << filename << "!" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
int id, bk;
|
||||
double gain;
|
||||
while (infile >> id >> bk >> gain)
|
||||
{
|
||||
backGain[id][bk] = gain;
|
||||
if (backGain[id][bk] > 0)
|
||||
backGainValid[id][bk] = true;
|
||||
else
|
||||
backGainValid[id][bk] = false;
|
||||
}
|
||||
|
||||
infile.close();
|
||||
std::cout << "Loaded back gains from " << filename << std::endl;
|
||||
|
||||
std::string filename1 = "sx3_GainMatchfront.txt";
|
||||
|
||||
std::ifstream infile1(filename1);
|
||||
if (!infile1.is_open())
|
||||
{
|
||||
std::cerr << "Error opening " << filename1 << "!" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
int idf, bkf, uf, df;
|
||||
double fgain;
|
||||
while (infile1 >> idf >> bkf >> uf >> df >> fgain)
|
||||
{
|
||||
frontGain[idf][bkf][uf][df] = fgain;
|
||||
frontGainValid[idf][bkf][uf][df] = true;
|
||||
}
|
||||
|
||||
// QQQ Gain Matching and Calibration
|
||||
// ----------------------- Load QQQ Gains
|
||||
{
|
||||
std::string filename = "qqq_GainMatch.txt";
|
||||
std::ifstream infile(filename);
|
||||
if (!infile.is_open())
|
||||
{
|
||||
std::cerr << "Error opening " << filename << "!" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
int det, ring, wedge;
|
||||
double gainw, gainr;
|
||||
while (infile >> det >> ring >> wedge >> gainw >> gainr)
|
||||
{
|
||||
qqqGain[det][ring][wedge] = gainw;
|
||||
// qqqrGain[det][ring][wedge] = gainr;
|
||||
qqqGainValid[det][ring][wedge] = (gainw > 0);
|
||||
// qqqrGainValid[det][ring][wedge] = (gainr > 0);
|
||||
}
|
||||
infile.close();
|
||||
std::cout << "Loaded QQQ gains from " << filename << std::endl;
|
||||
}
|
||||
}
|
||||
// ----------------------- Load QQQ Calibrations
|
||||
{
|
||||
std::string filename = "qqq_Calib.txt";
|
||||
std::ifstream infile(filename);
|
||||
if (!infile.is_open())
|
||||
{
|
||||
std::cerr << "Error opening " << filename << "!" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
int det, ring, wedge;
|
||||
double slope;
|
||||
while (infile >> det >> ring >> wedge >> slope)
|
||||
{
|
||||
qqqCalib[det][ring][wedge] = slope;
|
||||
qqqCalibValid[det][ring][wedge] = (slope > 0);
|
||||
}
|
||||
infile.close();
|
||||
std::cout << "Loaded QQQ calibrations from " << filename << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Bool_t Analyzer::Process(Long64_t entry)
|
||||
|
|
@ -267,17 +112,13 @@ Bool_t Analyzer::Process(Long64_t entry)
|
|||
|
||||
// ########################################################### Raw data
|
||||
// //======================= SX3
|
||||
sx3ecut = false;
|
||||
|
||||
std::vector<std::pair<int, int>> ID; // first = id, 2nd = index
|
||||
for (int i = 0; i < sx3.multi; i++)
|
||||
{
|
||||
ID.push_back(std::pair<int, int>(sx3.id[i], i));
|
||||
hsx3IndexVE->Fill(sx3.index[i], sx3.e[i]);
|
||||
|
||||
if (sx3.e[i] > 100)
|
||||
{
|
||||
sx3ecut = true;
|
||||
}
|
||||
hsx3IndexVE->Fill(sx3.index[i], sx3.e[i]);
|
||||
|
||||
for (int j = i + 1; j < sx3.multi; j++)
|
||||
{
|
||||
|
|
@ -286,13 +127,10 @@ Bool_t Analyzer::Process(Long64_t entry)
|
|||
|
||||
for (int j = 0; j < pc.multi; j++)
|
||||
{
|
||||
if (pc.index[j] < 24 && pc.e[j] > 100)
|
||||
{
|
||||
hsx3VpcIndex->Fill(sx3.index[i], pc.index[j]);
|
||||
// if( sx3.ch[index] > 8 ){
|
||||
// hsx3VpcE->Fill( sx3.e[i], pc.e[j] );
|
||||
// }
|
||||
}
|
||||
hsx3VpcIndex->Fill(sx3.index[i], pc.index[j]);
|
||||
// if( sx3.ch[index] > 8 ){
|
||||
// hsx3VpcE->Fill( sx3.e[i], pc.e[j] );
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -366,27 +204,20 @@ Bool_t Analyzer::Process(Long64_t entry)
|
|||
}
|
||||
}
|
||||
|
||||
// sx3_contr.CalSX3Pos(sx3ID[0].first, sx3ChUp, sx3ChDn, sx3ChBk, sx3EUp, sx3EDn);
|
||||
// hitPos = sx3_contr.GetHitPos();
|
||||
// HitNonZero = true;
|
||||
sx3_contr.CalSX3Pos(sx3ID[0].first, sx3ChUp, sx3ChDn, sx3ChBk, sx3EUp, sx3EDn);
|
||||
hitPos = sx3_contr.GetHitPos();
|
||||
HitNonZero = true;
|
||||
// hitPos.Print();
|
||||
}
|
||||
}
|
||||
|
||||
// //======================= QQQ
|
||||
|
||||
qqqEcut = false;
|
||||
for (int i = 0; i < qqq.multi; i++)
|
||||
{
|
||||
// for( int j = 0; j < pc.multi; j++){
|
||||
// if(pc.index[j]==4){
|
||||
hqqqIndexVE->Fill(qqq.index[i], qqq.e[i]);
|
||||
// }
|
||||
// printf("QQQ ID : %d, ch : %d, e : %d \n", qqq.id[i], qqq.ch[i], qqq.e[i]);
|
||||
if (qqq.e[i] > 100)
|
||||
{
|
||||
qqqEcut = true;
|
||||
}
|
||||
// }
|
||||
for (int j = 0; j < qqq.multi; j++)
|
||||
{
|
||||
|
|
@ -395,483 +226,268 @@ Bool_t Analyzer::Process(Long64_t entry)
|
|||
hqqqCoin->Fill(qqq.index[i], qqq.index[j]);
|
||||
}
|
||||
|
||||
for (int k = 0; k < pc.multi; k++)
|
||||
{
|
||||
if (pc.index[k] < 24 && pc.e[k] > 50)
|
||||
{
|
||||
hqqqVpcE->Fill(qqq.e[i], pc.e[k]);
|
||||
// hpcIndexVE->Fill( pc.index[i], pc.e[i] );
|
||||
hqqqVpcIndex->Fill(qqq.index[i], pc.index[k]);
|
||||
}
|
||||
}
|
||||
|
||||
// }
|
||||
|
||||
for (int j = i + 1; j < qqq.multi; j++)
|
||||
{
|
||||
for (int k = 0; k < pc.multi; k++)
|
||||
{
|
||||
if (pc.index[k] < 24 && pc.e[k] > 50)
|
||||
{
|
||||
hqqqVpcE->Fill(qqq.e[i], pc.e[k]);
|
||||
// hpcIndexVE->Fill( pc.index[i], pc.e[i] );
|
||||
hqqqVpcIndex->Fill(qqq.index[i], pc.index[j]);
|
||||
}
|
||||
// }
|
||||
}
|
||||
// if( qqq.used[i] == true ) continue;
|
||||
|
||||
// if( qqq.id[i] == qqq.id[j] && (16 - qqq.ch[i]) * (16 - qqq.ch[j]) < 0 ){ // must be same detector and wedge and ring
|
||||
if (qqq.id[i] == qqq.id[j])
|
||||
{ // must be same detector
|
||||
|
||||
if (qqq.e[i] > 100)
|
||||
qqqEcut = true;
|
||||
if (qqq.id[i] == qqq.id[j])
|
||||
int chWedge = -1;
|
||||
int chRing = -1;
|
||||
if (qqq.ch[i] < qqq.ch[j])
|
||||
{
|
||||
int chWedge = -1;
|
||||
int chRing = -1;
|
||||
float eWedgeRaw = 0.0;
|
||||
float eWedge = 0.0;
|
||||
float eWedgeMeV = 0.0;
|
||||
float eRingRaw = 0.0;
|
||||
float eRing = 0.0;
|
||||
float eRingMeV = 0.0;
|
||||
// plug in gains
|
||||
if (qqq.ch[i] < 16 && qqq.ch[j] >= 16 && /*qqqrGainValid[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16] &&*/ qqqGainValid[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16])
|
||||
{
|
||||
chWedge = qqq.ch[i];
|
||||
eWedgeRaw = qqq.e[i];
|
||||
eWedge = qqq.e[i] * qqqGain[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16];
|
||||
// printf("Wedge E: %.2f Gain: %.4f \n", eWedge, qqqGain[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16]);
|
||||
chRing = qqq.ch[j] - 16;
|
||||
eRingRaw = qqq.e[j];
|
||||
eRing = qqq.e[j]; //* qqqrGain[qqq.id[j]][qqq.ch[j]][qqq.ch[i]-16];
|
||||
}
|
||||
else if (qqq.ch[j] < 16 && qqq.ch[i] >= 16 /* && qqqrGainValid[qqq.id[j]][qqq.ch[j]][qqq.ch[i] - 16] */ && qqqGainValid[qqq.id[j]][qqq.ch[j]][qqq.ch[i] - 16])
|
||||
{
|
||||
chWedge = qqq.ch[j];
|
||||
eWedge = qqq.e[j] * qqqGain[qqq.id[j]][qqq.ch[j]][qqq.ch[i] - 16];
|
||||
eWedgeRaw = qqq.e[j];
|
||||
chRing = qqq.ch[i] - 16;
|
||||
eRing = qqq.e[i]; // * qqqrGain[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16];
|
||||
eRingRaw = qqq.e[i];
|
||||
}
|
||||
else
|
||||
continue;
|
||||
// plug in calibrations
|
||||
if (qqqCalibValid[qqq.id[i]][chRing][chWedge])
|
||||
{
|
||||
eWedgeMeV = eWedge * qqqCalib[qqq.id[i]][chRing][chWedge] / 1000;
|
||||
eRingMeV = eRing * qqqCalib[qqq.id[i]][chRing][chWedge] / 1000;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
chRing = qqq.ch[j] - 16;
|
||||
chWedge = qqq.ch[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
chRing = qqq.ch[i];
|
||||
chWedge = qqq.ch[j] - 16;
|
||||
}
|
||||
|
||||
// printf(" ID : %d , chWedge : %d, chRing : %d \n", qqq.id[i], chWedge, chRing);
|
||||
// printf(" ID : %d , chWedge : %d, chRing : %d \n", qqq.id[i], chWedge, chRing);
|
||||
|
||||
double theta = -TMath::Pi() / 2 + 2 * TMath::Pi() / 16 / 4. * (qqq.id[i] * 16 + chWedge + 0.5);
|
||||
double rho = 50. + 40. / 16. * (chRing + 0.5);
|
||||
// if(qqq.e[i]>50){
|
||||
hqqqPolar->Fill(theta, rho);
|
||||
// }
|
||||
// qqq.used[i] = true;
|
||||
// qqq.used[j] = true;
|
||||
double theta = -TMath::Pi() / 2 + 2 * TMath::Pi() / 16 / 4. * (qqq.id[i] * 16 + chWedge + 0.5);
|
||||
double rho = 10. + 40. / 16. * (chRing + 0.5);
|
||||
// if(qqq.e[i]>50){
|
||||
hqqqPolar->Fill(theta, rho);
|
||||
// }
|
||||
// qqq.used[i] = true;
|
||||
// qqq.used[j] = true;
|
||||
|
||||
if (!HitNonZero)
|
||||
if (!HitNonZero)
|
||||
{
|
||||
double x = rho * TMath::Cos(theta);
|
||||
double y = rho * TMath::Sin(theta);
|
||||
hitPos.SetXYZ(x, y, 23 + 75 + 30);
|
||||
HitNonZero = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// //======================= PC
|
||||
|
||||
ID.clear();
|
||||
int counter = 0;
|
||||
std::vector<std::pair<int, double>> E;
|
||||
E.clear();
|
||||
for (int i = 0; i < pc.multi; i++)
|
||||
{
|
||||
|
||||
if (pc.e[i] > 100)
|
||||
ID.push_back(std::pair<int, int>(pc.id[i], i));
|
||||
if (pc.e[i] > 100)
|
||||
E.push_back(std::pair<int, double>(pc.index[i], pc.e[i]));
|
||||
|
||||
hpcIndexVE->Fill(pc.index[i], pc.e[i]);
|
||||
|
||||
for (int j = i + 1; j < pc.multi; j++)
|
||||
{
|
||||
hpcCoin->Fill(pc.index[i], pc.index[j]);
|
||||
}
|
||||
}
|
||||
// for( size_t i = 0; i < E.size(); i++) printf("%zu | %d %d \n", i, E[i].first, E[i].second );
|
||||
|
||||
pwinstance.ConstructGeo();
|
||||
Coord Crossover[24][24];
|
||||
TVector3 a, c, diff;
|
||||
double a2, ac, c2, adiff, cdiff, denom, alpha, beta;
|
||||
int index = 0;
|
||||
for (int i = 0; i < pwinstance.An.size(); i++)
|
||||
{
|
||||
a = pwinstance.An[i].first - pwinstance.An[i].second;
|
||||
for (int j = 0; j < pwinstance.Ca.size(); j++)
|
||||
{
|
||||
c = pwinstance.Ca[j].first - pwinstance.Ca[j].second;
|
||||
diff = pwinstance.An[i].first - pwinstance.Ca[j].first;
|
||||
a2 = a.Dot(a);
|
||||
ac = a.Dot(c);
|
||||
c2 = c.Dot(c);
|
||||
adiff = a.Dot(diff);
|
||||
cdiff = c.Dot(diff);
|
||||
denom = a2 * c2 - ac * ac;
|
||||
alpha = (ac * cdiff - c2 * adiff) / denom;
|
||||
beta = (a2 * cdiff - ac * adiff) / denom;
|
||||
Crossover[i][j].x = pwinstance.An[i].first.X() + alpha * a.X();
|
||||
Crossover[i][j].y = pwinstance.An[i].first.Y() + alpha * a.Y();
|
||||
Crossover[i][j].z = pwinstance.An[i].first.Z() + alpha * a.Z();
|
||||
if (i == 23)
|
||||
{
|
||||
if (abs(i - j) < 7 || abs(i - j) > 17)
|
||||
{
|
||||
if (alpha < 0 && alpha > -1)
|
||||
{
|
||||
double x = rho * TMath::Cos(theta);
|
||||
double y = rho * TMath::Sin(theta);
|
||||
hitPos.SetXYZ(x, y, 23 + 75 + 30);
|
||||
HitNonZero = true;
|
||||
printf("Anode and cathode indices and coord : %d %d %f %f %f %f\n", i, j, pwinstance.Ca[j].first.X(), pwinstance.Ca[j].first.Y(), pwinstance.Ca[j].first.Z(), alpha);
|
||||
printf("Crossover wires, points and alpha are : %f %f %f %f \n", Crossover[i][j].x, Crossover[i][j].y, Crossover[i][j].z, alpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// //======================= PC
|
||||
|
||||
// Calculate the crossover points and put them into an array
|
||||
if (E.size() >= 3)
|
||||
{
|
||||
|
||||
pwinstance.ConstructGeo();
|
||||
Coord Crossover[24][24][2];
|
||||
TVector3 a, c, diff;
|
||||
double a2, ac, c2, adiff, cdiff, denom, alpha, beta;
|
||||
int index = 0;
|
||||
for (int i = 0; i < pwinstance.An.size(); i++)
|
||||
{
|
||||
a = pwinstance.An[i].first - pwinstance.An[i].second;
|
||||
|
||||
for (int j = 0; j < pwinstance.Ca.size(); j++)
|
||||
{
|
||||
// Ok so this method uses what is essentially the solution of 2 equations to find the point of intersection between the anode and cathode wires
|
||||
// here a and c are the vectors of the anode and cathode wires respectively
|
||||
// diff is the perpendicular vector between the anode and cathode wires
|
||||
// The idea behind this is to then find the scalars alpha and beta that give a ratio between 0 and -1,
|
||||
|
||||
c = pwinstance.Ca[j].first - pwinstance.Ca[j].second;
|
||||
diff = pwinstance.An[i].first - pwinstance.Ca[j].first;
|
||||
a2 = a.Dot(a);
|
||||
c2 = c.Dot(c);
|
||||
ac = a.Dot(c);
|
||||
adiff = a.Dot(diff);
|
||||
cdiff = c.Dot(diff);
|
||||
denom = a2 * c2 - ac * ac;
|
||||
alpha = (ac * cdiff - c2 * adiff) / denom;
|
||||
beta = (a2 * cdiff - ac * adiff) / denom;
|
||||
|
||||
Crossover[i][j][0].x = pwinstance.An[i].first.X() + alpha * a.X();
|
||||
Crossover[i][j][0].y = pwinstance.An[i].first.Y() + alpha * a.Y();
|
||||
Crossover[i][j][0].z = pwinstance.An[i].first.Z() + alpha * a.Z();
|
||||
if (Crossover[i][j][0].z < -190 || Crossover[i][j][0].z > 190)
|
||||
{
|
||||
Crossover[i][j][0].z = 9999999;
|
||||
}
|
||||
// placeholder variable Crossover[i][j][1].x has nothing to do with the geometry of the crossover and is being used to store the alpha value-
|
||||
//-so that it can be used to sort "good" hits later
|
||||
Crossover[i][j][1].x = alpha;
|
||||
Crossover[i][j][1].y = 0;
|
||||
// if(i==0){
|
||||
// printf("CID, Crossover z and alpha are : %d %f %f \n", j, Crossover[i][j][0].z, Crossover[i][j][1].x /*this is alpha*/);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
// printf("Anode and cathode indices, alpha, denom, andiff, cndiff : %d %d %f %f %f %f\n", i, j, alpha, denom, adiff, cdiff);
|
||||
|
||||
// anodeIntersection.Clear();
|
||||
for (int i = 0; i < pc.multi; i++)
|
||||
{
|
||||
|
||||
if (pc.e[i] > 100)
|
||||
{
|
||||
hpcIndexVE->Fill(pc.index[i], pc.e[i]); // non gain matched energy
|
||||
}
|
||||
|
||||
// Gain Matching of PC wires
|
||||
if (pc.index[i] >= 0 && pc.index[i] < 48)
|
||||
{
|
||||
// printf("index: %d, Old cathode energy: %d \n", pc.index[i],pc.e[i]);
|
||||
auto it = slopeInterceptMap.find(pc.index[i]);
|
||||
if (it != slopeInterceptMap.end())
|
||||
{
|
||||
double slope = it->second.first;
|
||||
double intercept = it->second.second;
|
||||
// printf("slope: %f, intercept:%f\n" ,slope, intercept);
|
||||
pc.e[i] = slope * pc.e[i] + intercept;
|
||||
// printf("index: %d, New cathode energy: %d \n",pc.index[i], pc.e[i]);
|
||||
}
|
||||
hpcIndexVE_GM->Fill(pc.index[i], pc.e[i]);
|
||||
// hPC_E[pc.index[i]]->Fill(pc.e[i]); // gain matched energy per channel
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::pair<int, double>> anodeHits = {};
|
||||
std::vector<std::pair<int, double>> cathodeHits = {};
|
||||
std::vector<std::pair<int, double>> corrcatMax = {};
|
||||
std::vector<std::pair<int, double>> corrcatnextMax = {};
|
||||
std::vector<std::pair<int, double>> commcat = {};
|
||||
int aID = 0;
|
||||
int cID = 0;
|
||||
|
||||
float aE = 0;
|
||||
float cE = 0;
|
||||
float aESum = 0;
|
||||
float cESum = 0;
|
||||
float aEMax = 0;
|
||||
float cEMax = 0;
|
||||
float aEnextMax = 0;
|
||||
float cEnextMax = 0;
|
||||
int aIDMax = 0;
|
||||
int cIDMax = 0;
|
||||
int aIDnextMax = 0;
|
||||
int cIDnextMax = 0;
|
||||
// if( ID[0].first < 1 ) {
|
||||
// aID = pc.ch[ID[0].second];
|
||||
// cID = pc.ch[ID[1].second];
|
||||
// }else{
|
||||
// cID = pc.ch[ID[0].second];
|
||||
// aID = pc.ch[ID[1].second];
|
||||
// }
|
||||
// printf("anode= %d, cathode = %d\n", aID, cID);
|
||||
|
||||
// Define the excluded SX3 and QQQ channels
|
||||
// std::unordered_set<int> excludeSX3 = {34, 35, 36, 37, 61, 62, 67, 73, 74, 75, 76, 77, 78, 79, 80, 93, 97, 100, 103, 108, 109, 110, 111, 112};
|
||||
// std::unordered_set<int> excludeQQQ = {0, 17, 109, 110, 111, 112, 113, 119, 127, 128};
|
||||
// inCuth=false;
|
||||
// inCutl=false;
|
||||
// inPCCut=false;
|
||||
for (int i = 0; i < pc.multi; i++)
|
||||
for (int k = 0; k < qqq.multi; k++)
|
||||
{
|
||||
if (pc.e[i] > 100 /*&& pc.multi < 7*/)
|
||||
{
|
||||
// creating a vector of pairs of anode and cathode hits
|
||||
if (pc.index[i] < 24)
|
||||
{
|
||||
anodeHits.push_back(std::pair<int, double>(pc.index[i], pc.e[i]));
|
||||
}
|
||||
else if (pc.index[i] >= 24)
|
||||
{
|
||||
cathodeHits.push_back(std::pair<int, double>(pc.index[i] - 24, pc.e[i]));
|
||||
}
|
||||
|
||||
for (int j = i + 1; j < pc.multi; j++)
|
||||
{
|
||||
// if(PCCoinc_cut1->IsInside(pc.index[i], pc.index[j]) || PCCoinc_cut2->IsInside(pc.index[i], pc.index[j])){
|
||||
// // hpcCoin->Fill(pc.index[i], pc.index[j]);
|
||||
// inPCCut = true;
|
||||
// }
|
||||
hpcCoin->Fill(pc.index[i], pc.index[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// sorting the anode and cathode hits in descending order of energy
|
||||
std::sort(anodeHits.begin(), anodeHits.end(), [](const std::pair<int, double> &a, const std::pair<int, double> &b)
|
||||
{ return a.second > b.second; });
|
||||
std::sort(cathodeHits.begin(), cathodeHits.end(), [](const std::pair<int, double> &a, const std::pair<int, double> &b)
|
||||
{ return a.second > b.second; });
|
||||
|
||||
bool SiPCflag;
|
||||
|
||||
corrcatMax.clear();
|
||||
if (anodeHits.size() >= 1 && cathodeHits.size() > 1)
|
||||
{
|
||||
if (((TMath::TanH(hitPos.Y() / hitPos.X())) > (TMath::TanH(a.Y() / a.X()) - TMath::PiOver4())) || ((TMath::TanH(hitPos.Y() / hitPos.X())) < (TMath::TanH(a.Y() / a.X()) + TMath::PiOver4())))
|
||||
if (qqq.index[k] == 75 && pc.index[k] == 2 && pc.e[k] > 100)
|
||||
{
|
||||
|
||||
for (const auto &anode : anodeHits)
|
||||
int multi_an = 0;
|
||||
for (int l = 0; l < E.size(); l++)
|
||||
{
|
||||
aID = anode.first;
|
||||
aE = anode.second;
|
||||
aESum += aE;
|
||||
if (aE > aEMax)
|
||||
if (E[l].first < 24)
|
||||
{
|
||||
aEMax = aE;
|
||||
aIDMax = aID;
|
||||
multi_an++;
|
||||
}
|
||||
if (aE > aEnextMax && aE < aEMax)
|
||||
{
|
||||
aEnextMax = aE;
|
||||
aIDnextMax = aID;
|
||||
}
|
||||
// for(const auto &cat : cathodeHits){
|
||||
// hAVCcoin->Fill(aID, cat.first);
|
||||
// }
|
||||
}
|
||||
|
||||
// std::cout << " Anode iD : " << aIDMax << " Energy : " << aEMax << std::endl;
|
||||
|
||||
// printf("aID : %d, aE : %f, cE : %f\n", aID, aE, cE);
|
||||
for (const auto &cathode : cathodeHits)
|
||||
if (multi_an >= 1)
|
||||
{
|
||||
cID = cathode.first;
|
||||
cE = cathode.second;
|
||||
// std::cout << "Cathode ID : " << cID << " Energy : " << cE << std::endl;
|
||||
|
||||
hAVCcoin->Fill(aIDMax, cID);
|
||||
|
||||
// This section of code is used to find the cathodes are correlated with the max and next max anodes, as well as to figure out if there are any common cathodes
|
||||
// the anodes are correlated with the cathodes +/-3 from the anode number in the reverse order
|
||||
|
||||
for (int j = -4; j < 3; j++)
|
||||
for (int l = 0; l < E.size(); l++)
|
||||
{
|
||||
if ((aIDMax + 24 + j) % 24 == 23 - cID)
|
||||
/* the 23-cID is used to accomodate for the fact that the order of the cathodes was reversed relative top the physical geometry */
|
||||
// if (Crossover[aIDMax][cID][0].z != 9999999)
|
||||
if (E[l].first < 24 && E[l].first != 19 && E[l].first != 12)
|
||||
{
|
||||
corrcatMax.push_back(std::pair<int, double>(cID, cE));
|
||||
cESum += cE;
|
||||
// printf("Max Anode : %d Correlated Cathode : %d Anode Energy : %f z value : %f \n", aIDMax, cID, cESum, Crossover[aIDMax][cID][1].z /*prints alpha*/);
|
||||
// std::cout << " Cathode iD : " << cID << " Energy : " << cE << std::endl;
|
||||
aE = E[l].second;
|
||||
}
|
||||
else if (E[l].first > 24)
|
||||
{
|
||||
cE = E[l].second;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
hanVScatsum->Fill(aE, cE);
|
||||
|
||||
TVector3 anodeIntersection;
|
||||
anodeIntersection.Clear();
|
||||
// Implementing a method for PC reconstruction using a single Anode event
|
||||
// if (anodeHits.size() == 1)
|
||||
if (ID[0].first < 1)
|
||||
{
|
||||
float x, y, z = 0;
|
||||
for (const auto &corr : corrcatMax)
|
||||
{
|
||||
if (cESum > 0)
|
||||
{
|
||||
x += (corr.second) / cESum * Crossover[aIDMax][corr.first][0].x;
|
||||
y += (corr.second) / cESum * Crossover[aIDMax][corr.first][0].y;
|
||||
z += (corr.second) / cESum * Crossover[aIDMax][corr.first][0].z;
|
||||
// printf("Max Anode : %d Correlated Cathode : %d cathode Energy : %f cESum Energy : %f z value : %f \n", aIDMax, corr.first, corr.second, cESum, Crossover[aIDMax][corr.first][1].z /*prints alpha*/);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Warning: No valid cathode hits to correlate with anode %d! \n", aIDMax);
|
||||
}
|
||||
// printf("EventID : %llu, Max Anode : %d Cathode: %d PC X and Y : (%f, %f) \n", entry, aIDMax, cID, Crossover[aIDMax][cID][0].x, Crossover[aIDMax][cID][0].y);
|
||||
// for (int i = 0; i < sx3.multi; i++)
|
||||
// {
|
||||
// printf("EventID : %llu, HitPos X, Y, Z: %f %f %f SX3ID : %d %d \n", entry, hitPos.X(), hitPos.Y(), hitPos.Z(), sx3.id[i], sx3.ch[i]);
|
||||
// }
|
||||
|
||||
// for (int i = 0; i < qqq.multi; i++)
|
||||
// {
|
||||
// printf("Max Anode : %d Cathode: %d PC X and Y : %f %f \n", aIDMax, cID, Crossover[aIDMax][cID][0].x, Crossover[aIDMax][cID][0].y);
|
||||
// printf("HitPos X, Y, Z, QQQID : %f %f %f %d \n", hitPos.X(), hitPos.Y(), hitPos.Z(), qqq.id[i]);
|
||||
// }
|
||||
}
|
||||
anodeIntersection = TVector3(x, y, z);
|
||||
// std::cout << "Anode Intersection " << anodeIntersection.Z() << " " << x << " " << y << " " << z << std::endl;
|
||||
aID = pc.ch[ID[0].second];
|
||||
cID = pc.ch[ID[1].second];
|
||||
}
|
||||
else
|
||||
{
|
||||
cID = pc.ch[ID[0].second];
|
||||
aID = pc.ch[ID[1].second];
|
||||
}
|
||||
|
||||
if (anodeIntersection.Z() != 0)
|
||||
if (HitNonZero)
|
||||
{
|
||||
hPCZProj->Fill(anodeIntersection.Z());
|
||||
}
|
||||
// Filling the PC Z projection histogram
|
||||
// std::cout << anodeIntersection.Z() << std::endl;
|
||||
// hPCZProj->Fill(anodeIntersection.Z());
|
||||
|
||||
// }
|
||||
|
||||
// inCuth = false;
|
||||
// inCutl = false;
|
||||
// inPCCut = false;
|
||||
// for(int j=i+1;j<pc.multi;j++){
|
||||
// if(PCCoinc_cut1->IsInside(pc.index[i], pc.index[j]) || PCCoinc_cut2->IsInside(pc.index[i], pc.index[j])){
|
||||
// // hpcCoin->Fill(pc.index[i], pc.index[j]);
|
||||
// inPCCut = true;
|
||||
// }
|
||||
// hpcCoin->Fill(pc.index[i], pc.index[j]);
|
||||
// }
|
||||
|
||||
// Check if the accumulated energies are within the defined ranges
|
||||
// if (AnCatSum_high && AnCatSum_high->IsInside(aESum, cESum)) {
|
||||
// inCuth = true;
|
||||
// }
|
||||
// if (AnCatSum_low && AnCatSum_low->IsInside(aESum, cESum)) {
|
||||
// inCutl = true;
|
||||
// }
|
||||
|
||||
// Fill histograms based on the cut conditions
|
||||
// if (inCuth && inPCCut) {
|
||||
// hanVScatsum_hcut->Fill(aESum, cESum);
|
||||
// }
|
||||
// if (inCutl && inPCCut) {
|
||||
// hanVScatsum_lcut->Fill(aESum, cESum);
|
||||
// }
|
||||
// for(auto anode : anodeHits){
|
||||
|
||||
// float aE = anode.second;
|
||||
// aESum += aE;
|
||||
// if(inPCCut){
|
||||
hanVScatsum->Fill(aEMax, cESum);
|
||||
// }
|
||||
|
||||
// if (sx3ecut)
|
||||
// {
|
||||
hCat4An->Fill(corrcatMax.size());
|
||||
hNosvAe->Fill(corrcatMax.size(), aEMax);
|
||||
hAnodehits->Fill(anodeHits.size());
|
||||
// }
|
||||
|
||||
// }
|
||||
if (anodeHits.size() < 1)
|
||||
{
|
||||
hCat0An->Fill(cathodeHits.size());
|
||||
}
|
||||
|
||||
if (HitNonZero && anodeIntersection.Z() != 0)
|
||||
{
|
||||
pw_contr.CalTrack2(hitPos, anodeIntersection);
|
||||
pw_contr.CalTrack(hitPos, aID, cID);
|
||||
hZProj->Fill(pw_contr.GetZ0());
|
||||
}
|
||||
|
||||
// ########################################################### Track constrcution
|
||||
|
||||
// ############################## DO THE KINEMATICS
|
||||
|
||||
return kTRUE;
|
||||
}
|
||||
|
||||
void Analyzer::Terminate()
|
||||
{
|
||||
// ########################################################### Track constrcution
|
||||
|
||||
// gStyle->SetOptStat("neiou");
|
||||
// TCanvas *canvas = new TCanvas("cANASEN", "ANASEN", 2000, 2000);
|
||||
// canvas->Divide(3, 3);
|
||||
// ############################## DO THE KINEMATICS
|
||||
|
||||
// // hsx3VpcIndex->Draw("colz");
|
||||
return kTRUE;
|
||||
}
|
||||
|
||||
// //=============================================== pad-1
|
||||
// padID++;
|
||||
// canvas->cd(padID);
|
||||
// canvas->cd(padID)->SetGrid(1);
|
||||
void Analyzer::Terminate()
|
||||
{
|
||||
|
||||
// hsx3IndexVE->Draw("colz");
|
||||
gStyle->SetOptStat("neiou");
|
||||
TCanvas *canvas = new TCanvas("cANASEN", "ANASEN", 2000, 2000);
|
||||
canvas->Divide(3, 3);
|
||||
|
||||
// //=============================================== pad-2
|
||||
// padID++;
|
||||
// canvas->cd(padID);
|
||||
// canvas->cd(padID)->SetGrid(1);
|
||||
// hsx3VpcIndex->Draw("colz");
|
||||
|
||||
// hqqqIndexVE->Draw("colz");
|
||||
//=============================================== pad-1
|
||||
padID++;
|
||||
canvas->cd(padID);
|
||||
canvas->cd(padID)->SetGrid(1);
|
||||
|
||||
// //=============================================== pad-3
|
||||
// padID++;
|
||||
// canvas->cd(padID);
|
||||
// canvas->cd(padID)->SetGrid(1);
|
||||
hsx3IndexVE->Draw("colz");
|
||||
|
||||
// hpcIndexVE->Draw("colz");
|
||||
//=============================================== pad-2
|
||||
padID++;
|
||||
canvas->cd(padID);
|
||||
canvas->cd(padID)->SetGrid(1);
|
||||
|
||||
// //=============================================== pad-4
|
||||
// padID++;
|
||||
// canvas->cd(padID);
|
||||
// canvas->cd(padID)->SetGrid(1);
|
||||
hqqqIndexVE->Draw("colz");
|
||||
|
||||
// hsx3Coin->Draw("colz");
|
||||
//=============================================== pad-3
|
||||
padID++;
|
||||
canvas->cd(padID);
|
||||
canvas->cd(padID)->SetGrid(1);
|
||||
|
||||
// //=============================================== pad-5
|
||||
// padID++;
|
||||
// canvas->cd(padID);
|
||||
// canvas->cd(padID)->SetGrid(1);
|
||||
hpcIndexVE->Draw("colz");
|
||||
|
||||
// canvas->cd(padID)->SetLogz(true);
|
||||
//=============================================== pad-4
|
||||
padID++;
|
||||
canvas->cd(padID);
|
||||
canvas->cd(padID)->SetGrid(1);
|
||||
|
||||
// hqqqCoin->Draw("colz");
|
||||
hsx3Coin->Draw("colz");
|
||||
|
||||
// //=============================================== pad-6
|
||||
// padID++;
|
||||
// canvas->cd(padID);
|
||||
// canvas->cd(padID)->SetGrid(1);
|
||||
//=============================================== pad-5
|
||||
padID++;
|
||||
canvas->cd(padID);
|
||||
canvas->cd(padID)->SetGrid(1);
|
||||
|
||||
// hpcCoin->Draw("colz");
|
||||
canvas->cd(padID)->SetLogz(true);
|
||||
|
||||
// //=============================================== pad-7
|
||||
// padID++;
|
||||
// canvas->cd(padID);
|
||||
// canvas->cd(padID)->SetGrid(1);
|
||||
hqqqCoin->Draw("colz");
|
||||
|
||||
// // hsx3VpcIndex ->Draw("colz");
|
||||
// hsx3VpcE->Draw("colz");
|
||||
//=============================================== pad-6
|
||||
padID++;
|
||||
canvas->cd(padID);
|
||||
canvas->cd(padID)->SetGrid(1);
|
||||
|
||||
// //=============================================== pad-8
|
||||
// padID++;
|
||||
// canvas->cd(padID);
|
||||
// canvas->cd(padID)->SetGrid(1);
|
||||
hpcCoin->Draw("colz");
|
||||
|
||||
// // hqqqVpcIndex ->Draw("colz");
|
||||
//=============================================== pad-7
|
||||
padID++;
|
||||
canvas->cd(padID);
|
||||
canvas->cd(padID)->SetGrid(1);
|
||||
|
||||
// hqqqVpcE->Draw("colz");
|
||||
// //=============================================== pad-9
|
||||
// padID++;
|
||||
// hsx3VpcIndex ->Draw("colz");
|
||||
hsx3VpcE->Draw("colz");
|
||||
|
||||
// // canvas->cd(padID)->DrawFrame(-50, -50, 50, 50);
|
||||
// // hqqqPolar->Draw("same colz pol");
|
||||
//=============================================== pad-8
|
||||
padID++;
|
||||
canvas->cd(padID);
|
||||
canvas->cd(padID)->SetGrid(1);
|
||||
|
||||
// canvas->cd(padID);
|
||||
// canvas->cd(padID)->SetGrid(1);
|
||||
// // hZProj->Draw();
|
||||
// hanVScatsum->Draw("colz");
|
||||
// hqqqVpcIndex ->Draw("colz");
|
||||
|
||||
// // TFile *outRoot = new TFile("Histograms.root", "RECREATE");
|
||||
hqqqVpcE->Draw("colz");
|
||||
//=============================================== pad-9
|
||||
padID++;
|
||||
|
||||
// // if (!outRoot->IsOpen())
|
||||
// // {
|
||||
// // std::cerr << "Error opening file for writing!" << std::endl;
|
||||
// // return;
|
||||
// // }
|
||||
// canvas->cd(padID)->DrawFrame(-50, -50, 50, 50);
|
||||
// hqqqPolar->Draw("same colz pol");
|
||||
|
||||
// // // Loop through histograms and write them to the ROOT file
|
||||
// // for (int i = 0; i < 48; i++)
|
||||
// // {
|
||||
// // if (hPC_E[i] != nullptr)
|
||||
// // {
|
||||
// // hPC_E[i]->Write(); // Write histogram to file
|
||||
// // }
|
||||
// // }
|
||||
|
||||
// // outRoot->Close();
|
||||
}
|
||||
canvas->cd(padID);
|
||||
canvas->cd(padID)->SetGrid(1);
|
||||
// hZProj->Draw();
|
||||
hanVScatsum->Draw("colz");
|
||||
}
|
||||
|
|
|
|||
15
Analyzer.h
15
Analyzer.h
|
|
@ -18,7 +18,6 @@ public :
|
|||
Det sx3;
|
||||
Det qqq;
|
||||
Det pc ;
|
||||
Det misc;
|
||||
|
||||
ULong64_t evID;
|
||||
UInt_t run;
|
||||
|
|
@ -41,13 +40,6 @@ public :
|
|||
TBranch *b_pcCh; //!
|
||||
TBranch *b_pcE; //!
|
||||
TBranch *b_pcT; //!
|
||||
TBranch *b_miscMulti; //!
|
||||
TBranch *b_miscID; //!
|
||||
TBranch *b_miscCh; //!
|
||||
TBranch *b_miscE; //!
|
||||
TBranch *b_miscT; //!
|
||||
TBranch *b_miscTf; //!
|
||||
|
||||
|
||||
Analyzer(TTree * /*tree*/ =0) : fChain(0) { }
|
||||
virtual ~Analyzer() { }
|
||||
|
|
@ -100,13 +92,6 @@ void Analyzer::Init(TTree *tree){
|
|||
fChain->SetBranchAddress("pcCh", &pc.ch, &b_pcCh);
|
||||
fChain->SetBranchAddress("pcE", &pc.e, &b_pcE);
|
||||
fChain->SetBranchAddress("pcT", &pc.t, &b_pcT);
|
||||
fChain->SetBranchAddress("miscMulti", &misc.multi, &b_miscMulti);
|
||||
fChain->SetBranchAddress("miscID", &misc.id, &b_miscID);
|
||||
fChain->SetBranchAddress("miscCh", &misc.ch, &b_miscCh);
|
||||
fChain->SetBranchAddress("miscE", &misc.e, &b_miscE);
|
||||
fChain->SetBranchAddress("miscT", &misc.t, &b_miscT);
|
||||
// fChain->SetBranchAddress("miscF", &misc.tf, &b_miscTf);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
283
Armory/#ClassPW.h#
Normal file
283
Armory/#ClassPW.h#
Normal file
|
|
@ -0,0 +1,283 @@
|
|||
#ifndef ClassPW_h
|
||||
#define ClassPW_h
|
||||
|
||||
#include <cstdio>
|
||||
#include <TMath.h>
|
||||
#include <TVector3.h>
|
||||
|
||||
struct PWHitInfo{
|
||||
std::pair<short, short> nearestWire; // anode, cathode
|
||||
std::pair<double, double> nearestDist; // anode, cathode
|
||||
|
||||
std::pair<short, short> nextNearestWire; // anode, cathode
|
||||
std::pair<double, double> nextNearestDist; // anode, cathode
|
||||
|
||||
void Clear(){
|
||||
nearestWire.first = -1;
|
||||
nearestWire.second = -1;
|
||||
nearestDist.first = 999999999;
|
||||
nearestDist.second = 999999999;
|
||||
nextNearestWire.first = -1;
|
||||
nextNearestWire.second = -1;
|
||||
nextNearestDist.first = 999999999;
|
||||
nextNearestDist.second = 999999999;
|
||||
}
|
||||
};
|
||||
|
||||
//!########################################################
|
||||
class PW{ // proportional wire
|
||||
public:
|
||||
PW(){ ClearHitInfo();};
|
||||
~PW(){};
|
||||
|
||||
PWHitInfo GetHitInfo() const {return hitInfo;}
|
||||
std::pair<short, short> GetNearestID() const {return hitInfo.nearestWire;}
|
||||
std::pair<double, double> GetNearestDistance() const {return hitInfo.nearestDist;}
|
||||
std::pair<short, short> Get2ndNearestID() const {return hitInfo.nextNearestWire;}
|
||||
std::pair<double, double> Get2ndNearestDistance() const {return hitInfo.nextNearestDist;}
|
||||
|
||||
TVector3 GetTrackPos() const {return trackPos;}
|
||||
TVector3 GetTrackVec() const {return trackVec;}
|
||||
double GetTrackTheta() const {return trackVec.Theta();}
|
||||
double GetTrackPhi() const {return trackVec.Phi();}
|
||||
double GetZ0();
|
||||
|
||||
int GetNumWire() const {return nWire;}
|
||||
double GetDeltaAngle() const {return dAngle;}
|
||||
double GetAnodeLength() const {return anodeLength;}
|
||||
double GetCathodeLength() const {return cathodeLength;}
|
||||
TVector3 GetAnodeDn(short id) const {return An[id].first;}
|
||||
TVector3 GetAnodeUp(short id) const {return An[id].second;}
|
||||
TVector3 GetCathodeDn(short id) const {return Ca[id].first;}
|
||||
TVector3 GetCathodeUp(short id) const {return Ca[id].second;}
|
||||
|
||||
TVector3 GetAnodneMid(short id) const {return (An[id].first + An[id].second) * 0.5; }
|
||||
double GetAnodeTheta(short id) const {return (An[id].first - An[id].second).Theta();}
|
||||
double GetAnodePhi(short id) const {return (An[id].first - An[id].second).Phi();}
|
||||
|
||||
TVector3 GetCathodneMid(short id) const {return (Ca[id].first + Ca[id].second) * 0.5; }
|
||||
double GetCathodeTheta(short id) const {return (Ca[id].first - Ca[id].second).Theta();}
|
||||
double GetCathodePhi(short id) const {return (Ca[id].first - Ca[id].second).Phi();}
|
||||
|
||||
void ClearHitInfo();
|
||||
void ConstructGeo();
|
||||
void FindWireID(TVector3 pos, TVector3 direction, bool verbose = false);
|
||||
void CalTrack(TVector3 sx3Pos, int anodeID, int cathodeID, bool verbose = false);
|
||||
void CalTrack2(TVector3 sx3Pos, PWHitInfo hitInfo, double sigmaA = 0, double sigmaC = 0, bool verbose = false);
|
||||
|
||||
void Print(){
|
||||
printf(" The nearest | Anode: %2d(%5.2f) Cathode: %2d(%5.2f)\n", hitInfo.nearestWire.first,
|
||||
hitInfo.nearestDist.first,
|
||||
hitInfo.nearestWire.second,
|
||||
hitInfo.nearestDist.second);
|
||||
|
||||
printf(" The 2nd nearest | Anode: %2d(%5.2f) Cathode: %2d(%5.2f)\n", hitInfo.nextNearestWire.first,
|
||||
hitInfo.nextNearestDist.first,
|
||||
hitInfo.nextNearestWire.second,
|
||||
hitInfo.nextNearestDist.second);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
PWHitInfo hitInfo;
|
||||
|
||||
TVector3 trackPos;
|
||||
TVector3 trackVec;
|
||||
|
||||
const int nWire = 24;
|
||||
const int wireShift = 3;
|
||||
const float zLen = 380; //mm
|
||||
const float radiusA = 37;
|
||||
const float radiusC = 43;
|
||||
|
||||
double dAngle;
|
||||
double anodeLength;
|
||||
double cathodeLength;
|
||||
|
||||
std::vector<std::pair<TVector3,TVector3>> An; // the anode wire position vector in space
|
||||
std::vector<std::pair<TVector3,TVector3>> Ca; // the cathode wire position vector in space
|
||||
|
||||
double Distance(TVector3 a1, TVector3 a2, TVector3 b1, TVector3 b2){
|
||||
TVector3 na = a1 - a2;
|
||||
TVector3 nb = b1 - b2;
|
||||
TVector3 nd = (na.Cross(nb)).Unit();
|
||||
return TMath::Abs(nd.Dot(a1-b2));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
inline void PW::ClearHitInfo(){
|
||||
hitInfo.Clear();
|
||||
}
|
||||
|
||||
inline void PW::ConstructGeo(){
|
||||
|
||||
An.clear();
|
||||
Ca.clear();
|
||||
|
||||
std::pair<TVector3, TVector3> p1; // anode
|
||||
std::pair<TVector3, TVector3> q1; // cathode
|
||||
|
||||
//anode and cathode start at pos-Y axis and count in right-Hand
|
||||
//anode wire shift is right-hand.
|
||||
//cathode wire shift is left-hand.
|
||||
|
||||
for(int i = 0; i < nWire; i++ ){
|
||||
// Anode rotate right-hand
|
||||
p1.first.SetXYZ( radiusA * TMath::Cos( TMath::TwoPi() / nWire * (i) + TMath::PiOver2()),
|
||||
radiusA * TMath::Sin( TMath::TwoPi() / nWire * (i) + TMath::PiOver2()),
|
||||
zLen/2);
|
||||
p1.second.SetXYZ( radiusA * TMath::Cos( TMath::TwoPi() / nWire * (i + wireShift) + TMath::PiOver2()),
|
||||
radiusA * TMath::Sin( TMath::TwoPi() / nWire * (i + wireShift) + TMath::PiOver2()),
|
||||
-zLen/2);
|
||||
An.push_back(p1);
|
||||
|
||||
// Cathod rotate left-hand
|
||||
q1.first.SetXYZ( radiusC * TMath::Cos( TMath::TwoPi() / nWire * (i) + TMath::PiOver2()),
|
||||
radiusC * TMath::Sin( TMath::TwoPi() / nWire * (i) + TMath::PiOver2()),
|
||||
zLen/2);
|
||||
q1.second.SetXYZ( radiusC * TMath::Cos( TMath::TwoPi() / nWire * (i - wireShift) + TMath::PiOver2()),
|
||||
radiusC * TMath::Sin( TMath::TwoPi() / nWire * (i - wireShift) + TMath::PiOver2()),
|
||||
-zLen/2);
|
||||
Ca.push_back(q1);
|
||||
}
|
||||
|
||||
dAngle = wireShift * TMath::TwoPi() / nWire;
|
||||
anodeLength = TMath::Sqrt( zLen*zLen + TMath::Power(2* radiusA * TMath::Sin(dAngle/2),2) );
|
||||
cathodeLength = TMath::Sqrt( zLen*zLen + TMath::Power(2* radiusC * TMath::Sin(dAngle/2),2) );
|
||||
}
|
||||
|
||||
inline void PW::FindWireID(TVector3 pos, TVector3 direction, bool verbose ){
|
||||
|
||||
hitInfo.Clear();
|
||||
double phi = direction.Phi();
|
||||
|
||||
for( int i = 0; i < nWire; i++){
|
||||
|
||||
double disA = 99999999;
|
||||
double phiS = An[i].first.Phi() - TMath::PiOver4();
|
||||
double phiL = An[i].second.Phi() + TMath::PiOver4();
|
||||
// printf("A%2d: %f %f | %f\n", i, phiS * TMath::RadToDeg(), phiL * TMath::RadToDeg(), phi * TMath::RadToDeg());
|
||||
if( phi > 0 && phiS > phiL ) phiL = phiL + TMath::TwoPi();
|
||||
if( phi < 0 && phiS > phiL ) phiS = phiS - TMath::TwoPi();
|
||||
|
||||
if( phiS < phi && phi < phiL) {
|
||||
disA = Distance( pos, pos + direction, An[i].first, An[i].second);
|
||||
if( disA < hitInfo.nearestDist.first ){
|
||||
hitInfo.nearestDist.first = disA;
|
||||
hitInfo.nearestWire.first = i;
|
||||
}
|
||||
}
|
||||
|
||||
double disC = 99999999;
|
||||
phiS = Ca[i].second.Phi()- TMath::PiOver4();
|
||||
phiL = Ca[i].first.Phi() + TMath::PiOver4();
|
||||
// printf("C%2d: %f %f\n", i, phiS * TMath::RadToDeg(), phiL * TMath::RadToDeg());
|
||||
if( phi > 0 && phiS > phiL ) phiL = phiL + TMath::TwoPi();
|
||||
if( phi < 0 && phiS > phiL ) phiS = phiS - TMath::TwoPi();
|
||||
|
||||
if(phiS < phi && phi < phiL) {
|
||||
disC = Distance( pos, pos + direction, Ca[i].first, Ca[i].second);
|
||||
if( disC < hitInfo.nearestDist.second ){
|
||||
hitInfo.nearestDist.second = disC;
|
||||
hitInfo.nearestWire.second = i;
|
||||
}
|
||||
}
|
||||
|
||||
if(verbose) printf(" %2d | %8.2f, %8.2f\n", i, disA, disC);
|
||||
}
|
||||
|
||||
//==== find the 2nd nearest wire
|
||||
short anode1 = hitInfo.nearestWire.first;
|
||||
short aaa1 = anode1 - 1; if( aaa1 < 0 ) aaa1 += nWire;
|
||||
short aaa2 = (anode1 + 1) % nWire;
|
||||
|
||||
double haha1 = Distance( pos, pos + direction, An[aaa1].first, An[aaa1].second);
|
||||
double haha2 = Distance( pos, pos + direction, An[aaa2].first, An[aaa2].second);
|
||||
if( haha1 < haha2){
|
||||
hitInfo.nextNearestWire.first = aaa1;
|
||||
hitInfo.nextNearestDist.first = haha1;
|
||||
}else{
|
||||
hitInfo.nextNearestWire.first = aaa2;
|
||||
hitInfo.nextNearestDist.first = haha2;
|
||||
}
|
||||
|
||||
short cathode1 = hitInfo.nearestWire.second;
|
||||
short ccc1 = cathode1 - 1; if( ccc1 < 0 ) ccc1 += nWire;
|
||||
short ccc2 = (cathode1 + 1) % nWire;
|
||||
|
||||
haha1 = Distance( pos, pos + direction, Ca[ccc1].first, Ca[ccc1].second);
|
||||
haha2 = Distance( pos, pos + direction, Ca[ccc2].first, Ca[ccc2].second);
|
||||
if( haha1 < haha2){
|
||||
hitInfo.nextNearestWire.second = ccc1;
|
||||
hitInfo.nextNearestDist.second = haha1;
|
||||
}else{
|
||||
hitInfo.nextNearestWire.second = ccc2;
|
||||
hitInfo.nextNearestDist.second = haha2;
|
||||
}
|
||||
|
||||
if( verbose ) Print();
|
||||
}
|
||||
|
||||
inline void PW::CalTrack(TVector3 sx3Pos, int anodeID, int cathodeID, bool verbose){
|
||||
|
||||
trackPos = sx3Pos;
|
||||
|
||||
TVector3 n1 = (An[anodeID].first - An[anodeID].second).Cross((sx3Pos - An[anodeID].second)).Unit();
|
||||
TVector3 n2 = (Ca[cathodeID].first - Ca[cathodeID].second).Cross((sx3Pos - Ca[cathodeID].second)).Unit();
|
||||
|
||||
// if the handiness of anode and cathode revered, it should be n2 cross n1
|
||||
trackVec = (n2.Cross(n1)).Unit();
|
||||
|
||||
if( verbose ) printf("Theta, Phi = %f, %f \n", trackVec.Theta() *TMath::RadToDeg(), trackVec.Phi()*TMath::RadToDeg());
|
||||
|
||||
}
|
||||
|
||||
inline void PW::CalTrack2(TVector3 sx3Pos, PWHitInfo hitInfo, double sigmaA, double sigmaC, bool verbose){
|
||||
|
||||
trackPos = sx3Pos;
|
||||
|
||||
double p1 = TMath::Abs(hitInfo.nearestDist.first + gRandom->Gaus(0, sigmaA));
|
||||
double p2 = TMath::Abs(hitInfo.nextNearestDist.first + gRandom->Gaus(0, sigmaA));
|
||||
double fracA = p1 / (p1 + p2);
|
||||
short anodeID1 = hitInfo.nearestWire.first;
|
||||
short anodeID2 = hitInfo.nextNearestWire.first;
|
||||
TVector3 shiftA1 = (An[anodeID2].first - An[anodeID1].first) * fracA;
|
||||
TVector3 shiftA2 = (An[anodeID2].second - An[anodeID1].second) * fracA;
|
||||
|
||||
double q1 = TMath::Abs(hitInfo.nearestDist.second + gRandom->Gaus(0, sigmaC));
|
||||
double q2 = TMath::Abs(hitInfo.nextNearestDist.second + gRandom->Gaus(0, sigmaC));
|
||||
double fracC = q1 / (q1 + q2);
|
||||
short cathodeID1 = hitInfo.nearestWire.second;
|
||||
short cathodeID2 = hitInfo.nextNearestWire.second;
|
||||
TVector3 shiftC1 = (Ca[cathodeID2].first - Ca[cathodeID1].first) * fracC;
|
||||
TVector3 shiftC2 = (Ca[cathodeID2].second - Ca[cathodeID1].second) * fracC;
|
||||
|
||||
TVector3 a1 = An[anodeID1].first + shiftA1;
|
||||
TVector3 a2 = An[anodeID1].second + shiftA2;
|
||||
|
||||
TVector3 c1 = Ca[cathodeID1].first + shiftC1;
|
||||
TVector3 c2 = Ca[cathodeID1].second + shiftC2;
|
||||
|
||||
TVector3 n1 = (a1 - a2).Cross((sx3Pos - a2)).Unit();
|
||||
TVector3 n2 = (c1 - c2).Cross((sx3Pos - c2)).Unit();
|
||||
|
||||
// if the handiness of anode and cathode revered, it should be n2 cross n1
|
||||
trackVec = (n2.Cross(n1)).Unit();
|
||||
|
||||
if( verbose ) printf("Theta, Phi = %f, %f \n", trackVec.Theta() *TMath::RadToDeg(), trackVec.Phi()*TMath::RadToDeg());
|
||||
|
||||
}
|
||||
|
||||
inline double PW::GetZ0(){
|
||||
|
||||
double x = trackPos.X();
|
||||
double y = trackPos.Y();
|
||||
double rho = TMath::Sqrt(x*x + y*y);
|
||||
double theta = trackVec.Theta();
|
||||
|
||||
return trackPos.Z() - rho / TMath::Tan(theta);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -42,7 +42,7 @@ void ANASEN_model(int anodeID1 = -1, int anodeID2 = -1, int cathodeID1 = -1, int
|
|||
//--- making ANASEN
|
||||
const int nWire = 24;
|
||||
const int wireShift = 3;
|
||||
const int zLen = 350; //mm
|
||||
const int zLen = 300; //mm
|
||||
const int radiusA = 38;
|
||||
const int radiusC = 43;
|
||||
|
||||
|
|
@ -103,8 +103,8 @@ void ANASEN_model(int anodeID1 = -1, int anodeID2 = -1, int cathodeID1 = -1, int
|
|||
new TGeoRotation("rot1", 360/nSX3 * (i + 0.5), 0., 0.)));
|
||||
}
|
||||
|
||||
const int qqqR1 = 50;
|
||||
const int qqqR2 = 100;
|
||||
const int qqqR1 = 10;
|
||||
const int qqqR2 = 50;
|
||||
TGeoVolume *qqq = geom->MakeTubs("qqq", Al, qqqR1, qqqR2, 0.5, 5, 85);
|
||||
qqq->SetLineColor(7);
|
||||
for( int i = 0; i < 4; i++){
|
||||
|
|
|
|||
1270
Armory/ClassData.h
1270
Armory/ClassData.h
File diff suppressed because it is too large
Load Diff
|
|
@ -5,67 +5,60 @@
|
|||
|
||||
#define MAXMULTI 1000
|
||||
|
||||
class Det
|
||||
{
|
||||
class Det{
|
||||
public:
|
||||
Det() : multi(0) { Clear(); }
|
||||
Det(): multi(0) {Clear(); }
|
||||
|
||||
unsigned short multi; // max 65535
|
||||
unsigned short id[MAXMULTI];
|
||||
unsigned short ch[MAXMULTI];
|
||||
unsigned short e[MAXMULTI];
|
||||
unsigned long long t[MAXMULTI];
|
||||
unsigned long long tf[MAXMULTI];
|
||||
unsigned short multi; // max 65535
|
||||
unsigned short id[MAXMULTI];
|
||||
unsigned short ch[MAXMULTI];
|
||||
unsigned short e[MAXMULTI];
|
||||
unsigned long long t[MAXMULTI];
|
||||
|
||||
unsigned short sn[MAXMULTI];
|
||||
unsigned short digiCh[MAXMULTI];
|
||||
unsigned short sn[MAXMULTI];
|
||||
unsigned short digiCh[MAXMULTI];
|
||||
|
||||
unsigned short index[MAXMULTI]; // id * nCh + ch;
|
||||
bool used[MAXMULTI];
|
||||
unsigned short index[MAXMULTI]; // id * nCh + ch;
|
||||
bool used[MAXMULTI];
|
||||
|
||||
void Clear()
|
||||
{
|
||||
void Clear(){
|
||||
multi = 0;
|
||||
for (int i = 0; i < MAXMULTI; i++)
|
||||
{
|
||||
for( int i = 0; i < MAXMULTI; i++){
|
||||
id[i] = 0;
|
||||
ch[i] = 0;
|
||||
e[i] = 0;
|
||||
t[i] = 0;
|
||||
tf[i] = 0;
|
||||
index[i] = 0;
|
||||
sn[i] = 0;
|
||||
digiCh[i] = 0;
|
||||
used[i] = false;
|
||||
e[i] = 0;
|
||||
t[i] = 0;
|
||||
index[i] = 0;
|
||||
sn[i] = 0;
|
||||
digiCh[i] = 0;
|
||||
used[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
void Print()
|
||||
{
|
||||
void Print(){
|
||||
printf("=============================== multi : %u\n", multi);
|
||||
for (int i = 0; i < multi; i++)
|
||||
{
|
||||
printf(" %3d | %2d-%-2d(%5d) %5u %15llu %15llu \n", i, id[i], ch[i], index[i], e[i], t[i], tf[i]);
|
||||
for( int i = 0; i < multi; i++) {
|
||||
printf(" %3d | %2d-%-2d(%5d) %5u %15llu \n", i, id[i], ch[i], index[i], e[i], t[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void SetDetDimension(unsigned short maxID, unsigned maxCh)
|
||||
{
|
||||
void SetDetDimension(unsigned short maxID, unsigned maxCh){
|
||||
nID = maxID;
|
||||
nCh = maxCh;
|
||||
}
|
||||
|
||||
void CalIndex()
|
||||
{
|
||||
for (int i = 0; i < multi; i++)
|
||||
{
|
||||
index[i] = id[i] * nCh + ch[i];
|
||||
void CalIndex(){
|
||||
for( int i = 0; i < multi; i++){
|
||||
index[i] = id[i] * nCh + ch[i] ;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
unsigned short nID;
|
||||
unsigned short nCh;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
246
Armory/ClassPC1An.h
Normal file
246
Armory/ClassPC1An.h
Normal file
|
|
@ -0,0 +1,246 @@
|
|||
#ifndef ClassPC_h
|
||||
#define ClassPC_h
|
||||
|
||||
#include <cstdio>
|
||||
#include <TMath.h>
|
||||
#include <TVector3.h>
|
||||
#include <TRandom.h>
|
||||
|
||||
struct PCHit_1An{
|
||||
std::pair<short, short> nearestWire; // anode, cathode
|
||||
std::pair<double, double> nearestDist; // anode, cathode
|
||||
|
||||
short nextNearestWire; // cathode
|
||||
double nextNearestDist; // cathode
|
||||
|
||||
void Clear(){
|
||||
nearestWire.first = -1;
|
||||
nearestWire.second = -1;
|
||||
nearestDist.first = 999999999;
|
||||
nearestDist.second = 999999999;
|
||||
nextNearestWire= -1;
|
||||
nextNearestDist = 999999999;
|
||||
}
|
||||
};
|
||||
|
||||
//!########################################################
|
||||
class PC{ // proportional wire
|
||||
public:
|
||||
PC(){ ClearHitInfo();};
|
||||
~PC(){};
|
||||
|
||||
PCHit_1An GetHitInfo() const {return hitInfo;}
|
||||
std::pair<short, short> GetNearestID() const {return hitInfo.nearestWire;}
|
||||
std::pair<double, double> GetNearestDistance() const {return hitInfo.nearestDist;}
|
||||
short Get2ndNearestID() const {return hitInfo.nextNearestWire;}
|
||||
double Get2ndNearestDistance() const {return hitInfo.nextNearestDist;}
|
||||
|
||||
TVector3 GetTrackPos() const {return trackPos;}
|
||||
TVector3 GetTrackVec() const {return trackVec;}
|
||||
double GetTrackTheta() const {return trackVec.Theta();}
|
||||
double GetTrackPhi() const {return trackVec.Phi();}
|
||||
double GetZ0();
|
||||
|
||||
int GetNumWire() const {return nWire;}
|
||||
double GetDeltaAngle() const {return dAngle;}
|
||||
double GetAnodeLength() const {return anodeLength;}
|
||||
double GetCathodeLength() const {return cathodeLength;}
|
||||
TVector3 GetAnodeDn(short id) const {return An[id].first;}
|
||||
TVector3 GetAnodeUp(short id) const {return An[id].second;}
|
||||
TVector3 GetCathodeDn(short id) const {return Ca[id].first;}
|
||||
TVector3 GetCathodeUp(short id) const {return Ca[id].second;}
|
||||
|
||||
TVector3 GetAnodneMid(short id) const {return (An[id].first + An[id].second) * 0.5; }
|
||||
double GetAnodeTheta(short id) const {return (An[id].first - An[id].second).Theta();}
|
||||
double GetAnodePhi(short id) const {return (An[id].first - An[id].second).Phi();}
|
||||
|
||||
TVector3 GetCathodneMid(short id) const {return (Ca[id].first + Ca[id].second) * 0.5; }
|
||||
double GetCathodeTheta(short id) const {return (Ca[id].first - Ca[id].second).Theta();}
|
||||
double GetCathodePhi(short id) const {return (Ca[id].first - Ca[id].second).Phi();}
|
||||
|
||||
void ClearHitInfo();
|
||||
void ConstructGeo();
|
||||
void FindWireID(TVector3 pos, TVector3 direction, bool verbose = false);
|
||||
void CalTrack3(TVector3 sx3Pos, PCHit_1An hitInfo, double sigmaA = 0, double sigmaC = 0, bool verbose = false);
|
||||
|
||||
void Print(){
|
||||
printf(" The nearest | Anode: %2d(%5.2f) Cathode: %2d(%5.2f)\n", hitInfo.nearestWire.first,
|
||||
hitInfo.nearestDist.first,
|
||||
hitInfo.nearestWire.second,
|
||||
hitInfo.nearestDist.second);
|
||||
|
||||
printf(" The 2nd nearest Cathode: %2d(%5.2f)\n", hitInfo.nextNearestWire,
|
||||
hitInfo.nextNearestDist);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
// PCHitInfo hitInfo;
|
||||
PCHit_1An hitInfo;
|
||||
|
||||
TVector3 trackPos;
|
||||
TVector3 trackVec;
|
||||
|
||||
const int nWire = 24;
|
||||
const int wireShift = 3;
|
||||
const float zLen = 380; //mm
|
||||
const float radiusA = 37;
|
||||
const float radiusC = 43;
|
||||
|
||||
double dAngle;
|
||||
double anodeLength;
|
||||
double cathodeLength;
|
||||
|
||||
std::vector<std::pair<TVector3,TVector3>> An; // the anode wire position vector in space
|
||||
std::vector<std::pair<TVector3,TVector3>> Ca; // the cathode wire position vector in space
|
||||
|
||||
double Distance(TVector3 a1, TVector3 a2, TVector3 b1, TVector3 b2){
|
||||
TVector3 na = a1 - a2;
|
||||
TVector3 nb = b1 - b2;
|
||||
TVector3 nd = (na.Cross(nb)).Unit();
|
||||
return TMath::Abs(nd.Dot(a1-b2));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
inline void PC::ClearHitInfo(){
|
||||
hitInfo.Clear();
|
||||
}
|
||||
|
||||
inline void PC::ConstructGeo(){
|
||||
|
||||
An.clear();
|
||||
Ca.clear();
|
||||
|
||||
std::pair<TVector3, TVector3> p1; // anode
|
||||
std::pair<TVector3, TVector3> q1; // cathode
|
||||
|
||||
//anode and cathode start at pos-Y axis and count in right-Hand
|
||||
//anode wire shift is right-hand.
|
||||
//cathode wire shift is left-hand.
|
||||
|
||||
for(int i = 0; i < nWire; i++ ){
|
||||
// Anode rotate right-hand
|
||||
p1.first.SetXYZ( radiusA * TMath::Cos( TMath::TwoPi() / nWire * (i) + TMath::PiOver2()),
|
||||
radiusA * TMath::Sin( TMath::TwoPi() / nWire * (i) + TMath::PiOver2()),
|
||||
zLen/2);
|
||||
p1.second.SetXYZ( radiusA * TMath::Cos( TMath::TwoPi() / nWire * (i + wireShift) + TMath::PiOver2()),
|
||||
radiusA * TMath::Sin( TMath::TwoPi() / nWire * (i + wireShift) + TMath::PiOver2()),
|
||||
-zLen/2);
|
||||
An.push_back(p1);
|
||||
|
||||
// Cathod rotate left-hand
|
||||
q1.first.SetXYZ( radiusC * TMath::Cos( TMath::TwoPi() / nWire * (i) + TMath::PiOver2()),
|
||||
radiusC * TMath::Sin( TMath::TwoPi() / nWire * (i) + TMath::PiOver2()),
|
||||
zLen/2);
|
||||
q1.second.SetXYZ( radiusC * TMath::Cos( TMath::TwoPi() / nWire * (i - wireShift) + TMath::PiOver2()),
|
||||
radiusC * TMath::Sin( TMath::TwoPi() / nWire * (i - wireShift) + TMath::PiOver2()),
|
||||
-zLen/2);
|
||||
Ca.push_back(q1);
|
||||
}
|
||||
|
||||
dAngle = wireShift * TMath::TwoPi() / nWire;
|
||||
anodeLength = TMath::Sqrt( zLen*zLen + TMath::Power(2* radiusA * TMath::Sin(dAngle/2),2) );
|
||||
cathodeLength = TMath::Sqrt( zLen*zLen + TMath::Power(2* radiusC * TMath::Sin(dAngle/2),2) );
|
||||
}
|
||||
|
||||
inline void PC::FindWireID(TVector3 pos, TVector3 direction, bool verbose ){
|
||||
|
||||
hitInfo.Clear();
|
||||
double phi = direction.Phi();
|
||||
|
||||
for( int i = 0; i < nWire; i++){
|
||||
|
||||
double disA = 99999999;
|
||||
double phiS = An[i].first.Phi() - TMath::PiOver4();
|
||||
double phiL = An[i].second.Phi() + TMath::PiOver4();
|
||||
// printf("A%2d: %f %f | %f\n", i, phiS * TMath::RadToDeg(), phiL * TMath::RadToDeg(), phi * TMath::RadToDeg());
|
||||
if( phi > 0 && phiS > phiL ) phiL = phiL + TMath::TwoPi();
|
||||
if( phi < 0 && phiS > phiL ) phiS = phiS - TMath::TwoPi();
|
||||
|
||||
if( phiS < phi && phi < phiL) {
|
||||
disA = Distance( pos, pos + direction, An[i].first, An[i].second);
|
||||
if( disA < hitInfo.nearestDist.first ){
|
||||
hitInfo.nearestDist.first = disA;
|
||||
hitInfo.nearestWire.first = i;
|
||||
}
|
||||
}
|
||||
|
||||
double disC = 99999999;
|
||||
phiS = Ca[i].second.Phi()- TMath::PiOver4();
|
||||
phiL = Ca[i].first.Phi() + TMath::PiOver4();
|
||||
// printf("C%2d: %f %f\n", i, phiS * TMath::RadToDeg(), phiL * TMath::RadToDeg());
|
||||
if( phi > 0 && phiS > phiL ) phiL = phiL + TMath::TwoPi();
|
||||
if( phi < 0 && phiS > phiL ) phiS = phiS - TMath::TwoPi();
|
||||
|
||||
if(phiS < phi && phi < phiL) {
|
||||
disC = Distance( pos, pos + direction, Ca[i].first, Ca[i].second);
|
||||
if( disC < hitInfo.nearestDist.second ){
|
||||
hitInfo.nearestDist.second = disC;
|
||||
hitInfo.nearestWire.second = i;
|
||||
}
|
||||
}
|
||||
|
||||
if(verbose) printf(" %2d | %8.2f, %8.2f\n", i, disA, disC);
|
||||
}
|
||||
|
||||
short cathode1 = hitInfo.nearestWire.second;
|
||||
short ccc1 = cathode1 - 1; if( ccc1 < 0 ) ccc1 += nWire;
|
||||
short ccc2 = (cathode1 + 1) % nWire;
|
||||
|
||||
double haha1 = Distance( pos, pos + direction, Ca[ccc1].first, Ca[ccc1].second);
|
||||
double haha2 = Distance( pos, pos + direction, Ca[ccc2].first, Ca[ccc2].second);
|
||||
if( haha1 < haha2){
|
||||
hitInfo.nextNearestWire = ccc1;
|
||||
hitInfo.nextNearestDist = haha1;
|
||||
}else{
|
||||
hitInfo.nextNearestWire = ccc2;
|
||||
hitInfo.nextNearestDist= haha2;
|
||||
}
|
||||
|
||||
if( verbose ) Print();
|
||||
}
|
||||
|
||||
|
||||
inline void PC::CalTrack3(TVector3 sx3Pos, PCHit_1An hitInfo, double sigmaA, double sigmaC, bool verbose){
|
||||
|
||||
trackPos = sx3Pos;
|
||||
|
||||
double p1 = TMath::Abs(hitInfo.nearestDist.first + gRandom->Gaus(0, sigmaA));
|
||||
short anodeID1 = hitInfo.nearestWire.first;
|
||||
|
||||
double q1 = TMath::Abs(hitInfo.nearestDist.second + gRandom->Gaus(0, sigmaC));
|
||||
double q2 = TMath::Abs(hitInfo.nextNearestDist+ gRandom->Gaus(0, sigmaC));
|
||||
double fracC = q1 / (q1 + q2);
|
||||
short cathodeID1 = hitInfo.nearestWire.second;
|
||||
short cathodeID2 = hitInfo.nextNearestWire;
|
||||
TVector3 shiftC1 = (Ca[cathodeID2].first - Ca[cathodeID1].first) * fracC;
|
||||
TVector3 shiftC2 = (Ca[cathodeID2].second - Ca[cathodeID1].second) * fracC;
|
||||
|
||||
TVector3 a1 = An[anodeID1].first;
|
||||
|
||||
TVector3 c1 = Ca[cathodeID1].first + shiftC1;
|
||||
TVector3 c2 = Ca[cathodeID1].second + shiftC2;
|
||||
|
||||
TVector3 n1 = (sx3Pos - a1).Unit();
|
||||
TVector3 n2 = (c1 - c2).Cross((sx3Pos - c2)).Unit();
|
||||
|
||||
// if the handiness of anode and cathode revered, it should be n2 cross n1
|
||||
trackVec = (n2.Cross(n1)).Unit();
|
||||
|
||||
if( verbose ) printf("Theta, Phi = %f, %f \n", trackVec.Theta() *TMath::RadToDeg(), trackVec.Phi()*TMath::RadToDeg());
|
||||
|
||||
}
|
||||
|
||||
inline double PC::GetZ0(){
|
||||
|
||||
double x = trackPos.X();
|
||||
double y = trackPos.Y();
|
||||
double rho = TMath::Sqrt(x*x + y*y);
|
||||
double theta = trackVec.Theta();
|
||||
|
||||
return trackPos.Z() - rho / TMath::Tan(theta);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
370
Armory/ClassPW.h
Executable file → Normal file
370
Armory/ClassPW.h
Executable file → Normal file
|
|
@ -2,7 +2,6 @@
|
|||
#define ClassPW_h
|
||||
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <TMath.h>
|
||||
#include <TVector3.h>
|
||||
#include <TRandom.h>
|
||||
|
|
@ -62,17 +61,6 @@ public:
|
|||
double GetTrackPhi() const { return trackVec.Phi(); }
|
||||
double GetZ0();
|
||||
|
||||
Coord Crossover[24][24][2];
|
||||
|
||||
inline TVector3 getClosestWirePosAtWirePhi(std::pair<TVector3, TVector3>, double phi);
|
||||
inline std::tuple<std::pair<TVector3, TVector3>, double, double, double> GetPseudoWire(const std::vector<std::tuple<int, double, double>> &cluster, std::string type);
|
||||
|
||||
inline std::tuple<TVector3, double, double, double, double, double, double, double>
|
||||
FindCrossoverProperties(const std::vector<std::tuple<int, double, double>> &a_cluster, const std::vector<std::tuple<int, double, double>> &c_cluster);
|
||||
|
||||
inline std::vector<std::vector<std::tuple<int, double, double>>>
|
||||
Make_Clusters(std::unordered_map<int, std::tuple<int, double, double>> wireEvents);
|
||||
|
||||
int GetNumWire() const { return nWire; }
|
||||
double GetDeltaAngle() const { return dAngle; }
|
||||
double GetAnodeLength() const { return anodeLength; }
|
||||
|
|
@ -94,7 +82,7 @@ public:
|
|||
void ConstructGeo();
|
||||
void FindWireID(TVector3 pos, TVector3 direction, bool verbose = false);
|
||||
void CalTrack(TVector3 sx3Pos, int anodeID, int cathodeID, bool verbose = false);
|
||||
void CalTrack2(TVector3 sx3Pos, TVector3 anodeInt, bool verbose = false);
|
||||
void CalTrack2(TVector3 sx3Pos, PWHitInfo hitInfo, double sigmaA = 0, double sigmaC = 0, bool verbose = false);
|
||||
|
||||
void Print()
|
||||
{
|
||||
|
|
@ -116,10 +104,8 @@ private:
|
|||
TVector3 trackVec;
|
||||
|
||||
const int nWire = 24;
|
||||
const int wireShift = 4;
|
||||
// const float zLen = 380; // mm
|
||||
// const float zLen = 348.6; // mm
|
||||
const float zLen = 174.3 * 2; // mm
|
||||
const int wireShift = 3;
|
||||
const float zLen = 380; // mm
|
||||
const float radiusA = 37;
|
||||
const float radiusC = 43;
|
||||
|
||||
|
|
@ -153,290 +139,34 @@ inline void PW::ConstructGeo()
|
|||
std::pair<TVector3, TVector3> p1; // anode
|
||||
std::pair<TVector3, TVector3> q1; // cathode
|
||||
|
||||
double k = TMath::TwoPi() / 24.; // 48 solder thru holes, wires in every other one
|
||||
double offset_a1 = -6 * k - 4 * k; // -6 to go from 0,0 to 90degree up, and 4 for the wire offset //old version -5 * k - 5 * k;
|
||||
double offset_c1 = -6 * k + k / 2.0; // correct for a half-turn
|
||||
// std::cerr << "Here!" << std::endl;
|
||||
// #include "../scratch/testing.h"
|
||||
double offset_a2 = offset_a1 + wireShift * k;
|
||||
double offset_c2 = offset_c1 - wireShift * k;
|
||||
// anode and cathode start at pos-Y axis and count in right-Hand
|
||||
// anode wire shift is right-hand.
|
||||
// cathode wire shift is left-hand.
|
||||
|
||||
for (int i = 0; i < nWire; i++)
|
||||
{
|
||||
// Anode rotate right-hand coming in towards +z riding with the beam. In this frame, +x is to the right, and +y down
|
||||
// updated Feb 2026, Sudarsan B. Photographs indicate that anode wires twist right handed, as one moves from -z to +z with the convention above
|
||||
// wire indices increase leftward as one moves to +z (hence -k factor), but wires themselves twist rightward - as indicated by offset_a2 being more +ve w.r.t offset_a1
|
||||
//'First' is -z locus, 'second' is +z locus
|
||||
p1.first.SetXYZ(radiusA * TMath::Cos(-k * i + offset_a1),
|
||||
radiusA * TMath::Sin(-k * i + offset_a1),
|
||||
-zLen / 2);
|
||||
p1.second.SetXYZ(radiusA * TMath::Cos(-k * i + offset_a2),
|
||||
radiusA * TMath::Sin(-k * i + offset_a2),
|
||||
+zLen / 2);
|
||||
|
||||
// Cathodes twist left-hand as indicated by offset_c2 being more negative than offset_c1, under the same system, while wires increase rightward (hence +k factor)
|
||||
q1.first.SetXYZ(radiusC * TMath::Cos(k * i + offset_c1),
|
||||
radiusC * TMath::Sin(k * i + offset_c1),
|
||||
-zLen / 2);
|
||||
q1.second.SetXYZ(radiusC * TMath::Cos(k * i + offset_c2),
|
||||
radiusC * TMath::Sin(k * i + offset_c2),
|
||||
zLen / 2);
|
||||
// Anode rotate right-hand
|
||||
p1.first.SetXYZ(radiusA * TMath::Cos(TMath::TwoPi() / nWire * (i) + TMath::PiOver2()),
|
||||
radiusA * TMath::Sin(TMath::TwoPi() / nWire * (i) + TMath::PiOver2()),
|
||||
zLen / 2);
|
||||
p1.second.SetXYZ(radiusA * TMath::Cos(TMath::TwoPi() / nWire * (i + wireShift) + TMath::PiOver2()),
|
||||
radiusA * TMath::Sin(TMath::TwoPi() / nWire * (i + wireShift) + TMath::PiOver2()),
|
||||
-zLen / 2);
|
||||
An.push_back(p1);
|
||||
|
||||
// Cathod rotate left-hand
|
||||
q1.first.SetXYZ(radiusC * TMath::Cos(TMath::TwoPi() / nWire * (i) + TMath::PiOver2()),
|
||||
radiusC * TMath::Sin(TMath::TwoPi() / nWire * (i) + TMath::PiOver2()),
|
||||
zLen / 2);
|
||||
q1.second.SetXYZ(radiusC * TMath::Cos(TMath::TwoPi() / nWire * (i - wireShift) + TMath::PiOver2()),
|
||||
radiusC * TMath::Sin(TMath::TwoPi() / nWire * (i - wireShift) + TMath::PiOver2()),
|
||||
-zLen / 2);
|
||||
Ca.push_back(q1);
|
||||
}
|
||||
|
||||
// Calculate Crossover Geometry ONCE
|
||||
TVector3 a, c, diff;
|
||||
double a2, ac, c2, adiff, cdiff, denom, alpha;
|
||||
|
||||
for (size_t i = 0; i < An.size(); i++)
|
||||
{
|
||||
// a = An[i].first - An[i].second;
|
||||
a = An[i].second - An[i].first;
|
||||
for (size_t j = 0; j < Ca.size(); j++)
|
||||
{
|
||||
c = Ca[j].second - Ca[j].first;
|
||||
diff = An[i].second - Ca[j].second;
|
||||
a2 = a.Dot(a);
|
||||
c2 = c.Dot(c);
|
||||
ac = a.Dot(c);
|
||||
adiff = a.Dot(diff);
|
||||
cdiff = c.Dot(diff);
|
||||
denom = a2 * c2 - ac * ac;
|
||||
alpha = (ac * cdiff - c2 * adiff) / denom;
|
||||
|
||||
Crossover[i][j][0].x = An[i].second.X() + alpha * a.X();
|
||||
Crossover[i][j][0].y = An[i].second.Y() + alpha * a.Y();
|
||||
Crossover[i][j][0].z = An[i].second.Z() + alpha * a.Z();
|
||||
|
||||
if (Crossover[i][j][0].z < -190 || Crossover[i][j][0].z > 190)
|
||||
{
|
||||
// std::cout << "Weird crossover but ok" << std::endl;
|
||||
}
|
||||
if ((i + j) % 24 == 12 || Crossover[i][j][0].z < -190 || Crossover[i][j][0].z > 190)
|
||||
{
|
||||
Crossover[i][j][0].z = 9999999;
|
||||
// std::cout << "Weird crossover" << std::endl;
|
||||
}
|
||||
|
||||
Crossover[i][j][1].x = alpha;
|
||||
Crossover[i][j][1].y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
dAngle = wireShift * TMath::TwoPi() / nWire;
|
||||
anodeLength = TMath::Sqrt(zLen * zLen + TMath::Power(2 * radiusA * TMath::Sin(dAngle / 2), 2));
|
||||
cathodeLength = TMath::Sqrt(zLen * zLen + TMath::Power(2 * radiusC * TMath::Sin(dAngle / 2), 2)); // chord length subtending an angle alpha is 2rsin(alpha/2)
|
||||
}
|
||||
|
||||
inline TVector3 PW::getClosestWirePosAtWirePhi(std::pair<TVector3, TVector3> awire, double sx3phi_radian)
|
||||
{
|
||||
// 1. Get wire geometry
|
||||
TVector3 a1 = awire.first; // Top of the wire
|
||||
TVector3 a2 = awire.second; // Bottom of the wire
|
||||
TVector3 wireVec = a2 - a1; // Vector pointing down the wire
|
||||
|
||||
// Variables to track our minimums during the scan
|
||||
double min_delta_phi = 9999.0;
|
||||
double best_t = -1.0;
|
||||
TVector3 best_pcz_intersect;
|
||||
|
||||
// 2. THE SCAN: Walk down the wire in 1000 tiny steps
|
||||
// (For a 380mm wire, this is checking every 0.38 mm)
|
||||
int num_steps = 1000;
|
||||
for (int i = 0; i <= num_steps; ++i)
|
||||
{
|
||||
double t_test = (double)i / num_steps; // Ranges from 0.0 to 1.0
|
||||
TVector3 test_pt = a1 + t_test * wireVec; // The 3D point at this step
|
||||
|
||||
// Calculate absolute Delta Phi between Si hit and this specific point on the wire
|
||||
if (TMath::IsNaN(sx3phi_radian - test_pt.Phi()))
|
||||
continue;
|
||||
double dPhi = TMath::Abs(TVector2::Phi_mpi_pi(sx3phi_radian - test_pt.Phi())); // Phi_mpi_pi just puts the angle in the range -180 to 180
|
||||
|
||||
// If this is the smallest Delta Phi we've seen so far, save it!
|
||||
if (dPhi < min_delta_phi)
|
||||
{
|
||||
min_delta_phi = dPhi;
|
||||
best_t = t_test;
|
||||
best_pcz_intersect = test_pt;
|
||||
}
|
||||
}
|
||||
return best_pcz_intersect;
|
||||
}
|
||||
|
||||
inline std::vector<std::vector<std::tuple<int, double, double>>>
|
||||
PW::Make_Clusters(std::unordered_map<int, std::tuple<int, double, double>> wireEvents)
|
||||
{
|
||||
std::vector<std::vector<std::tuple<int, double, double>>> wireClusters;
|
||||
std::vector<std::tuple<int, double, double>> wireCluster;
|
||||
// TODO: Write a macro once, call it twice
|
||||
int wirecount = 0;
|
||||
while (wirecount < 24)
|
||||
{
|
||||
if (wireEvents.find(wirecount) == wireEvents.end())
|
||||
{
|
||||
wirecount++;
|
||||
continue;
|
||||
}
|
||||
wireCluster.clear();
|
||||
int ctr2 = wirecount;
|
||||
do
|
||||
{
|
||||
wireCluster.emplace_back(wireEvents[ctr2]);
|
||||
ctr2 += 1;
|
||||
if (ctr2 == 24 || ctr2 - wirecount == 7)
|
||||
break; // loose logic, needs to be looked at.
|
||||
} while (wireEvents.find(ctr2) != wireEvents.end());
|
||||
wireClusters.push_back(std::move(wireCluster));
|
||||
wirecount = ctr2; // we already dealt with wires until the last value of ctr2
|
||||
}
|
||||
|
||||
if (wireClusters.size() > 1)
|
||||
{ // Deal with wraparound if required
|
||||
auto first_cluster = wireClusters.front(); // front and back provide references to the elements themselves. less copy, can modify etc
|
||||
auto last_cluster = wireClusters.back();
|
||||
if (std::get<0>(last_cluster.back()) == 23 && std::get<0>(first_cluster.front()) == 0)
|
||||
{
|
||||
last_cluster.insert(last_cluster.end(), first_cluster.begin(), first_cluster.end());
|
||||
}
|
||||
wireClusters.erase(wireClusters.begin()); // canonically, erase() needs an iterator, hence begin() not front()
|
||||
// TODO: Can also deal with 'gaps' of missing wires similarly. end of one segment and beginning of another segment will be separated by missing wire --> combine the two
|
||||
// TODO: Also needs some development regarding the time-correlation. Don't put wires in the same cluster if they aren't time coincident
|
||||
}
|
||||
return wireClusters;
|
||||
|
||||
/*if(aClusters.size()>1 || cClusters.size() > 1) {
|
||||
std::cout << " ============== " << std::endl;
|
||||
}
|
||||
if(aClusters.size()>1 && cClusters.size() >=1) {
|
||||
std::cout << aClusters.size() << " new anode clusters ----> " << std::endl;
|
||||
int cc=1;
|
||||
for(auto ac : aClusters) {
|
||||
std::cout << " Cluster " << cc << std::endl;
|
||||
double first_ts = std::get<2>(ac.at(0));
|
||||
for(auto item : ac) {
|
||||
std::cout << " \t" << std::get<0>(item) << " " << std::get<1>(item) << " " << std::get<2>(item)-first_ts << std::endl;
|
||||
}
|
||||
std::cout << " ------" << std::endl;
|
||||
cc++;
|
||||
}
|
||||
}
|
||||
|
||||
if(cClusters.size()>=1 ) {
|
||||
std::cout << cClusters.size() << " new cathode clusters ----> " << std::endl;
|
||||
int cc=1;
|
||||
for(auto ac : cClusters) {
|
||||
std::cout << " Cluster " << cc << std::endl;
|
||||
double first_ts = std::get<2>(ac.at(0));
|
||||
for(auto item : ac) {
|
||||
std::cout << " \t" << std::get<0>(item) << " " << std::get<1>(item) << " " << std::get<2>(item)-first_ts << std::endl;
|
||||
}
|
||||
std::cout << " ------" << std::endl;
|
||||
cc++;
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
inline std::tuple<std::pair<TVector3, TVector3>, double, double, double>
|
||||
PW::GetPseudoWire(const std::vector<std::tuple<int, double, double>> &cluster, std::string type)
|
||||
{
|
||||
std::pair<TVector3, TVector3> avgvec = std::pair(TVector3(0, 0, 0), TVector3(0, 0, 0));
|
||||
double sumEnergy = 0;
|
||||
double maxEnergy = 0;
|
||||
double tsMaxEnergy = 0;
|
||||
if (type == "ANODE")
|
||||
{
|
||||
// if(cluster.size()>1) std::cout << " -------anodes" << std::endl;
|
||||
for (auto wire : cluster)
|
||||
{
|
||||
avgvec.first += std::get<1>(wire) * TVector3(An.at(std::get<0>(wire)).first.X(), An.at(std::get<0>(wire)).first.Y(), 0);
|
||||
avgvec.second += std::get<1>(wire) * TVector3(An.at(std::get<0>(wire)).second.X(), An.at(std::get<0>(wire)).second.Y(), 0);
|
||||
sumEnergy += std::get<1>(wire);
|
||||
if (std::get<1>(wire) > maxEnergy)
|
||||
{
|
||||
maxEnergy = std::get<1>(wire);
|
||||
tsMaxEnergy = std::get<2>(wire);
|
||||
}
|
||||
/*if(cluster.size()>1) {
|
||||
std::cout << "\t\t ch:" << std::get<0>(wire) << " " << std::get<1>(wire) << " " << std::get<2>(wire) << std::endl;
|
||||
std::cout << "\t\t w1(r,phi,z):" << An.at(std::get<0>(wire)).first.Perp() << " " << An.at(std::get<0>(wire)).first.Phi()*180/M_PI << " " << An.at(std::get<0>(wire)).first.Z() << std::endl;
|
||||
std::cout << "\t\t w2(r,phi,z):" << An.at(std::get<0>(wire)).second.Perp() << " " << An.at(std::get<0>(wire)).second.Phi()*180/M_PI << " " << An.at(std::get<0>(wire)).second.Z() << std::endl;
|
||||
}*/
|
||||
}
|
||||
avgvec.first = avgvec.first * (1.0 / sumEnergy);
|
||||
avgvec.second = avgvec.second * (1.0 / sumEnergy);
|
||||
double phi1 = avgvec.first.Phi();
|
||||
double phi2 = avgvec.second.Phi();
|
||||
avgvec.first.SetXYZ(radiusA * TMath::Cos(phi1), radiusA * TMath::Sin(phi1), -zLen / 2);
|
||||
avgvec.second.SetXYZ(radiusA * TMath::Cos(phi2), radiusA * TMath::Sin(phi2), zLen / 2);
|
||||
/*if(cluster.size()>1) {
|
||||
std::cout << "\t\t avg1(r,phi,z):" << avgvec.first.Perp() << " " << avgvec.first.Phi()*180/M_PI << " " << avgvec.first.Z() << std::endl;
|
||||
std::cout << "\t\t avg2(r,phi,z):" << avgvec.second.Perp() << " " << avgvec.second.Phi()*180/M_PI << " " << avgvec.second.Z() << std::endl;
|
||||
}*/
|
||||
}
|
||||
else if (type == "CATHODE")
|
||||
{
|
||||
for (auto wire : cluster)
|
||||
{
|
||||
avgvec.first += std::get<1>(wire) * TVector3(Ca.at(std::get<0>(wire)).first.X(), Ca.at(std::get<0>(wire)).first.Y(), 0);
|
||||
avgvec.second += std::get<1>(wire) * TVector3(Ca.at(std::get<0>(wire)).second.X(), Ca.at(std::get<0>(wire)).second.Y(), 0);
|
||||
sumEnergy += std::get<1>(wire);
|
||||
if (std::get<1>(wire) > maxEnergy)
|
||||
{
|
||||
maxEnergy = std::get<1>(wire);
|
||||
tsMaxEnergy = std::get<2>(wire);
|
||||
}
|
||||
}
|
||||
avgvec.first = avgvec.first * (1.0 / sumEnergy);
|
||||
avgvec.second = avgvec.second * (1.0 / sumEnergy);
|
||||
double phi1 = avgvec.first.Phi();
|
||||
double phi2 = avgvec.second.Phi();
|
||||
avgvec.first.SetXYZ(radiusC * TMath::Cos(phi1), radiusC * TMath::Sin(phi1), -zLen / 2);
|
||||
avgvec.second.SetXYZ(radiusC * TMath::Cos(phi2), radiusC * TMath::Sin(phi2), zLen / 2);
|
||||
}
|
||||
return std::tuple(avgvec, sumEnergy, maxEnergy, tsMaxEnergy);
|
||||
}
|
||||
|
||||
inline std::tuple<TVector3, double, double, double, double, double, double, double> PW::FindCrossoverProperties(const std::vector<std::tuple<int, double, double>> &a_cluster,
|
||||
const std::vector<std::tuple<int, double, double>> &c_cluster)
|
||||
{
|
||||
// std::pair<TVector3, TVector3> apwire = GetPseudoWire(a_cluster,"ANODE",anodeSumE);
|
||||
// std::pair<TVector3, TVector3> cpwire = GetPseudoWire(c_cluster,"CATHODE",cathodeSumE);
|
||||
auto [apwire, apSumE, apMaxE, apTSMaxE] = GetPseudoWire(a_cluster, "ANODE");
|
||||
auto [cpwire, cpSumE, cpMaxE, cpTSMaxE] = GetPseudoWire(c_cluster, "CATHODE");
|
||||
|
||||
TVector3 crossover;
|
||||
crossover.Clear();
|
||||
TVector3 a, c, diff;
|
||||
double a2, ac, c2, adiff, cdiff, denom, alpha = 0;
|
||||
|
||||
if (apSumE && cpSumE)
|
||||
{
|
||||
a = apwire.first - apwire.second;
|
||||
c = cpwire.first - cpwire.second;
|
||||
diff = apwire.first - cpwire.first;
|
||||
a2 = a.Dot(a);
|
||||
c2 = c.Dot(c);
|
||||
ac = a.Dot(c);
|
||||
adiff = a.Dot(diff);
|
||||
cdiff = c.Dot(diff);
|
||||
denom = a2 * c2 - ac * ac;
|
||||
alpha = (ac * cdiff - c2 * adiff) / denom;
|
||||
crossover = apwire.first + alpha * a;
|
||||
if (crossover.z() < -190 || crossover.Z() > 190)
|
||||
{
|
||||
alpha = 9999999;
|
||||
apSumE = -1;
|
||||
cpSumE = -1;
|
||||
apMaxE = -1;
|
||||
cpMaxE = -1;
|
||||
apTSMaxE = -1;
|
||||
cpTSMaxE = -1;
|
||||
}
|
||||
}
|
||||
// std::cout << apSumE << " " << cpSumE << " " << " " << crossover.Perp() << std::endl;
|
||||
return std::tuple(crossover, alpha, apSumE, cpSumE, apMaxE, cpMaxE, apTSMaxE, cpTSMaxE);
|
||||
cathodeLength = TMath::Sqrt(zLen * zLen + TMath::Power(2 * radiusC * TMath::Sin(dAngle / 2), 2));
|
||||
}
|
||||
|
||||
inline void PW::FindWireID(TVector3 pos, TVector3 direction, bool verbose)
|
||||
|
|
@ -548,35 +278,43 @@ inline void PW::CalTrack(TVector3 sx3Pos, int anodeID, int cathodeID, bool verbo
|
|||
printf("Theta, Phi = %f, %f \n", trackVec.Theta() * TMath::RadToDeg(), trackVec.Phi() * TMath::RadToDeg());
|
||||
}
|
||||
|
||||
inline void PW::CalTrack2(TVector3 siPos, TVector3 anodeInt, bool verbose)
|
||||
inline void PW::CalTrack2(TVector3 sx3Pos, PWHitInfo hitInfo, double sigmaA, double sigmaC, bool verbose)
|
||||
{
|
||||
|
||||
double mx, my;
|
||||
double z;
|
||||
mx = siPos.X() / (siPos.X() - anodeInt.X());
|
||||
my = siPos.Y() / (siPos.Y() - anodeInt.Y());
|
||||
z = siPos.Z() + mx * (anodeInt.Z() - siPos.Z());
|
||||
// if (mx == my)
|
||||
{
|
||||
trackVec = TVector3(0, 0, z);
|
||||
}
|
||||
trackPos = sx3Pos;
|
||||
|
||||
double p1 = TMath::Abs(hitInfo.nearestDist.first + gRandom->Gaus(0, sigmaA));
|
||||
double p2 = TMath::Abs(hitInfo.nextNearestDist.first + gRandom->Gaus(0, sigmaA));
|
||||
double fracA = p1 / (p1 + p2);
|
||||
short anodeID1 = hitInfo.nearestWire.first;
|
||||
short anodeID2 = hitInfo.nextNearestWire.first;
|
||||
TVector3 shiftA1 = (An[anodeID2].first - An[anodeID1].first) * fracA;
|
||||
TVector3 shiftA2 = (An[anodeID2].second - An[anodeID1].second) * fracA;
|
||||
|
||||
double q1 = TMath::Abs(hitInfo.nearestDist.second + gRandom->Gaus(0, sigmaC));
|
||||
double q2 = TMath::Abs(hitInfo.nextNearestDist.second + gRandom->Gaus(0, sigmaC));
|
||||
double fracC = q1 / (q1 + q2);
|
||||
short cathodeID1 = hitInfo.nearestWire.second;
|
||||
short cathodeID2 = hitInfo.nextNearestWire.second;
|
||||
TVector3 shiftC1 = (Ca[cathodeID2].first - Ca[cathodeID1].first) * fracC;
|
||||
TVector3 shiftC2 = (Ca[cathodeID2].second - Ca[cathodeID1].second) * fracC;
|
||||
|
||||
TVector3 a1 = An[anodeID1].first + shiftA1;
|
||||
TVector3 a2 = An[anodeID1].second + shiftA2;
|
||||
|
||||
TVector3 c1 = Ca[cathodeID1].first + shiftC1;
|
||||
TVector3 c2 = Ca[cathodeID1].second + shiftC2;
|
||||
|
||||
TVector3 n1 = (a1 - a2).Cross((sx3Pos - a2)).Unit();
|
||||
TVector3 n2 = (c1 - c2).Cross((sx3Pos - c2)).Unit();
|
||||
|
||||
// if the handiness of anode and cathode revered, it should be n2 cross n1
|
||||
trackVec = (n2.Cross(n1)).Unit();
|
||||
|
||||
if (verbose)
|
||||
printf("X slope = %f and Y slope = %f \n", mx, my);
|
||||
printf("Theta, Phi = %f, %f \n", trackVec.Theta() * TMath::RadToDeg(), trackVec.Phi() * TMath::RadToDeg());
|
||||
}
|
||||
|
||||
/*inline TVector3 PW::CalTrack3(TVector3 siPos, TVector3 anodeInt, bool verbose)
|
||||
{
|
||||
|
||||
TVector3 v = anodeInt-siPos;
|
||||
double t_minimum = -1.0*(siPos.X()*v.X()+siPos.Y()*v.Y())/(v.X()*v.X()+v.Y()*v.Y());
|
||||
TVector3 vector_closest_to_z = siPos + t_minimum*v;
|
||||
|
||||
return vector_closest_to_z;
|
||||
if (verbose)
|
||||
printf("X slope = %f and Y slope = %f \n", mx, my);
|
||||
}*/
|
||||
|
||||
inline double PW::GetZ0()
|
||||
{
|
||||
|
||||
|
|
@ -585,7 +323,7 @@ inline double PW::GetZ0()
|
|||
double rho = TMath::Sqrt(x * x + y * y);
|
||||
double theta = trackVec.Theta();
|
||||
|
||||
return trackVec.Z();
|
||||
return trackPos.Z() - rho / TMath::Tan(theta);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,355 +0,0 @@
|
|||
#include "fsuReader.h"
|
||||
|
||||
#include "TROOT.h"
|
||||
#include "TSystem.h"
|
||||
#include "TClonesArray.h"
|
||||
#include "TGraph.h"
|
||||
#include "TFile.h"
|
||||
#include "TTree.h"
|
||||
#include "TMacro.h"
|
||||
|
||||
|
||||
#define MAX_MULTI 2000
|
||||
|
||||
struct FileInfo{
|
||||
|
||||
std::string fileName;
|
||||
int fileID;
|
||||
unsigned long hitCount;
|
||||
|
||||
};
|
||||
|
||||
//^#############################################################
|
||||
//^#############################################################
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
printf("=========================================\n");
|
||||
printf("=== *.fsu Events Builder ===\n");
|
||||
printf("=========================================\n");
|
||||
if (argc < 6) {
|
||||
printf("Incorrect number of arguments:\n");
|
||||
printf("%s [timeWindow] [withTrace] [verbose] [batchSize] [inFile1] [inFile2] .... \n", argv[0]);
|
||||
printf(" timeWindow : in ns, -1 = no event building \n");
|
||||
printf(" withTrace : 0 for no trace, 1 for trace \n");
|
||||
printf(" verbose : > 0 for debug \n");
|
||||
printf(" batchSize : the size of hit in a batch \n");
|
||||
printf(" Output file name is contructed from inFile1 \n");
|
||||
printf("\n");
|
||||
printf(" Example: %s 0 0 0 10000 '\\ls -1 *001*.fsu'\n", argv[0]);
|
||||
printf("\n\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
uInt runStartTime = getTime_us();
|
||||
|
||||
///============= read input
|
||||
long timeWindow = atoi(argv[1]);
|
||||
bool traceOn = atoi(argv[2]);
|
||||
unsigned int debug = atoi(argv[3]);
|
||||
unsigned int batchSize = atoi(argv[4]);
|
||||
int nFile = argc - 5;
|
||||
TString inFileName[nFile];
|
||||
for( int i = 0 ; i < nFile ; i++){ inFileName[i] = argv[i+5];}
|
||||
|
||||
/// Form outFileName;
|
||||
TString outFileName = inFileName[0];
|
||||
int pos = outFileName.Last('/');
|
||||
pos = outFileName.Index("_", pos+1); // find next "_"
|
||||
pos = outFileName.Index("_", pos+1); // find next "_"
|
||||
if( nFile == 1 ) pos = outFileName.Index("_", pos+1); // find next "_", S/N
|
||||
outFileName.Remove(pos); // remove the rest
|
||||
outFileName += "_" + std::to_string(timeWindow);
|
||||
outFileName += ".root";
|
||||
printf("-------> Out file name : %s \n", outFileName.Data());
|
||||
printf("========================================= Number of Files : %d \n", nFile);
|
||||
for( int i = 0; i < nFile; i++) printf("%2d | %s \n", i, inFileName[i].Data());
|
||||
printf("=========================================\n");
|
||||
printf(" Time Window = %ld ns = %.1f us\n", timeWindow, timeWindow/1000.);
|
||||
printf(" Include Trace = %s\n", traceOn ? "Yes" : "No");
|
||||
printf(" Debug level = %d\n", debug);
|
||||
printf(" Batch size = %d events/file\n", batchSize);
|
||||
printf(" Max multiplity = %d hits/event (hard coded)\n", MAX_MULTI);
|
||||
printf("========================================= Grouping files\n");
|
||||
|
||||
std::vector<std::vector<FileInfo>> fileGroupList; // fileName and ID = SN * 1000 + index
|
||||
std::vector<FileInfo> fileList;
|
||||
|
||||
unsigned long long int totalHitCount = 0;
|
||||
|
||||
FSUReader * readerA = new FSUReader(inFileName[0].Data(), 1, 1);
|
||||
readerA->ScanNumBlock(0,0);
|
||||
FileInfo fileInfo = {inFileName[0].Data(), readerA->GetSN() * 1000 + readerA->GetFileOrder(), readerA->GetHitCount()};
|
||||
fileList.push_back(fileInfo);
|
||||
totalHitCount += readerA->GetHitCount();
|
||||
|
||||
for( int i = 1; i < nFile; i++){
|
||||
FSUReader * readerB = new FSUReader(inFileName[i].Data(), 1, 0);
|
||||
readerB->ScanNumBlock(0,0);
|
||||
totalHitCount += readerB->GetHitCount();
|
||||
fileInfo = {inFileName[i].Data(), readerB->GetSN() * 1000 + readerB->GetFileOrder(), readerB->GetHitCount()};
|
||||
|
||||
if( readerA->GetSN() == readerB->GetSN() ){
|
||||
fileList.push_back(fileInfo);
|
||||
}else{
|
||||
fileGroupList.push_back(fileList);
|
||||
fileList.clear();
|
||||
fileList.push_back(fileInfo);
|
||||
}
|
||||
|
||||
delete readerA;
|
||||
readerA = readerB;
|
||||
}
|
||||
fileGroupList.push_back(fileList);
|
||||
delete readerA;
|
||||
|
||||
printf("======================= total Hit Count : %llu\n", totalHitCount);
|
||||
|
||||
for( size_t i = 0; i < fileGroupList.size(); i++){
|
||||
printf("group ----- %ld \n", i);
|
||||
|
||||
//sort by ID
|
||||
std::sort(fileGroupList[i].begin(), fileGroupList[i].end(), [](const FileInfo & a, const FileInfo & b) {
|
||||
return a.fileID < b.fileID;
|
||||
});
|
||||
|
||||
for( size_t j = 0; j < fileGroupList[i].size(); j++){
|
||||
printf("%3ld | %8d | %9lu| %s \n", j, fileGroupList[i][j].fileID, fileGroupList[i][j].hitCount, fileGroupList[i][j].fileName.c_str() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// //*====================================== create tree
|
||||
TFile * outRootFile = new TFile(outFileName, "recreate");
|
||||
TTree * tree = new TTree("tree", outFileName);
|
||||
|
||||
unsigned long long evID = 0;
|
||||
unsigned int multi = 0;
|
||||
unsigned short sn[MAX_MULTI] = {0}; /// board SN
|
||||
unsigned short ch[MAX_MULTI] = {0}; /// chID
|
||||
unsigned short e[MAX_MULTI] = {0}; /// 15 bit
|
||||
unsigned short e2[MAX_MULTI] = {0}; /// 15 bit
|
||||
unsigned long long e_t[MAX_MULTI] = {0}; /// timestamp 47 bit
|
||||
unsigned short e_f[MAX_MULTI] = {0}; /// fine time 10 bit
|
||||
unsigned short traceLength[MAX_MULTI];
|
||||
|
||||
tree->Branch("evID", &evID, "event_ID/l");
|
||||
tree->Branch("multi", &multi, "multi/i");
|
||||
tree->Branch("sn", sn, "sn[multi]/s");
|
||||
tree->Branch("ch", ch, "ch[multi]/s");
|
||||
tree->Branch("e", e, "e[multi]/s");
|
||||
tree->Branch("e2", e2, "e2[multi]/s");
|
||||
tree->Branch("e_t", e_t, "e_timestamp[multi]/l");
|
||||
tree->Branch("e_f", e_f, "e_fineTime[multi]/s");
|
||||
tree->Branch("traceLength", traceLength, "traceLength[multi]/s");
|
||||
|
||||
TClonesArray * arrayTrace = nullptr;
|
||||
TGraph * trace = nullptr;
|
||||
|
||||
if( traceOn ) {
|
||||
arrayTrace = new TClonesArray("TGraph");
|
||||
tree->Branch("trace", arrayTrace, 2560000);
|
||||
arrayTrace->BypassStreamer();
|
||||
}
|
||||
|
||||
//*======================================= Open files
|
||||
printf("========================================= Open files & Build Events.\n");
|
||||
|
||||
const short nGroup = fileGroupList.size();
|
||||
std::vector<Hit> hitList[nGroup];
|
||||
|
||||
FSUReader ** reader = new FSUReader * [nGroup];
|
||||
ulong ID[nGroup];
|
||||
for( short i = 0; i < nGroup; i++){
|
||||
std::vector<std::string> fList;
|
||||
for( size_t j = 0; j < fileGroupList[i].size(); j++){
|
||||
fList.push_back( fileGroupList[i][j].fileName );
|
||||
}
|
||||
reader[i] = new FSUReader(fList, 600, debug);
|
||||
hitList[i] = reader[i]->ReadBatch(batchSize, debug );
|
||||
reader[i]->PrintHitListInfo(&hitList[i], "hitList-" + std::to_string(reader[i]->GetSN()));
|
||||
ID[i] = 0;
|
||||
if( debug ) {
|
||||
|
||||
for( size_t p = 0; p < 10; p ++ ){
|
||||
if( hitList[i].size() <= p ) break;
|
||||
hitList[i][p].Print();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
unsigned long long tStart = 0;
|
||||
unsigned long long tEnd = 0;
|
||||
|
||||
//find earliest time group;
|
||||
unsigned long long t0 = -1;
|
||||
short g0 = 0 ;
|
||||
for( short i = 0; i < nGroup; i++){
|
||||
if( hitList[i].size() == 0 ) continue;
|
||||
if( hitList[i][0].timestamp < t0 ) {
|
||||
t0 = hitList[i][0].timestamp;
|
||||
g0 = i;
|
||||
}
|
||||
}
|
||||
tStart = t0;
|
||||
if( debug ) printf("First timestamp is %llu, group : %u\n", t0, g0);
|
||||
|
||||
int nFileFinished = 0;
|
||||
multi = 0;
|
||||
evID = 0;
|
||||
std::vector<Hit> events;
|
||||
|
||||
unsigned long long hitProcessed = 0;
|
||||
|
||||
do{
|
||||
|
||||
//*============= Build events from hitList[i]
|
||||
if( debug ) printf("################################ ev build %llu \n", evID);
|
||||
events.clear();
|
||||
|
||||
for( short i = 0; i < nGroup; i++){
|
||||
short ig = (i + g0 ) % nGroup;
|
||||
|
||||
if( hitList[ig].size() == 0 ) continue;
|
||||
|
||||
//chekc if reached the end of hitList
|
||||
if( ID[ig] >= hitList[ig].size() ) {
|
||||
hitList[ig] = reader[ig]->ReadBatch(batchSize, debug + 1);
|
||||
if( debug ) reader[ig]->PrintHitListInfo( &hitList[ig], "hitList-" + std::to_string(ig));
|
||||
ID[ig] = 0;
|
||||
if( hitList[ig].size() == 0 ) continue;
|
||||
}
|
||||
|
||||
if( timeWindow >= 0 ){
|
||||
|
||||
do{
|
||||
|
||||
if( (long int)(hitList[ig].at(ID[ig]).timestamp - t0) <= timeWindow ){
|
||||
events.push_back(hitList[ig].at(ID[ig]));
|
||||
ID[ig] ++;
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
|
||||
//check if reached the end of hitList
|
||||
if( ID[ig] >= hitList[ig].size() ) {
|
||||
hitList[ig] = reader[ig]->ReadBatch(batchSize, debug);
|
||||
if( debug ) reader[ig]->PrintHitListInfo( &hitList[ig], "hitList-" + std::to_string(ig));
|
||||
ID[ig] = 0;
|
||||
if( hitList[ig].size() == 0 ) break;
|
||||
}
|
||||
|
||||
}while(ID[ig] < hitList[ig].size());
|
||||
|
||||
}else{
|
||||
events.push_back(hitList[ig].at(ID[ig]));
|
||||
ID[ig] ++;
|
||||
}
|
||||
|
||||
if( timeWindow < 0) break;
|
||||
|
||||
}
|
||||
|
||||
if( events.size() > 1 ){
|
||||
std::sort(events.begin(), events.end(), [](const Hit& a, const Hit& b) {
|
||||
return a.timestamp < b.timestamp;
|
||||
});
|
||||
}
|
||||
|
||||
tEnd = events.back().timestamp;
|
||||
|
||||
hitProcessed += events.size();
|
||||
if( hitProcessed % 10000 == 0 ) printf("hit Porcessed %llu/%llu hit....%.2f%%\n\033[A\r", hitProcessed, totalHitCount, hitProcessed*100./totalHitCount);
|
||||
|
||||
|
||||
multi = events.size() ;
|
||||
if( events.size() >= MAX_MULTI ) {
|
||||
printf("event %lld has size = %d > MAX_MULTI = %d\n", evID, multi, MAX_MULTI);
|
||||
multi = MAX_MULTI;
|
||||
}
|
||||
if( debug ) printf("=================================== filling data | %u \n", multi);
|
||||
for( size_t p = 0; p < multi ; p ++ ) {
|
||||
if( debug ) {printf("%4zu | ", p); events[p].Print();}
|
||||
|
||||
sn[p] = events[p].sn;
|
||||
ch[p] = events[p].ch;
|
||||
e[p] = events[p].energy;
|
||||
e2[p] = events[p].energy2;
|
||||
e_t[p] = events[p].timestamp;
|
||||
e_f[p] = events[p].fineTime;
|
||||
|
||||
traceLength[p] = events[p].traceLength;
|
||||
if( traceOn ){
|
||||
trace = (TGraph *) arrayTrace->ConstructedAt(multi, "C");
|
||||
trace->Clear();
|
||||
for( int hh = 0; hh < traceLength[multi]; hh++){
|
||||
trace->SetPoint(hh, hh, events[p].trace[hh]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
outRootFile->cd();
|
||||
tree->Fill();
|
||||
// tree->Write();
|
||||
multi = 0;
|
||||
evID ++;
|
||||
|
||||
///===================== find the next first timestamp
|
||||
t0 = -1;
|
||||
g0 = -1;
|
||||
|
||||
for( int i = 0; i < nGroup; i++) {
|
||||
if( hitList[i].size() == 0 ) continue;
|
||||
if( hitList[i][ID[i]].timestamp < t0 ) {
|
||||
t0 = hitList[i][ID[i]].timestamp;
|
||||
g0 = i;
|
||||
}
|
||||
}
|
||||
if( debug ) printf("Next First timestamp is %llu, group : %u\n", t0, g0);
|
||||
|
||||
//*=============
|
||||
nFileFinished = 0;
|
||||
for( int i = 0 ; i < nGroup; i++) {
|
||||
if( hitList[i].size() == 0 ) {
|
||||
nFileFinished ++;
|
||||
continue;
|
||||
}else{
|
||||
if( ID[i] >= hitList[i].size( )) {
|
||||
hitList[i] = reader[i]->ReadBatch(batchSize, debug);
|
||||
ID[i] = 0;
|
||||
if( hitList[i].size() == 0 ) nFileFinished ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( debug > 1 ) printf("========== nFileFinished : %d\n", nFileFinished);
|
||||
|
||||
}while( nFileFinished < nGroup);
|
||||
|
||||
tree->Write();
|
||||
|
||||
uInt runEndTime = getTime_us();
|
||||
double runTime = (runEndTime - runStartTime) * 1e-6;
|
||||
printf("========================================= finished.\n");
|
||||
printf(" event building time = %.2f sec = %.2f min\n", runTime, runTime/60.);
|
||||
printf(" total events built = %llu by event builder (%llu in tree)\n", evID, tree->GetEntriesFast());
|
||||
double tDuration_sec = (tEnd - tStart) * 1e-9;
|
||||
printf(" first timestamp = %20llu ns\n", tStart);
|
||||
printf(" last timestamp = %20llu ns\n", tEnd);
|
||||
printf(" total data duration = %.2f sec = %.2f min\n", tDuration_sec, tDuration_sec/60.);
|
||||
printf("==============> saved to %s \n", outFileName.Data());
|
||||
|
||||
TMacro info;
|
||||
info.AddLine(Form("tStart= %20llu ns",tStart));
|
||||
info.AddLine(Form(" tEnd= %20llu ns",tEnd));
|
||||
info.Write("info");
|
||||
|
||||
outRootFile->Close();
|
||||
|
||||
for( int i = 0; i < nGroup; i++) delete reader[i];
|
||||
delete [] reader;
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1,416 +0,0 @@
|
|||
#ifndef HISTPLOTTER_H
|
||||
#define HISTPLOTTER_H
|
||||
#include <TCanvas.h>
|
||||
#include <TROOT.h>
|
||||
#include <TSystem.h>
|
||||
#include <TStyle.h>
|
||||
#include <iostream>
|
||||
#include <TFile.h>
|
||||
#include <TMemFile.h>
|
||||
#include <TH1.h>
|
||||
#include <TH2.h>
|
||||
#include <TCutG.h>
|
||||
#include <signal.h>
|
||||
#include <cstdlib>
|
||||
#include <utility>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <unordered_map>
|
||||
#include <set>
|
||||
#include <TGraphErrors.h>
|
||||
|
||||
class HistPlotter {
|
||||
private:
|
||||
long long barrier_count, barrier_limit; //meant to keep track of how often to call FillN() on histograms
|
||||
enum {TFILE, TMEMFILE} filetype;
|
||||
std::unordered_map<std::string,TObject*> oMap; //!< Maps std::string to all TH1, TH2 objects in the class
|
||||
std::unordered_map<std::string,TObject*> cutsMap; //!< Maps std::string to TCutG objects held by the class
|
||||
std::set<std::string> folderList; //!< List of all folder names used to nest objects
|
||||
std::unordered_map<TObject*,std::string> foldersForObjects; //!< Map that returns the folder corresponding to the object whose pointer is specified
|
||||
TFile *ofile=nullptr; //!< TFile pointer for the output file
|
||||
TMemFile *omfile=nullptr; //!< TFile pointer for the output memfile
|
||||
|
||||
//Caches to permit FillN() calls
|
||||
std::unordered_map<std::string, std::vector<double>> onedimcache;
|
||||
std::unordered_map<std::string, std::pair<std::vector<double>, std::vector<double>>> twodimcache;
|
||||
inline void FillN_All_Histograms();
|
||||
public:
|
||||
HistPlotter(std::string outfile, std::string type);
|
||||
inline void FlushToDisk(int integral); //!< Writes all objects to file before closing, nesting objects in folders as is found necessary
|
||||
inline void PrintObjects(); //!< Dump objects to std::cout for inspection
|
||||
inline void ReadCuts(std::string);
|
||||
inline TCutG* FindCut(std::string cut) {
|
||||
return static_cast<TCutG*>(cutsMap.at(cut));
|
||||
}
|
||||
inline void set_barrier_limit(long long limit) { barrier_limit = limit; }
|
||||
inline void barrier_increment() {
|
||||
barrier_count++;
|
||||
if(barrier_count == barrier_limit) {
|
||||
FillN_All_Histograms();
|
||||
barrier_count=0;
|
||||
}
|
||||
}
|
||||
/*! \fn void FindCut()
|
||||
\brief
|
||||
- Searches for a cut by name 'cut' in the internal list of cuts 'cutsMap'. Ugly fails (via unresolved at()) if such a cut isn't found.
|
||||
\param filename - name of the plainxtext file containing the cut file locations and identifiers
|
||||
\return Pointer to the TCutG object that matches the name. Very useful to use this as plotter.FindCut("protonbarrelpid")->IsInside(deltaE, E) for instance.
|
||||
*/
|
||||
|
||||
inline void SetNewTitle(std::string name, std::string title) {
|
||||
auto result = oMap.find(name); //result is an iterator
|
||||
if(result==oMap.end()) return; //no warnings, could be changed in future
|
||||
else
|
||||
static_cast<TNamed*>(oMap.at(name))->SetTitle(title.c_str()); // set new title
|
||||
}
|
||||
|
||||
//Smart functions that create a new histogram if it doesn't exist.
|
||||
inline void FillGraph(const std::string &name, float valuex, float valuey, float errx=0, float erry=0);
|
||||
inline void Fill1D(const std::string& name,int nbinsx, float xlow, float xhigh, float value);
|
||||
inline void Fill2D(const std::string& name,int nbinsx, float xlow, float xhigh
|
||||
,int nbinsy, float ylow, float yhigh, float valuex, float valuey);
|
||||
inline void Fill1D(const std::string& name,int nbinsx, float xlow, float xhigh, float value, const std::string& folder);
|
||||
inline void Fill2D(const std::string& name,int nbinsx, float xlow, float xhigh
|
||||
,int nbinsy, float ylow, float yhigh, float valuex, float valuey, const std::string& folder);
|
||||
//TObject* findObject(std::string key);
|
||||
};
|
||||
|
||||
HistPlotter::HistPlotter(std::string outfile, std::string type="") {
|
||||
/*!
|
||||
\brief Constructor. Opens a TFile instance with the specified filename
|
||||
\param outfile : std::string that holds the desired output ROOT filename
|
||||
\return None
|
||||
*/
|
||||
if(type=="" || type == "TFILE") {
|
||||
ofile = new TFile(outfile.c_str(),"recreate");
|
||||
filetype = TFILE;
|
||||
} else if(type =="TMEMFILE") {
|
||||
omfile = new TMemFile(outfile.c_str(),"recreate");
|
||||
filetype=TMEMFILE;
|
||||
} else {
|
||||
std::cout << "Unknown type "<< type << " specified for HistPlotter (use \"TFILE\" or \"TMEMFILE\"), using default \"TFILE\" " << std::endl;
|
||||
ofile = new TFile(outfile.c_str(),"recreate");
|
||||
filetype = TFILE;
|
||||
}
|
||||
barrier_count=0;
|
||||
barrier_limit=1000;
|
||||
}
|
||||
|
||||
void HistPlotter::FillN_All_Histograms() {
|
||||
for(auto it=oMap.begin(); it!=oMap.end(); it++ ) {
|
||||
//it->first is std::string 'name', it->second is the TObject
|
||||
if(it->second->InheritsFrom("TH1F")) {
|
||||
//FillN(size, array-of-doubles, array-of-weights); //we set array-of-weights to (1,1,1,.. (size)
|
||||
static_cast<TH1F*>(it->second)->FillN(onedimcache[it->first].size(), //size
|
||||
onedimcache[it->first].data(), //array
|
||||
std::vector<double>(onedimcache[it->first].size(),1.0).data()); //weight of ones
|
||||
onedimcache[it->first].clear();
|
||||
} else if(it->second->InheritsFrom("TH2F")) {
|
||||
//FillN(size, array-of-doubles, array-of-weights); //we set array-of-weights to (1,1,1,.. (size))
|
||||
static_cast<TH2F*>(it->second)->FillN(twodimcache[it->first].first.size(), //size
|
||||
twodimcache[it->first].first.data(), //x array
|
||||
twodimcache[it->first].second.data(), //y array
|
||||
std::vector<double>(twodimcache[it->first].first.size(),1.0).data()); //weight of ones
|
||||
twodimcache[it->first].first.clear();
|
||||
twodimcache[it->first].second.clear();
|
||||
}
|
||||
}
|
||||
std::cout << "." << std::endl;
|
||||
}
|
||||
|
||||
void HistPlotter::FlushToDisk(int min_integral=0) {
|
||||
/*! \fn void FlushToDisk()
|
||||
\brief Function that can be used at any point to exit smoothly by saving all ROOT objects in memory
|
||||
to the output file before closing it. Obeys the binding of histograms to separate folders, if so specified.
|
||||
\return No return -- void
|
||||
*/
|
||||
if(filetype==TMEMFILE && omfile) {
|
||||
std::cout << "Not flushing a TMemfile .. exiting .." << std::endl;
|
||||
delete omfile;
|
||||
return;
|
||||
}
|
||||
if(ofile->IsZombie() || !ofile) {
|
||||
std::cerr << "Output file is zombie, finishing up without writing to disk!" << std::endl;
|
||||
return;
|
||||
}
|
||||
FillN_All_Histograms();
|
||||
for(auto it=oMap.begin(); it!=oMap.end(); it++ ) {
|
||||
//omap maps: name(first) to object address(second).
|
||||
// foldersForObjects maps: object address(first) to foldername(second)
|
||||
auto result = foldersForObjects.find(it->second); //returns <TObject* histogram,std::string foldername> pair if found
|
||||
if(result!=foldersForObjects.end()) { //we try to create folder if needed and cd to it
|
||||
ofile->mkdir(result->second.c_str(),"",kTRUE); // args: name, title, returnExistingDirectory
|
||||
ofile->cd(result->second.c_str());
|
||||
} else {
|
||||
ofile->cd(); //toplevel for all default histograms. Default setting
|
||||
}
|
||||
if(((TH1F*)it->second)->Integral()>min_integral)
|
||||
it->second->Write();
|
||||
}
|
||||
|
||||
//Create a directory for all cuts, and save all cuts in them
|
||||
ofile->mkdir("gCUTS","",kTRUE);
|
||||
ofile->cd("gCUTS");
|
||||
for(auto it=cutsMap.begin(); it!=cutsMap.end(); it++) {
|
||||
(static_cast<TNamed*>(it->second))->SetName(it->first.c_str());
|
||||
it->second->Write();
|
||||
}
|
||||
ofile->Close();
|
||||
std::cout << "Wrote " << oMap.size() << " histograms to TFile " << std::string(ofile->GetName()) << std::endl;
|
||||
}
|
||||
|
||||
void HistPlotter::FillGraph(const std::string& name, float valuex, float valuey, float errx, float erry) {
|
||||
/*! \fn void FillGraph()
|
||||
\brief
|
||||
- Creates a TGraphError in memory with name 'name' if it doesn't exist, and fills it with valuex, valuey
|
||||
- Writes present state to disk and fails with return value -1 if the name clashes with another object that's not of type TGraph*
|
||||
|
||||
\param name name of the TGraph
|
||||
\param valuex The xvalue
|
||||
\param valuey The yvalue
|
||||
\param errx The x error
|
||||
\param erry The y error
|
||||
\return No return void
|
||||
*/
|
||||
auto result = oMap.find(name);
|
||||
if(result==oMap.end()) {
|
||||
TGraphErrors *tempG = new TGraphErrors();
|
||||
tempG->SetName(name.c_str());
|
||||
oMap.insert(std::make_pair(name,static_cast<TObject*>(tempG)));
|
||||
}
|
||||
if(!oMap.at(name)->InheritsFrom("TGraphErrors")) {
|
||||
std::cerr << "Object " << name << " refers to something other than a TGraph*, not filling it hence!" << std::endl;
|
||||
std::cerr << "Abort.." << std::endl;
|
||||
FlushToDisk();
|
||||
exit(-1);
|
||||
}
|
||||
// static_cast<TGraphErrors*>(oMap.at(name))->AddPointError(valuex,valuey,errx,erry);
|
||||
}
|
||||
|
||||
void HistPlotter::Fill1D(const std::string& name, int nbinsx, float xlow, float xhigh, float value) {
|
||||
/*! \fn void Fill1D()
|
||||
\brief
|
||||
- Creates a TH1F in memory with name 'name' if it doesn't exist, and fills it with valuex, valuey
|
||||
- Writes present state to disk and fails with return value -1 if the name clashes with another object that's not of type TH1*
|
||||
|
||||
\param name name of the TH1F histogram
|
||||
\param nbinsx Number of bins in the histogram
|
||||
\param xlow Lower limit on x-axis
|
||||
\param xhigh Upper limit on x-axis
|
||||
\param value The bin corresponding to value in (nbinsx, xlow, xhigh) is incremented by 1
|
||||
\return No return void
|
||||
*/
|
||||
auto result = oMap.find(name); //result is an iterator
|
||||
if(result==oMap.end()) {
|
||||
TH1F* temp1D = new TH1F(name.c_str(), name.c_str(), nbinsx, xlow, xhigh);
|
||||
oMap.insert(std::make_pair(name,static_cast<TObject*>(temp1D)));
|
||||
onedimcache.insert(std::make_pair(name, std::vector<double>()));
|
||||
onedimcache[name].reserve(16384);
|
||||
} else if(foldersForObjects.find(oMap.at(name))!=foldersForObjects.end()) { //shouldn't have a folder associated with it
|
||||
std::cerr << "Object " << name << " already registered at " << foldersForObjects[oMap[name]] << ", choose a different name for the histogram to be stored in toplevel .." << std::endl;
|
||||
}
|
||||
|
||||
//Check if the string 'name' maps to a 1D hist. If there's any other object by this name raise issue
|
||||
if(!oMap.at(name)->InheritsFrom("TH1F")) {
|
||||
std::cerr << "Object " << name << " refers to something other than a TH1*, not filling it hence!" << std::endl;
|
||||
std::cerr << "Abort.." << std::endl;
|
||||
FlushToDisk();
|
||||
exit(-1);
|
||||
}
|
||||
onedimcache[name].emplace_back(value);
|
||||
//static_cast<TH1F*>(oMap.at(name))->Fill(value);
|
||||
}
|
||||
|
||||
void HistPlotter::Fill1D(const std::string& name, int nbinsx, float xlow, float xhigh, float value, const std::string& foldername) {
|
||||
/*! \fn void Fill1D()
|
||||
\brief
|
||||
- Creates a TH1F in memory with name 'name' if it doesn't exist, and fills it with valuex, valuey
|
||||
- Writes present state to disk and fails with return value -1 if the name clashes with another object that's not of type TH1*
|
||||
- Remembers the foldername this particular histogram maps to, if provided. If not, defaults to toplevel.
|
||||
|
||||
\param name name of the TH1F histogram
|
||||
\param nbinsx Number of bins in the histogram
|
||||
\param xlow Lower limit on x-axis
|
||||
\param xhigh Upper limit on x-axis
|
||||
\param value The bin corresponding to value in (nbinsx, xlow, xhigh) is incremented by 1
|
||||
\param foldername Name of the folder to put this histogram into. Defaults to toplevel if left empty
|
||||
\return No return -- void
|
||||
*/
|
||||
|
||||
auto result = oMap.find(name); //result is an iterator
|
||||
if(result==oMap.end()) {
|
||||
TH1F* temp1D = new TH1F(name.c_str(), name.c_str(), nbinsx, xlow, xhigh);
|
||||
oMap.insert(std::make_pair(name,static_cast<TObject*>(temp1D)));
|
||||
onedimcache.insert(std::make_pair(name, std::vector<double>()));
|
||||
onedimcache[name].reserve(16384);
|
||||
if(foldername!="") {
|
||||
if(folderList.find(foldername)==folderList.end()) {
|
||||
folderList.insert(foldername);
|
||||
}
|
||||
foldersForObjects.insert(std::make_pair(static_cast<TObject*>(temp1D),foldername));
|
||||
}
|
||||
} else {
|
||||
//object is present in map, but we enforce unique names
|
||||
//it must already have a folder attached to it
|
||||
if(foldersForObjects.find(oMap.at(name))==foldersForObjects.end()) {
|
||||
std::cerr << "Object " << name << " already registered at toplevel, choose a different name for the histogram to be stored in " << foldername << " folder .." << std::endl;
|
||||
} else if(foldersForObjects[oMap[name]]!=foldername) {
|
||||
std::cerr << "Object " << name << " already registered at " << foldersForObjects[oMap[name]] << ", choose a different name for the histogram to be stored in " << foldername << " folder .." << std::endl;
|
||||
}
|
||||
}
|
||||
//Check if the string 'name' maps to a 1D hist. If there's any other object by this name raise issue
|
||||
if(!oMap.at(name)->InheritsFrom("TH1F")) {
|
||||
std::cerr << "Object " << name << " refers to something other than a TH1*, not filling it hence!" << std::endl;
|
||||
std::cerr << "Abort.." << std::endl;
|
||||
FlushToDisk();
|
||||
exit(-1);
|
||||
}
|
||||
onedimcache[name].emplace_back(value);
|
||||
//static_cast<TH1F*>(oMap.at(name))->Fill(value);
|
||||
}
|
||||
|
||||
void HistPlotter::Fill2D(const std::string& name, int nbinsx, float xlow, float xhigh, int nbinsy, float ylow, float yhigh, float valuex, float valuey) {
|
||||
/*! \fn void Fill2D()
|
||||
\brief
|
||||
- Creates a TH2F in memory with name 'name' if it doesn't exist, and fills it with valuex, valuey
|
||||
- Writes present state to disk and fails with return value -1 if the name clashes with another object that's not of type TH2*
|
||||
\param name name of the TH1F histogram
|
||||
\param nbinsx Number of xbins in the histogram
|
||||
\param xlow Lower limit on x-axis
|
||||
\param xhigh Upper limit on x-axis
|
||||
\param nbinsy Number of ybins in the histogram
|
||||
\param ylow Lower limit on y-axis
|
||||
\param yhigh Upper limit on y-axis
|
||||
\param valuex
|
||||
\param valuey The bin corresponding to (valuex, valuey) in (nbinsx, xlow, xhigh, ybinsx, ylow, yhigh) is incremented by 1
|
||||
\return No return -- void
|
||||
*/
|
||||
|
||||
auto result = oMap.find(name); //result is an iterator
|
||||
if(result==oMap.end()) {
|
||||
TH2F* temp2D = new TH2F(name.c_str(), name.c_str(), nbinsx, xlow, xhigh, nbinsy, ylow, yhigh);
|
||||
oMap.insert(std::make_pair(name,static_cast<TObject*>(temp2D)));
|
||||
twodimcache.insert(std::make_pair(name, std::make_pair(std::vector<double>(),std::vector<double>())));
|
||||
twodimcache[name].first.reserve(16384);
|
||||
twodimcache[name].second.reserve(16384);
|
||||
} else if(foldersForObjects.find(oMap.at(name))!=foldersForObjects.end()) { //shouldn't have a folder associated with it
|
||||
std::cerr << "Object " << name << " already registered at " << foldersForObjects[oMap[name]] << ", choose a different name for the histogram to be stored in toplevel .." << std::endl;
|
||||
}
|
||||
|
||||
//Check if the string 'name' maps to a 1D hist. If there's any other object by this name raise issue
|
||||
if(!oMap.at(name)->InheritsFrom("TH2F")) {
|
||||
std::cerr << "Object " << name << " refers to something other than a TH2*, not filling it hence!" << std::endl;
|
||||
std::cerr << "Abort.." << std::endl;
|
||||
FlushToDisk();
|
||||
exit(-1);
|
||||
}
|
||||
twodimcache[name].first.emplace_back(valuex);
|
||||
twodimcache[name].second.emplace_back(valuey);
|
||||
//static_cast<TH2F*>(oMap.at(name))->Fill(valuex,valuey);
|
||||
}
|
||||
|
||||
void HistPlotter::Fill2D(const std::string& name, int nbinsx, float xlow, float xhigh, int nbinsy, float ylow, float yhigh, float valuex, float valuey, const std::string& foldername) {
|
||||
/*! \fn void Fill2D()
|
||||
\brief
|
||||
- Creates a TH2F in memory with name 'name' if it doesn't exist, and fills it with valuex, valuey
|
||||
- Writes present state to disk and fails with return value -1 if the name clashes with another object that's not of type TH2*
|
||||
- Remembers the foldername this particular histogram maps to, if provided. If not defaults to toplevel
|
||||
|
||||
\param name name of the TH1F histogram
|
||||
\param nbinsx Number of xbins in the histogram
|
||||
\param xlow Lower limit on x-axis
|
||||
\param xhigh Upper limit on x-axis
|
||||
\param nbinsy Number of ybins in the histogram
|
||||
\param ylow Lower limit on y-axis
|
||||
\param yhigh Upper limit on y-axis
|
||||
\param valuex
|
||||
\param valuey The bin corresponding to (valuex, valuey) in (nbinsx, xlow, xhigh, ybinsx, ylow, yhigh) is incremented by 1
|
||||
\param foldername Name of the folder to put this histogram into. Defaults to toplevel if left empty
|
||||
\return No return -- void
|
||||
*/
|
||||
|
||||
auto result = oMap.find(name); //result is an iterator
|
||||
if(result==oMap.end()) {
|
||||
TH2F* temp2D = new TH2F(name.c_str(), name.c_str(), nbinsx, xlow, xhigh, nbinsy, ylow, yhigh);
|
||||
oMap.insert(std::make_pair(name,static_cast<TObject*>(temp2D)));
|
||||
twodimcache.insert(std::make_pair(name, std::make_pair(std::vector<double>(),std::vector<double>())));
|
||||
twodimcache[name].first.reserve(16384);
|
||||
twodimcache[name].second.reserve(16384);
|
||||
if(foldername!="") {
|
||||
if(folderList.find(foldername)==folderList.end()) {
|
||||
folderList.insert(foldername);
|
||||
}
|
||||
foldersForObjects.insert(std::make_pair(static_cast<TObject*>(temp2D),foldername));
|
||||
}
|
||||
} else {
|
||||
//object is present in map, but we enforce unique names
|
||||
//it must already have a folder attached to it
|
||||
if(foldersForObjects.find(oMap.at(name))==foldersForObjects.end()) {
|
||||
std::cerr << "Object " << name << " already registered at toplevel, choose a different name for the histogram to be stored in " << foldername << " folder .." << std::endl;
|
||||
} else if(foldersForObjects[oMap.at(name)]!=foldername) {
|
||||
std::cerr << "Object " << name << " already registered at " << foldersForObjects[oMap[name]] << ", choose a different name for the histogram to be stored in " << foldername << " folder .." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
//Check if the string 'name' maps to a 1D hist. If there's any other object by this name raise issue
|
||||
if(!oMap.at(name)->InheritsFrom("TH2F")) {
|
||||
std::cerr << "Object " << name << " refers to something other than a TH2*, not filling it hence!" << std::endl;
|
||||
std::cerr << "Abort.." << std::endl;
|
||||
FlushToDisk();
|
||||
exit(-1);
|
||||
}
|
||||
twodimcache[name].first.emplace_back(valuex);
|
||||
twodimcache[name].second.emplace_back(valuey);
|
||||
//static_cast<TH2F*>(oMap.at(name))->Fill(valuex,valuey);
|
||||
}
|
||||
|
||||
void HistPlotter::ReadCuts(std::string filename) {
|
||||
/*! \fn void ReadCuts()
|
||||
\brief Reads a list of cuts from a file. The file must have the format below, two columns
|
||||
- Column#1 - path to a file that contains a single TCutG object named "CUTG", the default name in ROOT.
|
||||
- Column#2 - The identifier name you plan to use in the code, like 'protonbarrelpid' or something, that will be searched by FindCut()
|
||||
\param filename name of the plainxtext file containing the cut file locations and identifiers
|
||||
\return No return -- void
|
||||
*/
|
||||
|
||||
std::ifstream infile;
|
||||
infile.open(filename);
|
||||
std::string cutfilename, cutname;
|
||||
for(std::string line; std::getline(infile, line); ) {
|
||||
if(line.size()!=0 && line[0]=='#')
|
||||
; //don't do anything with '#' lines
|
||||
else {
|
||||
std::stringstream ss(line);
|
||||
ss>>cutfilename>>cutname;
|
||||
|
||||
TFile f(cutfilename.c_str());
|
||||
if(f.IsZombie()) {
|
||||
std::cerr << "Cannot open cutfile " << cutfilename << " .. skipping.." << std::endl;
|
||||
continue;
|
||||
}
|
||||
TCutG *cut = (TCutG*)(f.Get("CUTG"));
|
||||
cutsMap.insert(std::make_pair(cutname,static_cast<TObject*>(cut)));
|
||||
f.Close();
|
||||
} //else
|
||||
}//for loop
|
||||
infile.close();
|
||||
}
|
||||
|
||||
void HistPlotter::PrintObjects() {
|
||||
/*
|
||||
void PrintObjects()
|
||||
Prints the contents of the unordered_maps oMap and cutsMap to facilitate debugging
|
||||
|
||||
*/
|
||||
std::cout << "Type | Name " << std::endl;
|
||||
std::cout << "---- | --------------------- " << std::endl;
|
||||
for(auto it=oMap.begin(); it!=oMap.end(); it++ ) {
|
||||
std::cout << it->second->ClassName() << " | "<< it->first << std::endl;
|
||||
}
|
||||
for(auto it=cutsMap.begin(); it!=cutsMap.end(); it++ ) {
|
||||
std::cout << it->second->ClassName() << " | "<< it->first << std::endl;
|
||||
}
|
||||
std::cout << "---- | --------------------- " << std::endl;
|
||||
}
|
||||
|
||||
#endif
|
||||
52
Armory/Hit.h
52
Armory/Hit.h
|
|
@ -1,52 +0,0 @@
|
|||
#ifndef Hit_H
|
||||
#define Hit_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
class Hit{
|
||||
public:
|
||||
unsigned short sn;
|
||||
uint8_t ch;
|
||||
unsigned short energy;
|
||||
unsigned short energy2;
|
||||
unsigned long long timestamp;
|
||||
unsigned short fineTime;
|
||||
bool pileUp;
|
||||
|
||||
unsigned short traceLength;
|
||||
std::vector<short> trace;
|
||||
|
||||
Hit(){
|
||||
Clear();
|
||||
}
|
||||
|
||||
void Clear(){
|
||||
sn = 0;
|
||||
ch = 0;
|
||||
energy = 0;
|
||||
energy2 = 0;
|
||||
timestamp = 0;
|
||||
fineTime = 0;
|
||||
traceLength = 0;
|
||||
pileUp = false;
|
||||
trace.clear();
|
||||
}
|
||||
|
||||
void Print(){
|
||||
printf("(%5d, %2d) %6d %16llu, %6d, %d, %5ld\n", sn, ch, energy, timestamp, fineTime, pileUp, trace.size());
|
||||
}
|
||||
|
||||
void PrintTrace(){
|
||||
for( unsigned short i = 0; i < traceLength; i++){
|
||||
printf("%3u | %6d \n", i, trace[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Define operator< for sorting
|
||||
bool operator<(const Hit& other) const {
|
||||
return timestamp < other.timestamp;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
#include "Kinematics.h"
|
||||
//#include "elastcaller.h"
|
||||
//double Kinematics::getQval(double m1, double m2, double m3, double t1, double t3, double angle3)
|
||||
double Kinematics::getExc(double t3, double angle3)
|
||||
/*
|
||||
\brief Follows convention in Marion, 2013: (1 - beam, 2- target, 3-ejectile, 4-recoil)
|
||||
|
||||
m1 is beam, (typically heavy nucleus)
|
||||
m2 is 'd', (light target)
|
||||
m3 is 'p', (light ejectile mass)
|
||||
t1 is beam kinetic energy,
|
||||
\param t3 lab-kinetic-energy in MeV
|
||||
\param angle3 lab-angle in deg of detected proton (if d,p) or other charged particle
|
||||
\return Excitation energy of the heavy-recoil nucleus in MeV
|
||||
*/
|
||||
{
|
||||
double m1 = m_A;
|
||||
double m2 = m_d;
|
||||
double m3 = m_p;
|
||||
double m4 = m_B;
|
||||
double t1 = E_beam;
|
||||
//t1 = slowitdown("75Ga",t1,"1(12C)2(2H)",1.2);
|
||||
|
||||
m1 *= u_MeV;
|
||||
m2 *= u_MeV;
|
||||
m3 *= u_MeV;
|
||||
m4 *= u_MeV;
|
||||
|
||||
double e1 = m1 + t1;
|
||||
double e3 = m3 + t3;
|
||||
ET = t1 + m1 + m2;
|
||||
double p1 = TMath::Sqrt(t1*t1 + 2*m1*t1);
|
||||
double p3 = TMath::Sqrt(t3*t3 + 2*m3*t3);
|
||||
double cosTheta = TMath::Cos(angle3*TMath::Pi()/180.);
|
||||
// return m1+m2-m3-TMath::Sqrt(m1*m1 + m2*m2 + m3*m3 + 2.*m2*e1 - 2.*e3*(e1+m2)+ 2.*p1*p3*cosTheta);
|
||||
double Q = m1+m2-m3-TMath::Sqrt(m1*m1 + m2*m2 + m3*m3 + 2.*m2*e1 - 2.*e3*(e1+m2)+ 2.*p1*p3*cosTheta);
|
||||
|
||||
Qx = Q;
|
||||
T4 = ET - e3 - (m1+m2-m3-Q);
|
||||
//T4 = slowitdown("75Ga",T4,"1(12C)2(2H)",1.2);
|
||||
P4 = TMath::Sqrt(T4*T4 + 2*m4*T4);
|
||||
|
||||
//this angle will not be affected by eloss
|
||||
theta4 = (180./M_PI)*TMath::ASin((p3/P4)*TMath::Sin(angle3*M_PI/180.));
|
||||
|
||||
// T4-=16.5; //eloss in about 1.4 mg CD2
|
||||
T4-=15.5; //eloss in 1.35 mg CD2 //TODO: actually degrade recoil/ejectiles in target
|
||||
// T4-=14.1; //eloss in about 1.2 mg CD2
|
||||
// T4-=31.7; //eloss in 2.7 mg CD2
|
||||
|
||||
//recalculate everything other than angle with lowered Kinetic energy
|
||||
P4 = TMath::Sqrt(T4*T4 + 2*m4*T4);
|
||||
gamma4 = T4/m4+1.;
|
||||
beta4 = TMath::Sqrt(1. - 1./(gamma4*gamma4));
|
||||
//beta4 = TMath::Sqrt((P4*P4)/(P4*P4 + m4*m4));
|
||||
theta4 = (180./M_PI)*TMath::ASin((p3/P4)*TMath::Sin(angle3*M_PI/180.));
|
||||
|
||||
return Q0 - Q;//Q0 = Q + Exc
|
||||
|
||||
}
|
||||
|
||||
double Kinematics::getBeta4(double t3, double angle3)
|
||||
/*
|
||||
\brief Follows convention in Marion, 2013: (1 - beam, 2- target, 3-ejectile, 4-recoil)
|
||||
|
||||
m1 is beam, (typically heavy nucleus)
|
||||
m2 is 'd', (light target)
|
||||
m3 is 'p', (light ejectile mass)
|
||||
t1 is beam kinetic energy,
|
||||
\param t3 lab-kinetic-energy in MeV
|
||||
\param angle3 lab-angle in deg of detected proton (if d,p) or other charged particle
|
||||
\return doppler-shift beta (=v/c) of the heavy-recoil nucleus, calls getExc() to fill the value
|
||||
*/
|
||||
{
|
||||
getExc(t3, angle3);
|
||||
return beta4;
|
||||
}
|
||||
|
||||
double Kinematics::getBrho(double t3, double angle3, double charge_state) {
|
||||
/*
|
||||
\brief Follows convention in Marion, 2013: (1 - beam, 2- target, 3-ejectile, 4-recoil)
|
||||
|
||||
m1 is beam, (typically heavy nucleus)
|
||||
m2 is 'd', (light target)
|
||||
m3 is 'p', (light ejectile mass)
|
||||
t1 is beam kinetic energy,
|
||||
\param t3 lab-kinetic-energy in MeV
|
||||
\param angle3 lab-angle in deg of detected proton (if d,p) or other charged particle
|
||||
\param charge_state charge state of the intended nucleus, in units of elementary charge (= +1 for H+, +2 for He2+ etc).
|
||||
\return b-rho value, generated from P4*3.3359e-3/charge_state where P4 is 4momentum of heavy-recoil calculated from orruba kinematics
|
||||
*/
|
||||
getExc(t3,angle3);
|
||||
return P4*3.3359e-3/charge_state;
|
||||
}
|
||||
|
||||
double Kinematics::getTheta4(double t3, double angle3) {
|
||||
/*
|
||||
\brief Follows convention in Marion, 2013: (1 - beam, 2- target, 3-ejectile, 4-recoil)
|
||||
|
||||
m1 is beam, (typically heavy nucleus)
|
||||
m2 is 'd', (light target)
|
||||
m3 is 'p', (light ejectile mass)
|
||||
t1 is beam kinetic energy,
|
||||
\param t3 lab-kinetic-energy in MeV
|
||||
\param angle3 lab-angle in deg of detected proton (if d,p) or other charged particle
|
||||
\param charge_state charge state of the intended nucleus, in units of elementary charge (= +1 for H+, +2 for He2+ etc).
|
||||
\return lab theta value of heavy recoil in degrees
|
||||
*/
|
||||
getExc(t3,angle3);
|
||||
return theta4;
|
||||
}
|
||||
|
|
@ -1,207 +0,0 @@
|
|||
#ifndef KINEMATICS_H
|
||||
#define KINEMATICS_H
|
||||
#include <TMath.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <TVector3.h>
|
||||
const double u_MeV = 931.49410372; //u in MeV
|
||||
|
||||
class Kinematics {
|
||||
public:
|
||||
/*
|
||||
A(d,p)B is used as template, with A being beam, and p being ejectile.
|
||||
Always, make m3 the thing you detect, and m1 the beam
|
||||
*/
|
||||
double m_A, m_d, m_p, m_B;
|
||||
double E_beam;
|
||||
|
||||
/**
|
||||
* @{ \name List of funny impossible default values
|
||||
*/
|
||||
/**
|
||||
* \brief Default values used for all the physics values
|
||||
*/
|
||||
double Q0=-9999, Qx=-9999;
|
||||
double P4=-9999, E4=-9999, T4=-9999; //heavy recoil momentum, totE, KE
|
||||
double P3=-9999, E3=-9999, T3=-9999; //light recoil
|
||||
double ET=-9999;
|
||||
double gamma4=-9999, beta4=-9999, theta4=-9999; //theta=heavy-recoil lab angle
|
||||
double brho=-9999;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
Kinematics(double m1, double m2, double m3, double m4, double ebeam) {
|
||||
/*
|
||||
A(d,p)B is used as template, with A being beam, and p being ejectile.
|
||||
Always, make m3 the thing you detect, m2 the target, and m1 the beam
|
||||
|
||||
ebeam is in MeV/u, all others are in amu
|
||||
*/
|
||||
m_A = m1;
|
||||
m_d = m2;
|
||||
m_p = m3, m_B = m4, E_beam = ebeam*m_A;
|
||||
Q0 = (- m_B - m_p + m_d + m_A)*u_MeV;
|
||||
}
|
||||
Kinematics() {}
|
||||
|
||||
void setValues(double m1, double m2, double m3, double m4, double ebeam) {
|
||||
/*
|
||||
Can be used to 'live update' say the beam energy in the case of active target detectors.
|
||||
*/
|
||||
|
||||
m_A = m1;
|
||||
m_d = m2;
|
||||
m_p = m3, m_B = m4, E_beam = ebeam*m_A;
|
||||
Q0 = (- m_B - m_p + m_d + m_A)*u_MeV;
|
||||
//std::cout << "Q0 MeV: " << Q0 << std::endl;
|
||||
}
|
||||
|
||||
void setEBeam(double Ebeam) {E_beam = Ebeam;}
|
||||
|
||||
double getBeta4(double t3, double angle3);
|
||||
double getTheta4(double t3, double angle3);
|
||||
double getBrho(double t3, double angle3, double charge_state);
|
||||
double getExc(double t3, double angle3); //t3 is proton energy detected in ORRUBA, angle3 is proton angle in degrees
|
||||
|
||||
double getBeta4_fromvec(double t3, const TVector3 &pos, const TVector3 &origin) {
|
||||
TVector3 local = pos - origin; //position w.r.t origin
|
||||
float angle = local.Theta()*180./M_PI;
|
||||
return getBeta4(t3, angle);
|
||||
}
|
||||
|
||||
double getExc_fromvec(double t3, const TVector3 &pos, const TVector3 &origin) {
|
||||
TVector3 local = pos - origin; //position w.r.t origin
|
||||
float angle = local.Theta()*180./M_PI;
|
||||
return getExc(t3, angle);
|
||||
}
|
||||
|
||||
void setValuesFromFile(const std::string& filename) {
|
||||
(void) filename;
|
||||
/*std::ifstream in;
|
||||
in.open(filename);
|
||||
if(!in) {
|
||||
std::cerr<< "File not open at " << filename << std::endl;
|
||||
return;
|
||||
}
|
||||
for(std::string line; std::getline(in, line); ) {
|
||||
if(line.size()!=0 && line[0]=='#')
|
||||
; //don't do anything with '#' lines
|
||||
else {
|
||||
std::stringstream ss(line);
|
||||
ss>>m_A>>m_d>>m_p>>m_B>>E_beam;
|
||||
}
|
||||
}
|
||||
in.close();*/
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
//double Kinematics::getQval(double m1, double m2, double m3, double t1, double t3, double angle3)
|
||||
double Kinematics::getExc(double t3, double angle3)
|
||||
/*
|
||||
\brief Follows convention in Marion, 2013: (1 - beam, 2- target, 3-ejectile, 4-recoil)
|
||||
|
||||
m1 is beam, (typically heavy nucleus)
|
||||
m2 is 'd', (light target)
|
||||
m3 is 'p', (light ejectile mass)
|
||||
t1 is beam kinetic energy,
|
||||
|
||||
All calculations are done here, and other wrapper functions written make derived quantities from stuff calculated here.
|
||||
|
||||
\param t3 lab-kinetic-energy in MeV
|
||||
\param angle3 lab-angle in deg of detected proton (if d,p) or other charged particle
|
||||
\return Excitation energy of the heavy-recoil nucleus in MeV
|
||||
*/
|
||||
{
|
||||
double m1 = m_A;
|
||||
double m2 = m_d;
|
||||
double m3 = m_p;
|
||||
double m4 = m_B;
|
||||
double t1 = E_beam;
|
||||
|
||||
m1 *= u_MeV;
|
||||
m2 *= u_MeV;
|
||||
m3 *= u_MeV;
|
||||
m4 *= u_MeV;
|
||||
|
||||
double e1 = m1 + t1;
|
||||
double e3 = m3 + t3;
|
||||
ET = t1 + m1 + m2;
|
||||
double p1 = TMath::Sqrt(t1*t1 + 2*m1*t1);
|
||||
double p3 = TMath::Sqrt(t3*t3 + 2*m3*t3);
|
||||
double cosTheta = TMath::Cos(angle3*TMath::Pi()/180.);
|
||||
// return m1+m2-m3-TMath::Sqrt(m1*m1 + m2*m2 + m3*m3 + 2.*m2*e1 - 2.*e3*(e1+m2)+ 2.*p1*p3*cosTheta);
|
||||
double Q = m1+m2-m3-TMath::Sqrt(m1*m1 + m2*m2 + m3*m3 + 2.*m2*e1 - 2.*e3*(e1+m2)+ 2.*p1*p3*cosTheta);
|
||||
|
||||
Qx = Q;
|
||||
//Recoil properties just in case it's useful
|
||||
T4 = ET - e3 - (m1+m2-m3-Q);
|
||||
P4 = TMath::Sqrt(T4*T4 + 2*m4*T4);
|
||||
|
||||
//this angle will not be affected by eloss
|
||||
theta4 = (180./M_PI)*TMath::ASin((p3/P4)*TMath::Sin(angle3*M_PI/180.));
|
||||
|
||||
//recalculate everything other than angle with lowered Kinetic energy
|
||||
P4 = TMath::Sqrt(T4*T4 + 2*m4*T4);
|
||||
gamma4 = T4/m4+1.;
|
||||
beta4 = TMath::Sqrt(1. - 1./(gamma4*gamma4));
|
||||
theta4 = (180./M_PI)*TMath::ASin((p3/P4)*TMath::Sin(angle3*M_PI/180.));
|
||||
|
||||
return Q0 - Q;//Q0 = Q + Exc
|
||||
|
||||
}
|
||||
|
||||
double Kinematics::getBeta4(double t3, double angle3)
|
||||
/*
|
||||
\brief Follows convention in Marion, 2013: (1 - beam, 2- target, 3-ejectile, 4-recoil)
|
||||
|
||||
m1 is beam, (typically heavy nucleus)
|
||||
m2 is 'd', (light target)
|
||||
m3 is 'p', (light ejectile mass)
|
||||
t1 is beam kinetic energy,
|
||||
\param t3 lab-kinetic-energy in MeV
|
||||
\param angle3 lab-angle in deg of detected proton (if d,p) or other charged particle
|
||||
\return doppler-shift beta (=v/c) of the heavy-recoil nucleus, calls getExc() to fill the value
|
||||
*/
|
||||
{
|
||||
getExc(t3, angle3);
|
||||
return beta4;
|
||||
}
|
||||
|
||||
double Kinematics::getBrho(double t3, double angle3, double charge_state) {
|
||||
/*
|
||||
\brief Follows convention in Marion, 2013: (1 - beam, 2- target, 3-ejectile, 4-recoil)
|
||||
|
||||
m1 is beam, (typically heavy nucleus)
|
||||
m2 is 'd', (light target)
|
||||
m3 is 'p', (light ejectile mass)
|
||||
t1 is beam kinetic energy,
|
||||
\param t3 lab-kinetic-energy in MeV
|
||||
\param angle3 lab-angle in deg of detected proton (if d,p) or other charged particle
|
||||
\param charge_state charge state of the intended nucleus, in units of elementary charge (= +1 for H+, +2 for He2+ etc).
|
||||
\return b-rho value, generated from P4*3.3359e-3/charge_state where P4 is 4momentum of heavy-recoil calculated from orruba kinematics
|
||||
*/
|
||||
getExc(t3,angle3);
|
||||
return P4*3.3359e-3/charge_state;
|
||||
}
|
||||
|
||||
double Kinematics::getTheta4(double t3, double angle3) {
|
||||
/*
|
||||
\brief Follows convention in Marion, 2013: (1 - beam, 2- target, 3-ejectile, 4-recoil)
|
||||
|
||||
m1 is beam, (typically heavy nucleus)
|
||||
m2 is 'd', (light target)
|
||||
m3 is 'p', (light ejectile mass)
|
||||
t1 is beam kinetic energy,
|
||||
\param t3 lab-kinetic-energy in MeV
|
||||
\param angle3 lab-angle in deg of detected proton (if d,p) or other charged particle
|
||||
\param charge_state charge state of the intended nucleus, in units of elementary charge (= +1 for H+, +2 for He2+ etc).
|
||||
\return lab theta value of heavy recoil in degrees
|
||||
*/
|
||||
getExc(t3,angle3);
|
||||
return theta4;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
674
Armory/LICENSE
674
Armory/LICENSE
|
|
@ -1,674 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
|
|
@ -10,7 +10,7 @@ COPTS = -fPIC -DLINUX -g -O0 -Wall -std=c++17 -lpthread
|
|||
|
||||
ROOTLIBS = `root-config --cflags --glibs`
|
||||
|
||||
ALL = Mapper EventBuilder#AnasenMS
|
||||
ALL = Mapper AnasenMS
|
||||
|
||||
#########################################################################
|
||||
|
||||
|
|
@ -23,10 +23,6 @@ Mapper : Mapper.cpp ../mapping.h ClassDet.h
|
|||
@echo "--------- making Mapper"
|
||||
$(CC) $(COPTS) -o Mapper Mapper.cpp $(ROOTLIBS)
|
||||
|
||||
# AnasenMS : constant.h Isotope.h ClassTransfer.h ClassSX3.h ClassPW.h ClassAnasen.h anasenMS.cpp
|
||||
# @echo "--------- making ANASEN Monte Carlo"
|
||||
# $(CC) $(COPTS) -o AnasenMS anasenMS.cpp $(ROOTLIBS)
|
||||
|
||||
EventBuilder : EventBuilder.cpp ClassData.h fsuReader.h Hit.h
|
||||
@echo "--------- making EventBuilder"
|
||||
$(CC) $(COPTS) -o EventBuilder EventBuilder.cpp $(ROOTLIBS)
|
||||
AnasenMS : constant.h Isotope.h ClassTransfer.h ClassSX3.h ClassPW.h ClassAnasen.h anasenMS.cpp
|
||||
@echo "--------- making ANASEN Monte Carlo"
|
||||
$(CC) $(COPTS) -o AnasenMS anasenMS.cpp $(ROOTLIBS)
|
||||
|
|
|
|||
|
|
@ -11,14 +11,12 @@
|
|||
#include "ClassDet.h"
|
||||
|
||||
//===============================
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int main(int argc, char **argv){
|
||||
|
||||
printf("=========================================\n");
|
||||
printf("=== Mapper ===\n");
|
||||
printf("=========================================\n");
|
||||
if (argc != 2)
|
||||
{
|
||||
if (argc != 2) {
|
||||
printf("Incorrect number of arguments:\n");
|
||||
printf("%s [inFile]\n", argv[0]);
|
||||
printf("\n\n");
|
||||
|
|
@ -30,37 +28,37 @@ int main(int argc, char **argv)
|
|||
|
||||
PrintMapping();
|
||||
|
||||
TFile *inFile = new TFile(inFileName.c_str(), "READ");
|
||||
TTree *tree = (TTree *)inFile->Get("tree");
|
||||
TFile * inFile = new TFile(inFileName.c_str(), "READ");
|
||||
TTree * tree = (TTree*) inFile->Get("tree");
|
||||
unsigned long long totnumEntry = tree->GetEntries();
|
||||
|
||||
ULong64_t evID;
|
||||
UInt_t multi;
|
||||
UShort_t sn[MAXMULTI];
|
||||
UShort_t ch[MAXMULTI];
|
||||
UShort_t e[MAXMULTI];
|
||||
UShort_t e2[MAXMULTI];
|
||||
ULong64_t e_t[MAXMULTI];
|
||||
UShort_t e_f[MAXMULTI];
|
||||
ULong64_t evID;
|
||||
UInt_t multi;
|
||||
UShort_t sn[MAXMULTI];
|
||||
UShort_t ch[MAXMULTI];
|
||||
UShort_t e[MAXMULTI];
|
||||
UShort_t e2[MAXMULTI];
|
||||
ULong64_t e_t[MAXMULTI];
|
||||
UShort_t e_f[MAXMULTI];
|
||||
|
||||
tree->SetBranchAddress("evID", &evID);
|
||||
tree->SetBranchAddress("evID", &evID);
|
||||
tree->SetBranchAddress("multi", &multi);
|
||||
tree->SetBranchAddress("sn", sn);
|
||||
tree->SetBranchAddress("ch", ch);
|
||||
tree->SetBranchAddress("e", e);
|
||||
tree->SetBranchAddress("e2", e2);
|
||||
tree->SetBranchAddress("e_t", e_t);
|
||||
tree->SetBranchAddress("e_f", e_f);
|
||||
tree->SetBranchAddress("sn", sn);
|
||||
tree->SetBranchAddress("ch", ch);
|
||||
tree->SetBranchAddress("e", e);
|
||||
tree->SetBranchAddress("e2", e2);
|
||||
tree->SetBranchAddress("e_t", e_t);
|
||||
tree->SetBranchAddress("e_f", e_f);
|
||||
|
||||
///================== new tree
|
||||
TString outFileName = inFileName;
|
||||
TString runStr = outFileName;
|
||||
int pos = outFileName.Last('/');
|
||||
pos = outFileName.Index("_", pos + 1); // find next "_"
|
||||
runStr.Remove(0, pos + 1);
|
||||
pos = outFileName.Index("_", pos+1); // find next "_"
|
||||
runStr.Remove(0, pos+1);
|
||||
runStr.Remove(3);
|
||||
pos = outFileName.Index("_", pos + 1); // find next "_"
|
||||
outFileName.Remove(pos); // remove the rest
|
||||
pos = outFileName.Index("_", pos+1); // find next "_"
|
||||
outFileName.Remove(pos); // remove the rest
|
||||
outFileName += "_mapped.root";
|
||||
|
||||
ULong_t eventID;
|
||||
|
|
@ -68,150 +66,117 @@ int main(int argc, char **argv)
|
|||
|
||||
Det sx3;
|
||||
Det qqq;
|
||||
Det pc;
|
||||
Det misc;
|
||||
Det pc ;
|
||||
|
||||
printf(" Raw root file : %s\n", inFileName.c_str());
|
||||
printf(" Run : %03d\n", run);
|
||||
printf(" total Entry : %lld \n", totnumEntry);
|
||||
printf(" Out file name : %s \n", outFileName.Data());
|
||||
|
||||
TFile *saveFile = new TFile(outFileName, "RECREATE");
|
||||
TTree *newTree = new TTree("tree", "tree");
|
||||
TFile * saveFile = new TFile( outFileName,"RECREATE");
|
||||
TTree * newTree = new TTree("tree","tree");
|
||||
|
||||
newTree->Branch("evID", &eventID, "eventID/l");
|
||||
newTree->Branch("run", &run, "run/i");
|
||||
|
||||
newTree->Branch("evID", &eventID,"eventID/l");
|
||||
newTree->Branch("run", &run,"run/i");
|
||||
|
||||
newTree->Branch("sx3Multi", &sx3.multi, "sx3Multi/s");
|
||||
newTree->Branch("sx3ID", &sx3.id, "sx3ID[sx3Multi]/s");
|
||||
newTree->Branch("sx3Ch", &sx3.ch, "sx3Ch[sx3Multi]/s");
|
||||
newTree->Branch("sx3E", &sx3.e, "sx3Energy[sx3Multi]/s");
|
||||
newTree->Branch("sx3T", &sx3.t, "sx3Time[sx3Multi]/l");
|
||||
newTree->Branch("sx3ID", &sx3.id, "sx3ID[sx3Multi]/s");
|
||||
newTree->Branch("sx3Ch", &sx3.ch, "sx3Ch[sx3Multi]/s");
|
||||
newTree->Branch("sx3E", &sx3.e, "sx3Energy[sx3Multi]/s");
|
||||
newTree->Branch("sx3T", &sx3.t, "sx3Time[sx3Multi]/l");
|
||||
|
||||
newTree->Branch("qqqMulti", &qqq.multi, "qqqMulti/s");
|
||||
newTree->Branch("qqqID", &qqq.id, "qqqID[qqqMulti]/s");
|
||||
newTree->Branch("qqqCh", &qqq.ch, "qqqCh[qqqMulti]/s");
|
||||
newTree->Branch("qqqE", &qqq.e, "qqqEnergy[qqqMulti]/s");
|
||||
newTree->Branch("qqqT", &qqq.t, "qqqTime[qqqMulti]/l");
|
||||
newTree->Branch("qqqSN", &qqq.sn, "qqqSN[qqqMulti]/s");
|
||||
newTree->Branch("qqqID", &qqq.id, "qqqID[qqqMulti]/s");
|
||||
newTree->Branch("qqqCh", &qqq.ch, "qqqCh[qqqMulti]/s");
|
||||
newTree->Branch("qqqE", &qqq.e, "qqqEnergy[qqqMulti]/s");
|
||||
newTree->Branch("qqqT", &qqq.t, "qqqTime[qqqMulti]/l");
|
||||
newTree->Branch("qqqSN", &qqq.sn, "qqqSN[qqqMulti]/s");
|
||||
|
||||
newTree->Branch("pcMulti", &pc.multi, "pcMulti/s");
|
||||
newTree->Branch("pcID", &pc.id, "pcID[pcMulti]/s");
|
||||
newTree->Branch("pcCh", &pc.ch, "pcCh[pcMulti]/s");
|
||||
newTree->Branch("pcE", &pc.e, "pcEnergy[pcMulti]/s");
|
||||
newTree->Branch("pcT", &pc.t, "pcTime[pcMulti]/l");
|
||||
|
||||
newTree->Branch("miscMulti", &misc.multi, "miscMulti/s");
|
||||
newTree->Branch("miscID", &misc.id, "miscID[miscMulti]/s");
|
||||
newTree->Branch("miscCh", &misc.ch, "miscCh[miscMulti]/s");
|
||||
newTree->Branch("miscE", &misc.e, "miscEnergy[miscMulti]/s");
|
||||
newTree->Branch("miscT", &misc.t, "miscTime[miscMulti]/l");
|
||||
newTree->Branch("miscF", &misc.tf, "miscFineTime[miscMulti]/l");
|
||||
newTree->Branch("pcID", &pc.id, "pcID[pcMulti]/s");
|
||||
newTree->Branch("pcCh", &pc.ch, "pcCh[pcMulti]/s");
|
||||
newTree->Branch("pcE", &pc.e, "pcEnergy[pcMulti]/s");
|
||||
newTree->Branch("pcT", &pc.t, "pcTime[pcMulti]/l");
|
||||
|
||||
///================== looping old tree and apply mapping
|
||||
|
||||
// clock
|
||||
// TBenchmark clock;
|
||||
// Bool_t shown;
|
||||
//clock
|
||||
// TBenchmark clock;
|
||||
// Bool_t shown;
|
||||
|
||||
for (unsigned long long ev = 0; ev < totnumEntry; ev++)
|
||||
{
|
||||
for( unsigned long long ev = 0; ev < totnumEntry; ev++){
|
||||
tree->GetEntry(ev);
|
||||
|
||||
eventID = evID;
|
||||
sx3.multi = 0;
|
||||
qqq.multi = 0;
|
||||
pc.multi = 0;
|
||||
misc.multi = 0;
|
||||
|
||||
sx3.Clear();
|
||||
sx3.Clear();
|
||||
qqq.Clear();
|
||||
pc.Clear();
|
||||
misc.Clear();
|
||||
pc.Clear();
|
||||
misc.Clear();
|
||||
|
||||
for (unsigned int i = 0; i < multi; i++)
|
||||
{
|
||||
for( unsigned int i = 0; i < multi; i++){
|
||||
|
||||
// printf("%10u/%10u| %5d, %2u, %6u, %14llu\n", i, multi, sn[i], ch[i], e[i], e_t[i] );
|
||||
|
||||
// globalCh = digi-ID * nCh(digi-iD) + ch
|
||||
//globalCh = digi-ID * nCh(digi-iD) + ch
|
||||
int globalCh = -1;
|
||||
|
||||
for (int j = 0; j < nBd; j++)
|
||||
{
|
||||
if (board.at(j) == sn[i])
|
||||
{
|
||||
globalCh = (sn[i] > 1000 ? j * 64 : 7 * 64 + (j - 7) * 16) + ch[i]; //& = number V1740
|
||||
for( int j = 0; j < nBd; j++){
|
||||
if( board.at(j) == sn[i]){
|
||||
globalCh = (sn[i] > 1000 ? j * 64 : 7*64 + (j-7) * 16) + ch[i]; //& = number V1740
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (globalCh == -1)
|
||||
printf("ev %llu\n", ev);
|
||||
if( globalCh == -1) printf("ev %llu\n", ev);
|
||||
|
||||
unsigned short ID = mapping[globalCh];
|
||||
|
||||
//=================================== sx3
|
||||
if (ID < 10000)
|
||||
{
|
||||
if( ID < 10000 ) {
|
||||
sx3.id[sx3.multi] = ID / 100;
|
||||
sx3.ch[sx3.multi] = ID % 100;
|
||||
sx3.e[sx3.multi] = e[i];
|
||||
sx3.t[sx3.multi] = e_t[i];
|
||||
sx3.multi++;
|
||||
sx3.multi ++;
|
||||
}
|
||||
|
||||
//=================================== qqq
|
||||
if (10000 <= ID && ID < 20000)
|
||||
{
|
||||
if( 10000 <= ID && ID < 20000 ) {
|
||||
qqq.id[qqq.multi] = (ID - 10000) / 100;
|
||||
qqq.ch[qqq.multi] = (ID - 10000) % 100;
|
||||
qqq.e[qqq.multi] = e[i];
|
||||
qqq.t[qqq.multi] = e_t[i];
|
||||
qqq.sn[qqq.multi] = sn[i];
|
||||
qqq.multi++;
|
||||
qqq.multi ++;
|
||||
}
|
||||
|
||||
//=================================== pc
|
||||
if (20000 <= ID && ID < 30000)
|
||||
{
|
||||
if( 20000 <= ID && ID < 30000 ) {
|
||||
pc.id[pc.multi] = (ID - 20000) / 100;
|
||||
pc.ch[pc.multi] = (ID - 20000) % 100;
|
||||
pc.e[pc.multi] = e[i];
|
||||
pc.t[pc.multi] = e_t[i];
|
||||
pc.multi++;
|
||||
}
|
||||
|
||||
//=================================== misc
|
||||
if (30000 <= ID && ID < 40000)
|
||||
{
|
||||
misc.id[misc.multi] = (ID - 30000) / 100;
|
||||
misc.ch[misc.multi] = (ID - 30000) % 100;
|
||||
misc.e[misc.multi] = e[i];
|
||||
misc.t[misc.multi] = e_t[i];
|
||||
misc.tf[misc.multi] = e_f[i];
|
||||
// if( ID == 30002 || ID == 30004 ) printf("sn : %d ch: %2d | gID %3d | ID %6d | e_f : %d\n", sn[i], ch[i], globalCh, ID, e_f[i]);
|
||||
misc.multi++;
|
||||
pc.multi ++;
|
||||
}
|
||||
}
|
||||
|
||||
saveFile->cd(); // set focus on this file
|
||||
saveFile->cd(); //set focus on this file
|
||||
newTree->Fill();
|
||||
|
||||
if (eventID % 100 == 0)
|
||||
printf("%6lu/%6llu [%2d%%]\n\033[A\r", eventID, totnumEntry, TMath::Nint((eventID + 1) * 100. / totnumEntry));
|
||||
if( eventID % 100 == 0 ) printf("%6lu/%6llu [%2d%%]\n\033[A\r", eventID, totnumEntry, TMath::Nint((eventID+1)*100./totnumEntry));
|
||||
|
||||
}
|
||||
|
||||
inFile->Close();
|
||||
|
||||
saveFile->cd(); // set focus on this file
|
||||
saveFile->cd(); //set focus on this file
|
||||
newTree->Write();
|
||||
UInt_t eventNumber = newTree->GetEntries();
|
||||
saveFile->Close();
|
||||
printf("-------------- done, %u\n", eventNumber);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
#include <TF1.h>
|
||||
/*double model(double* x, double* p) {
|
||||
double result = x[0];
|
||||
double factor = 29.0;
|
||||
double slope = 0.7;
|
||||
if(TMath::Abs(x[0]) < 16.2) result=x[0]*slope;
|
||||
else if(TMath::Abs(x[0]) < 49.8 ) result=x[0]*slope+TMath::Sign(1.0,x[0])*factor;
|
||||
else if(TMath::Abs(x[0]) < 85.2 ) result=x[0]*slope+TMath::Sign(1.0,x[0])*factor*2;
|
||||
else result=x[0]*slope+TMath::Sign(1.0,x[0])*factor*3;
|
||||
return result;
|
||||
}
|
||||
|
||||
double model_invert(double *y, double *q) {
|
||||
double result=y[0];
|
||||
double slope = 0.7;
|
||||
double factor = 0.0;
|
||||
if(TMath::Abs(y[0]) < 16.2/slope) result = y[0]/slope;
|
||||
else if(TMath::Abs(y[0]) < 49.8/slope ) result=y[0]/slope-TMath::Sign(1.0,y[0])*factor;
|
||||
else if(TMath::Abs(y[0]) < 85.2/slope ) result=y[0]/slope-TMath::Sign(1.0,y[0])*factor*2;
|
||||
else result=y[0]/slope-TMath::Sign(1.0,y[0])*factor*3;
|
||||
return result;
|
||||
}*/
|
||||
|
||||
double model_invert(double* y, double* p) {
|
||||
double result = y[0];
|
||||
double slope = 0.6;
|
||||
double z_grid[8] = {147.998,101.946,59.7634,19.6965,-19.6965,-59.7634,-101.946,-147.998};
|
||||
for(int i=0;i<7;i++) {
|
||||
if(y[0] <= z_grid[i] && y[0] > z_grid[i+1]) {
|
||||
double zavg = (z_grid[i] + z_grid[i+1])*0.5; //midpoint about which we pivot
|
||||
result = (y[0]-zavg)/slope + zavg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
double model_a1c1(double* x, double* p) {
|
||||
double result = x[0];
|
||||
double factor = 29.0;
|
||||
double slope = 0.0;
|
||||
if(TMath::Abs(x[0]) < 16.2) result=x[0]*slope;
|
||||
else if(TMath::Abs(x[0]) < 49.8 ) result=x[0]*slope+TMath::Sign(1.0,x[0])*factor;
|
||||
else if(TMath::Abs(x[0]) < 85.2 ) result=x[0]*slope+TMath::Sign(1.0,x[0])*factor*2;
|
||||
else result=x[0]*slope+TMath::Sign(1.0,x[0])*factor*3;
|
||||
return result;
|
||||
}
|
||||
|
||||
double model_invert_a1c1(double *y, double *q) {
|
||||
double result=y[0];
|
||||
/* double slope = 1.0;
|
||||
double factor = 5.0;
|
||||
if(TMath::Abs(y[0]) < 16.2/slope) result = y[0]/slope;
|
||||
else if(TMath::Abs(y[0]) < 49.8/slope ) result=y[0]/slope-TMath::Sign(1.0,y[0])*factor;
|
||||
else if(TMath::Abs(y[0]) < 85.2/slope ) result=y[0]/slope-TMath::Sign(1.0,y[0])*factor*2;
|
||||
else result=y[0]/slope-TMath::Sign(1.0,y[0])*factor**/;
|
||||
return result+40;
|
||||
}
|
||||
|
||||
|
||||
/*void testmodel() {
|
||||
TF1 eqline("x","x",-200,200);
|
||||
eqline.Draw("");
|
||||
eqline.SetLineStyle(kDashed);
|
||||
|
||||
//TF1 f1("model",model,-200,200,2);
|
||||
TF1 f1a("model_inv",model_a1c1,-200,200,2);
|
||||
eqline.SetNpx(10000);
|
||||
f1a.SetNpx(10000);
|
||||
std::vector<double> pars = {0.0,1.};
|
||||
f1a.SetParameters(pars.data());
|
||||
f1a.SetLineColor(kGreen+2);
|
||||
f1a.SetLineStyle(kLine);
|
||||
f1a.Draw("L SAME");
|
||||
|
||||
TF1 f1("model",model,-200,200,2);
|
||||
//TF1 f1("model_inv",model_invert,-200,200,2);
|
||||
eqline.SetNpx(10000);
|
||||
f1.SetNpx(10000);
|
||||
//std::vector<double> pars = {0.0,1.};
|
||||
f1.SetParameters(pars.data());
|
||||
f1.SetLineColor(kGreen+2);
|
||||
f1.SetLineStyle(kLine);
|
||||
f1.Draw("L SAME");
|
||||
|
||||
gPad->Modified(); gPad->Update();
|
||||
while(gPad->WaitPrimitive());
|
||||
}*/
|
||||
190
Armory/SX3Geom.h
190
Armory/SX3Geom.h
|
|
@ -1,190 +0,0 @@
|
|||
#ifndef SX3Geom_h
|
||||
#define SX3Geom_h
|
||||
#include <vector>
|
||||
|
||||
const double DEFAULT_NULL=-987654321.;
|
||||
|
||||
class sx3_geometry_scalefactors {
|
||||
public:
|
||||
//If sx3 has L, R being the left and right extremities, we choose add, stretch here such that
|
||||
// x_mm = (x_raw+add)*stretch; so add=abs(L), stretch=75/(abs(L)+R)
|
||||
float add[4];
|
||||
float stretch[4];
|
||||
};
|
||||
|
||||
class qqq5_finegains {
|
||||
public:
|
||||
std::array<std::pair<float,float>,32> front;
|
||||
//front.at(30).first = slope at clkpos 0, ring 30 for E front layer
|
||||
//front.at(30).second = intercept for the same as above
|
||||
std::array<std::pair<float,float>,4> back;
|
||||
};
|
||||
class sx3_fbgains {
|
||||
public:
|
||||
//Order of indices is [pad][strip]
|
||||
float padoffsets[4][4];
|
||||
float padgains[4][4];
|
||||
|
||||
float stripLoffsets[4][4];
|
||||
float stripLgains[4][4];
|
||||
|
||||
float stripRoffsets[4][4];
|
||||
float stripRgains[4][4];
|
||||
};
|
||||
|
||||
std::array<sx3_fbgains,24> sx3_xtalk_gains; //every sx3 needs to be gainmatched as a frontL-back, frontR-back pair (pad strip pair)
|
||||
std::array<sx3_geometry_scalefactors,24> sx3gs;
|
||||
|
||||
class sx3 {
|
||||
public:
|
||||
//TODO: Convert to std::array
|
||||
//Holds all information in an event, including ped subtraction+scaling. back[2].at(0) will have the largest energy seen in ch2, if any
|
||||
std::vector<float> back[4];
|
||||
std::vector<float> frontL[4];
|
||||
std::vector<float> frontR[4];
|
||||
|
||||
double ts = DEFAULT_NULL;
|
||||
//Easy lookup of final calibrated event. Only filled for valid cases, assumed for now to be 1L, 1R, 1B
|
||||
float frontX=DEFAULT_NULL;
|
||||
float frontXmm=DEFAULT_NULL;
|
||||
float frontE=DEFAULT_NULL;
|
||||
float backE=DEFAULT_NULL;
|
||||
int stripF=DEFAULT_NULL;
|
||||
int stripB=DEFAULT_NULL;
|
||||
float frontEL=DEFAULT_NULL;
|
||||
float frontER=DEFAULT_NULL;
|
||||
|
||||
float phi=DEFAULT_NULL; //
|
||||
|
||||
std::set<int> valid_front_chans;
|
||||
std::set<int> valid_back_chans;
|
||||
std::set<int> unmatched_front_chans; //every front channel is unmatched and invalid at first. when it gets matched, it gets removed and sent to valid
|
||||
|
||||
bool foundevent=false;
|
||||
bool valid=false;//valid will be set to false in all cases where we have ambiguity
|
||||
int flags=-1;//flags settable to different types of values to indicate different invalid situations
|
||||
|
||||
void fillevent(const std::string& position, const int subchannel, const float value); //make 'const' what functions don't need to change, helps with performance
|
||||
void validate(const sx3_fbgains&, const sx3_geometry_scalefactors&);
|
||||
void validate();
|
||||
};
|
||||
|
||||
|
||||
void sx3::fillevent(const std::string& positionstring, const int subchannel, const float value) {
|
||||
assert(subchannel>=0 && subchannel<4);
|
||||
foundevent=1;
|
||||
if(positionstring=="FRONT_L") {
|
||||
frontL[subchannel].push_back(value);
|
||||
unmatched_front_chans.insert(subchannel);
|
||||
} else if(positionstring=="FRONT_R") {
|
||||
frontR[subchannel].push_back(value);
|
||||
unmatched_front_chans.insert(subchannel);
|
||||
} else if(positionstring=="BACK") {
|
||||
back[subchannel].push_back(value);
|
||||
valid_back_chans.insert(subchannel);
|
||||
} else {
|
||||
std::cout << "Unknown string "+positionstring+" encountered in sx3::fillevent \n" << std::endl;
|
||||
}
|
||||
if(frontL[subchannel].size()!=0 && frontR[subchannel].size()!=0 ) {
|
||||
unmatched_front_chans.erase(subchannel);
|
||||
valid_front_chans.insert(subchannel); //std::set, so no duplication will happen
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//void sx3::validate(const sx3_fbgains& fbgains, const sx3_geometry_scalefactors& sx3gs) {
|
||||
void sx3::validate() {
|
||||
if(valid_front_chans.size()!=0 && valid_back_chans.size()!=0) {
|
||||
valid=true;
|
||||
float maxFE=0;
|
||||
float maxBE=0;
|
||||
//float zpos=0;
|
||||
int bchan=-1;
|
||||
int fchan=-1;
|
||||
/* for(auto cc: valid_front_chans) {
|
||||
std::cout << "fc" << cc << std::endl;// " " << frontL[cc].at(0) << " " << frontR[cc].at(0) << std::endl;
|
||||
}
|
||||
for(auto cc: valid_back_chans) {
|
||||
std::cout << "bc" << cc << std::endl; //" " << back[cc].at(0) << std::endl;
|
||||
}
|
||||
*/
|
||||
for(auto chan: valid_front_chans) {
|
||||
if(frontL[chan].size()>1) {
|
||||
printf("\nmultihit sx3 at Lsubchan:%d, ts:%1.13g\n",chan,ts);
|
||||
for(const auto& e: frontL[chan]) printf("e: %f\t",e);
|
||||
std::sort(frontL[chan].begin(), frontL[chan].end(), std::greater<float>());
|
||||
flags += (-1000);
|
||||
}
|
||||
if(frontR[chan].size()>1) {
|
||||
printf("\nmultihit sx3 at Rsubchan:%d, ts:%1.13g\n",chan,ts);
|
||||
for(const auto& e: frontR[chan]) printf("e: %f\t",e);
|
||||
std::sort(frontR[chan].begin(), frontR[chan].end(), std::greater<float>());
|
||||
flags += (-2000);
|
||||
}
|
||||
//assign position using max L+R value
|
||||
/*printf("chan:%d sizeL: %d sizeR: %d\n",chan, frontL[chan].size(), frontR[chan].size()); fflush(stdout);
|
||||
printf("foo\n");
|
||||
std::cout << "\nL:" << std::endl;
|
||||
for(auto thing: frontL[chan]) std::cout << thing << " " << std::flush;
|
||||
std::cout << "\nR:" << std::endl;
|
||||
for(auto thing: frontR[chan]) std::cout << thing << " " << std::flush;*/
|
||||
if(frontL[chan].at(0) + frontR[chan].at(0)>= maxFE) {
|
||||
maxFE = frontL[chan].at(0) + frontR[chan].at(0);
|
||||
//zpos = (frontL[chan].at(0)-frontR[chan].at(0))/maxFE;
|
||||
fchan = chan;
|
||||
}
|
||||
}
|
||||
for(auto chan: valid_back_chans) {
|
||||
if(back[chan].size()>1) {
|
||||
printf("\nmultihit sx3 at Bsubchan:%d, ts:%1.13g\n",chan,ts);
|
||||
for(const auto& e: back[chan]) printf("e: %f\t",e);
|
||||
std::sort(back[chan].begin(), back[chan].end(), std::greater<float>());
|
||||
flags += (-3000);
|
||||
}
|
||||
if(back[chan].size() ==0 ) {
|
||||
printf("foo\n");
|
||||
//continue;
|
||||
}
|
||||
if(back[chan].at(0) >= maxBE) {
|
||||
maxBE = back[chan].at(0);
|
||||
bchan = chan;
|
||||
}
|
||||
}
|
||||
/*
|
||||
Cross-talk corrections are important when evaluating 'energy' signals from strips/pads.
|
||||
They can cause unexpected behavior when used universally for all EL, ER cases, so we split scenarios in two.
|
||||
- Positions along each strip (frontX) *are not* corrected for crosstalk.
|
||||
- Total F and B energies (frontE, backE) *are*.
|
||||
Sudarsan B, 31 Oct 2024
|
||||
*/
|
||||
|
||||
if(fchan==-1 || bchan==-1) {
|
||||
std::cout << "how" << std::endl;
|
||||
std::cout << "fc " << std::flush; for(auto fc : valid_front_chans) std::cout << fc << " (" << frontL[fc].at(0) << "," << frontR[fc].at(0)<< ") "; std::cout << std::endl;
|
||||
std::cout << "bc " << std::flush; for(auto bc : valid_back_chans) std::cout << bc << " " << back[bc].at(0) << std::flush; std::cout << std::endl;
|
||||
}
|
||||
float Eleft = frontL[fchan].at(0);
|
||||
float Eright = frontR[fchan].at(0);
|
||||
frontEL = Eleft;
|
||||
frontER = Eright;
|
||||
frontX = (Eleft-Eright)/(Eleft+Eright);
|
||||
//frontXmm = (frontX+sx3gs.add[fchan])*sx3gs.stretch[fchan]; //convert to mm
|
||||
|
||||
//frontE = Eleft*fbgains.stripLgains[bchan][fchan] + fbgains.stripLoffsets[bchan][fchan]
|
||||
// + Eright*fbgains.stripRgains[bchan][fchan] + fbgains.stripRoffsets[bchan][fchan];
|
||||
//backE = back[bchan].at(0)*fbgains.padgains[bchan][fchan]+fbgains.padoffsets[bchan][fchan];
|
||||
frontE = Eleft+Eright;
|
||||
backE = maxBE;
|
||||
stripF=fchan;
|
||||
stripB=bchan;
|
||||
|
||||
flags = 0;
|
||||
} else if(valid_front_chans.size()!=0 && valid_back_chans.size()==0) {
|
||||
flags = -10;
|
||||
} else if(valid_front_chans.size()==0 && valid_back_chans.size()!=0) {
|
||||
flags = -20;
|
||||
}
|
||||
}
|
||||
|
||||
typedef sx3 sx3det;
|
||||
#endif
|
||||
|
|
@ -1,795 +0,0 @@
|
|||
#include "ClassData.h"
|
||||
#include "Hit.h"
|
||||
#include <algorithm>
|
||||
#include <filesystem>
|
||||
|
||||
// #include "AggSeparator.h"
|
||||
|
||||
class FSUReader{
|
||||
|
||||
public:
|
||||
FSUReader();
|
||||
FSUReader(std::string fileName, uInt dataSize = 100, int verbose = 1);
|
||||
FSUReader(std::vector<std::string> fileList, uInt dataSize = 100, int verbose = 1);
|
||||
~FSUReader();
|
||||
|
||||
void OpenFile(std::string fileName, uInt dataSize, int verbose = 1);
|
||||
bool IsOpen() const{return inFile == nullptr ? false : true;}
|
||||
bool IsEndOfFile() const {
|
||||
// printf("%s : %d | %ld |%ld\n", __func__, feof(inFile), ftell(inFile), inFileSize);
|
||||
if(fileList.empty() ) {
|
||||
if( (uLong )ftell(inFile) >= inFileSize){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
if( fileID + 1 == (int) fileList.size() && ((uLong)ftell(inFile) >= inFileSize) ) {
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScanNumBlock(int verbose = 1, uShort saveData = 0); // saveData = 0 (no save), 1 (no trace), 2 (with trace);
|
||||
int ReadNextBlock(bool traceON = false, int verbose = 0, uShort saveData = 0); // saveData = 0 (no save), 1 (no trace), 2 (with trace);
|
||||
int ReadBlock(unsigned int ID, int verbose = 0);
|
||||
|
||||
unsigned int GetFilePos() const {return filePos;}
|
||||
unsigned long GetTotNumBlock() const{ return totNumBlock;}
|
||||
std::vector<unsigned int> GetBlockTimestamp() const {return blockTimeStamp;}
|
||||
|
||||
Data * GetData() const{return data;}
|
||||
|
||||
std::string GetFileName() const{return fileName;}
|
||||
int GetDPPType() const{return DPPType;}
|
||||
int GetSN() const{return sn;}
|
||||
int GetTick2ns() const{return tick2ns;}
|
||||
int GetNumCh() const{return numCh;}
|
||||
int GetFileOrder() const{return order;}
|
||||
int GetChMask() const{return chMask;}
|
||||
unsigned long GetFileByteSize() const {return inFileSize;}
|
||||
|
||||
void ClearHitList() { hit.clear();}
|
||||
ulong GetHitListLength() const {return hit.size();}
|
||||
std::vector<Hit> GetHitVector() const {return hit;}
|
||||
void SortHit(int verbose = false);
|
||||
Hit GetHit(int id) const {
|
||||
if( id < 0 ) id = hit.size() + id;
|
||||
return hit[id];
|
||||
}
|
||||
|
||||
void ClearHitCount() {hitCount = 0;}
|
||||
ulong GetHitCount() const{return hitCount;}
|
||||
|
||||
std::vector<Hit> ReadBatch(unsigned int batchSize = 1000000, bool verbose = false); // output the sorted Hit
|
||||
|
||||
// std::string SaveHit(std::vector<Hit> hitList, bool isAppend = false);
|
||||
// std::string SaveHit2NewFile(std::string saveFolder = "./", std::string indexStr = "");
|
||||
// void SortAndSaveTS(unsigned int batchSize = 1000000, bool verbose = false);
|
||||
// off_t GetTSFileSize() const {return tsFileSize;}
|
||||
|
||||
//TODO
|
||||
//void SplitFile(unsigned long hitSizePreFile);
|
||||
|
||||
void PrintHit(ulong numHit = -1, ulong startIndex = 0) {
|
||||
for( ulong i = startIndex; i < std::min(numHit, hitCount); i++){
|
||||
printf("%10zu ", i); hit[i].Print();
|
||||
}
|
||||
}
|
||||
|
||||
static void PrintHitListInfo(std::vector<Hit> * hitList, std::string name){
|
||||
size_t n = hitList->size();
|
||||
size_t s = sizeof(Hit);
|
||||
printf("============== %s, size : %zu | %.2f MByte\n", name.c_str(), n, n*s/1024./1024.);
|
||||
if( n > 0 ){
|
||||
printf("t0 : %15llu ns\n", hitList->front().timestamp);
|
||||
printf("t1 : %15llu ns\n", hitList->back().timestamp);
|
||||
printf("dt : %15.3f ms\n", (hitList->back().timestamp - hitList->front().timestamp)/1e6);
|
||||
}
|
||||
}
|
||||
|
||||
void PrintHitListInfo(){
|
||||
size_t n = hit.size();
|
||||
size_t s = sizeof(Hit);
|
||||
printf("============== reader.hit, size : %zu | %.2f MByte\n", n, n*s/1024./1024.);
|
||||
if( n > 0 ){
|
||||
printf("t0 : %15llu ns\n", hit.at(0).timestamp);
|
||||
printf("t1 : %15llu ns\n", hit.back().timestamp);
|
||||
printf("dt : %15.3f ms\n", (hit.back().timestamp - hit.front().timestamp)/1e6);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//void SaveAsCAENCoMPASSFormat();
|
||||
|
||||
private:
|
||||
|
||||
FILE * inFile;
|
||||
Data * data;
|
||||
|
||||
std::string fileName;
|
||||
std::vector<std::string> fileList;
|
||||
short fileID;
|
||||
unsigned long inFileSize;
|
||||
unsigned int filePos;
|
||||
unsigned long totNumBlock;
|
||||
unsigned int blockID;
|
||||
|
||||
bool isDualBlock;
|
||||
|
||||
uShort sn;
|
||||
uShort DPPType;
|
||||
uShort tick2ns;
|
||||
uShort order;
|
||||
uShort chMask;
|
||||
uShort numCh;
|
||||
|
||||
std::vector<unsigned int> blockPos;
|
||||
std::vector<unsigned int > blockTimeStamp;
|
||||
|
||||
unsigned long hitCount;
|
||||
|
||||
std::vector<Hit> hit;
|
||||
|
||||
unsigned int word[1]; /// 4 byte
|
||||
size_t dummy;
|
||||
char * buffer;
|
||||
|
||||
off_t tsFileSize;
|
||||
|
||||
};
|
||||
|
||||
inline FSUReader::~FSUReader(){
|
||||
delete data;
|
||||
|
||||
if( inFile ) fclose(inFile);
|
||||
|
||||
}
|
||||
|
||||
inline FSUReader::FSUReader(){
|
||||
inFile = nullptr;
|
||||
data = nullptr;
|
||||
|
||||
blockPos.clear();
|
||||
blockTimeStamp.clear();
|
||||
hit.clear();
|
||||
|
||||
fileList.clear();
|
||||
fileID = -1;
|
||||
|
||||
}
|
||||
|
||||
inline FSUReader::FSUReader(std::string fileName, uInt dataSize, int verbose){
|
||||
inFile = nullptr;
|
||||
data = nullptr;
|
||||
|
||||
blockPos.clear();
|
||||
blockTimeStamp.clear();
|
||||
hit.clear();
|
||||
|
||||
fileList.clear();
|
||||
fileID = -1;
|
||||
OpenFile(fileName, dataSize, verbose);
|
||||
}
|
||||
|
||||
inline FSUReader::FSUReader(std::vector<std::string> fileList, uInt dataSize, int verbose){
|
||||
inFile = nullptr;
|
||||
data = nullptr;
|
||||
|
||||
blockPos.clear();
|
||||
blockTimeStamp.clear();
|
||||
hit.clear();
|
||||
//The files are the same DPPType and sn
|
||||
this->fileList = fileList;
|
||||
fileID = 0;
|
||||
OpenFile(fileList[fileID], dataSize, verbose);
|
||||
|
||||
}
|
||||
|
||||
inline void FSUReader::OpenFile(std::string fileName, uInt dataSize, int verbose){
|
||||
|
||||
/// File format must be YYY...Y_runXXX_AAA_BBB_TT_CCC.fsu
|
||||
/// YYY...Y = prefix
|
||||
/// XXX = runID, 3 digits
|
||||
/// AAA = board Serial Number, 3 digits
|
||||
/// BBB = DPPtype, 3 digits
|
||||
/// TT = tick2ns, any digits
|
||||
/// CCC = over size index, 3 digits
|
||||
|
||||
if( inFile != nullptr ) fclose(inFile);
|
||||
|
||||
inFile = fopen(fileName.c_str(), "r");
|
||||
|
||||
if( inFile == NULL ){
|
||||
printf("FSUReader::Cannot open file : %s \n", fileName.c_str());
|
||||
this->fileName = "";
|
||||
return;
|
||||
}
|
||||
|
||||
this->fileName = fileName;
|
||||
|
||||
fseek(inFile, 0L, SEEK_END);
|
||||
inFileSize = ftell(inFile);
|
||||
if(verbose) printf("%s | file size : %ld Byte = %.2f MB\n", fileName.c_str() , inFileSize, inFileSize/1024./1024.);
|
||||
fseek(inFile, 0L, SEEK_SET);
|
||||
filePos = 0;
|
||||
|
||||
if( fileID > 0 ) return;
|
||||
|
||||
totNumBlock = 0;
|
||||
blockID = 0;
|
||||
blockPos.clear();
|
||||
blockTimeStamp.clear();
|
||||
|
||||
hitCount = 0;
|
||||
hit.clear();
|
||||
|
||||
//check is the file is *.fsu or *.fsu.X
|
||||
size_t found = fileName.find_last_of('.');
|
||||
std::string ext = fileName.substr(found + 1);
|
||||
|
||||
if( ext.find("fsu") != std::string::npos ) {
|
||||
if(verbose > 1) printf("It is an raw data *.fsu format\n");
|
||||
isDualBlock = false;
|
||||
chMask = -1;
|
||||
}else{
|
||||
chMask = atoi(ext.c_str());
|
||||
isDualBlock = true;
|
||||
if(verbose > 1) printf("It is a splitted dual block data *.fsu.X format, dual channel mask : %d \n", chMask);
|
||||
}
|
||||
|
||||
std::string fileNameNoExt;
|
||||
found = fileName.find_last_of(".fsu");
|
||||
size_t found2 = fileName.find_last_of('/');
|
||||
if( found2 == std::string::npos ){
|
||||
fileNameNoExt = fileName.substr(0, found-4);
|
||||
}else{
|
||||
fileNameNoExt = fileName.substr(found2+1, found-4);
|
||||
}
|
||||
|
||||
// Split the string by underscores
|
||||
std::istringstream iss(fileNameNoExt);
|
||||
std::vector<std::string> tokens;
|
||||
std::string token;
|
||||
|
||||
while (std::getline(iss, token, '_')) { tokens.push_back(token); }
|
||||
sn = atoi(tokens[2].c_str());
|
||||
tick2ns = atoi(tokens[4].c_str());
|
||||
order = atoi(tokens[5].c_str());
|
||||
|
||||
DPPType = 0;
|
||||
if( fileName.find("PHA") != std::string::npos ) DPPType = DPPTypeCode::DPP_PHA_CODE;
|
||||
if( fileName.find("PSD") != std::string::npos ) DPPType = DPPTypeCode::DPP_PSD_CODE;
|
||||
if( fileName.find("QDC") != std::string::npos ) DPPType = DPPTypeCode::DPP_QDC_CODE;
|
||||
if( DPPType == 0 ){
|
||||
fclose(inFile);
|
||||
inFile = nullptr;
|
||||
printf("Cannot find DPPType in the filename. Abort.");
|
||||
return ;
|
||||
}
|
||||
|
||||
numCh = (DPPType == DPPTypeCode::DPP_QDC_CODE ? 64 : 16);
|
||||
|
||||
data = new Data(numCh, dataSize);
|
||||
data->tick2ns = tick2ns;
|
||||
data->boardSN = sn;
|
||||
data->DPPType = DPPType;
|
||||
|
||||
}
|
||||
|
||||
inline int FSUReader::ReadNextBlock(bool traceON, int verbose, uShort saveData){
|
||||
if( inFile == NULL ) return -1;
|
||||
if( feof(inFile) || filePos >= inFileSize) {
|
||||
if( fileID >= 0 && fileID + 1 < (short) fileList.size() ){
|
||||
printf("-------------- next file\n");
|
||||
fileID ++;
|
||||
OpenFile(fileList[fileID], data->GetDataSize(), 1 );
|
||||
}else{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
dummy = fread(word, 4, 1, inFile);
|
||||
fseek(inFile, -4, SEEK_CUR);
|
||||
|
||||
if( dummy != 1) {
|
||||
printf("fread error, should read 4 bytes, but read %ld x 4 byte, file pos: %ld / %ld byte\n",
|
||||
dummy, ftell(inFile), inFileSize);
|
||||
return -10;
|
||||
}
|
||||
short header = ((word[0] >> 28 ) & 0xF);
|
||||
|
||||
Hit temp;
|
||||
|
||||
if( header == 0xA ) { ///normal header
|
||||
|
||||
unsigned int aggSize = (word[0] & 0x0FFFFFFF) * 4; ///byte
|
||||
if( aggSize > inFileSize - ftell(inFile)) aggSize = inFileSize - ftell(inFile);
|
||||
buffer = new char[aggSize];
|
||||
dummy = fread(buffer, aggSize, 1, inFile);
|
||||
filePos = ftell(inFile);
|
||||
if( dummy != 1) {
|
||||
printf("fread error, should read %d bytes, but read %ld x %d byte, file pos: %ld / %ld byte \n",
|
||||
aggSize, dummy, aggSize, ftell(inFile), inFileSize);
|
||||
return -30;
|
||||
}
|
||||
|
||||
data->DecodeBuffer(buffer, aggSize, !traceON, verbose); // data will own the buffer
|
||||
//printf(" word Index = %u | filePos : %u | ", data->GetWordIndex(), filePos);
|
||||
|
||||
}else if( (header & 0xF ) == 0x8 ) { /// dual channel header
|
||||
|
||||
unsigned int dualSize = (word[0] & 0x7FFFFFFF) * 4; ///byte
|
||||
buffer = new char[dualSize];
|
||||
dummy = fread(buffer, dualSize, 1, inFile);
|
||||
filePos = ftell(inFile);
|
||||
|
||||
data->buffer = buffer;
|
||||
data->DecodeDualBlock(buffer, dualSize, DPPType, chMask, !traceON, verbose);
|
||||
|
||||
}else{
|
||||
printf("incorrect header.\n trminate.");
|
||||
return -20;
|
||||
}
|
||||
|
||||
unsigned int eventCout = 0;
|
||||
|
||||
for( int ch = 0; ch < data->GetNChannel(); ch++){
|
||||
if( data->NumEventsDecoded[ch] == 0 ) continue;
|
||||
|
||||
hitCount += data->NumEventsDecoded[ch];
|
||||
eventCout += data->NumEventsDecoded[ch];
|
||||
|
||||
if( saveData ){
|
||||
int start = data->GetDataIndex(ch) - data->NumEventsDecoded[ch] + 1;
|
||||
if( start < 0 ) start = start + data->GetDataSize();
|
||||
|
||||
for( int i = start; i < start + data->NumEventsDecoded[ch]; i++ ){
|
||||
int k = i % data->GetDataSize();
|
||||
|
||||
temp.sn = sn;
|
||||
temp.ch = ch;
|
||||
temp.energy = data->GetEnergy(ch, k);
|
||||
temp.energy2 = data->GetEnergy2(ch, k);
|
||||
temp.timestamp = data->GetTimestamp(ch, k);
|
||||
temp.fineTime = data->GetFineTime(ch, k);
|
||||
temp.pileUp = data->GetPileUp(ch, k);
|
||||
if( saveData > 1 ) {
|
||||
temp.traceLength = data->Waveform1[ch][k].size();
|
||||
temp.trace = data->Waveform1[ch][k];
|
||||
}else{
|
||||
temp.traceLength = 0;
|
||||
if( temp.trace.size() > 0 ) temp.trace.clear();
|
||||
}
|
||||
|
||||
hit.push_back(temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data->ClearTriggerRate();
|
||||
data->ClearNumEventsDecoded();
|
||||
data->ClearBuffer(); // this will clear the buffer.
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int FSUReader::ReadBlock(unsigned int ID, int verbose){
|
||||
if( totNumBlock == 0 )return -1;
|
||||
if( ID >= totNumBlock )return -1;
|
||||
|
||||
data->ClearData();
|
||||
|
||||
fseek( inFile, 0L, SEEK_SET);
|
||||
|
||||
if( verbose ) printf("Block index: %u, File Pos: %u byte\n", ID, blockPos[ID]);
|
||||
|
||||
fseek(inFile, blockPos[ID], SEEK_CUR);
|
||||
filePos = blockPos[ID];
|
||||
blockID = ID;
|
||||
return ReadNextBlock(false, verbose, false);
|
||||
|
||||
}
|
||||
|
||||
inline void FSUReader::SortHit(int verbose){
|
||||
if( verbose) printf("\nQuick Sort hit array according to time...");
|
||||
std::sort(hit.begin(), hit.end(), [](const Hit& a, const Hit& b) {
|
||||
return a.timestamp < b.timestamp;
|
||||
});
|
||||
if( verbose) printf(".......done.\n");
|
||||
}
|
||||
|
||||
inline void FSUReader::ScanNumBlock(int verbose, uShort saveData){
|
||||
if( inFile == nullptr ) return;
|
||||
if( feof(inFile) ) return;
|
||||
|
||||
blockID = 0;
|
||||
blockPos.push_back(0);
|
||||
|
||||
data->ClearData();
|
||||
rewind(inFile);
|
||||
filePos = 0;
|
||||
|
||||
bool isTraceOn = saveData < 2 ? false : true;
|
||||
|
||||
while( ReadNextBlock(isTraceOn, verbose - 1, saveData) == 0 ){
|
||||
blockPos.push_back(filePos);
|
||||
blockTimeStamp.push_back(data->aggTime);
|
||||
blockID ++;
|
||||
if(verbose && blockID % 10000 == 0) printf("%u, %.2f%% %u/%lu\n\033[A\r", blockID, filePos*100./inFileSize, filePos, inFileSize);
|
||||
}
|
||||
|
||||
totNumBlock = blockID;
|
||||
if(verbose) {
|
||||
printf("\nScan complete: number of data Block : %lu\n", totNumBlock);
|
||||
printf( " number of hit : %lu", hitCount);
|
||||
if( hitCount > 1e6 ) printf(" = %.3f million", hitCount/1e6);
|
||||
printf("\n");
|
||||
if( saveData )printf( " size of the hit array : %lu\n", hit.size());
|
||||
|
||||
if( saveData ){
|
||||
size_t sizeT = sizeof(hit[0]) * hit.size();
|
||||
printf("size of hit array : %lu byte = %.2f kByte, = %.2f MByte\n", sizeT, sizeT/1024., sizeT/1024./1024.);
|
||||
}
|
||||
}
|
||||
|
||||
if( fileList.size() > 0 ){
|
||||
fileID = 0;
|
||||
OpenFile(fileList[fileID], data->GetDataSize(), 0);
|
||||
}
|
||||
|
||||
rewind(inFile);
|
||||
blockID = 0;
|
||||
filePos = 0;
|
||||
|
||||
//check is the hitCount == hit.size();
|
||||
if( saveData ){
|
||||
if( hitCount != hit.size()){
|
||||
printf("!!!!!! the Data::dataSize is not big enough. !!!!!!!!!!!!!!!\n");
|
||||
}else{
|
||||
SortHit(verbose+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline std::vector<Hit> FSUReader::ReadBatch(unsigned int batchSize, bool verbose){
|
||||
|
||||
// printf("%s sn:%d. filePos : %lu\n", __func__, sn, ftell(inFile));
|
||||
|
||||
std::vector<Hit> hitList_A;
|
||||
if( IsEndOfFile() ) {
|
||||
hitList_A = hit;
|
||||
hit.clear();
|
||||
return hitList_A;
|
||||
}
|
||||
|
||||
if( hit.size() == 0 ){
|
||||
int res = 0;
|
||||
do{
|
||||
res = ReadNextBlock(true, 0, 3);
|
||||
}while ( hit.size() < batchSize && res == 0);
|
||||
SortHit();
|
||||
uLong t0_B = hit.at(0).timestamp;
|
||||
uLong t1_B = hit.back().timestamp;
|
||||
if( verbose ) {
|
||||
printf(" hit in memeory : %7zu | %u | %lu \n", hit.size(), filePos, inFileSize);
|
||||
printf("t0 : %15lu ns\n", t0_B);
|
||||
printf("t1 : %15lu ns\n", t1_B);
|
||||
printf("dt : %15.3f ms\n", (t1_B - t0_B)/1e6);
|
||||
}
|
||||
|
||||
hitList_A = hit;
|
||||
hit.clear();
|
||||
|
||||
}else{
|
||||
|
||||
hitList_A = hit;
|
||||
hit.clear();
|
||||
|
||||
}
|
||||
|
||||
if( IsEndOfFile() ) return hitList_A; // when file finished for 1st batch read
|
||||
|
||||
int res = 0;
|
||||
do{
|
||||
res = ReadNextBlock(true, 0, 3);
|
||||
}while ( hit.size() < batchSize && res == 0);
|
||||
SortHit();
|
||||
uLong t0_B = hit.at(0).timestamp;
|
||||
uLong t1_B = hit.back().timestamp;
|
||||
|
||||
if( verbose ) {
|
||||
printf(" hit in memeory : %7zu | %u | %lu \n", hit.size(), filePos, inFileSize);
|
||||
printf("t0 : %15lu\n", t0_B);
|
||||
printf("t1 : %15lu\n", t1_B);
|
||||
printf("dt : %15.3f ms\n", (t1_B - t0_B)/1e6);
|
||||
}
|
||||
|
||||
uLong t0_A = hitList_A.at(0).timestamp;
|
||||
uLong t1_A = hitList_A.back().timestamp;
|
||||
ulong ID_A = 0;
|
||||
ulong ID_B = 0;
|
||||
|
||||
if( t0_A >= t0_B) {
|
||||
printf("\033[0;31m!!!!!!!!!!!!!!!!! %s | Need to increase the batch size. \033[0m\n", __func__);
|
||||
return std::vector<Hit> ();
|
||||
}
|
||||
|
||||
if( t1_A > t0_B) { // need to sort between two hitList
|
||||
|
||||
if( verbose ) {
|
||||
printf("############# need to sort \n");
|
||||
printf("=========== sume of A + B : %zu \n", hitList_A.size() + hit.size());
|
||||
}
|
||||
|
||||
std::vector<Hit> hitTemp;
|
||||
|
||||
// find the hit that is >= t0_B, save them to hitTemp
|
||||
for( size_t j = 0; j < hitList_A.size() ; j++){
|
||||
if( hitList_A[j].timestamp < t0_B ) continue;;
|
||||
if( ID_A == 0 ) ID_A = j;
|
||||
hitTemp.push_back(hitList_A[j]);
|
||||
}
|
||||
|
||||
// remove hitList_A element that is >= t0_B
|
||||
hitList_A.erase(hitList_A.begin() + ID_A, hitList_A.end() );
|
||||
|
||||
// find the hit that is <= t1_A, save them to hitTemp
|
||||
for( size_t j = 0; j < hit.size(); j++){
|
||||
if( hit[j].timestamp > t1_A ) {
|
||||
break;
|
||||
}
|
||||
hitTemp.push_back(hit[j]);
|
||||
ID_B = j + 1;
|
||||
}
|
||||
|
||||
// remove hit elements that is <= t1_A
|
||||
hit.erase(hit.begin(), hit.begin() + ID_B );
|
||||
|
||||
// sort hitTemp
|
||||
std::sort(hitTemp.begin(), hitTemp.end(), [](const Hit& a, const Hit& b) {
|
||||
return a.timestamp < b.timestamp;
|
||||
});
|
||||
|
||||
|
||||
if( verbose ) {
|
||||
printf("----------------- ID_A : %lu, Drop\n", ID_A);
|
||||
printf("----------------- ID_B : %lu, Drop\n", ID_B);
|
||||
PrintHitListInfo(&hitList_A, "hitList_A");
|
||||
PrintHitListInfo(&hitTemp, "hitTemp");
|
||||
PrintHitListInfo();
|
||||
printf("=========== sume of A + B + Temp : %zu \n", hitList_A.size() + hit.size() + hitTemp.size());
|
||||
printf("----------------- refill hitList_A \n");
|
||||
}
|
||||
|
||||
for( size_t j = 0; j < hitTemp.size(); j++){
|
||||
hitList_A.push_back(hitTemp[j]);
|
||||
}
|
||||
hitTemp.clear();
|
||||
|
||||
if( verbose ) {
|
||||
PrintHitListInfo(&hitList_A, "hitList_A");
|
||||
PrintHitListInfo();
|
||||
printf("=========== sume of A + B : %zu \n", hitList_A.size() + hit.size());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return hitList_A;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
inline void FSUReader::SortAndSaveTS(unsigned int batchSize, bool verbose){
|
||||
|
||||
int count = 0;
|
||||
std::vector<Hit> hitList_A ;
|
||||
|
||||
do{
|
||||
|
||||
if( verbose ) printf("***************************************************\n");
|
||||
|
||||
int res = 0;
|
||||
do{
|
||||
res = ReadNextBlock(true, 0, 3);
|
||||
}while ( hit.size() < batchSize && res == 0);
|
||||
|
||||
SortHit();
|
||||
uLong t0_B = hit.at(0).timestamp;
|
||||
uLong t1_B = hit.back().timestamp;
|
||||
|
||||
if( verbose ) {
|
||||
printf(" hit in memeory : %7zu | %u | %lu \n", hit.size(), filePos, inFileSize);
|
||||
printf("t0 : %15lu\n", t0_B);
|
||||
printf("t1 : %15lu\n", t1_B);
|
||||
}
|
||||
|
||||
if( count == 0 ) {
|
||||
hitList_A = hit; // copy hit
|
||||
}else{
|
||||
|
||||
uLong t0_A = hitList_A.at(0).timestamp;
|
||||
uLong t1_A = hitList_A.back().timestamp;
|
||||
ulong ID_A = 0;
|
||||
ulong ID_B = 0;
|
||||
|
||||
if( t0_A > t0_B) {
|
||||
printf("Need to increase the batch size. \n");
|
||||
return;
|
||||
}
|
||||
|
||||
if( t1_A > t0_B) { // need to sort between two hitList
|
||||
|
||||
if( verbose ) {
|
||||
printf("############# need to sort \n");
|
||||
printf("=========== sume of A + B : %zu \n", hitList_A.size() + hit.size());
|
||||
}
|
||||
|
||||
std::vector<Hit> hitTemp;
|
||||
|
||||
for( size_t j = 0; j < hitList_A.size() ; j++){
|
||||
if( hitList_A[j].timestamp < t0_B ) continue;
|
||||
if( ID_A == 0 ) ID_A = j;
|
||||
hitTemp.push_back(hitList_A[j]);
|
||||
}
|
||||
|
||||
hitList_A.erase(hitList_A.begin() + ID_A, hitList_A.end() );
|
||||
if( verbose ) {
|
||||
printf("----------------- ID_A : %lu, Drop\n", ID_A);
|
||||
PrintHitListInfo(hitList_A, "hitList_A");
|
||||
}
|
||||
|
||||
|
||||
for( size_t j = 0; j < hit.size(); j++){
|
||||
if( hit[j].timestamp > t1_A ) {
|
||||
ID_B = j;
|
||||
break;
|
||||
}
|
||||
hitTemp.push_back(hit[j]);
|
||||
}
|
||||
|
||||
std::sort(hitTemp.begin(), hitTemp.end(), [](const Hit& a, const Hit& b) {
|
||||
return a.timestamp < b.timestamp;
|
||||
});
|
||||
|
||||
hit.erase(hit.begin(), hit.begin() + ID_B );
|
||||
|
||||
if( verbose ) {
|
||||
PrintHitListInfo(hitTemp, "hitTemp");
|
||||
printf("----------------- ID_B : %lu, Drop\n", ID_B);
|
||||
PrintHitListInfo(hit, "hit");
|
||||
printf("=========== sume of A + B + Temp : %zu \n", hitList_A.size() + hit.size() + hitTemp.size());
|
||||
printf("----------------- refill hitList_A \n");
|
||||
}
|
||||
ulong ID_Temp = 0;
|
||||
for( size_t j = 0; j < hitTemp.size(); j++){
|
||||
hitList_A.push_back(hitTemp[j]);
|
||||
if( hitList_A.size() >= batchSize ) {
|
||||
ID_Temp = j+1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
hitTemp.erase(hitTemp.begin(), hitTemp.begin() + ID_Temp );
|
||||
for( size_t j = 0 ; j < hit.size(); j ++){
|
||||
hitTemp.push_back(hit[j]);
|
||||
}
|
||||
SaveHit(hitList_A, count <= 1 ? false : true);
|
||||
|
||||
if( verbose ) {
|
||||
PrintHitListInfo(hitList_A, "hitList_A");
|
||||
PrintHitListInfo(hitTemp, "hitTemp");
|
||||
printf("----------------- replace hitList_A by hitTemp \n");
|
||||
}
|
||||
|
||||
hitList_A.clear();
|
||||
hitList_A = hitTemp;
|
||||
hit.clear();
|
||||
|
||||
if( verbose ) {
|
||||
PrintHitListInfo(hitList_A, "hitList_A");
|
||||
printf("===========================================\n");
|
||||
}
|
||||
|
||||
}else{ // save hitList_A, replace hitList_A
|
||||
|
||||
SaveHit(hitList_A, count <= 1? false : true);
|
||||
hitList_A.clear();
|
||||
hitList_A = hit;
|
||||
if( verbose ) PrintHitListInfo(hitList_A, "hitList_A");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ClearHitList();
|
||||
count ++;
|
||||
}while(filePos < inFileSize);
|
||||
|
||||
SaveHit(hitList_A, count <= 1 ? false : true);
|
||||
|
||||
printf("================= finished.\n");
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
inline std::string FSUReader::SaveHit(std::vector<Hit> hitList, bool isAppend){
|
||||
|
||||
std::string outFileName;
|
||||
if( fileList.empty() ) {
|
||||
outFileName = fileName + ".ts" ;
|
||||
}else{
|
||||
outFileName = fileList[0] + ".ts" ;
|
||||
}
|
||||
uint64_t hitSize = hitList.size();
|
||||
|
||||
FILE * outFile ;
|
||||
if( isAppend ) {
|
||||
outFile = fopen(outFileName.c_str(), "rb+"); //read/write bineary
|
||||
|
||||
rewind(outFile);
|
||||
fseek( outFile, 4, SEEK_CUR);
|
||||
uint64_t org_hitSize;
|
||||
fread(&org_hitSize, 8, 1, outFile);
|
||||
|
||||
rewind(outFile);
|
||||
fseek( outFile, 4, SEEK_CUR);
|
||||
|
||||
org_hitSize += hitSize;
|
||||
|
||||
fwrite(&org_hitSize, 8, 1, outFile);
|
||||
fseek(outFile, 0, SEEK_END);
|
||||
|
||||
}else{
|
||||
outFile = fopen(outFileName.c_str(), "wb"); //overwrite binary
|
||||
uint32_t header = 0xAA000000;
|
||||
header += sn;
|
||||
fwrite( &header, 4, 1, outFile );
|
||||
fwrite( &hitSize, 8, 1, outFile);
|
||||
}
|
||||
|
||||
|
||||
for( ulong i = 0; i < hitSize; i++){
|
||||
|
||||
if( i% 10000 == 0 ) printf("Saving %lu/%lu Hit (%.2f%%)\n\033[A\r", i, hitSize, i*100./hitSize);
|
||||
|
||||
uint16_t flag = hitList[i].ch + (hitList[i].pileUp << 8) ;
|
||||
|
||||
if( DPPType == DPPTypeCode::DPP_PSD_CODE ) flag += ( 1 << 15);
|
||||
if( hitList[i].traceLength > 0 ) flag += (1 << 14);
|
||||
|
||||
// fwrite( &(hit[i].ch), 1, 1, outFile);
|
||||
fwrite( &flag, 2, 1, outFile);
|
||||
fwrite( &(hitList[i].energy), 2, 1, outFile);
|
||||
if( DPPType == DPPTypeCode::DPP_PSD_CODE ) fwrite( &(hitList[i].energy2), 2, 1, outFile);
|
||||
fwrite( &(hitList[i].timestamp), 6, 1, outFile);
|
||||
fwrite( &(hitList[i].fineTime), 2, 1, outFile);
|
||||
if( hitList[i].traceLength > 0 ) fwrite( &(hitList[i].traceLength), 2, 1, outFile);
|
||||
|
||||
for( uShort j = 0; j < hitList[i].traceLength; j++){
|
||||
fwrite( &(hitList[i].trace[j]), 2, 1, outFile);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
off_t tsFileSize = ftello(outFile); // unsigned int = Max ~4GB
|
||||
fclose(outFile);
|
||||
|
||||
printf("Saved to %s, size: ", outFileName.c_str());
|
||||
if( tsFileSize < 1024 ) {
|
||||
printf(" %ld Byte", tsFileSize);
|
||||
}else if( tsFileSize < 1024*1024 ) {
|
||||
printf(" %.2f kB", tsFileSize/1024.);
|
||||
}else if( tsFileSize < 1024*1024*1024){
|
||||
printf(" %.2f MB", tsFileSize/1024./1024.);
|
||||
}else{
|
||||
printf(" %.2f GB", tsFileSize/1024./1024./1024.);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
return outFileName;
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
#ifndef MACRO_H
|
||||
#define MACRO_H
|
||||
|
||||
#define MaxNPorts 4 //for optical link
|
||||
#define MaxNBoards 4 //for both optical link and usb
|
||||
|
||||
#define MaxNDigitizer MaxNPorts * MaxNBoards
|
||||
|
||||
#define MaxRegChannel 16
|
||||
#define MaxNChannels 64
|
||||
#define MaxRecordLength 0x3fff * 8
|
||||
#define MaxSaveFileSize 1024 * 1024 * 1024 * 2
|
||||
|
||||
#define MaxDisplayTraceTimeLength 20000 //ns
|
||||
#define ScopeUpdateMiliSec 200 // msec
|
||||
#define MaxNumberOfTrace 5 // in an event
|
||||
|
||||
#define SETTINGSIZE 2048
|
||||
|
||||
#define DAQLockFile "DAQLock.dat"
|
||||
#define PIDFile "pid.dat"
|
||||
|
||||
#include <sys/time.h> /** struct timeval, select() */
|
||||
|
||||
inline unsigned int getTime_us(){
|
||||
unsigned int time_us;
|
||||
struct timeval t1;
|
||||
struct timezone tz;
|
||||
gettimeofday(&t1, &tz);
|
||||
time_us = (t1.tv_sec) * 1000 * 1000 + t1.tv_usec;
|
||||
return time_us;
|
||||
}
|
||||
|
||||
#include <chrono>
|
||||
inline unsigned long long getTime_ns(){
|
||||
std::chrono::high_resolution_clock::time_point currentTime = std::chrono::high_resolution_clock::now();
|
||||
std::chrono::nanoseconds nanoseconds = std::chrono::duration_cast<std::chrono::nanoseconds>(currentTime.time_since_epoch());
|
||||
return nanoseconds.count();
|
||||
}
|
||||
|
||||
typedef unsigned short uShort;
|
||||
typedef unsigned int uInt;
|
||||
typedef unsigned long uLong;
|
||||
typedef unsigned long long ullong;
|
||||
|
||||
#define DebugMode 0 //process check, when 1, print out all function call
|
||||
|
||||
// if DebugMode is 1, define DebugPrint() to be printf(), else, DebugPrint() define nothing
|
||||
#if DebugMode
|
||||
#define DebugPrint(fmt, ...) printf(fmt "::%s\n",##__VA_ARGS__, __func__);
|
||||
#else
|
||||
#define DebugPrint(fmt, ...)
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
#!/bin/bash
|
||||
#parallel -j 6 echo ./ProcessRun.sh {1} 2000 0 ::: {020..400}
|
||||
|
||||
parallel --jobs 1 --results log/log_{}.txt --memfree 1G --ctag -j 1 ./ProcessRun.sh {1} 2000 0 ::: {109..400} # for 17F
|
||||
|
||||
# parallel --results log/log_{}.txt --ctag -j 6 ./ProcessRun.sh {1} 4000 0 ::: {5..21}
|
||||
270
Calibration.C
270
Calibration.C
|
|
@ -1,270 +0,0 @@
|
|||
|
||||
#define Calibration_cxx
|
||||
|
||||
#include <TH2.h>
|
||||
#include <TF1.h>
|
||||
#include <TStyle.h>
|
||||
#include <TCanvas.h>
|
||||
#include <TMath.h>
|
||||
#include <TCutG.h>
|
||||
#include <fstream>
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
#include "Armory/HistPlotter.h"
|
||||
#include "TVector3.h"
|
||||
#include "Calibration.h"
|
||||
|
||||
TH2F *hQQQFVB;
|
||||
HistPlotter *plotter;
|
||||
int padID = 0;
|
||||
|
||||
TCutG *cut;
|
||||
std::map<std::tuple<int, int, int>, std::vector<std::pair<double, double>>> dataPoints;
|
||||
|
||||
bool qqqEcut = false;
|
||||
|
||||
// Gain Arrays
|
||||
const int MAX_QQQ = 4;
|
||||
const int MAX_RING = 16;
|
||||
const int MAX_WEDGE = 16;
|
||||
double qqqwGain[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{0}}};
|
||||
// double qqqrGain[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{0}}};
|
||||
bool qqqwGainValid[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{false}}};
|
||||
// bool qqqrGainValid[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{false}}};
|
||||
|
||||
void Calibration::Begin(TTree * /*tree*/)
|
||||
{
|
||||
plotter = new HistPlotter("Calib.root", "TFILE");
|
||||
// ----------------------- Load QQQ Gains
|
||||
{
|
||||
std::string filename = "qqq_GainMatch.txt";
|
||||
std::ifstream infile(filename);
|
||||
if (!infile.is_open())
|
||||
{
|
||||
std::cerr << "Error opening " << filename << "!" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
int det, ring, wedge;
|
||||
double gainw, gainr;
|
||||
while (infile >> det >> ring >> wedge >> gainw >> gainr)
|
||||
{
|
||||
qqqwGain[det][ring][wedge] = gainw;
|
||||
// qqqrGain[det][ring][wedge] = gainr;
|
||||
qqqwGainValid[det][ring][wedge] = (gainw > 0);
|
||||
// qqqrGainValid[det][ring][wedge] = (gainr > 0);
|
||||
}
|
||||
infile.close();
|
||||
std::cout << "Loaded QQQ gains from " << filename << std::endl;
|
||||
}
|
||||
}
|
||||
for (int det = 0; det < MAX_QQQ; det++)
|
||||
{
|
||||
for (int ring = 0; ring < MAX_RING; ring++)
|
||||
{
|
||||
for (int wedge = 0; wedge < MAX_WEDGE; wedge++)
|
||||
{
|
||||
TString hname = Form("hCal_qqq%d_ring%d_wedge%d", det, ring, wedge);
|
||||
TString htitle = Form("QQQ det%d ring%d wedge%d; Energy (arb); Counts", det, ring, wedge);
|
||||
// hQQQSpectra[det][ring][wedge] = new TH1F(hname, htitle, 4000, 0, 16000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Bool_t Calibration::Process(Long64_t entry)
|
||||
{
|
||||
b_qqqMulti->GetEntry(entry);
|
||||
b_qqqID->GetEntry(entry);
|
||||
b_qqqCh->GetEntry(entry);
|
||||
b_qqqE->GetEntry(entry);
|
||||
b_qqqT->GetEntry(entry);
|
||||
|
||||
qqq.CalIndex();
|
||||
|
||||
for (int i = 0; i < qqq.multi; i++)
|
||||
{
|
||||
for (int j = i + 1; j < qqq.multi; j++)
|
||||
{
|
||||
if (qqq.e[i] > 100)
|
||||
qqqEcut = true;
|
||||
if (qqq.id[i] == qqq.id[j])
|
||||
{
|
||||
int chWedge = -1;
|
||||
int chRing = -1;
|
||||
float eWedgeRaw = 0.0;
|
||||
float eWedge = 0.0;
|
||||
float eRingRaw = 0.0;
|
||||
float eRing = 0.0;
|
||||
if (qqq.ch[i] < 16 && qqq.ch[j] >= 16 && /*qqqrGainValid[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16] &&*/ qqqwGainValid[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16])
|
||||
{
|
||||
chWedge = qqq.ch[i];
|
||||
eWedgeRaw = qqq.e[i];
|
||||
eWedge = qqq.e[i] * qqqwGain[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16];
|
||||
// printf("Wedge E: %.2f Gain: %.4f \n", eWedge, qqqGain[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16]);
|
||||
chRing = qqq.ch[j] - 16;
|
||||
eRingRaw = qqq.e[j];
|
||||
eRing = qqq.e[j];// * qqqrGain[qqq.id[j]][qqq.ch[j]][qqq.ch[i] - 16];
|
||||
}
|
||||
else if (qqq.ch[j] < 16 && qqq.ch[i] >= 16 && /*qqqrGainValid[qqq.id[j]][qqq.ch[j]][qqq.ch[i] - 16] &&*/ qqqwGainValid[qqq.id[j]][qqq.ch[j]][qqq.ch[i] - 16])
|
||||
{
|
||||
chWedge = qqq.ch[j];
|
||||
eWedge = qqq.e[j] * qqqwGain[qqq.id[j]][qqq.ch[j]][qqq.ch[i] - 16];
|
||||
eWedgeRaw = qqq.e[j];
|
||||
|
||||
chRing = qqq.ch[i] - 16;
|
||||
eRing = qqq.e[i];// * qqqrGain[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16];
|
||||
eRingRaw = qqq.e[i];
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
// hQQQFVB->Fill(eWedge, eRing);
|
||||
plotter->Fill2D(Form("hRaw_qqq%d_ring%d_wedge%d", qqq.id[i], chRing, chWedge), 400, 0, 16000, 400, 0, 16000, eWedgeRaw, eRingRaw, "ERaw");
|
||||
plotter->Fill2D(Form("hGM_qqq%d_ring%d_wedge%d", qqq.id[i], chRing, chWedge), 400, 0, 16000, 400, 0, 16000, eWedge, eRing, "EGM");
|
||||
plotter->Fill2D("hRawQQQ", 4000, 0, 16000, 4000, 0, 16000, eWedgeRaw, eRingRaw);
|
||||
plotter->Fill2D("hGMQQQ", 4000, 0, 16000, 4000, 0, 16000, eWedge, eRing);
|
||||
|
||||
TString histName = Form("hQQQFVB_id%d_r%d_w%d", qqq.id[i], chRing, chWedge);
|
||||
// TH2F *hist2d = (TH2F *)gDirectory->Get(histName);
|
||||
// if (!hist2d)
|
||||
// {
|
||||
// hist2d = new TH2F(histName, Form("QQQ Det%d R%d W%d;Wedge E;Ring E", qqq.id[i], chRing, chWedge), 400, 0, 16000, 400, 0, 16000);
|
||||
// }
|
||||
|
||||
// hist2d->Fill(eWedge, eRing);
|
||||
// if (cut && cut->IsInside(eWedge, eRing))
|
||||
const double MIN_ADC = 1500.0;
|
||||
const double MAX_ADC = 3000.0;
|
||||
|
||||
// if (eWedge >= MIN_ADC && eWedge <= MAX_ADC &&
|
||||
// eRing >= MIN_ADC && eRing <= MAX_ADC)
|
||||
double ratio = (eWedge > 0.0) ? (eRing / eWedge) : 0.0;
|
||||
|
||||
double maxslope = 1.5;
|
||||
|
||||
bool validPoint = false;
|
||||
if (ratio < maxslope && ratio > 1. / maxslope)
|
||||
{
|
||||
// Accumulate data for gain matching
|
||||
dataPoints[{qqq.id[i], chRing, chWedge}].emplace_back(eWedge, eRing);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return kTRUE;
|
||||
}
|
||||
|
||||
void Calibration::Terminate()
|
||||
{
|
||||
const double AM241_PEAK = 5485.56;
|
||||
const double P_PEAK = 7000; // keV
|
||||
|
||||
double calibArray[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{0}}};
|
||||
bool calibValid[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{false}}};
|
||||
|
||||
std::ofstream outFile("qqq_Calib.txt");
|
||||
if (!outFile.is_open())
|
||||
{
|
||||
std::cerr << "Error opening qqq_Calib.txt!" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// 1. Create per–channel 1D spectra in ADC from stored gain-matched data
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
std::map<std::tuple<int, int, int>, TH1F *> spectra;
|
||||
|
||||
for (auto &kv : dataPoints)
|
||||
{
|
||||
int det, ring, wedge;
|
||||
std::tie(det, ring, wedge) = kv.first;
|
||||
|
||||
TString hname = Form("hSpec_d%d_r%d_w%d", det, ring, wedge);
|
||||
TH1F *h = new TH1F(hname, hname, 4000, 0, 16000);
|
||||
|
||||
for (auto &p : kv.second)
|
||||
{
|
||||
double eWedge = p.first; // already gain-matched ADC
|
||||
double eRing = p.second;
|
||||
|
||||
// Use ring ADC for calibration (cleaner alpha peak)
|
||||
h->Fill(eRing);
|
||||
}
|
||||
|
||||
spectra[kv.first] = h;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// 2. Fit Am-241 peak and extract keV/ADC calibration slope
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
for (auto &kv : spectra)
|
||||
{
|
||||
int det, ring, wedge;
|
||||
std::tie(det, ring, wedge) = kv.first;
|
||||
TH1F *h = kv.second;
|
||||
|
||||
if (!h || h->GetEntries() < 50)
|
||||
continue;
|
||||
|
||||
int binMax = h->GetMaximumBin();
|
||||
double adcPeak = h->GetXaxis()->GetBinCenter(binMax);
|
||||
|
||||
if (adcPeak <= 0)
|
||||
continue;
|
||||
|
||||
// double slope_keV = AM241_PEAK / adcPeak; // keV per ADC
|
||||
double slope_keV = P_PEAK / adcPeak; // keV per ADC
|
||||
|
||||
calibArray[det][ring][wedge] = slope_keV;
|
||||
calibValid[det][ring][wedge] = true;
|
||||
|
||||
outFile << det << " " << wedge << " " << ring << " "
|
||||
<< slope_keV << "\n";
|
||||
|
||||
// printf("QQQ DET=%d R=%d W=%d ADCpeak=%.1f slope_keV=%.6f\n",det, ring, wedge, adcPeak, slope_keV);
|
||||
}
|
||||
|
||||
outFile.close();
|
||||
std::cout << "Wrote QQQ calibration file qqq_Calib.txt\n";
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// 3. Build fully calibrated 2D combined histogram
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
TH2F *hCal = new TH2F("hCal",
|
||||
"All QQQ Calibrated;Wedge Energy (keV);Ring Energy (keV)",
|
||||
800, 0, 7000,
|
||||
800, 0, 7000);
|
||||
|
||||
for (auto &kv : dataPoints)
|
||||
{
|
||||
int det, ring, wedge;
|
||||
std::tie(det, ring, wedge) = kv.first;
|
||||
|
||||
if (!calibValid[det][ring][wedge])
|
||||
continue;
|
||||
|
||||
double slope = calibArray[det][ring][wedge];
|
||||
|
||||
for (auto &p : kv.second)
|
||||
{
|
||||
double eWGM = p.first; // gain matched ADC
|
||||
double eRGM = p.second;
|
||||
|
||||
double eWkeV = eWGM * slope / 1000;
|
||||
double eRkeV = eRGM * slope / 1000;
|
||||
|
||||
hCal->Fill(eWkeV, eRkeV);
|
||||
plotter->Fill2D("hCalQQQ", 4000, 0, 10, 4000, 0, 10, eWkeV, eRkeV);
|
||||
plotter->Fill2D(Form("hRCal_qqq%d", det), 16, 0, 15, 400, 0, 24, ring, eRkeV, "RingCal");
|
||||
plotter->Fill2D(Form("hWCal_qqq%d", det), 16, 0, 15, 400, 0, 24, wedge, eWkeV, "WedgeCal");
|
||||
}
|
||||
}
|
||||
|
||||
plotter->FlushToDisk();
|
||||
std::cout << "Calibrated 2D QQQ histogram saved.\n";
|
||||
}
|
||||
114
Calibration.h
114
Calibration.h
|
|
@ -1,114 +0,0 @@
|
|||
#ifndef Calibration_h
|
||||
#define Calibration_h
|
||||
|
||||
#include <TROOT.h>
|
||||
#include <TChain.h>
|
||||
#include <TFile.h>
|
||||
#include <TSelector.h>
|
||||
|
||||
#include "Armory/ClassDet.h"
|
||||
|
||||
class Calibration : public TSelector {
|
||||
public :
|
||||
TTree *fChain; //!pointer to the analyzed TTree or TChain
|
||||
|
||||
// Fixed size dimensions of array or collections stored in the TTree if any.
|
||||
|
||||
// Declaration of leaf types
|
||||
Det sx3;
|
||||
Det qqq;
|
||||
Det pc ;
|
||||
|
||||
ULong64_t evID;
|
||||
UInt_t run;
|
||||
|
||||
// List of branches
|
||||
TBranch *b_eventID; //!
|
||||
TBranch *b_run; //!
|
||||
TBranch *b_sx3Multi; //!
|
||||
TBranch *b_sx3ID; //!
|
||||
TBranch *b_sx3Ch; //!
|
||||
TBranch *b_sx3E; //!
|
||||
TBranch *b_sx3T; //!
|
||||
TBranch *b_qqqMulti; //!
|
||||
TBranch *b_qqqID; //!
|
||||
TBranch *b_qqqCh; //!
|
||||
TBranch *b_qqqE; //!
|
||||
TBranch *b_qqqT; //!
|
||||
TBranch *b_pcMulti; //!
|
||||
TBranch *b_pcID; //!
|
||||
TBranch *b_pcCh; //!
|
||||
TBranch *b_pcE; //!
|
||||
TBranch *b_pcT; //!
|
||||
|
||||
Calibration(TTree * /*tree*/ =0) : fChain(0) { }
|
||||
virtual ~Calibration() { }
|
||||
virtual Int_t Version() const { return 2; }
|
||||
virtual void Begin(TTree *tree);
|
||||
virtual void SlaveBegin(TTree *tree);
|
||||
virtual void Init(TTree *tree);
|
||||
virtual Bool_t Notify();
|
||||
virtual Bool_t Process(Long64_t entry);
|
||||
virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0) { return fChain ? fChain->GetTree()->GetEntry(entry, getall) : 0; }
|
||||
virtual void SetOption(const char *option) { fOption = option; }
|
||||
virtual void SetObject(TObject *obj) { fObject = obj; }
|
||||
virtual void SetInputList(TList *input) { fInput = input; }
|
||||
virtual TList *GetOutputList() const { return fOutput; }
|
||||
virtual void SlaveTerminate();
|
||||
virtual void Terminate();
|
||||
|
||||
ClassDef(Calibration,0);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef Calibration_cxx
|
||||
void Calibration::Init(TTree *tree){
|
||||
|
||||
// Set branch addresses and branch pointers
|
||||
if (!tree) return;
|
||||
fChain = tree;
|
||||
fChain->SetMakeClass(1);
|
||||
|
||||
fChain->SetBranchAddress("evID", &evID, &b_eventID);
|
||||
fChain->SetBranchAddress("run", &run, &b_run);
|
||||
|
||||
sx3.SetDetDimension(24,12);
|
||||
qqq.SetDetDimension(4,32);
|
||||
pc.SetDetDimension(2,24);
|
||||
|
||||
fChain->SetBranchAddress("sx3Multi", &sx3.multi, &b_sx3Multi);
|
||||
fChain->SetBranchAddress("sx3ID", &sx3.id, &b_sx3ID);
|
||||
fChain->SetBranchAddress("sx3Ch", &sx3.ch, &b_sx3Ch);
|
||||
fChain->SetBranchAddress("sx3E", &sx3.e, &b_sx3E);
|
||||
fChain->SetBranchAddress("sx3T", &sx3.t, &b_sx3T);
|
||||
fChain->SetBranchAddress("qqqMulti", &qqq.multi, &b_qqqMulti);
|
||||
fChain->SetBranchAddress("qqqID", &qqq.id, &b_qqqID);
|
||||
fChain->SetBranchAddress("qqqCh", &qqq.ch, &b_qqqCh);
|
||||
fChain->SetBranchAddress("qqqE", &qqq.e, &b_qqqE);
|
||||
fChain->SetBranchAddress("qqqT", &qqq.t, &b_qqqT);
|
||||
fChain->SetBranchAddress("pcMulti", &pc.multi, &b_pcMulti);
|
||||
fChain->SetBranchAddress("pcID", &pc.id, &b_pcID);
|
||||
fChain->SetBranchAddress("pcCh", &pc.ch, &b_pcCh);
|
||||
fChain->SetBranchAddress("pcE", &pc.e, &b_pcE);
|
||||
fChain->SetBranchAddress("pcT", &pc.t, &b_pcT);
|
||||
|
||||
}
|
||||
|
||||
Bool_t Calibration::Notify(){
|
||||
|
||||
return kTRUE;
|
||||
}
|
||||
|
||||
void Calibration::SlaveBegin(TTree * /*tree*/){
|
||||
|
||||
TString option = GetOption();
|
||||
|
||||
}
|
||||
|
||||
void Calibration::SlaveTerminate(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // #ifdef Calibration_cxx
|
||||
|
|
@ -1,124 +0,0 @@
|
|||
#include <TFile.h>
|
||||
#include <TH1.h>
|
||||
#include <TSpectrum.h>
|
||||
#include <TF1.h>
|
||||
#include <TCanvas.h>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <TText.h>
|
||||
|
||||
void FitHistogramsWithTSpectrum_Sequential_Improved() {
|
||||
TFile *inputFile = new TFile("Histograms_anodes.root", "READ");
|
||||
if (!inputFile || inputFile->IsZombie()) {
|
||||
std::cerr << "Error opening the input file!" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
TCanvas *c1 = new TCanvas("c1", "Histogram Viewer", 800, 600);
|
||||
|
||||
// Open the output ASCII file to save the centroids
|
||||
std::ofstream outFile("centroids.txt");
|
||||
if (!outFile.is_open()) {
|
||||
std::cerr << "Error opening output file!" << std::endl;
|
||||
return;
|
||||
}
|
||||
outFile << "HistogramIndex\tPeakNumber\tCentroid\tAmplitude\tSigma" << std::endl;
|
||||
|
||||
for (int i = 0; i < 24; ++i) {
|
||||
TH1 *histogram = dynamic_cast<TH1*>(inputFile->Get(Form("hCathode_%d", i)));
|
||||
if (!histogram) {
|
||||
std::cerr << "Failed to retrieve histogram_" << i << " from the file." << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Set range for peak search
|
||||
double minX = 700;
|
||||
double maxX = 25000;
|
||||
histogram->GetXaxis()->SetRangeUser(minX, maxX);
|
||||
|
||||
// Draw the histogram
|
||||
c1->cd();
|
||||
histogram->Draw();
|
||||
|
||||
// Peak search using TSpectrum
|
||||
const int maxPeaks = 5;
|
||||
TSpectrum spectrumFinder(maxPeaks);
|
||||
int nFound = spectrumFinder.Search(histogram, 2, "", 0.01);
|
||||
|
||||
if (nFound <= 0) {
|
||||
std::cerr << "No peaks found for histogram " << i << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
Double_t *xPositions = spectrumFinder.GetPositionX();
|
||||
Double_t *yPositions = spectrumFinder.GetPositionY();
|
||||
std::vector<std::pair<Double_t, Double_t>> peaks;
|
||||
|
||||
// Collect and sort peaks by X position
|
||||
for (int j = 0; j < nFound; ++j) {
|
||||
peaks.emplace_back(xPositions[j], yPositions[j]);
|
||||
}
|
||||
std::sort(peaks.begin(), peaks.end());
|
||||
|
||||
// Fit each peak with a Gaussian
|
||||
for (int j = 0; j < peaks.size(); ++j) {
|
||||
Double_t peakX = peaks[j].first;
|
||||
Double_t peakY = peaks[j].second;
|
||||
Double_t initialAmplitude = peakY; // Better initial guess
|
||||
Double_t initialCentroid = peakX; // Centroid based on peak position
|
||||
Double_t initialSigma = 60.0;
|
||||
// Define Gaussian with initial parameters
|
||||
TF1 *gaussFit = new TF1(Form("gauss_%d", j), "gaus", peakX - 200, peakX + 200);
|
||||
//gaussFit->SetParameters(peakY, peakX, 25.0); // Initial guesses for amplitude, mean, sigma
|
||||
gaussFit->SetParameters(initialAmplitude, initialCentroid, initialSigma);
|
||||
// Perform fit
|
||||
int fitStatus = histogram->Fit(gaussFit, "RQ+");
|
||||
if (fitStatus != 0) {
|
||||
std::cerr << "Fit failed for peak " << j + 1 << " in histogram " << i << std::endl;
|
||||
delete gaussFit;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Retrieve fit parameters
|
||||
double amplitude = gaussFit->GetParameter(0);
|
||||
double centroid = gaussFit->GetParameter(1);
|
||||
double sigma = gaussFit->GetParameter(2);
|
||||
double amplitudeError = gaussFit->GetParError(0);
|
||||
double centroidError = gaussFit->GetParError(1);
|
||||
double sigmaError = gaussFit->GetParError(2);
|
||||
|
||||
// Chi-squared value
|
||||
double chi2 = gaussFit->GetChisquare();
|
||||
int ndf = gaussFit->GetNDF();
|
||||
outFile << i << "\t" << j + 1 << "\t" << centroid << std::endl;
|
||||
gaussFit->SetLineColor(kRed);
|
||||
gaussFit->Draw("SAME");
|
||||
TText *text = new TText();
|
||||
text->SetNDC();
|
||||
text->SetTextSize(0.03);
|
||||
text->SetTextColor(kRed);
|
||||
//text->DrawText(0.15, 0.8 - j * 0.05, Form("Peak %d: Amp=%.2f, Mean=%.2f, Sigma=%.2f", j + 1, amplitude, centroid, sigma));
|
||||
text->DrawText(0.15, 0.8 - j * 0.05,
|
||||
Form("Peak %d: Amp=%.2f±%.2f, Mean=%.2f±%.2f, Sigma=%.2f±%.2f, Chi2/NDF=%.2f",
|
||||
j + 1, amplitude, amplitudeError, centroid, centroidError, sigma, sigmaError, chi2 / ndf));
|
||||
// Save results
|
||||
|
||||
|
||||
// Clean up
|
||||
delete gaussFit;
|
||||
}
|
||||
|
||||
// Update canvas for visualization
|
||||
c1->Update();
|
||||
std::cout << "Press Enter to view the next histogram..." << std::endl;
|
||||
c1->WaitPrimitive(); // Wait until Enter is pressed in the ROOT console
|
||||
}
|
||||
|
||||
// Close resources
|
||||
inputFile->Close();
|
||||
outFile.close();
|
||||
delete c1;
|
||||
}
|
||||
|
||||
309
GainMatchQQQ.C
309
GainMatchQQQ.C
|
|
@ -1,309 +0,0 @@
|
|||
#define GainMatchQQQ_cxx
|
||||
|
||||
#include "GainMatchQQQ.h"
|
||||
#include <TH2.h>
|
||||
#include <TF1.h>
|
||||
#include <TStyle.h>
|
||||
#include <TCanvas.h>
|
||||
#include <TMath.h>
|
||||
#include <TCutG.h>
|
||||
#include <fstream>
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <numeric>
|
||||
#include "Armory/HistPlotter.h"
|
||||
#include "TVector3.h"
|
||||
#include "TGraphErrors.h"
|
||||
#include "TF1.h"
|
||||
#include <cmath>
|
||||
|
||||
TH2F *hQQQFVB;
|
||||
HistPlotter *plotter;
|
||||
|
||||
int padID = 0;
|
||||
|
||||
TCutG *cut;
|
||||
std::map<std::tuple<int, int, int>, std::vector<std::pair<double, double>>> dataPoints;
|
||||
|
||||
void GainMatchQQQ::Begin(TTree * /*tree*/)
|
||||
{
|
||||
plotter = new HistPlotter("GainQQQ.root", "TFILE");
|
||||
TString option = GetOption();
|
||||
|
||||
hQQQFVB = new TH2F("hQQQFVB", "QQQ Front vs Back; Front E; Back E", 800, 0, 16000, 800, 0, 16000);
|
||||
|
||||
// Load the TCutG object
|
||||
TFile *cutFile = TFile::Open("qqqcorr.root");
|
||||
if (!cutFile || cutFile->IsZombie())
|
||||
{
|
||||
std::cerr << "Error: Could not open qqqcorr.root" << std::endl;
|
||||
return;
|
||||
}
|
||||
cut = dynamic_cast<TCutG *>(cutFile->Get("qqqcorr"));
|
||||
if (!cut)
|
||||
{
|
||||
std::cerr << "Error: Could not find TCutG named 'qqqcorr' in qqqcorr.root" << std::endl;
|
||||
return;
|
||||
}
|
||||
cut->SetName("qqqcorr"); // Ensure the cut has the correct name
|
||||
}
|
||||
|
||||
Bool_t GainMatchQQQ::Process(Long64_t entry)
|
||||
{
|
||||
|
||||
int ringMults[16] = {0};
|
||||
int wedgeMults[16] = {0};
|
||||
std::vector<std::tuple<int, int, int, double, double>> events;
|
||||
|
||||
b_qqqMulti->GetEntry(entry);
|
||||
b_qqqID->GetEntry(entry);
|
||||
b_qqqCh->GetEntry(entry);
|
||||
b_qqqE->GetEntry(entry);
|
||||
b_qqqT->GetEntry(entry);
|
||||
|
||||
qqq.CalIndex();
|
||||
|
||||
for (int i = 0; i < qqq.multi; i++)
|
||||
{
|
||||
for (int j = i + 1; j < qqq.multi; j++)
|
||||
{
|
||||
if (qqq.id[i] == qqq.id[j])
|
||||
{
|
||||
int chWedge = -1;
|
||||
int chRing = -1;
|
||||
float eWedge = 0.0;
|
||||
float eRing = 0.0;
|
||||
if (qqq.ch[i] < 16 && qqq.ch[j] >= 16)
|
||||
{
|
||||
chWedge = qqq.ch[i];
|
||||
eWedge = qqq.e[i];
|
||||
chRing = qqq.ch[j] - 16;
|
||||
eRing = qqq.e[j];
|
||||
}
|
||||
else if (qqq.ch[j] < 16 && qqq.ch[i] >= 16)
|
||||
{
|
||||
chWedge = qqq.ch[j];
|
||||
eWedge = qqq.e[j];
|
||||
chRing = qqq.ch[i] - 16;
|
||||
eRing = qqq.e[i];
|
||||
}
|
||||
else
|
||||
continue;
|
||||
ringMults[chRing]++;
|
||||
wedgeMults[chWedge]++;
|
||||
hQQQFVB->Fill(eWedge, eRing);
|
||||
events.emplace_back(qqq.id[i], chRing, chWedge, eRing, eWedge);
|
||||
plotter->Fill2D(Form("hRaw_qqq%d_ring%d_wedge%d", qqq.id[i], chRing, chWedge), 800, 0, 3000, 800, 0, 3000, eWedge, eRing, "hRawQQQ");
|
||||
// double ratio = (eWedge > 0.0) ? (eRing / eWedge) : 0.0;
|
||||
// double maxslope = 1.5;
|
||||
|
||||
// bool validPoint = false;
|
||||
// if (ratio < maxslope && ratio > 1. / maxslope)
|
||||
// {
|
||||
// // Accumulate data for gain matching
|
||||
// dataPoints[{qqq.id[i], chRing, chWedge}].emplace_back(eWedge, eRing);
|
||||
// plotter->Fill2D("hAll_in", 4000, 0, 16000, 4000, 0, 16000, eWedge, eRing);
|
||||
// validPoint = true;
|
||||
// }
|
||||
|
||||
// if (!validPoint)
|
||||
// {
|
||||
// plotter->Fill2D("hAll_out", 4000, 0, 16000, 4000, 0, 16000, eWedge, eRing);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto tuple : events)
|
||||
{
|
||||
auto [id, chr, chw, er, ew] = tuple;
|
||||
if (ringMults[chr] > 1 || wedgeMults[chw] > 1)
|
||||
continue; // ignore multiplicity > 1 events
|
||||
double ratio = (ew > 0.0) ? (er / ew) : 0.0;
|
||||
double maxslope = 1.5;
|
||||
|
||||
bool validPoint = false;
|
||||
if (ratio < maxslope && ratio > 1. / maxslope)
|
||||
{
|
||||
// Accumulate data for gain matching
|
||||
dataPoints[{id, chr, chw}].emplace_back(ew, er);
|
||||
plotter->Fill2D("hAll_in", 4000, 0, 16000, 4000, 0, 16000, ew, er);
|
||||
validPoint = true;
|
||||
}
|
||||
if (!validPoint)
|
||||
{
|
||||
plotter->Fill2D("hAll_out", 4000, 0, 16000, 4000, 0, 16000, ew, er);
|
||||
}
|
||||
}
|
||||
|
||||
return kTRUE;
|
||||
}
|
||||
|
||||
|
||||
void GainMatchQQQ::Terminate()
|
||||
{
|
||||
const int MAX_DET = 4;
|
||||
const int MAX_RING = 16;
|
||||
const int MAX_WEDGE = 16;
|
||||
|
||||
// We store gains locally just for the "corrected" plot,
|
||||
// but the file will output Slopes for the global minimizer.
|
||||
double gainW[MAX_DET][MAX_RING][MAX_WEDGE] = {{{0}}};
|
||||
double gainR[MAX_DET][MAX_RING][MAX_WEDGE] = {{{0}}};
|
||||
bool gainValid[MAX_DET][MAX_RING][MAX_WEDGE] = {{{false}}};
|
||||
|
||||
// Output file for the Minimizer
|
||||
std::ofstream outFile("qqq_GainMatch.txt");
|
||||
|
||||
// Benchmark/Debug file
|
||||
std::ofstream benchFile("benchmark_diff.txt");
|
||||
benchFile << "ID Wedge Ring Chi2NDF Slope SlopeErr" << std::endl;
|
||||
|
||||
if (!outFile.is_open()) { std::cerr << "Error opening output file!" << std::endl; return; }
|
||||
|
||||
const int MIN_POINTS = 50;
|
||||
const int MAX_ITER = 3; // Outlier rejection passes
|
||||
const double CLIP_SIGMA = 2.5; // Sigma threshold for outliers
|
||||
|
||||
for (const auto &kv : dataPoints)
|
||||
{
|
||||
auto key = kv.first;
|
||||
auto [id, ring, wedge] = key;
|
||||
const auto &pts = kv.second;
|
||||
|
||||
if (pts.size() < (size_t)MIN_POINTS) continue;
|
||||
|
||||
std::vector<std::pair<double, double>> current_pts = pts;
|
||||
|
||||
double finalSlope = 0.0;
|
||||
double finalSlopeErr = 0.0;
|
||||
bool converged = false;
|
||||
|
||||
// --- Iterative Fitting ---
|
||||
for (int iter = 0; iter < MAX_ITER; ++iter)
|
||||
{
|
||||
if (current_pts.size() < (size_t)MIN_POINTS) break;
|
||||
|
||||
std::vector<double> x, y, ex, ey;
|
||||
|
||||
for (const auto &p : current_pts)
|
||||
{
|
||||
x.push_back(p.first); // Wedge E
|
||||
y.push_back(p.second); // Ring E
|
||||
ex.push_back(std::sqrt(std::abs(p.first))); // Error in X (Poisson)
|
||||
ey.push_back(std::sqrt(std::abs(p.second))); // Error in Y (Poisson)
|
||||
|
||||
// Sanity check to avoid 0 error
|
||||
if(ex.back() < 1.0) ex.back() = 1.0;
|
||||
if(ey.back() < 1.0) ey.back() = 1.0;
|
||||
}
|
||||
|
||||
// 2. Create Graph
|
||||
TGraphErrors *gr = new TGraphErrors(current_pts.size(), x.data(), y.data(), ex.data(), ey.data());
|
||||
|
||||
// 3. Fit Linear Function through Origin
|
||||
TF1 *f1= new TF1("calibFit", "[0]*x", 0, 16000);
|
||||
f1->SetParameter(0, 1.0);
|
||||
|
||||
// "Q"=Quiet, "N"=NoDraw, "S"=ResultPtr
|
||||
// We do NOT use "W" (Ignore weights), we want to use the errors we set.
|
||||
int fitStatus = gr->Fit(f1, "QNS");
|
||||
|
||||
if (fitStatus != 0) {
|
||||
delete gr; delete f1;
|
||||
break;
|
||||
}
|
||||
|
||||
finalSlope = f1->GetParameter(0);
|
||||
double chi2 = f1->GetChisquare();
|
||||
double ndf = f1->GetNDF();
|
||||
|
||||
// Get the statistical error on the slope
|
||||
double rawErr = f1->GetParError(0);
|
||||
|
||||
// SCALING ERROR:
|
||||
// If Chi2/NDF > 1, the data scatters more than Poisson stats predict.
|
||||
// // We inflate the error by sqrt(Chi2/NDF) to be conservative for the Minimizer.
|
||||
// double redChi2 = (ndf > 0) ? (chi2 / ndf) : 1.0;
|
||||
// double inflation = (redChi2 > 1.0) ? std::sqrt(redChi2) : 1.0;
|
||||
|
||||
// finalSlopeErr = rawErr * inflation;
|
||||
|
||||
// 4. Outlier Rejection
|
||||
if (iter == MAX_ITER - 1) {
|
||||
converged = true;
|
||||
delete gr; delete f1;
|
||||
break;
|
||||
}
|
||||
|
||||
// Calculate Residuals
|
||||
std::vector<double> residuals;
|
||||
double sumSqResid = 0.0;
|
||||
for(size_t k=0; k<current_pts.size(); ++k) {
|
||||
double val = f1->Eval(current_pts[k].first);
|
||||
double res = current_pts[k].second - val;
|
||||
residuals.push_back(res);
|
||||
sumSqResid += res*res;
|
||||
}
|
||||
// double sigma = std::sqrt(sumSqResid / current_pts.size());
|
||||
|
||||
// // Filter
|
||||
// std::vector<std::pair<double, double>> next_pts;
|
||||
// for(size_t k=0; k<current_pts.size(); ++k) {
|
||||
// if(std::abs(residuals[k]) < CLIP_SIGMA * sigma) {
|
||||
// next_pts.push_back(current_pts[k]);
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (next_pts.size() == current_pts.size()) {
|
||||
// converged = true;
|
||||
// delete gr; delete f1;
|
||||
// break;
|
||||
// }
|
||||
// current_pts = next_pts;
|
||||
// delete gr; delete f1;
|
||||
}
|
||||
|
||||
if (!converged || finalSlope <= 0) continue;
|
||||
|
||||
// --- Store/Output ---
|
||||
|
||||
// 1. Save locally for the verification plot (hAll)
|
||||
// Approximate local gain for plotting purposes only
|
||||
double gW_local = std::sqrt(finalSlope);
|
||||
double gR_local = 1.0 / gW_local;
|
||||
gainW[id][ring][wedge] = gW_local;
|
||||
gainR[id][ring][wedge] = gR_local;
|
||||
gainValid[id][ring][wedge] = true;
|
||||
|
||||
// 2. Write to File for Minimizer
|
||||
// Format: ID Wedge Ring Slope Error
|
||||
outFile << id << " " << wedge << " " << ring << " " << finalSlope << " " << finalSlopeErr << std::endl;
|
||||
|
||||
// 3. Benchmark Info
|
||||
benchFile << id << " " << wedge << " " << ring << " "
|
||||
<< finalSlope << " " << finalSlopeErr << std::endl;
|
||||
}
|
||||
|
||||
outFile.close();
|
||||
benchFile.close();
|
||||
std::cout << "Gain matching with Errors complete." << std::endl;
|
||||
|
||||
// Plotting the corrected data (Visual check using local approx gains)
|
||||
for (auto &kv : dataPoints)
|
||||
{
|
||||
int id, ring, wedge;
|
||||
std::tie(id, ring, wedge) = kv.first;
|
||||
if (!gainValid[id][ring][wedge]) continue;
|
||||
auto &pts = kv.second;
|
||||
for (auto &pr : pts)
|
||||
{
|
||||
double corrWedge = pr.first * gainW[id][ring][wedge];
|
||||
double corrRing = pr.second * gainR[id][ring][wedge];
|
||||
plotter->Fill2D("hAll", 4000, 0, 16000, 4000, 0, 16000, corrWedge, corrRing);
|
||||
}
|
||||
}
|
||||
|
||||
plotter->FlushToDisk();
|
||||
}
|
||||
2158
MakeVertex.C
2158
MakeVertex.C
File diff suppressed because it is too large
Load Diff
133
MakeVertex.h
133
MakeVertex.h
|
|
@ -1,133 +0,0 @@
|
|||
#ifndef MakeVertex_h
|
||||
#define MakeVertex_h
|
||||
|
||||
#include <TROOT.h>
|
||||
#include <TChain.h>
|
||||
#include <TApplication.h>
|
||||
#include <TFile.h>
|
||||
#include <TSelector.h>
|
||||
#include <iomanip>
|
||||
#include <vector> // Required for vectors
|
||||
#include <utility> // Required for std::pair
|
||||
|
||||
#include "Armory/ClassDet.h"
|
||||
#include "Armory/ClassPW.h" // YOU ADDED THIS (Correct! Defines Coord)
|
||||
|
||||
class MakeVertex : public TSelector {
|
||||
public :
|
||||
TTree *fChain; //!pointer to the analyzed TTree or TChain
|
||||
|
||||
// Declaration of leaf types
|
||||
Det sx3;
|
||||
Det qqq;
|
||||
Det pc ;
|
||||
Det misc;
|
||||
|
||||
ULong64_t evID;
|
||||
UInt_t run;
|
||||
|
||||
// List of branches
|
||||
TBranch *b_eventID; //!
|
||||
TBranch *b_run; //!
|
||||
TBranch *b_sx3Multi; //!
|
||||
TBranch *b_sx3ID; //!
|
||||
TBranch *b_sx3Ch; //!
|
||||
TBranch *b_sx3E; //!
|
||||
TBranch *b_sx3T; //!
|
||||
TBranch *b_qqqMulti; //!
|
||||
TBranch *b_qqqID; //!
|
||||
TBranch *b_qqqCh; //!
|
||||
TBranch *b_qqqE; //!
|
||||
TBranch *b_qqqT; //!
|
||||
TBranch *b_pcMulti; //!
|
||||
TBranch *b_pcID; //!
|
||||
TBranch *b_pcCh; //!
|
||||
TBranch *b_pcE; //!
|
||||
TBranch *b_pcT; //!
|
||||
TBranch *b_miscMulti; //!
|
||||
TBranch *b_miscID; //!
|
||||
TBranch *b_miscCh; //!
|
||||
TBranch *b_miscE; //!
|
||||
TBranch *b_miscT; //!
|
||||
TBranch *b_miscTf; //!
|
||||
|
||||
// 1. Geometry Cache
|
||||
Coord Crossover[24][24][2];
|
||||
|
||||
// 2. Persistent Vectors (REQUIRED for the optimized .cxx to work)
|
||||
std::vector<std::pair<int, double>> anodeHits;
|
||||
std::vector<std::pair<int, double>> cathodeHits;
|
||||
std::vector<std::pair<int, double>> corrcatMax;
|
||||
std::vector<std::pair<int, double>> corranoMax;
|
||||
std::vector<double> cathodeTimes;
|
||||
std::vector<double> anodeTimes;
|
||||
|
||||
MakeVertex(TTree * /*tree*/ =0) : fChain(0) { }
|
||||
virtual ~MakeVertex() { }
|
||||
virtual Int_t Version() const { return 2; }
|
||||
virtual void Begin(TTree *tree);
|
||||
virtual void SlaveBegin(TTree *tree);
|
||||
virtual void Init(TTree *tree);
|
||||
virtual Bool_t Notify();
|
||||
virtual Bool_t Process(Long64_t entry);
|
||||
virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0) { return fChain ? fChain->GetTree()->GetEntry(entry, getall) : 0; }
|
||||
virtual void SetOption(const char *option) { fOption = option; }
|
||||
virtual void SetObject(TObject *obj) { fObject = obj; }
|
||||
virtual void SetInputList(TList *input) { fInput = input; }
|
||||
virtual TList *GetOutputList() const { return fOutput; }
|
||||
virtual void SlaveTerminate();
|
||||
virtual void Terminate();
|
||||
|
||||
ClassDef(MakeVertex,0);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MakeVertex_cxx
|
||||
void MakeVertex::Init(TTree *tree){
|
||||
|
||||
if (!tree) return;
|
||||
fChain = tree;
|
||||
fChain->SetMakeClass(1);
|
||||
|
||||
fChain->SetBranchAddress("evID", &evID, &b_eventID);
|
||||
fChain->SetBranchAddress("run", &run, &b_run);
|
||||
|
||||
sx3.SetDetDimension(24,12);
|
||||
qqq.SetDetDimension(4,32);
|
||||
pc.SetDetDimension(2,24);
|
||||
|
||||
fChain->SetBranchAddress("sx3Multi", &sx3.multi, &b_sx3Multi);
|
||||
fChain->SetBranchAddress("sx3ID", &sx3.id, &b_sx3ID);
|
||||
fChain->SetBranchAddress("sx3Ch", &sx3.ch, &b_sx3Ch);
|
||||
fChain->SetBranchAddress("sx3E", &sx3.e, &b_sx3E);
|
||||
fChain->SetBranchAddress("sx3T", &sx3.t, &b_sx3T);
|
||||
fChain->SetBranchAddress("qqqMulti", &qqq.multi, &b_qqqMulti);
|
||||
fChain->SetBranchAddress("qqqID", &qqq.id, &b_qqqID);
|
||||
fChain->SetBranchAddress("qqqCh", &qqq.ch, &b_qqqCh);
|
||||
fChain->SetBranchAddress("qqqE", &qqq.e, &b_qqqE);
|
||||
fChain->SetBranchAddress("qqqT", &qqq.t, &b_qqqT);
|
||||
fChain->SetBranchAddress("pcMulti", &pc.multi, &b_pcMulti);
|
||||
fChain->SetBranchAddress("pcID", &pc.id, &b_pcID);
|
||||
fChain->SetBranchAddress("pcCh", &pc.ch, &b_pcCh);
|
||||
fChain->SetBranchAddress("pcE", &pc.e, &b_pcE);
|
||||
fChain->SetBranchAddress("pcT", &pc.t, &b_pcT);
|
||||
fChain->SetBranchAddress("miscMulti", &misc.multi, &b_miscMulti);
|
||||
fChain->SetBranchAddress("miscID", &misc.id, &b_miscID);
|
||||
fChain->SetBranchAddress("miscCh", &misc.ch, &b_miscCh);
|
||||
fChain->SetBranchAddress("miscE", &misc.e, &b_miscE);
|
||||
fChain->SetBranchAddress("miscT", &misc.t, &b_miscT);
|
||||
fChain->SetBranchAddress("miscf", &misc.tf, &b_miscTf);
|
||||
}
|
||||
|
||||
Bool_t MakeVertex::Notify(){
|
||||
return kTRUE;
|
||||
}
|
||||
|
||||
void MakeVertex::SlaveBegin(TTree * /*tree*/){
|
||||
// TString option = GetOption();
|
||||
}
|
||||
|
||||
void MakeVertex::SlaveTerminate(){
|
||||
}
|
||||
#endif // #ifdef MakeVertex_cxx
|
||||
|
|
@ -1,139 +0,0 @@
|
|||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
#include <TGraph.h>
|
||||
#include <TF1.h>
|
||||
#include <TCanvas.h>
|
||||
#include <TH1.h>
|
||||
|
||||
|
||||
|
||||
void MatchAndPlotCentroids() {
|
||||
// Open the centroid data file
|
||||
std::ifstream inputFile("centroids_27Al.txt");
|
||||
// std::ifstream inputFile("centroids_17F.txt");
|
||||
if (!inputFile.is_open()) {
|
||||
std::cerr << "Error: Could not open Centroids.txt" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// Data structure to store centroids by histogram and peak number
|
||||
std::map<int, std::map<int, double>> centroidData;
|
||||
|
||||
// Read data from the file
|
||||
std::string line;
|
||||
while (std::getline(inputFile, line)) {
|
||||
std::istringstream iss(line);
|
||||
int histogramIndex, peakNumber;
|
||||
double centroid;
|
||||
if (iss >> histogramIndex >> peakNumber >> centroid) {
|
||||
centroidData[histogramIndex][peakNumber] = centroid;
|
||||
}
|
||||
}
|
||||
|
||||
inputFile.close();
|
||||
|
||||
// Ensure histogram 24 exists and has data
|
||||
if (centroidData.find(1) == centroidData.end()) {
|
||||
std::cerr << "Error: Histogram 0 not found in the data!" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// Reference centroids from histogram 24
|
||||
const auto& referenceCentroids = centroidData[1];
|
||||
std::ofstream outputFile("slope_intercept_results.dat");
|
||||
if (!outputFile.is_open()) {
|
||||
std::cerr << "Error: Could not open the output file for writing!" << std::endl;
|
||||
return;
|
||||
}
|
||||
outputFile << "Histogram Number\tSlope\tIntercept\n";
|
||||
// Loop through histograms 25 to 47
|
||||
|
||||
// 1. Create a SINGLE canvas BEFORE the loop
|
||||
TCanvas *c1 = new TCanvas("c1", "Centroid Fit Viewer", 800, 600);
|
||||
|
||||
for (int targetHist = 0; targetHist <= 23; targetHist++) {
|
||||
// Ensure the target histogram exists and matches in peak numbers
|
||||
if (centroidData.find(targetHist) == centroidData.end() || centroidData[targetHist].size() != referenceCentroids.size()) {
|
||||
//4th cnetroid data point for 19 was generated using the 3 datqa points for the slope of wires 0 and 19
|
||||
std::cout << "Skipping Histogram " << targetHist << " due to mismatched or missing data." << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Prepare x and y values for TGraph
|
||||
std::vector<double> xValues, yValues;
|
||||
for (const auto& [peakNumber, refCentroid] : referenceCentroids) {
|
||||
if (centroidData[targetHist].find(peakNumber) != centroidData[targetHist].end()) {
|
||||
yValues.push_back(refCentroid);
|
||||
xValues.push_back(centroidData[targetHist][peakNumber]);
|
||||
} else {
|
||||
std::cerr << "Warning: Peak " << peakNumber << " missing in histogram " << targetHist << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (xValues.size() < 3) {
|
||||
std::cout << "Skipping Histogram " << targetHist << " as it has less than 3 matching centroids." << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Create a TGraph
|
||||
TGraph *graph = new TGraph(xValues.size(), &xValues[0], &yValues[0]);
|
||||
graph->SetTitle(Form("Centroid of Histogram %d vs 1", targetHist));
|
||||
graph->GetYaxis()->SetTitle("Centroid of Histogram 1");
|
||||
graph->GetXaxis()->SetTitle(Form("Centroid of Histogram %d", targetHist));
|
||||
graph->SetMarkerStyle(20);
|
||||
graph->SetMarkerSize(1.0);
|
||||
graph->SetMarkerColor(kBlue);
|
||||
|
||||
graph->Draw("AP");
|
||||
// Draw the graph
|
||||
graph->Draw("AP");
|
||||
double minX = *std::min_element(xValues.begin(), xValues.end());
|
||||
double maxX = *std::max_element(xValues.begin(), xValues.end());
|
||||
// Fit the data with a linear function
|
||||
TF1 *fitLine = new TF1("fitLine", "pol1", minX, maxX); // Adjust range as needed
|
||||
fitLine->SetLineColor(kRed); // Set the line color to distinguish it
|
||||
fitLine->SetLineWidth(2); // Thicker line for visibility
|
||||
graph->Fit(fitLine, "M");
|
||||
fitLine->Draw("same");
|
||||
fitLine->SetParLimits(0, -10, 10); // Limit intercept between -10 and 10
|
||||
fitLine->SetParLimits(1, 0, 2);
|
||||
// Extract slope and intercept
|
||||
double slope = fitLine->GetParameter(1);
|
||||
double intercept = fitLine->GetParameter(0);
|
||||
outputFile << targetHist << "\t" << slope << "\t" << intercept << "\n";
|
||||
std::cout << "Histogram 24 vs " << targetHist << ": Slope = " << slope << ", Intercept = " << intercept << std::endl;
|
||||
std::vector<double> residuals;
|
||||
for (size_t i = 0; i < xValues.size(); ++i) {
|
||||
double fittedY = fitLine->Eval(xValues[i]); // Evaluate fitted function at x
|
||||
double residual = yValues[i] - fittedY; // Residual = observed - fitted
|
||||
residuals.push_back(residual);
|
||||
}
|
||||
|
||||
// Create a graph for the residuals
|
||||
/*TGraph *residualGraph = new TGraph(residuals.size(), &xValues[0], &residuals[0]);
|
||||
residualGraph->SetTitle(Form("Residuals for Histogram 24 vs %d", targetHist));
|
||||
residualGraph->GetYaxis()->SetTitle("Residuals");
|
||||
residualGraph->GetXaxis()->SetTitle(Form("Centroid of Histogram %d", targetHist));
|
||||
residualGraph->SetMarkerStyle(20);
|
||||
residualGraph->SetMarkerSize(1.0);
|
||||
residualGraph->SetMarkerColor(kGreen);
|
||||
|
||||
// Draw the residuals plot below the original plot (can be on a new canvas if preferred)
|
||||
TCanvas *c2 = new TCanvas(Form("c_residuals_24_vs_%d", targetHist), Form("Residuals for Centroid 24 vs %d", targetHist), 800, 400);
|
||||
residualGraph->Draw("AP");*/
|
||||
c1->Update();
|
||||
//c2->Update();
|
||||
std::cout << "Press Enter to continue..." << std::endl;
|
||||
|
||||
//std::cin.get();
|
||||
c1->WaitPrimitive();
|
||||
//c2->WaitPrimitive();
|
||||
//std::cin.get();
|
||||
//std::cin.get();
|
||||
}
|
||||
outputFile.close();
|
||||
std::cout << "Results written to slope_intercept_results.txt" << std::endl;
|
||||
}
|
||||
454
PCGainMatch.C
454
PCGainMatch.C
|
|
@ -1,454 +0,0 @@
|
|||
#define PCGainMatch_cxx
|
||||
|
||||
#include "PCGainMatch.h"
|
||||
#include <TH2.h>
|
||||
#include <TStyle.h>
|
||||
#include <TCanvas.h>
|
||||
#include <TMath.h>
|
||||
#include <TCutG.h>
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
#include "Armory/ClassSX3.h"
|
||||
#include "Armory/ClassPW.h"
|
||||
|
||||
#include "TVector3.h"
|
||||
|
||||
TH2F * hsx3IndexVE;
|
||||
TH2F * hqqqIndexVE;
|
||||
TH2F * hpcIndexVE;
|
||||
|
||||
TH2F * hsx3Coin;
|
||||
TH2F * hqqqCoin;
|
||||
TH2F * hpcCoin;
|
||||
|
||||
TH2F * hqqqPolar;
|
||||
TH2F * hsx3VpcIndex;
|
||||
TH2F * hqqqVpcIndex;
|
||||
TH2F * hqqqVpcE;
|
||||
TH2F * hsx3VpcE;
|
||||
TH2F * hanVScatsum;
|
||||
TH2F * hanVScatsum_a[24];
|
||||
TH2F * hanVScatsum_hcut;
|
||||
TH2F * hanVScatsum_lcut;
|
||||
TH2F * hAnodeHits;
|
||||
TH1F * hAnodeMultiplicity;
|
||||
|
||||
|
||||
int padID = 0;
|
||||
|
||||
SX3 sx3_contr;
|
||||
PW pw_contr;
|
||||
TVector3 hitPos;
|
||||
bool HitNonZero;
|
||||
|
||||
TH1F * hZProj;
|
||||
TCutG *AnCatSum_high;
|
||||
TCutG *AnCatSum_low;
|
||||
TCutG *PCCoinc_cut1;
|
||||
TCutG *PCCoinc_cut2;
|
||||
bool inCuth;
|
||||
bool inCutl;
|
||||
bool inPCCut;
|
||||
|
||||
void PCGainMatch::Begin(TTree * /*tree*/){
|
||||
TString option = GetOption();
|
||||
|
||||
hsx3IndexVE = new TH2F("hsx3IndexVE", "SX3 index vs Energy; sx3 index ; Energy", 24*12, 0, 24*12, 400, 0, 5000); hsx3IndexVE->SetNdivisions( -612, "x");
|
||||
hqqqIndexVE = new TH2F("hqqqIndexVE", "QQQ index vs Energy; QQQ index ; Energy", 4*2*16, 0, 4*2*16, 400, 0, 5000); hqqqIndexVE->SetNdivisions( -1204, "x");
|
||||
hpcIndexVE = new TH2F("hpcIndexVE", "PC index vs Energy; PC index ; Energy", 2*24, 0, 2*24, 800, 0, 16000); hpcIndexVE->SetNdivisions( -1204, "x");
|
||||
|
||||
|
||||
hsx3Coin = new TH2F("hsx3Coin", "SX3 Coincident", 24*12, 0, 24*12, 24*12, 0, 24*12);
|
||||
hqqqCoin = new TH2F("hqqqCoin", "QQQ Coincident", 4*2*16, 0, 4*2*16, 4*2*16, 0, 4*2*16);
|
||||
hpcCoin = new TH2F("hpcCoin", "PC Coincident", 2*24, 0, 2*24, 2*24, 0, 2*24);
|
||||
|
||||
hqqqPolar = new TH2F("hqqqPolar", "QQQ Polar ID", 16*4, -TMath::Pi(), TMath::Pi(),16, 10, 50);
|
||||
|
||||
hsx3VpcIndex = new TH2F("hsx3Vpcindex", "sx3 vs pc; sx3 index; pc index", 24*12, 0, 24*12, 48, 0, 48);
|
||||
hsx3VpcIndex->SetNdivisions( -612, "x");
|
||||
hsx3VpcIndex->SetNdivisions( -12, "y");
|
||||
hqqqVpcIndex = new TH2F("hqqqVpcindex", "qqq vs pc; qqq index; pc index", 4*2*16, 0, 4*2*16, 48, 0, 48);
|
||||
hqqqVpcIndex->SetNdivisions( -612, "x");
|
||||
hqqqVpcIndex->SetNdivisions( -12, "y");
|
||||
|
||||
hqqqVpcE = new TH2F("hqqqVpcEnergy", "qqq vs pc; qqq energy; pc energy", 400, 0, 5000, 400, 0, 5000);
|
||||
hqqqVpcE->SetNdivisions( -612, "x");
|
||||
hqqqVpcE->SetNdivisions( -12, "y");
|
||||
|
||||
hsx3VpcE = new TH2F("hsx3VpcEnergy", "sx3 vs pc; sx3 energy; pc energy", 400, 0, 5000, 400, 0, 5000);
|
||||
hsx3VpcE->SetNdivisions( -612, "x");
|
||||
hsx3VpcE->SetNdivisions( -12, "y");
|
||||
|
||||
hZProj = new TH1F("hZProj", "Nos of anodes", 20, 0, 19);
|
||||
hAnodeHits = new TH2F("hAnodeHits", "Anode vs Anode Energy, Anode ID; Anode E", 24,0 , 23, 400, 0 , 20000);
|
||||
hAnodeMultiplicity = new TH1F("hAnodeMultiplicity", "Number of Anodes/Event", 40, 0, 40);
|
||||
hanVScatsum = new TH2F("hanVScatsum", "Anode vs Cathode Sum; Anode E; Cathode E", 400,0 , 10000, 800, 0 , 16000);
|
||||
for (int i = 0; i < 24; i++) {
|
||||
TString histName = Form("hAnodeVsCathode_%d", i);
|
||||
TString histTitle = Form("Anode %d vs Cathode Sum; Anode E; Cathode Sum E", i);
|
||||
hanVScatsum_a[i] = new TH2F(histName, histTitle, 400, 0, 10000, 400, 0, 16000);
|
||||
}
|
||||
hanVScatsum_lcut = new TH2F("hanVScatsum_LCUT", "Anode vs Cathode Sum; Anode E; Cathode E", 400,0 , 16000, 400, 0 , 16000);
|
||||
hanVScatsum_hcut = new TH2F("hanVScatsum_HCUT", "Anode vs Cathode Sum; Anode E; Cathode E", 400,0 , 16000, 400, 0 , 16000);
|
||||
|
||||
sx3_contr.ConstructGeo();
|
||||
pw_contr.ConstructGeo();
|
||||
// TFile *f1 = new TFile("AnCatSum_high.root");
|
||||
// TFile *f2 = new TFile("AnCatSum_low.root");
|
||||
// TFile *f3 = new TFile("PCCoinc_cut1.root");
|
||||
// TFile *f4 = new TFile("PCCoinc_cut2.root");
|
||||
// AnCatSum_high= (TCutG*)f1->Get("AnCatSum_high");
|
||||
// AnCatSum_low= (TCutG*)f2->Get("AnCatSum_low");
|
||||
// PCCoinc_cut1= (TCutG*)f3->Get("PCCoinc_cut1");
|
||||
// PCCoinc_cut2= (TCutG*)f4->Get("PCCoinc_cut2");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Bool_t PCGainMatch::Process(Long64_t entry){
|
||||
// if (entry % 1000000 == 0) {
|
||||
// std::cout << "Processing entry: " << entry << std::endl;
|
||||
// }
|
||||
// if ( entry > 100 ) return kTRUE;
|
||||
|
||||
hitPos.Clear();
|
||||
HitNonZero = false;
|
||||
|
||||
// if( entry > 1) return kTRUE;
|
||||
// printf("################### ev : %llu \n", entry);
|
||||
|
||||
b_sx3Multi->GetEntry(entry);
|
||||
b_sx3ID->GetEntry(entry);
|
||||
b_sx3Ch->GetEntry(entry);
|
||||
b_sx3E->GetEntry(entry);
|
||||
b_sx3T->GetEntry(entry);
|
||||
b_qqqMulti->GetEntry(entry);
|
||||
b_qqqID->GetEntry(entry);
|
||||
b_qqqCh->GetEntry(entry);
|
||||
b_qqqE->GetEntry(entry);
|
||||
b_qqqT->GetEntry(entry);
|
||||
b_pcMulti->GetEntry(entry);
|
||||
b_pcID->GetEntry(entry);
|
||||
b_pcCh->GetEntry(entry);
|
||||
b_pcE->GetEntry(entry);
|
||||
b_pcT->GetEntry(entry);
|
||||
|
||||
sx3.CalIndex();
|
||||
qqq.CalIndex();
|
||||
pc.CalIndex();
|
||||
|
||||
// sx3.Print();
|
||||
|
||||
//########################################################### Raw data
|
||||
|
||||
// //======================= PC
|
||||
|
||||
std::vector<std::pair<int, double>> anodeHits={};
|
||||
std::vector<std::pair<int, double>> cathodeHits={};
|
||||
int aID = 0;
|
||||
int cID = 0;
|
||||
float aE = 0;
|
||||
float cE = 0;
|
||||
|
||||
// Define the excluded SX3 and QQQ channels
|
||||
// std::unordered_set<int> excludeSX3 = {34, 35, 36, 37, 61, 62, 67, 73, 74, 75, 76, 77, 78, 79, 80, 93, 97, 100, 103, 108, 109, 110, 111, 112};
|
||||
// std::unordered_set<int> excludeQQQ = {0, 17, 109, 110, 111, 112, 113, 119, 127, 128};
|
||||
// inCuth=false;
|
||||
// inCutl=false;
|
||||
// inPCCut=false;
|
||||
for( int i = 0; i < pc.multi; i ++){
|
||||
|
||||
if(pc.e[i]>50 && pc.multi<7){
|
||||
|
||||
float aESum = 0;
|
||||
float cESum = 0;
|
||||
if (pc.index[i] < 24 ) {
|
||||
anodeHits.push_back(std::pair<int, double>(pc.index[i], pc.e[i]));
|
||||
} else if (pc.index[i] >= 24) {
|
||||
cathodeHits.push_back(std::pair<int, double>(pc.index[i], pc.e[i]));
|
||||
}
|
||||
|
||||
for(int j=i+1;j<pc.multi;j++){
|
||||
// if(PCCoinc_cut1->IsInside(pc.index[i], pc.index[j]) || PCCoinc_cut2->IsInside(pc.index[i], pc.index[j])){
|
||||
// // hpcCoin->Fill(pc.index[i], pc.index[j]);
|
||||
// inPCCut = true;
|
||||
// }
|
||||
hpcCoin->Fill(pc.index[i], pc.index[j]);
|
||||
}
|
||||
if (anodeHits.size()==1 && cathodeHits.size() >= 1) {
|
||||
|
||||
for (const auto& anode : anodeHits) {
|
||||
// for(int l=0; l<sx3.multi; l++){
|
||||
// if (sx3.index[l]==80){
|
||||
|
||||
aID = anode.first;
|
||||
aE = anode.second;
|
||||
aESum += aE;
|
||||
// printf("aID : %d, aE : %f\n", aID, aE);
|
||||
}
|
||||
|
||||
// printf("aID : %d, aE : %f, cE : %f\n", aID, aE, cE);
|
||||
for (const auto& cathode : cathodeHits) {
|
||||
cID = cathode.first;
|
||||
cE = cathode.second;
|
||||
// if(cE>cEMax){
|
||||
// cEMax = cE;
|
||||
// cIDMax = cID;
|
||||
// }
|
||||
// if(cE>cEnextMax && cE<cEMax){
|
||||
// cEnextMax = cE;
|
||||
// cIDnextMax = cID;
|
||||
// }
|
||||
|
||||
cESum += cE;
|
||||
}
|
||||
// }
|
||||
|
||||
// inCuth = false;
|
||||
// inCutl = false;
|
||||
// inPCCut = false;
|
||||
// for(int j=i+1;j<pc.multi;j++){
|
||||
// if(PCCoinc_cut1->IsInside(pc.index[i], pc.index[j]) || PCCoinc_cut2->IsInside(pc.index[i], pc.index[j])){
|
||||
// // hpcCoin->Fill(pc.index[i], pc.index[j]);
|
||||
// inPCCut = true;
|
||||
// }
|
||||
// hpcCoin->Fill(pc.index[i], pc.index[j]);
|
||||
// }
|
||||
|
||||
// Check if the accumulated energies are within the defined ranges
|
||||
// if (AnCatSum_high && AnCatSum_high->IsInside(aESum, cESum)) {
|
||||
// inCuth = true;
|
||||
// }
|
||||
// if (AnCatSum_low && AnCatSum_low->IsInside(aESum, cESum)) {
|
||||
// inCutl = true;
|
||||
// }
|
||||
|
||||
// Fill histograms based on the cut conditions
|
||||
// if (inCuth && inPCCut) {
|
||||
// hanVScatsum_hcut->Fill(aESum, cESum);
|
||||
// }
|
||||
// if (inCutl && inPCCut) {
|
||||
// hanVScatsum_lcut->Fill(aESum, cESum);
|
||||
// }
|
||||
// for(auto anode : anodeHits){
|
||||
|
||||
// float aE = anode.second;
|
||||
// aESum += aE;
|
||||
// if(inPCCut){
|
||||
hanVScatsum->Fill(aESum, cESum);
|
||||
// }
|
||||
if (aID < 24 && aE > 50) {
|
||||
hanVScatsum_a[aID]->Fill(aE, cESum);
|
||||
}
|
||||
|
||||
|
||||
// }
|
||||
// Fill histograms for the `pc` data
|
||||
hpcIndexVE->Fill(pc.index[i], pc.e[i]);
|
||||
// if(inPCCut){
|
||||
hAnodeMultiplicity->Fill(anodeHits.size());
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// //======================= SX3
|
||||
|
||||
std::vector<std::pair<int, int>> ID; // first = id, 2nd = index
|
||||
for( int i = 0; i < sx3.multi; i ++){
|
||||
if(sx3.e[i]>50){
|
||||
ID.push_back(std::pair<int, int>(sx3.id[i], i));
|
||||
hsx3IndexVE->Fill( sx3.index[i], sx3.e[i] );
|
||||
|
||||
for( int j = i+1; j < sx3.multi; j++){
|
||||
hsx3Coin->Fill( sx3.index[i], sx3.index[j]);
|
||||
}
|
||||
|
||||
for( int j = 0; j < pc.multi; j++){
|
||||
hsx3VpcIndex->Fill( sx3.index[i], pc.index[j] );
|
||||
// if( sx3.ch[index] > 8 ){
|
||||
// hsx3VpcE->Fill( sx3.e[i], pc.e[j] );
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( ID.size() > 0 ){
|
||||
std::sort(ID.begin(), ID.end(), [](const std::pair<int, int> & a, const std::pair<int, int> & b) {
|
||||
return a.first < b.first;
|
||||
} );
|
||||
// printf("##############################\n");
|
||||
// for( size_t i = 0; i < ID.size(); i++) printf("%zu | %d %d \n", i, ID[i].first, ID[i].second );
|
||||
|
||||
std::vector<std::pair<int, int>> sx3ID;
|
||||
sx3ID.push_back(ID[0]);
|
||||
bool found = false;
|
||||
for( size_t i = 1; i < ID.size(); i++){
|
||||
if( ID[i].first == sx3ID.back().first) {
|
||||
sx3ID.push_back(ID[i]);
|
||||
if( sx3ID.size() >= 3) {
|
||||
found = true;
|
||||
}
|
||||
}else{
|
||||
if( !found ){
|
||||
sx3ID.clear();
|
||||
sx3ID.push_back(ID[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// printf("---------- sx3ID Multi : %zu \n", sx3ID.size());
|
||||
|
||||
if( found ){
|
||||
int sx3ChUp, sx3ChDn, sx3ChBk;
|
||||
float sx3EUp, sx3EDn;
|
||||
// printf("------ sx3 ID : %d, multi: %zu\n", sx3ID[0].first, sx3ID.size());
|
||||
for( size_t i = 0; i < sx3ID.size(); i++ ){
|
||||
int index = sx3ID[i].second;
|
||||
// printf(" %zu | index %d | ch : %d, energy : %d \n", i, index, sx3.ch[index], sx3.e[index]);
|
||||
|
||||
|
||||
if( sx3.ch[index] < 8 ){
|
||||
if( sx3.ch[index] % 2 == 0) {
|
||||
sx3ChDn = sx3.ch[index];
|
||||
sx3EDn = sx3.e[index];
|
||||
}else{
|
||||
sx3ChUp = sx3.ch[index];
|
||||
sx3EUp = sx3.e[index];
|
||||
}
|
||||
}else{
|
||||
sx3ChBk = sx3.ch[index];
|
||||
}
|
||||
for( int j = 0; j < pc.multi; j++){
|
||||
|
||||
// hsx3VpcIndex->Fill( sx3.index[i], pc.index[j] );
|
||||
if( sx3.ch[index] > 8 && pc.index[j]<24 && pc.e[j]>50 ){
|
||||
hsx3VpcE->Fill( sx3.e[i], pc.e[j] );
|
||||
// hpcIndexVE->Fill( pc.index[i], pc.e[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sx3_contr.CalSX3Pos(sx3ID[0].first, sx3ChUp, sx3ChDn, sx3ChBk, sx3EUp, sx3EDn);
|
||||
hitPos = sx3_contr.GetHitPos();
|
||||
HitNonZero = true;
|
||||
// hitPos.Print();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// //======================= QQQ
|
||||
for( int i = 0; i < qqq.multi; i ++){
|
||||
|
||||
// for( int j = 0; j < pc.multi; j++){
|
||||
if(qqq.e[i]>50 ){
|
||||
hqqqIndexVE->Fill( qqq.index[i], qqq.e[i] );
|
||||
for( int j = 0; j < qqq.multi; j++){
|
||||
if ( j == i ) continue;
|
||||
hqqqCoin->Fill( qqq.index[i], qqq.index[j]);
|
||||
}
|
||||
|
||||
|
||||
for( int j = i + 1; j < qqq.multi; j++){
|
||||
for( int k = 0; k < pc.multi; k++){
|
||||
// if(qqq.e[i>50]){
|
||||
hqqqVpcE->Fill( qqq.e[i], pc.e[k] );
|
||||
hqqqVpcIndex->Fill( qqq.index[i], pc.index[j] );
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
// hanVScatsum->Fill(aE,cE);
|
||||
|
||||
|
||||
if( HitNonZero){
|
||||
pw_contr.CalTrack( hitPos, aID, cID);
|
||||
hZProj->Fill(pw_contr.GetZ0());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//########################################################### Track constrcution
|
||||
|
||||
|
||||
//############################## DO THE KINEMATICS
|
||||
|
||||
|
||||
return kTRUE;
|
||||
}
|
||||
|
||||
void PCGainMatch::Terminate(){
|
||||
|
||||
gStyle->SetOptStat("neiou");
|
||||
TCanvas * canvas = new TCanvas("cANASEN", "ANASEN", 2000, 2000);
|
||||
canvas->Divide(3,3);
|
||||
|
||||
//hsx3VpcIndex->Draw("colz");
|
||||
|
||||
//=============================================== pad-1
|
||||
padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1);
|
||||
|
||||
hsx3IndexVE->Draw("colz");
|
||||
|
||||
//=============================================== pad-2
|
||||
padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1);
|
||||
|
||||
hqqqIndexVE->Draw("colz");
|
||||
|
||||
//=============================================== pad-3
|
||||
padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1);
|
||||
|
||||
hpcIndexVE->Draw("colz");
|
||||
|
||||
//=============================================== pad-4
|
||||
padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1);
|
||||
|
||||
hsx3Coin->Draw("colz");
|
||||
|
||||
//=============================================== pad-5
|
||||
padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1);
|
||||
|
||||
canvas->cd(padID)->SetLogz(true);
|
||||
|
||||
hqqqCoin->Draw("colz");
|
||||
|
||||
//=============================================== pad-6
|
||||
padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1);
|
||||
|
||||
hpcCoin->Draw("colz");
|
||||
|
||||
//=============================================== pad-7
|
||||
padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1);
|
||||
|
||||
// hsx3VpcIndex ->Draw("colz");
|
||||
hsx3VpcE->Draw("colz") ;
|
||||
|
||||
//=============================================== pad-8
|
||||
padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1);
|
||||
|
||||
// hqqqVpcIndex ->Draw("colz");
|
||||
|
||||
hqqqVpcE ->Draw("colz");
|
||||
//=============================================== pad-9
|
||||
padID ++;
|
||||
|
||||
// canvas->cd(padID)->DrawFrame(-50, -50, 50, 50);
|
||||
// hqqqPolar->Draw("same colz pol");
|
||||
|
||||
canvas->cd(padID); canvas->cd(padID)->SetGrid(1);
|
||||
hanVScatsum->Draw("colz");
|
||||
// hAnodeHits->Draw("colz");
|
||||
// hAnodeMultiplicity->Draw();
|
||||
}
|
||||
114
PCGainMatch.h
114
PCGainMatch.h
|
|
@ -1,114 +0,0 @@
|
|||
#ifndef PCGainMatch_h
|
||||
#define PCGainMatch_h
|
||||
|
||||
#include <TROOT.h>
|
||||
#include <TChain.h>
|
||||
#include <TFile.h>
|
||||
#include <TSelector.h>
|
||||
|
||||
#include "Armory/ClassDet.h"
|
||||
|
||||
class PCGainMatch : public TSelector {
|
||||
public :
|
||||
TTree *fChain; //!pointer to the analyzed TTree or TChain
|
||||
|
||||
// Fixed size dimensions of array or collections stored in the TTree if any.
|
||||
|
||||
// Declaration of leaf types
|
||||
Det sx3;
|
||||
Det qqq;
|
||||
Det pc ;
|
||||
|
||||
ULong64_t evID;
|
||||
UInt_t run;
|
||||
|
||||
// List of branches
|
||||
TBranch *b_eventID; //!
|
||||
TBranch *b_run; //!
|
||||
TBranch *b_sx3Multi; //!
|
||||
TBranch *b_sx3ID; //!
|
||||
TBranch *b_sx3Ch; //!
|
||||
TBranch *b_sx3E; //!
|
||||
TBranch *b_sx3T; //!
|
||||
TBranch *b_qqqMulti; //!
|
||||
TBranch *b_qqqID; //!
|
||||
TBranch *b_qqqCh; //!
|
||||
TBranch *b_qqqE; //!
|
||||
TBranch *b_qqqT; //!
|
||||
TBranch *b_pcMulti; //!
|
||||
TBranch *b_pcID; //!
|
||||
TBranch *b_pcCh; //!
|
||||
TBranch *b_pcE; //!
|
||||
TBranch *b_pcT; //!
|
||||
|
||||
PCGainMatch(TTree * /*tree*/ =0) : fChain(0) { }
|
||||
virtual ~PCGainMatch() { }
|
||||
virtual Int_t Version() const { return 2; }
|
||||
virtual void Begin(TTree *tree);
|
||||
virtual void SlaveBegin(TTree *tree);
|
||||
virtual void Init(TTree *tree);
|
||||
virtual Bool_t Notify();
|
||||
virtual Bool_t Process(Long64_t entry);
|
||||
virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0) { return fChain ? fChain->GetTree()->GetEntry(entry, getall) : 0; }
|
||||
virtual void SetOption(const char *option) { fOption = option; }
|
||||
virtual void SetObject(TObject *obj) { fObject = obj; }
|
||||
virtual void SetInputList(TList *input) { fInput = input; }
|
||||
virtual TList *GetOutputList() const { return fOutput; }
|
||||
virtual void SlaveTerminate();
|
||||
virtual void Terminate();
|
||||
|
||||
ClassDef(PCGainMatch,0);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef PCGainMatch_cxx
|
||||
void PCGainMatch::Init(TTree *tree){
|
||||
|
||||
// Set branch addresses and branch pointers
|
||||
if (!tree) return;
|
||||
fChain = tree;
|
||||
fChain->SetMakeClass(1);
|
||||
|
||||
fChain->SetBranchAddress("evID", &evID, &b_eventID);
|
||||
fChain->SetBranchAddress("run", &run, &b_run);
|
||||
|
||||
sx3.SetDetDimension(24,12);
|
||||
qqq.SetDetDimension(4,32);
|
||||
pc.SetDetDimension(2,24);
|
||||
|
||||
fChain->SetBranchAddress("sx3Multi", &sx3.multi, &b_sx3Multi);
|
||||
fChain->SetBranchAddress("sx3ID", &sx3.id, &b_sx3ID);
|
||||
fChain->SetBranchAddress("sx3Ch", &sx3.ch, &b_sx3Ch);
|
||||
fChain->SetBranchAddress("sx3E", &sx3.e, &b_sx3E);
|
||||
fChain->SetBranchAddress("sx3T", &sx3.t, &b_sx3T);
|
||||
fChain->SetBranchAddress("qqqMulti", &qqq.multi, &b_qqqMulti);
|
||||
fChain->SetBranchAddress("qqqID", &qqq.id, &b_qqqID);
|
||||
fChain->SetBranchAddress("qqqCh", &qqq.ch, &b_qqqCh);
|
||||
fChain->SetBranchAddress("qqqE", &qqq.e, &b_qqqE);
|
||||
fChain->SetBranchAddress("qqqT", &qqq.t, &b_qqqT);
|
||||
fChain->SetBranchAddress("pcMulti", &pc.multi, &b_pcMulti);
|
||||
fChain->SetBranchAddress("pcID", &pc.id, &b_pcID);
|
||||
fChain->SetBranchAddress("pcCh", &pc.ch, &b_pcCh);
|
||||
fChain->SetBranchAddress("pcE", &pc.e, &b_pcE);
|
||||
fChain->SetBranchAddress("pcT", &pc.t, &b_pcT);
|
||||
|
||||
}
|
||||
|
||||
Bool_t PCGainMatch::Notify(){
|
||||
|
||||
return kTRUE;
|
||||
}
|
||||
|
||||
void PCGainMatch::SlaveBegin(TTree * /*tree*/){
|
||||
|
||||
TString option = GetOption();
|
||||
|
||||
}
|
||||
|
||||
void PCGainMatch::SlaveTerminate(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // #ifdef Analyzer_cxx
|
||||
|
|
@ -1,38 +1,29 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ "$#" -ne 3 ]; then
|
||||
echo "Usage: $0 runID timeWindow_ns option"
|
||||
echo "option: 0 - process raw data, 1 - process mapped data"
|
||||
if [ "$#" -ne 2 ]; then
|
||||
echo "Usage: $0 runID timeWindow_ns"
|
||||
echo "Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
runID=$(printf "%03d" $1)
|
||||
runID=$1
|
||||
timeWindow=$2
|
||||
|
||||
option=$3
|
||||
|
||||
# rawFolder=/home/tandem/data1/2024_09_17Fap/data
|
||||
# rawFolder=/mnt/d/17F
|
||||
# rootFolder=/mnt/d/Remapped_files/17F_data/root_data
|
||||
# rawFolder=/mnt/data1/vs19g/2024_06_27Al
|
||||
# rootFolder=/home/vs19g/Desktop/27Al_Data/root_data
|
||||
rawFolder=/mnt/data1/vs19g/2024_09_17Fap/data
|
||||
rootFolder=/home/vs19g/Desktop/17F_Data/root_data
|
||||
rawFolder=/home/tandem/Desktop/analysis/data
|
||||
rootFolder=../root_data
|
||||
|
||||
if [ $option -eq 0 ]; then
|
||||
|
||||
# rsync -auh --info=progress2 splitpole@128.186.111.223:/media/nvmeData/2024_09_17Fap/*.fsu /home/tandem/data1/2024_09_17Fap/data
|
||||
rsync -auh --info=progress2 splitpole@128.186.111.223:/media/nvmeData/2024_09_17Fap/*.fsu /home/tandem/data1/2024_09_17Fap/data
|
||||
|
||||
fileList=`\ls -1 ${rawFolder}/*Run*_${runID}_*.fsu`
|
||||
fileList=`\ls -1 ${rawFolder}/*Run_${runID}_*.fsu`
|
||||
|
||||
time ./EventBuilder ${timeWindow} 0 0 100000000 ${fileList}
|
||||
./EventBuilder ${timeWindow} 0 0 100000000 ${fileList}
|
||||
|
||||
outFile=${rawFolder}/*${runID}*${timeWindow}.root
|
||||
|
||||
mv -vf ${outFile} ${rootFolder}/.
|
||||
|
||||
time ./Mapper ${rootFolder}/*${runID}*${timeWindow}.root
|
||||
./Mapper ${rootFolder}/*${runID}*${timeWindow}.root
|
||||
fi
|
||||
|
||||
# root "processRun.C(\"${rootFolder}/Run_${runID}_mapped.root\")"
|
||||
root "processRun.C(\"${rootFolder}/Run_${runID}_mapped.root\")"
|
||||
|
|
|
|||
167
QQQ_Calcheck.C
167
QQQ_Calcheck.C
|
|
@ -1,167 +0,0 @@
|
|||
|
||||
#define QQQ_Calcheck_cxx
|
||||
|
||||
#include <TH2.h>
|
||||
#include <TF1.h>
|
||||
#include <TStyle.h>
|
||||
#include <TCanvas.h>
|
||||
#include <TMath.h>
|
||||
#include <TCutG.h>
|
||||
#include <fstream>
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
#include "Armory/HistPlotter.h"
|
||||
#include "TVector3.h"
|
||||
#include "QQQ_Calcheck.h"
|
||||
|
||||
TH2F *hQQQFVB;
|
||||
HistPlotter *plotter;
|
||||
int padID = 0;
|
||||
|
||||
TCutG *cut;
|
||||
std::map<std::tuple<int, int, int>, std::vector<std::pair<double, double>>> dataPoints;
|
||||
|
||||
bool qqqEcut = false;
|
||||
|
||||
// Gain Arrays
|
||||
const int MAX_QQQ = 4;
|
||||
const int MAX_RING = 16;
|
||||
const int MAX_WEDGE = 16;
|
||||
double qqqwGain[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{0}}};
|
||||
double qqqrGain[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{0}}};
|
||||
bool qqqwGainValid[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{false}}};
|
||||
bool qqqrGainValid[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{false}}};
|
||||
double qqqCalib[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{0}}};
|
||||
bool qqqCalibValid[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{false}}};
|
||||
|
||||
void QQQ_Calcheck::Begin(TTree * /*tree*/)
|
||||
{
|
||||
plotter = new HistPlotter("Cal_checkQQQ.root", "TFILE");
|
||||
// ----------------------- Load QQQ Gains
|
||||
{
|
||||
std::string filename = "qqq_GainMatch.dat";
|
||||
std::ifstream infile(filename);
|
||||
if (!infile.is_open())
|
||||
{
|
||||
std::cerr << "Error opening " << filename << "!" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
int det, ring, wedge;
|
||||
double gainw,gainr;
|
||||
while (infile >> det >> ring >> wedge >> gainw>> gainr)
|
||||
{
|
||||
qqqwGain[det][ring][wedge] = gainw;
|
||||
// qqqrGain[det][ring][wedge] = gainr;
|
||||
qqqwGainValid[det][ring][wedge] = (gainw > 0);
|
||||
// qqqrGainValid[det][ring][wedge] = (gainr > 0);
|
||||
}
|
||||
infile.close();
|
||||
std::cout << "Loaded QQQ gains from " << filename << std::endl;
|
||||
}
|
||||
}
|
||||
// ----------------------- Load QQQ Calibrations
|
||||
{
|
||||
std::string filename = "qqq_Calib.dat";
|
||||
std::ifstream infile(filename);
|
||||
if (!infile.is_open())
|
||||
{
|
||||
std::cerr << "Error opening " << filename << "!" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
int det, ring, wedge;
|
||||
double slope;
|
||||
while (infile >> det >> ring >> wedge >> slope)
|
||||
{
|
||||
qqqCalib[det][ring][wedge] = slope;
|
||||
qqqCalibValid[det][ring][wedge] = (slope > 0);
|
||||
}
|
||||
infile.close();
|
||||
std::cout << "Loaded QQQ calibrations from " << filename << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Bool_t QQQ_Calcheck::Process(Long64_t entry)
|
||||
{
|
||||
b_qqqMulti->GetEntry(entry);
|
||||
b_qqqID->GetEntry(entry);
|
||||
b_qqqCh->GetEntry(entry);
|
||||
b_qqqE->GetEntry(entry);
|
||||
b_qqqT->GetEntry(entry);
|
||||
|
||||
qqq.CalIndex();
|
||||
|
||||
for (int i = 0; i < qqq.multi; i++)
|
||||
{
|
||||
for (int j = i + 1; j < qqq.multi; j++)
|
||||
{
|
||||
if (qqq.e[i] > 100)
|
||||
qqqEcut = true;
|
||||
if (qqq.id[i] == qqq.id[j])
|
||||
{
|
||||
int chWedge = -1;
|
||||
int chRing = -1;
|
||||
float eWedgeRaw = 0.0;
|
||||
float eWedge = 0.0;
|
||||
float eWedgeMeV = 0.0;
|
||||
float eRingRaw = 0.0;
|
||||
float eRing = 0.0;
|
||||
float eRingMeV = 0.0;
|
||||
// plug in gains
|
||||
if (qqq.ch[i] < 16 && qqq.ch[j] >= 16 && /*qqqrGainValid[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16] &&*/ qqqwGainValid[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16])
|
||||
{
|
||||
chWedge = qqq.ch[i];
|
||||
eWedgeRaw = qqq.e[i];
|
||||
eWedge = qqq.e[i] * qqqwGain[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16];
|
||||
// printf("Wedge E: %.2f Gain: %.4f \n", eWedge, qqqGain[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16]);
|
||||
chRing = qqq.ch[j] - 16;
|
||||
eRingRaw = qqq.e[j];
|
||||
eRing = qqq.e[j];//* qqqrGain[qqq.id[j]][qqq.ch[j]][qqq.ch[i]-16];
|
||||
}
|
||||
else if (qqq.ch[j] < 16 && qqq.ch[i] >= 16/* && qqqrGainValid[qqq.id[j]][qqq.ch[j]][qqq.ch[i] - 16] */&& qqqwGainValid[qqq.id[j]][qqq.ch[j]][qqq.ch[i] - 16])
|
||||
{
|
||||
chWedge = qqq.ch[j];
|
||||
eWedge = qqq.e[j] * qqqwGain[qqq.id[j]][qqq.ch[j]][qqq.ch[i] - 16];
|
||||
eWedgeRaw = qqq.e[j];
|
||||
|
||||
chRing = qqq.ch[i] - 16;
|
||||
eRing = qqq.e[i];// * qqqrGain[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16];
|
||||
eRingRaw = qqq.e[i];
|
||||
}
|
||||
else
|
||||
continue;
|
||||
// plug in calibrations
|
||||
if (qqqCalibValid[qqq.id[i]][chWedge][chRing])
|
||||
{
|
||||
eWedgeMeV = eWedge * qqqCalib[qqq.id[i]][chWedge][chRing] / 1000;
|
||||
eRingMeV = eRing * qqqCalib[qqq.id[i]][chWedge][chRing] / 1000;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
// hQQQFVB->Fill(eWedge, eRing);
|
||||
plotter->Fill2D(Form("hRaw_qqq%d_ring%d_wedge%d", qqq.id[i], chRing, chWedge), 400, 0, 8000, 400, 0, 8000, eWedgeRaw, eRingRaw, "ERaw");
|
||||
plotter->Fill2D(Form("hGM_qqq%d_ring%d_wedge%d", qqq.id[i], chRing, chWedge), 400, 0, 16000, 400, 0, 16000, eWedge, eRing, "EGM");
|
||||
plotter->Fill2D(Form("hCal_qqq%d_ring%d_wedge%d", qqq.id[i], chRing, chWedge), 400, 0, 10, 400, 0, 10, eWedgeMeV, eRingMeV, "ECal");
|
||||
if(eWedgeRaw >1500 && eRingRaw>1500 )
|
||||
plotter->Fill2D(Form("hCal_cut_qqq%d_ring%d_wedge%d", qqq.id[i], chRing, chWedge), 400, 0, 10, 400, 0, 10, eWedgeMeV, eRingMeV, "ECal_cut");
|
||||
|
||||
plotter->Fill2D(Form("hRCal_qqq%d", qqq.id[i]), 16, 0, 15, 1000, 0, 30, chRing, eRingMeV, "RingCal");
|
||||
plotter->Fill2D(Form("hWCal_qqq%d", qqq.id[i]), 16, 0, 15, 1000, 0, 30, chWedge, eWedgeMeV, "WedgeCal");
|
||||
plotter->Fill2D("hRawQQQ", 4000, 0, 8000, 4000, 0, 8000, eWedgeRaw, eRingRaw);
|
||||
plotter->Fill2D("hGMQQQ", 4000, 0, 8000, 4000, 0, 8000, eWedge, eRing);
|
||||
plotter->Fill2D("hCalQQQ", 4000, 0, 10, 4000, 0, 10, eWedgeMeV, eRingMeV);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return kTRUE;
|
||||
}
|
||||
|
||||
void QQQ_Calcheck::Terminate()
|
||||
{
|
||||
plotter->FlushToDisk();
|
||||
std::cout << "Calibration check file for 2D QQQ histogram saved.\n";
|
||||
}
|
||||
114
QQQ_Calcheck.h
114
QQQ_Calcheck.h
|
|
@ -1,114 +0,0 @@
|
|||
#ifndef QQQ_Calcheck_h
|
||||
#define QQQ_Calcheck_h
|
||||
|
||||
#include <TROOT.h>
|
||||
#include <TChain.h>
|
||||
#include <TFile.h>
|
||||
#include <TSelector.h>
|
||||
|
||||
#include "Armory/ClassDet.h"
|
||||
|
||||
class QQQ_Calcheck : public TSelector {
|
||||
public :
|
||||
TTree *fChain; //!pointer to the analyzed TTree or TChain
|
||||
|
||||
// Fixed size dimensions of array or collections stored in the TTree if any.
|
||||
|
||||
// Declaration of leaf types
|
||||
Det sx3;
|
||||
Det qqq;
|
||||
Det pc ;
|
||||
|
||||
ULong64_t evID;
|
||||
UInt_t run;
|
||||
|
||||
// List of branches
|
||||
TBranch *b_eventID; //!
|
||||
TBranch *b_run; //!
|
||||
TBranch *b_sx3Multi; //!
|
||||
TBranch *b_sx3ID; //!
|
||||
TBranch *b_sx3Ch; //!
|
||||
TBranch *b_sx3E; //!
|
||||
TBranch *b_sx3T; //!
|
||||
TBranch *b_qqqMulti; //!
|
||||
TBranch *b_qqqID; //!
|
||||
TBranch *b_qqqCh; //!
|
||||
TBranch *b_qqqE; //!
|
||||
TBranch *b_qqqT; //!
|
||||
TBranch *b_pcMulti; //!
|
||||
TBranch *b_pcID; //!
|
||||
TBranch *b_pcCh; //!
|
||||
TBranch *b_pcE; //!
|
||||
TBranch *b_pcT; //!
|
||||
|
||||
QQQ_Calcheck(TTree * /*tree*/ =0) : fChain(0) { }
|
||||
virtual ~QQQ_Calcheck() { }
|
||||
virtual Int_t Version() const { return 2; }
|
||||
virtual void Begin(TTree *tree);
|
||||
virtual void SlaveBegin(TTree *tree);
|
||||
virtual void Init(TTree *tree);
|
||||
virtual Bool_t Notify();
|
||||
virtual Bool_t Process(Long64_t entry);
|
||||
virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0) { return fChain ? fChain->GetTree()->GetEntry(entry, getall) : 0; }
|
||||
virtual void SetOption(const char *option) { fOption = option; }
|
||||
virtual void SetObject(TObject *obj) { fObject = obj; }
|
||||
virtual void SetInputList(TList *input) { fInput = input; }
|
||||
virtual TList *GetOutputList() const { return fOutput; }
|
||||
virtual void SlaveTerminate();
|
||||
virtual void Terminate();
|
||||
|
||||
ClassDef(QQQ_Calcheck,0);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef QQQ_Calcheck_cxx
|
||||
void QQQ_Calcheck::Init(TTree *tree){
|
||||
|
||||
// Set branch addresses and branch pointers
|
||||
if (!tree) return;
|
||||
fChain = tree;
|
||||
fChain->SetMakeClass(1);
|
||||
|
||||
fChain->SetBranchAddress("evID", &evID, &b_eventID);
|
||||
fChain->SetBranchAddress("run", &run, &b_run);
|
||||
|
||||
sx3.SetDetDimension(24,12);
|
||||
qqq.SetDetDimension(4,32);
|
||||
pc.SetDetDimension(2,24);
|
||||
|
||||
fChain->SetBranchAddress("sx3Multi", &sx3.multi, &b_sx3Multi);
|
||||
fChain->SetBranchAddress("sx3ID", &sx3.id, &b_sx3ID);
|
||||
fChain->SetBranchAddress("sx3Ch", &sx3.ch, &b_sx3Ch);
|
||||
fChain->SetBranchAddress("sx3E", &sx3.e, &b_sx3E);
|
||||
fChain->SetBranchAddress("sx3T", &sx3.t, &b_sx3T);
|
||||
fChain->SetBranchAddress("qqqMulti", &qqq.multi, &b_qqqMulti);
|
||||
fChain->SetBranchAddress("qqqID", &qqq.id, &b_qqqID);
|
||||
fChain->SetBranchAddress("qqqCh", &qqq.ch, &b_qqqCh);
|
||||
fChain->SetBranchAddress("qqqE", &qqq.e, &b_qqqE);
|
||||
fChain->SetBranchAddress("qqqT", &qqq.t, &b_qqqT);
|
||||
fChain->SetBranchAddress("pcMulti", &pc.multi, &b_pcMulti);
|
||||
fChain->SetBranchAddress("pcID", &pc.id, &b_pcID);
|
||||
fChain->SetBranchAddress("pcCh", &pc.ch, &b_pcCh);
|
||||
fChain->SetBranchAddress("pcE", &pc.e, &b_pcE);
|
||||
fChain->SetBranchAddress("pcT", &pc.t, &b_pcT);
|
||||
|
||||
}
|
||||
|
||||
Bool_t QQQ_Calcheck::Notify(){
|
||||
|
||||
return kTRUE;
|
||||
}
|
||||
|
||||
void QQQ_Calcheck::SlaveBegin(TTree * /*tree*/){
|
||||
|
||||
TString option = GetOption();
|
||||
|
||||
}
|
||||
|
||||
void QQQ_Calcheck::SlaveTerminate(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // #ifdef QQQ_Calcheck_cxx
|
||||
238
README.md
238
README.md
|
|
@ -1,238 +0,0 @@
|
|||
# ANASEN Analysis
|
||||
|
||||
Analysis code for the **Array for Nuclear Astrophysics and Structure with Exotic Nuclei (ANASEN)** detector at FSU. Processes raw .fsu data through event building, channel mapping, calibration, and physics-level vertex reconstruction for transfer reaction experiments.
|
||||
|
||||
---
|
||||
|
||||
## Detector Overview
|
||||
|
||||
| Detector | Type | Role |
|
||||
|----------|------|------|
|
||||
| **SX3** | Double-sided silicon strip (barrel, ~88 mm radius) | Energy and Z-position of recoils/ejectiles |
|
||||
| **QQQ** | Annular silicon (forward, z = 100 mm) | Energy and polar angle of forward-going particles |
|
||||
| **PC** | Helical proportional counter | dE and azimuthal/Z position via 24 anode + 24 cathode wires |
|
||||
|
||||
The PC uses 24 twisted anode wires and 24 cathode wires. Wire geometry, crossover positions, pseudo-wire interpolation, and track-plane intersection are all handled by `Armory/ClassPW.h`.
|
||||
|
||||
---
|
||||
|
||||
## Full Analysis Chain
|
||||
|
||||
```
|
||||
Raw .fsu files (FSU digitizer output)
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ 1. EVENT BUILDING │
|
||||
│ Binary: EventBuilder (Armory/EventBuilder.cpp) │
|
||||
│ Script: buildEvents.sh or ProcessRun.sh <run> <tw> 0 │
|
||||
│ Input : *.fsu files │
|
||||
│ Output: Run_NNN_<timeWindow>ns.root (raw, unmapped TTree) │
|
||||
│ Hits within a configurable time window are grouped as events. │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ 3. PRE-ANALYSIS CHECKS (optional) │
|
||||
│ Macro: PreAnalysis.C │
|
||||
│ Plots raw rates and energy spectra per channel from unmapped │
|
||||
│ data — useful for identifying dead/noisy channels before │
|
||||
│ mapping. │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ 2. CHANNEL MAPPING │
|
||||
│ Binary: Mapper (Armory/Mapper.cpp) │
|
||||
│ Script: ProcessRun.sh <run> <tw> 0 (calls Mapper internally) │
|
||||
│ Config: mapping.h │
|
||||
│ Input : Eventbuilt ROOT tree │
|
||||
│ Output: Run_NNN_mapped.root │
|
||||
│ Translates hardware (digitizer SN, channel) to logical │
|
||||
│ detector identity (SX3/QQQ/PC, strip/wire number). │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ 4. CALIBRATION │
|
||||
│ │
|
||||
| SX3 — two-pass procedure: │
|
||||
│ Pass 1 — Left/Right matching (sx3cal/LRFit.C) │
|
||||
│ │ Start with unity gains: │
|
||||
│ │ LRFit.C fits the left/right charge ratio │
|
||||
│ │ Collate per-detector results into a single rightgains.dat │
|
||||
| │ │
|
||||
│ Pass 2 — Back/Front gain matching (sx3cal/EXFit.C) │
|
||||
│ │ Run on data that is unity-gain sorted but L/R matched │
|
||||
│ │ EXFit.C : │
|
||||
│ │ 1) gain-matches the back strips (backgains.dat) │
|
||||
│ │ 2) corrects dynamic range non-linearity in the fronts │
|
||||
│ │ (frontgains.dat) │
|
||||
│ │ Run for every detector, collate into master backgains.dat │
|
||||
│ │ and frontgains.dat. │
|
||||
│ │ |
|
||||
│ ├── GainMatchQQQ.C │
|
||||
│ │ QQQ ring/wedge gain matching │
|
||||
│ │ Output: qqq_GainMatch.dat │
|
||||
│ ├── Calibration.C │
|
||||
│ │ Final absolute energy calibration for all detectors │
|
||||
│ │ Output: qqq_Calib.dat │
|
||||
│ ├── PCGainMatch.C │
|
||||
│ │ PC anode and cathode gain matching │
|
||||
│ │ Output: slope_intercept_*.dat │
|
||||
│ ├── FitHistogramsWithTSpectrum_Sequential_Improved.C │
|
||||
│ │ Automated peak finding on PC wire spectra │
|
||||
│ │ done separately for anodes and cathodes then combined │
|
||||
│ │ (TSpectrum-based; writes centroids for gain match) │
|
||||
│ └──QQQ_Calcheck.C │
|
||||
│ Verifies QQQ calibration against known sources │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ 5. VERTEX RECONSTRUCTION (MakeVertex) │
|
||||
│ Macro : MakeVertex.C (ROOT TSelector) │
|
||||
│ Batch : run_sx3.sh (choose dataset, wireflip and offset) │
|
||||
│ Input : Run_NNN_mapped.root │
|
||||
│ Output: result_runNNN.root (calibrated TTree │
|
||||
│ + diagnostic histograms) │
|
||||
│ Applies energy calibrations, reconstructs PC hit positions │
|
||||
│ (anode energy + cathode charge division), clusters wires, │
|
||||
│ and builds SX3/QQQ/PC event objects. │
|
||||
│ 3D track-reconstruction diagnostics using │
|
||||
│ PC wire geometry and Si hit positions. │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Channel Mapping (`mapping.h` / `mapping_alpha.h`)
|
||||
|
||||
The Mapper binary reads the raw TTree (digitizer serial number + channel) and rewrites it with logical detector labels. `mapping.h` is used for standard beam runs; `mapping_alpha.h` for source/alpha calibration runs where the electronics configuration differs. The active mapping is selected by editing the `#include` at the top of `Armory/Mapper.cpp` before building.
|
||||
|
||||
`PrintMapping()` (defined in the mapping header) prints the full channel table at runtime for verification.
|
||||
|
||||
---
|
||||
|
||||
## MakeVertex — Vertex Reconstruction
|
||||
|
||||
`MakeVertex.C` is a ROOT `TSelector` that loops over the analyzed event tree and fills diagnostic and physics histograms. It loads energy-loss lookup tables from `eloss_calculations/` and uses `Armory/Kinematics.h` for two-body reaction kinematics.
|
||||
|
||||
### Diagnostic Section Toggles
|
||||
|
||||
Comment out any `#define` at the top of `MakeVertex.C` to skip that block at compile time:
|
||||
|
||||
```cpp
|
||||
#define DIAG_WIREMULT // anode/cathode cluster multiplicity plots
|
||||
#define DIAG_1WIRE // raw per-wire dE vs Si (no PC required)
|
||||
#define DIAG_PC_SX3 // PC-SX3 coincidence analysis
|
||||
#define DIAG_1A0C_SX3 // 1A0C single-wire vertex with SX3
|
||||
#define DIAG_1A0C_QQQ // 1A0C single-wire vertex with QQQ
|
||||
#define DIAG_NA0C_SX3 // nA0C (n>=2) pseudo-wire vertex with SX3
|
||||
#define DIAG_NA0C_QQQ // nA0C (n>=2) pseudo-wire vertex with QQQ
|
||||
#define DIAG_PC_QQQ // PC-QQQ coincidence analysis
|
||||
```
|
||||
|
||||
### Histogram Output Folders
|
||||
|
||||
| ROOT Folder | Content |
|
||||
|-------------|---------|
|
||||
| `wiremult` | Anode/cathode cluster size and multiplicity matrices |
|
||||
| `1wire` | Raw single-wire dE vs SX3/QQQ energy and phi correlations |
|
||||
| `hTiming` | PC-Si timing spectra |
|
||||
| `hPCZSX3` | PC-Z reconstruction with SX3 coincidence |
|
||||
| `hPCzQQQ` | PC-Z projection with QQQ coincidence |
|
||||
| `1A0C`,`2A0C`, `3A0C`, … | n anodes (n≥1), 0 cathode: pseudo-wire vertex + excitation spectra |
|
||||
| `ainterp_noc` | Pseudo-wire interpolation diagnostics (no cathode gate) |
|
||||
| `phicut` | PC-QQQ with phi coincidence gate |
|
||||
|
||||
### Vertex Reconstruction Methods
|
||||
|
||||
**nA0C (n ≥ 1 anodes, `DIAG_NA0C_SX3/QQQ`):** All anode clusters are flattened and passed to `GetPseudoWire()` to produce an energy-weighted average wire. `getClosestWirePosAtWirePhi()` then finds the point on that pseudo-wire at the Si phi. Histograms land in a folder named `{n}A0C` (e.g. `2A0C`).
|
||||
|
||||
---
|
||||
|
||||
## Energy Loss (`eloss_calculations/`)
|
||||
|
||||
Lookup tables pre-computed with [pycatima](https://github.com/hrosiak/pycatima) for the isobutane/helium fill gas at 250 Torr. Tables cover protons, alphas, aluminum beam, fluorine, and oxygen. `Eloss.py` regenerates the tables; `make_eloss_table.C` is a ROOT-based alternative generator.
|
||||
|
||||
The `cm_to_MeV` / `MeV_to_cm` TGraph pairs loaded in `MakeVertex.C` provide fast range–energy conversion for correcting energy loss in the Si detectors.
|
||||
|
||||
---
|
||||
|
||||
## Geometry Utilities
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `grid_generate.py` | Generates `detector_geometry.dat` — calculates SX3, QQQ, and PC wire azimuthal angles from first principles given detector radii and strip positions |
|
||||
| `shadowplay.py` | Exports ANASEN geometry (wires, SX3, QQQ) as a VTK file + `anasen_labels.csv` for visualisation in ParaView |
|
||||
| `detector_geometry.dat` | Pre-generated geometry reference (SX3 strip angles, wire positions) |
|
||||
| `anasen_labels.csv` | Label table for ParaView geometry display |
|
||||
|
||||
---
|
||||
|
||||
## FEM Simulations (`anasen_fem/`)
|
||||
|
||||
Finite-element simulations of the PC electric field using gmsh (meshing), Elmer (FEM solver), and ParaView (visualisation). See `anasen_fem/README.md` for full setup and installation instructions.
|
||||
|
||||
```bash
|
||||
cd anasen_fem
|
||||
python3 run.py # mesh → FEM solve → field extraction → ParaView output
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Batch Processing Scripts
|
||||
|
||||
| Script | Purpose |
|
||||
|--------|---------|
|
||||
| `buildEvents.sh <run> <tw>` | Build events from raw .fsu for a single run |
|
||||
| `ProcessRun.sh <run> <tw> <opt>` | Full single-run pipeline: event build (opt=0) or analysis (opt=1) |
|
||||
| `BatchProcess.sh` | Parallel batch processing over a run range via GNU parallel |
|
||||
| `process_mapped_run.sh <start> <end>` | Run `TrackRecon.C` in parallel over a range of mapped files |
|
||||
| `run_sx3.sh/run_27Al.sh/run_17F.sh` | Run `VertexRecon.C` in parallel over a range of mapped files and hAdds them for analysis|
|
||||
|
||||
---
|
||||
|
||||
## Dependencies
|
||||
|
||||
- [ROOT](https://root.cern) ≥ 6.x (TSelector, TChain, TVector3, TF1, TGraph, TSpectrum)
|
||||
- [GNU parallel](https://www.gnu.org/software/parallel/) — for batch scripts
|
||||
- [pycatima](https://github.com/hrosiak/pycatima) — for regenerating energy-loss tables
|
||||
- gmsh + Elmer + ParaView — for FEM simulations only
|
||||
|
||||
---
|
||||
|
||||
## Key Files Reference
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `mapping.h` / `mapping_alpha.h` | Hardware→logical channel mapping (beam / alpha-source configs) |
|
||||
| `Armory/EventBuilder.cpp` | Time-window coincidence event builder (compiled binary) |
|
||||
| `Armory/Mapper.cpp` | Channel remapper: SN+ch → detector ID (compiled binary) |
|
||||
| `PreAnalysis.C / .h` | Raw rate and energy checks on mapped data |
|
||||
| `sx3cal/EXFit.C`, `EXFit2.C` | SX3 front/back gain coefficient extraction |
|
||||
| `sx3cal/LRFit.C` | SX3 left-right position calibration |
|
||||
| `sx3cal/{17F,27Al}/` | Per-experiment gain coefficient files (frontgains, backgains, rightgains) |
|
||||
| `GainMatchQQQ.C` | QQQ gain matching |
|
||||
| `Calibration.C / .h` | Absolute energy calibration |
|
||||
| `QQQ_Calcheck.C` | QQQ calibration verification |
|
||||
| `PCGainMatch.C` | PC anode/cathode gain matching |
|
||||
| `FitHistogramsWithTSpectrum_Sequential_Improved.C` | Automated PC anode peak fitting |
|
||||
| `Analyzer.C / .h` | Event-level clustering and PC hit reconstruction, (older in need of rehaul)|
|
||||
| `Analysis.C` | TChain wrapper to run Analyzer over a run range |
|
||||
| `processRun.C` | Single-file wrapper to run Analyzer on one ROOT file |
|
||||
| `MakeVertex.C / .h` | Vertex reconstruction and physics histogram production |
|
||||
| `TrackRecon.C / .h` | Alternate to VertexRecon, to track changes through code, eventaully plan to clean up one for actual data analysis |
|
||||
| `RunTimeSummary.C` | Run-by-run timing/rate summary across a run range |
|
||||
| `Armory/ClassPW.h` | PC wire geometry: crossovers, pseudo-wire, track-plane intersection |
|
||||
| `Armory/Kinematics.h/.cpp` | Two-body reaction kinematics (excitation energy, Q-value) |
|
||||
| `Armory/HistPlotter.h` | Histogram management with named ROOT folders |
|
||||
| `Armory/SX3Geom.h` | SX3 detector geometry |
|
||||
| `Armory/PC_StepLadder_Correction.h` | PC Z-position slope correction |
|
||||
| `eloss_calculations/Eloss.py` | Energy-loss table generator (pycatima) |
|
||||
| `grid_generate.py` | Generates `detector_geometry.dat` from first principles |
|
||||
| `shadowplay.py` | Exports ANASEN geometry to VTK + CSV for ParaView |
|
||||
| `detector_geometry.dat` | Pre-generated detector geometry reference |
|
||||
| `anasen_labels.csv` | Label table for ParaView geometry visualisation |
|
||||
| `anasen_fem/` | FEM electric field simulations for the PC |
|
||||
140
RunTimeSummary.C
140
RunTimeSummary.C
|
|
@ -1,140 +0,0 @@
|
|||
#include <TFile.h>
|
||||
#include <TH1.h>
|
||||
#include <TH2.h>
|
||||
#include <TString.h>
|
||||
#include <TSystem.h>
|
||||
#include <TCanvas.h>
|
||||
#include <iostream>
|
||||
|
||||
void RunTimeSummary(int startRun, int endRun)
|
||||
{
|
||||
TString fileDir = "/mnt/d/Remapped_files/17F_data/root_data/";
|
||||
TString histName = "AnodeQQQ_Time";
|
||||
TString filePattern = "Run_%03d_mapped_histograms.root";
|
||||
TString filePatternAlt = "ProtonRun_%d_mapped_histograms.root";
|
||||
TString filePatternAlt2 = "Source_%d_mapped_histograms.root";
|
||||
|
||||
int nBinsTime = 0;
|
||||
double timeMin = 0, timeMax = 0;
|
||||
bool foundRef = false;
|
||||
|
||||
for (int r = startRun; r <= endRun; r++)
|
||||
{
|
||||
TString tempName;
|
||||
|
||||
// 1. Try Pattern 1: Run_XXX...
|
||||
tempName = fileDir + Form(filePattern, r);
|
||||
if (gSystem->AccessPathName(tempName))
|
||||
{ // Returns true if MISSING
|
||||
|
||||
// 2. Try Pattern 2: ProtonRun_X...
|
||||
tempName = fileDir + Form(filePatternAlt, r);
|
||||
if (gSystem->AccessPathName(tempName))
|
||||
{
|
||||
|
||||
// 3. Try Pattern 3: Source_X...
|
||||
tempName = fileDir + Form(filePatternAlt2, r);
|
||||
if (gSystem->AccessPathName(tempName))
|
||||
{
|
||||
// All 3 patterns failed. Skip this run.
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we get here, 'tempName' holds the valid filename that was found
|
||||
TFile *fTemp = TFile::Open(tempName);
|
||||
if (!fTemp || fTemp->IsZombie())
|
||||
{
|
||||
if (fTemp)
|
||||
delete fTemp;
|
||||
continue;
|
||||
}
|
||||
|
||||
TH1F *hRef = (TH1F *)fTemp->Get(histName);
|
||||
if (hRef)
|
||||
{
|
||||
|
||||
nBinsTime = hRef->GetNbinsX();
|
||||
timeMin = hRef->GetXaxis()->GetXmin();
|
||||
timeMax = hRef->GetXaxis()->GetXmax();
|
||||
foundRef = true;
|
||||
|
||||
delete hRef;
|
||||
fTemp->Close();
|
||||
delete fTemp;
|
||||
printf("Reference found in Run %d: %d bins, Range [%.1f, %.1f]\n", r, nBinsTime, timeMin, timeMax);
|
||||
break;
|
||||
}
|
||||
fTemp->Close();
|
||||
delete fTemp;
|
||||
}
|
||||
|
||||
if (!foundRef)
|
||||
{
|
||||
printf("Error: No valid histograms found in the entire range. Exiting.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
int nRuns = endRun - startRun + 1;
|
||||
TH2F *hSummary = new TH2F("hSummary",
|
||||
Form("Timing Summary (Runs %d-%d);Timing;Run Number", startRun, endRun),
|
||||
nBinsTime, timeMin, timeMax,
|
||||
nRuns, startRun, endRun + 1);
|
||||
|
||||
for (int run = startRun; run <= endRun; run++)
|
||||
{
|
||||
|
||||
TString filename = fileDir + Form(filePattern, run);
|
||||
|
||||
if (gSystem->AccessPathName(filename))
|
||||
continue;
|
||||
|
||||
TFile *fin = TFile::Open(filename);
|
||||
if (!fin || fin->IsZombie())
|
||||
{
|
||||
if (fin)
|
||||
delete fin;
|
||||
continue;
|
||||
}
|
||||
|
||||
TH1F *hin = (TH1F *)fin->Get(histName);
|
||||
|
||||
if (hin)
|
||||
{
|
||||
// Determine which ROW (Y-bin) corresponds to this Run
|
||||
// Note: ROOT bins start at 1.
|
||||
// If startRun=10 and run=10 -> binY=1.
|
||||
int binY_Run = run - startRun + 1;
|
||||
|
||||
// Loop through the Time bins (X-bins in the 1D hist)
|
||||
for (int binX_Time = 1; binX_Time <= hin->GetNbinsX(); binX_Time++)
|
||||
{
|
||||
|
||||
double content = hin->GetBinContent(binX_Time);
|
||||
|
||||
// Copy content to: (Time, Run)
|
||||
if (content > 0)
|
||||
{
|
||||
hSummary->SetBinContent(binX_Time, binY_Run, content);
|
||||
}
|
||||
}
|
||||
delete hin;
|
||||
}
|
||||
|
||||
fin->Close();
|
||||
delete fin;
|
||||
|
||||
if ((run - startRun) % 10 == 0)
|
||||
printf("Stitched Run %d...\n", run);
|
||||
}
|
||||
|
||||
TFile *fOut = new TFile("SummaryPlot.root", "RECREATE");
|
||||
hSummary->Write();
|
||||
|
||||
TCanvas *c1 = new TCanvas("c1", "Time Summary Plot", 1000, 800);
|
||||
hSummary->SetStats(0);
|
||||
hSummary->Draw("COLZ");
|
||||
|
||||
printf("Done! Saved to SummaryPlot.root\n");
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 70 KiB |
1990
TrackRecon.C
1990
TrackRecon.C
File diff suppressed because it is too large
Load Diff
41
TrackRecon.h
41
TrackRecon.h
|
|
@ -3,25 +3,21 @@
|
|||
|
||||
#include <TROOT.h>
|
||||
#include <TChain.h>
|
||||
#include <TApplication.h>
|
||||
#include <TFile.h>
|
||||
#include <TSelector.h>
|
||||
#include <iomanip>
|
||||
#include <vector> // Required for vectors
|
||||
#include <utility> // Required for std::pair
|
||||
|
||||
#include "Armory/ClassDet.h"
|
||||
#include "Armory/ClassPW.h" // YOU ADDED THIS (Correct! Defines Coord)
|
||||
|
||||
class TrackRecon : public TSelector {
|
||||
public :
|
||||
TTree *fChain; //!pointer to the analyzed TTree or TChain
|
||||
|
||||
// Fixed size dimensions of array or collections stored in the TTree if any.
|
||||
|
||||
// Declaration of leaf types
|
||||
Det sx3;
|
||||
Det qqq;
|
||||
Det pc ;
|
||||
Det misc;
|
||||
|
||||
ULong64_t evID;
|
||||
UInt_t run;
|
||||
|
|
@ -44,23 +40,6 @@ public :
|
|||
TBranch *b_pcCh; //!
|
||||
TBranch *b_pcE; //!
|
||||
TBranch *b_pcT; //!
|
||||
TBranch *b_miscMulti; //!
|
||||
TBranch *b_miscID; //!
|
||||
TBranch *b_miscCh; //!
|
||||
TBranch *b_miscE; //!
|
||||
TBranch *b_miscT; //!
|
||||
TBranch *b_miscTf; //!
|
||||
|
||||
// 1. Geometry Cache
|
||||
Coord Crossover[24][24][2];
|
||||
|
||||
// 2. Persistent Vectors (REQUIRED for the optimized .cxx to work)
|
||||
std::vector<std::pair<int, double>> anodeHits;
|
||||
std::vector<std::pair<int, double>> cathodeHits;
|
||||
std::vector<std::pair<int, double>> corrcatMax;
|
||||
std::vector<std::pair<int, double>> corranoMax;
|
||||
std::vector<double> cathodeTimes;
|
||||
std::vector<double> anodeTimes;
|
||||
|
||||
TrackRecon(TTree * /*tree*/ =0) : fChain(0) { }
|
||||
virtual ~TrackRecon() { }
|
||||
|
|
@ -86,6 +65,7 @@ public :
|
|||
#ifdef TrackRecon_cxx
|
||||
void TrackRecon::Init(TTree *tree){
|
||||
|
||||
// Set branch addresses and branch pointers
|
||||
if (!tree) return;
|
||||
fChain = tree;
|
||||
fChain->SetMakeClass(1);
|
||||
|
|
@ -112,22 +92,23 @@ void TrackRecon::Init(TTree *tree){
|
|||
fChain->SetBranchAddress("pcCh", &pc.ch, &b_pcCh);
|
||||
fChain->SetBranchAddress("pcE", &pc.e, &b_pcE);
|
||||
fChain->SetBranchAddress("pcT", &pc.t, &b_pcT);
|
||||
fChain->SetBranchAddress("miscMulti", &misc.multi, &b_miscMulti);
|
||||
fChain->SetBranchAddress("miscID", &misc.id, &b_miscID);
|
||||
fChain->SetBranchAddress("miscCh", &misc.ch, &b_miscCh);
|
||||
fChain->SetBranchAddress("miscE", &misc.e, &b_miscE);
|
||||
fChain->SetBranchAddress("miscT", &misc.t, &b_miscT);
|
||||
fChain->SetBranchAddress("miscf", &misc.tf, &b_miscTf);
|
||||
|
||||
}
|
||||
|
||||
Bool_t TrackRecon::Notify(){
|
||||
|
||||
return kTRUE;
|
||||
}
|
||||
|
||||
void TrackRecon::SlaveBegin(TTree * /*tree*/){
|
||||
// TString option = GetOption();
|
||||
|
||||
TString option = GetOption();
|
||||
|
||||
}
|
||||
|
||||
void TrackRecon::SlaveTerminate(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // #ifdef TrackRecon_cxx
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 201 KiB |
|
|
@ -1,27 +0,0 @@
|
|||
### README for ANASEN fem simulations:
|
||||
|
||||
* There are a few iterations of these simulations that already exist. Be sure to also locate and refer to them if necessary.
|
||||
* Install gmsh and its python api by running (Ubuntu 22.04 LTS)
|
||||
|
||||
```
|
||||
sudo apt install gmsh python3-gmsh
|
||||
```
|
||||
|
||||
* Gmsh gives us the tools to create a meshgrid that samples the 2d space appropriately to plot the field/equipotential lines.
|
||||
* The output file typically has the .msh extension. This is read as input to Elmer, which is the FEM differential-equation solver.
|
||||
|
||||
* Install Elmer via the following steps:
|
||||
|
||||
```
|
||||
sudo add-apt-repository ppa:elmer-csc-ubuntu/elmer-csc-ppa
|
||||
sudo apt install elmerfem-csc-eg
|
||||
```
|
||||
|
||||
* Install ParaView for visualizations by downloading from the Linux .tar.gz link at https://www.paraview.org/download/
|
||||
- The current version is tested to work on Paraview 6.1.0. The default version in Ubuntu 22.04 repositories has some trouble with scripting
|
||||
* v0.0.1, March 10 2026
|
||||
- 2d simulations of fields only. gmsh for meshing, elmer for fem, paraview to plot
|
||||
- Before running, open `paraview_plotter.py` to make the bash shebang (#!) point to the location of `pvpython` or `pvbatch`
|
||||
- `python3 run.py` should run everything in order, and is hopefully all the files are self-documenting
|
||||
* v0.0.2, planned TODO
|
||||
- Garfield to take Elmer results and perform charge-transport
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
rm wires2d.msh
|
||||
rm wires2d/*
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
1
|
||||
13 1.0
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
import ROOT
|
||||
import os
|
||||
import sys
|
||||
|
||||
# 1. FIX: Manually load the Garfield library if it's not in the ROOT namespace
|
||||
# Update this path to your actual installation location
|
||||
garfield_lib_path = "/home/vs19g/garfieldpp/install/lib/libGarfield.so" #penguin path
|
||||
# garfield_lib_path = "/home/vsitaraman/garfieldpp/install/lib/libGarfield.so" #laptop path
|
||||
|
||||
if os.path.exists(garfield_lib_path):
|
||||
ROOT.gSystem.Load(garfield_lib_path)
|
||||
else:
|
||||
print(f"CRITICAL ERROR: {garfield_lib_path} not found.")
|
||||
sys.exit(1)
|
||||
|
||||
# Verify access
|
||||
try:
|
||||
test_gas = ROOT.Garfield.MediumMagboltz()
|
||||
except AttributeError:
|
||||
print("ERROR: Garfield shared library loaded, but 'Garfield' namespace not found.")
|
||||
sys.exit(1)
|
||||
|
||||
# --- 2. GAS SETUP (96% He, 4% CO2) ---
|
||||
gas = ROOT.Garfield.MediumMagboltz()
|
||||
gas_file = "He96_CO2_4_260Torr.gas"
|
||||
|
||||
if not os.path.exists(gas_file):
|
||||
print("Generating new Magboltz gas table (260 Torr)...")
|
||||
# --- Optimized Magboltz Settings ---
|
||||
gas.SetComposition("he", 96.0, "co2", 4.0)
|
||||
gas.SetTemperature(293.15)
|
||||
gas.SetPressure(260.0)
|
||||
|
||||
# 1. Limit the Field Grid:
|
||||
gas.SetFieldGrid(10., 80000., 20, True)
|
||||
|
||||
# 2. Reduce the precision slightly for the first run:
|
||||
gas.GenerateGasTable(8)
|
||||
gas.WriteGasFile(gas_file)
|
||||
else:
|
||||
print(f"Loading existing gas table: {gas_file}")
|
||||
gas.LoadGasFile(gas_file)
|
||||
|
||||
# --- 3. FIELD MAP SETUP ---
|
||||
fm = ROOT.Garfield.ComponentElmer2d()
|
||||
|
||||
|
||||
fm.Initialise("wires2d/mesh.header",
|
||||
"wires2d/mesh.elements",
|
||||
"wires2d/mesh.nodes",
|
||||
"dielectrics.dat",
|
||||
"wires2d/elstatics.result",
|
||||
"mm")
|
||||
|
||||
# Set the medium (Body 13 from your Gmsh script)
|
||||
fm.SetMedium(0, gas)
|
||||
|
||||
# --- 4. SENSOR AND DRIFT SETUP ---
|
||||
sensor = ROOT.Garfield.Sensor()
|
||||
sensor.AddComponent(fm)
|
||||
sensor.SetArea(-50.0, -50.0, -5.0, 50.0, 50.0, 5.0) #hardcoding the sesnsor area to define a psuedo 3d geometry
|
||||
|
||||
# Heavy Ion Drift (RKF) - Best for the general track
|
||||
drift = ROOT.Garfield.DriftLineRKF()
|
||||
drift.SetSensor(sensor)
|
||||
|
||||
# Electron Avalanche (Microscopic) - Best for high-field gain
|
||||
aval = ROOT.Garfield.AvalancheMicroscopic()
|
||||
aval.SetSensor(sensor)
|
||||
|
||||
# --- 5. EXECUTION ---
|
||||
# Starting position (e.g., near the IC wires at r=23mm or closer to Anodes)
|
||||
x0, y0, z0, t0 = 3.50, 0.0, 0.0, 0.0
|
||||
|
||||
print(f"Simulating heavy ion drift from r={x0}...")
|
||||
drift.DriftIon(x0, y0, z0, t0)
|
||||
|
||||
# Create a file to store the heavy ion track
|
||||
with open("heavy_ion_track.csv", "w") as f:
|
||||
f.write("x,y,z,t\n")
|
||||
|
||||
# After running drift.DriftIon(x0, y0, z0, t0):
|
||||
n_points = drift.GetNumberOfDriftLinePoints()
|
||||
for i in range(n_points):
|
||||
xi, yi, zi, ti = ROOT.double(0), ROOT.double(0), ROOT.double(0), ROOT.double(0)
|
||||
drift.GetDriftLinePoint(i, xi, yi, zi, ti)
|
||||
f.write(f"{xi},{yi},{zi},{ti}\n")
|
||||
|
||||
print(f"Simulating electron avalanche from r={x0}...")
|
||||
# AvalancheElectron(x, y, z, t, energy, dx, dy, dz)
|
||||
aval.AvalancheElectron(x0, y0, z0, t0, 0.1, 0.0, 0.0, 0.0)
|
||||
|
||||
with open("avalanche_endpoints.csv", "w") as f:
|
||||
f.write("x,y,z,t\n")
|
||||
|
||||
# After aval.AvalancheElectron(...)
|
||||
n_endpoints = aval.GetNumberOfEndpoints()
|
||||
for i in range(n_endpoints):
|
||||
# Get start and end points of each electron in the avalanche
|
||||
x1, y1, z1, t1, e1 = ROOT.double(0), ROOT.double(0), ROOT.double(0), ROOT.double(0), ROOT.double(0)
|
||||
x2, y2, z2, t2, e2, status = ROOT.double(0), ROOT.double(0), ROOT.double(0), ROOT.double(0), ROOT.double(0), ROOT.int(0)
|
||||
|
||||
aval.GetEndpoint(i, x1, y1, z1, t1, e1, x2, y2, z2, t2, e2, status)
|
||||
# We save the endpoint (x2, y2, z2) where the electron was collected or attached
|
||||
f.write(f"{x2},{y2},{z2},{t2}\n")
|
||||
|
||||
print("Simulation complete.")
|
||||
|
|
@ -1,114 +0,0 @@
|
|||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
from mpl_toolkits.mplot3d import Axes3D
|
||||
|
||||
acolors = plt.get_cmap('tab20',24)
|
||||
ccolors = plt.get_cmap('tab20',24)
|
||||
|
||||
k=-2*np.pi/24.
|
||||
offset = 6*k + 3*k #-pi/2
|
||||
xarra_1 = np.array([37*np.cos(k*i+offset) for i in np.arange(0,24)])
|
||||
yarra_1 = np.array([37*np.sin(k*i+offset) for i in np.arange(0,24)])
|
||||
labelsa_1 = np.array([i for i in np.arange(0,24)])
|
||||
|
||||
fig,ax = plt.subplots(figsize=(10,10))
|
||||
ax.invert_yaxis()
|
||||
ax.plot(xarra_1,yarra_1,"x",label="anode, z=-L/2")
|
||||
|
||||
for x,y,label in zip(xarra_1,yarra_1,labelsa_1):
|
||||
ax.text(x,y,label)
|
||||
|
||||
kc=2*np.pi/24.
|
||||
offsetc = -4*kc + 2*kc - np.pi/24 #-pi/4
|
||||
xarrc_1 = np.array([42*np.cos(kc*i+offsetc) for i in np.arange(0,24)])
|
||||
yarrc_1 = np.array([42*np.sin(kc*i+offsetc) for i in np.arange(0,24)])
|
||||
labelsc_1 = np.array([i for i in np.arange(0,24)])
|
||||
|
||||
ax.plot(xarrc_1,yarrc_1,"o",label="cathode, z=-L/2, where they are picked up")
|
||||
|
||||
for x,y,label in zip(xarrc_1,yarrc_1,labelsc_1):
|
||||
ax.text(x,y,label)
|
||||
plt.title("z=-L/2 plane, beam going into the plane along +z, (+x right, +y down)")
|
||||
plt.grid()
|
||||
plt.legend()
|
||||
plt.savefig("plane1.png")
|
||||
plt.show()
|
||||
|
||||
fig,ax = plt.subplots(figsize=(10,10))
|
||||
ax.invert_yaxis()
|
||||
|
||||
offset = offset-3*k
|
||||
xarra_2 = np.array([37*np.cos(k*i+offset) for i in np.arange(0,24)])
|
||||
yarra_2 = np.array([37*np.sin(k*i+offset) for i in np.arange(0,24)])
|
||||
labelsa_2 = np.array([i for i in np.arange(0,24)])
|
||||
|
||||
ax.plot(xarra_2,yarra_2,"x",label="anode, z=+L/2, where they are picked up")
|
||||
|
||||
for x,y,label in zip(xarra_2,yarra_2,labelsa_2):
|
||||
ax.text(x,y,label)
|
||||
|
||||
offsetc = offsetc-3*kc
|
||||
xarrc_2 = np.array([42*np.cos(kc*i+offsetc) for i in np.arange(0,24)])
|
||||
yarrc_2 = np.array([42*np.sin(kc*i+offsetc) for i in np.arange(0,24)])
|
||||
labelsc_2 = np.array([i for i in np.arange(0,24)])
|
||||
|
||||
ax.plot(xarrc_2,yarrc_2,"o",label="cathode, z=+L/2")
|
||||
|
||||
for x,y,label in zip(xarrc_2,yarrc_2,labelsc_2):
|
||||
ax.text(x,y,label)
|
||||
plt.title("z=+L/2 plane, beam going into the plane along +z, (+x right, +y down)")
|
||||
plt.grid()
|
||||
plt.legend()
|
||||
plt.savefig("plane2.png")
|
||||
plt.show()
|
||||
|
||||
fig = plt.figure(figsize=(10,10))
|
||||
ax = fig.add_subplot(111,projection='3d')
|
||||
ax.set_xlabel("x")
|
||||
ax.set_ylabel("y")
|
||||
ax.set_zlabel("z")
|
||||
|
||||
xx_a = np.array([[x1,x2] for x1,x2 in zip(xarra_1,xarra_2)])
|
||||
yy_a = np.array([[y1,y2] for y1,y2 in zip(yarra_1,yarra_2)])
|
||||
zz_a = np.array([[-173.5,173.5] for x1,x2 in zip(xarra_1,xarra_2)])
|
||||
for i,[xx,yy,zz] in enumerate(zip(xx_a,yy_a,zz_a)):
|
||||
ax.plot(xx,yy,zz,'-',color=acolors(i/24))
|
||||
|
||||
for i,[x,y,label] in enumerate(zip(xarra_1,yarra_1,labelsa_1)):
|
||||
ax.text(x,y,-173,"a"+str(label),color=acolors(i/24))
|
||||
for i,[x,y,label] in enumerate(zip(xarra_2,yarra_2,labelsa_2)):
|
||||
ax.text(x,y,+173,"a"+str(label),color=acolors(i/24))
|
||||
|
||||
xx_c = np.array([[x1,x2] for x1,x2 in zip(xarrc_1,xarrc_2)])
|
||||
yy_c = np.array([[y1,y2] for y1,y2 in zip(yarrc_1,yarrc_2)])
|
||||
zz_c = np.array([[-173.5,173.5] for x1,x2 in zip(xarrc_1,xarrc_2)])
|
||||
for i,[xx,yy,zz] in enumerate(zip(xx_c,yy_c,zz_c)):
|
||||
ax.plot(xx,yy,zz,'--',color=ccolors(((47-i)%24)/24))
|
||||
|
||||
for i,[x,y,label] in enumerate(zip(xarrc_1,yarrc_1,labelsc_1)):
|
||||
ax.text(x,y,-173,"c"+str(label),color=ccolors(((25-i)%24)/24))
|
||||
for i,[x,y,label] in enumerate(zip(xarrc_2,yarrc_2,labelsc_2)):
|
||||
ax.text(x,y,+173,"c"+str(label),color=ccolors(((47-i)%24)/24))
|
||||
ax.view_init(elev=-53, azim=-106, roll=18)
|
||||
plt.tight_layout()
|
||||
plt.show()
|
||||
phi_qqq = np.array([[2*np.pi*(-i*16+j+0.5)/(16*4) for i in range(4)] for j in range(16)])
|
||||
print(phi_qqq)
|
||||
#'''
|
||||
for i,[phi1,phi2,phi3,phi4] in enumerate(phi_qqq):
|
||||
ax.plot([50*np.cos(phi1),100*np.cos(phi1)],[50*np.sin(phi1),100*np.sin(phi1)],[100,100],'-',color='red')
|
||||
ax.text(104*np.cos(phi1),104*np.sin(phi1),100,"0_%d"%(i),color="red")
|
||||
|
||||
ax.plot([50*np.cos(phi2),100*np.cos(phi2)],[50*np.sin(phi2),100*np.sin(phi2)],[100,100],'-',color='green')
|
||||
ax.text(104*np.cos(phi2),104*np.sin(phi2),100,"1_%d"%(i),color="green")
|
||||
|
||||
ax.plot([50*np.cos(phi3),100*np.cos(phi3)],[50*np.sin(phi3),100*np.sin(phi3)],[100,100],'-',color='blue')
|
||||
ax.text(104*np.cos(phi3),104*np.sin(phi3),100,"2_%d"%(i),color="blue")
|
||||
|
||||
ax.plot([50*np.cos(phi4),100*np.cos(phi4)],[50*np.sin(phi4),100*np.sin(phi4)],[100,100],'-',color='brown')
|
||||
ax.text(104*np.cos(phi4),104*np.sin(phi4),100,"3_%d"%(i),color="brown")
|
||||
#'''
|
||||
#coords_qqq = np.array([[50*np.cos(phi),100*np.sin(phi),100] for phi in phi_qqq]).T
|
||||
plt.tight_layout()
|
||||
plt.show()
|
||||
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
Check Keywords Warn
|
||||
|
||||
Header
|
||||
Mesh DB "." "wires2d"
|
||||
End
|
||||
|
||||
Simulation
|
||||
Coordinate System = Cartesian 2D
|
||||
Simulation Type = Steady State
|
||||
Steady State Max Iterations = 1
|
||||
Output File = "elstatics.result"
|
||||
Post File = "elstatics.ep"
|
||||
End
|
||||
|
||||
Constants
|
||||
Permittivity Of Vacuum = 8.8542e-12
|
||||
End
|
||||
|
||||
|
||||
Body 1
|
||||
Target Bodies(1) = 13
|
||||
Equation = 1
|
||||
Material = 1
|
||||
End
|
||||
|
||||
|
||||
Equation 1
|
||||
Active Solvers(2) = 1 2
|
||||
End
|
||||
|
||||
|
||||
Material 1
|
||||
Relative Permittivity = 1
|
||||
End
|
||||
|
||||
|
||||
Solver 1
|
||||
Equation = Electrostatics
|
||||
Procedure = "StatElecSolve" "StatElecSolver"
|
||||
|
||||
Variable = Potential
|
||||
Variable DOFs = 1
|
||||
|
||||
Calculate Electric Field = True
|
||||
Calculate Electric Flux = False
|
||||
|
||||
Linear System Solver = Iterative
|
||||
Linear System Iterative Method = CG
|
||||
Linear System Max Iterations = 500
|
||||
Linear System Convergence Tolerance = 1.0e-8
|
||||
Linear System Preconditioning = ILU1
|
||||
End
|
||||
|
||||
|
||||
Solver 2
|
||||
Equation = Electric Force
|
||||
Procedure = "ElectricForce" "StatElecForce"
|
||||
End
|
||||
|
||||
|
||||
Boundary Condition 1
|
||||
Target Boundaries = 10
|
||||
Potential = 650
|
||||
Calculate Electric Force = True
|
||||
End
|
||||
|
||||
|
||||
Boundary Condition 2
|
||||
Target Boundaries = 20
|
||||
Potential = 0
|
||||
End
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
import numpy as np
|
||||
import gmsh
|
||||
|
||||
gmsh.initialize()
|
||||
gmsh.model.add("adaptive_mesh")
|
||||
gmsh.option.setNumber('General.NumThreads', 4)
|
||||
#gmsh.option.setNumber("Mesh.Adapt.MaxNumberOfElements", 200000)
|
||||
#gmsh.option.setNumber("Mesh.Adapt.MaxNumberOfNodes", 200000)
|
||||
#gmsh.option.setNumber("Mesh.Adapt.MaxIter",5)
|
||||
#gmsh.option.setNumber("Mesh.MeshSizeMin", 5e-3)
|
||||
#gmsh.option.setNumber("Mesh.MeshSizeMax", 10.0)
|
||||
#gmsh.option.setNumber("Mesh.CharacteristicLengthFromCurvature", 0)
|
||||
|
||||
lc = 0.01
|
||||
|
||||
#anodes, plane 1 at -zmax/2
|
||||
k=-2*np.pi/24.
|
||||
offset = 6*k + 3*k #-pi/2
|
||||
xarra_1 = np.array([37*np.cos(k*i+offset) for i in np.arange(0,24)])
|
||||
yarra_1 = np.array([37*np.sin(k*i+offset) for i in np.arange(0,24)])
|
||||
|
||||
#cathodes, plane 1 at -zmax/2
|
||||
kc=2*np.pi/24.
|
||||
offsetc = -4*kc + 2*kc - np.pi/24 #-pi/4
|
||||
xarrc_1 = np.array([42*np.cos(kc*i+offsetc) for i in np.arange(0,24)])
|
||||
yarrc_1 = np.array([42*np.sin(kc*i+offsetc) for i in np.arange(0,24)])
|
||||
|
||||
#anodes, plane 2 at +zmax/2
|
||||
offset = offset-3*k
|
||||
xarra_2 = np.array([37*np.cos(k*i+offset) for i in np.arange(0,24)])
|
||||
yarra_2 = np.array([37*np.sin(k*i+offset) for i in np.arange(0,24)])
|
||||
|
||||
#cathodes, plane2 at +zmax/2
|
||||
offsetc = offsetc-3*kc
|
||||
xarrc_2 = np.array([42*np.cos(kc*i+offsetc) for i in np.arange(0,24)])
|
||||
yarrc_2 = np.array([42*np.sin(kc*i+offsetc) for i in np.arange(0,24)])
|
||||
|
||||
pa1 = []
|
||||
pa2 = []
|
||||
pc1 = []
|
||||
pc2 = []
|
||||
|
||||
wire_radius = 0.254 #mm
|
||||
anode_wires = []
|
||||
cathode_wires = []
|
||||
aw_tags = [(3,i) for i in range(24)]
|
||||
cw_tags = [(3,i+24) for i in range(24)]
|
||||
|
||||
for i,[xa,ya,xc,yc,xa2,ya2,xc2,yc2] in enumerate(zip(xarra_1,yarra_1,xarrc_1,yarrc_1,xarra_2,yarra_2,xarrc_2,yarrc_2)):
|
||||
print(i,xa,ya,-178.3,xc,yc,-178.3,xa2,ya2,178.3,xc2,yc2,178.3)
|
||||
anode_wires.append(gmsh.model.occ.addCylinder(xa,ya,-178.3,(xa2-xa),(ya2-ya),178.3*2,wire_radius,i)) #x,y,z of first face center, dx,dy,dz of the axis, then the wire radius
|
||||
cathode_wires.append(gmsh.model.occ.addCylinder(xc,yc,-178.3,(xc2-xc),(yc2-yc),178.3*2,wire_radius,i+24)) #cathode tags 24-47, anode 0-23
|
||||
|
||||
|
||||
anasen_barrel = gmsh.model.occ.addCylinder(0,0,-500,0,0,500+605,300,1234) #tag 1234
|
||||
#anasen_barrel = gmsh.model.occ.addCylinder(0,0,-500,0,0,500+605,300,1234) #tag 1234
|
||||
|
||||
gmsh.model.occ.synchronize()
|
||||
|
||||
all_wires = aw_tags+cw_tags
|
||||
gmsh.model.occ.fragment([(3,1234)],all_wires)
|
||||
gmsh.model.occ.removeAllDuplicates()
|
||||
gmsh.model.occ.synchronize()
|
||||
gmsh.option.setNumber("Geometry.Tolerance", 1e-6)
|
||||
gmsh.option.setNumber("Geometry.OCCFixDegenerated", 1)
|
||||
gmsh.option.setNumber("Geometry.OCCFixSmallEdges", 1)
|
||||
gmsh.option.setNumber("Geometry.OCCFixSmallFaces", 1)
|
||||
|
||||
wire_surfs = []
|
||||
for w in anode_wires + cathode_wires:
|
||||
wire_surfs += [s[1] for s in gmsh.model.getBoundary([(3,w)], oriented=False) if s[0] == 2]
|
||||
#'''
|
||||
f1 = gmsh.model.mesh.field.add("Distance")
|
||||
gmsh.model.mesh.field.setNumbers(f1, "FacesList", wire_surfs) # Example curves
|
||||
f2 = gmsh.model.mesh.field.add("Threshold")
|
||||
gmsh.model.mesh.field.setNumber(f2, "InField", f1)
|
||||
gmsh.model.mesh.field.setNumber(f2, "SizeMin", 0.05)
|
||||
gmsh.model.mesh.field.setNumber(f2, "SizeMax", 5.)
|
||||
gmsh.model.mesh.field.setNumber(f2, "DistMin", 1.)
|
||||
gmsh.model.mesh.field.setNumber(f2, "DistMax", 20.)
|
||||
gmsh.model.mesh.field.setAsBackgroundMesh(f2)
|
||||
#'''
|
||||
gmsh.option.setNumber("Mesh.Algorithm", 2)
|
||||
gmsh.option.setNumber("Mesh.Algorithm3D", 1) # For 3D meshes
|
||||
|
||||
gmsh.model.mesh.generate(dim=3)
|
||||
#gmsh.model.mesh.refine()
|
||||
#gmsh.model.mesh.refine()
|
||||
#gmsh.model.mesh.refine()
|
||||
gmsh.fltk.run()
|
||||
gmsh.finalize()
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
import numpy as np
|
||||
import gmsh
|
||||
|
||||
gmsh.initialize()
|
||||
#gmsh.model.add("adaptive_mesh")
|
||||
gmsh.option.setNumber('General.NumThreads', 4)
|
||||
#gmsh.option.setNumber("Mesh.Adapt.MaxNumberOfElements", 200000)
|
||||
#gmsh.option.setNumber("Mesh.Adapt.MaxNumberOfNodes", 200000)
|
||||
#gmsh.option.setNumber("Mesh.Adapt.MaxIter",5)
|
||||
#gmsh.option.setNumber("Mesh.MeshSizeMin", 5e-3)
|
||||
#gmsh.option.setNumber("Mesh.MeshSizeMax", 10.0)
|
||||
gmsh.option.setNumber("Geometry.Tolerance", 1e-2)
|
||||
#gmsh.option.setNumber("Mesh.CharacteristicLengthFromCurvature", 0)
|
||||
|
||||
lc = 0.04
|
||||
#anodes, plane 1 at -zmax/2
|
||||
k=-2*np.pi/24.
|
||||
offset = 6*k + 3*k #-pi/2
|
||||
xarra_1 = np.array([37*np.cos(k*i+offset) for i in np.arange(0,24)])
|
||||
yarra_1 = np.array([37*np.sin(k*i+offset) for i in np.arange(0,24)])
|
||||
|
||||
#cathodes, plane 1 at -zmax/2
|
||||
kc=2*np.pi/24.
|
||||
offsetc = -4*kc + 2*kc - np.pi/24 #-pi/4
|
||||
xarrc_1 = np.array([42*np.cos(kc*i+offsetc) for i in np.arange(0,24)])
|
||||
yarrc_1 = np.array([42*np.sin(kc*i+offsetc) for i in np.arange(0,24)])
|
||||
|
||||
#anodes, plane 2 at +zmax/2
|
||||
offset = offset-3*k
|
||||
xarra_2 = np.array([37*np.cos(k*i+offset) for i in np.arange(0,24)])
|
||||
yarra_2 = np.array([37*np.sin(k*i+offset) for i in np.arange(0,24)])
|
||||
|
||||
#cathodes, plane2 at +zmax/2
|
||||
offsetc = offsetc-3*kc
|
||||
xarrc_2 = np.array([42*np.cos(kc*i+offsetc) for i in np.arange(0,24)])
|
||||
yarrc_2 = np.array([42*np.sin(kc*i+offsetc) for i in np.arange(0,24)])
|
||||
|
||||
wire_radius = 0.254 #mm
|
||||
anode_wires = []
|
||||
cathode_wires = []
|
||||
aw_tags = [(3,i) for i in range(24)]
|
||||
cw_tags = [(3,i+24) for i in range(24)]
|
||||
|
||||
for i,[xa,ya,xc,yc,xa2,ya2,xc2,yc2] in enumerate(zip(xarra_1,yarra_1,xarrc_1,yarrc_1,xarra_2,yarra_2,xarrc_2,yarrc_2)):
|
||||
print(i,xa,ya,-178.3,xc,yc,-178.3,xa2,ya2,178.3,xc2,yc2,178.3)
|
||||
pa1 = gmsh.model.occ.addPoint(xa,ya,-178.3,lc)
|
||||
pa2 = gmsh.model.occ.addPoint(xa2,ya2,178.3,lc)
|
||||
pc1 = gmsh.model.occ.addPoint(xc,yc,-178.3,lc)
|
||||
pc2 = gmsh.model.occ.addPoint(xc2,yc2,178.3,lc)
|
||||
linea = gmsh.model.occ.addLine(pa1,pa2)
|
||||
linec = gmsh.model.occ.addLine(pc1,pc2)
|
||||
anode_wires.append(linea)
|
||||
cathode_wires.append(linec)
|
||||
|
||||
#anasen_barrel = gmsh.model.occ.addCylinder(0,0,-500,0,0,500+605,300,1234) #tag 1234
|
||||
anasen_barrel = gmsh.model.occ.addCylinder(0,0,-200, 0,0,400, 300) #tag 1234
|
||||
|
||||
gmsh.model.occ.synchronize()
|
||||
gmsh.model.mesh.embed(1,anode_wires+cathode_wires,3,anasen_barrel)
|
||||
|
||||
f1 = gmsh.model.mesh.field.add("Distance")
|
||||
gmsh.model.mesh.field.setNumbers(f1,"CurvesList",anode_wires+cathode_wires)
|
||||
|
||||
f2 = gmsh.model.mesh.field.add("Threshold")
|
||||
gmsh.model.mesh.field.setNumber(f2,"InField",f1)
|
||||
gmsh.model.mesh.field.setNumber(f2,"SizeMin",0.08)
|
||||
gmsh.model.mesh.field.setNumber(f2,"SizeMax",5)
|
||||
gmsh.model.mesh.field.setNumber(f2,"DistMin",1)
|
||||
gmsh.model.mesh.field.setNumber(f2,"DistMax",20)
|
||||
|
||||
gmsh.model.mesh.field.setAsBackgroundMesh(f2)
|
||||
|
||||
gmsh.model.addPhysicalGroup(1, anode_wires, tag=10)
|
||||
gmsh.model.setPhysicalName(1,10,"anode_wires")
|
||||
|
||||
gmsh.model.addPhysicalGroup(1, cathode_wires, tag=20)
|
||||
gmsh.model.setPhysicalName(1,20,"cathode_wires")
|
||||
|
||||
gmsh.option.setNumber("Mesh.Algorithm",6)
|
||||
gmsh.option.setNumber("Mesh.Algorithm3D", 10) # For 3D meshes
|
||||
|
||||
gmsh.model.mesh.generate(dim=3)
|
||||
gmsh.model.mesh.refine()
|
||||
#gmsh.model.mesh.refine()
|
||||
#gmsh.model.mesh.refine()
|
||||
gmsh.fltk.run()
|
||||
gmsh.finalize()
|
||||
|
|
@ -1,118 +0,0 @@
|
|||
#!/home/vsitaraman/ParaView-6.1.0-MPI-Linux-Python3.12-x86_64/bin/pvbatch
|
||||
########### !/home/vsitaraman/ParaView-6.1.0-RC1-MPI-Linux-Python3.12-x86_64/bin/pvbatch
|
||||
import numpy as np
|
||||
import sys
|
||||
from paraview.simple import *
|
||||
|
||||
reader = XMLUnstructuredGridReader(FileName=["wires2d/elfield_anasen_t0001.vtu"])
|
||||
|
||||
contour_filter = Contour(Input=reader,ContourBy = 'potential')
|
||||
contour_filter.Isosurfaces = [i for i in np.arange(0,660,660/40.)]
|
||||
|
||||
renderView = GetActiveViewOrCreate('RenderView')
|
||||
renderView.ViewSize = [2000,2000]
|
||||
renderView.OrientationAxesVisibility = 0 # Hide axis
|
||||
renderView.UseColorPaletteForBackground=0
|
||||
renderView.Background = [0.1, 0.1, 0.1] # Set background to dark gray (RGB 0-1)
|
||||
|
||||
renderView.MultiSamples = 8 # 0 disables it, 4-8 is usually sufficient
|
||||
|
||||
ResetCamera()
|
||||
|
||||
contour_display = Show(contour_filter, renderView)
|
||||
contour_display.LineWidth = 3.0 # Increase this for thicker lines
|
||||
contour_display.RenderLinesAsTubes = 1 # Makes lines look smoother at high res
|
||||
#colorbar
|
||||
contour_display_potentialLUT = GetColorTransferFunction('potential', contour_display, separate=True)
|
||||
contour_display_potentialLUT.ApplyPreset('Cool to Warm', True)
|
||||
contour_display.SetScalarBarVisibility(renderView, True)
|
||||
|
||||
#axesGrid = renderView.AxesGridrfcxgdtv
|
||||
#axesGrid.Visibility = 1
|
||||
#axesGrid.XTitle = "x (mm)"
|
||||
#axesGrid.YTitle = "y (mm)"
|
||||
|
||||
# 1. Get the active view
|
||||
view = GetActiveView()
|
||||
|
||||
# 2. Define your desired coordinate ranges (x_min, x_max, y_min, y_max, z_min, z_max)
|
||||
x_min, x_max = -0.05, 0.05
|
||||
y_min, y_max = -0.05, 0.05
|
||||
z_min, z_max = -0.05, 0.05
|
||||
|
||||
# 3. Calculate Center, Position, and Parallel Scale
|
||||
center = [(x_min + x_max) / 2.0, (y_min + y_max) / 2.0, (z_min + z_max) / 2.0]
|
||||
# Position the camera far away along Z to look at the center
|
||||
position = [center[0], center[1], 1.0]
|
||||
# Parallel scale defines how much of the scene is visible.
|
||||
# It is usually half the height of the viewed area.
|
||||
view.CameraParallelScale = max((x_max - x_min), (y_max - y_min))/1.6
|
||||
|
||||
# 4. Apply settings
|
||||
view.CenterOfRotation = center
|
||||
view.CameraPosition = position
|
||||
view.CameraFocalPoint = center
|
||||
view.CameraViewUp = [0.0, 1.0, 0.0] # Y-axis is up
|
||||
|
||||
# 5. Enable Parallel Projection (optional, often better for exact mapping)
|
||||
view.CameraParallelProjection = 1
|
||||
|
||||
#ResetCamera()
|
||||
Render()
|
||||
|
||||
SaveScreenshot("contour_output.png")
|
||||
|
||||
#make glyps for field lines
|
||||
contour_display.LineWidth = 1.0 # Increase this for thicker lines
|
||||
contour_display.RenderLinesAsTubes = 0 # Makes lines look smoother at high res
|
||||
|
||||
# 1. Get the active view
|
||||
view = GetActiveView()
|
||||
|
||||
# 1. Set the Focal Point to the middle of the quadrant in metres
|
||||
zoom_center = [-0.025, 0.025, 0.0]
|
||||
|
||||
# 2. Tighten the Parallel Scale
|
||||
view.CameraParallelScale = 0.015
|
||||
|
||||
# 3. Position the Camera (0.5m away is fine)
|
||||
view.CameraPosition = [zoom_center[0], zoom_center[1], 0.5]
|
||||
view.CameraFocalPoint = zoom_center
|
||||
view.CameraViewUp = [0.0, 1.0, 0.0]
|
||||
# pot_threshold = Threshold(Input=reader)
|
||||
# pot_threshold.Scalars = ['POINTS', 'potential']
|
||||
# pot_threshold.ThresholdMethod = 'Above Upper Threshold'
|
||||
# pot_threshold.UpperThreshold = 100.0
|
||||
|
||||
# --- 2. Create the Glyph Filter (The Arrows) ---
|
||||
# IMPORTANT: Use 'pot_threshold' as the Input, not the 'reader'
|
||||
glyph = Glyph(Input=contour_filter, GlyphType='Arrow') #
|
||||
# glyph = Glyph(Input=reader, GlyphType='Arrow') #this uses all field line snot just the ones from the equipotential lines shown
|
||||
|
||||
# Orientation Array: Use the 'electric field' vector from Elmer
|
||||
glyph.OrientationArray = ['POINTS', 'electric field']
|
||||
glyph.ScaleArray = ['POINTS', 'No scale array']
|
||||
glyph.ScaleFactor = 0.001
|
||||
|
||||
glyph.GlyphMode = 'Every Nth Point'
|
||||
glyph.Stride = 32
|
||||
|
||||
# --- 3. Display the Glyphs ---
|
||||
glyph_display = Show(glyph, renderView)
|
||||
|
||||
# Set the representation to Surface so we see the full arrow colors
|
||||
glyph_display.Representation = 'Surface'
|
||||
|
||||
|
||||
# This is the critical line: Color the arrows by the 'potential' scalar
|
||||
ColorBy(glyph_display, ('POINTS', 'potential'))
|
||||
glyph_display.LookupTable = contour_display_potentialLUT
|
||||
contour_display_potentialLUT.RescaleTransferFunction(0.0, 660.0)
|
||||
|
||||
# Optional: Disable the scalar bar for the arrows to avoid cluttering
|
||||
# the existing 'potential' scalar bar.
|
||||
glyph_display.SetScalarBarVisibility(renderView, False)
|
||||
|
||||
# --- 4. Final Render ---
|
||||
Render()
|
||||
SaveScreenshot("Field_output.png")
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
import code
|
||||
import os
|
||||
|
||||
# val=-174.3
|
||||
val=0
|
||||
count=10
|
||||
while val<174.3+0.1:
|
||||
print(val)
|
||||
os.system("python3 wires_gmsh2d_bc.py "+str(val))
|
||||
os.system("ElmerGrid 14 2 wires2d.msh -2d")
|
||||
os.system("ElmerSolver wires2d.sif")
|
||||
os.system("./paraview_plotter.py")
|
||||
# os.system("python3 garfield_sim.py")
|
||||
os.system("cp wires2d.msh wires2d/mesh_files/wires2d%02d_%1.4f.msh"%(count,val))
|
||||
os.system("cp wires2d.sif wires2d/sif_files/wires2d_%02d_%1.4f.sif"%(count,val))
|
||||
os.system("cp wires2d/elfield_anasen_t0001.vtu wires2d/vtu_files/elfield_anasen_%02d_%1.4f.vtu"%(count,val))
|
||||
os.system("cp contour_output.png png/Contour_output_z_%02d_%1.4f.png"%(count,val))
|
||||
os.system("cp Field_output.png png/Field_ouput_z_%02d_%1.4f.png"%(count,val))
|
||||
val=val+17.43
|
||||
count = count + 1
|
||||
# break
|
||||
|
||||
# os.system("tar -cvzf wiress2d/mesh.tar.gz wires2d/mesh_files")
|
||||
# os.system("rm -rf wires2d/mesh_files/*")
|
||||
# os.system("tar -cvzf wires2d/sif.tar.gz wires2d/sif_files")
|
||||
# os.system("rm -rf wires2d/sif_files/*")
|
||||
# os.system("tar -cvzf wires2d/vtu.tar.gz wires2d/vtu_files")
|
||||
# os.system("rm -rf wires2d/vtu_files/*")
|
||||
|
|
@ -1 +0,0 @@
|
|||
8.500000000000E+002
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
Metadata for SaveScalars file: ./scalars.dat
|
||||
Elmer version: 26.2
|
||||
Elmer compilation date: 2026-05-14
|
||||
Solver input file: wires2d.sif
|
||||
File started at: 2026/05/19 22:16:54
|
||||
|
||||
Variables in columns of matrix:
|
||||
1: res: potential difference
|
||||
|
|
@ -1,120 +0,0 @@
|
|||
Check Keywords Warn
|
||||
|
||||
Header
|
||||
Mesh DB "." "wires2d"
|
||||
End
|
||||
|
||||
Simulation
|
||||
Coordinate System = Cartesian 2D
|
||||
Simulation Type = Steady State
|
||||
Steady State Max Iterations = 1
|
||||
Output File = "elstatics.result"
|
||||
Post File = "elstatics.ep"
|
||||
Coordinate Scaling = 0.001 ! Converts mm from Gmsh to meters for Elmer
|
||||
End
|
||||
|
||||
Constants
|
||||
Permittivity Of Vacuum = 8.8542e-12
|
||||
End
|
||||
|
||||
|
||||
Body 1
|
||||
Target Bodies(1) = 13
|
||||
Equation = 1
|
||||
Material = 1
|
||||
End
|
||||
|
||||
|
||||
Equation 1
|
||||
Active Solvers(2) = 1 2
|
||||
End
|
||||
|
||||
|
||||
Material 1
|
||||
Relative Permittivity = 1
|
||||
End
|
||||
|
||||
|
||||
Solver 1
|
||||
Equation = Electrostatics
|
||||
Procedure = "StatElecSolve" "StatElecSolver"
|
||||
|
||||
Variable = Potential
|
||||
Variable DOFs = 1
|
||||
|
||||
Calculate Electric Field = True
|
||||
Calculate Electric Flux = False
|
||||
|
||||
Linear System Solver = Iterative
|
||||
Linear System Iterative Method = CG
|
||||
Linear System Max Iterations = 5000
|
||||
Linear System Convergence Tolerance = 1.0e-8
|
||||
Linear System Preconditioning = ILU1
|
||||
Calculate Vectors = Logical True
|
||||
End
|
||||
|
||||
Solver 2
|
||||
Equation = "Electric Field"
|
||||
Procedure = "FluxSolver" "FluxSolver"
|
||||
|
||||
! Calculate from the potential
|
||||
Target Variable = "Potential"
|
||||
! Name of the output vector field in VTU
|
||||
Flux Variable = String "Electric Field"
|
||||
|
||||
! Use 2D components (x, y)
|
||||
Flux Coefficient = String "Permittivity"
|
||||
|
||||
Calculate Vectors = Logical True
|
||||
End
|
||||
|
||||
Solver 3
|
||||
Equation = Result Output
|
||||
Procedure = "ResultOutputSolve" "ResultOutputSolver"
|
||||
Output File Name = elfield_anasen ! Sets prefix for output files
|
||||
Output Format = Vtu
|
||||
! Optional: Select specific variables to save
|
||||
Scalar Field 1 = Potential
|
||||
Vector Field 1 = Electric Field
|
||||
End
|
||||
|
||||
Solver 4
|
||||
Exec Solver = After All
|
||||
Equation = SaveScalars
|
||||
Procedure = "SaveData" "SaveScalars"
|
||||
Filename = "scalars.dat"
|
||||
End
|
||||
|
||||
Boundary Condition 1
|
||||
Target Boundaries = 1
|
||||
Potential = -200
|
||||
Calculate Electric Force = True
|
||||
End
|
||||
|
||||
Boundary Condition 2
|
||||
Target Boundaries = 2
|
||||
Potential = 150
|
||||
Calculate Electric Force = True
|
||||
End
|
||||
|
||||
Boundary Condition 3
|
||||
Target Boundaries = 3
|
||||
Potential = 250
|
||||
Calculate Electric Force = True
|
||||
End
|
||||
|
||||
Boundary Condition 4
|
||||
Target Boundaries = 10
|
||||
Potential = 0
|
||||
End
|
||||
|
||||
Boundary Condition 5
|
||||
Target Boundaries = 20
|
||||
Potential = 650
|
||||
Calculate Electric Force = True
|
||||
End
|
||||
|
||||
Boundary Condition 6
|
||||
Target Boundaries = 30
|
||||
Potential = 0
|
||||
End
|
||||
|
|
@ -1,247 +0,0 @@
|
|||
import numpy as np
|
||||
import gmsh, sys
|
||||
|
||||
# --- Configuration Flags ---
|
||||
include_ic_wires = True
|
||||
include_needle = True
|
||||
|
||||
gmsh.initialize()
|
||||
gmsh.model.add("adaptive_mesh")
|
||||
gmsh.option.setNumber("General.NumThreads", 10)
|
||||
# gmsh.option.setNumber("Mesh.Adapt.MaxNumberOfElements", 200000)
|
||||
# gmsh.option.setNumber("Mesh.Adapt.MaxNumberOfNodes", 200000)
|
||||
# gmsh.option.setNumber("Mesh.Adapt.MaxIter",5)
|
||||
# gmsh.option.setNumber("Mesh.MeshSizeMin", 5e-3)
|
||||
# gmsh.option.setNumber("Mesh.MeshSizeMax", 10.0)
|
||||
gmsh.option.setNumber("Geometry.Tolerance", 4e-2)
|
||||
# gmsh.option.setNumber("Mesh.MeshSizeExtendFromBoundary", 0)
|
||||
|
||||
lc = 0.04
|
||||
# z_loc = -174.3
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage: python3 wires_gmsh2d_bc.py <z_locus in mm>")
|
||||
quit()
|
||||
|
||||
z_loc = float(sys.argv[1])
|
||||
|
||||
wireShift = 4.0
|
||||
k = 2 * np.pi / 24.0
|
||||
kg = k/2.0
|
||||
|
||||
# Plane 1 Offsets (-zmax/2)
|
||||
# Anodes: -6*k (base) - 4*k (correction) = -10*k
|
||||
offset_a1 = -6 * k - 4 * k
|
||||
# Cathodes: -6*k (base) + 0.5*k (half-placement)
|
||||
offset_c1 = -6 * k + (k / 2.0)
|
||||
# Guard wires: aligned with cathodes
|
||||
offset_g1 = offset_c1
|
||||
|
||||
# Plane 2 Offsets (+zmax/2) with Twist
|
||||
offset_a2 = offset_a1 + (wireShift * k)
|
||||
offset_c2 = offset_c1 - (wireShift * k)
|
||||
offset_g2 = offset_c2
|
||||
|
||||
# 1 needle, 24 ic1, 24 ic2, 48 guard wires, 24 anodes, 24 cathodes
|
||||
|
||||
# needle at plane 1 at -zmax/2 no rotation
|
||||
xarr_needle = np.array([0])
|
||||
yarr_needle = np.array([0])
|
||||
|
||||
# ic1 wires, plane 1 at -zmax/2 no rotation
|
||||
xarr_i11 = np.array([23 * np.cos(k * i) for i in range(24)])
|
||||
yarr_i11 = np.array([23 * np.sin(k * i) for i in range(24)])
|
||||
|
||||
# ic1 wires, plane 1 at -zmax/2 no rotation
|
||||
xarr_i21 = np.array([23 * np.cos(k * i + k / 2.0) for i in range(24)])
|
||||
yarr_i21 = np.array([23 * np.sin(k * i + k / 2.0) for i in range(24)])
|
||||
|
||||
# --- Coordinate Arrays (Plane 1) ---
|
||||
# Anodes: -k*i (Left-handed twist direction)
|
||||
xarra_1 = np.array([37 * np.cos(-k * i + offset_a1) for i in range(24)])
|
||||
yarra_1 = np.array([37 * np.sin(-k * i + offset_a1) for i in range(24)])
|
||||
|
||||
# Cathodes: +k*i (Right-handed twist direction)
|
||||
xarrc_1 = np.array([42 * np.cos(k * i + offset_c1) for i in range(24)])
|
||||
yarrc_1 = np.array([42 * np.sin(k * i + offset_c1) for i in range(24)])
|
||||
|
||||
# Guard Wires (48 wires, use kg spacing)
|
||||
xarrg_1 = np.array([32 * np.cos(kg * i + offset_g1) for i in range(48)])
|
||||
yarrg_1 = np.array([32 * np.sin(kg * i + offset_g1) for i in range(48)])
|
||||
|
||||
# needle at plane 2 at zmax/2
|
||||
xarr_needle_2 = np.array([0])
|
||||
yarr_needle_2 = np.array([0])
|
||||
|
||||
# #ic1 wires, plane 2 at zmax/2
|
||||
xarr_i12 = np.array([23 * np.cos(k * i) for i in range(24)])
|
||||
yarr_i12 = np.array([23 * np.sin(k * i) for i in range(24)])
|
||||
|
||||
# #ic2 wires, plane 2 at zmax/2
|
||||
xarr_i22 = np.array([23 * np.cos(k * i + k / 2.0) for i in range(24)])
|
||||
yarr_i22 = np.array([23 * np.sin(k * i + k / 2.0) for i in range(24)])
|
||||
|
||||
# --- Coordinate Arrays (Plane 2) ---
|
||||
xarra_2 = np.array([37 * np.cos(-k * i + offset_a2) for i in range(24)])
|
||||
yarra_2 = np.array([37 * np.sin(-k * i + offset_a2) for i in range(24)])
|
||||
|
||||
xarrc_2 = np.array([42 * np.cos(k * i + offset_c2) for i in range(24)])
|
||||
yarrc_2 = np.array([42 * np.sin(k * i + offset_c2) for i in range(24)])
|
||||
|
||||
xarrg_2 = np.array([32 * np.cos(kg * i + offset_g2) for i in range(48)])
|
||||
yarrg_2 = np.array([32 * np.sin(kg * i + offset_g2) for i in range(48)])
|
||||
|
||||
direction_needle_x = xarr_needle_2 - xarr_needle
|
||||
direction_needle_y = yarr_needle_2 - yarr_needle
|
||||
|
||||
direction_ic1_x = xarr_i12 - xarr_i11
|
||||
direction_ic1_y = yarr_i12 - yarr_i11
|
||||
|
||||
direction_ic2_x = xarr_i22 - xarr_i21
|
||||
direction_ic2_y = yarr_i22 - yarr_i21
|
||||
|
||||
direction_guard_x = xarrg_2 - xarrg_1
|
||||
direction_guard_y = yarrg_2 - yarrg_1
|
||||
|
||||
direction_anodes_x = xarra_2 - xarra_1
|
||||
direction_anodes_y = yarra_2 - yarra_1
|
||||
|
||||
direction_cathodes_x = xarrc_2 - xarrc_1
|
||||
direction_cathodes_y = yarrc_2 - yarrc_1
|
||||
|
||||
t = (z_loc + 174.3) / (2 * 174.3) # z=-174.3 is 0, z=+174.3 is 1
|
||||
|
||||
xloc_needle = xarr_needle + t * direction_needle_x
|
||||
yloc_needle = yarr_needle + t * direction_needle_y
|
||||
xloc_i1 = xarr_i11 + t * direction_ic1_x
|
||||
yloc_i1 = yarr_i11 + t * direction_ic1_y
|
||||
xloc_i2 = xarr_i21 + t * direction_ic2_x
|
||||
yloc_i2 = yarr_i21 + t * direction_ic2_y
|
||||
xloc_g = xarrg_1 + t * direction_guard_x
|
||||
yloc_g = yarrg_1 + t * direction_guard_y
|
||||
xloc_a = xarra_1 + t * direction_anodes_x
|
||||
yloc_a = yarra_1 + t * direction_anodes_y
|
||||
xloc_c = xarrc_1 + t * direction_cathodes_x
|
||||
yloc_c = yarrc_1 + t * direction_cathodes_y
|
||||
|
||||
# wire_radius_a = 0.018 #mm
|
||||
# wire_radius_c = 0.0762 #mm
|
||||
# wire_radius_g = 0.0762 #mm
|
||||
wire_radius = 0.254 # mm
|
||||
needle = []
|
||||
ic1_wires = []
|
||||
ic2_wires = []
|
||||
guard_wires = []
|
||||
anode_wires = []
|
||||
cathode_wires = []
|
||||
iw1_tags = [(3, i) for i in range(24)]
|
||||
iw2_tags = [(3, i + 24) for i in range(24)]
|
||||
gw_tags = [(3, i + 48) for i in range(48)]
|
||||
aw_tags = [(3, i) for i in range(24)]
|
||||
cw_tags = [(3, i + 24) for i in range(24)]
|
||||
|
||||
# for i,[xa,ya,xc,yc] in enumerate(zip(xarra_1,yarra_1,xarrc_1,yarrc_1)):
|
||||
# create Hot Needle (1 total)
|
||||
for i, (xn, yn) in enumerate(zip(xloc_needle, yloc_needle)):
|
||||
if include_needle:
|
||||
ndisk = gmsh.model.occ.addDisk(xn, yn, 0, wire_radius, wire_radius)
|
||||
needle.append(ndisk)
|
||||
|
||||
# create Guard Wires (48 total)
|
||||
for xg, yg in zip(xloc_g, yloc_g):
|
||||
gdisk = gmsh.model.occ.addDisk(xg, yg, 0, wire_radius, wire_radius)
|
||||
guard_wires.append(gdisk)
|
||||
|
||||
# create Cathode Wires (24 total)
|
||||
for xc, yc in zip(xloc_c, yloc_c):
|
||||
cdisk = gmsh.model.occ.addDisk(xc, yc, 0, wire_radius, wire_radius)
|
||||
cathode_wires.append(cdisk)
|
||||
|
||||
# create IC Anode and Cathode Wires (24 total each)
|
||||
for i, (xa, ya) in enumerate(zip(xloc_a, yloc_a)):
|
||||
adisk = gmsh.model.occ.addDisk(xa, ya, 0, wire_radius, wire_radius)
|
||||
anode_wires.append(adisk)
|
||||
|
||||
# Place IC wires only if flag is True
|
||||
if include_ic_wires:
|
||||
i1disk = gmsh.model.occ.addDisk(
|
||||
xloc_i1[i], yloc_i1[i], 0, wire_radius, wire_radius
|
||||
)
|
||||
i2disk = gmsh.model.occ.addDisk(
|
||||
xloc_i2[i], yloc_i2[i], 0, wire_radius, wire_radius
|
||||
)
|
||||
ic1_wires.append(i1disk)
|
||||
ic2_wires.append(i2disk)
|
||||
|
||||
anasen_barrel = gmsh.model.occ.addDisk(0, 0, 0, 500, 500)
|
||||
# gmsh.model.occ.synchronize()
|
||||
# gmsh.model.mesh.embed(1,anode_wires+cathode_wires,2,anasen_barrel)
|
||||
|
||||
gmsh.option.setNumber("Geometry.Tolerance", 1e-6)
|
||||
gmsh.option.setNumber("Geometry.OCCFixDegenerated", 1)
|
||||
gmsh.model.occ.synchronize()
|
||||
|
||||
|
||||
# --- Surface Extraction ---
|
||||
def get_surfs(disks):
|
||||
surfs = []
|
||||
for d in disks:
|
||||
surfs += [
|
||||
s[1] for s in gmsh.model.getBoundary([(2, d)], oriented=False) if s[0] == 1
|
||||
]
|
||||
return surfs
|
||||
|
||||
|
||||
needle_surfs = get_surfs(needle) if include_needle else []
|
||||
gwire_surfs = get_surfs(guard_wires)
|
||||
awire_surfs = get_surfs(anode_wires)
|
||||
cwire_surfs = get_surfs(cathode_wires)
|
||||
i1wire_surfs = get_surfs(ic1_wires) if include_ic_wires else []
|
||||
i2wire_surfs = get_surfs(ic2_wires) if include_ic_wires else []
|
||||
|
||||
|
||||
all_active_wire_surfs = (
|
||||
needle_surfs + gwire_surfs + awire_surfs + cwire_surfs + i1wire_surfs + i2wire_surfs
|
||||
)
|
||||
gmsh.model.mesh.embed(1, all_active_wire_surfs, 2, anasen_barrel)
|
||||
|
||||
f1 = gmsh.model.mesh.field.add("Distance")
|
||||
gmsh.model.mesh.field.setNumbers(f1, "CurvesList", all_active_wire_surfs)
|
||||
|
||||
f2 = gmsh.model.mesh.field.add("Threshold")
|
||||
gmsh.model.mesh.field.setNumber(f2, "InField", f1)
|
||||
gmsh.model.mesh.field.setNumber(f2, "SizeMin", 0.05) # Fine mesh near wires
|
||||
gmsh.model.mesh.field.setNumber(f2, "SizeMax", 5.0) # Large mesh in empty space
|
||||
gmsh.model.mesh.field.setNumber(f2, "DistMin", 0.5) # Apply SizeMin within 1mm
|
||||
gmsh.model.mesh.field.setNumber(f2, "DistMax", 15.0) # Transition to SizeMax by 20mm
|
||||
|
||||
gmsh.model.mesh.field.setAsBackgroundMesh(f2)
|
||||
|
||||
|
||||
# --- Physical Groups ---
|
||||
# Needle
|
||||
if include_needle:
|
||||
gmsh.model.addPhysicalGroup(1, needle_surfs, tag=1, name="hot_needle")
|
||||
|
||||
# IC Wires
|
||||
if include_ic_wires:
|
||||
gmsh.model.addPhysicalGroup(1, i1wire_surfs, tag=2, name="ic_wire_1")
|
||||
gmsh.model.addPhysicalGroup(1, i2wire_surfs, tag=3, name="ic_wire_2")
|
||||
|
||||
# Proportional Counter Wires
|
||||
gmsh.model.addPhysicalGroup(1, gwire_surfs, tag=10, name="guard_wires")
|
||||
gmsh.model.addPhysicalGroup(1, awire_surfs, tag=20, name="anode_wires")
|
||||
gmsh.model.addPhysicalGroup(1, cwire_surfs, tag=30, name="cathode_wires")
|
||||
|
||||
# Gas Volume (2D)
|
||||
gmsh.model.addPhysicalGroup(2, [anasen_barrel], tag=13, name="gas")
|
||||
|
||||
gmsh.option.setNumber("Mesh.Algorithm", 6)
|
||||
|
||||
gmsh.model.mesh.generate(dim=2)
|
||||
# gmsh.model.mesh.refine()
|
||||
# gmsh.model.mesh.refine()
|
||||
gmsh.model.mesh.setOrder(2)
|
||||
gmsh.write("wires2d.msh")
|
||||
# gmsh.fltk.run()
|
||||
gmsh.finalize()
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
X,Y,Z,Label
|
||||
-28.779245994292484,28.779245994292488,189.3,A0
|
||||
-6.173888892008441,46.89534194298123,204.3,C0
|
||||
-35.24723393402666,20.349999999999998,189.3,A1
|
||||
6.1738888920084465,46.89534194298123,204.3,C1
|
||||
-39.31318112996508,10.533935135672605,189.3,A2
|
||||
18.10092635086875,43.69950188778387,204.3,C2
|
||||
-40.7,4.984312472529728e-15,189.3,A3
|
||||
28.794415592112486,37.525612995775425,204.3,C3
|
||||
-39.31318112996508,-10.533935135672598,189.3,A4
|
||||
37.525612995775425,28.794415592112486,204.3,C4
|
||||
-35.24723393402665,-20.350000000000005,189.3,A5
|
||||
43.69950188778387,18.10092635086875,204.3,C5
|
||||
-28.77924599429249,-28.779245994292484,189.3,A6
|
||||
46.89534194298123,6.17388889200844,204.3,C6
|
||||
-20.350000000000023,-35.247233934026646,189.3,A7
|
||||
46.89534194298123,-6.17388889200844,204.3,C7
|
||||
-10.53393513567259,-39.31318112996508,189.3,A8
|
||||
43.69950188778387,-18.10092635086875,204.3,C8
|
||||
-7.476468708794592e-15,-40.7,189.3,A9
|
||||
37.525612995775425,-28.794415592112486,204.3,C9
|
||||
10.533935135672577,-39.31318112996509,189.3,A10
|
||||
28.794415592112486,-37.525612995775425,204.3,C10
|
||||
20.350000000000005,-35.24723393402665,189.3,A11
|
||||
18.10092635086875,-43.69950188778387,204.3,C11
|
||||
28.77924599429248,-28.77924599429249,189.3,A12
|
||||
6.1738888920084465,-46.89534194298123,204.3,C12
|
||||
35.247233934026646,-20.350000000000023,189.3,A13
|
||||
-6.173888892008441,-46.89534194298123,204.3,C13
|
||||
39.31318112996508,-10.533935135672593,189.3,A14
|
||||
-18.100926350868747,-43.69950188778387,204.3,C14
|
||||
40.7,-9.968624945059456e-15,189.3,A15
|
||||
-28.794415592112486,-37.525612995775425,204.3,C15
|
||||
39.31318112996509,10.533935135672575,189.3,A16
|
||||
-37.52561299577542,-28.7944155921125,204.3,C16
|
||||
35.24723393402665,20.35,189.3,A17
|
||||
-43.69950188778387,-18.100926350868754,204.3,C17
|
||||
28.77924599429249,28.77924599429248,189.3,A18
|
||||
-46.89534194298123,-6.17388889200844,204.3,C18
|
||||
20.34999999999999,35.24723393402666,189.3,A19
|
||||
-46.89534194298124,6.173888892008428,204.3,C19
|
||||
10.533935135672595,39.31318112996508,189.3,A20
|
||||
-43.699501887783875,18.100926350868743,204.3,C20
|
||||
1.246078118132432e-14,40.7,189.3,A21
|
||||
-37.525612995775425,28.794415592112486,204.3,C21
|
||||
-10.533935135672573,39.31318112996509,189.3,A22
|
||||
-28.7944155921125,37.52561299577542,204.3,C22
|
||||
-20.34999999999997,35.247233934026674,189.3,A23
|
||||
-18.100926350868736,43.699501887783875,204.3,C23
|
||||
8.677040182954032,-100.82732255526474,0,D0_S0
|
||||
20.363633298595417,-99.13002793745362,0,D0_S1
|
||||
31.929590218792463,-96.03093912099365,0,D0_S2
|
||||
42.89912404953582,-91.657542819904,0,D0_S3
|
||||
57.928198505728936,-82.98050263694998,0,D1_S0
|
||||
67.20043771866115,-75.66730582239823,0,D1_S1
|
||||
75.66730582239825,-67.20043771866115,0,D1_S2
|
||||
82.98050263694998,-57.928198505728936,0,D1_S3
|
||||
91.657542819904,-42.89912404953581,0,D2_S0
|
||||
96.03093912099365,-31.929590218792463,0,D2_S1
|
||||
99.13002793745362,-20.363633298595417,0,D2_S2
|
||||
100.82732255526474,-8.677040182954027,0,D2_S3
|
||||
100.82732255526474,8.677040182954027,0,D3_S0
|
||||
99.13002793745362,20.363633298595417,0,D3_S1
|
||||
96.03093912099365,31.929590218792466,0,D3_S2
|
||||
91.657542819904,42.89912404953581,0,D3_S3
|
||||
82.98050263694998,57.928198505728936,0,D4_S0
|
||||
75.66730582239825,67.20043771866115,0,D4_S1
|
||||
67.20043771866115,75.66730582239823,0,D4_S2
|
||||
57.928198505728936,82.98050263694998,0,D4_S3
|
||||
42.89912404953582,91.657542819904,0,D5_S0
|
||||
31.929590218792463,96.03093912099365,0,D5_S1
|
||||
20.363633298595417,99.13002793745362,0,D5_S2
|
||||
8.677040182954055,100.82732255526474,0,D5_S3
|
||||
-8.677040182954043,100.82732255526474,0,D6_S0
|
||||
-20.36363329859545,99.1300279374536,0,D6_S1
|
||||
-31.929590218792452,96.03093912099366,0,D6_S2
|
||||
-42.89912404953579,91.65754281990401,0,D6_S3
|
||||
-57.92819850572895,82.98050263694996,0,D7_S0
|
||||
-67.20043771866116,75.6673058223982,0,D7_S1
|
||||
-75.66730582239823,67.20043771866116,0,D7_S2
|
||||
-82.98050263694995,57.92819850572897,0,D7_S3
|
||||
-91.657542819904,42.89912404953581,0,D8_S0
|
||||
-96.03093912099366,31.929590218792452,0,D8_S1
|
||||
-99.1300279374536,20.363633298595445,0,D8_S2
|
||||
-100.82732255526474,8.67704018295404,0,D8_S3
|
||||
-100.82732255526474,-8.677040182954059,0,D9_S0
|
||||
-99.13002793745362,-20.36363329859542,0,D9_S1
|
||||
-96.03093912099366,-31.929590218792423,0,D9_S2
|
||||
-91.65754281990401,-42.899124049535786,0,D9_S3
|
||||
-82.98050263694996,-57.92819850572895,0,D10_S0
|
||||
-75.66730582239822,-67.20043771866116,0,D10_S1
|
||||
-67.20043771866116,-75.66730582239823,0,D10_S2
|
||||
-57.928198505728936,-82.98050263694998,0,D10_S3
|
||||
-42.899124049535814,-91.657542819904,0,D11_S0
|
||||
-31.929590218792413,-96.03093912099368,0,D11_S1
|
||||
-20.363633298595452,-99.1300279374536,0,D11_S2
|
||||
-8.67704018295409,-100.82732255526474,0,D11_S3
|
||||
|
|
|
@ -1,89 +0,0 @@
|
|||
HistogramIndex PeakNumber Centroid Amplitude Sigma
|
||||
1 1 922.213
|
||||
1 2 1885.55
|
||||
1 3 2845.53
|
||||
1 4 3810.32
|
||||
2 1 955.591
|
||||
2 2 1953.17
|
||||
2 3 2949.37
|
||||
2 4 3950.79
|
||||
3 1 995.787
|
||||
3 2 2036.58
|
||||
3 3 3076.91
|
||||
3 4 4112.05
|
||||
4 1 1017.48
|
||||
4 2 2080.19
|
||||
4 3 3142.24
|
||||
4 4 4206.1
|
||||
5 1 1022.78
|
||||
5 2 2091.21
|
||||
5 3 3158.28
|
||||
5 4 4226.97
|
||||
6 1 1076.22
|
||||
6 2 2203.37
|
||||
6 3 3329.53
|
||||
6 4 4457.69
|
||||
7 1 977.46
|
||||
7 2 1998.02
|
||||
7 3 3017.36
|
||||
7 4 4040.47
|
||||
8 1 1049.74
|
||||
8 2 2144.38
|
||||
8 3 3238.2
|
||||
8 4 4335.25
|
||||
9 1 1000.59
|
||||
9 2 2046.42
|
||||
9 3 3090.29
|
||||
9 4 4129.63
|
||||
10 1 1014.92
|
||||
10 2 2076.16
|
||||
10 3 3134.59
|
||||
10 4 4213.42
|
||||
11 1 1004.85
|
||||
11 2 2052.88
|
||||
11 3 3100.3
|
||||
11 4 4164.75
|
||||
12 1 945.861
|
||||
12 2 1932.49
|
||||
12 3 2917.95
|
||||
12 4 3955.15
|
||||
13 1 998.307
|
||||
13 2 2040.38
|
||||
13 3 3078.76
|
||||
13 4 4135.51
|
||||
14 1 966.429
|
||||
14 2 1972.15
|
||||
14 3 2974.84
|
||||
14 4 4056.41
|
||||
15 1 958.352
|
||||
15 2 1958.64
|
||||
15 3 2957.7
|
||||
15 4 3970.41
|
||||
16 1 970.732
|
||||
16 2 1977.63
|
||||
16 3 2984.97
|
||||
16 4 4002.56
|
||||
17 1 1013.65
|
||||
17 2 2064.9
|
||||
17 3 3114.19
|
||||
17 4 4190.98
|
||||
18 1 975.538
|
||||
18 2 1990.64
|
||||
18 3 3005.46
|
||||
18 4 4048.99
|
||||
20 1 912.778
|
||||
20 2 1866.83
|
||||
20 3 2819.21
|
||||
20 4 3781.63
|
||||
21 1 1002.36
|
||||
21 2 1989.95
|
||||
21 3 2975.53
|
||||
21 4 3986.71
|
||||
22 1 1075.38
|
||||
22 2 2144.25
|
||||
22 3 3210.17
|
||||
22 4 4312.84
|
||||
23 1 988.828
|
||||
23 2 2016.35
|
||||
23 3 3044.19
|
||||
23 4 4082.41
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
=========================================================
|
||||
SX3 BARREL AZIMUTHAL ANGLES (Degrees)
|
||||
=========================================================
|
||||
Det ID | Strip 0 | Strip 1 | Strip 2 | Strip 3 | Det Center
|
||||
---------------------------------------------------------
|
||||
0 | 85.08 | 78.39 | 71.61 | 64.92 | 75.00
|
||||
1 | 55.08 | 48.39 | 41.61 | 34.92 | 45.00
|
||||
2 | 25.08 | 18.39 | 11.61 | 4.92 | 15.00
|
||||
3 | -4.92 | -11.61 | -18.39 | -25.08 | -15.00
|
||||
4 | -34.92 | -41.61 | -48.39 | -55.08 | -45.00
|
||||
5 | -64.92 | -71.61 | -78.39 | -85.08 | -75.00
|
||||
6 | -94.92 | -101.61 | -108.39 | -115.08 | -105.00
|
||||
7 | -124.92 | -131.61 | -138.39 | -145.08 | -135.00
|
||||
8 | -154.92 | -161.61 | -168.39 | -175.08 | -165.00
|
||||
9 | 175.08 | 168.39 | 161.61 | 154.92 | 165.00
|
||||
10 | 145.08 | 138.39 | 131.61 | 124.92 | 135.00
|
||||
11 | 115.08 | 108.39 | 101.61 | 94.92 | 105.00
|
||||
|
||||
|
||||
=========================================================
|
||||
PROPORTIONAL COUNTER WIRE ANGLES (Degrees)
|
||||
=========================================================
|
||||
Wire ID | Anode (-z) | Anode (+z) | Cathode (-z) | Cathode (+z)
|
||||
----------------------------------------------------------------
|
||||
0 | -135.00 | -90.00 | -97.50 | -142.50
|
||||
1 | -150.00 | -105.00 | -82.50 | -127.50
|
||||
2 | -165.00 | -120.00 | -67.50 | -112.50
|
||||
3 | -180.00 | -135.00 | -52.50 | -97.50
|
||||
4 | 165.00 | -150.00 | -37.50 | -82.50
|
||||
5 | 150.00 | -165.00 | -22.50 | -67.50
|
||||
6 | 135.00 | -180.00 | -7.50 | -52.50
|
||||
7 | 120.00 | 165.00 | 7.50 | -37.50
|
||||
8 | 105.00 | 150.00 | 22.50 | -22.50
|
||||
9 | 90.00 | 135.00 | 37.50 | -7.50
|
||||
10 | 75.00 | 120.00 | 52.50 | 7.50
|
||||
11 | 60.00 | 105.00 | 67.50 | 22.50
|
||||
12 | 45.00 | 90.00 | 82.50 | 37.50
|
||||
13 | 30.00 | 75.00 | 97.50 | 52.50
|
||||
14 | 15.00 | 60.00 | 112.50 | 67.50
|
||||
15 | 0.00 | 45.00 | 127.50 | 82.50
|
||||
16 | -15.00 | 30.00 | 142.50 | 97.50
|
||||
17 | -30.00 | 15.00 | 157.50 | 112.50
|
||||
18 | -45.00 | 0.00 | 172.50 | 127.50
|
||||
19 | -60.00 | -15.00 | -172.50 | 142.50
|
||||
20 | -75.00 | -30.00 | -157.50 | 157.50
|
||||
21 | -90.00 | -45.00 | -142.50 | 172.50
|
||||
22 | -105.00 | -60.00 | -127.50 | -172.50
|
||||
23 | -120.00 | -75.00 | -112.50 | -157.50
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
import pycatima as catima
|
||||
import numpy as np
|
||||
|
||||
# --- 1. Constants ---
|
||||
P_TORR = 250
|
||||
TEMP_K = 293.15
|
||||
R = 8.3144
|
||||
MEV2U = 1.0 / 931.494
|
||||
|
||||
# Gas Density Calculations
|
||||
p_pa = P_TORR * 133.322
|
||||
molar_density = p_pa / (R * TEMP_K)
|
||||
m_he, m_c, m_o= 4.0026, 12.0000, 15.9949
|
||||
m_mix_avg = (0.96 * m_he) + (0.04 * (m_c + 2*m_o))
|
||||
rho_g_cm3 = (molar_density * m_mix_avg) / 1e6
|
||||
print(f"Gas density at {P_TORR} Torr: {rho_g_cm3:.6e} g/cm^3")
|
||||
|
||||
# --- 2. Material & Step Setup ---
|
||||
material_def = [(m_he, 2, 0.96), (m_c, 6, 0.04), (m_o, 8, 0.08)]
|
||||
gas_mix = catima.Material(material_def)
|
||||
gas_mix.density(rho_g_cm3)
|
||||
|
||||
# Thickness step settings
|
||||
step_mg_cm2 = 0.001 # 1 ug/cm2 steps as per your example
|
||||
step_g_cm2 = step_mg_cm2 / 1000.0
|
||||
max_steps = 1000000000 # Adjust based on how far you want to track
|
||||
|
||||
def generate_lookup(z, mass_u, e_start_mev, label):
|
||||
filename = f"{label}_lookup_{e_start_mev}MeV.dat"
|
||||
projectile = catima.Projectile(mass_u, z)
|
||||
|
||||
current_e_total = e_start_mev
|
||||
current_thickness_g_cm2 = 0.0
|
||||
|
||||
output = []
|
||||
header = f"Energy(MeV) \tmg/cm2 \tcm\nStarting Energy: {e_start_mev} MeV"
|
||||
|
||||
for i in range(max_steps):
|
||||
# 1. Record current state
|
||||
dist_cm = current_thickness_g_cm2 / rho_g_cm3
|
||||
output.append([current_e_total, current_thickness_g_cm2 * 1000.0, dist_cm])
|
||||
|
||||
# 2. Calculate energy loss for the NEXT step
|
||||
e_u = current_e_total / mass_u
|
||||
if e_u < 0.0001: # Stop at ATIMA limit
|
||||
break
|
||||
|
||||
projectile.T(e_u)
|
||||
# dedx returns MeV / (g/cm2)
|
||||
loss_mev = catima.dedx(projectile, gas_mix) * step_g_cm2
|
||||
|
||||
# 3. Update values
|
||||
current_e_total -= loss_mev
|
||||
current_thickness_g_cm2 += step_g_cm2
|
||||
|
||||
np.savetxt(filename, output, fmt='%.6f', delimiter='\t', header=header)
|
||||
print(f"Lookup table created: {filename}")
|
||||
|
||||
# --- 3. Run ---
|
||||
# Format: generate_lookup(Z, mass_u, E_start_MeV, label)
|
||||
generate_lookup(1, 1.0078, 20, "proton")
|
||||
generate_lookup(2, 4.0026, 20, "alpha")
|
||||
generate_lookup(13,26.9815, 80, "aluminum")
|
||||
generate_lookup(9,17.0021, 70, "fluorine")
|
||||
generate_lookup(8,15.9949, 70, "oxygen")
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -1,29 +0,0 @@
|
|||
#include "/home/sud/Desktop/Software2/propagator/elastcaller.h"
|
||||
void make_eloss_table_protons() {
|
||||
double einput = 20.0, estepnow;
|
||||
double target_thickness_unit = 4e-2; //mg/cm2.
|
||||
double density = 0.0711;//mg/cm3
|
||||
long i=0;
|
||||
while(einput > 0.001) {
|
||||
std::cout << "After " << i << " steps, 1H is at " << einput << " MeV after penetrating " << i*target_thickness_unit << " mg/cm2 " << i*target_thickness_unit/density << " cm of HeCO2" << std::endl;
|
||||
estepnow = slowmedown("1H",einput,"3(12C)6(16O)97(4He)",target_thickness_unit);
|
||||
|
||||
einput = estepnow;
|
||||
i+=1;
|
||||
}
|
||||
}
|
||||
|
||||
void make_eloss_table() {
|
||||
double einput = 20.0, estepnow;
|
||||
double target_thickness_unit = 1e-3; //mg/cm2.
|
||||
double density = 0.0711;//mg/cm3
|
||||
long i=0;
|
||||
while(einput > 0.001) {
|
||||
std::cout << "After " << i << " steps, 4He is at " << einput << " MeV after penetrating " << i*target_thickness_unit << " mg/cm2 " << i*target_thickness_unit/density << " cm of HeCO2" << std::endl;
|
||||
estepnow = slowmedown("4He",einput,"3(12C)6(16O)97(4He)",target_thickness_unit);
|
||||
|
||||
|
||||
einput = estepnow;
|
||||
i+=1;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
541
gainmatch.C
Normal file
541
gainmatch.C
Normal file
|
|
@ -0,0 +1,541 @@
|
|||
#define gainmatch_cxx
|
||||
|
||||
#include "gainmatch.h"
|
||||
#include <TH2.h>
|
||||
#include <TStyle.h>
|
||||
#include <TCanvas.h>
|
||||
#include <TMath.h>
|
||||
#include <TCutG.h>
|
||||
|
||||
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
|
||||
#include "Armory/ClassSX3.h"
|
||||
#include "Armory/ClassPW.h"
|
||||
|
||||
#include "TVector3.h"
|
||||
|
||||
TH2F * hsx3IndexVE;
|
||||
TH2F * hqqqIndexVE;
|
||||
TH2F * hqqqIndexVE_cut;
|
||||
TH2F * hpcIndexVE;
|
||||
|
||||
TH2F * hsx3Coin;
|
||||
TH2F * hqqqCoin;
|
||||
TH2F * hpcCoin;
|
||||
TH2F * hpcCoin_cut;
|
||||
|
||||
TH2F * hGoodQQQ;
|
||||
TH2F * hGoodQQQRingVWedge;
|
||||
|
||||
TH2F * hqqqPolar;
|
||||
TH2F * hsx3VpcIndex;
|
||||
TH2F * hqqqVpcIndex;
|
||||
TH2F * hqqqVpcIndex_cut;
|
||||
TH2F * hqqqVpcE;
|
||||
TH2F * hqqqVpcE_cut;
|
||||
TH2F * hqqqVpcE_cut1;
|
||||
TH2F * hqqqVpcE_cut2;
|
||||
TH2F * hqqqVpcE_cutCoinc;
|
||||
TH2F * hsx3VpcE;
|
||||
TH2F * hanVScatsum;
|
||||
TH2F * hanVScatsum_cut;
|
||||
TH2F * hanVScatsum_cut1;
|
||||
TH2F * hanVScatsum_cut2;
|
||||
TH2F * hsx3Vsx3;
|
||||
TH2F * hsx3uVsx3d_01;
|
||||
TH2F * hsx3uVsx3d_23;
|
||||
TH2F * hsx3uVsx3d_45;
|
||||
TH2F * hsx3uVsx3d_67;
|
||||
TH2F * hVCID;
|
||||
TH1F *hsx3bk_9_shifted ;
|
||||
TH1F *hsx3bk_10_shifted ;
|
||||
TH1F *hsx3bk_11_shifted ;
|
||||
|
||||
int padID = 0;
|
||||
|
||||
TCutG *Coinc_cut_set1;
|
||||
//TCutG *crap_cut;
|
||||
TCutG *AnCathCoinc_cut;
|
||||
TCutG *AnCathCoinc_cut1;
|
||||
TCutG *AnCathCoinc_cut2;
|
||||
|
||||
SX3 sx3_contr;
|
||||
PW pw_contr;
|
||||
TVector3 hitPos;
|
||||
bool HitNonZero;
|
||||
bool inCut;
|
||||
bool inCut1;
|
||||
bool inCut2;
|
||||
bool inCutCoinc;
|
||||
TH1F *hZd_01_1;
|
||||
TH1F *hZd_01_2;
|
||||
TH1F *hZd_01_3;
|
||||
TH1F *hZd_01_4;
|
||||
TH1F * hZProj;
|
||||
TH1F * hsx3bk_11;
|
||||
TH1F * hsx3bk_10;
|
||||
TH1F * hsx3bk_9;
|
||||
TH1F * hsx3bk_8;
|
||||
void gainmatch::Begin(TTree * /*tree*/){
|
||||
TString option = GetOption();
|
||||
|
||||
hsx3IndexVE = new TH2F("hsx3IndexVE", "SX3 index vs Energy; sx3 index ; Energy", 24*12, 0, 24*12, 400, 0, 5000); hsx3IndexVE->SetNdivisions( -612, "x");
|
||||
hqqqIndexVE = new TH2F("hqqqIndexVE", "QQQ index vs Energy; QQQ index ; Energy", 4*2*16, 0, 4*2*16, 400, 0, 5000); hqqqIndexVE->SetNdivisions( -1204, "x");
|
||||
hqqqIndexVE_cut = new TH2F("hqqqIndexVE_cut", "QQQ index vs Energy gated; QQQ index ; Energy", 4*2*16, 0, 4*2*16, 400, 0, 5000); hqqqIndexVE->SetNdivisions( -1204, "x");
|
||||
hpcIndexVE = new TH2F("hpcIndexVE", "PC index vs Energy; PC index ; Energy", 2*24, 0, 2*24, 400, 0, 4000); hpcIndexVE->SetNdivisions( -1204, "x");
|
||||
|
||||
hGoodQQQ = new TH2F("hGoodQQQ", "number of good QQQ vs QQQ id", 10, 0, 10, 4, 0, 4);
|
||||
hGoodQQQRingVWedge = new TH2F("hGoodQQQRingVWedge", "Ring index, Wedge index", 16*4, 0, 16*4, 16*4, 0, 16*4);
|
||||
hZd_01_1 =new TH1F("hZd_01_1", "Z position", 100, -1, 1);
|
||||
hZd_01_2 =new TH1F("hZd_01_2", "Z position", 100, -1, 1);
|
||||
hZd_01_3 =new TH1F("hZd_01_3", "Z position", 100, -1, 1);
|
||||
hZd_01_4 =new TH1F("hZd_01_4", "Z position", 100, -1, 1);
|
||||
hsx3Coin = new TH2F("hsx3Coin", "SX3 Coincident", 24*12, 0, 24*12, 24*12, 0, 24*12);
|
||||
hqqqCoin = new TH2F("hqqqCoin", "QQQ Coincident", 4*2*16, 0, 4*2*16, 4*2*16, 0, 4*2*16);
|
||||
hpcCoin = new TH2F("hpcCoin", "PC Coincident", 2*24, 0, 2*24, 2*24, 0, 2*24);
|
||||
hpcCoin_cut = new TH2F("hpcCoin_cut", "PC Coincident gated", 2*24, 0, 2*24, 2*24, 0, 2*24);
|
||||
|
||||
hqqqPolar = new TH2F("hqqqPolar", "QQQ Polar ID", 16*4, -TMath::Pi(), TMath::Pi(),16, 10, 50);
|
||||
|
||||
hsx3VpcIndex = new TH2F("hsx3Vpcindex", "sx3 vs pc; sx3 index; pc index", 24*12, 0, 24*12, 48, 0, 48);
|
||||
hsx3Vsx3 = new TH2F("hsx3Vsx3", "sx3 vs sx3; sx3 E; sx3 E", 8000, 0, 16000, 8000, 0, 16000);
|
||||
hsx3uVsx3d_01 = new TH2F("hsx3uVsx3d_01", "sx3u vs sx3d; sx3u E; sx3d E", 100, 0, 1, 100, 0, 1);
|
||||
hsx3uVsx3d_23 = new TH2F("hsx3uVsx3d_23", "sx3u vs sx3d; sx3u E; sx3d E", 100, 0, 1, 100, 0, 1);
|
||||
hsx3uVsx3d_45 = new TH2F("hsx3uVsx3d_45", "sx3u vs sx3d; sx3u E; sx3d E", 1000, 0, 5000, 1000, 0, 5000);
|
||||
hsx3uVsx3d_67 = new TH2F("hsx3uVsx3d_67", "sx3u vs sx3d; sx3u E; sx3d E", 1000, 0, 5000, 1000, 0, 5000);
|
||||
hsx3VpcIndex->SetNdivisions( -612, "x");
|
||||
hsx3VpcIndex->SetNdivisions( -12, "y");
|
||||
|
||||
hqqqVpcIndex = new TH2F("hqqqVpcindex", "qqq vs pc; qqq index; pc index", 4*2*16, 0, 4*2*16, 48, 0, 48);
|
||||
hqqqVpcIndex->SetNdivisions( -612, "x");
|
||||
hqqqVpcIndex->SetNdivisions( -12, "y");
|
||||
|
||||
hqqqVpcIndex_cut = new TH2F("hqqqVpcindex_cut", "qqq vs pc gated; qqq index; pc index", 4*2*16, 0, 4*2*16, 48, 0, 48);
|
||||
hqqqVpcIndex_cut->SetNdivisions( -612, "x");
|
||||
hqqqVpcIndex_cut->SetNdivisions( -12, "y");
|
||||
|
||||
hqqqVpcE = new TH2F("hqqqVpcEnergy", "qqq vs pc; qqq energy; pc energy", 8000, 0, 16000, 8000, 0, 16000);
|
||||
hqqqVpcE->SetNdivisions( -612, "x");
|
||||
hqqqVpcE->SetNdivisions( -12, "y");
|
||||
|
||||
hqqqVpcE_cut = new TH2F("hqqqVpcEnergy_cut", "qqq vs pc gated; qqq energy; pc energy", 8000, 0, 16000, 8000, 0, 16000);
|
||||
hqqqVpcE_cut->SetNdivisions( -612, "x");
|
||||
hqqqVpcE_cut->SetNdivisions( -12, "y");
|
||||
|
||||
hqqqVpcE_cut1 = new TH2F("hqqqVpcEnergy_cut1", "qqq vs pc gated; qqq energy; pc energy", 8000, 0, 16000, 8000, 0, 16000);
|
||||
hqqqVpcE_cut1->SetNdivisions( -612, "x");
|
||||
hqqqVpcE_cut1->SetNdivisions( -12, "y");
|
||||
|
||||
hqqqVpcE_cut2 = new TH2F("hqqqVpcEnergy_cut2", "qqq vs pc gated; qqq energy; pc energy", 8000, 0, 16000, 8000, 0, 16000);
|
||||
hqqqVpcE_cut2->SetNdivisions( -612, "x");
|
||||
hqqqVpcE_cut2->SetNdivisions( -12, "y");
|
||||
|
||||
hqqqVpcE_cutCoinc = new TH2F("hqqqVpcEnergy_cutCoinc", "qqq vs pc gated; qqq energy; pc energy", 8000, 0, 16000, 8000, 0, 16000);
|
||||
hqqqVpcE_cutCoinc->SetNdivisions( -612, "x");
|
||||
hqqqVpcE_cutCoinc->SetNdivisions( -12, "y");
|
||||
hsx3bk_8=new TH1F("hsx3bk_8", "hsx3bk_8",1000, 0,5000);
|
||||
hsx3bk_9=new TH1F("hsx3bk_9", "hsx3bk_9",1000, 0,5000);
|
||||
hsx3bk_10=new TH1F("hsx3bk_10", "hsx3bk_10",1000, 0,5000);
|
||||
hsx3bk_11=new TH1F("hsx3bk_11", "hsx3bk_11",1000, 0,5000);
|
||||
hsx3VpcE = new TH2F("hsx3VpcEnergy", "sx3 vs pc; sx3 energy; pc energy", 400, 0, 5000, 400, 0, 5000);
|
||||
hsx3VpcE->SetNdivisions( -612, "x");
|
||||
hsx3VpcE->SetNdivisions( -12, "y");
|
||||
hsx3bk_9_shifted = new TH1F("hsx3bk_9_shifted", "hsx3bk_9",1000, 0,5000);
|
||||
hsx3bk_10_shifted = new TH1F("hsx3bk_10_shifted", "hsx3bk_9",1000, 0,5000);
|
||||
hsx3bk_11_shifted = new TH1F("hsx3bk_11_shifted", "hsx3bk_9",1000, 0,5000);
|
||||
hZProj = new TH1F("hZProj", "Z Projection", 200, -600, 600);
|
||||
|
||||
hanVScatsum = new TH2F("hanVScatsum", "Anode vs Cathode Sum; Anode E; Cathode E", 8000,0 , 16000, 8000, 0 , 16000);
|
||||
hanVScatsum_cut = new TH2F("hanVScatsum_cut", "Anode vs Cathode Sum gated; Anode E; Cathode E", 1600,0 , 16000, 1600, 0 , 16000);
|
||||
hanVScatsum_cut1 = new TH2F("hanVScatsum_cut1", "Anode vs Cathode Sum gated; Anode E; Cathode E", 1600,0 , 16000, 1600, 0 , 16000);
|
||||
hanVScatsum_cut2 = new TH2F("hanVScatsum_cut2", "Anode vs Cathode Sum gated; Anode E; Cathode E", 1600,0 , 16000, 1600, 0 , 16000);
|
||||
|
||||
hVCID = new TH2F("hVCID", "Virtual Cathod ID vs total Cath. Energy", 200, 0, 24, 200, 0, 10000);
|
||||
|
||||
sx3_contr.ConstructGeo();
|
||||
pw_contr.ConstructGeo();
|
||||
|
||||
TFile *f3 = new TFile("Coinc_cut_set1.root");
|
||||
//TFile *f4 = new TFile("crap_cut.root");
|
||||
TFile *f = new TFile("AnCathCoinc_cut.root");
|
||||
TFile *f1 = new TFile("AnCathCoinc_cut1.root");
|
||||
TFile *f2 = new TFile("AnCathCoinc_cut2.root");
|
||||
|
||||
|
||||
Coinc_cut_set1 = (TCutG*)f3->Get("Coinc_cut_set1");
|
||||
//crap_cut = (TCutG*)f4->Get("crap_cut");
|
||||
AnCathCoinc_cut = (TCutG*)f->Get("AnCathCoinc_cut");
|
||||
AnCathCoinc_cut1 = (TCutG*)f1->Get("AnCathCoinc_cut1");
|
||||
AnCathCoinc_cut2 = (TCutG*)f2->Get("AnCathCoinc_cut2");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Bool_t gainmatch::Process(Long64_t entry){
|
||||
|
||||
// if ( entry > 100 ) return kTRUE;
|
||||
|
||||
hitPos.Clear();
|
||||
HitNonZero = false;
|
||||
inCut = false;
|
||||
|
||||
// if( entry > 1) return kTRUE;
|
||||
// printf("################### ev : %llu \n", entry);
|
||||
|
||||
b_sx3Multi->GetEntry(entry);
|
||||
b_sx3ID->GetEntry(entry);
|
||||
b_sx3Ch->GetEntry(entry);
|
||||
b_sx3E->GetEntry(entry);
|
||||
b_sx3T->GetEntry(entry);
|
||||
b_qqqMulti->GetEntry(entry);
|
||||
b_qqqID->GetEntry(entry);
|
||||
b_qqqCh->GetEntry(entry);
|
||||
b_qqqE->GetEntry(entry);
|
||||
b_qqqT->GetEntry(entry);
|
||||
b_pcMulti->GetEntry(entry);
|
||||
b_pcID->GetEntry(entry);
|
||||
b_pcCh->GetEntry(entry);
|
||||
b_pcE->GetEntry(entry);
|
||||
b_pcT->GetEntry(entry);
|
||||
|
||||
sx3.CalIndex();
|
||||
qqq.CalIndex();
|
||||
pc.CalIndex();
|
||||
|
||||
// sx3.Print();
|
||||
|
||||
//########################################################### Raw data
|
||||
// //======================= SX3
|
||||
|
||||
std::vector<std::pair<int, int>> ID; // first = id, 2nd = index
|
||||
for (int i = 0; i < sx3.multi; i++) {
|
||||
ID.push_back(std::pair<int, int>(sx3.id[i], i));
|
||||
|
||||
hsx3IndexVE->Fill(sx3.index[i], sx3.e[i]);
|
||||
|
||||
for (int j = i + 1; j < sx3.multi; j++) {
|
||||
hsx3Coin->Fill(sx3.index[i], sx3.index[j]);
|
||||
}
|
||||
|
||||
for (int j = 0; j < pc.multi; j++) {
|
||||
hsx3VpcIndex->Fill(sx3.index[i], pc.index[j]);
|
||||
}
|
||||
}
|
||||
|
||||
if (ID.size() > 0) {
|
||||
std::sort(ID.begin(), ID.end(), [](const std::pair<int, int> &a, const std::pair<int, int> &b) {
|
||||
return a.first < b.first;
|
||||
});
|
||||
|
||||
std::vector<std::pair<int, int>> sx3ID;
|
||||
sx3ID.push_back(ID[0]);
|
||||
bool found = false;
|
||||
for (size_t i = 1; i < ID.size(); i++) {
|
||||
if (ID[i].first == sx3ID.back().first) {
|
||||
sx3ID.push_back(ID[i]);
|
||||
if (sx3ID.size() >= 3) {
|
||||
found = true;
|
||||
}
|
||||
} else {
|
||||
if (!found) {
|
||||
sx3ID.clear();
|
||||
sx3ID.push_back(ID[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
int sx3ChUp = -1, sx3ChDn = -1, sx3ChBk = -1;
|
||||
float sx3EUp = 0.0, sx3EDn = 0.0, sx3EBk = 0.0;
|
||||
|
||||
for (size_t i = 0; i < sx3ID.size(); i++) {
|
||||
int index = sx3ID[i].second;
|
||||
|
||||
if (sx3.ch[index] < 8) {
|
||||
if (sx3.ch[index] % 2 == 0) {
|
||||
sx3ChDn = sx3.ch[index];
|
||||
sx3EDn = sx3.e[index];
|
||||
} else {
|
||||
sx3ChUp = sx3.ch[index];
|
||||
sx3EUp = sx3.e[index];
|
||||
}
|
||||
} else {
|
||||
sx3ChBk = sx3.ch[index];
|
||||
sx3EBk = sx3.e[index];
|
||||
}
|
||||
|
||||
int ch = sx3.ch[index];
|
||||
float energy = sx3.e[index];
|
||||
if (sx3ID[0].first == 9) {
|
||||
float peak8 = 0.0;
|
||||
float peak9 = 0.0;
|
||||
int peak10 = 0.0;
|
||||
float peak11 = 0.0;
|
||||
float shift9 =0.0;
|
||||
float shift10 =0.0;
|
||||
float shift11 =0.0;
|
||||
int minBin_8 = hsx3bk_8->FindBin(1);
|
||||
int maxBin_8 = hsx3bk_8->FindBin(5000);
|
||||
int maxRangeBinContent_8 = -1;
|
||||
double maxBinCenter_8 = 0.0;
|
||||
int minBin_9 = hsx3bk_9->FindBin(1);
|
||||
int maxBin_9 = hsx3bk_9->FindBin(5000);
|
||||
int maxRangeBinContent_9 = -1;
|
||||
double maxBinCenter_9 = 0.0;
|
||||
int minBin_10 = hsx3bk_10->FindBin(1);
|
||||
int maxBin_10 = hsx3bk_10->FindBin(5000);
|
||||
int maxRangeBinContent_10 = -1;
|
||||
double maxBinCenter_10 = 0.0;
|
||||
int minBin_11 = hsx3bk_11->FindBin(1);
|
||||
int maxBin_11 = hsx3bk_11->FindBin(5000);
|
||||
int maxRangeBinContent_11 = -1;
|
||||
double maxBinCenter_11 = 0.0;
|
||||
if (sx3ChBk == 8) {
|
||||
|
||||
hsx3bk_8->Fill(sx3EBk);
|
||||
|
||||
|
||||
for (int bin = minBin_8; bin <= maxBin_8; ++bin) {
|
||||
if (hsx3bk_8->GetBinContent(bin) > maxRangeBinContent_8) {
|
||||
maxRangeBinContent_8 = hsx3bk_8->GetBinContent(bin);
|
||||
maxBinCenter_8 = hsx3bk_8->GetBinCenter(bin);
|
||||
}
|
||||
}
|
||||
|
||||
//peak8 = hsx3bk_8->GetMaximumBin();
|
||||
//peak8 = hsx3bk_8->GetMaximumBin();
|
||||
//printf("peak8: %f\n", maxBinCenter_8);
|
||||
}
|
||||
//printf("peak8_mm: %f\n", maxBinCenter);
|
||||
else if (sx3ChBk == 9) {
|
||||
|
||||
hsx3bk_9->Fill(sx3EBk);
|
||||
for (int bin = minBin_9; bin <= maxBin_9; ++bin) {
|
||||
if (hsx3bk_9->GetBinContent(bin) > maxRangeBinContent_9) {
|
||||
maxRangeBinContent_9 = hsx3bk_9->GetBinContent(bin);
|
||||
maxBinCenter_9 = hsx3bk_9->GetBinCenter(bin);
|
||||
}
|
||||
}
|
||||
|
||||
//peak8 = hsx3bk_8->GetMaximumBin();
|
||||
//peak8 = hsx3bk_8->GetMaximumBin();
|
||||
//printf("peak9: %f\n", maxBinCenter_9);
|
||||
//hsx3bk_9_shifted->Fill(sx3EBk*0.76);
|
||||
peak9 = 2097.5/maxBinCenter_9;
|
||||
//printf("peak9_shift: %f\n", peak9);
|
||||
hsx3bk_9_shifted->Fill(sx3EBk*(2097.5/maxBinCenter_9));
|
||||
//printf("peak9 %d\n", peak9);
|
||||
}
|
||||
else if(sx3ChBk == 10) {
|
||||
|
||||
hsx3bk_10->Fill(sx3EBk);
|
||||
for (int bin = minBin_10; bin <= maxBin_10; ++bin) {
|
||||
if (hsx3bk_10->GetBinContent(bin) > maxRangeBinContent_10) {
|
||||
maxRangeBinContent_10 = hsx3bk_10->GetBinContent(bin);
|
||||
maxBinCenter_10 = hsx3bk_10->GetBinCenter(bin);
|
||||
}
|
||||
}
|
||||
|
||||
//peak8 = hsx3bk_8->GetMaximumBin();
|
||||
//peak8 = hsx3bk_8->GetMaximumBin();
|
||||
//printf("peak10: %f\n", maxBinCenter_10);
|
||||
//hsx3bk_9_shifted->Fill(sx3EBk*0.76);
|
||||
peak10= 2097.5/maxBinCenter_10;
|
||||
//printf("peak10_shift: %f\n", 1787.5/maxBinCenter_10);
|
||||
hsx3bk_10_shifted->Fill(sx3EBk*(2097.5/maxBinCenter_10));
|
||||
//printf("peak9 %d\n", peak9);
|
||||
}
|
||||
//peak10 = hsx3bk_10->GetMaximumBin();
|
||||
// printf("peak10 %d\n" ,peak10);
|
||||
|
||||
else if(sx3ChBk == 11) {
|
||||
|
||||
hsx3bk_11->Fill(sx3EBk);
|
||||
for (int bin = minBin_11; bin <= maxBin_11; ++bin) {
|
||||
if (hsx3bk_11->GetBinContent(bin) > maxRangeBinContent_11) {
|
||||
maxRangeBinContent_11 = hsx3bk_11->GetBinContent(bin);
|
||||
maxBinCenter_11 = hsx3bk_11->GetBinCenter(bin);
|
||||
}
|
||||
}
|
||||
|
||||
//peak8 = hsx3bk_8->GetMaximumBin();
|
||||
//peak8 = hsx3bk_8->GetMaximumBin();
|
||||
//printf("peak9: %f\n", maxBinCenter_11);
|
||||
//hsx3bk_9_shifted->Fill(sx3EBk*0.76);
|
||||
peak11 = 2097.5/maxBinCenter_11;
|
||||
//printf("peak11_shift: %f\n", peak11);
|
||||
hsx3bk_11_shifted->Fill(sx3EBk*(2097.5/maxBinCenter_11));
|
||||
//printf("peak9 %d\n", peak9);
|
||||
|
||||
}
|
||||
|
||||
|
||||
float sx3EBk_shifted = 0.0;
|
||||
float sx3E_u_matched_01 = 0.0;
|
||||
float sx3E_d_matched_01 = 0.0;
|
||||
float sx3E_fb_matched_01 = 0.0;
|
||||
float sx3E_fbu_matched_01 = 0.0;
|
||||
float sx3E_fbd_matched_01 = 0.0;
|
||||
float diff =0.0;
|
||||
float ratio = 0.0;
|
||||
float coeff = 0.0;
|
||||
if (sx3ChBk == 9) {
|
||||
sx3EBk_shifted = (sx3EBk *(2097.5/maxBinCenter_9));
|
||||
} else if (sx3ChBk == 10) {
|
||||
sx3EBk_shifted = (sx3EBk * (2097.5/maxBinCenter_10));
|
||||
} else if (sx3ChBk == 11) {
|
||||
sx3EBk_shifted = (sx3EBk * (2097.5/maxBinCenter_11)) ;
|
||||
} else {
|
||||
sx3EBk_shifted = sx3EBk; // Use unshifted value for sx3ChBk == 8
|
||||
}
|
||||
if ((sx3ChUp == 1 && sx3ChDn == 0)) {
|
||||
sx3E_u_matched_01= (sx3EUp-0.898729)/0.836243;
|
||||
//sx3E_u_matched_01= (0.836243*sx3EDn)+0.898729;
|
||||
sx3E_d_matched_01= (sx3EDn-0.898729)/0.836243;
|
||||
sx3E_fb_matched_01=(sx3EBk_shifted+9.2423)/0.924773 ;
|
||||
sx3E_fbu_matched_01=(sx3E_u_matched_01+9.2423)/0.924773 ;
|
||||
sx3E_fbd_matched_01=(sx3E_d_matched_01+9.2423)/0.924773 ;
|
||||
diff = sx3E_fb_matched_01 - (sx3EUp+sx3E_fbd_matched_01);
|
||||
ratio = sx3EUp/sx3E_fbd_matched_01;
|
||||
coeff = ((sx3EUp+diff) - (sx3E_fbd_matched_01*ratio))/(diff*(1+ratio));
|
||||
}
|
||||
|
||||
//TH2F *hsx3uVsx3d_01 = nullptr;
|
||||
if (sx3ChBk >=8) {
|
||||
|
||||
//if (sx3ChBk == 9) {
|
||||
|
||||
|
||||
|
||||
if ((sx3ChUp == 1 && sx3ChDn == 0)) {
|
||||
if (sx3ChUp != -1 && sx3ChDn != -1 && sx3ChBk !=-1) {
|
||||
if (sx3EBk_shifted > 50 && sx3EUp > 50 && sx3EDn > 50) {
|
||||
printf("sx3EUp: %f, sx3EDn: %f, sx3E_u_matched_01: %f,sx3E_d_matched_01: %f\n", sx3EUp, sx3EDn, sx3E_u_matched_01,sx3E_d_matched_01);
|
||||
//printf("Filling hsx3uVsx3d_01_shifted: %f\n", sx3EBk_ud_matched_01 / sx3EBk_shifted);
|
||||
// hsx3uVsx3d_01->Fill(sx3E_u_matched_01 / sx3EBk_shifted, sx3E_d_matched_01 / sx3EBk_shifted);
|
||||
hsx3uVsx3d_01->Fill(sx3EUp / sx3EBk_shifted, sx3E_d_matched_01 / sx3EBk_shifted);
|
||||
hsx3uVsx3d_23->Fill(sx3EUp / sx3EBk_shifted, sx3EDn/ sx3EBk_shifted);
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
else if ((sx3ChUp == 3 && sx3ChDn == 2)) {
|
||||
if (sx3ChUp != -1 && sx3ChDn != -1 && sx3ChBk !=-1) {
|
||||
if (sx3EBk_shifted != 0 && sx3EBk_shifted > 50 && sx3EUp > 50 && sx3EDn > 50) {
|
||||
printf("sx3EUp: %f, sx3EDn: %f, sx3EBk_shifted: %f\n", sx3EUp, sx3EDn, sx3EBk_shifted);
|
||||
printf("Filling hsx3uVsx3d_23_shifted: %f\n", sx3EUp / sx3EBk_shifted);
|
||||
// hsx3uVsx3d_23->Fill(sx3EUp / sx3EBk_shifted, (-0.924754*sx3EUp+0.916671) / sx3EBk_shifted);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
/* if ((sx3ChUp == 1 && sx3ChDn == 0)) {
|
||||
if (sx3ChUp != -1 && sx3ChDn != -1 && sx3ChBk !=-1) {
|
||||
if (sx3EBk != 0 && sx3EBk > 50 && sx3EUp > 50 && sx3EDn > 50) {
|
||||
printf("sx3EUp: %f, sx3EDn: %f, sx3EBk: %f\n", sx3EUp, sx3EDn, sx3EBk);
|
||||
printf("Filling hsx3uVsx3d_01: %f\n", sx3EUp / sx3EBk);
|
||||
hsx3uVsx3d_45->Fill(sx3EUp / sx3EBk, sx3EDn / sx3EBk);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((sx3ChUp == 3 && sx3ChDn == 2)) {
|
||||
if (sx3ChUp != -1 && sx3ChDn != -1 && sx3ChBk !=-1) {
|
||||
if (sx3EBk != 0 && sx3EBk > 50 && sx3EUp > 50 && sx3EDn > 50) {
|
||||
printf("sx3EUp: %f, sx3EDn: %f, sx3EBk: %f\n", sx3EUp, sx3EDn, sx3EBk);
|
||||
printf("Filling hsx3uVsx3d_23: %f\n", sx3EUp / sx3EBk);
|
||||
hsx3uVsx3d_67->Fill(sx3EUp / sx3EBk, sx3EDn / sx3EBk);
|
||||
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if (sx3ChUp == 1 && sx3ChDn == 0){
|
||||
//if (sx3ChUp == 1 || sx3ChDn == 0 || sx3ChUp == 3 || sx3ChDn == 2 || sx3ChUp == 5 || sx3ChDn == 4 || sx3ChUp == 7 || sx3ChDn == 6) {
|
||||
if (sx3ChUp != -1 && sx3ChBk !=-1 && sx3ChDn !=-1) {
|
||||
if (sx3EBk_shifted > 50 && sx3EUp > 50 && sx3EDn>50 &&sx3E_u_matched_01>50 && sx3E_u_matched_01>50) {
|
||||
//printf("sx3EUp: %f, sx3EDn: %f, sx3E_u_matched_01: %f,sx3E_d_matched_01: %f\n", sx3EUp, sx3EDn, sx3E_u_matched_01,sx3E_d_matched_01);
|
||||
printf("Filling hsx3uVsx3d_nn: %f, gggggg: %f \n", (sx3EUp+sx3EDn),(sx3E_u_matched_01+sx3E_d_matched_01) );
|
||||
hsx3uVsx3d_45->Fill((sx3EUp+sx3E_d_matched_01),sx3EBk_shifted);
|
||||
hsx3uVsx3d_67->Fill((sx3EUp+sx3E_d_matched_01),sx3E_fb_matched_01);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*if (sx3ChBk > 8) {
|
||||
if ((sx3ChUp == 7 && sx3ChDn == 6) ||
|
||||
(sx3ChUp == 5 && sx3ChDn == 4) ||
|
||||
(sx3ChUp == 3 && sx3ChDn == 2) ||
|
||||
(sx3ChUp == 1 && sx3ChDn == 0)) {
|
||||
if (sx3ChUp != -1 && sx3ChDn != -1 && sx3ChBk !=-1) {
|
||||
if (sx3EBk != 0 && sx3EBk > 50 && sx3EUp > 50 && sx3EDn > 50) {
|
||||
hsx3uVsx3d->Fill(sx3EUp / sx3EBk, sx3EDn / sx3EBk);
|
||||
hsx3Vsx3->Fill(sx3EUp ,sx3EDn);
|
||||
printf("sx3EUp: %f | sx3EDn: %f | sx3EBk: %f | sx3ChUp: %d | sx3ChDn: %d | sx3ChBk: %d\n", sx3EUp, sx3EDn, sx3EBk, sx3ChUp, sx3ChDn, sx3ChBk);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
//else {
|
||||
//printf("sx3EUp\n");
|
||||
//}
|
||||
if (sx3ChUp == 1 && sx3ChDn == 0){
|
||||
|
||||
if (sx3ChUp != -1 && sx3ChBk !=-1 && sx3ChDn !=-1) {
|
||||
if (sx3E_d_matched_01> sx3EUp ) {
|
||||
//printf("hZd_01_1_dn: %f\n", sx3E_d_matched_01);
|
||||
//printf("hZd_01_1_b: %f\n", sx3E_fb_matched_01);
|
||||
hZd_01_1->Fill((2*(sx3E_d_matched_01+(coeff*diff))/sx3E_fb_matched_01)-1);
|
||||
}
|
||||
else if(sx3EUp> sx3E_d_matched_01) {
|
||||
//printf("hZd_01_2_sx3EUp: %f\n",sx3EUp );
|
||||
//printf("hZd_01_2_sx3EDn: %f\n",sx3E_fb_matched_01);
|
||||
|
||||
hZd_01_2->Fill(1-(2*(sx3EUp+(1-coeff)*diff))/sx3E_fb_matched_01);
|
||||
}
|
||||
else if(sx3EUp>0.0 && sx3E_d_matched_01>0.0 && sx3E_d_matched_01>=sx3EUp ) {
|
||||
hZd_01_3->Fill((2*(sx3E_d_matched_01+ coeff*diff)/sx3E_fb_matched_01)-1);
|
||||
}
|
||||
else if(sx3EUp>0.0 && sx3E_d_matched_01>0.0 && sx3E_d_matched_01<sx3EUp ) {
|
||||
hZd_01_4->Fill(1-(2*(sx3EUp+ (1-coeff)*diff)/sx3E_fb_matched_01));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < pc.multi; j++) {
|
||||
if (sx3.ch[index] > 8) {
|
||||
hsx3VpcE->Fill(sx3.e[i], pc.e[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sx3_contr.CalSX3Pos(sx3ID[0].first, sx3ChUp, sx3ChDn, sx3ChBk, sx3EUp, sx3EDn);
|
||||
hitPos = sx3_contr.GetHitPos();
|
||||
HitNonZero = true;
|
||||
// hitPos.Print();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// //======================= PC
|
||||
|
||||
|
||||
//########################################################### Track constrcution
|
||||
|
||||
|
||||
//############################## DO THE KINEMATICS
|
||||
|
||||
}
|
||||
return kTRUE;
|
||||
}
|
||||
|
||||
void gainmatch::Terminate(){
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef GainMatchQQQ_h
|
||||
#define GainMatchQQQ_h
|
||||
#ifndef gainmatch_h
|
||||
#define gainmatch_h
|
||||
|
||||
#include <TROOT.h>
|
||||
#include <TChain.h>
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "Armory/ClassDet.h"
|
||||
|
||||
class GainMatchQQQ : public TSelector {
|
||||
class gainmatch : public TSelector {
|
||||
public :
|
||||
TTree *fChain; //!pointer to the analyzed TTree or TChain
|
||||
|
||||
|
|
@ -41,8 +41,8 @@ public :
|
|||
TBranch *b_pcE; //!
|
||||
TBranch *b_pcT; //!
|
||||
|
||||
GainMatchQQQ(TTree * /*tree*/ =0) : fChain(0) { }
|
||||
virtual ~GainMatchQQQ() { }
|
||||
gainmatch(TTree * /*tree*/ =0) : fChain(0) { }
|
||||
virtual ~gainmatch() { }
|
||||
virtual Int_t Version() const { return 2; }
|
||||
virtual void Begin(TTree *tree);
|
||||
virtual void SlaveBegin(TTree *tree);
|
||||
|
|
@ -57,13 +57,13 @@ public :
|
|||
virtual void SlaveTerminate();
|
||||
virtual void Terminate();
|
||||
|
||||
ClassDef(GainMatchQQQ,0);
|
||||
ClassDef(gainmatch,0);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GainMatchQQQ_cxx
|
||||
void GainMatchQQQ::Init(TTree *tree){
|
||||
#ifdef gainmatch_cxx
|
||||
void gainmatch::Init(TTree *tree){
|
||||
|
||||
// Set branch addresses and branch pointers
|
||||
if (!tree) return;
|
||||
|
|
@ -95,20 +95,20 @@ void GainMatchQQQ::Init(TTree *tree){
|
|||
|
||||
}
|
||||
|
||||
Bool_t GainMatchQQQ::Notify(){
|
||||
Bool_t gainmatch::Notify(){
|
||||
|
||||
return kTRUE;
|
||||
}
|
||||
|
||||
void GainMatchQQQ::SlaveBegin(TTree * /*tree*/){
|
||||
void gainmatch::SlaveBegin(TTree * /*tree*/){
|
||||
|
||||
TString option = GetOption();
|
||||
|
||||
}
|
||||
|
||||
void GainMatchQQQ::SlaveTerminate(){
|
||||
void gainmatch::SlaveTerminate(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // #ifdef GainMatchQQQ_cxx
|
||||
#endif // #ifdef gainmatch_cxx
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
#include "TF1.h"
|
||||
|
||||
double model2(double *x, double *par) {
|
||||
/* 'Potential Well' of width 2a from from xx-a to xx+a
|
||||
xx is coordinate about the point of origin, set at x=center
|
||||
v0 is the y-offset of the potential
|
||||
k is the 'steepness' of the potential
|
||||
|
||||
continuous across xx-a and xx+a, and differentiable
|
||||
*/
|
||||
|
||||
double center= par[3];
|
||||
double xx = x[0]-center;
|
||||
double a = TMath::Abs(par[0]);
|
||||
double k = TMath::Abs(par[1]);
|
||||
double v0 = par[2];
|
||||
|
||||
if(xx < -a)
|
||||
return k*(xx+a)*(xx+a) + v0;
|
||||
else if(xx > a)
|
||||
return k*(xx-a)*(xx-a) + v0;
|
||||
else
|
||||
return v0;
|
||||
}
|
||||
|
||||
void func1() {
|
||||
//TF1 f1("bowl",model,-2.,2.,2);
|
||||
TCanvas c("c1","c1",800,600);
|
||||
TF1 f1("bowl",model2,-10.,10.,4);
|
||||
f1.SetMaximum(10);
|
||||
|
||||
for(int i=-4; i<4; i++) {
|
||||
f1.SetParameters(.4,100,2,i); //a, k, v0, center
|
||||
f1.SetNpx(100000);
|
||||
if(i==-4) f1.Draw("L");
|
||||
f1.DrawCopy("L SAME");
|
||||
c.Modified(); c.Update();
|
||||
//c.SaveAs(Form("%d.png",out));
|
||||
while(c.WaitPrimitive());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,216 +0,0 @@
|
|||
#include "../Armory/HistPlotter.h"
|
||||
#include <Minuit2/FCNBase.h>
|
||||
#include <Math/Minimizer.h>
|
||||
#include <Math/Factory.h>
|
||||
#include <Math/Functor.h>
|
||||
#include <TMath.h>
|
||||
#include <TPad.h>
|
||||
#include <cassert>
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#include <iostream>
|
||||
#include <TF1.h>
|
||||
#include "func1.h"
|
||||
static long iters=0;
|
||||
|
||||
//class intgm_sx3 : public ROOT::Minuit2::FCNBase {
|
||||
class intgm_sx3 {
|
||||
int N;
|
||||
|
||||
//L.at(0).at(3).at(n) is front strip = 0, back pad = 3, nth datapoint
|
||||
std::array<std::array<std::vector<double>,4>,4> L,R,B;
|
||||
//std::array<std::array<double,5>,4> stripedge; //stripedge.at(i).at(j) is the jth edge of the ith strip. there are five edges for the four strips 'i'=0 to 3, (0,1) (1,2) (2,3) (3,4) for each
|
||||
//the edges are at -2a, -a, 0, a, 2a respectively so we enforce four ratios in the chi2 value - 'a' can be held constant, no need to fit it.
|
||||
|
||||
//assume z = M*(aL-bR)
|
||||
//stripedge[i][1] = max(z) when pad==0 = min(z) when pad==1 this should be -1
|
||||
//stripedge[i][2] = max(z) when pad==1 = min(z) when pad==2. this should be 0
|
||||
//stripedge[i][3] = max(z) when pad==2 = min(z) when pad==3. this should be 1
|
||||
|
||||
//i.e. stripedge[i][j] = max(z) when pad == j-1, min(z) when pad==j, for i= 1,2,3
|
||||
|
||||
//ncounts.at(frontch).at(backch) is the number of (L,R,B) tuples we've filled (frontch,backch) coordinates in the detector
|
||||
std::array<std::array<long,4>,4> ncounts;
|
||||
TH1F *localhists[4][4]; //one histogram for each fc, bc combination
|
||||
HistPlotter *plotter;
|
||||
TF1 *pos_weight[4];
|
||||
TF1 *energywell;
|
||||
public:
|
||||
intgm_sx3() {
|
||||
for(int bc=0; bc<4; bc++) {
|
||||
for(int fc=0; fc<4; fc++) {
|
||||
L[fc][bc].reserve(1000);
|
||||
R[fc][bc].reserve(1000);
|
||||
B[fc][bc].reserve(1000);
|
||||
//localhists[fc][bc] = new TH1F(Form("h_%d_%d",fc,bc),Form("h_%d_%d",fc,bc),1000,-4.,4.);
|
||||
ncounts[fc][bc] = 0;
|
||||
}
|
||||
pos_weight[bc] = new TF1(Form("b_strip%d",bc),model2,-10,10,4); //from -10, to 10, 4 parameters
|
||||
pos_weight[bc]->SetParameters(1.0,10,1.,3-2*bc); //centers at 1, 3.,5,7 Width 2a with a=1.0
|
||||
pos_weight[bc]->SetNpx(1'000'000);
|
||||
}
|
||||
energywell = new TF1("ewell",model2,0,2000,4); //0 to 2000 channels, 4 params
|
||||
energywell->SetParameters(1000,20,1,1500); //center the back E values at 1500 +/- 500
|
||||
energywell->SetNpx(1'000'000);
|
||||
N=0;
|
||||
}
|
||||
void set_plotter(HistPlotter *p) {plotter=p;}
|
||||
void set_iters(long i) { iters=i;}
|
||||
intgm_sx3(HistPlotter *p) : plotter(p) {
|
||||
for(int bc=0; bc<4; bc++) {
|
||||
for(int fc=0; fc<4; fc++) {
|
||||
L[fc][bc].reserve(1000);
|
||||
R[fc][bc].reserve(1000);
|
||||
B[fc][bc].reserve(1000);
|
||||
//localhists[fc][bc] = new TH1F(Form("h_%d_%d",fc,bc),Form("h_%d_%d",fc,bc),1000,-4.,4.);
|
||||
ncounts[fc][bc] = 0;
|
||||
}
|
||||
pos_weight[bc] = new TF1(Form("b_strip%d",bc),model2,-10,10,4); //from -10, to 10, 4 parameters
|
||||
//a/2, k, v0, center
|
||||
pos_weight[bc]->SetParameters(0.92,10,1.,-1.*(3-2*bc)); //centers at 7, 5.,3,1 Width 2a with a=1.0
|
||||
pos_weight[bc]->SetNpx(1'000'000);
|
||||
}
|
||||
energywell = new TF1("ewell",model2,0,8000,4); //0 to 2000 channels, 4 params
|
||||
// energywell->SetParameters(60,10,0,1430); //center the back E values at 1430 +/- 60
|
||||
energywell->SetParameters(400,10,0,5246); //center the back E values at 5486 +/- 600
|
||||
energywell->SetNpx(1'000'000);
|
||||
N=0;
|
||||
}
|
||||
|
||||
inline void fill(int fc, int bc, double leftE, double rightE, double backE) {
|
||||
/*
|
||||
*
|
||||
*/
|
||||
assert(fc>=0 && fc<=3 && "Front channels should fit the range 0 to 3 inclusive!");
|
||||
assert(bc>=0 && bc<=3 && "Back channels should fit the range 0 to 3 inclusive!");
|
||||
if(leftE>0 && rightE >0 && backE>0) {
|
||||
L[fc][bc].emplace_back(leftE);
|
||||
R[fc][bc].emplace_back(rightE);
|
||||
B[fc][bc].emplace_back(backE);
|
||||
ncounts[fc][bc]+=1;
|
||||
N+=1;
|
||||
}
|
||||
}
|
||||
|
||||
inline void print() {
|
||||
for(int i=0; i<16; i++) {
|
||||
std::cout << ncounts[i%4][i/4] << std::endl;
|
||||
}
|
||||
}
|
||||
inline void plot(std::string comment, const double* params) {
|
||||
std::array<double,4> l,r,b,bo,ro,lo,offset,stretch; //aliases to help with book-keeping
|
||||
std::array<std::array<double,4>,4> back_gains;// back_gains[fc][bc] are for fc,bc firing in combo
|
||||
for(int ctr=0; ctr<4; ctr++) {
|
||||
r[ctr] = params[ctr];
|
||||
}
|
||||
for(int ctr=4; ctr<20; ctr++) {
|
||||
int bch = (ctr-4)%4;
|
||||
int fch = (ctr-4)/4;
|
||||
back_gains[bch][fch] = params[ctr];
|
||||
}
|
||||
for(int ctr=20; ctr<24; ctr++) {
|
||||
stretch[ctr-20] = params[ctr];
|
||||
}
|
||||
for(int ctr=24; ctr<28; ctr++) {
|
||||
l[ctr-24] = params[ctr];
|
||||
}
|
||||
for(int fc=0; fc<4; fc++) {
|
||||
for(int bc=0; bc<4; bc++) {
|
||||
for(int n=0; n<ncounts[fc][bc]; n++) {
|
||||
if(plotter) {
|
||||
double left = l[fc]*L[fc][bc].at(n);
|
||||
double right = r[fc]*R[fc][bc].at(n);
|
||||
double back = back_gains[bc][fc]*B[fc][bc].at(n);
|
||||
//double zpos = (left - right)/(left+right);
|
||||
double zpos = stretch[fc]*(left - right)/(left+right);// + offset[fc]; //back;
|
||||
plotter->Fill2D(Form("normlf_fc%d_%d_%s",fc,bc,comment.c_str()),800,0,1.,800,0,1.,left/back, right/back,"l_vs_r");
|
||||
plotter->Fill2D(Form("normlf_all_%s",comment.c_str()),800, 0, 1., 800, 0, 1.,left/back, right/back);
|
||||
plotter->Fill2D(Form("case_f%d_b%d_%s",fc,bc,comment.c_str()),800,0,8192,800,0,8192,left+right,back,"l_vs_r");
|
||||
plotter->Fill2D(Form("case_all_%s",comment.c_str()),800,0,8192,800,0,8192,left+right,back);
|
||||
//plotter->Fill2D(Form("z_vs_backe_f%d_b%d_%s",fc,bc,comment.c_str()),800,-10,10,800,0,8192,zpos,back,"z_vs_be");
|
||||
plotter->Fill2D(Form("z_vs_backe_all_%s",comment.c_str()),800,-10,10,800,0,8192,zpos,back);
|
||||
} //end if plotter
|
||||
}// end for-n
|
||||
}//end for-bc
|
||||
}//end for-fc
|
||||
}//end plot()
|
||||
|
||||
// double operator()(const std::vector<double>& params) const override{
|
||||
double eval(const double* params) const {
|
||||
iters+=1;
|
||||
|
||||
std::array<double,4> l,r,b,bo,ro,lo, offset, stretch; //aliases to help with book-keeping
|
||||
std::array<std::array<double,4>,4> back_gains;// back_gains[fc][bc] are for fc,bc firing in combo
|
||||
for(int ctr=0; ctr<16; ctr++) {
|
||||
int bch = (ctr)%4;
|
||||
int fch = (ctr)/4;
|
||||
back_gains[bch][fch] = params[ctr];
|
||||
}
|
||||
for(int ctr=16; ctr<20; ctr++) {
|
||||
r[ctr-16] = params[ctr];
|
||||
l[ctr-16] = 1.0;
|
||||
}
|
||||
for(int ctr=20; ctr<24; ctr++) {
|
||||
stretch[ctr-20] = params[ctr];
|
||||
}
|
||||
double result=0, sumcount=0;
|
||||
for(int fc=0; fc<4; fc++) {
|
||||
for(int bc=0; bc<4; bc++) {
|
||||
//if(bc >= 1 || fc >= 1 ) continue;
|
||||
if(ncounts[fc][bc] == 0 && iters ==0) {
|
||||
std::cout << "Missing any data in front:" << fc << " back:" << bc << " combination." << std::endl;
|
||||
}
|
||||
|
||||
for(int n=0; n<ncounts[fc][bc] ; n++) {
|
||||
//double left = l[fc]*L[fc][bc].at(n) + lo[fc];
|
||||
//double right = r[fc]*R[fc][bc].at(n) + ro[fc];
|
||||
//double back = b[bc]*B[fc][bc].at(n) + bo[bc];
|
||||
//double add = TMath::Power(left + right - back,2);
|
||||
if(B[fc][bc].at(n)<100) continue;//ignore events too close to noise threshold
|
||||
|
||||
double left = l[fc]*L[fc][bc].at(n);
|
||||
double right = r[fc]*R[fc][bc].at(n);
|
||||
double back = back_gains[bc][fc]*B[fc][bc].at(n);
|
||||
double lnorm = left/B[fc][bc].at(n);
|
||||
double rnorm = right/B[fc][bc].at(n);
|
||||
|
||||
//double add = TMath::Power(left/back + right/back - 1.0,2);
|
||||
double add = TMath::Power(left + right - back,2);
|
||||
double zpos = stretch[fc]*(left - right)/(left+right); //back;
|
||||
std::cout << zpos << " " << pos_weight[bc]->Eval(zpos) << " " << bc << std::endl;
|
||||
double add_position = pos_weight[bc]->Eval(zpos);
|
||||
double eback_align_penalty = energywell->Eval(back);
|
||||
/* if(back>1000) zmid[fc][bc] += zpos;
|
||||
if(back>1000 && zpos < zmin[fc][bc]) zmin[fc][bc] = zpos;
|
||||
if(back> 1000 && zpos > zmax[fc][bc]) zmax[fc][bc] = zpos;
|
||||
|
||||
if(back>1000) {
|
||||
localhists[fc][bc]->Fill(zpos);
|
||||
}*/
|
||||
|
||||
result += add_position;
|
||||
//result += add;
|
||||
result += eback_align_penalty;
|
||||
sumcount+=1;
|
||||
//if(bc==0) std::cout << add << " " << add_position << " " << zpos << std::endl;
|
||||
//To avoid drift towards (0,0,0) trivial solution. This value ~1 close to (1,1,1)
|
||||
//result+=(1e-3/(TMath::Power(l[fc],2)+TMath::Power(r[fc],2)+TMath::Power(b[bc],2)+1e-9));
|
||||
//result+=(1e-3/(TMath::Power(l[fc],2)+TMath::Power(r[fc],2)+TMath::Power(b[bc],2)+1e-9));
|
||||
} //end for-n
|
||||
} //end for-bc
|
||||
} //end for-fc
|
||||
result/=sumcount; //normalize, so the value doesn't scream
|
||||
if(iters%1'000==0) {
|
||||
std::cout << "iters : " << iters << " params: " << std::endl ;
|
||||
for(int i=0 ; i< 10; i++) std::cout << params[i] << " " << std::flush;
|
||||
std::cout<< std::endl;
|
||||
for(int i=10 ; i< 20; i++) std::cout << params[i] << " " << std::flush;
|
||||
std::cout << std::endl << " result: " << result << std::endl;
|
||||
} //end if
|
||||
return result;
|
||||
} //end eval()
|
||||
|
||||
//double Up() const override { return 1.0; } // Required by minuit2 FCBase
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -1,338 +0,0 @@
|
|||
#ifndef UTILS_ORR_H
|
||||
#define UTILS_ORR_H
|
||||
#include "datatypes.h"
|
||||
#include "HistPlotter.h"
|
||||
#include "Geometry_orr.h" //contains orruba geometry constants
|
||||
#include <cassert>
|
||||
#include <stdio.h>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
//#include <cstring>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include <iomanip>
|
||||
#include <set>
|
||||
#include <sys/stat.h>
|
||||
#include "TMath.h"
|
||||
#include "counters.h"
|
||||
|
||||
static named_counter oc("named orruba counters");
|
||||
|
||||
inline float get_filesize(std::string filename) {
|
||||
struct stat st;
|
||||
stat(filename.c_str(), &st);
|
||||
return st.st_size;
|
||||
}
|
||||
|
||||
class orruba_params {
|
||||
/*
|
||||
*
|
||||
*/
|
||||
public:
|
||||
int chnum=DEFAULT_NULL; //!< global channel number
|
||||
std::string type = "-";
|
||||
int id=DEFAULT_NULL;
|
||||
int layer=DEFAULT_NULL;
|
||||
int frontback=DEFAULT_NULL;
|
||||
int updown=DEFAULT_NULL;
|
||||
int subid=DEFAULT_NULL;
|
||||
int leftright=DEFAULT_NULL;
|
||||
|
||||
float ped=DEFAULT_NULL;
|
||||
float offset=DEFAULT_NULL;
|
||||
float gain=DEFAULT_NULL;
|
||||
float gain2=DEFAULT_NULL; //for use with sx3's
|
||||
};
|
||||
|
||||
class sx3_geometry_scalefactors {
|
||||
public:
|
||||
//If sx3 has L, R being the left and right extremities, we choose add, stretch here such that
|
||||
// x_mm = (x_raw+add)*stretch; so add=abs(L), stretch=75/(abs(L)+R)
|
||||
float add[4];
|
||||
float stretch[4];
|
||||
};
|
||||
|
||||
class qqq5_finegains {
|
||||
public:
|
||||
std::array<std::pair<float,float>,32> front;
|
||||
//front.at(30).first = slope at clkpos 0, ring 30 for E front layer
|
||||
//front.at(30).second = intercept for the same as above
|
||||
std::array<std::pair<float,float>,4> back;
|
||||
};
|
||||
class sx3_fbgains {
|
||||
public:
|
||||
//Order of indices is [pad][strip]
|
||||
float padoffsets[4][4];
|
||||
float padgains[4][4];
|
||||
|
||||
float stripLoffsets[4][4];
|
||||
float stripLgains[4][4];
|
||||
|
||||
float stripRoffsets[4][4];
|
||||
float stripRgains[4][4];
|
||||
};
|
||||
|
||||
//Metadata ORRUBA needs to know about itself, to be configured at the start
|
||||
extern std::array<orruba_params,MAX_ORRUBA_CHANS> o_params;
|
||||
extern std::array<sx3_fbgains,24> sx3_xtalk_gains; //every sx3 needs to be gainmatched as a frontL-back, frontR-back pair (pad strip pair)
|
||||
extern std::array<sx3_geometry_scalefactors,24> sx3gs;
|
||||
extern std::array<qqq5_finegains,4> qqq5_fg_dE, qqq5_fg_E;
|
||||
|
||||
class type19Raw {
|
||||
public:
|
||||
long int timestamp;
|
||||
std::vector<unsigned short> ch;
|
||||
std::vector<unsigned short> val;
|
||||
|
||||
type19Raw() : timestamp(0), ch(50,0), val(50,0) {} //Reserve 50 for size of these vectors, initial value of zero
|
||||
void print() const {
|
||||
/*
|
||||
print()
|
||||
Prints type19Raw's contents to stdout for monitoring
|
||||
*/
|
||||
std::cout << "------" << std::endl;
|
||||
for(unsigned int ii=0; ii<ch.size(); ii++) {
|
||||
std::cout << ch.at(ii) << " " << val.at(ii) << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class sx3 {
|
||||
public:
|
||||
//TODO: Convert to std::array
|
||||
//Holds all information in an event, including ped subtraction+scaling. back[2].at(0) will have the largest energy seen in ch2, if any
|
||||
std::vector<float> back[4];
|
||||
std::vector<float> frontL[4];
|
||||
std::vector<float> frontR[4];
|
||||
|
||||
double ts = DEFAULT_NULL;
|
||||
//Easy lookup of final calibrated event. Only filled for valid cases, assumed for now to be 1L, 1R, 1B
|
||||
float frontX=DEFAULT_NULL;
|
||||
float frontXmm=DEFAULT_NULL;
|
||||
float frontE=DEFAULT_NULL;
|
||||
float backE=DEFAULT_NULL;
|
||||
int stripF=DEFAULT_NULL;
|
||||
int stripB=DEFAULT_NULL;
|
||||
float frontEL=DEFAULT_NULL;
|
||||
float frontER=DEFAULT_NULL;
|
||||
|
||||
float phi=DEFAULT_NULL; //
|
||||
|
||||
std::set<int> valid_front_chans;
|
||||
std::set<int> valid_back_chans;
|
||||
std::set<int> unmatched_front_chans; //every front channel is unmatched and invalid at first. when it gets matched, it gets removed and sent to valid
|
||||
|
||||
bool foundevent=false;
|
||||
bool valid=false;//valid will be set to false in all cases where we have ambiguity
|
||||
int flags=-1;//flags settable to different types of values to indicate different invalid situations
|
||||
|
||||
void fillevent(const std::string& position, const int subchannel, const float value); //make 'const' what functions don't need to change, helps with performance
|
||||
void validate(const sx3_fbgains&, const sx3_geometry_scalefactors&);
|
||||
};
|
||||
|
||||
class qqq5 {
|
||||
public:
|
||||
//Holds all information in an event, including ped subtraction+scaling. front[2].at(0) will have the largest energy seen in ch2, if any
|
||||
//TODO: Convert to std::array
|
||||
std::vector<float> back[4];
|
||||
std::vector<float> front[32];
|
||||
|
||||
double ts = DEFAULT_NULL;
|
||||
float selftheta=DEFAULT_NULL,selfrho=DEFAULT_NULL;
|
||||
//Easy lookup of the final calibrated event. Only filled for valid cases.
|
||||
double frontE=DEFAULT_NULL;
|
||||
double backE=DEFAULT_NULL;
|
||||
int frontch;
|
||||
int backch;
|
||||
|
||||
std::pair<int,int> adj_front_strips = {-1,-1};
|
||||
std::pair<int,int> adj_back_strips = {-1,-1};
|
||||
std::set<int> valid_front_chans; //list of channels that fire. can inspect size() of these to see if there are front/back events
|
||||
std::set<int> valid_back_chans; // we use std::set since it makes for very readable code
|
||||
|
||||
bool foundevent=false;
|
||||
bool valid=false; //valid will be set to false in all cases where we have ambiguity
|
||||
int flags=-1; //flags settable to different types of values to indicate different invalid situations
|
||||
|
||||
void fillevent(const std::string& position, const int subchannel, const float value); //make 'const' what functions don't need to change, helps with performance
|
||||
void validate();
|
||||
};
|
||||
|
||||
struct orrubaevent {
|
||||
//Every clean, valid charged-particle event will have these four parts
|
||||
float dE=DEFAULT_NULL; //!< true energy-loss in the dE layer. Found by gainmatching ADC readout to alpha data
|
||||
float E=DEFAULT_NULL; //!< energy deposited in the E layer. When summed with dE, gives true energy in keV deposited by the particle in ORRUBA
|
||||
float dE_PID = DEFAULT_NULL; //!< dE scaled for dE-layer's thickness, reducing the spread due to angular straggling by explicitly accounting for it. This will give a sharper pid plot that can be gated on better
|
||||
float dE_linPID = DEFAULT_NULL; //!< dE_PID, but linearized using the prescription described in, say, PhysRevC.90.034601 (2014). dE_linPID = ((dE+E)^a-E^a)^(1/a) where a ~ 1.68 is chosen empirically
|
||||
float Theta=DEFAULT_NULL; //!< Laboratory polar angle of event in radians, deprecated
|
||||
float Phi=DEFAULT_NULL; //!< Lab azimuthal angle of event in radians, deprecated
|
||||
|
||||
//Helpful indices to make dE-E plots
|
||||
std::string type; //!< "endcap" vs "barrel"
|
||||
//!< Identify the position of the detector in the barrel, usually in accordance with the channel map: say we might learn detector is at "Quad 4" or "clk_pos 10", together with 'type'. Useful with HistPlotter class
|
||||
int position=DEFAULT_NULL;
|
||||
int subchdE_1=DEFAULT_NULL, subchdE_2=DEFAULT_NULL; //!< Identify the subchannels corresponding to the two sides of the dE detector. To avoid confusion, 1=strip(sx3), ring(qqq) and 2=pad(sx3), wedge(qqq)
|
||||
int subchE_1=DEFAULT_NULL, subchE_2=DEFAULT_NULL; //!< Identify the subchannels corresponding to the two sides of the E detector. Same convention as above
|
||||
|
||||
float x=DEFAULT_NULL,y=DEFAULT_NULL,z=DEFAULT_NULL; //!< Laboratory x,y,z coordinates of the event from the E layer
|
||||
float r0=DEFAULT_NULL,theta0=DEFAULT_NULL,phi0=DEFAULT_NULL; //!< vector elements from hit to origin for E layer
|
||||
float r1=DEFAULT_NULL,theta1=DEFAULT_NULL,phi1=DEFAULT_NULL; //!< vector elements from hit to origin for dE layer
|
||||
};
|
||||
|
||||
/*TODO:
|
||||
* There will be some use for a class such that it stores
|
||||
PhysicsEvent = <Ex, Brho, THeta4, ...orrubaevent >
|
||||
* Once the 'orrubaevent' structs are made, it should be callable. like
|
||||
std::vector<PhysicsEvent> getPhysicsFromVertices(Kinematics dpkin, std::vector<orrubaevent> orvec);?
|
||||
* should the physics just go sit in orrubaevent? maybe orruba2024 class can have a kinematics object in it?
|
||||
*/
|
||||
|
||||
class orruba2024 {
|
||||
private:
|
||||
//Class expected to be changed for each version of the analysis code
|
||||
public:
|
||||
bool found_trk, found_trkpresc, found_tdcq, found_s800e1, found_s800trg,
|
||||
found_rf, found_gt, found_si, found_siup;
|
||||
|
||||
bool found_de, found_e, found_qqq, found_sx3;//orruba
|
||||
long long timestamp=DEFAULT_NULL;
|
||||
std::vector<type19Raw> o_rawvec;
|
||||
|
||||
std::array<qqq5,4> uendcapE;
|
||||
std::array<qqq5,4> uendcapdE;
|
||||
std::array<sx3,12> ubarrelE;
|
||||
std::array<sx3,12> ubarreldE;
|
||||
|
||||
std::array<sx3,2> dbarrelE;
|
||||
//Results after post-processing, including possible multiplicities
|
||||
std::vector<orrubaevent> events;
|
||||
|
||||
double target_z_offset;
|
||||
|
||||
//void initialize(const std::string & filename1, const std::string& filename2, const std::string& filename3);
|
||||
float tdc_trk = DEFAULT_NULL;
|
||||
float tdc_trksi = DEFAULT_NULL; //trackerpr+si stops are combined into one channel
|
||||
float tdc_trkp = DEFAULT_NULL;
|
||||
float tdc_q = DEFAULT_NULL;
|
||||
float tdc_s800e1 = DEFAULT_NULL;
|
||||
float tdc_s800trg = DEFAULT_NULL;
|
||||
float tdc_rf = DEFAULT_NULL;
|
||||
float tdc_rf_unwrap = DEFAULT_NULL;
|
||||
float tdc_gt = DEFAULT_NULL;
|
||||
float tdc_si = DEFAULT_NULL;
|
||||
float tdc_siup = DEFAULT_NULL;
|
||||
orruba2024(const std::vector<type19Raw>& orvec);
|
||||
void postprocess(); //generates 'events', and performs validations on freshly entered data. performs fine gainmatching for front-back-pairs
|
||||
void print() const {
|
||||
std::cout << Form("TDCs\n trk:%1.4f\ntrkp:%1.4f\nq:%1.4f\ns800e1:%1.4f\ns800trg:%1.4f\nrf:%1.4f\nrfuw:%1.4f\ngt:%1.4f\nsi:%1.4f\nsiup:%1.4f\n-----\nevents_size:%lu\ntimestamp:%lld\nfound_de:%d, found_e:%d\n-------\n-------\n",
|
||||
tdc_trk, tdc_trkp, tdc_q, tdc_s800e1, tdc_s800trg, tdc_rf, tdc_rf_unwrap, tdc_gt, tdc_si, tdc_siup, events.size(), timestamp, found_de, found_e) << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
class trackingdet {
|
||||
public:
|
||||
double timestamp=DEFAULT_NULL;
|
||||
//TODO: Convert all to std::array
|
||||
std::vector<float> xwires[MAXNWIRES_TRACK];
|
||||
std::vector<float> ywires[MAXNWIRES_TRACK];
|
||||
std::vector<float> xwiresf[MAXNWIRES_TRACK];
|
||||
std::vector<float> ywiresf[MAXNWIRES_TRACK];
|
||||
std::vector<float> xwiresf_nn[MAXNWIRES_TRACK];
|
||||
std::vector<float> ywiresf_nn[MAXNWIRES_TRACK];
|
||||
|
||||
std::vector<float> xtimes[MAXNWIRES_TRACK];
|
||||
std::vector<float> ytimes[MAXNWIRES_TRACK];
|
||||
std::vector<float> xtimesf[MAXNWIRES_TRACK];
|
||||
std::vector<float> ytimesf[MAXNWIRES_TRACK];
|
||||
std::vector<float> cathode;
|
||||
|
||||
int multx; //how many x-wires fired?
|
||||
int multy; //how many y-wires fired?
|
||||
int multxf; //how many filtered x-wires fired?
|
||||
int multyf; //how many filtered y-wires fired?
|
||||
|
||||
int multxt; //how many x-tdcwires fired?
|
||||
int multyt; //how many y-tdcwires fired?
|
||||
|
||||
int multxtf; //how many x-tdcwires fired in window?
|
||||
int multytf; //how many y-tdcwires fired in window?
|
||||
|
||||
float tot_cathode=0;
|
||||
float tot_x=0;
|
||||
float tot_y=0;
|
||||
float tot_anode=0;
|
||||
|
||||
//list of x and y wires fired above energy threshold, within timing gate window
|
||||
std::set<int> list_ywires;
|
||||
std::set<int> list_xwires;
|
||||
|
||||
std::set<int> list_ytwires;
|
||||
std::set<int> list_xtwires;
|
||||
|
||||
//position of the vertex estimated by up to 2 neighbouring wires firing together within window
|
||||
double xpos=DEFAULT_NULL;
|
||||
double ypos=DEFAULT_NULL;
|
||||
bool clean_event = false;
|
||||
int maxnx=-124, maxny=-124;
|
||||
int nnx = 0; //nearest neighbour x wires set this to +/- 1 if present w.r.t. wire maxnx
|
||||
int nny = 0; //nearest neighbour y wires set this to +/- 1 if present w.r.t wire maxny
|
||||
bool clean_event_no_timing = false;
|
||||
bool clean_single_xy_event = false;
|
||||
bool clean_single_xy_event_no_timing = false;
|
||||
void Reset() {
|
||||
/***
|
||||
Resets all data members.
|
||||
**/
|
||||
cathode.clear();
|
||||
for(int i=0; i<MAXNWIRES_TRACK; i++) {
|
||||
xwires[i].clear();
|
||||
ywires[i].clear();
|
||||
xwiresf[i].clear();
|
||||
ywiresf[i].clear();
|
||||
xwiresf_nn[i].clear();
|
||||
ywiresf_nn[i].clear();
|
||||
xtimes[i].clear();
|
||||
ytimes[i].clear();
|
||||
xtimesf[i].clear();
|
||||
ytimesf[i].clear();
|
||||
}
|
||||
list_xwires.clear();
|
||||
list_ywires.clear();
|
||||
list_xtwires.clear();
|
||||
list_ytwires.clear();
|
||||
|
||||
nnx = 0;
|
||||
nny = 0;
|
||||
clean_event_no_timing = false;
|
||||
clean_event = false; //x, y both fire above thresh, xt, yt present within broad coinc window
|
||||
xpos=DEFAULT_NULL;
|
||||
ypos=DEFAULT_NULL;
|
||||
maxnx=-124;
|
||||
maxny=-124;
|
||||
multx=0; //how many x-wires fired?
|
||||
multy=0; //how many y-wires fired?
|
||||
multxf=0; //how many filt x-wires fired?
|
||||
multyf=0; //how many filt y-wires fired?
|
||||
multxt=0; //how many tdc x-wires fired?
|
||||
multyt=0; //how many tdc y-wires fired?
|
||||
multxtf=0; //how many tdc x-wires fired?
|
||||
multytf=0; //how many tdc y-wires fired?
|
||||
}
|
||||
|
||||
trackingdet() {
|
||||
Reset();
|
||||
};
|
||||
trackingdet(const std::vector<type19Raw>& orvec);
|
||||
};
|
||||
|
||||
const float alpha = 0.0;
|
||||
int matchchantype(unsigned short chan, const std::array<orruba_params,MAX_ORRUBA_CHANS>& index, const std::string& label);
|
||||
void initialize_orruba(const std::string & filename1, const std::string& filename2, const std::string& filename3, const std::string& filename4);//,
|
||||
int parse_orruba_data(const unsigned short* buffer, int32_t length, type19Raw& oraw_event);
|
||||
#endif
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
import math
|
||||
|
||||
def wrap_phi(angle):
|
||||
"""Wraps an angle to be between -180 and +180 degrees"""
|
||||
return (angle + 180) % 360 - 180
|
||||
|
||||
# The name of the file you want to generate
|
||||
filename = "detector_geometry.dat"
|
||||
|
||||
# Open the file in 'write' mode
|
||||
with open(filename, "w") as f:
|
||||
|
||||
# --- 1. SX3 Geometry ---
|
||||
f.write("=========================================================\n")
|
||||
f.write(" SX3 BARREL AZIMUTHAL ANGLES (Degrees) \n")
|
||||
f.write("=========================================================\n")
|
||||
f.write(" Det ID | Strip 0 | Strip 1 | Strip 2 | Strip 3 | Det Center\n")
|
||||
f.write("---------------------------------------------------------\n")
|
||||
|
||||
for det_id in range(12): # Assuming 12 barrel detectors
|
||||
strips = []
|
||||
for stripF in range(4):
|
||||
stripF_rev = 3 - stripF
|
||||
num = (2 * stripF_rev - 3) * 40.30
|
||||
den = 8.0 * 88.0 * math.cos(math.radians(15.0))
|
||||
beta_n = 15.0 + math.degrees(math.atan2(num, den))
|
||||
phi_n = ((-det_id + 0.5) * 30.0 + beta_n) + 45.0
|
||||
strips.append(wrap_phi(phi_n))
|
||||
|
||||
det_center = wrap_phi(((-det_id + 0.5) * 30.0 + 15.0) + 45.0)
|
||||
f.write(f" {det_id:2d} | {strips[0]:6.2f} | {strips[1]:6.2f} | {strips[2]:6.2f} | {strips[3]:6.2f} | {det_center:6.2f}\n")
|
||||
|
||||
|
||||
# --- 2. PC Wire Geometry ---
|
||||
f.write("\n\n=========================================================\n")
|
||||
f.write(" PROPORTIONAL COUNTER WIRE ANGLES (Degrees) \n")
|
||||
f.write("=========================================================\n")
|
||||
f.write(" Wire ID | Anode (-z) | Anode (+z) | Cathode (-z) | Cathode (+z)\n")
|
||||
f.write("----------------------------------------------------------------\n")
|
||||
|
||||
k = 360.0 / 24.0
|
||||
offset_a1 = -6*k - 3*k
|
||||
offset_c1 = -4*k - 2*k - (360.0/48.0)
|
||||
wireShift = 3
|
||||
offset_a2 = offset_a1 + wireShift*k
|
||||
offset_c2 = offset_c1 - wireShift*k
|
||||
|
||||
for i in range(24):
|
||||
phi_a1 = wrap_phi(-k * i + offset_a1)
|
||||
phi_a2 = wrap_phi(-k * i + offset_a2)
|
||||
phi_c1 = wrap_phi(k * i + offset_c1)
|
||||
phi_c2 = wrap_phi(k * i + offset_c2)
|
||||
|
||||
f.write(f" {i:2d} | {phi_a1:7.2f} | {phi_a2:7.2f} | {phi_c1:7.2f} | {phi_c2:7.2f}\n")
|
||||
|
||||
print(f"Success! The geometry lookup table has been saved to '{filename}'.")
|
||||
330
mapping.h
330
mapping.h
|
|
@ -12,261 +12,213 @@
|
|||
#include <TMath.h>
|
||||
|
||||
const std::map<int, unsigned short> board = {
|
||||
{0, 17122}, // id, sn
|
||||
{1, 17123},
|
||||
{2, 22320},
|
||||
{3, 22130},
|
||||
{4, 22129},
|
||||
{5, 15529},
|
||||
{6, 15528},
|
||||
// {7,89},
|
||||
{7, 334},
|
||||
{8, 379},
|
||||
{9, 325},
|
||||
{10, 405}};
|
||||
{0, 17122}, // id, sn
|
||||
{1, 17123},
|
||||
{2, 22320},
|
||||
{3, 22130},
|
||||
{4, 22129},
|
||||
{5, 15529},
|
||||
{6, 15528},
|
||||
{7, 334},
|
||||
{8, 379},
|
||||
{9, 325},
|
||||
{10, 405}
|
||||
};
|
||||
const int nBd = board.size();
|
||||
|
||||
const int nV1740 = 7;
|
||||
const int nV1725 = 4;
|
||||
const int nV1725 = 3;
|
||||
|
||||
//+++++++++++++++++++ detID;
|
||||
// The detectors are seperated into 2 type: SuperX3, QQQ, and PC
|
||||
// the SuperX3 has 24 detectors for each kind, wach detector has 12 channels
|
||||
// the QQQ has 4 detectors for each kind, each detector has 32 channels
|
||||
// the PC has 2 types, anode and cathode, each has 24 channels
|
||||
// the MISC has 6 channels, the lollipop IC and siliscon followed by the hotneedle IC, as well as the Rf and MCP
|
||||
// The detID = Type * 10000 + index * 100 + channel
|
||||
// fro example, detID(superX3-8, ch-7) = 00807
|
||||
|
||||
|
||||
// use the GenMapping() to get that
|
||||
const std::vector<int> mapping = {
|
||||
|
||||
//================== 17122
|
||||
806, 807, 804, 805, 803, 802, 801, 800, 1006, 1007, 1004, 1005, 1003, 1002, 1001, 1000,
|
||||
606, 607, 604, 605, 603, 602, 601, 600, 1106, 1107, 1104, 1105, 1103, 1102, 1101, 1100,
|
||||
711, 710, 709, 708, 911, 910, 909, 908, 1011, 1010, 1009, 1008, 811, 810, 809, 808,
|
||||
706, 707, 704, 705, 703, 702, 701, 700, 906, 907, 904, 905, 903, 902, 901, 900,
|
||||
//================== 17123
|
||||
1406, 1407, 1404, 1405, 1403, 1402, 1401, 1400, 1606, 1607, 1604, 1605, 1603, 1602, 1601, 1600,
|
||||
1306, 1307, 1304, 1305, 1303, 1302, 1301, 1300, 1506, 1507, 1504, 1505, 1503, 1502, 1501, 1500,
|
||||
1311, 1310, 1309, 1308, 1711, 1710, 1709, 1708, 1611, 1610, 1609, 1608, 1411, 1410, 1409, 1408,
|
||||
1206, 1207, 1204, 1205, 1203, 1202, 1201, 1200, 1706, 1707, 1704, 1705, 1703, 1702, 1701, 1700,
|
||||
//================== 22320
|
||||
6, 7, 4, 5, 3, 2, 1, 0, 506, 507, 504, 505, 503, 502, 501, 500,
|
||||
111, 110, 109, 108, 311, 310, 309, 308, 411, 410, 409, 408, 211, 210, 209, 208,
|
||||
206, 207, 204, 205, 203, 202, 201, 200, 406, 407, 404, 405, 403, 402, 401, 400,
|
||||
106, 107, 104, 105, 103, 102, 101, 100, 306, 307, 304, 305, 303, 302, 301, 300,
|
||||
//================== 22130
|
||||
1911, 1910, 1909, 1908, 2111, 2110, 2109, 2108, 2211, 2210, 2209, 2208, 2011, 2010, 2009, 2008,
|
||||
11, 10, 9, 8, 511, 510, 509, 508, 611, 610, 609, 608, 1111, 1110, 1109, 1108,
|
||||
2006, 2007, 2004, 2005, 2003, 2002, 2001, 2000, 2206, 2207, 2204, 2205, 2203, 2202, 2201, 2200,
|
||||
1906, 1907, 1904, 1905, 1903, 1902, 1901, 1900, 2106, 2107, 2104, 2105, 2103, 2102, 2101, 2100,
|
||||
//================== 22129
|
||||
1806, 1807, 1804, 1805, 1803, 1802, 1801, 1800, 2306, 2307, 2304, 2305, 2303, 2302, 2301, 2300,
|
||||
10031, 10030, 10029, 10028, 10027, 10026, 10025, 10024, 10023, 10022, 10021, 10020, 10019, 10018, 10017, 10016,
|
||||
// 10016, 10017, 10018, 10019, 10020, 10021, 10022, 10023, 10024, 10025, 10026, 10027, 10028, 10029, 10030, 10031,
|
||||
10116, 10117, 10118, 10119, 10120, 10121, 10122, 10123, 10124, 10125, 10126, 10127, 10128, 10129, 10130, 10131,
|
||||
10015, 10014, 10013, 10012, 10011, 10010, 10009, 10008, 10007, 10006, 10005, 10004, 10003, 10002, 10001, 10000,
|
||||
//================== 15529
|
||||
10231, 10230, 10229, 10228, 10227, 10226, 10225, 10224, 10223, 10222, 10221, 10220, 10219, 10218, 10217, 10216,
|
||||
10100, 10101, 10102, 10103, 10104, 10105, 10106, 10107, 10108, 10109, 10110, 10111, 10112, 10113, 10114, 10115,
|
||||
// 10115, 10114, 10113, 10112, 10111, 10110, 10109, 10108, 10107, 10106, 10105, 10104, 10103, 10102, 10101, 10100,
|
||||
10300, 10301, 10302, 10303, 10304, 10305, 10306, 10307, 10308, 10309, 10310, 10311, 10312, 10313, 10314, 10315,
|
||||
// 10315, 10314, 10313, 10312, 10311, 10310, 10309, 10308, 10307, 10306, 10305, 10304, 10303, 10302, 10301, 10300,
|
||||
10215, 10214, 10213, 10212, 10211, 10210, 10209, 10208, 10207, 10206, 10205, 10204, 10203, 10202, 10201, 10200,
|
||||
//================== 15528
|
||||
10316, 10317, 10318, 10319, 10320, 10321, 10322, 10323, 10324, 10325, 10326, 10327, 10328, 10329, 10330, 10331,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
//================== 89
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||
// 30004, -1, 30003, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
//================== 334
|
||||
20116, 20117, 20118, 20119, -1, 20121, 20122, 20123, 20016, 20017, 20018, -1, 20020, 20021, 20022, 20023,
|
||||
//================== 379
|
||||
-1, 20001, 20002, 20003, 20004, 20005, -1, 20007, 20008, -1, 20010, 20011, 20012, 20013, 20014, 20015,
|
||||
//================== 325
|
||||
20100, 20101, 20102, 20103, 20104, 20105, 20106, 20107, 20108, 20109, 20110, 20111, 20112, -1, 20114, 20115,
|
||||
//================== 405
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||
20006, -1, 30005, 20009, -1, 20120, 20000, 20019, 20113, 30000, 30004, 30001, 30002, -1, 30003, -1};
|
||||
//================== 17122
|
||||
806, 807, 804, 805, 803, 802, 801, 800, 1006, 1007, 1004, 1005, 1003, 1002, 1001, 1000,
|
||||
606, 607, 604, 605, 603, 602, 601, 600, 1106, 1107, 1104, 1105, 1103, 1102, 1101, 1100,
|
||||
711, 710, 709, 708, 911, 910, 909, 908, 1011, 1010, 1009, 1008, 811, 810, 809, 808,
|
||||
706, 707, 704, 705, 703, 702, 701, 700, 906, 907, 904, 905, 903, 902, 901, 900,
|
||||
//================== 17123
|
||||
1406, 1407, 1404, 1405, 1403, 1402, 1401, 1400, 1606, 1607, 1604, 1605, 1603, 1602, 1601, 1600,
|
||||
1306, 1307, 1304, 1305, 1303, 1302, 1301, 1300, 1506, 1507, 1504, 1505, 1503, 1502, 1501, 1500,
|
||||
1311, 1310, 1309, 1308, 1711, 1710, 1709, 1708, 1611, 1610, 1609, 1608, 1411, 1410, 1409, 1408,
|
||||
1206, 1207, 1204, 1205, 1203, 1202, 1201, 1200, 1706, 1707, 1704, 1705, 1703, 1702, 1701, 1700,
|
||||
//================== 22320
|
||||
6, 7, 4, 5, 3, 2, 1, 0, 506, 507, 504, 505, 503, 502, 501, 500,
|
||||
111, 110, 109, 108, 311, 310, 309, 308, 411, 410, 409, 408, 211, 210, 209, 208,
|
||||
206, 207, 204, 205, 203, 202, 201, 200, 406, 407, 404, 405, 403, 402, 401, 400,
|
||||
106, 107, 104, 105, 103, 102, 101, 100, 306, 307, 304, 305, 303, 302, 301, 300,
|
||||
//================== 22130
|
||||
1911, 1910, 1909, 1908, 2111, 2110, 2109, 2108, 2211, 2210, 2209, 2208, 2011, 2010, 2009, 2008,
|
||||
11, 10, 9, 8, 511, 510, 509, 508, 611, 610, 609, 608, 1111, 1110, 1109, 1108,
|
||||
2006, 2007, 2004, 2005, 2003, 2002, 2001, 2000, 2206, 2207, 2204, 2205, 2203, 2202, 2201, 2200,
|
||||
1906, 1907, 1904, 1905, 1903, 1902, 1901, 1900, 2106, 2107, 2104, 2105, 2103, 2102, 2101, 2100,
|
||||
//================== 22129
|
||||
1806, 1807, 1804, 1805, 1803, 1802, 1801, 1800, 2306, 2307, 2304, 2305, 2303, 2302, 2301, 2300,
|
||||
10016, 10017, 10018, 10019, 10020, 10021, 10022, 10023, 10024, 10025, 10026, 10027, 10028, 10029, 10030, 10031,
|
||||
10116, 10117, 10118, 10119, 10120, 10121, 10122, 10123, 10124, 10125, 10126, 10127, 10128, 10129, 10130, 10131,
|
||||
10015, 10014, 10013, 10012, 10011, 10010, 10009, 10008, 10007, 10006, 10005, 10004, 10003, 10002, 10001, 10000,
|
||||
//================== 15529
|
||||
10231, 10230, 10229, 10228, 10227, 10226, 10225, 10224, 10223, 10222, 10221, 10220, 10219, 10218, 10217, 10216,
|
||||
10115, 10114, 10113, 10112, 10111, 10110, 10109, 10108, 10107, 10106, 10105, 10104, 10103, 10102, 10101, 10100,
|
||||
10315, 10314, 10313, 10312, 10311, 10310, 10309, 10308, 10307, 10306, 10305, 10304, 10303, 10302, 10301, 10300,
|
||||
10215, 10214, 10213, 10212, 10211, 10210, 10209, 10208, 10207, 10206, 10205, 10204, 10203, 10202, 10201, 10200,
|
||||
//================== 15528
|
||||
10316, 10317, 10318, 10319, 10320, 10321, 10322, 10323, 10324, 10325, 10326, 10327, 10328, 10329, 10330, 10331,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
//================== 334
|
||||
20116, 20117, 20118, 20119, 20120, 20121, 20122, 20123, 20016, 20017, 20018, 20019, 20020, 20021, 20022, 20023,
|
||||
//================== 379
|
||||
20000, 20001, 20002, 20003, 20004, 20005, -1, 20007, 20008, -1, 20010, 20011, 20012, 20013, 20014, 20015,
|
||||
//================== 325
|
||||
20100, 20101, 20102, 20103, 20104, 20105, 20106, 20107, 20108, 20109, 20110, 20111, 20112, 20113, 20114, 20115,
|
||||
//================== 405
|
||||
20006, -1, -1, 20009, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
|
||||
|
||||
// MCP moved from channel 1 to 2 after Run number 322
|
||||
// MCP and Rf moved to ch 0 and 1 after Run number after Run282
|
||||
// moved back to ch
|
||||
void PrintMapping()
|
||||
{
|
||||
};
|
||||
|
||||
void PrintMapping(){
|
||||
|
||||
int digiID = 0;
|
||||
int count = 0;
|
||||
printf("==================== ID-MAP: \n");
|
||||
printf("%11s|", "");
|
||||
for (int i = 0; i < 16; i++)
|
||||
printf("%7d|", i);
|
||||
printf("%11s|", ""); for(int i = 0 ; i < 16; i++ ) printf("%7d|", i);
|
||||
printf("\n");
|
||||
for (int i = 0; i < 12 + 16 * 8; i++)
|
||||
printf("-");
|
||||
for (size_t i = 0; i < mapping.size(); i++)
|
||||
{
|
||||
if ((i) % 16 == 0)
|
||||
{
|
||||
for(int i = 0 ; i < 12 + 16*8; i++ ) printf("-");
|
||||
for(size_t i = 0 ; i < mapping.size(); i ++){
|
||||
if( (i) % 16 == 0 ) {
|
||||
printf("\n");
|
||||
|
||||
if (digiID < nBd)
|
||||
{
|
||||
if (board.at(digiID) > 1000)
|
||||
{
|
||||
if (count == 3)
|
||||
digiID++;
|
||||
if (i % 64 == 0)
|
||||
{
|
||||
if( digiID < nBd ){
|
||||
if( board.at(digiID) > 1000 ) {
|
||||
if( count == 3 ) digiID ++;
|
||||
if( i % 64 == 0 ) {
|
||||
printf("%11d|", board.at(digiID));
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (count == 1)
|
||||
digiID++;
|
||||
if (i % 16 == 0)
|
||||
{
|
||||
}else{
|
||||
if( count == 1 ) digiID ++;
|
||||
if( i % 16 == 0 ) {
|
||||
printf("%11d|", board.at(digiID));
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count != 0)
|
||||
printf("%11s|", "");
|
||||
count++;
|
||||
if( count != 0) printf("%11s|", "");
|
||||
count ++;
|
||||
}
|
||||
|
||||
int typeID = mapping[i] / 10000;
|
||||
int detID = (mapping[i] - typeID * 10000) / 100;
|
||||
int ch = mapping[i] - typeID * 10000 - detID * 100;
|
||||
int detID = (mapping[i] - typeID*10000 )/100;
|
||||
int ch = mapping[i] - typeID*10000 - detID * 100;
|
||||
|
||||
if (mapping[i] == -1)
|
||||
{
|
||||
if( mapping[i] == -1 ) {
|
||||
|
||||
printf("%7s|", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (typeID == 0)
|
||||
{ // SX3
|
||||
}else{
|
||||
|
||||
if( typeID == 0){ // SX3
|
||||
|
||||
printf("\033[36m%3d(%2d)\033[0m|", detID, ch);
|
||||
}
|
||||
else if (typeID == 1)
|
||||
{ // QQQ
|
||||
|
||||
}else if( typeID == 1){ // QQQ
|
||||
|
||||
printf("\033[91m%3d(%2d)\033[0m|", detID, ch);
|
||||
}
|
||||
else if (typeID == 2)
|
||||
{ // PC
|
||||
|
||||
}else if( typeID == 2){ // PC
|
||||
|
||||
printf("\033[35m%3d(%2d)\033[0m|", detID, ch);
|
||||
}
|
||||
else if (typeID == 3)
|
||||
{ // MISC
|
||||
|
||||
printf("\033[33m%3d(%2d)\033[0m|", detID, ch);
|
||||
}else{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
for (int i = 0; i < 12 + 16 * 8; i++)
|
||||
printf("-");
|
||||
for(int i = 0 ; i < 12 + 16*8; i++ ) printf("-");
|
||||
printf("\n");
|
||||
|
||||
}
|
||||
|
||||
void GenMapping(std::string mapFile)
|
||||
{
|
||||
|
||||
void GenMapping(std::string mapFile){
|
||||
|
||||
|
||||
std::vector<int> map;
|
||||
|
||||
std::ifstream inputFile(mapFile); // Replace "your_file.txt" with the actual file path
|
||||
|
||||
if (!inputFile.is_open())
|
||||
{
|
||||
std::ifstream inputFile(mapFile); // Replace "your_file.txt" with the actual file path
|
||||
|
||||
if (!inputFile.is_open()) {
|
||||
printf("Error: Could not open the file (%s).\n", mapFile.c_str());
|
||||
return;
|
||||
return ;
|
||||
}
|
||||
|
||||
std::string line;
|
||||
|
||||
// Read the file line by line
|
||||
while (std::getline(inputFile, line))
|
||||
{
|
||||
while (std::getline(inputFile, line)) {
|
||||
std::vector<std::string> words;
|
||||
std::istringstream iss(line);
|
||||
|
||||
// Extract words from the current line
|
||||
while (true)
|
||||
{
|
||||
while (true) {
|
||||
std::string word;
|
||||
if (!(iss >> word))
|
||||
break; // Break if there are no more words
|
||||
if (!(iss >> word)) break; // Break if there are no more words
|
||||
|
||||
word.erase(std::remove_if(word.begin(), word.end(), ::isspace), word.end());
|
||||
words.push_back(word);
|
||||
|
||||
}
|
||||
|
||||
if (atoi(words[0].c_str()) % 16 == 0)
|
||||
printf("=================\n");
|
||||
if( atoi(words[0].c_str()) % 16 == 0 ) printf("=================\n");
|
||||
|
||||
int detID = atoi(words[1].c_str()) * 100;
|
||||
if (words.size() < 5)
|
||||
printf(" hahhahha %s\n", line.c_str());
|
||||
if (words[2] == "BARREL")
|
||||
{
|
||||
if (words[3] == "FRONTDOWN")
|
||||
{
|
||||
|
||||
int detID = atoi(words[1].c_str())*100;
|
||||
if(words.size() < 5 ) printf(" hahhahha %s\n", line.c_str());
|
||||
if( words[2] == "BARREL" ) {
|
||||
if( words[3] == "FRONTDOWN" ){
|
||||
int chID = atoi(words[4].c_str());
|
||||
if (chID % 2 != 0)
|
||||
chID -= 1;
|
||||
if( chID % 2 != 0 ) chID -= 1;
|
||||
detID += chID;
|
||||
}
|
||||
|
||||
if (words[3] == "FRONTUP")
|
||||
{
|
||||
if( words[3] == "FRONTUP" ){
|
||||
int chID = atoi(words[4].c_str());
|
||||
if (chID % 2 == 0)
|
||||
chID += 1;
|
||||
if( chID % 2 == 0 ) chID += 1;
|
||||
detID += chID;
|
||||
}
|
||||
|
||||
if (words[3] == "BACK")
|
||||
detID += atoi(words[4].c_str()) + 8;
|
||||
if( words[3] == "BACK") detID += atoi(words[4].c_str()) + 8;
|
||||
}
|
||||
|
||||
if (words[2] == "FQQQ")
|
||||
{
|
||||
if( words[2] == "FQQQ" ) {
|
||||
detID += 10000;
|
||||
if (words[3] == "WEDGE")
|
||||
detID += atoi(words[4].c_str());
|
||||
if (words[3] == "RING")
|
||||
detID += atoi(words[4].c_str()) + 16;
|
||||
if( words[3] == "WEDGE") detID += atoi(words[4].c_str());
|
||||
if( words[3] == "RING") detID += atoi(words[4].c_str()) + 16;
|
||||
}
|
||||
|
||||
if (words[2] == "PC")
|
||||
{
|
||||
if( words[2] == "PC" ) {
|
||||
detID += 20000;
|
||||
if (words[3] == "ANODE")
|
||||
detID += atoi(words[4].c_str());
|
||||
if (words[3] == "CATHODE")
|
||||
detID += 100 + atoi(words[4].c_str());
|
||||
if( words[3] == "ANODE") detID += atoi(words[4].c_str());
|
||||
if( words[3] == "CATHODE") detID += 100 + atoi(words[4].c_str());
|
||||
|
||||
}
|
||||
|
||||
if(words[2] == "MISC")
|
||||
{
|
||||
detID += 30000;
|
||||
}
|
||||
|
||||
if (words[2] == "blank")
|
||||
{
|
||||
if( words[2] == "blank") {
|
||||
detID = -1;
|
||||
}
|
||||
|
||||
|
|
@ -282,42 +234,29 @@ void GenMapping(std::string mapFile)
|
|||
int digiID = 0;
|
||||
int count = 0;
|
||||
printf("===============================\n");
|
||||
for (size_t i = 0; i < ((map.size() + 15) / 16) * 16; i++)
|
||||
{
|
||||
if (i % 16 == 0)
|
||||
{
|
||||
for( size_t i = 0; i < ((map.size() +15)/16) * 16; i++){
|
||||
if( i % 16 == 0) {
|
||||
printf("\n");
|
||||
if (digiID < nBd)
|
||||
{
|
||||
if (board.at(digiID) > 1000)
|
||||
{
|
||||
if (count == 3)
|
||||
digiID++;
|
||||
if (i % 64 == 0)
|
||||
{
|
||||
if( digiID < nBd ){
|
||||
if( board.at(digiID) > 1000 ) {
|
||||
if( count == 3 ) digiID ++;
|
||||
if( i % 64 == 0 ) {
|
||||
printf(" //================== %d\n", board.at(digiID));
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (count == 1)
|
||||
digiID++;
|
||||
if (i % 16 == 0)
|
||||
{
|
||||
}else{
|
||||
if( count == 1 ) digiID ++;
|
||||
if( i % 16 == 0 ) {
|
||||
printf(" //================== %d\n", board.at(digiID));
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
count++;
|
||||
count ++;
|
||||
}
|
||||
if (i < map.size())
|
||||
{
|
||||
if( i < map.size() ){
|
||||
printf(" %5d,", map[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
}else{
|
||||
printf(" %5d,", -1);
|
||||
}
|
||||
}
|
||||
|
|
@ -326,14 +265,13 @@ void GenMapping(std::string mapFile)
|
|||
printf("sorting mapping and see if there any repeated\n");
|
||||
std::sort(map.begin(), map.end());
|
||||
|
||||
for (size_t i = 1; i < map.size(); i++)
|
||||
{
|
||||
if (map[i] == -1)
|
||||
continue;
|
||||
if (map[i] == map[i - 1])
|
||||
printf("%5d \n", map[i]);
|
||||
for( size_t i = 1; i < map.size(); i++){
|
||||
if( map[i] == -1 ) continue;
|
||||
if( map[i] == map[i-1] ) printf("%5d \n", map[i]);
|
||||
}
|
||||
printf("=========== Done. if nothing show, no repeat. \n");
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -302,22 +302,22 @@
|
|||
301 1 FQQQ RING 13
|
||||
302 1 FQQQ RING 14
|
||||
303 1 FQQQ RING 15
|
||||
304 1 FQQQ WEDGE 0
|
||||
305 1 FQQQ WEDGE 1
|
||||
306 1 FQQQ WEDGE 2
|
||||
307 1 FQQQ WEDGE 3
|
||||
308 1 FQQQ WEDGE 4
|
||||
309 1 FQQQ WEDGE 5
|
||||
310 1 FQQQ WEDGE 6
|
||||
311 1 FQQQ WEDGE 7
|
||||
312 1 FQQQ WEDGE 8
|
||||
313 1 FQQQ WEDGE 9
|
||||
314 1 FQQQ WEDGE 10
|
||||
315 1 FQQQ WEDGE 11
|
||||
316 1 FQQQ WEDGE 12
|
||||
317 1 FQQQ WEDGE 13
|
||||
318 1 FQQQ WEDGE 14
|
||||
319 1 FQQQ WEDGE 15
|
||||
304 1 FQQQ WEDGE 15
|
||||
305 1 FQQQ WEDGE 14
|
||||
306 1 FQQQ WEDGE 13
|
||||
307 1 FQQQ WEDGE 12
|
||||
308 1 FQQQ WEDGE 11
|
||||
309 1 FQQQ WEDGE 10
|
||||
310 1 FQQQ WEDGE 9
|
||||
311 1 FQQQ WEDGE 8
|
||||
312 1 FQQQ WEDGE 7
|
||||
313 1 FQQQ WEDGE 6
|
||||
314 1 FQQQ WEDGE 5
|
||||
315 1 FQQQ WEDGE 4
|
||||
316 1 FQQQ WEDGE 3
|
||||
317 1 FQQQ WEDGE 2
|
||||
318 1 FQQQ WEDGE 1
|
||||
319 1 FQQQ WEDGE 0
|
||||
320 2 FQQQ RING 15
|
||||
321 2 FQQQ RING 14
|
||||
322 2 FQQQ RING 13
|
||||
|
|
@ -366,22 +366,22 @@
|
|||
365 2 FQQQ WEDGE 2
|
||||
366 2 FQQQ WEDGE 1
|
||||
367 2 FQQQ WEDGE 0
|
||||
368 3 FQQQ WEDGE 0
|
||||
369 3 FQQQ WEDGE 1
|
||||
370 3 FQQQ WEDGE 2
|
||||
371 3 FQQQ WEDGE 3
|
||||
372 3 FQQQ WEDGE 4
|
||||
373 3 FQQQ WEDGE 5
|
||||
374 3 FQQQ WEDGE 6
|
||||
375 3 FQQQ WEDGE 7
|
||||
376 3 FQQQ WEDGE 8
|
||||
377 3 FQQQ WEDGE 9
|
||||
378 3 FQQQ WEDGE 10
|
||||
379 3 FQQQ WEDGE 11
|
||||
380 3 FQQQ WEDGE 12
|
||||
381 3 FQQQ WEDGE 13
|
||||
382 3 FQQQ WEDGE 14
|
||||
383 3 FQQQ WEDGE 15
|
||||
368 3 FQQQ WEDGE 15
|
||||
369 3 FQQQ WEDGE 14
|
||||
370 3 FQQQ WEDGE 13
|
||||
371 3 FQQQ WEDGE 12
|
||||
372 3 FQQQ WEDGE 11
|
||||
373 3 FQQQ WEDGE 10
|
||||
374 3 FQQQ WEDGE 9
|
||||
375 3 FQQQ WEDGE 8
|
||||
376 3 FQQQ WEDGE 7
|
||||
377 3 FQQQ WEDGE 6
|
||||
378 3 FQQQ WEDGE 5
|
||||
379 3 FQQQ WEDGE 4
|
||||
380 3 FQQQ WEDGE 3
|
||||
381 3 FQQQ WEDGE 2
|
||||
382 3 FQQQ WEDGE 1
|
||||
383 3 FQQQ WEDGE 0
|
||||
384 3 FQQQ RING 0
|
||||
385 3 FQQQ RING 1
|
||||
386 3 FQQQ RING 2
|
||||
|
|
|
|||
|
|
@ -1,67 +0,0 @@
|
|||
void anode_gainmatch(){
|
||||
TFile *f = new TFile("../results_run16.root");
|
||||
|
||||
TH2F *pc_index_h2d = (TH2F*)(f->Get("hRawPC/PC_Index_Vs_Energy"));
|
||||
std::cout << pc_index_h2d << std::endl;
|
||||
TCanvas c("c1","c1",0,0,1600,800);
|
||||
//TCanvas c_g("cg","cg",0,900,400,400);
|
||||
c.Divide(2,1);
|
||||
auto c1=c.cd(1);
|
||||
pc_index_h2d->Draw("COLZ");
|
||||
pc_index_h2d->GetYaxis()->SetRangeUser(240,5000);
|
||||
auto c2=c.cd(2);
|
||||
c2->SetLogy();
|
||||
TH1F *h_1d=NULL;
|
||||
int bin_index=1;
|
||||
std::vector<std::vector<double>> all_peaks;
|
||||
std::vector<int> found_wire_list;
|
||||
while(bin_index<=24) {
|
||||
h_1d=(TH1F*)(pc_index_h2d->ProjectionY("_py",bin_index,bin_index));
|
||||
auto c1 = c.cd(1);
|
||||
TBox box(pc_index_h2d->GetXaxis()->GetBinLowEdge(bin_index),0,pc_index_h2d->GetXaxis()->GetBinUpEdge(bin_index),pc_index_h2d->GetYaxis()->GetXmax());
|
||||
box.SetFillColorAlpha(kYellow+3,0.3);
|
||||
box.Draw("SAME");
|
||||
c1->Modified(); c1->Update();
|
||||
//while(c1->WaitPrimitive());
|
||||
|
||||
TSpectrum s;
|
||||
auto c2 = c.cd(2);
|
||||
h_1d->Draw();
|
||||
c2->Modified(); c2->Update();
|
||||
int npeaks = s.Search(h_1d,8,"",0.02); std::cout << npeaks << std::endl;
|
||||
if(npeaks>=3) {
|
||||
std::vector<double> xpeaks(s.GetPositionX(),s.GetPositionX()+npeaks);
|
||||
std::sort(xpeaks.begin(),xpeaks.end(),std::greater());
|
||||
found_wire_list.push_back((int)pc_index_h2d->GetXaxis()->GetBinCenter(bin_index));
|
||||
all_peaks.push_back(xpeaks);
|
||||
}
|
||||
while(c2->WaitPrimitive());
|
||||
bin_index++;
|
||||
}
|
||||
c.cd(2)->SetLogy(kFALSE);
|
||||
gStyle->SetOptFit(1111);
|
||||
|
||||
std::ofstream outfile("anode_gm_coeffs.dat");
|
||||
outfile << found_wire_list.at(0) << " "
|
||||
<< 1.0 << " "
|
||||
<< 0.0 << std::endl;
|
||||
|
||||
for(int i=0; i<all_peaks.size(); i++){
|
||||
if(i==1) continue;
|
||||
TGraph g(all_peaks.at(i).size(), all_peaks.at(i).data(), all_peaks.at(1).data());
|
||||
auto c2 = c.cd(2);
|
||||
g.SetMarkerStyle(20);
|
||||
//g.Print();
|
||||
g.Draw("AP");
|
||||
g.Fit("pol1");
|
||||
outfile << found_wire_list.at(i) << " "
|
||||
<< ((TF1*)g.FindObject("pol1"))->GetParameter(1) << " "
|
||||
<< ((TF1*)g.FindObject("pol1"))->GetParameter(0) << std::endl;
|
||||
c2->Modified();
|
||||
c2->Update();
|
||||
while(c2->WaitPrimitive());
|
||||
}
|
||||
outfile.close();
|
||||
f->Close();
|
||||
return;
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
0 1 0
|
||||
0 0.937314 -16.871
|
||||
2 0.965461 -1.54376
|
||||
3 0.926501 -3.27662
|
||||
4 0.905634 2.54577
|
||||
5 0.905634 -11.0387
|
||||
6 0.853919 6.23079
|
||||
7 0.945588 -9.54044
|
||||
8 0.884454 -11.8262
|
||||
9 0.922501 -3.42538
|
||||
10 0.903053 9.28069
|
||||
11 0.914653 9.87642
|
||||
12 0.965332 13.2526
|
||||
13 0.923847 -3.41775
|
||||
14 0.93845 25.9901
|
||||
15 0.955424 12.324
|
||||
16 0.95116 4.99595
|
||||
17 0.910745 2.86648
|
||||
18 0.941376 4.57217
|
||||
19 0.871622 932.111
|
||||
20 1.00624 7.86358
|
||||
21 0.969834 -45.001
|
||||
22 0.89304 -31.5635
|
||||
23 0.933226 4.02193
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
void cathode_gainmatch(){
|
||||
TFile *f = new TFile("../results_run17.root");
|
||||
TH2F *pc_index_h2d = (TH2F*)(f->Get("hRawPC/PC_Index_Vs_Energy"));
|
||||
std::cout << pc_index_h2d << std::endl;
|
||||
TCanvas c("c1","c1",0,0,1600,800);
|
||||
//TCanvas c_g("cg","cg",0,900,400,400);
|
||||
c.Divide(2,1);
|
||||
auto c1=c.cd(1);
|
||||
pc_index_h2d->Draw("COLZ");
|
||||
pc_index_h2d->GetYaxis()->SetRangeUser(600,pc_index_h2d->GetYaxis()->GetXmax());
|
||||
auto c2=c.cd(2);
|
||||
c2->SetLogy();
|
||||
TH1F *h_1d=NULL;
|
||||
int bin_index=25;
|
||||
std::vector<double> pulser_heights = {0.01,0.05,0.1,0.15,0.2,0.25,0.3,0.5};
|
||||
std::vector<std::vector<double>> all_peaks;
|
||||
std::vector<int> found_wire_list;
|
||||
while(bin_index<=48) {
|
||||
h_1d=(TH1F*)(pc_index_h2d->ProjectionY("_py",bin_index,bin_index));
|
||||
auto c1 = c.cd(1);
|
||||
TBox box(pc_index_h2d->GetXaxis()->GetBinLowEdge(bin_index),0,pc_index_h2d->GetXaxis()->GetBinUpEdge(bin_index),pc_index_h2d->GetYaxis()->GetXmax());
|
||||
box.SetFillColorAlpha(kYellow+3,0.3);
|
||||
box.Draw("SAME");
|
||||
c1->Modified(); c1->Update();
|
||||
//while(c1->WaitPrimitive());
|
||||
|
||||
TSpectrum s;
|
||||
auto c2 = c.cd(2);
|
||||
h_1d->Draw();
|
||||
c2->Modified(); c2->Update();
|
||||
int npeaks = s.Search(h_1d,20,"",0.1); std::cout << npeaks << std::endl;
|
||||
if(npeaks==8) {
|
||||
std::vector<double> xpeaks(s.GetPositionX(),s.GetPositionX()+npeaks);
|
||||
for(int i=0; i<8; i++) {
|
||||
std::cout << pc_index_h2d->GetXaxis()->GetBinCenter(bin_index) << " " << xpeaks.at(i) << " " << xpeaks.at(i)/pulser_heights.at(i) << std::endl;
|
||||
}
|
||||
std::sort(xpeaks.begin(),xpeaks.end(),std::greater());
|
||||
found_wire_list.push_back((int)pc_index_h2d->GetXaxis()->GetBinCenter(bin_index));
|
||||
all_peaks.push_back(xpeaks);
|
||||
}
|
||||
while(c2->WaitPrimitive());
|
||||
bin_index++;
|
||||
}
|
||||
c.cd(2)->SetLogy(kFALSE);
|
||||
gStyle->SetOptFit(1111);
|
||||
|
||||
std::ofstream outfile("cathode_gm_coeffs.dat");
|
||||
outfile << found_wire_list.at(0) << " "
|
||||
<< 1.0 << " "
|
||||
<< 0.0 << std::endl;
|
||||
|
||||
for(int i=1; i<all_peaks.size(); i++){
|
||||
TGraph g(all_peaks.at(i).size(), all_peaks.at(i).data(), all_peaks.at(0).data());
|
||||
auto c2 = c.cd(2);
|
||||
g.SetMarkerStyle(20);
|
||||
//g.Print();
|
||||
g.Draw("AP");
|
||||
g.Fit("pol1");
|
||||
outfile << found_wire_list.at(i) << " "
|
||||
<< ((TF1*)g.FindObject("pol1"))->GetParameter(1) << " "
|
||||
<< ((TF1*)g.FindObject("pol1"))->GetParameter(0) << std::endl;
|
||||
c2->Modified();
|
||||
c2->Update();
|
||||
while(c2->WaitPrimitive());
|
||||
}
|
||||
outfile.close();
|
||||
f->Close();
|
||||
return;
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
24 1 0
|
||||
25 0.941896 6.16135
|
||||
26 0.980284 2.86886
|
||||
27 0.983166 -3.82952
|
||||
28 0.978704 -2.89713
|
||||
29 0.964947 2.25786
|
||||
30 0.94514 0.925074
|
||||
31 0.977231 1.6493
|
||||
32 0.919527 5.82742
|
||||
33 0.972243 2.88061
|
||||
34 0.928892 7.61384
|
||||
35 0.947376 -0.644223
|
||||
36 0.875342 6.066
|
||||
38 0.970953 6.262
|
||||
40 0.918408 -3.27891
|
||||
41 0.913619 4.11288
|
||||
42 0.954083 2.21261
|
||||
43 0.993037 5.48924
|
||||
45 0.926406 -19.719
|
||||
46 1.00459 5.14574
|
||||
47 0.942483 5.54183
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
#Histogram Number Slope Intercept
|
||||
0 0.937314 -16.871
|
||||
1 0 0
|
||||
2 0.965461 -1.54376
|
||||
3 0.926501 -3.27662
|
||||
4 0.905634 2.54577
|
||||
5 0.905634 -11.0387
|
||||
6 0.853919 6.23079
|
||||
7 0.945588 -9.54044
|
||||
8 0.884454 -11.8262
|
||||
9 0.922501 -3.42538
|
||||
10 0.903053 9.28069
|
||||
11 0.914653 9.87642
|
||||
12 0.965332 13.2526
|
||||
13 0.923847 -3.41775
|
||||
14 0.93845 25.9901
|
||||
15 0.955424 12.324
|
||||
16 0.95116 4.99595
|
||||
17 0.910745 2.86648
|
||||
18 0.941376 4.57217
|
||||
19 0.871622 932.111
|
||||
20 1.00624 7.86358
|
||||
21 0.969834 -45.001
|
||||
22 0.89304 -31.5635
|
||||
23 0.933226 4.02193
|
||||
24 0 0
|
||||
25 0.941896 6.16135
|
||||
26 0.980284 2.86886
|
||||
27 0.983166 -3.82952
|
||||
28 0.978704 -2.89713
|
||||
29 0.964947 2.25786
|
||||
30 0.94514 0.925074
|
||||
31 0.977231 1.6493
|
||||
32 0.919527 5.82742
|
||||
33 0.972243 2.88061
|
||||
34 0.928892 7.61384
|
||||
35 0.947376 -0.644223
|
||||
36 0.875342 6.066
|
||||
37 0 0
|
||||
38 0.970953 6.262
|
||||
39 0 0
|
||||
40 0.918408 -3.27891
|
||||
41 0.913619 4.11288
|
||||
42 0.954083 2.21261
|
||||
43 0.993037 5.48924
|
||||
44 0 0
|
||||
45 0.926406 -19.719
|
||||
46 1.00459 5.14574
|
||||
47 0.942483 5.54183
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
#Histogram Number Slope Intercept
|
||||
#Histogram Number Slope Intercept
|
||||
0 0.931015 -1.35431
|
||||
1 1 -1.87356e-10
|
||||
2 0.964185 1.49989
|
||||
3 0.92638 -1.30621
|
||||
4 0.905569 1.00834
|
||||
5 0.901182 0.470903
|
||||
6 0.853932 3.32687
|
||||
7 0.942785 1.08887
|
||||
8 0.878904 -0.0107433
|
||||
9 0.922662 -2.32259
|
||||
10 0.903343 8.38332
|
||||
11 0.914227 6.56108
|
||||
12 0.961008 23.0982
|
||||
13 0.920976 5.22104
|
||||
14 0.936584 31.5073
|
||||
15 0.959044 5.43267
|
||||
16 0.95263 -0.404053
|
||||
17 0.90953 4.82833
|
||||
18 0.940277 10.3629
|
||||
19 0.86746 -17.8678
|
||||
20 1.00683 4.76371
|
||||
21 0.968342 -43.9496
|
||||
22 0.892882 -32.0742
|
||||
23 0.933615 1.10704
|
||||
24 1 -2.89219e-10
|
||||
25 0.942098 -0.105169
|
||||
26 0.980862 -0.732032
|
||||
27 0.982975 -2.22704
|
||||
28 0.978815 -1.51477
|
||||
29 0.965245 -2.19515
|
||||
30 0.945384 -0.892599
|
||||
31 0.977408 -0.908592
|
||||
32 0.919546 3.25464
|
||||
33 0.972194 2.44956
|
||||
34 0.92852 5.44745
|
||||
35 0.947098 1.40531
|
||||
36 0.875491 -1.13145
|
||||
37 1 0
|
||||
38 0.970862 2.86019
|
||||
39 1 0
|
||||
40 0.91793 -3.80615
|
||||
41 0.913897 -2.12964
|
||||
42 0.954014 -0.760604
|
||||
43 0.993616 -1.40278
|
||||
44 1 0
|
||||
45 0.926169 -21.2016
|
||||
46 1.00577 -2.14281
|
||||
47 0.943312 -1.26464
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# ==========================================
|
||||
# CONFIGURATION
|
||||
# ==========================================
|
||||
DATA_DIR="/mnt/d/Remapped_files/17F_data/root_data"
|
||||
MACRO="TrackRecon.C"
|
||||
|
||||
# SAFETY SETTINGS
|
||||
JOBS=2 # Keep low (2-4) to prevent WSL crashes
|
||||
MIN_MEM="1G" # Wait if RAM is full
|
||||
# ==========================================
|
||||
|
||||
# 1. CHECK ARGUMENTS
|
||||
if [ "$#" -ne 2 ]; then
|
||||
echo "Usage: $0 <Start_Run> <End_Run>"
|
||||
echo "Example: $0 10 50"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
START_RUN=$1
|
||||
END_RUN=$2
|
||||
|
||||
# 2. COMPILE MACRO
|
||||
# Compiling once is mandatory for parallel execution
|
||||
echo "Compiling ${MACRO}..."
|
||||
root -l -b -q -e "gROOT->ProcessLine(\".L ${MACRO}+\");"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: Compilation failed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 3. DEFINE WORKER FUNCTION
|
||||
run_job() {
|
||||
file_path="$1"
|
||||
macro_name="$2"
|
||||
|
||||
echo "Processing: $file_path"
|
||||
|
||||
# Execute ROOT
|
||||
nice -n 15 root -l -x -b -q "$file_path" -e "tree->Process(\"${macro_name}+\");" > "${file_path}.log" 2>&1
|
||||
}
|
||||
export -f run_job
|
||||
|
||||
# 4. QUEUE BUILDER (The "Skip" Logic is here)
|
||||
echo "Checking runs $START_RUN to $END_RUN..."
|
||||
|
||||
for (( i=$START_RUN; i<=$END_RUN; i++ ))
|
||||
do
|
||||
# Construct the input filename
|
||||
# Logic: Run_0 + number -> Run_0115
|
||||
file="${DATA_DIR}/Run_${i}_mapped.root"
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# SKIP LOGIC
|
||||
# We check if the log file exists. If so, we assume it's done.
|
||||
# ------------------------------------------------------------
|
||||
log_file="${file}.log"
|
||||
|
||||
if [ -f "$log_file" ]; then
|
||||
# >&2 redirects to stderr so it doesn't get fed into 'parallel'
|
||||
echo "Skipping Run $i: Log file already exists." >&2
|
||||
continue
|
||||
fi
|
||||
|
||||
# Only add to queue if the INPUT file actually exists
|
||||
if [ -f "$file" ]; then
|
||||
echo "$file"
|
||||
else
|
||||
echo "Warning: Input file for run $i not found." >&2
|
||||
fi
|
||||
|
||||
done | parallel --jobs $JOBS --memfree $MIN_MEM --retries 2 run_job {} "$MACRO"
|
||||
760
qqq_Calib.dat
760
qqq_Calib.dat
|
|
@ -1,760 +0,0 @@
|
|||
0 0 0 3.34288
|
||||
0 1 0 3.29257
|
||||
0 2 0 3.31126
|
||||
0 3 0 3.28022
|
||||
0 4 0 3.29877
|
||||
0 5 0 3.29877
|
||||
0 6 0 3.305
|
||||
0 7 0 3.305
|
||||
0 8 0 3.26797
|
||||
0 9 0 3.32384
|
||||
0 10 0 3.31126
|
||||
0 11 0 3.32384
|
||||
0 12 0 3.29877
|
||||
0 13 0 3.31126
|
||||
0 14 0 3.28022
|
||||
0 15 0 3.27409
|
||||
0 0 2 3.44828
|
||||
0 1 2 3.53179
|
||||
0 2 2 3.53179
|
||||
0 3 2 3.44149
|
||||
0 4 2 3.48259
|
||||
0 5 2 3.47567
|
||||
0 6 2 3.48953
|
||||
0 7 2 3.45508
|
||||
0 8 2 3.46878
|
||||
0 9 2 3.46192
|
||||
0 10 2 3.45508
|
||||
0 11 2 3.46192
|
||||
0 12 2 3.48259
|
||||
0 13 2 3.5035
|
||||
0 14 2 3.4965
|
||||
0 15 2 3.46878
|
||||
0 0 3 3.2022
|
||||
0 1 3 3.20807
|
||||
0 2 3 3.23176
|
||||
0 3 3 3.23176
|
||||
0 4 3 3.23774
|
||||
0 5 3 3.20807
|
||||
0 6 3 3.19635
|
||||
0 7 3 3.21987
|
||||
0 8 3 3.18471
|
||||
0 9 3 3.21396
|
||||
0 10 3 3.19635
|
||||
0 11 3 3.20807
|
||||
0 12 3 3.18471
|
||||
0 13 3 3.22581
|
||||
0 14 3 3.19635
|
||||
0 15 3 3.19635
|
||||
0 0 4 3.33016
|
||||
0 1 4 3.32384
|
||||
0 2 4 3.32384
|
||||
0 3 4 3.37512
|
||||
0 4 4 3.39476
|
||||
0 5 4 3.305
|
||||
0 6 4 3.33016
|
||||
0 7 4 3.34928
|
||||
0 8 4 3.31126
|
||||
0 9 4 3.31754
|
||||
0 10 4 3.33651
|
||||
0 11 4 3.31126
|
||||
0 12 4 3.32384
|
||||
0 13 4 3.305
|
||||
0 14 4 3.34928
|
||||
0 15 4 3.31754
|
||||
0 0 5 3.31754
|
||||
0 1 5 3.33651
|
||||
0 2 5 3.34928
|
||||
0 3 5 3.33016
|
||||
0 4 5 3.40136
|
||||
0 5 5 3.41463
|
||||
0 6 5 3.33651
|
||||
0 7 5 3.36215
|
||||
0 8 5 3.36862
|
||||
0 9 5 3.34288
|
||||
0 10 5 3.32384
|
||||
0 11 5 3.31754
|
||||
0 12 5 3.33016
|
||||
0 13 5 3.36862
|
||||
0 14 5 3.31754
|
||||
0 15 5 3.32384
|
||||
0 0 6 3.36215
|
||||
0 1 6 3.37512
|
||||
0 2 6 3.3557
|
||||
0 3 6 3.3557
|
||||
0 4 6 3.34928
|
||||
0 5 6 3.40798
|
||||
0 6 6 3.39476
|
||||
0 7 6 3.31754
|
||||
0 8 6 3.33016
|
||||
0 9 6 3.34928
|
||||
0 10 6 3.33651
|
||||
0 11 6 3.33651
|
||||
0 12 6 3.34288
|
||||
0 13 6 3.3557
|
||||
0 14 6 3.34288
|
||||
0 15 6 3.34928
|
||||
0 0 7 4.2735
|
||||
0 1 7 4.24242
|
||||
0 2 7 4.21179
|
||||
0 3 7 4.21179
|
||||
0 4 7 4.21179
|
||||
0 5 7 4.19162
|
||||
0 6 7 4.31566
|
||||
0 7 7 4.24242
|
||||
0 8 7 4.1816
|
||||
0 9 7 4.21179
|
||||
0 10 7 4.22195
|
||||
0 11 7 4.22195
|
||||
0 12 7 4.1816
|
||||
0 13 7 4.21179
|
||||
0 14 7 4.19162
|
||||
0 15 7 4.28397
|
||||
0 0 8 3.51053
|
||||
0 1 8 3.52467
|
||||
0 2 8 3.5035
|
||||
0 3 8 3.4965
|
||||
0 4 8 3.48953
|
||||
0 5 8 3.53179
|
||||
0 6 8 3.4965
|
||||
0 7 8 3.56779
|
||||
0 8 8 3.56779
|
||||
0 9 8 3.48953
|
||||
0 10 8 3.5035
|
||||
0 11 8 3.48259
|
||||
0 12 8 3.5035
|
||||
0 13 8 3.47567
|
||||
0 14 8 3.48953
|
||||
0 15 8 3.48953
|
||||
0 0 9 3.39476
|
||||
0 1 9 3.41463
|
||||
0 2 9 3.42131
|
||||
0 3 9 3.40798
|
||||
0 4 9 3.39476
|
||||
0 5 9 3.42801
|
||||
0 6 9 3.42131
|
||||
0 7 9 3.44149
|
||||
0 8 9 3.48259
|
||||
0 9 9 3.44149
|
||||
0 10 9 3.41463
|
||||
0 11 9 3.41463
|
||||
0 12 9 3.42801
|
||||
0 13 9 3.39476
|
||||
0 14 9 3.42131
|
||||
0 15 9 3.42131
|
||||
0 0 10 3.59712
|
||||
0 1 10 3.56053
|
||||
0 2 10 3.52467
|
||||
0 3 10 3.5533
|
||||
0 4 10 3.57508
|
||||
0 5 10 3.53893
|
||||
0 6 10 3.56053
|
||||
0 7 10 3.5533
|
||||
0 8 10 3.5461
|
||||
0 9 10 3.56779
|
||||
0 10 10 3.63448
|
||||
0 11 10 3.56779
|
||||
0 12 10 3.5824
|
||||
0 13 10 3.5533
|
||||
0 14 10 3.5824
|
||||
0 15 10 3.53179
|
||||
0 0 11 3.44149
|
||||
0 1 11 3.41463
|
||||
0 2 11 3.39476
|
||||
0 3 11 3.3557
|
||||
0 4 11 3.40798
|
||||
0 5 11 3.40136
|
||||
0 6 11 3.40136
|
||||
0 7 11 3.38164
|
||||
0 8 11 3.38164
|
||||
0 9 11 3.40136
|
||||
0 10 11 3.45508
|
||||
0 11 11 3.46192
|
||||
0 12 11 3.42131
|
||||
0 13 11 3.40798
|
||||
0 14 11 3.38819
|
||||
0 15 11 3.43474
|
||||
0 0 12 3.40798
|
||||
0 1 12 3.42131
|
||||
0 2 12 3.42801
|
||||
0 3 12 3.42801
|
||||
0 4 12 3.42131
|
||||
0 5 12 3.44149
|
||||
0 6 12 3.44149
|
||||
0 7 12 3.44828
|
||||
0 8 12 3.44149
|
||||
0 9 12 3.42801
|
||||
0 10 12 3.42801
|
||||
0 11 12 3.48953
|
||||
0 12 12 3.47567
|
||||
0 13 12 3.44149
|
||||
0 14 12 3.42801
|
||||
0 15 12 3.44828
|
||||
0 0 13 3.65726
|
||||
0 1 13 3.62694
|
||||
0 2 13 3.68034
|
||||
0 3 13 3.59712
|
||||
0 4 13 3.66492
|
||||
0 5 13 3.65726
|
||||
0 6 13 3.61197
|
||||
0 7 13 3.67261
|
||||
0 8 13 3.68809
|
||||
0 9 13 3.63448
|
||||
0 10 13 3.67261
|
||||
0 11 13 3.68034
|
||||
0 12 13 3.71156
|
||||
0 13 13 3.72737
|
||||
0 14 13 3.65726
|
||||
0 15 13 3.64964
|
||||
0 0 14 3.56779
|
||||
0 1 14 3.56779
|
||||
0 2 14 3.51759
|
||||
0 3 14 3.47567
|
||||
0 4 14 3.4965
|
||||
0 5 14 3.51053
|
||||
0 6 14 3.51759
|
||||
0 7 14 3.48953
|
||||
0 8 14 3.51053
|
||||
0 9 14 3.53893
|
||||
0 10 14 3.53893
|
||||
0 11 14 3.69588
|
||||
0 12 14 3.47567
|
||||
0 13 14 3.7037
|
||||
0 14 14 3.71156
|
||||
0 15 14 3.5533
|
||||
0 0 15 39.3258
|
||||
0 1 15 3.42131
|
||||
0 2 15 3.42131
|
||||
0 3 15 3.48953
|
||||
0 4 15 3.38164
|
||||
0 5 15 3.43474
|
||||
0 6 15 3.37512
|
||||
0 7 15 3.38164
|
||||
0 8 15 28
|
||||
0 9 15 33.9806
|
||||
0 10 15 3.37512
|
||||
0 11 15 3.33016
|
||||
0 12 15 3.36862
|
||||
0 13 15 29.4118
|
||||
0 14 15 36.8421
|
||||
0 15 15 34.6535
|
||||
1 0 0 3.22581
|
||||
1 1 0 3.21396
|
||||
1 2 0 3.17893
|
||||
1 3 0 3.20807
|
||||
1 7 0 3.18471
|
||||
1 8 0 3.16742
|
||||
1 0 1 3.29877
|
||||
1 1 1 3.33016
|
||||
1 2 1 3.29257
|
||||
1 3 1 3.305
|
||||
1 7 1 3.29877
|
||||
1 8 1 3.305
|
||||
1 0 2 3.25581
|
||||
1 1 2 3.28022
|
||||
1 2 2 3.27409
|
||||
1 3 2 3.23774
|
||||
1 7 2 3.21396
|
||||
1 8 2 3.24374
|
||||
1 0 3 3.18471
|
||||
1 1 3 3.1617
|
||||
1 2 3 3.20807
|
||||
1 3 3 3.22581
|
||||
1 7 3 3.18471
|
||||
1 8 3 3.15032
|
||||
1 0 4 3.21987
|
||||
1 1 4 3.23176
|
||||
1 2 4 3.21987
|
||||
1 3 4 3.24977
|
||||
1 7 4 3.22581
|
||||
1 8 4 3.24977
|
||||
1 0 5 3.17893
|
||||
1 1 5 3.17893
|
||||
1 2 5 3.17316
|
||||
1 3 5 3.18471
|
||||
1 7 5 3.19052
|
||||
1 8 5 3.1617
|
||||
1 0 6 3.29257
|
||||
1 1 6 3.29257
|
||||
1 2 6 3.33016
|
||||
1 3 6 3.32384
|
||||
1 7 6 3.31754
|
||||
1 8 6 3.305
|
||||
1 0 7 3.61944
|
||||
1 1 7 3.61197
|
||||
1 2 7 3.61197
|
||||
1 3 7 3.59712
|
||||
1 7 7 3.68809
|
||||
1 8 7 3.64964
|
||||
1 0 8 3.23774
|
||||
1 1 8 3.25581
|
||||
1 2 8 3.26188
|
||||
1 3 8 3.26188
|
||||
1 7 8 3.26797
|
||||
1 8 8 3.28022
|
||||
1 0 9 3.33651
|
||||
1 1 9 3.33016
|
||||
1 2 9 3.3557
|
||||
1 3 9 3.34928
|
||||
1 7 9 3.36862
|
||||
1 8 9 3.37512
|
||||
1 0 10 3.38819
|
||||
1 1 10 3.42131
|
||||
1 2 10 3.42801
|
||||
1 3 10 3.42801
|
||||
1 7 10 3.38164
|
||||
1 8 10 3.41463
|
||||
1 0 11 3.21987
|
||||
1 1 11 3.24374
|
||||
1 2 11 3.23774
|
||||
1 3 11 3.21987
|
||||
1 7 11 3.21987
|
||||
1 8 11 3.23774
|
||||
1 0 12 3.21987
|
||||
1 1 12 3.17893
|
||||
1 2 12 3.19635
|
||||
1 3 12 3.23774
|
||||
1 7 12 3.21396
|
||||
1 8 12 3.20807
|
||||
1 0 13 3.61197
|
||||
1 1 13 3.62694
|
||||
1 2 13 3.65726
|
||||
1 3 13 3.64964
|
||||
1 7 13 3.5824
|
||||
1 8 13 3.62694
|
||||
1 0 14 3.14465
|
||||
1 1 14 3.15032
|
||||
1 2 14 3.18471
|
||||
1 3 14 3.14465
|
||||
1 7 14 3.14465
|
||||
1 8 14 3.156
|
||||
1 0 15 3.51759
|
||||
1 1 15 3.53893
|
||||
1 2 15 3.48953
|
||||
1 3 15 3.43474
|
||||
1 7 15 3.52467
|
||||
1 8 15 3.62694
|
||||
2 0 0 2.83401
|
||||
2 1 0 2.75374
|
||||
2 2 0 2.76243
|
||||
2 3 0 2.75374
|
||||
2 4 0 2.77118
|
||||
2 5 0 2.78441
|
||||
2 6 0 2.7668
|
||||
2 7 0 2.77557
|
||||
2 8 0 2.7668
|
||||
2 9 0 2.76243
|
||||
2 10 0 2.7408
|
||||
2 11 0 2.7668
|
||||
2 12 0 2.7451
|
||||
2 13 0 2.75808
|
||||
2 14 0 2.74941
|
||||
2 0 1 3.01464
|
||||
2 1 1 3.04083
|
||||
2 2 1 2.9889
|
||||
2 3 1 2.97366
|
||||
2 4 1 2.97366
|
||||
2 5 1 2.96359
|
||||
2 6 1 2.97872
|
||||
2 7 1 2.93871
|
||||
2 8 1 2.96862
|
||||
2 9 1 2.9838
|
||||
2 10 1 2.96862
|
||||
2 11 1 2.97366
|
||||
2 12 1 2.9889
|
||||
2 13 1 2.94365
|
||||
2 14 1 2.9838
|
||||
2 0 2 2.83861
|
||||
2 1 2 2.90456
|
||||
2 2 2 2.89495
|
||||
2 3 2 2.82943
|
||||
2 4 2 2.83861
|
||||
2 5 2 2.84322
|
||||
2 6 2 2.84322
|
||||
2 7 2 2.84322
|
||||
2 8 2 2.83861
|
||||
2 9 2 2.82943
|
||||
2 10 2 2.83401
|
||||
2 11 2 2.82486
|
||||
2 12 2 2.81124
|
||||
2 13 2 2.82486
|
||||
2 14 2 2.80674
|
||||
2 0 3 2.67789
|
||||
2 1 3 2.68199
|
||||
2 2 3 2.71528
|
||||
2 3 3 2.72374
|
||||
2 4 3 2.67789
|
||||
2 5 3 2.6738
|
||||
2 6 3 2.65756
|
||||
2 7 3 2.66565
|
||||
2 8 3 2.66972
|
||||
2 9 3 2.69024
|
||||
2 10 3 2.68199
|
||||
2 11 3 2.63753
|
||||
2 12 3 2.67789
|
||||
2 13 3 2.68199
|
||||
2 14 3 2.69024
|
||||
2 0 4 2.78884
|
||||
2 1 4 2.81124
|
||||
2 2 4 2.81577
|
||||
2 3 4 2.86182
|
||||
2 4 4 2.87121
|
||||
2 5 4 2.81124
|
||||
2 6 4 2.77557
|
||||
2 7 4 2.80674
|
||||
2 8 4 2.80224
|
||||
2 9 4 2.78441
|
||||
2 10 4 2.77557
|
||||
2 11 4 2.80224
|
||||
2 12 4 2.80224
|
||||
2 13 4 2.7933
|
||||
2 14 4 2.80674
|
||||
2 0 5 2.77118
|
||||
2 1 5 2.7668
|
||||
2 2 5 2.77557
|
||||
2 3 5 2.77557
|
||||
2 4 5 2.81124
|
||||
2 5 5 2.84322
|
||||
2 6 5 2.76243
|
||||
2 7 5 2.78441
|
||||
2 8 5 2.7408
|
||||
2 9 5 2.76243
|
||||
2 10 5 2.77998
|
||||
2 11 5 2.77557
|
||||
2 12 5 2.78441
|
||||
2 13 5 2.77557
|
||||
2 14 5 2.7668
|
||||
2 0 6 2.91424
|
||||
2 1 6 2.91424
|
||||
2 2 6 2.9191
|
||||
2 3 6 2.90939
|
||||
2 4 6 2.89975
|
||||
2 5 6 2.96862
|
||||
2 6 6 2.97872
|
||||
2 7 6 2.9191
|
||||
2 8 6 2.89975
|
||||
2 9 6 2.91424
|
||||
2 10 6 2.92887
|
||||
2 11 6 2.9191
|
||||
2 12 6 2.89017
|
||||
2 13 6 2.90939
|
||||
2 14 6 2.90939
|
||||
2 0 7 2.83401
|
||||
2 1 7 2.81124
|
||||
2 2 7 2.78441
|
||||
2 3 7 2.83861
|
||||
2 4 7 2.83861
|
||||
2 5 7 2.82486
|
||||
2 6 7 2.89495
|
||||
2 7 7 2.88541
|
||||
2 8 7 2.84322
|
||||
2 9 7 2.81577
|
||||
2 10 7 2.83401
|
||||
2 11 7 2.81577
|
||||
2 12 7 2.82486
|
||||
2 13 7 2.82486
|
||||
2 14 7 2.82486
|
||||
2 0 8 2.92887
|
||||
2 1 8 2.92398
|
||||
2 2 8 2.90939
|
||||
2 3 8 2.9191
|
||||
2 4 8 2.89975
|
||||
2 5 8 2.92887
|
||||
2 6 8 2.91424
|
||||
2 7 8 2.96862
|
||||
2 8 8 2.96862
|
||||
2 9 8 2.92398
|
||||
2 10 8 2.90939
|
||||
2 11 8 2.9191
|
||||
2 12 8 2.87592
|
||||
2 13 8 2.9191
|
||||
2 14 8 2.91424
|
||||
2 0 10 2.91424
|
||||
2 1 10 2.93378
|
||||
2 2 10 2.92887
|
||||
2 3 10 2.94365
|
||||
2 4 10 2.93871
|
||||
2 5 10 2.93378
|
||||
2 6 10 2.93871
|
||||
2 7 10 2.92887
|
||||
2 8 10 2.90939
|
||||
2 9 10 2.97366
|
||||
2 10 10 2.97872
|
||||
2 11 10 2.92398
|
||||
2 12 10 2.92398
|
||||
2 13 10 2.90939
|
||||
2 14 10 2.93378
|
||||
2 0 11 3.01984
|
||||
2 1 11 3.01464
|
||||
2 2 11 3.01984
|
||||
2 3 11 3.00429
|
||||
2 4 11 3.00429
|
||||
2 5 11 3.03556
|
||||
2 6 11 3.02506
|
||||
2 7 11 3.02506
|
||||
2 8 11 3.0303
|
||||
2 9 11 3.00946
|
||||
2 10 11 3.07828
|
||||
2 11 11 3.07828
|
||||
2 12 11 3.00946
|
||||
2 13 11 3.0303
|
||||
2 14 11 2.99914
|
||||
2 0 12 2.90456
|
||||
2 1 12 2.92887
|
||||
2 2 12 2.89495
|
||||
2 3 12 2.92887
|
||||
2 4 12 2.90456
|
||||
2 5 12 2.91424
|
||||
2 6 12 2.92887
|
||||
2 7 12 2.89495
|
||||
2 8 12 2.93378
|
||||
2 9 12 2.90939
|
||||
2 10 12 2.92398
|
||||
2 11 12 2.97366
|
||||
2 12 12 2.96862
|
||||
2 13 12 2.90939
|
||||
2 14 12 2.89495
|
||||
2 0 13 2.83861
|
||||
2 1 13 2.81124
|
||||
2 2 13 2.80674
|
||||
2 3 13 2.80674
|
||||
2 4 13 2.83401
|
||||
2 5 13 2.84784
|
||||
2 6 13 2.83401
|
||||
2 7 13 2.82031
|
||||
2 8 13 2.81577
|
||||
2 9 13 2.81577
|
||||
2 10 13 2.81577
|
||||
2 11 13 2.82943
|
||||
2 12 13 2.89017
|
||||
2 13 13 2.90939
|
||||
2 14 13 2.82486
|
||||
2 0 14 2.93871
|
||||
2 1 14 2.9191
|
||||
2 2 14 2.93871
|
||||
2 3 14 2.9191
|
||||
2 4 14 2.93378
|
||||
2 5 14 2.94861
|
||||
2 6 14 2.90939
|
||||
2 7 14 2.92398
|
||||
2 8 14 2.90456
|
||||
2 9 14 2.91424
|
||||
2 10 14 2.90939
|
||||
2 11 14 2.90456
|
||||
2 12 14 3.00946
|
||||
2 13 14 3.04613
|
||||
2 14 14 2.96862
|
||||
3 0 0 2.80674
|
||||
3 1 0 2.76243
|
||||
3 2 0 2.75374
|
||||
3 3 0 2.73224
|
||||
3 4 0 2.7408
|
||||
3 5 0 2.72374
|
||||
3 7 0 2.72798
|
||||
3 8 0 2.7408
|
||||
3 9 0 2.73651
|
||||
3 10 0 2.7195
|
||||
3 11 0 2.7451
|
||||
3 12 0 2.71528
|
||||
3 13 0 2.72374
|
||||
3 14 0 2.69854
|
||||
3 15 0 2.72798
|
||||
3 0 1 6.4695
|
||||
3 5 1 6.37523
|
||||
3 7 1 6.35209
|
||||
3 15 1 6.32911
|
||||
3 0 2 2.89017
|
||||
3 1 2 2.95858
|
||||
3 2 2 3.00429
|
||||
3 3 2 2.91424
|
||||
3 4 2 2.92398
|
||||
3 5 2 2.89975
|
||||
3 7 2 2.91424
|
||||
3 8 2 2.88541
|
||||
3 9 2 2.91424
|
||||
3 10 2 2.91424
|
||||
3 11 2 2.87592
|
||||
3 12 2 2.90456
|
||||
3 13 2 2.89017
|
||||
3 14 2 2.9191
|
||||
3 15 2 2.90939
|
||||
3 0 3 2.9889
|
||||
3 1 3 2.9889
|
||||
3 2 3 3.01984
|
||||
3 3 3 3.03556
|
||||
3 4 3 2.97366
|
||||
3 5 3 2.97366
|
||||
3 7 3 2.9838
|
||||
3 8 3 2.9838
|
||||
3 9 3 2.97872
|
||||
3 10 3 2.95858
|
||||
3 11 3 2.95359
|
||||
3 12 3 2.96862
|
||||
3 13 3 2.97872
|
||||
3 14 3 2.96862
|
||||
3 15 3 2.96862
|
||||
3 0 4 2.96862
|
||||
3 1 4 2.93871
|
||||
3 2 4 2.94365
|
||||
3 3 4 2.99914
|
||||
3 4 4 3.0303
|
||||
3 5 4 2.95359
|
||||
3 7 4 2.93378
|
||||
3 8 4 2.92887
|
||||
3 9 4 2.92398
|
||||
3 10 4 2.97366
|
||||
3 11 4 2.93871
|
||||
3 12 4 2.95858
|
||||
3 13 4 2.95858
|
||||
3 14 4 2.96359
|
||||
3 15 4 2.96862
|
||||
3 0 5 2.88541
|
||||
3 1 5 2.88541
|
||||
3 2 5 2.88541
|
||||
3 3 5 2.88066
|
||||
3 4 5 2.96359
|
||||
3 5 5 2.95858
|
||||
3 7 5 2.89495
|
||||
3 8 5 2.89975
|
||||
3 9 5 2.90456
|
||||
3 10 5 2.88066
|
||||
3 11 5 2.90456
|
||||
3 12 5 2.90456
|
||||
3 13 5 2.90939
|
||||
3 14 5 2.88541
|
||||
3 15 5 2.89975
|
||||
3 0 7 2.95858
|
||||
3 1 7 2.9889
|
||||
3 2 7 2.96359
|
||||
3 3 7 2.94861
|
||||
3 4 7 2.95858
|
||||
3 5 7 2.9889
|
||||
3 7 7 3.04083
|
||||
3 8 7 2.96862
|
||||
3 9 7 2.9889
|
||||
3 10 7 2.9838
|
||||
3 11 7 2.95359
|
||||
3 12 7 2.96862
|
||||
3 13 7 2.97872
|
||||
3 14 7 2.96862
|
||||
3 15 7 2.96862
|
||||
3 0 8 3.12221
|
||||
3 1 8 3.11665
|
||||
3 2 8 3.14465
|
||||
3 3 8 3.13901
|
||||
3 4 8 3.12221
|
||||
3 5 8 3.13901
|
||||
3 7 8 3.16742
|
||||
3 8 8 3.19052
|
||||
3 9 8 3.13901
|
||||
3 10 8 3.11665
|
||||
3 11 8 3.13901
|
||||
3 12 8 3.13901
|
||||
3 13 8 3.16742
|
||||
3 14 8 3.09461
|
||||
3 15 8 3.14465
|
||||
3 0 9 2.96359
|
||||
3 1 9 2.9838
|
||||
3 2 9 2.93378
|
||||
3 3 9 2.9191
|
||||
3 4 9 2.94365
|
||||
3 5 9 2.94861
|
||||
3 7 9 2.97366
|
||||
3 8 9 2.99914
|
||||
3 9 9 3.0303
|
||||
3 10 9 2.9889
|
||||
3 11 9 2.95359
|
||||
3 12 9 2.97872
|
||||
3 13 9 2.95858
|
||||
3 14 9 2.95359
|
||||
3 15 9 2.94365
|
||||
3 0 10 3.34928
|
||||
3 1 10 3.38164
|
||||
3 2 10 3.38164
|
||||
3 3 10 3.39476
|
||||
3 4 10 3.37512
|
||||
3 5 10 3.37512
|
||||
3 7 10 3.38819
|
||||
3 8 10 3.3557
|
||||
3 9 10 3.42801
|
||||
3 10 10 3.39476
|
||||
3 11 10 3.40798
|
||||
3 12 10 3.36862
|
||||
3 13 10 3.38819
|
||||
3 14 10 3.36862
|
||||
3 15 10 3.39476
|
||||
3 0 11 3.19052
|
||||
3 1 11 3.19052
|
||||
3 2 11 3.16742
|
||||
3 3 11 3.156
|
||||
3 4 11 3.19052
|
||||
3 5 11 3.19635
|
||||
3 7 11 3.17316
|
||||
3 8 11 3.18471
|
||||
3 9 11 3.19052
|
||||
3 10 11 3.23176
|
||||
3 11 11 3.25581
|
||||
3 12 11 3.2022
|
||||
3 13 11 3.19635
|
||||
3 14 11 3.23774
|
||||
3 15 11 3.22581
|
||||
3 0 12 3.03556
|
||||
3 1 12 3.08914
|
||||
3 2 12 3.0303
|
||||
3 3 12 3.0837
|
||||
3 4 12 3.07828
|
||||
3 5 12 3.06748
|
||||
3 7 12 3.04083
|
||||
3 8 12 3.06212
|
||||
3 9 12 3.07828
|
||||
3 10 12 3.04613
|
||||
3 11 12 3.14465
|
||||
3 12 12 3.11665
|
||||
3 13 12 3.06748
|
||||
3 14 12 3.15032
|
||||
3 15 12 3.0837
|
||||
3 0 13 3.11111
|
||||
3 1 13 3.10559
|
||||
3 2 13 3.10009
|
||||
3 3 13 3.08914
|
||||
3 4 13 3.07828
|
||||
3 5 13 3.08914
|
||||
3 7 13 3.10009
|
||||
3 8 13 3.10559
|
||||
3 9 13 3.0837
|
||||
3 10 13 3.09461
|
||||
3 11 13 3.10559
|
||||
3 12 13 3.156
|
||||
3 13 13 3.22581
|
||||
3 14 13 3.16742
|
||||
3 15 13 3.13339
|
||||
3 0 14 2.93378
|
||||
3 1 14 2.95858
|
||||
3 2 14 2.97366
|
||||
3 3 14 2.9191
|
||||
3 4 14 2.96862
|
||||
3 5 14 2.94365
|
||||
3 7 14 2.96862
|
||||
3 8 14 2.9889
|
||||
3 9 14 2.95858
|
||||
3 10 14 2.93378
|
||||
3 11 14 3.01984
|
||||
3 12 14 2.96359
|
||||
3 13 14 3.0303
|
||||
3 14 14 3.05677
|
||||
3 15 14 2.9889
|
||||
3 0 15 3.13339
|
||||
3 1 15 3.14465
|
||||
3 2 15 3.156
|
||||
3 3 15 3.18471
|
||||
3 4 15 3.17893
|
||||
3 5 15 3.15032
|
||||
3 7 15 3.1617
|
||||
3 8 15 3.16742
|
||||
3 9 15 3.19052
|
||||
3 10 15 3.1617
|
||||
3 11 15 3.156
|
||||
3 12 15 3.2022
|
||||
3 13 15 3.156
|
||||
3 14 15 3.25581
|
||||
3 15 15 3.31126
|
||||
|
|
@ -1,760 +0,0 @@
|
|||
0 0 0 1.12207 0
|
||||
0 1 0 1.08493 0
|
||||
0 2 0 1.10745 0
|
||||
0 3 0 1.0896 0
|
||||
0 4 0 1.14681 0
|
||||
0 5 0 1.12957 0
|
||||
0 6 0 1.05646 0
|
||||
0 7 0 1.09773 0
|
||||
0 8 0 1.05916 0
|
||||
0 9 0 1.10486 0
|
||||
0 10 0 1.13044 0
|
||||
0 11 0 1.0665 0
|
||||
0 12 0 1.12404 0
|
||||
0 13 0 1.12471 0
|
||||
0 14 0 1.11974 0
|
||||
0 15 0 1.10215 0
|
||||
0 0 2 1.05256 0
|
||||
0 1 2 1.01731 0
|
||||
0 2 2 1.04108 0
|
||||
0 3 2 1.02415 0
|
||||
0 4 2 1.07689 0
|
||||
0 5 2 1.06084 0
|
||||
0 6 2 0.989488 0
|
||||
0 7 2 1.03084 0
|
||||
0 8 2 0.993233 0
|
||||
0 9 2 1.03774 0
|
||||
0 10 2 1.06344 0
|
||||
0 11 2 1.00042 0
|
||||
0 12 2 1.0559 0
|
||||
0 13 2 1.05577 0
|
||||
0 14 2 1.05148 0
|
||||
0 15 2 1.03467 0
|
||||
0 0 3 1.1385 0
|
||||
0 1 3 1.10223 0
|
||||
0 2 3 1.12758 0
|
||||
0 3 3 1.10855 0
|
||||
0 4 3 1.16811 0
|
||||
0 5 3 1.14951 0
|
||||
0 6 3 1.07275 0
|
||||
0 7 3 1.11613 0
|
||||
0 8 3 1.07539 0
|
||||
0 9 3 1.12459 0
|
||||
0 10 3 1.15338 0
|
||||
0 11 3 1.08428 0
|
||||
0 12 3 1.14383 0
|
||||
0 13 3 1.14369 0
|
||||
0 14 3 1.14039 0
|
||||
0 15 3 1.11949 0
|
||||
0 0 4 1.09932 0
|
||||
0 1 4 1.0625 0
|
||||
0 2 4 1.08606 0
|
||||
0 3 4 1.06822 0
|
||||
0 4 4 1.1235 0
|
||||
0 5 4 1.10999 0
|
||||
0 6 4 1.03531 0
|
||||
0 7 4 1.07693 0
|
||||
0 8 4 1.03709 0
|
||||
0 9 4 1.08531 0
|
||||
0 10 4 1.11285 0
|
||||
0 11 4 1.0469 0
|
||||
0 12 4 1.10321 0
|
||||
0 13 4 1.10394 0
|
||||
0 14 4 1.10035 0
|
||||
0 15 4 1.08045 0
|
||||
0 0 5 1.09396 0
|
||||
0 1 5 1.05866 0
|
||||
0 2 5 1.08213 0
|
||||
0 3 5 1.06565 0
|
||||
0 4 5 1.12018 0
|
||||
0 5 5 1.1064 0
|
||||
0 6 5 1.03231 0
|
||||
0 7 5 1.0731 0
|
||||
0 8 5 1.03371 0
|
||||
0 9 5 1.08144 0
|
||||
0 10 5 1.10954 0
|
||||
0 11 5 1.04273 0
|
||||
0 12 5 1.10036 0
|
||||
0 13 5 1.10079 0
|
||||
0 14 5 1.09671 0
|
||||
0 15 5 1.07585 0
|
||||
0 0 6 1.11619 0
|
||||
0 1 6 1.0771 0
|
||||
0 2 6 1.10141 0
|
||||
0 3 6 1.08367 0
|
||||
0 4 6 1.14209 0
|
||||
0 5 6 1.12639 0
|
||||
0 6 6 1.05297 0
|
||||
0 7 6 1.09318 0
|
||||
0 8 6 1.05305 0
|
||||
0 9 6 1.10065 0
|
||||
0 10 6 1.12791 0
|
||||
0 11 6 1.06161 0
|
||||
0 12 6 1.11892 0
|
||||
0 13 6 1.1185 0
|
||||
0 14 6 1.11602 0
|
||||
0 15 6 1.09589 0
|
||||
0 0 7 0.992207 0
|
||||
0 1 7 0.95617 0
|
||||
0 2 7 0.97662 0
|
||||
0 3 7 0.96121 0
|
||||
0 4 7 1.00953 0
|
||||
0 5 7 0.996397 0
|
||||
0 6 7 0.931868 0
|
||||
0 7 7 0.964233 0
|
||||
0 8 7 0.931324 0
|
||||
0 9 7 0.973485 0
|
||||
0 10 7 0.999204 0
|
||||
0 11 7 0.940932 0
|
||||
0 12 7 0.991757 0
|
||||
0 13 7 0.991016 0
|
||||
0 14 7 0.989383 0
|
||||
0 15 7 0.975226 0
|
||||
0 0 8 1.06807 0
|
||||
0 1 8 1.03455 0
|
||||
0 2 8 1.05888 0
|
||||
0 3 8 1.0404 0
|
||||
0 4 8 1.09704 0
|
||||
0 5 8 1.08007 0
|
||||
0 6 8 1.00981 0
|
||||
0 7 8 1.05129 0
|
||||
0 8 8 1.01367 0
|
||||
0 9 8 1.0595 0
|
||||
0 10 8 1.08453 0
|
||||
0 11 8 1.019 0
|
||||
0 12 8 1.07599 0
|
||||
0 13 8 1.07544 0
|
||||
0 14 8 1.07126 0
|
||||
0 15 8 1.05213 0
|
||||
0 0 9 1.07322 0
|
||||
0 1 9 1.03869 0
|
||||
0 2 9 1.06165 0
|
||||
0 3 9 1.0447 0
|
||||
0 4 9 1.10153 0
|
||||
0 5 9 1.08441 0
|
||||
0 6 9 1.01286 0
|
||||
0 7 9 1.05365 0
|
||||
0 8 9 1.01672 0
|
||||
0 9 9 1.06427 0
|
||||
0 10 9 1.08927 0
|
||||
0 11 9 1.02263 0
|
||||
0 12 9 1.07962 0
|
||||
0 13 9 1.07916 0
|
||||
0 14 9 1.07558 0
|
||||
0 15 9 1.05542 0
|
||||
0 0 10 1.03342 0
|
||||
0 1 10 0.999954 0
|
||||
0 2 10 1.02158 0
|
||||
0 3 10 1.00498 0
|
||||
0 4 10 1.05958 0
|
||||
0 5 10 1.04313 0
|
||||
0 6 10 0.974025 0
|
||||
0 7 10 1.01269 0
|
||||
0 8 10 0.975984 0
|
||||
0 9 10 1.02259 0
|
||||
0 10 10 1.04922 0
|
||||
0 11 10 0.985154 0
|
||||
0 12 10 1.03874 0
|
||||
0 13 10 1.03801 0
|
||||
0 14 10 1.03509 0
|
||||
0 15 10 1.0175 0
|
||||
0 0 11 1.08258 0
|
||||
0 1 11 1.04797 0
|
||||
0 2 11 1.07057 0
|
||||
0 3 11 1.05309 0
|
||||
0 4 11 1.11159 0
|
||||
0 5 11 1.09417 0
|
||||
0 6 11 1.02086 0
|
||||
0 7 11 1.06119 0
|
||||
0 8 11 1.02392 0
|
||||
0 9 11 1.07117 0
|
||||
0 10 11 1.10077 0
|
||||
0 11 11 1.03559 0
|
||||
0 12 11 1.09012 0
|
||||
0 13 11 1.08843 0
|
||||
0 14 11 1.08571 0
|
||||
0 15 11 1.06485 0
|
||||
0 0 12 1.07307 0
|
||||
0 1 12 1.03946 0
|
||||
0 2 12 1.0614 0
|
||||
0 3 12 1.04367 0
|
||||
0 4 12 1.10177 0
|
||||
0 5 12 1.08434 0
|
||||
0 6 12 1.01155 0
|
||||
0 7 12 1.05298 0
|
||||
0 8 12 1.01438 0
|
||||
0 9 12 1.06102 0
|
||||
0 10 12 1.08926 0
|
||||
0 11 12 1.02538 0
|
||||
0 12 12 1.08318 0
|
||||
0 13 12 1.07886 0
|
||||
0 14 12 1.07625 0
|
||||
0 15 12 1.05681 0
|
||||
0 0 13 1.01387 0
|
||||
0 1 13 0.981192 0
|
||||
0 2 13 1.00272 0
|
||||
0 3 13 0.986491 0
|
||||
0 4 13 1.04149 0
|
||||
0 5 13 1.02408 0
|
||||
0 6 13 0.955257 0
|
||||
0 7 13 0.995111 0
|
||||
0 8 13 0.957727 0
|
||||
0 9 13 1.0025 0
|
||||
0 10 13 1.02863 0
|
||||
0 11 13 0.967083 0
|
||||
0 12 13 1.02681 0
|
||||
0 13 13 1.02643 0
|
||||
0 14 13 1.0182 0
|
||||
0 15 13 0.997673 0
|
||||
0 0 14 1.04472 0
|
||||
0 1 14 1.011 0
|
||||
0 2 14 1.03378 0
|
||||
0 3 14 1.01487 0
|
||||
0 4 14 1.07252 0
|
||||
0 5 14 1.05521 0
|
||||
0 6 14 0.984421 0
|
||||
0 7 14 1.02534 0
|
||||
0 8 14 0.988077 0
|
||||
0 9 14 1.03279 0
|
||||
0 10 14 1.05902 0
|
||||
0 11 14 0.996786 0
|
||||
0 12 14 1.05098 0
|
||||
0 13 14 1.05293 0
|
||||
0 14 14 1.04859 0
|
||||
0 15 14 1.02731 0
|
||||
0 0 15 1.09462 0
|
||||
0 1 15 1.06343 0
|
||||
0 2 15 1.08376 0
|
||||
0 3 15 1.06709 0
|
||||
0 4 15 1.12538 0
|
||||
0 5 15 1.10751 0
|
||||
0 6 15 1.03287 0
|
||||
0 7 15 1.07668 0
|
||||
0 8 15 1.03758 0
|
||||
0 9 15 1.08417 0
|
||||
0 10 15 1.1094 0
|
||||
0 11 15 1.04588 0
|
||||
0 12 15 1.09978 0
|
||||
0 13 15 1.10121 0
|
||||
0 14 15 1.0985 0
|
||||
0 15 15 1.07597 0
|
||||
1 0 0 1.00584 0
|
||||
1 1 0 0.991739 0
|
||||
1 2 0 1.04076 0
|
||||
1 3 0 0.989385 0
|
||||
1 7 0 0.957583 0
|
||||
1 8 0 0.942439 0
|
||||
1 0 1 0.96917 0
|
||||
1 1 1 0.950773 0
|
||||
1 2 1 1.00249 0
|
||||
1 3 1 0.95195 0
|
||||
1 7 1 0.92104 0
|
||||
1 8 1 0.906307 0
|
||||
1 0 2 0.985122 0
|
||||
1 1 2 0.967623 0
|
||||
1 2 2 1.01795 0
|
||||
1 3 2 0.967184 0
|
||||
1 7 2 0.935621 0
|
||||
1 8 2 0.920832 0
|
||||
1 0 3 1.00595 0
|
||||
1 1 3 0.990189 0
|
||||
1 2 3 1.04015 0
|
||||
1 3 3 0.987531 0
|
||||
1 7 3 0.954839 0
|
||||
1 8 3 0.940718 0
|
||||
1 0 4 0.990917 0
|
||||
1 1 4 0.975577 0
|
||||
1 2 4 1.0252 0
|
||||
1 3 4 0.974288 0
|
||||
1 7 4 0.941412 0
|
||||
1 8 4 0.92702 0
|
||||
1 0 5 1.00671 0
|
||||
1 1 5 0.99208 0
|
||||
1 2 5 1.04264 0
|
||||
1 3 5 0.990048 0
|
||||
1 7 5 0.956649 0
|
||||
1 8 5 0.942892 0
|
||||
1 0 6 0.96557 0
|
||||
1 1 6 0.950451 0
|
||||
1 2 6 0.998704 0
|
||||
1 3 6 0.949055 0
|
||||
1 7 6 0.917574 0
|
||||
1 8 6 0.903503 0
|
||||
1 0 7 0.891906 0
|
||||
1 1 7 0.87781 0
|
||||
1 2 7 0.922639 0
|
||||
1 3 7 0.875712 0
|
||||
1 7 7 0.853554 0
|
||||
1 8 7 0.836195 0
|
||||
1 0 8 0.989769 0
|
||||
1 1 8 0.974462 0
|
||||
1 2 8 1.02441 0
|
||||
1 3 8 0.972957 0
|
||||
1 7 8 0.942627 0
|
||||
1 8 8 0.925595 0
|
||||
1 0 9 0.958183 0
|
||||
1 1 9 0.943537 0
|
||||
1 2 9 0.99262 0
|
||||
1 3 9 0.941384 0
|
||||
1 7 9 0.910448 0
|
||||
1 8 9 0.89467 0
|
||||
1 0 10 0.94311 0
|
||||
1 1 10 0.930002 0
|
||||
1 2 10 0.977494 0
|
||||
1 3 10 0.927837 0
|
||||
1 7 10 0.89765 0
|
||||
1 8 10 0.882992 0
|
||||
1 0 11 0.996567 0
|
||||
1 1 11 0.981705 0
|
||||
1 2 11 1.03187 0
|
||||
1 3 11 0.978015 0
|
||||
1 7 11 0.946121 0
|
||||
1 8 11 0.931507 0
|
||||
1 0 12 1.00398 0
|
||||
1 1 12 0.989787 0
|
||||
1 2 12 1.04028 0
|
||||
1 3 12 0.986024 0
|
||||
1 7 12 0.954241 0
|
||||
1 8 12 0.939639 0
|
||||
1 0 13 0.896427 0
|
||||
1 1 13 0.882492 0
|
||||
1 2 13 0.927603 0
|
||||
1 3 13 0.879707 0
|
||||
1 7 13 0.850951 0
|
||||
1 8 13 0.83792 0
|
||||
1 0 14 1.02997 0
|
||||
1 1 14 1.01547 0
|
||||
1 2 14 1.06817 0
|
||||
1 3 14 1.01254 0
|
||||
1 7 14 0.98002 0
|
||||
1 8 14 0.963423 0
|
||||
1 0 15 0.953121 0
|
||||
1 1 15 0.938522 0
|
||||
1 2 15 0.986155 0
|
||||
1 3 15 0.937939 0
|
||||
1 7 15 0.907522 0
|
||||
1 8 15 0.891172 0
|
||||
2 0 0 1.06379 0
|
||||
2 1 0 1.10875 0
|
||||
2 2 0 1.02294 0
|
||||
2 3 0 1.02842 0
|
||||
2 4 0 1.06084 0
|
||||
2 5 0 1.0194 0
|
||||
2 6 0 1.05202 0
|
||||
2 7 0 1.07026 0
|
||||
2 8 0 0.991063 0
|
||||
2 9 0 1.00772 0
|
||||
2 10 0 1.0433 0
|
||||
2 11 0 1.07869 0
|
||||
2 12 0 1.04086 0
|
||||
2 13 0 1.06181 0
|
||||
2 14 0 1.02712 0
|
||||
2 0 1 0.995685 0
|
||||
2 1 1 1.03281 0
|
||||
2 2 1 0.955546 0
|
||||
2 3 1 0.959761 0
|
||||
2 4 1 0.991299 0
|
||||
2 5 1 0.951227 0
|
||||
2 6 1 0.982886 0
|
||||
2 7 1 1.0003 0
|
||||
2 8 1 0.924545 0
|
||||
2 9 1 0.939693 0
|
||||
2 10 1 0.973191 0
|
||||
2 11 1 1.0087 0
|
||||
2 12 1 0.972144 0
|
||||
2 13 1 0.993519 0
|
||||
2 14 1 0.960164 0
|
||||
2 0 2 1.04864 0
|
||||
2 1 2 1.08857 0
|
||||
2 2 2 1.00562 0
|
||||
2 3 2 1.01227 0
|
||||
2 4 2 1.04421 0
|
||||
2 5 2 1.00279 0
|
||||
2 6 2 1.0365 0
|
||||
2 7 2 1.05444 0
|
||||
2 8 2 0.974793 0
|
||||
2 9 2 0.991239 0
|
||||
2 10 2 1.02675 0
|
||||
2 11 2 1.06391 0
|
||||
2 12 2 1.02552 0
|
||||
2 13 2 1.04714 0
|
||||
2 14 2 1.01293 0
|
||||
2 0 3 1.10698 0
|
||||
2 1 3 1.15985 0
|
||||
2 2 3 1.06676 0
|
||||
2 3 3 1.07236 0
|
||||
2 4 3 1.10393 0
|
||||
2 5 3 1.06069 0
|
||||
2 6 3 1.09578 0
|
||||
2 7 3 1.11475 0
|
||||
2 8 3 1.03064 0
|
||||
2 9 3 1.04788 0
|
||||
2 10 3 1.08533 0
|
||||
2 11 3 1.1247 0
|
||||
2 12 3 1.084 0
|
||||
2 13 3 1.10751 0
|
||||
2 14 3 1.06881 0
|
||||
2 0 4 1.05695 0
|
||||
2 1 4 1.10478 0
|
||||
2 2 4 1.01516 0
|
||||
2 3 4 1.02202 0
|
||||
2 4 4 1.05319 0
|
||||
2 5 4 1.0132 0
|
||||
2 6 4 1.04602 0
|
||||
2 7 4 1.06436 0
|
||||
2 8 4 0.983777 0
|
||||
2 9 4 1.00063 0
|
||||
2 10 4 1.03641 0
|
||||
2 11 4 1.07385 0
|
||||
2 12 4 1.03511 0
|
||||
2 13 4 1.05746 0
|
||||
2 14 4 1.02133 0
|
||||
2 0 5 1.06973 0
|
||||
2 1 5 1.11893 0
|
||||
2 2 5 1.02921 0
|
||||
2 3 5 1.03518 0
|
||||
2 4 5 1.06659 0
|
||||
2 5 5 1.024 0
|
||||
2 6 5 1.05907 0
|
||||
2 7 5 1.07706 0
|
||||
2 8 5 0.996679 0
|
||||
2 9 5 1.01315 0
|
||||
2 10 5 1.04979 0
|
||||
2 11 5 1.08783 0
|
||||
2 12 5 1.04761 0
|
||||
2 13 5 1.07017 0
|
||||
2 14 5 1.03459 0
|
||||
2 0 6 1.01777 0
|
||||
2 1 6 1.06565 0
|
||||
2 2 6 0.979373 0
|
||||
2 3 6 0.985911 0
|
||||
2 4 6 1.01836 0
|
||||
2 5 6 0.976077 0
|
||||
2 6 6 1.01061 0
|
||||
2 7 6 1.02541 0
|
||||
2 8 6 0.948997 0
|
||||
2 9 6 0.964438 0
|
||||
2 10 6 0.998979 0
|
||||
2 11 6 1.03578 0
|
||||
2 12 6 0.997692 0
|
||||
2 13 6 1.01927 0
|
||||
2 14 6 0.98573 0
|
||||
2 0 7 1.04993 0
|
||||
2 1 7 1.09893 0
|
||||
2 2 7 1.01005 0
|
||||
2 3 7 1.01582 0
|
||||
2 4 7 1.04851 0
|
||||
2 5 7 1.00559 0
|
||||
2 6 7 1.04112 0
|
||||
2 7 7 1.0568 0
|
||||
2 8 7 0.978975 0
|
||||
2 9 7 0.993864 0
|
||||
2 10 7 1.0298 0
|
||||
2 11 7 1.06841 0
|
||||
2 12 7 1.02848 0
|
||||
2 13 7 1.05094 0
|
||||
2 14 7 1.01543 0
|
||||
2 0 8 1.01612 0
|
||||
2 1 8 1.06305 0
|
||||
2 2 8 0.977015 0
|
||||
2 3 8 0.982285 0
|
||||
2 4 8 1.01406 0
|
||||
2 5 8 0.973506 0
|
||||
2 6 8 1.00636 0
|
||||
2 7 8 1.02191 0
|
||||
2 8 8 0.94526 0
|
||||
2 9 8 0.962214 0
|
||||
2 10 8 0.996687 0
|
||||
2 11 8 1.03274 0
|
||||
2 12 8 0.995101 0
|
||||
2 13 8 1.01635 0
|
||||
2 14 8 0.983357 0
|
||||
2 0 10 1.01528 0
|
||||
2 1 10 1.0629 0
|
||||
2 2 10 0.977071 0
|
||||
2 3 10 0.982667 0
|
||||
2 4 10 1.01391 0
|
||||
2 5 10 0.973828 0
|
||||
2 6 10 1.00659 0
|
||||
2 7 10 1.02271 0
|
||||
2 8 10 0.945569 0
|
||||
2 9 10 0.961178 0
|
||||
2 10 10 0.99506 0
|
||||
2 11 10 1.03282 0
|
||||
2 12 10 0.995946 0
|
||||
2 13 10 1.01636 0
|
||||
2 14 10 0.983149 0
|
||||
2 0 11 0.98887 0
|
||||
2 1 11 1.03575 0
|
||||
2 2 11 0.950057 0
|
||||
2 3 11 0.957045 0
|
||||
2 4 11 0.98771 0
|
||||
2 5 11 0.948147 0
|
||||
2 6 11 0.980085 0
|
||||
2 7 11 0.996872 0
|
||||
2 8 11 0.921831 0
|
||||
2 9 11 0.937791 0
|
||||
2 10 11 0.969633 0
|
||||
2 11 11 1.00569 0
|
||||
2 12 11 0.968821 0
|
||||
2 13 11 0.989286 0
|
||||
2 14 11 0.95708 0
|
||||
2 0 12 1.02614 0
|
||||
2 1 12 1.07428 0
|
||||
2 2 12 0.986035 0
|
||||
2 3 12 0.992505 0
|
||||
2 4 12 1.02473 0
|
||||
2 5 12 0.982998 0
|
||||
2 6 12 1.01596 0
|
||||
2 7 12 1.03366 0
|
||||
2 8 12 0.956237 0
|
||||
2 9 12 0.971838 0
|
||||
2 10 12 1.00753 0
|
||||
2 11 12 1.04671 0
|
||||
2 12 12 1.00818 0
|
||||
2 13 12 1.02586 0
|
||||
2 14 12 0.991409 0
|
||||
2 0 13 1.06079 0
|
||||
2 1 13 1.1109 0
|
||||
2 2 13 1.02101 0
|
||||
2 3 13 1.02705 0
|
||||
2 4 13 1.0606 0
|
||||
2 5 13 1.01806 0
|
||||
2 6 13 1.05253 0
|
||||
2 7 13 1.07057 0
|
||||
2 8 13 0.989061 0
|
||||
2 9 13 1.00561 0
|
||||
2 10 13 1.04113 0
|
||||
2 11 13 1.07944 0
|
||||
2 12 13 1.04261 0
|
||||
2 13 13 1.06189 0
|
||||
2 14 13 1.02742 0
|
||||
2 0 14 1.03499 0
|
||||
2 1 14 1.0824 0
|
||||
2 2 14 0.996601 0
|
||||
2 3 14 1.00177 0
|
||||
2 4 14 1.03489 0
|
||||
2 5 14 0.991935 0
|
||||
2 6 14 1.02592 0
|
||||
2 7 14 1.04317 0
|
||||
2 8 14 0.965101 0
|
||||
2 9 14 0.980145 0
|
||||
2 10 14 1.01669 0
|
||||
2 11 14 1.05187 0
|
||||
2 12 14 1.01527 0
|
||||
2 13 14 1.03445 0
|
||||
2 14 14 1.00218 0
|
||||
3 0 0 1.02668 0
|
||||
3 1 0 1.05936 0
|
||||
3 2 0 1.08615 0
|
||||
3 3 0 1.06914 0
|
||||
3 4 0 1.0033 0
|
||||
3 5 0 1.04672 0
|
||||
3 7 0 1.00311 0
|
||||
3 8 0 1.06115 0
|
||||
3 9 0 1.0264 0
|
||||
3 10 0 1.07247 0
|
||||
3 11 0 1.01683 0
|
||||
3 12 0 1.06141 0
|
||||
3 13 0 0.98663 0
|
||||
3 14 0 1.08288 0
|
||||
3 15 0 1.09865 0
|
||||
3 0 1 0.896415 0
|
||||
3 5 1 0.886632 0
|
||||
3 7 1 0.894764 0
|
||||
3 15 1 0.944132 0
|
||||
3 0 2 0.958758 0
|
||||
3 1 2 0.991373 0
|
||||
3 2 2 1.01735 0
|
||||
3 3 2 1.00148 0
|
||||
3 4 2 0.937938 0
|
||||
3 5 2 0.980391 0
|
||||
3 7 2 0.937721 0
|
||||
3 8 2 0.992541 0
|
||||
3 9 2 0.95922 0
|
||||
3 10 2 1.00326 0
|
||||
3 11 2 0.950558 0
|
||||
3 12 2 0.992706 0
|
||||
3 13 2 0.921237 0
|
||||
3 14 2 1.0139 0
|
||||
3 15 2 1.02952 0
|
||||
3 0 3 0.938772 0
|
||||
3 1 3 0.972454 0
|
||||
3 2 3 0.99648 0
|
||||
3 3 3 0.983469 0
|
||||
3 4 3 0.921026 0
|
||||
3 5 3 0.961268 0
|
||||
3 7 3 0.919383 0
|
||||
3 8 3 0.973386 0
|
||||
3 9 3 0.940748 0
|
||||
3 10 3 0.98233 0
|
||||
3 11 3 0.931532 0
|
||||
3 12 3 0.973319 0
|
||||
3 13 3 0.90318 0
|
||||
3 14 3 0.993651 0
|
||||
3 15 3 1.00895 0
|
||||
3 0 4 0.945405 0
|
||||
3 1 4 0.978441 0
|
||||
3 2 4 1.00276 0
|
||||
3 3 4 0.987975 0
|
||||
3 4 4 0.926133 0
|
||||
3 5 4 0.96733 0
|
||||
3 7 4 0.925474 0
|
||||
3 8 4 0.980402 0
|
||||
3 9 4 0.947152 0
|
||||
3 10 4 0.990976 0
|
||||
3 11 4 0.939097 0
|
||||
3 12 4 0.980622 0
|
||||
3 13 4 0.910305 0
|
||||
3 14 4 1.00016 0
|
||||
3 15 4 1.01719 0
|
||||
3 0 5 0.96506 0
|
||||
3 1 5 0.9989 0
|
||||
3 2 5 1.02523 0
|
||||
3 3 5 1.00911 0
|
||||
3 4 5 0.947918 0
|
||||
3 5 5 0.991991 0
|
||||
3 7 5 0.946836 0
|
||||
3 8 5 1.00176 0
|
||||
3 9 5 0.968487 0
|
||||
3 10 5 1.0118 0
|
||||
3 11 5 0.958123 0
|
||||
3 12 5 1.00164 0
|
||||
3 13 5 0.930079 0
|
||||
3 14 5 1.02211 0
|
||||
3 15 5 1.03808 0
|
||||
3 0 7 0.941011 0
|
||||
3 1 7 0.974489 0
|
||||
3 2 7 0.999141 0
|
||||
3 3 7 0.981835 0
|
||||
3 4 7 0.922634 0
|
||||
3 5 7 0.962816 0
|
||||
3 7 7 0.92086 0
|
||||
3 8 7 0.975121 0
|
||||
3 9 7 0.944277 0
|
||||
3 10 7 0.987067 0
|
||||
3 11 7 0.934807 0
|
||||
3 12 7 0.97648 0
|
||||
3 13 7 0.907341 0
|
||||
3 14 7 0.997508 0
|
||||
3 15 7 1.01366 0
|
||||
3 0 8 0.89627 0
|
||||
3 1 8 0.928294 0
|
||||
3 2 8 0.952441 0
|
||||
3 3 8 0.936783 0
|
||||
3 4 8 0.878916 0
|
||||
3 5 8 0.917206 0
|
||||
3 7 8 0.88043 0
|
||||
3 8 8 0.93158 0
|
||||
3 9 8 0.900573 0
|
||||
3 10 8 0.9408 0
|
||||
3 11 8 0.890392 0
|
||||
3 12 8 0.930038 0
|
||||
3 13 8 0.863319 0
|
||||
3 14 8 0.949375 0
|
||||
3 15 8 0.963463 0
|
||||
3 0 9 0.948492 0
|
||||
3 1 9 0.981967 0
|
||||
3 2 9 1.00739 0
|
||||
3 3 9 0.990932 0
|
||||
3 4 9 0.928484 0
|
||||
3 5 9 0.971465 0
|
||||
3 7 9 0.928916 0
|
||||
3 8 9 0.983222 0
|
||||
3 9 9 0.953984 0
|
||||
3 10 9 0.995541 0
|
||||
3 11 9 0.941864 0
|
||||
3 12 9 0.983412 0
|
||||
3 13 9 0.91342 0
|
||||
3 14 9 1.00336 0
|
||||
3 15 9 1.02097 0
|
||||
3 0 10 0.838475 0
|
||||
3 1 10 0.86862 0
|
||||
3 2 10 0.891363 0
|
||||
3 3 10 0.876602 0
|
||||
3 4 10 0.823031 0
|
||||
3 5 10 0.85912 0
|
||||
3 7 10 0.821671 0
|
||||
3 8 10 0.868138 0
|
||||
3 9 10 0.845315 0
|
||||
3 10 10 0.88348 0
|
||||
3 11 10 0.833665 0
|
||||
3 12 10 0.870701 0
|
||||
3 13 10 0.808021 0
|
||||
3 14 10 0.887408 0
|
||||
3 15 10 0.902132 0
|
||||
3 0 11 0.885101 0
|
||||
3 1 11 0.916216 0
|
||||
3 2 11 0.940889 0
|
||||
3 3 11 0.923896 0
|
||||
3 4 11 0.867684 0
|
||||
3 5 11 0.9062 0
|
||||
3 7 11 0.866413 0
|
||||
3 8 11 0.917874 0
|
||||
3 9 11 0.888327 0
|
||||
3 10 11 0.932097 0
|
||||
3 11 11 0.881387 0
|
||||
3 12 11 0.920479 0
|
||||
3 13 11 0.852823 0
|
||||
3 14 11 0.936398 0
|
||||
3 15 11 0.952434 0
|
||||
3 0 12 0.917321 0
|
||||
3 1 12 0.949356 0
|
||||
3 2 12 0.974708 0
|
||||
3 3 12 0.958998 0
|
||||
3 4 12 0.899136 0
|
||||
3 5 12 0.939278 0
|
||||
3 7 12 0.898067 0
|
||||
3 8 12 0.95081 0
|
||||
3 9 12 0.920047 0
|
||||
3 10 12 0.963872 0
|
||||
3 11 12 0.909538 0
|
||||
3 12 12 0.955445 0
|
||||
3 13 12 0.885332 0
|
||||
3 14 12 0.972018 0
|
||||
3 15 12 0.986613 0
|
||||
3 0 13 0.906732 0
|
||||
3 1 13 0.940638 0
|
||||
3 2 13 0.964936 0
|
||||
3 3 13 0.949298 0
|
||||
3 4 13 0.890224 0
|
||||
3 5 13 0.931129 0
|
||||
3 7 13 0.889726 0
|
||||
3 8 13 0.942384 0
|
||||
3 9 13 0.911354 0
|
||||
3 10 13 0.952627 0
|
||||
3 11 13 0.901228 0
|
||||
3 12 13 0.94338 0
|
||||
3 13 13 0.874148 0
|
||||
3 14 13 0.961403 0
|
||||
3 15 13 0.977713 0
|
||||
3 0 14 0.95233 0
|
||||
3 1 14 0.987515 0
|
||||
3 2 14 1.01396 0
|
||||
3 3 14 0.997041 0
|
||||
3 4 14 0.935215 0
|
||||
3 5 14 0.976277 0
|
||||
3 7 14 0.933648 0
|
||||
3 8 14 0.98953 0
|
||||
3 9 14 0.957268 0
|
||||
3 10 14 1.00003 0
|
||||
3 11 14 0.947087 0
|
||||
3 12 14 0.989929 0
|
||||
3 13 14 0.91941 0
|
||||
3 14 14 1.01076 0
|
||||
3 15 14 1.0263 0
|
||||
3 0 15 0.905797 0
|
||||
3 1 15 0.935697 0
|
||||
3 2 15 0.962285 0
|
||||
3 3 15 0.945393 0
|
||||
3 4 15 0.889273 0
|
||||
3 5 15 0.926698 0
|
||||
3 7 15 0.88521 0
|
||||
3 8 15 0.938653 0
|
||||
3 9 15 0.90796 0
|
||||
3 10 15 0.949553 0
|
||||
3 11 15 0.898358 0
|
||||
3 12 15 0.936328 0
|
||||
3 13 15 0.872314 0
|
||||
3 14 15 0.959995 0
|
||||
3 15 15 0.98169 0
|
||||
57
run_17F.sh
57
run_17F.sh
|
|
@ -1,57 +0,0 @@
|
|||
rm results_run*.root
|
||||
export DATASET="17F"
|
||||
export flip180="0"
|
||||
export flipa=0
|
||||
export anode_offset=2
|
||||
export cathode_offset=0
|
||||
export productionrun=1
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_005_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run05.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_006_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run06.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_007_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run07.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_008_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run08.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_009_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run09.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_010_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run10.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_011_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run11.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_012_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run12.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_013_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run13.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_014_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run14.root;
|
||||
|
||||
#17F pulser runs
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/PulserRun_015_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run15.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/PulserRun_016_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run16.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/PulserRun_017_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run17.root;
|
||||
|
||||
#17F alpha run with gas
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_018_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run18.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_019_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run19.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_020_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run20.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_021_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run21.root;
|
||||
|
||||
#17F reaction data
|
||||
# export flip180="0"
|
||||
declare -i run=322 #49
|
||||
# while [[ $run -lt 399 ]]; do #392
|
||||
# wrun=$(printf "%03d" $run)
|
||||
# file_exists=$(test -f ../ANASEN_analysis/data/17F_Data/Run_"$wrun"_mapped.root)
|
||||
# if [[ $file_exists -ne 0 ]]; then continue; fi
|
||||
# root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Run_"$wrun"_mapped.root -e 'tree->Process("MakeVertex.C+O","Analyzer_17F.root")'; mv Analyzer_17F.root 17F_output/results_run$wrun.root;
|
||||
# run=run+1
|
||||
# done
|
||||
|
||||
while [[ $run -lt 323 ]]; do #392
|
||||
wrun=$(printf "%03d" $run)
|
||||
file_exists=$(test -f ../ANASEN_analysis/data/17F_Data/Run_"$wrun"_mapped.root)
|
||||
if [[ $file_exists -ne 0 ]]; then continue; fi
|
||||
root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Run_"$wrun"_mapped.root -e 'tree->Process("VertexRecon.C+O","Analyzer_17F.root")'; mv Analyzer_17F.root 17F_output/results_run$wrun.root;
|
||||
run=run+1
|
||||
done
|
||||
|
||||
rm output.root
|
||||
hadd -k -j 4 output.root 17F_output/results_run*.root
|
||||
mv output.root output_17F.root
|
||||
|
||||
unset souce_vertex
|
||||
unset DATASET
|
||||
unset flip180
|
||||
unset flipa
|
||||
unset anode_offset
|
||||
32
run_27Al.sh
32
run_27Al.sh
|
|
@ -1,32 +0,0 @@
|
|||
rm results_run*.root
|
||||
export DATASET="27Al"
|
||||
export flip180="0"
|
||||
export flipa=0
|
||||
export flipc=0
|
||||
export anode_offset=0
|
||||
export cathode_offset=0
|
||||
#declare -i run=28
|
||||
#while [[ $run -lt 34 ]]; do #runs 1 to 84
|
||||
# wrun=$(printf "%03d" $run)
|
||||
# root -q -l -b -x ../ANASEN_analysis/data/27Al_Data/Run_"$wrun"_mapped.root -e 'tree->Process("Make#Vertex.C+O")'; mv Analyzer_SX3.root 27Al_output/results_run$wrun.root;
|
||||
# run=run+1
|
||||
#done
|
||||
|
||||
declare -i run=50
|
||||
while [[ $run -lt 51 ]]; do #runs 1 to 84
|
||||
wrun=$(printf "%03d" $run)
|
||||
root -q -l -b -x ../ANASEN_analysis/data/27Al_Data/Run_"$wrun"_mapped.root -e 'tree->Process("MakeVertex.C+O","Analyzer_27Al.root")'; mv Analyzer_27Al.root 27Al_output/results_run$wrun.root;
|
||||
run=run+1
|
||||
done
|
||||
|
||||
rm output.root
|
||||
hadd -k -j 4 output.root 27Al_output/results_run*.root
|
||||
mv output.root output_27Al.root
|
||||
|
||||
#root -q -l -b -x -e '.L MakeVertex.C+O';
|
||||
#halfproc=3
|
||||
#parallel --ctag --bar -j $halfproc ./run.sh ::: {028..034} ::: 27Al #color-tag, linebuffer, then run run.sh in parallel
|
||||
|
||||
unset souce_vertex
|
||||
unset DATASET
|
||||
unset flip180
|
||||
108
run_sx3.sh
108
run_sx3.sh
|
|
@ -1,108 +0,0 @@
|
|||
#Alpha runs at different spacer positions
|
||||
# rm results_run*.root
|
||||
export flipa=0
|
||||
export anode_offset=0
|
||||
export cathode_offset=0
|
||||
|
||||
export DATASET="27Al"
|
||||
if [[ 1 -eq 0 ]]; then
|
||||
#root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_009_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run09.root;
|
||||
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_001_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run01.root;
|
||||
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_002_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run02.root;
|
||||
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_003_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run03.root;
|
||||
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_004_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run04.root;
|
||||
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_005_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run05.root;
|
||||
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_006_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run06.root;
|
||||
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_007_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run07.root;
|
||||
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_008_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run08.root;
|
||||
fi
|
||||
|
||||
#exit
|
||||
#alpha+gas 27Al
|
||||
export DATASET="27Al"
|
||||
#root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_009_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run09.root;
|
||||
if [[ 1 -eq 0 ]]; then
|
||||
#export timecut_low=230.0;
|
||||
export timecut_low=400.0;
|
||||
#export timecut_high=400.0;
|
||||
#unset timecut_low, timecut_high
|
||||
#export source_vertex=53.44; root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_009_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run09.root;
|
||||
#export source_vertex=53.44; root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_010_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run10.root;
|
||||
#export source_vertex=53.44; root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_011_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run11.root;
|
||||
export source_vertex=53.44; root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_012_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run12.root;
|
||||
# exit
|
||||
#export source_vertex=53.44; root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_013_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run13.root;
|
||||
#exit
|
||||
fi
|
||||
|
||||
#protons+gas, 27Al
|
||||
#export flip180="1"
|
||||
#export flip180="0"
|
||||
if [[ 1 -eq 0 ]]; then
|
||||
export source_vertex=-200.0; #put the 'source' on the entrance window
|
||||
root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_018_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run18.root;
|
||||
# exit
|
||||
root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_015_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run15.root;
|
||||
root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_017_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run17.root;
|
||||
root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_019_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run19.root;
|
||||
root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_020_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run20.root;
|
||||
root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_021_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run21.root;
|
||||
root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_022_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run22.root;
|
||||
exit
|
||||
fi
|
||||
|
||||
#27Al reaction data
|
||||
#root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_051_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run51.root;
|
||||
#root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_078_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run78.root;
|
||||
#root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_081_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run81.root;
|
||||
|
||||
#root -l -x results_run19.root results_run12.root -e "new TBrowser"
|
||||
#exit
|
||||
export DATASET="17F"
|
||||
if [[ 1 -eq 0 ]]; then
|
||||
root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_005_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run05.root;
|
||||
root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_006_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run06.root;
|
||||
root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_007_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run07.root;
|
||||
root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_008_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run08.root;
|
||||
root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_009_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run09.root;
|
||||
root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_010_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run10.root;
|
||||
root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_011_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run11.root;
|
||||
root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_012_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run12.root;
|
||||
root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_013_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run13.root;
|
||||
root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_014_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run14.root;
|
||||
fi
|
||||
#17F pulser runs
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/PulserRun_015_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run15.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/PulserRun_016_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run16.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/PulserRun_017_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run17.root;
|
||||
|
||||
#17F alpha run with gas
|
||||
if [[ 1 -eq 1 ]]; then
|
||||
export source_vertex=53.44; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_018_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run18.root;
|
||||
export source_vertex=14.24; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_019_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run19.root;
|
||||
export source_vertex=-24.96; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_020_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run20.root;
|
||||
export source_vertex=-73.96; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_021_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run21.root;
|
||||
fi
|
||||
#17F reaction data
|
||||
if [[ 1 -eq 0 ]]; then
|
||||
export source_vertex=-57.28; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_035_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run35.root;
|
||||
#export source_vertex=-8.28; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_036_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root resulrs_run36.root;
|
||||
#export source_vertex=-27.88; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_037_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run37.root;
|
||||
#export source_vertex=11.32; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_038_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run38.root;
|
||||
#export source_vertex=30.92; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_039_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run39.root;
|
||||
#export source_vertex=50.52; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_041_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run41.root;
|
||||
#export source_vertex=70.12; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_042_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run42.root;
|
||||
#export source_vertex=109.32; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_043_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run43.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_043_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run43.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Run_099_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run99.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Run_104_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run104.root;
|
||||
#mv Analyzer_SX3.root results_run19.root;
|
||||
fi
|
||||
unset flipa
|
||||
unset flipc
|
||||
unset anode_offset
|
||||
unset cathode_offset
|
||||
unset souce_vertex
|
||||
unset DATASET
|
||||
unset flip180
|
||||
unset timecut_low, timecut_high
|
||||
111
run_tr.sh
111
run_tr.sh
|
|
@ -1,111 +0,0 @@
|
|||
#Alpha runs at different spacer positions
|
||||
# rm results_run*.root
|
||||
export flipa=0
|
||||
export anode_offset=0
|
||||
export DATASET="27Al"
|
||||
if [[ 1 -eq 0 ]]; then
|
||||
#root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_009_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run09.root;
|
||||
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_001_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run01.root;
|
||||
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_002_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run02.root;
|
||||
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_003_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run03.root;
|
||||
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_004_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run04.root;
|
||||
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_005_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run05.root;
|
||||
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_006_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run06.root;
|
||||
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_007_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run07.root;
|
||||
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_008_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run08.root;
|
||||
fi
|
||||
|
||||
#exit
|
||||
#alpha+gas 27Al
|
||||
export DATASET="27Al"
|
||||
#root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_009_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run09.root;
|
||||
if [[ 1 -eq 1 ]]; then
|
||||
#export timecut_low=230.0;
|
||||
export timecut_low=400.0;
|
||||
#export timecut_high=400.0;
|
||||
#export source_vertex=53.44; root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_009_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run09.root;
|
||||
#export source_vertex=53.44; root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_010_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run10.root;
|
||||
#export source_vertex=53.44; root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_011_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run11.root;
|
||||
export source_vertex=53.44; root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_012_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run12.root;
|
||||
# exit
|
||||
#export source_vertex=53.44; root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_013_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run13.root;
|
||||
#exit
|
||||
fi
|
||||
unset timecut_low
|
||||
|
||||
#protons+gas, 27Al
|
||||
#export flip180="1"
|
||||
#export flip180="0"
|
||||
if [[ 1 -eq 0 ]]; then
|
||||
export flipa=0
|
||||
export anode_offset=0
|
||||
export source_vertex=-200.0; #put the 'source' on the entrance window
|
||||
root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_018_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run18.root;
|
||||
exit
|
||||
root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_015_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run15.root;
|
||||
root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_017_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run17.root;
|
||||
root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_019_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run19.root;
|
||||
root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_020_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run20.root;
|
||||
root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_021_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run21.root;
|
||||
root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_022_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run22.root;
|
||||
exit
|
||||
fi
|
||||
|
||||
#27Al reaction data
|
||||
#root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_051_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run51.root;
|
||||
#root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_078_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run78.root;
|
||||
#root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_081_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run81.root;
|
||||
|
||||
#root -l -x results_run19.root results_run12.root -e "new TBrowser"
|
||||
#exit
|
||||
export DATASET="17F"
|
||||
export flip180="0"
|
||||
if [[ 1 -eq 0 ]]; then
|
||||
root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_005_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run05.root;
|
||||
root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_006_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run06.root;
|
||||
root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_007_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run07.root;
|
||||
root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_008_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run08.root;
|
||||
root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_009_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run09.root;
|
||||
root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_010_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run10.root;
|
||||
root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_011_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run11.root;
|
||||
root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_012_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run12.root;
|
||||
root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_013_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run13.root;
|
||||
root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_014_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run14.root;
|
||||
fi
|
||||
#17F pulser runs
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/PulserRun_015_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run15.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/PulserRun_016_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run16.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/PulserRun_017_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run17.root;
|
||||
|
||||
#17F alpha run with gas
|
||||
if [[ 1 -eq 1 ]]; then
|
||||
export source_vertex=53.44; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_018_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run18.root;
|
||||
# export source_vertex=14.24; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_019_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run19.root;
|
||||
# export source_vertex=-24.96; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_020_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run20.root;
|
||||
# export source_vertex=-73.96; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_021_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run21.root;
|
||||
fi
|
||||
#17F reaction data
|
||||
#export flip180="0"
|
||||
if [[ 1 -eq 0 ]]; then
|
||||
export source_vertex=-57.28; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_035_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run35.root;
|
||||
#export source_vertex=-8.28; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_036_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root resulrs_run36.root;
|
||||
#export source_vertex=-27.88; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_037_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run37.root;
|
||||
#export source_vertex=11.32; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_038_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run38.root;
|
||||
#export source_vertex=30.92; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_039_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run39.root;
|
||||
#export source_vertex=50.52; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_041_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run41.root;
|
||||
#export source_vertex=70.12; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_042_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run42.root;
|
||||
#export source_vertex=109.32; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_043_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run43.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_043_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run43.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Run_099_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run99.root;
|
||||
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Run_104_mapped.root -e 'tree->Process("TrackRecon.C+O")'; mv Analyzer_SX3.root results_run104.root;
|
||||
#mv Analyzer_SX3.root results_run19.root;
|
||||
fi
|
||||
unset flipa
|
||||
unset flipc
|
||||
unset anode_offset
|
||||
unset cathode_offset
|
||||
unset souce_vertex
|
||||
unset DATASET
|
||||
unset flip180
|
||||
unset timecut_low
|
||||
unset timecut_high
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
#include "../../Armory/PC_StepLadder_Correction.h"
|
||||
|
||||
int quit=0;
|
||||
void handler(int){quit=0;}
|
||||
|
||||
int colors[] = {kSpring+3, kRed, kGreen+3, kBlue+3, kViolet, kOrange, kSpring-7, kAzure-5};
|
||||
void scan_offset(){
|
||||
signal(SIGINT,handler);
|
||||
TCanvas c("c1","c1",0,0,1600,800);
|
||||
c.Divide(2,1);
|
||||
|
||||
// TF1 f1("model",model,-200,200,2);
|
||||
// f1.SetNpx(10000);
|
||||
// std::vector<double> pars = {0.0,1.};
|
||||
// f1.SetParameters(pars.data());
|
||||
// f1.SetLineColor(kGreen+2);
|
||||
// f1.SetLineStyle(kLine);
|
||||
|
||||
|
||||
|
||||
|
||||
TFile* f=NULL;
|
||||
std::vector<TFile*> files;
|
||||
int ctr=0;
|
||||
for(int i=12; i<=21; i++) {
|
||||
auto c1=c.cd(1);
|
||||
c1->SetGrid(1,1);
|
||||
f = new TFile(Form("../../results_run%d.root",i));
|
||||
if(i==12) {
|
||||
//TH2F *h2 = (TH2F*)(f->Get("phicut/pczguess_vs_pc_int"));
|
||||
TH2F *h23 = (TH2F*)(f->Get("phicut/pczguess_vs_pc_int_A1C2"));
|
||||
std::cout << "aaa" << h23 << std::endl;
|
||||
h23->SetLineColorAlpha(kOrange,0.75);
|
||||
h23->GetYaxis()->SetRangeUser(-200,200);
|
||||
h23->Draw("box");
|
||||
while(gPad->WaitPrimitive());
|
||||
} else {
|
||||
//TH2F *h2 = (TH2F*)(f->Get("phicut/pczguess_vs_pc_int"));
|
||||
//TH2F *h2 = (TH2F*)(f->Get("pcz_vs_sx3pczguess_A1C2_strip12"));
|
||||
TH2F *h2 = (TH2F*)(f->Get("pcz_vs_sx3pczguess_A1C2"));
|
||||
std::cout << h2 << std::endl;
|
||||
//TH2F *h2 = (TH2F*)(f->Get("hPCQQQ/PC_XY_Projection_QQQ2"));
|
||||
if(!h2) continue;
|
||||
h2->SetTitle(Form("case%d",i));
|
||||
//h2->Draw("colz same");
|
||||
h2->SetLineColorAlpha(colors[ctr],0.75);
|
||||
h2->Draw("box same");
|
||||
// f1.Draw("same");
|
||||
}
|
||||
TF1 eqline("x","x",-200,200);
|
||||
eqline.Draw("SAME");
|
||||
|
||||
c1->Modified();
|
||||
c1->Update();
|
||||
ctr+=1;
|
||||
|
||||
|
||||
auto c2=c.cd(2);
|
||||
c2->SetGrid(1,1);
|
||||
|
||||
TH2F *h3 = (TH2F*)(f->Get("sx3phi_vs_pcphi1"));
|
||||
// TH2F *h2 = (TH2F*)(f->Get("hPCQQQ/PC_XY_Projection_QQQ2"));
|
||||
if(!h3) continue;
|
||||
h3->SetTitle(Form("case%d",i));
|
||||
h3->Draw("colz");
|
||||
eqline.Draw("SAME");
|
||||
c2->Modified();
|
||||
c2->Update();
|
||||
|
||||
while(gPad->WaitPrimitive());
|
||||
|
||||
files.emplace_back(f);
|
||||
std::cout <<"Test" << std::endl;
|
||||
if(i==21) {
|
||||
i=11;
|
||||
c.Clear();
|
||||
c.Divide(2,1);
|
||||
ctr=0;
|
||||
}
|
||||
//if(quit) break;
|
||||
}
|
||||
for(auto file : files) {
|
||||
file->Close();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
#include "../../Armory/PC_StepLadder_Correction.h"
|
||||
|
||||
int quit=0;
|
||||
void handler(int){quit=1;}
|
||||
|
||||
int colors[] = {kSpring+3, kRed, kGreen+3, kBlue+3, kViolet, kOrange, kSpring-7, kAzure-5};
|
||||
void scan_offset_fix(){
|
||||
signal(SIGINT,handler);
|
||||
TCanvas c("c1","c1",0,0,1600,800);
|
||||
c.Divide(2,1);
|
||||
|
||||
TF1 f1("model",model,-200,200,2);
|
||||
f1.SetNpx(10000);
|
||||
std::vector<double> pars = {0.0,1.};
|
||||
f1.SetParameters(pars.data());
|
||||
f1.SetLineColor(kGreen+2);
|
||||
f1.SetLineStyle(kLine);
|
||||
|
||||
|
||||
|
||||
|
||||
TFile* f=NULL;
|
||||
std::vector<TFile*> files;
|
||||
int ctr=0;
|
||||
for(int i=12; i<=21; i++) {
|
||||
if(i==15) continue;
|
||||
auto c1=c.cd(1);
|
||||
c1->SetGrid(1,1);
|
||||
f = new TFile(Form("../../results_run%d.root",i));
|
||||
if(i==12) {
|
||||
//TH2F *h2 = (TH2F*)(f->Get("phicut/pczguess_vs_pc_int"));
|
||||
TH2F *h23 = (TH2F*)(f->Get("pczfix_vs_qqqpczguess_A1C2"));
|
||||
h23->SetLineColorAlpha(kOrange,0.75);
|
||||
h23->Draw("box SAME");
|
||||
|
||||
} else {
|
||||
//TH2F *h2 = (TH2F*)(f->Get("phicut/pczguess_vs_pc_int"));
|
||||
//TH2F *h2 = (TH2F*)(f->Get("pcz_vs_sx3pczguess_A1C2_strip12"));
|
||||
TH2F *h2 = (TH2F*)(f->Get("pczfix_vs_sx3pczguess_A1C2"));
|
||||
//TH2F *h2 = (TH2F*)(f->Get("hPCQQQ/PC_XY_Projection_QQQ2"));
|
||||
if(!h2) continue;
|
||||
h2->SetTitle(Form("case%d",i));
|
||||
//h2->Draw("colz same");
|
||||
h2->SetLineColorAlpha(colors[ctr],0.75);
|
||||
h2->Draw("box same");
|
||||
//f1.Draw("same");
|
||||
}
|
||||
TF1 eqline("x","x",-200,200);
|
||||
eqline.Draw("SAME");
|
||||
c1->Modified();
|
||||
c1->Update();
|
||||
ctr+=1;
|
||||
|
||||
|
||||
auto c2=c.cd(2);
|
||||
c2->SetGrid(1,1);
|
||||
|
||||
TH2F *h3 = (TH2F*)(f->Get("sx3phi_vs_pcphi1"));
|
||||
// TH2F *h2 = (TH2F*)(f->Get("hPCQQQ/PC_XY_Projection_QQQ2"));
|
||||
if(!h3) continue;
|
||||
h3->SetTitle(Form("case%d",i));
|
||||
h3->Draw("colz");
|
||||
eqline.Draw("SAME");
|
||||
c2->Modified();
|
||||
c2->Update();
|
||||
|
||||
while(gPad->WaitPrimitive());
|
||||
|
||||
files.emplace_back(f);
|
||||
if(i==21) {
|
||||
i=11;
|
||||
c.Clear();
|
||||
c.Divide(2,1);
|
||||
ctr=0;
|
||||
}
|
||||
if(quit) break;
|
||||
}
|
||||
for(auto file : files) {
|
||||
file->Close();
|
||||
}
|
||||
}
|
||||
152
shadowplay.py
152
shadowplay.py
|
|
@ -1,152 +0,0 @@
|
|||
import math
|
||||
import csv
|
||||
|
||||
# ==========================================
|
||||
# CONFIGURATION
|
||||
# ==========================================
|
||||
VTK_FILE = "anasen_geometry.vtk"
|
||||
CSV_FILE = "anasen_labels.csv"
|
||||
|
||||
Z_SOURCE = 53.0 # Source position
|
||||
R_A = 37.0 # Anode radius (mm)
|
||||
R_C = 43.0 # Cathode radius (mm)
|
||||
R_SX3 = 88.0 # SX3 Barrel radius (mm)
|
||||
Z_LEN = 348.6 # Total Z length (174.3 * 2 from ClassPW.h)
|
||||
Z_HALF = Z_LEN / 2.0
|
||||
|
||||
points = []
|
||||
lines = []
|
||||
polygons = []
|
||||
cell_colors = []
|
||||
labels = []
|
||||
|
||||
def add_point(x_code, y_code, z_code):
|
||||
# TRANSFORM: Map the C++ Frame (+Y Down, +Z Into Page)
|
||||
# to the Visual ParaView Frame (+Y Up, +Z Out of Page)
|
||||
points.append((x_code, -y_code, -z_code))
|
||||
return len(points) - 1
|
||||
|
||||
def project_shadow(r_wire, phi_minusZ_deg, phi_plusZ_deg, color_code):
|
||||
shadow_pts = []
|
||||
steps = 50
|
||||
for i in range(steps + 1):
|
||||
t = i / float(steps)
|
||||
# 1. Coordinate on the wire in CODE frame
|
||||
z_w = -Z_HALF + (t * Z_LEN)
|
||||
phi_w_deg = phi_minusZ_deg * (1 - t) + phi_plusZ_deg * t
|
||||
phi_w = math.radians(phi_w_deg)
|
||||
|
||||
# 2. Ray from Source through the wire
|
||||
dx = r_wire * math.cos(phi_w)
|
||||
dy = r_wire * math.sin(phi_w)
|
||||
dz = z_w - Z_SOURCE
|
||||
|
||||
# 3. Scale ray until it hits SX3 (R = 88)
|
||||
r_current = math.sqrt(dx**2 + dy**2)
|
||||
alpha = R_SX3 / r_current
|
||||
|
||||
x_proj = alpha * dx
|
||||
y_proj = alpha * dy
|
||||
z_proj = Z_SOURCE + alpha * dz
|
||||
|
||||
shadow_pts.append(add_point(x_proj, y_proj, z_proj))
|
||||
|
||||
lines.append(shadow_pts)
|
||||
cell_colors.append(color_code)
|
||||
|
||||
# ==========================================
|
||||
# 1. GENERATE PC WIRES & SHADOWS (LINES)
|
||||
# ==========================================
|
||||
k = 360.0 / 24.0
|
||||
|
||||
for i in range(24):
|
||||
# --- ANODES ---
|
||||
# From ClassPW.h: offset_a1 = -135 deg, offset_a2 = -90 deg
|
||||
phi_a_minusZ = -k * i - 135.0
|
||||
phi_a_plusZ = -k * i - 90.0
|
||||
|
||||
x_a1, y_a1 = R_A * math.cos(math.radians(phi_a_minusZ)), R_A * math.sin(math.radians(phi_a_minusZ))
|
||||
x_a2, y_a2 = R_A * math.cos(math.radians(phi_a_plusZ)), R_A * math.sin(math.radians(phi_a_plusZ))
|
||||
|
||||
pa1 = add_point(x_a1, y_a1, -Z_HALF)
|
||||
pa2 = add_point(x_a2, y_a2, Z_HALF)
|
||||
lines.append([pa1, pa2])
|
||||
cell_colors.append(1) # Color 1 = Anodes
|
||||
project_shadow(R_A, phi_a_minusZ, phi_a_plusZ, 4)
|
||||
|
||||
# Place label at +Z_visual (which maps from -Z_code in the transform)
|
||||
labels.append((x_a1 * 1.1, -y_a1 * 1.1, Z_HALF + 15, f"A{i}"))
|
||||
|
||||
# --- CATHODES ---
|
||||
# From ClassPW.h: offset_c1 = -97.5 deg, offset_c2 = -142.5 deg
|
||||
phi_c_minusZ = k * i - 97.5
|
||||
phi_c_plusZ = k * i - 142.5
|
||||
|
||||
x_c1, y_c1 = R_C * math.cos(math.radians(phi_c_minusZ)), R_C * math.sin(math.radians(phi_c_minusZ))
|
||||
x_c2, y_c2 = R_C * math.cos(math.radians(phi_c_plusZ)), R_C * math.sin(math.radians(phi_c_plusZ))
|
||||
|
||||
pc1 = add_point(x_c1, y_c1, -Z_HALF)
|
||||
pc2 = add_point(x_c2, y_c2, Z_HALF)
|
||||
lines.append([pc1, pc2])
|
||||
cell_colors.append(2) # Color 2 = Cathodes
|
||||
project_shadow(R_C, phi_c_minusZ, phi_c_plusZ, 5)
|
||||
|
||||
labels.append((x_c1 * 1.1, -y_c1 * 1.1, Z_HALF + 30, f"C{i}"))
|
||||
|
||||
# ==========================================
|
||||
# 2. GENERATE SX3 BARREL (POLYGONS)
|
||||
# ==========================================
|
||||
# Calculate exact strip positions based on MakeVertex.C formulas
|
||||
for det_id in range(12):
|
||||
for stripF in range(4):
|
||||
stripF_rev = 3 - stripF
|
||||
num = (2 * stripF_rev - 3) * 40.30
|
||||
den = 8.0 * R_SX3 * math.cos(math.radians(15.0))
|
||||
beta_n = 15.0 + math.degrees(math.atan2(num, den))
|
||||
|
||||
# phi_n perfectly computes the C++ angle
|
||||
phi_code_deg = ((-det_id + 0.5) * 30.0 + beta_n) + 45.0
|
||||
phi_code = math.radians(phi_code_deg)
|
||||
|
||||
d_phi = 10.0 / R_SX3 # ~6.5 degrees width per strip
|
||||
phi_L = phi_code - (d_phi / 2.0)
|
||||
phi_R = phi_code + (d_phi / 2.0)
|
||||
|
||||
p1 = add_point(R_SX3 * math.cos(phi_L), R_SX3 * math.sin(phi_L), -Z_HALF)
|
||||
p2 = add_point(R_SX3 * math.cos(phi_R), R_SX3 * math.sin(phi_R), -Z_HALF)
|
||||
p3 = add_point(R_SX3 * math.cos(phi_R), R_SX3 * math.sin(phi_R), Z_HALF)
|
||||
p4 = add_point(R_SX3 * math.cos(phi_L), R_SX3 * math.sin(phi_L), Z_HALF)
|
||||
|
||||
polygons.append([p1, p2, p3, p4])
|
||||
cell_colors.append(3) # SX3 Color
|
||||
|
||||
# Place Labels correctly in visual space
|
||||
x_lbl, y_lbl = R_SX3 * 1.15 * math.cos(phi_code), R_SX3 * 1.15 * math.sin(phi_code)
|
||||
labels.append((x_lbl, -y_lbl, 0, f"D{det_id}_S{stripF}"))
|
||||
|
||||
# ==========================================
|
||||
# 3. WRITE VTK AND CSV
|
||||
# ==========================================
|
||||
with open(VTK_FILE, "w") as f:
|
||||
f.write("# vtk DataFile Version 2.0\nANASEN Geometry\nASCII\nDATASET POLYDATA\n")
|
||||
f.write(f"POINTS {len(points)} float\n")
|
||||
for pt in points: f.write(f"{pt[0]:.4f} {pt[1]:.4f} {pt[2]:.4f}\n")
|
||||
|
||||
line_data_size = sum(len(l) + 1 for l in lines)
|
||||
f.write(f"\nLINES {len(lines)} {line_data_size}\n")
|
||||
for l in lines: f.write(f"{len(l)} " + " ".join(map(str, l)) + "\n")
|
||||
|
||||
poly_data_size = sum(len(p) + 1 for p in polygons)
|
||||
f.write(f"\nPOLYGONS {len(polygons)} {poly_data_size}\n")
|
||||
for p in polygons: f.write(f"{len(p)} " + " ".join(map(str, p)) + "\n")
|
||||
|
||||
f.write(f"\nCELL_DATA {len(lines) + len(polygons)}\n")
|
||||
f.write("SCALARS EntityType int 1\nLOOKUP_TABLE default\n")
|
||||
for c in cell_colors: f.write(f"{c}\n")
|
||||
|
||||
with open(CSV_FILE, "w", newline='') as f:
|
||||
writer = csv.writer(f)
|
||||
writer.writerow(["X", "Y", "Z", "Label"])
|
||||
writer.writerows(labels)
|
||||
|
||||
print(f"Generated {VTK_FILE} and {CSV_FILE}.")
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
Histogram Number Slope Intercept
|
||||
24 1 -2.89219e-10
|
||||
25 0.942098 -0.105169
|
||||
26 0.980862 -0.732032
|
||||
27 0.982975 -2.22704
|
||||
28 0.978815 -1.51477
|
||||
29 0.965245 -2.19515
|
||||
30 0.945384 -0.892599
|
||||
31 0.977408 -0.908592
|
||||
32 0.919546 3.25464
|
||||
33 0.972194 2.44956
|
||||
34 0.92852 5.44745
|
||||
35 0.947098 1.40531
|
||||
36 0.875491 -1.13145
|
||||
37 1.95496 -1735.58
|
||||
38 0.970862 2.86019
|
||||
40 0.91793 -3.80615
|
||||
41 0.913897 -2.12964
|
||||
42 0.954014 -0.760604
|
||||
43 0.993616 -1.40278
|
||||
45 0.926169 -21.2016
|
||||
46 1.00577 -2.14281
|
||||
47 0.943312 -1.26464
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
#Histogram Number Slope Intercept
|
||||
0 0.931015 -1.35431
|
||||
1 1 -1.87356e-10
|
||||
2 0.964185 1.49989
|
||||
3 0.92638 -1.30621
|
||||
4 0.905569 1.00834
|
||||
5 0.901182 0.470903
|
||||
6 0.853932 3.32687
|
||||
7 0.942785 1.08887
|
||||
8 0.878904 -0.0107433
|
||||
9 0.922662 -2.32259
|
||||
10 0.903343 8.38332
|
||||
11 0.914227 6.56108
|
||||
12 0.961008 23.0982
|
||||
13 0.920976 5.22104
|
||||
14 0.936584 31.5073
|
||||
15 0.959044 5.43267
|
||||
16 0.95263 -0.404053
|
||||
17 0.90953 4.82833
|
||||
18 0.940277 10.3629
|
||||
19 0.86746 -17.8678
|
||||
20 1.00683 4.76371
|
||||
21 0.968342 -43.9496
|
||||
22 0.892882 -32.0742
|
||||
23 0.933615 1.10704
|
||||
24 1 -2.89219e-10
|
||||
25 0.942098 -0.105169
|
||||
26 0.980862 -0.732032
|
||||
27 0.982975 -2.22704
|
||||
28 0.978815 -1.51477
|
||||
29 0.965245 -2.19515
|
||||
30 0.945384 -0.892599
|
||||
31 0.977408 -0.908592
|
||||
32 0.919546 3.25464
|
||||
33 0.972194 2.44956
|
||||
34 0.92852 5.44745
|
||||
35 0.947098 1.40531
|
||||
36 0.875491 -1.13145
|
||||
37 1 0
|
||||
38 0.970862 2.86019
|
||||
39 1 0
|
||||
40 0.91793 -3.80615
|
||||
41 0.913897 -2.12964
|
||||
42 0.954014 -0.760604
|
||||
43 0.993616 -1.40278
|
||||
44 1 0
|
||||
45 0.926169 -21.2016
|
||||
46 1.00577 -2.14281
|
||||
47 0.943312 -1.26464
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
#Histogram Number Slope Intercept
|
||||
0 0.937314 -16.871
|
||||
1 0 0
|
||||
2 0.965461 -1.54376
|
||||
3 0.926501 -3.27662
|
||||
4 0.905634 2.54577
|
||||
5 0.905634 -11.0387
|
||||
6 0.853919 6.23079
|
||||
7 0.945588 -9.54044
|
||||
8 0.884454 -11.8262
|
||||
9 0.922501 -3.42538
|
||||
10 0.903053 9.28069
|
||||
11 0.914653 9.87642
|
||||
12 0.965332 13.2526
|
||||
13 0.923847 -3.41775
|
||||
14 0.93845 25.9901
|
||||
15 0.955424 12.324
|
||||
16 0.95116 4.99595
|
||||
17 0.910745 2.86648
|
||||
18 0.941376 4.57217
|
||||
19 0.871622 932.111
|
||||
20 1.00624 7.86358
|
||||
21 0.969834 -45.001
|
||||
22 0.89304 -31.5635
|
||||
23 0.933226 4.02193
|
||||
24 0 0
|
||||
25 0.941896 6.16135
|
||||
26 0.980284 2.86886
|
||||
27 0.983166 -3.82952
|
||||
28 0.978704 -2.89713
|
||||
29 0.964947 2.25786
|
||||
30 0.94514 0.925074
|
||||
31 0.977231 1.6493
|
||||
32 0.919527 5.82742
|
||||
33 0.972243 2.88061
|
||||
34 0.928892 7.61384
|
||||
35 0.947376 -0.644223
|
||||
36 0.875342 6.066
|
||||
37 0 0
|
||||
38 0.970953 6.262
|
||||
39 0 0
|
||||
40 0.918408 -3.27891
|
||||
41 0.913619 4.11288
|
||||
42 0.954083 2.21261
|
||||
43 0.993037 5.48924
|
||||
44 0 0
|
||||
45 0.926406 -19.719
|
||||
46 1.00459 5.14574
|
||||
47 0.942483 5.54183
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
Histogram Number Slope Intercept
|
||||
0 0.931015 -1.35431
|
||||
1 1 -1.87356e-10
|
||||
2 0.964185 1.49989
|
||||
3 0.92638 -1.30621
|
||||
4 0.905569 1.00834
|
||||
5 0.901182 0.470903
|
||||
6 0.853932 3.32687
|
||||
7 0.942785 1.08887
|
||||
8 0.878904 -0.0107433
|
||||
9 0.922662 -2.32259
|
||||
10 0.903343 8.38332
|
||||
11 0.914227 6.56108
|
||||
12 0.961008 23.0982
|
||||
13 0.920976 5.22104
|
||||
14 0.936584 31.5073
|
||||
15 0.959044 5.43267
|
||||
16 0.95263 -0.404053
|
||||
17 0.90953 4.82833
|
||||
18 0.940277 10.3629
|
||||
19 0.86746 -17.8678
|
||||
20 1.00683 4.76371
|
||||
21 0.968342 -43.9496
|
||||
22 0.892882 -32.0742
|
||||
23 0.933615 1.10704
|
||||
24 1 -2.89219e-10
|
||||
25 0.942098 -0.105169
|
||||
26 0.980862 -0.732032
|
||||
27 0.982975 -2.22704
|
||||
28 0.978815 -1.51477
|
||||
29 0.965245 -2.19515
|
||||
30 0.945384 -0.892599
|
||||
31 0.977408 -0.908592
|
||||
32 0.919546 3.25464
|
||||
33 0.972194 2.44956
|
||||
34 0.92852 5.44745
|
||||
35 0.947098 1.40531
|
||||
36 0.875491 -1.13145
|
||||
37 1 0
|
||||
38 0.970862 2.86019
|
||||
39 1 0
|
||||
40 0.91793 -3.80615
|
||||
41 0.913897 -2.12964
|
||||
42 0.954014 -0.760604
|
||||
43 0.993616 -1.40278
|
||||
44 1 0
|
||||
45 0.926169 -21.2016
|
||||
46 1.00577 -2.14281
|
||||
47 0.943312 -1.26464
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
Histogram Number Slope Intercept
|
||||
1 1 -1.87356e-10
|
||||
2 0.964185 1.49989
|
||||
3 0.92638 -1.30621
|
||||
4 0.905569 1.00834
|
||||
5 0.901182 0.470903
|
||||
7 0.942785 1.08887
|
||||
8 0.878904 -0.0107433
|
||||
10 0.903343 8.38332
|
||||
11 0.914227 6.56108
|
||||
12 0.961008 23.0982
|
||||
13 0.920976 5.22104
|
||||
14 0.936584 31.5073
|
||||
15 0.959044 5.43267
|
||||
16 0.95263 -0.404053
|
||||
17 0.90953 4.82833
|
||||
18 0.940277 10.3629
|
||||
20 1.00683 4.76371
|
||||
21 0.968342 -43.9496
|
||||
22 0.892882 -32.0742
|
||||
23 0.933615 1.10704
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
1 front 0 back 3 3.68208
|
||||
1 front 0 back 0 3.89631
|
||||
1 front 1 back 2 4.44599
|
||||
1 front 1 back 3 3.81311
|
||||
1 front 1 back 0 3.98321
|
||||
1 front 2 back 2 4.52103
|
||||
1 front 2 back 3 3.68208
|
||||
1 front 2 back 0 3.95382
|
||||
1 front 3 back 2 4.55951
|
||||
1 front 3 back 3 3.68208
|
||||
1 front 3 back 0 3.89631
|
||||
3 front 1 back 2 3.81311
|
||||
3 front 1 back 1 3.92485
|
||||
3 front 1 back 3 4.13701
|
||||
3 front 1 back 0 4.26886
|
||||
3 front 2 back 2 3.86817
|
||||
3 front 2 back 1 4.04334
|
||||
3 front 2 back 3 3.98321
|
||||
3 front 2 back 0 4.23512
|
||||
3 front 3 back 2 3.92485
|
||||
3 front 3 back 1 3.92485
|
||||
3 front 3 back 3 3.95382
|
||||
3 front 3 back 0 4.13701
|
||||
7 front 0 back 2 3.65694
|
||||
7 front 0 back 1 3.53625
|
||||
7 front 0 back 3 4.23512
|
||||
7 front 0 back 0 3.60769
|
||||
7 front 1 back 2 3.65694
|
||||
7 front 1 back 1 3.53625
|
||||
7 front 1 back 3 4.23512
|
||||
7 front 1 back 0 3.58356
|
||||
7 front 2 back 2 3.68208
|
||||
7 front 2 back 1 3.55975
|
||||
7 front 2 back 3 4.13701
|
||||
7 front 2 back 0 3.60769
|
||||
7 front 3 back 2 3.68208
|
||||
7 front 3 back 1 3.53625
|
||||
7 front 3 back 3 4.23512
|
||||
7 front 3 back 0 3.58356
|
||||
9 front 0 back 2 3.68208
|
||||
9 front 0 back 1 3.53625
|
||||
9 front 0 back 3 3.51306
|
||||
9 front 0 back 0 3.42327
|
||||
9 front 1 back 2 3.70756
|
||||
9 front 1 back 1 3.49018
|
||||
9 front 1 back 3 3.63215
|
||||
9 front 1 back 0 3.46759
|
||||
9 front 2 back 2 3.70756
|
||||
9 front 2 back 1 3.55975
|
||||
9 front 2 back 3 3.53625
|
||||
9 front 2 back 0 3.44529
|
||||
9 front 3 back 2 3.7334
|
||||
9 front 3 back 1 3.51306
|
||||
9 front 3 back 3 3.53625
|
||||
9 front 3 back 0 3.42327
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
1 0 0 1.
|
||||
1 1 0 1.
|
||||
1 2 0 1.
|
||||
1 3 0 1.
|
||||
1 0 1 1.
|
||||
1 1 1 1.
|
||||
1 2 1 1.
|
||||
1 3 1 1.
|
||||
1 0 2 1.
|
||||
1 1 2 1.
|
||||
1 2 2 1.
|
||||
1 3 2 1.
|
||||
1 0 3 1.
|
||||
1 1 3 1.
|
||||
1 2 3 1.
|
||||
1 3 3 1.
|
||||
7 0 0 1.
|
||||
7 1 0 1.
|
||||
7 2 0 1.
|
||||
7 3 0 1.
|
||||
7 0 1 1.
|
||||
7 1 1 1.
|
||||
7 2 1 1.
|
||||
7 3 1 1.
|
||||
7 0 2 1.
|
||||
7 1 2 1.
|
||||
7 2 2 1.
|
||||
7 3 2 1.
|
||||
7 0 3 1.
|
||||
7 1 3 1.
|
||||
7 2 3 1.
|
||||
7 3 3 1.
|
||||
0 0 0 1.
|
||||
0 1 0 1.
|
||||
0 2 0 1.
|
||||
0 3 0 1.
|
||||
0 0 1 1.
|
||||
0 1 1 1.
|
||||
0 2 1 1.
|
||||
0 3 1 1.
|
||||
0 0 2 1.
|
||||
0 1 2 1.
|
||||
0 2 2 1.
|
||||
0 3 2 1.
|
||||
0 0 3 1.
|
||||
0 1 3 1.
|
||||
0 2 3 1.
|
||||
0 3 3 1.
|
||||
2 0 0 1.
|
||||
2 1 0 1.
|
||||
2 2 0 1.
|
||||
2 3 0 1.
|
||||
2 0 1 1.
|
||||
2 1 1 1.
|
||||
2 2 1 1.
|
||||
2 3 1 1.
|
||||
2 0 2 1.
|
||||
2 1 2 1.
|
||||
2 2 2 1.
|
||||
2 3 2 1.
|
||||
2 0 3 1.
|
||||
2 1 3 1.
|
||||
2 2 3 1.
|
||||
2 3 3 1.
|
||||
9 0 0 1.
|
||||
9 1 0 1.
|
||||
9 2 0 1.
|
||||
9 3 0 1.
|
||||
9 0 1 1.
|
||||
9 1 1 1.
|
||||
9 2 1 1.
|
||||
9 3 1 1.
|
||||
9 0 2 1.
|
||||
9 1 2 1.
|
||||
9 2 2 1.
|
||||
9 3 2 1.
|
||||
9 0 3 1.
|
||||
9 1 3 1.
|
||||
9 2 3 1.
|
||||
9 3 3 1.
|
||||
3 0 0 1.
|
||||
3 1 0 1.
|
||||
3 2 0 1.
|
||||
3 3 0 1.
|
||||
3 0 1 1.
|
||||
3 1 1 1.
|
||||
3 2 1 1.
|
||||
3 3 1 1.
|
||||
3 0 2 1.
|
||||
3 1 2 1.
|
||||
3 2 2 1.
|
||||
3 3 2 1.
|
||||
3 0 3 1.
|
||||
3 1 3 1.
|
||||
3 2 3 1.
|
||||
3 3 3 1.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user