-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed47c9c
commit 4a55052
Showing
67 changed files
with
18,780 additions
and
1,944 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
#include <stdio.h> | ||
#include <TMath.h> | ||
#include <TCanvas.h> | ||
#include <iostream> | ||
#include <TROOT.h> | ||
#include <TChain.h> | ||
#include <TObject.h> | ||
#include <TRandom.h> | ||
#include <TFile.h> | ||
#include <math.h> | ||
#include <TF1Convolution.h> | ||
#include <TF1.h> | ||
#include <TH1F.h> | ||
#include <TGraph.h> | ||
#include <TStopwatch.h> | ||
|
||
|
||
using namespace std; | ||
|
||
|
||
void 111() | ||
{ | ||
|
||
TFile *file = new TFile("flat_scint3_box15_gap01_x_z_1.5_1.5mm_e200.root"); | ||
|
||
TH1F* hist = (TH1F *)file->Get("fCounterSipm"); | ||
|
||
TH1F *h_file = new TH1F("h_file","h_file",200,0.,1600.); | ||
|
||
Int_t nentries = (Int_t)hist->GetEntries(); | ||
|
||
for (int i=0;i < nentries; i++) | ||
{ | ||
Double_t x = hist->GetBinContent(); | ||
x += gRandom->Gaus(0.,3.); | ||
h_file->Fill(x); | ||
} | ||
|
||
TF1Convolution *f_conv = new TF1Convolution("fCounterSipm","gaus",0.,1600.,true); | ||
f_conv->SetRange(0.,1600.); | ||
// f_conv->SetNofPointsFFT(1000); | ||
TF1 *f = new TF1("f",*f_conv, 0., 1600., f_conv->GetNpar()); | ||
f->SetParameters(1.,-0.3,0.,1.); | ||
|
||
|
||
new TCanvas("c","c",800,1000); | ||
h_ExpGauss -> Fit("f"); | ||
h_ExpGauss->Draw(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
void new_fit() { | ||
TFile *file = new TFile("flat_scint3_box15_gap01_xz2mm_e200.root"); | ||
TH1F *hist; | ||
TF1 *fitFunc1; | ||
TF1 *fitFunc2; | ||
|
||
/* printf("File open... "); | ||
if (!file) { | ||
printf("[FAIL]\n"); | ||
return 0; | ||
} else printf("[OK]\n"); | ||
*/ | ||
|
||
printf("Loading histogram... "); | ||
hist = (TH1F *)file->Get("fCounterSipm"); | ||
/* if (!hist1) { | ||
printf("[FAIL]\n"); | ||
return 0; | ||
} else printf("[OK]\n"); | ||
*/ | ||
|
||
fitFunc1 = new TF1("fitFunc1", "gaus"); | ||
hist->Fit(fitFunc1); | ||
float mean1 = fitFunc1->GetParameter(1); | ||
float sigma1 = fitFunc1->GetParameter(2); | ||
std::cout << "Mean1 : " << mean1 << std::endl; | ||
std::cout << "Sigma1 : " << sigma1 << std::endl; | ||
|
||
fitFunc2 = new TF1("fitFunc2", "gaus", mean1 - 2*sigma1, mean1 + 2*sigma1); | ||
hist->Fit(fitFunc2, "R"); | ||
float mean2 = fitFunc2->GetParameter(1); | ||
float sigma2 = fitFunc2->GetParameter(2); | ||
std::cout << "Mean2 : " << mean2 << std::endl; | ||
std::cout << "Sigma2 : " << sigma2 << std::endl; | ||
|
||
hist->Draw(); | ||
|
||
/* FILE *file = fopen("mean2.txt", "a+"); | ||
printf("File open... "); | ||
if (!file) { | ||
printf("[FAIL]\n"); | ||
return 0; | ||
} else printf("[OK]\n"); | ||
fprintf(file, "%E\n", mean2); | ||
// fclose(file); | ||
FILE *file1 = fopen("sigma2.txt", "a+"); | ||
printf("File open... "); | ||
if (!file1) { | ||
printf("[FAIL]\n"); | ||
return 0; | ||
} else printf("[OK]\n"); | ||
fprintf(file1, "%E\n", sigma2); | ||
*/ // fclose(file1); | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
# for bash | ||
|
||
# | ||
# sed 's/HoleDepth = 0.0*mm;/HoleDepth = 1.5*mm;/g' DRTileDetectorConstruction.cc > DRTileDetectorConstruction-1.cc | ||
# rm DRTileDetectorConstruction.cc | ||
# mv DRTileDetectorConstruction-1.cc DRTileDetectorConstruction.cc | ||
# cmake ~/DRTile && make && make install | ||
# | ||
|
||
# !!! | ||
|
||
sed 's/0 10 0/1.5 10 1.5/g' DRTile.in > DRTile-1.in | ||
sed 's/x_z_0_0mm/x_z_1.5_1.5mm/g' DRTile-1.in > DRTile1.in | ||
rm -rf DRTile.in DRTile-1.in | ||
mv DRTile1.in DRTile.in | ||
./DRTile -m DRTile.in | ||
|
||
# !!! | ||
|
||
#sed 's/1.5 10 1.5/4.5 10 4.5/g' DRTile.in > DRTile-1.in | ||
#sed 's/x_z_1.5_1.5mm/x_z_4.5_4.5mm/g' DRTile-1.in > DRTile1.in | ||
#rm -rf DRTile.in DRTile-1.in | ||
#mv DRTile1.in DRTile.in | ||
#./DRTile -m DRTile.in | ||
|
||
# !!! | ||
|
||
#sed 's/4.5 10 4.5/7.5 10 7.5/g' DRTile.in > DRTile-1.in | ||
#sed 's/x_z_4.5_4.5mm/x_z_7.5_7.5mm/g' DRTile-1.in > DRTile1.in | ||
#rm -rf DRTile.in DRTile-1.in | ||
#mv DRTile1.in DRTile.in | ||
#./DRTile -m DRTile.in | ||
|
||
# !!! | ||
|
||
#sed 's/7.5 10 7.5/10.5 10 10.5/g' DRTile.in > DRTile-1.in | ||
#sed 's/x_z_7.5_7.5mm/x_z_10.5_10.5mm/g' DRTile-1.in > DRTile1.in | ||
#rm -rf DRTile.in DRTile-1.in | ||
#mv DRTile1.in DRTile.in | ||
#./DRTile -m DRTile.in | ||
|
||
# !!! | ||
|
||
sed 's/1.5 10 1.5/13.5 10 13.5/g' DRTile.in > DRTile-1.in | ||
sed 's/x_z_1.5_1.5mm/x_z_13.5_13.5mm/g' DRTile-1.in > DRTile1.in | ||
rm -rf DRTile.in DRTile-1.in | ||
mv DRTile1.in DRTile.in | ||
./DRTile -m DRTile.in | ||
|
||
# !!! | ||
|
||
sed 's/13.5 10 13.5/0 10 0/g' DRTile.in > DRTile-1.in | ||
sed 's/x_z_13.5_13.5mm/x_z_0_0mm/g' DRTile-1.in > DRTile1.in | ||
rm -rf DRTile.in DRTile-1.in | ||
mv DRTile1.in DRTile.in | ||
#./DRTile -m DRTile.in | ||
|
||
# !!! | ||
|
||
#sed 's/10 10 10/12 10 12/g' DRTile.in > DRTile-1.in | ||
#sed 's/xz1010mm/xz1212mm/g' DRTile-1.in > DRTile1.in | ||
#rm -rf DRTile.in DRTile-1.in | ||
#mv DRTile1.in DRTile.in | ||
#./DRTile -m DRTile.in | ||
|
||
#sed 's/12 10 12/14 10 14/g' DRTile.in > DRTile-1.in | ||
#sed 's/xz1212mm/xz1414mm/g' DRTile-1.in > DRTile1.in | ||
#rm -rf DRTile.in DRTile-1.in | ||
#mv DRTile1.in DRTile.in | ||
#./DRTile -m DRTile.in | ||
|
||
#sed 's/13.5 10 13.5/1.5 10 1.5/g' DRTile.in > DRTile-1.in | ||
#sed 's/x_z_13.5_13.5mm/x_z_1.5_1.5mm/g' DRTile-1.in > DRTile1.in | ||
#rm -rf DRTile.in DRTile-1.in | ||
#mv DRTile1.in DRTile.in | ||
#./DRTile -m DRTile.in | ||
|
||
#sed 's/9 10 9/10 10 10/g' DRTile.in > DRTile-1.in | ||
#sed 's/xz9mm/xz10mm/g' DRTile-1.in > DRTile1.in | ||
#rm -rf DRTile.in DRTile-1.in | ||
#mv DRTile1.in DRTile.in | ||
#./DRTile -m DRTile.in | ||
|
||
#sed 's/10 10 10/11 10 11/g' DRTile.in > DRTile-1.in | ||
#sed 's/xz10mm/xz11mm/g' DRTile-1.in > DRTile1.in | ||
#rm -rf DRTile.in DRTile-1.in | ||
#mv DRTile1.in DRTile.in | ||
#./DRTile -m DRTile.in | ||
|
||
# !!! | ||
|
||
#sed 's/2 10 2/12 10 12/g' DRTile.in > DRTile-1.in | ||
#sed 's/xz2mm/xz12mm/g' DRTile-1.in > DRTile1.in | ||
#rm -rf DRTile.in DRTile-1.in | ||
#mv DRTile1.in DRTile.in | ||
#./DRTile -m DRTile.in | ||
|
||
# !!! | ||
|
||
#sed 's/12 10 12/13 10 13/g' DRTile.in > DRTile-1.in | ||
#sed 's/xz12mm/xz13mm/g' DRTile-1.in > DRTile1.in | ||
#rm -rf DRTile.in DRTile-1.in | ||
#mv DRTile1.in DRTile.in | ||
#./DRTile -m DRTile.in | ||
|
||
#sed 's/13 10 13/14 10 14/g' DRTile.in > DRTile-1.in | ||
#sed 's/xz13mm/xz14mm/g' DRTile-1.in > DRTile1.in | ||
#rm -rf DRTile.in DRTile-1.in | ||
#mv DRTile1.in DRTile.in | ||
#./DRTile -m DRTile.in | ||
|
||
#sed 's/14 10 14/15 10 15/g' DRTile.in > DRTile-1.in | ||
#sed 's/xz14mm/xz15mm/g' DRTile-1.in > DRTile1.in | ||
#rm -rf DRTile.in DRTile-1.in | ||
#mv DRTile1.in DRTile.in | ||
#./DRTile -m DRTile.in | ||
|
||
# !!! | ||
|
||
#sed 's/12 10 12/1 10 1/g' DRTile.in > DRTile-1.in | ||
#sed 's/xz12mm/xz1mm/g' DRTile-1.in > DRTile1.in | ||
#rm -rf DRTile.in DRTile-1.in | ||
#mv DRTile1.in DRTile.in | ||
|
||
# !!! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
void DRTileMPV() { | ||
TFile *file = new TFile("flat_scint3_box15_gap01_xz2mm_e200.root"); | ||
TH1D *hist; | ||
TF1 *fitFunc; | ||
|
||
|
||
printf("File open... "); | ||
if (!file) { | ||
printf("[FAIL]\n"); | ||
return 0; | ||
} else printf("[OK]\n"); | ||
|
||
printf("Loading histogram... "); | ||
hist = file->GetObject("fCounterSipm", hist); | ||
if (!hist) { | ||
printf("[FAIL]\n"); | ||
return 0; | ||
} else printf("[OK]\n"); | ||
|
||
fitFunc = new TF1("fitFunc", "landau"); | ||
hist->Fit(fitFunc, "M0"); | ||
// hist->Draw(); | ||
printf("\n\tMPV = %E\n\n", fitFunc->GetParameter(1)); | ||
|
||
printf("\n\tChisquare = %E\n\n", fitFunc->GetChisquare()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
void MPV() { | ||
const float NUM_BIN_X = 10; | ||
const float NUM_BIN_Z = 10; | ||
const float X_LOW = 0; | ||
const float X_UP = 20; | ||
const float Z_LOW = 0; | ||
const float Z_UP = 20; | ||
const char *FNAME_X = "x.txt"; | ||
const char *FNAME_Z = "z.txt"; | ||
const char *FNAME_AMP = "amp.txt"; // amp | ||
|
||
float x, z, amp; | ||
TH2F *hist; | ||
FILE *file_x = fopen(FNAME_X, "r"); | ||
FILE *file_z = fopen(FNAME_Z, "r"); | ||
FILE *file_amp = fopen(FNAME_AMP, "r"); | ||
|
||
if (!((long)file_x * (long)file_z * (long)file_amp)) return; | ||
|
||
hist = new TH2F("hist", "hist title", NUM_BIN_X, X_LOW, X_UP, NUM_BIN_Z, Z_LOW, Z_UP); | ||
while(1) { | ||
fscanf(file_x, "%f,", &x); | ||
fscanf(file_z, "%f,", &z); | ||
fscanf(file_amp, "%f,", &); | ||
if (feof(file_x) || feof(file_z) || feof(file_amp)) break; | ||
|
||
hist->Fill(x, z, amp); | ||
} | ||
|
||
hist->Draw("colz"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
void code_final() { | ||
const float maxx = 34.0; | ||
const float minx = 1.0; | ||
const float stepx = 1.5; | ||
const float NUM_BIN_X = (maxx - minx)/stepx + 1; | ||
const float NUM_BIN_Y = (maxx - minx)/stepx + 1; | ||
const float X_LOW = minx - stepx*0.5; | ||
const float X_UP = X_LOW + NUM_BIN_X*stepx; | ||
const float Y_LOW = minx - stepx*0.5; | ||
const float Y_UP = X_LOW + NUM_BIN_X*stepx; | ||
const char *FNAME_X = "x.txt"; | ||
const char *FNAME_Y = "y.txt"; | ||
const char *FNAME_AMP = "mean.txt"; // mean.txt, evcut.txt, evtot.txt, chi2.txt | ||
|
||
TCanvas *c1 = new TCanvas("c1", "c1", 600, 600); | ||
|
||
float x, y, amp; | ||
TH2F *hist; | ||
FILE *file_x = fopen(FNAME_X, "r"); | ||
FILE *file_y = fopen(FNAME_Y, "r"); | ||
FILE *file_amp = fopen(FNAME_AMP, "r"); | ||
|
||
if (!((long)file_x * (long)file_y * (long)file_amp)) return; | ||
|
||
// N events above pedestal (200.000000 ADC) | ||
// Chi2/NDF | ||
// Total number of events | ||
// MPV | ||
|
||
hist = new TH2F("MPV", "MPV", NUM_BIN_X, X_LOW, X_UP, NUM_BIN_Y, Y_LOW, Y_UP); | ||
while(1) { | ||
fscanf(file_x, "%f,", &x); | ||
fscanf(file_y, "%f,", &y); | ||
fscanf(file_amp, "%f,", &); | ||
if (feof(file_x) || feof(file_y) || feof(file_amp)) break; | ||
|
||
printf("%f %f %f\n", x, y, amp); | ||
|
||
hist->Fill(x, y, amp); | ||
} | ||
hist->GetXaxis()->SetTitle("x, mm "); | ||
hist->GetYaxis()->SetTitle("y, mm "); | ||
//hist->GetZaxis()->SetTitle("Mean of p.e."); | ||
|
||
gStyle->SetOptStat(0); | ||
|
||
hist->Draw("colz"); | ||
|
||
// c1->SaveAs("final.jpg"); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include <stdio.h> | ||
|
||
int main (void) | ||
{ | ||
FILE *file = fopen("out.txt", "r"); | ||
if (!(long)file) return 1; | ||
|
||
printf("\n"); | ||
|
||
int dd = 0; | ||
float a = 0; | ||
float b = 0; | ||
float c = 0; | ||
int d = 0; | ||
while(1) { | ||
fscanf(file, "%i %f %f %f %i,", &dd , &a , &b , &c , &d); | ||
if (feof(file)) break; | ||
printf("%f\n", a * 0.25); | ||
} | ||
return 0; | ||
} |
Oops, something went wrong.