13 #include "TApplication.h"
23 #include "TGraphPolar.h"
24 #include "TGraphPolargram.h"
28 #include "TApplication.h"
31 #include "TVirtualFitter.h"
32 #include "Math/MinimizerOptions.h"
33 #include "TFitResultPtr.h"
34 #include "TFitResult.h"
36 #include "TPaveLabel.h"
40 #include <RtypesCore.h>
45 void Locate(Int_t
id, Bool_t is_ASIDE, Double_t *rbin, Double_t *thbin);
50 bool skip_empty_fees =
true;
52 std::vector<pair<int,int>>
vec;
54 const TString filename3( Form(
"./pedestal-26540-outfile.root") );
56 TFile *infile3 = TFile::Open(filename3);
60 TNtuple * liveTntuple ;
61 liveTntuple = (TNtuple*) infile3->Get(
"h_Alive");
63 TNtuple * totTntuple ;
64 totTntuple = (TNtuple*) infile3->Get(
"h_AliveTot");
66 TH3F * dm2 =
new TH3F(
"dm2",
"TPC map",26, -0.5, 25.5, 24, -0.5, 23.5, 3, 0.5, 3.5 );
67 liveTntuple->Draw(
"module_id:sec_id:fee_id>>dm2",
"",
"");
69 TH3F * h_AlivePedestalNoise =
new TH3F(
"h_AlivePedestalNoise",
"TPC Alive Pedestal Noise of Std. Dev,",26, -0.5, 25.5, 24, -0.5, 23.5, 3, 0.5, 3.5 );
70 liveTntuple->Draw(
"module_id:sec_id:fee_id>>h_AlivePedestalNoise",
"pedStdi",
"");
72 TH3F * tot =
new TH3F(
"tot",
" TPC Tot Map", 26, -0.5, 25.5, 24, -0.5, 23.5, 3, 0.5, 3.5 );
73 totTntuple->Draw(
"module_id:sec_id:fee_id>>tot",
"",
"");
78 std::vector<Float_t> sub_arrA;
79 std::vector<Float_t> sub_arrC;
81 Float_t frac[dm2->GetNbinsX()][dm2->GetNbinsY()];
82 std::vector<Float_t> module_std_dev;
84 for (Int_t
i = 0;
i < dm2->GetNbinsY();
i++) {
85 for (Int_t
j = 0;
j < dm2->GetNbinsZ();
j++) {
91 for (Int_t
k = 0;
k < dm2->GetNbinsX();
k++) {
94 if( dm2->GetBinContent(
k+1,
i+1,
j+1) >= 1){
95 num+=dm2->GetBinContent(
k+1,
i+1,
j+1);
96 denom+=tot->GetBinContent(
k+1,
i+1,
j+1);
97 sum_noise+=h_AlivePedestalNoise->GetBinContent(
k+1,
i+1,
j+1);
101 num+=dm2->GetBinContent(
k+1,
i+1,
j+1);
102 denom+=tot->GetBinContent(
k+1,
i+1,
j+1);
103 sum_noise+=h_AlivePedestalNoise->GetBinContent(
k+1,
i+1,
j+1);
107 Float_t frac_val= ( num / denom) * 100.0;
108 Float_t noise_value = sum_noise/num;
110 frac[
i+1][
j+1] = frac_val;
111 std::cout <<
"Sec ID = " <<
i <<
", Module ID = " <<
j+1 <<
", Live fraction = " << frac_val <<
"%" << std::endl;
113 sub_arrC.push_back(frac_val);
115 sub_arrA.push_back(frac_val);
162 gStyle->SetOptStat(0);
164 const Int_t N_rBins = 4;
165 const Int_t N_thBins = 12;
167 Double_t rBin_edges[N_rBins + 1] = {0.0, 0.256, 0.504, 0.752, 1.00};
169 TGraphPolargram* polardummy1 =
new TGraphPolargram(
"polardummy1",0,1,0,2.*TMath::Pi());
170 polardummy1->SetToGrad();
171 polardummy1->SetNdivPolar(N_thBins);
172 polardummy1->SetLineColor(0);
173 polardummy1->SetRadialLabelSize(0);
175 TGraphPolargram* polardummy2 =
new TGraphPolargram(
"polardummy2",0,1,0,2.*TMath::Pi());
176 polardummy2->SetToGrad();
177 polardummy2->SetNdivPolar( N_thBins);
178 polardummy2->SetLineColor(0);
179 polardummy2->SetRadialLabelSize(0);
181 for(Int_t
i = 0 ;
i < 12 ;
i++){
185 sprintf(labelstr2,
"C0%d",
i);
188 sprintf(labelstr1,
"A%d",18-
i);
191 sprintf(labelstr1,
"A%d",30-
i);
196 sprintf(labelstr2,
"C%d",
i);
197 sprintf(labelstr1,
"A%d",30-
i);
199 polardummy1->SetPolarLabel(
i,labelstr1);
200 polardummy2->SetPolarLabel(
i,labelstr2);
203 TH2D* ErrASide =
new TH2D(
"ASide" ,
"ADC Counts North Side" , N_thBins, -TMath::Pi()/12. , 23.*TMath::Pi()/12. , N_rBins , rBin_edges );
205 TH2D* ErrCSide =
new TH2D(
"CSide" ,
"ADC Counts South Side" , N_thBins, -TMath::Pi()/12. , 23.*TMath::Pi()/12. , N_rBins , rBin_edges );
209 Int_t trip_count_total = 0;
210 Bool_t is_ASIDE =
true;
212 for (Int_t
i = 0;
i < 36;
i++) {
213 Locate(
i + 1,
true, &r, &theta);
214 ErrASide->Fill(theta, r, sub_arrA[
i]);
218 for (Int_t
i = 0;
i < 36;
i++) {
219 Locate(
i + 1,
false, &r, &theta);
220 ErrCSide->Fill(theta, r, sub_arrC[
i]);
225 TH2D* dummy_his1 =
new TH2D(
"dummy1",
"26540-Alive Channel Fraction North Side (%)", 100, -1.5, 1.5, 100, -1.5, 1.5);
226 TH2D* dummy_his2 =
new TH2D(
"dummy2",
"26540-Alive Channel Fraction South Side (%)", 100, -1.5, 1.5, 100, -1.5, 1.5);
228 TPaveLabel* A00 =
new TPaveLabel( 1.046586,-0.1938999,1.407997,0.2144871,
"18" );
229 TPaveLabel* A01 =
new TPaveLabel( 0.962076,0.4382608,1.323487,0.8466479 ,
"17" );
230 TPaveLabel* A02 =
new TPaveLabel( 0.4801947,0.8802139,0.8416056,1.288601 ,
"16" );
231 TPaveLabel* A03 =
new TPaveLabel( -0.1823921,1.011681,0.1790189,1.425662,
"15" );
232 TPaveLabel* A04 =
new TPaveLabel( -0.8449788,0.8690253,-0.4835679,1.288601 ,
"14" );
233 TPaveLabel* A05 =
new TPaveLabel( -1.30879,0.441058,-0.9473786,0.8550394 ,
"13" );
234 TPaveLabel* A06 =
new TPaveLabel( -1.411009,-0.2050886,-1.049598,0.2144871,
"12" );
235 TPaveLabel* A07 =
new TPaveLabel( -1.302585,-0.7757116,-0.9471979,-0.3561359 ,
"23" );
236 TPaveLabel* A08 =
new TPaveLabel( -0.8449788,-1.309971,-0.4835679,-0.8848013 ,
"22" );
237 TPaveLabel* A09 =
new TPaveLabel( -0.1823921,-1.426557,0.1790189,-1.006982 ,
"21" );
238 TPaveLabel* A10 =
new TPaveLabel( 0.4801947,-1.309076,0.8416056,-0.8839062 ,
"20" );
239 TPaveLabel* A11 =
new TPaveLabel( 0.9622567,-0.7785088,1.323668,-0.3533387 ,
"19" );
241 TPaveLabel* C00 =
new TPaveLabel( 1.046586,-0.1938999,1.407997,0.2144871,
"00" );
242 TPaveLabel* C01 =
new TPaveLabel( 0.962076,0.4382608,1.323487,0.8466479 ,
"01" );
243 TPaveLabel* C02 =
new TPaveLabel( 0.4801947,0.8802139,0.8416056,1.288601 ,
"02" );
244 TPaveLabel* C03 =
new TPaveLabel( -0.1823921,1.011681,0.1790189,1.425662,
"03" );
245 TPaveLabel* C04 =
new TPaveLabel( -0.8449788,0.8690253,-0.4835679,1.288601 ,
"04" );
246 TPaveLabel* C05 =
new TPaveLabel( -1.30879,0.441058,-0.9473786,0.8550394 ,
"05" );
247 TPaveLabel* C06 =
new TPaveLabel( -1.411009,-0.2050886,-1.049598,0.2144871,
"06" );
248 TPaveLabel* C07 =
new TPaveLabel( -1.302585,-0.7757116,-0.9471979,-0.3561359 ,
"07" );
249 TPaveLabel* C08 =
new TPaveLabel( -0.8449788,-1.309971,-0.4835679,-0.8848013 ,
"08" );
250 TPaveLabel* C09 =
new TPaveLabel( -0.1823921,-1.426557,0.1790189,-1.006982 ,
"09" );
251 TPaveLabel* C10 =
new TPaveLabel( 0.4801947,-1.309076,0.8416056,-0.8839062 ,
"10" );
252 TPaveLabel* C11 =
new TPaveLabel( 0.9622567,-0.7785088,1.323668,-0.3533387 ,
"11" );
254 A00->SetFillColor(0);
255 A01->SetFillColor(0);
256 A02->SetFillColor(0);
257 A03->SetFillColor(0);
258 A04->SetFillColor(0);
259 A05->SetFillColor(0);
260 A06->SetFillColor(0);
261 A07->SetFillColor(0);
262 A08->SetFillColor(0);
263 A09->SetFillColor(0);
264 A10->SetFillColor(0);
265 A11->SetFillColor(0);
267 C00->SetFillColor(0);
268 C01->SetFillColor(0);
269 C02->SetFillColor(0);
270 C03->SetFillColor(0);
271 C04->SetFillColor(0);
272 C05->SetFillColor(0);
273 C06->SetFillColor(0);
274 C07->SetFillColor(0);
275 C08->SetFillColor(0);
276 C09->SetFillColor(0);
277 C10->SetFillColor(0);
278 C11->SetFillColor(0);
280 gStyle->SetPalette(kBird);
282 TCanvas *
Error_Viz =
new TCanvas(
"Error_Viz",
"Error_Viz", 1248, 598);
283 Error_Viz->Divide(2,1);
285 dummy_his1->Draw(
"");
287 ErrCSide->Draw(
"colpolzsame0");
301 dummy_his2->Draw(
"");
303 ErrASide->Draw(
"colpolzsame0");
317 ErrCSide->SetMaximum(100);
318 ErrASide->SetMaximum(100);
321 ErrCSide->SetMinimum(80);
322 ErrASide->SetMinimum(80);
327 Double_t Maxval = TMath::Max(ErrASide->GetBinContent(ErrASide->GetMaximumBin()),ErrCSide->GetBinContent(ErrCSide->GetMaximumBin()));
329 TFile *outf =
new TFile(
"Trip_Histos.root",
"RECREATE");
335 void Locate(Int_t
id, Bool_t is_ASIDE, Double_t *rbin, Double_t *thbin) {
337 Double_t ASIDE_angle_bins[12] = { 0.1*2.*TMath::Pi()/12 , 1.1*2.*TMath::Pi()/12 , 2.1*2.*TMath::Pi()/12 , 3.1*2.*TMath::Pi()/12 , 4.1*2.*TMath::Pi()/12 , 5.1*2.*TMath::Pi()/12 , 6.1*2.*TMath::Pi()/12 , 7.1*2.*TMath::Pi()/12 , 8.1*2.*TMath::Pi()/12 , 9.1*2.*TMath::Pi()/12 , 10.1*2.*TMath::Pi()/12 , 11.1*2.*TMath::Pi()/12 };
339 Double_t CSIDE_angle_bins[12] = { 6.1*2.*TMath::Pi()/12 , 5.1*2.*TMath::Pi()/12 , 4.1*2.*TMath::Pi()/12 , 3.1*2.*TMath::Pi()/12 , 2.1*2.*TMath::Pi()/12 , 1.1*2.*TMath::Pi()/12 , 0.1*2.*TMath::Pi()/12 , 11.1*2.*TMath::Pi()/12 , 10.1*2.*TMath::Pi()/12 , 9.1*2.*TMath::Pi()/12 , 8.1*2.*TMath::Pi()/12 , 7.1*2.*TMath::Pi()/12 };
341 Int_t modid3 =
id % 3;
357 *thbin = CSIDE_angle_bins[TMath::FloorNint((
id-1)/3)];
360 *thbin = ASIDE_angle_bins[TMath::FloorNint((
id-1)/3)];