updated peachCake.C
This commit is contained in:
parent
e3aa858ff0
commit
44368a9ff1
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,3 +6,4 @@
|
||||||
legacy_code
|
legacy_code
|
||||||
nscl2pixie
|
nscl2pixie
|
||||||
nscl2pixie_haha
|
nscl2pixie_haha
|
||||||
|
*_C_ACLiC_*
|
||||||
|
|
145
peachCake.C
145
peachCake.C
|
@ -13,6 +13,9 @@
|
||||||
|
|
||||||
TH2F * hCloverID;
|
TH2F * hCloverID;
|
||||||
TH2F * hPID;
|
TH2F * hPID;
|
||||||
|
TH1F * hZ;
|
||||||
|
TH2F * hPID0; // raw
|
||||||
|
TH2F * hPID2; // z vs A/Q
|
||||||
TH2F * hImplantIons;
|
TH2F * hImplantIons;
|
||||||
TH2F * hImplantBeta; //high gain
|
TH2F * hImplantBeta; //high gain
|
||||||
|
|
||||||
|
@ -37,12 +40,31 @@ TH1F * hvetoFlag;
|
||||||
|
|
||||||
vector<vector<double>> eCorr;
|
vector<vector<double>> eCorr;
|
||||||
|
|
||||||
|
double TOFCorrection(double energy){
|
||||||
|
|
||||||
|
|
||||||
|
return (-225.8 - 0.040017 * energy
|
||||||
|
+0.0000710839 * energy*energy
|
||||||
|
-6.28402e-8 * TMath::Power(energy,3)
|
||||||
|
+2.90563e-11 * TMath::Power(energy,4)
|
||||||
|
-6.70137e-15 * TMath::Power(energy,5)
|
||||||
|
+6.08418e-19 * TMath::Power(energy,6) );
|
||||||
|
|
||||||
|
|
||||||
|
//return 34./TMath::Sqrt(energy - 93) -235.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void peachCake::Begin(TTree * /*tree*/){
|
void peachCake::Begin(TTree * /*tree*/){
|
||||||
TString option = GetOption();
|
TString option = GetOption();
|
||||||
|
|
||||||
hCloverID = new TH2F("hCloverID", "Clover; ID; energy [keV]", 52, 0, 52, 400, 0, 2000);
|
hCloverID = new TH2F("hCloverID", "Clover; ID; energy [keV]", 52, 0, 52, 400, 0, 2000);
|
||||||
hPID = new TH2F("hPID", "PID; ns; msx40", 500, -265, -220, 500, 0, 6500);
|
|
||||||
|
hPID = new TH2F("hPID", "PID; ns; msx100", 1000, -265, -220, 1000, 0, 3500);
|
||||||
|
hPID0 = new TH2F("hPID0", "PID raw; ns; msx100", 1000, -265, -220, 1000, 0, 3500);
|
||||||
|
hPID2 = new TH2F("hPID2", "PID2; A/Q; Z", 500, 2, 4.2, 500, 0, 16);
|
||||||
|
|
||||||
|
hZ = new TH1F("hZ", "Z; dE; count", 500, 0, 16);
|
||||||
|
|
||||||
hImplantIons = new TH2F("hImplantIons", "Implat low gain; x ; y", 400, 0, 1, 400, 0, 1);
|
hImplantIons = new TH2F("hImplantIons", "Implat low gain; x ; y", 400, 0, 1, 400, 0, 1);
|
||||||
hImplantBeta = new TH2F("hImplantBeta", "Implat high gain; x ; y", 400, 0, 1, 400, 0, 1);
|
hImplantBeta = new TH2F("hImplantBeta", "Implat high gain; x ; y", 400, 0, 1, 400, 0, 1);
|
||||||
|
@ -131,7 +153,8 @@ Bool_t peachCake::Process(Long64_t entry){
|
||||||
//======= Scanning the event
|
//======= Scanning the event
|
||||||
for( int i = 0; i < multi; i++){
|
for( int i = 0; i < multi; i++){
|
||||||
|
|
||||||
if( 0 <= detID[i] && detID[i] < 100 ){ // Clover
|
//----- clover
|
||||||
|
if( 0 <= detID[i] && detID[i] < 100 ){
|
||||||
if( e[i] > 0 ) {
|
if( e[i] > 0 ) {
|
||||||
int id = detID[i];
|
int id = detID[i];
|
||||||
double eCal = 0;
|
double eCal = 0;
|
||||||
|
@ -141,64 +164,70 @@ Bool_t peachCake::Process(Long64_t entry){
|
||||||
hCloverID->Fill(detID[i], eCal);
|
hCloverID->Fill(detID[i], eCal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//----- dy Beta
|
||||||
if( detID[i] == 200 ) { //dy Beta
|
if( detID[i] == 200 ) {
|
||||||
if ( multiDyBeta < 4 ){
|
if ( multiDyBeta < 4 ){
|
||||||
dyBetaTime[multiDyBeta] = e_t[i];
|
dyBetaTime[multiDyBeta] = e_t[i];
|
||||||
dyBetaEnergy[multiDyBeta] = e[i];
|
dyBetaEnergy[multiDyBeta] = e[i];
|
||||||
multiDyBeta ++;
|
multiDyBeta ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( 201 <= detID[i] && detID[i] < 250){ // Implant detector, high gain, Beta
|
if( 201 <= detID[i] && detID[i] < 250){
|
||||||
a_H[detID[i] - 200] = e[i];
|
a_H[detID[i] - 200] = e[i];
|
||||||
}
|
}
|
||||||
|
//----- dy Ions
|
||||||
if( detID[i] == 250 ) { //dy Ions
|
if( detID[i] == 250 ) {
|
||||||
if ( multiDyIons < 4 ){
|
if ( multiDyIons < 4 ){
|
||||||
dyIonsTime[multiDyIons] = e_t[i];
|
dyIonsTime[multiDyIons] = e_t[i];
|
||||||
dyIonsEnergy[multiDyIons] = e[i];
|
dyIonsEnergy[multiDyIons] = e[i];
|
||||||
multiDyIons ++;
|
multiDyIons ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( 251 <= detID[i] && detID[i] < 260){ // Implant detector, low gain, Ions
|
if( 251 <= detID[i] && detID[i] < 260){
|
||||||
a_L[detID[i] - 250] = e[i];
|
a_L[detID[i] - 250] = e[i];
|
||||||
}
|
}
|
||||||
|
//----- veto_front
|
||||||
if( detID[i] == 290 ) {
|
if( detID[i] == 290 ) {
|
||||||
veto_f = e[i];
|
veto_f = e[i];
|
||||||
veto_f_time = e_t[i];
|
veto_f_time = e_t[i];
|
||||||
if( veto_f > 0 && (vetoFlag & 1) == 0) vetoFlag += 1;
|
if( veto_f > 0 && (vetoFlag & 1) == 0) vetoFlag += 1;
|
||||||
}
|
}
|
||||||
|
//----- veto_rear
|
||||||
if( detID[i] == 291 ) {
|
if( detID[i] == 291 ) {
|
||||||
veto_r = e[i];
|
veto_r = e[i];
|
||||||
veto_r_time = e_t[i];
|
veto_r_time = e_t[i];
|
||||||
if( veto_r > 0 && (vetoFlag & 2) == 0) vetoFlag += 2;
|
if( veto_r > 0 && (vetoFlag & 2) == 0) vetoFlag += 2;
|
||||||
}
|
}
|
||||||
|
//----- image scint L
|
||||||
if( detID[i] == 300 ) { // image scint L
|
if( detID[i] == 300 ) {
|
||||||
if( e[i] > 1000 ) {
|
if( e[i] > 1000 ) {
|
||||||
startTimeL = e_t[i];
|
startTimeL = e_t[i];
|
||||||
cfdL = cfd[i]/16384.;
|
cfdL = cfd[i]/16384.;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( detID[i] == 301 ) { // image scint R
|
//----- image scint R
|
||||||
|
if( detID[i] == 301 ) {
|
||||||
startTimeR = e_t[i];
|
startTimeR = e_t[i];
|
||||||
cfdR = cfd[i]/16384.;
|
cfdR = cfd[i]/16384.;
|
||||||
}
|
}
|
||||||
if( detID[i] == 306 ) { // cross T2 analog
|
//----- cross T2 analog
|
||||||
|
if( detID[i] == 306 ) {
|
||||||
if( (vetoFlag & 4) == 0) vetoFlag += 4;
|
if( (vetoFlag & 4) == 0) vetoFlag += 4;
|
||||||
crossEnergy = e[i];
|
crossEnergy = e[i];
|
||||||
crossTime = e_t[i];
|
crossTime = e_t[i];
|
||||||
}
|
}
|
||||||
if( detID[i] == 307 ) { // cross B2 logic
|
//----- cross B2 logic
|
||||||
|
if( detID[i] == 307 ) {
|
||||||
stopTime = e_t[i];
|
stopTime = e_t[i];
|
||||||
cfd2 = cfd[i]/16384.;
|
cfd2 = cfd[i]/16384.;
|
||||||
if( (vetoFlag & 4) == 0) vetoFlag += 4;
|
if( (vetoFlag & 4) == 0) vetoFlag += 4;
|
||||||
}
|
}
|
||||||
if( detID[i] == 308 ) energy = e[i]; //MSX40
|
//----- MSX40
|
||||||
//if( detID[i] == 309 ) energy = e[i]; //MSX100
|
///if( detID[i] == 308 ) energy = e[i];
|
||||||
|
//----- MSX100
|
||||||
if( detID[i] == 310 ) { //MSX40 logic
|
if( detID[i] == 309 ) energy = e[i];
|
||||||
|
//----- MSX40 logic
|
||||||
|
if( detID[i] == 310 ) {
|
||||||
startTime40 = e_t[i];
|
startTime40 = e_t[i];
|
||||||
cfd40 = cfd[i]/16384.;
|
cfd40 = cfd[i]/16384.;
|
||||||
}
|
}
|
||||||
|
@ -209,7 +238,7 @@ Bool_t peachCake::Process(Long64_t entry){
|
||||||
double startCFD = cfdL;
|
double startCFD = cfdL;
|
||||||
|
|
||||||
TOF = TMath::QuietNaN();
|
TOF = TMath::QuietNaN();
|
||||||
if( startTime > 0 && stopTime > 0 ){
|
if( startTime > 0 && stopTime > 0 && energy > 0 ){
|
||||||
if( stopTime > startTime ){
|
if( stopTime > startTime ){
|
||||||
TOF = double(stopTime - startTime) - startCFD + cfd2;
|
TOF = double(stopTime - startTime) - startCFD + cfd2;
|
||||||
}else{
|
}else{
|
||||||
|
@ -217,8 +246,36 @@ Bool_t peachCake::Process(Long64_t entry){
|
||||||
}
|
}
|
||||||
TOF = TOF * 8; // to ns
|
TOF = TOF * 8; // to ns
|
||||||
|
|
||||||
hPID->Fill(TOF, energy);
|
/// TOF correction, A/Q = 3 to have a fixed TOF.
|
||||||
if( energy > 0 ) flag += 1;
|
hPID0->Fill(TOF, energy);
|
||||||
|
|
||||||
|
double newTOF = TOF - TOFCorrection(energy) - 234.;
|
||||||
|
|
||||||
|
hPID->Fill(newTOF, energy);
|
||||||
|
flag += 1;
|
||||||
|
|
||||||
|
///======== Z vs A/Q
|
||||||
|
double c = 299.792458; /// mm/ns
|
||||||
|
double FL = 56423 ; /// mm
|
||||||
|
double Brho = 9.04; /// T.mm
|
||||||
|
double ma = 931.5;
|
||||||
|
double beta0 = Brho * c / TMath::Sqrt( 9*ma*ma + Brho*Brho*c*c); // for AoQ = 3
|
||||||
|
double tofOffset = 504; /// ns
|
||||||
|
|
||||||
|
double beta = FL/c/(newTOF+tofOffset);
|
||||||
|
double gamma = 1./TMath::Sqrt(1.-beta*beta);
|
||||||
|
|
||||||
|
double Z = sqrt((energy + 19.63) / 15.14) * TMath::Power(beta / beta0,1.3) ;
|
||||||
|
double AoQ = c * Brho / gamma/ beta / ma;
|
||||||
|
|
||||||
|
//printf("tof : %f, beta: %f (%f), Z : %f, A/Q : %f \n", TOF + tofOffset, beta, beta0, Z, AoQ);
|
||||||
|
|
||||||
|
Z = -0.15938 + 1.01736 *Z + 0.000203316 * Z*Z;
|
||||||
|
|
||||||
|
hPID2->Fill(AoQ, Z);
|
||||||
|
|
||||||
|
hZ->Fill(Z);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================== Implant
|
//================================== Implant
|
||||||
|
@ -295,24 +352,17 @@ Bool_t peachCake::Process(Long64_t entry){
|
||||||
|
|
||||||
printf("============ flag : %d, vetoFlag : %d\n", flag, vetoFlag);
|
printf("============ flag : %d, vetoFlag : %d\n", flag, vetoFlag);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================= Rejection
|
|
||||||
if ( flag == 0 ) return kTRUE;
|
|
||||||
|
|
||||||
//============================= Progress
|
//============================= Progress
|
||||||
saveFile->cd();
|
|
||||||
newTree->Fill();
|
|
||||||
|
|
||||||
|
|
||||||
clock.Stop("timer");
|
clock.Stop("timer");
|
||||||
Double_t time = clock.GetRealTime("timer");
|
Double_t time = clock.GetRealTime("timer");
|
||||||
clock.Start("timer");
|
clock.Start("timer");
|
||||||
|
|
||||||
if ( !shown ) {
|
if ( !shown ) {
|
||||||
if (fmod(time, 10) < 1 ){
|
if (fmod(time, 10) < 1 ){
|
||||||
printf( "%12llu[%2d%%]|%3.0f min %5.2f sec | expect:%5.2f min\r",
|
printf( "%12llu[%2d%%]|%3.0f min %5.2f sec | expect:%5.2f min \n",
|
||||||
nProcessed,
|
nProcessed,
|
||||||
TMath::Nint((nProcessed+1)*100./totnumEntry),
|
TMath::Nint((nProcessed+1)*100./totnumEntry),
|
||||||
TMath::Floor(time/60.), time - TMath::Floor(time/60.)*60.,
|
TMath::Floor(time/60.), time - TMath::Floor(time/60.)*60.,
|
||||||
|
@ -324,6 +374,13 @@ Bool_t peachCake::Process(Long64_t entry){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//============================= Rejection
|
||||||
|
if ( flag == 0 ) return kTRUE;
|
||||||
|
|
||||||
|
//============================= Save Tree
|
||||||
|
saveFile->cd();
|
||||||
|
newTree->Fill();
|
||||||
|
|
||||||
return kTRUE;
|
return kTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,21 +393,31 @@ void peachCake::Terminate(){
|
||||||
saveFile->Close();
|
saveFile->Close();
|
||||||
|
|
||||||
gStyle->SetOptStat("neiou");
|
gStyle->SetOptStat("neiou");
|
||||||
TCanvas * c1 = new TCanvas("c1", "c1", 1500, 1000);
|
TCanvas * c1 = new TCanvas("c1", "c1", 1400, 1400);
|
||||||
c1->Divide(3,3);
|
c1->Divide(2,2);
|
||||||
|
|
||||||
int padID=1;
|
int padID=1;
|
||||||
|
|
||||||
c1->cd(padID);
|
c1->cd(padID); //c1->cd(padID)->SetLogz();
|
||||||
c1->cd(padID)->SetLogz();
|
hPID0->Draw("colz");
|
||||||
|
|
||||||
|
padID ++;
|
||||||
|
c1->cd(padID); //c1->cd(padID)->SetLogz();
|
||||||
hPID->Draw("colz");
|
hPID->Draw("colz");
|
||||||
|
|
||||||
padID ++;
|
padID ++;
|
||||||
c1->cd(padID);
|
c1->cd(padID); //c1->cd(padID)->SetLogz();
|
||||||
c1->cd(padID)->SetGrid();
|
hPID2->Draw("colz");
|
||||||
c1->cd(padID)->SetLogz();
|
|
||||||
hCloverID->Draw("colz"); hCloverID->SetNdivisions(-13);
|
|
||||||
|
|
||||||
|
padID ++;
|
||||||
|
c1->cd(padID); //c1->cd(padID)->SetLogz();
|
||||||
|
hZ->Draw("colz");
|
||||||
|
|
||||||
|
//padID ++;
|
||||||
|
//c1->cd(padID); c1->cd(padID)->SetGrid(); c1->cd(padID)->SetLogz();
|
||||||
|
//hCloverID->Draw("colz"); hCloverID->SetNdivisions(-13);
|
||||||
|
|
||||||
|
/*
|
||||||
padID ++;
|
padID ++;
|
||||||
c1->cd(padID); c1->cd(padID)->SetLogz(); hImplantIons->Draw("colz");
|
c1->cd(padID); c1->cd(padID)->SetLogz(); hImplantIons->Draw("colz");
|
||||||
|
|
||||||
|
@ -376,5 +443,5 @@ void peachCake::Terminate(){
|
||||||
c1->cd(padID); hFlag->Draw("");
|
c1->cd(padID); hFlag->Draw("");
|
||||||
hvetoFlag->SetLineColor(2); hvetoFlag->Draw("same");
|
hvetoFlag->SetLineColor(2); hvetoFlag->Draw("same");
|
||||||
|
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user