-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
5 changed files
with
420 additions
and
0 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,57 @@ | ||
SRC = ./src | ||
LIB = ./lib | ||
BIN = ./bin | ||
DATA = ./data | ||
INC = $(addprefix -I,$(SRC)) | ||
|
||
vpath %.c $(SRC) | ||
|
||
CC = g++ | ||
CCFLAGS = -c -Wno-deprecated -g #-std=c++11 -Wall | ||
|
||
LD = g++ | ||
#LDFLAGS = -lGui -lTreePlayer -Wall -std=c++11 -fopenmp | ||
LDFLAGS = -lGui -lTreePlayer -Wall#-w # -Wall -w toglie i warning | ||
# YOU SHOULD ACTIVE -Wall every time !!!! | ||
|
||
ROOTINCS = $(shell root-config --cflags) # will be used as it is | ||
ROOTLIBS = $(shell root-config --glibs) -lMinuit # will be used as it is | ||
LIBS = $(LIB) # will get an -L for each entry | ||
|
||
EXEC = Simulate | ||
COMPONENTS = main TigerElectronics | ||
BIN_EXEC = $(addprefix $(BIN)/,$(EXEC) ) | ||
|
||
default: all | ||
|
||
# compile sources | ||
$(LIB)/%.o: $(SRC)/%.c | ||
@echo . | ||
@echo ... compiling source: $< to $@ | ||
$(CC) $(CCFLAGS) $< $(ROOTINCS) $(INC) -o $@ | ||
|
||
$(BIN_EXEC): | ||
$(LD) $^ $(ROOTLIBS) $(addprefix -L, $(LIBS)) -o $@ | ||
$(BIN)/$(EXEC): $(addprefix $(LIB)/, $(addsuffix .o, $(COMPONENTS) ) ) | ||
|
||
.PHONY : clean | ||
clean: | ||
@echo ... cleaning | ||
rm -f $(LIB)/*.o | ||
#m -f $(BIN)/* | ||
|
||
$(LIB): | ||
mkdir -p $(LIB) | ||
$(BIN): | ||
mkdir -p $(BIN) | ||
$(LOG): | ||
mkdir -p $(LOG) | ||
$(DATA): | ||
mkdir -p $(DATA) | ||
mkdir -p $(DATA)/images | ||
installdirs: $(LIB) $(BIN) $(DATA) #$(LOG) | ||
#yo: installdirs $(BIN_EXEC1) | ||
#tum: installdirs $(BIN_EXEC2) | ||
fush: installdirs $(BIN_EXEC) | ||
#all: yo tum fush | ||
all: fush |
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,42 @@ | ||
#ifndef Common_h | ||
#define Common_h | ||
#include "TSystem.h" | ||
#include <fstream> | ||
#include <iostream> | ||
#include <cmath> | ||
#include <vector> | ||
#include <numeric> | ||
#include "TFile.h" | ||
#include "TTree.h" | ||
#include "TRandom3.h" | ||
#include "TCanvas.h" | ||
#include "TH1F.h" | ||
#include "TH1D.h" | ||
#include "TGraph.h" | ||
#include "TLine.h" | ||
#include "TPaveText.h" | ||
#include "TF1.h" | ||
#include "TMath.h" | ||
#include "TROOT.h" | ||
using namespace std; | ||
// XYZ are refered to the detector frame where the anode is on the XY plane and the electrinc drift field is along the Z direction | ||
namespace TIGER { | ||
|
||
//Simulation | ||
const bool ToT = false; | ||
const bool SH = true; | ||
const bool NO_Noise = false; | ||
const bool NO_Saturation = false; | ||
//Readout - Induction TIGER | ||
#define n_ns 1625//1500//875//675 //500 | ||
const double jitter_TIGER = 0; | ||
const double timestep_TIGER = 6.25; //ns | ||
const double noise_TIGER = 10; //mV | ||
const double thrT_TIGER = 10; //mV | ||
const double thrE_TIGER = 20; //mV | ||
const double gain_TIGER = 12.7; //mV/fC | ||
const int integration_time_TIGER = 8; | ||
const double saturation_TIGER = 800; | ||
const bool enable_tfine_tiger = true; | ||
} | ||
#endif |
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,168 @@ | ||
#ifndef ElectronicChannel_h | ||
#define ElectronicChannel_h | ||
#include "Common.h" | ||
using namespace std; | ||
|
||
namespace TIGER{ | ||
class ElectronicChannel{ | ||
public: | ||
//Constructor | ||
//ElectronicChannel():above_thr(false){ | ||
// h_time_raw = new TH1D(); | ||
// h_time_apv = new TH1D();// | ||
// h_time_tiger_T = new TH1D(); | ||
// h_time_tiger_E = new TH1D(); | ||
// h_time_cap = new TH1D();// | ||
// h_time_int = new TH1D();//? | ||
// h_time_res = new TH1D();// | ||
// h_time_tot = new TH1D(); | ||
// h_time_cur = new TH1D();// | ||
//}; | ||
ElectronicChannel(): | ||
above_thr(false){ | ||
h_time_raw = new TH1D(" raw","Current raw",n_ns, 0, n_ns); //raw signal induced by electrons | ||
h_time_tiger_T = new TH1D("tig_T","Voltage[mV] tig_T",n_ns, 0, n_ns); //tiger Tbranch signal | ||
h_time_tiger_E = new TH1D("tig_E","Voltage[mV] tig_E",n_ns, 0, n_ns); //tiger Ebranch signal | ||
//h_time_int = new TH1D(" int","Charge[fC] int",n_ns, 0, n_ns); //integrator circuit | ||
h_time_tot = new TH1D(" tot","Charge[fC] tot",n_ns, 0, n_ns); //integrated charge over time | ||
h_time_cur = new TH1D(" cur","Current cur",n_ns, 0, n_ns); //current after the resistive | ||
|
||
h_time_raw->GetXaxis()->SetTitle("Time [ns]"); | ||
h_time_tiger_T->GetXaxis()->SetTitle("Time [ns]"); | ||
h_time_tiger_E->GetXaxis()->SetTitle("Time [ns]"); | ||
//h_time_int->GetXaxis()->SetTitle("Time [ns]"); | ||
h_time_tot->GetXaxis()->SetTitle("Time [ns]"); | ||
h_time_cur->GetXaxis()->SetTitle("Time [ns]"); | ||
|
||
h_time_raw->GetYaxis()->SetTitle("Current [1 fC / 1 ns]"); | ||
h_time_tiger_T->GetYaxis()->SetTitle("Voltage [1 mV / 1 ns]"); | ||
h_time_tiger_E->GetYaxis()->SetTitle(""); | ||
//h_time_int->GetYaxis()->SetTitle("Charge [fC]"); | ||
h_time_tot->GetYaxis()->SetTitle("Charge [fC]"); | ||
h_time_cur->GetYaxis()->SetTitle("Current [1 fC / 1 ns]"); | ||
|
||
}; | ||
//Destructor | ||
~ElectronicChannel() { | ||
h_time_raw->~TH1D(); | ||
h_time_tiger_T->~TH1D(); | ||
h_time_tiger_E->~TH1D(); | ||
//h_time_int->~TH1D(); | ||
h_time_tot->~TH1D(); | ||
h_time_cur->~TH1D(); | ||
/* | ||
delete h_time_raw; | ||
delete h_time_apv; | ||
delete h_time_tiger_T; | ||
delete h_time_tiger_E; | ||
delete h_time_cap; | ||
delete h_time_int; | ||
delete h_time_res; | ||
delete h_time_tot; | ||
delete h_time_cur; | ||
*/ | ||
}; | ||
//Function | ||
int Get_ChannelID () {return channelID;}; | ||
double Get_Charge () {return charge;}; | ||
double Get_Time () {return time;}; | ||
double Get_dTime () {return dtime;}; | ||
double Get_t_thr_E () {return t_thr_E;}; | ||
double Get_t_Q_E () {return t_Q_E;}; | ||
TH1D* Get_Histo_raw () {return h_time_raw;}; | ||
TH1D* Get_Histo_tiger_E () {return h_time_tiger_E;}; | ||
TH1D* Get_Histo_tiger_T () {return h_time_tiger_T;}; | ||
//TH1D* Get_Histo_int () {return h_time_int;}; | ||
TH1D* Get_Histo_tot () {return h_time_tot;}; | ||
TH1D* Get_Histo_cur () {return h_time_cur;}; | ||
bool Get_AboveThr () {return above_thr;}; | ||
|
||
void Set_Charge (double io) {charge=io;}; | ||
void Set_Time (double io) {time=io;}; | ||
void Set_dTime (double io) {dtime=io;}; | ||
void Set_t_thr_E (double io) {t_thr_E=io;}; | ||
void Set_t_Q_E (double io) {t_Q_E=io;}; | ||
void Set_AboveThr (bool io) {above_thr=io;}; | ||
|
||
void Reset () { Reset_Time(); Set_Charge(0); Set_Time(0); Set_dTime(0); }; | ||
void Reset_Time () { | ||
h_time_raw->Reset(); | ||
//h_time_int->Reset(); | ||
h_time_cur->Reset(); | ||
h_time_tiger_E->Reset(); | ||
h_time_tiger_T->Reset(); | ||
}; | ||
void Fill_Time(double io, int charge) { h_time_raw->Fill(io, -charge); }; // charge in fC | ||
|
||
void Print_Time_TIGER (int ch_id) { | ||
TCanvas *c = new TCanvas("ccc","ccc",600,600); | ||
c->Divide(2,3); | ||
c->cd(1); h_time_raw->Draw(); | ||
c->cd(2); h_time_tot->Draw(); | ||
c->cd(3); h_time_cur->Draw(); | ||
//c->cd(8); h_time_int->Draw(); | ||
c->cd(5); | ||
h_time_tiger_T->Draw(); | ||
float V_thr_T = thrT_TIGER; | ||
float t_thr_T = Get_Time(); | ||
TLine *l_t_thr_T = new TLine(t_thr_T,h_time_tiger_T->GetMinimum()-10,t_thr_T,V_thr_T); | ||
TLine *l_V_thr_T = new TLine(0,V_thr_T,t_thr_T,V_thr_T); | ||
l_V_thr_T->SetLineColor(kRed); | ||
l_t_thr_T->SetLineColor(kRed); | ||
l_V_thr_T->Draw("same"); | ||
l_t_thr_T->Draw("same"); | ||
c->cd(6); | ||
h_time_tiger_E->Draw(); | ||
float V_thr_E = thrE_TIGER; | ||
float t_thr_E = Get_Time(); | ||
float V_Q = Get_Charge()*gain_TIGER; | ||
TLine *l_t_thr_E = new TLine(Get_t_thr_E(),Get_Histo_tiger_E()->GetMinimum()-10,Get_t_thr_E(),V_thr_E); | ||
TLine *l_V_thr_E = new TLine(0,V_thr_E,Get_t_thr_E(),V_thr_E); | ||
TLine *l_t_Q = new TLine(Get_t_Q_E(),Get_Histo_tiger_E()->GetMinimum()-10,Get_t_Q_E(),V_Q); | ||
TLine *l_V_Q = new TLine(0,V_Q,Get_t_Q_E(),V_Q); | ||
l_V_thr_E->SetLineColor(kRed); | ||
l_t_thr_E->SetLineColor(kRed); | ||
l_t_Q->SetLineColor(kRed); | ||
l_V_Q->SetLineColor(kRed); | ||
l_V_thr_E->Draw("same"); | ||
l_t_thr_E->Draw("same"); | ||
l_t_Q->Draw("same"); | ||
l_V_Q->Draw("same"); | ||
c->cd(4); | ||
TPaveText *text_tiger = new TPaveText(0.2,0.2,0.8,0.8); | ||
text_tiger->AddText(Form("Tiger T thr = %.0f mV",thrT_TIGER)); | ||
text_tiger->AddText(Form("Tiger E thr = %.0f mV",thrE_TIGER)); | ||
text_tiger->AddText(Form("Time measured = %.2f ns",Get_Time())); | ||
text_tiger->AddText(Form("Charge measured = %.2f fC",Get_Charge())); | ||
text_tiger->AddText(Form("Voltage at Qmeas = %.2f mV",Get_Charge()*gain_TIGER)); | ||
text_tiger->AddText(Form("Time at Qmeas = %.2f ns",Get_t_Q_E())); | ||
text_tiger->AddText(Form("Time at thr_E = %.2f ns",Get_t_thr_E())); | ||
text_tiger->AddText(Form("Max charge collected = %.2f fC",Get_Histo_tot()->GetMaximum())); | ||
text_tiger->Draw(); | ||
c->SaveAs(Form("data/Channel_histos_%i.pdf", ch_id)); | ||
|
||
delete c; | ||
}; | ||
|
||
//Variables | ||
TH1D* h_time_raw; | ||
TH1D* h_time_tiger_E; | ||
TH1D* h_time_tiger_T; | ||
//TH1D* h_time_int; | ||
TH1D* h_time_tot; | ||
TH1D* h_time_cur; | ||
//constant | ||
const int nbin = 1000; | ||
private: | ||
//Variable | ||
bool PrintNTuple; | ||
int channelID; | ||
double charge; //fC | ||
double time; //ns | ||
double dtime; //ns | ||
bool above_thr; | ||
double t_thr_E; | ||
double t_Q_E; | ||
}; | ||
} | ||
#endif |
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,64 @@ | ||
#ifndef TigerElectronics_h | ||
#define TigerElectronics_h | ||
#include "Common.h" | ||
#include "ElectronicChannel.h" | ||
using namespace std; | ||
namespace TIGER { | ||
class Readout { | ||
public: | ||
//Constructor | ||
Readout(); //int setup, int electronics, Geometry* geometry | ||
//Destructor | ||
~Readout(); | ||
//Function | ||
bool Get_PrintPng() { return PrintPng; }; | ||
bool Get_PrintPDF() { return PrintPDF; }; | ||
void Simulate_TIGER(); //vector<double> | ||
void Induce_on_channel(vector<double> wf); | ||
void Integrate_Charge(); | ||
void Set_ChannelID(int io) { channel_id = io; }; | ||
void Set_PrintPng(bool io) { PrintPng = io; }; | ||
void Set_PrintPDF(bool io) { PrintPDF = io; }; | ||
ElectronicChannel* Get_Channel() { return channel; }; | ||
vector<double> GetDigitalOutput() { return output; }; | ||
|
||
private: | ||
//Variable | ||
//bool PrintInfo; | ||
bool PrintPDF; | ||
bool PrintPng; | ||
int channel_id; | ||
ElectronicChannel* channel; | ||
vector<double> output; | ||
|
||
//Function | ||
//int Get_ChannelID(int type); | ||
void Initialize_TIGER(); | ||
void Integration_TIGER(); | ||
void Extract_Charge_Time(); | ||
double Get_Charge_TIGER(ElectronicChannel* ch); | ||
double Get_Time_TIGER(ElectronicChannel* ch); | ||
double Get_dTime_TIGER(ElectronicChannel* ch); | ||
|
||
TF1* f[n_ns]; | ||
//APV | ||
double time, dtime; | ||
void Set_Time(double io) { time = io; }; | ||
double Get_Time() { return time; }; | ||
void Set_dTime(double io) { dtime = io; }; | ||
double Get_dTime() { return dtime; }; | ||
//Tiger | ||
double T_branch(double t) { | ||
t = t - 10.; | ||
if (t > 0) return 2000 * (0.00181928 * exp(-t / 3.) - 0.0147059 * exp(-t / 20.) + 0.0128866 * exp(-t / 100.)); | ||
return 0; | ||
}; | ||
double E_branch(double t) { | ||
t = t - 5; | ||
if (t > 0) return 0.000627357 * (1358.7 * exp(-t * 0.0385647) * t + 1358.7 * exp(-t * 0.0114353) * t + 100164. * exp(-t * 0.0385647) - 100164. * exp(-0.0114353 * t)); | ||
return 0; | ||
}; | ||
|
||
}; | ||
} | ||
#endif |
Oops, something went wrong.