Improved SX3 calibrations, step-ladder correction to pcz.
A lot of the files are identical to old ones, but the main changes are: 1) EXFit2.C in sx3cal - Finds front/right gains for each strip using the known middle two pad edges, but gainmatches all backs 2) Define new 'fix' loci, arising from the step-ladder correction to A1C2 events. This is tested in scratch/sx3z_vs_pcz/testmodel.h, will be given a better name in the future. 3) Explore A1C2 and A1C3 loci in detail 4) environment variables to 'flip' and 'offset' wires during sort. All env vars are set in shell scripts that call them 5) environment variables that allow for timestamp bounds to be set and unset. Default limiting values are 0 and dbl_max so no harm done unless these specific env vars are set. 6) Some bookkeeping indicating 27Al instead of 26Al in all places.
This commit is contained in:
parent
e61a63ea13
commit
b2242ccacd
84
anasen_analysis_vignesh/.vscode/c_cpp_properties.json
vendored
Normal file
84
anasen_analysis_vignesh/.vscode/c_cpp_properties.json
vendored
Normal file
|
|
@ -0,0 +1,84 @@
|
||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Hades",
|
||||||
|
"includePath": [
|
||||||
|
"${workspaceFolder}/**",
|
||||||
|
"/usr/include/x86_64-linux-gnu/qt6/**",
|
||||||
|
"/usr/local/cern/root_v6.26.06/include/**"
|
||||||
|
],
|
||||||
|
"defines": [],
|
||||||
|
"compilerPath": "/usr/bin/gcc",
|
||||||
|
"cStandard": "c17",
|
||||||
|
"cppStandard": "gnu++17",
|
||||||
|
"intelliSenseMode": "linux-gcc-x64"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "RyanUbuntu",
|
||||||
|
"includePath": [
|
||||||
|
"${workspaceFolder}/**",
|
||||||
|
"/usr/include/x86_64-linux-gnu/qt6/**",
|
||||||
|
"/opt/root/include/**"
|
||||||
|
],
|
||||||
|
"defines": [],
|
||||||
|
"compilerPath": "/usr/bin/gcc",
|
||||||
|
"cStandard": "c17",
|
||||||
|
"cppStandard": "gnu++17",
|
||||||
|
"intelliSenseMode": "linux-gcc-x64"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Anasen",
|
||||||
|
"includePath": [
|
||||||
|
"${workspaceFolder}/**",
|
||||||
|
"/usr/include/x86_64-linux-gnu/qt6/**",
|
||||||
|
"/opt/root/include/**"
|
||||||
|
],
|
||||||
|
"defines": [],
|
||||||
|
"compilerPath": "/usr/bin/gcc",
|
||||||
|
"cStandard": "c17",
|
||||||
|
"cppStandard": "gnu++17",
|
||||||
|
"intelliSenseMode": "linux-gcc-x64"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Splitpole",
|
||||||
|
"includePath": [
|
||||||
|
"${workspaceFolder}/**",
|
||||||
|
"/usr/include/x86_64-linux-gnu/qt6/**",
|
||||||
|
"/home/splitpole/cern/root/include/**",
|
||||||
|
"/usr/include/x86_64-linux-gnu/qt6/QtWidgets",
|
||||||
|
"/usr/include/x86_64-linux-gnu/qt6/QtCore"
|
||||||
|
],
|
||||||
|
"defines": [],
|
||||||
|
"compilerPath": "/usr/bin/gcc",
|
||||||
|
"cStandard": "c17",
|
||||||
|
"cppStandard": "gnu++17",
|
||||||
|
"intelliSenseMode": "linux-gcc-x64"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Penguin",
|
||||||
|
"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": [
|
||||||
|
"${workspaceFolder}/**",
|
||||||
|
"/home/vsitaraman/root/include/**"
|
||||||
|
],
|
||||||
|
"defines": [],
|
||||||
|
"compilerPath": "/usr/bin/gcc",
|
||||||
|
"cStandard": "c17",
|
||||||
|
"cppStandard": "gnu++17",
|
||||||
|
"intelliSenseMode": "linux-gcc-x64"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": 4
|
||||||
|
}
|
||||||
130
anasen_analysis_vignesh/.vscode/settings.json
vendored
Normal file
130
anasen_analysis_vignesh/.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,130 @@
|
||||||
|
{
|
||||||
|
"files.associations": {
|
||||||
|
"ryanScript.C": "cpp",
|
||||||
|
"ryanSelector.C": "cpp",
|
||||||
|
"array": "cpp",
|
||||||
|
"deque": "cpp",
|
||||||
|
"list": "cpp",
|
||||||
|
"string": "cpp",
|
||||||
|
"unordered_map": "cpp",
|
||||||
|
"unordered_set": "cpp",
|
||||||
|
"vector": "cpp",
|
||||||
|
"string_view": "cpp",
|
||||||
|
"initializer_list": "cpp",
|
||||||
|
"span": "cpp",
|
||||||
|
"ApplyMapping.C": "cpp",
|
||||||
|
"script.C": "cpp",
|
||||||
|
"Analyzer.C": "cpp",
|
||||||
|
"PreAnalysis.C": "cpp",
|
||||||
|
"ANASEN_model.C": "cpp",
|
||||||
|
"algorithm": "cpp",
|
||||||
|
"allocator": "cpp",
|
||||||
|
"limits": "cpp",
|
||||||
|
"atomic": "cpp",
|
||||||
|
"bit": "cpp",
|
||||||
|
"*.tcc": "cpp",
|
||||||
|
"cctype": "cpp",
|
||||||
|
"chrono": "cpp",
|
||||||
|
"clocale": "cpp",
|
||||||
|
"cmath": "cpp",
|
||||||
|
"codecvt": "cpp",
|
||||||
|
"compare": "cpp",
|
||||||
|
"complex": "cpp",
|
||||||
|
"concepts": "cpp",
|
||||||
|
"condition_variable": "cpp",
|
||||||
|
"cstdarg": "cpp",
|
||||||
|
"cstddef": "cpp",
|
||||||
|
"cstdint": "cpp",
|
||||||
|
"cstdio": "cpp",
|
||||||
|
"cstdlib": "cpp",
|
||||||
|
"cstring": "cpp",
|
||||||
|
"ctime": "cpp",
|
||||||
|
"cwchar": "cpp",
|
||||||
|
"cwctype": "cpp",
|
||||||
|
"map": "cpp",
|
||||||
|
"set": "cpp",
|
||||||
|
"exception": "cpp",
|
||||||
|
"functional": "cpp",
|
||||||
|
"iterator": "cpp",
|
||||||
|
"memory": "cpp",
|
||||||
|
"memory_resource": "cpp",
|
||||||
|
"numeric": "cpp",
|
||||||
|
"optional": "cpp",
|
||||||
|
"random": "cpp",
|
||||||
|
"ratio": "cpp",
|
||||||
|
"source_location": "cpp",
|
||||||
|
"system_error": "cpp",
|
||||||
|
"tuple": "cpp",
|
||||||
|
"type_traits": "cpp",
|
||||||
|
"utility": "cpp",
|
||||||
|
"fstream": "cpp",
|
||||||
|
"future": "cpp",
|
||||||
|
"iomanip": "cpp",
|
||||||
|
"iosfwd": "cpp",
|
||||||
|
"iostream": "cpp",
|
||||||
|
"istream": "cpp",
|
||||||
|
"mutex": "cpp",
|
||||||
|
"new": "cpp",
|
||||||
|
"numbers": "cpp",
|
||||||
|
"ostream": "cpp",
|
||||||
|
"semaphore": "cpp",
|
||||||
|
"sstream": "cpp",
|
||||||
|
"stdexcept": "cpp",
|
||||||
|
"stop_token": "cpp",
|
||||||
|
"streambuf": "cpp",
|
||||||
|
"thread": "cpp",
|
||||||
|
"cinttypes": "cpp",
|
||||||
|
"typeinfo": "cpp",
|
||||||
|
"variant": "cpp",
|
||||||
|
"bitset": "cpp",
|
||||||
|
"forward_list": "cpp",
|
||||||
|
"anasenMS.C": "cpp",
|
||||||
|
"*.icc": "cpp",
|
||||||
|
"any": "cpp",
|
||||||
|
"cfenv": "cpp",
|
||||||
|
"csignal": "cpp",
|
||||||
|
"regex": "cpp",
|
||||||
|
"scoped_allocator": "cpp",
|
||||||
|
"shared_mutex": "cpp",
|
||||||
|
"valarray": "cpp",
|
||||||
|
"processRun.C": "cpp",
|
||||||
|
"TrackRecon.C": "cpp",
|
||||||
|
"processRuns.C": "cpp",
|
||||||
|
"Analysis.C": "cpp",
|
||||||
|
"datastructs.h": "c",
|
||||||
|
"ANASENPlotEdit.C": "cpp",
|
||||||
|
"GetMean_Q3_new.C": "cpp",
|
||||||
|
"AlphaCal_new.C": "cpp",
|
||||||
|
"f1.C": "cpp",
|
||||||
|
"GeoCal_Maria_new.C": "cpp",
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
"github-enterprise.uri": "https://fsunuc.physics.fsu.edu"
|
||||||
|
}
|
||||||
BIN
anasen_analysis_vignesh/27Al
Normal file
BIN
anasen_analysis_vignesh/27Al
Normal file
Binary file not shown.
20
anasen_analysis_vignesh/Analysis.C
Normal file
20
anasen_analysis_vignesh/Analysis.C
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
#include "TChain.h"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Analysis(int start, int end) {
|
||||||
|
// Create a TChain
|
||||||
|
TChain *chain = new TChain("tree");
|
||||||
|
for(int i = start; i < end+1; i++) {
|
||||||
|
chain->Add(Form("data/root_data/Run_%03d_mapped.root", i));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process the chain using Analyzer.C+
|
||||||
|
chain->Process("Analyzer.C+");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define a macro with the same name as the script
|
||||||
|
void Analysis() {
|
||||||
|
Analysis(72, 194); // Adjust the range if needed
|
||||||
|
}
|
||||||
876
anasen_analysis_vignesh/Analyzer.C
Normal file
876
anasen_analysis_vignesh/Analyzer.C
Normal file
|
|
@ -0,0 +1,876 @@
|
||||||
|
#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>
|
||||||
|
|
||||||
|
TH2F *hsx3IndexVE;
|
||||||
|
TH2F *hqqqIndexVE;
|
||||||
|
TH2F *hpcIndexVE;
|
||||||
|
|
||||||
|
TH2F *hpcIndexVE_GM;
|
||||||
|
TH2F *hsx3Coin;
|
||||||
|
TH2F *hqqqCoin;
|
||||||
|
TH2F *hpcCoin;
|
||||||
|
TH2F *hAVCcoin;
|
||||||
|
|
||||||
|
TH2F *hqqqPolar;
|
||||||
|
TH2F *hsx3VpcIndex;
|
||||||
|
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);
|
||||||
|
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);
|
||||||
|
|
||||||
|
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);
|
||||||
|
hqqqVpcIndex = new TH2F("hqqqVpcindex", "qqq vs pc; qqq index; pc index", 4 * 2 * 16, 0, 4 * 2 * 16, 48, 0, 48);
|
||||||
|
|
||||||
|
hqqqVpcE = new TH2F("hqqqVpcEnergy", "qqq vs pc; qqq energy; pc energy", 400, 0, 5000, 800, 0, 16000);
|
||||||
|
|
||||||
|
hsx3VpcE = new TH2F("hsx3VpcEnergy", "sx3 vs pc; sx3 energy; pc energy", 400, 0, 5000, 800, 0, 16000);
|
||||||
|
|
||||||
|
hZProj = new TH1F("hZProj", "Z Projection", 1200, -600, 600);
|
||||||
|
hPCZProj = new TH1F("hPCZProj", "PC Z Projection", 600, -300, 300);
|
||||||
|
|
||||||
|
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);
|
||||||
|
// }
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
|
||||||
|
// 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
|
||||||
|
// //======================= 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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++)
|
||||||
|
{
|
||||||
|
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] );
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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
|
||||||
|
|
||||||
|
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++)
|
||||||
|
{
|
||||||
|
if (j == i)
|
||||||
|
continue;
|
||||||
|
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++)
|
||||||
|
{
|
||||||
|
// 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;
|
||||||
|
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;
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
if (!HitNonZero)
|
||||||
|
{
|
||||||
|
double x = rho * TMath::Cos(theta);
|
||||||
|
double y = rho * TMath::Sin(theta);
|
||||||
|
hitPos.SetXYZ(x, y, 23 + 75 + 30);
|
||||||
|
HitNonZero = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// //======================= PC
|
||||||
|
|
||||||
|
// Calculate the crossover points and put them into an array
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
// 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] > 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())))
|
||||||
|
{
|
||||||
|
|
||||||
|
for (const auto &anode : anodeHits)
|
||||||
|
{
|
||||||
|
aID = anode.first;
|
||||||
|
aE = anode.second;
|
||||||
|
aESum += aE;
|
||||||
|
if (aE > aEMax)
|
||||||
|
{
|
||||||
|
aEMax = aE;
|
||||||
|
aIDMax = aID;
|
||||||
|
}
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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++)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TVector3 anodeIntersection;
|
||||||
|
anodeIntersection.Clear();
|
||||||
|
// Implementing a method for PC reconstruction using a single Anode event
|
||||||
|
// if (anodeHits.size() == 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anodeIntersection.Z() != 0)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
hZProj->Fill(pw_contr.GetZ0());
|
||||||
|
}
|
||||||
|
|
||||||
|
// ########################################################### Track constrcution
|
||||||
|
|
||||||
|
// ############################## DO THE KINEMATICS
|
||||||
|
|
||||||
|
return kTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Analyzer::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);
|
||||||
|
// // hZProj->Draw();
|
||||||
|
// hanVScatsum->Draw("colz");
|
||||||
|
|
||||||
|
TFile *outRoot = new TFile("Histograms.root", "RECREATE");
|
||||||
|
|
||||||
|
if (!outRoot->IsOpen())
|
||||||
|
{
|
||||||
|
std::cerr << "Error opening file for writing!" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// // // 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();
|
||||||
|
}
|
||||||
129
anasen_analysis_vignesh/Analyzer.h
Normal file
129
anasen_analysis_vignesh/Analyzer.h
Normal file
|
|
@ -0,0 +1,129 @@
|
||||||
|
#ifndef Analyzer_h
|
||||||
|
#define Analyzer_h
|
||||||
|
|
||||||
|
#include <TROOT.h>
|
||||||
|
#include <TChain.h>
|
||||||
|
#include <TFile.h>
|
||||||
|
#include <TSelector.h>
|
||||||
|
|
||||||
|
#include "Armory/ClassDet.h"
|
||||||
|
|
||||||
|
class Analyzer : 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;
|
||||||
|
|
||||||
|
// 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; //!
|
||||||
|
|
||||||
|
|
||||||
|
Analyzer(TTree * /*tree*/ =0) : fChain(0) { }
|
||||||
|
virtual ~Analyzer() { }
|
||||||
|
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(Analyzer,0);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef Analyzer_cxx
|
||||||
|
void Analyzer::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);
|
||||||
|
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 Analyzer::Notify(){
|
||||||
|
|
||||||
|
return kTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Analyzer::SlaveBegin(TTree * /*tree*/){
|
||||||
|
|
||||||
|
TString option = GetOption();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Analyzer::SlaveTerminate(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // #ifdef Analyzer_cxx
|
||||||
402
anasen_analysis_vignesh/Analyzer1.C
Normal file
402
anasen_analysis_vignesh/Analyzer1.C
Normal file
|
|
@ -0,0 +1,402 @@
|
||||||
|
#define Analyzer1_cxx
|
||||||
|
|
||||||
|
#include "Analyzer1.h"
|
||||||
|
#include <TH2.h>
|
||||||
|
#include <TStyle.h>
|
||||||
|
#include <TCanvas.h>
|
||||||
|
#include <TMath.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;
|
||||||
|
int padID = 0;
|
||||||
|
|
||||||
|
SX3 sx3_contr;
|
||||||
|
PW pw_contr;
|
||||||
|
TVector3 hitPos;
|
||||||
|
bool HitNonZero;
|
||||||
|
|
||||||
|
TH1F * hZProj;
|
||||||
|
|
||||||
|
void Analyzer1::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, 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);
|
||||||
|
|
||||||
|
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", "Z Projection", 1200, -600, 600);
|
||||||
|
|
||||||
|
hanVScatsum = new TH2F("hanVScatsum", "Anode vs Cathode Sum; Anode E; Cathode E", 400,0 , 10000, 400, 0 , 16000);
|
||||||
|
|
||||||
|
sx3_contr.ConstructGeo();
|
||||||
|
pw_contr.ConstructGeo();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Bool_t Analyzer1::Process(Long64_t entry){
|
||||||
|
|
||||||
|
// 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
|
||||||
|
// //======================= 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( 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 ){
|
||||||
|
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(pc.index[j]==4){
|
||||||
|
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(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
|
||||||
|
|
||||||
|
int chWedge = -1;
|
||||||
|
int chRing = -1;
|
||||||
|
if( qqq.ch[i] < qqq.ch[j]){
|
||||||
|
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);
|
||||||
|
|
||||||
|
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 ){
|
||||||
|
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 );
|
||||||
|
|
||||||
|
if( E.size()>=3 ){
|
||||||
|
|
||||||
|
int aID = 0;
|
||||||
|
int cID = 0;
|
||||||
|
|
||||||
|
float aE = 0;
|
||||||
|
float cE = 0;
|
||||||
|
bool multi_an =false;
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
// for( int k = 0; k < qqq.multi; k++){
|
||||||
|
// if(qqq.index[k]==75 && pc.index[k]==2 && pc.e[k]>100){
|
||||||
|
for(int l=0;l<E.size();l++){
|
||||||
|
if(E[l].first<24 ){
|
||||||
|
if(!multi_an){
|
||||||
|
aE = E[l].second;
|
||||||
|
}
|
||||||
|
multi_an=true;
|
||||||
|
}
|
||||||
|
else if (E[l].first>=24){
|
||||||
|
cE = E[l].second + cE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
hanVScatsum->Fill(aE,cE);
|
||||||
|
|
||||||
|
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];
|
||||||
|
}
|
||||||
|
|
||||||
|
if( HitNonZero){
|
||||||
|
pw_contr.CalTrack( hitPos, aID, cID);
|
||||||
|
hZProj->Fill(pw_contr.GetZ0());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//########################################################### Track constrcution
|
||||||
|
|
||||||
|
|
||||||
|
//############################## DO THE KINEMATICS
|
||||||
|
|
||||||
|
|
||||||
|
return kTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Analyzer1::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);
|
||||||
|
// hZProj->Draw();
|
||||||
|
hanVScatsum->Draw("colz");
|
||||||
|
|
||||||
|
}
|
||||||
114
anasen_analysis_vignesh/Analyzer1.h
Normal file
114
anasen_analysis_vignesh/Analyzer1.h
Normal file
|
|
@ -0,0 +1,114 @@
|
||||||
|
#ifndef Analyzer1_h
|
||||||
|
#define Analyzer1_h
|
||||||
|
|
||||||
|
#include <TROOT.h>
|
||||||
|
#include <TChain.h>
|
||||||
|
#include <TFile.h>
|
||||||
|
#include <TSelector.h>
|
||||||
|
|
||||||
|
#include "Armory/ClassDet.h"
|
||||||
|
|
||||||
|
class Analyzer1 : 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; //!
|
||||||
|
|
||||||
|
Analyzer1(TTree * /*tree*/ =0) : fChain(0) { }
|
||||||
|
virtual ~Analyzer1() { }
|
||||||
|
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(Analyzer1,0);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef Analyzer1_cxx
|
||||||
|
void Analyzer1::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 Analyzer1::Notify(){
|
||||||
|
|
||||||
|
return kTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Analyzer1::SlaveBegin(TTree * /*tree*/){
|
||||||
|
|
||||||
|
TString option = GetOption();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Analyzer1::SlaveTerminate(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // #ifdef Analyzer_cxx
|
||||||
121
anasen_analysis_vignesh/Armory/ANASEN_model.C
Normal file
121
anasen_analysis_vignesh/Armory/ANASEN_model.C
Normal file
|
|
@ -0,0 +1,121 @@
|
||||||
|
#include "TGeoManager.h"
|
||||||
|
#include "TGeoVolume.h"
|
||||||
|
#include "TGeoBBox.h"
|
||||||
|
#include "TCanvas.h"
|
||||||
|
#include "TPolyMarker3D.h"
|
||||||
|
#include "TPolyLine3D.h"
|
||||||
|
|
||||||
|
#include "TMath.h"
|
||||||
|
|
||||||
|
void ANASEN_model(int anodeID1 = -1, int anodeID2 = -1, int cathodeID1 = -1, int cathodeID2 = -1 ) {
|
||||||
|
|
||||||
|
// Create ROOT manager and master volume
|
||||||
|
TGeoManager *geom = new TGeoManager("Detector", "ANASEN");
|
||||||
|
|
||||||
|
//--- define some materials
|
||||||
|
TGeoMaterial *matVacuum = new TGeoMaterial("Vacuum", 0,0,0);
|
||||||
|
TGeoMaterial *matAl = new TGeoMaterial("Al", 26.98,13,2.7);
|
||||||
|
//--- define some media
|
||||||
|
TGeoMedium *Vacuum = new TGeoMedium("Vacuum",1, matVacuum);
|
||||||
|
TGeoMedium *Al = new TGeoMedium("Root Material",2, matAl);
|
||||||
|
|
||||||
|
//--- make the top container volume
|
||||||
|
Double_t worldx = 200.; //mm
|
||||||
|
Double_t worldy = 200.; //mm
|
||||||
|
Double_t worldz = 200.; //mm
|
||||||
|
TGeoVolume *worldBox = geom->MakeBox("ROOT", Vacuum, worldx, worldy, worldz);
|
||||||
|
geom->SetTopVolume(worldBox);
|
||||||
|
|
||||||
|
//--- making axis
|
||||||
|
TGeoVolume *axisX = geom->MakeTube("axisX", Al, 0, 0.1, 5.);
|
||||||
|
axisX->SetLineColor(1);
|
||||||
|
worldBox->AddNode(axisX, 1, new TGeoCombiTrans(5, 0, 0., new TGeoRotation("rotA", 90., 90., 0.)));
|
||||||
|
|
||||||
|
TGeoVolume *axisY = geom->MakeTube("axisY", Al, 0, 0.1, 5.);
|
||||||
|
axisY->SetLineColor(1);
|
||||||
|
worldBox->AddNode(axisY, 1, new TGeoCombiTrans(0, 5, 0., new TGeoRotation("rotB", 0., 90., 0.)));
|
||||||
|
|
||||||
|
TGeoVolume *axisZ = geom->MakeTube("axisZ", Al, 0, 0.1, 5.);
|
||||||
|
axisZ->SetLineColor(1);
|
||||||
|
worldBox->AddNode(axisZ, 1, new TGeoTranslation(0, 0, 5));
|
||||||
|
|
||||||
|
//--- making ANASEN
|
||||||
|
const int nWire = 24;
|
||||||
|
const int wireShift = 3;
|
||||||
|
const int zLen = 300; //mm
|
||||||
|
const int radiusA = 38;
|
||||||
|
const int radiusC = 43;
|
||||||
|
|
||||||
|
//.......... convert to wire center dimensions
|
||||||
|
double dAngle = wireShift * TMath::TwoPi() / nWire;
|
||||||
|
double radiusAnew = radiusA * TMath::Cos( dAngle / 2.);
|
||||||
|
double wireALength = TMath::Sqrt( zLen*zLen + TMath::Power(2* radiusA * TMath::Sin(dAngle/2),2) );
|
||||||
|
double wireATheta = TMath::ATan2( 2* radiusA * TMath::Sin( dAngle / 2.), zLen);
|
||||||
|
|
||||||
|
// printf(" dAngle : %f\n", dAngle);
|
||||||
|
// printf(" newRadius : %f\n", radiusAnew);
|
||||||
|
// printf("wireLength : %f\n", wireALength);
|
||||||
|
// printf("wire Theta : %f\n", wireATheta);
|
||||||
|
|
||||||
|
TGeoVolume *pcA = geom->MakeTube("tub1", Al, 0, 0.01, wireALength/2);
|
||||||
|
pcA->SetLineColor(4);
|
||||||
|
|
||||||
|
for( int i = 0; i < nWire; i++){
|
||||||
|
if( anodeID2 >= 0 && (i < anodeID1 || i > anodeID2) ) continue;
|
||||||
|
worldBox->AddNode(pcA, i+1, new TGeoCombiTrans( radiusAnew * TMath::Cos( TMath::TwoPi() / nWire *i + dAngle / 2),
|
||||||
|
radiusAnew * TMath::Sin( TMath::TwoPi() / nWire *i + dAngle / 2),
|
||||||
|
0,
|
||||||
|
new TGeoRotation("rot1", 360/ nWire * (i + wireShift/2.), wireATheta * 180/ TMath::Pi(), 0.)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
double radiusCnew = radiusC * TMath::Cos( dAngle / 2.);
|
||||||
|
double wireCLength = TMath::Sqrt( zLen*zLen + TMath::Power(2* radiusC * TMath::Sin(dAngle/2),2) );
|
||||||
|
double wireCTheta = TMath::ATan2( 2* radiusC * TMath::Sin( dAngle / 2.), zLen);
|
||||||
|
|
||||||
|
TGeoVolume *pcC = geom->MakeTube("tub2", Al, 0, 0.01, wireCLength/2);
|
||||||
|
pcC->SetLineColor(6);
|
||||||
|
for( int i = 0; i < nWire; i++){
|
||||||
|
if( cathodeID2 >= 0 && (i < cathodeID1 || i > cathodeID2) ) continue;
|
||||||
|
worldBox->AddNode(pcC, i+1, new TGeoCombiTrans( radiusCnew * TMath::Cos( TMath::TwoPi() / nWire *i - dAngle/2),
|
||||||
|
radiusCnew * TMath::Sin( TMath::TwoPi() / nWire *i - dAngle/2),
|
||||||
|
0,
|
||||||
|
new TGeoRotation("rot1", 360/ nWire * (i - wireShift/2.), -wireCTheta * 180/ TMath::Pi(), 0.)));
|
||||||
|
}
|
||||||
|
|
||||||
|
const int nSX3 = 12;
|
||||||
|
const int sx3Radius = 88;
|
||||||
|
const int sx3Width = 40;
|
||||||
|
const int sx3Length = 75;
|
||||||
|
const int sx3Gap = 5;
|
||||||
|
|
||||||
|
TGeoVolume * sx3 = geom->MakeBox("box", Al, 0.1, sx3Width/2, sx3Length/2);
|
||||||
|
sx3->SetLineColor(kGreen+3);
|
||||||
|
for( int i = 0; i < nSX3; i++){
|
||||||
|
worldBox->AddNode(sx3, 2*i+1., new TGeoCombiTrans( sx3Radius * TMath::Cos( TMath::TwoPi() / nSX3 * (i + 0.5)),
|
||||||
|
sx3Radius * TMath::Sin( TMath::TwoPi() / nSX3 * (i + 0.5)),
|
||||||
|
sx3Length/2+sx3Gap,
|
||||||
|
new TGeoRotation("rot1", 360/nSX3 * (i + 0.5), 0., 0.)));
|
||||||
|
|
||||||
|
worldBox->AddNode(sx3, 2*i+2., new TGeoCombiTrans( sx3Radius * TMath::Cos( TMath::TwoPi() / nSX3 * (i + 0.5)),
|
||||||
|
sx3Radius * TMath::Sin( TMath::TwoPi() / nSX3 * (i + 0.5)),
|
||||||
|
-sx3Length/2-sx3Gap,
|
||||||
|
new TGeoRotation("rot1", 360/nSX3 * (i + 0.5), 0., 0.)));
|
||||||
|
}
|
||||||
|
|
||||||
|
const int qqqR1 = 50;
|
||||||
|
const int qqqR2 = 100;
|
||||||
|
TGeoVolume *qqq = geom->MakeTubs("qqq", Al, qqqR1, qqqR2, 0.5, 5, 85);
|
||||||
|
qqq->SetLineColor(7);
|
||||||
|
for( int i = 0; i < 4; i++){
|
||||||
|
worldBox->AddNode(qqq, i+1, new TGeoCombiTrans( 0,
|
||||||
|
0,
|
||||||
|
100,
|
||||||
|
new TGeoRotation("rot1", 360/4 * (i), 0., 0.)));
|
||||||
|
}
|
||||||
|
|
||||||
|
geom->CloseGeometry();
|
||||||
|
|
||||||
|
geom->SetVisLevel(4);
|
||||||
|
worldBox->Draw("ogle");
|
||||||
|
}
|
||||||
121
anasen_analysis_vignesh/Armory/Armory/ANASEN_model.C
Normal file
121
anasen_analysis_vignesh/Armory/Armory/ANASEN_model.C
Normal file
|
|
@ -0,0 +1,121 @@
|
||||||
|
#include "TGeoManager.h"
|
||||||
|
#include "TGeoVolume.h"
|
||||||
|
#include "TGeoBBox.h"
|
||||||
|
#include "TCanvas.h"
|
||||||
|
#include "TPolyMarker3D.h"
|
||||||
|
#include "TPolyLine3D.h"
|
||||||
|
|
||||||
|
#include "TMath.h"
|
||||||
|
|
||||||
|
void ANASEN_model(int anodeID1 = -1, int anodeID2 = -1, int cathodeID1 = -1, int cathodeID2 = -1 ) {
|
||||||
|
|
||||||
|
// Create ROOT manager and master volume
|
||||||
|
TGeoManager *geom = new TGeoManager("Detector", "ANASEN");
|
||||||
|
|
||||||
|
//--- define some materials
|
||||||
|
TGeoMaterial *matVacuum = new TGeoMaterial("Vacuum", 0,0,0);
|
||||||
|
TGeoMaterial *matAl = new TGeoMaterial("Al", 26.98,13,2.7);
|
||||||
|
//--- define some media
|
||||||
|
TGeoMedium *Vacuum = new TGeoMedium("Vacuum",1, matVacuum);
|
||||||
|
TGeoMedium *Al = new TGeoMedium("Root Material",2, matAl);
|
||||||
|
|
||||||
|
//--- make the top container volume
|
||||||
|
Double_t worldx = 200.; //mm
|
||||||
|
Double_t worldy = 200.; //mm
|
||||||
|
Double_t worldz = 200.; //mm
|
||||||
|
TGeoVolume *worldBox = geom->MakeBox("ROOT", Vacuum, worldx, worldy, worldz);
|
||||||
|
geom->SetTopVolume(worldBox);
|
||||||
|
|
||||||
|
//--- making axis
|
||||||
|
TGeoVolume *axisX = geom->MakeTube("axisX", Al, 0, 0.1, 5.);
|
||||||
|
axisX->SetLineColor(1);
|
||||||
|
worldBox->AddNode(axisX, 1, new TGeoCombiTrans(5, 0, 0., new TGeoRotation("rotA", 90., 90., 0.)));
|
||||||
|
|
||||||
|
TGeoVolume *axisY = geom->MakeTube("axisY", Al, 0, 0.1, 5.);
|
||||||
|
axisY->SetLineColor(1);
|
||||||
|
worldBox->AddNode(axisY, 1, new TGeoCombiTrans(0, 5, 0., new TGeoRotation("rotB", 0., 90., 0.)));
|
||||||
|
|
||||||
|
TGeoVolume *axisZ = geom->MakeTube("axisZ", Al, 0, 0.1, 5.);
|
||||||
|
axisZ->SetLineColor(1);
|
||||||
|
worldBox->AddNode(axisZ, 1, new TGeoTranslation(0, 0, 5));
|
||||||
|
|
||||||
|
//--- making ANASEN
|
||||||
|
const int nWire = 24;
|
||||||
|
const int wireShift = 3;
|
||||||
|
const int zLen = 300; //mm
|
||||||
|
const int radiusA = 38;
|
||||||
|
const int radiusC = 43;
|
||||||
|
|
||||||
|
//.......... convert to wire center dimensions
|
||||||
|
double dAngle = wireShift * TMath::TwoPi() / nWire;
|
||||||
|
double radiusAnew = radiusA * TMath::Cos( dAngle / 2.);
|
||||||
|
double wireALength = TMath::Sqrt( zLen*zLen + TMath::Power(2* radiusA * TMath::Sin(dAngle/2),2) );
|
||||||
|
double wireATheta = TMath::ATan2( 2* radiusA * TMath::Sin( dAngle / 2.), zLen);
|
||||||
|
|
||||||
|
// printf(" dAngle : %f\n", dAngle);
|
||||||
|
// printf(" newRadius : %f\n", radiusAnew);
|
||||||
|
// printf("wireLength : %f\n", wireALength);
|
||||||
|
// printf("wire Theta : %f\n", wireATheta);
|
||||||
|
|
||||||
|
TGeoVolume *pcA = geom->MakeTube("tub1", Al, 0, 0.01, wireALength/2);
|
||||||
|
pcA->SetLineColor(4);
|
||||||
|
|
||||||
|
for( int i = 0; i < nWire; i++){
|
||||||
|
if( anodeID2 >= 0 && (i < anodeID1 || i > anodeID2) ) continue;
|
||||||
|
worldBox->AddNode(pcA, i+1, new TGeoCombiTrans( radiusAnew * TMath::Cos( TMath::TwoPi() / nWire *i + dAngle / 2),
|
||||||
|
radiusAnew * TMath::Sin( TMath::TwoPi() / nWire *i + dAngle / 2),
|
||||||
|
0,
|
||||||
|
new TGeoRotation("rot1", 360/ nWire * (i + wireShift/2.), wireATheta * 180/ TMath::Pi(), 0.)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
double radiusCnew = radiusC * TMath::Cos( dAngle / 2.);
|
||||||
|
double wireCLength = TMath::Sqrt( zLen*zLen + TMath::Power(2* radiusC * TMath::Sin(dAngle/2),2) );
|
||||||
|
double wireCTheta = TMath::ATan2( 2* radiusC * TMath::Sin( dAngle / 2.), zLen);
|
||||||
|
|
||||||
|
TGeoVolume *pcC = geom->MakeTube("tub2", Al, 0, 0.01, wireCLength/2);
|
||||||
|
pcC->SetLineColor(6);
|
||||||
|
for( int i = 0; i < nWire; i++){
|
||||||
|
if( cathodeID2 >= 0 && (i < cathodeID1 || i > cathodeID2) ) continue;
|
||||||
|
worldBox->AddNode(pcC, i+1, new TGeoCombiTrans( radiusCnew * TMath::Cos( TMath::TwoPi() / nWire *i - dAngle/2),
|
||||||
|
radiusCnew * TMath::Sin( TMath::TwoPi() / nWire *i - dAngle/2),
|
||||||
|
0,
|
||||||
|
new TGeoRotation("rot1", 360/ nWire * (i - wireShift/2.), -wireCTheta * 180/ TMath::Pi(), 0.)));
|
||||||
|
}
|
||||||
|
|
||||||
|
const int nSX3 = 12;
|
||||||
|
const int sx3Radius = 88;
|
||||||
|
const int sx3Width = 40;
|
||||||
|
const int sx3Length = 75;
|
||||||
|
const int sx3Gap = 5;
|
||||||
|
|
||||||
|
TGeoVolume * sx3 = geom->MakeBox("box", Al, 0.1, sx3Width/2, sx3Length/2);
|
||||||
|
sx3->SetLineColor(kGreen+3);
|
||||||
|
for( int i = 0; i < nSX3; i++){
|
||||||
|
worldBox->AddNode(sx3, 2*i+1., new TGeoCombiTrans( sx3Radius * TMath::Cos( TMath::TwoPi() / nSX3 * (i + 0.5)),
|
||||||
|
sx3Radius * TMath::Sin( TMath::TwoPi() / nSX3 * (i + 0.5)),
|
||||||
|
sx3Length/2+sx3Gap,
|
||||||
|
new TGeoRotation("rot1", 360/nSX3 * (i + 0.5), 0., 0.)));
|
||||||
|
|
||||||
|
worldBox->AddNode(sx3, 2*i+2., new TGeoCombiTrans( sx3Radius * TMath::Cos( TMath::TwoPi() / nSX3 * (i + 0.5)),
|
||||||
|
sx3Radius * TMath::Sin( TMath::TwoPi() / nSX3 * (i + 0.5)),
|
||||||
|
-sx3Length/2-sx3Gap,
|
||||||
|
new TGeoRotation("rot1", 360/nSX3 * (i + 0.5), 0., 0.)));
|
||||||
|
}
|
||||||
|
|
||||||
|
const int qqqR1 = 50;
|
||||||
|
const int qqqR2 = 100;
|
||||||
|
TGeoVolume *qqq = geom->MakeTubs("qqq", Al, qqqR1, qqqR2, 0.5, 5, 85);
|
||||||
|
qqq->SetLineColor(7);
|
||||||
|
for( int i = 0; i < 4; i++){
|
||||||
|
worldBox->AddNode(qqq, i+1, new TGeoCombiTrans( 0,
|
||||||
|
0,
|
||||||
|
100,
|
||||||
|
new TGeoRotation("rot1", 360/4 * (i), 0., 0.)));
|
||||||
|
}
|
||||||
|
|
||||||
|
geom->CloseGeometry();
|
||||||
|
|
||||||
|
geom->SetVisLevel(4);
|
||||||
|
worldBox->Draw("ogle");
|
||||||
|
}
|
||||||
314
anasen_analysis_vignesh/Armory/Armory/ClassAnasen.h
Normal file
314
anasen_analysis_vignesh/Armory/Armory/ClassAnasen.h
Normal file
|
|
@ -0,0 +1,314 @@
|
||||||
|
#ifndef ClassAnasen_h
|
||||||
|
#define ClassAnasen_h
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include <TMath.h>
|
||||||
|
#include <TVector3.h>
|
||||||
|
|
||||||
|
#include "TGeoManager.h"
|
||||||
|
#include "TGeoVolume.h"
|
||||||
|
#include "TGeoBBox.h"
|
||||||
|
#include "TCanvas.h"
|
||||||
|
#include "TPolyMarker3D.h"
|
||||||
|
#include "TPolyLine3D.h"
|
||||||
|
#include "TRandom.h"
|
||||||
|
|
||||||
|
#include "ClassSX3.h"
|
||||||
|
#include "ClassPW.h"
|
||||||
|
|
||||||
|
class ANASEN{
|
||||||
|
public:
|
||||||
|
ANASEN();
|
||||||
|
~ANASEN();
|
||||||
|
|
||||||
|
void SetUncertainties(double sx3W, double sx3L, double anode, double cathode){
|
||||||
|
sigmaA = anode;
|
||||||
|
sigmaC = cathode;
|
||||||
|
sigmaW = sx3W;
|
||||||
|
sigmaL = sx3L;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawTrack(TVector3 pos, TVector3 direction, bool drawEstimatedTrack = false);
|
||||||
|
void DrawDeducedTrack(TVector3 sx3Pos, int anodeID, int cathodeID);
|
||||||
|
void DrawAnasen(int anodeID1 = -1,
|
||||||
|
int anodeID2 = -1,
|
||||||
|
int cathodeID1 = -1,
|
||||||
|
int cathodeID2 = -1,
|
||||||
|
int sx3ID = -1,
|
||||||
|
bool DrawQQQ = false );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PW * GetPW() {return pw;}
|
||||||
|
SX3 * GetSX3() {return sx3;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
PW * pw;
|
||||||
|
SX3 * sx3;
|
||||||
|
|
||||||
|
double sigmaA, sigmaC; // pw
|
||||||
|
double sigmaW, sigmaL; // sx3
|
||||||
|
|
||||||
|
const float qqqR1 = 50;
|
||||||
|
const float qqqR2 = 100;
|
||||||
|
const float qqqZPos = 23 + 75 + 30;
|
||||||
|
|
||||||
|
void CalGeometry();
|
||||||
|
|
||||||
|
TGeoManager *geom;
|
||||||
|
TGeoVolume *worldBox;
|
||||||
|
|
||||||
|
void Construct3DModel(int anodeID1 = -1,
|
||||||
|
int anodeID2 = -1,
|
||||||
|
int cathodeID1 = -1,
|
||||||
|
int cathodeID2 = -1,
|
||||||
|
int sx3ID = -1,
|
||||||
|
bool DrawQQQ = true);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//!==============================================
|
||||||
|
inline ANASEN::ANASEN(){
|
||||||
|
|
||||||
|
pw = new PW();
|
||||||
|
sx3 = new SX3();
|
||||||
|
|
||||||
|
CalGeometry();
|
||||||
|
|
||||||
|
geom = nullptr;
|
||||||
|
worldBox = nullptr;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
inline ANASEN::~ANASEN(){
|
||||||
|
|
||||||
|
delete geom;
|
||||||
|
|
||||||
|
delete pw;
|
||||||
|
delete sx3;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//!==============================================
|
||||||
|
inline void ANASEN::CalGeometry(){
|
||||||
|
|
||||||
|
sx3->ConstructGeo();
|
||||||
|
pw->ConstructGeo();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void ANASEN::Construct3DModel(int anodeID1, int anodeID2, int cathodeID1, int cathodeID2, int sx3ID, bool DrawQQQ ){
|
||||||
|
|
||||||
|
if( geom ) delete geom;
|
||||||
|
|
||||||
|
// Create ROOT manager and master volume
|
||||||
|
geom = new TGeoManager("Detector", "ANASEN");
|
||||||
|
|
||||||
|
//--- define some materials
|
||||||
|
TGeoMaterial *matVacuum = new TGeoMaterial("Vacuum", 0,0,0);
|
||||||
|
TGeoMaterial *matAl = new TGeoMaterial("Al", 26.98,13,2.7);
|
||||||
|
//--- define some media
|
||||||
|
TGeoMedium *Vacuum = new TGeoMedium("Vacuum",1, matVacuum);
|
||||||
|
TGeoMedium *Al = new TGeoMedium("Root Material",2, matAl);
|
||||||
|
|
||||||
|
//--- make the top container volume
|
||||||
|
Double_t worldx = 200.; //mm
|
||||||
|
Double_t worldy = 200.; //mm
|
||||||
|
Double_t worldz = 200.; //mm
|
||||||
|
worldBox = geom->MakeBox("ROOT", Vacuum, worldx, worldy, worldz);
|
||||||
|
geom->SetTopVolume(worldBox);
|
||||||
|
|
||||||
|
//--- making axis
|
||||||
|
TGeoVolume *axisX = geom->MakeTube("axisX", Al, 0, 0.1, 5.);
|
||||||
|
axisX->SetLineColor(1);
|
||||||
|
worldBox->AddNode(axisX, 1, new TGeoCombiTrans(5, 0, 0., new TGeoRotation("rotA", 90., 90., 0.)));
|
||||||
|
TGeoVolume *axisY = geom->MakeTube("axisY", Al, 0, 0.1, 5.);
|
||||||
|
axisY->SetLineColor(1);
|
||||||
|
worldBox->AddNode(axisY, 1, new TGeoCombiTrans(0, 5, 0., new TGeoRotation("rotB", 0., 90., 0.)));
|
||||||
|
TGeoVolume *axisZ = geom->MakeTube("axisZ", Al, 0, 0.1, 5.);
|
||||||
|
axisZ->SetLineColor(1);
|
||||||
|
worldBox->AddNode(axisZ, 1, new TGeoTranslation(0, 0, 5));
|
||||||
|
|
||||||
|
//.......... convert to wire center dimensions
|
||||||
|
TGeoVolume *pcA = geom->MakeTube("tub1", Al, 0, 0.01, pw->GetAnodeLength()/2);
|
||||||
|
pcA->SetLineColor(4);
|
||||||
|
|
||||||
|
int startID = 0;
|
||||||
|
int endID = pw->GetNumWire() - 1;
|
||||||
|
|
||||||
|
if( anodeID1 >= 0 && anodeID2 >= 0 ){
|
||||||
|
startID = anodeID1;
|
||||||
|
endID = anodeID2;
|
||||||
|
if( anodeID1 > anodeID2 ) {
|
||||||
|
endID = pw->GetNumWire() + anodeID2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for( int i = startID; i <= endID; i++){
|
||||||
|
TVector3 a = pw->GetAnodneMid(i);
|
||||||
|
double wireTheta = pw->GetAnodeTheta(i) * TMath::RadToDeg();
|
||||||
|
double wirePhi = pw->GetAnodePhi(i) * TMath::RadToDeg() + 90;
|
||||||
|
|
||||||
|
worldBox->AddNode(pcA, i+1, new TGeoCombiTrans( a.X(),
|
||||||
|
a.Y(),
|
||||||
|
a.Z(),
|
||||||
|
new TGeoRotation("rot1", wirePhi, wireTheta, 0.)));
|
||||||
|
}
|
||||||
|
|
||||||
|
TGeoVolume *pcC = geom->MakeTube("tub2", Al, 0, 0.01, pw->GetCathodeLength()/2);
|
||||||
|
pcC->SetLineColor(6);
|
||||||
|
|
||||||
|
startID = 0;
|
||||||
|
endID = pw->GetNumWire() - 1;
|
||||||
|
|
||||||
|
if( cathodeID1 >= 0 && cathodeID2 >= 0 ){
|
||||||
|
startID = cathodeID1;
|
||||||
|
endID = cathodeID2;
|
||||||
|
if( cathodeID1 > cathodeID2 ) {
|
||||||
|
endID = pw->GetNumWire() + cathodeID2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for( int i = startID; i <= endID; i++){
|
||||||
|
TVector3 a = pw->GetCathodneMid(i);
|
||||||
|
double wireTheta = pw->GetCathodeTheta(i) * TMath::RadToDeg();
|
||||||
|
double wirePhi = pw->GetCathodePhi(i) * TMath::RadToDeg() + 90;
|
||||||
|
|
||||||
|
worldBox->AddNode(pcC, i+1, new TGeoCombiTrans( a.X(),
|
||||||
|
a.Y(),
|
||||||
|
a.Z(),
|
||||||
|
new TGeoRotation("rot1", wirePhi , wireTheta, 0.)));
|
||||||
|
}
|
||||||
|
|
||||||
|
TGeoVolume * sx3Det = geom->MakeBox("box", Al, 0.1, sx3->GetWidth()/2, sx3->GetLength()/2);
|
||||||
|
sx3Det->SetLineColor(kGreen+3);
|
||||||
|
|
||||||
|
for( int i = 0; i < sx3->GetNumDet(); i++){
|
||||||
|
if( sx3ID != -1 && i != sx3ID ) continue;
|
||||||
|
TVector3 aUp = sx3->GetUpMid(i); // center of the SX3 upstream
|
||||||
|
TVector3 aDn = sx3->GetDnMid(i); // center of the SX3 Downstream
|
||||||
|
double phi = sx3->GetDetPhi(i) * TMath::RadToDeg() + 90;
|
||||||
|
|
||||||
|
worldBox->AddNode(sx3Det, 2*i+1., new TGeoCombiTrans( aUp.X(),
|
||||||
|
aUp.Y(),
|
||||||
|
aUp.Z(),
|
||||||
|
new TGeoRotation("rot1", phi, 0., 0.)));
|
||||||
|
worldBox->AddNode(sx3Det, 2*i+1., new TGeoCombiTrans( aDn.X(),
|
||||||
|
aDn.Y(),
|
||||||
|
aDn.Z(),
|
||||||
|
new TGeoRotation("rot1", phi, 0., 0.)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if( DrawQQQ ){
|
||||||
|
TGeoVolume *qqq = geom->MakeTubs("qqq", Al, qqqR1, qqqR2, 0.5, 5, 85);
|
||||||
|
qqq->SetLineColor(7);
|
||||||
|
for( int i = 0; i < 4; i++){
|
||||||
|
worldBox->AddNode(qqq, i+1, new TGeoCombiTrans( 0,
|
||||||
|
0,
|
||||||
|
qqqZPos,
|
||||||
|
new TGeoRotation("rot1", 360/4 * (i), 0., 0.)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//!============================================== Drawing functions
|
||||||
|
inline void ANASEN::DrawAnasen(int anodeID1, int anodeID2, int cathodeID1, int cathodeID2, int sx3ID, bool DrawQQQ ){
|
||||||
|
|
||||||
|
Construct3DModel(anodeID1, anodeID2, cathodeID1, cathodeID2, sx3ID, DrawQQQ);
|
||||||
|
|
||||||
|
geom->CloseGeometry();
|
||||||
|
geom->SetVisLevel(4);
|
||||||
|
worldBox->Draw("ogle");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void ANASEN::DrawTrack(TVector3 pos, TVector3 direction, bool drawEstimatedTrack){
|
||||||
|
|
||||||
|
pw->FindWireID(pos, direction);
|
||||||
|
sx3->FindSX3Pos(pos, direction);
|
||||||
|
|
||||||
|
std::pair<short, short> wireID = pw->GetNearestID();
|
||||||
|
|
||||||
|
Construct3DModel(wireID.first, wireID.first, wireID.second, wireID.second, -1, false);
|
||||||
|
|
||||||
|
double theta = direction.Theta() * TMath::RadToDeg();
|
||||||
|
double phi = direction.Phi() * TMath::RadToDeg();
|
||||||
|
// printf("Theta, Phi = %.2f %.2f \n", theta, phi);
|
||||||
|
// pos.Print();
|
||||||
|
TGeoVolume * Track = geom->MakeTube("track", 0, 0, 0.1, 150.);
|
||||||
|
Track->SetLineColor(kRed);
|
||||||
|
worldBox->AddNode(Track, 1, new TGeoCombiTrans( pos.X(), pos.Y(), pos.Z(), new TGeoRotation("rotA", phi + 90, theta, 0.)));
|
||||||
|
|
||||||
|
TGeoVolume * startPos = geom->MakeSphere("startPos", 0, 0, 3);
|
||||||
|
startPos->SetLineColor(kBlack);
|
||||||
|
worldBox->AddNode(startPos, 3, new TGeoCombiTrans( pos.X(), pos.Y(), pos.Z(), new TGeoRotation("rotA", 0, 0, 0.)));
|
||||||
|
|
||||||
|
if( sx3->GetID() >= 0 ){
|
||||||
|
//TVector3 hitPos = sx3->GetHitPos();
|
||||||
|
TVector3 hitPos = sx3->GetHitPosWithSigma(sigmaW, sigmaL);
|
||||||
|
|
||||||
|
TGeoVolume * hit = geom->MakeSphere("hitpos", 0, 0, 3);
|
||||||
|
hit->SetLineColor(kRed);
|
||||||
|
worldBox->AddNode(hit, 2, new TGeoCombiTrans( hitPos.X(), hitPos.Y(), hitPos.Z(), new TGeoRotation("rotA", 0, 0, 0.)));
|
||||||
|
|
||||||
|
if( drawEstimatedTrack ){
|
||||||
|
|
||||||
|
{//===== simple
|
||||||
|
pw->CalTrack(hitPos, wireID.first, wireID.second, true);
|
||||||
|
|
||||||
|
double thetaDeduce = pw->GetTrackTheta() * TMath::RadToDeg();
|
||||||
|
double phiDeduce = pw->GetTrackPhi() * TMath::RadToDeg();
|
||||||
|
|
||||||
|
TGeoVolume * trackDeduce = geom->MakeTube("trackDeduce", 0, 0, 0.1, 100.);
|
||||||
|
trackDeduce->SetLineColor(kOrange);
|
||||||
|
worldBox->AddNode(trackDeduce, 1, new TGeoCombiTrans( hitPos.X(), hitPos.Y(), hitPos.Z(), new TGeoRotation("rotA", phiDeduce + 90, thetaDeduce, 0.)));
|
||||||
|
}
|
||||||
|
|
||||||
|
{//===== complicated
|
||||||
|
PWHitInfo hitInfo = pw->GetHitInfo();
|
||||||
|
pw->CalTrack2(hitPos, hitInfo, sigmaA, sigmaC, true);
|
||||||
|
|
||||||
|
double thetaDeduce = pw->GetTrackTheta() * TMath::RadToDeg();
|
||||||
|
double phiDeduce = pw->GetTrackPhi() * TMath::RadToDeg();
|
||||||
|
|
||||||
|
TGeoVolume * trackDeduce2 = geom->MakeTube("trackDeduce2", 0, 0, 0.1, 100.);
|
||||||
|
trackDeduce2->SetLineColor(kGreen);
|
||||||
|
worldBox->AddNode(trackDeduce2, 1, new TGeoCombiTrans( hitPos.X(), hitPos.Y(), hitPos.Z(), new TGeoRotation("rotA", phiDeduce + 90, thetaDeduce, 0.)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
geom->CloseGeometry();
|
||||||
|
geom->SetVisLevel(4);
|
||||||
|
worldBox->Draw("ogle");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void ANASEN::DrawDeducedTrack(TVector3 sx3Pos, int anodeID, int cathodeID){
|
||||||
|
|
||||||
|
pw->CalTrack(sx3Pos, anodeID, cathodeID);
|
||||||
|
|
||||||
|
Construct3DModel(anodeID, anodeID, cathodeID, cathodeID, -1, false);
|
||||||
|
|
||||||
|
double theta = pw->GetTrackTheta() * TMath::RadToDeg();
|
||||||
|
double phi = pw->GetTrackPhi() * TMath::RadToDeg();
|
||||||
|
|
||||||
|
TGeoVolume * Track = geom->MakeTube("axisX", 0, 0, 0.1, 100.);
|
||||||
|
Track->SetLineColor(kRed);
|
||||||
|
worldBox->AddNode(Track, 1, new TGeoCombiTrans( sx3Pos.X(), sx3Pos.Y(), sx3Pos.Z(), new TGeoRotation("rotA", phi + 90, theta, 0.)));
|
||||||
|
|
||||||
|
TGeoVolume * hit = geom->MakeSphere("hitpos", 0, 0, 3);
|
||||||
|
hit->SetLineColor(kRed);
|
||||||
|
worldBox->AddNode(hit, 2, new TGeoCombiTrans( sx3Pos.X(), sx3Pos.Y(), sx3Pos.Z(), new TGeoRotation("rotA", 0, 0, 0.)));
|
||||||
|
|
||||||
|
geom->CloseGeometry();
|
||||||
|
geom->SetVisLevel(4);
|
||||||
|
worldBox->Draw("ogle");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
64
anasen_analysis_vignesh/Armory/Armory/ClassDet.h
Normal file
64
anasen_analysis_vignesh/Armory/Armory/ClassDet.h
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
#ifndef ClassDet_h
|
||||||
|
#define ClassDet_h
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
#define MAXMULTI 1000
|
||||||
|
|
||||||
|
class Det{
|
||||||
|
public:
|
||||||
|
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 short sn[MAXMULTI];
|
||||||
|
unsigned short digiCh[MAXMULTI];
|
||||||
|
|
||||||
|
unsigned short index[MAXMULTI]; // id * nCh + ch;
|
||||||
|
bool used[MAXMULTI];
|
||||||
|
|
||||||
|
void Clear(){
|
||||||
|
multi = 0;
|
||||||
|
for( int i = 0; i < MAXMULTI; i++){
|
||||||
|
id[i] = 0;
|
||||||
|
ch[i] = 0;
|
||||||
|
e[i] = 0;
|
||||||
|
t[i] = 0;
|
||||||
|
index[i] = 0;
|
||||||
|
sn[i] = 0;
|
||||||
|
digiCh[i] = 0;
|
||||||
|
used[i] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Print(){
|
||||||
|
printf("=============================== multi : %u\n", multi);
|
||||||
|
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){
|
||||||
|
nID = maxID;
|
||||||
|
nCh = maxCh;
|
||||||
|
}
|
||||||
|
|
||||||
|
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
anasen_analysis_vignesh/Armory/Armory/ClassPC1An.h
Normal file
246
anasen_analysis_vignesh/Armory/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
|
||||||
315
anasen_analysis_vignesh/Armory/Armory/ClassPW.h
Normal file
315
anasen_analysis_vignesh/Armory/Armory/ClassPW.h
Normal file
|
|
@ -0,0 +1,315 @@
|
||||||
|
#ifndef ClassPW_h
|
||||||
|
#define ClassPW_h
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include <TMath.h>
|
||||||
|
#include <TVector3.h>
|
||||||
|
#include <TRandom.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;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Coord
|
||||||
|
{
|
||||||
|
float x, y, z;
|
||||||
|
Coord() : x(0), y(0), z(0) {}
|
||||||
|
Coord(const TVector3 &vec)
|
||||||
|
{
|
||||||
|
x = vec.X(); // TVector3's X() returns the x-coordinate
|
||||||
|
y = vec.Y(); // TVector3's Y() returns the y-coordinate
|
||||||
|
z = vec.Z(); // TVector3's Z() returns the z-coordinate
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//! ########################################################
|
||||||
|
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; }
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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, TVector3 anodeInt, 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 with the 3 wire offset accounted for (+1 from the calculated offset from the PC coincidence spectrum)
|
||||||
|
q1.first.SetXYZ(radiusC * TMath::Cos(TMath::TwoPi() / nWire * (i + wireShift + 1) + TMath::PiOver2()),
|
||||||
|
radiusC * TMath::Sin(TMath::TwoPi() / nWire * (i + wireShift + 1) + TMath::PiOver2()),
|
||||||
|
zLen / 2);
|
||||||
|
q1.second.SetXYZ(radiusC * TMath::Cos(TMath::TwoPi() / nWire * (i + 1) + TMath::PiOver2()),
|
||||||
|
radiusC * TMath::Sin(TMath::TwoPi() / nWire * (i + 1) + TMath::PiOver2()),
|
||||||
|
-zLen / 2);
|
||||||
|
Ca.push_back(q1);
|
||||||
|
}
|
||||||
|
// correcting for the fact that the order of the cathode wires is reversed
|
||||||
|
std::reverse(Ca.begin(), Ca.end());
|
||||||
|
// adjusting for the 3 wire offset, the rbegin and rend are used as the rotation of the wires is done in the opposite direction i.e. 1,2,3 -> 3,1,2
|
||||||
|
// NOT NECESSARY ANY MORE, HAS BEEN IMCORPORATED INTO THE WIREOFFSET IN THE BEGINNING
|
||||||
|
// std::rotate(Ca.rbegin(), Ca.rbegin() + 4, Ca.rend());
|
||||||
|
|
||||||
|
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 siPos, TVector3 anodeInt, 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
printf("X slope = %f and Y slope = %f \n", mx, my);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 trackVec.Z();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
257
anasen_analysis_vignesh/Armory/Armory/ClassSX3.h
Normal file
257
anasen_analysis_vignesh/Armory/Armory/ClassSX3.h
Normal file
|
|
@ -0,0 +1,257 @@
|
||||||
|
#ifndef ClassSX3_h
|
||||||
|
#define ClassSX3_h
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include <TMath.h>
|
||||||
|
#include <TVector3.h>
|
||||||
|
#include <TRandom.h>
|
||||||
|
|
||||||
|
class SX3{
|
||||||
|
public:
|
||||||
|
SX3(){Clear();};
|
||||||
|
~SX3(){}
|
||||||
|
|
||||||
|
short GetID() const {return id;}
|
||||||
|
short GetChUp() const {return chUp;}
|
||||||
|
short GetChDn() const {return chDn;}
|
||||||
|
short GetChBk() const {return chBk;}
|
||||||
|
|
||||||
|
TVector3 GetHitPos() const {return hitPos;}
|
||||||
|
TVector3 GetHitPosWithSigma(double sigmaY_mm, double sigmaZ_mm);
|
||||||
|
|
||||||
|
double GetZFrac() const {return zFrac;} // range from -0.5 to 0.5
|
||||||
|
|
||||||
|
void Clear();
|
||||||
|
void ConstructGeo();
|
||||||
|
void FindSX3Pos(TVector3 pos, TVector3 direction, bool verbose = false);
|
||||||
|
void CalSX3Pos(unsigned short ID, unsigned short chUp, unsigned short chDown, unsigned short chBack, float eUp, float eDown);
|
||||||
|
|
||||||
|
double GetNumDet() const {return numDet;}
|
||||||
|
double GetWidth() const {return width;}
|
||||||
|
double GetLength() const {return length;}
|
||||||
|
TVector3 GetDnL(short id) const {return SDn[id].first; } // lower strip ID
|
||||||
|
TVector3 GetDnH(short id) const {return SDn[id].second; } // higher strip ID
|
||||||
|
TVector3 GetUpL(short id) const {return SUp[id].first; } // lower strip ID
|
||||||
|
TVector3 GetUpH(short id) const {return SUp[id].second; } // higher strip ID
|
||||||
|
|
||||||
|
TVector3 GetDnMid(short id) const { return (SDn[id].first + SDn[id].second)*0.5;}
|
||||||
|
TVector3 GetUpMid(short id) const { return (SUp[id].first + SUp[id].second)*0.5;}
|
||||||
|
|
||||||
|
double GetDetPhi(short id) const { return (SUp[id].second - SUp[id].first).Phi();}
|
||||||
|
|
||||||
|
void Print(){
|
||||||
|
if( id == -1 ){
|
||||||
|
printf("Did not hit any SX3.\n");
|
||||||
|
}else{
|
||||||
|
printf("ID: %d, U,D,B: %d %d %d| zFrac : %.2f\n", id, chUp, chDn, chBk, zFrac);
|
||||||
|
printf("Hit Pos: %.2f, %.2f, %.2f\n", hitPos.X(), hitPos.Y(), hitPos.Z());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// void CalZFrac(){
|
||||||
|
// zFrac = (eUp - eDn)/(eUp + eDn);
|
||||||
|
// }
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
const int numDet = 12;
|
||||||
|
const float radius = 88;
|
||||||
|
const float width = 40;
|
||||||
|
const float length = 75;
|
||||||
|
const float gap = 46;
|
||||||
|
|
||||||
|
short id; // -1 when no hit
|
||||||
|
short chUp;
|
||||||
|
short chDn;
|
||||||
|
short chBk;
|
||||||
|
|
||||||
|
double zFrac; // from +1 (downstream) to -1 (upstream)
|
||||||
|
|
||||||
|
double eUp;
|
||||||
|
double eDn;
|
||||||
|
double eBk;
|
||||||
|
|
||||||
|
TVector3 hitPos;
|
||||||
|
|
||||||
|
std::vector<std::pair<TVector3,TVector3>> SDn; // coners of the SX3 0-11, z = mid point
|
||||||
|
std::vector<std::pair<TVector3,TVector3>> SUp; // coners of the SX3 12-23, z = mid point
|
||||||
|
std::vector<TVector3> SNorml; // normal of the SX3 (outward)
|
||||||
|
|
||||||
|
|
||||||
|
std::pair<double, double> Intersect(TVector3 p1, TVector3 p2, TVector3 q1, TVector3 q2, bool verbose){
|
||||||
|
|
||||||
|
//see https://nukephysik101.wordpress.com/2023/12/30/intersect-between-2-line-segments/
|
||||||
|
//zero all z-component
|
||||||
|
TVector3 a0 = p1; a0.SetZ(0);
|
||||||
|
TVector3 a1 = p2; a1.SetZ(0);
|
||||||
|
|
||||||
|
TVector3 b0 = q1; b0.SetZ(0);
|
||||||
|
TVector3 b1 = q2; b1.SetZ(0);
|
||||||
|
|
||||||
|
double A = ((b0-b1).Cross(a0-a1)).Mag();
|
||||||
|
|
||||||
|
double h = ((b0-a0).Cross(b1-a0)).Z()/ A;
|
||||||
|
double k = ((a1-b0).Cross(a0-b0)).Z()/ A;
|
||||||
|
|
||||||
|
if( verbose ) printf(" ----h, k : %f, %f\n", h, k);
|
||||||
|
|
||||||
|
return std::pair<double,double>(h,k);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
inline void SX3::Clear(){
|
||||||
|
id = -1;
|
||||||
|
chUp = -1;
|
||||||
|
chDn = -1;
|
||||||
|
chBk = -1;
|
||||||
|
zFrac = TMath::QuietNaN();
|
||||||
|
|
||||||
|
eUp = TMath::QuietNaN();
|
||||||
|
eDn = TMath::QuietNaN();
|
||||||
|
eBk = TMath::QuietNaN();
|
||||||
|
|
||||||
|
SDn.clear();
|
||||||
|
SUp.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void SX3::ConstructGeo(){
|
||||||
|
TVector3 sa, sb, sc, sn;
|
||||||
|
|
||||||
|
for(int i = 0; i < numDet; i++){
|
||||||
|
sa.SetXYZ( radius, -width/2, gap/2 + length/2 );
|
||||||
|
sb.SetXYZ( radius, width/2, gap/2 + length/2 );
|
||||||
|
|
||||||
|
double rot = TMath::TwoPi() / numDet * (i - 0.5) - TMath::PiOver2();
|
||||||
|
|
||||||
|
sa.RotateZ( rot );
|
||||||
|
sb.RotateZ( rot );
|
||||||
|
SDn.push_back(std::pair<TVector3,TVector3>(sa,sb));
|
||||||
|
|
||||||
|
sc.SetXYZ( radius, -width/2, gap/2 );
|
||||||
|
sc.RotateZ( rot );
|
||||||
|
|
||||||
|
sn = ((sc-sa).Cross(sb-sa)).Unit();
|
||||||
|
SNorml.push_back(sn);
|
||||||
|
|
||||||
|
sa.SetXYZ( radius, -width/2, -gap/2 - length/2 );
|
||||||
|
sb.SetXYZ( radius, width/2, -gap/2 - length/2 );
|
||||||
|
|
||||||
|
sa.RotateZ( rot );
|
||||||
|
sb.RotateZ( rot );
|
||||||
|
SUp.push_back(std::pair<TVector3,TVector3>(sa,sb));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void SX3::FindSX3Pos(TVector3 pos, TVector3 direction, bool verbose){
|
||||||
|
|
||||||
|
id = -1;
|
||||||
|
for( int i = 0 ; i < numDet; i++){
|
||||||
|
|
||||||
|
if(verbose) printf(" %d ", i);
|
||||||
|
std::pair<double, double> frac = Intersect( pos, pos + direction, SDn[i].first, SDn[i].second, verbose);
|
||||||
|
|
||||||
|
|
||||||
|
if( frac.second < 0 || frac.second > 1 ) continue;
|
||||||
|
hitPos = pos + frac.first * direction;
|
||||||
|
|
||||||
|
double dis = hitPos.Dot(SNorml[i]);
|
||||||
|
|
||||||
|
if(verbose) {
|
||||||
|
printf("reduced distance : %f\n", dis);
|
||||||
|
printf(" %d*", (i+1)%numDet);
|
||||||
|
Intersect( pos, pos + direction, SDn[(i+1)%numDet].first, SDn[(i+1)%numDet].second, verbose);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( TMath::Abs(dis - radius) > 0.1 ) continue;
|
||||||
|
|
||||||
|
chDn = 2 * TMath::Floor(frac.second * 4);
|
||||||
|
chUp = chDn + 1;
|
||||||
|
|
||||||
|
double zPos = hitPos.Z();
|
||||||
|
if( (gap/2 < zPos && zPos < gap/2 + length ) || (-gap/2 - length < zPos && zPos < -gap/2 ) ){
|
||||||
|
|
||||||
|
id = zPos > 0 ? i : i + 12;
|
||||||
|
|
||||||
|
zFrac = zPos > 0 ? (zPos - gap/2. - length/2.)/length : (zPos - ( - gap/2. - length/2.) )/length ;
|
||||||
|
|
||||||
|
chBk = TMath::Floor( (zFrac + 0.5) * 4 ) + 8;
|
||||||
|
|
||||||
|
if( verbose) Print();
|
||||||
|
return ;
|
||||||
|
|
||||||
|
}else{
|
||||||
|
if( verbose ) printf(" zPos out of sensitive region\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( verbose) Print();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline TVector3 SX3::GetHitPosWithSigma(double sigmaY_mm, double sigmaZ_mm){
|
||||||
|
|
||||||
|
double phi = SNorml[id%numDet].Phi();
|
||||||
|
|
||||||
|
TVector3 haha = hitPos;
|
||||||
|
haha.RotateZ(-phi);
|
||||||
|
|
||||||
|
double y = haha.Y() + gRandom->Gaus(0, sigmaY_mm);
|
||||||
|
if( sigmaY_mm < 0 ){
|
||||||
|
double deltaW = width/4;
|
||||||
|
y = TMath::Floor((haha.Y()-deltaW)/deltaW)*deltaW + deltaW*1.5; // when ever land on each strip, set the position to be center of the strip.
|
||||||
|
if( y >= 25 ) y = 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
double z = haha.Z() + gRandom->Gaus(0, sigmaZ_mm);
|
||||||
|
if( sigmaZ_mm < 0 ){
|
||||||
|
haha.Z();
|
||||||
|
double delta = length/4;
|
||||||
|
int sign = z > 0 ? 1 : -1;
|
||||||
|
z = TMath::Floor( (abs(z)-gap/2)/delta )*delta + 0.5 * delta + gap/2;
|
||||||
|
if( z >= 107.375 ) z = 88.625;
|
||||||
|
z = sign * z;
|
||||||
|
}
|
||||||
|
|
||||||
|
haha.SetY(y);
|
||||||
|
haha.SetZ(z);
|
||||||
|
haha.RotateZ(phi);
|
||||||
|
|
||||||
|
return haha;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void SX3::CalSX3Pos(unsigned short ID, unsigned short chUp, unsigned short chDown, unsigned short chBack, float eUp, float eDown){
|
||||||
|
|
||||||
|
hitPos.Clear();
|
||||||
|
|
||||||
|
|
||||||
|
if( (chUp - chDown) != 1 || (chDown % 2) != 0) return ;
|
||||||
|
|
||||||
|
int reducedID = ID % numDet;
|
||||||
|
|
||||||
|
TVector3 sa, sb;
|
||||||
|
|
||||||
|
if( ID < numDet ){ //down
|
||||||
|
sa = SDn[reducedID].second;
|
||||||
|
sb = SDn[reducedID].first;
|
||||||
|
}else{
|
||||||
|
sa = SUp[reducedID].second;
|
||||||
|
sb = SUp[reducedID].first;
|
||||||
|
}
|
||||||
|
|
||||||
|
hitPos.SetX( (sb.X() - sa.X()) * chUp/8 + sa.X());
|
||||||
|
hitPos.SetY( (sb.Y() - sa.Y()) * chUp/8 + sa.Y());
|
||||||
|
|
||||||
|
if( eUp == 0 || eDown == 0 ){
|
||||||
|
hitPos.SetZ( sa.Z() + (2*(chBk - 7)-1) * length / 8 );
|
||||||
|
}else{
|
||||||
|
double frac = (eUp - eDown)/(eUp + eDown); // from +1 (downstream) to -1 (upstream)
|
||||||
|
double zPos = sa.Z() + length * frac/2;
|
||||||
|
hitPos.SetZ( zPos );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
468
anasen_analysis_vignesh/Armory/Armory/ClassTransfer.h
Normal file
468
anasen_analysis_vignesh/Armory/Armory/ClassTransfer.h
Normal file
|
|
@ -0,0 +1,468 @@
|
||||||
|
#ifndef ClassTransfer_h
|
||||||
|
#define ClassTransfer_h
|
||||||
|
|
||||||
|
#include "TBenchmark.h"
|
||||||
|
#include "TLorentzVector.h"
|
||||||
|
#include "TVector3.h"
|
||||||
|
#include "TMath.h"
|
||||||
|
#include "TFile.h"
|
||||||
|
#include "TTree.h"
|
||||||
|
#include "TRandom.h"
|
||||||
|
#include "TMacro.h"
|
||||||
|
#include "TGraph.h"
|
||||||
|
#include <vector>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
#include "Isotope.h"
|
||||||
|
|
||||||
|
class ReactionConfig{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
ReactionConfig(){}
|
||||||
|
~ReactionConfig(){}
|
||||||
|
|
||||||
|
int beamA, beamZ;
|
||||||
|
int targetA, targetZ;
|
||||||
|
int recoilLightA, recoilLightZ;
|
||||||
|
int recoilHeavyA, recoilHeavyZ;
|
||||||
|
|
||||||
|
float beamEnergy; ///MeV/u
|
||||||
|
float beamEnergySigma; ///beam-energy_sigma_in_MeV/u
|
||||||
|
float beamAngle; ///beam-angle_in_mrad
|
||||||
|
float beamAngleSigma; ///beam-emittance_in_mrad
|
||||||
|
float beamX; ///x_offset_of_Beam_in_mm
|
||||||
|
float beamY; ///y_offset_of_Beam_in_mm
|
||||||
|
int numEvents; ///number_of_Event_being_generated
|
||||||
|
bool isTargetScattering; ///isTargetScattering
|
||||||
|
float targetDensity; ///target_density_in_g/cm3
|
||||||
|
float targetThickness; ///targetThickness_in_cm
|
||||||
|
std::string beamStoppingPowerFile; ///stopping_power_for_beam
|
||||||
|
std::string recoilLightStoppingPowerFile; ///stopping_power_for_light_recoil
|
||||||
|
std::string recoilHeavyStoppingPowerFile; ///stopping_power_for_heavy_recoil
|
||||||
|
bool isDecay; ///isDacay
|
||||||
|
int heavyDecayA; ///decayNucleus_A
|
||||||
|
int heavyDecayZ; ///decayNucleus_Z
|
||||||
|
bool isRedo; ///isReDo
|
||||||
|
std::vector<float> beamEx; ///excitation_energy_of_A[MeV]
|
||||||
|
|
||||||
|
|
||||||
|
void SetReaction(int beamA, int beamZ,
|
||||||
|
int targetA, int targetZ,
|
||||||
|
int recoilA, int recoilZ, float beamEnergy_AMeV){
|
||||||
|
this->beamA = beamA;
|
||||||
|
this->beamZ = beamZ;
|
||||||
|
this->targetA = targetA;
|
||||||
|
this->targetZ = targetZ;
|
||||||
|
this->recoilLightA = recoilA;
|
||||||
|
this->recoilLightZ = recoilZ;
|
||||||
|
|
||||||
|
recoilHeavyA = this->beamA + this->targetA - recoilLightA;
|
||||||
|
recoilHeavyZ = this->beamZ + this->targetZ - recoilLightZ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoadReactionConfig(TMacro * macro){
|
||||||
|
|
||||||
|
if( macro == NULL ) return ;
|
||||||
|
|
||||||
|
int numLine = macro->GetListOfLines()->GetSize();
|
||||||
|
|
||||||
|
for( int i = 0; i < numLine; i ++){
|
||||||
|
|
||||||
|
std::vector<std::string> str = SplitStr(macro->GetListOfLines()->At(i)->GetName(), " ");
|
||||||
|
|
||||||
|
///printf("%d | %s\n", i, str[0].c_str());
|
||||||
|
|
||||||
|
if( str[0].find_first_of("#") == 0 ) break;
|
||||||
|
|
||||||
|
if( i == 0 ) beamA = atoi(str[0].c_str());
|
||||||
|
if( i == 1 ) beamZ = atoi(str[0].c_str());
|
||||||
|
if( i == 2 ) targetA = atoi(str[0].c_str());
|
||||||
|
if( i == 3 ) targetZ = atoi(str[0].c_str());
|
||||||
|
if( i == 4 ) recoilLightA = atoi(str[0].c_str());
|
||||||
|
if( i == 5 ) recoilLightZ = atoi(str[0].c_str());
|
||||||
|
if( i == 6 ) beamEnergy = atof(str[0].c_str());
|
||||||
|
if( i == 7 ) beamEnergySigma = atof(str[0].c_str());
|
||||||
|
if( i == 8 ) beamAngle = atof(str[0].c_str());
|
||||||
|
if( i == 9 ) beamAngleSigma = atof(str[0].c_str());
|
||||||
|
if( i == 10 ) beamX = atof(str[0].c_str());
|
||||||
|
if( i == 11 ) beamY = atof(str[0].c_str());
|
||||||
|
if( i == 12 ) numEvents = atoi(str[0].c_str());
|
||||||
|
if( i == 13 ) {
|
||||||
|
if( str[0].compare("false") == 0 ) isTargetScattering = false;
|
||||||
|
if( str[0].compare("true") == 0 ) isTargetScattering = true;
|
||||||
|
}
|
||||||
|
if( i == 14 ) targetDensity = atof(str[0].c_str());
|
||||||
|
if( i == 15 ) targetThickness = atof(str[0].c_str());
|
||||||
|
if( i == 16 ) beamStoppingPowerFile = str[0];
|
||||||
|
if( i == 17 ) recoilLightStoppingPowerFile = str[0];
|
||||||
|
if( i == 18 ) recoilHeavyStoppingPowerFile = str[0];
|
||||||
|
if( i == 19 ) {
|
||||||
|
if( str[0].compare("false") == 0 ) isDecay = false;
|
||||||
|
if( str[0].compare("true") == 0 ) isDecay = true;
|
||||||
|
}
|
||||||
|
if( i == 20 ) heavyDecayA = atoi(str[0].c_str());
|
||||||
|
if( i == 21 ) heavyDecayZ = atoi(str[0].c_str());
|
||||||
|
if( i == 22 ) {
|
||||||
|
if( str[0].compare("false") == 0 ) isRedo = false;
|
||||||
|
if( str[0].compare("true" ) == 0 ) isRedo = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( i >= 23) {
|
||||||
|
beamEx.push_back( atof(str[0].c_str()) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
recoilHeavyA = beamA + targetA - recoilLightA;
|
||||||
|
recoilHeavyZ = beamZ + targetZ - recoilLightZ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PrintReactionConfig(){
|
||||||
|
|
||||||
|
printf("=====================================================\n");
|
||||||
|
printf(" beam : A = %3d, Z = %2d \n", beamA, beamZ);
|
||||||
|
printf(" target : A = %3d, Z = %2d \n", targetA, targetZ);
|
||||||
|
printf(" light : A = %3d, Z = %2d \n", recoilLightA, recoilLightZ);
|
||||||
|
|
||||||
|
printf(" beam Energy : %.2f +- %.2f MeV/u, dE/E = %5.2f %%\n", beamEnergy, beamEnergySigma, beamEnergySigma/beamEnergy);
|
||||||
|
printf(" Angle : %.2f +- %.2f mrad\n", beamAngle, beamAngleSigma);
|
||||||
|
printf(" offset : (x,y) = (%.2f, %.2f) mmm \n", beamX, beamY);
|
||||||
|
|
||||||
|
printf("##### number of Simulation Events : %d \n", numEvents);
|
||||||
|
|
||||||
|
printf(" is target scattering : %s \n", isTargetScattering ? "Yes" : "No");
|
||||||
|
|
||||||
|
if(isTargetScattering){
|
||||||
|
printf(" target density : %.f g/cm3\n", targetDensity);
|
||||||
|
printf(" thickness : %.f cm\n", targetThickness);
|
||||||
|
printf(" beam stopping file : %s \n", beamStoppingPowerFile.c_str());
|
||||||
|
printf(" recoil light stopping file : %s \n", recoilLightStoppingPowerFile.c_str());
|
||||||
|
printf(" recoil heavy stopping file : %s \n", recoilHeavyStoppingPowerFile.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
printf(" is simulate decay : %s \n", isDecay ? "Yes" : "No");
|
||||||
|
if( isDecay ){
|
||||||
|
printf(" heavy decay : A = %d, Z = %d \n", heavyDecayA, heavyDecayZ);
|
||||||
|
}
|
||||||
|
printf(" is Redo until hit array : %s \n", isRedo ? "Yes" : "No");
|
||||||
|
|
||||||
|
printf(" beam Ex : %.2f MeV \n", beamEx[0]);
|
||||||
|
for( int i = 1; i < (int) beamEx.size(); i++){
|
||||||
|
printf(" %.2f MeV \n", beamEx[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("=====================================================\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//=======================================================
|
||||||
|
//#######################################################
|
||||||
|
// Class for Transfer Reaction
|
||||||
|
// reaction notation A(a,b)B
|
||||||
|
// A = incident particle
|
||||||
|
// a = target
|
||||||
|
// b = light scattered particle
|
||||||
|
// B = heavy scattered particle
|
||||||
|
//=======================================================
|
||||||
|
class TransferReaction {
|
||||||
|
public:
|
||||||
|
TransferReaction();
|
||||||
|
~TransferReaction();
|
||||||
|
|
||||||
|
void SetA(int A, int Z, double Ex);
|
||||||
|
void Seta(int A, int Z);
|
||||||
|
void Setb(int A, int Z);
|
||||||
|
void SetB(int A, int Z);
|
||||||
|
void SetIncidentEnergyAngle(double KEA, double theta, double phi);
|
||||||
|
void SetExA(double Ex);
|
||||||
|
void SetExB(double Ex);
|
||||||
|
void SetReactionFromFile(string settingFile);
|
||||||
|
|
||||||
|
TString GetReactionName();
|
||||||
|
TString GetReactionName_Latex();
|
||||||
|
|
||||||
|
ReactionConfig GetRectionConfig() { return reaction;}
|
||||||
|
|
||||||
|
double GetMass_A(){return mA + ExA;}
|
||||||
|
double GetMass_a(){return ma;}
|
||||||
|
double GetMass_b(){return mb;}
|
||||||
|
double GetMass_B(){return mB + ExB;}
|
||||||
|
|
||||||
|
double GetCMTotalKE() {return Etot - mA - ma;}
|
||||||
|
double GetQValue() {return mA + ExA + ma - mb - mB - ExB;}
|
||||||
|
double GetMaxExB() {return Etot - mb - mB;}
|
||||||
|
|
||||||
|
TLorentzVector GetPA(){return PA;}
|
||||||
|
TLorentzVector GetPa(){return Pa;}
|
||||||
|
TLorentzVector GetPb(){return Pb;}
|
||||||
|
TLorentzVector GetPB(){return PB;}
|
||||||
|
|
||||||
|
void CalReactionConstant();
|
||||||
|
|
||||||
|
TLorentzVector * Event(double thetaCM, double phiCM);
|
||||||
|
|
||||||
|
double GetEx(){return Ex;}
|
||||||
|
double GetThetaCM(){return thetaCM;}
|
||||||
|
|
||||||
|
double GetMomentumbCM() {return p;}
|
||||||
|
double GetReactionBeta() {return beta;}
|
||||||
|
double GetReactionGamma() {return gamma;}
|
||||||
|
double GetCMTotalEnergy() {return Etot;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
ReactionConfig reaction;
|
||||||
|
|
||||||
|
string nameA, namea, nameb, nameB;
|
||||||
|
double thetaIN, phiIN;
|
||||||
|
double mA, ma, mb, mB;
|
||||||
|
|
||||||
|
double TA, T; // TA = KE of A pre u, T = total energy
|
||||||
|
double ExA, ExB;
|
||||||
|
double Ex, thetaCM; //calculated Ex using inverse mapping from e and z to thetaCM
|
||||||
|
|
||||||
|
bool isReady;
|
||||||
|
bool isBSet;
|
||||||
|
|
||||||
|
double k; // CM Boost momentum
|
||||||
|
double beta, gamma; //CM boost beta
|
||||||
|
double Etot;
|
||||||
|
double p; // CM frame momentum of b, B
|
||||||
|
|
||||||
|
TLorentzVector PA, Pa, Pb, PB;
|
||||||
|
|
||||||
|
TString format(TString name);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
TransferReaction::TransferReaction(){
|
||||||
|
|
||||||
|
thetaIN = 0.;
|
||||||
|
phiIN = 0.;
|
||||||
|
SetA(24, 12, 0);
|
||||||
|
Seta(4,2);
|
||||||
|
Setb(1,1);
|
||||||
|
SetB(27,13);
|
||||||
|
TA = 2.5;
|
||||||
|
T = TA * reaction.beamA;
|
||||||
|
|
||||||
|
ExA = 0;
|
||||||
|
ExB = 0;
|
||||||
|
|
||||||
|
Ex = TMath::QuietNaN();
|
||||||
|
thetaCM = TMath::QuietNaN();
|
||||||
|
|
||||||
|
CalReactionConstant();
|
||||||
|
|
||||||
|
TLorentzVector temp (0,0,0,0);
|
||||||
|
PA = temp;
|
||||||
|
Pa = temp;
|
||||||
|
Pb = temp;
|
||||||
|
PB = temp;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
TransferReaction::~TransferReaction(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransferReaction::SetA(int A, int Z, double Ex = 0){
|
||||||
|
Isotope temp (A, Z);
|
||||||
|
mA = temp.Mass;
|
||||||
|
reaction.beamA = A;
|
||||||
|
reaction.beamZ = Z;
|
||||||
|
ExA = Ex;
|
||||||
|
nameA = temp.Name;
|
||||||
|
isReady = false;
|
||||||
|
isBSet = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransferReaction::Seta(int A, int Z){
|
||||||
|
Isotope temp (A, Z);
|
||||||
|
ma = temp.Mass;
|
||||||
|
reaction.targetA = A;
|
||||||
|
reaction.targetZ = Z;
|
||||||
|
namea = temp.Name;
|
||||||
|
isReady = false;
|
||||||
|
isBSet = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransferReaction::Setb(int A, int Z){
|
||||||
|
Isotope temp (A, Z);
|
||||||
|
mb = temp.Mass;
|
||||||
|
reaction.recoilLightA = A;
|
||||||
|
reaction.recoilLightZ = Z;
|
||||||
|
nameb = temp.Name;
|
||||||
|
isReady = false;
|
||||||
|
isBSet = false;
|
||||||
|
}
|
||||||
|
void TransferReaction::SetB(int A, int Z){
|
||||||
|
Isotope temp (A, Z);
|
||||||
|
mB = temp.Mass;
|
||||||
|
reaction.recoilHeavyA = A;
|
||||||
|
reaction.recoilHeavyZ = Z;
|
||||||
|
nameB = temp.Name;
|
||||||
|
isReady = false;
|
||||||
|
isBSet = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransferReaction::SetIncidentEnergyAngle(double KEA, double theta, double phi){
|
||||||
|
this->TA = KEA;
|
||||||
|
this->T = TA * reaction.beamA;
|
||||||
|
this->thetaIN = theta;
|
||||||
|
this->phiIN = phi;
|
||||||
|
isReady = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransferReaction::SetExA(double Ex){
|
||||||
|
this->ExA = Ex;
|
||||||
|
isReady = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransferReaction::SetExB(double Ex){
|
||||||
|
this->ExB = Ex;
|
||||||
|
isReady = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransferReaction::SetReactionFromFile(string settingFile){
|
||||||
|
|
||||||
|
TMacro * haha = new TMacro();
|
||||||
|
if( haha->ReadFile(settingFile.c_str()) > 0 ) {
|
||||||
|
reaction.LoadReactionConfig(haha);
|
||||||
|
|
||||||
|
SetA(reaction.beamA, reaction.beamZ);
|
||||||
|
Seta(reaction.targetA, reaction.targetZ);
|
||||||
|
Setb(reaction.recoilLightA, reaction.recoilLightZ);
|
||||||
|
SetB(reaction.recoilHeavyA, reaction.recoilHeavyZ);
|
||||||
|
|
||||||
|
SetIncidentEnergyAngle(reaction.beamEnergy, 0, 0);
|
||||||
|
CalReactionConstant();
|
||||||
|
}else{
|
||||||
|
|
||||||
|
printf("cannot read file %s.\n", settingFile.c_str());
|
||||||
|
isReady = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
TString TransferReaction::GetReactionName(){
|
||||||
|
TString rName;
|
||||||
|
rName.Form("%s(%s,%s)%s", nameA.c_str(), namea.c_str(), nameb.c_str(), nameB.c_str());
|
||||||
|
return rName;
|
||||||
|
}
|
||||||
|
|
||||||
|
TString TransferReaction::format(TString name){
|
||||||
|
if( name.IsAlpha() ) return name;
|
||||||
|
int len = name.Length();
|
||||||
|
TString temp = name;
|
||||||
|
TString temp2 = name;
|
||||||
|
if( temp.Remove(0, len-2).IsAlpha()){
|
||||||
|
temp2.Remove(len-2);
|
||||||
|
}else{
|
||||||
|
temp = name;
|
||||||
|
temp.Remove(0, len-1);
|
||||||
|
temp2.Remove(len-1);
|
||||||
|
}
|
||||||
|
return "^{"+temp2+"}"+temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
TString TransferReaction::GetReactionName_Latex(){
|
||||||
|
TString rName;
|
||||||
|
rName.Form("%s(%s,%s)%s", format(nameA).Data(), format(namea).Data(), format(nameb).Data(), format(nameB).Data());
|
||||||
|
return rName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransferReaction::CalReactionConstant(){
|
||||||
|
if( !isBSet){
|
||||||
|
reaction.recoilHeavyA = reaction.beamA + reaction.targetA - reaction.recoilLightA;
|
||||||
|
reaction.recoilHeavyZ = reaction.beamZ + reaction.targetZ - reaction.recoilLightZ;
|
||||||
|
Isotope temp (reaction.recoilHeavyA, reaction.recoilHeavyZ);
|
||||||
|
mB = temp.Mass;
|
||||||
|
isBSet = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
k = TMath::Sqrt(TMath::Power(mA + ExA + T, 2) - (mA + ExA) * (mA + ExA));
|
||||||
|
beta = k / (mA + ExA + ma + T);
|
||||||
|
gamma = 1 / TMath::Sqrt(1- beta * beta);
|
||||||
|
Etot = TMath::Sqrt(TMath::Power(mA + ExA + ma + T,2) - k * k);
|
||||||
|
p = TMath::Sqrt( (Etot*Etot - TMath::Power(mb + mB + ExB,2)) * (Etot*Etot - TMath::Power(mb - mB - ExB,2)) ) / 2 / Etot;
|
||||||
|
|
||||||
|
PA.SetXYZM(0, 0, k, mA + ExA);
|
||||||
|
PA.RotateY(thetaIN);
|
||||||
|
PA.RotateZ(phiIN);
|
||||||
|
|
||||||
|
Pa.SetXYZM(0,0,0,ma);
|
||||||
|
|
||||||
|
isReady = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
TLorentzVector * TransferReaction::Event(double thetaCM, double phiCM)
|
||||||
|
{
|
||||||
|
if( isReady == false ){
|
||||||
|
CalReactionConstant();
|
||||||
|
}
|
||||||
|
|
||||||
|
//TLorentzVector Pa(0, 0, 0, ma);
|
||||||
|
|
||||||
|
//---- to CM frame
|
||||||
|
TLorentzVector Pc = PA + Pa;
|
||||||
|
TVector3 b = Pc.BoostVector();
|
||||||
|
|
||||||
|
TVector3 vb(0,0,0);
|
||||||
|
|
||||||
|
if( b.Mag() > 0 ){
|
||||||
|
TVector3 v0 (0,0,0);
|
||||||
|
TVector3 nb = v0 - b;
|
||||||
|
|
||||||
|
TLorentzVector PAc = PA;
|
||||||
|
PAc.Boost(nb);
|
||||||
|
TVector3 vA = PAc.Vect();
|
||||||
|
|
||||||
|
TLorentzVector Pac = Pa;
|
||||||
|
Pac.Boost(nb);
|
||||||
|
TVector3 va = Pac.Vect();
|
||||||
|
|
||||||
|
//--- construct vb
|
||||||
|
vb = va;
|
||||||
|
vb.SetMag(p);
|
||||||
|
|
||||||
|
TVector3 ub = vb.Orthogonal();
|
||||||
|
vb.Rotate(thetaCM, ub);
|
||||||
|
vb.Rotate(phiCM + TMath::PiOver2(), va); // somehow, the calculation turn the vector 90 degree.
|
||||||
|
//vb.Rotate(phiCM , va); // somehow, the calculation turn the vector 90 degree.
|
||||||
|
}
|
||||||
|
|
||||||
|
//--- from Pb
|
||||||
|
TLorentzVector Pbc;
|
||||||
|
Pbc.SetVectM(vb, mb);
|
||||||
|
|
||||||
|
//--- from PB
|
||||||
|
TLorentzVector PBc;
|
||||||
|
//PBc.SetVectM(vB, mB + ExB);
|
||||||
|
PBc.SetVectM(-vb, mB + ExB);
|
||||||
|
|
||||||
|
//---- to Lab Frame
|
||||||
|
TLorentzVector Pb = Pbc;
|
||||||
|
Pb.Boost(b);
|
||||||
|
TLorentzVector PB = PBc;
|
||||||
|
PB.Boost(b);
|
||||||
|
|
||||||
|
TLorentzVector * output = new TLorentzVector[4];
|
||||||
|
output[0] = PA;
|
||||||
|
output[1] = Pa;
|
||||||
|
output[2] = Pb;
|
||||||
|
output[3] = PB;
|
||||||
|
|
||||||
|
this->Pb = Pb;
|
||||||
|
this->PB = PB;
|
||||||
|
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
414
anasen_analysis_vignesh/Armory/Armory/HistPlotter.h
Normal file
414
anasen_analysis_vignesh/Armory/Armory/HistPlotter.h
Normal file
|
|
@ -0,0 +1,414 @@
|
||||||
|
#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(); //!< 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() {
|
||||||
|
/*! \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
|
||||||
|
}
|
||||||
|
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
|
||||||
522
anasen_analysis_vignesh/Armory/Armory/Isotope.h
Normal file
522
anasen_analysis_vignesh/Armory/Armory/Isotope.h
Normal file
|
|
@ -0,0 +1,522 @@
|
||||||
|
/***********************************************************************
|
||||||
|
*
|
||||||
|
* This is Isotope.h, To extract the isotope mass from massXX.txt
|
||||||
|
*
|
||||||
|
*-------------------------------------------------------
|
||||||
|
* created by Ryan (Tsz Leung) Tang, Nov-18, 2018
|
||||||
|
* email: goluckyryan@gmail.com
|
||||||
|
* ********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef ISOTOPE_H
|
||||||
|
#define ISOTOPE_H
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "constant.h" // amu
|
||||||
|
#include <stdlib.h> //atoi
|
||||||
|
#include <algorithm>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
string massData="mass20.txt";
|
||||||
|
|
||||||
|
// about the mass**.txt
|
||||||
|
// Mass Excess = (ATOMIC MASS - A)*amu | e.g. n : (1.088664.91585E-6-1)*amu
|
||||||
|
// mass excess uncertaintly
|
||||||
|
// BEA = (Z*M(1H) + N*M(1n) - Me(A,Z))/A , Me is the mass with electrons
|
||||||
|
// BEA = (Z*mp + N*mn - M(A,Z))/A , M is the mass without electrons
|
||||||
|
|
||||||
|
class Isotope {
|
||||||
|
public:
|
||||||
|
int A, Z;
|
||||||
|
double Mass, MassError, BEA;
|
||||||
|
string Name, Symbol;
|
||||||
|
string dataSource;
|
||||||
|
|
||||||
|
Isotope(){ dataSource = massData; };
|
||||||
|
Isotope(int a, int z){ dataSource = massData; SetIso(a,z); };
|
||||||
|
Isotope(string name){ dataSource = massData; SetIsoByName(name); };
|
||||||
|
|
||||||
|
void SetIso(int a, int z);
|
||||||
|
void SetIsoByName(string name);
|
||||||
|
|
||||||
|
double CalSp(int Np, int Nn); // this for the Np-proton, Nn-neutron removal
|
||||||
|
double CalSp2(int a, int z); // this is for (a,z) nucleus removal
|
||||||
|
|
||||||
|
double CalBeta(double T){
|
||||||
|
// double Etot = Mass + T;
|
||||||
|
double gamma = 1 + T/Mass;
|
||||||
|
double beta = sqrt(1 - 1 / gamma / gamma ) ;
|
||||||
|
return beta;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Print();
|
||||||
|
void ListShell();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void FindMassByAZ(int a, int z); // give mass, massError, BEA, Name, Symbol;
|
||||||
|
void FindMassByName(string name); // give Z, mass, massError, BEA;
|
||||||
|
|
||||||
|
int TwoJ(int nShell);
|
||||||
|
string Orbital(int nShell);
|
||||||
|
int magic(int i){
|
||||||
|
switch (i){
|
||||||
|
case 0: return 2; break;
|
||||||
|
case 1: return 8; break;
|
||||||
|
case 2: return 20; break;
|
||||||
|
case 3: return 28; break;
|
||||||
|
case 4: return 40; break;
|
||||||
|
case 5: return 50; break;
|
||||||
|
case 6: return 82; break;
|
||||||
|
case 7: return 128; break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int magicShellID(int i){
|
||||||
|
switch (i){
|
||||||
|
case 0: return 0; break;
|
||||||
|
case 1: return 2; break;
|
||||||
|
case 2: return 5; break;
|
||||||
|
case 3: return 6; break;
|
||||||
|
case 4: return 9; break;
|
||||||
|
case 5: return 10; break;
|
||||||
|
case 6: return 15; break;
|
||||||
|
case 7: return 21; break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int fileStartLine;
|
||||||
|
int fileEndLine;
|
||||||
|
int lineMass050_099;
|
||||||
|
int lineMass100_149;
|
||||||
|
int lineMass150_199;
|
||||||
|
int lineMass200;
|
||||||
|
|
||||||
|
|
||||||
|
void setFileLines(){
|
||||||
|
fileStartLine = 37;
|
||||||
|
fileEndLine = 3594;
|
||||||
|
|
||||||
|
lineMass050_099 = 466;
|
||||||
|
lineMass100_149 = 1160;
|
||||||
|
lineMass150_199 = 1994;
|
||||||
|
lineMass200 = 2774;
|
||||||
|
}
|
||||||
|
|
||||||
|
char * heliosPath;
|
||||||
|
bool isFindOnce;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
inline void Isotope::SetIso(int a, int z){
|
||||||
|
this->A = a;
|
||||||
|
this->Z = z;
|
||||||
|
FindMassByAZ(a,z);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Isotope::SetIsoByName(string name){
|
||||||
|
FindMassByName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Isotope::FindMassByAZ(int A, int Z){
|
||||||
|
string line;
|
||||||
|
int lineNum=0;
|
||||||
|
int list_A, list_Z;
|
||||||
|
|
||||||
|
ifstream myfile;
|
||||||
|
int flag=0;
|
||||||
|
|
||||||
|
setFileLines();
|
||||||
|
|
||||||
|
int numLineStart = fileStartLine;
|
||||||
|
int numLineEnd = fileEndLine;
|
||||||
|
|
||||||
|
if ( A >= 50 && A < 100) numLineStart = lineMass050_099;
|
||||||
|
if ( A >=100 && A < 150) numLineStart = lineMass100_149;
|
||||||
|
if ( A >=150 && A < 200) numLineStart = lineMass150_199;
|
||||||
|
if ( A >=200 ) numLineStart = lineMass200;
|
||||||
|
|
||||||
|
myfile.open(dataSource.c_str());
|
||||||
|
|
||||||
|
if (myfile.is_open()) {
|
||||||
|
while (/*! myfile.eof() &&*/ flag == 0 && lineNum <numLineEnd){
|
||||||
|
lineNum ++ ;
|
||||||
|
//printf("%3d ",lineNum);
|
||||||
|
getline (myfile,line);
|
||||||
|
|
||||||
|
if (lineNum >= numLineStart ){
|
||||||
|
list_Z = atoi((line.substr(10,5)).c_str());
|
||||||
|
list_A = atoi((line.substr(15,5)).c_str());
|
||||||
|
|
||||||
|
if ( A == list_A && Z == list_Z) {
|
||||||
|
this->BEA = atof((line.substr(54,11)).c_str());
|
||||||
|
this->Mass = list_Z*mp + (list_A-list_Z)*mn - this->BEA/1000*list_A;
|
||||||
|
this->MassError = atof((line.substr(65,7)).c_str());
|
||||||
|
string str = line.substr(20,2);
|
||||||
|
str.erase(remove(str.begin(), str.end(), ' '), str.end());
|
||||||
|
this->Symbol = str;
|
||||||
|
|
||||||
|
ostringstream ss;
|
||||||
|
ss << A << this->Symbol;
|
||||||
|
this->Name = ss.str();
|
||||||
|
flag = 1;
|
||||||
|
}else if ( list_A > A) {
|
||||||
|
this->BEA = -404;
|
||||||
|
this->Mass = -404;
|
||||||
|
this->MassError = -404;
|
||||||
|
this->Symbol = "non";
|
||||||
|
this->Name = "non";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( this->Name == "1H" ) this->Name = "p";
|
||||||
|
if( this->Name == "2H" ) this->Name = "d";
|
||||||
|
if( this->Name == "3H" ) this->Name = "t";
|
||||||
|
if( this->Name == "4He" ) this->Name = "a";
|
||||||
|
|
||||||
|
myfile.close();
|
||||||
|
}else {
|
||||||
|
printf("Unable to open %s\n", dataSource.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Isotope::FindMassByName(string name){
|
||||||
|
|
||||||
|
// done seperate the Mass number and the name
|
||||||
|
if( name == "n" ) {
|
||||||
|
this->Name = "1n";
|
||||||
|
this->BEA = 0;
|
||||||
|
this->Mass = mn;
|
||||||
|
this->MassError = 0;
|
||||||
|
this->Name = "n";
|
||||||
|
this->A = 1;
|
||||||
|
this->Z = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if( name == "p" ) name = "1H";
|
||||||
|
if( name == "d" ) name = "2H";
|
||||||
|
if( name == "t" ) name = "3H";
|
||||||
|
if( name == "a" ) name = "4He";
|
||||||
|
|
||||||
|
string temp = name;
|
||||||
|
int lastDigit = 0;
|
||||||
|
|
||||||
|
for(int i=0; temp[i]; i++){
|
||||||
|
if(temp[i] == '0') lastDigit = i;
|
||||||
|
if(temp[i] == '1') lastDigit = i;
|
||||||
|
if(temp[i] == '2') lastDigit = i;
|
||||||
|
if(temp[i] == '3') lastDigit = i;
|
||||||
|
if(temp[i] == '4') lastDigit = i;
|
||||||
|
if(temp[i] == '5') lastDigit = i;
|
||||||
|
if(temp[i] == '6') lastDigit = i;
|
||||||
|
if(temp[i] == '7') lastDigit = i;
|
||||||
|
if(temp[i] == '8') lastDigit = i;
|
||||||
|
if(temp[i] == '9') lastDigit = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->Symbol = temp.erase(0, lastDigit +1);
|
||||||
|
//check is Symbol is 2 charaters, if not, add " " at the end
|
||||||
|
if( this->Symbol.length() == 1 ){
|
||||||
|
this->Symbol = this->Symbol + " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
temp = name;
|
||||||
|
int len = temp.length();
|
||||||
|
temp = temp.erase(lastDigit+1, len);
|
||||||
|
|
||||||
|
this->A = atoi(temp.c_str());
|
||||||
|
//printf(" Symbol = |%s| , Mass = %d\n", this->Symbol.c_str(), this->A);
|
||||||
|
|
||||||
|
// find the nucleus in the data
|
||||||
|
string line;
|
||||||
|
int lineNum=0;
|
||||||
|
int list_A;
|
||||||
|
string list_symbol;
|
||||||
|
|
||||||
|
ifstream myfile;
|
||||||
|
int flag=0;
|
||||||
|
|
||||||
|
setFileLines();
|
||||||
|
|
||||||
|
int numLineStart = fileStartLine;
|
||||||
|
int numLineEnd = fileEndLine;
|
||||||
|
|
||||||
|
if ( A >= 50 && A < 100) numLineStart = lineMass050_099;
|
||||||
|
if ( A >=100 && A < 150) numLineStart = lineMass100_149;
|
||||||
|
if ( A >=150 && A < 200) numLineStart = lineMass150_199;
|
||||||
|
if ( A >=200 ) numLineStart = lineMass200;
|
||||||
|
|
||||||
|
myfile.open(dataSource.c_str());
|
||||||
|
|
||||||
|
if (myfile.is_open()) {
|
||||||
|
while (/*! myfile.eof() &&*/ flag == 0 && lineNum <numLineEnd){
|
||||||
|
lineNum ++ ;
|
||||||
|
//printf("%3d ",lineNum);
|
||||||
|
getline (myfile,line);
|
||||||
|
|
||||||
|
if (lineNum >= numLineStart ){
|
||||||
|
list_symbol = line.substr(20,2);
|
||||||
|
list_A = atoi((line.substr(15,5)).c_str());
|
||||||
|
|
||||||
|
//printf(" A = %d, Sym = |%s| \n", list_A, list_symbol.c_str());
|
||||||
|
|
||||||
|
if ( this->A == list_A && this->Symbol == list_symbol) {
|
||||||
|
this->Z = atoi((line.substr(10,5)).c_str());
|
||||||
|
this->BEA = atof((line.substr(54,11)).c_str());
|
||||||
|
this->Mass = this->Z*mp + (list_A-this->Z)*mn - this->BEA/1000*list_A;
|
||||||
|
this->MassError = atof((line.substr(65,7)).c_str());
|
||||||
|
|
||||||
|
string str = line.substr(20,2);
|
||||||
|
str.erase(remove(str.begin(), str.end(), ' '), str.end());
|
||||||
|
this->Symbol = str;
|
||||||
|
|
||||||
|
ostringstream ss;
|
||||||
|
ss << this->A << this->Symbol;
|
||||||
|
this->Name = ss.str();
|
||||||
|
flag = 1;
|
||||||
|
}else if ( list_A > this->A) {
|
||||||
|
this->BEA = -404;
|
||||||
|
this->Mass = -404;
|
||||||
|
this->MassError = -404;
|
||||||
|
this->Symbol = "non";
|
||||||
|
this->Name = "non";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
myfile.close();
|
||||||
|
}else {
|
||||||
|
printf("Unable to open %s\n", dataSource.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline double Isotope::CalSp(int Np, int Nn){
|
||||||
|
Isotope nucleusD(A - Np - Nn, Z - Np);
|
||||||
|
|
||||||
|
if( nucleusD.Mass != -404){
|
||||||
|
return nucleusD.Mass + Nn*mn + Np*mp - this->Mass;
|
||||||
|
}else{
|
||||||
|
return -404;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline double Isotope::CalSp2(int a, int z){
|
||||||
|
Isotope nucleusD(A - a , Z - z);
|
||||||
|
Isotope nucleusS(a,z);
|
||||||
|
|
||||||
|
if( nucleusD.Mass != -404 && nucleusS.Mass != -404){
|
||||||
|
return nucleusD.Mass + nucleusS.Mass - this->Mass;
|
||||||
|
}else{
|
||||||
|
return -404;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int Isotope::TwoJ(int nShell){
|
||||||
|
|
||||||
|
switch(nShell){
|
||||||
|
case 0: return 1; break; // 0s1/2
|
||||||
|
case 1: return 3; break; // 0p3/2
|
||||||
|
case 2: return 1; break; // 0p1/2 -- 8
|
||||||
|
case 3: return 5; break; // 0d5/2
|
||||||
|
case 4: return 1; break; // 1s1/2
|
||||||
|
case 5: return 3; break; // 0d3/2 -- 20
|
||||||
|
case 6: return 7; break; // 0f7/2 -- 28
|
||||||
|
case 7: return 3; break; // 1p3/2
|
||||||
|
case 8: return 1; break; // 1p1/2
|
||||||
|
case 9: return 5; break; // 0f5/2 -- 40
|
||||||
|
case 10: return 9; break; // 0g9/2 -- 50
|
||||||
|
case 11: return 7; break; // 0g7/2
|
||||||
|
case 12: return 5; break; // 1d5/2
|
||||||
|
case 13: return 11; break; // 0h11/2
|
||||||
|
case 14: return 3; break; // 1d3/2
|
||||||
|
case 15: return 1; break; // 2s1/2 -- 82
|
||||||
|
case 16: return 9; break; // 0h9/2
|
||||||
|
case 17: return 7; break; // 1f7/2
|
||||||
|
case 18: return 13; break; // 0i13/2
|
||||||
|
case 19: return 3; break; // 2p3/2
|
||||||
|
case 20: return 5; break; // 1f5/2
|
||||||
|
case 21: return 1; break; // 1p1/2 -- 126
|
||||||
|
case 22: return 9; break; // 1g9/2
|
||||||
|
case 23: return 11; break; // 0i11/2
|
||||||
|
case 24: return 15; break; // 0j15/2
|
||||||
|
case 25: return 5; break; // 2d5/2
|
||||||
|
case 26: return 1; break; // 3s1/2
|
||||||
|
case 27: return 3; break; // 2d3/2
|
||||||
|
case 28: return 7; break; // 1g7/2
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline string Isotope::Orbital(int nShell){
|
||||||
|
|
||||||
|
switch(nShell){
|
||||||
|
case 0: return "0s1 "; break; //
|
||||||
|
case 1: return "0p3 "; break; //
|
||||||
|
case 2: return "0p1 "; break; //-- 8
|
||||||
|
case 3: return "0d5 "; break; //
|
||||||
|
case 4: return "1s1 "; break; //
|
||||||
|
case 5: return "0d3 "; break; //-- 20
|
||||||
|
case 6: return "0f7 "; break; //-- 28
|
||||||
|
case 7: return "1p3 "; break; //
|
||||||
|
case 8: return "1p1 "; break; //
|
||||||
|
case 9: return "0f5 "; break; //-- 40
|
||||||
|
case 10: return "0g9 "; break; //-- 50
|
||||||
|
case 11: return "0g7 "; break; //
|
||||||
|
case 12: return "1d5 "; break; //
|
||||||
|
case 13: return "0h11"; break; //
|
||||||
|
case 14: return "1d3 "; break; //
|
||||||
|
case 15: return "2s1 "; break; //-- 82
|
||||||
|
case 16: return "0h9 "; break; //
|
||||||
|
case 17: return "1f7 "; break; //
|
||||||
|
case 18: return "0i13"; break; //
|
||||||
|
case 19: return "2p3 "; break; //
|
||||||
|
case 20: return "1f5 "; break; //
|
||||||
|
case 21: return "1p1 "; break; //-- 126
|
||||||
|
case 22: return "1g9 "; break; //
|
||||||
|
case 23: return "0i11"; break; //
|
||||||
|
case 24: return "0j15"; break; //
|
||||||
|
case 25: return "2d5 "; break; //
|
||||||
|
case 26: return "3s1 "; break; //
|
||||||
|
case 27: return "2d3 "; break; //
|
||||||
|
case 28: return "1g7 "; break; //
|
||||||
|
}
|
||||||
|
|
||||||
|
return "nan";
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Isotope::ListShell(){
|
||||||
|
|
||||||
|
if( Mass < 0 ) return;
|
||||||
|
|
||||||
|
int n = A-Z;
|
||||||
|
int p = Z;
|
||||||
|
|
||||||
|
int k = std::min(n,p);
|
||||||
|
int nMagic = 0;
|
||||||
|
for( int i = 0; i < 7; i++){
|
||||||
|
if( magic(i) < k && k <= magic(i+1) ){
|
||||||
|
nMagic = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int coreShell = magicShellID(nMagic-1);
|
||||||
|
int coreZ1 = magic(nMagic-1);
|
||||||
|
int coreZ2 = magic(nMagic);
|
||||||
|
|
||||||
|
Isotope core1( 2*coreZ1, coreZ1);
|
||||||
|
Isotope core2( 2*coreZ2, coreZ2);
|
||||||
|
|
||||||
|
printf("------------------ Core:%3s, inner Core:%3s \n", (core2.Name).c_str(), (core1.Name).c_str());
|
||||||
|
printf(" || ");
|
||||||
|
int t = std::max(n,p);
|
||||||
|
int nShell = 0;
|
||||||
|
do{
|
||||||
|
int occ = TwoJ(nShell)+1;
|
||||||
|
if( nShell > coreShell) {
|
||||||
|
printf("%4s", Orbital(nShell).c_str());
|
||||||
|
if( nShell == 0 || nShell == 2 || nShell == 5 || nShell ==6 || nShell == 9 || nShell == 10 || nShell == 15 || nShell == 21){
|
||||||
|
printf("|");
|
||||||
|
}else{
|
||||||
|
printf(",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
t = t - occ;
|
||||||
|
nShell++;
|
||||||
|
}while( t > 0 && nShell < 29);
|
||||||
|
for( int i = 1; i <= 6; i++){
|
||||||
|
if (nShell < 28) {
|
||||||
|
printf("%4s,", Orbital(nShell).c_str());
|
||||||
|
}else if( nShell == 28 ) {
|
||||||
|
printf("%4s", Orbital(nShell).c_str());
|
||||||
|
}
|
||||||
|
nShell ++;
|
||||||
|
}
|
||||||
|
if (nShell < 29) printf("%4s", Orbital(nShell).c_str());
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
|
||||||
|
printf(" Z = %3d || ", p);
|
||||||
|
nShell = 0;
|
||||||
|
do{
|
||||||
|
int occ = TwoJ(nShell)+1;
|
||||||
|
if( nShell > coreShell ){
|
||||||
|
if( p > occ ) {
|
||||||
|
printf("%-4d", occ);
|
||||||
|
if( nShell == 0 || nShell == 2 || nShell == 5 || nShell ==6 || nShell == 9 || nShell == 10 || nShell == 15 || nShell == 21){
|
||||||
|
printf("|");
|
||||||
|
}else{
|
||||||
|
printf(",");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
printf("%-4d", p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p = p - occ;
|
||||||
|
nShell++;
|
||||||
|
}while( p > 0 && nShell < 29);
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
printf(" N = %3d || ", n);
|
||||||
|
nShell = 0;
|
||||||
|
do{
|
||||||
|
int occ = TwoJ(nShell)+1;
|
||||||
|
if ( nShell > coreShell ){
|
||||||
|
if( n > occ ) {
|
||||||
|
printf("%-4d", occ);
|
||||||
|
if( nShell == 0 || nShell == 2 || nShell == 5 || nShell ==6 || nShell == 9 || nShell == 10 || nShell == 15 || nShell == 21){
|
||||||
|
printf("|");
|
||||||
|
}else{
|
||||||
|
printf(",");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
printf("%-4d", n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
n = n - occ;
|
||||||
|
nShell++;
|
||||||
|
}while( n > 0 && nShell < 29);
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
printf("------------------ \n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void Isotope::Print(){
|
||||||
|
|
||||||
|
if (Mass > 0){
|
||||||
|
|
||||||
|
dataSource = massData;
|
||||||
|
|
||||||
|
printf(" using mass data : %s \n", dataSource.c_str());
|
||||||
|
printf(" mass of \e[47m\e[31m%s\e[m nucleus (Z,A)=(%3d,%3d) is \e[47m\e[31m%12.5f\e[m MeV, BE/A=%7.5f MeV\n", Name.c_str(), Z, A, Mass, BEA/1000.);
|
||||||
|
printf(" total BE : %12.5f MeV\n",BEA*A/1000.);
|
||||||
|
printf(" mass in amu : %12.5f u\n",Mass/amu);
|
||||||
|
printf(" mass excess : %12.5f MeV\n", Mass + Z*0.510998950 - A*amu);
|
||||||
|
printf("-------------- Seperation energy \n");
|
||||||
|
printf(" S1p: %8.4f| S1n: %8.4f| S(2H ): %8.4f| S1p1n : %8.4f\n", CalSp(1, 0), CalSp(0, 1), CalSp2(2, 1), CalSp(1, 1));
|
||||||
|
printf(" S2p: %8.4f| S2n: %8.4f| S(3He): %8.4f| S(3H) : %8.4f\n", CalSp(2, 0), CalSp(0, 2), CalSp2(3, 2), CalSp2(3, 1));
|
||||||
|
printf(" S3p: %8.4f| S3n: %8.4f| S(4He): %8.4f|\n", CalSp(3, 0), CalSp(0, 3), CalSp2(4, 2));
|
||||||
|
printf(" S4p: %8.4f| S4n: %8.4f| \n", CalSp(4, 0), CalSp(0, 4));
|
||||||
|
|
||||||
|
}else{
|
||||||
|
printf("Error %6.0f, no nucleus with (Z,A) = (%3d,%3d). \n", Mass, Z, A);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
674
anasen_analysis_vignesh/Armory/Armory/LICENSE
Normal file
674
anasen_analysis_vignesh/Armory/Armory/LICENSE
Normal file
|
|
@ -0,0 +1,674 @@
|
||||||
|
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>.
|
||||||
32
anasen_analysis_vignesh/Armory/Armory/Makefile
Normal file
32
anasen_analysis_vignesh/Armory/Armory/Makefile
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
########################################################################
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#########################################################################
|
||||||
|
|
||||||
|
CC = g++
|
||||||
|
|
||||||
|
#COPTS = -fPIC -DLINUX -O2 -std=c++17 -lpthread
|
||||||
|
COPTS = -fPIC -DLINUX -g -O0 -Wall -std=c++17 -lpthread
|
||||||
|
|
||||||
|
ROOTLIBS = `root-config --cflags --glibs`
|
||||||
|
|
||||||
|
ALL = Mapper EventBuilder#AnasenMS
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
|
||||||
|
all : $(ALL)
|
||||||
|
|
||||||
|
clean :
|
||||||
|
/bin/rm -f $(OBJS) $(ALL)
|
||||||
|
|
||||||
|
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)
|
||||||
182
anasen_analysis_vignesh/Armory/Armory/Mapper.cpp
Normal file
182
anasen_analysis_vignesh/Armory/Armory/Mapper.cpp
Normal file
|
|
@ -0,0 +1,182 @@
|
||||||
|
#include <string>
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
#include <TROOT.h>
|
||||||
|
#include <TTree.h>
|
||||||
|
#include <TFile.h>
|
||||||
|
#include <TMath.h>
|
||||||
|
#include <TBenchmark.h>
|
||||||
|
|
||||||
|
#include "../mapping.h"
|
||||||
|
#include "ClassDet.h"
|
||||||
|
|
||||||
|
//===============================
|
||||||
|
int main(int argc, char **argv){
|
||||||
|
|
||||||
|
printf("=========================================\n");
|
||||||
|
printf("=== Mapper ===\n");
|
||||||
|
printf("=========================================\n");
|
||||||
|
if (argc != 2) {
|
||||||
|
printf("Incorrect number of arguments:\n");
|
||||||
|
printf("%s [inFile]\n", argv[0]);
|
||||||
|
printf("\n\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
///============= read input
|
||||||
|
std::string inFileName = argv[1];
|
||||||
|
|
||||||
|
PrintMapping();
|
||||||
|
|
||||||
|
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];
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
///================== new tree
|
||||||
|
TString outFileName = inFileName;
|
||||||
|
TString runStr = outFileName;
|
||||||
|
int pos = outFileName.Last('/');
|
||||||
|
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
|
||||||
|
outFileName += "_mapped.root";
|
||||||
|
|
||||||
|
ULong_t eventID;
|
||||||
|
UInt_t run = runStr.Atoi();
|
||||||
|
|
||||||
|
Det sx3;
|
||||||
|
Det qqq;
|
||||||
|
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");
|
||||||
|
|
||||||
|
|
||||||
|
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("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("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");
|
||||||
|
|
||||||
|
///================== looping old tree and apply mapping
|
||||||
|
|
||||||
|
//clock
|
||||||
|
// TBenchmark clock;
|
||||||
|
// Bool_t shown;
|
||||||
|
|
||||||
|
for( unsigned long long ev = 0; ev < totnumEntry; ev++){
|
||||||
|
tree->GetEntry(ev);
|
||||||
|
|
||||||
|
eventID = evID;
|
||||||
|
sx3.multi = 0;
|
||||||
|
qqq.multi = 0;
|
||||||
|
pc.multi = 0;
|
||||||
|
|
||||||
|
qqq.Clear();
|
||||||
|
|
||||||
|
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
|
||||||
|
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
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( globalCh == -1) printf("ev %llu\n", ev);
|
||||||
|
|
||||||
|
unsigned short ID = mapping[globalCh];
|
||||||
|
|
||||||
|
//=================================== sx3
|
||||||
|
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 ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================== qqq
|
||||||
|
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 ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================== pc
|
||||||
|
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 ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
inFile->Close();
|
||||||
|
|
||||||
|
saveFile->cd(); //set focus on this file
|
||||||
|
newTree->Write();
|
||||||
|
UInt_t eventNumber = newTree->GetEntries();
|
||||||
|
saveFile->Close();
|
||||||
|
printf("-------------- done, %u\n", eventNumber);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
280
anasen_analysis_vignesh/Armory/Armory/anasenMS.cpp
Normal file
280
anasen_analysis_vignesh/Armory/Armory/anasenMS.cpp
Normal file
|
|
@ -0,0 +1,280 @@
|
||||||
|
#include "TRandom.h"
|
||||||
|
#include "TFile.h"
|
||||||
|
#include "TTree.h"
|
||||||
|
#include "TH1.h"
|
||||||
|
#include "TH2.h"
|
||||||
|
#include "TStyle.h"
|
||||||
|
#include "TCanvas.h"
|
||||||
|
#include "TBenchmark.h"
|
||||||
|
|
||||||
|
#include "ClassTransfer.h"
|
||||||
|
#include "ClassAnasen.h"
|
||||||
|
|
||||||
|
//======== Gerneate light particle based on reaction
|
||||||
|
// find out the CalTrack and the real track
|
||||||
|
// find out the Q-value uncertaintly
|
||||||
|
|
||||||
|
int main(int argc, char **argv){
|
||||||
|
|
||||||
|
printf("=========================================\n");
|
||||||
|
printf("=== ANASEN Monte Carlo ===\n");
|
||||||
|
printf("=========================================\n");
|
||||||
|
|
||||||
|
int numEvent = 1000000;
|
||||||
|
if( argc >= 2 ) numEvent = atoi(argv[1]);
|
||||||
|
|
||||||
|
//Reaction
|
||||||
|
TransferReaction transfer;
|
||||||
|
|
||||||
|
transfer.SetA(24,12, 0);
|
||||||
|
transfer.SetIncidentEnergyAngle(10, 0, 0);
|
||||||
|
transfer.Seta( 4, 2);
|
||||||
|
transfer.Setb( 1, 1);
|
||||||
|
|
||||||
|
//TODO add alpha source
|
||||||
|
|
||||||
|
std::vector<float> ExAList = {0};
|
||||||
|
std::vector<float> ExList = {0, 1, 2};
|
||||||
|
|
||||||
|
double vertexXRange[2] = { -5, 5}; // mm
|
||||||
|
double vertexYRange[2] = { -5, 5};
|
||||||
|
double vertexZRange[2] = { -100, 100};
|
||||||
|
|
||||||
|
double sigmaSX3_W = -1; // mm, < 0 use mid-point
|
||||||
|
double sigmaSX3_L = 3; // mm, < 0 use mid-point
|
||||||
|
double sigmaPW_A = 0; // from 0 to 1.
|
||||||
|
double sigmaPW_C = 0; // from 0 to 1.
|
||||||
|
|
||||||
|
//###################################################
|
||||||
|
|
||||||
|
printf("------------ Vertex :\n");
|
||||||
|
printf("X : %7.2f - %7.2f mm\n", vertexXRange[0], vertexXRange[1]);
|
||||||
|
printf("Y : %7.2f - %7.2f mm\n", vertexYRange[0], vertexYRange[1]);
|
||||||
|
printf("Z : %7.2f - %7.2f mm\n", vertexZRange[0], vertexZRange[1]);
|
||||||
|
printf("------------ Uncertainty :\n");
|
||||||
|
printf(" SX3 horizontal : %.1f\n", sigmaSX3_W);
|
||||||
|
printf(" SX3 vertical : %.1f\n", sigmaSX3_L);
|
||||||
|
printf(" Anode : %.1f mm\n", sigmaPW_A);
|
||||||
|
printf(" Cathode : %.1f mm\n", sigmaPW_C);
|
||||||
|
printf(" num_eve : %d \n",numEvent);
|
||||||
|
transfer.CalReactionConstant();
|
||||||
|
|
||||||
|
int nExA = ExAList.size();
|
||||||
|
int nEx = ExList.size();
|
||||||
|
|
||||||
|
ANASEN * anasen = new ANASEN();
|
||||||
|
SX3 * sx3 = anasen->GetSX3();
|
||||||
|
PW * pw = anasen->GetPW();
|
||||||
|
|
||||||
|
TString saveFileName = "SimAnasen1.root";
|
||||||
|
printf("\e[32m#################################### building Tree in %s\e[0m\n", saveFileName.Data());
|
||||||
|
TFile * saveFile = new TFile(saveFileName, "recreate");
|
||||||
|
TTree * tree = new TTree("tree", "tree");
|
||||||
|
|
||||||
|
double KEA;
|
||||||
|
tree->Branch("beamKEA", &KEA, "beamKEA/D");
|
||||||
|
|
||||||
|
double thetaCM, phiCM;
|
||||||
|
tree->Branch("thetaCM", &thetaCM, "thetaCM/D");
|
||||||
|
tree->Branch("phiCM", &phiCM, "phiCM/D");
|
||||||
|
|
||||||
|
double thetab, phib, Tb;
|
||||||
|
double thetaB, phiB, TB;
|
||||||
|
tree->Branch("thetab", &thetab, "thetab/D");
|
||||||
|
tree->Branch("phib", &phib, "phib/D");
|
||||||
|
tree->Branch("Tb", &Tb, "Tb/D");
|
||||||
|
tree->Branch("thetaB", &thetaB, "thetaB/D");
|
||||||
|
tree->Branch("phiB", &phiB, "phiB/D");
|
||||||
|
tree->Branch("TB", &TB, "TB/D");
|
||||||
|
|
||||||
|
int ExAID;
|
||||||
|
double ExA;
|
||||||
|
tree->Branch("ExAID", &ExAID, "ExAID/I");
|
||||||
|
tree->Branch("ExA", &ExA, "ExA/D");
|
||||||
|
|
||||||
|
int ExID;
|
||||||
|
double Ex;
|
||||||
|
tree->Branch("ExID", &ExID, "ExID/I");
|
||||||
|
tree->Branch("Ex", &Ex, "Ex/D");
|
||||||
|
|
||||||
|
double vertexX, vertexY, vertexZ;
|
||||||
|
tree->Branch("vX", &vertexX, "VertexX/D");
|
||||||
|
tree->Branch("vY", &vertexY, "VertexY/D");
|
||||||
|
tree->Branch("vZ", &vertexZ, "VertexZ/D");
|
||||||
|
|
||||||
|
double sx3X, sx3Y, sx3Z;
|
||||||
|
tree->Branch("sx3X", &sx3X, "sx3X/D");
|
||||||
|
tree->Branch("sx3Y", &sx3Y, "sx3Y/D");
|
||||||
|
tree->Branch("sx3Z", &sx3Z, "sx3Z/D");
|
||||||
|
|
||||||
|
int anodeID[2], cathodeID[2];
|
||||||
|
tree->Branch("aID", anodeID, "anodeID/I");
|
||||||
|
tree->Branch("cID", cathodeID, "cathodeID/I");
|
||||||
|
|
||||||
|
double anodeDist[2], cathodeDist[2];
|
||||||
|
tree->Branch("aDist", anodeDist, "anodeDist/D");
|
||||||
|
tree->Branch("cDist", cathodeDist, "cathodeDist/D");
|
||||||
|
|
||||||
|
int sx3ID, sx3Up, sx3Dn, sx3Bk;
|
||||||
|
double sx3ZFrac;
|
||||||
|
tree->Branch("sx3ID", &sx3ID, "sx3ID/I");
|
||||||
|
tree->Branch("sx3Up", &sx3Up, "sx3Up/I");
|
||||||
|
tree->Branch("sx3Dn", &sx3Dn, "sx3Dn/I");
|
||||||
|
tree->Branch("sx3Bk", &sx3Bk, "sx3Bk/I");
|
||||||
|
tree->Branch("sx3ZFrac", &sx3ZFrac, "sx3ZFrac/D");
|
||||||
|
|
||||||
|
double reTheta, rePhi;
|
||||||
|
tree->Branch("reTheta", &reTheta, "reconstucted_theta/D");
|
||||||
|
tree->Branch("rePhi", &rePhi, "reconstucted_phi/D");
|
||||||
|
|
||||||
|
double reTheta1, rePhi1;
|
||||||
|
tree->Branch("reTheta1", &reTheta1, "reconstucted_theta1/D");
|
||||||
|
tree->Branch("rePhi1", &rePhi1, "reconstucted_phi1/D");
|
||||||
|
|
||||||
|
double z0;
|
||||||
|
tree->Branch("z0", &z0, "reconstucted_Z/D");
|
||||||
|
|
||||||
|
|
||||||
|
//========timer
|
||||||
|
TBenchmark clock;
|
||||||
|
bool shown ;
|
||||||
|
clock.Reset();
|
||||||
|
clock.Start("timer");
|
||||||
|
shown = false;
|
||||||
|
|
||||||
|
//================================= Calculate event
|
||||||
|
for( int i = 0; i < numEvent ; i++){
|
||||||
|
|
||||||
|
ExAID = gRandom->Integer(nExA);
|
||||||
|
ExA = ExAList[ExAID];
|
||||||
|
transfer.SetExA(ExA);
|
||||||
|
|
||||||
|
ExID = gRandom->Integer(nEx);
|
||||||
|
Ex = ExList[ExID];
|
||||||
|
transfer.SetExB(Ex);
|
||||||
|
|
||||||
|
transfer.CalReactionConstant();
|
||||||
|
|
||||||
|
thetaCM = TMath::ACos(2 * gRandom->Rndm() - 1) ;
|
||||||
|
phiCM = (gRandom->Rndm() - 0.5) * TMath::TwoPi();
|
||||||
|
|
||||||
|
//==== Calculate reaction
|
||||||
|
TLorentzVector * output = transfer.Event(thetaCM, phiCM);
|
||||||
|
TLorentzVector Pb = output[2];
|
||||||
|
TLorentzVector PB = output[3];
|
||||||
|
|
||||||
|
thetab = Pb.Theta() * TMath::RadToDeg();
|
||||||
|
thetaB = PB.Theta() * TMath::RadToDeg();
|
||||||
|
|
||||||
|
Tb = Pb.E() - Pb.M();
|
||||||
|
TB = PB.E() - PB.M();
|
||||||
|
|
||||||
|
phib = Pb.Phi() * TMath::RadToDeg();
|
||||||
|
phiB = PB.Phi() * TMath::RadToDeg();
|
||||||
|
|
||||||
|
vertexX = (vertexXRange[1]- vertexXRange[0])*gRandom->Rndm() + vertexXRange[0];
|
||||||
|
vertexY = (vertexYRange[1]- vertexYRange[0])*gRandom->Rndm() + vertexYRange[0];
|
||||||
|
vertexZ = (vertexZRange[1]- vertexZRange[0])*gRandom->Rndm() + vertexZRange[0];
|
||||||
|
|
||||||
|
TVector3 vertex(vertexX, vertexY, vertexZ);
|
||||||
|
|
||||||
|
TVector3 dir(1, 0, 0);
|
||||||
|
dir.SetTheta(thetab * TMath::DegToRad());
|
||||||
|
dir.SetPhi(phib * TMath::DegToRad());
|
||||||
|
|
||||||
|
|
||||||
|
pw->FindWireID(vertex, dir, false);
|
||||||
|
sx3->FindSX3Pos(vertex, dir, false);
|
||||||
|
|
||||||
|
PWHitInfo hitInfo = pw->GetHitInfo();
|
||||||
|
|
||||||
|
anodeID[0] = hitInfo.nearestWire.first;
|
||||||
|
cathodeID[0] = hitInfo.nearestWire.second;
|
||||||
|
anodeID[1] = hitInfo.nextNearestWire.first;
|
||||||
|
cathodeID[1] = hitInfo.nextNearestWire.second;
|
||||||
|
|
||||||
|
anodeDist[0] = hitInfo.nearestDist.first;
|
||||||
|
cathodeDist[0] = hitInfo.nearestDist.second;
|
||||||
|
anodeDist[1] = hitInfo.nextNearestDist.first;
|
||||||
|
cathodeDist[1] = hitInfo.nextNearestDist.second;
|
||||||
|
|
||||||
|
sx3ID = sx3->GetID();
|
||||||
|
if( sx3ID >= 0 ){
|
||||||
|
sx3Up = sx3->GetChUp();
|
||||||
|
sx3Dn = sx3->GetChDn();
|
||||||
|
sx3Bk = sx3->GetChBk();
|
||||||
|
sx3ZFrac = sx3->GetZFrac();
|
||||||
|
|
||||||
|
//Introduce uncertaity
|
||||||
|
// TVector3 hitPos = sx3->GetHitPos();
|
||||||
|
TVector3 hitPos = sx3->GetHitPosWithSigma(sigmaSX3_W, sigmaSX3_L);
|
||||||
|
|
||||||
|
sx3X = hitPos.X();
|
||||||
|
sx3Y = hitPos.Y();
|
||||||
|
sx3Z = hitPos.Z();
|
||||||
|
|
||||||
|
pw->CalTrack(hitPos, anodeID[0], cathodeID[0], false);
|
||||||
|
reTheta = pw->GetTrackTheta() * TMath::RadToDeg();
|
||||||
|
rePhi = pw->GetTrackPhi() * TMath::RadToDeg();
|
||||||
|
|
||||||
|
pw->CalTrack2(hitPos, hitInfo, sigmaPW_A, sigmaPW_C, false);
|
||||||
|
reTheta1 = pw->GetTrackTheta() * TMath::RadToDeg();
|
||||||
|
rePhi1 = pw->GetTrackPhi() * TMath::RadToDeg();
|
||||||
|
|
||||||
|
z0 = pw->GetZ0();
|
||||||
|
|
||||||
|
}else{
|
||||||
|
sx3Up = -1;
|
||||||
|
sx3Dn = -1;
|
||||||
|
sx3Bk = -1;
|
||||||
|
sx3ZFrac = TMath::QuietNaN();
|
||||||
|
|
||||||
|
sx3X = TMath::QuietNaN();
|
||||||
|
sx3Y = TMath::QuietNaN();
|
||||||
|
sx3Z = TMath::QuietNaN();
|
||||||
|
|
||||||
|
// for( int i = 0; i < 12; i++){
|
||||||
|
// sx3Index[i] = -1;
|
||||||
|
// }
|
||||||
|
|
||||||
|
reTheta = TMath::QuietNaN();
|
||||||
|
rePhi = TMath::QuietNaN();
|
||||||
|
|
||||||
|
reTheta1 = TMath::QuietNaN();
|
||||||
|
rePhi1 = TMath::QuietNaN();
|
||||||
|
|
||||||
|
z0 = TMath::QuietNaN();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
tree->Fill();
|
||||||
|
|
||||||
|
//#################################################################### Timer
|
||||||
|
clock.Stop("timer");
|
||||||
|
Double_t time = clock.GetRealTime("timer");
|
||||||
|
clock.Start("timer");
|
||||||
|
|
||||||
|
if ( !shown ) {
|
||||||
|
if (fmod(time, 10) < 1 ){
|
||||||
|
printf( "%10d[%2d%%]| %8.2f sec | expect: %5.1f min \n", i, TMath::Nint((i+1)*100./numEvent), time , numEvent*time/(i+1)/60);
|
||||||
|
shown = 1;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if (fmod(time, 10) > 9 ){
|
||||||
|
shown = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
tree->Write();
|
||||||
|
int count = tree->GetEntries();
|
||||||
|
saveFile->Close();
|
||||||
|
|
||||||
|
printf("=============== done. saved as %s. count(hit==1) : %d\n", saveFileName.Data(), count);
|
||||||
|
|
||||||
|
delete anasen;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
105
anasen_analysis_vignesh/Armory/Armory/constant.h
Normal file
105
anasen_analysis_vignesh/Armory/Armory/constant.h
Normal file
|
|
@ -0,0 +1,105 @@
|
||||||
|
/***********************************************************************
|
||||||
|
*
|
||||||
|
* This is constant.h, to provide various physical constants.
|
||||||
|
*
|
||||||
|
*-------------------------------------------------------
|
||||||
|
* created by Ryan (Tsz Leung) Tang, Nov-18, 2018
|
||||||
|
* email: goluckyryan@gmail.com
|
||||||
|
* ********************************************************************/
|
||||||
|
|
||||||
|
#ifndef constant
|
||||||
|
#define constant
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
const double pi = acos(-1.0);
|
||||||
|
const double E = 2.718281828459 ;
|
||||||
|
const double hbar_SI = 1.054571628e-34; //Js
|
||||||
|
const double kB = 1.3806504e-23; //JK^-1
|
||||||
|
const double e = 1.602176487e-19; //C
|
||||||
|
const double c_SI = 299792458; //ms^-1
|
||||||
|
const double me_SI = 9.10938215e-31 ; //kg
|
||||||
|
const double mp_SI = 1.672621637e-27 ; //kg
|
||||||
|
const double mn_SI = 1.67492729e-27 ; //kg
|
||||||
|
const double NA = 6.022141e+23 ; //mol^-1
|
||||||
|
|
||||||
|
const double deg2rad = pi/180 ;
|
||||||
|
const double rad2deg = 180/pi ;
|
||||||
|
|
||||||
|
//======================================================================
|
||||||
|
const double amu = 931.49432; // MeV/c^2
|
||||||
|
const double hbarc = 197.326979; // MeV fm;
|
||||||
|
const double c = 299.792458; // mm/ns;
|
||||||
|
const double ee = 1.439964454; // MeV.fm
|
||||||
|
|
||||||
|
//======================================================================
|
||||||
|
double kg2MeV(double m){
|
||||||
|
return m*c_SI*c_SI/e/1e6;
|
||||||
|
}
|
||||||
|
|
||||||
|
double T2Brho(double mass, int Z, int A, double T){
|
||||||
|
//mass in MeV
|
||||||
|
// Z in e
|
||||||
|
// T in MeV/A
|
||||||
|
double gamma = (T*A + mass)/mass;
|
||||||
|
double beta = sqrt(1-1/gamma/gamma);
|
||||||
|
return mass*beta*gamma/Z/c;
|
||||||
|
}
|
||||||
|
|
||||||
|
double Brho2T(double mass, int Z, int A, double Brho){
|
||||||
|
//mass in MeV
|
||||||
|
// Z in e
|
||||||
|
return (sqrt(pow(Brho*Z*c,2)+mass*mass)-mass)/A;
|
||||||
|
}
|
||||||
|
|
||||||
|
double T2beta(double mass, int A, double T){
|
||||||
|
double gamma = 1.0 + T*A/mass;
|
||||||
|
return sqrt(1-1/gamma/gamma);
|
||||||
|
}
|
||||||
|
|
||||||
|
double ev2nm(double eV){
|
||||||
|
// photon energy to nm
|
||||||
|
return hbarc/2/pi/eV;
|
||||||
|
}
|
||||||
|
|
||||||
|
//======================================================================
|
||||||
|
const double mp = kg2MeV(mp_SI);
|
||||||
|
const double mn = kg2MeV(mn_SI);
|
||||||
|
const double hbar = 197.326979;
|
||||||
|
|
||||||
|
|
||||||
|
//======================================================================
|
||||||
|
inline std::vector<std::string> SplitStr(std::string tempLine, std::string splitter, int shift = 0){
|
||||||
|
|
||||||
|
std::vector<std::string> output;
|
||||||
|
|
||||||
|
size_t pos;
|
||||||
|
do{
|
||||||
|
pos = tempLine.find(splitter); /// fine splitter
|
||||||
|
if( pos == 0 ){ ///check if it is splitter again
|
||||||
|
tempLine = tempLine.substr(pos+1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string secStr;
|
||||||
|
if( pos == std::string::npos ){
|
||||||
|
secStr = tempLine;
|
||||||
|
}else{
|
||||||
|
secStr = tempLine.substr(0, pos+shift);
|
||||||
|
tempLine = tempLine.substr(pos+shift);
|
||||||
|
}
|
||||||
|
|
||||||
|
///check if secStr is begin with space
|
||||||
|
while( secStr.substr(0, 1) == " ") secStr = secStr.substr(1);
|
||||||
|
|
||||||
|
///check if secStr is end with space
|
||||||
|
while( secStr.back() == ' ') secStr = secStr.substr(0, secStr.size()-1);
|
||||||
|
|
||||||
|
output.push_back(secStr);
|
||||||
|
///printf(" |%s---\n", secStr.c_str());
|
||||||
|
|
||||||
|
}while(pos != std::string::npos );
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
314
anasen_analysis_vignesh/Armory/ClassAnasen.h
Normal file
314
anasen_analysis_vignesh/Armory/ClassAnasen.h
Normal file
|
|
@ -0,0 +1,314 @@
|
||||||
|
#ifndef ClassAnasen_h
|
||||||
|
#define ClassAnasen_h
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include <TMath.h>
|
||||||
|
#include <TVector3.h>
|
||||||
|
|
||||||
|
#include "TGeoManager.h"
|
||||||
|
#include "TGeoVolume.h"
|
||||||
|
#include "TGeoBBox.h"
|
||||||
|
#include "TCanvas.h"
|
||||||
|
#include "TPolyMarker3D.h"
|
||||||
|
#include "TPolyLine3D.h"
|
||||||
|
#include "TRandom.h"
|
||||||
|
|
||||||
|
#include "ClassSX3.h"
|
||||||
|
#include "ClassPW.h"
|
||||||
|
|
||||||
|
class ANASEN{
|
||||||
|
public:
|
||||||
|
ANASEN();
|
||||||
|
~ANASEN();
|
||||||
|
|
||||||
|
void SetUncertainties(double sx3W, double sx3L, double anode, double cathode){
|
||||||
|
sigmaA = anode;
|
||||||
|
sigmaC = cathode;
|
||||||
|
sigmaW = sx3W;
|
||||||
|
sigmaL = sx3L;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawTrack(TVector3 pos, TVector3 direction, bool drawEstimatedTrack = false);
|
||||||
|
void DrawDeducedTrack(TVector3 sx3Pos, int anodeID, int cathodeID);
|
||||||
|
void DrawAnasen(int anodeID1 = -1,
|
||||||
|
int anodeID2 = -1,
|
||||||
|
int cathodeID1 = -1,
|
||||||
|
int cathodeID2 = -1,
|
||||||
|
int sx3ID = -1,
|
||||||
|
bool DrawQQQ = false );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PW * GetPW() {return pw;}
|
||||||
|
SX3 * GetSX3() {return sx3;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
PW * pw;
|
||||||
|
SX3 * sx3;
|
||||||
|
|
||||||
|
double sigmaA, sigmaC; // pw
|
||||||
|
double sigmaW, sigmaL; // sx3
|
||||||
|
|
||||||
|
const float qqqR1 = 50;
|
||||||
|
const float qqqR2 = 100;
|
||||||
|
const float qqqZPos = 23 + 75 + 30;
|
||||||
|
|
||||||
|
void CalGeometry();
|
||||||
|
|
||||||
|
TGeoManager *geom;
|
||||||
|
TGeoVolume *worldBox;
|
||||||
|
|
||||||
|
void Construct3DModel(int anodeID1 = -1,
|
||||||
|
int anodeID2 = -1,
|
||||||
|
int cathodeID1 = -1,
|
||||||
|
int cathodeID2 = -1,
|
||||||
|
int sx3ID = -1,
|
||||||
|
bool DrawQQQ = true);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//!==============================================
|
||||||
|
inline ANASEN::ANASEN(){
|
||||||
|
|
||||||
|
pw = new PW();
|
||||||
|
sx3 = new SX3();
|
||||||
|
|
||||||
|
CalGeometry();
|
||||||
|
|
||||||
|
geom = nullptr;
|
||||||
|
worldBox = nullptr;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
inline ANASEN::~ANASEN(){
|
||||||
|
|
||||||
|
delete geom;
|
||||||
|
|
||||||
|
delete pw;
|
||||||
|
delete sx3;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//!==============================================
|
||||||
|
inline void ANASEN::CalGeometry(){
|
||||||
|
|
||||||
|
sx3->ConstructGeo();
|
||||||
|
pw->ConstructGeo();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void ANASEN::Construct3DModel(int anodeID1, int anodeID2, int cathodeID1, int cathodeID2, int sx3ID, bool DrawQQQ ){
|
||||||
|
|
||||||
|
if( geom ) delete geom;
|
||||||
|
|
||||||
|
// Create ROOT manager and master volume
|
||||||
|
geom = new TGeoManager("Detector", "ANASEN");
|
||||||
|
|
||||||
|
//--- define some materials
|
||||||
|
TGeoMaterial *matVacuum = new TGeoMaterial("Vacuum", 0,0,0);
|
||||||
|
TGeoMaterial *matAl = new TGeoMaterial("Al", 26.98,13,2.7);
|
||||||
|
//--- define some media
|
||||||
|
TGeoMedium *Vacuum = new TGeoMedium("Vacuum",1, matVacuum);
|
||||||
|
TGeoMedium *Al = new TGeoMedium("Root Material",2, matAl);
|
||||||
|
|
||||||
|
//--- make the top container volume
|
||||||
|
Double_t worldx = 200.; //mm
|
||||||
|
Double_t worldy = 200.; //mm
|
||||||
|
Double_t worldz = 200.; //mm
|
||||||
|
worldBox = geom->MakeBox("ROOT", Vacuum, worldx, worldy, worldz);
|
||||||
|
geom->SetTopVolume(worldBox);
|
||||||
|
|
||||||
|
//--- making axis
|
||||||
|
TGeoVolume *axisX = geom->MakeTube("axisX", Al, 0, 0.1, 5.);
|
||||||
|
axisX->SetLineColor(1);
|
||||||
|
worldBox->AddNode(axisX, 1, new TGeoCombiTrans(5, 0, 0., new TGeoRotation("rotA", 90., 90., 0.)));
|
||||||
|
TGeoVolume *axisY = geom->MakeTube("axisY", Al, 0, 0.1, 5.);
|
||||||
|
axisY->SetLineColor(1);
|
||||||
|
worldBox->AddNode(axisY, 1, new TGeoCombiTrans(0, 5, 0., new TGeoRotation("rotB", 0., 90., 0.)));
|
||||||
|
TGeoVolume *axisZ = geom->MakeTube("axisZ", Al, 0, 0.1, 5.);
|
||||||
|
axisZ->SetLineColor(1);
|
||||||
|
worldBox->AddNode(axisZ, 1, new TGeoTranslation(0, 0, 5));
|
||||||
|
|
||||||
|
//.......... convert to wire center dimensions
|
||||||
|
TGeoVolume *pcA = geom->MakeTube("tub1", Al, 0, 0.01, pw->GetAnodeLength()/2);
|
||||||
|
pcA->SetLineColor(4);
|
||||||
|
|
||||||
|
int startID = 0;
|
||||||
|
int endID = pw->GetNumWire() - 1;
|
||||||
|
|
||||||
|
if( anodeID1 >= 0 && anodeID2 >= 0 ){
|
||||||
|
startID = anodeID1;
|
||||||
|
endID = anodeID2;
|
||||||
|
if( anodeID1 > anodeID2 ) {
|
||||||
|
endID = pw->GetNumWire() + anodeID2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for( int i = startID; i <= endID; i++){
|
||||||
|
TVector3 a = pw->GetAnodneMid(i);
|
||||||
|
double wireTheta = pw->GetAnodeTheta(i) * TMath::RadToDeg();
|
||||||
|
double wirePhi = pw->GetAnodePhi(i) * TMath::RadToDeg() + 90;
|
||||||
|
|
||||||
|
worldBox->AddNode(pcA, i+1, new TGeoCombiTrans( a.X(),
|
||||||
|
a.Y(),
|
||||||
|
a.Z(),
|
||||||
|
new TGeoRotation("rot1", wirePhi, wireTheta, 0.)));
|
||||||
|
}
|
||||||
|
|
||||||
|
TGeoVolume *pcC = geom->MakeTube("tub2", Al, 0, 0.01, pw->GetCathodeLength()/2);
|
||||||
|
pcC->SetLineColor(6);
|
||||||
|
|
||||||
|
startID = 0;
|
||||||
|
endID = pw->GetNumWire() - 1;
|
||||||
|
|
||||||
|
if( cathodeID1 >= 0 && cathodeID2 >= 0 ){
|
||||||
|
startID = cathodeID1;
|
||||||
|
endID = cathodeID2;
|
||||||
|
if( cathodeID1 > cathodeID2 ) {
|
||||||
|
endID = pw->GetNumWire() + cathodeID2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for( int i = startID; i <= endID; i++){
|
||||||
|
TVector3 a = pw->GetCathodneMid(i);
|
||||||
|
double wireTheta = pw->GetCathodeTheta(i) * TMath::RadToDeg();
|
||||||
|
double wirePhi = pw->GetCathodePhi(i) * TMath::RadToDeg() + 90;
|
||||||
|
|
||||||
|
worldBox->AddNode(pcC, i+1, new TGeoCombiTrans( a.X(),
|
||||||
|
a.Y(),
|
||||||
|
a.Z(),
|
||||||
|
new TGeoRotation("rot1", wirePhi , wireTheta, 0.)));
|
||||||
|
}
|
||||||
|
|
||||||
|
TGeoVolume * sx3Det = geom->MakeBox("box", Al, 0.1, sx3->GetWidth()/2, sx3->GetLength()/2);
|
||||||
|
sx3Det->SetLineColor(kGreen+3);
|
||||||
|
|
||||||
|
for( int i = 0; i < sx3->GetNumDet(); i++){
|
||||||
|
if( sx3ID != -1 && i != sx3ID ) continue;
|
||||||
|
TVector3 aUp = sx3->GetUpMid(i); // center of the SX3 upstream
|
||||||
|
TVector3 aDn = sx3->GetDnMid(i); // center of the SX3 Downstream
|
||||||
|
double phi = sx3->GetDetPhi(i) * TMath::RadToDeg() + 90;
|
||||||
|
|
||||||
|
worldBox->AddNode(sx3Det, 2*i+1., new TGeoCombiTrans( aUp.X(),
|
||||||
|
aUp.Y(),
|
||||||
|
aUp.Z(),
|
||||||
|
new TGeoRotation("rot1", phi, 0., 0.)));
|
||||||
|
worldBox->AddNode(sx3Det, 2*i+1., new TGeoCombiTrans( aDn.X(),
|
||||||
|
aDn.Y(),
|
||||||
|
aDn.Z(),
|
||||||
|
new TGeoRotation("rot1", phi, 0., 0.)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if( DrawQQQ ){
|
||||||
|
TGeoVolume *qqq = geom->MakeTubs("qqq", Al, qqqR1, qqqR2, 0.5, 5, 85);
|
||||||
|
qqq->SetLineColor(7);
|
||||||
|
for( int i = 0; i < 4; i++){
|
||||||
|
worldBox->AddNode(qqq, i+1, new TGeoCombiTrans( 0,
|
||||||
|
0,
|
||||||
|
qqqZPos,
|
||||||
|
new TGeoRotation("rot1", 360/4 * (i), 0., 0.)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//!============================================== Drawing functions
|
||||||
|
inline void ANASEN::DrawAnasen(int anodeID1, int anodeID2, int cathodeID1, int cathodeID2, int sx3ID, bool DrawQQQ ){
|
||||||
|
|
||||||
|
Construct3DModel(anodeID1, anodeID2, cathodeID1, cathodeID2, sx3ID, DrawQQQ);
|
||||||
|
|
||||||
|
geom->CloseGeometry();
|
||||||
|
geom->SetVisLevel(4);
|
||||||
|
worldBox->Draw("ogle");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void ANASEN::DrawTrack(TVector3 pos, TVector3 direction, bool drawEstimatedTrack){
|
||||||
|
|
||||||
|
pw->FindWireID(pos, direction);
|
||||||
|
sx3->FindSX3Pos(pos, direction);
|
||||||
|
|
||||||
|
std::pair<short, short> wireID = pw->GetNearestID();
|
||||||
|
|
||||||
|
Construct3DModel(wireID.first, wireID.first, wireID.second, wireID.second, -1, false);
|
||||||
|
|
||||||
|
double theta = direction.Theta() * TMath::RadToDeg();
|
||||||
|
double phi = direction.Phi() * TMath::RadToDeg();
|
||||||
|
// printf("Theta, Phi = %.2f %.2f \n", theta, phi);
|
||||||
|
// pos.Print();
|
||||||
|
TGeoVolume * Track = geom->MakeTube("track", 0, 0, 0.1, 150.);
|
||||||
|
Track->SetLineColor(kRed);
|
||||||
|
worldBox->AddNode(Track, 1, new TGeoCombiTrans( pos.X(), pos.Y(), pos.Z(), new TGeoRotation("rotA", phi + 90, theta, 0.)));
|
||||||
|
|
||||||
|
TGeoVolume * startPos = geom->MakeSphere("startPos", 0, 0, 3);
|
||||||
|
startPos->SetLineColor(kBlack);
|
||||||
|
worldBox->AddNode(startPos, 3, new TGeoCombiTrans( pos.X(), pos.Y(), pos.Z(), new TGeoRotation("rotA", 0, 0, 0.)));
|
||||||
|
|
||||||
|
if( sx3->GetID() >= 0 ){
|
||||||
|
//TVector3 hitPos = sx3->GetHitPos();
|
||||||
|
TVector3 hitPos = sx3->GetHitPosWithSigma(sigmaW, sigmaL);
|
||||||
|
|
||||||
|
TGeoVolume * hit = geom->MakeSphere("hitpos", 0, 0, 3);
|
||||||
|
hit->SetLineColor(kRed);
|
||||||
|
worldBox->AddNode(hit, 2, new TGeoCombiTrans( hitPos.X(), hitPos.Y(), hitPos.Z(), new TGeoRotation("rotA", 0, 0, 0.)));
|
||||||
|
|
||||||
|
if( drawEstimatedTrack ){
|
||||||
|
|
||||||
|
{//===== simple
|
||||||
|
pw->CalTrack(hitPos, wireID.first, wireID.second, true);
|
||||||
|
|
||||||
|
double thetaDeduce = pw->GetTrackTheta() * TMath::RadToDeg();
|
||||||
|
double phiDeduce = pw->GetTrackPhi() * TMath::RadToDeg();
|
||||||
|
|
||||||
|
TGeoVolume * trackDeduce = geom->MakeTube("trackDeduce", 0, 0, 0.1, 100.);
|
||||||
|
trackDeduce->SetLineColor(kOrange);
|
||||||
|
worldBox->AddNode(trackDeduce, 1, new TGeoCombiTrans( hitPos.X(), hitPos.Y(), hitPos.Z(), new TGeoRotation("rotA", phiDeduce + 90, thetaDeduce, 0.)));
|
||||||
|
}
|
||||||
|
|
||||||
|
{//===== complicated
|
||||||
|
PWHitInfo hitInfo = pw->GetHitInfo();
|
||||||
|
pw->CalTrack2(hitPos, hitInfo, sigmaA, sigmaC, true);
|
||||||
|
|
||||||
|
double thetaDeduce = pw->GetTrackTheta() * TMath::RadToDeg();
|
||||||
|
double phiDeduce = pw->GetTrackPhi() * TMath::RadToDeg();
|
||||||
|
|
||||||
|
TGeoVolume * trackDeduce2 = geom->MakeTube("trackDeduce2", 0, 0, 0.1, 100.);
|
||||||
|
trackDeduce2->SetLineColor(kGreen);
|
||||||
|
worldBox->AddNode(trackDeduce2, 1, new TGeoCombiTrans( hitPos.X(), hitPos.Y(), hitPos.Z(), new TGeoRotation("rotA", phiDeduce + 90, thetaDeduce, 0.)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
geom->CloseGeometry();
|
||||||
|
geom->SetVisLevel(4);
|
||||||
|
worldBox->Draw("ogle");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void ANASEN::DrawDeducedTrack(TVector3 sx3Pos, int anodeID, int cathodeID){
|
||||||
|
|
||||||
|
pw->CalTrack(sx3Pos, anodeID, cathodeID);
|
||||||
|
|
||||||
|
Construct3DModel(anodeID, anodeID, cathodeID, cathodeID, -1, false);
|
||||||
|
|
||||||
|
double theta = pw->GetTrackTheta() * TMath::RadToDeg();
|
||||||
|
double phi = pw->GetTrackPhi() * TMath::RadToDeg();
|
||||||
|
|
||||||
|
TGeoVolume * Track = geom->MakeTube("axisX", 0, 0, 0.1, 100.);
|
||||||
|
Track->SetLineColor(kRed);
|
||||||
|
worldBox->AddNode(Track, 1, new TGeoCombiTrans( sx3Pos.X(), sx3Pos.Y(), sx3Pos.Z(), new TGeoRotation("rotA", phi + 90, theta, 0.)));
|
||||||
|
|
||||||
|
TGeoVolume * hit = geom->MakeSphere("hitpos", 0, 0, 3);
|
||||||
|
hit->SetLineColor(kRed);
|
||||||
|
worldBox->AddNode(hit, 2, new TGeoCombiTrans( sx3Pos.X(), sx3Pos.Y(), sx3Pos.Z(), new TGeoRotation("rotA", 0, 0, 0.)));
|
||||||
|
|
||||||
|
geom->CloseGeometry();
|
||||||
|
geom->SetVisLevel(4);
|
||||||
|
worldBox->Draw("ogle");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
64
anasen_analysis_vignesh/Armory/ClassDet.h
Normal file
64
anasen_analysis_vignesh/Armory/ClassDet.h
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
#ifndef ClassDet_h
|
||||||
|
#define ClassDet_h
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
#define MAXMULTI 1000
|
||||||
|
|
||||||
|
class Det{
|
||||||
|
public:
|
||||||
|
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 short sn[MAXMULTI];
|
||||||
|
unsigned short digiCh[MAXMULTI];
|
||||||
|
|
||||||
|
unsigned short index[MAXMULTI]; // id * nCh + ch;
|
||||||
|
bool used[MAXMULTI];
|
||||||
|
|
||||||
|
void Clear(){
|
||||||
|
multi = 0;
|
||||||
|
for( int i = 0; i < MAXMULTI; i++){
|
||||||
|
id[i] = 0;
|
||||||
|
ch[i] = 0;
|
||||||
|
e[i] = 0;
|
||||||
|
t[i] = 0;
|
||||||
|
index[i] = 0;
|
||||||
|
sn[i] = 0;
|
||||||
|
digiCh[i] = 0;
|
||||||
|
used[i] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Print(){
|
||||||
|
printf("=============================== multi : %u\n", multi);
|
||||||
|
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){
|
||||||
|
nID = maxID;
|
||||||
|
nCh = maxCh;
|
||||||
|
}
|
||||||
|
|
||||||
|
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
anasen_analysis_vignesh/Armory/ClassPC1An.h
Normal file
246
anasen_analysis_vignesh/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
|
||||||
535
anasen_analysis_vignesh/Armory/ClassPW.h
Normal file
535
anasen_analysis_vignesh/Armory/ClassPW.h
Normal file
|
|
@ -0,0 +1,535 @@
|
||||||
|
#ifndef ClassPW_h
|
||||||
|
#define ClassPW_h
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include <iostream>
|
||||||
|
#include <TMath.h>
|
||||||
|
#include <TVector3.h>
|
||||||
|
#include <TRandom.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;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Coord
|
||||||
|
{
|
||||||
|
float x, y, z;
|
||||||
|
Coord() : x(0), y(0), z(0) {}
|
||||||
|
Coord(const TVector3 &vec)
|
||||||
|
{
|
||||||
|
x = vec.X(); // TVector3's X() returns the x-coordinate
|
||||||
|
y = vec.Y(); // TVector3's Y() returns the y-coordinate
|
||||||
|
z = vec.Z(); // TVector3's Z() returns the z-coordinate
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//! ########################################################
|
||||||
|
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; }
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
TVector3 GetTrackPos() const { return trackPos; }
|
||||||
|
TVector3 GetTrackVec() const { return trackVec; }
|
||||||
|
double GetTrackTheta() const { return trackVec.Theta(); }
|
||||||
|
double GetTrackPhi() const { return trackVec.Phi(); }
|
||||||
|
double GetZ0();
|
||||||
|
|
||||||
|
Coord Crossover[24][24][2];
|
||||||
|
|
||||||
|
|
||||||
|
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; }
|
||||||
|
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, TVector3 anodeInt, 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 zLen = 348.6; // mm
|
||||||
|
const float zLen = 174.3*2; // 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
|
||||||
|
|
||||||
|
double k = TMath::TwoPi()/24.; //48 solder thru holes, wires in every other one
|
||||||
|
double offset_a1 = -6*k-3*k;
|
||||||
|
double offset_c1 = -4*k -2*k - TMath::TwoPi()/48; //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;
|
||||||
|
|
||||||
|
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);
|
||||||
|
An.push_back(p1);
|
||||||
|
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 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 siPos, TVector3 anodeInt, 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
printf("X slope = %f and Y slope = %f \n", mx, my);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*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()
|
||||||
|
{
|
||||||
|
|
||||||
|
double x = trackPos.X();
|
||||||
|
double y = trackPos.Y();
|
||||||
|
double rho = TMath::Sqrt(x * x + y * y);
|
||||||
|
double theta = trackVec.Theta();
|
||||||
|
|
||||||
|
return trackVec.Z();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
491
anasen_analysis_vignesh/Armory/ClassPW.h.Questionable.Feb2026
Normal file
491
anasen_analysis_vignesh/Armory/ClassPW.h.Questionable.Feb2026
Normal file
|
|
@ -0,0 +1,491 @@
|
||||||
|
#ifndef ClassPW_h
|
||||||
|
#define ClassPW_h
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include <iostream>
|
||||||
|
#include <TMath.h>
|
||||||
|
#include <TVector3.h>
|
||||||
|
#include <TRandom.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;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Coord
|
||||||
|
{
|
||||||
|
float x, y, z;
|
||||||
|
Coord() : x(0), y(0), z(0) {}
|
||||||
|
Coord(const TVector3 &vec)
|
||||||
|
{
|
||||||
|
x = vec.X(); // TVector3's X() returns the x-coordinate
|
||||||
|
y = vec.Y(); // TVector3's Y() returns the y-coordinate
|
||||||
|
z = vec.Z(); // TVector3's Z() returns the z-coordinate
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//! ########################################################
|
||||||
|
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; }
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
TVector3 GetTrackPos() const { return trackPos; }
|
||||||
|
TVector3 GetTrackVec() const { return trackVec; }
|
||||||
|
double GetTrackTheta() const { return trackVec.Theta(); }
|
||||||
|
double GetTrackPhi() const { return trackVec.Phi(); }
|
||||||
|
double GetZ0();
|
||||||
|
|
||||||
|
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; }
|
||||||
|
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, TVector3 anodeInt, 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 zLen = 348.6; // 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
|
||||||
|
//updated Feb 2026, Sudarsan B
|
||||||
|
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 with the 3 wire offset accounted for (+1 from the calculated offset from the PC coincidence spectrum)
|
||||||
|
q1.first.SetXYZ(radiusC * TMath::Cos(TMath::TwoPi() / nWire * (i + wireShift + 1) + TMath::PiOver2()),
|
||||||
|
radiusC * TMath::Sin(TMath::TwoPi() / nWire * (i + wireShift + 1) + TMath::PiOver2()),
|
||||||
|
zLen / 2);
|
||||||
|
q1.second.SetXYZ(radiusC * TMath::Cos(TMath::TwoPi() / nWire * (i + 1) + TMath::PiOver2()),
|
||||||
|
radiusC * TMath::Sin(TMath::TwoPi() / nWire * (i + 1) + TMath::PiOver2()),
|
||||||
|
-zLen / 2);
|
||||||
|
Ca.push_back(q1);
|
||||||
|
}
|
||||||
|
// correcting for the fact that the order of the cathode wires is reversed
|
||||||
|
std::reverse(Ca.begin(), Ca.end());
|
||||||
|
// adjusting for the 3 wire offset, the rbegin and rend are used as the rotation of the wires is done in the opposite direction i.e. 1,2,3 -> 3,1,2
|
||||||
|
// NOT NECESSARY ANY MORE, HAS BEEN IMCORPORATED INTO THE WIREOFFSET IN THE BEGINNING
|
||||||
|
// std::rotate(Ca.rbegin(), Ca.rbegin() + 4, Ca.rend());
|
||||||
|
|
||||||
|
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 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 siPos, TVector3 anodeInt, 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
printf("X slope = %f and Y slope = %f \n", mx, my);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*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()
|
||||||
|
{
|
||||||
|
|
||||||
|
double x = trackPos.X();
|
||||||
|
double y = trackPos.Y();
|
||||||
|
double rho = TMath::Sqrt(x * x + y * y);
|
||||||
|
double theta = trackVec.Theta();
|
||||||
|
|
||||||
|
return trackVec.Z();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
489
anasen_analysis_vignesh/Armory/ClassPW.h.modified
Normal file
489
anasen_analysis_vignesh/Armory/ClassPW.h.modified
Normal file
|
|
@ -0,0 +1,489 @@
|
||||||
|
#ifndef ClassPW_h
|
||||||
|
#define ClassPW_h
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include <iostream>
|
||||||
|
#include <TMath.h>
|
||||||
|
#include <TVector3.h>
|
||||||
|
#include <TRandom.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;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Coord
|
||||||
|
{
|
||||||
|
float x, y, z;
|
||||||
|
Coord() : x(0), y(0), z(0) {}
|
||||||
|
Coord(const TVector3 &vec)
|
||||||
|
{
|
||||||
|
x = vec.X(); // TVector3's X() returns the x-coordinate
|
||||||
|
y = vec.Y(); // TVector3's Y() returns the y-coordinate
|
||||||
|
z = vec.Z(); // TVector3's Z() returns the z-coordinate
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//! ########################################################
|
||||||
|
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; }
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
TVector3 GetTrackPos() const { return trackPos; }
|
||||||
|
TVector3 GetTrackVec() const { return trackVec; }
|
||||||
|
double GetTrackTheta() const { return trackVec.Theta(); }
|
||||||
|
double GetTrackPhi() const { return trackVec.Phi(); }
|
||||||
|
double GetZ0();
|
||||||
|
|
||||||
|
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; }
|
||||||
|
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, TVector3 anodeInt, 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 zLen = 348.6; // 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
|
||||||
|
|
||||||
|
double k = TMath::TwoPi()/24.; //48 solder thru holes, wires in every other one
|
||||||
|
double offset_a1 = -6*k-3*k;
|
||||||
|
double offset_c1 = -3*k - TMath::TwoPi()/48; //correct for a half-turn
|
||||||
|
double offset_a2 = offset_a1+3*k;
|
||||||
|
double offset_c2 = offset_c1-3*k;
|
||||||
|
|
||||||
|
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
|
||||||
|
//'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 rotate left-hand, under the same system. k is positive
|
||||||
|
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);
|
||||||
|
An.push_back(p1);
|
||||||
|
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)); //chord length subtending an angle alpha is 2rsin(alpha/2)
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 siPos, TVector3 anodeInt, 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
printf("X slope = %f and Y slope = %f \n", mx, my);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*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()
|
||||||
|
{
|
||||||
|
|
||||||
|
double x = trackPos.X();
|
||||||
|
double y = trackPos.Y();
|
||||||
|
double rho = TMath::Sqrt(x * x + y * y);
|
||||||
|
double theta = trackVec.Theta();
|
||||||
|
|
||||||
|
return trackVec.Z();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
257
anasen_analysis_vignesh/Armory/ClassSX3.h
Normal file
257
anasen_analysis_vignesh/Armory/ClassSX3.h
Normal file
|
|
@ -0,0 +1,257 @@
|
||||||
|
#ifndef ClassSX3_h
|
||||||
|
#define ClassSX3_h
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include <TMath.h>
|
||||||
|
#include <TVector3.h>
|
||||||
|
#include <TRandom.h>
|
||||||
|
|
||||||
|
class SX3{
|
||||||
|
public:
|
||||||
|
SX3(){Clear();};
|
||||||
|
~SX3(){}
|
||||||
|
|
||||||
|
short GetID() const {return id;}
|
||||||
|
short GetChUp() const {return chUp;}
|
||||||
|
short GetChDn() const {return chDn;}
|
||||||
|
short GetChBk() const {return chBk;}
|
||||||
|
|
||||||
|
TVector3 GetHitPos() const {return hitPos;}
|
||||||
|
TVector3 GetHitPosWithSigma(double sigmaY_mm, double sigmaZ_mm);
|
||||||
|
|
||||||
|
double GetZFrac() const {return zFrac;} // range from -0.5 to 0.5
|
||||||
|
|
||||||
|
void Clear();
|
||||||
|
void ConstructGeo();
|
||||||
|
void FindSX3Pos(TVector3 pos, TVector3 direction, bool verbose = false);
|
||||||
|
void CalSX3Pos(unsigned short ID, unsigned short chUp, unsigned short chDown, unsigned short chBack, float eUp, float eDown);
|
||||||
|
|
||||||
|
double GetNumDet() const {return numDet;}
|
||||||
|
double GetWidth() const {return width;}
|
||||||
|
double GetLength() const {return length;}
|
||||||
|
TVector3 GetDnL(short id) const {return SDn[id].first; } // lower strip ID
|
||||||
|
TVector3 GetDnH(short id) const {return SDn[id].second; } // higher strip ID
|
||||||
|
TVector3 GetUpL(short id) const {return SUp[id].first; } // lower strip ID
|
||||||
|
TVector3 GetUpH(short id) const {return SUp[id].second; } // higher strip ID
|
||||||
|
|
||||||
|
TVector3 GetDnMid(short id) const { return (SDn[id].first + SDn[id].second)*0.5;}
|
||||||
|
TVector3 GetUpMid(short id) const { return (SUp[id].first + SUp[id].second)*0.5;}
|
||||||
|
|
||||||
|
double GetDetPhi(short id) const { return (SUp[id].second - SUp[id].first).Phi();}
|
||||||
|
|
||||||
|
void Print(){
|
||||||
|
if( id == -1 ){
|
||||||
|
printf("Did not hit any SX3.\n");
|
||||||
|
}else{
|
||||||
|
printf("ID: %d, U,D,B: %d %d %d| zFrac : %.2f\n", id, chUp, chDn, chBk, zFrac);
|
||||||
|
printf("Hit Pos: %.2f, %.2f, %.2f\n", hitPos.X(), hitPos.Y(), hitPos.Z());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// void CalZFrac(){
|
||||||
|
// zFrac = (eUp - eDn)/(eUp + eDn);
|
||||||
|
// }
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
const int numDet = 12;
|
||||||
|
const float radius = 88;
|
||||||
|
const float width = 40;
|
||||||
|
const float length = 75;
|
||||||
|
const float gap = 46;
|
||||||
|
|
||||||
|
short id; // -1 when no hit
|
||||||
|
short chUp;
|
||||||
|
short chDn;
|
||||||
|
short chBk;
|
||||||
|
|
||||||
|
double zFrac; // from +1 (downstream) to -1 (upstream)
|
||||||
|
|
||||||
|
double eUp;
|
||||||
|
double eDn;
|
||||||
|
double eBk;
|
||||||
|
|
||||||
|
TVector3 hitPos;
|
||||||
|
|
||||||
|
std::vector<std::pair<TVector3,TVector3>> SDn; // coners of the SX3 0-11, z = mid point
|
||||||
|
std::vector<std::pair<TVector3,TVector3>> SUp; // coners of the SX3 12-23, z = mid point
|
||||||
|
std::vector<TVector3> SNorml; // normal of the SX3 (outward)
|
||||||
|
|
||||||
|
|
||||||
|
std::pair<double, double> Intersect(TVector3 p1, TVector3 p2, TVector3 q1, TVector3 q2, bool verbose){
|
||||||
|
|
||||||
|
//see https://nukephysik101.wordpress.com/2023/12/30/intersect-between-2-line-segments/
|
||||||
|
//zero all z-component
|
||||||
|
TVector3 a0 = p1; a0.SetZ(0);
|
||||||
|
TVector3 a1 = p2; a1.SetZ(0);
|
||||||
|
|
||||||
|
TVector3 b0 = q1; b0.SetZ(0);
|
||||||
|
TVector3 b1 = q2; b1.SetZ(0);
|
||||||
|
|
||||||
|
double A = ((b0-b1).Cross(a0-a1)).Mag();
|
||||||
|
|
||||||
|
double h = ((b0-a0).Cross(b1-a0)).Z()/ A;
|
||||||
|
double k = ((a1-b0).Cross(a0-b0)).Z()/ A;
|
||||||
|
|
||||||
|
if( verbose ) printf(" ----h, k : %f, %f\n", h, k);
|
||||||
|
|
||||||
|
return std::pair<double,double>(h,k);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
inline void SX3::Clear(){
|
||||||
|
id = -1;
|
||||||
|
chUp = -1;
|
||||||
|
chDn = -1;
|
||||||
|
chBk = -1;
|
||||||
|
zFrac = TMath::QuietNaN();
|
||||||
|
|
||||||
|
eUp = TMath::QuietNaN();
|
||||||
|
eDn = TMath::QuietNaN();
|
||||||
|
eBk = TMath::QuietNaN();
|
||||||
|
|
||||||
|
SDn.clear();
|
||||||
|
SUp.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void SX3::ConstructGeo(){
|
||||||
|
TVector3 sa, sb, sc, sn;
|
||||||
|
|
||||||
|
for(int i = 0; i < numDet; i++){
|
||||||
|
sa.SetXYZ( radius, -width/2, gap/2 + length/2 );
|
||||||
|
sb.SetXYZ( radius, width/2, gap/2 + length/2 );
|
||||||
|
|
||||||
|
double rot = TMath::TwoPi() / numDet * (i - 0.5) - TMath::PiOver2();
|
||||||
|
|
||||||
|
sa.RotateZ( rot );
|
||||||
|
sb.RotateZ( rot );
|
||||||
|
SDn.push_back(std::pair<TVector3,TVector3>(sa,sb));
|
||||||
|
|
||||||
|
sc.SetXYZ( radius, -width/2, gap/2 );
|
||||||
|
sc.RotateZ( rot );
|
||||||
|
|
||||||
|
sn = ((sc-sa).Cross(sb-sa)).Unit();
|
||||||
|
SNorml.push_back(sn);
|
||||||
|
|
||||||
|
sa.SetXYZ( radius, -width/2, -gap/2 - length/2 );
|
||||||
|
sb.SetXYZ( radius, width/2, -gap/2 - length/2 );
|
||||||
|
|
||||||
|
sa.RotateZ( rot );
|
||||||
|
sb.RotateZ( rot );
|
||||||
|
SUp.push_back(std::pair<TVector3,TVector3>(sa,sb));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void SX3::FindSX3Pos(TVector3 pos, TVector3 direction, bool verbose){
|
||||||
|
|
||||||
|
id = -1;
|
||||||
|
for( int i = 0 ; i < numDet; i++){
|
||||||
|
|
||||||
|
if(verbose) printf(" %d ", i);
|
||||||
|
std::pair<double, double> frac = Intersect( pos, pos + direction, SDn[i].first, SDn[i].second, verbose);
|
||||||
|
|
||||||
|
|
||||||
|
if( frac.second < 0 || frac.second > 1 ) continue;
|
||||||
|
hitPos = pos + frac.first * direction;
|
||||||
|
|
||||||
|
double dis = hitPos.Dot(SNorml[i]);
|
||||||
|
|
||||||
|
if(verbose) {
|
||||||
|
printf("reduced distance : %f\n", dis);
|
||||||
|
printf(" %d*", (i+1)%numDet);
|
||||||
|
Intersect( pos, pos + direction, SDn[(i+1)%numDet].first, SDn[(i+1)%numDet].second, verbose);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( TMath::Abs(dis - radius) > 0.1 ) continue;
|
||||||
|
|
||||||
|
chDn = 2 * TMath::Floor(frac.second * 4);
|
||||||
|
chUp = chDn + 1;
|
||||||
|
|
||||||
|
double zPos = hitPos.Z();
|
||||||
|
if( (gap/2 < zPos && zPos < gap/2 + length ) || (-gap/2 - length < zPos && zPos < -gap/2 ) ){
|
||||||
|
|
||||||
|
id = zPos > 0 ? i : i + 12;
|
||||||
|
|
||||||
|
zFrac = zPos > 0 ? (zPos - gap/2. - length/2.)/length : (zPos - ( - gap/2. - length/2.) )/length ;
|
||||||
|
|
||||||
|
chBk = TMath::Floor( (zFrac + 0.5) * 4 ) + 8;
|
||||||
|
|
||||||
|
if( verbose) Print();
|
||||||
|
return ;
|
||||||
|
|
||||||
|
}else{
|
||||||
|
if( verbose ) printf(" zPos out of sensitive region\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( verbose) Print();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline TVector3 SX3::GetHitPosWithSigma(double sigmaY_mm, double sigmaZ_mm){
|
||||||
|
|
||||||
|
double phi = SNorml[id%numDet].Phi();
|
||||||
|
|
||||||
|
TVector3 haha = hitPos;
|
||||||
|
haha.RotateZ(-phi);
|
||||||
|
|
||||||
|
double y = haha.Y() + gRandom->Gaus(0, sigmaY_mm);
|
||||||
|
if( sigmaY_mm < 0 ){
|
||||||
|
double deltaW = width/4;
|
||||||
|
y = TMath::Floor((haha.Y()-deltaW)/deltaW)*deltaW + deltaW*1.5; // when ever land on each strip, set the position to be center of the strip.
|
||||||
|
if( y >= 25 ) y = 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
double z = haha.Z() + gRandom->Gaus(0, sigmaZ_mm);
|
||||||
|
if( sigmaZ_mm < 0 ){
|
||||||
|
haha.Z();
|
||||||
|
double delta = length/4;
|
||||||
|
int sign = z > 0 ? 1 : -1;
|
||||||
|
z = TMath::Floor( (abs(z)-gap/2)/delta )*delta + 0.5 * delta + gap/2;
|
||||||
|
if( z >= 107.375 ) z = 88.625;
|
||||||
|
z = sign * z;
|
||||||
|
}
|
||||||
|
|
||||||
|
haha.SetY(y);
|
||||||
|
haha.SetZ(z);
|
||||||
|
haha.RotateZ(phi);
|
||||||
|
|
||||||
|
return haha;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void SX3::CalSX3Pos(unsigned short ID, unsigned short chUp, unsigned short chDown, unsigned short chBack, float eUp, float eDown){
|
||||||
|
|
||||||
|
hitPos.Clear();
|
||||||
|
|
||||||
|
|
||||||
|
if( (chUp - chDown) != 1 || (chDown % 2) != 0) return ;
|
||||||
|
|
||||||
|
int reducedID = ID % numDet;
|
||||||
|
|
||||||
|
TVector3 sa, sb;
|
||||||
|
|
||||||
|
if( ID < numDet ){ //down
|
||||||
|
sa = SDn[reducedID].second;
|
||||||
|
sb = SDn[reducedID].first;
|
||||||
|
}else{
|
||||||
|
sa = SUp[reducedID].second;
|
||||||
|
sb = SUp[reducedID].first;
|
||||||
|
}
|
||||||
|
|
||||||
|
hitPos.SetX( (sb.X() - sa.X()) * chUp/8 + sa.X());
|
||||||
|
hitPos.SetY( (sb.Y() - sa.Y()) * chUp/8 + sa.Y());
|
||||||
|
|
||||||
|
if( eUp == 0 || eDown == 0 ){
|
||||||
|
hitPos.SetZ( sa.Z() + (2*(chBk - 7)-1) * length / 8 );
|
||||||
|
}else{
|
||||||
|
double frac = (eUp - eDown)/(eUp + eDown); // from +1 (downstream) to -1 (upstream)
|
||||||
|
double zPos = sa.Z() + length * frac/2;
|
||||||
|
hitPos.SetZ( zPos );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
468
anasen_analysis_vignesh/Armory/ClassTransfer.h
Normal file
468
anasen_analysis_vignesh/Armory/ClassTransfer.h
Normal file
|
|
@ -0,0 +1,468 @@
|
||||||
|
#ifndef ClassTransfer_h
|
||||||
|
#define ClassTransfer_h
|
||||||
|
|
||||||
|
#include "TBenchmark.h"
|
||||||
|
#include "TLorentzVector.h"
|
||||||
|
#include "TVector3.h"
|
||||||
|
#include "TMath.h"
|
||||||
|
#include "TFile.h"
|
||||||
|
#include "TTree.h"
|
||||||
|
#include "TRandom.h"
|
||||||
|
#include "TMacro.h"
|
||||||
|
#include "TGraph.h"
|
||||||
|
#include <vector>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
#include "Isotope.h"
|
||||||
|
|
||||||
|
class ReactionConfig{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
ReactionConfig(){}
|
||||||
|
~ReactionConfig(){}
|
||||||
|
|
||||||
|
int beamA, beamZ;
|
||||||
|
int targetA, targetZ;
|
||||||
|
int recoilLightA, recoilLightZ;
|
||||||
|
int recoilHeavyA, recoilHeavyZ;
|
||||||
|
|
||||||
|
float beamEnergy; ///MeV/u
|
||||||
|
float beamEnergySigma; ///beam-energy_sigma_in_MeV/u
|
||||||
|
float beamAngle; ///beam-angle_in_mrad
|
||||||
|
float beamAngleSigma; ///beam-emittance_in_mrad
|
||||||
|
float beamX; ///x_offset_of_Beam_in_mm
|
||||||
|
float beamY; ///y_offset_of_Beam_in_mm
|
||||||
|
int numEvents; ///number_of_Event_being_generated
|
||||||
|
bool isTargetScattering; ///isTargetScattering
|
||||||
|
float targetDensity; ///target_density_in_g/cm3
|
||||||
|
float targetThickness; ///targetThickness_in_cm
|
||||||
|
std::string beamStoppingPowerFile; ///stopping_power_for_beam
|
||||||
|
std::string recoilLightStoppingPowerFile; ///stopping_power_for_light_recoil
|
||||||
|
std::string recoilHeavyStoppingPowerFile; ///stopping_power_for_heavy_recoil
|
||||||
|
bool isDecay; ///isDacay
|
||||||
|
int heavyDecayA; ///decayNucleus_A
|
||||||
|
int heavyDecayZ; ///decayNucleus_Z
|
||||||
|
bool isRedo; ///isReDo
|
||||||
|
std::vector<float> beamEx; ///excitation_energy_of_A[MeV]
|
||||||
|
|
||||||
|
|
||||||
|
void SetReaction(int beamA, int beamZ,
|
||||||
|
int targetA, int targetZ,
|
||||||
|
int recoilA, int recoilZ, float beamEnergy_AMeV){
|
||||||
|
this->beamA = beamA;
|
||||||
|
this->beamZ = beamZ;
|
||||||
|
this->targetA = targetA;
|
||||||
|
this->targetZ = targetZ;
|
||||||
|
this->recoilLightA = recoilA;
|
||||||
|
this->recoilLightZ = recoilZ;
|
||||||
|
|
||||||
|
recoilHeavyA = this->beamA + this->targetA - recoilLightA;
|
||||||
|
recoilHeavyZ = this->beamZ + this->targetZ - recoilLightZ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoadReactionConfig(TMacro * macro){
|
||||||
|
|
||||||
|
if( macro == NULL ) return ;
|
||||||
|
|
||||||
|
int numLine = macro->GetListOfLines()->GetSize();
|
||||||
|
|
||||||
|
for( int i = 0; i < numLine; i ++){
|
||||||
|
|
||||||
|
std::vector<std::string> str = SplitStr(macro->GetListOfLines()->At(i)->GetName(), " ");
|
||||||
|
|
||||||
|
///printf("%d | %s\n", i, str[0].c_str());
|
||||||
|
|
||||||
|
if( str[0].find_first_of("#") == 0 ) break;
|
||||||
|
|
||||||
|
if( i == 0 ) beamA = atoi(str[0].c_str());
|
||||||
|
if( i == 1 ) beamZ = atoi(str[0].c_str());
|
||||||
|
if( i == 2 ) targetA = atoi(str[0].c_str());
|
||||||
|
if( i == 3 ) targetZ = atoi(str[0].c_str());
|
||||||
|
if( i == 4 ) recoilLightA = atoi(str[0].c_str());
|
||||||
|
if( i == 5 ) recoilLightZ = atoi(str[0].c_str());
|
||||||
|
if( i == 6 ) beamEnergy = atof(str[0].c_str());
|
||||||
|
if( i == 7 ) beamEnergySigma = atof(str[0].c_str());
|
||||||
|
if( i == 8 ) beamAngle = atof(str[0].c_str());
|
||||||
|
if( i == 9 ) beamAngleSigma = atof(str[0].c_str());
|
||||||
|
if( i == 10 ) beamX = atof(str[0].c_str());
|
||||||
|
if( i == 11 ) beamY = atof(str[0].c_str());
|
||||||
|
if( i == 12 ) numEvents = atoi(str[0].c_str());
|
||||||
|
if( i == 13 ) {
|
||||||
|
if( str[0].compare("false") == 0 ) isTargetScattering = false;
|
||||||
|
if( str[0].compare("true") == 0 ) isTargetScattering = true;
|
||||||
|
}
|
||||||
|
if( i == 14 ) targetDensity = atof(str[0].c_str());
|
||||||
|
if( i == 15 ) targetThickness = atof(str[0].c_str());
|
||||||
|
if( i == 16 ) beamStoppingPowerFile = str[0];
|
||||||
|
if( i == 17 ) recoilLightStoppingPowerFile = str[0];
|
||||||
|
if( i == 18 ) recoilHeavyStoppingPowerFile = str[0];
|
||||||
|
if( i == 19 ) {
|
||||||
|
if( str[0].compare("false") == 0 ) isDecay = false;
|
||||||
|
if( str[0].compare("true") == 0 ) isDecay = true;
|
||||||
|
}
|
||||||
|
if( i == 20 ) heavyDecayA = atoi(str[0].c_str());
|
||||||
|
if( i == 21 ) heavyDecayZ = atoi(str[0].c_str());
|
||||||
|
if( i == 22 ) {
|
||||||
|
if( str[0].compare("false") == 0 ) isRedo = false;
|
||||||
|
if( str[0].compare("true" ) == 0 ) isRedo = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( i >= 23) {
|
||||||
|
beamEx.push_back( atof(str[0].c_str()) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
recoilHeavyA = beamA + targetA - recoilLightA;
|
||||||
|
recoilHeavyZ = beamZ + targetZ - recoilLightZ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PrintReactionConfig(){
|
||||||
|
|
||||||
|
printf("=====================================================\n");
|
||||||
|
printf(" beam : A = %3d, Z = %2d \n", beamA, beamZ);
|
||||||
|
printf(" target : A = %3d, Z = %2d \n", targetA, targetZ);
|
||||||
|
printf(" light : A = %3d, Z = %2d \n", recoilLightA, recoilLightZ);
|
||||||
|
|
||||||
|
printf(" beam Energy : %.2f +- %.2f MeV/u, dE/E = %5.2f %%\n", beamEnergy, beamEnergySigma, beamEnergySigma/beamEnergy);
|
||||||
|
printf(" Angle : %.2f +- %.2f mrad\n", beamAngle, beamAngleSigma);
|
||||||
|
printf(" offset : (x,y) = (%.2f, %.2f) mmm \n", beamX, beamY);
|
||||||
|
|
||||||
|
printf("##### number of Simulation Events : %d \n", numEvents);
|
||||||
|
|
||||||
|
printf(" is target scattering : %s \n", isTargetScattering ? "Yes" : "No");
|
||||||
|
|
||||||
|
if(isTargetScattering){
|
||||||
|
printf(" target density : %.f g/cm3\n", targetDensity);
|
||||||
|
printf(" thickness : %.f cm\n", targetThickness);
|
||||||
|
printf(" beam stopping file : %s \n", beamStoppingPowerFile.c_str());
|
||||||
|
printf(" recoil light stopping file : %s \n", recoilLightStoppingPowerFile.c_str());
|
||||||
|
printf(" recoil heavy stopping file : %s \n", recoilHeavyStoppingPowerFile.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
printf(" is simulate decay : %s \n", isDecay ? "Yes" : "No");
|
||||||
|
if( isDecay ){
|
||||||
|
printf(" heavy decay : A = %d, Z = %d \n", heavyDecayA, heavyDecayZ);
|
||||||
|
}
|
||||||
|
printf(" is Redo until hit array : %s \n", isRedo ? "Yes" : "No");
|
||||||
|
|
||||||
|
printf(" beam Ex : %.2f MeV \n", beamEx[0]);
|
||||||
|
for( int i = 1; i < (int) beamEx.size(); i++){
|
||||||
|
printf(" %.2f MeV \n", beamEx[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("=====================================================\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//=======================================================
|
||||||
|
//#######################################################
|
||||||
|
// Class for Transfer Reaction
|
||||||
|
// reaction notation A(a,b)B
|
||||||
|
// A = incident particle
|
||||||
|
// a = target
|
||||||
|
// b = light scattered particle
|
||||||
|
// B = heavy scattered particle
|
||||||
|
//=======================================================
|
||||||
|
class TransferReaction {
|
||||||
|
public:
|
||||||
|
TransferReaction();
|
||||||
|
~TransferReaction();
|
||||||
|
|
||||||
|
void SetA(int A, int Z, double Ex);
|
||||||
|
void Seta(int A, int Z);
|
||||||
|
void Setb(int A, int Z);
|
||||||
|
void SetB(int A, int Z);
|
||||||
|
void SetIncidentEnergyAngle(double KEA, double theta, double phi);
|
||||||
|
void SetExA(double Ex);
|
||||||
|
void SetExB(double Ex);
|
||||||
|
void SetReactionFromFile(string settingFile);
|
||||||
|
|
||||||
|
TString GetReactionName();
|
||||||
|
TString GetReactionName_Latex();
|
||||||
|
|
||||||
|
ReactionConfig GetRectionConfig() { return reaction;}
|
||||||
|
|
||||||
|
double GetMass_A(){return mA + ExA;}
|
||||||
|
double GetMass_a(){return ma;}
|
||||||
|
double GetMass_b(){return mb;}
|
||||||
|
double GetMass_B(){return mB + ExB;}
|
||||||
|
|
||||||
|
double GetCMTotalKE() {return Etot - mA - ma;}
|
||||||
|
double GetQValue() {return mA + ExA + ma - mb - mB - ExB;}
|
||||||
|
double GetMaxExB() {return Etot - mb - mB;}
|
||||||
|
|
||||||
|
TLorentzVector GetPA(){return PA;}
|
||||||
|
TLorentzVector GetPa(){return Pa;}
|
||||||
|
TLorentzVector GetPb(){return Pb;}
|
||||||
|
TLorentzVector GetPB(){return PB;}
|
||||||
|
|
||||||
|
void CalReactionConstant();
|
||||||
|
|
||||||
|
TLorentzVector * Event(double thetaCM, double phiCM);
|
||||||
|
|
||||||
|
double GetEx(){return Ex;}
|
||||||
|
double GetThetaCM(){return thetaCM;}
|
||||||
|
|
||||||
|
double GetMomentumbCM() {return p;}
|
||||||
|
double GetReactionBeta() {return beta;}
|
||||||
|
double GetReactionGamma() {return gamma;}
|
||||||
|
double GetCMTotalEnergy() {return Etot;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
ReactionConfig reaction;
|
||||||
|
|
||||||
|
string nameA, namea, nameb, nameB;
|
||||||
|
double thetaIN, phiIN;
|
||||||
|
double mA, ma, mb, mB;
|
||||||
|
|
||||||
|
double TA, T; // TA = KE of A pre u, T = total energy
|
||||||
|
double ExA, ExB;
|
||||||
|
double Ex, thetaCM; //calculated Ex using inverse mapping from e and z to thetaCM
|
||||||
|
|
||||||
|
bool isReady;
|
||||||
|
bool isBSet;
|
||||||
|
|
||||||
|
double k; // CM Boost momentum
|
||||||
|
double beta, gamma; //CM boost beta
|
||||||
|
double Etot;
|
||||||
|
double p; // CM frame momentum of b, B
|
||||||
|
|
||||||
|
TLorentzVector PA, Pa, Pb, PB;
|
||||||
|
|
||||||
|
TString format(TString name);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
TransferReaction::TransferReaction(){
|
||||||
|
|
||||||
|
thetaIN = 0.;
|
||||||
|
phiIN = 0.;
|
||||||
|
SetA(24, 12, 0);
|
||||||
|
Seta(4,2);
|
||||||
|
Setb(1,1);
|
||||||
|
SetB(27,13);
|
||||||
|
TA = 2.5;
|
||||||
|
T = TA * reaction.beamA;
|
||||||
|
|
||||||
|
ExA = 0;
|
||||||
|
ExB = 0;
|
||||||
|
|
||||||
|
Ex = TMath::QuietNaN();
|
||||||
|
thetaCM = TMath::QuietNaN();
|
||||||
|
|
||||||
|
CalReactionConstant();
|
||||||
|
|
||||||
|
TLorentzVector temp (0,0,0,0);
|
||||||
|
PA = temp;
|
||||||
|
Pa = temp;
|
||||||
|
Pb = temp;
|
||||||
|
PB = temp;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
TransferReaction::~TransferReaction(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransferReaction::SetA(int A, int Z, double Ex = 0){
|
||||||
|
Isotope temp (A, Z);
|
||||||
|
mA = temp.Mass;
|
||||||
|
reaction.beamA = A;
|
||||||
|
reaction.beamZ = Z;
|
||||||
|
ExA = Ex;
|
||||||
|
nameA = temp.Name;
|
||||||
|
isReady = false;
|
||||||
|
isBSet = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransferReaction::Seta(int A, int Z){
|
||||||
|
Isotope temp (A, Z);
|
||||||
|
ma = temp.Mass;
|
||||||
|
reaction.targetA = A;
|
||||||
|
reaction.targetZ = Z;
|
||||||
|
namea = temp.Name;
|
||||||
|
isReady = false;
|
||||||
|
isBSet = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransferReaction::Setb(int A, int Z){
|
||||||
|
Isotope temp (A, Z);
|
||||||
|
mb = temp.Mass;
|
||||||
|
reaction.recoilLightA = A;
|
||||||
|
reaction.recoilLightZ = Z;
|
||||||
|
nameb = temp.Name;
|
||||||
|
isReady = false;
|
||||||
|
isBSet = false;
|
||||||
|
}
|
||||||
|
void TransferReaction::SetB(int A, int Z){
|
||||||
|
Isotope temp (A, Z);
|
||||||
|
mB = temp.Mass;
|
||||||
|
reaction.recoilHeavyA = A;
|
||||||
|
reaction.recoilHeavyZ = Z;
|
||||||
|
nameB = temp.Name;
|
||||||
|
isReady = false;
|
||||||
|
isBSet = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransferReaction::SetIncidentEnergyAngle(double KEA, double theta, double phi){
|
||||||
|
this->TA = KEA;
|
||||||
|
this->T = TA * reaction.beamA;
|
||||||
|
this->thetaIN = theta;
|
||||||
|
this->phiIN = phi;
|
||||||
|
isReady = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransferReaction::SetExA(double Ex){
|
||||||
|
this->ExA = Ex;
|
||||||
|
isReady = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransferReaction::SetExB(double Ex){
|
||||||
|
this->ExB = Ex;
|
||||||
|
isReady = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransferReaction::SetReactionFromFile(string settingFile){
|
||||||
|
|
||||||
|
TMacro * haha = new TMacro();
|
||||||
|
if( haha->ReadFile(settingFile.c_str()) > 0 ) {
|
||||||
|
reaction.LoadReactionConfig(haha);
|
||||||
|
|
||||||
|
SetA(reaction.beamA, reaction.beamZ);
|
||||||
|
Seta(reaction.targetA, reaction.targetZ);
|
||||||
|
Setb(reaction.recoilLightA, reaction.recoilLightZ);
|
||||||
|
SetB(reaction.recoilHeavyA, reaction.recoilHeavyZ);
|
||||||
|
|
||||||
|
SetIncidentEnergyAngle(reaction.beamEnergy, 0, 0);
|
||||||
|
CalReactionConstant();
|
||||||
|
}else{
|
||||||
|
|
||||||
|
printf("cannot read file %s.\n", settingFile.c_str());
|
||||||
|
isReady = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
TString TransferReaction::GetReactionName(){
|
||||||
|
TString rName;
|
||||||
|
rName.Form("%s(%s,%s)%s", nameA.c_str(), namea.c_str(), nameb.c_str(), nameB.c_str());
|
||||||
|
return rName;
|
||||||
|
}
|
||||||
|
|
||||||
|
TString TransferReaction::format(TString name){
|
||||||
|
if( name.IsAlpha() ) return name;
|
||||||
|
int len = name.Length();
|
||||||
|
TString temp = name;
|
||||||
|
TString temp2 = name;
|
||||||
|
if( temp.Remove(0, len-2).IsAlpha()){
|
||||||
|
temp2.Remove(len-2);
|
||||||
|
}else{
|
||||||
|
temp = name;
|
||||||
|
temp.Remove(0, len-1);
|
||||||
|
temp2.Remove(len-1);
|
||||||
|
}
|
||||||
|
return "^{"+temp2+"}"+temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
TString TransferReaction::GetReactionName_Latex(){
|
||||||
|
TString rName;
|
||||||
|
rName.Form("%s(%s,%s)%s", format(nameA).Data(), format(namea).Data(), format(nameb).Data(), format(nameB).Data());
|
||||||
|
return rName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransferReaction::CalReactionConstant(){
|
||||||
|
if( !isBSet){
|
||||||
|
reaction.recoilHeavyA = reaction.beamA + reaction.targetA - reaction.recoilLightA;
|
||||||
|
reaction.recoilHeavyZ = reaction.beamZ + reaction.targetZ - reaction.recoilLightZ;
|
||||||
|
Isotope temp (reaction.recoilHeavyA, reaction.recoilHeavyZ);
|
||||||
|
mB = temp.Mass;
|
||||||
|
isBSet = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
k = TMath::Sqrt(TMath::Power(mA + ExA + T, 2) - (mA + ExA) * (mA + ExA));
|
||||||
|
beta = k / (mA + ExA + ma + T);
|
||||||
|
gamma = 1 / TMath::Sqrt(1- beta * beta);
|
||||||
|
Etot = TMath::Sqrt(TMath::Power(mA + ExA + ma + T,2) - k * k);
|
||||||
|
p = TMath::Sqrt( (Etot*Etot - TMath::Power(mb + mB + ExB,2)) * (Etot*Etot - TMath::Power(mb - mB - ExB,2)) ) / 2 / Etot;
|
||||||
|
|
||||||
|
PA.SetXYZM(0, 0, k, mA + ExA);
|
||||||
|
PA.RotateY(thetaIN);
|
||||||
|
PA.RotateZ(phiIN);
|
||||||
|
|
||||||
|
Pa.SetXYZM(0,0,0,ma);
|
||||||
|
|
||||||
|
isReady = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
TLorentzVector * TransferReaction::Event(double thetaCM, double phiCM)
|
||||||
|
{
|
||||||
|
if( isReady == false ){
|
||||||
|
CalReactionConstant();
|
||||||
|
}
|
||||||
|
|
||||||
|
//TLorentzVector Pa(0, 0, 0, ma);
|
||||||
|
|
||||||
|
//---- to CM frame
|
||||||
|
TLorentzVector Pc = PA + Pa;
|
||||||
|
TVector3 b = Pc.BoostVector();
|
||||||
|
|
||||||
|
TVector3 vb(0,0,0);
|
||||||
|
|
||||||
|
if( b.Mag() > 0 ){
|
||||||
|
TVector3 v0 (0,0,0);
|
||||||
|
TVector3 nb = v0 - b;
|
||||||
|
|
||||||
|
TLorentzVector PAc = PA;
|
||||||
|
PAc.Boost(nb);
|
||||||
|
TVector3 vA = PAc.Vect();
|
||||||
|
|
||||||
|
TLorentzVector Pac = Pa;
|
||||||
|
Pac.Boost(nb);
|
||||||
|
TVector3 va = Pac.Vect();
|
||||||
|
|
||||||
|
//--- construct vb
|
||||||
|
vb = va;
|
||||||
|
vb.SetMag(p);
|
||||||
|
|
||||||
|
TVector3 ub = vb.Orthogonal();
|
||||||
|
vb.Rotate(thetaCM, ub);
|
||||||
|
vb.Rotate(phiCM + TMath::PiOver2(), va); // somehow, the calculation turn the vector 90 degree.
|
||||||
|
//vb.Rotate(phiCM , va); // somehow, the calculation turn the vector 90 degree.
|
||||||
|
}
|
||||||
|
|
||||||
|
//--- from Pb
|
||||||
|
TLorentzVector Pbc;
|
||||||
|
Pbc.SetVectM(vb, mb);
|
||||||
|
|
||||||
|
//--- from PB
|
||||||
|
TLorentzVector PBc;
|
||||||
|
//PBc.SetVectM(vB, mB + ExB);
|
||||||
|
PBc.SetVectM(-vb, mB + ExB);
|
||||||
|
|
||||||
|
//---- to Lab Frame
|
||||||
|
TLorentzVector Pb = Pbc;
|
||||||
|
Pb.Boost(b);
|
||||||
|
TLorentzVector PB = PBc;
|
||||||
|
PB.Boost(b);
|
||||||
|
|
||||||
|
TLorentzVector * output = new TLorentzVector[4];
|
||||||
|
output[0] = PA;
|
||||||
|
output[1] = Pa;
|
||||||
|
output[2] = Pb;
|
||||||
|
output[3] = PB;
|
||||||
|
|
||||||
|
this->Pb = Pb;
|
||||||
|
this->PB = PB;
|
||||||
|
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
416
anasen_analysis_vignesh/Armory/HistPlotter.h
Normal file
416
anasen_analysis_vignesh/Armory/HistPlotter.h
Normal file
|
|
@ -0,0 +1,416 @@
|
||||||
|
#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
|
||||||
522
anasen_analysis_vignesh/Armory/Isotope.h
Normal file
522
anasen_analysis_vignesh/Armory/Isotope.h
Normal file
|
|
@ -0,0 +1,522 @@
|
||||||
|
/***********************************************************************
|
||||||
|
*
|
||||||
|
* This is Isotope.h, To extract the isotope mass from massXX.txt
|
||||||
|
*
|
||||||
|
*-------------------------------------------------------
|
||||||
|
* created by Ryan (Tsz Leung) Tang, Nov-18, 2018
|
||||||
|
* email: goluckyryan@gmail.com
|
||||||
|
* ********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef ISOTOPE_H
|
||||||
|
#define ISOTOPE_H
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "constant.h" // amu
|
||||||
|
#include <stdlib.h> //atoi
|
||||||
|
#include <algorithm>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
string massData="mass20.txt";
|
||||||
|
|
||||||
|
// about the mass**.txt
|
||||||
|
// Mass Excess = (ATOMIC MASS - A)*amu | e.g. n : (1.088664.91585E-6-1)*amu
|
||||||
|
// mass excess uncertaintly
|
||||||
|
// BEA = (Z*M(1H) + N*M(1n) - Me(A,Z))/A , Me is the mass with electrons
|
||||||
|
// BEA = (Z*mp + N*mn - M(A,Z))/A , M is the mass without electrons
|
||||||
|
|
||||||
|
class Isotope {
|
||||||
|
public:
|
||||||
|
int A, Z;
|
||||||
|
double Mass, MassError, BEA;
|
||||||
|
string Name, Symbol;
|
||||||
|
string dataSource;
|
||||||
|
|
||||||
|
Isotope(){ dataSource = massData; };
|
||||||
|
Isotope(int a, int z){ dataSource = massData; SetIso(a,z); };
|
||||||
|
Isotope(string name){ dataSource = massData; SetIsoByName(name); };
|
||||||
|
|
||||||
|
void SetIso(int a, int z);
|
||||||
|
void SetIsoByName(string name);
|
||||||
|
|
||||||
|
double CalSp(int Np, int Nn); // this for the Np-proton, Nn-neutron removal
|
||||||
|
double CalSp2(int a, int z); // this is for (a,z) nucleus removal
|
||||||
|
|
||||||
|
double CalBeta(double T){
|
||||||
|
// double Etot = Mass + T;
|
||||||
|
double gamma = 1 + T/Mass;
|
||||||
|
double beta = sqrt(1 - 1 / gamma / gamma ) ;
|
||||||
|
return beta;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Print();
|
||||||
|
void ListShell();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void FindMassByAZ(int a, int z); // give mass, massError, BEA, Name, Symbol;
|
||||||
|
void FindMassByName(string name); // give Z, mass, massError, BEA;
|
||||||
|
|
||||||
|
int TwoJ(int nShell);
|
||||||
|
string Orbital(int nShell);
|
||||||
|
int magic(int i){
|
||||||
|
switch (i){
|
||||||
|
case 0: return 2; break;
|
||||||
|
case 1: return 8; break;
|
||||||
|
case 2: return 20; break;
|
||||||
|
case 3: return 28; break;
|
||||||
|
case 4: return 40; break;
|
||||||
|
case 5: return 50; break;
|
||||||
|
case 6: return 82; break;
|
||||||
|
case 7: return 128; break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int magicShellID(int i){
|
||||||
|
switch (i){
|
||||||
|
case 0: return 0; break;
|
||||||
|
case 1: return 2; break;
|
||||||
|
case 2: return 5; break;
|
||||||
|
case 3: return 6; break;
|
||||||
|
case 4: return 9; break;
|
||||||
|
case 5: return 10; break;
|
||||||
|
case 6: return 15; break;
|
||||||
|
case 7: return 21; break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int fileStartLine;
|
||||||
|
int fileEndLine;
|
||||||
|
int lineMass050_099;
|
||||||
|
int lineMass100_149;
|
||||||
|
int lineMass150_199;
|
||||||
|
int lineMass200;
|
||||||
|
|
||||||
|
|
||||||
|
void setFileLines(){
|
||||||
|
fileStartLine = 37;
|
||||||
|
fileEndLine = 3594;
|
||||||
|
|
||||||
|
lineMass050_099 = 466;
|
||||||
|
lineMass100_149 = 1160;
|
||||||
|
lineMass150_199 = 1994;
|
||||||
|
lineMass200 = 2774;
|
||||||
|
}
|
||||||
|
|
||||||
|
char * heliosPath;
|
||||||
|
bool isFindOnce;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
inline void Isotope::SetIso(int a, int z){
|
||||||
|
this->A = a;
|
||||||
|
this->Z = z;
|
||||||
|
FindMassByAZ(a,z);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Isotope::SetIsoByName(string name){
|
||||||
|
FindMassByName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Isotope::FindMassByAZ(int A, int Z){
|
||||||
|
string line;
|
||||||
|
int lineNum=0;
|
||||||
|
int list_A, list_Z;
|
||||||
|
|
||||||
|
ifstream myfile;
|
||||||
|
int flag=0;
|
||||||
|
|
||||||
|
setFileLines();
|
||||||
|
|
||||||
|
int numLineStart = fileStartLine;
|
||||||
|
int numLineEnd = fileEndLine;
|
||||||
|
|
||||||
|
if ( A >= 50 && A < 100) numLineStart = lineMass050_099;
|
||||||
|
if ( A >=100 && A < 150) numLineStart = lineMass100_149;
|
||||||
|
if ( A >=150 && A < 200) numLineStart = lineMass150_199;
|
||||||
|
if ( A >=200 ) numLineStart = lineMass200;
|
||||||
|
|
||||||
|
myfile.open(dataSource.c_str());
|
||||||
|
|
||||||
|
if (myfile.is_open()) {
|
||||||
|
while (/*! myfile.eof() &&*/ flag == 0 && lineNum <numLineEnd){
|
||||||
|
lineNum ++ ;
|
||||||
|
//printf("%3d ",lineNum);
|
||||||
|
getline (myfile,line);
|
||||||
|
|
||||||
|
if (lineNum >= numLineStart ){
|
||||||
|
list_Z = atoi((line.substr(10,5)).c_str());
|
||||||
|
list_A = atoi((line.substr(15,5)).c_str());
|
||||||
|
|
||||||
|
if ( A == list_A && Z == list_Z) {
|
||||||
|
this->BEA = atof((line.substr(54,11)).c_str());
|
||||||
|
this->Mass = list_Z*mp + (list_A-list_Z)*mn - this->BEA/1000*list_A;
|
||||||
|
this->MassError = atof((line.substr(65,7)).c_str());
|
||||||
|
string str = line.substr(20,2);
|
||||||
|
str.erase(remove(str.begin(), str.end(), ' '), str.end());
|
||||||
|
this->Symbol = str;
|
||||||
|
|
||||||
|
ostringstream ss;
|
||||||
|
ss << A << this->Symbol;
|
||||||
|
this->Name = ss.str();
|
||||||
|
flag = 1;
|
||||||
|
}else if ( list_A > A) {
|
||||||
|
this->BEA = -404;
|
||||||
|
this->Mass = -404;
|
||||||
|
this->MassError = -404;
|
||||||
|
this->Symbol = "non";
|
||||||
|
this->Name = "non";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( this->Name == "1H" ) this->Name = "p";
|
||||||
|
if( this->Name == "2H" ) this->Name = "d";
|
||||||
|
if( this->Name == "3H" ) this->Name = "t";
|
||||||
|
if( this->Name == "4He" ) this->Name = "a";
|
||||||
|
|
||||||
|
myfile.close();
|
||||||
|
}else {
|
||||||
|
printf("Unable to open %s\n", dataSource.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Isotope::FindMassByName(string name){
|
||||||
|
|
||||||
|
// done seperate the Mass number and the name
|
||||||
|
if( name == "n" ) {
|
||||||
|
this->Name = "1n";
|
||||||
|
this->BEA = 0;
|
||||||
|
this->Mass = mn;
|
||||||
|
this->MassError = 0;
|
||||||
|
this->Name = "n";
|
||||||
|
this->A = 1;
|
||||||
|
this->Z = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if( name == "p" ) name = "1H";
|
||||||
|
if( name == "d" ) name = "2H";
|
||||||
|
if( name == "t" ) name = "3H";
|
||||||
|
if( name == "a" ) name = "4He";
|
||||||
|
|
||||||
|
string temp = name;
|
||||||
|
int lastDigit = 0;
|
||||||
|
|
||||||
|
for(int i=0; temp[i]; i++){
|
||||||
|
if(temp[i] == '0') lastDigit = i;
|
||||||
|
if(temp[i] == '1') lastDigit = i;
|
||||||
|
if(temp[i] == '2') lastDigit = i;
|
||||||
|
if(temp[i] == '3') lastDigit = i;
|
||||||
|
if(temp[i] == '4') lastDigit = i;
|
||||||
|
if(temp[i] == '5') lastDigit = i;
|
||||||
|
if(temp[i] == '6') lastDigit = i;
|
||||||
|
if(temp[i] == '7') lastDigit = i;
|
||||||
|
if(temp[i] == '8') lastDigit = i;
|
||||||
|
if(temp[i] == '9') lastDigit = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->Symbol = temp.erase(0, lastDigit +1);
|
||||||
|
//check is Symbol is 2 charaters, if not, add " " at the end
|
||||||
|
if( this->Symbol.length() == 1 ){
|
||||||
|
this->Symbol = this->Symbol + " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
temp = name;
|
||||||
|
int len = temp.length();
|
||||||
|
temp = temp.erase(lastDigit+1, len);
|
||||||
|
|
||||||
|
this->A = atoi(temp.c_str());
|
||||||
|
//printf(" Symbol = |%s| , Mass = %d\n", this->Symbol.c_str(), this->A);
|
||||||
|
|
||||||
|
// find the nucleus in the data
|
||||||
|
string line;
|
||||||
|
int lineNum=0;
|
||||||
|
int list_A;
|
||||||
|
string list_symbol;
|
||||||
|
|
||||||
|
ifstream myfile;
|
||||||
|
int flag=0;
|
||||||
|
|
||||||
|
setFileLines();
|
||||||
|
|
||||||
|
int numLineStart = fileStartLine;
|
||||||
|
int numLineEnd = fileEndLine;
|
||||||
|
|
||||||
|
if ( A >= 50 && A < 100) numLineStart = lineMass050_099;
|
||||||
|
if ( A >=100 && A < 150) numLineStart = lineMass100_149;
|
||||||
|
if ( A >=150 && A < 200) numLineStart = lineMass150_199;
|
||||||
|
if ( A >=200 ) numLineStart = lineMass200;
|
||||||
|
|
||||||
|
myfile.open(dataSource.c_str());
|
||||||
|
|
||||||
|
if (myfile.is_open()) {
|
||||||
|
while (/*! myfile.eof() &&*/ flag == 0 && lineNum <numLineEnd){
|
||||||
|
lineNum ++ ;
|
||||||
|
//printf("%3d ",lineNum);
|
||||||
|
getline (myfile,line);
|
||||||
|
|
||||||
|
if (lineNum >= numLineStart ){
|
||||||
|
list_symbol = line.substr(20,2);
|
||||||
|
list_A = atoi((line.substr(15,5)).c_str());
|
||||||
|
|
||||||
|
//printf(" A = %d, Sym = |%s| \n", list_A, list_symbol.c_str());
|
||||||
|
|
||||||
|
if ( this->A == list_A && this->Symbol == list_symbol) {
|
||||||
|
this->Z = atoi((line.substr(10,5)).c_str());
|
||||||
|
this->BEA = atof((line.substr(54,11)).c_str());
|
||||||
|
this->Mass = this->Z*mp + (list_A-this->Z)*mn - this->BEA/1000*list_A;
|
||||||
|
this->MassError = atof((line.substr(65,7)).c_str());
|
||||||
|
|
||||||
|
string str = line.substr(20,2);
|
||||||
|
str.erase(remove(str.begin(), str.end(), ' '), str.end());
|
||||||
|
this->Symbol = str;
|
||||||
|
|
||||||
|
ostringstream ss;
|
||||||
|
ss << this->A << this->Symbol;
|
||||||
|
this->Name = ss.str();
|
||||||
|
flag = 1;
|
||||||
|
}else if ( list_A > this->A) {
|
||||||
|
this->BEA = -404;
|
||||||
|
this->Mass = -404;
|
||||||
|
this->MassError = -404;
|
||||||
|
this->Symbol = "non";
|
||||||
|
this->Name = "non";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
myfile.close();
|
||||||
|
}else {
|
||||||
|
printf("Unable to open %s\n", dataSource.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline double Isotope::CalSp(int Np, int Nn){
|
||||||
|
Isotope nucleusD(A - Np - Nn, Z - Np);
|
||||||
|
|
||||||
|
if( nucleusD.Mass != -404){
|
||||||
|
return nucleusD.Mass + Nn*mn + Np*mp - this->Mass;
|
||||||
|
}else{
|
||||||
|
return -404;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline double Isotope::CalSp2(int a, int z){
|
||||||
|
Isotope nucleusD(A - a , Z - z);
|
||||||
|
Isotope nucleusS(a,z);
|
||||||
|
|
||||||
|
if( nucleusD.Mass != -404 && nucleusS.Mass != -404){
|
||||||
|
return nucleusD.Mass + nucleusS.Mass - this->Mass;
|
||||||
|
}else{
|
||||||
|
return -404;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int Isotope::TwoJ(int nShell){
|
||||||
|
|
||||||
|
switch(nShell){
|
||||||
|
case 0: return 1; break; // 0s1/2
|
||||||
|
case 1: return 3; break; // 0p3/2
|
||||||
|
case 2: return 1; break; // 0p1/2 -- 8
|
||||||
|
case 3: return 5; break; // 0d5/2
|
||||||
|
case 4: return 1; break; // 1s1/2
|
||||||
|
case 5: return 3; break; // 0d3/2 -- 20
|
||||||
|
case 6: return 7; break; // 0f7/2 -- 28
|
||||||
|
case 7: return 3; break; // 1p3/2
|
||||||
|
case 8: return 1; break; // 1p1/2
|
||||||
|
case 9: return 5; break; // 0f5/2 -- 40
|
||||||
|
case 10: return 9; break; // 0g9/2 -- 50
|
||||||
|
case 11: return 7; break; // 0g7/2
|
||||||
|
case 12: return 5; break; // 1d5/2
|
||||||
|
case 13: return 11; break; // 0h11/2
|
||||||
|
case 14: return 3; break; // 1d3/2
|
||||||
|
case 15: return 1; break; // 2s1/2 -- 82
|
||||||
|
case 16: return 9; break; // 0h9/2
|
||||||
|
case 17: return 7; break; // 1f7/2
|
||||||
|
case 18: return 13; break; // 0i13/2
|
||||||
|
case 19: return 3; break; // 2p3/2
|
||||||
|
case 20: return 5; break; // 1f5/2
|
||||||
|
case 21: return 1; break; // 1p1/2 -- 126
|
||||||
|
case 22: return 9; break; // 1g9/2
|
||||||
|
case 23: return 11; break; // 0i11/2
|
||||||
|
case 24: return 15; break; // 0j15/2
|
||||||
|
case 25: return 5; break; // 2d5/2
|
||||||
|
case 26: return 1; break; // 3s1/2
|
||||||
|
case 27: return 3; break; // 2d3/2
|
||||||
|
case 28: return 7; break; // 1g7/2
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline string Isotope::Orbital(int nShell){
|
||||||
|
|
||||||
|
switch(nShell){
|
||||||
|
case 0: return "0s1 "; break; //
|
||||||
|
case 1: return "0p3 "; break; //
|
||||||
|
case 2: return "0p1 "; break; //-- 8
|
||||||
|
case 3: return "0d5 "; break; //
|
||||||
|
case 4: return "1s1 "; break; //
|
||||||
|
case 5: return "0d3 "; break; //-- 20
|
||||||
|
case 6: return "0f7 "; break; //-- 28
|
||||||
|
case 7: return "1p3 "; break; //
|
||||||
|
case 8: return "1p1 "; break; //
|
||||||
|
case 9: return "0f5 "; break; //-- 40
|
||||||
|
case 10: return "0g9 "; break; //-- 50
|
||||||
|
case 11: return "0g7 "; break; //
|
||||||
|
case 12: return "1d5 "; break; //
|
||||||
|
case 13: return "0h11"; break; //
|
||||||
|
case 14: return "1d3 "; break; //
|
||||||
|
case 15: return "2s1 "; break; //-- 82
|
||||||
|
case 16: return "0h9 "; break; //
|
||||||
|
case 17: return "1f7 "; break; //
|
||||||
|
case 18: return "0i13"; break; //
|
||||||
|
case 19: return "2p3 "; break; //
|
||||||
|
case 20: return "1f5 "; break; //
|
||||||
|
case 21: return "1p1 "; break; //-- 126
|
||||||
|
case 22: return "1g9 "; break; //
|
||||||
|
case 23: return "0i11"; break; //
|
||||||
|
case 24: return "0j15"; break; //
|
||||||
|
case 25: return "2d5 "; break; //
|
||||||
|
case 26: return "3s1 "; break; //
|
||||||
|
case 27: return "2d3 "; break; //
|
||||||
|
case 28: return "1g7 "; break; //
|
||||||
|
}
|
||||||
|
|
||||||
|
return "nan";
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Isotope::ListShell(){
|
||||||
|
|
||||||
|
if( Mass < 0 ) return;
|
||||||
|
|
||||||
|
int n = A-Z;
|
||||||
|
int p = Z;
|
||||||
|
|
||||||
|
int k = std::min(n,p);
|
||||||
|
int nMagic = 0;
|
||||||
|
for( int i = 0; i < 7; i++){
|
||||||
|
if( magic(i) < k && k <= magic(i+1) ){
|
||||||
|
nMagic = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int coreShell = magicShellID(nMagic-1);
|
||||||
|
int coreZ1 = magic(nMagic-1);
|
||||||
|
int coreZ2 = magic(nMagic);
|
||||||
|
|
||||||
|
Isotope core1( 2*coreZ1, coreZ1);
|
||||||
|
Isotope core2( 2*coreZ2, coreZ2);
|
||||||
|
|
||||||
|
printf("------------------ Core:%3s, inner Core:%3s \n", (core2.Name).c_str(), (core1.Name).c_str());
|
||||||
|
printf(" || ");
|
||||||
|
int t = std::max(n,p);
|
||||||
|
int nShell = 0;
|
||||||
|
do{
|
||||||
|
int occ = TwoJ(nShell)+1;
|
||||||
|
if( nShell > coreShell) {
|
||||||
|
printf("%4s", Orbital(nShell).c_str());
|
||||||
|
if( nShell == 0 || nShell == 2 || nShell == 5 || nShell ==6 || nShell == 9 || nShell == 10 || nShell == 15 || nShell == 21){
|
||||||
|
printf("|");
|
||||||
|
}else{
|
||||||
|
printf(",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
t = t - occ;
|
||||||
|
nShell++;
|
||||||
|
}while( t > 0 && nShell < 29);
|
||||||
|
for( int i = 1; i <= 6; i++){
|
||||||
|
if (nShell < 28) {
|
||||||
|
printf("%4s,", Orbital(nShell).c_str());
|
||||||
|
}else if( nShell == 28 ) {
|
||||||
|
printf("%4s", Orbital(nShell).c_str());
|
||||||
|
}
|
||||||
|
nShell ++;
|
||||||
|
}
|
||||||
|
if (nShell < 29) printf("%4s", Orbital(nShell).c_str());
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
|
||||||
|
printf(" Z = %3d || ", p);
|
||||||
|
nShell = 0;
|
||||||
|
do{
|
||||||
|
int occ = TwoJ(nShell)+1;
|
||||||
|
if( nShell > coreShell ){
|
||||||
|
if( p > occ ) {
|
||||||
|
printf("%-4d", occ);
|
||||||
|
if( nShell == 0 || nShell == 2 || nShell == 5 || nShell ==6 || nShell == 9 || nShell == 10 || nShell == 15 || nShell == 21){
|
||||||
|
printf("|");
|
||||||
|
}else{
|
||||||
|
printf(",");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
printf("%-4d", p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p = p - occ;
|
||||||
|
nShell++;
|
||||||
|
}while( p > 0 && nShell < 29);
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
printf(" N = %3d || ", n);
|
||||||
|
nShell = 0;
|
||||||
|
do{
|
||||||
|
int occ = TwoJ(nShell)+1;
|
||||||
|
if ( nShell > coreShell ){
|
||||||
|
if( n > occ ) {
|
||||||
|
printf("%-4d", occ);
|
||||||
|
if( nShell == 0 || nShell == 2 || nShell == 5 || nShell ==6 || nShell == 9 || nShell == 10 || nShell == 15 || nShell == 21){
|
||||||
|
printf("|");
|
||||||
|
}else{
|
||||||
|
printf(",");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
printf("%-4d", n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
n = n - occ;
|
||||||
|
nShell++;
|
||||||
|
}while( n > 0 && nShell < 29);
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
printf("------------------ \n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void Isotope::Print(){
|
||||||
|
|
||||||
|
if (Mass > 0){
|
||||||
|
|
||||||
|
dataSource = massData;
|
||||||
|
|
||||||
|
printf(" using mass data : %s \n", dataSource.c_str());
|
||||||
|
printf(" mass of \e[47m\e[31m%s\e[m nucleus (Z,A)=(%3d,%3d) is \e[47m\e[31m%12.5f\e[m MeV, BE/A=%7.5f MeV\n", Name.c_str(), Z, A, Mass, BEA/1000.);
|
||||||
|
printf(" total BE : %12.5f MeV\n",BEA*A/1000.);
|
||||||
|
printf(" mass in amu : %12.5f u\n",Mass/amu);
|
||||||
|
printf(" mass excess : %12.5f MeV\n", Mass + Z*0.510998950 - A*amu);
|
||||||
|
printf("-------------- Seperation energy \n");
|
||||||
|
printf(" S1p: %8.4f| S1n: %8.4f| S(2H ): %8.4f| S1p1n : %8.4f\n", CalSp(1, 0), CalSp(0, 1), CalSp2(2, 1), CalSp(1, 1));
|
||||||
|
printf(" S2p: %8.4f| S2n: %8.4f| S(3He): %8.4f| S(3H) : %8.4f\n", CalSp(2, 0), CalSp(0, 2), CalSp2(3, 2), CalSp2(3, 1));
|
||||||
|
printf(" S3p: %8.4f| S3n: %8.4f| S(4He): %8.4f|\n", CalSp(3, 0), CalSp(0, 3), CalSp2(4, 2));
|
||||||
|
printf(" S4p: %8.4f| S4n: %8.4f| \n", CalSp(4, 0), CalSp(0, 4));
|
||||||
|
|
||||||
|
}else{
|
||||||
|
printf("Error %6.0f, no nucleus with (Z,A) = (%3d,%3d). \n", Mass, Z, A);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
674
anasen_analysis_vignesh/Armory/LICENSE
Normal file
674
anasen_analysis_vignesh/Armory/LICENSE
Normal file
|
|
@ -0,0 +1,674 @@
|
||||||
|
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>.
|
||||||
32
anasen_analysis_vignesh/Armory/Makefile
Normal file
32
anasen_analysis_vignesh/Armory/Makefile
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
########################################################################
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#########################################################################
|
||||||
|
|
||||||
|
CC = g++
|
||||||
|
|
||||||
|
#COPTS = -fPIC -DLINUX -O2 -std=c++17 -lpthread
|
||||||
|
COPTS = -fPIC -DLINUX -g -O0 -Wall -std=c++17 -lpthread
|
||||||
|
|
||||||
|
ROOTLIBS = `root-config --cflags --glibs`
|
||||||
|
|
||||||
|
ALL = Mapper EventBuilder#AnasenMS
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
|
||||||
|
all : $(ALL)
|
||||||
|
|
||||||
|
clean :
|
||||||
|
/bin/rm -f $(OBJS) $(ALL)
|
||||||
|
|
||||||
|
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)
|
||||||
182
anasen_analysis_vignesh/Armory/Mapper.cpp
Normal file
182
anasen_analysis_vignesh/Armory/Mapper.cpp
Normal file
|
|
@ -0,0 +1,182 @@
|
||||||
|
#include <string>
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
#include <TROOT.h>
|
||||||
|
#include <TTree.h>
|
||||||
|
#include <TFile.h>
|
||||||
|
#include <TMath.h>
|
||||||
|
#include <TBenchmark.h>
|
||||||
|
|
||||||
|
#include "../mapping.h"
|
||||||
|
#include "ClassDet.h"
|
||||||
|
|
||||||
|
//===============================
|
||||||
|
int main(int argc, char **argv){
|
||||||
|
|
||||||
|
printf("=========================================\n");
|
||||||
|
printf("=== Mapper ===\n");
|
||||||
|
printf("=========================================\n");
|
||||||
|
if (argc != 2) {
|
||||||
|
printf("Incorrect number of arguments:\n");
|
||||||
|
printf("%s [inFile]\n", argv[0]);
|
||||||
|
printf("\n\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
///============= read input
|
||||||
|
std::string inFileName = argv[1];
|
||||||
|
|
||||||
|
PrintMapping();
|
||||||
|
|
||||||
|
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];
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
///================== new tree
|
||||||
|
TString outFileName = inFileName;
|
||||||
|
TString runStr = outFileName;
|
||||||
|
int pos = outFileName.Last('/');
|
||||||
|
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
|
||||||
|
outFileName += "_mapped.root";
|
||||||
|
|
||||||
|
ULong_t eventID;
|
||||||
|
UInt_t run = runStr.Atoi();
|
||||||
|
|
||||||
|
Det sx3;
|
||||||
|
Det qqq;
|
||||||
|
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");
|
||||||
|
|
||||||
|
|
||||||
|
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("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("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");
|
||||||
|
|
||||||
|
///================== looping old tree and apply mapping
|
||||||
|
|
||||||
|
//clock
|
||||||
|
// TBenchmark clock;
|
||||||
|
// Bool_t shown;
|
||||||
|
|
||||||
|
for( unsigned long long ev = 0; ev < totnumEntry; ev++){
|
||||||
|
tree->GetEntry(ev);
|
||||||
|
|
||||||
|
eventID = evID;
|
||||||
|
sx3.multi = 0;
|
||||||
|
qqq.multi = 0;
|
||||||
|
pc.multi = 0;
|
||||||
|
|
||||||
|
qqq.Clear();
|
||||||
|
|
||||||
|
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
|
||||||
|
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
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( globalCh == -1) printf("ev %llu\n", ev);
|
||||||
|
|
||||||
|
unsigned short ID = mapping[globalCh];
|
||||||
|
|
||||||
|
//=================================== sx3
|
||||||
|
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 ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================== qqq
|
||||||
|
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 ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================== pc
|
||||||
|
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 ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
inFile->Close();
|
||||||
|
|
||||||
|
saveFile->cd(); //set focus on this file
|
||||||
|
newTree->Write();
|
||||||
|
UInt_t eventNumber = newTree->GetEntries();
|
||||||
|
saveFile->Close();
|
||||||
|
printf("-------------- done, %u\n", eventNumber);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
190
anasen_analysis_vignesh/Armory/SX3Geom.h
Normal file
190
anasen_analysis_vignesh/Armory/SX3Geom.h
Normal file
|
|
@ -0,0 +1,190 @@
|
||||||
|
#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
|
||||||
280
anasen_analysis_vignesh/Armory/anasenMS.cpp
Normal file
280
anasen_analysis_vignesh/Armory/anasenMS.cpp
Normal file
|
|
@ -0,0 +1,280 @@
|
||||||
|
#include "TRandom.h"
|
||||||
|
#include "TFile.h"
|
||||||
|
#include "TTree.h"
|
||||||
|
#include "TH1.h"
|
||||||
|
#include "TH2.h"
|
||||||
|
#include "TStyle.h"
|
||||||
|
#include "TCanvas.h"
|
||||||
|
#include "TBenchmark.h"
|
||||||
|
|
||||||
|
#include "ClassTransfer.h"
|
||||||
|
#include "ClassAnasen.h"
|
||||||
|
|
||||||
|
//======== Gerneate light particle based on reaction
|
||||||
|
// find out the CalTrack and the real track
|
||||||
|
// find out the Q-value uncertaintly
|
||||||
|
|
||||||
|
int main(int argc, char **argv){
|
||||||
|
|
||||||
|
printf("=========================================\n");
|
||||||
|
printf("=== ANASEN Monte Carlo ===\n");
|
||||||
|
printf("=========================================\n");
|
||||||
|
|
||||||
|
int numEvent = 1000000;
|
||||||
|
if( argc >= 2 ) numEvent = atoi(argv[1]);
|
||||||
|
|
||||||
|
//Reaction
|
||||||
|
TransferReaction transfer;
|
||||||
|
|
||||||
|
transfer.SetA(24,12, 0);
|
||||||
|
transfer.SetIncidentEnergyAngle(10, 0, 0);
|
||||||
|
transfer.Seta( 4, 2);
|
||||||
|
transfer.Setb( 1, 1);
|
||||||
|
|
||||||
|
//TODO add alpha source
|
||||||
|
|
||||||
|
std::vector<float> ExAList = {0};
|
||||||
|
std::vector<float> ExList = {0, 1, 2};
|
||||||
|
|
||||||
|
double vertexXRange[2] = { -5, 5}; // mm
|
||||||
|
double vertexYRange[2] = { -5, 5};
|
||||||
|
double vertexZRange[2] = { -100, 100};
|
||||||
|
|
||||||
|
double sigmaSX3_W = -1; // mm, < 0 use mid-point
|
||||||
|
double sigmaSX3_L = 3; // mm, < 0 use mid-point
|
||||||
|
double sigmaPW_A = 0; // from 0 to 1.
|
||||||
|
double sigmaPW_C = 0; // from 0 to 1.
|
||||||
|
|
||||||
|
//###################################################
|
||||||
|
|
||||||
|
printf("------------ Vertex :\n");
|
||||||
|
printf("X : %7.2f - %7.2f mm\n", vertexXRange[0], vertexXRange[1]);
|
||||||
|
printf("Y : %7.2f - %7.2f mm\n", vertexYRange[0], vertexYRange[1]);
|
||||||
|
printf("Z : %7.2f - %7.2f mm\n", vertexZRange[0], vertexZRange[1]);
|
||||||
|
printf("------------ Uncertainty :\n");
|
||||||
|
printf(" SX3 horizontal : %.1f\n", sigmaSX3_W);
|
||||||
|
printf(" SX3 vertical : %.1f\n", sigmaSX3_L);
|
||||||
|
printf(" Anode : %.1f mm\n", sigmaPW_A);
|
||||||
|
printf(" Cathode : %.1f mm\n", sigmaPW_C);
|
||||||
|
printf(" num_eve : %d \n",numEvent);
|
||||||
|
transfer.CalReactionConstant();
|
||||||
|
|
||||||
|
int nExA = ExAList.size();
|
||||||
|
int nEx = ExList.size();
|
||||||
|
|
||||||
|
ANASEN * anasen = new ANASEN();
|
||||||
|
SX3 * sx3 = anasen->GetSX3();
|
||||||
|
PW * pw = anasen->GetPW();
|
||||||
|
|
||||||
|
TString saveFileName = "SimAnasen1.root";
|
||||||
|
printf("\e[32m#################################### building Tree in %s\e[0m\n", saveFileName.Data());
|
||||||
|
TFile * saveFile = new TFile(saveFileName, "recreate");
|
||||||
|
TTree * tree = new TTree("tree", "tree");
|
||||||
|
|
||||||
|
double KEA;
|
||||||
|
tree->Branch("beamKEA", &KEA, "beamKEA/D");
|
||||||
|
|
||||||
|
double thetaCM, phiCM;
|
||||||
|
tree->Branch("thetaCM", &thetaCM, "thetaCM/D");
|
||||||
|
tree->Branch("phiCM", &phiCM, "phiCM/D");
|
||||||
|
|
||||||
|
double thetab, phib, Tb;
|
||||||
|
double thetaB, phiB, TB;
|
||||||
|
tree->Branch("thetab", &thetab, "thetab/D");
|
||||||
|
tree->Branch("phib", &phib, "phib/D");
|
||||||
|
tree->Branch("Tb", &Tb, "Tb/D");
|
||||||
|
tree->Branch("thetaB", &thetaB, "thetaB/D");
|
||||||
|
tree->Branch("phiB", &phiB, "phiB/D");
|
||||||
|
tree->Branch("TB", &TB, "TB/D");
|
||||||
|
|
||||||
|
int ExAID;
|
||||||
|
double ExA;
|
||||||
|
tree->Branch("ExAID", &ExAID, "ExAID/I");
|
||||||
|
tree->Branch("ExA", &ExA, "ExA/D");
|
||||||
|
|
||||||
|
int ExID;
|
||||||
|
double Ex;
|
||||||
|
tree->Branch("ExID", &ExID, "ExID/I");
|
||||||
|
tree->Branch("Ex", &Ex, "Ex/D");
|
||||||
|
|
||||||
|
double vertexX, vertexY, vertexZ;
|
||||||
|
tree->Branch("vX", &vertexX, "VertexX/D");
|
||||||
|
tree->Branch("vY", &vertexY, "VertexY/D");
|
||||||
|
tree->Branch("vZ", &vertexZ, "VertexZ/D");
|
||||||
|
|
||||||
|
double sx3X, sx3Y, sx3Z;
|
||||||
|
tree->Branch("sx3X", &sx3X, "sx3X/D");
|
||||||
|
tree->Branch("sx3Y", &sx3Y, "sx3Y/D");
|
||||||
|
tree->Branch("sx3Z", &sx3Z, "sx3Z/D");
|
||||||
|
|
||||||
|
int anodeID[2], cathodeID[2];
|
||||||
|
tree->Branch("aID", anodeID, "anodeID/I");
|
||||||
|
tree->Branch("cID", cathodeID, "cathodeID/I");
|
||||||
|
|
||||||
|
double anodeDist[2], cathodeDist[2];
|
||||||
|
tree->Branch("aDist", anodeDist, "anodeDist/D");
|
||||||
|
tree->Branch("cDist", cathodeDist, "cathodeDist/D");
|
||||||
|
|
||||||
|
int sx3ID, sx3Up, sx3Dn, sx3Bk;
|
||||||
|
double sx3ZFrac;
|
||||||
|
tree->Branch("sx3ID", &sx3ID, "sx3ID/I");
|
||||||
|
tree->Branch("sx3Up", &sx3Up, "sx3Up/I");
|
||||||
|
tree->Branch("sx3Dn", &sx3Dn, "sx3Dn/I");
|
||||||
|
tree->Branch("sx3Bk", &sx3Bk, "sx3Bk/I");
|
||||||
|
tree->Branch("sx3ZFrac", &sx3ZFrac, "sx3ZFrac/D");
|
||||||
|
|
||||||
|
double reTheta, rePhi;
|
||||||
|
tree->Branch("reTheta", &reTheta, "reconstucted_theta/D");
|
||||||
|
tree->Branch("rePhi", &rePhi, "reconstucted_phi/D");
|
||||||
|
|
||||||
|
double reTheta1, rePhi1;
|
||||||
|
tree->Branch("reTheta1", &reTheta1, "reconstucted_theta1/D");
|
||||||
|
tree->Branch("rePhi1", &rePhi1, "reconstucted_phi1/D");
|
||||||
|
|
||||||
|
double z0;
|
||||||
|
tree->Branch("z0", &z0, "reconstucted_Z/D");
|
||||||
|
|
||||||
|
|
||||||
|
//========timer
|
||||||
|
TBenchmark clock;
|
||||||
|
bool shown ;
|
||||||
|
clock.Reset();
|
||||||
|
clock.Start("timer");
|
||||||
|
shown = false;
|
||||||
|
|
||||||
|
//================================= Calculate event
|
||||||
|
for( int i = 0; i < numEvent ; i++){
|
||||||
|
|
||||||
|
ExAID = gRandom->Integer(nExA);
|
||||||
|
ExA = ExAList[ExAID];
|
||||||
|
transfer.SetExA(ExA);
|
||||||
|
|
||||||
|
ExID = gRandom->Integer(nEx);
|
||||||
|
Ex = ExList[ExID];
|
||||||
|
transfer.SetExB(Ex);
|
||||||
|
|
||||||
|
transfer.CalReactionConstant();
|
||||||
|
|
||||||
|
thetaCM = TMath::ACos(2 * gRandom->Rndm() - 1) ;
|
||||||
|
phiCM = (gRandom->Rndm() - 0.5) * TMath::TwoPi();
|
||||||
|
|
||||||
|
//==== Calculate reaction
|
||||||
|
TLorentzVector * output = transfer.Event(thetaCM, phiCM);
|
||||||
|
TLorentzVector Pb = output[2];
|
||||||
|
TLorentzVector PB = output[3];
|
||||||
|
|
||||||
|
thetab = Pb.Theta() * TMath::RadToDeg();
|
||||||
|
thetaB = PB.Theta() * TMath::RadToDeg();
|
||||||
|
|
||||||
|
Tb = Pb.E() - Pb.M();
|
||||||
|
TB = PB.E() - PB.M();
|
||||||
|
|
||||||
|
phib = Pb.Phi() * TMath::RadToDeg();
|
||||||
|
phiB = PB.Phi() * TMath::RadToDeg();
|
||||||
|
|
||||||
|
vertexX = (vertexXRange[1]- vertexXRange[0])*gRandom->Rndm() + vertexXRange[0];
|
||||||
|
vertexY = (vertexYRange[1]- vertexYRange[0])*gRandom->Rndm() + vertexYRange[0];
|
||||||
|
vertexZ = (vertexZRange[1]- vertexZRange[0])*gRandom->Rndm() + vertexZRange[0];
|
||||||
|
|
||||||
|
TVector3 vertex(vertexX, vertexY, vertexZ);
|
||||||
|
|
||||||
|
TVector3 dir(1, 0, 0);
|
||||||
|
dir.SetTheta(thetab * TMath::DegToRad());
|
||||||
|
dir.SetPhi(phib * TMath::DegToRad());
|
||||||
|
|
||||||
|
|
||||||
|
pw->FindWireID(vertex, dir, false);
|
||||||
|
sx3->FindSX3Pos(vertex, dir, false);
|
||||||
|
|
||||||
|
PWHitInfo hitInfo = pw->GetHitInfo();
|
||||||
|
|
||||||
|
anodeID[0] = hitInfo.nearestWire.first;
|
||||||
|
cathodeID[0] = hitInfo.nearestWire.second;
|
||||||
|
anodeID[1] = hitInfo.nextNearestWire.first;
|
||||||
|
cathodeID[1] = hitInfo.nextNearestWire.second;
|
||||||
|
|
||||||
|
anodeDist[0] = hitInfo.nearestDist.first;
|
||||||
|
cathodeDist[0] = hitInfo.nearestDist.second;
|
||||||
|
anodeDist[1] = hitInfo.nextNearestDist.first;
|
||||||
|
cathodeDist[1] = hitInfo.nextNearestDist.second;
|
||||||
|
|
||||||
|
sx3ID = sx3->GetID();
|
||||||
|
if( sx3ID >= 0 ){
|
||||||
|
sx3Up = sx3->GetChUp();
|
||||||
|
sx3Dn = sx3->GetChDn();
|
||||||
|
sx3Bk = sx3->GetChBk();
|
||||||
|
sx3ZFrac = sx3->GetZFrac();
|
||||||
|
|
||||||
|
//Introduce uncertaity
|
||||||
|
// TVector3 hitPos = sx3->GetHitPos();
|
||||||
|
TVector3 hitPos = sx3->GetHitPosWithSigma(sigmaSX3_W, sigmaSX3_L);
|
||||||
|
|
||||||
|
sx3X = hitPos.X();
|
||||||
|
sx3Y = hitPos.Y();
|
||||||
|
sx3Z = hitPos.Z();
|
||||||
|
|
||||||
|
pw->CalTrack(hitPos, anodeID[0], cathodeID[0], false);
|
||||||
|
reTheta = pw->GetTrackTheta() * TMath::RadToDeg();
|
||||||
|
rePhi = pw->GetTrackPhi() * TMath::RadToDeg();
|
||||||
|
|
||||||
|
pw->CalTrack2(hitPos, hitInfo, sigmaPW_A, sigmaPW_C, false);
|
||||||
|
reTheta1 = pw->GetTrackTheta() * TMath::RadToDeg();
|
||||||
|
rePhi1 = pw->GetTrackPhi() * TMath::RadToDeg();
|
||||||
|
|
||||||
|
z0 = pw->GetZ0();
|
||||||
|
|
||||||
|
}else{
|
||||||
|
sx3Up = -1;
|
||||||
|
sx3Dn = -1;
|
||||||
|
sx3Bk = -1;
|
||||||
|
sx3ZFrac = TMath::QuietNaN();
|
||||||
|
|
||||||
|
sx3X = TMath::QuietNaN();
|
||||||
|
sx3Y = TMath::QuietNaN();
|
||||||
|
sx3Z = TMath::QuietNaN();
|
||||||
|
|
||||||
|
// for( int i = 0; i < 12; i++){
|
||||||
|
// sx3Index[i] = -1;
|
||||||
|
// }
|
||||||
|
|
||||||
|
reTheta = TMath::QuietNaN();
|
||||||
|
rePhi = TMath::QuietNaN();
|
||||||
|
|
||||||
|
reTheta1 = TMath::QuietNaN();
|
||||||
|
rePhi1 = TMath::QuietNaN();
|
||||||
|
|
||||||
|
z0 = TMath::QuietNaN();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
tree->Fill();
|
||||||
|
|
||||||
|
//#################################################################### Timer
|
||||||
|
clock.Stop("timer");
|
||||||
|
Double_t time = clock.GetRealTime("timer");
|
||||||
|
clock.Start("timer");
|
||||||
|
|
||||||
|
if ( !shown ) {
|
||||||
|
if (fmod(time, 10) < 1 ){
|
||||||
|
printf( "%10d[%2d%%]| %8.2f sec | expect: %5.1f min \n", i, TMath::Nint((i+1)*100./numEvent), time , numEvent*time/(i+1)/60);
|
||||||
|
shown = 1;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if (fmod(time, 10) > 9 ){
|
||||||
|
shown = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
tree->Write();
|
||||||
|
int count = tree->GetEntries();
|
||||||
|
saveFile->Close();
|
||||||
|
|
||||||
|
printf("=============== done. saved as %s. count(hit==1) : %d\n", saveFileName.Data(), count);
|
||||||
|
|
||||||
|
delete anasen;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
105
anasen_analysis_vignesh/Armory/constant.h
Normal file
105
anasen_analysis_vignesh/Armory/constant.h
Normal file
|
|
@ -0,0 +1,105 @@
|
||||||
|
/***********************************************************************
|
||||||
|
*
|
||||||
|
* This is constant.h, to provide various physical constants.
|
||||||
|
*
|
||||||
|
*-------------------------------------------------------
|
||||||
|
* created by Ryan (Tsz Leung) Tang, Nov-18, 2018
|
||||||
|
* email: goluckyryan@gmail.com
|
||||||
|
* ********************************************************************/
|
||||||
|
|
||||||
|
#ifndef constant
|
||||||
|
#define constant
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
const double pi = acos(-1.0);
|
||||||
|
const double E = 2.718281828459 ;
|
||||||
|
const double hbar_SI = 1.054571628e-34; //Js
|
||||||
|
const double kB = 1.3806504e-23; //JK^-1
|
||||||
|
const double e = 1.602176487e-19; //C
|
||||||
|
const double c_SI = 299792458; //ms^-1
|
||||||
|
const double me_SI = 9.10938215e-31 ; //kg
|
||||||
|
const double mp_SI = 1.672621637e-27 ; //kg
|
||||||
|
const double mn_SI = 1.67492729e-27 ; //kg
|
||||||
|
const double NA = 6.022141e+23 ; //mol^-1
|
||||||
|
|
||||||
|
const double deg2rad = pi/180 ;
|
||||||
|
const double rad2deg = 180/pi ;
|
||||||
|
|
||||||
|
//======================================================================
|
||||||
|
const double amu = 931.49432; // MeV/c^2
|
||||||
|
const double hbarc = 197.326979; // MeV fm;
|
||||||
|
const double c = 299.792458; // mm/ns;
|
||||||
|
const double ee = 1.439964454; // MeV.fm
|
||||||
|
|
||||||
|
//======================================================================
|
||||||
|
double kg2MeV(double m){
|
||||||
|
return m*c_SI*c_SI/e/1e6;
|
||||||
|
}
|
||||||
|
|
||||||
|
double T2Brho(double mass, int Z, int A, double T){
|
||||||
|
//mass in MeV
|
||||||
|
// Z in e
|
||||||
|
// T in MeV/A
|
||||||
|
double gamma = (T*A + mass)/mass;
|
||||||
|
double beta = sqrt(1-1/gamma/gamma);
|
||||||
|
return mass*beta*gamma/Z/c;
|
||||||
|
}
|
||||||
|
|
||||||
|
double Brho2T(double mass, int Z, int A, double Brho){
|
||||||
|
//mass in MeV
|
||||||
|
// Z in e
|
||||||
|
return (sqrt(pow(Brho*Z*c,2)+mass*mass)-mass)/A;
|
||||||
|
}
|
||||||
|
|
||||||
|
double T2beta(double mass, int A, double T){
|
||||||
|
double gamma = 1.0 + T*A/mass;
|
||||||
|
return sqrt(1-1/gamma/gamma);
|
||||||
|
}
|
||||||
|
|
||||||
|
double ev2nm(double eV){
|
||||||
|
// photon energy to nm
|
||||||
|
return hbarc/2/pi/eV;
|
||||||
|
}
|
||||||
|
|
||||||
|
//======================================================================
|
||||||
|
const double mp = kg2MeV(mp_SI);
|
||||||
|
const double mn = kg2MeV(mn_SI);
|
||||||
|
const double hbar = 197.326979;
|
||||||
|
|
||||||
|
|
||||||
|
//======================================================================
|
||||||
|
inline std::vector<std::string> SplitStr(std::string tempLine, std::string splitter, int shift = 0){
|
||||||
|
|
||||||
|
std::vector<std::string> output;
|
||||||
|
|
||||||
|
size_t pos;
|
||||||
|
do{
|
||||||
|
pos = tempLine.find(splitter); /// fine splitter
|
||||||
|
if( pos == 0 ){ ///check if it is splitter again
|
||||||
|
tempLine = tempLine.substr(pos+1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string secStr;
|
||||||
|
if( pos == std::string::npos ){
|
||||||
|
secStr = tempLine;
|
||||||
|
}else{
|
||||||
|
secStr = tempLine.substr(0, pos+shift);
|
||||||
|
tempLine = tempLine.substr(pos+shift);
|
||||||
|
}
|
||||||
|
|
||||||
|
///check if secStr is begin with space
|
||||||
|
while( secStr.substr(0, 1) == " ") secStr = secStr.substr(1);
|
||||||
|
|
||||||
|
///check if secStr is end with space
|
||||||
|
while( secStr.back() == ' ') secStr = secStr.substr(0, secStr.size()-1);
|
||||||
|
|
||||||
|
output.push_back(secStr);
|
||||||
|
///printf(" |%s---\n", secStr.c_str());
|
||||||
|
|
||||||
|
}while(pos != std::string::npos );
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
270
anasen_analysis_vignesh/Calibration.C
Normal file
270
anasen_analysis_vignesh/Calibration.C
Normal file
|
|
@ -0,0 +1,270 @@
|
||||||
|
|
||||||
|
#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
anasen_analysis_vignesh/Calibration.h
Normal file
114
anasen_analysis_vignesh/Calibration.h
Normal file
|
|
@ -0,0 +1,114 @@
|
||||||
|
#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
|
||||||
639
anasen_analysis_vignesh/DataDump.C
Normal file
639
anasen_analysis_vignesh/DataDump.C
Normal file
|
|
@ -0,0 +1,639 @@
|
||||||
|
#define DataDump_cxx
|
||||||
|
|
||||||
|
#include "DataDump.h"
|
||||||
|
#include "Armory/ClassPW.h"
|
||||||
|
#include "Armory/HistPlotter.h"
|
||||||
|
|
||||||
|
#include <TH2.h>
|
||||||
|
#include <TStyle.h>
|
||||||
|
#include <TCanvas.h>
|
||||||
|
#include <TMath.h>
|
||||||
|
#include <TBranch.h>
|
||||||
|
#include "TVector3.h"
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <map>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
#include <utility>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
// Global instances
|
||||||
|
PW pw_contr;
|
||||||
|
PW pwinstance;
|
||||||
|
TVector3 hitPos;
|
||||||
|
long long int gcount=0;
|
||||||
|
|
||||||
|
class Event {
|
||||||
|
public:
|
||||||
|
TVector3 pos;
|
||||||
|
int ch1=-1; //ring# for QQQ, anode# for PC
|
||||||
|
int ch2=-1; //wedge# for QQQ, cathode# for PC
|
||||||
|
double Energy1=-1; //Front for QQQ, Anode for PC
|
||||||
|
double Energy2=-1; //Back for QQQ, Cathode for PC
|
||||||
|
double Time1=-1;
|
||||||
|
double Time2=-1;
|
||||||
|
Event(TVector3 p, double E1, double E2, double T1, double T2): pos(p), Energy1(E1), Energy2(E2), Time1(T1), Time2(T2) {}
|
||||||
|
};
|
||||||
|
/*
|
||||||
|
void testfunction()
|
||||||
|
{
|
||||||
|
for(auto cathode: cathodes) {
|
||||||
|
std::unordered_set<int> chans;
|
||||||
|
chans.insert(cathode.ch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
// Calibration globals
|
||||||
|
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}}};
|
||||||
|
// TCutg *cutQQQ;
|
||||||
|
|
||||||
|
// PC Arrays
|
||||||
|
double pcSlope[48];
|
||||||
|
double pcIntercept[48];
|
||||||
|
|
||||||
|
HistPlotter *plotter;
|
||||||
|
|
||||||
|
bool HitNonZero;
|
||||||
|
bool sx3ecut;
|
||||||
|
bool qqqEcut;
|
||||||
|
|
||||||
|
|
||||||
|
void DataDump::Begin(TTree * /*tree*/)
|
||||||
|
{
|
||||||
|
TString option = GetOption();
|
||||||
|
plotter = new HistPlotter("Analyzer_QQQ.root", "TFILE");
|
||||||
|
|
||||||
|
pw_contr.ConstructGeo();
|
||||||
|
pwinstance.ConstructGeo();
|
||||||
|
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
// 1. CRITICAL FIX: Initialize PC Arrays to Default (Raw)
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
for (int i = 0; i < 48; i++) {
|
||||||
|
pcSlope[i] = 1.0; // Default slope = 1 (preserves Raw energy)
|
||||||
|
pcIntercept[i] = 0.0; // Default intercept = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate Crossover Geometry ONCE
|
||||||
|
TVector3 a, c, diff;
|
||||||
|
double a2, ac, c2, adiff, cdiff, denom, alpha;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < pwinstance.An.size(); i++)
|
||||||
|
{
|
||||||
|
a = pwinstance.An[i].first - pwinstance.An[i].second;
|
||||||
|
for (size_t 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);
|
||||||
|
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 = 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 || (i+j)%24 == 12 )
|
||||||
|
{
|
||||||
|
Crossover[i][j][0].z = 9999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
Crossover[i][j][1].x = alpha;
|
||||||
|
Crossover[i][j][1].y = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load PC Calibrations
|
||||||
|
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;
|
||||||
|
if (index >= 0 && index <= 47)
|
||||||
|
{
|
||||||
|
pcSlope[index] = slope;
|
||||||
|
pcIntercept[index] = intercept;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inputFile.close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "Error opening slope_intercept.txt" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ... (Load QQQ Gains and Calibs - same as before) ...
|
||||||
|
{
|
||||||
|
std::string filename = "qqq_GainMatch.dat";
|
||||||
|
std::ifstream infile(filename);
|
||||||
|
if (infile.is_open())
|
||||||
|
{
|
||||||
|
int det, ring, wedge;
|
||||||
|
double gainw, gainr;
|
||||||
|
while (infile >> det >> wedge >> ring >> gainw >> gainr)
|
||||||
|
{
|
||||||
|
qqqGain[det][wedge][ring] = gainw;
|
||||||
|
qqqGainValid[det][wedge][ring] = (gainw > 0);
|
||||||
|
}
|
||||||
|
infile.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::string filename = "qqq_Calib.dat";
|
||||||
|
std::ifstream infile(filename);
|
||||||
|
if (infile.is_open())
|
||||||
|
{
|
||||||
|
int det, ring, wedge;
|
||||||
|
double slope;
|
||||||
|
while (infile >> det >> wedge >> ring >> slope)
|
||||||
|
{
|
||||||
|
qqqCalib[det][wedge][ring] = slope;
|
||||||
|
qqqCalibValid[det][wedge][ring] = (slope > 0);
|
||||||
|
}
|
||||||
|
infile.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool_t DataDump::Process(Long64_t entry)
|
||||||
|
{
|
||||||
|
hitPos.Clear();
|
||||||
|
HitNonZero = false;
|
||||||
|
bool qqq1000cut = false;
|
||||||
|
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();
|
||||||
|
|
||||||
|
// QQQ Processing
|
||||||
|
int qqqCount = 0;
|
||||||
|
int qqqAdjCh = 0;
|
||||||
|
// REMOVE WHEN RERUNNING USING THE NEW CALIBRATION FILE
|
||||||
|
for (int i = 0; i < qqq.multi; i++)
|
||||||
|
{
|
||||||
|
if ((qqq.id[i] == 3 || qqq.id[i] == 1) && qqq.ch[i] < 16)
|
||||||
|
{
|
||||||
|
qqq.ch[i] = 16 - qqq.ch[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < qqq.multi; i++)
|
||||||
|
{
|
||||||
|
if (qqq.id[i] == 0 && qqq.ch[i] >= 16)
|
||||||
|
{
|
||||||
|
qqq.ch[i] = 31 - qqq.ch[i] + 16;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::tuple<int,int,double,int,double>> qqqlist;
|
||||||
|
std::vector<Event> QQQ_Events, PC_Events;
|
||||||
|
std::vector<Event> QQQ_Events_Raw, PC_Events_Raw;
|
||||||
|
bool PCQQQTimeCut = false;
|
||||||
|
for (int i = 0; i < qqq.multi; i++)
|
||||||
|
{
|
||||||
|
for (int j = i + 1; j < qqq.multi; j++)
|
||||||
|
{
|
||||||
|
if (qqq.id[i] == qqq.id[j])
|
||||||
|
{
|
||||||
|
qqqCount++;
|
||||||
|
|
||||||
|
int chWedge = -1;
|
||||||
|
int chRing = -1;
|
||||||
|
double eWedge = 0.0;
|
||||||
|
double eWedgeMeV = 0.0;
|
||||||
|
double eRing = 0.0;
|
||||||
|
double eRingMeV = 0.0;
|
||||||
|
double tRing = 0.0;
|
||||||
|
double tWedge = 0.0;
|
||||||
|
|
||||||
|
if (qqq.ch[i] < 16 && qqq.ch[j] >= 16 && qqqGainValid[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16])
|
||||||
|
{
|
||||||
|
chWedge = qqq.ch[i];
|
||||||
|
eWedge = qqq.e[i] * qqqGain[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16];
|
||||||
|
chRing = qqq.ch[j] - 16;
|
||||||
|
eRing = qqq.e[j];
|
||||||
|
tRing = static_cast<double>(qqq.t[j]);
|
||||||
|
tWedge = static_cast<double>(qqq.t[i]);
|
||||||
|
}
|
||||||
|
else if (qqq.ch[j] < 16 && 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];
|
||||||
|
chRing = qqq.ch[i] - 16;
|
||||||
|
eRing = qqq.e[i];
|
||||||
|
tRing = static_cast<double>(qqq.t[i]);
|
||||||
|
tWedge = static_cast<double>(qqq.t[j]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
Event qqqevent(TVector3(rho*TMath::Cos(theta),rho*TMath::Sin(theta),23+75+30), eRingMeV, eWedgeMeV, tRing, tWedge);
|
||||||
|
Event qqqeventr(TVector3(rho*TMath::Cos(theta),rho*TMath::Sin(theta),23+75+30), eRing, eWedge, tRing, tWedge);
|
||||||
|
QQQ_Events.push_back(qqqevent);
|
||||||
|
QQQ_Events_Raw.push_back(qqqeventr);
|
||||||
|
qqqlist.push_back(std::tuple(qqq.id[i],chRing,eRingMeV,chWedge,eWedgeMeV));
|
||||||
|
} //end if qqq.id[i] == qqq.id[j]
|
||||||
|
}//inner qqq loop, j
|
||||||
|
}//outer qqq loop, i
|
||||||
|
|
||||||
|
// PC Gain Matching and Filling
|
||||||
|
double anodeT = -99999;
|
||||||
|
double cathodeT = 99999;
|
||||||
|
int anodeIndex = -1;
|
||||||
|
int cathodeIndex = -1;
|
||||||
|
|
||||||
|
|
||||||
|
int aID = 0;
|
||||||
|
int cID = 0;
|
||||||
|
double aE = 0;
|
||||||
|
double cE = 0;
|
||||||
|
double aESum = 0;
|
||||||
|
double cESum = 0;
|
||||||
|
double aEMax = 0;
|
||||||
|
int aIDMax = 0;
|
||||||
|
anodeHits.clear();
|
||||||
|
cathodeHits.clear();
|
||||||
|
anodeTimes.clear();
|
||||||
|
cathodeTimes.clear();
|
||||||
|
corrcatMax.clear();
|
||||||
|
corranoMax.clear();
|
||||||
|
|
||||||
|
std::array<bool,24> caths_seen{0}, anos_seen{0};
|
||||||
|
std::vector<std::tuple<int,double,double>> anodeChunks, cathodeChunks;
|
||||||
|
for (int i = 0; i < pc.multi; i++)
|
||||||
|
{
|
||||||
|
if (pc.e[i] > 4)
|
||||||
|
{
|
||||||
|
;//plotter->Fill2D("PC_Index_Vs_Energy", 48, 0, 48, 2000, 0, 30000, pc.index[i], static_cast<double>(pc.e[i]), "hRawPC");
|
||||||
|
} else
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (pc.index[i] < 48) {
|
||||||
|
pc.e[i] = pcSlope[pc.index[i]] * pc.e[i] + pcIntercept[pc.index[i]];
|
||||||
|
//plotter->Fill2D("PC_Index_VS_GainMatched_Energy", 48, 0, 48, 2000, 0, 30000, pc.index[i], pc.e[i], "hGMPC");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pc.index[i] < 24) {
|
||||||
|
anodeT = static_cast<double>(pc.t[i]);
|
||||||
|
anodeIndex = pc.index[i];
|
||||||
|
anos_seen[anodeIndex] = 1;
|
||||||
|
anodeHits.push_back(std::pair<int, double>(pc.index[i], pc.e[i]));
|
||||||
|
anodeTimes.push_back(anodeT);
|
||||||
|
anodeChunks.push_back(std::tuple<int,double,double>(pc.index[i],anodeT,pc.e[i]));
|
||||||
|
} else {
|
||||||
|
cathodeT = static_cast<double>(pc.t[i]);
|
||||||
|
cathodeIndex = pc.index[i] - 24;
|
||||||
|
caths_seen[cathodeIndex] = 1;
|
||||||
|
cathodeChunks.push_back(std::tuple<int,double,double>(pc.index[i]-24,cathodeT,pc.e[i]));
|
||||||
|
cathodeHits.push_back(std::pair<int, double>(pc.index[i] - 24, pc.e[i]));
|
||||||
|
cathodeTimes.push_back(cathodeT);
|
||||||
|
}
|
||||||
|
}//end of pc.multi loop
|
||||||
|
|
||||||
|
if(anodeHits.size() && cathodeHits.size()) {
|
||||||
|
for(size_t ii=0; ii<anodeHits.size(); ii++) {
|
||||||
|
const auto& an = anodeHits.at(ii);
|
||||||
|
const auto& at = anodeTimes.at(ii);
|
||||||
|
for(size_t jj=0; jj<cathodeHits.size(); jj++) {
|
||||||
|
const auto& ca = cathodeHits.at(jj);
|
||||||
|
const auto& ct = cathodeTimes.at(jj);
|
||||||
|
plotter->Fill2D("ach_minus_cch_vs_ach",60,-30,30,24,0,24,an.first-ca.first,an.first);
|
||||||
|
plotter->Fill2D("ach_minus_cch_vs_dt",60,-30,30,400,-1000,1000,an.first-ca.first,at-ct);
|
||||||
|
plotter->Fill2D("ach_vs_cch",24,0,24,24,0,24,an.first,ca.first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gcount++;
|
||||||
|
}
|
||||||
|
bool all_three = anodeHits.size() > 0 && cathodeHits.size() > 0 && qqqlist.size() > 0;
|
||||||
|
|
||||||
|
if(all_three) std::cout << "---" << std::endl;
|
||||||
|
for(size_t ii=0; ii<anodeHits.size() && all_three; ii++) {
|
||||||
|
const auto& an = anodeHits.at(ii);
|
||||||
|
const auto& at = anodeTimes.at(ii);
|
||||||
|
std::cout << "an" << std::setprecision(16) << ", " << an.first << ", " << an.second << ", " << at << " ,-1, -1" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(size_t jj=0; jj<cathodeHits.size() && all_three; jj++) {
|
||||||
|
const auto& ca = cathodeHits.at(jj);
|
||||||
|
const auto& ct = cathodeTimes.at(jj);
|
||||||
|
std::cout << "ca" << std::setprecision(16) << ", " << ca.first << ", " << ca.second << ", " << ct << " ,-1, -1" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(size_t jj=0; jj<qqqlist.size() && all_three; jj++) {
|
||||||
|
const auto[id,chr,er,chw,ew] = qqqlist.at(jj);
|
||||||
|
std::cout << "q" << std::setprecision(16) << ", " << id << ", " << chr << ", " << er << ", " << chw << ", " << ew << std::endl;
|
||||||
|
}
|
||||||
|
if(all_three) std::cout << " --end-- " << std::endl;
|
||||||
|
|
||||||
|
if(gcount == 100)
|
||||||
|
return -1;
|
||||||
|
// std::sort(anodeChunks.begin(),anodeChunks.end(),);
|
||||||
|
if (anodeHits.size() >= 1 && cathodeHits.size() >= 1)
|
||||||
|
{
|
||||||
|
// 2. CRITICAL FIX: Define reference vector 'a'
|
||||||
|
// In Analyzer.cxx, 'a' was left over from the loop. We use the first anode wire as reference here.
|
||||||
|
// (Assuming pwinstance.An is populated and wires are generally parallel).
|
||||||
|
TVector3 refAnode = pwinstance.An[0].first - pwinstance.An[0].second;
|
||||||
|
for (const auto &anode : anodeHits)
|
||||||
|
{
|
||||||
|
aID = anode.first;
|
||||||
|
aE = anode.second;
|
||||||
|
aESum += aE;
|
||||||
|
if (aE > aEMax)
|
||||||
|
{
|
||||||
|
aEMax = aE;
|
||||||
|
aIDMax = aID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto &cathode : cathodeHits)
|
||||||
|
{
|
||||||
|
cID = cathode.first;
|
||||||
|
cE = cathode.second;
|
||||||
|
for (int j = -4; j < 3; j++)
|
||||||
|
{
|
||||||
|
if ((aIDMax + 24 + j) % 24 == 23 - cID)
|
||||||
|
{
|
||||||
|
corrcatMax.push_back(std::pair<int, double>(cID, cE));
|
||||||
|
cESum += cE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TVector3 anodeIntersection;
|
||||||
|
anodeIntersection.Clear();
|
||||||
|
if (corrcatMax.size() > 0)
|
||||||
|
{
|
||||||
|
double x = 0, y = 0, z = 0;
|
||||||
|
for (const auto &corr : corrcatMax)
|
||||||
|
{
|
||||||
|
if (Crossover[aIDMax][corr.first][0].z > 9000000)
|
||||||
|
continue;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (x == 0 && y == 0 && z == 0)
|
||||||
|
;
|
||||||
|
// to ignore events with no valid crossover points
|
||||||
|
else
|
||||||
|
anodeIntersection = TVector3(x, y, z);
|
||||||
|
}
|
||||||
|
bool PCQQQPhiCut = false;
|
||||||
|
// flip the algorithm for cathode 1 multi anode events
|
||||||
|
if ((hitPos.Phi() > (anodeIntersection.Phi() - TMath::PiOver4())) && (hitPos.Phi() < (anodeIntersection.Phi() + TMath::PiOver4()))) {
|
||||||
|
PCQQQPhiCut = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anodeIntersection.Z() != 0)
|
||||||
|
{
|
||||||
|
plotter->Fill1D("PC_Z_Projection", 600, -300, 300, anodeIntersection.Z(), "hPCzQQQ");
|
||||||
|
plotter->Fill2D("Z_Proj_VsDelTime", 600, -300, 300, 200, -2000, 2000, anodeIntersection.Z(), anodeT - cathodeT, "hPCzQQQ");
|
||||||
|
plotter->Fill2D("IntPhi_vs_QQQphi", 100, -200, 200, 80, -200, 200, anodeIntersection.Phi() * 180. / TMath::Pi(), hitPos.Phi() * 180. / TMath::Pi(), "hPCQQQ");
|
||||||
|
plotter->Fill2D("Inttheta_vs_QQQtheta", 90, 0, 180, 20, 0, 45, anodeIntersection.Theta() * 180. / TMath::Pi(), hitPos.Theta() * 180. / TMath::Pi(), "hPCQQQ");
|
||||||
|
plotter->Fill2D("Inttheta_vs_QQQtheta_TC" + std::to_string(PCQQQTimeCut), 90, 0, 180, 20, 0, 45, anodeIntersection.Theta() * 180. / TMath::Pi(), hitPos.Theta() * 180. / TMath::Pi(), "hPCQQQ");
|
||||||
|
plotter->Fill2D("IntPhi_vs_QQQphi_TC" + std::to_string(PCQQQTimeCut) + "PhiC" + std::to_string(PCQQQPhiCut), 100, -200, 200, 80, -200, 200, anodeIntersection.Phi() * 180. / TMath::Pi(), hitPos.Phi() * 180. / TMath::Pi(), "hPCQQQ");
|
||||||
|
}
|
||||||
|
if (anodeIntersection.Z() != 0 && cathodeHits.size() >= 2)
|
||||||
|
plotter->Fill1D("PC_Z_Projection_TC" + std::to_string(PCQQQTimeCut) + "PhiC" + std::to_string(PCQQQPhiCut), 600, -300, 300, anodeIntersection.Z(), "hPCzQQQ");
|
||||||
|
|
||||||
|
if (anodeIntersection.Z() != 0 && cathodeHits.size() == 1)
|
||||||
|
{
|
||||||
|
plotter->Fill1D("PC_Z_proj_1C", 600, -300, 300, anodeIntersection.Z(), "hPCzQQQ");
|
||||||
|
plotter->Fill2D("IntersectionPhi_vs_AnodeZ_1C", 400, -200, 200, 600, -300, 300, anodeIntersection.Phi() * 180. / TMath::Pi(), anodeIntersection.Z(), "hPCzQQQ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anodeIntersection.Z() != 0 && cathodeHits.size() == 2)
|
||||||
|
{
|
||||||
|
plotter->Fill1D("PC_Z_proj_2C", 600, -300, 300, anodeIntersection.Z(), "hPCzQQQ");
|
||||||
|
plotter->Fill2D("IntersectionPhi_vs_AnodeZ_2C", 400, -200, 200, 600, -300, 300, anodeIntersection.Phi() * 180. / TMath::Pi(), anodeIntersection.Z(), "hGMPC");
|
||||||
|
}
|
||||||
|
if (anodeIntersection.Z() != 0 && cathodeHits.size() > 2)
|
||||||
|
{
|
||||||
|
plotter->Fill1D("PC_Z_proj_nC", 600, -300, 300, anodeIntersection.Z(), "hPCzQQQ");
|
||||||
|
plotter->Fill2D("IntersectionPhi_vs_AnodeZ_nC", 400, -200, 200, 600, -300, 300, anodeIntersection.Phi() * 180. / TMath::Pi(), anodeIntersection.Z(), "hGMPC");
|
||||||
|
}
|
||||||
|
if (anodeHits.size() > 0 && cathodeHits.size() > 0)
|
||||||
|
plotter->Fill2D("AHits_vs_CHits", 12, 0, 11, 6, 0, 5, anodeHits.size(), cathodeHits.size(), "hRawPC");
|
||||||
|
|
||||||
|
// make another plot with nearest neighbour constraint
|
||||||
|
bool hasNeighbourAnodes = false;
|
||||||
|
bool hasNeighbourCathodes = false;
|
||||||
|
|
||||||
|
// 1. Check Anodes for neighbours (including wrap-around 0-23)
|
||||||
|
for (size_t i = 0; i < anodeHits.size(); i++)
|
||||||
|
{
|
||||||
|
for (size_t j = i + 1; j < anodeHits.size(); j++)
|
||||||
|
{
|
||||||
|
int diff = std::abs(anodeHits[i].first - anodeHits[j].first);
|
||||||
|
if (diff == 1 || diff == 23)
|
||||||
|
{ // 23 handles the cylindrical wrap
|
||||||
|
hasNeighbourAnodes = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasNeighbourAnodes)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Check Cathodes for neighbours (including wrap-around 0-23)
|
||||||
|
for (size_t i = 0; i < cathodeHits.size(); i++)
|
||||||
|
{
|
||||||
|
for (size_t j = i + 1; j < cathodeHits.size(); j++)
|
||||||
|
{
|
||||||
|
int diff = std::abs(cathodeHits[i].first - cathodeHits[j].first);
|
||||||
|
if (diff == 1 || diff == 23)
|
||||||
|
{
|
||||||
|
hasNeighbourCathodes = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasNeighbourCathodes)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
// FILL PLOTS
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
if (anodeHits.size() > 0 && cathodeHits.size() > 0)
|
||||||
|
{
|
||||||
|
plotter->Fill2D("AHits_vs_CHits_NA" + std::to_string(hasNeighbourAnodes), 12, 0, 11, 6, 0, 5, anodeHits.size(), cathodeHits.size(), "hRawPC");
|
||||||
|
plotter->Fill2D("AHits_vs_CHits_NC" + std::to_string(hasNeighbourCathodes), 12, 0, 11, 6, 0, 5, anodeHits.size(), cathodeHits.size(), "hRawPC");
|
||||||
|
|
||||||
|
// Constraint Plot: Only fill if BOTH planes have adjacent hits
|
||||||
|
// This effectively removes events with only isolated single-wire hits (noise)
|
||||||
|
if (hasNeighbourAnodes && hasNeighbourCathodes)
|
||||||
|
{
|
||||||
|
plotter->Fill2D("AHits_vs_CHits_NN", 12, 0, 11, 6, 0, 5, anodeHits.size(), cathodeHits.size(), "hRawPC");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (HitNonZero && anodeIntersection.Z() != 0)
|
||||||
|
{
|
||||||
|
pw_contr.CalTrack2(hitPos, anodeIntersection);
|
||||||
|
plotter->Fill1D("VertexRecon", 600, -300, 300, pw_contr.GetZ0());
|
||||||
|
plotter->Fill1D("VertexRecon_TC"+std::to_string(PCQQQTimeCut)+"_PhiC"+std::to_string(PCQQQPhiCut), 600, -300, 300, pw_contr.GetZ0());
|
||||||
|
|
||||||
|
if (cathodeHits.size() == 2)
|
||||||
|
plotter->Fill1D("VertexRecon_2c_TC"+std::to_string(PCQQQTimeCut)+"_PhiC"+std::to_string(PCQQQPhiCut), 600, -300, 300, pw_contr.GetZ0());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < qqq.multi; i++)
|
||||||
|
{
|
||||||
|
if (PCQQQTimeCut)
|
||||||
|
{
|
||||||
|
plotter->Fill2D("PC_XY_Projection_QQQ_TimeCut" + std::to_string(qqq.id[i]), 400, -100, 100, 400, -100, 100, anodeIntersection.X(), anodeIntersection.Y(), "hPCQQQ");
|
||||||
|
}
|
||||||
|
plotter->Fill2D("PC_XY_Projection_QQQ" + std::to_string(qqq.id[i]), 400, -100, 100, 400, -100, 100, anodeIntersection.X(), anodeIntersection.Y(), "hPCQQQ");
|
||||||
|
|
||||||
|
for (int j = i + 1; j < qqq.multi; j++)
|
||||||
|
{
|
||||||
|
if (qqq.id[i] == qqq.id[j])
|
||||||
|
{
|
||||||
|
int chWedge = -1;
|
||||||
|
int chRing = -1;
|
||||||
|
double eWedge = 0.0;
|
||||||
|
double eWedgeMeV = 0.0;
|
||||||
|
double eRing = 0.0;
|
||||||
|
double eRingMeV = 0.0;
|
||||||
|
double tRing = 0.0;
|
||||||
|
int qqqID = -1;
|
||||||
|
if (qqq.ch[i] < 16 && qqq.ch[j] >= 16 && qqqGainValid[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16])
|
||||||
|
{
|
||||||
|
chWedge = qqq.ch[i];
|
||||||
|
eWedge = qqq.e[i] * qqqGain[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16];
|
||||||
|
chRing = qqq.ch[j] - 16;
|
||||||
|
eRing = qqq.e[j];
|
||||||
|
tRing = static_cast<double>(qqq.t[j]);
|
||||||
|
qqqID = qqq.id[i];
|
||||||
|
}
|
||||||
|
else if (qqq.ch[j] < 16 && 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];
|
||||||
|
chRing = qqq.ch[i] - 16;
|
||||||
|
tRing = static_cast<double>(qqq.t[i]);
|
||||||
|
eRing = qqq.e[i];
|
||||||
|
qqqID = qqq.id[i];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
// if (anodeIntersection.Z() != 0)
|
||||||
|
{
|
||||||
|
plotter->Fill2D("PC_Z_vs_QQQRing", 600, -300, 300, 16, 0, 16, anodeIntersection.Z(), chRing, "hPCzQQQ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anodeIntersection.Z() != 0 && cathodeHits.size() == 2)
|
||||||
|
{
|
||||||
|
plotter->Fill2D("PC_Z_vs_QQQRing_2C", 600, -300, 300, 16, 0, 16, anodeIntersection.Z(), chRing, "hPCzQQQ");
|
||||||
|
plotter->Fill2D("PC_Z_vs_QQQRing_2C" + std::to_string(qqq.id[i]), 600, -300, 300, 16, 0, 16, anodeIntersection.Z(), chRing, "hPCzQQQ");
|
||||||
|
plotter->Fill2D("PC_Z_vs_QQQWedge_2C", 600, -300, 300, 16, 0, 16, anodeIntersection.Z(), chWedge, "hPCzQQQ");
|
||||||
|
}
|
||||||
|
plotter->Fill2D("Vertex_V_QQQRingTC" + std::to_string(PCQQQTimeCut) + "PhiC" + std::to_string(PCQQQPhiCut), 600, -300, 300, 16, 0, 16, pw_contr.GetZ0(), chRing, "hPCQQQ");
|
||||||
|
double phi = TMath::ATan2(anodeIntersection.Y(), anodeIntersection.X()) * 180. / TMath::Pi();
|
||||||
|
plotter->Fill2D("PolarAngle_Vs_QQQWedge" + std::to_string(qqqID), 360, -360, 360, 16, 0, 16, phi, chWedge, "hPCQQQ");
|
||||||
|
// plotter->Fill2D("EdE_PC_vs_QQQ_timegate_ls1000"+std::to_string())
|
||||||
|
|
||||||
|
plotter->Fill2D("PC_Z_vs_QQQRing_Det" + std::to_string(qqqID), 600, -300, 300, 16, 0, 16, anodeIntersection.Z(), chRing, "hPCQQQ");
|
||||||
|
//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);
|
||||||
|
|
||||||
|
for (int k = 0; k < pc.multi; k++)
|
||||||
|
{
|
||||||
|
if(pc.index[k] >= 24)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
double sinTheta = TMath::Sin(hitPos.Theta());
|
||||||
|
|
||||||
|
plotter->Fill2D("CalibratedQQQE_RvsPCE_TC" + std::to_string(PCQQQTimeCut) + "PhiC" + std::to_string(PCQQQPhiCut), 1000, 0, 10, 2000, 0, 30000, eRingMeV, pc.e[k]*sinTheta, "hPCQQQ");
|
||||||
|
plotter->Fill2D("CalibratedQQQE_WvsPCE_TC" + std::to_string(PCQQQTimeCut) + "PhiC" + std::to_string(PCQQQPhiCut), 1000, 0, 10, 2000, 0, 30000, eWedgeMeV, pc.e[k]*sinTheta, "hPCQQQ");
|
||||||
|
plotter->Fill2D("PCQQQ_dTimevsdPhi", 200, -2000, 2000, 80, -200, 200, tRing - static_cast<double>(pc.t[k]), (hitPos.Phi()-anodeIntersection.Phi()) * 180. / TMath::Pi(), "hTiming");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < sx3.multi; i++)
|
||||||
|
{
|
||||||
|
// plotting sx3 strip hits vs anode phi
|
||||||
|
if (sx3.ch[i] < 8)
|
||||||
|
plotter->Fill2D("AnodePhi_vs_SX3Strip", 100, -200, 200, 8 * 24, 0, 8 * 24, anodeIntersection.Phi() * 180. / TMath::Pi(), sx3.id[i] * 8 + sx3.ch[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anodeIntersection.Z() != 0 && cathodeHits.size() == 3)
|
||||||
|
{
|
||||||
|
plotter->Fill1D("PC_Z_proj_3C", 600, -300, 300, anodeIntersection.Z(), "hPCzQQQ");
|
||||||
|
}
|
||||||
|
|
||||||
|
plotter->Fill2D("AnodeMaxE_Vs_Cathode_Sum_Energy", 2000, 0, 30000, 2000, 0, 30000, aEMax, cESum, "hGMPC");
|
||||||
|
plotter->Fill1D("Correlated_Cathode_MaxAnode", 6, 0, 5, corrcatMax.size(), "hGMPC");
|
||||||
|
plotter->Fill2D("Correlated_Cathode_VS_MaxAnodeEnergy", 6, 0, 5, 2000, 0, 30000, corrcatMax.size(), aEMax, "hGMPC");
|
||||||
|
plotter->Fill1D("AnodeHits", 12, 0, 11, anodeHits.size(), "hGMPC");
|
||||||
|
plotter->Fill2D("AnodeMaxE_vs_AnodeHits", 12, 0, 11, 2000, 0, 30000, anodeHits.size(), aEMax, "hGMPC");
|
||||||
|
|
||||||
|
if (anodeHits.size() < 1)
|
||||||
|
{
|
||||||
|
plotter->Fill1D("NoAnodeHits_CathodeHits", 6, 0, 5, cathodeHits.size(), "hGMPC");
|
||||||
|
}
|
||||||
|
|
||||||
|
return kTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataDump::Terminate()
|
||||||
|
{
|
||||||
|
plotter->FlushToDisk();
|
||||||
|
}
|
||||||
132
anasen_analysis_vignesh/DataDump.h
Normal file
132
anasen_analysis_vignesh/DataDump.h
Normal file
|
|
@ -0,0 +1,132 @@
|
||||||
|
#ifndef DataDump_h
|
||||||
|
#define DataDump_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 DataDump : 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;
|
||||||
|
|
||||||
|
DataDump(TTree * /*tree*/ =0) : fChain(0) { }
|
||||||
|
virtual ~DataDump() { }
|
||||||
|
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(DataDump,0);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DataDump_cxx
|
||||||
|
void DataDump::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);
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool_t DataDump::Notify(){
|
||||||
|
return kTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataDump::SlaveBegin(TTree * /*tree*/){
|
||||||
|
// TString option = GetOption();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataDump::SlaveTerminate(){
|
||||||
|
}
|
||||||
|
#endif // #ifdef DataDump_cxx
|
||||||
|
|
@ -0,0 +1,124 @@
|
||||||
|
#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
anasen_analysis_vignesh/GainMatchQQQ.C
Normal file
309
anasen_analysis_vignesh/GainMatchQQQ.C
Normal file
|
|
@ -0,0 +1,309 @@
|
||||||
|
#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();
|
||||||
|
}
|
||||||
114
anasen_analysis_vignesh/GainMatchQQQ.h
Normal file
114
anasen_analysis_vignesh/GainMatchQQQ.h
Normal file
|
|
@ -0,0 +1,114 @@
|
||||||
|
#ifndef GainMatchQQQ_h
|
||||||
|
#define GainMatchQQQ_h
|
||||||
|
|
||||||
|
#include <TROOT.h>
|
||||||
|
#include <TChain.h>
|
||||||
|
#include <TFile.h>
|
||||||
|
#include <TSelector.h>
|
||||||
|
|
||||||
|
#include "Armory/ClassDet.h"
|
||||||
|
|
||||||
|
class GainMatchQQQ : 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; //!
|
||||||
|
|
||||||
|
GainMatchQQQ(TTree * /*tree*/ =0) : fChain(0) { }
|
||||||
|
virtual ~GainMatchQQQ() { }
|
||||||
|
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(GainMatchQQQ,0);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GainMatchQQQ_cxx
|
||||||
|
void GainMatchQQQ::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 GainMatchQQQ::Notify(){
|
||||||
|
|
||||||
|
return kTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GainMatchQQQ::SlaveBegin(TTree * /*tree*/){
|
||||||
|
|
||||||
|
TString option = GetOption();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GainMatchQQQ::SlaveTerminate(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // #ifdef GainMatchQQQ_cxx
|
||||||
432
anasen_analysis_vignesh/GainMatchSX3.C
Normal file
432
anasen_analysis_vignesh/GainMatchSX3.C
Normal file
|
|
@ -0,0 +1,432 @@
|
||||||
|
#define GainMatchSX3_cxx
|
||||||
|
|
||||||
|
#include "GainMatchSX3.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 <TProfile.h>
|
||||||
|
#include "Armory/ClassSX3.h"
|
||||||
|
#include "Armory/HistPlotter.h"
|
||||||
|
#include <TGraphErrors.h>
|
||||||
|
#include "TVector3.h"
|
||||||
|
|
||||||
|
TH2F *hSX3FvsB;
|
||||||
|
TH2F *hSX3FvsB_g;
|
||||||
|
TH2F *hsx3IndexVE;
|
||||||
|
TH2F *hsx3IndexVE_g;
|
||||||
|
TH2F *hSX3;
|
||||||
|
TH2F *hsx3Coin;
|
||||||
|
|
||||||
|
int padID = 0;
|
||||||
|
|
||||||
|
SX3 sx3_contr;
|
||||||
|
TCutG *cut;
|
||||||
|
TCutG *cut1;
|
||||||
|
std::map<std::tuple<int, int, int, int>, std::vector<std::tuple<double, double, double>>> dataPoints;
|
||||||
|
std::map<std::tuple<int, int, int, int>, int> comboCounts;
|
||||||
|
|
||||||
|
const int MAX_DET = 24;
|
||||||
|
const int MAX_UP = 4;
|
||||||
|
const int MAX_DOWN = 4;
|
||||||
|
const int MAX_BK = 4;
|
||||||
|
|
||||||
|
double frontGainUp[MAX_DET][MAX_BK][MAX_UP][MAX_DOWN] = {{{{0}}}};
|
||||||
|
double frontGainDown[MAX_DET][MAX_BK][MAX_UP][MAX_DOWN] = {{{{0}}}};
|
||||||
|
bool frontGainValid[MAX_DET][MAX_BK][MAX_UP][MAX_DOWN] = {{{{false}}}};
|
||||||
|
TCanvas c("canvas", "canvas", 800, 600);
|
||||||
|
|
||||||
|
// ==== Configuration Flags ====
|
||||||
|
const bool interactiveMode = true; // If true: show canvas + wait for user
|
||||||
|
const bool verboseFit = true; // If true: print fit summary and chi²
|
||||||
|
const bool drawCanvases = true; // If false: canvases won't be drawn at all
|
||||||
|
|
||||||
|
// HistPlotter plotter("SX3GainMatchBack.root");
|
||||||
|
|
||||||
|
void GainMatchSX3::Begin(TTree * /*tree*/)
|
||||||
|
{
|
||||||
|
TString option = GetOption();
|
||||||
|
|
||||||
|
hSX3FvsB = new TH2F("hSX3FvsB", "SX3 Front vs Back; Front E; Back E", 400, 0, 16000, 400, 0, 16000);
|
||||||
|
hSX3FvsB_g = new TH2F("hSX3FvsB_g", "SX3 Front vs Back; Front E; Back E", 400, 0, 16000, 400, 0, 16000);
|
||||||
|
hsx3IndexVE = new TH2F("hsx3IndexVE", "SX3 index vs Energy; sx3 index ; Energy", 24 * 12, 0, 24 * 12, 400, 0, 5000);
|
||||||
|
hsx3IndexVE_g = new TH2F("hsx3IndexVE_g", "SX3 index vs Energy; sx3 index ; Energy", 24 * 12, 0, 24 * 12, 400, 0, 5000);
|
||||||
|
hSX3 = new TH2F("hSX3", "SX3 Front v Back; Fronts; Backs", 8, 0, 8, 4, 0, 4);
|
||||||
|
|
||||||
|
hsx3Coin = new TH2F("hsx3Coin", "SX3 Coincident", 24 * 12, 0, 24 * 12, 24 * 12, 0, 24 * 12);
|
||||||
|
|
||||||
|
sx3_contr.ConstructGeo();
|
||||||
|
|
||||||
|
// Load the TCutG object
|
||||||
|
TFile *cutFile = TFile::Open("sx3cut.root");
|
||||||
|
if (!cutFile || cutFile->IsZombie())
|
||||||
|
{
|
||||||
|
std::cerr << "Error: Could not open sx3cut.root" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cut = dynamic_cast<TCutG *>(cutFile->Get("sx3cut"));
|
||||||
|
if (!cut)
|
||||||
|
{
|
||||||
|
std::cerr << "Error: Could not find TCutG named 'sx3cut' in sx3cut.root" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cut->SetName("sx3cut"); // Ensure the cut has the correct name
|
||||||
|
|
||||||
|
// Load the TCutG object
|
||||||
|
TFile *cutFile1 = TFile::Open("UvD.root");
|
||||||
|
bool cut1Loaded = (cut1 != nullptr);
|
||||||
|
cut1 = dynamic_cast<TCutG *>(cutFile1->Get("UvD"));
|
||||||
|
if (!cut1)
|
||||||
|
{
|
||||||
|
std::cerr << "Error: Could not find TCutG named 'UvD' in UvD.root" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cut1->SetName("UvD");
|
||||||
|
|
||||||
|
// plotter.ReadCuts("cuts.txt");
|
||||||
|
|
||||||
|
std::string filename = "sx3_GainMatchfront.txt";
|
||||||
|
// std::string filename = "sx3_GainMatchfront.txt";
|
||||||
|
|
||||||
|
std::ifstream infile(filename);
|
||||||
|
if (!infile.is_open())
|
||||||
|
{
|
||||||
|
std::cerr << "Error opening " << filename << "!" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int id, bk, u, d;
|
||||||
|
double gainup, gaindown;
|
||||||
|
while (infile >> id >> bk >> u >> d >> gainup >> gaindown)
|
||||||
|
{
|
||||||
|
frontGainUp[id][bk][u][d] = gainup;
|
||||||
|
frontGainDown[id][bk][u][d] = gaindown;
|
||||||
|
frontGainValid[id][bk][u][d] = true;
|
||||||
|
if(frontGainValid[id][bk][u][d]) {
|
||||||
|
// std::cout << "Loaded front gain for Det" << id << " Bk" << bk << " U" << u << " D" << d
|
||||||
|
// << ": Up=" << gainup << ", Down=" << gaindown << std::endl;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
std::cout << "No valid front gain for Det" << id << " Bk" << bk << " U" << u << " D" << d << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool_t GainMatchSX3::Process(Long64_t 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();
|
||||||
|
|
||||||
|
std::vector<std::pair<int, int>> ID;
|
||||||
|
for (int i = 0; i < sx3.multi; i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
// for (int j = i + 1; j < sx3.multi; j++)
|
||||||
|
// {
|
||||||
|
// if (sx3.id[i] == 3)
|
||||||
|
// hsx3Coin->Fill(sx3.index[i], sx3.index[j]);
|
||||||
|
// }
|
||||||
|
if (sx3.e[i] > 100)
|
||||||
|
{
|
||||||
|
ID.push_back(std::pair<int, int>(sx3.id[i], i));
|
||||||
|
hsx3IndexVE->Fill(sx3.index[i], sx3.e[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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; });
|
||||||
|
|
||||||
|
// start with the first entry in the sorted array: channels that belong to the same detector are together in sequenmce
|
||||||
|
std::vector<std::pair<int, int>> sx3ID;
|
||||||
|
sx3ID.push_back(ID[0]);
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
|
for (size_t i = 1; i < ID.size(); i++)
|
||||||
|
{ // Check if id of i belongs to the same detector and then add it to the detector ID vector
|
||||||
|
if (ID[i].first == sx3ID.back().first)
|
||||||
|
{ // count the nunmber of hits that belong to the same detector
|
||||||
|
sx3ID.push_back(ID[i]);
|
||||||
|
|
||||||
|
if (sx3ID.size() >= 3)
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // the next event does not belong to the same detector, abandon the first event and continue with the next one
|
||||||
|
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;
|
||||||
|
|
||||||
|
// Build the correlated set once
|
||||||
|
for (size_t i = 0; i < sx3ID.size(); i++)
|
||||||
|
{
|
||||||
|
if (sx3.e[i] > 100)
|
||||||
|
{
|
||||||
|
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] - 8;
|
||||||
|
sx3EBk = sx3.e[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// Only if we found all three channels do we proceed
|
||||||
|
if (sx3ChUp >= 0 && sx3ChDn >= 0 && sx3ChBk >= 0)
|
||||||
|
{
|
||||||
|
// Fill once per correlated set
|
||||||
|
hSX3->Fill(sx3ChDn + 4, sx3ChBk);
|
||||||
|
hSX3->Fill(sx3ChUp, sx3ChBk);
|
||||||
|
hSX3FvsB->Fill(sx3EUp + sx3EDn, sx3EBk);
|
||||||
|
|
||||||
|
if (frontGainValid[sx3ID[0].first][sx3ChBk][sx3ChUp / 2][sx3ChDn / 2])
|
||||||
|
{
|
||||||
|
sx3EUp *= frontGainUp[sx3ID[0].first][sx3ChBk][sx3ChUp / 2][sx3ChDn / 2];
|
||||||
|
sx3EDn *= frontGainDown[sx3ID[0].first][sx3ChBk][sx3ChUp / 2][sx3ChDn / 2];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// printf("No front gain for Det%d Bk%d U%d D%d\n", sx3ID[0].first, sx3ChBk, sx3ChUp / 2, sx3ChDn / 2);
|
||||||
|
sx3EUp = sx3EDn = 0.;
|
||||||
|
}
|
||||||
|
// plotter.Fill2D("hSX3F", 400, 0, 16000, 400, 0, 16000, sx3EUp + sx3EDn, sx3EBk);
|
||||||
|
|
||||||
|
// Pick detector ID from one of the correlated hits (all same detector)
|
||||||
|
int detID = sx3ID[0].first;
|
||||||
|
|
||||||
|
TString histName = Form("hSX3FVB_id%d_U%d_D%d_B%d", detID, sx3ChUp, sx3ChDn, sx3ChBk);
|
||||||
|
TString histName1 = Form("UnCorr_id%d_U%d-D%dvsB%d", detID, sx3ChUp, sx3ChDn, sx3ChBk);
|
||||||
|
|
||||||
|
TH2F *hist2d = (TH2F *)gDirectory->Get(histName);
|
||||||
|
TH2F *hist2d1 = (TH2F *)gDirectory->Get(histName1);
|
||||||
|
if (!hist2d)
|
||||||
|
{
|
||||||
|
hist2d = new TH2F(histName, histName,
|
||||||
|
400, 0, 16000, 400, 0, 16000);
|
||||||
|
}
|
||||||
|
if (!hist2d1)
|
||||||
|
{
|
||||||
|
hist2d1 = new TH2F(histName1, histName1,
|
||||||
|
800, -1, 1, 800, 0, 4000);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sx3EBk > 100 || sx3EUp > 100 || sx3EDn > 100)
|
||||||
|
{
|
||||||
|
hSX3FvsB_g->Fill(sx3EUp + sx3EDn, sx3EBk);
|
||||||
|
|
||||||
|
// Use the correlated triplet directly
|
||||||
|
dataPoints[{detID, sx3ChBk, sx3ChUp, sx3ChDn}]
|
||||||
|
.emplace_back(sx3EBk, sx3EUp, sx3EDn);
|
||||||
|
}
|
||||||
|
|
||||||
|
hist2d->Fill(sx3EUp + sx3EDn, sx3EBk);
|
||||||
|
hist2d1->Fill((sx3EUp - sx3EDn) / (sx3EUp + sx3EDn), sx3EBk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return kTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
const double GAIN_ACCEPTANCE_THRESHOLD = 0.3;
|
||||||
|
void GainMatchSX3::Terminate()
|
||||||
|
{
|
||||||
|
double backSlope[MAX_DET][MAX_BK] = {{0}};
|
||||||
|
bool backSlopeValid[MAX_DET][MAX_BK] = {{false}};
|
||||||
|
|
||||||
|
std::ofstream outFile("sx3_BackGains0.txt");
|
||||||
|
if (!outFile.is_open())
|
||||||
|
{
|
||||||
|
std::cerr << "Error opening sx3_BackGains.txt for writing!" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// === Gain fit: (Up+Dn) vs Back, grouped by [id][bk] ===
|
||||||
|
for (int id = 0; id < MAX_DET; id++)
|
||||||
|
{
|
||||||
|
for (int bk = 0; bk < MAX_BK; bk++)
|
||||||
|
{
|
||||||
|
std::vector<double> bkE, udE;
|
||||||
|
|
||||||
|
// Collect all (Up+Dn, Back) for this id,bk
|
||||||
|
for (const auto &kv : dataPoints)
|
||||||
|
{
|
||||||
|
auto [cid, cbk, u, d] = kv.first;
|
||||||
|
if (cid != id || cbk != bk)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (const auto &pr : kv.second)
|
||||||
|
{
|
||||||
|
double eBk, eUp, eDn;
|
||||||
|
std::tie(eBk, eUp, eDn) = pr;
|
||||||
|
if ((eBk < 100) || (eUp < 100) || (eDn < 100))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
bkE.push_back(eBk);
|
||||||
|
udE.push_back(eUp + eDn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bkE.size() < 5)
|
||||||
|
continue; // not enough statistics
|
||||||
|
|
||||||
|
// Build graph with errors
|
||||||
|
const double fixedError = 0.0; // ADC channels
|
||||||
|
std::vector<double> exVals(udE.size(), 0.0); // no x error
|
||||||
|
std::vector<double> eyVals(udE.size(), fixedError); // constant y error
|
||||||
|
|
||||||
|
TGraphErrors g(udE.size(), udE.data(), bkE.data(),
|
||||||
|
exVals.data(), eyVals.data());
|
||||||
|
|
||||||
|
TF1 f("f", "[0]*x", 0, 16000);
|
||||||
|
// f.SetParameter(0, 1.0); // initial slope
|
||||||
|
|
||||||
|
if (drawCanvases)
|
||||||
|
{
|
||||||
|
g.SetTitle(Form("Detector %d Back %d: (Up+Dn) vs Back", id, bk));
|
||||||
|
g.SetMarkerStyle(20);
|
||||||
|
g.SetMarkerColor(kBlue);
|
||||||
|
g.Draw("AP");
|
||||||
|
|
||||||
|
g.Fit(&f, interactiveMode ? "Q" : "QNR");
|
||||||
|
|
||||||
|
if (verboseFit)
|
||||||
|
{
|
||||||
|
double chi2 = f.GetChisquare();
|
||||||
|
int ndf = f.GetNDF();
|
||||||
|
double reducedChi2 = (ndf != 0) ? chi2 / ndf : -1;
|
||||||
|
|
||||||
|
std::cout << Form("Det%d Back%d → Slope: %.4f | χ²/ndf = %.2f/%d = %.2f",
|
||||||
|
id, bk, f.GetParameter(0), chi2, ndf, reducedChi2)
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (interactiveMode)
|
||||||
|
{
|
||||||
|
c.Update();
|
||||||
|
gPad->WaitPrimitive();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
c.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g.Fit(&f, "QNR");
|
||||||
|
}
|
||||||
|
|
||||||
|
double slope = 1 / f.GetParameter(0);
|
||||||
|
if (std::abs(slope - 1.0) < 0.3) // sanity check
|
||||||
|
{
|
||||||
|
backSlope[id][bk] = slope;
|
||||||
|
backSlopeValid[id][bk] = true;
|
||||||
|
outFile << id << " " << bk << " " << slope << "\n";
|
||||||
|
printf("Back slope Det%d Bk%d → %.4f\n", id, bk, slope);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "Warning: Bad slope for Det" << id << " Bk" << bk
|
||||||
|
<< " slope=" << slope << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
outFile.close();
|
||||||
|
std::cout << "Back gain matching complete." << std::endl;
|
||||||
|
|
||||||
|
// === Create histograms ===
|
||||||
|
TH2F *hFVB = new TH2F("hFVB", "Corrected Up+Dn vs Corrected Back;Up+Dn E;Corrected Back E",
|
||||||
|
600, 0, 16000, 600, 0, 16000);
|
||||||
|
TH2F *hAsym = new TH2F("hAsym", "Up vs Dn divide corrected back;Up/Back E;Dn/Back E",
|
||||||
|
400, 0.0, 1.0, 400, 0.0, 1.0);
|
||||||
|
TH2F *hAsymUnorm = new TH2F("hAsymUnorm", "Up vs Dn;Up E;Dn E",
|
||||||
|
800, 0.0, 4000.0, 800, 0.0, 4000.0);
|
||||||
|
|
||||||
|
// Fill histograms using corrected back energies
|
||||||
|
for (const auto &kv : dataPoints)
|
||||||
|
{
|
||||||
|
auto [id, bk, u, d] = kv.first;
|
||||||
|
if (!backSlopeValid[id][bk])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
double slope = backSlope[id][bk];
|
||||||
|
|
||||||
|
for (const auto &pr : kv.second)
|
||||||
|
{
|
||||||
|
double eBk, eUp, eDn;
|
||||||
|
std::tie(eBk, eUp, eDn) = pr;
|
||||||
|
|
||||||
|
double updn = eUp + eDn;
|
||||||
|
if (updn == 0 || eBk == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
double correctedBack = eBk * slope;
|
||||||
|
double asym = (eUp - eDn) / updn;
|
||||||
|
|
||||||
|
hFVB->Fill(updn, correctedBack);
|
||||||
|
hAsym->Fill(eUp / correctedBack, eDn / correctedBack);
|
||||||
|
hAsymUnorm->Fill(eUp, eDn);
|
||||||
|
TString histNamex = Form("CorrBack_id%d_U%d-D%dvsB%d", id, u, d, bk);
|
||||||
|
|
||||||
|
TH2F *hist2dx = (TH2F *)gDirectory->Get(histNamex);
|
||||||
|
if (!hist2dx)
|
||||||
|
{
|
||||||
|
hist2dx = new TH2F(histNamex, histNamex,
|
||||||
|
800, -1, 1, 800, 0, 4000);
|
||||||
|
}
|
||||||
|
|
||||||
|
hist2dx->Fill((eUp - eDn) / (eUp + eDn), correctedBack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// plotter.FlushToDisk();
|
||||||
|
}
|
||||||
114
anasen_analysis_vignesh/GainMatchSX3.h
Normal file
114
anasen_analysis_vignesh/GainMatchSX3.h
Normal file
|
|
@ -0,0 +1,114 @@
|
||||||
|
#ifndef GainMatchSX3_h
|
||||||
|
#define GainMatchSX3_h
|
||||||
|
|
||||||
|
#include <TROOT.h>
|
||||||
|
#include <TChain.h>
|
||||||
|
#include <TFile.h>
|
||||||
|
#include <TSelector.h>
|
||||||
|
|
||||||
|
#include "Armory/ClassDet.h"
|
||||||
|
|
||||||
|
class GainMatchSX3 : 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; //!
|
||||||
|
|
||||||
|
GainMatchSX3(TTree * /*tree*/ =0) : fChain(0) { }
|
||||||
|
virtual ~GainMatchSX3() { }
|
||||||
|
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(GainMatchSX3,0);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GainMatchSX3_cxx
|
||||||
|
void GainMatchSX3::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 GainMatchSX3::Notify(){
|
||||||
|
|
||||||
|
return kTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GainMatchSX3::SlaveBegin(TTree * /*tree*/){
|
||||||
|
|
||||||
|
TString option = GetOption();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GainMatchSX3::SlaveTerminate(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // #ifdef GainMatchSX3_cxx
|
||||||
420
anasen_analysis_vignesh/GainMatchSX3Front.C
Normal file
420
anasen_analysis_vignesh/GainMatchSX3Front.C
Normal file
|
|
@ -0,0 +1,420 @@
|
||||||
|
#define GainMatchSX3Front_cxx
|
||||||
|
|
||||||
|
#include "GainMatchSX3Front.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 <TProfile.h>
|
||||||
|
#include "Armory/ClassSX3.h"
|
||||||
|
#include "TGraphErrors.h"
|
||||||
|
#include "TMultiDimFit.h"
|
||||||
|
|
||||||
|
#include "TVector3.h"
|
||||||
|
|
||||||
|
TH2F *hSX3FvsB;
|
||||||
|
TH2F *hSX3FvsB_g;
|
||||||
|
TH2F *hsx3IndexVE;
|
||||||
|
TH2F *hsx3IndexVE_g;
|
||||||
|
TH2F *hSX3;
|
||||||
|
TH2F *hsx3Coin;
|
||||||
|
|
||||||
|
int padID = 0;
|
||||||
|
|
||||||
|
SX3 sx3_contr;
|
||||||
|
TCutG *cut;
|
||||||
|
TCutG *cut1;
|
||||||
|
std::map<std::tuple<int, int, int, int>, std::vector<std::tuple<double, double, double>>> dataPoints;
|
||||||
|
TCanvas c(Form("canvas"), "Fit", 800, 600);
|
||||||
|
|
||||||
|
// Gain 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}}}};
|
||||||
|
double uvdslope[MAX_DET][MAX_BK][MAX_UP][MAX_DOWN] = {{{{0}}}};
|
||||||
|
// ==== Configuration Flags ====
|
||||||
|
const bool interactiveMode = true; // If true: show canvas + wait for user
|
||||||
|
const bool verboseFit = true; // If true: print fit summary and chi²
|
||||||
|
const bool drawCanvases = true; // If false: canvases won't be drawn at all
|
||||||
|
|
||||||
|
void GainMatchSX3Front::Begin(TTree * /*tree*/)
|
||||||
|
{
|
||||||
|
TString option = GetOption();
|
||||||
|
|
||||||
|
hSX3FvsB = new TH2F("hSX3FvsB", "SX3 Front vs Back; Front E; Back E", 800, 0, 16000, 800, 0, 16000);
|
||||||
|
hSX3FvsB_g = new TH2F("hSX3FvsB_g", "SX3 Front vs Back; Front E; Back E", 800, 0, 16000, 800, 0, 16000);
|
||||||
|
hsx3IndexVE = new TH2F("hsx3IndexVE", "SX3 index vs Energy; sx3 index ; Energy", 24 * 12, 0, 24 * 12, 400, 0, 5000);
|
||||||
|
hsx3IndexVE_g = new TH2F("hsx3IndexVE_g", "SX3 index vs Energy; sx3 index ; Energy", 24 * 12, 0, 24 * 12, 400, 0, 5000);
|
||||||
|
hSX3 = new TH2F("hSX3", "SX3 Front v Back; Fronts; Backs", 8, 0, 8, 4, 0, 4);
|
||||||
|
|
||||||
|
hsx3Coin = new TH2F("hsx3Coin", "SX3 Coincident", 24 * 12, 0, 24 * 12, 24 * 12, 0, 24 * 12);
|
||||||
|
|
||||||
|
sx3_contr.ConstructGeo();
|
||||||
|
|
||||||
|
// Load the TCutG object
|
||||||
|
TFile *cutFile = TFile::Open("sx3cut.root");
|
||||||
|
bool cutLoaded = (cut != nullptr);
|
||||||
|
cut = dynamic_cast<TCutG *>(cutFile->Get("sx3cut"));
|
||||||
|
if (!cut)
|
||||||
|
{
|
||||||
|
std::cerr << "Error: Could not find TCutG named 'sx3cut' in sx3cut.root" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cut->SetName("sx3cut"); // Ensure the cut has the correct name
|
||||||
|
|
||||||
|
// Load the TCutG object
|
||||||
|
TFile *cutFile1 = TFile::Open("UvD.root");
|
||||||
|
bool cut1Loaded = (cut1 != nullptr);
|
||||||
|
cut1 = dynamic_cast<TCutG *>(cutFile1->Get("UvD"));
|
||||||
|
if (!cut1)
|
||||||
|
{
|
||||||
|
std::cerr << "Error: Could not find TCutG named 'UvD' in UvD.root" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cut1->SetName("UvD");
|
||||||
|
|
||||||
|
std::string filename = "sx3_BackGains.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
SX3 sx3_contr;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool_t GainMatchSX3Front::Process(Long64_t entry)
|
||||||
|
{
|
||||||
|
|
||||||
|
b_sx3Multi->GetEntry(entry);
|
||||||
|
b_sx3ID->GetEntry(entry);
|
||||||
|
b_sx3Ch->GetEntry(entry);
|
||||||
|
b_sx3E->GetEntry(entry);
|
||||||
|
b_sx3T->GetEntry(entry);
|
||||||
|
|
||||||
|
sx3.CalIndex();
|
||||||
|
|
||||||
|
std::vector<std::pair<int, int>> ID;
|
||||||
|
for (int i = 0; i < sx3.multi; i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
for (int j = i + 1; j < sx3.multi; j++)
|
||||||
|
{
|
||||||
|
// if (sx3.id[i] == 3)
|
||||||
|
hsx3Coin->Fill(sx3.index[i], sx3.index[j]);
|
||||||
|
}
|
||||||
|
if (sx3.e[i] > 100)
|
||||||
|
{
|
||||||
|
ID.push_back(std::pair<int, int>(sx3.id[i], i));
|
||||||
|
hsx3IndexVE->Fill(sx3.index[i], sx3.e[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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; });
|
||||||
|
|
||||||
|
// start with the first entry in the sorted array: channels that belong to the same detector are together in sequenmce
|
||||||
|
std::vector<std::pair<int, int>> sx3ID;
|
||||||
|
sx3ID.push_back(ID[0]);
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
|
for (size_t i = 1; i < ID.size(); i++)
|
||||||
|
{ // Check if id of i belongs to the same detector and then add it to the detector ID vector
|
||||||
|
if (ID[i].first == sx3ID.back().first)
|
||||||
|
{ // count the nunmber of hits that belong to the same detector
|
||||||
|
sx3ID.push_back(ID[i]);
|
||||||
|
|
||||||
|
if (sx3ID.size() >= 3)
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // the next event does not belong to the same detector, abandon the first event and continue with the next one
|
||||||
|
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;
|
||||||
|
// Check the channel number and assign it to the appropriate channel type
|
||||||
|
if (sx3.ch[index] < 8)
|
||||||
|
{
|
||||||
|
if (sx3.ch[index] % 2 == 0)
|
||||||
|
{
|
||||||
|
sx3ChDn = sx3.ch[index] / 2;
|
||||||
|
sx3EDn = sx3.e[index];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sx3ChUp = sx3.ch[index] / 2;
|
||||||
|
sx3EUp = sx3.e[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sx3ChBk = sx3.ch[index] - 8;
|
||||||
|
// if (sx3ChBk == 2)
|
||||||
|
// printf("Found back channel Det %d Back %d \n", sx3.id[index], sx3ChBk);
|
||||||
|
sx3EBk = sx3.e[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < sx3.multi; i++)
|
||||||
|
{
|
||||||
|
// If we have a valid front and back channel, fill the histograms
|
||||||
|
hSX3->Fill(sx3ChDn + 4, sx3ChBk);
|
||||||
|
hSX3->Fill(sx3ChUp, sx3ChBk);
|
||||||
|
|
||||||
|
// Fill the histogram for the front vs back
|
||||||
|
hSX3FvsB->Fill(sx3EUp + sx3EDn, sx3EBk);
|
||||||
|
|
||||||
|
if (sx3.e[i] > 100 && sx3.id[i] == 3)
|
||||||
|
{
|
||||||
|
// back gain correction
|
||||||
|
|
||||||
|
// Fill the histogram for the front vs back with gain correction
|
||||||
|
// hSX3FvsB_g->Fill(sx3EUp + sx3EDn, sx3EBk);
|
||||||
|
// // Fill the index vs energy histogram
|
||||||
|
// hsx3IndexVE_g->Fill(sx3.index[i], sx3.e[i]);
|
||||||
|
// }
|
||||||
|
// {
|
||||||
|
TString histName = Form("hSX3FVB_id%d_U%d_D%d_B%d", sx3.id[i], sx3ChUp, sx3ChDn, sx3ChBk);
|
||||||
|
TH2F *hist2d = (TH2F *)gDirectory->Get(histName);
|
||||||
|
if (!hist2d)
|
||||||
|
{
|
||||||
|
hist2d = new TH2F(histName, Form("hSX3FVB_id%d_U%d_D%d_B%d", sx3.id[i], sx3ChUp, sx3ChDn, sx3ChBk), 400, 0, 16000, 400, 0, 16000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (sx3ChBk == 2)
|
||||||
|
// printf("Found back channel Det %d Back %d \n", sx3.id[i], sx3ChBk);
|
||||||
|
hsx3IndexVE_g->Fill(sx3.index[i], sx3.e[i]);
|
||||||
|
hSX3FvsB_g->Fill(sx3EUp + sx3EDn, sx3EBk);
|
||||||
|
|
||||||
|
hist2d->Fill(sx3EUp + sx3EDn, sx3EBk);
|
||||||
|
|
||||||
|
if (cut && cut->IsInside(sx3EUp + sx3EDn, sx3EBk) && cut1 && cut1->IsInside(sx3EUp / sx3EBk, sx3EDn / sx3EBk))
|
||||||
|
{
|
||||||
|
|
||||||
|
if (backGainValid[sx3.id[i]][sx3ChBk])
|
||||||
|
{
|
||||||
|
sx3EBk *= backGain[sx3.id[i]][sx3ChBk];
|
||||||
|
}
|
||||||
|
// Accumulate data for gain matching
|
||||||
|
dataPoints[{sx3.id[i], sx3ChBk, sx3ChUp, sx3ChDn}].emplace_back(sx3EBk, sx3EUp, sx3EDn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return kTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GainMatchSX3Front::Terminate()
|
||||||
|
{
|
||||||
|
|
||||||
|
std::map<std::tuple<int, int, int, int>, TVectorD> fitCoefficients;
|
||||||
|
|
||||||
|
// === Gain matching ===
|
||||||
|
|
||||||
|
std::ofstream outFile("sx3_GainMatchfront.txt");
|
||||||
|
if (!outFile.is_open())
|
||||||
|
{
|
||||||
|
std::cerr << "Error opening output file!" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TH2F *hUvD = new TH2F("hUvD", " UvD; Up/CorrBack; Down/CorrBack", 600, 0, 1, 600, 0, 1);
|
||||||
|
|
||||||
|
for (const auto &kv : dataPoints)
|
||||||
|
{
|
||||||
|
auto [id, bk, u, d] = kv.first;
|
||||||
|
const auto &pts = kv.second;
|
||||||
|
|
||||||
|
if (pts.size() < 50)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
std::vector<double> uE, dE, udE, corrBkE;
|
||||||
|
|
||||||
|
for (const auto &pr : pts)
|
||||||
|
{
|
||||||
|
double eBkCorr, eUp, eDn;
|
||||||
|
std::tie(eBkCorr, eUp, eDn) = pr;
|
||||||
|
if ((eBkCorr < 100) || (eUp < 100) || (eDn < 100))
|
||||||
|
continue; // Skip if any energy is zero
|
||||||
|
uE.push_back(eUp / eBkCorr);
|
||||||
|
dE.push_back(eDn / eBkCorr);
|
||||||
|
udE.push_back(eUp + eDn);
|
||||||
|
corrBkE.push_back(eBkCorr);
|
||||||
|
hUvD->Fill(eUp / eBkCorr, eDn / eBkCorr);
|
||||||
|
}
|
||||||
|
if (uE.size() < 5 || dE.size() < 5 || corrBkE.size() < 5)
|
||||||
|
continue; // Ensure we have enough points for fitting
|
||||||
|
// TGraph g(udE.size(), udE.data(), corrBkE.data());
|
||||||
|
|
||||||
|
// TF1 f("f", "[0]*x", 0, 20000);
|
||||||
|
// f.SetParameter(0, 1.0); // Initial guess for the gain
|
||||||
|
// g.Fit(&f, "R");
|
||||||
|
|
||||||
|
const double fixedError = 0.0; // in ADC channels
|
||||||
|
|
||||||
|
std::vector<double> xVals, yVals, exVals, eyVals;
|
||||||
|
|
||||||
|
// Build data with fixed error
|
||||||
|
for (size_t i = 0; i < udE.size(); ++i)
|
||||||
|
{
|
||||||
|
double x = uE[i]; // front energy
|
||||||
|
double y = dE[i]; // back energy
|
||||||
|
|
||||||
|
xVals.push_back(x);
|
||||||
|
yVals.push_back(y);
|
||||||
|
exVals.push_back(fixedError); // error in up energy
|
||||||
|
eyVals.push_back(0.); // error in down energy
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build TGraphErrors with errors
|
||||||
|
TGraphErrors g(xVals.size(), xVals.data(), yVals.data(), exVals.data(), eyVals.data());
|
||||||
|
|
||||||
|
TF1 f("f", "[0]*x+[1]", 0, 16000);
|
||||||
|
f.SetParameter(0, -1.0); // Initial guess
|
||||||
|
|
||||||
|
if (drawCanvases)
|
||||||
|
{
|
||||||
|
g.SetTitle(Form("Detector %d: U%d D%d B%d", id, u, d, bk));
|
||||||
|
g.SetMarkerStyle(20);
|
||||||
|
g.SetMarkerColor(kBlue);
|
||||||
|
g.Draw("AP");
|
||||||
|
|
||||||
|
g.Fit(&f, interactiveMode ? "Q" : "QNR"); // 'R' avoids refit, 'N' skips drawing
|
||||||
|
|
||||||
|
if (verboseFit)
|
||||||
|
{
|
||||||
|
double chi2 = f.GetChisquare();
|
||||||
|
int ndf = f.GetNDF();
|
||||||
|
double reducedChi2 = (ndf != 0) ? chi2 / ndf : -1;
|
||||||
|
|
||||||
|
std::cout << Form("Det%d U%d D%d B%d → Gain: %.4f | χ²/ndf = %.2f/%d = %.2f",
|
||||||
|
id, u, d, bk, f.GetParameter(0), chi2, ndf, reducedChi2)
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (interactiveMode)
|
||||||
|
{
|
||||||
|
c.Update();
|
||||||
|
gPad->WaitPrimitive();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
c.Close(); // Optionally avoid clutter in batch
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g.Fit(&f, "QNR");
|
||||||
|
}
|
||||||
|
|
||||||
|
double slope = f.GetParameter(0);
|
||||||
|
double intercept = f.GetParameter(1);
|
||||||
|
|
||||||
|
// printf("Front gain Det%d Back%d Up%dDn%d → %.4f\n", id, bk, u, d, frontGain[id][bk][u][d]);
|
||||||
|
if (std::abs(slope + 1.0) < 0.3) // sanity check
|
||||||
|
{
|
||||||
|
frontGain[id][bk][u][d] = slope;
|
||||||
|
|
||||||
|
frontGainValid[id][bk][u][d] = true;
|
||||||
|
outFile << id << " " << bk << " " << u << " " << d << " " << TMath::Abs(slope)/intercept << " " << 1.0/intercept << std::endl;
|
||||||
|
printf("Back slope Det%d Bk%d → %.4f\n", id, bk, slope);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "Warning: Bad slope for Det" << id << " Bk" << bk
|
||||||
|
<< " slope=" << f.GetParameter(0) << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
outFile.close();
|
||||||
|
std::cout << "Gain matching complete." << std::endl;
|
||||||
|
|
||||||
|
// === Stage 3: Create corrected histogram ===
|
||||||
|
TH2F *hCorrectedFvB = new TH2F("hCorrectedFvB", "Corrected;Corrected Front Sum;Corrected Back", 800, 0, 8000, 800, 0, 8000);
|
||||||
|
TH2F *hCorrectedUvD = new TH2F("hCorrectedUvD", "Corrected UvD; UvD Up; UvD Down", 600, 0, 1, 600, 0, 1);
|
||||||
|
|
||||||
|
for (const auto &kv : dataPoints)
|
||||||
|
{
|
||||||
|
|
||||||
|
auto [id, bk, u, d] = kv.first;
|
||||||
|
double front;
|
||||||
|
if (frontGainValid[id][bk][u][d])
|
||||||
|
front = frontGain[id][bk][u][d];
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
for (const auto &pr : kv.second)
|
||||||
|
{
|
||||||
|
double eBk, eUp, eDn;
|
||||||
|
std::tie(eBk, eUp, eDn) = pr;
|
||||||
|
double corrUp = eUp * front;
|
||||||
|
// double corrDn = eDn * front;
|
||||||
|
|
||||||
|
hCorrectedFvB->Fill(corrUp + eDn, eBk);
|
||||||
|
hCorrectedUvD->Fill(corrUp / eBk, eDn / eBk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// // === Final canvas ===
|
||||||
|
// gStyle->SetOptStat(1110);
|
||||||
|
// TCanvas *c1 = new TCanvas("c1", "Gain Correction Results", 1200, 600);
|
||||||
|
// c1->Divide(2, 1);
|
||||||
|
|
||||||
|
// c1->cd(1);
|
||||||
|
// hSX3FvsB_g->SetTitle("Before Correction (Gated)");
|
||||||
|
// hSX3FvsB_g->GetXaxis()->SetTitle("Measured Front Sum (E_Up + E_Dn)");
|
||||||
|
// hSX3FvsB_g->GetYaxis()->SetTitle("Measured Back E");
|
||||||
|
// hSX3FvsB_g->Draw("colz");
|
||||||
|
|
||||||
|
// c1->cd(2);
|
||||||
|
// hCorrectedFvB->SetTitle("After Correction");
|
||||||
|
// hCorrectedFvB->Draw("colz");
|
||||||
|
// TF1 *diag = new TF1("diag", "x", 0, 40000);
|
||||||
|
// diag->SetLineColor(kRed);
|
||||||
|
// diag->SetLineWidth(2);
|
||||||
|
// diag->Draw("same");
|
||||||
|
|
||||||
|
std::cout << "Terminate() completed successfully." << std::endl;
|
||||||
|
}
|
||||||
104
anasen_analysis_vignesh/GainMatchSX3Front.h
Normal file
104
anasen_analysis_vignesh/GainMatchSX3Front.h
Normal file
|
|
@ -0,0 +1,104 @@
|
||||||
|
#ifndef GainMatchSX3Front_h
|
||||||
|
#define GainMatchSX3Front_h
|
||||||
|
|
||||||
|
#include <TROOT.h>
|
||||||
|
#include <TChain.h>
|
||||||
|
#include <TFile.h>
|
||||||
|
#include <TSelector.h>
|
||||||
|
|
||||||
|
#include "Armory/ClassDet.h"
|
||||||
|
|
||||||
|
class GainMatchSX3Front : 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; //!
|
||||||
|
|
||||||
|
GainMatchSX3Front(TTree * /*tree*/ =0) : fChain(0) { }
|
||||||
|
virtual ~GainMatchSX3Front() { }
|
||||||
|
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(GainMatchSX3Front,0);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GainMatchSX3Front_cxx
|
||||||
|
void GainMatchSX3Front::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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool_t GainMatchSX3Front::Notify(){
|
||||||
|
|
||||||
|
return kTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GainMatchSX3Front::SlaveBegin(TTree * /*tree*/){
|
||||||
|
|
||||||
|
TString option = GetOption();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GainMatchSX3Front::SlaveTerminate(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // #ifdef GainMatchSX3Front_cxx
|
||||||
245
anasen_analysis_vignesh/GainMatchSX3Front1.C
Normal file
245
anasen_analysis_vignesh/GainMatchSX3Front1.C
Normal file
|
|
@ -0,0 +1,245 @@
|
||||||
|
#define GainMatchSX3_cxx
|
||||||
|
|
||||||
|
#include "GainMatchSX3.h"
|
||||||
|
#include "Armory/ClassSX3.h"
|
||||||
|
#include <TFile.h>
|
||||||
|
#include <TTree.h>
|
||||||
|
#include <TGraph.h>
|
||||||
|
#include <TF1.h>
|
||||||
|
#include <TH2F.h>
|
||||||
|
#include <TCanvas.h>
|
||||||
|
#include <TStyle.h>
|
||||||
|
#include <TApplication.h>
|
||||||
|
#include <map>
|
||||||
|
#include <vector>
|
||||||
|
#include <tuple>
|
||||||
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
const int MAX_DET = 24;
|
||||||
|
const int MAX_BK = 4;
|
||||||
|
const int MAX_UP = 4;
|
||||||
|
const int MAX_DOWN = 4;
|
||||||
|
|
||||||
|
// Gain arrays
|
||||||
|
double backGain[MAX_DET][MAX_BK][MAX_UP][MAX_DOWN] = {{{{0}}}};
|
||||||
|
bool backGainValid[MAX_DET][MAX_BK][MAX_UP][MAX_DOWN] = {{{{false}}}};
|
||||||
|
|
||||||
|
double frontGain[MAX_DET][MAX_BK][MAX_UP][MAX_DOWN] = {{{{0}}}};
|
||||||
|
bool frontGainValid[MAX_DET][MAX_BK][MAX_UP][MAX_DOWN] = {{{{false}}}};
|
||||||
|
|
||||||
|
// Data container
|
||||||
|
std::map<std::tuple<int, int, int, int>, std::vector<std::tuple<double, double, double>>> dataPoints;
|
||||||
|
|
||||||
|
// Load back gains
|
||||||
|
void LoadBackGains(const std::string &filename)
|
||||||
|
{
|
||||||
|
std::ifstream infile(filename);
|
||||||
|
if (!infile.is_open())
|
||||||
|
{
|
||||||
|
std::cerr << "Error opening " << filename << "!" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int id, bk, u, d;
|
||||||
|
double gain;
|
||||||
|
while (infile >> id >> bk >> u >> d >> gain)
|
||||||
|
{
|
||||||
|
backGain[id][bk][u][d] = gain;
|
||||||
|
backGainValid[id][bk][u][d] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
infile.close();
|
||||||
|
std::cout << "Loaded back gains from " << filename << std::endl;
|
||||||
|
SX3 sx3_contr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Front gain matching function
|
||||||
|
Bool_t GainMatchSX3::Process(Long64_t entry)
|
||||||
|
{
|
||||||
|
// Link SX3 branches
|
||||||
|
|
||||||
|
b_sx3Multi->GetEntry(entry);
|
||||||
|
b_sx3ID->GetEntry(entry);
|
||||||
|
b_sx3Ch->GetEntry(entry);
|
||||||
|
b_sx3E->GetEntry(entry);
|
||||||
|
b_sx3T->GetEntry(entry);
|
||||||
|
|
||||||
|
sx3.CalIndex();
|
||||||
|
|
||||||
|
Long64_t nentries = tree->GetEntries(Long64_t entry);
|
||||||
|
std::cout << "Total entries: " << nentries << std::endl;
|
||||||
|
|
||||||
|
TH2F *hBefore = new TH2F("hBefore", "Before Correction;E_Up+E_Dn;Back Energy", 400, 0, 40000, 400, 0, 40000);
|
||||||
|
TH2F *hAfter = new TH2F("hAfter", "After Correction;E_Up+E_Dn;Corrected Back Energy", 400, 0, 40000, 400, 0, 40000);
|
||||||
|
|
||||||
|
for (Long64_t entry = 0; entry < nentries; ++entry)
|
||||||
|
{
|
||||||
|
tree->GetEntry(entry);
|
||||||
|
sx3.CalIndex();
|
||||||
|
|
||||||
|
std::vector<std::pair<int, int>> ID;
|
||||||
|
|
||||||
|
for (int i = 0; i < sx3.multi; i++)
|
||||||
|
{
|
||||||
|
if (sx3.e[i] > 100)
|
||||||
|
{
|
||||||
|
ID.push_back({sx3.id[i], i});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ID.empty())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Sort by id
|
||||||
|
std::sort(ID.begin(), ID.end(), [](auto &a, auto &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)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
int sx3ChUp = -1, sx3ChDn = -1, sx3ChBk = -1;
|
||||||
|
float sx3EUp = 0.0, sx3EDn = 0.0, sx3EBk = 0.0;
|
||||||
|
int sx3id = sx3ID[0].first;
|
||||||
|
|
||||||
|
for (auto &[id, idx] : sx3ID)
|
||||||
|
{
|
||||||
|
if (sx3.ch[idx] < 8)
|
||||||
|
{
|
||||||
|
if (sx3.ch[idx] % 2 == 0)
|
||||||
|
{
|
||||||
|
sx3ChDn = sx3.ch[idx] / 2;
|
||||||
|
sx3EDn = sx3.e[idx];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sx3ChUp = sx3.ch[idx] / 2;
|
||||||
|
sx3EUp = sx3.e[idx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sx3ChBk = sx3.ch[idx] - 8;
|
||||||
|
sx3EBk = sx3.e[idx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sx3ChUp < 0 || sx3ChDn < 0 || sx3ChBk < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!backGainValid[sx3id][sx3ChBk][sx3ChUp][sx3ChDn])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
double corrBk = sx3EBk * backGain[sx3id][sx3ChBk][sx3ChUp][sx3ChDn];
|
||||||
|
|
||||||
|
hBefore->Fill(sx3EUp + sx3EDn, sx3EBk);
|
||||||
|
hAfter->Fill(sx3EUp + sx3EDn, corrBk);
|
||||||
|
|
||||||
|
dataPoints[{sx3id, sx3ChBk, sx3ChUp, sx3ChDn}].emplace_back(corrBk, sx3EUp, sx3EDn);
|
||||||
|
}
|
||||||
|
|
||||||
|
// === Fit front gains ===
|
||||||
|
std::ofstream outFile("sx3_GainMatchfront.txt");
|
||||||
|
if (!outFile.is_open())
|
||||||
|
{
|
||||||
|
std::cerr << "Error opening sx3_GainMatchfront.txt!" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto &kv : dataPoints)
|
||||||
|
{
|
||||||
|
auto [id, bk, u, d] = kv.first;
|
||||||
|
const auto &pts = kv.second;
|
||||||
|
|
||||||
|
if (pts.size() < 5)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
std::vector<double> udE, corrBkE;
|
||||||
|
|
||||||
|
for (const auto &pr : pts)
|
||||||
|
{
|
||||||
|
double eBkCorr, eUp, eDn;
|
||||||
|
std::tie(eBkCorr, eUp, eDn) = pr;
|
||||||
|
udE.push_back(eUp + eDn);
|
||||||
|
corrBkE.push_back(eBkCorr);
|
||||||
|
}
|
||||||
|
|
||||||
|
TGraph g(udE.size(), udE.data(), corrBkE.data());
|
||||||
|
TF1 f("f", "[0]*x", 0, 40000);
|
||||||
|
g.Fit(&f, "QNR");
|
||||||
|
|
||||||
|
frontGain[id][bk][u][d] = f.GetParameter(0);
|
||||||
|
frontGainValid[id][bk][u][d] = true;
|
||||||
|
|
||||||
|
outFile << id << " " << bk << " " << u << " " << d << " " << frontGain[id][bk][u][d] << std::endl;
|
||||||
|
printf("Front gain Det%d Back%d Up%dDn%d → %.4f\n", id, bk, u, d, frontGain[id][bk][u][d]);
|
||||||
|
}
|
||||||
|
|
||||||
|
outFile.close();
|
||||||
|
std::cout << "Front gain matching complete." << std::endl;
|
||||||
|
|
||||||
|
// === Draw diagnostic plots ===
|
||||||
|
gStyle->SetOptStat(1110);
|
||||||
|
TCanvas *c = new TCanvas("c", "Gain Matching Diagnostics", 1200, 600);
|
||||||
|
c->Divide(2, 1);
|
||||||
|
|
||||||
|
c->cd(1);
|
||||||
|
hBefore->Draw("colz");
|
||||||
|
TF1 *diag1 = new TF1("diag1", "x", 0, 40000);
|
||||||
|
diag1->SetLineColor(kRed);
|
||||||
|
diag1->Draw("same");
|
||||||
|
|
||||||
|
c->cd(2);
|
||||||
|
hAfter->Draw("colz");
|
||||||
|
TF1 *diag2 = new TF1("diag2", "x", 0, 40000);
|
||||||
|
diag2->SetLineColor(kRed);
|
||||||
|
diag2->Draw("same");
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
TApplication app("app", &argc, argv);
|
||||||
|
|
||||||
|
// Load back gains
|
||||||
|
LoadBackGains("sx3_GainMatchback.txt");
|
||||||
|
|
||||||
|
// Open tree
|
||||||
|
TFile *f = TFile::Open("input_tree.root"); // <<< Change file name
|
||||||
|
if (!f || f->IsZombie())
|
||||||
|
{
|
||||||
|
std::cerr << "Cannot open input_tree.root!" << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
TTree *tree = (TTree *)f->Get("tree");
|
||||||
|
if (!tree)
|
||||||
|
{
|
||||||
|
std::cerr << "Tree not found!" << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run front gain matching
|
||||||
|
GainMatchSX3(tree);
|
||||||
|
|
||||||
|
app.Run();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
1470
anasen_analysis_vignesh/MakeVertex.C
Normal file
1470
anasen_analysis_vignesh/MakeVertex.C
Normal file
File diff suppressed because it is too large
Load Diff
144
anasen_analysis_vignesh/MakeVertex.h
Normal file
144
anasen_analysis_vignesh/MakeVertex.h
Normal file
|
|
@ -0,0 +1,144 @@
|
||||||
|
#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; //!
|
||||||
|
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
|
||||||
|
void MakeAnalysisHistograms();
|
||||||
|
void MakeDiagnosticHistograms();
|
||||||
|
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);*/
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool_t MakeVertex::Notify() {
|
||||||
|
return kTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MakeVertex::SlaveBegin(TTree * /*tree*/) {
|
||||||
|
// TString option = GetOption();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MakeVertex::SlaveTerminate() {
|
||||||
|
}
|
||||||
|
#endif // #ifdef MakeVertex_cxx
|
||||||
958
anasen_analysis_vignesh/MakeVertexSX3.C
Normal file
958
anasen_analysis_vignesh/MakeVertexSX3.C
Normal file
|
|
@ -0,0 +1,958 @@
|
||||||
|
#define MakeVertexSX3_cxx
|
||||||
|
|
||||||
|
#include "MakeVertexSX3.h"
|
||||||
|
#include "Armory/ClassPW.h"
|
||||||
|
#include "Armory/HistPlotter.h"
|
||||||
|
#include "Armory/SX3Geom.h"
|
||||||
|
|
||||||
|
#include <TH2.h>
|
||||||
|
#include <TStyle.h>
|
||||||
|
#include <TCanvas.h>
|
||||||
|
#include <TMath.h>
|
||||||
|
#include <TBranch.h>
|
||||||
|
#include "TVector3.h"
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <vector>
|
||||||
|
#include <array>
|
||||||
|
#include <map>
|
||||||
|
#include <utility>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
// Global instances
|
||||||
|
PW pw_contr;
|
||||||
|
PW pwinstance;
|
||||||
|
TVector3 hitPos;
|
||||||
|
double qqqenergy, qqqtimestamp;
|
||||||
|
class Event {
|
||||||
|
public:
|
||||||
|
Event(TVector3 p, double e1, double e2, double t1, double t2) : pos(p), Energy1(e1), Energy2(e2), Time1(t1), Time2(t2) {}
|
||||||
|
Event(TVector3 p, double e1, double e2, double t1, double t2, int c1, int c2) : pos(p), Energy1(e1), Energy2(e2), Time1(t1), Time2(t2), ch1(c1), ch2(c2) {}
|
||||||
|
|
||||||
|
TVector3 pos;
|
||||||
|
int ch1=-1; //int(ch1/16) gives qqq id, ch1%16 gives ring#
|
||||||
|
int ch2=-1; //int(ch2/16) gives qqq id, ch2%16 gives wedge#
|
||||||
|
double Energy1=-1; //Front for QQQ, Anode for PC
|
||||||
|
double Energy2=-1; //Back for QQQ, Cathode for PC
|
||||||
|
double Time1=-1;
|
||||||
|
double Time2=-1;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// Calibration globals
|
||||||
|
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}}};
|
||||||
|
// TCutg *cutQQQ;
|
||||||
|
|
||||||
|
double sx3BackGain[24][4][4] = {{{1.}}};
|
||||||
|
double sx3FrontGain[24][4] = {{1.}};
|
||||||
|
double sx3FrontOffset[24][4] = {{0.}};
|
||||||
|
double sx3RightGain[24][4] = {{1.}};
|
||||||
|
|
||||||
|
// PC Arrays
|
||||||
|
double pcSlope[48];
|
||||||
|
double pcIntercept[48];
|
||||||
|
|
||||||
|
HistPlotter *plotter;
|
||||||
|
|
||||||
|
bool HitNonZero;
|
||||||
|
bool sx3ecut;
|
||||||
|
bool qqqEcut;
|
||||||
|
|
||||||
|
void MakeVertexSX3::Begin(TTree * /*tree*/)
|
||||||
|
{
|
||||||
|
TString option = GetOption();
|
||||||
|
plotter = new HistPlotter("Analyzer_SX3.root", "TFILE");
|
||||||
|
pw_contr.ConstructGeo();
|
||||||
|
pwinstance.ConstructGeo();
|
||||||
|
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
// 1. CRITICAL FIX: Initialize PC Arrays to Default (Raw)
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
for (int i = 0; i < 48; i++)
|
||||||
|
{
|
||||||
|
pcSlope[i] = 1.0; // Default slope = 1 (preserves Raw energy)
|
||||||
|
pcIntercept[i] = 0.0; // Default intercept = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate Crossover Geometry ONCE
|
||||||
|
TVector3 a, c, diff;
|
||||||
|
double a2, ac, c2, adiff, cdiff, denom, alpha;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < pwinstance.An.size(); i++)
|
||||||
|
{
|
||||||
|
a = pwinstance.An[i].first - pwinstance.An[i].second;
|
||||||
|
|
||||||
|
for (size_t 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);
|
||||||
|
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 = 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 || (i+j)%24 == 12)
|
||||||
|
{
|
||||||
|
Crossover[i][j][0].z = 9999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
Crossover[i][j][1].x = alpha;
|
||||||
|
Crossover[i][j][1].y = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load PC Calibrations
|
||||||
|
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;
|
||||||
|
if (index >= 0 && index <= 47)
|
||||||
|
{
|
||||||
|
pcSlope[index] = slope;
|
||||||
|
pcIntercept[index] = intercept;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inputFile.close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "Error opening slope_intercept.txt" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load QQQ Cuts from file
|
||||||
|
// {
|
||||||
|
// std::string filename = "QQQ_PCCut.root";
|
||||||
|
// TFile *cutFile = TFile::Open(filename.c_str(), "READ");
|
||||||
|
// if (cutFile && !cutFile->IsZombie())
|
||||||
|
// {
|
||||||
|
// cutQQQ = (TCutg *)cutFile->Get("cutQQQPC");
|
||||||
|
// if (cutQQQ)
|
||||||
|
// {
|
||||||
|
// std::cout << "Loaded QQQ PC cut from " << filename << std::endl;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// std::cerr << "Error: cutQQQPC not found in " << filename << std::endl;
|
||||||
|
// }
|
||||||
|
// cutFile->Close();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// ... (Load QQQ Gains and Calibs - same as before) ...
|
||||||
|
{
|
||||||
|
std::string filename = "qqq_GainMatch.dat";
|
||||||
|
std::ifstream infile(filename);
|
||||||
|
if (infile.is_open())
|
||||||
|
{
|
||||||
|
int det, ring, wedge;
|
||||||
|
double gainw, gainr;
|
||||||
|
while (infile >> det >> wedge >> ring >> gainw >> gainr)
|
||||||
|
{
|
||||||
|
qqqGain[det][wedge][ring] = gainw;
|
||||||
|
qqqGainValid[det][wedge][ring] = (gainw > 0);
|
||||||
|
// std::cout << "QQQ Gain Loaded: Det " << det << " Ring " << ring << " Wedge " << wedge << " GainW " << gainw << " GainR " << gainr << std::endl;
|
||||||
|
}
|
||||||
|
infile.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::string filename = "qqq_Calib.dat";
|
||||||
|
std::ifstream infile(filename);
|
||||||
|
if (infile.is_open())
|
||||||
|
{
|
||||||
|
int det, ring, wedge;
|
||||||
|
double slope;
|
||||||
|
while (infile >> det >> wedge >> ring >> slope)
|
||||||
|
{
|
||||||
|
qqqCalib[det][wedge][ring] = slope;
|
||||||
|
qqqCalibValid[det][wedge][ring] = (slope > 0);
|
||||||
|
// std::cout << "QQQ Calib Loaded: Det " << det << " Ring " << ring << " Wedge " << wedge << " Slope " << slope << std::endl;
|
||||||
|
}
|
||||||
|
infile.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
std::ifstream infile("sx3cal/backgains.dat");
|
||||||
|
std::string temp;
|
||||||
|
int backpos, frontpos, clkpos;
|
||||||
|
std::cout << "foo" << std::endl;
|
||||||
|
if (infile.is_open())
|
||||||
|
while(infile>>clkpos>>temp>>frontpos>>temp>>backpos>>sx3BackGain[clkpos][frontpos][backpos])
|
||||||
|
std::cout << sx3BackGain[clkpos][frontpos][backpos] << std::endl;
|
||||||
|
infile.close();
|
||||||
|
|
||||||
|
infile.open("sx3cal/frontgains.dat");
|
||||||
|
if (infile.is_open())
|
||||||
|
while(infile>>clkpos>>temp>>temp>>frontpos>>sx3FrontOffset[clkpos][frontpos]>>sx3FrontGain[clkpos][frontpos])
|
||||||
|
std::cout << sx3FrontOffset[clkpos][frontpos] << " " << sx3FrontGain[clkpos][frontpos] << std::endl;
|
||||||
|
infile.close();
|
||||||
|
|
||||||
|
infile.open("sx3cal/rightgains.dat");
|
||||||
|
if (infile.is_open())
|
||||||
|
while(infile>>clkpos>>frontpos>>temp>>sx3RightGain[clkpos][frontpos]) {
|
||||||
|
sx3RightGain[clkpos][frontpos]=TMath::Abs(sx3RightGain[clkpos][frontpos]);
|
||||||
|
}
|
||||||
|
infile.close();
|
||||||
|
|
||||||
|
}
|
||||||
|
std::cout << "aaa" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool_t MakeVertexSX3::Process(Long64_t entry)
|
||||||
|
{
|
||||||
|
hitPos.Clear();
|
||||||
|
qqqenergy = -1;
|
||||||
|
qqqtimestamp=-1;
|
||||||
|
HitNonZero = false;
|
||||||
|
bool qqq1000cut = false;
|
||||||
|
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();
|
||||||
|
|
||||||
|
std::vector<Event> sx3Events;
|
||||||
|
if(sx3.multi>1) {
|
||||||
|
std::array<sx3det,12> Fsx3;
|
||||||
|
//std::cout << "-----" << std::endl;
|
||||||
|
for(int i=0; i<sx3.multi; i++) {
|
||||||
|
if(sx3.id[i]>=12) continue;
|
||||||
|
int id = sx3.id[i];
|
||||||
|
if(sx3.ch[i]>=8) {
|
||||||
|
int sx3ch=sx3.ch[i]-8;
|
||||||
|
sx3ch=(sx3ch+3)%4;
|
||||||
|
if(sx3ch==0 || sx3ch==3) continue;
|
||||||
|
float value=sx3.e[i];
|
||||||
|
int gch = sx3.id[i]*4+(sx3.ch[i]-8);
|
||||||
|
Fsx3.at(id).fillevent("BACK",sx3ch,value);
|
||||||
|
Fsx3.at(id).ts = static_cast<double>(sx3.t[i]);
|
||||||
|
plotter->Fill2D("sx3backs_raw",100,0,100,800,0,4096,gch,sx3.e[i]);
|
||||||
|
} else {
|
||||||
|
int sx3ch=sx3.ch[i]/2;
|
||||||
|
double value=sx3.e[i];
|
||||||
|
if(sx3.ch[i]%2==0) {
|
||||||
|
Fsx3.at(id).fillevent("FRONT_L",sx3ch,value*sx3RightGain[id][sx3ch]);
|
||||||
|
} else {
|
||||||
|
Fsx3.at(id).fillevent("FRONT_R",sx3ch,value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(int id=0; id<12; id++) {
|
||||||
|
Fsx3.at(id).validate();
|
||||||
|
auto det = Fsx3.at(id);
|
||||||
|
bool no_charge_sharing_strict = det.valid_front_chans.size()==1 && det.valid_back_chans.size()==1;
|
||||||
|
if(det.valid) {
|
||||||
|
//std::cout << det.frontEL << " " << det.frontEL*sx3RightGain[id][det.stripF] << std::endl;
|
||||||
|
plotter->Fill2D("be_vs_x_sx3_id_"+std::to_string(id)+"_f"+std::to_string(det.stripF)+"_b"+std::to_string(det.stripB),200,-1,1,800,0,8192,
|
||||||
|
det.frontX,det.backE,"evsx");
|
||||||
|
//std::cout << sx3BackGain[id][det.stripF][det.stripB] << " " << sx3FrontGain[id][det.stripF] << std::endl;
|
||||||
|
plotter->Fill2D("matched_be_vs_x_sx3_id_"+std::to_string(id)+"_f"+std::to_string(det.stripF),200,-30,30,800,0,8192,
|
||||||
|
det.frontX*sx3FrontGain[id][det.stripF]+sx3FrontOffset[id][det.stripF],det.backE*sx3BackGain[id][det.stripF][det.stripB],"evsx_matched");
|
||||||
|
//plotter->Fill2D("fe_vs_x_sx3_id_"+std::to_string(id)+"_f"+std::to_string(det.stripF)+"_"+std::to_string(det.stripB),200,-1,1,800,0,4096,det.frontX,det.backE,"evsx");
|
||||||
|
plotter->Fill2D("l_vs_r_sx3_id_"+std::to_string(id)+"_f"+std::to_string(det.stripF),800,0,4096,800,0,4096,det.frontEL,det.frontER,"l_vs_r");
|
||||||
|
}
|
||||||
|
if(det.valid && (id ==9 || id==7 || id == 1 || id==3) && det.stripF!=DEFAULT_NULL && det.stripB!=DEFAULT_NULL) {
|
||||||
|
double z = det.frontX*sx3FrontGain[id][det.stripF]+sx3FrontOffset[id][det.stripF];
|
||||||
|
double backE = det.backE*sx3BackGain[id][det.stripF][det.stripB];
|
||||||
|
Event sx3ev(TVector3(0,0,z),backE,-1,det.ts,-1,det.stripB+4*id,det.stripF+4*id);
|
||||||
|
sx3Events.push_back(sx3ev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//return kTRUE;
|
||||||
|
// QQQ Processing
|
||||||
|
|
||||||
|
int qqqCount = 0;
|
||||||
|
int qqqAdjCh = 0;
|
||||||
|
// REMOVE WHEN RERUNNING USING THE NEW CALIBRATION FILE
|
||||||
|
for (int i = 0; i < qqq.multi; i++)
|
||||||
|
{
|
||||||
|
//if ((qqq.id[i] == 3 || qqq.id[i] == 1) && qqq.ch[i] < 16)
|
||||||
|
if (qqq.id[i] == 1 && qqq.ch[i] < 16) //for run 12, 26Al
|
||||||
|
{
|
||||||
|
qqq.ch[i] = 16 - qqq.ch[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < qqq.multi; i++)
|
||||||
|
{
|
||||||
|
if (qqq.id[i] == 0 && qqq.ch[i] >= 16)
|
||||||
|
{
|
||||||
|
qqq.ch[i] = 31 - qqq.ch[i] + 16;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<Event> QQQ_Events, PC_Events;
|
||||||
|
std::vector<Event> QQQ_Events_Raw, PC_Events_Raw;
|
||||||
|
std::vector<Event> QQQ_Events2; //clustering done
|
||||||
|
|
||||||
|
std::unordered_map<int,std::tuple<int,int,double,double>> qvecr[4], qvecw[4];
|
||||||
|
if(qqq.multi>1) {
|
||||||
|
//if(qqq.multi>=3) std::cout << "-----" << std::endl;
|
||||||
|
for(int i=0; i<qqq.multi; i++) {
|
||||||
|
//if(qqq.multi>=3) std::cout << std::setprecision(16) << "qqq"<< qqq.id[i] << " " << std::string(qqq.ch[i]/16?"ring":"wedge") << qqq.ch[i]%16 << " " << qqq.e[i] << " " << qqq.t[i] - qqq.t[0] << std::endl;
|
||||||
|
if(qqq.ch[i]/16) {
|
||||||
|
if(qvecr[qqq.id[i]].find(qqq.ch[i])!=qvecr[qqq.id[i]].end()) std::cout << "mayday!" << std::endl;
|
||||||
|
qvecr[qqq.id[i]][qqq.ch[i]] = std::tuple(qqq.id[i],qqq.ch[i],qqq.e[i],qqq.t[i]);
|
||||||
|
} else {
|
||||||
|
if(qvecw[qqq.id[i]].find(qqq.ch[i])!=qvecw[qqq.id[i]].end()) std::cout << "mayday!" << std::endl;
|
||||||
|
qvecw[qqq.id[i]][qqq.ch[i]] = std::tuple(qqq.id[i],qqq.ch[i],qqq.e[i],qqq.t[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PCQQQTimeCut = false;
|
||||||
|
for (int i = 0; i < qqq.multi; i++) {
|
||||||
|
plotter->Fill2D("QQQ_Index_Vs_Energy", 16 * 8, 0, 16 * 8, 2000, 0, 16000, qqq.index[i], qqq.e[i], "hRawQQQ");
|
||||||
|
|
||||||
|
for (int j = 0; j < qqq.multi; j++) {
|
||||||
|
if (j == i)
|
||||||
|
continue;
|
||||||
|
plotter->Fill2D("QQQ_Coincidence_Matrix", 16 * 8, 0, 16 * 8, 16 * 8, 0, 16 * 8, qqq.index[i], qqq.index[j], "hRawQQQ");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int k = 0; k < pc.multi; k++) {
|
||||||
|
if (pc.index[k] < 24 && pc.e[k] > 50) {
|
||||||
|
plotter->Fill2D("QQQ_Vs_Anode_Energy", 400, 0, 4000, 1000, 0, 16000, qqq.e[i], pc.e[k], "hRawQQQ");
|
||||||
|
plotter->Fill2D("QQQ_Vs_PC_Index", 16 * 8, 0, 16 * 8, 24, 0, 24, qqq.index[i], pc.index[k], "hRawQQQ");
|
||||||
|
}
|
||||||
|
else if (pc.index[k] >= 24 && pc.e[k] > 50) {
|
||||||
|
plotter->Fill2D("QQQ_Vs_Cathode_Energy", 400, 0, 4000, 1000, 0, 16000, qqq.e[i], pc.e[k], "hRawQQQ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int j = i + 1; j < qqq.multi; j++) {
|
||||||
|
if (qqq.id[i] == qqq.id[j]) {
|
||||||
|
qqqCount++;
|
||||||
|
|
||||||
|
int chWedge = -1;
|
||||||
|
int chRing = -1;
|
||||||
|
double eWedge = 0.0;
|
||||||
|
double eWedgeMeV = 0.0;
|
||||||
|
double eRing = 0.0;
|
||||||
|
double eRingMeV = 0.0;
|
||||||
|
double tRing = 0.0;
|
||||||
|
double tWedge = 0.0;
|
||||||
|
|
||||||
|
if (qqq.ch[i] < 16 && qqq.ch[j] >= 16 && qqqGainValid[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16]) {
|
||||||
|
chWedge = qqq.ch[i];
|
||||||
|
eWedge = qqq.e[i] * qqqGain[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16];
|
||||||
|
chRing = qqq.ch[j] - 16;
|
||||||
|
eRing = qqq.e[j];
|
||||||
|
tRing = static_cast<double>(qqq.t[j]);
|
||||||
|
tWedge = static_cast<double>(qqq.t[i]);
|
||||||
|
}
|
||||||
|
else if (qqq.ch[j] < 16 && 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];
|
||||||
|
chRing = qqq.ch[i] - 16;
|
||||||
|
eRing = qqq.e[i];
|
||||||
|
tRing = static_cast<double>(qqq.t[i]);
|
||||||
|
tWedge = static_cast<double>(qqq.t[j]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
|
||||||
|
plotter->Fill1D("Wedgetime_Vs_Ringtime", 100, -1000, 1000, tWedge - tRing, "hTiming");
|
||||||
|
plotter->Fill2D("RingE_vs_Index", 16 * 4, 0, 16 * 4, 1000, 0, 16000, chRing + qqq.id[i] * 16, eRing, "hRawQQQ");
|
||||||
|
plotter->Fill2D("WedgeE_vs_Index", 16 * 4, 0, 16 * 4, 1000, 0, 16000, chWedge + qqq.id[i] * 16, eWedge, "hRawQQQ");
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
if(eRingMeV/eWedgeMeV > 3.0 || eRingMeV/eWedgeMeV<1.0/3.0) continue;
|
||||||
|
//if(eRingMeV<4.0 || eWedgeMeV<4.0) continue;
|
||||||
|
|
||||||
|
double theta = -TMath::Pi() / 2 + 2 * TMath::Pi() / 16 / 4. * (qqq.id[i] * 16 + chWedge + 0.5);
|
||||||
|
double rho = 50. + (50. / 16.) * (chRing + 0.5); //"?"
|
||||||
|
//z used to be 75+30+23=128
|
||||||
|
//we found a 12mm shift towards the vertex later --> 116
|
||||||
|
Event qqqevent(TVector3(rho*TMath::Cos(theta),rho*TMath::Sin(theta),116), eRingMeV, eWedgeMeV, tRing, tWedge,chRing+qqq.id[i]*16, chWedge+qqq.id[i]*16);
|
||||||
|
Event qqqeventr(TVector3(rho*TMath::Cos(theta),rho*TMath::Sin(theta),116), eRing, eWedge, tRing, tWedge,chRing+qqq.id[i]*16, chWedge+qqq.id[i]*16);
|
||||||
|
QQQ_Events.push_back(qqqevent);
|
||||||
|
QQQ_Events_Raw.push_back(qqqeventr);
|
||||||
|
plotter->Fill2D("QQQCartesianPlot", 200, -100, 100, 200, -100, 100, rho * TMath::Cos(theta), rho * TMath::Sin(theta), "hCalQQQ");
|
||||||
|
plotter->Fill2D("QQQCartesianPlot" + std::to_string(qqq.id[i]), 200, -100, 100, 200, -100, 100, rho * TMath::Cos(theta), rho * TMath::Sin(theta), "hCalQQQ");
|
||||||
|
if (PCQQQTimeCut) {
|
||||||
|
plotter->Fill2D("PC_XY_Projection_QQQ_TimeCut" + std::to_string(qqq.id[i]), 400, -100, 100, 400, -100, 100, rho * TMath::Cos(theta), rho * TMath::Sin(theta), "hPCQQQ");
|
||||||
|
}
|
||||||
|
plotter->Fill2D("PC_XY_Projection_QQQ" + std::to_string(qqq.id[i]), 400, -100, 100, 400, -100, 100, rho * TMath::Cos(theta), rho * TMath::Sin(theta), "hPCQQQ");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
|
||||||
|
plotter->Fill2D("WedgeE_Vs_RingECal", 1000, 0, 10, 1000, 0, 10, eWedgeMeV, eRingMeV, "hCalQQQ");
|
||||||
|
plotter->Fill2D("WedgeE_Vs_RingECal_selected", 1000, 0, 10, 1000, 0, 10, eWedgeMeV, eRingMeV, "hCalQQQ");
|
||||||
|
|
||||||
|
for (int k = 0; k < pc.multi; k++)
|
||||||
|
{
|
||||||
|
plotter->Fill2D("RingCh_vs_Anode_Index", 16 * 4, 0, 16 * 4, 24, 0, 24, chRing + qqq.id[i] * 16, pc.index[k], "hRawQQQ");
|
||||||
|
plotter->Fill2D("WedgeCh_vs_Anode_Index", 16 * 4, 0, 16 * 4, 24, 0, 24, chWedge + qqq.id[i] * 16, pc.index[k], "hRawQQQ");
|
||||||
|
plotter->Fill2D("WedgeCh_vs_Anode_Index" + std::to_string(qqq.id[i]), 16 * 4, 0, 16 * 4, 24, 0, 24, chWedge + qqq.id[i] * 16, pc.index[k]);
|
||||||
|
plotter->Fill2D("RingCh_vs_Cathode_Index", 16 * 4, 0, 16 * 4, 24, 24, 48, chRing + qqq.id[i] * 16, pc.index[k], "hRawQQQ");
|
||||||
|
plotter->Fill2D("WedgeCh_vs_Cathode_Index", 16 * 4, 0, 16 * 4, 24, 24, 48, chWedge + qqq.id[i] * 16, pc.index[k], "hRawQQQ");
|
||||||
|
|
||||||
|
if (pc.index[k] < 24 && pc.e[k] > 50)
|
||||||
|
{
|
||||||
|
plotter->Fill2D("Timing_Difference_QQQ_PC", 500, -2000, 2000, 16, 0, 16, tRing - static_cast<double>(pc.t[k]), chRing, "hTiming");
|
||||||
|
plotter->Fill2D("DelT_Vs_QQQRingECal", 500, -2000, 2000, 1000, 0, 10, tRing - static_cast<double>(pc.t[k]), eRingMeV, "hTiming");
|
||||||
|
plotter->Fill2D("CalibratedQQQEvsPCE_R", 1000, 0, 10, 2000, 0, 30000, eRingMeV, pc.e[k], "hPCQQQ");
|
||||||
|
plotter->Fill2D("CalibratedQQQEvsPCE_W", 1000, 0, 10, 2000, 0, 30000, eWedgeMeV, pc.e[k], "hPCQQQ");
|
||||||
|
if (tRing - static_cast<double>(pc.t[k]) < -150) // proton tests, 27Al
|
||||||
|
//if (tRing - static_cast<double>(pc.t[k]) < -150 && tRing - static_cast<double>(pc.t[k]) > -450) // 27Al
|
||||||
|
//if (tRing - static_cast<double>(pc.t[k]) < -70 && tRing - static_cast<double>(pc.t[k]) > -150) // 17F
|
||||||
|
{
|
||||||
|
PCQQQTimeCut = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pc.index[k] >= 24 && pc.e[k] > 50) {
|
||||||
|
plotter->Fill2D("Timing_Difference_QQQ_PC_Cathode", 500, -2000, 2000, 16, 0, 16, tRing - static_cast<double>(pc.t[k]), chRing, "hTiming");
|
||||||
|
}
|
||||||
|
} //end of pc k loop
|
||||||
|
|
||||||
|
if (!HitNonZero) {
|
||||||
|
double theta = -TMath::Pi() / 2 + 2 * TMath::Pi() / 16 / 4. * (qqq.id[i] * 16 + chWedge + 0.5);
|
||||||
|
double rho = 50. + (50. / 16.) * (chRing + 0.5); //"?"
|
||||||
|
double x = rho * TMath::Cos(theta);
|
||||||
|
double y = rho * TMath::Sin(theta);
|
||||||
|
hitPos.SetXYZ(x, y, (23 + 75 + 30));
|
||||||
|
qqqenergy = eRingMeV;
|
||||||
|
qqqtimestamp = tRing;
|
||||||
|
HitNonZero = true;
|
||||||
|
}
|
||||||
|
} // if j==i
|
||||||
|
} //j loop end
|
||||||
|
} //i loop end
|
||||||
|
|
||||||
|
plotter->Fill1D("QQQ_Multiplicity", 10, 0, 10, qqqCount, "hRawQQQ");
|
||||||
|
|
||||||
|
/*if(QQQ_Events.size()>=1) {
|
||||||
|
std::cout<< " ---->" << std::endl;
|
||||||
|
for(auto qe: QQQ_Events) {
|
||||||
|
std::cout << qe.ch1/16 << " " <<qe.ch2/16 << " " << qe.ch1%16 << " "<< qe.ch2%16 << " " << qe.Energy1 << " " << qe.Energy2 << " " << std::endl;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
typedef std::unordered_map<int,std::tuple<int,double,double>> WireEvent; //this stores nearest neighbour wire events, or a 'cluster'
|
||||||
|
WireEvent aWireEvents, cWireEvents; //naming for book keeping
|
||||||
|
aWireEvents.clear();
|
||||||
|
aWireEvents.reserve(24);
|
||||||
|
|
||||||
|
// PC Gain Matching and Filling
|
||||||
|
double anodeT = -99999;
|
||||||
|
double cathodeT = 99999;
|
||||||
|
int anodeIndex = -1;
|
||||||
|
int cathodeIndex = -1;
|
||||||
|
for (int i = 0; i < pc.multi; i++)
|
||||||
|
{
|
||||||
|
if (pc.e[i] > 50)
|
||||||
|
{
|
||||||
|
plotter->Fill2D("PC_Index_Vs_Energy", 48, 0, 48, 2000, 0, 30000, pc.index[i], static_cast<double>(pc.e[i]), "hRawPC");
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pc.index[i] < 48)
|
||||||
|
{
|
||||||
|
pc.e[i] = pcSlope[pc.index[i]] * pc.e[i] + pcIntercept[pc.index[i]];
|
||||||
|
plotter->Fill2D("PC_Index_VS_GainMatched_Energy", 48, 0, 48, 2000, 0, 30000, pc.index[i], pc.e[i], "hGMPC");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pc.index[i] < 24)
|
||||||
|
{
|
||||||
|
anodeT = static_cast<double>(pc.t[i]);
|
||||||
|
anodeIndex = pc.index[i];
|
||||||
|
aWireEvents[pc.index[i]] = std::tuple(pc.index[i],pc.e[i],static_cast<double>(pc.t[i]));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cathodeT = static_cast<double>(pc.t[i]);
|
||||||
|
cathodeIndex = pc.index[i] - 24;
|
||||||
|
cWireEvents[pc.index[i]-24] = std::tuple(pc.index[i]-24,pc.e[i],static_cast<double>(pc.t[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anodeT != -99999 && cathodeT != 99999)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < qqq.multi; j++)
|
||||||
|
{
|
||||||
|
plotter->Fill1D("PC_Time_qqq", 200, -2000, 2000, anodeT - cathodeT, "hTiming");
|
||||||
|
plotter->Fill2D("PC_Time_Vs_QQQ_ch", 200, -2000, 2000, 16 * 8, 0, 16 * 8, anodeT - cathodeT, qqq.ch[j], "hTiming");
|
||||||
|
plotter->Fill2D("PC_Time_vs_AIndex", 200, -2000, 2000, 24, 0, 24, anodeT - cathodeT, anodeIndex, "hTiming");
|
||||||
|
plotter->Fill2D("PC_Time_vs_CIndex", 200, -2000, 2000, 24, 0, 24, anodeT - cathodeT, cathodeIndex, "hTiming");
|
||||||
|
// plotter->Fill1D("PC_Time_A" + std::to_string(anodeIndex) + "_C" + std::to_string(cathodeIndex), 200, -1000, 1000, anodeT - cathodeT, "TimingPC");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int j = 0; j < sx3.multi; j++)
|
||||||
|
{
|
||||||
|
plotter->Fill1D("PC_Time_sx3", 200, -2000, 2000, anodeT - cathodeT, "hTiming");
|
||||||
|
}
|
||||||
|
|
||||||
|
plotter->Fill1D("PC_Time", 200, -2000, 2000, anodeT - cathodeT, "hTiming");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int j = i + 1; j < pc.multi; j++)
|
||||||
|
{
|
||||||
|
plotter->Fill2D("PC_Coincidence_Matrix", 48, 0, 48, 48, 0, 48, pc.index[i], pc.index[j], "hRawPC");
|
||||||
|
plotter->Fill2D("PC_Coincidence_Matrix_anodeMinusCathode_lt_-200_" + std::to_string(anodeT - cathodeT < -200), 48, 0, 48, 48, 0, 48, pc.index[i], pc.index[j], "hRawPC");
|
||||||
|
plotter->Fill2D("Anode_V_Anode", 24, 0, 24, 24, 0, 24, pc.index[i], pc.index[j], "hGMPC");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
anodeHits.clear();
|
||||||
|
cathodeHits.clear();
|
||||||
|
corrcatMax.clear();
|
||||||
|
|
||||||
|
int aID = 0;
|
||||||
|
int cID = 0;
|
||||||
|
double aE = 0;
|
||||||
|
double cE = 0;
|
||||||
|
double aESum = 0;
|
||||||
|
double cESum = 0;
|
||||||
|
double aEMax = 0;
|
||||||
|
int aIDMax = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 0; i < pc.multi; i++) {
|
||||||
|
// if (pc.e[i] > 100)
|
||||||
|
{
|
||||||
|
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]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::sort(anodeHits.begin(),anodeHits.end(),[](std::pair<int,double> a, std::pair<int,double> b){ return a.first < b.first;});
|
||||||
|
std::sort(cathodeHits.begin(),cathodeHits.end(),[](std::pair<int,double> a, std::pair<int,double> b){ return a.first < b.first;});
|
||||||
|
|
||||||
|
//clusters = collection of (collection of wires) where each wire is (index, energy, timestamp)
|
||||||
|
std::vector<std::vector<std::tuple<int,double,double>>> aClusters = pwinstance.Make_Clusters(aWireEvents);
|
||||||
|
std::vector<std::vector<std::tuple<int,double,double>>> cClusters = pwinstance.Make_Clusters(cWireEvents);
|
||||||
|
|
||||||
|
std::vector<std::pair<double,double>> sumE_AC;
|
||||||
|
for(auto aCluster: aClusters) {
|
||||||
|
for(auto cCluster: cClusters) {
|
||||||
|
if(aCluster.size()<=1 && cCluster.size()<=1) continue;
|
||||||
|
auto [crossover,alpha,apSumE,cpSumE,apMaxE,cpMaxE,apTSMaxE,cpTSMaxE] = pwinstance.FindCrossoverProperties(aCluster, cCluster);
|
||||||
|
if(alpha!=9999999 && apSumE!=-1) {
|
||||||
|
//Event PCEvent(crossover,apMaxE,cpMaxE,apTSMaxE,cpTSMaxE);
|
||||||
|
//Event PCEvent(crossover,apSumE,cpSumE,apTSMaxE,cpTSMaxE);
|
||||||
|
Event PCEvent(crossover,apSumE,cpMaxE,apTSMaxE,cpTSMaxE); //run12 shows cathode-max and anode-sum provide best dE signals.
|
||||||
|
//std::cout << apSumE << " " << crossover.Perp() << " " << apMaxE << " " << apTSMaxE << std::endl;
|
||||||
|
PC_Events.push_back(PCEvent);
|
||||||
|
sumE_AC.push_back(std::pair(apSumE,cpSumE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(QQQ_Events.size() && PC_Events.size())
|
||||||
|
plotter->Fill2D("PCEv_vs_QQQEv",20,0,20,20,0,20,QQQ_Events.size(),PC_Events.size());
|
||||||
|
|
||||||
|
for(auto pcevent:PC_Events) {
|
||||||
|
for(auto sx3event:sx3Events) {
|
||||||
|
plotter->Fill1D("dt_pcA_sx3B"+std::to_string(sx3event.ch2),640,-2000,2000,sx3event.Time1 - pcevent.Time1);
|
||||||
|
plotter->Fill1D("dt_pcC_sx3B"+std::to_string(sx3event.ch2),640,-2000,2000,sx3event.Time1 - pcevent.Time2);
|
||||||
|
plotter->Fill2D("dE_E_Anodesx3B",400,0,10,800,0,40000,sx3event.Energy1*0.001,pcevent.Energy1);
|
||||||
|
|
||||||
|
plotter->Fill2D("dE_E_Cathodesx3B",400,0,10,800,0,10000,sx3event.Energy1*0.001,pcevent.Energy2);
|
||||||
|
double sx3z = sx3event.pos.Z()+(75.0/2.0)+23.0-90.0; //w.r.t target origin at 90 for run12
|
||||||
|
double sx3rho = 88.0;
|
||||||
|
double sx3theta = TMath::ATan2(sx3rho,sx3z);
|
||||||
|
double pczguess = 40.0/TMath::Tan(sx3theta) + 90.0;
|
||||||
|
plotter->Fill2D("pcz_vs_sx3pczguess",300,0,200,150,0,200,pczguess,pcevent.pos.Z());
|
||||||
|
plotter->Fill2D("pcz_vs_sx3pczguess"+std::to_string(sx3event.ch2),300,0,200,150,0,200,pczguess,pcevent.pos.Z());
|
||||||
|
plotter->Fill2D("pcz_vs_sx3z",300,0,200,150,0,200,sx3z+90,pcevent.pos.Z());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(auto pcevent: PC_Events) {
|
||||||
|
for(auto qqqevent: QQQ_Events) {
|
||||||
|
plotter->Fill1D("dt_pcA_qqqR",640,-2000,2000,qqqevent.Time1 - pcevent.Time1);
|
||||||
|
plotter->Fill1D("dt_pcC_qqqW",640,-2000,2000,qqqevent.Time2 - pcevent.Time2);
|
||||||
|
plotter->Fill2D("dE_E_AnodeQQQR",400,0,10,800,0,40000,qqqevent.Energy1,pcevent.Energy1);
|
||||||
|
plotter->Fill2D("dE_E_CathodeQQQR",400,0,10,800,0,10000,qqqevent.Energy2,pcevent.Energy2);
|
||||||
|
double sinTheta = TMath::Sin((qqqevent.pos - TVector3(0,0,90)).Theta())/TMath::Sin((TVector3(51.5,0,128.) - TVector3(0,0,90)).Theta());
|
||||||
|
plotter->Fill2D("dE2_E_AnodeQQQR",400,0,10,800,0,40000,qqqevent.Energy1,pcevent.Energy1*sinTheta);
|
||||||
|
plotter->Fill2D("dE2_E_CathodeQQQR",400,0,10,800,0,10000,qqqevent.Energy2,pcevent.Energy2*sinTheta);
|
||||||
|
|
||||||
|
if(qqqevent.pos.Phi() <= pcevent.pos.Phi()+TMath::Pi()/4. && qqqevent.pos.Phi() >= pcevent.pos.Phi()-TMath::Pi()/4.) {
|
||||||
|
plotter->Fill1D("PCZ",800,-200,200,pcevent.pos.Z(),"phicut");
|
||||||
|
double pcz_guess = 40.0/TMath::Tan((qqqevent.pos-TVector3(0,0,90)).Theta()) + 90; //this is ideally kept to be all QQQ+userinput for calibration of pcz
|
||||||
|
plotter->Fill2D("pczguess_vs_pc",300,0,200,150,0,200,pcz_guess,pcevent.pos.Z(),"phicut");
|
||||||
|
plotter->Fill2D("pczguess_vs_pc_phi="+std::to_string(qqqevent.pos.Phi()*180./M_PI),300,0,200,150,0,200,pcz_guess,pcevent.pos.Z(),"phicut");
|
||||||
|
//plotter->Fill1D("PCZ",800,-200,200,pcevent.pos.Z(),"phicut");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//HALFTIME! Can stop here in future versions
|
||||||
|
//return kTRUE;
|
||||||
|
|
||||||
|
if (anodeHits.size() >= 1 && cathodeHits.size() >= 1)
|
||||||
|
{
|
||||||
|
// 2. CRITICAL FIX: Define reference vector 'a'
|
||||||
|
// In Analyzer.cxx, 'a' was left over from the loop. We use the first anode wire as reference here.
|
||||||
|
// (Assuming pwinstance.An is populated and wires are generally parallel).
|
||||||
|
TVector3 refAnode = pwinstance.An[0].first - pwinstance.An[0].second;
|
||||||
|
|
||||||
|
{
|
||||||
|
for (const auto &anode : anodeHits)
|
||||||
|
{
|
||||||
|
aID = anode.first;
|
||||||
|
aE = anode.second;
|
||||||
|
aESum += aE;
|
||||||
|
if (aE > aEMax)
|
||||||
|
{
|
||||||
|
aEMax = aE;
|
||||||
|
aIDMax = aID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto &cathode : cathodeHits)
|
||||||
|
{
|
||||||
|
cID = cathode.first;
|
||||||
|
cE = cathode.second;
|
||||||
|
plotter->Fill2D("AnodeMax_Vs_Cathode_Coincidence_Matrix", 24, 0, 24, 24, 0, 24, aIDMax, cID, "hRawPC");
|
||||||
|
plotter->Fill2D("Anode_Vs_Cathode_Coincidence_Matrix", 24, 0, 24, 24, 0, 24, aID, cID, "hRawPC");
|
||||||
|
plotter->Fill2D("Anode_vs_CathodeE", 2000, 0, 30000, 2000, 0, 30000, aE, cE, "hGMPC");
|
||||||
|
plotter->Fill2D("CathodeMult_V_CathodeE", 6, 0, 6, 2000, 0, 30000, cathodeHits.size(), cE, "hGMPC");
|
||||||
|
for (int j = -4; j < 3; j++)
|
||||||
|
{
|
||||||
|
if ((aIDMax + 24 + j) % 24 == 23 - cID)
|
||||||
|
{
|
||||||
|
corrcatMax.push_back(std::pair<int, double>(cID, cE));
|
||||||
|
cESum += cE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TVector3 anodeIntersection,vector_closest_to_z;
|
||||||
|
anodeIntersection.Clear();
|
||||||
|
vector_closest_to_z.Clear();
|
||||||
|
if (corrcatMax.size() > 0)
|
||||||
|
{
|
||||||
|
double x = 0, y = 0, z = 0;
|
||||||
|
for (const auto &corr : corrcatMax)
|
||||||
|
{
|
||||||
|
if (Crossover[aIDMax][corr.first][0].z > 9000000)
|
||||||
|
continue;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (x == 0 && y == 0 && z == 0)
|
||||||
|
;
|
||||||
|
// to ignore events with no valid crossover points
|
||||||
|
else
|
||||||
|
anodeIntersection = TVector3(x, y, z);
|
||||||
|
// << "Anode Intersection: " << anodeIntersection.X() << ", " << anodeIntersection.Y() << ", " << anodeIntersection.Z() << std::endl;
|
||||||
|
}
|
||||||
|
bool PCQQQPhiCut = false;
|
||||||
|
// flip the algorithm for cathode 1 multi anode events
|
||||||
|
if ((hitPos.Phi() > (anodeIntersection.Phi() - TMath::PiOver4())) && (hitPos.Phi() < (anodeIntersection.Phi() + TMath::PiOver4()))) {
|
||||||
|
PCQQQPhiCut = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (double Tz = 60; Tz <= 100; Tz += 1.0)
|
||||||
|
{
|
||||||
|
TVector3 TargetPos(0, 0, Tz);
|
||||||
|
if(PCQQQPhiCut && anodeIntersection.Perp()>0 && anodeIntersection.Z()!=0 && cathodeHits.size()>=2) {
|
||||||
|
plotter->Fill2D("Inttheta_vs_QQQtheta_TC" + std::to_string(PCQQQTimeCut) + "_TZ" + std::to_string(Tz), 400, 0, 180, 90, 0, 90, (anodeIntersection - TargetPos).Theta() * 180. / TMath::Pi(), (hitPos - TargetPos).Theta() * 180. / TMath::Pi(), "TPosVariation");
|
||||||
|
//plotter->Fill2D("R_ratio_to_Z_ratio" + std::to_string(PCQQQTimeCut) + "_TZ" + std::to_string(Tz), 100, -2, 2, 100, -2, 2, (anodeIntersection - TargetPos).Z()/(hitPos-TargetPos).Z(), ((anodeIntersection - TargetPos).Perp()+2.5)/(hitPos-TargetPos).Perp(), "TPosVariation");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anodeIntersection.Z() != 0 && anodeIntersection.Perp()>0 && HitNonZero)
|
||||||
|
{
|
||||||
|
plotter->Fill1D("PC_Z_Projection", 600, -300, 300, anodeIntersection.Z(), "hPCzQQQ");
|
||||||
|
plotter->Fill2D("Z_Proj_VsDelTime", 600, -300, 300, 200, -2000, 2000, anodeIntersection.Z(), anodeT - cathodeT, "hPCzQQQ");
|
||||||
|
plotter->Fill2D("IntPhi_vs_QQQphi", 100, -200, 200, 80, -200, 200, anodeIntersection.Phi() * 180. / TMath::Pi(), hitPos.Phi() * 180. / TMath::Pi(), "hPCQQQ");
|
||||||
|
//plotter->Fill2D("Inttheta_vs_QQQtheta", 90, 0, 180, 20, 0, 45, anodeIntersection.Theta() * 180. / TMath::Pi(), hitPos.Theta() * 180. / TMath::Pi(), "hPCQQQ");
|
||||||
|
//plotter->Fill2D("Inttheta_vs_QQQtheta_TC" + std::to_string(PCQQQTimeCut)+ "_PC"+std::to_string(PCQQQPhiCut), 90, 0, 180, 20, 0, 45, anodeIntersection.Theta() * 180. / TMath::Pi(), hitPos.Theta() * 180. / TMath::Pi(), "hPCQQQ");
|
||||||
|
plotter->Fill2D("IntPhi_vs_QQQphi_TC" + std::to_string(PCQQQTimeCut) + "PhiC" + std::to_string(PCQQQPhiCut), 100, -200, 200, 80, -200, 200, anodeIntersection.Phi() * 180. / TMath::Pi(), hitPos.Phi() * 180. / TMath::Pi(), "hPCQQQ");
|
||||||
|
}
|
||||||
|
if (anodeIntersection.Z() != 0 && cathodeHits.size() >= 2)
|
||||||
|
plotter->Fill1D("PC_Z_Projection_TC" + std::to_string(PCQQQTimeCut) + "PhiC" + std::to_string(PCQQQPhiCut), 600, -300, 300, anodeIntersection.Z(), "hPCzQQQ");
|
||||||
|
|
||||||
|
if (anodeIntersection.Z() != 0 && cathodeHits.size() == 1)
|
||||||
|
{
|
||||||
|
plotter->Fill1D("PC_Z_proj_1C", 600, -300, 300, anodeIntersection.Z(), "hPCzQQQ");
|
||||||
|
plotter->Fill2D("IntersectionPhi_vs_AnodeZ_1C", 400, -200, 200, 600, -300, 300, anodeIntersection.Phi() * 180. / TMath::Pi(), anodeIntersection.Z(), "hPCzQQQ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anodeIntersection.Z() != 0 && cathodeHits.size() == 2)
|
||||||
|
{
|
||||||
|
plotter->Fill1D("PC_Z_proj_2C", 600, -300, 300, anodeIntersection.Z(), "hPCzQQQ");
|
||||||
|
plotter->Fill2D("IntersectionPhi_vs_AnodeZ_2C", 400, -200, 200, 600, -300, 300, anodeIntersection.Phi() * 180. / TMath::Pi(), anodeIntersection.Z(), "hGMPC");
|
||||||
|
}
|
||||||
|
if (anodeIntersection.Z() != 0 && cathodeHits.size() > 2)
|
||||||
|
{
|
||||||
|
plotter->Fill1D("PC_Z_proj_nC", 600, -300, 300, anodeIntersection.Z(), "hPCzQQQ");
|
||||||
|
plotter->Fill2D("IntersectionPhi_vs_AnodeZ_nC", 400, -200, 200, 600, -300, 300, anodeIntersection.Phi() * 180. / TMath::Pi(), anodeIntersection.Z(), "hGMPC");
|
||||||
|
}
|
||||||
|
if (anodeHits.size() > 0 && cathodeHits.size() > 0)
|
||||||
|
plotter->Fill2D("AHits_vs_CHits", 12, 0, 11, 6, 0, 5, anodeHits.size(), cathodeHits.size(), "hRawPC");
|
||||||
|
|
||||||
|
// make another plot with nearest neighbour constraint
|
||||||
|
bool hasNeighbourAnodes = false;
|
||||||
|
bool hasNeighbourCathodes = false;
|
||||||
|
|
||||||
|
// 1. Check Anodes for neighbours (including wrap-around 0-23)
|
||||||
|
for (size_t i = 0; i < anodeHits.size(); i++)
|
||||||
|
{
|
||||||
|
for (size_t j = i + 1; j < anodeHits.size(); j++)
|
||||||
|
{
|
||||||
|
int diff = std::abs(anodeHits[i].first - anodeHits[j].first);
|
||||||
|
if (diff == 1 || diff == 23)
|
||||||
|
{ // 23 handles the cylindrical wrap
|
||||||
|
hasNeighbourAnodes = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasNeighbourAnodes)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Check Cathodes for neighbours (including wrap-around 0-23)
|
||||||
|
for (size_t i = 0; i < cathodeHits.size(); i++)
|
||||||
|
{
|
||||||
|
for (size_t j = i + 1; j < cathodeHits.size(); j++)
|
||||||
|
{
|
||||||
|
int diff = std::abs(cathodeHits[i].first - cathodeHits[j].first);
|
||||||
|
if (diff == 1 || diff == 23)
|
||||||
|
{
|
||||||
|
hasNeighbourCathodes = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasNeighbourCathodes)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
// FILL PLOTS
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
if (anodeHits.size() > 0 && cathodeHits.size() > 0)
|
||||||
|
{
|
||||||
|
plotter->Fill2D("AHits_vs_CHits_NA" + std::to_string(hasNeighbourAnodes), 12, 0, 11, 6, 0, 5, anodeHits.size(), cathodeHits.size(), "hRawPC");
|
||||||
|
plotter->Fill2D("AHits_vs_CHits_NC" + std::to_string(hasNeighbourCathodes), 12, 0, 11, 6, 0, 5, anodeHits.size(), cathodeHits.size(), "hRawPC");
|
||||||
|
|
||||||
|
// Constraint Plot: Only fill if BOTH planes have adjacent hits
|
||||||
|
// This effectively removes events with only isolated single-wire hits (noise)
|
||||||
|
if (hasNeighbourAnodes && hasNeighbourCathodes)
|
||||||
|
{
|
||||||
|
plotter->Fill2D("AHits_vs_CHits_NN", 12, 0, 11, 6, 0, 5, anodeHits.size(), cathodeHits.size(), "hRawPC");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (HitNonZero && anodeIntersection.Z() != 0)
|
||||||
|
{
|
||||||
|
pw_contr.CalTrack2(hitPos, anodeIntersection);
|
||||||
|
plotter->Fill1D("VertexRecon", 600, -1300, 1300, pw_contr.GetZ0());
|
||||||
|
plotter->Fill1D("VertexRecon_TC"+std::to_string(PCQQQTimeCut)+"_PhiC"+std::to_string(PCQQQPhiCut), 600, -1300, 1300, pw_contr.GetZ0());
|
||||||
|
|
||||||
|
if (cathodeHits.size() == 2)
|
||||||
|
plotter->Fill1D("VertexRecon_2c_TC"+std::to_string(PCQQQTimeCut)+"_PhiC"+std::to_string(PCQQQPhiCut), 600, -1300, 1300, pw_contr.GetZ0());
|
||||||
|
|
||||||
|
TVector3 x2(anodeIntersection), x1(hitPos);
|
||||||
|
|
||||||
|
TVector3 v = x2-x1;
|
||||||
|
double t_minimum = -1.0*(x1.X()*v.X()+x1.Y()*v.Y())/(v.X()*v.X()+v.Y()*v.Y());
|
||||||
|
vector_closest_to_z = x1 + t_minimum*v;
|
||||||
|
|
||||||
|
plotter->Fill1D("VertexRecon_Z_TC"+std::to_string(PCQQQTimeCut)+"_PhiC"+std::to_string(PCQQQPhiCut), 600, -1300, 1300, vector_closest_to_z.Z() ,"customVertex");
|
||||||
|
if(vector_closest_to_z.Perp() < 20) {
|
||||||
|
plotter->Fill1D("VertexRecon_RadialCut_Z_TC"+std::to_string(PCQQQTimeCut)+"_PhiC"+std::to_string(PCQQQPhiCut), 600, -1300, 1300, vector_closest_to_z.Z() ,"customVertex");
|
||||||
|
}
|
||||||
|
|
||||||
|
plotter->Fill2D("VertexRecon_XY_TC"+std::to_string(PCQQQTimeCut)+"_PhiC"+std::to_string(PCQQQPhiCut), 100, -100, 100, 100,-100,100, vector_closest_to_z.X(), vector_closest_to_z.Y() ,"customVertex");
|
||||||
|
if(cathodeHits.size()==2) {
|
||||||
|
plotter->Fill1D("VertexRecon2C_Z_TC"+std::to_string(PCQQQTimeCut)+"_PhiC"+std::to_string(PCQQQPhiCut), 600, -1300, 1300, vector_closest_to_z.Z() ,"customVertex");
|
||||||
|
if(vector_closest_to_z.Perp() < 20) {
|
||||||
|
plotter->Fill1D("VertexRecon2C_RadialCut_Z_TC"+std::to_string(PCQQQTimeCut)+"_PhiC"+std::to_string(PCQQQPhiCut), 600, -1300, 1300, vector_closest_to_z.Z() ,"customVertex");
|
||||||
|
}
|
||||||
|
plotter->Fill2D("VertexRecon2C_XY_TC"+std::to_string(PCQQQTimeCut)+"_PhiC"+std::to_string(PCQQQPhiCut), 100, -100, 100, 100,-100,100, vector_closest_to_z.X(), vector_closest_to_z.Y() ,"customVertex");
|
||||||
|
plotter->Fill2D("VertexRecon2C_RhoZ_TC"+std::to_string(PCQQQTimeCut)+"_PhiC"+std::to_string(PCQQQPhiCut), 100, -100, 100, 600,-1300,1300, vector_closest_to_z.Perp(), vector_closest_to_z.Z() ,"customVertex");
|
||||||
|
plotter->Fill2D("VertexRecon2C_Z_vs_QQQE_TC"+std::to_string(PCQQQTimeCut)+"_PhiC"+std::to_string(PCQQQPhiCut), 600, -1300, 1300, 800,0,20000, vector_closest_to_z.Z(), qqqenergy ,"customVertex");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < qqq.multi; i++)
|
||||||
|
{
|
||||||
|
if(anodeIntersection.Perp() > 0) { //suppress x,y=0,0 events
|
||||||
|
if (PCQQQTimeCut) {
|
||||||
|
plotter->Fill2D("PC_XY_Projection_QQQ_TimeCut" + std::to_string(qqq.id[i]), 400, -100, 100, 400, -100, 100, anodeIntersection.X(), anodeIntersection.Y(), "hPCQQQ");
|
||||||
|
}
|
||||||
|
plotter->Fill2D("PC_XY_Projection_QQQ" + std::to_string(qqq.id[i]), 400, -100, 100, 400, -100, 100, anodeIntersection.X(), anodeIntersection.Y(), "hPCQQQ");
|
||||||
|
}
|
||||||
|
for (int j = i + 1; j < qqq.multi; j++)
|
||||||
|
{
|
||||||
|
if (qqq.id[i] == qqq.id[j])
|
||||||
|
{
|
||||||
|
int chWedge = -1;
|
||||||
|
int chRing = -1;
|
||||||
|
double eWedge = 0.0;
|
||||||
|
double eWedgeMeV = 0.0;
|
||||||
|
double eRing = 0.0;
|
||||||
|
double eRingMeV = 0.0;
|
||||||
|
double tRing = 0.0;
|
||||||
|
int qqqID = -1;
|
||||||
|
if (qqq.ch[i] < 16 && qqq.ch[j] >= 16 && qqqGainValid[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16])
|
||||||
|
{
|
||||||
|
chWedge = qqq.ch[i];
|
||||||
|
eWedge = qqq.e[i] * qqqGain[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16];
|
||||||
|
chRing = qqq.ch[j] - 16;
|
||||||
|
eRing = qqq.e[j];
|
||||||
|
tRing = static_cast<double>(qqq.t[j]);
|
||||||
|
qqqID = qqq.id[i];
|
||||||
|
}
|
||||||
|
else if (qqq.ch[j] < 16 && 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];
|
||||||
|
chRing = qqq.ch[i] - 16;
|
||||||
|
tRing = static_cast<double>(qqq.t[i]);
|
||||||
|
eRing = qqq.e[i];
|
||||||
|
qqqID = qqq.id[i];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
// if (anodeIntersection.Z() != 0)
|
||||||
|
{
|
||||||
|
plotter->Fill2D("PC_Z_vs_QQQRing", 600, -300, 300, 16, 0, 16, anodeIntersection.Z(), chRing, "hPCzQQQ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anodeIntersection.Z() != 0 && cathodeHits.size() == 2)
|
||||||
|
{
|
||||||
|
plotter->Fill2D("PC_Z_vs_QQQRing_2C", 600, -300, 300, 16, 0, 16, anodeIntersection.Z(), chRing, "hPCzQQQ");
|
||||||
|
plotter->Fill2D("PC_Z_vs_QQQRing_2C" + std::to_string(qqq.id[i]), 600, -300, 300, 16, 0, 16, anodeIntersection.Z(), chRing, "hPCzQQQ");
|
||||||
|
plotter->Fill2D("PC_Z_vs_QQQWedge_2C", 600, -300, 300, 16, 0, 16, anodeIntersection.Z(), chWedge, "hPCzQQQ");
|
||||||
|
}
|
||||||
|
plotter->Fill2D("VertexRecon_QQQRingTC" + std::to_string(PCQQQTimeCut) + "PhiC" + std::to_string(PCQQQPhiCut), 600, -1300, 1300, 16, 0, 16, vector_closest_to_z.Z(), chRing, "hPCQQQ");
|
||||||
|
double phi = TMath::ATan2(anodeIntersection.Y(), anodeIntersection.X()) * 180. / TMath::Pi();
|
||||||
|
plotter->Fill2D("PolarAngle_Vs_QQQWedge" + std::to_string(qqqID), 360, -360, 360, 16, 0, 16, phi, chWedge, "hPCQQQ");
|
||||||
|
// plotter->Fill2D("EdE_PC_vs_QQQ_timegate_ls1000"+std::to_string())
|
||||||
|
|
||||||
|
plotter->Fill2D("PC_Z_vs_QQQRing_Det" + std::to_string(qqqID), 600, -300, 300, 16, 0, 16, anodeIntersection.Z(), chRing, "hPCQQQ");
|
||||||
|
//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);
|
||||||
|
|
||||||
|
for (int k = 0; k < pc.multi; k++)
|
||||||
|
{
|
||||||
|
if(pc.index[k] >= 24)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// double sinTheta = TMath::Sin((hitPos-vector_closest_to_z).Theta());
|
||||||
|
double sinTheta = TMath::Sin((anodeIntersection-TVector3(0,0,90.0)).Theta());
|
||||||
|
// double sinTheta = TMath::Sin((anodeIntersection-vector_closest_to_z).Theta());
|
||||||
|
// double sinTheta = TMath::Sin((hitPos-TVector3(0,0,30.0)).Theta());
|
||||||
|
// double sinTheta = TMath::Sin(hitPos.Theta());
|
||||||
|
|
||||||
|
if(cathodeHits.size()==2 && PCQQQPhiCut) {
|
||||||
|
plotter->Fill2D("CalibratedQQQE_RvsCPCE_TC" + std::to_string(PCQQQTimeCut) , 400, 0, 10, 400, 0, 30000, eRingMeV, pc.e[k]*sinTheta, "hPCQQQ");
|
||||||
|
plotter->Fill2D("CalibratedQQQE_WvsCPCE_TC" + std::to_string(PCQQQTimeCut) , 400, 0, 10, 400, 0, 30000, eWedgeMeV, pc.e[k]*sinTheta, "hPCQQQ");
|
||||||
|
plotter->Fill2D("CalibratedQQQE_RvsPCE_TC" + std::to_string(PCQQQTimeCut) , 400, 0, 10, 400, 0, 30000, eRingMeV, pc.e[k], "hPCQQQ");
|
||||||
|
plotter->Fill2D("CalibratedQQQE_WvsPCE_TC" + std::to_string(PCQQQTimeCut) , 400, 0, 10, 400, 0, 30000, eWedgeMeV, pc.e[k], "hPCQQQ");
|
||||||
|
plotter->Fill2D("PCQQQ_dTimevsdPhi", 200, -2000, 2000, 80, -200, 200, tRing - static_cast<double>(pc.t[k]), (hitPos.Phi()-anodeIntersection.Phi()) * 180. / TMath::Pi(), "hTiming");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}///qqq i==j case end
|
||||||
|
} //j loop end
|
||||||
|
} // qqq i loop end
|
||||||
|
|
||||||
|
TVector3 guessVertex(0,0,90.); //for run12, subtract anodeIntersection.Z() by ~74.0 seems to work
|
||||||
|
//rho=40.0 mm is halfway between the cathodes(rho=42) and anodes(rho=37)
|
||||||
|
double pcz_guess = 42.0/TMath::Tan((hitPos-guessVertex).Theta()) + guessVertex.Z(); //this is ideally kept to be all QQQ+userinput for calibration of pcz
|
||||||
|
if(PCQQQTimeCut && PCQQQPhiCut && hitPos.Perp()>0 && anodeIntersection.Perp()>0 && cathodeHits.size()>=2) {
|
||||||
|
plotter->Fill2D("pczguess_vs_qqqE",100,0,200,800,0,20,pcz_guess,qqqenergy,"pczguess");
|
||||||
|
double pczoffset=30.0;
|
||||||
|
//plotter->Fill2D("pczguess_vs_pcz_rad="+std::to_string(hitPos.Perp()),100,0,200,150,0,200,pcz_guess,anodeIntersection.Z(),"pczguess"); //entirely qqq-derived position vs entirely PC derived position
|
||||||
|
plotter->Fill2D("pczguess_vs_pcz_phi="+std::to_string(hitPos.Phi()*180./M_PI),100,0,200,150,0,200,pcz_guess,anodeIntersection.Z()+pczoffset,"pczguess"); //entirely qqq-derived position vs entirely PC derived position
|
||||||
|
plotter->Fill2D("pczguess_vs_pcz",100,0,200,150,0,200,pcz_guess,anodeIntersection.Z()+pczoffset);
|
||||||
|
plotter->Fill2D("pcz_vs_pcPhi_rad="+std::to_string(hitPos.Perp()),360,0,360,150,0,200,anodeIntersection.Phi()*180./M_PI,anodeIntersection.Z()+pczoffset,"pczguess");
|
||||||
|
}
|
||||||
|
for (int i = 0; i < sx3.multi; i++)
|
||||||
|
{
|
||||||
|
// plotting sx3 strip hits vs anode phi
|
||||||
|
if (sx3.ch[i] < 8 && anodeIntersection.Perp()>0)
|
||||||
|
plotter->Fill2D("PCPhi_vs_SX3Strip", 100, -200, 200, 8 * 24, 0, 8 * 24, anodeIntersection.Phi() * 180. / TMath::Pi(), sx3.id[i] * 8 + sx3.ch[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anodeIntersection.Z() != 0 && cathodeHits.size() == 3)
|
||||||
|
{
|
||||||
|
plotter->Fill1D("PC_Z_proj_3C", 600, -300, 300, anodeIntersection.Z(), "hPCzQQQ");
|
||||||
|
}
|
||||||
|
|
||||||
|
plotter->Fill2D("AnodeMaxE_Vs_Cathode_Sum_Energy", 2000, 0, 30000, 2000, 0, 30000, aEMax, cESum, "hGMPC");
|
||||||
|
plotter->Fill1D("Correlated_Cathode_MaxAnode", 6, 0, 5, corrcatMax.size(), "hGMPC");
|
||||||
|
plotter->Fill2D("Correlated_Cathode_VS_MaxAnodeEnergy", 6, 0, 5, 2000, 0, 30000, corrcatMax.size(), aEMax, "hGMPC");
|
||||||
|
plotter->Fill1D("AnodeHits", 12, 0, 11, anodeHits.size(), "hGMPC");
|
||||||
|
plotter->Fill2D("AnodeMaxE_vs_AnodeHits", 12, 0, 11, 2000, 0, 30000, anodeHits.size(), aEMax, "hGMPC");
|
||||||
|
|
||||||
|
if (anodeHits.size() < 1)
|
||||||
|
{
|
||||||
|
plotter->Fill1D("NoAnodeHits_CathodeHits", 6, 0, 5, cathodeHits.size(), "hGMPC");
|
||||||
|
}
|
||||||
|
|
||||||
|
return kTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MakeVertexSX3::Terminate()
|
||||||
|
{
|
||||||
|
plotter->FlushToDisk();
|
||||||
|
}
|
||||||
1114
anasen_analysis_vignesh/MakeVertexSX3.C.backup
Normal file
1114
anasen_analysis_vignesh/MakeVertexSX3.C.backup
Normal file
File diff suppressed because it is too large
Load Diff
132
anasen_analysis_vignesh/MakeVertexSX3.h
Normal file
132
anasen_analysis_vignesh/MakeVertexSX3.h
Normal file
|
|
@ -0,0 +1,132 @@
|
||||||
|
#ifndef MakeVertexSX3_h
|
||||||
|
#define MakeVertexSX3_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 MakeVertexSX3 : 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;
|
||||||
|
|
||||||
|
MakeVertexSX3(TTree * /*tree*/ =0) : fChain(0) { }
|
||||||
|
virtual ~MakeVertexSX3() { }
|
||||||
|
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(MakeVertexSX3,0);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MakeVertexSX3_cxx
|
||||||
|
void MakeVertexSX3::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);
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool_t MakeVertexSX3::Notify(){
|
||||||
|
return kTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MakeVertexSX3::SlaveBegin(TTree * /*tree*/){
|
||||||
|
// TString option = GetOption();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MakeVertexSX3::SlaveTerminate(){
|
||||||
|
}
|
||||||
|
#endif // #ifdef MakeVertexSX3_cxx
|
||||||
133
anasen_analysis_vignesh/MatchAndPlotCentroids.C
Normal file
133
anasen_analysis_vignesh/MatchAndPlotCentroids.C
Normal file
|
|
@ -0,0 +1,133 @@
|
||||||
|
#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.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.txt");
|
||||||
|
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
|
||||||
|
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
|
||||||
|
TCanvas *c1 = new TCanvas(Form("c_centroid_1_vs_%d", targetHist), Form("Centroid 1 vs %d", targetHist), 800, 600);
|
||||||
|
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); // Full circle marker
|
||||||
|
graph->SetMarkerSize(1.0);
|
||||||
|
graph->SetMarkerColor(kBlue);
|
||||||
|
// 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
anasen_analysis_vignesh/PCGainMatch.C
Normal file
454
anasen_analysis_vignesh/PCGainMatch.C
Normal file
|
|
@ -0,0 +1,454 @@
|
||||||
|
#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
anasen_analysis_vignesh/PCGainMatch.h
Normal file
114
anasen_analysis_vignesh/PCGainMatch.h
Normal file
|
|
@ -0,0 +1,114 @@
|
||||||
|
#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
|
||||||
82
anasen_analysis_vignesh/PreAnalysis.C
Normal file
82
anasen_analysis_vignesh/PreAnalysis.C
Normal file
|
|
@ -0,0 +1,82 @@
|
||||||
|
#define PreAnalysis_cxx
|
||||||
|
|
||||||
|
#include "PreAnalysis.h"
|
||||||
|
#include <TH2.h>
|
||||||
|
#include <TH1.h>
|
||||||
|
#include <TStyle.h>
|
||||||
|
#include <TCanvas.h>
|
||||||
|
|
||||||
|
#include "mapping.h"
|
||||||
|
|
||||||
|
TH2F ** hRate;
|
||||||
|
TH2F ** hEnergy;
|
||||||
|
|
||||||
|
|
||||||
|
int padID = 0;
|
||||||
|
|
||||||
|
void PreAnalysis::Begin(TTree * /*tree*/){
|
||||||
|
TString option = GetOption();
|
||||||
|
|
||||||
|
//Find the first and last timestamp, to get the run duration
|
||||||
|
|
||||||
|
hRate = new TH2F * [nBd];
|
||||||
|
hEnergy = new TH2F * [nBd];
|
||||||
|
for( int i = 0; i < nBd; i++){
|
||||||
|
if( board.at(i) > 1000) {
|
||||||
|
hRate[i] = new TH2F(Form("hRate%d", board.at(i)), Form("Digi-%d; ch; sec", board.at(i)), 64, 0, 64, 100, 0, 100);
|
||||||
|
hEnergy[i] = new TH2F(Form("hEnergy%d", board.at(i)), Form("Digi-%d; ch; raw E", board.at(i)), 64, 0, 64, 400, 0, 5000);
|
||||||
|
}else{
|
||||||
|
hRate[i] = new TH2F(Form("hRate%d", board.at(i)), Form("Digi-%d; ch; sec", board.at(i)), 16, 0, 16, 100, 0, 100);
|
||||||
|
hEnergy[i] = new TH2F(Form("hEnergy%d", board.at(i)), Form("Digi-%d; ch; raw E", board.at(i)), 16, 0, 16, 400, 0, 5000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("================================ done creating histograms.\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool_t PreAnalysis::Process(Long64_t entry){
|
||||||
|
|
||||||
|
b_multi->GetEntry(entry);
|
||||||
|
b_sn->GetEntry(entry);
|
||||||
|
b_ch->GetEntry(entry);
|
||||||
|
b_e->GetEntry(entry);
|
||||||
|
b_e_t->GetEntry(entry);
|
||||||
|
|
||||||
|
// printf("------------- multi: %lu\n", multi);
|
||||||
|
|
||||||
|
for( unsigned int i = 0; i < multi; i++){
|
||||||
|
|
||||||
|
for( int j = 0; j < nBd; j++ ){
|
||||||
|
|
||||||
|
if( sn[i] == board.at(j) ) {
|
||||||
|
hRate[j]->Fill(ch[i], e_t[i]/1e9);
|
||||||
|
|
||||||
|
hEnergy[j]->Fill(ch[i], e[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return kTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreAnalysis::Terminate(){
|
||||||
|
|
||||||
|
printf("================================ %s\n", __func__);
|
||||||
|
|
||||||
|
gStyle->SetOptStat("neiou");
|
||||||
|
TCanvas * canvas = new TCanvas("cANASEN", "Pre-Analysis, ANASEN", 4000, 800);
|
||||||
|
canvas->Divide(10,2);
|
||||||
|
|
||||||
|
for( int i = 0; i < nBd; i++){
|
||||||
|
padID++; canvas->cd(padID);
|
||||||
|
hRate[i]->Draw("colz");
|
||||||
|
}
|
||||||
|
|
||||||
|
for( int i = 0; i < nBd; i++){
|
||||||
|
padID++; canvas->cd(padID);
|
||||||
|
hEnergy[i]->Draw("colz");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
92
anasen_analysis_vignesh/PreAnalysis.h
Normal file
92
anasen_analysis_vignesh/PreAnalysis.h
Normal file
|
|
@ -0,0 +1,92 @@
|
||||||
|
#ifndef PreAnalysis_h
|
||||||
|
#define PreAnalysis_h
|
||||||
|
|
||||||
|
#include <TROOT.h>
|
||||||
|
#include <TChain.h>
|
||||||
|
#include <TFile.h>
|
||||||
|
#include <TSelector.h>
|
||||||
|
|
||||||
|
#define MAXMULTI 1000
|
||||||
|
|
||||||
|
class PreAnalysis : public TSelector {
|
||||||
|
public :
|
||||||
|
TTree *fChain; //!pointer to the analyzed TTree or TChain
|
||||||
|
|
||||||
|
// Declaration of leaf types
|
||||||
|
ULong64_t evID;
|
||||||
|
UInt_t multi;
|
||||||
|
UShort_t sn[MAXMULTI]; //[multi]
|
||||||
|
UShort_t ch[MAXMULTI]; //[multi]
|
||||||
|
UShort_t e[MAXMULTI]; //[multi]
|
||||||
|
UShort_t e2[MAXMULTI]; //[multi]
|
||||||
|
ULong64_t e_t[MAXMULTI]; //[multi]
|
||||||
|
UShort_t e_f[MAXMULTI]; //[multi]
|
||||||
|
Bool_t pileUp[MAXMULTI]; //[multi]
|
||||||
|
|
||||||
|
// List of branches
|
||||||
|
TBranch *b_event_ID; //!
|
||||||
|
TBranch *b_multi; //!
|
||||||
|
TBranch *b_sn; //!
|
||||||
|
TBranch *b_ch; //!
|
||||||
|
TBranch *b_e; //!
|
||||||
|
TBranch *b_e2; //!
|
||||||
|
TBranch *b_e_t; //!
|
||||||
|
TBranch *b_e_f; //!
|
||||||
|
TBranch *b_pileUp; //!
|
||||||
|
|
||||||
|
PreAnalysis(TTree * /*tree*/ =0) : fChain(0) { }
|
||||||
|
virtual ~PreAnalysis() { }
|
||||||
|
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(PreAnalysis,0);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PreAnalysis_cxx
|
||||||
|
void PreAnalysis::Init(TTree *tree){
|
||||||
|
|
||||||
|
// Set branch addresses and branch pointers
|
||||||
|
if (!tree) return;
|
||||||
|
fChain = tree;
|
||||||
|
fChain->SetMakeClass(1);
|
||||||
|
|
||||||
|
fChain->SetBranchAddress("evID", &evID, &b_event_ID);
|
||||||
|
fChain->SetBranchAddress("multi", &multi, &b_multi);
|
||||||
|
fChain->SetBranchAddress("sn", sn, &b_sn);
|
||||||
|
fChain->SetBranchAddress("ch", ch, &b_ch);
|
||||||
|
fChain->SetBranchAddress("e", e, &b_e);
|
||||||
|
fChain->SetBranchAddress("e2", e2, &b_e2);
|
||||||
|
fChain->SetBranchAddress("e_t", e_t, &b_e_t);
|
||||||
|
fChain->SetBranchAddress("e_f", e_f, &b_e_f);
|
||||||
|
fChain->SetBranchAddress("pileUp", pileUp, &b_pileUp);
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool_t PreAnalysis::Notify(){
|
||||||
|
|
||||||
|
return kTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreAnalysis::SlaveBegin(TTree * /*tree*/){
|
||||||
|
|
||||||
|
TString option = GetOption();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreAnalysis::SlaveTerminate(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // #ifdef PreAnalysis_cxx
|
||||||
34
anasen_analysis_vignesh/ProcessRun.sh
Executable file
34
anasen_analysis_vignesh/ProcessRun.sh
Executable file
|
|
@ -0,0 +1,34 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ "$#" -ne 3 ]; then
|
||||||
|
echo "Usage: $0 runID timeWindow_ns option"
|
||||||
|
echo "option: 0 - process raw data, 1 - process mapped data"
|
||||||
|
echo "Exiting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
runID=$1
|
||||||
|
timeWindow=$2
|
||||||
|
|
||||||
|
option=$3
|
||||||
|
|
||||||
|
# rawFolder=/home/tandem/data1/2024_09_17Fap/data
|
||||||
|
rawFolder=../Raw_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
|
||||||
|
|
||||||
|
fileList=`\ls -1 ${rawFolder}/*Run_${runID}_*.fsu`
|
||||||
|
|
||||||
|
# ./EventBuilder ${timeWindow} 0 0 100000000 ${fileList}
|
||||||
|
|
||||||
|
outFile=${rawFolder}/*${runID}*${timeWindow}.root
|
||||||
|
|
||||||
|
mv -vf ${outFile} ${rootFolder}/.
|
||||||
|
|
||||||
|
./Mapper ${rootFolder}/*${runID}*${timeWindow}.root
|
||||||
|
fi
|
||||||
|
|
||||||
|
root "processRun.C(\"${rootFolder}/Run_${runID}_mapped.root\")"
|
||||||
167
anasen_analysis_vignesh/QQQ_Calcheck.C
Normal file
167
anasen_analysis_vignesh/QQQ_Calcheck.C
Normal file
|
|
@ -0,0 +1,167 @@
|
||||||
|
|
||||||
|
#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
anasen_analysis_vignesh/QQQ_Calcheck.h
Normal file
114
anasen_analysis_vignesh/QQQ_Calcheck.h
Normal file
|
|
@ -0,0 +1,114 @@
|
||||||
|
#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
|
||||||
742
anasen_analysis_vignesh/TrackRecon.C.backup
Normal file
742
anasen_analysis_vignesh/TrackRecon.C.backup
Normal file
|
|
@ -0,0 +1,742 @@
|
||||||
|
#define TrackRecon_cxx
|
||||||
|
|
||||||
|
#include "TrackRecon.h"
|
||||||
|
#include "Armory/ClassPW.h"
|
||||||
|
#include "Armory/HistPlotter.h"
|
||||||
|
|
||||||
|
#include <TH2.h>
|
||||||
|
#include <TStyle.h>
|
||||||
|
#include <TCanvas.h>
|
||||||
|
#include <TMath.h>
|
||||||
|
#include <TBranch.h>
|
||||||
|
#include "TVector3.h"
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <map>
|
||||||
|
#include <utility>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
// Global instances
|
||||||
|
PW pw_contr;
|
||||||
|
PW pwinstance;
|
||||||
|
TVector3 hitPos;
|
||||||
|
|
||||||
|
struct Event {
|
||||||
|
TVector3 pos;
|
||||||
|
double Energy1=-1; //Front for QQQ, Anode for PC
|
||||||
|
double Energy2=-1; //Back for QQQ, Cathode for PC
|
||||||
|
double Time1=-1;
|
||||||
|
double Time2=-1;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Calibration globals
|
||||||
|
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}}};
|
||||||
|
// TCutg *cutQQQ;
|
||||||
|
|
||||||
|
// PC Arrays
|
||||||
|
double pcSlope[48];
|
||||||
|
double pcIntercept[48];
|
||||||
|
|
||||||
|
HistPlotter *plotter;
|
||||||
|
|
||||||
|
bool HitNonZero;
|
||||||
|
bool sx3ecut;
|
||||||
|
bool qqqEcut;
|
||||||
|
|
||||||
|
void TrackRecon::Begin(TTree * /*tree*/)
|
||||||
|
{
|
||||||
|
TString option = GetOption();
|
||||||
|
plotter = new HistPlotter("Analyzer_QQQ.root", "TFILE");
|
||||||
|
|
||||||
|
pw_contr.ConstructGeo();
|
||||||
|
pwinstance.ConstructGeo();
|
||||||
|
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
// 1. CRITICAL FIX: Initialize PC Arrays to Default (Raw)
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
for (int i = 0; i < 48; i++)
|
||||||
|
{
|
||||||
|
pcSlope[i] = 1.0; // Default slope = 1 (preserves Raw energy)
|
||||||
|
pcIntercept[i] = 0.0; // Default intercept = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate Crossover Geometry ONCE
|
||||||
|
TVector3 a, c, diff;
|
||||||
|
double a2, ac, c2, adiff, cdiff, denom, alpha;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < pwinstance.An.size(); i++)
|
||||||
|
{
|
||||||
|
a = pwinstance.An[i].first - pwinstance.An[i].second;
|
||||||
|
|
||||||
|
for (size_t 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);
|
||||||
|
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 = 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 || (i+j)%24 == 12)
|
||||||
|
{
|
||||||
|
Crossover[i][j][0].z = 9999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
Crossover[i][j][1].x = alpha;
|
||||||
|
Crossover[i][j][1].y = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load PC Calibrations
|
||||||
|
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;
|
||||||
|
if (index >= 0 && index <= 47)
|
||||||
|
{
|
||||||
|
pcSlope[index] = slope;
|
||||||
|
pcIntercept[index] = intercept;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inputFile.close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "Error opening slope_intercept.txt" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load QQQ Cuts from file
|
||||||
|
// {
|
||||||
|
// std::string filename = "QQQ_PCCut.root";
|
||||||
|
// TFile *cutFile = TFile::Open(filename.c_str(), "READ");
|
||||||
|
// if (cutFile && !cutFile->IsZombie())
|
||||||
|
// {
|
||||||
|
// cutQQQ = (TCutg *)cutFile->Get("cutQQQPC");
|
||||||
|
// if (cutQQQ)
|
||||||
|
// {
|
||||||
|
// std::cout << "Loaded QQQ PC cut from " << filename << std::endl;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// std::cerr << "Error: cutQQQPC not found in " << filename << std::endl;
|
||||||
|
// }
|
||||||
|
// cutFile->Close();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// ... (Load QQQ Gains and Calibs - same as before) ...
|
||||||
|
{
|
||||||
|
std::string filename = "qqq_GainMatch.dat";
|
||||||
|
std::ifstream infile(filename);
|
||||||
|
if (infile.is_open())
|
||||||
|
{
|
||||||
|
int det, ring, wedge;
|
||||||
|
double gainw, gainr;
|
||||||
|
while (infile >> det >> wedge >> ring >> gainw >> gainr)
|
||||||
|
{
|
||||||
|
qqqGain[det][wedge][ring] = gainw;
|
||||||
|
qqqGainValid[det][wedge][ring] = (gainw > 0);
|
||||||
|
// std::cout << "QQQ Gain Loaded: Det " << det << " Ring " << ring << " Wedge " << wedge << " GainW " << gainw << " GainR " << gainr << std::endl;
|
||||||
|
}
|
||||||
|
infile.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::string filename = "qqq_Calib.dat";
|
||||||
|
std::ifstream infile(filename);
|
||||||
|
if (infile.is_open())
|
||||||
|
{
|
||||||
|
int det, ring, wedge;
|
||||||
|
double slope;
|
||||||
|
while (infile >> det >> wedge >> ring >> slope)
|
||||||
|
{
|
||||||
|
qqqCalib[det][wedge][ring] = slope;
|
||||||
|
qqqCalibValid[det][wedge][ring] = (slope > 0);
|
||||||
|
// std::cout << "QQQ Calib Loaded: Det " << det << " Ring " << ring << " Wedge " << wedge << " Slope " << slope << std::endl;
|
||||||
|
}
|
||||||
|
infile.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool_t TrackRecon::Process(Long64_t entry)
|
||||||
|
{
|
||||||
|
hitPos.Clear();
|
||||||
|
HitNonZero = false;
|
||||||
|
bool qqq1000cut = false;
|
||||||
|
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();
|
||||||
|
|
||||||
|
// QQQ Processing
|
||||||
|
|
||||||
|
int qqqCount = 0;
|
||||||
|
int qqqAdjCh = 0;
|
||||||
|
// REMOVE WHEN RERUNNING USING THE NEW CALIBRATION FILE
|
||||||
|
for (int i = 0; i < qqq.multi; i++)
|
||||||
|
{
|
||||||
|
if ((qqq.id[i] == 3 || qqq.id[i] == 1) && qqq.ch[i] < 16)
|
||||||
|
{
|
||||||
|
qqq.ch[i] = 16 - qqq.ch[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < qqq.multi; i++)
|
||||||
|
{
|
||||||
|
if (qqq.id[i] == 0 && qqq.ch[i] >= 16)
|
||||||
|
{
|
||||||
|
qqq.ch[i] = 31 - qqq.ch[i] + 16;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<Event> QQQ_Events, PC_Events;
|
||||||
|
std::vector<Event> QQQ_Events_Raw, PC_Events_Raw;
|
||||||
|
|
||||||
|
|
||||||
|
bool PCQQQTimeCut = false;
|
||||||
|
for (int i = 0; i < qqq.multi; i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
plotter->Fill2D("QQQ_Index_Vs_Energy", 16 * 8, 0, 16 * 8, 2000, 0, 16000, qqq.index[i], qqq.e[i], "hRawQQQ");
|
||||||
|
|
||||||
|
for (int j = 0; j < qqq.multi; j++)
|
||||||
|
{
|
||||||
|
if (j == i)
|
||||||
|
continue;
|
||||||
|
plotter->Fill2D("QQQ_Coincidence_Matrix", 16 * 8, 0, 16 * 8, 16 * 8, 0, 16 * 8, qqq.index[i], qqq.index[j], "hRawQQQ");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int k = 0; k < pc.multi; k++)
|
||||||
|
{
|
||||||
|
if (pc.index[k] < 24 && pc.e[k] > 50)
|
||||||
|
{
|
||||||
|
plotter->Fill2D("QQQ_Vs_Anode_Energy", 400, 0, 4000, 1000, 0, 16000, qqq.e[i], pc.e[k], "hRawQQQ");
|
||||||
|
plotter->Fill2D("QQQ_Vs_PC_Index", 16 * 8, 0, 16 * 8, 24, 0, 24, qqq.index[i], pc.index[k], "hRawQQQ");
|
||||||
|
}
|
||||||
|
else if (pc.index[k] >= 24 && pc.e[k] > 50)
|
||||||
|
{
|
||||||
|
plotter->Fill2D("QQQ_Vs_Cathode_Energy", 400, 0, 4000, 1000, 0, 16000, qqq.e[i], pc.e[k], "hRawQQQ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int j = i + 1; j < qqq.multi; j++)
|
||||||
|
{
|
||||||
|
if (qqq.id[i] == qqq.id[j])
|
||||||
|
{
|
||||||
|
qqqCount++;
|
||||||
|
|
||||||
|
int chWedge = -1;
|
||||||
|
int chRing = -1;
|
||||||
|
double eWedge = 0.0;
|
||||||
|
double eWedgeMeV = 0.0;
|
||||||
|
double eRing = 0.0;
|
||||||
|
double eRingMeV = 0.0;
|
||||||
|
double tRing = 0.0;
|
||||||
|
double tWedge = 0.0;
|
||||||
|
|
||||||
|
if (qqq.ch[i] < 16 && qqq.ch[j] >= 16 && qqqGainValid[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16])
|
||||||
|
{
|
||||||
|
chWedge = qqq.ch[i];
|
||||||
|
eWedge = qqq.e[i] * qqqGain[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16];
|
||||||
|
chRing = qqq.ch[j] - 16;
|
||||||
|
eRing = qqq.e[j];
|
||||||
|
tRing = static_cast<double>(qqq.t[j]);
|
||||||
|
tWedge = static_cast<double>(qqq.t[i]);
|
||||||
|
}
|
||||||
|
else if (qqq.ch[j] < 16 && 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];
|
||||||
|
chRing = qqq.ch[i] - 16;
|
||||||
|
eRing = qqq.e[i];
|
||||||
|
tRing = static_cast<double>(qqq.t[i]);
|
||||||
|
tWedge = static_cast<double>(qqq.t[j]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
|
||||||
|
plotter->Fill1D("Wedgetime_Vs_Ringtime", 100, -1000, 1000, tWedge - tRing, "hTiming");
|
||||||
|
plotter->Fill2D("RingE_vs_Index", 16 * 4, 0, 16 * 4, 1000, 0, 16000, chRing + qqq.id[i] * 16, eRing, "hRawQQQ");
|
||||||
|
plotter->Fill2D("WedgeE_vs_Index", 16 * 4, 0, 16 * 4, 1000, 0, 16000, chWedge + qqq.id[i] * 16, eWedge, "hRawQQQ");
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
plotter->Fill2D("WedgeE_Vs_RingECal", 1000, 0, 10, 1000, 0, 10, eWedgeMeV, eRingMeV, "hCalQQQ");
|
||||||
|
|
||||||
|
for (int k = 0; k < pc.multi; k++)
|
||||||
|
{
|
||||||
|
plotter->Fill2D("RingCh_vs_Anode_Index", 16 * 4, 0, 16 * 4, 24, 0, 24, chRing + qqq.id[i] * 16, pc.index[k], "hRawQQQ");
|
||||||
|
plotter->Fill2D("WedgeCh_vs_Anode_Index", 16 * 4, 0, 16 * 4, 24, 0, 24, chWedge + qqq.id[i] * 16, pc.index[k], "hRawQQQ");
|
||||||
|
plotter->Fill2D("WedgeCh_vs_Anode_Index" + std::to_string(qqq.id[i]), 16 * 4, 0, 16 * 4, 24, 0, 24, chWedge + qqq.id[i] * 16, pc.index[k]);
|
||||||
|
plotter->Fill2D("RingCh_vs_Cathode_Index", 16 * 4, 0, 16 * 4, 24, 24, 48, chRing + qqq.id[i] * 16, pc.index[k], "hRawQQQ");
|
||||||
|
plotter->Fill2D("WedgeCh_vs_Cathode_Index", 16 * 4, 0, 16 * 4, 24, 24, 48, chWedge + qqq.id[i] * 16, pc.index[k], "hRawQQQ");
|
||||||
|
|
||||||
|
if (pc.index[k] < 24 && pc.e[k] > 50)
|
||||||
|
{
|
||||||
|
// plotter->Fill2D("QQQ_CalibW_Vs_PC_Energy", 1000, 0, 16, 2000, 0, 30000, eWedgeMeV, pc.e[k], "hCalQQQ");
|
||||||
|
// plotter->Fill2D("QQQ_CalibR_Vs_PC_Energy", 1000, 0, 16, 2000, 0, 30000, eRingMeV, pc.e[k], "hCalQQQ");
|
||||||
|
|
||||||
|
// if (tRing - static_cast<double>(pc.t[k]) < 0 && tRing - static_cast<double>(pc.t[k]) > -600)
|
||||||
|
// // {
|
||||||
|
// // plotter->Fill2D("QQQ_CalibW_Vs_PC_Energy_Tight", 1000, 0, 16, 2000, 0, 30000, eWedgeMeV, pc.e[k], "hCalQQQ");
|
||||||
|
// // plotter->Fill2D("QQQ_CalibR_Vs_PC_Energy_Tight", 1000, 0, 16, 2000, 0, 30000, eRingMeV, pc.e[k], "hCalQQQ");
|
||||||
|
// // }
|
||||||
|
// // else
|
||||||
|
// // {
|
||||||
|
// // plotter->Fill2D("QQQ_CalibW_Vs_PC_Energy_OffTime", 1000, 0, 16, 2000, 0, 30000, eWedgeMeV, pc.e[k], "hCalQQQ");
|
||||||
|
// // plotter->Fill2D("QQQ_CalibR_Vs_PC_Energy_OffTime", 1000, 0, 16, 2000, 0, 30000, eRingMeV, pc.e[k], "hCalQQQ");
|
||||||
|
// // }
|
||||||
|
plotter->Fill2D("Timing_Difference_QQQ_PC", 500, -1000, 1000, 16, 0, 16, tRing - static_cast<double>(pc.t[k]), chRing, "hTiming");
|
||||||
|
plotter->Fill2D("DelT_Vs_QQQRingECal", 500, -1000, 1000, 1000, 0, 10, tRing - static_cast<double>(pc.t[k]), eRingMeV, "hTiming");
|
||||||
|
plotter->Fill2D("CalibratedQQQEvsPCE_R", 1000, 0, 10, 2000, 0, 30000, eRingMeV, pc.e[k], "hPCQQQ");
|
||||||
|
plotter->Fill2D("CalibratedQQQEvsPCE_W", 1000, 0, 10, 2000, 0, 30000, eWedgeMeV, pc.e[k], "hPCQQQ");
|
||||||
|
if (tRing - static_cast<double>(pc.t[k]) < -150 && tRing - static_cast<double>(pc.t[k]) > -450) // 27Al
|
||||||
|
//if (tRing - static_cast<double>(pc.t[k]) < -70 && tRing - static_cast<double>(pc.t[k]) > -150) // 17F
|
||||||
|
{
|
||||||
|
PCQQQTimeCut = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pc.index[k] >= 24 && pc.e[k] > 50) {
|
||||||
|
plotter->Fill2D("Timing_Difference_QQQ_PC_Cathode", 500, -1000, 1000, 16, 0, 16, tRing - static_cast<double>(pc.t[k]), chRing, "hTiming");
|
||||||
|
}
|
||||||
|
} //end of pc loop
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
//Event qqqevent(TVector3(rho*TMath::Cos(theta),rho*TMath::Sin(theta),23+75+30), eRingMeV, eWedgeMeV, tRing, tWedge);
|
||||||
|
//Event qqqeventr(TVector3(rho*TMath::Cos(theta),rho*TMath::Sin(theta),23+75+30), eRing, eWedge, tRing, tWedge);
|
||||||
|
//QQQ_Events.push_back(qqqevent);
|
||||||
|
//QQQ_Events_Raw.push_back(qqqeventr);
|
||||||
|
plotter->Fill2D("QQQPolarPlot", 16 * 4, -TMath::Pi(), TMath::Pi(), 32, 40, 100, theta, rho, "hCalQQQ");
|
||||||
|
plotter->Fill2D("QQQCartesianPlot", 200, -100, 100, 200, -100, 100, rho * TMath::Cos(theta), rho * TMath::Sin(theta), "hCalQQQ");
|
||||||
|
plotter->Fill2D("QQQCartesianPlot" + std::to_string(qqq.id[i]), 200, -100, 100, 200, -100, 100, rho * TMath::Cos(theta), rho * TMath::Sin(theta), "hCalQQQ");
|
||||||
|
if (PCQQQTimeCut)
|
||||||
|
{
|
||||||
|
plotter->Fill2D("PC_XY_Projection_QQQ_TimeCut" + std::to_string(qqq.id[i]), 400, -100, 100, 400, -100, 100, rho * TMath::Cos(theta), rho * TMath::Sin(theta), "hPCQQQ");
|
||||||
|
}
|
||||||
|
plotter->Fill2D("PC_XY_Projection_QQQ" + std::to_string(qqq.id[i]), 400, -100, 100, 400, -100, 100, rho * TMath::Cos(theta), rho * TMath::Sin(theta), "hPCQQQ");
|
||||||
|
|
||||||
|
if (!HitNonZero)
|
||||||
|
{
|
||||||
|
double x = rho * TMath::Cos(theta);
|
||||||
|
double y = rho * TMath::Sin(theta);
|
||||||
|
hitPos.SetXYZ(x, y, 23 + 75 + 30);
|
||||||
|
HitNonZero = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
plotter->Fill1D("QQQ_Multiplicity", 10, 0, 10, qqqCount, "hRawQQQ");
|
||||||
|
|
||||||
|
// PC Gain Matching and Filling
|
||||||
|
double anodeT = -99999;
|
||||||
|
double cathodeT = 99999;
|
||||||
|
int anodeIndex = -1;
|
||||||
|
int cathodeIndex = -1;
|
||||||
|
for (int i = 0; i < pc.multi; i++)
|
||||||
|
{
|
||||||
|
if (pc.e[i] > 10)
|
||||||
|
{
|
||||||
|
plotter->Fill2D("PC_Index_Vs_Energy", 48, 0, 48, 2000, 0, 30000, pc.index[i], static_cast<double>(pc.e[i]), "hRawPC");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pc.index[i] < 48)
|
||||||
|
{
|
||||||
|
pc.e[i] = pcSlope[pc.index[i]] * pc.e[i] + pcIntercept[pc.index[i]];
|
||||||
|
plotter->Fill2D("PC_Index_VS_GainMatched_Energy", 48, 0, 48, 2000, 0, 30000, pc.index[i], pc.e[i], "hGMPC");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pc.index[i] < 24)
|
||||||
|
{
|
||||||
|
anodeT = static_cast<double>(pc.t[i]);
|
||||||
|
anodeIndex = pc.index[i];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cathodeT = static_cast<double>(pc.t[i]);
|
||||||
|
cathodeIndex = pc.index[i] - 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anodeT != -99999 && cathodeT != 99999)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < qqq.multi; j++)
|
||||||
|
{
|
||||||
|
plotter->Fill1D("PC_Time_qqq", 200, -2000, 2000, anodeT - cathodeT, "hTiming");
|
||||||
|
plotter->Fill2D("PC_Time_Vs_QQQ_ch", 200, -2000, 2000, 16 * 8, 0, 16 * 8, anodeT - cathodeT, qqq.ch[j], "hTiming");
|
||||||
|
plotter->Fill2D("PC_Time_vs_AIndex", 200, -2000, 2000, 24, 0, 24, anodeT - cathodeT, anodeIndex, "hTiming");
|
||||||
|
plotter->Fill2D("PC_Time_vs_CIndex", 200, -2000, 2000, 24, 0, 24, anodeT - cathodeT, cathodeIndex, "hTiming");
|
||||||
|
// plotter->Fill1D("PC_Time_A" + std::to_string(anodeIndex) + "_C" + std::to_string(cathodeIndex), 200, -1000, 1000, anodeT - cathodeT, "TimingPC");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int j = 0; j < sx3.multi; j++)
|
||||||
|
{
|
||||||
|
plotter->Fill1D("PC_Time_sx3", 200, -2000, 2000, anodeT - cathodeT, "hTiming");
|
||||||
|
}
|
||||||
|
|
||||||
|
plotter->Fill1D("PC_Time", 200, -2000, 2000, anodeT - cathodeT, "hTiming");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int j = i + 1; j < pc.multi; j++)
|
||||||
|
{
|
||||||
|
plotter->Fill2D("PC_Coincidence_Matrix", 48, 0, 48, 48, 0, 48, pc.index[i], pc.index[j], "hRawPC");
|
||||||
|
plotter->Fill2D("PC_Coincidence_Matrix_anodeMinusCathode_lt_-200_" + std::to_string(anodeT - cathodeT < -200), 48, 0, 48, 48, 0, 48, pc.index[i], pc.index[j], "hRawPC");
|
||||||
|
plotter->Fill2D("Anode_V_Anode", 24, 0, 24, 24, 0, 24, pc.index[i], pc.index[j], "hGMPC");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
anodeHits.clear();
|
||||||
|
cathodeHits.clear();
|
||||||
|
corrcatMax.clear();
|
||||||
|
|
||||||
|
int aID = 0;
|
||||||
|
int cID = 0;
|
||||||
|
double aE = 0;
|
||||||
|
double cE = 0;
|
||||||
|
double aESum = 0;
|
||||||
|
double cESum = 0;
|
||||||
|
double aEMax = 0;
|
||||||
|
int aIDMax = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < pc.multi; i++)
|
||||||
|
{
|
||||||
|
// if (pc.e[i] > 100)
|
||||||
|
{
|
||||||
|
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]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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; });
|
||||||
|
|
||||||
|
if (anodeHits.size() >= 1 && cathodeHits.size() >= 1)
|
||||||
|
{
|
||||||
|
// 2. CRITICAL FIX: Define reference vector 'a'
|
||||||
|
// In Analyzer.cxx, 'a' was left over from the loop. We use the first anode wire as reference here.
|
||||||
|
// (Assuming pwinstance.An is populated and wires are generally parallel).
|
||||||
|
TVector3 refAnode = pwinstance.An[0].first - pwinstance.An[0].second;
|
||||||
|
|
||||||
|
{
|
||||||
|
for (const auto &anode : anodeHits)
|
||||||
|
{
|
||||||
|
aID = anode.first;
|
||||||
|
aE = anode.second;
|
||||||
|
aESum += aE;
|
||||||
|
if (aE > aEMax)
|
||||||
|
{
|
||||||
|
aEMax = aE;
|
||||||
|
aIDMax = aID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto &cathode : cathodeHits)
|
||||||
|
{
|
||||||
|
cID = cathode.first;
|
||||||
|
cE = cathode.second;
|
||||||
|
plotter->Fill2D("AnodeMax_Vs_Cathode_Coincidence_Matrix", 24, 0, 24, 24, 0, 24, aIDMax, cID, "hRawPC");
|
||||||
|
plotter->Fill2D("Anode_Vs_Cathode_Coincidence_Matrix", 24, 0, 24, 24, 0, 24, aID, cID, "hRawPC");
|
||||||
|
plotter->Fill2D("Anode_vs_CathodeE", 2000, 0, 30000, 2000, 0, 30000, aE, cE, "hGMPC");
|
||||||
|
plotter->Fill2D("CathodeMult_V_CathodeE", 6, 0, 6, 2000, 0, 30000, cathodeHits.size(), cE, "hGMPC");
|
||||||
|
for (int j = -4; j < 3; j++)
|
||||||
|
{
|
||||||
|
if ((aIDMax + 24 + j) % 24 == 23 - cID)
|
||||||
|
{
|
||||||
|
corrcatMax.push_back(std::pair<int, double>(cID, cE));
|
||||||
|
cESum += cE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TVector3 anodeIntersection;
|
||||||
|
anodeIntersection.Clear();
|
||||||
|
if (corrcatMax.size() > 0)
|
||||||
|
{
|
||||||
|
double x = 0, y = 0, z = 0;
|
||||||
|
for (const auto &corr : corrcatMax)
|
||||||
|
{
|
||||||
|
if (Crossover[aIDMax][corr.first][0].z > 9000000)
|
||||||
|
continue;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (x == 0 && y == 0 && z == 0)
|
||||||
|
;
|
||||||
|
// to ignore events with no valid crossover points
|
||||||
|
else
|
||||||
|
anodeIntersection = TVector3(x, -y, -z);
|
||||||
|
// std::cout << "Anode Intersection: " << anodeIntersection.X() << ", " << anodeIntersection.Y() << ", " << anodeIntersection.Z() << std::endl;
|
||||||
|
}
|
||||||
|
bool PCQQQPhiCut = false;
|
||||||
|
// flip the algorithm for cathode 1 multi anode events
|
||||||
|
if ((hitPos.Phi() > (anodeIntersection.Phi() - TMath::PiOver4())) && (hitPos.Phi() < (anodeIntersection.Phi() + TMath::PiOver4()))) {
|
||||||
|
PCQQQPhiCut = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// for (double Tz = -190; Tz <= 190; Tz += 10.0)
|
||||||
|
// {
|
||||||
|
// TVector3 TargetPos(0, 0, Tz);
|
||||||
|
// plotter->Fill2D("Inttheta_vs_QQQtheta_TC" + std::to_string(PCQQQTimeCut) + "_TZ" + std::to_string(Tz), 90, 0, 180, 120, 0, 180, (anodeIntersection - TargetPos).Theta() * 180. / TMath::Pi(), (hitPos - TargetPos).Theta() * 180. / TMath::Pi(), "TPosVariation");
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (anodeIntersection.Z() != 0)
|
||||||
|
{
|
||||||
|
plotter->Fill1D("PC_Z_Projection", 600, -300, 300, anodeIntersection.Z(), "hPCzQQQ");
|
||||||
|
plotter->Fill2D("Z_Proj_VsDelTime", 600, -300, 300, 200, -2000, 2000, anodeIntersection.Z(), anodeT - cathodeT, "hPCzQQQ");
|
||||||
|
plotter->Fill2D("IntPhi_vs_QQQphi", 100, -200, 200, 80, -200, 200, anodeIntersection.Phi() * 180. / TMath::Pi(), hitPos.Phi() * 180. / TMath::Pi(), "hPCQQQ");
|
||||||
|
plotter->Fill2D("Inttheta_vs_QQQtheta", 90, 0, 180, 20, 0, 45, anodeIntersection.Theta() * 180. / TMath::Pi(), hitPos.Theta() * 180. / TMath::Pi(), "hPCQQQ");
|
||||||
|
plotter->Fill2D("Inttheta_vs_QQQtheta_TC" + std::to_string(PCQQQTimeCut), 90, 0, 180, 20, 0, 45, anodeIntersection.Theta() * 180. / TMath::Pi(), hitPos.Theta() * 180. / TMath::Pi(), "hPCQQQ");
|
||||||
|
plotter->Fill2D("IntPhi_vs_QQQphi_TC" + std::to_string(PCQQQTimeCut) + "PhiC" + std::to_string(PCQQQPhiCut), 100, -200, 200, 80, -200, 200, anodeIntersection.Phi() * 180. / TMath::Pi(), hitPos.Phi() * 180. / TMath::Pi(), "hPCQQQ");
|
||||||
|
}
|
||||||
|
if (anodeIntersection.Z() != 0 && cathodeHits.size() >= 2)
|
||||||
|
plotter->Fill1D("PC_Z_Projection_TC" + std::to_string(PCQQQTimeCut) + "PhiC" + std::to_string(PCQQQPhiCut), 600, -300, 300, anodeIntersection.Z(), "hPCzQQQ");
|
||||||
|
|
||||||
|
if (anodeIntersection.Z() != 0 && cathodeHits.size() == 1)
|
||||||
|
{
|
||||||
|
plotter->Fill1D("PC_Z_proj_1C", 600, -300, 300, anodeIntersection.Z(), "hPCzQQQ");
|
||||||
|
plotter->Fill2D("IntersectionPhi_vs_AnodeZ_1C", 400, -200, 200, 600, -300, 300, anodeIntersection.Phi() * 180. / TMath::Pi(), anodeIntersection.Z(), "hPCzQQQ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anodeIntersection.Z() != 0 && cathodeHits.size() == 2)
|
||||||
|
{
|
||||||
|
plotter->Fill1D("PC_Z_proj_2C", 600, -300, 300, anodeIntersection.Z(), "hPCzQQQ");
|
||||||
|
plotter->Fill2D("IntersectionPhi_vs_AnodeZ_2C", 400, -200, 200, 600, -300, 300, anodeIntersection.Phi() * 180. / TMath::Pi(), anodeIntersection.Z(), "hGMPC");
|
||||||
|
}
|
||||||
|
if (anodeIntersection.Z() != 0 && cathodeHits.size() > 2)
|
||||||
|
{
|
||||||
|
plotter->Fill1D("PC_Z_proj_nC", 600, -300, 300, anodeIntersection.Z(), "hPCzQQQ");
|
||||||
|
plotter->Fill2D("IntersectionPhi_vs_AnodeZ_nC", 400, -200, 200, 600, -300, 300, anodeIntersection.Phi() * 180. / TMath::Pi(), anodeIntersection.Z(), "hGMPC");
|
||||||
|
}
|
||||||
|
if (anodeHits.size() > 0 && cathodeHits.size() > 0)
|
||||||
|
plotter->Fill2D("AHits_vs_CHits", 12, 0, 11, 6, 0, 5, anodeHits.size(), cathodeHits.size(), "hRawPC");
|
||||||
|
|
||||||
|
// make another plot with nearest neighbour constraint
|
||||||
|
bool hasNeighbourAnodes = false;
|
||||||
|
bool hasNeighbourCathodes = false;
|
||||||
|
|
||||||
|
// 1. Check Anodes for neighbours (including wrap-around 0-23)
|
||||||
|
for (size_t i = 0; i < anodeHits.size(); i++)
|
||||||
|
{
|
||||||
|
for (size_t j = i + 1; j < anodeHits.size(); j++)
|
||||||
|
{
|
||||||
|
int diff = std::abs(anodeHits[i].first - anodeHits[j].first);
|
||||||
|
if (diff == 1 || diff == 23)
|
||||||
|
{ // 23 handles the cylindrical wrap
|
||||||
|
hasNeighbourAnodes = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasNeighbourAnodes)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Check Cathodes for neighbours (including wrap-around 0-23)
|
||||||
|
for (size_t i = 0; i < cathodeHits.size(); i++)
|
||||||
|
{
|
||||||
|
for (size_t j = i + 1; j < cathodeHits.size(); j++)
|
||||||
|
{
|
||||||
|
int diff = std::abs(cathodeHits[i].first - cathodeHits[j].first);
|
||||||
|
if (diff == 1 || diff == 23)
|
||||||
|
{
|
||||||
|
hasNeighbourCathodes = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasNeighbourCathodes)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
// FILL PLOTS
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
if (anodeHits.size() > 0 && cathodeHits.size() > 0)
|
||||||
|
{
|
||||||
|
plotter->Fill2D("AHits_vs_CHits_NA" + std::to_string(hasNeighbourAnodes), 12, 0, 11, 6, 0, 5, anodeHits.size(), cathodeHits.size(), "hRawPC");
|
||||||
|
plotter->Fill2D("AHits_vs_CHits_NC" + std::to_string(hasNeighbourCathodes), 12, 0, 11, 6, 0, 5, anodeHits.size(), cathodeHits.size(), "hRawPC");
|
||||||
|
|
||||||
|
// Constraint Plot: Only fill if BOTH planes have adjacent hits
|
||||||
|
// This effectively removes events with only isolated single-wire hits (noise)
|
||||||
|
if (hasNeighbourAnodes && hasNeighbourCathodes)
|
||||||
|
{
|
||||||
|
plotter->Fill2D("AHits_vs_CHits_NN", 12, 0, 11, 6, 0, 5, anodeHits.size(), cathodeHits.size(), "hRawPC");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (HitNonZero && anodeIntersection.Z() != 0)
|
||||||
|
{
|
||||||
|
pw_contr.CalTrack2(hitPos, anodeIntersection);
|
||||||
|
plotter->Fill1D("VertexRecon", 600, -1300, 1300, pw_contr.GetZ0());
|
||||||
|
plotter->Fill1D("VertexRecon_TC"+std::to_string(PCQQQTimeCut)+"_PhiC"+std::to_string(PCQQQPhiCut), 600, -300, 300, pw_contr.GetZ0());
|
||||||
|
|
||||||
|
if (cathodeHits.size() == 2)
|
||||||
|
plotter->Fill1D("VertexRecon_2c_TC"+std::to_string(PCQQQTimeCut)+"_PhiC"+std::to_string(PCQQQPhiCut), 600, -300, 300, pw_contr.GetZ0());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < qqq.multi; i++)
|
||||||
|
{
|
||||||
|
if (PCQQQTimeCut) {
|
||||||
|
plotter->Fill2D("PC_XY_Projection_QQQ_TimeCut" + std::to_string(qqq.id[i]), 400, -100, 100, 400, -100, 100, anodeIntersection.X(), anodeIntersection.Y(), "hPCQQQ");
|
||||||
|
}
|
||||||
|
plotter->Fill2D("PC_XY_Projection_QQQ" + std::to_string(qqq.id[i]), 400, -100, 100, 400, -100, 100, anodeIntersection.X(), anodeIntersection.Y(), "hPCQQQ");
|
||||||
|
|
||||||
|
for (int j = i + 1; j < qqq.multi; j++)
|
||||||
|
{
|
||||||
|
if (qqq.id[i] == qqq.id[j])
|
||||||
|
{
|
||||||
|
int chWedge = -1;
|
||||||
|
int chRing = -1;
|
||||||
|
double eWedge = 0.0;
|
||||||
|
double eWedgeMeV = 0.0;
|
||||||
|
double eRing = 0.0;
|
||||||
|
double eRingMeV = 0.0;
|
||||||
|
double tRing = 0.0;
|
||||||
|
int qqqID = -1;
|
||||||
|
if (qqq.ch[i] < 16 && qqq.ch[j] >= 16 && qqqGainValid[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16])
|
||||||
|
{
|
||||||
|
chWedge = qqq.ch[i];
|
||||||
|
eWedge = qqq.e[i] * qqqGain[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16];
|
||||||
|
chRing = qqq.ch[j] - 16;
|
||||||
|
eRing = qqq.e[j];
|
||||||
|
tRing = static_cast<double>(qqq.t[j]);
|
||||||
|
qqqID = qqq.id[i];
|
||||||
|
}
|
||||||
|
else if (qqq.ch[j] < 16 && 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];
|
||||||
|
chRing = qqq.ch[i] - 16;
|
||||||
|
tRing = static_cast<double>(qqq.t[i]);
|
||||||
|
eRing = qqq.e[i];
|
||||||
|
qqqID = qqq.id[i];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
// if (anodeIntersection.Z() != 0)
|
||||||
|
{
|
||||||
|
plotter->Fill2D("PC_Z_vs_QQQRing", 600, -300, 300, 16, 0, 16, anodeIntersection.Z(), chRing, "hPCzQQQ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anodeIntersection.Z() != 0 && cathodeHits.size() == 2)
|
||||||
|
{
|
||||||
|
plotter->Fill2D("PC_Z_vs_QQQRing_2C", 600, -300, 300, 16, 0, 16, anodeIntersection.Z(), chRing, "hPCzQQQ");
|
||||||
|
plotter->Fill2D("PC_Z_vs_QQQRing_2C" + std::to_string(qqq.id[i]), 600, -300, 300, 16, 0, 16, anodeIntersection.Z(), chRing, "hPCzQQQ");
|
||||||
|
plotter->Fill2D("PC_Z_vs_QQQWedge_2C", 600, -300, 300, 16, 0, 16, anodeIntersection.Z(), chWedge, "hPCzQQQ");
|
||||||
|
}
|
||||||
|
plotter->Fill2D("Vertex_V_QQQRingTC" + std::to_string(PCQQQTimeCut) + "PhiC" + std::to_string(PCQQQPhiCut), 600, -300, 300, 16, 0, 16, pw_contr.GetZ0(), chRing, "hPCQQQ");
|
||||||
|
double phi = TMath::ATan2(anodeIntersection.Y(), anodeIntersection.X()) * 180. / TMath::Pi();
|
||||||
|
plotter->Fill2D("PolarAngle_Vs_QQQWedge" + std::to_string(qqqID), 360, -360, 360, 16, 0, 16, phi, chWedge, "hPCQQQ");
|
||||||
|
// plotter->Fill2D("EdE_PC_vs_QQQ_timegate_ls1000"+std::to_string())
|
||||||
|
|
||||||
|
plotter->Fill2D("PC_Z_vs_QQQRing_Det" + std::to_string(qqqID), 600, -300, 300, 16, 0, 16, anodeIntersection.Z(), chRing, "hPCQQQ");
|
||||||
|
//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);
|
||||||
|
|
||||||
|
for (int k = 0; k < pc.multi; k++)
|
||||||
|
{
|
||||||
|
if(pc.index[k] >= 24)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
double sinTheta = TMath::Sin(hitPos.Theta());
|
||||||
|
|
||||||
|
plotter->Fill2D("CalibratedQQQE_RvsPCE_TC" + std::to_string(PCQQQTimeCut) + "PhiC" + std::to_string(PCQQQPhiCut), 1000, 0, 10, 2000, 0, 30000, eRingMeV, pc.e[k]*sinTheta, "hPCQQQ");
|
||||||
|
plotter->Fill2D("CalibratedQQQE_WvsPCE_TC" + std::to_string(PCQQQTimeCut) + "PhiC" + std::to_string(PCQQQPhiCut), 1000, 0, 10, 2000, 0, 30000, eWedgeMeV, pc.e[k]*sinTheta, "hPCQQQ");
|
||||||
|
plotter->Fill2D("PCQQQ_dTimevsdPhi", 200, -2000, 2000, 80, -200, 200, tRing - static_cast<double>(pc.t[k]), (hitPos.Phi()-anodeIntersection.Phi()) * 180. / TMath::Pi(), "hTiming");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < sx3.multi; i++)
|
||||||
|
{
|
||||||
|
// plotting sx3 strip hits vs anode phi
|
||||||
|
if (sx3.ch[i] < 8)
|
||||||
|
plotter->Fill2D("AnodePhi_vs_SX3Strip", 100, -200, 200, 8 * 24, 0, 8 * 24, anodeIntersection.Phi() * 180. / TMath::Pi(), sx3.id[i] * 8 + sx3.ch[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anodeIntersection.Z() != 0 && cathodeHits.size() == 3)
|
||||||
|
{
|
||||||
|
plotter->Fill1D("PC_Z_proj_3C", 600, -300, 300, anodeIntersection.Z(), "hPCzQQQ");
|
||||||
|
}
|
||||||
|
|
||||||
|
plotter->Fill2D("AnodeMaxE_Vs_Cathode_Sum_Energy", 2000, 0, 30000, 2000, 0, 30000, aEMax, cESum, "hGMPC");
|
||||||
|
plotter->Fill1D("Correlated_Cathode_MaxAnode", 6, 0, 5, corrcatMax.size(), "hGMPC");
|
||||||
|
plotter->Fill2D("Correlated_Cathode_VS_MaxAnodeEnergy", 6, 0, 5, 2000, 0, 30000, corrcatMax.size(), aEMax, "hGMPC");
|
||||||
|
plotter->Fill1D("AnodeHits", 12, 0, 11, anodeHits.size(), "hGMPC");
|
||||||
|
plotter->Fill2D("AnodeMaxE_vs_AnodeHits", 12, 0, 11, 2000, 0, 30000, anodeHits.size(), aEMax, "hGMPC");
|
||||||
|
|
||||||
|
if (anodeHits.size() < 1)
|
||||||
|
{
|
||||||
|
plotter->Fill1D("NoAnodeHits_CathodeHits", 6, 0, 5, cathodeHits.size(), "hGMPC");
|
||||||
|
}
|
||||||
|
|
||||||
|
return kTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TrackRecon::Terminate()
|
||||||
|
{
|
||||||
|
plotter->FlushToDisk();
|
||||||
|
}
|
||||||
BIN
anasen_analysis_vignesh/WedgeChVAnode.jpeg
Normal file
BIN
anasen_analysis_vignesh/WedgeChVAnode.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 201 KiB |
19
anasen_analysis_vignesh/buildEvents.sh
Executable file
19
anasen_analysis_vignesh/buildEvents.sh
Executable file
|
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ "$#" -ne 2 ]; then
|
||||||
|
echo "Usage: $0 runID timeWindow_ns"
|
||||||
|
echo "Exiting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
runID=$1
|
||||||
|
timeWindow=$2
|
||||||
|
|
||||||
|
rawFolder=/media/nvmeData/ANASEN_test
|
||||||
|
rootFoler=/media/nvmeData/ANASEN_test/root_data
|
||||||
|
|
||||||
|
fileList=`\ls -1 ${rawFolder}/*${runID}*.fsu`
|
||||||
|
|
||||||
|
./EventBuilderNoTrace ${timeWindow} 0 ${fileList}
|
||||||
|
|
||||||
|
mv -vf ${rawFolder}/*${runID}*${timeWindow}_noTrace.root ${rootFoler}/.
|
||||||
1109
anasen_analysis_vignesh/elog/elogd.cfg
Normal file
1109
anasen_analysis_vignesh/elog/elogd.cfg
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,13 @@
|
||||||
|
#include "/home/sud/Desktop/Software2/propagator/elastcaller.h"
|
||||||
|
void make_eloss_table() {
|
||||||
|
double einput = 6.0, estepnow;
|
||||||
|
double target_thickness_unit = 1e-3; //mg/cm2.
|
||||||
|
double density = 0.0711;//mg/cm3
|
||||||
|
long i=0;
|
||||||
|
while(einput > 4.0) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
anasen_analysis_vignesh/eloss_calculations/stopit/a.out
Executable file
BIN
anasen_analysis_vignesh/eloss_calculations/stopit/a.out
Executable file
Binary file not shown.
811
anasen_analysis_vignesh/eloss_calculations/stopit/desorb.for
Executable file
811
anasen_analysis_vignesh/eloss_calculations/stopit/desorb.for
Executable file
|
|
@ -0,0 +1,811 @@
|
||||||
|
subroutine desorb(ianz,zp,ap,ep,loste)
|
||||||
|
|
||||||
|
C ** CALCULATES ENERGY LOSS IN AN ABSORBER SANDWICH *******
|
||||||
|
C **** ENERGY DEPOSIT IN SECTIONS OF IONIZATION **********
|
||||||
|
C *************** CHAMBER (DE1, DE2, AND DE3) ************
|
||||||
|
|
||||||
|
|
||||||
|
PARAMETER (DSEP0=4.0,isold0=1)
|
||||||
|
|
||||||
|
COMMON ISG(19),INN(19),DEN(19),THK(19),PRS(19),XLN(19),ARDEN(19)
|
||||||
|
1 ,ZNUMB(19,4),ANUMB(19,4),ELNUM(19,4),CONCN(19,4)
|
||||||
|
1 ,PRDEN(19,4),PRTHK(19,4)
|
||||||
|
DIMENSION ZNUMBW(4),ANUMBW(4),ELNUMW(4),CONCNW(4)
|
||||||
|
1 ,PRDENW(4),PRTHKW(4)
|
||||||
|
DIMENSION E(19),DE(19),xmem(19)
|
||||||
|
DIMENSION TOUT(19),TOUTE(19)
|
||||||
|
dimension eptable(50,500,2),emintabz(50),ianzv(5)
|
||||||
|
real loste(19)
|
||||||
|
DATA io1,IO2,IO3,io0/9,11,12,1/
|
||||||
|
data iopt,ianzi,ianzide/1,2,1/
|
||||||
|
c
|
||||||
|
save eltimo,izmax,izth
|
||||||
|
|
||||||
|
c the mass table is to be used only for iopt = 5,6
|
||||||
|
c use atomic masses to average for isotipic composition.
|
||||||
|
c taken from Formulas Facts and Constants, H. J. Fischbeck and
|
||||||
|
c K. H. Fischbeck. Springer - Verlag 1987 2nd ed, pages 164-183.
|
||||||
|
|
||||||
|
dimension amass(70)
|
||||||
|
data amass/1.01,4.00,6.94,9.01,10.81,12.01,14.01,16.00,19.00
|
||||||
|
1,20.18,22.99,24.31,26.98,28.09,30.97,32.07,35.45,39.95
|
||||||
|
2,39.10,40.08,44.96,47.88,50.94,52.00,54.94,55.85,58.93
|
||||||
|
3,58.69,63.55,65.39,69.72,72.59,74.92,78.96,79.90,83.80
|
||||||
|
4,85.47,87.62,88.91,91.22,92.91,95.94,98.,101.07,102.91
|
||||||
|
5,106.42,107.87,112.41,114.82,118.71,121.75,127.60,126.90
|
||||||
|
6,131.29,132.91,137.33,138.91,140.12,140.91,144.24,147.
|
||||||
|
7,150.36,151.96,157.25,158.93,162.5,164.93,167.26,168.93
|
||||||
|
8,173.04/
|
||||||
|
|
||||||
|
c for Z > 70, you are in trouble !!
|
||||||
|
c
|
||||||
|
c open(unit=IO1, status='OLD', file='absorb.inp')
|
||||||
|
open(unit=IO2, status='OLD', file='desorb.out')
|
||||||
|
c rewind IO1
|
||||||
|
c rewind IO2
|
||||||
|
c
|
||||||
|
10 CONTINUE
|
||||||
|
|
||||||
|
|
||||||
|
C IOPT = 1 - SUPPLY ENERGY OF PARTICLE ENTERING
|
||||||
|
C THE ABSORBER ARRAY AND GET LOSS AND
|
||||||
|
C RANGES
|
||||||
|
C IOPT = 2 - SUPPLY TARGET, PROECTILE AND EJECTILE
|
||||||
|
C INFO. AND THEN GO THROUGH ABSORBER
|
||||||
|
C SANDWICH
|
||||||
|
C IOPT = 3 - CALCULATE ENERGY DEPOSITS IN DETECTOR
|
||||||
|
C DETECTOR DIMENSIONS ARE STANDARD AND
|
||||||
|
C THE VARIABLE -'IDET' - CHOOSES BETWEEN
|
||||||
|
C VARIETY OF AVAILABLE DETECTORS
|
||||||
|
C IOPT = 4 - FINDS MAXIMUM ENERGY THAT CAN BE STOPPED IN
|
||||||
|
C IANZ ELEMENTS OF THE SANDWICH FOR GIVEN
|
||||||
|
C ZP, AP.
|
||||||
|
C WHEN CALCULATION IS FINISHED, THE PROGRAM READS
|
||||||
|
C IN NEW VALUES OF ZP, AP AND RESTARTS. TO END
|
||||||
|
C THE PROGRAM, GIVE ZP < 0.
|
||||||
|
C IN ORDER TO HELP THE SPEED OF THE PROGRAM,
|
||||||
|
C GIVE THE PARTICLE'S "Z" IN increasing ORDER.
|
||||||
|
C IOPT = 5 - STORES ARRAYS OF Edet AS A FUNCTION OF INCIDENT
|
||||||
|
C ENERGY AND THE PARTICLE'S ID (Z,A)
|
||||||
|
C ARRAY LABELED eptable(Z-Zth,Einc,ipunch)
|
||||||
|
C ipunch = 1 stopped, = 2 punched through
|
||||||
|
c Einc = E(incident)/detable
|
||||||
|
C Zth = lowest Z considered - 1
|
||||||
|
C
|
||||||
|
C ************************************************************
|
||||||
|
|
||||||
|
c read(io1,*) iopt
|
||||||
|
c1 FORMAT(10I)
|
||||||
|
DSEP = DSEP0
|
||||||
|
isold = isold0
|
||||||
|
c
|
||||||
|
IF(iopt.LT.0) GO TO 2000
|
||||||
|
|
||||||
|
|
||||||
|
C ***********************************************************
|
||||||
|
c
|
||||||
|
if(iopt.eq.3) then
|
||||||
|
open(unit=IO3, status='OLD', file='absorbv.out')
|
||||||
|
rewind IO3
|
||||||
|
endif
|
||||||
|
c
|
||||||
|
if(iopt.ge.5) then
|
||||||
|
do itpun = 1,2
|
||||||
|
do itblz = 1,50
|
||||||
|
emintabz(itblz) = 0.
|
||||||
|
do itble = 1,500
|
||||||
|
eptable ( itblz,itble,itpun ) = 0.
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
c
|
||||||
|
open(unit=io0, status='UNKNOWN', file='abs.tbl')
|
||||||
|
rewind io0
|
||||||
|
c
|
||||||
|
else
|
||||||
|
endif
|
||||||
|
|
||||||
|
C ***********************************************************
|
||||||
|
|
||||||
|
c ianz = number of elements in absorber "sandwich" - the
|
||||||
|
c particle deposits all its energy in these layers.
|
||||||
|
c ianzi = index of last layer in which the energy of the
|
||||||
|
c particle is not recorded - this unreecorded energy
|
||||||
|
c is used in the DST production in two modes:
|
||||||
|
c when making DST tape from data:
|
||||||
|
c Since the detector records only deposited energy
|
||||||
|
c the output tables are used to correct for this
|
||||||
|
c deficinecy and for a given dharge and mass extrapolate
|
||||||
|
c the measured energy to the target exit energy
|
||||||
|
c when making DST tape from model calculations:
|
||||||
|
c The "lost" energy is a source of broadening of the
|
||||||
|
c energy spectra due to straggling - this "smearing"
|
||||||
|
c is estimated and superposed on the calculated spectra.
|
||||||
|
c ianzide = element # for DE calculation
|
||||||
|
c
|
||||||
|
c read(IO1,*) ianz,ianzi,ianzide
|
||||||
|
c
|
||||||
|
c ianzv(5)
|
||||||
|
c = Index of layer where exiting particle velocit is
|
||||||
|
c calculated (only for option 3) max = 5
|
||||||
|
c
|
||||||
|
c if(iopt.eq.3) read (IO1,*) knz
|
||||||
|
c if(iopt.eq.3) read (IO1,*) (ianzv(k),k=1,knz)
|
||||||
|
C ***********************************************************
|
||||||
|
|
||||||
|
C AP = PROJECTILE MASS
|
||||||
|
C ZP = PROJECTILE CHARGE
|
||||||
|
C EP = PROJECTILE ENERGY
|
||||||
|
c
|
||||||
|
c read(io1,*) zp,ap,ep
|
||||||
|
2 FORMAT(f10.3)
|
||||||
|
|
||||||
|
C *************************************************************
|
||||||
|
c
|
||||||
|
c zth= threshold Z for incident energy tble calc. (iopt=5,6)
|
||||||
|
c zmax = maximum z for table calculation
|
||||||
|
c detable = the energy step size used for array storage
|
||||||
|
c emin = starting incident energy for table
|
||||||
|
c emax = mazximum incident energy for table calculation
|
||||||
|
c EP is ignored when iopt = 5 or 6
|
||||||
|
c
|
||||||
|
if(iopt.ge.5) then
|
||||||
|
read(IO1,*) zth,zmax,emintab,emaxtab,detable
|
||||||
|
eltimeo = secnds(0.0) ! start timing
|
||||||
|
izth = ifix (zth + 0.01)
|
||||||
|
izmax = ifix (zmax + 0.01)
|
||||||
|
c
|
||||||
|
c if detable > emintab change emintab to 1/2 * detable
|
||||||
|
c
|
||||||
|
if(emintab.lt.detable) emintab = 0.5*detable
|
||||||
|
write(io2,291) zth+1,zmax,emintab,emaxtab,detable
|
||||||
|
else
|
||||||
|
endif
|
||||||
|
c
|
||||||
|
C ************************************************************
|
||||||
|
|
||||||
|
C IN THE FOLLOWING THE LISTED VARIABLES ARE INDEXED
|
||||||
|
C THE INDICES I AND J STAND FOR THE FOLLOWING:
|
||||||
|
C - I - SERIAL NUMBER OF ABSORBER LAYER (<20)
|
||||||
|
C - J - SERIAL NUMBER OF ELEMENT WITHIN LAYER (<5)
|
||||||
|
|
||||||
|
C *************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
C ISG(I) = 0 - FOR SOLID ABSORBERS
|
||||||
|
C (I) = 1 - FOR GASEOUS ABSORBERS
|
||||||
|
C INN(I) = NUMBER OF ELEMENTS IN ONE LAYER
|
||||||
|
C (E.G. CH4 HAS TWO ELEMENTS C AND H)
|
||||||
|
C DEN(I) = DENSITY OF ABSORBE (FOR SOLIDS)
|
||||||
|
C THK(I) = THICKNESS OF ABSORBER IN MG/CMSQ (FOR SOLIDS)
|
||||||
|
C PRS(I) = PRESSURE (IN MM HG) FOR GAS ABSORBER
|
||||||
|
C XLN(I) = PHYSICAL LENGTH OF ABSORBER ( IN CM ) FOR GAS
|
||||||
|
|
||||||
|
C **** ABSORBER COMPOSITION ****
|
||||||
|
|
||||||
|
C ELNUM(I,J) = NUMBER OF ATOMS OF ELEMENT J IN LAYER I
|
||||||
|
C CONCN(I,J) = CONCENTRATION (MOLAR) OF ELEMENT J IN LAYER I
|
||||||
|
C ANUMB(I,J) = MASS NUMBER OF ELEMENT J IN LAYER I
|
||||||
|
C ZNUMB(I,J) = ATOMIC NUMBER OF ELEMENT J IN LAYER I
|
||||||
|
|
||||||
|
C PRDEN(I,J) = PARTIAL DENSITY OF ELEMENT J IN LAYER I
|
||||||
|
C PRTHK(I,J) = PARTIAL THICKNESS OF ELEMENT J IN LAYER I (MG/CMSQ)
|
||||||
|
|
||||||
|
C MAXIMUM OF NINETEEN LAYERS SPECIFIED
|
||||||
|
|
||||||
|
|
||||||
|
C *************************************************************
|
||||||
|
|
||||||
|
DO 100 ISN=1,IANZ
|
||||||
|
c read(io1,*) ISG(ISN),INN(ISN)
|
||||||
|
IF(ISG(ISN).EQ.1) GO TO 50
|
||||||
|
c read(io1,*) DEN(ISN),THK(ISN)
|
||||||
|
TOUT(ISN)=THK(ISN)/(DEN(ISN)*1000.)
|
||||||
|
TOUTE(ISN)=TOUT(ISN)/2.54
|
||||||
|
DO 20 IMN=1,INN(ISN)
|
||||||
|
c read(io1,*) ANUMB(ISN,IMN),ZNUMB(ISN,IMN),
|
||||||
|
c 1 ELNUM(ISN,IMN),CONCN(ISN,IMN)
|
||||||
|
20 CONTINUE
|
||||||
|
GO TO 100
|
||||||
|
50 continue
|
||||||
|
c read(io1,*) PRS(ISN),XLN(ISN)
|
||||||
|
DO 60 IMN=1,INN(ISN)
|
||||||
|
c read(io1,2) ANUMB(ISN,IMN),ZNUMB(ISN,IMN),
|
||||||
|
c 1 ELNUM(ISN,IMN),CONCN(ISN,IMN)
|
||||||
|
60 CONTINUE
|
||||||
|
100 CONTINUE
|
||||||
|
|
||||||
|
C ****************************************************************
|
||||||
|
|
||||||
|
if(iopt.ne.5.and.iopt.ne.6) WRITE(IO2,101) ap,zp,ep
|
||||||
|
if(iopt.ne.5.and.iopt.ne.6) WRITE(IO2,102) ianz
|
||||||
|
|
||||||
|
C *****************************************************************
|
||||||
|
|
||||||
|
DO 200 I=1,ianz
|
||||||
|
INNW=INN(I)
|
||||||
|
DO 210 J=1,INNW
|
||||||
|
ANUMBW(J)=ANUMB(I,J)
|
||||||
|
ZNUMBW(J)=ZNUMB(I,J)
|
||||||
|
ELNUMW(J)=ELNUM(I,J)
|
||||||
|
CONCNW(J)=CONCN(I,J)
|
||||||
|
210 CONTINUE
|
||||||
|
DENW=DEN(I)
|
||||||
|
XLNW=XLN(I)
|
||||||
|
PRSW=PRS(I)
|
||||||
|
THKW=THK(I)
|
||||||
|
IF(ISG(I).EQ.1) GO TO 250
|
||||||
|
CALL SETABS(INNW,ANUMBW,ZNUMBW,ELNUMW,PRTHKW,THKW,PRDENW,DENW)
|
||||||
|
DO 230 J=1,INNW
|
||||||
|
PRDEN(I,J)=PRDENW(J)
|
||||||
|
PRTHK(I,J)=PRTHKW(J)
|
||||||
|
230 CONTINUE
|
||||||
|
GO TO 200
|
||||||
|
|
||||||
|
250 CALL SETABG(INNW,ANUMBW,ZNUMBW,ELNUMW,CONCNW,PRTHKW,THKW
|
||||||
|
1, PRDENW,DENW,PRSW,XLNW)
|
||||||
|
DEN(I)=0.
|
||||||
|
THK(I)=0.
|
||||||
|
DO 270 J=1,INNW
|
||||||
|
PRDEN(I,J)=PRDENW(J)
|
||||||
|
PRTHK(I,J)=PRTHKW(J)
|
||||||
|
DEN(I)=DEN(I)+PRDEN(I,J)
|
||||||
|
THK(I)=THK(I)+PRTHK(I,J)
|
||||||
|
270 CONTINUE
|
||||||
|
200 CONTINUE
|
||||||
|
|
||||||
|
C *************************************************************
|
||||||
|
|
||||||
|
C START CALCULATION AND DETAILED PRINTOUT
|
||||||
|
|
||||||
|
C *************************************************************
|
||||||
|
c
|
||||||
|
if(iopt.ge.5) then
|
||||||
|
ep = emintab
|
||||||
|
zp = zth + 1.
|
||||||
|
indexz = ifix (zp - zth + 0.001)
|
||||||
|
endif
|
||||||
|
c
|
||||||
|
299 continue ! come here for new particle (zp change)
|
||||||
|
|
||||||
|
izp = ifix (zp+0.001)
|
||||||
|
c
|
||||||
|
if(iopt.ge.5) then
|
||||||
|
if (izp.gt.70) then
|
||||||
|
write (6,*) 'no mass for Z = ',izp
|
||||||
|
stop
|
||||||
|
else
|
||||||
|
ap = amass(izp)
|
||||||
|
|
||||||
|
c The trick!. To calculate energy losses for deuterons and tritons,
|
||||||
|
c enter zth = 0.2 and 0.3 respectively. E. Chavez jul/92
|
||||||
|
|
||||||
|
if (izp.eq.1) then
|
||||||
|
iap = ifix (zth*10.0 + 0.1)
|
||||||
|
ap = float (iap)
|
||||||
|
end if
|
||||||
|
end if
|
||||||
|
end if
|
||||||
|
c
|
||||||
|
if (iopt.eq.6) then
|
||||||
|
ideltalay = 8 ! choose DE3 for eloss signal
|
||||||
|
if(izp.eq.1) ideltalay = 16 ! choose DEh for eloss signal
|
||||||
|
endif
|
||||||
|
c
|
||||||
|
300 CONTINUE ! come here for new energy (ep)
|
||||||
|
c
|
||||||
|
EI=ep
|
||||||
|
XUPDN=-1.
|
||||||
|
EPS=0.0001
|
||||||
|
I1STPASS = 1
|
||||||
|
|
||||||
|
IF (iopt.EQ.4) GO TO 600
|
||||||
|
|
||||||
|
ipunch = 2
|
||||||
|
DO 510 I=1,IANZ ! begin loop over absorber layers
|
||||||
|
c
|
||||||
|
if(iopt.ge.5) go to 504
|
||||||
|
IF(ISG(I).EQ.0) WRITE(IO2,311) I,THK(I),TOUT(I),TOUTE(I),DEN(I)
|
||||||
|
IF(ISG(I).EQ.1) WRITE(IO2,312) I,THK(I),PRS(I),XLN(I),DEN(I)
|
||||||
|
DO 320 J=1,INN(I)
|
||||||
|
WRITE(IO2,321) ANUMB(I,J),ZNUMB(I,J),PRTHK(I,J)
|
||||||
|
320 CONTINUE
|
||||||
|
504 continue
|
||||||
|
c
|
||||||
|
c XNS - initial no. of intervals for integration of DE
|
||||||
|
XNS = 2.
|
||||||
|
c EI = energy in
|
||||||
|
CALL ADS(I,XUPDN,XNS,EPS,ap,zp,EI,DEI,ISTAT)
|
||||||
|
c DEI = energy out - energy in ( < 0. for energy loss)
|
||||||
|
EIOLD=EI
|
||||||
|
c E(I) = energy left after I'th element (EP-DE(1)-DE(2)+...)
|
||||||
|
c if particle stopped in detector this is equal to energy lost
|
||||||
|
c in remaining layers
|
||||||
|
DE(I) = DEI
|
||||||
|
E(I) = EI + DEI
|
||||||
|
EI = E(I)
|
||||||
|
INS=IFIX(XNS+0.001)
|
||||||
|
c
|
||||||
|
if (iopt.ge.5) go to 505
|
||||||
|
WRITE(IO2,401) INS,EIOLD,EI
|
||||||
|
loste(i)=-1.*de(i)
|
||||||
|
if (EI.LT.EPS.OR.ISTAT.EQ.-1) WRITE(IO2,402) I
|
||||||
|
505 continue
|
||||||
|
loste(ianz + 1)=e(ianz)
|
||||||
|
c
|
||||||
|
c if particle stopped in layer beyond ianzi we must
|
||||||
|
c check if iopt=5 or6 and calculate the energy loss in the
|
||||||
|
c front part (layers 1 thru ianzi).
|
||||||
|
c
|
||||||
|
istore = I
|
||||||
|
if (EI.lt.EPS) ipunch=1
|
||||||
|
c control loop exit
|
||||||
|
c exit when particle runs out of energy in last layer
|
||||||
|
if (EI.LT.EPS.OR.ISTAT.EQ.-1) go to 701
|
||||||
|
c if interested in DE signal only (iopt=6) exit after
|
||||||
|
c layer for which DE is sought was traversed
|
||||||
|
if(iopt.eq.6.and.I.ge.ianzide) go to 701
|
||||||
|
c
|
||||||
|
510 CONTINUE ! end loop over absorber layers
|
||||||
|
|
||||||
|
c this part for iopt=5,6 stores incident energy values
|
||||||
|
|
||||||
|
701 continue
|
||||||
|
if(iopt.ne.5.and.iopt.ne.6) go to 520
|
||||||
|
c
|
||||||
|
c establish higher energy cutoof for next step with higher z
|
||||||
|
c should save time in calulating energies of particles stopped
|
||||||
|
c in the dead layer
|
||||||
|
if( I.le.ianzi) emintabz(izp)=ep
|
||||||
|
c
|
||||||
|
c evalue = energy of particle when entering sensitive volume of det.
|
||||||
|
c when particle is stopped (ipunch=1) this is what is left
|
||||||
|
c once you take off the energy lost in the dead layer.
|
||||||
|
evalue = E(ianzi)
|
||||||
|
c = when particle punches thouough detector its energy at the
|
||||||
|
c end is EI - subtract this from what it entered with (after
|
||||||
|
c dead layers) and again you got the energy deposited.
|
||||||
|
if(ipunch.eq.2) evalue = E(ianzi) - EI
|
||||||
|
c roundoff errors could resutl in negative energies !!
|
||||||
|
if (evalue.lt.0.0) evalue = 0.0
|
||||||
|
|
||||||
|
c EI is current energy after last layer - is nonzero when particle
|
||||||
|
c punched through and to get energy deposited must subtract this
|
||||||
|
c "left over" energy from the energy of particle had when it entered
|
||||||
|
c the detector's sensitive volume
|
||||||
|
indexe = ifix((ep + 0.001)/detable) + 1
|
||||||
|
indexz = ifix(zp - zth + 0.001)
|
||||||
|
if(iopt.eq.5) eptable(indexz,indexe,ipunch) = evalue
|
||||||
|
if(iopt.eq.6) ipunch = 1
|
||||||
|
if(iopt.eq.6) eptable(indexz,indexe,ipunch) = -DE(ianzide)
|
||||||
|
|
||||||
|
c now repeat calculation for same Z but new energy
|
||||||
|
ep = ep + detable
|
||||||
|
if(ep.gt.emaxtab) go to 709
|
||||||
|
go to 300
|
||||||
|
|
||||||
|
709 continue
|
||||||
|
c reset energy to emintab and up zp by one until we top
|
||||||
|
c zmax - this portion controls looping over Z!
|
||||||
|
|
||||||
|
do ieps = 1,ianz
|
||||||
|
E(ieps) = 0.
|
||||||
|
DE(ieps) = 0.
|
||||||
|
enddo
|
||||||
|
|
||||||
|
ep = emintabz(izp)
|
||||||
|
zp = zp + 1.
|
||||||
|
izp = ifix(zp + 0.001)
|
||||||
|
emintabz(izp) = emintabz(izp-1)
|
||||||
|
|
||||||
|
eltime = secnds (eltimeo)
|
||||||
|
itminutes = ifix(eltime/60.)
|
||||||
|
tminutes = float(itminutes)
|
||||||
|
tseconds = eltime - tminutes*60.
|
||||||
|
eltimeo = eltimeo + eltime
|
||||||
|
zpm1 = zp - 1.
|
||||||
|
if((izp-1).le.izmax) write(io2,714) zpm1,ap,tminutes,tseconds
|
||||||
|
714 format(' finished Z=',f3.0,' A=',f4.0,' - ',f5.0,
|
||||||
|
+' minutes and ',f3.0,' seconds elapsed')
|
||||||
|
|
||||||
|
if (izp.ge.izmax) go to 711
|
||||||
|
go to 299
|
||||||
|
|
||||||
|
711 continue
|
||||||
|
|
||||||
|
c get here when iopt = 5 or 6 calculation is done
|
||||||
|
c now ready to store array on disk
|
||||||
|
write(io0,712) zth,zmax,emintab,emaxtab,detable
|
||||||
|
|
||||||
|
iemintab = ifix( (emintab + 0.001)/detable ) + 1
|
||||||
|
iemaxtab = ifix( (emaxtab + 0.001)/detable )
|
||||||
|
iztop = ifix(zp - 1. - zth + 0.001)
|
||||||
|
|
||||||
|
do ipp = 1,2
|
||||||
|
do indexz = 1, iztop
|
||||||
|
iztab = indexz + ifix(zth+0.01)
|
||||||
|
imasstab = ifix(amass(iztab) + 0.1)
|
||||||
|
if(iztop.eq.1) imasstab = ifix(ap + 0.1)
|
||||||
|
write(io0,7712) indexz,iztab,imasstab,iemintab,iemaxtab
|
||||||
|
7712 format(5i20)
|
||||||
|
itblow = iemintab
|
||||||
|
do indexe = iemintab,iemaxtab,10
|
||||||
|
itbup = itblow + 9
|
||||||
|
write(io0,713) (eptable(indexz,itbe,ipp),itbe=itblow,itbup)
|
||||||
|
itblow = itbup + 1
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
712 format(5e16.8)
|
||||||
|
713 format(10e16.8)
|
||||||
|
c
|
||||||
|
close (unit = io0)
|
||||||
|
c
|
||||||
|
C MORE INPUT FOR NEW CALCULATION WITH SAME ABSORBERS
|
||||||
|
|
||||||
|
520 CONTINUE
|
||||||
|
|
||||||
|
|
||||||
|
c read(io1,*) zp,ap,ep
|
||||||
|
zp = -1.
|
||||||
|
IF(zp.le.0.) GO TO 2000
|
||||||
|
izp = ifix(zp + 0.001)
|
||||||
|
if(ap.le.0.) AP = amass(izp)
|
||||||
|
IF(zp.gt.0.) WRITE(IO2,101) ap,zp,ep
|
||||||
|
GO TO 299
|
||||||
|
|
||||||
|
600 DO I = 1, ianz
|
||||||
|
ILAY = I
|
||||||
|
XNS = 2.0
|
||||||
|
CALL ADS(I,XUPDN,XNS,EPS,ap,zp,EI,DEI,ISTAT)
|
||||||
|
EIOLD = EI
|
||||||
|
DE(I) = DEI
|
||||||
|
E(I) = EI + DEI
|
||||||
|
c E(I) = energy left after I'th element (EP+DE(1)+DE(2)+...)
|
||||||
|
c if particle stopped in detector this is equal to energy lost
|
||||||
|
c in remaining layers
|
||||||
|
xmem(i) = E(I)
|
||||||
|
EI = E(I)
|
||||||
|
INS = IFIX(XNS + 0.001)
|
||||||
|
c WRITE (IO2,613) ILAY,INS,EI,ISTAT
|
||||||
|
IF (EI.LE.0.0.OR.ISTAT.EQ.-1) GO TO 601
|
||||||
|
END DO
|
||||||
|
|
||||||
|
|
||||||
|
601 IF (ISTAT.EQ.0)THEN
|
||||||
|
IF (EI.LT.0.003.AND.EI.GE.0.0) THEN
|
||||||
|
WRITE(IO2,611) ap,zp,ep,ILAY,xmem(5),xmem(6),xmem(7)
|
||||||
|
read(io1,*) zp,ap
|
||||||
|
izp = ifix (zp + 0.001)
|
||||||
|
if(ap.le.0.) ap = amass(izp)
|
||||||
|
IF (zp.LT.0.0) GO TO 2000
|
||||||
|
IPASS = 0
|
||||||
|
I1STPASS = 1
|
||||||
|
EI = ep
|
||||||
|
GO TO 600
|
||||||
|
END IF
|
||||||
|
isign = isold
|
||||||
|
isold = 1
|
||||||
|
ELSE
|
||||||
|
isign = - isold
|
||||||
|
isold = -1
|
||||||
|
END IF
|
||||||
|
|
||||||
|
IF (I1STPASS.gt.0) THEN
|
||||||
|
isign = 1
|
||||||
|
I1STPASS = 0
|
||||||
|
IF (ISTAT.EQ.0) THEN
|
||||||
|
DSEP = - DSEP0
|
||||||
|
ELSE
|
||||||
|
DSEP = DSEP0
|
||||||
|
END IF
|
||||||
|
END IF
|
||||||
|
|
||||||
|
C IF THE INITIAL ENERGY WAS TOO LARGE, THEN THE ION WILL PUNCH THROUGH
|
||||||
|
C THE DETECTOR A NUMBER OF TIMES UNTIL THE ENERGY IS REDUCED BELOW
|
||||||
|
C THE PUNCH-THROUGH ENERGY (PTE). IF THE INITIAL ENERGY WAS TOO SHORT
|
||||||
|
C THEN IT WON'T UNTIL PTE IS REACHED. IN THIS MOMENT, IPASS IS SET TO
|
||||||
|
C ONE, AND FROM THIS POINT EVERY FURTHER CALCULATION WILL IMPLY A
|
||||||
|
C REDUCTION BY HALF OF THE SIZE OF "DSEP", AND A CHANGE OF SIGN ONLY
|
||||||
|
C IF APROPRIATE.
|
||||||
|
|
||||||
|
IF (isign.LT.0) IPASS = 1 !IPASS=1 UNTIL "PTE" IS FOUND.
|
||||||
|
IF (IPASS.EQ.1) DSEP = isign * DSEP * 0.5
|
||||||
|
|
||||||
|
IF (ABS(DSEP).LT.0.05) THEN
|
||||||
|
EI = 0.00001
|
||||||
|
ISTAT = 0
|
||||||
|
GO TO 601
|
||||||
|
END IF
|
||||||
|
|
||||||
|
EP = EP + DSEP
|
||||||
|
ei = ep
|
||||||
|
|
||||||
|
GO TO 600
|
||||||
|
|
||||||
|
1000 CONTINUE
|
||||||
|
GO TO 10
|
||||||
|
2000 CONTINUE
|
||||||
|
|
||||||
|
101 FORMAT(//////' PASSAGE OF CHARGED PARTICLE THROUGH ABSORBER',
|
||||||
|
1 ' SANDWICH '////' AP = ',F6.0,' ZP = ',F5.0,
|
||||||
|
1 ' INITIAL ENERGY = ',F12.5//)
|
||||||
|
102 FORMAT(' ABSORBER SANDWICH CONTAINS - ',I2,' LAYERS'//)
|
||||||
|
291 format(' start absorber calculations for z =',f3.0
|
||||||
|
+,' to z =',f3.0,/' and energies from emin =',f6.2
|
||||||
|
+,' to emax =',f7.2,' in ',f6.2,'MeV steps')
|
||||||
|
311 FORMAT(//' LAYER # ',I2,' - SOLID ABSORBER - ',
|
||||||
|
1' AREAL DENSITY = ',E10.4/' THICKNESS = ',E10.4,
|
||||||
|
1' CM OR ',E10.4,' INCH DENSITY =',E10.3,' G/CM3')
|
||||||
|
312 FORMAT(//' LAYER # ',I2,' - GAS ABSORBER - ',
|
||||||
|
1' AREAL DENSITY = ',E10.4/' PRESSURE = ',E10.4,
|
||||||
|
1' TORR LENGTH ',E9.4,'CM DENSITY =',E9.3,'MG/CM3')
|
||||||
|
321 FORMAT(7X,' A =',F6.0,' Z =',F5.0,' AREAL DENSITY'
|
||||||
|
1,' (PARTIAL) = ',E12.5,' MG/CMSQ')
|
||||||
|
401 FORMAT(' CALC IN-',I4,' STEPS'
|
||||||
|
1,' ENERGY IN = ',F8.3,' ENERGY OUT = ',F8.3
|
||||||
|
2,'(MEV)')
|
||||||
|
402 FORMAT(' CHARGED PARTICLE STOPPED IN LAYER # ',I2)
|
||||||
|
613 FORMAT (2X,'LAYER= ',I2,': ',I6,' ITERATIONS'
|
||||||
|
1, ', E final= ',F10.4,' STATUS= ',I2)
|
||||||
|
611 FORMAT (2X,'Ion (A , Z): (',F4.0,' , ',F3.0
|
||||||
|
1,'), E(MeV)= ',F7.2,' STOPPED IN LAYER ',I2/
|
||||||
|
1' Esum = ',f7.2,' Esum-E1 = ',f7.2,
|
||||||
|
1' Esum-E1-E2 = ',f7.2)
|
||||||
|
703 format(' eptable (',i2,', ',i3,', ',i1,' ) =',f8.2)
|
||||||
|
|
||||||
|
return
|
||||||
|
END
|
||||||
|
|
||||||
|
SUBROUTINE ADS(I1,SIGN,XN1,EPS,A,Z,E,DEE,ISTAT)
|
||||||
|
|
||||||
|
C SUBROUTINE FOR ENERGY LOSS CALCULATIONS
|
||||||
|
C CALL DEDX FRO STOPPING POWER CALCULATIONS
|
||||||
|
|
||||||
|
COMMON ISG(19),INN(19)
|
||||||
|
1 ,DEN(19),THK(19),PRS(19),XLN(19),ARDEN(19)
|
||||||
|
1 ,ZNUMB(19,4),ANUMB(19,4),ELNUM(19,4),CONCN(19,4)
|
||||||
|
1 ,PRDEN(19,4),PRTHK(19,4)
|
||||||
|
|
||||||
|
C N1= NUMBER OF SUBDIVISIONS FOR INTEGRATION
|
||||||
|
C OF ENERGY LOSS
|
||||||
|
|
||||||
|
1000 CONTINUE
|
||||||
|
EH = E
|
||||||
|
N1 = IFIX(XN1+0.001)
|
||||||
|
DEDNEXT = 0.
|
||||||
|
DO 1010 K=1,N1
|
||||||
|
J1 = INN(I1)
|
||||||
|
ISGW = ISG(I1)
|
||||||
|
I = I1
|
||||||
|
DO 1001 J = 1,J1
|
||||||
|
AX = ANUMB(I,J)
|
||||||
|
ZX = ZNUMB(I,J)
|
||||||
|
FX = PRTHK(I,J)/XN1
|
||||||
|
DENST = PRDEN(I,J)
|
||||||
|
VH = VEL(EH,A)
|
||||||
|
CALL DEDX(Z,A,ZX,AX,DENST,EH,VH,ISGW,DEX,DE)
|
||||||
|
EH = EH + DE*SIGN*FX
|
||||||
|
IF(EH.LE.0.) THEN
|
||||||
|
IF (K.LE.2) THEN
|
||||||
|
N1 = N1 * 2
|
||||||
|
XN1 = FLOAT(N1)
|
||||||
|
GO TO 1000
|
||||||
|
END IF
|
||||||
|
ISTAT = -1
|
||||||
|
GO TO 9910
|
||||||
|
END IF
|
||||||
|
IF (K.LE.2) DEDNEXT = DEDNEXT + DE * FX
|
||||||
|
1001 CONTINUE
|
||||||
|
IF (K.EQ.1) THEN
|
||||||
|
DED1ST = DEDNEXT
|
||||||
|
DEDNEXT = 0.0
|
||||||
|
END IF
|
||||||
|
IF (K.EQ.2) THEN
|
||||||
|
DDD = DED1ST - DEDNEXT
|
||||||
|
IF(DDD.LT.0.) DDD=-DDD
|
||||||
|
DDS = DED1ST + DEDNEXT
|
||||||
|
DDR = DDD/DDS
|
||||||
|
IF(DDR.GT.EPS) THEN
|
||||||
|
N1 = N1 * 2
|
||||||
|
XN1 = FLOAT(N1)
|
||||||
|
GO TO 1000
|
||||||
|
END IF
|
||||||
|
END IF
|
||||||
|
1010 CONTINUE
|
||||||
|
|
||||||
|
ISTAT = 0
|
||||||
|
9910 DEE = EH-E
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
END
|
||||||
|
|
||||||
|
SUBROUTINE SETABS(INW,A,Z,AN,T,TH,D,DN)
|
||||||
|
|
||||||
|
C SUBROUTINE FOR SETTING UP COMPOSITE ABSORBER
|
||||||
|
C DATA (PARTIAL DENSITIES AND THICKNESSES)
|
||||||
|
|
||||||
|
DIMENSION A(4),Z(4),AN(4),T(4),D(4)
|
||||||
|
|
||||||
|
AW=0.
|
||||||
|
DO 1 I=1,INW
|
||||||
|
AW=AW+A(I)*AN(I)
|
||||||
|
1 CONTINUE
|
||||||
|
DO 2 I=1,INW
|
||||||
|
AN(I)=A(I)*AN(I)/AW
|
||||||
|
T(I) = TH*AN(I)
|
||||||
|
D(I) = DN*AN(I)
|
||||||
|
2 CONTINUE
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
END
|
||||||
|
|
||||||
|
SUBROUTINE SETABG(INW,A,Z,AN,CN,T,TH,D,DN,PR,XL)
|
||||||
|
|
||||||
|
C SUBROUTINE FOR SETTING UP COMPOSITE ABSORBER DATA
|
||||||
|
C FOR GASEOUS LAYERS.
|
||||||
|
|
||||||
|
DIMENSION A(4),Z(4),AN(4),CN(4),T(4),D(4)
|
||||||
|
|
||||||
|
|
||||||
|
P = PR/760.
|
||||||
|
X = XL/22.4
|
||||||
|
|
||||||
|
AWW=0.
|
||||||
|
AW=0.
|
||||||
|
DO 1 I=1,INW
|
||||||
|
AW = AW +A(I)*AN(I)
|
||||||
|
AWW= AWW+A(I)*AN(I)*CN(I)
|
||||||
|
T(I) = P*X*A(I)*AN(I)*CN(I)
|
||||||
|
D(I) = T(I)/XL
|
||||||
|
1 CONTINUE
|
||||||
|
RETURN
|
||||||
|
END
|
||||||
|
|
||||||
|
FUNCTION VEL(ENER,A1)
|
||||||
|
|
||||||
|
VV=SQRT(2.13E-3*ENER/A1)
|
||||||
|
VEL=VV
|
||||||
|
RETURN
|
||||||
|
END
|
||||||
|
|
||||||
|
FUNCTION FKINEM(EP,AP,AT,TH)
|
||||||
|
|
||||||
|
IF(AP.GT.AT) GOTO 100
|
||||||
|
E=EP*AP**2/(AP+AT)**2
|
||||||
|
E=E*(COS(TH)+SQRT((AT/AP)**2-SIN(TH)**2))**2
|
||||||
|
FKINEM=E
|
||||||
|
RETURN
|
||||||
|
100 FKINEM=0.
|
||||||
|
RETURN
|
||||||
|
END
|
||||||
|
|
||||||
|
FUNCTION FFKIN(EP,AP,AT,TH,Q)
|
||||||
|
|
||||||
|
C INELASTIC SCATTERING
|
||||||
|
B=AP**2*EP/(AP+AT)**2/(EP+Q)
|
||||||
|
D=AT**2/(AP+AT)**2*(1.+AP*Q/AT/(EP+Q))
|
||||||
|
E=(EP+Q)*B*(COS(TH)+SQRT(D/B-SIN(TH)**2))**2
|
||||||
|
FFKIN=E
|
||||||
|
RETURN
|
||||||
|
END
|
||||||
|
|
||||||
|
SUBROUTINE DEDX(Z1,A1,Z2,A2,RHO,ENER,V,IFG,DEDXHI,DEDXTO)
|
||||||
|
|
||||||
|
C PROGRAM CALCULATES THE DIFFERENTIAL ENERGY LOSS DE/DX IN SOLID
|
||||||
|
C TARGETS USING A SEMIEMPIRICAL FORMULA DEDUCED FROM EXPERIMENTAL
|
||||||
|
C THE PROGRAM IS MODIFIED FOR GAS ABSORBERS.
|
||||||
|
|
||||||
|
C REF.: K.BRAUNE,R.NOVOTNY,D.PELTE,D.HUSAR,D.SCHWALM,
|
||||||
|
C PROCEEDINGS - SPRING MEETING OF THE GERMAN PHYSICAL
|
||||||
|
C SOCIETY, VERHANDLUNGEN 4/1978
|
||||||
|
|
||||||
|
C K.BRAUNE, DIPLOM, HEIDELBERG 1979
|
||||||
|
|
||||||
|
|
||||||
|
C H(Z2) IS A SUM OF FIVE GAUSSIAN FUNCTIONS.
|
||||||
|
C A1 MASS NUMBER - PROJECTILE
|
||||||
|
C Z2 ATOMIC NUMBER ABSORBER
|
||||||
|
C A1 MASS NUMBER ABSORBER
|
||||||
|
C RHO DENSITY OF THE ABSORBER (GRAMM/CM**3)
|
||||||
|
C (MEANLESS IF GAS ABSORBER )
|
||||||
|
C ENER ENERGY OF THE PROJECTILE (MEV)
|
||||||
|
C V VELOCITY OF THE PROJECTILE
|
||||||
|
C IN MEV/(MG/CM**2)
|
||||||
|
C Z1 ATOMIC NUMBER - PROJECTILE
|
||||||
|
|
||||||
|
IF(IFG.EQ.1) RHO=1.
|
||||||
|
XI=V**2/Z2
|
||||||
|
C
|
||||||
|
C ABSORBER - FUNCTION
|
||||||
|
C G(XI)=Y(EXP)-Y(THEORY) - IS DEDUCED FROM EXPERIMENTAL ENERGY LOSS
|
||||||
|
C MEASUREMENTS.
|
||||||
|
C
|
||||||
|
C IF THE SAME ABSORBER WAS USED BEFORE , GO TO STATEMENT # 55
|
||||||
|
|
||||||
|
IF(A2.EQ.A2SAV.AND.Z2.EQ.Z2SAV) GOTO 55
|
||||||
|
|
||||||
|
Z2SAV=Z2
|
||||||
|
A2SAV=A2
|
||||||
|
|
||||||
|
C FUNCTION Y
|
||||||
|
|
||||||
|
FY=54721.*(1.+5.15E-2*SQRT(A2/RHO)-EXP(-0.23*Z2))
|
||||||
|
IF(IFG.NE.1) GOTO 10
|
||||||
|
FY=54721.*(1.35-EXP(Z2*(-.13+.0014*Z2)))
|
||||||
|
|
||||||
|
C G(XI) IS THE DERIVATION OF A GASSIAN WITH VARIABLE HEIGHT H(Z2).
|
||||||
|
|
||||||
|
10 IF(Z2.GT.26.) GOTO 20
|
||||||
|
G1=19.84*EXP(-.17*(Z2-4.25)**2)
|
||||||
|
GOTO 35
|
||||||
|
20 G1=0.000001
|
||||||
|
IF(Z2.GT.38.) GOTO 40
|
||||||
|
35 G2=17.12*EXP(-.12*(Z2-11.63)**2)
|
||||||
|
GOTO 50
|
||||||
|
40 G2=0.0000001
|
||||||
|
50 G3=7.95*EXP(-.015*(Z2-30.2)**2)
|
||||||
|
G4=5.84*EXP(-.022*(Z2-48.63)**2)
|
||||||
|
G5=7.27*EXP(-.005*(Z2-73.06)**2)
|
||||||
|
HZ2=(9.-(G1+G2+G3+G4+G5))*1.32E-5
|
||||||
|
ZWD=2./3.
|
||||||
|
Z2ZWD=Z2**ZWD
|
||||||
|
|
||||||
|
C MULTIPLICATIONFACTORS OF G(XI)
|
||||||
|
|
||||||
|
FG=1.2E-4*Z2*Z2+2.49E-2*A2/RHO
|
||||||
|
IF(IFG.NE.1) GOTO 52
|
||||||
|
FG=1.3/(1.+EXP(3.-Z2/5.))
|
||||||
|
52 ALEFG=ALOG(2.7E-5/FG)
|
||||||
|
|
||||||
|
C CALCULATION OF G(XI)
|
||||||
|
|
||||||
|
55 GXI=0.
|
||||||
|
IF(XI.GE.1.E-9.AND.XI.LE.5.E-4) THEN
|
||||||
|
|
||||||
|
SQXI=SQRT(XI)
|
||||||
|
C=2./Z2*SQXI/(1.+1.E4*SQXI)
|
||||||
|
IF(IFG.EQ.1) C=C/2.
|
||||||
|
FG0=1./(1.+(XI*10000.)**3)
|
||||||
|
AL=ALOG(XI)-ALEFG
|
||||||
|
GXI=(C-HZ2*AL*EXP(-.32*AL*AL))*FG0
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
C CALCULATION OF Y(XI)
|
||||||
|
Y=3.3E-4*ALOG(1.+XI*FY)+GXI
|
||||||
|
C ENERGY LOSS OF HEAVY IONS
|
||||||
|
C EFFECTIVE CHARGE
|
||||||
|
VV0=V*137.
|
||||||
|
FV=1.
|
||||||
|
IF(V.LE..62) FV=1.-EXP(-VV0)
|
||||||
|
AZ1=ALOG(1.035-.4*EXP(-.16*Z1))
|
||||||
|
|
||||||
|
QQ=V/Z1**.509
|
||||||
|
GHI=Z1
|
||||||
|
VZ1=(-116.79-3350.4*QQ)*QQ
|
||||||
|
IF(VZ1.GT.-85.2) GHI=Z1*(1.-EXP(VZ1))
|
||||||
|
IF(Z1.GT.2.) GHI=Z1*(1.-EXP(FV*AZ1-0.879*VV0/Z1**0.65))
|
||||||
|
|
||||||
|
C EFFECTIVE CHARGE FOR PROTONS AND ALPHA PARTICLES
|
||||||
|
|
||||||
|
C ******************** RESULTS ********************
|
||||||
|
|
||||||
|
C ELECTRONIC ENERGY LOSS DEDXHI
|
||||||
|
|
||||||
|
DEDXHI=GHI*GHI*Z2*Y/(A2*V**2)
|
||||||
|
|
||||||
|
C NUCLEAR ENERGY LOSS DEDXNU
|
||||||
|
|
||||||
|
ZA=SQRT(Z1**(ZWD)+Z2ZWD)
|
||||||
|
EPS=3.25E4*A2*ENER/(Z1*Z2*(A1+A2)*ZA)
|
||||||
|
SIGMAN=1.7*SQRT(EPS)*ALOG(EPS+2.1718282)/
|
||||||
|
1 (1.+6.8*EPS+3.4*EPS**1.5)
|
||||||
|
DEDXNU=SIGMAN*5.105*Z1*Z2*A1/(ZA*A2*(A1+A2))
|
||||||
|
|
||||||
|
C TOTAL ENERGY LOSS DEDXTO
|
||||||
|
|
||||||
|
DEDXTO=DEDXHI+DEDXNU
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
END
|
||||||
|
c
|
||||||
88435
anasen_analysis_vignesh/eloss_calculations/stopit/desorb.out
Normal file
88435
anasen_analysis_vignesh/eloss_calculations/stopit/desorb.out
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,6 @@
|
||||||
|
Charged particle has Z = 2. A = 4. Initialenergy = 0.132 MeV.
|
||||||
|
Energy lost in layer = 0.132 MeV
|
||||||
|
Energy remaining = 0.000 MeV
|
||||||
|
Charged particle has Z = 2. A = 4. Initialenergy = 10.132 MeV.
|
||||||
|
Energy lost in layer = 10.133 MeV
|
||||||
|
Energy remaining = 0.000 MeV
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
4
4
|
||||||
|
|
||||||
|
|
||||||
|
Charged particle has Z = 2. A = 4. Initialenergy = 0.132 MeV.
|
||||||
|
|
||||||
|
|
||||||
|
Absorber contains 1 layers.
|
||||||
|
|
||||||
|
|
||||||
|
Layer # 1 - Solid Absorber
|
||||||
|
Density = 0.2329E+01 g/cm3 Thickness = 0.2329E+02 mg/cm2
|
||||||
|
Z = 14. A = 28. Atoms per molecule = 1.
|
||||||
|
Energy lost in layer = 0.132 MeV
|
||||||
|
|
||||||
|
Energy remaining = 0.000 MeV
|
||||||
|
|
||||||
|
Output also written to stopit.log
|
||||||
|
|
||||||
|
1 define stopee
|
||||||
|
2 define absorber
|
||||||
|
3 edit absorber
|
||||||
|
4 run with current parameters
|
||||||
|
5 find thickness of absorber to stop the stopee
|
||||||
|
6 print status of data
|
||||||
|
7 stop
|
||||||
|
4
4
|
||||||
|
|
||||||
|
|
||||||
|
Charged particle has Z = 2. A = 4. Initialenergy = 10.132 MeV.
|
||||||
|
|
||||||
|
|
||||||
|
Absorber contains 1 layers.
|
||||||
|
|
||||||
|
|
||||||
|
Layer # 1 - Solid Absorber
|
||||||
|
Density = 0.2329E+01 g/cm3 Thickness = 0.2329E+02 mg/cm2
|
||||||
|
Z = 14. A = 28. Atoms per molecule = 1.
|
||||||
|
Energy lost in layer = 10.133 MeV
|
||||||
|
|
||||||
|
Energy remaining = 0.000 MeV
|
||||||
|
|
||||||
|
Output also written to stopit.log
|
||||||
|
|
||||||
|
1 define stopee
|
||||||
|
2 define absorber
|
||||||
|
3 edit absorber
|
||||||
|
4 run with current parameters
|
||||||
|
5 find thickness of absorber to stop the stopee
|
||||||
|
6 print status of data
|
||||||
|
7 stop
|
||||||
106
anasen_analysis_vignesh/eloss_calculations/stopit/script.exp
Executable file
106
anasen_analysis_vignesh/eloss_calculations/stopit/script.exp
Executable file
|
|
@ -0,0 +1,106 @@
|
||||||
|
#!/usr/bin/expect -f
|
||||||
|
#
|
||||||
|
set timeout -1
|
||||||
|
spawn ./a.out
|
||||||
|
match_max 100000
|
||||||
|
expect -exact "\r
|
||||||
|
1 define stopee\r
|
||||||
|
2 define absorber\r
|
||||||
|
3 edit absorber\r
|
||||||
|
4 run with current parameters\r
|
||||||
|
5 find thickness of absorber to stop the stopee\r
|
||||||
|
6 print status of data\r
|
||||||
|
7 stop\r
|
||||||
|
"
|
||||||
|
send -- "1\r"
|
||||||
|
expect -exact "1\r
|
||||||
|
Enter Z and A of stopee.\r
|
||||||
|
"
|
||||||
|
send -- "2\r"
|
||||||
|
expect -exact "2\r
|
||||||
|
"
|
||||||
|
send -- "4\r"
|
||||||
|
expect -exact "4\r
|
||||||
|
Enter energy in MeV.\r
|
||||||
|
"
|
||||||
|
send -- "5.486\r"
|
||||||
|
expect -exact "5.486\r
|
||||||
|
\r
|
||||||
|
1 define stopee\r
|
||||||
|
2 define absorber\r
|
||||||
|
3 edit absorber\r
|
||||||
|
4 run with current parameters\r
|
||||||
|
5 find thickness of absorber to stop the stopee\r
|
||||||
|
6 print status of data\r
|
||||||
|
7 stop\r
|
||||||
|
"
|
||||||
|
send -- "2\r"
|
||||||
|
expect -exact "2\r
|
||||||
|
\r
|
||||||
|
How many stopping layers are there in the absorber?\r
|
||||||
|
"
|
||||||
|
send -- "1\r"
|
||||||
|
expect -exact "1\r
|
||||||
|
\r
|
||||||
|
Is layer 1 a solid, gas, or standardized medium?\r
|
||||||
|
(0 = solid, 1 = gas, 2 = standardized medium)\r
|
||||||
|
(Standardized media are: CO2, Si, C \[graphite\], C4H10, CF4,\r
|
||||||
|
CH2, CD2, He, and H2)\r
|
||||||
|
"
|
||||||
|
send -- "2\r"
|
||||||
|
expect -exact "2\r
|
||||||
|
Which standardized medium for layer 1?\r
|
||||||
|
1: CO2\r
|
||||||
|
2: Si\r
|
||||||
|
3: C (graphite)\r
|
||||||
|
4: C4H10\r
|
||||||
|
5: CF4\r
|
||||||
|
6: CH2\r
|
||||||
|
7: CD2\r
|
||||||
|
8: He-gas\r
|
||||||
|
9: H2-gas\r
|
||||||
|
"
|
||||||
|
send -- "2\r"
|
||||||
|
expect -exact "2\r
|
||||||
|
Enter thickness(microns) for layer 1\r
|
||||||
|
"
|
||||||
|
send -- "100\r"
|
||||||
|
expect -exact "100\r
|
||||||
|
\r
|
||||||
|
1 define stopee\r
|
||||||
|
2 define absorber\r
|
||||||
|
3 edit absorber\r
|
||||||
|
4 run with current parameters\r
|
||||||
|
5 find thickness of absorber to stop the stopee\r
|
||||||
|
6 print status of data\r
|
||||||
|
7 stop\r
|
||||||
|
"
|
||||||
|
send -- "4\r"
|
||||||
|
expect -exact "4\r
|
||||||
|
\r
|
||||||
|
\r
|
||||||
|
Charged particle has Z = 2. A = 4. Initialenergy = 5.486 MeV.\r
|
||||||
|
\r
|
||||||
|
\r
|
||||||
|
Absorber contains 1 layers.\r
|
||||||
|
\r
|
||||||
|
\r
|
||||||
|
Layer # 1 - Solid Absorber\r
|
||||||
|
Density = 0.2329E+01 g/cm3 Thickness = 0.2329E+02 mg/cm2\r
|
||||||
|
Z = 14. A = 28. Atoms per molecule = 1.\r
|
||||||
|
Energy lost in layer = 5.486 MeV\r
|
||||||
|
\r
|
||||||
|
Energy remaining = 0.000 MeV\r
|
||||||
|
\r
|
||||||
|
Output also written to stopit.log\r
|
||||||
|
\r
|
||||||
|
1 define stopee\r
|
||||||
|
2 define absorber\r
|
||||||
|
3 edit absorber\r
|
||||||
|
4 run with current parameters\r
|
||||||
|
5 find thickness of absorber to stop the stopee\r
|
||||||
|
6 print status of data\r
|
||||||
|
7 stop\r
|
||||||
|
"
|
||||||
|
send -- "7\r"
|
||||||
|
expect eof
|
||||||
106
anasen_analysis_vignesh/eloss_calculations/stopit/stopit.expect
Executable file
106
anasen_analysis_vignesh/eloss_calculations/stopit/stopit.expect
Executable file
|
|
@ -0,0 +1,106 @@
|
||||||
|
#!/usr/bin/expect -f
|
||||||
|
#
|
||||||
|
# This Expect script was generated by autoexpect on Sat Jan 31 17:06:49 2026
|
||||||
|
# Expect and autoexpect were both written by Don Libes, NIST.
|
||||||
|
#
|
||||||
|
# Note that autoexpect does not guarantee a working script. It
|
||||||
|
# necessarily has to guess about certain things. Two reasons a script
|
||||||
|
# might fail are:
|
||||||
|
#
|
||||||
|
# 1) timing - A surprising number of programs (rn, ksh, zsh, telnet,
|
||||||
|
# etc.) and devices discard or ignore keystrokes that arrive "too
|
||||||
|
# quickly" after prompts. If you find your new script hanging up at
|
||||||
|
# one spot, try adding a short sleep just before the previous send.
|
||||||
|
# Setting "force_conservative" to 1 (see below) makes Expect do this
|
||||||
|
# automatically - pausing briefly before sending each character. This
|
||||||
|
# pacifies every program I know of. The -c flag makes the script do
|
||||||
|
# this in the first place. The -C flag allows you to define a
|
||||||
|
# character to toggle this mode off and on.
|
||||||
|
|
||||||
|
set force_conservative 0 ;# set to 1 to force conservative mode even if
|
||||||
|
;# script wasn't run conservatively originally
|
||||||
|
if {$force_conservative} {
|
||||||
|
set send_slow {1 .1}
|
||||||
|
proc send {ignore arg} {
|
||||||
|
sleep .1
|
||||||
|
exp_send -s -- $arg
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# 2) differing output - Some programs produce different output each time
|
||||||
|
# they run. The "date" command is an obvious example. Another is
|
||||||
|
# ftp, if it produces throughput statistics at the end of a file
|
||||||
|
# transfer. If this causes a problem, delete these patterns or replace
|
||||||
|
# them with wildcards. An alternative is to use the -p flag (for
|
||||||
|
# "prompt") which makes Expect only look for the last line of output
|
||||||
|
# (i.e., the prompt). The -P flag allows you to define a character to
|
||||||
|
# toggle this mode off and on.
|
||||||
|
#
|
||||||
|
# Read the man page for more info.
|
||||||
|
#
|
||||||
|
# -Don
|
||||||
|
|
||||||
|
|
||||||
|
set timeout -1
|
||||||
|
spawn ./a.out
|
||||||
|
match_max 100000
|
||||||
|
expect "* 7 stop\r
|
||||||
|
"
|
||||||
|
send -- "1\r"
|
||||||
|
expect -exact "1\r
|
||||||
|
Enter Z and A of stopee.\r
|
||||||
|
"
|
||||||
|
send -- "4"
|
||||||
|
expect -exact " "
|
||||||
|
send -- "2\r"
|
||||||
|
expect -exact "2\r
|
||||||
|
"
|
||||||
|
send -- "4\r"
|
||||||
|
expect -exact "4\r
|
||||||
|
Enter energy in MeV.\r
|
||||||
|
"
|
||||||
|
send -- "5.486\r"
|
||||||
|
expect -exact "5.486\r
|
||||||
|
\r
|
||||||
|
1 define stopee\r
|
||||||
|
2 define absorber\r
|
||||||
|
3 edit absorber\r
|
||||||
|
4 run with current parameters\r
|
||||||
|
5 find thickness of absorber to stop the stopee\r
|
||||||
|
6 print status of data\r
|
||||||
|
7 stop\r
|
||||||
|
"
|
||||||
|
send -- "2\r"
|
||||||
|
|
||||||
|
expect "*How many stopping layers are there in the absorber?\r"
|
||||||
|
send -- "1\r"
|
||||||
|
|
||||||
|
expect "*CH2, CD2, He, and H2)\r"
|
||||||
|
send -- "2\r"
|
||||||
|
|
||||||
|
expect "*Which standardized medium for layer 1?\r
|
||||||
|
1: CO2\r
|
||||||
|
2: Si\r
|
||||||
|
3: C (graphite)\r
|
||||||
|
4: C4H10\r
|
||||||
|
5: CF4\r
|
||||||
|
6: CH2\r
|
||||||
|
7: CD2\r
|
||||||
|
8: He-gas\r
|
||||||
|
9: H2-gas\r
|
||||||
|
"
|
||||||
|
send -- "2\r"
|
||||||
|
expect "
|
||||||
|
* Enter thickness(microns) for layer 1\r
|
||||||
|
"
|
||||||
|
send -- "100\r"
|
||||||
|
expect "
|
||||||
|
* 7 stop\r
|
||||||
|
"
|
||||||
|
send -- "4\r"
|
||||||
|
expect "
|
||||||
|
* 7 stop\r
|
||||||
|
"
|
||||||
|
send -- "7\r"
|
||||||
|
expect eof
|
||||||
1057
anasen_analysis_vignesh/eloss_calculations/stopit/stopit2.for
Executable file
1057
anasen_analysis_vignesh/eloss_calculations/stopit/stopit2.for
Executable file
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,87 @@
|
||||||
|
import pexpect as px
|
||||||
|
import sys,time,os
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
if len(sys.argv) != 8:
|
||||||
|
print("Usage: python3 stopit_pex.py <z> <a> <thickness_um_layer1> <thickness_um_layer2> <energy_start_MeV> <energy_stop_MeV> <energy_step>")
|
||||||
|
print("Modify the \#absorber section in script to change stopping material")
|
||||||
|
quit()
|
||||||
|
|
||||||
|
stoppeeZ=int(sys.argv[1])
|
||||||
|
stoppeeA=int(sys.argv[2])
|
||||||
|
layer1_thickness = float(sys.argv[3]) #um
|
||||||
|
layer2_thickness = float(sys.argv[4]) #um
|
||||||
|
min_stoppee_energy=float(sys.argv[5])
|
||||||
|
max_stoppee_energy=float(sys.argv[6])
|
||||||
|
step_stoppee_energy=float(sys.argv[7])
|
||||||
|
|
||||||
|
#plotting prep
|
||||||
|
'''
|
||||||
|
plt.ion()
|
||||||
|
fig=plt.figure()
|
||||||
|
ax=fig.add_subplot(111)
|
||||||
|
ax.autoscale_view(True,True,True)
|
||||||
|
line,=ax.plot([],[],'b-')
|
||||||
|
ax.set_xlim(0,0.5*max_stoppee_energy)
|
||||||
|
ax.set_ylim(0,0.05*max_stoppee_energy)
|
||||||
|
'''
|
||||||
|
stopit_child = px.spawn("./a.out")
|
||||||
|
stopit_child.logfile = None
|
||||||
|
|
||||||
|
def run_stopit(child,Z,A,Energy_MeV,thickness_um):
|
||||||
|
child.expect("7 stop\r")
|
||||||
|
|
||||||
|
#stoppee
|
||||||
|
child.send("1\r")
|
||||||
|
child.expect("Enter Z and A of stopee.\r")
|
||||||
|
child.send(str(Z)+" "+str(A)+"\r")
|
||||||
|
child.expect("Enter energy in MeV.\r")
|
||||||
|
child.send(str(Energy_MeV)+"\r")
|
||||||
|
|
||||||
|
#absorber - standard medium, Si
|
||||||
|
child.expect("7 stop\r")
|
||||||
|
child.send("2\r")
|
||||||
|
child.expect("\r")
|
||||||
|
child.send("1\r")
|
||||||
|
child.expect("He, and H2\)\r")
|
||||||
|
child.send("2\r")
|
||||||
|
child.expect("H2-gas\r")
|
||||||
|
child.send("2\r") #first 2 for 'define absorber', then 1 for '1 layer', then 2 for 'standardized material', then '2' for Si.
|
||||||
|
child.expect("\r")
|
||||||
|
child.send(str(thickness_um)+"\r")
|
||||||
|
|
||||||
|
#run!
|
||||||
|
child.expect("7 stop\r")
|
||||||
|
child.send("4\r")
|
||||||
|
child.expect("stopit.log\r")
|
||||||
|
#get all the output that shows up before the string 'stopit.log' above.
|
||||||
|
#the split() splits it up at all whitespaces. we can pick out the substrings of interest from this bunch now
|
||||||
|
results = child.before.decode('utf-8').split()
|
||||||
|
|
||||||
|
return [results[12],results[48],results[53]]
|
||||||
|
|
||||||
|
layer1_edep = []
|
||||||
|
layer2_edep = []
|
||||||
|
stoppee_energy = min_stoppee_energy #in MeV
|
||||||
|
while(stoppee_energy < max_stoppee_energy):
|
||||||
|
[in_en,e_lost ,e_left ] = run_stopit(stopit_child,stoppeeZ,stoppeeA,stoppee_energy,layer1_thickness)
|
||||||
|
[in_en,e_lost2,e_left2] = run_stopit(stopit_child,stoppeeZ,stoppeeA,e_left ,layer2_thickness)
|
||||||
|
|
||||||
|
print(stoppee_energy,e_lost,e_lost2)
|
||||||
|
sys.stdout.flush()
|
||||||
|
layer1_edep.append(float(e_lost))
|
||||||
|
layer2_edep.append(float(e_lost2))
|
||||||
|
'''
|
||||||
|
line.set_data(layer2_edep,layer1_edep) #dE in y-axis, E in x-axis when possible
|
||||||
|
ax.relim()
|
||||||
|
plt.draw()
|
||||||
|
plt.pause(0.004)
|
||||||
|
'''
|
||||||
|
stoppee_energy += step_stoppee_energy
|
||||||
|
|
||||||
|
stopit_child.expect("7 stop\r")
|
||||||
|
stopit_child.send("7\r")
|
||||||
|
stopit_child.expect(px.EOF)
|
||||||
|
stopit_child.close()
|
||||||
|
|
||||||
|
plt.show(block=True)
|
||||||
17
anasen_analysis_vignesh/eloss_calculations/test_tgraph.C
Normal file
17
anasen_analysis_vignesh/eloss_calculations/test_tgraph.C
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
void test_tgraph() {
|
||||||
|
TGraph MeV_to_cm("alphas_in_250torr_mix_filtered.txt","%lf %*lf %lf");
|
||||||
|
TGraph cm_to_MeV(MeV_to_cm.GetN(), MeV_to_cm.GetY(), MeV_to_cm.GetX());
|
||||||
|
|
||||||
|
MeV_to_cm.Draw("AL");
|
||||||
|
while(gPad->WaitPrimitive());
|
||||||
|
cm_to_MeV.Draw("AL");
|
||||||
|
gPad->Modified(); gPad->Update();
|
||||||
|
while(gPad->WaitPrimitive());
|
||||||
|
|
||||||
|
double e=6.0,L=4.0;
|
||||||
|
while(e>5.0) {
|
||||||
|
double temp = MeV_to_cm.Eval(e)-L;
|
||||||
|
std::cout << "If we detect an alpha at " << e << " MeV, covering a path of " << L << " cm, " << cm_to_MeV.Eval(MeV_to_cm.Eval(e)-L) << " MeV is its original energy " << L << " cm prior" << std::endl;
|
||||||
|
e-=0.05;
|
||||||
|
}
|
||||||
|
}
|
||||||
24
anasen_analysis_vignesh/feeder.py
Normal file
24
anasen_analysis_vignesh/feeder.py
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
import keyboard
|
||||||
|
import time
|
||||||
|
fi = open("/tmp/eventlist.dat","r")
|
||||||
|
lines = fi.readlines()[3:]
|
||||||
|
fo = open("/tmp/coords","w")
|
||||||
|
for line in lines:
|
||||||
|
if("--" not in line):
|
||||||
|
print(line,end='')
|
||||||
|
fo.write(line)
|
||||||
|
fo.flush()
|
||||||
|
else:
|
||||||
|
if("end" in line):
|
||||||
|
while True:
|
||||||
|
time.sleep(2)
|
||||||
|
key = "n"
|
||||||
|
#key = input()
|
||||||
|
if 'n' in key:
|
||||||
|
break
|
||||||
|
fo.seek(0)
|
||||||
|
fo.truncate(0)
|
||||||
|
print(line,end='')
|
||||||
|
|
||||||
|
fo.close()
|
||||||
|
fi.close()
|
||||||
41
anasen_analysis_vignesh/gmsx3/func1.h
Normal file
41
anasen_analysis_vignesh/gmsx3/func1.h
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
#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());
|
||||||
|
}
|
||||||
|
}
|
||||||
216
anasen_analysis_vignesh/gmsx3/intgm_sx3.h
Normal file
216
anasen_analysis_vignesh/gmsx3/intgm_sx3.h
Normal file
|
|
@ -0,0 +1,216 @@
|
||||||
|
#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
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
338
anasen_analysis_vignesh/gmsx3/utilities_orr.h
Normal file
338
anasen_analysis_vignesh/gmsx3/utilities_orr.h
Normal file
|
|
@ -0,0 +1,338 @@
|
||||||
|
#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
|
||||||
80
anasen_analysis_vignesh/gnuplot_lookerup
Normal file
80
anasen_analysis_vignesh/gnuplot_lookerup
Normal file
|
|
@ -0,0 +1,80 @@
|
||||||
|
|
||||||
|
# --- configuration ---
|
||||||
|
datafilec = "../ANASEN_analysis/PW_study_Sudarsan/cathode1_2.dat"
|
||||||
|
datafilea = "../ANASEN_analysis/PW_study_Sudarsan/anode1_2.dat"
|
||||||
|
datafileqr = "../ANASEN_analysis/PW_study_Sudarsan/qqq_rings_geometry.dat"
|
||||||
|
datafileqw = "../ANASEN_analysis/PW_study_Sudarsan/qqq_wedges_geometry.dat"
|
||||||
|
|
||||||
|
set datafile separator ","
|
||||||
|
|
||||||
|
N = 24 #number of cids
|
||||||
|
|
||||||
|
# --- allocate arrays ---
|
||||||
|
array ca1x[N]
|
||||||
|
array an1x[N]
|
||||||
|
array ca1y[N]
|
||||||
|
array an1y[N]
|
||||||
|
array ca1z[N]
|
||||||
|
array an1z[N]
|
||||||
|
array ca2x[N]
|
||||||
|
array an2x[N]
|
||||||
|
array ca2y[N]
|
||||||
|
array an2y[N]
|
||||||
|
array ca2z[N]
|
||||||
|
array an2z[N]
|
||||||
|
array qqqW_Phi[64]
|
||||||
|
array qqqR_Rho[16]
|
||||||
|
|
||||||
|
# --- initialize (optional but safe) ---
|
||||||
|
do for [i=1:N] {
|
||||||
|
ca1x[i] = ca1y[i] = ca1z[i] = NaN;
|
||||||
|
ca2x[i] = ca2y[i] = ca2z[i] = NaN;
|
||||||
|
an1x[i] = an1y[i] = an1z[i] = NaN;
|
||||||
|
an2x[i] = an2y[i] = an2z[i] = NaN;
|
||||||
|
}
|
||||||
|
|
||||||
|
do for [j=1:16] {
|
||||||
|
do for [i=1:4] {
|
||||||
|
qqqW_Phi[i*4+j] = NaN
|
||||||
|
}
|
||||||
|
qqqR_Rho[j] = NaN
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# --- load table into arrays ---
|
||||||
|
stats datafilec using \
|
||||||
|
(ca1x[int($1)+1] = $2, \
|
||||||
|
ca1y[int($1)+1] = $3, \
|
||||||
|
ca1z[int($1)+1] = $4, \
|
||||||
|
ca2x[int($1)+1] = $5, \
|
||||||
|
ca2y[int($1)+1] = $6, \
|
||||||
|
ca2z[int($1)+1] = $7, 0) \
|
||||||
|
nooutput
|
||||||
|
|
||||||
|
stats datafilea using \
|
||||||
|
(an1x[int($1)+1] = $2, \
|
||||||
|
an1y[int($1)+1] = $3, \
|
||||||
|
an1z[int($1)+1] = $4, \
|
||||||
|
an2x[int($1)+1] = $5, \
|
||||||
|
an2y[int($1)+1] = $6, \
|
||||||
|
an2z[int($1)+1] = $7, 0) \
|
||||||
|
nooutput
|
||||||
|
|
||||||
|
set datafile separator "\t"
|
||||||
|
stats datafileqr using \
|
||||||
|
(qqqR_Rho[int($1)+1] = $2, 0) \
|
||||||
|
nooutput
|
||||||
|
|
||||||
|
stats datafileqw using \
|
||||||
|
(qqqW_Phi[(int($1))*4+int($2)+1] = $3, 0) \
|
||||||
|
nooutput
|
||||||
|
|
||||||
|
#do for [i=1:N] {
|
||||||
|
# print sprintf("Data[%d] = %g", i, an1x[i])
|
||||||
|
# print sprintf("Data[%d] = %g", i, ca1x[i])
|
||||||
|
#}
|
||||||
|
|
||||||
|
set datafile separator whitespace
|
||||||
|
#plot '< cat /tmp/coords | grep q' u (ca1x[int($2)+1]):(ca1y[int($2)+1]):(ca1x[int($2)+1]):(ca1y[int($2)+1]) w vector
|
||||||
|
|
||||||
|
#pause mouse key
|
||||||
41
anasen_analysis_vignesh/live_plotter
Normal file
41
anasen_analysis_vignesh/live_plotter
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
#columns:
|
||||||
|
#1 is anodeindex, 2 is cathodeindex, 3,4,5 is crossover x,y,z, 6 is alpha - 7,8,9 are anode loci (first plane), 10, 11, 12 are cathode loci (first plane).
|
||||||
|
#13,14,15 are anode second plane loci, 16,17,18 are cathode second plane loci
|
||||||
|
|
||||||
|
#set term qt font 'Verdana,10' size 1920,1080
|
||||||
|
set term x11 font 'terminus-16' size 1920,1080 noraise
|
||||||
|
#set key outside
|
||||||
|
pause_status=0
|
||||||
|
load 'gnuplot_lookerup'
|
||||||
|
bind all "x" "pause_status=!pause_status"
|
||||||
|
set datafile separator ","
|
||||||
|
|
||||||
|
#anode-cathode-raw-loci, junction points colored same as anode wires
|
||||||
|
set title sprintf('press ctrl+q to redraw, Ctrl+C the terminal to exit. pause\_status=%d',pause_status)
|
||||||
|
set xlabel 'x-axis'
|
||||||
|
set ylabel 'y-axis'
|
||||||
|
#set view 212,110,1,1
|
||||||
|
|
||||||
|
set xrange [-100:100]
|
||||||
|
set yrange [-100:100]
|
||||||
|
set zrange [-200:200]
|
||||||
|
|
||||||
|
set zlabel 'z-axis'
|
||||||
|
splot '../ANASEN_analysis/PW_study_Sudarsan/results_zsort.dat' u 7:8:9:($13-$7):($14-$8):($15-$9):1 with vectors nohead dt 1 lc variable title 'anodes',\
|
||||||
|
'' u 10:11:12:($16-$10):($17-$11):($18-$12):2 w vectors nohead dt 7 lc variable title 'cathodes',\
|
||||||
|
'../ANASEN_analysis/PW_study_Sudarsan/results_zsort.dat' u 3:4:5:1 w lp ls 7 lc variable title 'vertices colored anode',\
|
||||||
|
'< cat /tmp/coords | grep an' u (an1x[int($2)+1]):(an1y[int($2)+1]):(an1z[int($2)+1]):(an2x[int($2)+1]-an1x[int($2)+1]):(an2y[int($2)+1]-an1y[int($2)+1]):(an2z[int($2)+1]-an1z[int($2)+1]) w vector nohead lc 'black' lw 8 title 'selected\_anode',\
|
||||||
|
'< cat /tmp/coords | grep ca' u (ca1x[int($2)+1]):(ca1y[int($2)+1]):(ca1z[int($2)+1]):(ca2x[int($2)+1]-ca1x[int($2)+1]):(ca2y[int($2)+1]-ca1y[int($2)+1]):(ca2z[int($2)+1]-ca1z[int($2)+1]) w vectors nohead lc 'grey' dt 2 lw 8 title 'selected\_cath',\
|
||||||
|
'< cat /tmp/coords | grep q' u (qqqR_Rho[int($3)+1]*cos((pi/180.)*qqqW_Phi[int($2)*4+int($5)+1])):(qqqR_Rho[int($3)+1]*sin((pi/180.)*qqqW_Phi[int($2)*4+int($5)+1])):(128) w p ps 4 lc 'black' title 'qqqvertex'
|
||||||
|
#'' u 7:8:9:($1):1 w labels font ',10' tc variable notitle,\
|
||||||
|
#'' u 13:14:15:($1):1 w labels font ',10' tc variable notitle,\
|
||||||
|
#'' u 10:11:12:($2):2 w labels font ',10' tc variable notitle,\
|
||||||
|
#'' u 16:17:18:($2):2 w labels font ',10' tc variable notitle
|
||||||
|
if(pause_status==0) {
|
||||||
|
pause 1.0
|
||||||
|
} else {
|
||||||
|
reread
|
||||||
|
pause mouse close
|
||||||
|
pause_status=!pause_status
|
||||||
|
}
|
||||||
|
reread
|
||||||
334
anasen_analysis_vignesh/mapping.h
Normal file
334
anasen_analysis_vignesh/mapping.h
Normal file
|
|
@ -0,0 +1,334 @@
|
||||||
|
#ifndef Mapping_h
|
||||||
|
#define Mapping_h
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#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}};
|
||||||
|
const int nBd = board.size();
|
||||||
|
|
||||||
|
const int nV1740 = 7;
|
||||||
|
const int nV1725 = 4;
|
||||||
|
|
||||||
|
//+++++++++++++++++++ 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};
|
||||||
|
|
||||||
|
// 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()
|
||||||
|
{
|
||||||
|
|
||||||
|
int digiID = 0;
|
||||||
|
int count = 0;
|
||||||
|
printf("==================== ID-MAP: \n");
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
printf("%11d|", board.at(digiID));
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
if (mapping[i] == -1)
|
||||||
|
{
|
||||||
|
|
||||||
|
printf("%7s|", "");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
if (typeID == 0)
|
||||||
|
{ // SX3
|
||||||
|
|
||||||
|
printf("\033[36m%3d(%2d)\033[0m|", detID, ch);
|
||||||
|
}
|
||||||
|
else if (typeID == 1)
|
||||||
|
{ // QQQ
|
||||||
|
|
||||||
|
printf("\033[91m%3d(%2d)\033[0m|", detID, ch);
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
for (int i = 0; i < 12 + 16 * 8; i++)
|
||||||
|
printf("-");
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
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())
|
||||||
|
{
|
||||||
|
printf("Error: Could not open the file (%s).\n", mapFile.c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string line;
|
||||||
|
|
||||||
|
// Read the file line by line
|
||||||
|
while (std::getline(inputFile, line))
|
||||||
|
{
|
||||||
|
std::vector<std::string> words;
|
||||||
|
std::istringstream iss(line);
|
||||||
|
|
||||||
|
// Extract words from the current line
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
std::string word;
|
||||||
|
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");
|
||||||
|
|
||||||
|
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;
|
||||||
|
detID += chID;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (words[3] == "FRONTUP")
|
||||||
|
{
|
||||||
|
int chID = atoi(words[4].c_str());
|
||||||
|
if (chID % 2 == 0)
|
||||||
|
chID += 1;
|
||||||
|
detID += chID;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (words[3] == "BACK")
|
||||||
|
detID += atoi(words[4].c_str()) + 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
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[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[2] == "blank")
|
||||||
|
{
|
||||||
|
detID = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
map.push_back(detID);
|
||||||
|
|
||||||
|
printf("| %5d", detID);
|
||||||
|
printf("|\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close the file
|
||||||
|
inputFile.close();
|
||||||
|
|
||||||
|
int digiID = 0;
|
||||||
|
int count = 0;
|
||||||
|
printf("===============================\n");
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
printf(" //================== %d\n", board.at(digiID));
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (count == 1)
|
||||||
|
digiID++;
|
||||||
|
if (i % 16 == 0)
|
||||||
|
{
|
||||||
|
printf(" //================== %d\n", board.at(digiID));
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
if (i < map.size())
|
||||||
|
{
|
||||||
|
printf(" %5d,", map[i]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf(" %5d,", -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("\n\n===============================\n");
|
||||||
|
|
||||||
|
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]);
|
||||||
|
}
|
||||||
|
printf("=========== Done. if nothing show, no repeat. \n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
274
anasen_analysis_vignesh/mapping_alpha.h
Normal file
274
anasen_analysis_vignesh/mapping_alpha.h
Normal file
|
|
@ -0,0 +1,274 @@
|
||||||
|
#ifndef Mapping_h
|
||||||
|
#define Mapping_h
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#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, 334},
|
||||||
|
{8, 409},
|
||||||
|
{9, 405}
|
||||||
|
};
|
||||||
|
const int nBd = board.size();
|
||||||
|
|
||||||
|
const int nV1740 = 7;
|
||||||
|
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 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, 811, 810, 809, 808, 1011, 1010, 1009, 1008,
|
||||||
|
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, 1511, 1510, 1509, 1508, 1411, 1410, 1409, 1408, 1611, 1610, 1609, 1608,
|
||||||
|
1206, 1207, 1204, 1205, 1203, 1202, 1201, 1200, 1706, 1707, 1704, 1705, 1703, 1702, 1701, 1700,
|
||||||
|
//================== 22320
|
||||||
|
111, 110, 109, 108, 311, 310, 309, 308, 411, 410, 409, 408, 211, 210, 209, 208,
|
||||||
|
6, 7, 4, 5, 3, 2, 1, 0, 506, 507, 504, 505, 503, 502, 501, 500,
|
||||||
|
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
|
||||||
|
10016, 10017, 10018, 10019, 10020, 10021, 10022, 10023, 10024, 10025, 10026, 10027, 10028, 10029, 10030, 10031,
|
||||||
|
1806, 1807, 1804, 1805, 1803, 1802, 1801, 1800, 2306, 2307, 2304, 2305, 2303, 2302, 2301, 2300,
|
||||||
|
10116, 10117, 10118, 10119, 10120, 10121, 10122, 10123, 10124, 10125, 10126, 10127, 10128, 10129, 10130, 10131,
|
||||||
|
10115, 10114, 10113, 10112, 10111, 10110, 10109, 10108, 10107, 10106, 10105, 10104, 10103, 10102, 10101, 10100,
|
||||||
|
//================== 15529
|
||||||
|
10316, 10317, 10318, 10319, 10320, 10321, 10322, 10323, 10324, 10325, 10326, 10327, 10328, 10329, 10330, 10331,
|
||||||
|
10015, 10014, 10013, 10012, 10011, 10010, 10009, 10008, 10007, 10006, 10005, 10004, 10003, 10002, 10001, 10000,
|
||||||
|
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
|
||||||
|
10216, 10217, 10218, 10219, 10220, 10221, 10222, 10223, 10224, 10225, 10226, 10227, 10228, 10229, 10230, 10231,
|
||||||
|
-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,
|
||||||
|
//================== 409
|
||||||
|
20000, 20001, 20002, 20003, 20004, 20005, 20006, 20007, 20008, 20009, 20010, 20011, 20012, 20013, 20014, 20015,
|
||||||
|
//================== 405
|
||||||
|
20100, 20101, 20102, 20103, 20104, 20105, 20106, 20107, 20108, 20109, 20110, 20111, 20112, 20113, 20114, 20115
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
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("\n");
|
||||||
|
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 ) {
|
||||||
|
printf("%11d|", board.at(digiID));
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if( count == 1 ) digiID ++;
|
||||||
|
if( i % 16 == 0 ) {
|
||||||
|
printf("%11d|", board.at(digiID));
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
if( mapping[i] == -1 ) {
|
||||||
|
|
||||||
|
printf("%7s|", "");
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
if( typeID == 0){ // SX3
|
||||||
|
|
||||||
|
printf("\033[36m%3d(%2d)\033[0m|", detID, ch);
|
||||||
|
|
||||||
|
}else if( typeID == 1){ // QQQ
|
||||||
|
|
||||||
|
printf("\033[91m%3d(%2d)\033[0m|", detID, ch);
|
||||||
|
|
||||||
|
}else if( typeID == 2){ // PC
|
||||||
|
|
||||||
|
printf("\033[35m%3d(%2d)\033[0m|", detID, ch);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
for(int i = 0 ; i < 12 + 16*8; i++ ) printf("-");
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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()) {
|
||||||
|
printf("Error: Could not open the file (%s).\n", mapFile.c_str());
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string line;
|
||||||
|
|
||||||
|
// Read the file line by line
|
||||||
|
while (std::getline(inputFile, line)) {
|
||||||
|
std::vector<std::string> words;
|
||||||
|
std::istringstream iss(line);
|
||||||
|
|
||||||
|
// Extract words from the current line
|
||||||
|
while (true) {
|
||||||
|
std::string word;
|
||||||
|
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");
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
detID += chID;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( words[3] == "FRONTUP" ){
|
||||||
|
int chID = atoi(words[4].c_str());
|
||||||
|
if( chID % 2 == 0 ) chID += 1;
|
||||||
|
detID += chID;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( words[3] == "BACK") detID += atoi(words[4].c_str()) + 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
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[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[2] == "blank") {
|
||||||
|
detID = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
map.push_back(detID);
|
||||||
|
|
||||||
|
printf("| %5d", detID);
|
||||||
|
printf("|\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close the file
|
||||||
|
inputFile.close();
|
||||||
|
|
||||||
|
int digiID = 0;
|
||||||
|
int count = 0;
|
||||||
|
printf("===============================\n");
|
||||||
|
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 ) {
|
||||||
|
printf(" //================== %d\n", board.at(digiID));
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if( count == 1 ) digiID ++;
|
||||||
|
if( i % 16 == 0 ) {
|
||||||
|
printf(" //================== %d\n", board.at(digiID));
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
count ++;
|
||||||
|
}
|
||||||
|
if( i < map.size() ){
|
||||||
|
printf(" %5d,", map[i]);
|
||||||
|
}else{
|
||||||
|
printf(" %5d,", -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("\n\n===============================\n");
|
||||||
|
|
||||||
|
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]);
|
||||||
|
}
|
||||||
|
printf("=========== Done. if nothing show, no repeat. \n");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
67
anasen_analysis_vignesh/pccal/anode_gainmatch.C
Normal file
67
anasen_analysis_vignesh/pccal/anode_gainmatch.C
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
24
anasen_analysis_vignesh/pccal/anode_gm_coeffs.dat
Normal file
24
anasen_analysis_vignesh/pccal/anode_gm_coeffs.dat
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
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
|
||||||
69
anasen_analysis_vignesh/pccal/cathode_gainmatch.C
Normal file
69
anasen_analysis_vignesh/pccal/cathode_gainmatch.C
Normal file
|
|
@ -0,0 +1,69 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
21
anasen_analysis_vignesh/pccal/cathode_gm_coeffs.dat
Normal file
21
anasen_analysis_vignesh/pccal/cathode_gm_coeffs.dat
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
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
|
||||||
49
anasen_analysis_vignesh/pccal/pc_gm_coeffs.dat
Normal file
49
anasen_analysis_vignesh/pccal/pc_gm_coeffs.dat
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
#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
|
||||||
50
anasen_analysis_vignesh/pccal/slope_intercept_26Al.dat
Normal file
50
anasen_analysis_vignesh/pccal/slope_intercept_26Al.dat
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
#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
|
||||||
15
anasen_analysis_vignesh/processRun.C
Normal file
15
anasen_analysis_vignesh/processRun.C
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
#include "TFile.h"
|
||||||
|
#include "TString.h"
|
||||||
|
#include "TROOT.h"
|
||||||
|
#include "TTree.h"
|
||||||
|
|
||||||
|
|
||||||
|
void processRun(TString runFile){
|
||||||
|
|
||||||
|
TFile * file = new TFile(runFile);
|
||||||
|
|
||||||
|
TTree * tree = (TTree *) file->Get("tree");
|
||||||
|
|
||||||
|
tree->Process("Analyzer.C+");
|
||||||
|
|
||||||
|
}
|
||||||
760
anasen_analysis_vignesh/qqq_Calib.dat
Normal file
760
anasen_analysis_vignesh/qqq_Calib.dat
Normal file
|
|
@ -0,0 +1,760 @@
|
||||||
|
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
|
||||||
760
anasen_analysis_vignesh/qqq_GainMatch.dat
Normal file
760
anasen_analysis_vignesh/qqq_GainMatch.dat
Normal file
|
|
@ -0,0 +1,760 @@
|
||||||
|
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
|
||||||
Binary file not shown.
Binary file not shown.
3
anasen_analysis_vignesh/rootlogon.C
Normal file
3
anasen_analysis_vignesh/rootlogon.C
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
gSystem->SetBuildDir("./obj/",1);
|
||||||
|
}
|
||||||
3
anasen_analysis_vignesh/run.sh
Executable file
3
anasen_analysis_vignesh/run.sh
Executable file
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
outfile="$2_output/results_run$1.root"
|
||||||
|
root -q -l -b -x ../ANASEN_analysis/data/$2_Data/Run_$1_mapped.root -e $(printf 'tree->Process("MakeVertex.C+O","%s")' $outfile);
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user