Improved sx3 strip range, and added step-ladder correction to PCZ

1) Environment variables allowing flip and offset of anode wires
2) Environment variables allowing for selection of runs' start and stop time positions, to help with phi scanning runs
3) *fix histograms defined that incorporate step-ladder corrections applied to pcz, hard-coded currently in sx3cal/sx3z_vs_pcz/testmodel.h. Will need a better home in the future
4) EXFit2.C has the capability to now gainmatch all sx3 pads, and position along strip is still found from the central three pad edges. Treatment for (backE-missingfrontE) is being considered.
This commit is contained in:
Sudarsan Balakrishnan 2026-04-14 14:07:18 -04:00
parent e61a63ea13
commit eb54b6ab68
26 changed files with 770 additions and 181 deletions

View File

@ -156,8 +156,8 @@ inline void PW::ConstructGeo()
double k = TMath::TwoPi()/24.; //48 solder thru holes, wires in every other one double k = TMath::TwoPi()/24.; //48 solder thru holes, wires in every other one
double offset_a1 = -6*k-3*k; double offset_a1 = -6*k-3*k;
double offset_c1 = -4*k -2*k - TMath::TwoPi()/48; //correct for a half-turn double offset_c1 = -4*k -2*k - TMath::TwoPi()/48; //correct for a half-turn
std::cerr << "Here!" << std::endl; //std::cerr << "Here!" << std::endl;
#include "../scratch/testing.h" //#include "../scratch/testing.h"
double offset_a2 = offset_a1+wireShift*k; double offset_a2 = offset_a1+wireShift*k;
double offset_c2 = offset_c1-wireShift*k; double offset_c2 = offset_c1-wireShift*k;
@ -210,8 +210,12 @@ inline void PW::ConstructGeo()
Crossover[i][j][0].y = An[i].second.Y() + alpha * a.Y(); Crossover[i][j][0].y = An[i].second.Y() + alpha * a.Y();
Crossover[i][j][0].z = An[i].second.Z() + alpha * a.Z(); 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 || (i+j)%24 == 12) { 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; Crossover[i][j][0].z = 9999999;
//std::cout << "Weird crossover" << std::endl;
} }
Crossover[i][j][1].x = alpha; Crossover[i][j][1].x = alpha;

View File

@ -128,7 +128,7 @@ void sx3::validate() {
for(auto thing: frontL[chan]) std::cout << thing << " " << std::flush; for(auto thing: frontL[chan]) std::cout << thing << " " << std::flush;
std::cout << "\nR:" << std::endl; std::cout << "\nR:" << std::endl;
for(auto thing: frontR[chan]) std::cout << thing << " " << std::flush;*/ for(auto thing: frontR[chan]) std::cout << thing << " " << std::flush;*/
if(frontL[chan].at(0) + frontR[chan].at(0)> maxFE) { if(frontL[chan].at(0) + frontR[chan].at(0)>= maxFE) {
maxFE = frontL[chan].at(0) + frontR[chan].at(0); maxFE = frontL[chan].at(0) + frontR[chan].at(0);
//zpos = (frontL[chan].at(0)-frontR[chan].at(0))/maxFE; //zpos = (frontL[chan].at(0)-frontR[chan].at(0))/maxFE;
fchan = chan; fchan = chan;
@ -145,7 +145,7 @@ void sx3::validate() {
printf("foo\n"); printf("foo\n");
//continue; //continue;
} }
if(back[chan].at(0) > maxBE) { if(back[chan].at(0) >= maxBE) {
maxBE = back[chan].at(0); maxBE = back[chan].at(0);
bchan = chan; bchan = chan;
} }
@ -157,6 +157,12 @@ void sx3::validate() {
- Total F and B energies (frontE, backE) *are*. - Total F and B energies (frontE, backE) *are*.
Sudarsan B, 31 Oct 2024 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 Eleft = frontL[fchan].at(0);
float Eright = frontR[fchan].at(0); float Eright = frontR[fchan].at(0);
frontEL = Eleft; frontEL = Eleft;

View File

@ -13,8 +13,9 @@ Int_t colors[40] = {
#include "Armory/ClassPW.h" #include "Armory/ClassPW.h"
#include "Armory/HistPlotter.h" #include "Armory/HistPlotter.h"
#include "Armory/SX3Geom.h" #include "Armory/SX3Geom.h"
#include "scratch/sx3z_vs_phiz/testmodel.h"
#include <TH2.h> #include <TH2.h>
#include <TF1.h>
#include <TStyle.h> #include <TStyle.h>
#include <TCanvas.h> #include <TCanvas.h>
#include <TMath.h> #include <TMath.h>
@ -41,6 +42,7 @@ const double qqq_z = 100.0;
const double anode_gain = 1.5146e-5; //channels --> MeV const double anode_gain = 1.5146e-5; //channels --> MeV
std::string dataset; std::string dataset;
TF1 pcfix_func("func",model_invert,-200,200);
TApplication *app=NULL; TApplication *app=NULL;
TH1F *hha=NULL,*hhc=NULL; TH1F *hha=NULL,*hhc=NULL;
TH3D *frame=NULL; TH3D *frame=NULL;
@ -109,8 +111,13 @@ bool qqqEcut;
void MakeVertex::Begin(TTree * /*tree*/) void MakeVertex::Begin(TTree * /*tree*/)
{ {
pcfix_func.SetNpx(100000);
TString option = GetOption(); TString option = GetOption();
plotter = new HistPlotter("Analyzer_SX3.root", "TFILE"); if(option!="")
plotter = new HistPlotter(option.Data(),"TFILE");
else
plotter = new HistPlotter("Analyzer_SX3.root", "TFILE");
pw_contr.ConstructGeo(); pw_contr.ConstructGeo();
pwinstance.ConstructGeo(); pwinstance.ConstructGeo();
if(gROOT->IsBatch()) realtime=false; if(gROOT->IsBatch()) realtime=false;
@ -131,8 +138,19 @@ void MakeVertex::Begin(TTree * /*tree*/)
std::cout << "Dataset set to " << dataset << std::endl; std::cout << "Dataset set to " << dataset << std::endl;
std::cout << "source_vertex set to " << source_vertex << std::endl; std::cout << "source_vertex set to " << source_vertex << std::endl;
if(getenv("flipa")) {
int flip_offset = std::atoi(getenv("anode_offset"));
int yes_to_flip = std::atoi(getenv("flipa"));
if(yes_to_flip && flip_offset) {
std::cout << "Flipping anodes and offseting by " << flip_offset << " wires." << std::endl;
} else if(flip_offset){
std::cout << "Offseting anodes without flip by " << flip_offset << " wires." << std::endl;
}
}
fflush(stdout); fflush(stdout);
usleep(4e5); //usleep(4e5);
// Load PC Calibrations // Load PC Calibrations
std::ifstream inputFile("slope_intercept_results_"+dataset+".txt"); std::ifstream inputFile("slope_intercept_results_"+dataset+".txt");
if (inputFile.is_open()) if (inputFile.is_open())
@ -295,6 +313,19 @@ Bool_t MakeVertex::Process(Long64_t entry)
b_pcCh->GetEntry(entry); b_pcCh->GetEntry(entry);
b_pcE->GetEntry(entry); b_pcE->GetEntry(entry);
b_pcT->GetEntry(entry); b_pcT->GetEntry(entry);
double timecut_low = getenv("timecut_low")?std::atof(getenv("timecut_low")):0;
double timecut_high = getenv("timecut_high")?std::atof(getenv("timecut_high")):1e15 ;
if( pc.multi>0) {
for(int i=0; i<pc.multi; i++) {
if(pc.t[i]*1e-9 < timecut_high && pc.t[i]*1e-9 >= timecut_low) {
//good, keep it moving
} else {
return kTRUE;
}
}
}
sx3.CalIndex(); sx3.CalIndex();
qqq.CalIndex(); qqq.CalIndex();
@ -304,28 +335,39 @@ Bool_t MakeVertex::Process(Long64_t entry)
if(sx3.multi>1) { if(sx3.multi>1) {
std::array<sx3det,24> Fsx3; std::array<sx3det,24> Fsx3;
//std::cout << "-----" << std::endl; //std::cout << "-----" << std::endl;
bool found_upstream_sx3=0;
for(int i=0; i<sx3.multi; i++) { for(int i=0; i<sx3.multi; i++) {
int id = sx3.id[i]; int id = sx3.id[i];
//if(id>=12) continue; if(id>=12) continue;
if(sx3.ch[i]>=8) { if(sx3.ch[i]>=8) {
int sx3ch=sx3.ch[i]-8; int sx3ch=sx3.ch[i]-8;
sx3ch=(sx3ch+3)%4; sx3ch=(sx3ch+3)%4;
if(sx3ch==0 || sx3ch==3) continue; if(id>=12) {
float value=sx3.e[i]; found_upstream_sx3=1;
//std::cout << Form("f%d(",id) << sx3ch << "," << sx3.e[i] << ") " << std::flush;
}
//if(sx3ch==0 || sx3ch==3) continue;
double value=sx3.e[i];
int gch = sx3.id[i]*4+(sx3.ch[i]-8); int gch = sx3.id[i]*4+(sx3.ch[i]-8);
Fsx3.at(id).fillevent("BACK",sx3ch,value); if(id<12) Fsx3.at(id).fillevent("BACK",sx3ch,value);
Fsx3.at(id).ts = static_cast<double>(sx3.t[i]); Fsx3.at(id).ts = static_cast<double>(sx3.t[i]);
plotter->Fill2D("sx3backs_raw",100,0,100,800,0,4096,gch,sx3.e[i]); plotter->Fill2D("sx3backs_all_raw",100,0,100,800,0,4096,gch,sx3.e[i]);
} else { } else {
int sx3ch=sx3.ch[i]/2; int sx3ch=sx3.ch[i]/2;
double value=sx3.e[i]; double value=sx3.e[i];
if(id>=12) {
found_upstream_sx3=1;
//std::cout << Form("b%d(",id) << sx3ch << "," << value << ") " << std::flush;
}
if(sx3.ch[i]%2==0) { if(sx3.ch[i]%2==0) {
Fsx3.at(id).fillevent("FRONT_L",sx3ch,value*sx3RightGain[id][sx3ch]); Fsx3.at(id).fillevent("FRONT_L",sx3ch,value*sx3RightGain[id][sx3ch]);
} else { } else {
Fsx3.at(id).fillevent("FRONT_R",sx3ch,value); Fsx3.at(id).fillevent("FRONT_R",sx3ch,value);
} }
} }
} } //end for (i in sx3.multi)
//if(found_upstream_sx3) std::cout << std::endl;
for(int id=0; id<24; id++) { for(int id=0; id<24; id++) {
//std::cout << id << " " << Fsx3.at(id).valid_front_chans.size() << " " << Fsx3.at(id).valid_back_chans.size() << std::endl;; //std::cout << id << " " << Fsx3.at(id).valid_front_chans.size() << " " << Fsx3.at(id).valid_back_chans.size() << std::endl;;
try { try {
@ -342,7 +384,7 @@ Bool_t MakeVertex::Process(Long64_t entry)
det.frontX,det.backE,"evsx"); det.frontX,det.backE,"evsx");
//std::cout << sx3BackGain[id][det.stripF][det.stripB] << " " << sx3FrontGain[id][det.stripF] << std::endl; //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, plotter->Fill2D("matched_be_vs_x_sx3_id_"+std::to_string(id)+"_f"+std::to_string(det.stripF),200,-60,60,800,0,8192,
det.frontX*sx3FrontGain[id][det.stripF]+sx3FrontOffset[id][det.stripF],det.backE*sx3BackGain[id][det.stripF][det.stripB],"evsx_matched"); 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("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"); 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");
@ -350,6 +392,7 @@ Bool_t MakeVertex::Process(Long64_t entry)
if(det.valid && (id ==9 || id==7 || id == 1 || id==3) && det.stripF!=DEFAULT_NULL && det.stripB!=DEFAULT_NULL) { 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 z = det.frontX*sx3FrontGain[id][det.stripF]+sx3FrontOffset[id][det.stripF];
double backE = det.backE*sx3BackGain[id][det.stripF][det.stripB]; double backE = det.backE*sx3BackGain[id][det.stripF][det.stripB];
if(backE<2000) continue;
det.stripF=3-det.stripF; det.stripF=3-det.stripF;
double beta_n = 15.0 + TMath::ATan2((2*det.stripF-3)*40.30, 8.0*88.0*TMath::Cos(15.0*M_PI/180.0))*180./M_PI; //how much to add per strip to the starting position double beta_n = 15.0 + TMath::ATan2((2*det.stripF-3)*40.30, 8.0*88.0*TMath::Cos(15.0*M_PI/180.0))*180./M_PI; //how much to add per strip to the starting position
double phi_n = ((-id+0.5)*30+beta_n); double phi_n = ((-id+0.5)*30+beta_n);
@ -364,6 +407,12 @@ Bool_t MakeVertex::Process(Long64_t entry)
phi_n*=M_PI/180.; //starting-position phi + strip contribution phi_n*=M_PI/180.; //starting-position phi + strip contribution
Event sx3ev(TVector3(88.0*TMath::Cos(phi_n),88.0*TMath::Sin(phi_n),z),backE,-1,det.ts,-1,det.stripB+4*id,det.stripF+4*id); Event sx3ev(TVector3(88.0*TMath::Cos(phi_n),88.0*TMath::Sin(phi_n),z),backE,-1,det.ts,-1,det.stripB+4*id,det.stripF+4*id);
sx3Events.push_back(sx3ev); sx3Events.push_back(sx3ev);
plotter->Fill2D("sx3backs_gm",100,0,100,800,0,8192,det.stripB+4*id,backE);
plotter->Fill2D("sx3backs_raw",100,0,100,800,0,8192,det.stripB+4*id,det.backE);
//plotter->Fill2D("SX3CartesianPlot", 200, -100, 100, 200, -100, 100, 88.0*TMath::Cos(phi_n),88.0*TMath::Sin(phi_n), "hCalSX3");
plotter->Fill2D("SX3CartesianPlot" + std::to_string(id), 200, -100, 100, 200, -100, 100, 88.0*TMath::Cos(phi_n),88.0*TMath::Sin(phi_n), "hCalSX3");
} }
} }
} }
@ -452,12 +501,15 @@ Bool_t MakeVertex::Process(Long64_t entry)
plotter->Fill1D("Wedgetime_Vs_Ringtime", 100, -1000, 1000, tWedge - tRing, "hTiming"); 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("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"); plotter->Fill2D("WedgeE_vs_Index", 16 * 4, 0, 16 * 4, 1000, 0, 16000, chWedge + qqq.id[i] * 16, eWedge, "hRawQQQ");
plotter->Fill2D("WedgeE_Vs_RingECal", 1000, 0, 10, 1000, 0, 10, eWedgeMeV, eRingMeV, "hCalQQQ");
if (qqqCalibValid[qqq.id[i]][chWedge][chRing]) { if (qqqCalibValid[qqq.id[i]][chWedge][chRing]) {
eWedgeMeV = eWedge * qqqCalib[qqq.id[i]][chWedge][chRing] / 1000; eWedgeMeV = eWedge * qqqCalib[qqq.id[i]][chWedge][chRing] / 1000;
eRingMeV = eRing * 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/eWedgeMeV > 3.0 || eRingMeV/eWedgeMeV<1.0/3.0) continue;
if(eRingMeV<1.2 || eWedgeMeV<1.2) continue;
double theta = 2 * TMath::Pi() * (-qqq.id[i] * 16 + (15-chWedge) + 0.5)/(16*4); double theta = 2 * TMath::Pi() * (-qqq.id[i] * 16 + (15-chWedge) + 0.5)/(16*4);
double rho = 50. + (50. / 16.) * (chRing + 0.5); //"?" double rho = 50. + (50. / 16.) * (chRing + 0.5); //"?"
//z used to be 75+30+23=128 //z used to be 75+30+23=128
@ -467,6 +519,7 @@ Bool_t MakeVertex::Process(Long64_t entry)
if(qqq.id[i]>=1) { if(qqq.id[i]>=1) {
QQQ_Events.push_back(qqqevent); QQQ_Events.push_back(qqqevent);
QQQ_Events_Raw.push_back(qqqeventr); QQQ_Events_Raw.push_back(qqqeventr);
plotter->Fill2D("WedgeE_Vs_RingECal_selected", 1000, 0, 10, 1000, 0, 10, eWedgeMeV, eRingMeV, "hCalQQQ");
} }
plotter->Fill2D("QQQCartesianPlot", 200, -100, 100, 200, -100, 100, rho * TMath::Cos(theta), rho * TMath::Sin(theta), "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"); plotter->Fill2D("QQQCartesianPlot" + std::to_string(qqq.id[i]), 200, -100, 100, 200, -100, 100, rho * TMath::Cos(theta), rho * TMath::Sin(theta), "hCalQQQ");
@ -475,8 +528,6 @@ Bool_t MakeVertex::Process(Long64_t entry)
else else
continue; 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++) for (int k = 0; k < pc.multi; k++)
{ {
@ -493,7 +544,7 @@ Bool_t MakeVertex::Process(Long64_t entry)
plotter->Fill2D("CalibratedQQQEvsPCE_R", 1000, 0, 10, 2000, 0, 30000, eRingMeV, pc.e[k], "hPCQQQ"); 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"); 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) // proton tests, 27Al
if (tRing - static_cast<double>(pc.t[k]) > 150) // proton tests, 27Al if (tRing - static_cast<double>(pc.t[k]) < -150) // proton tests, 27Al
{ {
PCAQQQTimeCut = true; PCAQQQTimeCut = true;
} }
@ -565,9 +616,18 @@ Bool_t MakeVertex::Process(Long64_t entry)
anodeIndex = pc.index[i]; anodeIndex = pc.index[i];
if(getenv("flipa")) { if(getenv("flipa")) {
int flip_offset = std::atoi(getenv("flipa")); int flip_offset = std::atoi(getenv("anode_offset"));
int flipped_index = (anodeIndex+flip_offset)%24; int yes_to_flip = std::atoi(getenv("flipa"));
aWireEvents[flipped_index] = std::tuple(flipped_index,pc.e[i],static_cast<double>(pc.t[i])); if(yes_to_flip && flip_offset) {
int flipped_index = (23-anodeIndex+flip_offset)%24;
aWireEvents[flipped_index] = std::tuple(flipped_index,pc.e[i],static_cast<double>(pc.t[i]));
//std::cout << "Flipping anodes and offseting by " << flip_offset << " wires." << std::endl;
} else if(flip_offset){
int offset_index = (anodeIndex+flip_offset)%24;
aWireEvents[pc.index[i]] = std::tuple(offset_index,pc.e[i],static_cast<double>(pc.t[i]));
//std::cout << "Offseting anodes without flip by " << offset_index << " wires." << std::endl;
} else
aWireEvents[pc.index[i]] = std::tuple(pc.index[i],pc.e[i],static_cast<double>(pc.t[i]));
} else } else
aWireEvents[pc.index[i]] = std::tuple(pc.index[i],pc.e[i],static_cast<double>(pc.t[i])); aWireEvents[pc.index[i]] = std::tuple(pc.index[i],pc.e[i],static_cast<double>(pc.t[i]));
if(realtime) hha->SetBinContent(hha->FindFixBin(anodeIndex),pc.e[i]); if(realtime) hha->SetBinContent(hha->FindFixBin(anodeIndex),pc.e[i]);
@ -674,11 +734,13 @@ Bool_t MakeVertex::Process(Long64_t entry)
PCEvent.multi2=cCluster.size(); PCEvent.multi2=cCluster.size();
PC_Events.push_back(PCEvent); PC_Events.push_back(PCEvent);
sumE_AC.push_back(std::pair(apSumE,cpSumE)); sumE_AC.push_back(std::pair(apSumE,cpSumE));
} else {
;//std::cout << "AAAA " << std::endl;
} }
} }
} }
for(auto sx3event: sx3Events) { /*for(auto sx3event: sx3Events) {
for(int i=0; i<24; i++) { for(int i=0; i<24; i++) {
if(aWireEvents.find(i) != aWireEvents.end()) { if(aWireEvents.find(i) != aWireEvents.end()) {
auto awire = aWireEvents[i]; auto awire = aWireEvents[i];
@ -698,7 +760,7 @@ Bool_t MakeVertex::Process(Long64_t entry)
} }
} }
} }
} }*/
if(QQQ_Events.size() && PC_Events.size()) if(QQQ_Events.size() && PC_Events.size())
plotter->Fill2D("PCEv_vs_QQQEv",20,0,20,20,0,20,QQQ_Events.size(),PC_Events.size()); plotter->Fill2D("PCEv_vs_QQQEv",20,0,20,20,0,20,QQQ_Events.size(),PC_Events.size());
@ -721,7 +783,7 @@ Bool_t MakeVertex::Process(Long64_t entry)
std::string detid="_+_"; std::string detid="_+_";
if(sx3Events.size()) detid="+sx3"; if(sx3Events.size()) detid="+sx3";
if(QQQ_Events.size()) detid="+qqq"; if(QQQ_Events.size()) detid="+qqq";
plotter->Fill1D("pcz_a"+std::to_string(aClusters.at(0).size())+"_c"+std::to_string(cClusters.at(0).size())+detid,800,-200,200,pcevent.pos.Z(),"wiremult"); //plotter->Fill1D("pcz_a"+std::to_string(aClusters.at(0).size())+"_c"+std::to_string(cClusters.at(0).size())+detid,800,-200,200,pcevent.pos.Z(),"wiremult");
} }
PCSX3TimeCut=false; PCSX3TimeCut=false;
@ -736,7 +798,7 @@ Bool_t MakeVertex::Process(Long64_t entry)
plotter->Fill1D("dt_pcA_sx3B",640,-2000,2000,sx3event.Time1 - pcevent.Time1); plotter->Fill1D("dt_pcA_sx3B",640,-2000,2000,sx3event.Time1 - pcevent.Time1);
plotter->Fill1D("dt_pcC_sx3B",640,-2000,2000,sx3event.Time1 - pcevent.Time2); plotter->Fill1D("dt_pcC_sx3B",640,-2000,2000,sx3event.Time1 - pcevent.Time2);
plotter->Fill2D("dt_pcA_qqqR_vs_qqqRE",640,-2000,2000,400,0,10,sx3event.Time1-pcevent.Time1, sx3event.Energy1*0.001); plotter->Fill2D("dt_pcA_vs_sx3RE",640,-2000,2000,400,0,10,sx3event.Time1-pcevent.Time1, sx3event.Energy1*0.001);
plotter->Fill2D("dE_E_Anodesx3B",400,0,10,800,0,40000,sx3event.Energy1*0.001,pcevent.Energy1); 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); plotter->Fill2D("dE_E_Cathodesx3B",400,0,10,800,0,10000,sx3event.Energy1*0.001,pcevent.Energy2);
plotter->Fill2D("sx3phi_vs_pcphi"+std::to_string(sx3event.Time1 - pcevent.Time1<-150),100,-360,360,100,-360,360,sx3event.pos.Phi()*180/M_PI,pcevent.pos.Phi()*180/M_PI); plotter->Fill2D("sx3phi_vs_pcphi"+std::to_string(sx3event.Time1 - pcevent.Time1<-150),100,-360,360,100,-360,360,sx3event.pos.Phi()*180/M_PI,pcevent.pos.Phi()*180/M_PI);
@ -767,18 +829,50 @@ Bool_t MakeVertex::Process(Long64_t entry)
plotter->Fill1D("VertexReconZ_SX3"+std::to_string(PCSX3TimeCut),600,-1300,1300,vector_closest_to_z_sx3.Z(),"hPCZSX3"); plotter->Fill1D("VertexReconZ_SX3"+std::to_string(PCSX3TimeCut),600,-1300,1300,vector_closest_to_z_sx3.Z(),"hPCZSX3");
plotter->Fill2D("VertexReconXY_SX3"+std::to_string(PCSX3TimeCut),100,-100,100,100,-100,100,vector_closest_to_z_sx3.X(),vector_closest_to_z_sx3.Y(),"hPCZSX3"); plotter->Fill2D("VertexReconXY_SX3"+std::to_string(PCSX3TimeCut),100,-100,100,100,-100,100,vector_closest_to_z_sx3.X(),vector_closest_to_z_sx3.Y(),"hPCZSX3");
plotter->Fill2D("pcz_vs_sx3pczguess",300,0,200,600,-200,200,pczguess,pcevent.pos.Z()); //x-axis is all Si det, y-axis is PC anode+cathode only plotter->Fill2D("pcz_vs_time",2000,0,2000,600,-200,200,pcevent.Time1*1e-9,pcevent.pos.Z()); //x-axis is all Si det, y-axis is PC anode+cathode only
plotter->Fill2D("pcz_vs_sx3pczguess_int",300,0,200,600,-200,200,pcz_guess_int,pcevent.pos.Z()); //x-axis is all Si det, y-axis is PC anode+cathode only plotter->Fill2D("pcphi_vs_time",2000,0,2000,180,-360,360,pcevent.Time1*1e-9,pcevent.pos.Phi()*180./M_PI); //x-axis is all Si det, y-axis is PC anode+cathode only
//plotter->Fill2D("pcz_vs_sx3pczguess_strip"+std::to_string(sx3event.ch2),300,0,200,600,-200,200,pczguess,pcevent.pos.Z());
//plotter->Fill2D("pcz_vs_time_strip"+std::to_string(sx3event.ch2),2000,0,2000,600,-200,200,pcevent.Time1*1e-9,pcevent.pos.Z()); //x-axis is all Si det, y-axis is PC anode+cathode only
plotter->Fill2D("sx3phi_vs_time",2000,0,2000,180,-360,360,pcevent.Time1*1e-9,sx3event.pos.Phi()*180./M_PI); //x-axis is all Si det, y-axis is PC anode+cathode only
plotter->Fill2D("pcz_vs_sx3pczguess",600,-200,200,600,-200,200,pczguess,pcevent.pos.Z()); //x-axis is all Si det, y-axis is PC anode+cathode only
if(pcevent.multi1==1 && pcevent.multi2==2) {
plotter->Fill2D("pcz_vs_sx3pczguess_A1C2",600,-200,200,600,-200,200,pczguess,pcevent.pos.Z());
double pcz_fix = pcfix_func.Eval(pcevent.pos.Z());
TVector3 x2f(pcevent.pos.X(),pcevent.pos.Y(),pcz_fix);
TVector3 v = x2f-x1;
double t_minimum = -1.0*(x1.X()*v.X()+x1.Y()*v.Y())/(v.X()*v.X()+v.Y()*v.Y());
TVector3 r_rhoMin_fix = x1 + t_minimum*v;
plotter->Fill1D("VertexRecon_pczfix_sx3",600,-200,200,r_rhoMin_fix.Z());
plotter->Fill1D("pczfix_A1C2_1d_sx3",600,-200,200,pcz_fix);
plotter->Fill2D("pczfix_vs_sx3pczguess_A1C2",600,-200,200,600,-200,200,pczguess,pcz_fix);
plotter->Fill2D("pcz_vs_sx3pczguess_A1C2_strip"+std::to_string(sx3event.ch2),300,-200,200,600,-200,200,pczguess,pcevent.pos.Z());
double sinTheta_customV = TMath::Sin((sx3event.pos - TVector3(0,0,r_rhoMin_fix.Z())).Theta());
if(TMath::Abs(r_rhoMin_fix.Z())<200.0) {
plotter->Fill2D("dE3_E_AnodeSX3B_A1C2_(vertex_fix_z/20)="+std::to_string(floor(r_rhoMin_fix.Z()/20.0)),400,0,10,800,0,40000,sx3event.Energy1*0.001,pcevent.Energy1*sinTheta_customV);
plotter->Fill2D("dE3_E_CathodeSX3B_A1C2_(vertex_fix_z/20)="+std::to_string(floor(r_rhoMin_fix.Z()/20.0)),400,0,10,800,0,10000,sx3event.Energy1*0.001,pcevent.Energy2*sinTheta_customV);
}
}
if(pcevent.multi1==1 && pcevent.multi2==3) {
plotter->Fill2D("pcz_vs_sx3pczguess_A1C3",600,-200,200,600,-200,200,pczguess,pcevent.pos.Z());
plotter->Fill2D("pcz_vs_sx3pczguess_A1C3_strip"+std::to_string(sx3event.ch2),300,-200,200,600,-200,200,pczguess,pcevent.pos.Z());
}
plotter->Fill2D("pcz_vs_sx3pczguess_int",600,-200,200,600,-200,200,pcz_guess_int,pcevent.pos.Z()); //x-axis is all Si det, y-axis is PC anode+cathode only
plotter->Fill2D("pcz_vs_sx3pczguess_strip"+std::to_string(sx3event.ch2),300,-200,200,600,-200,200,pczguess,pcevent.pos.Z());
//plotter->Fill2D("pcz_vs_sx3pczguess_phi"+std::to_string(sx3event.pos.Phi()*180/M_PI),300,0,200,600,-200,200,pczguess,pcevent.pos.Z()); //plotter->Fill2D("pcz_vs_sx3pczguess_phi"+std::to_string(sx3event.pos.Phi()*180/M_PI),300,0,200,600,-200,200,pczguess,pcevent.pos.Z());
plotter->Fill2D("pcz_vs_sx3z_strip="+std::to_string(sx3event.ch2),300,0,100,600,-200,200,sx3z,pcevent.pos.Z(),"sx3_vs_pc_zcorr");
/*plotter->Fill2D("pcz_vs_sx3z_strip="+std::to_string(sx3event.ch2),300,0,100,600,-200,200,sx3z,pcevent.pos.Z(),"sx3_vs_pc_zcorr");
plotter->Fill2D("pcz_vs_sx3z_strip="+std::to_string(sx3event.ch2)+"_a"+std::to_string(pcevent.multi1)+"_c"+std::to_string(pcevent.multi2),300,0,100,600,-200,200,sx3z,pcevent.pos.Z(),"sx3_vs_pc_zcorr"); plotter->Fill2D("pcz_vs_sx3z_strip="+std::to_string(sx3event.ch2)+"_a"+std::to_string(pcevent.multi1)+"_c"+std::to_string(pcevent.multi2),300,0,100,600,-200,200,sx3z,pcevent.pos.Z(),"sx3_vs_pc_zcorr");
plotter->Fill2D("pcdEC_vs_sx3z_strip="+std::to_string(sx3event.ch2)+"_a"+std::to_string(pcevent.multi1)+"_c"+std::to_string(pcevent.multi2),800,0,20000,600,-200,200,pcevent.Energy2,sx3z,"sx3_vs_pc_zcorr"); plotter->Fill2D("pcdEC_vs_sx3z_strip="+std::to_string(sx3event.ch2)+"_a"+std::to_string(pcevent.multi1)+"_c"+std::to_string(pcevent.multi2),800,0,20000,600,-200,200,pcevent.Energy2,sx3z,"sx3_vs_pc_zcorr");
plotter->Fill2D("pcdEA_vs_sx3z_strip="+std::to_string(sx3event.ch2)+"_a"+std::to_string(pcevent.multi1)+"_c"+std::to_string(pcevent.multi2),800,0,20000,600,-200,200,pcevent.Energy1,sx3z,"sx3_vs_pc_zcorr"); plotter->Fill2D("pcdEA_vs_sx3z_strip="+std::to_string(sx3event.ch2)+"_a"+std::to_string(pcevent.multi1)+"_c"+std::to_string(pcevent.multi2),800,0,20000,600,-200,200,pcevent.Energy1,sx3z,"sx3_vs_pc_zcorr");*/
for(auto cc: cClusters) /*for(auto cc: cClusters)
for(auto ac: aClusters) { for(auto ac: aClusters) {
plotter->Fill2D("pcz_sx3_phicut_a"+std::to_string(ac.size())+"_c"+std::to_string(cc.size())+"_sx3guess",300,0,200,600,-200,200,sx3z,pcevent.pos.Z(),"hPCZSX3"); plotter->Fill2D("pcz_sx3_phicut_a"+std::to_string(ac.size())+"_c"+std::to_string(cc.size())+"_sx3guess",300,0,200,600,-200,200,sx3z,pcevent.pos.Z(),"hPCZSX3");
if(ac.size()==2 && cc.size()==1) { if(ac.size()==2 && cc.size()==1) {
plotter->Fill2D("pcz_sx3_phicut_a("+std::to_string(std::get<0>(ac.at(0)))+","+std::to_string(std::get<0>(ac.at(1)))+")_c"+std::to_string(std::get<0>(cc.at(0)))+"_sx3guess",300,0,200,600,-200,200,sx3z,pcevent.pos.Z(),"hPCZSX3"); plotter->Fill2D("pcz_sx3_phicut_a("+std::to_string(std::get<0>(ac.at(0)))+","+std::to_string(std::get<0>(ac.at(1)))+")_c"+std::to_string(std::get<0>(cc.at(0)))+"_sx3guess",300,0,200,600,-200,200,sx3z,pcevent.pos.Z(),"hPCZSX3");
@ -789,7 +883,7 @@ Bool_t MakeVertex::Process(Long64_t entry)
plotter->Fill2D("pcz_sx3_phicut_c("+std::to_string(std::get<0>(cc.at(0)))+","+std::to_string(std::get<0>(cc.at(1)))+")_a"+std::to_string(std::get<0>(ac.at(0)))+"_sx3guess",300,0,200,600,-200,200,sx3z,pcevent.pos.Z(),"hPCZSX3"); plotter->Fill2D("pcz_sx3_phicut_c("+std::to_string(std::get<0>(cc.at(0)))+","+std::to_string(std::get<0>(cc.at(1)))+")_a"+std::to_string(std::get<0>(ac.at(0)))+"_sx3guess",300,0,200,600,-200,200,sx3z,pcevent.pos.Z(),"hPCZSX3");
plotter->Fill2D("c2a1_vs_sx3_strip",24,0,24,64,0,64,0.5*(std::get<0>(cc.at(0))+std::get<0>(cc.at(1))),sx3event.ch2,"hPCZSX3"); plotter->Fill2D("c2a1_vs_sx3_strip",24,0,24,64,0,64,0.5*(std::get<0>(cc.at(0))+std::get<0>(cc.at(1))),sx3event.ch2,"hPCZSX3");
plotter->Fill2D("sx3phi_vs_pcphi"+std::to_string(sx3event.Time1 - pcevent.Time1<-150)+"_c("+std::to_string(std::get<0>(cc.at(0)))+","+std::to_string(std::get<0>(cc.at(1)))+")_a"+std::to_string(std::get<0>(ac.at(0))),100,-360,360,100,-360,360,sx3event.pos.Phi()*180/M_PI,pcevent.pos.Phi()*180/M_PI); plotter->Fill2D("sx3phi_vs_pcphi"+std::to_string(sx3event.Time1 - pcevent.Time1<-150)+"_c("+std::to_string(std::get<0>(cc.at(0)))+","+std::to_string(std::get<0>(cc.at(1)))+")_a"+std::to_string(std::get<0>(ac.at(0))),100,-360,360,100,-360,360,sx3event.pos.Phi()*180/M_PI,pcevent.pos.Phi()*180/M_PI);
plotter->Fill2D("pcz_vs_sx3z_2C1A_phiCut_TC"+std::to_string(PCSX3TimeCut),300,0,200,600,-400,400,sx3z,pcevent.pos.Z()); //plotter->Fill2D("pcz_vs_sx3z_2C1A_phiCut_TC"+std::to_string(PCSX3TimeCut),300,0,200,600,-400,400,sx3z,pcevent.pos.Z());
} }
if(ac.size()==1 && cc.size()==1) { if(ac.size()==1 && cc.size()==1) {
@ -797,8 +891,7 @@ Bool_t MakeVertex::Process(Long64_t entry)
//plotter->Fill2D("a2c1_vs_sx3_strip",24,0,24,64,0,64,0.5*(std::get<0>(ac.at(0))+std::get<0>(ac.at(1))),sx3event.ch2,"hPCZSX3"); //plotter->Fill2D("a2c1_vs_sx3_strip",24,0,24,64,0,64,0.5*(std::get<0>(ac.at(0))+std::get<0>(ac.at(1))),sx3event.ch2,"hPCZSX3");
//plotter->Fill2D("sx3phi_vs_pcphi"+std::to_string(sx3event.Time1 - pcevent.Time1<-150)+"_a("+std::to_string(std::get<0>(ac.at(0)))+")_c"+std::to_string(std::get<0>(cc.at(0))),100,-360,360,100,-360,360,sx3event.pos.Phi()*180/M_PI,pcevent.pos.Phi()*180/M_PI); //plotter->Fill2D("sx3phi_vs_pcphi"+std::to_string(sx3event.Time1 - pcevent.Time1<-150)+"_a("+std::to_string(std::get<0>(ac.at(0)))+")_c"+std::to_string(std::get<0>(cc.at(0))),100,-360,360,100,-360,360,sx3event.pos.Phi()*180/M_PI,pcevent.pos.Phi()*180/M_PI);
} }
}*/ //end for
}
bool sx3PhiCut = (TMath::Abs(sx3event.pos.Phi()-pcevent.pos.Phi()) < 45.0*M_PI/180.); bool sx3PhiCut = (TMath::Abs(sx3event.pos.Phi()-pcevent.pos.Phi()) < 45.0*M_PI/180.);
plotter->Fill1D("pcz_sx3Coinc_phiCut"+std::to_string(sx3PhiCut)+"_TC"+std::to_string(PCSX3TimeCut),300,0,200,sx3z); plotter->Fill1D("pcz_sx3Coinc_phiCut"+std::to_string(sx3PhiCut)+"_TC"+std::to_string(PCSX3TimeCut),300,0,200,sx3z);
@ -815,7 +908,7 @@ Bool_t MakeVertex::Process(Long64_t entry)
plotter->Fill2D("pcdE2A_vs_sx3z",800,0,20000,300,0,200,pcevent.Energy1*sinTheta,sx3z); plotter->Fill2D("pcdE2A_vs_sx3z",800,0,20000,300,0,200,pcevent.Energy1*sinTheta,sx3z);
plotter->Fill2D("pcdE2C_vs_sx3z",800,0,20000,300,0,200,pcevent.Energy2*sinTheta,sx3z); plotter->Fill2D("pcdE2C_vs_sx3z",800,0,20000,300,0,200,pcevent.Energy2*sinTheta,sx3z);
plotter->Fill2D("phi_vs_stripnum",180,-180,180,48,0,48,pcevent.pos.Phi()*180./M_PI,sx3event.ch2); plotter->Fill2D("phi_vs_stripnum",180,-180,180,48,0,48,pcevent.pos.Phi()*180./M_PI,sx3event.ch2);
plotter->Fill2D("E_theta_AnodeSX3",200,80,180,300,0,15,sx3theta*180/M_PI,sx3event.Energy1*0.001); plotter->Fill2D("E_theta_AnodeSX3",400,-20,180,300,0,15,sx3theta*180/M_PI,sx3event.Energy1*0.001);
} }
if(PCSX3TimeCut) { if(PCSX3TimeCut) {
plotter->Fill1D("PCZ_sx3",800,-200,200,pcevent.pos.Z(),"hPCZSX3"); plotter->Fill1D("PCZ_sx3",800,-200,200,pcevent.pos.Z(),"hPCZSX3");
@ -825,7 +918,7 @@ Bool_t MakeVertex::Process(Long64_t entry)
plotter->Fill1D("PCZsx3_phicut_a"+std::to_string(ac.size())+"_c"+std::to_string(cc.size()),800,-200,200,pcevent.pos.Z(),"hPCZSX3"); plotter->Fill1D("PCZsx3_phicut_a"+std::to_string(ac.size())+"_c"+std::to_string(cc.size()),800,-200,200,pcevent.pos.Z(),"hPCZSX3");
}*/ }*/
} }
} }//end PC-SX3 coincidence
for(auto pcevent: PC_Events) { for(auto pcevent: PC_Events) {
for(auto qqqevent: QQQ_Events) { for(auto qqqevent: QQQ_Events) {
@ -834,21 +927,47 @@ Bool_t MakeVertex::Process(Long64_t entry)
plotter->Fill1D("dt_pcC_qqqW",640,-2000,2000,qqqevent.Time2 - pcevent.Time2); plotter->Fill1D("dt_pcC_qqqW",640,-2000,2000,qqqevent.Time2 - pcevent.Time2);
plotter->Fill2D("phiPC_vs_phiQQQ",180,-360,360,180,-360,360,qqqevent.pos.Phi()*180/M_PI,pcevent.pos.Phi()*180/M_PI); plotter->Fill2D("phiPC_vs_phiQQQ",180,-360,360,180,-360,360,qqqevent.pos.Phi()*180/M_PI,pcevent.pos.Phi()*180/M_PI);
double sinTheta = TMath::Sin((qqqevent.pos - TVector3(0,0,source_vertex)).Theta());///TMath::Sin((TVector3(51.5,0,128.) - TVector3(0,0,85)).Theta()); double sinTheta = TMath::Sin((qqqevent.pos - TVector3(0,0,source_vertex)).Theta());///TMath::Sin((TVector3(51.5,0,128.) - TVector3(0,0,85)).Theta());
if((qqqevent.pos - TVector3(0,0,source_vertex)).Theta()*180/M_PI > 52) {
plotter->Fill2D("dE2_E_AnodeQQQR_outer",400,0,10,800,0,40000,qqqevent.Energy1,pcevent.Energy1*sinTheta); TVector3 x2(pcevent.pos);
plotter->Fill2D("dE2_E_CathodeQQQR_outer",400,0,10,800,0,10000,qqqevent.Energy2,pcevent.Energy2*sinTheta); TVector3 x1(qqqevent.pos);
plotter->Fill2D("dE_E_AnodeQQQR_outer",400,0,10,800,0,40000,qqqevent.Energy1,pcevent.Energy1); TVector3 v = x2-x1;
plotter->Fill2D("dE_E_CathodeQQQR_outer",400,0,10,800,0,10000,qqqevent.Energy2,pcevent.Energy2); double t_minimum = -1.0*(x1.X()*v.X()+x1.Y()*v.Y())/(v.X()*v.X()+v.Y()*v.Y());
TVector3 r_rhoMin = x1 + t_minimum*v;
/*if((qqqevent.pos - r_rhoMin).Theta()*180/M_PI > 52) {
plotter->Fill2D("dE3_E_AnodeQQQR_outer",400,0,10,800,0,40000,qqqevent.Energy1,pcevent.Energy1*sinTheta_customV,"customVertex");
plotter->Fill2D("dE3_E_CathodeQQQR_outer",400,0,10,800,0,10000,qqqevent.Energy2,pcevent.Energy2*sinTheta_customV,"customVertex");
} else { } else {
plotter->Fill2D("dE2_E_AnodeQQQR_inner",400,0,10,800,0,40000,qqqevent.Energy1,pcevent.Energy1*sinTheta); plotter->Fill2D("dE3_E_AnodeQQQR_inner",400,0,10,800,0,40000,qqqevent.Energy1,pcevent.Energy1*sinTheta_customV,"customVertex");
plotter->Fill2D("dE2_E_CathodeQQQR_inner",400,0,10,800,0,10000,qqqevent.Energy2,pcevent.Energy2*sinTheta); plotter->Fill2D("dE3_E_CathodeQQQR_inner",400,0,10,800,0,10000,qqqevent.Energy2,pcevent.Energy2*sinTheta_customV,"customVertex");
plotter->Fill2D("dE_E_AnodeQQQR_inner",400,0,10,800,0,40000,qqqevent.Energy1,pcevent.Energy1); }*/
plotter->Fill2D("dE_E_CathodeQQQR_inner",400,0,10,800,0,10000,qqqevent.Energy2,pcevent.Energy2);
}
//bool timecut = (qqqevent.Time1 - pcevent.Time1 < -150); //bool timecut = (qqqevent.Time1 - pcevent.Time1 < -150);
bool timecut = (qqqevent.Time1 - pcevent.Time1 < -150); bool timecut = (qqqevent.Time1 - pcevent.Time1 < -150);
if(timecut) {// && qqqevent.pos.Phi() <= pcevent.pos.Phi()+TMath::Pi()/4. && qqqevent.pos.Phi() >= pcevent.pos.Phi()-TMath::Pi()/4. ) { if(timecut) {// && qqqevent.pos.Phi() <= pcevent.pos.Phi()+TMath::Pi()/4. && qqqevent.pos.Phi() >= pcevent.pos.Phi()-TMath::Pi()/4. ) {
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);
/*if((qqqevent.pos - TVector3(0,0,source_vertex)).Theta()*180/M_PI > 52) {
plotter->Fill2D("dE2_E_AnodeQQQR_outer",400,0,10,800,0,40000,qqqevent.Energy1,pcevent.Energy1*sinTheta);
plotter->Fill2D("dE2_E_CathodeQQQR_outer",400,0,10,800,0,10000,qqqevent.Energy2,pcevent.Energy2*sinTheta);
plotter->Fill2D("dE_E_AnodeQQQR_outer",400,0,10,800,0,40000,qqqevent.Energy1,pcevent.Energy1);
plotter->Fill2D("dE_E_CathodeQQQR_outer",400,0,10,800,0,10000,qqqevent.Energy2,pcevent.Energy2);
} else {
plotter->Fill2D("dE2_E_AnodeQQQR_inner",400,0,10,800,0,40000,qqqevent.Energy1,pcevent.Energy1*sinTheta);
plotter->Fill2D("dE2_E_CathodeQQQR_inner",400,0,10,800,0,10000,qqqevent.Energy2,pcevent.Energy2*sinTheta);
plotter->Fill2D("dE_E_AnodeQQQR_inner",400,0,10,800,0,40000,qqqevent.Energy1,pcevent.Energy1);
plotter->Fill2D("dE_E_CathodeQQQR_inner",400,0,10,800,0,10000,qqqevent.Energy2,pcevent.Energy2);
}*/
plotter->Fill2D("qqqphi_vs_time",2000,0,2000,180,-360,360,pcevent.Time1*1e-9,qqqevent.pos.Phi()*180./M_PI); //x-axis is all Si det, y-axis is PC anode+cathode only
//plotter->Fill2D("dE_E_CathodeQQQ(R/4)"+std::to_string(floor((qqqevent.ch1%16)/4)),400,0,10,800,0,10000,qqqevent.Energy2,pcevent.Energy2,"customVertex");
//plotter->Fill2D("dE_E_AnodeQQQ(R/4)"+std::to_string(floor((qqqevent.ch1%16)/4)),400,0,10,800,0,40000,qqqevent.Energy1,pcevent.Energy1,"customVertex");
plotter->Fill1D("dt_pcA_qqqR_timecut",640,-2000,2000,qqqevent.Time1 - pcevent.Time1); plotter->Fill1D("dt_pcA_qqqR_timecut",640,-2000,2000,qqqevent.Time1 - pcevent.Time1);
plotter->Fill1D("dt_pcC_qqqW_timecut",640,-2000,2000,qqqevent.Time2 - pcevent.Time2); plotter->Fill1D("dt_pcC_qqqW_timecut",640,-2000,2000,qqqevent.Time2 - pcevent.Time2);
plotter->Fill2D("dE_theta_AnodeQQQR",75,0,90,400,0,20000,(qqqevent.pos - TVector3(0,0,source_vertex)).Theta()*180/M_PI,pcevent.Energy1); plotter->Fill2D("dE_theta_AnodeQQQR",75,0,90,400,0,20000,(qqqevent.pos - TVector3(0,0,source_vertex)).Theta()*180/M_PI,pcevent.Energy1);
@ -866,7 +985,7 @@ Bool_t MakeVertex::Process(Long64_t entry)
plotter->Fill2D("dE_phi_CathodeQQQR",100,-180,180,800,0,10000,(qqqevent.pos - TVector3(0,0,source_vertex)).Phi()*180/M_PI,pcevent.Energy2); plotter->Fill2D("dE_phi_CathodeQQQR",100,-180,180,800,0,10000,(qqqevent.pos - TVector3(0,0,source_vertex)).Phi()*180/M_PI,pcevent.Energy2);
plotter->Fill1D("PCZ",800,-200,200,pcevent.pos.Z(),"phicut"); plotter->Fill1D("PCZ",800,-200,200,pcevent.pos.Z(),"phicut");
plotter->Fill1D("PCZ_phicut_a"+std::to_string(aClusters.at(0).size())+"_c"+std::to_string(cClusters.at(0).size()),800,-200,200,pcevent.pos.Z(),"wiremult"); //plotter->Fill1D("PCZ_phicut_a"+std::to_string(aClusters.at(0).size())+"_c"+std::to_string(cClusters.at(0).size()),800,-200,200,pcevent.pos.Z(),"wiremult");
double pcz_guess_37 = 37./TMath::Tan((qqqevent.pos-TVector3(0,0,source_vertex)).Theta()) + source_vertex; double pcz_guess_37 = 37./TMath::Tan((qqqevent.pos-TVector3(0,0,source_vertex)).Theta()) + source_vertex;
plotter->Fill2D("pczguess_vs_pc_37",180,0,200,150,0,200,pcz_guess_37,pcevent.pos.Z(),"phicut"); plotter->Fill2D("pczguess_vs_pc_37",180,0,200,150,0,200,pcz_guess_37,pcevent.pos.Z(),"phicut");
@ -876,25 +995,54 @@ Bool_t MakeVertex::Process(Long64_t entry)
double pcz_guess_int = z_to_crossover_rho(pcevent.pos.Z())/TMath::Tan((qqqevent.pos-TVector3(0,0,source_vertex)).Theta()) + source_vertex; double pcz_guess_int = z_to_crossover_rho(pcevent.pos.Z())/TMath::Tan((qqqevent.pos-TVector3(0,0,source_vertex)).Theta()) + source_vertex;
//plotter->Fill2D("pczguess_vs_pc_int",180,0,200,150,0,200,pcz_guess_int,pcevent.pos.Z(),"phicut"); //plotter->Fill2D("pczguess_vs_pc_int",180,0,200,150,0,200,pcz_guess_int,pcevent.pos.Z(),"phicut");
plotter->Fill2D("pczguess_vs_pc_int",180,0,200,600,-400,400,pcz_guess_int,pcevent.pos.Z(),"phicut"); plotter->Fill2D("pczguess_vs_pc_int",400,-200,200,600,-400,400,pcz_guess_int,pcevent.pos.Z(),"phicut");
if(pcevent.multi1==1 && pcevent.multi2==2) {
double pcz_fix = pcfix_func.Eval(pcevent.pos.Z());
TVector3 x2f(pcevent.pos.X(),pcevent.pos.Y(),pcz_fix);
TVector3 v = x2f-x1;
double t_minimum = -1.0*(x1.X()*v.X()+x1.Y()*v.Y())/(v.X()*v.X()+v.Y()*v.Y());
TVector3 r_rhoMin_fix = x1 + t_minimum*v;
double sinTheta_customV = TMath::Sin((qqqevent.pos - TVector3(0,0,r_rhoMin_fix.Z())).Theta());
plotter->Fill2D("dE3_E_CathodeQQQW_A1C2",400,0,10,800,0,10000,qqqevent.Energy2,pcevent.Energy2*sinTheta_customV);
plotter->Fill2D("dE3_E_AnodeQQQR_A1C2",400,0,10,800,0,40000,qqqevent.Energy1,pcevent.Energy1*sinTheta_customV);
plotter->Fill1D("VertexRecon_pczfix_qqq",600,-200,200,r_rhoMin_fix.Z());
if(TMath::Abs(r_rhoMin_fix.Z())<200.0) {
plotter->Fill2D("dE3_E_AnodeQQQR_A1C2_(vertex_fix_z/20)="+std::to_string(floor(r_rhoMin_fix.Z()/20.0)),400,0,10,800,0,40000,qqqevent.Energy1,pcevent.Energy1*sinTheta_customV);
plotter->Fill2D("dE3_E_CathodeQQQR_A1C2_(vertex_fix_z/20)="+std::to_string(floor(r_rhoMin_fix.Z()/20.0)),400,0,10,800,0,10000,qqqevent.Energy1,pcevent.Energy2*sinTheta_customV);
}
plotter->Fill1D("pczfix_A1C2_1d_qqq",600,-200,200,pcz_fix);
plotter->Fill2D("pczfix_vs_qqqpczguess_A1C2",600,-200,200,600,-200,200,pcz_guess_int,pcz_fix);
plotter->Fill2D("pczguess_vs_pc_int_A1C2",400,-200,200,600,-400,400,pcz_guess_int,pcevent.pos.Z(),"phicut");
}
double qqqrho = qqqevent.pos.Perp(); double qqqrho = qqqevent.pos.Perp();
double qqqz = (qqqevent.pos - TVector3(0,0,source_vertex)).Z(); double qqqz = (qqqevent.pos - TVector3(0,0,source_vertex)).Z();
double tan_theta = qqqrho/qqqz; double tan_theta = qqqrho/qqqz;
double pcz_guess_int2 = z_to_crossover_rho(pcevent.pos.Z())/tan_theta + source_vertex; double pcz_guess_int2 = z_to_crossover_rho(pcevent.pos.Z())/tan_theta + source_vertex;
plotter->Fill2D("pczguess_vs_pc_int2",180,0,200,150,0,200,pcz_guess_int2,pcevent.pos.Z(),"phicut"); plotter->Fill2D("pczguess_vs_pc_int2",180,0,200,150,0,200,pcz_guess_int2,pcevent.pos.Z(),"phicut");
plotter->Fill2D("pczguess_vs_pc_int2_a"+std::to_string(pcevent.multi1)+"_c"+std::to_string(pcevent.multi2),180,0,200,150,0,200,pcz_guess_int2,pcevent.pos.Z(),"phicut");
double qqqz2 = (qqqevent.pos - r_rhoMin).Z();
double tan_theta2 = qqqrho/qqqz2;
double pcz_guess_int3 = z_to_crossover_rho(pcevent.pos.Z())/tan_theta2 + r_rhoMin.Z();
plotter->Fill2D("pczguess_vs_pc_int3",180,0,200,150,0,200,pcz_guess_int3,pcevent.pos.Z(),"phicut");
//plotter->Fill2D("pczguess_vs_pc_int2_a"+std::to_string(pcevent.multi1)+"_c"+std::to_string(pcevent.multi2),180,0,200,150,0,200,pcz_guess_int2,pcevent.pos.Z(),"phicut");
double pcz_guess = pcz_guess_int; double pcz_guess = pcz_guess_int;
plotter->Fill2D("pctheta_vs_qqqtheta",320,0,160,320,0,160,(qqqevent.pos-TVector3(0,0,source_vertex)).Theta()*180/M_PI,(pcevent.pos-TVector3(0,0,source_vertex)).Theta()*180/M_PI,"phicut"); plotter->Fill2D("pctheta_vs_qqqtheta_sv",180,-360,360,180,-360,360,(qqqevent.pos-TVector3(0,0,source_vertex)).Theta()*180/M_PI,(pcevent.pos-TVector3(0,0,source_vertex)).Theta()*180/M_PI,"phicut");
plotter->Fill2D("pctheta_vs_qqqtheta_rmz",180,-360,360,180,-360,360,(qqqevent.pos-TVector3(0,0,r_rhoMin.Z())).Theta()*180/M_PI,(pcevent.pos-TVector3(0,0,r_rhoMin.Z())).Theta()*180/M_PI,"phicut");
plotter->Fill2D("pctheta_vs_qqqtheta_rm",180,-360,360,180,-360,360,(qqqevent.pos-r_rhoMin).Theta()*180/M_PI,(pcevent.pos-r_rhoMin).Theta()*180/M_PI,"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->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"); //plotter->Fill1D("PCZ",800,-200,200,pcevent.pos.Z(),"phicut");
} }
} }
} }//end PC QQQ coincidence
//HALFTIME! Can stop here in future versions //HALFTIME! Can stop here in future versions
return kTRUE; return kTRUE;
if (anodeHits.size() >= 1 && cathodeHits.size() >= 1) if (anodeHits.size() >= 1 && cathodeHits.size() >= 1)
@ -1128,6 +1276,10 @@ Bool_t MakeVertex::Process(Long64_t entry)
vector_closest_to_z = x1 + t_minimum*v; 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"); plotter->Fill1D("VertexRecon_Z_TC"+std::to_string(PCQQQTimeCut)+"_PhiC"+std::to_string(PCQQQPhiCut), 600, -1300, 1300, vector_closest_to_z.Z(),"customVertex");
if(qqqenergy<4.0)
plotter->Fill1D("VertexRecon_Z(qqqE<4.0MeV)_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) { 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->Fill1D("VertexRecon_RadialCut_Z_TC"+std::to_string(PCQQQTimeCut)+"_PhiC"+std::to_string(PCQQQPhiCut), 600, -1300, 1300, vector_closest_to_z.Z(),"customVertex");
} }
@ -1140,7 +1292,7 @@ Bool_t MakeVertex::Process(Long64_t entry)
} }
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_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_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"); plotter->Fill2D("VertexRecon2C_Z_vs_QQQE_TC"+std::to_string(PCQQQTimeCut)+"_PhiC"+std::to_string(PCQQQPhiCut), 600, -1300, 1300, 800,0,20, vector_closest_to_z.Z(), qqqenergy,"customVertex");
} }
} }
@ -1290,6 +1442,18 @@ Bool_t MakeVertex::Process(Long64_t entry)
{ {
plotter->Fill1D("NoAnodeHits_CathodeHits", 6, 0, 5, cathodeHits.size(), "hGMPC"); plotter->Fill1D("NoAnodeHits_CathodeHits", 6, 0, 5, cathodeHits.size(), "hGMPC");
} }
for(auto cwevent: cWireEvents) {
//plotter->Fill1D("cwdtqqq_vs_cw"+std::to_string(PCQQQTimeCut),800,-2000,2000,24,0,24,std::get<2>(cwevent)-qqqtimestamp,std::get<0>(cwevent));
for(auto awevent: aWireEvents) {
plotter->Fill2D("aw_vs_cw",24,0,24,24,0,24,std::get<0>(awevent),std::get<0>(cwevent));
plotter->Fill2D("aw_vs_cw_dtq"+std::to_string(PCQQQTimeCut),24,0,24,24,0,24,std::get<0>(awevent),std::get<0>(cwevent));
}
}
for(auto awevent: aWireEvents) {
//plotter->Fill1D("awdtqqq_vs_aw"+std::to_string(PCQQQTimeCut),800,-2000,2000,24,0,24,std::get<2>(awevent)-qqqtimestamp,std::get<0>(awevent));
}
return kTRUE; return kTRUE;
} }

View File

@ -88,6 +88,8 @@ public :
virtual void SlaveTerminate(); virtual void SlaveTerminate();
virtual void Terminate(); virtual void Terminate();
void MakeAnalysisHistograms();
void MakeDiagnosticHistograms();
ClassDef(MakeVertex,0); ClassDef(MakeVertex,0);
}; };

3
run.sh Executable file
View 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);

46
run_17F.sh Normal file
View File

@ -0,0 +1,46 @@
rm results_run*.root
export DATASET="17F"
export flip180="0"
export flipa=0
export anode_offset=1
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_005_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run05.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_006_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run06.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_007_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run07.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_008_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run08.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_009_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run09.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_010_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run10.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_011_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run11.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_012_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run12.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_013_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run13.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_014_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run14.root;
#17F pulser runs
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/PulserRun_015_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run15.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/PulserRun_016_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run16.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/PulserRun_017_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run17.root;
#17F alpha run with gas
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_018_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run18.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_019_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run19.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_020_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run20.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_021_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run21.root;
#17F reaction data
export flip180="1"
declare -i run=231 #49
while [[ $run -lt 235 ]]; do #392
wrun=$(printf "%03d" $run)
file_exists=$(test -f ../ANASEN_analysis/data/17F_Data/Run_"$wrun"_mapped.root)
if [[ $file_exists -ne 0 ]]; then continue; fi
root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Run_"$wrun"_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run$wrun.root;
run=run+1
done
rm output_17F.root
hadd -j 4 -k output_17F.root results_run2*.root
unset souce_vertex
unset DATASET
unset flip180
unset flipa
unset anode_offset

28
run_27Al.sh Normal file
View File

@ -0,0 +1,28 @@
#rm results_run*.root
export DATASET="27Al"
export flip180="0"
#declare -i run=28
#while [[ $run -lt 34 ]]; do #runs 1 to 84
# wrun=$(printf "%03d" $run)
# root -q -l -b -x ../ANASEN_analysis/data/27Al_Data/Run_"$wrun"_mapped.root -e 'tree->Process("Make#Vertex.C+O")'; mv Analyzer_SX3.root 27Al_output/results_run$wrun.root;
# run=run+1
#done
declare -i run=50
while [[ $run -lt 59 ]]; do #runs 1 to 84
wrun=$(printf "%03d" $run)
root -q -l -b -x ../ANASEN_analysis/data/27Al_Data/Run_"$wrun"_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root 27Al_output/results_run$wrun.root;
run=run+1
done
rm output.root
hadd -k -j 4 output.root 27Al_output/results_run*.root
mv output.root output_27Al.root
#root -q -l -b -x -e '.L MakeVertex.C+O';
#halfproc=3
#parallel --ctag --bar -j $halfproc ./run.sh ::: {028..034} ::: 27Al #color-tag, linebuffer, then run run.sh in parallel
unset souce_vertex
unset DATASET
unset flip180

View File

@ -1,29 +1,51 @@
#Alpha runs at different spacer positions #Alpha runs at different spacer positions
#rm results_run*.root #rm results_run*.root
#root -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_009_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run09.root; #export flipa=1
#root -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_001_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run01.root; export anode_offset=1
#root -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_002_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run02.root; export DATASET="27Al"
#root -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_003_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run03.root; if [[ 1 -eq 0 ]]; then
#root -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_004_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run04.root; root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_009_mapped.root -e 'tree->Process("MakeVertex.C+O","27Al")'; mv Analyzer_SX3.root results_run09.root;
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_001_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run01.root;
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_002_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run02.root;
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_003_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run03.root;
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_004_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run04.root;
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_005_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run05.root;
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_006_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run06.root;
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_007_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run07.root;
root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_008_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run08.root;
fi
#exit
#alpha+gas 27Al #alpha+gas 27Al
export DATASET="26Al" export DATASET="27Al"
export flip180="0" export flip180="0"
#root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_009_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run09.root; #root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_009_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run09.root;
#root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_012_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run12.root; if [[ 1 -eq 0 ]]; then
#root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_013_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run13.root; #export timecut_low=500.0;
#export timecut_high=500.0;
#unset timecut_low, timecut_high
#export source_vertex=53.44; root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_009_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run09.root;
#export source_vertex=53.44; root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_010_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run10.root;
#export source_vertex=53.44; root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_011_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run11.root;
export source_vertex=53.44; root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_012_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run12.root;
#export source_vertex=53.44; root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_013_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run13.root;
#exit #exit
fi
#protons+gas, 27Al #protons+gas, 27Al
export flip180="1" #export flip180="1"
#root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_015_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run15.root; #export flip180="0"
#root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_017_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run17.root; if [[ 1 -eq 1 ]] ; then
#root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_018_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run18.root; export anode_offset=1
#root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_019_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run19.root; root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_015_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run15.root;
#root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_020_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run20.root; root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_017_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run17.root;
#root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_021_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run21.root; root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_018_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run18.root;
#root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_022_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run22.root; root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_019_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run19.root;
#exit root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_020_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run20.root;
root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_021_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run21.root;
root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_022_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run22.root;
exit
fi
#27Al reaction data #27Al reaction data
#root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_051_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run51.root; #root -b -q -l -x ../ANASEN_analysis/data/27Al_Data/Run_051_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run51.root;
@ -34,43 +56,49 @@ export flip180="1"
#exit #exit
export DATASET="17F" export DATASET="17F"
export flip180="0" export flip180="0"
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_005_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run05.root; if [[ 1 -eq 0 ]]; then
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_006_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run06.root; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_005_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run05.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_007_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run07.root; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_006_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run06.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_008_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run08.root; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_007_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run07.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_009_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run09.root; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_008_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run08.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_010_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run10.root; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_009_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run09.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_011_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run11.root; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_010_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run10.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_012_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run12.root; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_011_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run11.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_013_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run13.root; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_012_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run12.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_014_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run14.root; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_013_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run13.root;
root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Source_014_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run14.root;
fi
#17F pulser runs #17F pulser runs
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/PulserRun_015_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run15.root; #root -q -l -b -x ../ANASEN_analysis/data/17F_Data/PulserRun_015_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run15.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/PulserRun_016_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run16.root; #root -q -l -b -x ../ANASEN_analysis/data/17F_Data/PulserRun_016_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run16.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/PulserRun_017_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run17.root; #root -q -l -b -x ../ANASEN_analysis/data/17F_Data/PulserRun_017_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run17.root;
#17F alpha run with gas #17F alpha run with gas
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_018_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run18.root; export source_vertex=53.44; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_018_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run18.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_019_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run19.root; export source_vertex=14.24; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_019_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run19.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_020_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run20.root; export source_vertex=-24.96; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_020_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run20.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_021_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run21.root; export source_vertex=-73.96; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/SourceRun_021_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run21.root;
#17F reaction data #17F reaction data
export flip180="1" export flip180="1"
#export source_vertex=-57.28; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_035_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run35.root; #export source_vertex=-57.28; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_035_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run35.root;
export source_vertex=-8.28; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_036_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root resulrs_run36.root; #export source_vertex=-8.28; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_036_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root resulrs_run36.root;
export source_vertex=-27.88; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_037_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run37.root; #export source_vertex=-27.88; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_037_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run37.root;
export source_vertex=11.32; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_038_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run38.root; #export source_vertex=11.32; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_038_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run38.root;
export source_vertex=30.92; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_039_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run39.root; #export source_vertex=30.92; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_039_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run39.root;
export source_vertex=50.52; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_041_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run41.root; #export source_vertex=50.52; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_041_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run41.root;
export source_vertex=70.12; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_042_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run42.root; #export source_vertex=70.12; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_042_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run42.root;
export source_vertex=109.32; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_043_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run43.root; #export source_vertex=109.32; root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_043_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run43.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_043_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run43.root; #root -q -l -b -x ../ANASEN_analysis/data/17F_Data/ProtonRun_043_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run43.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Run_099_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run99.root; #root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Run_099_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run99.root;
#root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Run_104_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run104.root; #root -q -l -b -x ../ANASEN_analysis/data/17F_Data/Run_104_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run104.root;
#mv Analyzer_SX3.root results_run19.root; #mv Analyzer_SX3.root results_run19.root;
unset flipa
unset flipc
unset anode_offset
unset cathode_offset
unset souce_vertex unset souce_vertex
unset DATASET unset DATASET
unset flip180 unset flip180
unset timecut_low, timecut_high

View File

@ -10,7 +10,7 @@ void scan_offset(){
c1->SetGrid(1,1); c1->SetGrid(1,1);
TFile *f = new TFile(Form("results_run12_anodeoffset%d.root",i)); TFile *f = new TFile(Form("results_run12_anodeoffset%d.root",i));
//TH2F *h2 = (TH2F*)(f->Get("phicut/pczguess_vs_pc_int")); //TH2F *h2 = (TH2F*)(f->Get("phicut/pczguess_vs_pc_int"));
TH2F *h2 = (TH2F*)(f->Get("pcz_vs_sx3z")); TH2F *h2 = (TH2F*)(f->Get("pcz_vs_sx3pczguess"));
// TH2F *h2 = (TH2F*)(f->Get("hPCQQQ/PC_XY_Projection_QQQ2")); // TH2F *h2 = (TH2F*)(f->Get("hPCQQQ/PC_XY_Projection_QQQ2"));
if(!h2) continue; if(!h2) continue;
h2->SetTitle(Form("case%d",i)); h2->SetTitle(Form("case%d",i));
@ -32,7 +32,7 @@ void scan_offset(){
while(gPad->WaitPrimitive()); while(gPad->WaitPrimitive());
f->Close(); f->Close();
if(i==23) i=0; if(i==23) i=-1;
if(quit) break; if(quit) break;
} }
} }

View File

@ -1,24 +1,56 @@
#include "testmodel.h"
int quit=0; int quit=0;
void handler(int){quit=1;} void handler(int){quit=1;}
int colors[] = {kSpring+3, kRed, kGreen+3, kBlue+3, kViolet, kOrange, kSpring-7, kAzure-5};
void scan_offset(){ void scan_offset(){
signal(SIGINT,handler); signal(SIGINT,handler);
TCanvas c("c1","c1",0,0,1600,800); TCanvas c("c1","c1",0,0,1600,800);
c.Divide(2,1); c.Divide(2,1);
for(int i=36; i<=43; i++) {
TF1 f1("model",model,-200,200,2);
f1.SetNpx(10000);
std::vector<double> pars = {0.0,1.};
f1.SetParameters(pars.data());
f1.SetLineColor(kGreen+2);
f1.SetLineStyle(kLine);
TFile* f=NULL;
std::vector<TFile*> files;
int ctr=0;
for(int i=12; i<=21; i++) {
auto c1=c.cd(1); auto c1=c.cd(1);
c1->SetGrid(1,1); c1->SetGrid(1,1);
TFile *f = new TFile(Form("../../results_run%d.root",i)); f = new TFile(Form("../../results_run%d.root",i));
//TH2F *h2 = (TH2F*)(f->Get("phicut/pczguess_vs_pc_int"));
TH2F *h2 = (TH2F*)(f->Get("pcz_vs_sx3z_phiCut1_TC1")); if(i==12) {
// TH2F *h2 = (TH2F*)(f->Get("pcz_vs_sx3z_2C1A_phiCut_TC1")); //TH2F *h2 = (TH2F*)(f->Get("phicut/pczguess_vs_pc_int"));
//TH1F *h2 = (TH1F*)(f->Get("pcz_sx3Coinc_phiCut1_TC1")); TH2F *h23 = (TH2F*)(f->Get("phicut/pczguess_vs_pc_int_A1C2"));
// TH2F *h2 = (TH2F*)(f->Get("hPCQQQ/PC_XY_Projection_QQQ2")); h23->SetLineColorAlpha(kOrange,0.75);
if(!h2) continue; h23->Draw("box SAME");
h2->SetTitle(Form("case%d",i));
h2->Draw("colz"); } else {
//TH2F *h2 = (TH2F*)(f->Get("phicut/pczguess_vs_pc_int"));
//TH2F *h2 = (TH2F*)(f->Get("pcz_vs_sx3pczguess_A1C2_strip12"));
TH2F *h2 = (TH2F*)(f->Get("pcz_vs_sx3pczguess_A1C2"));
//TH2F *h2 = (TH2F*)(f->Get("hPCQQQ/PC_XY_Projection_QQQ2"));
if(!h2) continue;
h2->SetTitle(Form("case%d",i));
//h2->Draw("colz same");
h2->SetLineColorAlpha(colors[ctr],0.75);
h2->Draw("box same");
f1.Draw("same");
}
TF1 eqline("x","x",-200,200);
eqline.Draw("SAME");
c1->Modified(); c1->Modified();
c1->Update(); c1->Update();
ctr+=1;
auto c2=c.cd(2); auto c2=c.cd(2);
c2->SetGrid(1,1); c2->SetGrid(1,1);
@ -28,13 +60,22 @@ void scan_offset(){
if(!h3) continue; if(!h3) continue;
h3->SetTitle(Form("case%d",i)); h3->SetTitle(Form("case%d",i));
h3->Draw("colz"); h3->Draw("colz");
eqline.Draw("SAME");
c2->Modified(); c2->Modified();
c2->Update(); c2->Update();
while(gPad->WaitPrimitive()); while(gPad->WaitPrimitive());
f->Close(); files.emplace_back(f);
if(i==43) i=35; if(i==21) {
i=11;
c.Clear();
c.Divide(2,1);
ctr=0;
}
if(quit) break; if(quit) break;
} }
for(auto file : files) {
file->Close();
}
} }

View File

@ -0,0 +1,81 @@
#include "testmodel.h"
int quit=0;
void handler(int){quit=1;}
int colors[] = {kSpring+3, kRed, kGreen+3, kBlue+3, kViolet, kOrange, kSpring-7, kAzure-5};
void scan_offset_fix(){
signal(SIGINT,handler);
TCanvas c("c1","c1",0,0,1600,800);
c.Divide(2,1);
TF1 f1("model",model,-200,200,2);
f1.SetNpx(10000);
std::vector<double> pars = {0.0,1.};
f1.SetParameters(pars.data());
f1.SetLineColor(kGreen+2);
f1.SetLineStyle(kLine);
TFile* f=NULL;
std::vector<TFile*> files;
int ctr=0;
for(int i=12; i<=21; i++) {
auto c1=c.cd(1);
c1->SetGrid(1,1);
f = new TFile(Form("../../results_run%d.root",i));
if(i==12) {
//TH2F *h2 = (TH2F*)(f->Get("phicut/pczguess_vs_pc_int"));
TH2F *h23 = (TH2F*)(f->Get("pczfix_vs_qqqpczguess_A1C2"));
h23->SetLineColorAlpha(kOrange,0.75);
h23->Draw("SAME");
} else {
//TH2F *h2 = (TH2F*)(f->Get("phicut/pczguess_vs_pc_int"));
//TH2F *h2 = (TH2F*)(f->Get("pcz_vs_sx3pczguess_A1C2_strip12"));
TH2F *h2 = (TH2F*)(f->Get("pczfix_vs_sx3pczguess_A1C2"));
//TH2F *h2 = (TH2F*)(f->Get("hPCQQQ/PC_XY_Projection_QQQ2"));
if(!h2) continue;
h2->SetTitle(Form("case%d",i));
//h2->Draw("colz same");
h2->SetLineColorAlpha(colors[ctr],0.75);
h2->Draw("box same");
//f1.Draw("same");
}
TF1 eqline("x","x",-200,200);
eqline.Draw("SAME");
c1->Modified();
c1->Update();
ctr+=1;
auto c2=c.cd(2);
c2->SetGrid(1,1);
TH2F *h3 = (TH2F*)(f->Get("sx3phi_vs_pcphi1"));
// TH2F *h2 = (TH2F*)(f->Get("hPCQQQ/PC_XY_Projection_QQQ2"));
if(!h3) continue;
h3->SetTitle(Form("case%d",i));
h3->Draw("colz");
eqline.Draw("SAME");
c2->Modified();
c2->Update();
while(gPad->WaitPrimitive());
files.emplace_back(f);
if(i==21) {
i=11;
c.Clear();
c.Divide(2,1);
ctr=0;
}
if(quit) break;
}
for(auto file : files) {
file->Close();
}
}

View File

@ -0,0 +1,5 @@
{
}

View File

@ -0,0 +1,43 @@
#include <TF1.h>
double model(double* x, double* p) {
double result = x[0];
double factor = 29.0;
double slope = 0.7;
if(TMath::Abs(x[0]) < 16.2) result=x[0]*slope;
else if(TMath::Abs(x[0]) < 49.8 ) result=x[0]*slope+TMath::Sign(1.0,x[0])*factor;
else if(TMath::Abs(x[0]) < 85.2 ) result=x[0]*slope+TMath::Sign(1.0,x[0])*factor*2;
else result=x[0]*slope+TMath::Sign(1.0,x[0])*factor*2;
return result;
}
double model_invert(double *y, double *q) {
double result=y[0];
double slope = 0.7;
double factor = 40.0;
if(TMath::Abs(y[0]) < 16.2/slope) result = y[0]/slope;
else if(TMath::Abs(y[0]) < 49.8/slope ) result=y[0]/slope-TMath::Sign(1.0,y[0])*factor;
else if(TMath::Abs(y[0]) < 85.2/slope ) result=y[0]/slope-TMath::Sign(1.0,y[0])*factor*2;
else result=y[0]/slope-TMath::Sign(1.0,y[0])*factor*2;
return result;
}
/*void testmodel() {
TF1 eqline("x","x",-200,200);
eqline.Draw("");
eqline.SetLineStyle(kDashed);
//TF1 f1("model",model,-200,200,2);
TF1 f1("model_inv",model_invert,-200,200,2);
eqline.SetNpx(10000);
f1.SetNpx(10000);
std::vector<double> pars = {0.0,1.};
f1.SetParameters(pars.data());
f1.SetLineColor(kGreen+2);
f1.SetLineStyle(kLine);
f1.Draw("L SAME");
gPad->Modified(); gPad->Update();
while(gPad->WaitPrimitive());
}*/

View File

@ -1,26 +1,55 @@
1 front 0 back 2 4.1692 1 front 0 back 3 3.68208
1 front 1 back 2 4.13701 1 front 0 back 0 3.89631
1 front 2 back 2 4.26886 1 front 1 back 2 4.44599
1 front 3 back 2 4.26886 1 front 1 back 3 3.81311
3 front 1 back 2 3.31729 1 front 1 back 0 3.98321
3 front 1 back 1 3.33796 1 front 2 back 2 4.52103
3 front 2 back 2 3.35889 1 front 2 back 3 3.68208
3 front 2 back 1 3.49018 1 front 2 back 0 3.95382
3 front 3 back 2 3.38008 1 front 3 back 2 4.55951
3 front 3 back 1 3.35889 1 front 3 back 3 3.68208
7 front 0 back 2 3.25679 1 front 3 back 0 3.89631
7 front 0 back 1 3.08785 3 front 1 back 2 3.81311
7 front 1 back 2 3.25679 3 front 1 back 1 3.92485
7 front 1 back 1 3.14218 3 front 1 back 3 4.13701
7 front 2 back 2 3.29688 3 front 1 back 0 4.26886
7 front 2 back 1 3.16072 3 front 2 back 2 3.86817
7 front 3 back 2 3.29688 3 front 2 back 1 4.04334
7 front 3 back 1 3.12386 3 front 2 back 3 3.98321
9 front 0 back 2 3.25679 3 front 2 back 0 4.23512
9 front 0 back 1 3.10575 3 front 3 back 2 3.92485
9 front 1 back 2 3.27671 3 front 3 back 1 3.92485
9 front 1 back 1 3.12386 3 front 3 back 3 3.95382
9 front 2 back 2 3.29688 3 front 3 back 0 4.13701
9 front 2 back 1 3.14218 7 front 0 back 2 3.65694
9 front 3 back 2 3.29688 7 front 0 back 1 3.53625
9 front 3 back 1 3.10575 7 front 0 back 3 4.23512
7 front 0 back 0 3.60769
7 front 1 back 2 3.65694
7 front 1 back 1 3.53625
7 front 1 back 3 4.23512
7 front 1 back 0 3.58356
7 front 2 back 2 3.68208
7 front 2 back 1 3.55975
7 front 2 back 3 4.13701
7 front 2 back 0 3.60769
7 front 3 back 2 3.68208
7 front 3 back 1 3.53625
7 front 3 back 3 4.23512
7 front 3 back 0 3.58356
9 front 0 back 2 3.68208
9 front 0 back 1 3.53625
9 front 0 back 3 3.51306
9 front 0 back 0 3.42327
9 front 1 back 2 3.70756
9 front 1 back 1 3.49018
9 front 1 back 3 3.63215
9 front 1 back 0 3.46759
9 front 2 back 2 3.70756
9 front 2 back 1 3.55975
9 front 2 back 3 3.53625
9 front 2 back 0 3.44529
9 front 3 back 2 3.7334
9 front 3 back 1 3.51306
9 front 3 back 3 3.53625
9 front 3 back 0 3.42327

View File

@ -1,6 +1,6 @@
{ {
int index = 9; int index = 1;
TFile *f = new TFile("../results_run10.root"); TFile *f = new TFile("../results_run01.root");
TH2F *h2=NULL; TH2F *h2=NULL;
TH1F *h1x=NULL, *h1y=NULL; TH1F *h1x=NULL, *h1y=NULL;
//f->cd("evsx"); //f->cd("evsx");

79
sx3cal/EXFit2.C Normal file
View File

@ -0,0 +1,79 @@
{
int index = 9;
TFile *f = new TFile("../results_run05.root");
TH2F *h2=NULL;
TH1F *h1x=NULL, *h1y=NULL;
//f->cd("evsx");
//f->ls();
double known_xpos[4][2] = {{0,18.75},{-18.75,0}};
std::vector<double> xpos, xposkn; //first = x = known position, second = y = unknown position
std::ofstream ofb(Form("backgains%d.dat",index));
std::ofstream off(Form("frontgains%d.dat",index));
for(int i=0; i<4; i++) {
//do it for pad#2
int backnum=2;
h2 = (TH2F*)(f->Get(Form("evsx/be_vs_x_sx3_id_%d_f%d_b%d",index,i,backnum)));
auto macro = [&]() {
h1x = (TH1F*)(h2->ProjectionX("_px"));
double xleft = h1x->GetBinCenter(h1x->FindFirstBinAbove(h1x->GetMaximum()*0.4));
double xright = h1x->GetBinCenter(h1x->FindLastBinAbove(h1x->GetMaximum()*0.4));
//h1x->GetXaxis()->SetRangeUser(4*xleft, xright*4);
h1x->Draw();
TLine L1(xleft,0,xleft,h1x->GetMaximum()); L1.SetLineColor(kRed); L1.Draw("SAME");
TLine L2(xright,0,xright,h1x->GetMaximum()); L2.SetLineColor(kRed); L2.Draw("SAME");
gPad->Modified();
gPad->Update();
if(backnum==1 || backnum==2) xpos.push_back(xleft); xposkn.push_back(known_xpos[backnum-1][0]);
if(backnum==1 || backnum==2) xpos.push_back(xright); xposkn.push_back(known_xpos[backnum-1][1]);
while(gPad->WaitPrimitive());
h1y = (TH1F*)(h2->ProjectionY("_py"));
double ycenter = h1y->GetBinCenter(h1y->GetMaximumBin());
// std::cout << "front " << i << " back " << backnum << " " << xleft << " " << xright << " " << ycenter << " " << 5486/ycenter << std::endl;
ofb << index <<" front " << i << " back " << backnum << " " << 5486/ycenter << std::endl;
h1y->GetXaxis()->SetRangeUser(ycenter-200,ycenter+200);
h1y->Draw();
TLine L3(ycenter,0,ycenter,h1y->GetMaximum()*1.1); L3.SetLineColor(kRed); L3.Draw("SAME");
gPad->Modified();
gPad->Update();
while(gPad->WaitPrimitive());
};
if(h2)
macro();
//repeat for pad#1
backnum=1;
h2 = (TH2F*)(f->Get(Form("evsx/be_vs_x_sx3_id_%d_f%d_b%d",index,i,backnum)));
if(h2)
macro();
//repeat for pad#2
backnum=3;
h2 = (TH2F*)(f->Get(Form("evsx/be_vs_x_sx3_id_%d_f%d_b%d",index,i,backnum)));
if(h2)
macro();
//repeat for pad3
backnum=0;
h2 = (TH2F*)(f->Get(Form("evsx/be_vs_x_sx3_id_%d_f%d_b%d",index,i,backnum)));
if(h2)
macro();
double xtofit[] = {xpos[0],xpos[3]};
double xktofit[] = {xposkn[0],xposkn[3]};
TGraph G1(xpos.size(),xpos.data(),xposkn.data());
G1.Draw("APL*");
G1.Fit("pol1","Q");
off << index<<" lengthcal front " << i << " " << G1.GetFunction("pol1")->GetParameter(0) << " " << G1.GetFunction("pol1")->GetParameter(1) << std::endl;
gPad->Modified(); gPad->Update();
while(gPad->WaitPrimitive());
xpos.clear();
xposkn.clear();
}
ofb.close();
off.close();
f->Close();
}

View File

@ -1,8 +1,8 @@
{ {
TFile *f = new TFile("../results_run10.root"); TFile *f = new TFile("../results_run01.root");
f->cd("l_vs_r"); f->cd("l_vs_r");
gDirectory->ls(); gDirectory->ls();
int clkpos = 9; int clkpos = 1;
std::ofstream ofile(Form("rightgains%d.dat",clkpos)); std::ofstream ofile(Form("rightgains%d.dat",clkpos));
for(int i=0; i<4; i++) { for(int i=0; i<4; i++) {
TH2F h2(*(TH2F*)(f->Get(Form("l_vs_r/l_vs_r_sx3_id_%d_f%d",clkpos,i)))); TH2F h2(*(TH2F*)(f->Get(Form("l_vs_r/l_vs_r_sx3_id_%d_f%d",clkpos,i))));

View File

@ -1,4 +1,12 @@
1 front 0 back 2 4.1692 1 front 0 back 2 4.44599
1 front 1 back 2 4.13701 1 front 0 back 3 3.68208
1 front 2 back 2 4.26886 1 front 0 back 0 3.89631
1 front 3 back 2 4.26886 1 front 1 back 2 4.44599
1 front 1 back 3 3.81311
1 front 1 back 0 3.98321
1 front 2 back 2 4.52103
1 front 2 back 3 3.68208
1 front 2 back 0 3.95382
1 front 3 back 2 4.55951
1 front 3 back 3 3.68208
1 front 3 back 0 3.89631

View File

@ -1,6 +1,12 @@
3 front 1 back 2 3.31729 3 front 1 back 2 3.81311
3 front 1 back 1 3.33796 3 front 1 back 1 3.92485
3 front 2 back 2 3.35889 3 front 1 back 3 4.13701
3 front 2 back 1 3.49018 3 front 1 back 0 4.26886
3 front 3 back 2 3.38008 3 front 2 back 2 3.86817
3 front 3 back 1 3.35889 3 front 2 back 1 4.04334
3 front 2 back 3 3.98321
3 front 2 back 0 4.23512
3 front 3 back 2 3.92485
3 front 3 back 1 3.92485
3 front 3 back 3 3.95382
3 front 3 back 0 4.13701

View File

@ -1,8 +1,16 @@
7 front 0 back 2 3.25679 7 front 0 back 2 3.65694
7 front 0 back 1 3.08785 7 front 0 back 1 3.53625
7 front 1 back 2 3.25679 7 front 0 back 3 4.23512
7 front 1 back 1 3.14218 7 front 0 back 0 3.60769
7 front 2 back 2 3.29688 7 front 1 back 2 3.65694
7 front 2 back 1 3.16072 7 front 1 back 1 3.53625
7 front 3 back 2 3.29688 7 front 1 back 3 4.23512
7 front 3 back 1 3.12386 7 front 1 back 0 3.58356
7 front 2 back 2 3.68208
7 front 2 back 1 3.55975
7 front 2 back 3 4.13701
7 front 2 back 0 3.60769
7 front 3 back 2 3.68208
7 front 3 back 1 3.53625
7 front 3 back 3 4.23512
7 front 3 back 0 3.58356

View File

@ -1,8 +1,16 @@
9 front 0 back 2 3.25679 9 front 0 back 2 3.68208
9 front 0 back 1 3.10575 9 front 0 back 1 3.53625
9 front 1 back 2 3.27671 9 front 0 back 3 3.51306
9 front 1 back 1 3.12386 9 front 0 back 0 3.42327
9 front 2 back 2 3.29688 9 front 1 back 2 3.70756
9 front 2 back 1 3.14218 9 front 1 back 1 3.49018
9 front 3 back 2 3.29688 9 front 1 back 3 3.63215
9 front 3 back 1 3.10575 9 front 1 back 0 3.46759
9 front 2 back 2 3.70756
9 front 2 back 1 3.55975
9 front 2 back 3 3.53625
9 front 2 back 0 3.44529
9 front 3 back 2 3.7334
9 front 3 back 1 3.51306
9 front 3 back 3 3.53625
9 front 3 back 0 3.42327

View File

@ -1,4 +1,4 @@
1 lengthcal front 0 0.302419 60.4839 1 lengthcal front 0 -0.292969 58.5938
1 lengthcal front 1 0.907258 60.4839 1 lengthcal front 1 0.302419 60.4839
1 lengthcal front 2 -2.11694 60.4839 1 lengthcal front 2 -2.55682 56.8182
1 lengthcal front 3 3.32661 60.4839 1 lengthcal front 3 2.72177 60.4839

View File

@ -1,3 +1,3 @@
3 lengthcal front 1 -0.302419 60.4839 3 lengthcal front 1 0.468555 62.474
3 lengthcal front 2 -3.12146 59.4564 3 lengthcal front 2 -3.17087 60.3975
3 lengthcal front 3 5.3066 62.4306 3 lengthcal front 3 5.24289 63.5502

View File

@ -1,4 +1,4 @@
7 lengthcal front 0 0.225805 45.1611 7 lengthcal front 0 0 44.0628
7 lengthcal front 1 1.85157 46.2892 7 lengthcal front 1 1.68159 48.0453
7 lengthcal front 2 0.936622 46.8311 7 lengthcal front 2 0.80963 46.2646
7 lengthcal front 3 3.65527 45.6909 7 lengthcal front 3 3.5855 46.2646

View File

@ -1,4 +1,4 @@
9 lengthcal front 0 2.10806 46.8457 9 lengthcal front 0 2.10937 46.875
9 lengthcal front 1 0.694127 46.2751 9 lengthcal front 1 0.57866 46.2928
9 lengthcal front 2 1.04095 46.2646 9 lengthcal front 2 1.17187 46.875
9 lengthcal front 3 1.99048 46.8348 9 lengthcal front 3 1.6345 46.6999

View File

@ -1,4 +1,4 @@
1 0 1239.16 0.649287 1 0 1229.18 1.00572
1 1 1853.11 1.08968 1 1 1765.87 0.968534
1 2 1852.65 1.10279 1 2 1778.36 0.877985
1 3 1821.01 0.965101 1 3 1843.61 0.985871