4 #include<TApplication.h>
10 #include<TClonesArray.h>
34 TApplication myapp(
"myapp", 0, 0);
41 cout <<
" lmd radiation dose studies based on energy deposit in sensors " << endl;
42 TCanvas* canvas =
new TCanvas(
"canvas",
"canvas", 600, 600);
47 tMC.Add(
"./Lumi_MC_0.root");
50 TClonesArray* true_tracks =
new TClonesArray(
"PndMCTrack");
51 tMC.SetBranchAddress(
"MCTrack", &true_tracks);
53 TClonesArray* true_points =
new TClonesArray(
"PndSdsMCPoint");
54 tMC.SetBranchAddress(
"LMDPoint", &true_points);
60 TH1F* hist_eloss_total =
new TH1F(
"hist_eloss_total",
"energy deposit in 50#mum x 2cm x2cm sensors", 200, 0, 60);
61 TH1F* hist_eloss =
new TH1F(
"hist_eloss",
"energy deposit scaled to 1#mum", 200, 0, 1200);
62 hist_eloss_total->SetXTitle(
"E_{dep} [keV]");
63 hist_eloss->SetXTitle(
"E_{dep} [eV]");
65 TH2* plane3_hits =
new TH2F(
"plane3_hits",
"hits on plane 3", 200, -10, 10, 200, -10, 10);
66 plane3_hits->SetXTitle(
"X [cm]");
67 plane3_hits->SetYTitle(
"Y [cm]");
68 plane3_hits->SetZTitle(
"# hits");
70 plane3_Edep->SetNameTitle(
"plane3_Edep",
"E dep on plane 3");
71 plane3_Edep->SetZTitle(
"E_{dep} [J]");
73 plane3_rate->SetNameTitle(
"plane3_rate",
"rate on plane 3");
74 plane3_rate->SetZTitle(
"rate [kHz]");
76 plane3_rad->SetNameTitle(
"plane3_rad",
"IEL dose on plane 3");
77 plane3_rad->SetZTitle(
"IEL dose [Gy/a]");
81 int nEvents_counted(0);
84 cout <<
" reading " << nEvents <<
" Events " << endl;
85 for (Int_t j = 0; j <
nEvents ; j++) {
90 int nHits = true_points->GetEntriesFast();
92 for (Int_t iHit = 0; iHit <
nHits; iHit++) {
96 hist_eloss_total->Fill(mcpoint->GetEnergyLoss()*1.e6);
97 hist_eloss->Fill(mcpoint->GetEnergyLoss()*1.e9/50.);
100 int ihalf, iplane, imodule, iside, idie, isensor;
101 lmddim.
Get_sensor_by_id(sensID, ihalf, iplane, imodule, iside, idie, isensor);
107 if (iplane == 3 && iside == 0){
108 plane3_hits->Fill(hit_pos_lmd.X(), hit_pos_lmd.Y());
109 plane3_rate->Fill(hit_pos_lmd.X(), hit_pos_lmd.Y());
110 plane3_Edep->Fill(hit_pos_lmd.X(), hit_pos_lmd.Y(), mcpoint->GetEnergyLoss()*1.e9*1.602e-19);
111 plane3_rad->Fill(hit_pos_lmd.X(), hit_pos_lmd.Y(), mcpoint->GetEnergyLoss()*1.e9*1.602e-19);
134 double sig_total = 124.63e-27;
137 double lumi_ref = 1e32;
139 double rate_total = sig_total * lumi_ref;
140 cout <<
"\n The total rate at 1.5 GeV/c and " << lumi_ref <<
" mean luminosity to normalize to is " << rate_total <<
" Hz" << endl;
142 double tsim = nEvents_counted / rate_total;
143 cout << nEvents_counted <<
" events correspond to a real time of " << tsim <<
" s " << endl;
144 plane3_rate->Scale(1./tsim*1e-3);
146 cout <<
" total rate of " << nhitstotal <<
" hits is " << nhitstotal/tsim*1e-6 <<
"MHz" << endl;
147 plane3_rad->Scale(1./tsim*60.*60.*24.*365.*0.5/(2.33e-3*(2*2*50.e-4)));
149 plane3_Edep->Draw(
"colz");
152 plane3_hits->Draw(
"colz");
153 canvas->Print(
"MC_hit_distr_1_5_plane_3_side_0.pdf");
154 canvas->Print(
"MC_hit_distr_1_5_plane_3_side_0.root");
156 canvas->Print(
"MC_IEL_distrib_1_5.pdf");
157 canvas->Print(
"MC_IEL_distrib_1_5.root");
159 plane3_rate->Draw(
"colz");
160 cout <<
" max rate is " << plane3_rate->GetBinContent(plane3_rate->GetMaximumBin()) <<
" kHz" << endl;
161 canvas->Print(
"MC_hit_rate_1_5_plane_3_side_0.pdf");
162 canvas->Print(
"MC_hit_rate_1_5_plane_3_side_0.root");
164 plane3_rad->Draw(
"colz");
165 cout <<
" max dose is " << plane3_rad->GetBinContent(plane3_rad->GetMaximumBin()) <<
" Gy" << endl;
166 canvas->Print(
"MC_IEL_dose_1_5_plane_3_side_0.pdf");
167 canvas->Print(
"MC_IEL_does_1_5_plane_3_side_0.root");
174 gROOT->SetStyle(
"Plain");
175 const Int_t NRGBs = 5;
176 const Int_t NCont = 255;
177 Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
178 Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
179 Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
180 Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
181 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
182 gStyle->SetNumberContours(NCont);
183 gStyle->SetTitleFont(10*13+2,
"xyz");
184 gStyle->SetTitleSize(0.06,
"xyz");
185 gStyle->SetTitleOffset(1,
"xy");
186 gStyle->SetTitleOffset(1.3,
"z");
187 gStyle->SetLabelFont(10*13+2,
"xyz");
188 gStyle->SetLabelSize(0.06,
"xyz");
189 gStyle->SetLabelOffset(0.009,
"xyz");
190 gStyle->SetPadBottomMargin(0.2);
191 gStyle->SetPadTopMargin(0.15);
192 gStyle->SetPadLeftMargin(0.15);
193 gStyle->SetPadRightMargin(0.20);
194 gStyle->SetOptTitle(0);
195 gStyle->SetOptStat(0);
197 gStyle->SetFrameFillColor(0);
198 gStyle->SetFrameFillStyle(0);
199 TGaxis::SetMaxDigits(3);
204 if ((
int) (
last_percent * 100) == (
int) (percent * 100))
210 for (
int i = 0;
i < len; ++
i) {
211 if (
i < static_cast<int> (len * percent)) {
217 cout <<
"[" << progress <<
"] " << (
static_cast<int> (100 * percent))
int main(int argc, char **argv)
TH2Poly * Get_histogram_Plane(int iplane, int iside, bool aligned=true, bool lmd_frame=true, bool pixel_subdivision=false)
TVector3 hit_pos(hit->GetX(), hit->GetY(), hit->GetZ())
TVector3 Transform_global_to_lmd_local(const TVector3 &point, bool isvector=false, bool aligned=true)
void DrawProgressBar(int len, double percent)
Int_t GetSensorID() const
void Get_sensor_by_id(const int sensor_id, int &ihalf, int &iplane, int &imodule, int &iside, int &idie, int &isensor)
TVector3 GetPosition() const
static PndLmdDim & Get_instance()