source: trunk/MagicSoft/Mars/macros/Pedestals_Stability.C@ 943

Last change on this file since 943 was 804, checked in by jflix, 24 years ago
Example of macro to evaluate FADC Pedestal stabilities within several pedestal runs taken.
File size: 2.9 KB
Line 
1 void Pedestals_Stability()
2{
3 char *files[11] = {"ped_stab/stab1.root",
4 "ped_stab/stab2.root",
5 "ped_stab/stab3.root",
6 "ped_stab/stab4.root",
7 "ped_stab/stab5.root",
8 "ped_stab/stab6.root",
9 "ped_stab/stab7.root",
10 "ped_stab/stab8.root",
11 "ped_stab/stab9.root",
12 "ped_stab/stab10.root",
13 "ped_stab/stab11.root"};
14
15 for (Int_t stab_f=0; stab_f<11; stab_f++){
16
17 MParList plist;
18
19 MPedestalCam pedest;
20 MTaskList tlist;
21
22 plist->AddToList(&pedest);
23 plist->AddToList(&tlist);
24
25 MReadTree read("Events", files[stab_f] );
26 MPedCalcPedRun pedcalc;
27
28 tlist.AddToList(&read);
29 tlist.AddToList(&pedcalc);
30
31 MEvtLoop evtloop;
32 evtloop.SetParList(&plist);
33
34 if (!evtloop.PreProcess())
35 return;
36
37 const UInt_t NumEnt = read.GetEntries();
38
39 Float_t pedmeantohist[8][NumEnt];
40 Float_t pedMean[8][11];
41 Float_t pedRMS[8][11];
42
43 Int_t Ecount = 0;
44
45 while (read.Process())
46 {
47
48 pedcalc.Process();
49
50 for (Int_t i=0; i<8; i++){
51 pedmeantohist[i][Ecount] = pedest[i].GetMean();
52 }
53
54 Ecount++;
55
56 }
57
58 evtloop.PostProcess();
59
60
61 // Create Histogram to get Mean & RMS per 100 pixel events
62
63 gROOT->Reset();
64
65 PixelHist = new TH1F("Pixel Hist","Pixel x - Ped hist",100,0,1000);
66
67 cout << files[stab_f] << endl;
68
69 for (Int_t pix=0; pix<8 ; pix++){
70 for (Int_t ev=0; ev<NumEnt; ev++){
71 PixelHist->Fill(pedmeantohist[pix][ev]);
72 }
73
74 pedMean[pix][stab_f] = PixelHist->GetMean();
75 pedRMS[pix][stab_f] = PixelHist->GetRMS();
76
77 // cout << "Px" << pix << " - Ped = "
78 // << PixelHist->GetMean() << " +/- " << PixelHist->GetRMS() << endl;
79
80 PixelHist->Reset();
81
82 }
83 }
84
85
86 // Plot the results
87
88 // Create the Canvas
89
90 c1 = new TCanvas("c1","Pedestals for all pixels",605,0,600,650);
91 c1->Divide(3,3);
92
93 for (Int_t pix=0; pix<8 ; pix++){
94
95 Float_t Time[11] = {0,51,117,170,229,341,409,475,533,585,643};
96 Float_t Err_Time[11];
97
98 Float_t PedestMeantoGraph[11];
99 Float_t PedestRMStoGraph[11];
100
101 char Title[40];
102
103 for (Int_t ev=0; ev<11; ev++){
104 PedestMeantoGraph[ev] = pedMean[pix][ev];
105 PedestRMStoGraph[ev] = pedRMS[pix][ev];
106 }
107 c1->cd(pix+1);
108 gr = new TGraphErrors(11,Time,PedestMeantoGraph,Err_Time,PedestRMStoGraph);
109
110 sprintf(Title,"Pedestal Stability - Pixel %d",pix+1);
111 gr->SetMarkerStyle(20);
112 gr->SetMarkerSize(0.7);
113 gr->SetTitle(Title);
114 gr->Draw("ALP");
115 gr->GetXaxis()->SetTitle("Time (min)");
116 gr->GetYaxis()->SetTitle("ADC Counts");
117 gr->Draw("ALP");
118
119 }
120 c1->Update();
121
122}
Note: See TracBrowser for help on using the repository browser.