541 lines
23 KiB
C++
541 lines
23 KiB
C++
|
#define gainmatch_cxx
|
||
|
|
||
|
#include "gainmatch.h"
|
||
|
#include <TH2.h>
|
||
|
#include <TStyle.h>
|
||
|
#include <TCanvas.h>
|
||
|
#include <TMath.h>
|
||
|
#include <TCutG.h>
|
||
|
|
||
|
|
||
|
#include <utility>
|
||
|
#include <algorithm>
|
||
|
|
||
|
#include "Armory/ClassSX3.h"
|
||
|
#include "Armory/ClassPW.h"
|
||
|
|
||
|
#include "TVector3.h"
|
||
|
|
||
|
TH2F * hsx3IndexVE;
|
||
|
TH2F * hqqqIndexVE;
|
||
|
TH2F * hqqqIndexVE_cut;
|
||
|
TH2F * hpcIndexVE;
|
||
|
|
||
|
TH2F * hsx3Coin;
|
||
|
TH2F * hqqqCoin;
|
||
|
TH2F * hpcCoin;
|
||
|
TH2F * hpcCoin_cut;
|
||
|
|
||
|
TH2F * hGoodQQQ;
|
||
|
TH2F * hGoodQQQRingVWedge;
|
||
|
|
||
|
TH2F * hqqqPolar;
|
||
|
TH2F * hsx3VpcIndex;
|
||
|
TH2F * hqqqVpcIndex;
|
||
|
TH2F * hqqqVpcIndex_cut;
|
||
|
TH2F * hqqqVpcE;
|
||
|
TH2F * hqqqVpcE_cut;
|
||
|
TH2F * hqqqVpcE_cut1;
|
||
|
TH2F * hqqqVpcE_cut2;
|
||
|
TH2F * hqqqVpcE_cutCoinc;
|
||
|
TH2F * hsx3VpcE;
|
||
|
TH2F * hanVScatsum;
|
||
|
TH2F * hanVScatsum_cut;
|
||
|
TH2F * hanVScatsum_cut1;
|
||
|
TH2F * hanVScatsum_cut2;
|
||
|
TH2F * hsx3Vsx3;
|
||
|
TH2F * hsx3uVsx3d_01;
|
||
|
TH2F * hsx3uVsx3d_23;
|
||
|
TH2F * hsx3uVsx3d_45;
|
||
|
TH2F * hsx3uVsx3d_67;
|
||
|
TH2F * hVCID;
|
||
|
TH1F *hsx3bk_9_shifted ;
|
||
|
TH1F *hsx3bk_10_shifted ;
|
||
|
TH1F *hsx3bk_11_shifted ;
|
||
|
|
||
|
int padID = 0;
|
||
|
|
||
|
TCutG *Coinc_cut_set1;
|
||
|
//TCutG *crap_cut;
|
||
|
TCutG *AnCathCoinc_cut;
|
||
|
TCutG *AnCathCoinc_cut1;
|
||
|
TCutG *AnCathCoinc_cut2;
|
||
|
|
||
|
SX3 sx3_contr;
|
||
|
PW pw_contr;
|
||
|
TVector3 hitPos;
|
||
|
bool HitNonZero;
|
||
|
bool inCut;
|
||
|
bool inCut1;
|
||
|
bool inCut2;
|
||
|
bool inCutCoinc;
|
||
|
TH1F *hZd_01_1;
|
||
|
TH1F *hZd_01_2;
|
||
|
TH1F *hZd_01_3;
|
||
|
TH1F *hZd_01_4;
|
||
|
TH1F * hZProj;
|
||
|
TH1F * hsx3bk_11;
|
||
|
TH1F * hsx3bk_10;
|
||
|
TH1F * hsx3bk_9;
|
||
|
TH1F * hsx3bk_8;
|
||
|
void gainmatch::Begin(TTree * /*tree*/){
|
||
|
TString option = GetOption();
|
||
|
|
||
|
hsx3IndexVE = new TH2F("hsx3IndexVE", "SX3 index vs Energy; sx3 index ; Energy", 24*12, 0, 24*12, 400, 0, 5000); hsx3IndexVE->SetNdivisions( -612, "x");
|
||
|
hqqqIndexVE = new TH2F("hqqqIndexVE", "QQQ index vs Energy; QQQ index ; Energy", 4*2*16, 0, 4*2*16, 400, 0, 5000); hqqqIndexVE->SetNdivisions( -1204, "x");
|
||
|
hqqqIndexVE_cut = new TH2F("hqqqIndexVE_cut", "QQQ index vs Energy gated; QQQ index ; Energy", 4*2*16, 0, 4*2*16, 400, 0, 5000); hqqqIndexVE->SetNdivisions( -1204, "x");
|
||
|
hpcIndexVE = new TH2F("hpcIndexVE", "PC index vs Energy; PC index ; Energy", 2*24, 0, 2*24, 400, 0, 4000); hpcIndexVE->SetNdivisions( -1204, "x");
|
||
|
|
||
|
hGoodQQQ = new TH2F("hGoodQQQ", "number of good QQQ vs QQQ id", 10, 0, 10, 4, 0, 4);
|
||
|
hGoodQQQRingVWedge = new TH2F("hGoodQQQRingVWedge", "Ring index, Wedge index", 16*4, 0, 16*4, 16*4, 0, 16*4);
|
||
|
hZd_01_1 =new TH1F("hZd_01_1", "Z position", 100, -1, 1);
|
||
|
hZd_01_2 =new TH1F("hZd_01_2", "Z position", 100, -1, 1);
|
||
|
hZd_01_3 =new TH1F("hZd_01_3", "Z position", 100, -1, 1);
|
||
|
hZd_01_4 =new TH1F("hZd_01_4", "Z position", 100, -1, 1);
|
||
|
hsx3Coin = new TH2F("hsx3Coin", "SX3 Coincident", 24*12, 0, 24*12, 24*12, 0, 24*12);
|
||
|
hqqqCoin = new TH2F("hqqqCoin", "QQQ Coincident", 4*2*16, 0, 4*2*16, 4*2*16, 0, 4*2*16);
|
||
|
hpcCoin = new TH2F("hpcCoin", "PC Coincident", 2*24, 0, 2*24, 2*24, 0, 2*24);
|
||
|
hpcCoin_cut = new TH2F("hpcCoin_cut", "PC Coincident gated", 2*24, 0, 2*24, 2*24, 0, 2*24);
|
||
|
|
||
|
hqqqPolar = new TH2F("hqqqPolar", "QQQ Polar ID", 16*4, -TMath::Pi(), TMath::Pi(),16, 10, 50);
|
||
|
|
||
|
hsx3VpcIndex = new TH2F("hsx3Vpcindex", "sx3 vs pc; sx3 index; pc index", 24*12, 0, 24*12, 48, 0, 48);
|
||
|
hsx3Vsx3 = new TH2F("hsx3Vsx3", "sx3 vs sx3; sx3 E; sx3 E", 8000, 0, 16000, 8000, 0, 16000);
|
||
|
hsx3uVsx3d_01 = new TH2F("hsx3uVsx3d_01", "sx3u vs sx3d; sx3u E; sx3d E", 100, 0, 1, 100, 0, 1);
|
||
|
hsx3uVsx3d_23 = new TH2F("hsx3uVsx3d_23", "sx3u vs sx3d; sx3u E; sx3d E", 100, 0, 1, 100, 0, 1);
|
||
|
hsx3uVsx3d_45 = new TH2F("hsx3uVsx3d_45", "sx3u vs sx3d; sx3u E; sx3d E", 1000, 0, 5000, 1000, 0, 5000);
|
||
|
hsx3uVsx3d_67 = new TH2F("hsx3uVsx3d_67", "sx3u vs sx3d; sx3u E; sx3d E", 1000, 0, 5000, 1000, 0, 5000);
|
||
|
hsx3VpcIndex->SetNdivisions( -612, "x");
|
||
|
hsx3VpcIndex->SetNdivisions( -12, "y");
|
||
|
|
||
|
hqqqVpcIndex = new TH2F("hqqqVpcindex", "qqq vs pc; qqq index; pc index", 4*2*16, 0, 4*2*16, 48, 0, 48);
|
||
|
hqqqVpcIndex->SetNdivisions( -612, "x");
|
||
|
hqqqVpcIndex->SetNdivisions( -12, "y");
|
||
|
|
||
|
hqqqVpcIndex_cut = new TH2F("hqqqVpcindex_cut", "qqq vs pc gated; qqq index; pc index", 4*2*16, 0, 4*2*16, 48, 0, 48);
|
||
|
hqqqVpcIndex_cut->SetNdivisions( -612, "x");
|
||
|
hqqqVpcIndex_cut->SetNdivisions( -12, "y");
|
||
|
|
||
|
hqqqVpcE = new TH2F("hqqqVpcEnergy", "qqq vs pc; qqq energy; pc energy", 8000, 0, 16000, 8000, 0, 16000);
|
||
|
hqqqVpcE->SetNdivisions( -612, "x");
|
||
|
hqqqVpcE->SetNdivisions( -12, "y");
|
||
|
|
||
|
hqqqVpcE_cut = new TH2F("hqqqVpcEnergy_cut", "qqq vs pc gated; qqq energy; pc energy", 8000, 0, 16000, 8000, 0, 16000);
|
||
|
hqqqVpcE_cut->SetNdivisions( -612, "x");
|
||
|
hqqqVpcE_cut->SetNdivisions( -12, "y");
|
||
|
|
||
|
hqqqVpcE_cut1 = new TH2F("hqqqVpcEnergy_cut1", "qqq vs pc gated; qqq energy; pc energy", 8000, 0, 16000, 8000, 0, 16000);
|
||
|
hqqqVpcE_cut1->SetNdivisions( -612, "x");
|
||
|
hqqqVpcE_cut1->SetNdivisions( -12, "y");
|
||
|
|
||
|
hqqqVpcE_cut2 = new TH2F("hqqqVpcEnergy_cut2", "qqq vs pc gated; qqq energy; pc energy", 8000, 0, 16000, 8000, 0, 16000);
|
||
|
hqqqVpcE_cut2->SetNdivisions( -612, "x");
|
||
|
hqqqVpcE_cut2->SetNdivisions( -12, "y");
|
||
|
|
||
|
hqqqVpcE_cutCoinc = new TH2F("hqqqVpcEnergy_cutCoinc", "qqq vs pc gated; qqq energy; pc energy", 8000, 0, 16000, 8000, 0, 16000);
|
||
|
hqqqVpcE_cutCoinc->SetNdivisions( -612, "x");
|
||
|
hqqqVpcE_cutCoinc->SetNdivisions( -12, "y");
|
||
|
hsx3bk_8=new TH1F("hsx3bk_8", "hsx3bk_8",1000, 0,5000);
|
||
|
hsx3bk_9=new TH1F("hsx3bk_9", "hsx3bk_9",1000, 0,5000);
|
||
|
hsx3bk_10=new TH1F("hsx3bk_10", "hsx3bk_10",1000, 0,5000);
|
||
|
hsx3bk_11=new TH1F("hsx3bk_11", "hsx3bk_11",1000, 0,5000);
|
||
|
hsx3VpcE = new TH2F("hsx3VpcEnergy", "sx3 vs pc; sx3 energy; pc energy", 400, 0, 5000, 400, 0, 5000);
|
||
|
hsx3VpcE->SetNdivisions( -612, "x");
|
||
|
hsx3VpcE->SetNdivisions( -12, "y");
|
||
|
hsx3bk_9_shifted = new TH1F("hsx3bk_9_shifted", "hsx3bk_9",1000, 0,5000);
|
||
|
hsx3bk_10_shifted = new TH1F("hsx3bk_10_shifted", "hsx3bk_9",1000, 0,5000);
|
||
|
hsx3bk_11_shifted = new TH1F("hsx3bk_11_shifted", "hsx3bk_9",1000, 0,5000);
|
||
|
hZProj = new TH1F("hZProj", "Z Projection", 200, -600, 600);
|
||
|
|
||
|
hanVScatsum = new TH2F("hanVScatsum", "Anode vs Cathode Sum; Anode E; Cathode E", 8000,0 , 16000, 8000, 0 , 16000);
|
||
|
hanVScatsum_cut = new TH2F("hanVScatsum_cut", "Anode vs Cathode Sum gated; Anode E; Cathode E", 1600,0 , 16000, 1600, 0 , 16000);
|
||
|
hanVScatsum_cut1 = new TH2F("hanVScatsum_cut1", "Anode vs Cathode Sum gated; Anode E; Cathode E", 1600,0 , 16000, 1600, 0 , 16000);
|
||
|
hanVScatsum_cut2 = new TH2F("hanVScatsum_cut2", "Anode vs Cathode Sum gated; Anode E; Cathode E", 1600,0 , 16000, 1600, 0 , 16000);
|
||
|
|
||
|
hVCID = new TH2F("hVCID", "Virtual Cathod ID vs total Cath. Energy", 200, 0, 24, 200, 0, 10000);
|
||
|
|
||
|
sx3_contr.ConstructGeo();
|
||
|
pw_contr.ConstructGeo();
|
||
|
|
||
|
TFile *f3 = new TFile("Coinc_cut_set1.root");
|
||
|
//TFile *f4 = new TFile("crap_cut.root");
|
||
|
TFile *f = new TFile("AnCathCoinc_cut.root");
|
||
|
TFile *f1 = new TFile("AnCathCoinc_cut1.root");
|
||
|
TFile *f2 = new TFile("AnCathCoinc_cut2.root");
|
||
|
|
||
|
|
||
|
Coinc_cut_set1 = (TCutG*)f3->Get("Coinc_cut_set1");
|
||
|
//crap_cut = (TCutG*)f4->Get("crap_cut");
|
||
|
AnCathCoinc_cut = (TCutG*)f->Get("AnCathCoinc_cut");
|
||
|
AnCathCoinc_cut1 = (TCutG*)f1->Get("AnCathCoinc_cut1");
|
||
|
AnCathCoinc_cut2 = (TCutG*)f2->Get("AnCathCoinc_cut2");
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
Bool_t gainmatch::Process(Long64_t entry){
|
||
|
|
||
|
// if ( entry > 100 ) return kTRUE;
|
||
|
|
||
|
hitPos.Clear();
|
||
|
HitNonZero = false;
|
||
|
inCut = false;
|
||
|
|
||
|
// if( entry > 1) return kTRUE;
|
||
|
// printf("################### ev : %llu \n", entry);
|
||
|
|
||
|
b_sx3Multi->GetEntry(entry);
|
||
|
b_sx3ID->GetEntry(entry);
|
||
|
b_sx3Ch->GetEntry(entry);
|
||
|
b_sx3E->GetEntry(entry);
|
||
|
b_sx3T->GetEntry(entry);
|
||
|
b_qqqMulti->GetEntry(entry);
|
||
|
b_qqqID->GetEntry(entry);
|
||
|
b_qqqCh->GetEntry(entry);
|
||
|
b_qqqE->GetEntry(entry);
|
||
|
b_qqqT->GetEntry(entry);
|
||
|
b_pcMulti->GetEntry(entry);
|
||
|
b_pcID->GetEntry(entry);
|
||
|
b_pcCh->GetEntry(entry);
|
||
|
b_pcE->GetEntry(entry);
|
||
|
b_pcT->GetEntry(entry);
|
||
|
|
||
|
sx3.CalIndex();
|
||
|
qqq.CalIndex();
|
||
|
pc.CalIndex();
|
||
|
|
||
|
// sx3.Print();
|
||
|
|
||
|
//########################################################### Raw data
|
||
|
// //======================= SX3
|
||
|
|
||
|
std::vector<std::pair<int, int>> ID; // first = id, 2nd = index
|
||
|
for (int i = 0; i < sx3.multi; i++) {
|
||
|
ID.push_back(std::pair<int, int>(sx3.id[i], i));
|
||
|
|
||
|
hsx3IndexVE->Fill(sx3.index[i], sx3.e[i]);
|
||
|
|
||
|
for (int j = i + 1; j < sx3.multi; j++) {
|
||
|
hsx3Coin->Fill(sx3.index[i], sx3.index[j]);
|
||
|
}
|
||
|
|
||
|
for (int j = 0; j < pc.multi; j++) {
|
||
|
hsx3VpcIndex->Fill(sx3.index[i], pc.index[j]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (ID.size() > 0) {
|
||
|
std::sort(ID.begin(), ID.end(), [](const std::pair<int, int> &a, const std::pair<int, int> &b) {
|
||
|
return a.first < b.first;
|
||
|
});
|
||
|
|
||
|
std::vector<std::pair<int, int>> sx3ID;
|
||
|
sx3ID.push_back(ID[0]);
|
||
|
bool found = false;
|
||
|
for (size_t i = 1; i < ID.size(); i++) {
|
||
|
if (ID[i].first == sx3ID.back().first) {
|
||
|
sx3ID.push_back(ID[i]);
|
||
|
if (sx3ID.size() >= 3) {
|
||
|
found = true;
|
||
|
}
|
||
|
} else {
|
||
|
if (!found) {
|
||
|
sx3ID.clear();
|
||
|
sx3ID.push_back(ID[i]);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (found) {
|
||
|
int sx3ChUp = -1, sx3ChDn = -1, sx3ChBk = -1;
|
||
|
float sx3EUp = 0.0, sx3EDn = 0.0, sx3EBk = 0.0;
|
||
|
|
||
|
for (size_t i = 0; i < sx3ID.size(); i++) {
|
||
|
int index = sx3ID[i].second;
|
||
|
|
||
|
if (sx3.ch[index] < 8) {
|
||
|
if (sx3.ch[index] % 2 == 0) {
|
||
|
sx3ChDn = sx3.ch[index];
|
||
|
sx3EDn = sx3.e[index];
|
||
|
} else {
|
||
|
sx3ChUp = sx3.ch[index];
|
||
|
sx3EUp = sx3.e[index];
|
||
|
}
|
||
|
} else {
|
||
|
sx3ChBk = sx3.ch[index];
|
||
|
sx3EBk = sx3.e[index];
|
||
|
}
|
||
|
|
||
|
int ch = sx3.ch[index];
|
||
|
float energy = sx3.e[index];
|
||
|
if (sx3ID[0].first == 9) {
|
||
|
float peak8 = 0.0;
|
||
|
float peak9 = 0.0;
|
||
|
int peak10 = 0.0;
|
||
|
float peak11 = 0.0;
|
||
|
float shift9 =0.0;
|
||
|
float shift10 =0.0;
|
||
|
float shift11 =0.0;
|
||
|
int minBin_8 = hsx3bk_8->FindBin(1);
|
||
|
int maxBin_8 = hsx3bk_8->FindBin(5000);
|
||
|
int maxRangeBinContent_8 = -1;
|
||
|
double maxBinCenter_8 = 0.0;
|
||
|
int minBin_9 = hsx3bk_9->FindBin(1);
|
||
|
int maxBin_9 = hsx3bk_9->FindBin(5000);
|
||
|
int maxRangeBinContent_9 = -1;
|
||
|
double maxBinCenter_9 = 0.0;
|
||
|
int minBin_10 = hsx3bk_10->FindBin(1);
|
||
|
int maxBin_10 = hsx3bk_10->FindBin(5000);
|
||
|
int maxRangeBinContent_10 = -1;
|
||
|
double maxBinCenter_10 = 0.0;
|
||
|
int minBin_11 = hsx3bk_11->FindBin(1);
|
||
|
int maxBin_11 = hsx3bk_11->FindBin(5000);
|
||
|
int maxRangeBinContent_11 = -1;
|
||
|
double maxBinCenter_11 = 0.0;
|
||
|
if (sx3ChBk == 8) {
|
||
|
|
||
|
hsx3bk_8->Fill(sx3EBk);
|
||
|
|
||
|
|
||
|
for (int bin = minBin_8; bin <= maxBin_8; ++bin) {
|
||
|
if (hsx3bk_8->GetBinContent(bin) > maxRangeBinContent_8) {
|
||
|
maxRangeBinContent_8 = hsx3bk_8->GetBinContent(bin);
|
||
|
maxBinCenter_8 = hsx3bk_8->GetBinCenter(bin);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//peak8 = hsx3bk_8->GetMaximumBin();
|
||
|
//peak8 = hsx3bk_8->GetMaximumBin();
|
||
|
//printf("peak8: %f\n", maxBinCenter_8);
|
||
|
}
|
||
|
//printf("peak8_mm: %f\n", maxBinCenter);
|
||
|
else if (sx3ChBk == 9) {
|
||
|
|
||
|
hsx3bk_9->Fill(sx3EBk);
|
||
|
for (int bin = minBin_9; bin <= maxBin_9; ++bin) {
|
||
|
if (hsx3bk_9->GetBinContent(bin) > maxRangeBinContent_9) {
|
||
|
maxRangeBinContent_9 = hsx3bk_9->GetBinContent(bin);
|
||
|
maxBinCenter_9 = hsx3bk_9->GetBinCenter(bin);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//peak8 = hsx3bk_8->GetMaximumBin();
|
||
|
//peak8 = hsx3bk_8->GetMaximumBin();
|
||
|
//printf("peak9: %f\n", maxBinCenter_9);
|
||
|
//hsx3bk_9_shifted->Fill(sx3EBk*0.76);
|
||
|
peak9 = 2097.5/maxBinCenter_9;
|
||
|
//printf("peak9_shift: %f\n", peak9);
|
||
|
hsx3bk_9_shifted->Fill(sx3EBk*(2097.5/maxBinCenter_9));
|
||
|
//printf("peak9 %d\n", peak9);
|
||
|
}
|
||
|
else if(sx3ChBk == 10) {
|
||
|
|
||
|
hsx3bk_10->Fill(sx3EBk);
|
||
|
for (int bin = minBin_10; bin <= maxBin_10; ++bin) {
|
||
|
if (hsx3bk_10->GetBinContent(bin) > maxRangeBinContent_10) {
|
||
|
maxRangeBinContent_10 = hsx3bk_10->GetBinContent(bin);
|
||
|
maxBinCenter_10 = hsx3bk_10->GetBinCenter(bin);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//peak8 = hsx3bk_8->GetMaximumBin();
|
||
|
//peak8 = hsx3bk_8->GetMaximumBin();
|
||
|
//printf("peak10: %f\n", maxBinCenter_10);
|
||
|
//hsx3bk_9_shifted->Fill(sx3EBk*0.76);
|
||
|
peak10= 2097.5/maxBinCenter_10;
|
||
|
//printf("peak10_shift: %f\n", 1787.5/maxBinCenter_10);
|
||
|
hsx3bk_10_shifted->Fill(sx3EBk*(2097.5/maxBinCenter_10));
|
||
|
//printf("peak9 %d\n", peak9);
|
||
|
}
|
||
|
//peak10 = hsx3bk_10->GetMaximumBin();
|
||
|
// printf("peak10 %d\n" ,peak10);
|
||
|
|
||
|
else if(sx3ChBk == 11) {
|
||
|
|
||
|
hsx3bk_11->Fill(sx3EBk);
|
||
|
for (int bin = minBin_11; bin <= maxBin_11; ++bin) {
|
||
|
if (hsx3bk_11->GetBinContent(bin) > maxRangeBinContent_11) {
|
||
|
maxRangeBinContent_11 = hsx3bk_11->GetBinContent(bin);
|
||
|
maxBinCenter_11 = hsx3bk_11->GetBinCenter(bin);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//peak8 = hsx3bk_8->GetMaximumBin();
|
||
|
//peak8 = hsx3bk_8->GetMaximumBin();
|
||
|
//printf("peak9: %f\n", maxBinCenter_11);
|
||
|
//hsx3bk_9_shifted->Fill(sx3EBk*0.76);
|
||
|
peak11 = 2097.5/maxBinCenter_11;
|
||
|
//printf("peak11_shift: %f\n", peak11);
|
||
|
hsx3bk_11_shifted->Fill(sx3EBk*(2097.5/maxBinCenter_11));
|
||
|
//printf("peak9 %d\n", peak9);
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
float sx3EBk_shifted = 0.0;
|
||
|
float sx3E_u_matched_01 = 0.0;
|
||
|
float sx3E_d_matched_01 = 0.0;
|
||
|
float sx3E_fb_matched_01 = 0.0;
|
||
|
float sx3E_fbu_matched_01 = 0.0;
|
||
|
float sx3E_fbd_matched_01 = 0.0;
|
||
|
float diff =0.0;
|
||
|
float ratio = 0.0;
|
||
|
float coeff = 0.0;
|
||
|
if (sx3ChBk == 9) {
|
||
|
sx3EBk_shifted = (sx3EBk *(2097.5/maxBinCenter_9));
|
||
|
} else if (sx3ChBk == 10) {
|
||
|
sx3EBk_shifted = (sx3EBk * (2097.5/maxBinCenter_10));
|
||
|
} else if (sx3ChBk == 11) {
|
||
|
sx3EBk_shifted = (sx3EBk * (2097.5/maxBinCenter_11)) ;
|
||
|
} else {
|
||
|
sx3EBk_shifted = sx3EBk; // Use unshifted value for sx3ChBk == 8
|
||
|
}
|
||
|
if ((sx3ChUp == 1 && sx3ChDn == 0)) {
|
||
|
sx3E_u_matched_01= (sx3EUp-0.898729)/0.836243;
|
||
|
//sx3E_u_matched_01= (0.836243*sx3EDn)+0.898729;
|
||
|
sx3E_d_matched_01= (sx3EDn-0.898729)/0.836243;
|
||
|
sx3E_fb_matched_01=(sx3EBk_shifted+9.2423)/0.924773 ;
|
||
|
sx3E_fbu_matched_01=(sx3E_u_matched_01+9.2423)/0.924773 ;
|
||
|
sx3E_fbd_matched_01=(sx3E_d_matched_01+9.2423)/0.924773 ;
|
||
|
diff = sx3E_fb_matched_01 - (sx3EUp+sx3E_fbd_matched_01);
|
||
|
ratio = sx3EUp/sx3E_fbd_matched_01;
|
||
|
coeff = ((sx3EUp+diff) - (sx3E_fbd_matched_01*ratio))/(diff*(1+ratio));
|
||
|
}
|
||
|
|
||
|
//TH2F *hsx3uVsx3d_01 = nullptr;
|
||
|
if (sx3ChBk >=8) {
|
||
|
|
||
|
//if (sx3ChBk == 9) {
|
||
|
|
||
|
|
||
|
|
||
|
if ((sx3ChUp == 1 && sx3ChDn == 0)) {
|
||
|
if (sx3ChUp != -1 && sx3ChDn != -1 && sx3ChBk !=-1) {
|
||
|
if (sx3EBk_shifted > 50 && sx3EUp > 50 && sx3EDn > 50) {
|
||
|
printf("sx3EUp: %f, sx3EDn: %f, sx3E_u_matched_01: %f,sx3E_d_matched_01: %f\n", sx3EUp, sx3EDn, sx3E_u_matched_01,sx3E_d_matched_01);
|
||
|
//printf("Filling hsx3uVsx3d_01_shifted: %f\n", sx3EBk_ud_matched_01 / sx3EBk_shifted);
|
||
|
// hsx3uVsx3d_01->Fill(sx3E_u_matched_01 / sx3EBk_shifted, sx3E_d_matched_01 / sx3EBk_shifted);
|
||
|
hsx3uVsx3d_01->Fill(sx3EUp / sx3EBk_shifted, sx3E_d_matched_01 / sx3EBk_shifted);
|
||
|
hsx3uVsx3d_23->Fill(sx3EUp / sx3EBk_shifted, sx3EDn/ sx3EBk_shifted);
|
||
|
}
|
||
|
}
|
||
|
//}
|
||
|
}
|
||
|
else if ((sx3ChUp == 3 && sx3ChDn == 2)) {
|
||
|
if (sx3ChUp != -1 && sx3ChDn != -1 && sx3ChBk !=-1) {
|
||
|
if (sx3EBk_shifted != 0 && sx3EBk_shifted > 50 && sx3EUp > 50 && sx3EDn > 50) {
|
||
|
printf("sx3EUp: %f, sx3EDn: %f, sx3EBk_shifted: %f\n", sx3EUp, sx3EDn, sx3EBk_shifted);
|
||
|
printf("Filling hsx3uVsx3d_23_shifted: %f\n", sx3EUp / sx3EBk_shifted);
|
||
|
// hsx3uVsx3d_23->Fill(sx3EUp / sx3EBk_shifted, (-0.924754*sx3EUp+0.916671) / sx3EBk_shifted);
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
/* if ((sx3ChUp == 1 && sx3ChDn == 0)) {
|
||
|
if (sx3ChUp != -1 && sx3ChDn != -1 && sx3ChBk !=-1) {
|
||
|
if (sx3EBk != 0 && sx3EBk > 50 && sx3EUp > 50 && sx3EDn > 50) {
|
||
|
printf("sx3EUp: %f, sx3EDn: %f, sx3EBk: %f\n", sx3EUp, sx3EDn, sx3EBk);
|
||
|
printf("Filling hsx3uVsx3d_01: %f\n", sx3EUp / sx3EBk);
|
||
|
hsx3uVsx3d_45->Fill(sx3EUp / sx3EBk, sx3EDn / sx3EBk);
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
else if ((sx3ChUp == 3 && sx3ChDn == 2)) {
|
||
|
if (sx3ChUp != -1 && sx3ChDn != -1 && sx3ChBk !=-1) {
|
||
|
if (sx3EBk != 0 && sx3EBk > 50 && sx3EUp > 50 && sx3EDn > 50) {
|
||
|
printf("sx3EUp: %f, sx3EDn: %f, sx3EBk: %f\n", sx3EUp, sx3EDn, sx3EBk);
|
||
|
printf("Filling hsx3uVsx3d_23: %f\n", sx3EUp / sx3EBk);
|
||
|
hsx3uVsx3d_67->Fill(sx3EUp / sx3EBk, sx3EDn / sx3EBk);
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}*/
|
||
|
if (sx3ChUp == 1 && sx3ChDn == 0){
|
||
|
//if (sx3ChUp == 1 || sx3ChDn == 0 || sx3ChUp == 3 || sx3ChDn == 2 || sx3ChUp == 5 || sx3ChDn == 4 || sx3ChUp == 7 || sx3ChDn == 6) {
|
||
|
if (sx3ChUp != -1 && sx3ChBk !=-1 && sx3ChDn !=-1) {
|
||
|
if (sx3EBk_shifted > 50 && sx3EUp > 50 && sx3EDn>50 &&sx3E_u_matched_01>50 && sx3E_u_matched_01>50) {
|
||
|
//printf("sx3EUp: %f, sx3EDn: %f, sx3E_u_matched_01: %f,sx3E_d_matched_01: %f\n", sx3EUp, sx3EDn, sx3E_u_matched_01,sx3E_d_matched_01);
|
||
|
printf("Filling hsx3uVsx3d_nn: %f, gggggg: %f \n", (sx3EUp+sx3EDn),(sx3E_u_matched_01+sx3E_d_matched_01) );
|
||
|
hsx3uVsx3d_45->Fill((sx3EUp+sx3E_d_matched_01),sx3EBk_shifted);
|
||
|
hsx3uVsx3d_67->Fill((sx3EUp+sx3E_d_matched_01),sx3E_fb_matched_01);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
/*if (sx3ChBk > 8) {
|
||
|
if ((sx3ChUp == 7 && sx3ChDn == 6) ||
|
||
|
(sx3ChUp == 5 && sx3ChDn == 4) ||
|
||
|
(sx3ChUp == 3 && sx3ChDn == 2) ||
|
||
|
(sx3ChUp == 1 && sx3ChDn == 0)) {
|
||
|
if (sx3ChUp != -1 && sx3ChDn != -1 && sx3ChBk !=-1) {
|
||
|
if (sx3EBk != 0 && sx3EBk > 50 && sx3EUp > 50 && sx3EDn > 50) {
|
||
|
hsx3uVsx3d->Fill(sx3EUp / sx3EBk, sx3EDn / sx3EBk);
|
||
|
hsx3Vsx3->Fill(sx3EUp ,sx3EDn);
|
||
|
printf("sx3EUp: %f | sx3EDn: %f | sx3EBk: %f | sx3ChUp: %d | sx3ChDn: %d | sx3ChBk: %d\n", sx3EUp, sx3EDn, sx3EBk, sx3ChUp, sx3ChDn, sx3ChBk);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}*/
|
||
|
//else {
|
||
|
//printf("sx3EUp\n");
|
||
|
//}
|
||
|
if (sx3ChUp == 1 && sx3ChDn == 0){
|
||
|
|
||
|
if (sx3ChUp != -1 && sx3ChBk !=-1 && sx3ChDn !=-1) {
|
||
|
if (sx3E_d_matched_01> sx3EUp ) {
|
||
|
//printf("hZd_01_1_dn: %f\n", sx3E_d_matched_01);
|
||
|
//printf("hZd_01_1_b: %f\n", sx3E_fb_matched_01);
|
||
|
hZd_01_1->Fill((2*(sx3E_d_matched_01+(coeff*diff))/sx3E_fb_matched_01)-1);
|
||
|
}
|
||
|
else if(sx3EUp> sx3E_d_matched_01) {
|
||
|
//printf("hZd_01_2_sx3EUp: %f\n",sx3EUp );
|
||
|
//printf("hZd_01_2_sx3EDn: %f\n",sx3E_fb_matched_01);
|
||
|
|
||
|
hZd_01_2->Fill(1-(2*(sx3EUp+(1-coeff)*diff))/sx3E_fb_matched_01);
|
||
|
}
|
||
|
else if(sx3EUp>0.0 && sx3E_d_matched_01>0.0 && sx3E_d_matched_01>=sx3EUp ) {
|
||
|
hZd_01_3->Fill((2*(sx3E_d_matched_01+ coeff*diff)/sx3E_fb_matched_01)-1);
|
||
|
}
|
||
|
else if(sx3EUp>0.0 && sx3E_d_matched_01>0.0 && sx3E_d_matched_01<sx3EUp ) {
|
||
|
hZd_01_4->Fill(1-(2*(sx3EUp+ (1-coeff)*diff)/sx3E_fb_matched_01));
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
for (int j = 0; j < pc.multi; j++) {
|
||
|
if (sx3.ch[index] > 8) {
|
||
|
hsx3VpcE->Fill(sx3.e[i], pc.e[j]);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
sx3_contr.CalSX3Pos(sx3ID[0].first, sx3ChUp, sx3ChDn, sx3ChBk, sx3EUp, sx3EDn);
|
||
|
hitPos = sx3_contr.GetHitPos();
|
||
|
HitNonZero = true;
|
||
|
// hitPos.Print();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
// //======================= PC
|
||
|
|
||
|
|
||
|
//########################################################### Track constrcution
|
||
|
|
||
|
|
||
|
//############################## DO THE KINEMATICS
|
||
|
|
||
|
}
|
||
|
return kTRUE;
|
||
|
}
|
||
|
|
||
|
void gainmatch::Terminate(){
|
||
|
|
||
|
|
||
|
}
|