worked on the PreAnalysis and Analyzer

This commit is contained in:
splitPoleDAQ 2024-01-29 19:10:12 -05:00
parent 9e33074b61
commit f6175ead09
3 changed files with 208 additions and 56 deletions

View File

@ -3,30 +3,47 @@
#include "Analyzer.h" #include "Analyzer.h"
#include <TH2.h> #include <TH2.h>
#include <TStyle.h> #include <TStyle.h>
#include <TCanvas.h>
#include <TMath.h>
TH2F * hsx3IDVch; TH2F * hsx3IndexVE;
// TH2F * hqqqIDVch; TH2F * hqqqIndexVE;
// TH2F * hpcIDVch; TH2F * hpcIndexVE;
TH2F * hsx3Coin;
TH2F * hqqqCoin;
TH2F * hpcCoin;
TH2F * hqqqPolar;
TH2F * hsx3VpcIndex; TH2F * hsx3VpcIndex;
// TH2F * hsx3EVIndex; int padID = 0;
void Analyzer::Begin(TTree * /*tree*/){ void Analyzer::Begin(TTree * /*tree*/){
TString option = GetOption(); TString option = GetOption();
hsx3IDVch = new TH2F("hsx3IDVch", "sx3 ID vs ch; ch ; ID", 24, 0, 24, 12, 0, 12); hsx3IndexVE = new TH2F("hsx3IndexVE", "SX3 index vs Energy; sx3 index ; Energy", 24*12, 0, 24*12, 400, 0, 500); hsx3IndexVE->SetNdivisions( -612, "x");
// hqqqIDVch = new TH2F("hqqqIDVch", "qqq ID vs ch; ch ; ID", 4, 0, 4, 32, 0, 32); hqqqIndexVE = new TH2F("hqqqIndexVE", "QQQ index vs Energy; QQQ index ; Energy", 4*2*16, 0, 4*2*16, 400, 0, 500); hqqqIndexVE->SetNdivisions( -1204, "x");
// hpcIDVch = new TH2F("hpcIDVch", "pc ID vs ch; ch ; ID", 2, 0, 2, 24, 0, 24); hpcIndexVE = new TH2F("hpcIndexVE", "PC index vs Energy; PC index ; Energy", 2*24, 0, 2*24, 400, 0, 4000); hpcIndexVE->SetNdivisions( -1204, "x");
hsx3VpcIndex = new TH2F("hsx3Vpcindex", "sx3 vs pc", 24*12, 0, 24*12, 48, 0, 48);
hsx3Coin = new TH2F("hsx3Coin", "SX3 Coincident", 24*12, 0, 24*12, 24*12, 0, 24*12);
hqqqCoin = new TH2F("hqqqCoin", "QQQ Coincident", 4*2*16, 0, 4*2*16, 4*2*16, 0, 4*2*16);
hpcCoin = new TH2F("hpcCoin", "PC Coincident", 2*24, 0, 2*24, 2*24, 0, 2*24);
hqqqPolar = new TH2F("hqqqPolar", "QQQ Polar ID", 16*4, -TMath::Pi(), TMath::Pi(),16, 10, 50);
hsx3VpcIndex = new TH2F("hsx3Vpcindex", "sx3 vs pc; sx3 index; pc index", 24*12, 0, 24*12, 48, 0, 48);
hsx3VpcIndex->SetNdivisions( -612, "x");
hsx3VpcIndex->SetNdivisions( -12, "y");
} }
Bool_t Analyzer::Process(Long64_t entry){ Bool_t Analyzer::Process(Long64_t entry){
if( entry > 1) return kTRUE; // if( entry > 1) return kTRUE;
printf("################### ev : %llu \n", entry); // printf("################### ev : %llu \n", entry);
b_sx3Multi->GetEntry(entry); b_sx3Multi->GetEntry(entry);
b_sx3ID->GetEntry(entry); b_sx3ID->GetEntry(entry);
@ -48,14 +65,66 @@ Bool_t Analyzer::Process(Long64_t entry){
qqq.CalIndex(); qqq.CalIndex();
pc.CalIndex(); pc.CalIndex();
sx3.Print(); // sx3.Print();
//########################################################### Raw data
// //======================= SX3 // //======================= SX3
// for( int i = 0; i < sx3.multi; i ++){ for( int i = 0; i < sx3.multi; i ++){
// for( int j = 0; j < pc.multi; j++){
// hsx3VpcIndex->Fill( sx3.index[i], pc.index[j] ); 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] );
}
}
// //======================= QQQ
for( int i = 0; i < qqq.multi; i ++){
hqqqIndexVE->Fill( qqq.index[i], qqq.e[i] );
for( int j = i + 1; j < qqq.multi; j++){
hqqqCoin->Fill( qqq.index[i], qqq.index[j]);
if( qqq.used[i] == true ) continue;
if( qqq.id[i] == qqq.id[j] && (16 - qqq.ch[i]) * (16 - qqq.ch[j]) < 0 ){ // must be same detector and wedge and ring
int chWedge = qqq.ch[i];
int chRing = qqq.ch[j] - 16;
if( qqq.ch[i] >= 16 ) {
chWedge = qqq.ch[j];
chRing = qqq.ch[i] - 16;
}
//printf(" ID : %d , chWedge : %d, chRing : %d \n", qqq.id[i], chWedge, chRing);
double theta = -TMath::Pi() + 2*TMath::Pi()/16/4.*(qqq.id[i]*16 + chWedge +0.5);
double rho = 10.+40./16.*(chRing+0.5);
hqqqPolar->Fill( theta, rho);
qqq.used[i] = true;
qqq.used[j] = true;
}
}
}
// //======================= PC
for( int i = 0; i < pc.multi; i ++){
hpcIndexVE->Fill( pc.index[i], pc.e[i] );
for( int j = i+1; j < pc.multi; j++){
hpcCoin->Fill( pc.index[i], pc.index[j]);
}
}
//########################################################### Track constrcution
return kTRUE; return kTRUE;
@ -63,5 +132,46 @@ Bool_t Analyzer::Process(Long64_t entry){
void Analyzer::Terminate(){ void Analyzer::Terminate(){
gStyle->SetOptStat("neiou");
TCanvas * canvas = new TCanvas("cANASEN", "ANASEN", 1000, 1000);
canvas->Divide(3,3);
//hsx3VpcIndex->Draw("colz");
//=============================================== pad-1
padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1);
hsx3IndexVE->Draw("colz");
//=============================================== pad-2
padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1);
hqqqIndexVE->Draw("colz");
//=============================================== pad-3
padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1);
hpcIndexVE->Draw("colz");
//=============================================== pad-4
padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1);
hsx3Coin->Draw("colz");
//=============================================== pad-5
padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1);
hqqqCoin->Draw("colz");
//=============================================== pad-6
padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1);
hpcCoin->Draw("colz");
//=============================================== pad-7
padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1);
canvas->cd(padID)->DrawFrame(-50, -50, 50, 50);
hqqqPolar->Draw("same colz pol");
} }

View File

@ -16,6 +16,7 @@ public:
unsigned long long t[MAXMULTI]; unsigned long long t[MAXMULTI];
unsigned short index[MAXMULTI]; // id * 12 + ch; unsigned short index[MAXMULTI]; // id * 12 + ch;
bool used[MAXMULTI];
void Clear(){ void Clear(){
multi = 0; multi = 0;
@ -25,6 +26,7 @@ public:
e[i] = 0; e[i] = 0;
t[i] = 0; t[i] = 0;
index[i] = 0; index[i] = 0;
used[i] = false;
} }
} }

View File

@ -4,39 +4,79 @@
#include <TH2.h> #include <TH2.h>
#include <TH1.h> #include <TH1.h>
#include <TStyle.h> #include <TStyle.h>
#include <TCanvas.h>
#include "mapping.h" #include "mapping.h"
TH1F *** rate; TH2F ** hRate;
TH2F ** hEnergy;
int padID = 0;
void PreAnalysis::Begin(TTree * /*tree*/){ void PreAnalysis::Begin(TTree * /*tree*/){
TString option = GetOption(); TString option = GetOption();
//Find the first and last timestamp, to get the run duration //Find the first and last timestamp, to get the run duration
rate = new TH1F ** [nBd]; hRate = new TH2F * [nBd];
hEnergy = new TH2F * [nBd];
for( int i = 0; i < nBd; i++){ for( int i = 0; i < nBd; i++){
if( board.at(i) > 1000) { if( board.at(i) > 1000) {
rate[i] = new TH1F * [64]; hRate[i] = new TH2F(Form("hRate%d", board.at(i)), Form("Digi-%d; ch; sec", board.at(i)), 64, 0, 64, 100, 0, 100);
for(int j = 0; j < 64; j ++){ hEnergy[i] = new TH2F(Form("hEnergy%d", board.at(i)), Form("Digi-%d; ch; raw E", board.at(i)), 64, 0, 64, 400, 0, 500);
rate[i][j] = new TH1F(Form("h%d_%d", board.at(i), j), Form("Digi-%d, ch-%d", board.at(i), j), 100, 0, 100);
}
}else{ }else{
rate[i] = new TH1F * [16]; hRate[i] = new TH2F(Form("hRate%d", board.at(i)), Form("Digi-%d; ch; sec", board.at(i)), 16, 0, 16, 100, 0, 100);
for(int j = 0; j < 16; j ++){ hEnergy[i] = new TH2F(Form("hEnergy%d", board.at(i)), Form("Digi-%d; ch; raw E", board.at(i)), 16, 0, 16, 400, 0, 5000);
rate[i][j] = new TH1F(Form("h%d_%d", board.at(i), j), Form("Digi-%d, ch-%d", board.at(i), j), 100, 0, 100);
}
} }
} }
printf("================================ done creating histograms.\n");
} }
Bool_t PreAnalysis::Process(Long64_t entry){ Bool_t PreAnalysis::Process(Long64_t entry){
b_multi->GetEntry(entry);
b_sn->GetEntry(entry);
b_ch->GetEntry(entry);
b_e->GetEntry(entry);
b_e_t->GetEntry(entry);
// printf("------------- multi: %lu\n", multi);
for( unsigned int i = 0; i < multi; i++){
for( int j = 0; j < nBd; j++ ){
if( sn[i] == board.at(j) ) {
hRate[j]->Fill(ch[i], e_t[i]/1e9);
hEnergy[j]->Fill(ch[i], e[i]);
break;
}
}
}
return kTRUE; return kTRUE;
} }
void PreAnalysis::Terminate(){ void PreAnalysis::Terminate(){
printf("================================ %s\n", __func__);
gStyle->SetOptStat("neiou");
TCanvas * canvas = new TCanvas("cANASEN", "Pre-Analysis, ANASEN", 4000, 800);
canvas->Divide(10,2);
for( int i = 0; i < nBd; i++){
padID++; canvas->cd(padID);
hRate[i]->Draw("colz");
}
for( int i = 0; i < nBd; i++){
padID++; canvas->cd(padID);
hEnergy[i]->Draw("colz");
}
} }