| 1 | /* ======================================================================== *\ | 
|---|
| 2 | ! | 
|---|
| 3 | ! * | 
|---|
| 4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction | 
|---|
| 5 | ! * Software. It is distributed to you in the hope that it can be a useful | 
|---|
| 6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. | 
|---|
| 7 | ! * It is distributed WITHOUT ANY WARRANTY. | 
|---|
| 8 | ! * | 
|---|
| 9 | ! * Permission to use, copy, modify and distribute this software and its | 
|---|
| 10 | ! * documentation for any purpose is hereby granted without fee, | 
|---|
| 11 | ! * provided that the above copyright notice appear in all copies and | 
|---|
| 12 | ! * that both that copyright notice and this permission notice appear | 
|---|
| 13 | ! * in supporting documentation. It is provided "as is" without express | 
|---|
| 14 | ! * or implied warranty. | 
|---|
| 15 | ! * | 
|---|
| 16 | ! | 
|---|
| 17 | ! | 
|---|
| 18 | !   Author(s): ??? | 
|---|
| 19 | ! | 
|---|
| 20 | !   Copyright: MAGIC Software Development, 2000-2001 | 
|---|
| 21 | ! | 
|---|
| 22 | ! | 
|---|
| 23 | \* ======================================================================== */ | 
|---|
| 24 |  | 
|---|
| 25 |  | 
|---|
| 26 | void Pedestals_Stability() | 
|---|
| 27 | { | 
|---|
| 28 | char *files[11] = {"ped_stab/stab1.root", | 
|---|
| 29 | "ped_stab/stab2.root", | 
|---|
| 30 | "ped_stab/stab3.root", | 
|---|
| 31 | "ped_stab/stab4.root", | 
|---|
| 32 | "ped_stab/stab5.root", | 
|---|
| 33 | "ped_stab/stab6.root", | 
|---|
| 34 | "ped_stab/stab7.root", | 
|---|
| 35 | "ped_stab/stab8.root", | 
|---|
| 36 | "ped_stab/stab9.root", | 
|---|
| 37 | "ped_stab/stab10.root", | 
|---|
| 38 | "ped_stab/stab11.root"}; | 
|---|
| 39 |  | 
|---|
| 40 | for (Int_t stab_f=0; stab_f<11; stab_f++){ | 
|---|
| 41 |  | 
|---|
| 42 | MParList plist; | 
|---|
| 43 |  | 
|---|
| 44 | MPedestalCam  pedest; | 
|---|
| 45 | MTaskList     tlist; | 
|---|
| 46 |  | 
|---|
| 47 | plist->AddToList(&pedest); | 
|---|
| 48 | plist->AddToList(&tlist); | 
|---|
| 49 |  | 
|---|
| 50 | MReadTree read("Events", files[stab_f] ); | 
|---|
| 51 | MPedCalcPedRun pedcalc; | 
|---|
| 52 |  | 
|---|
| 53 | tlist.AddToList(&read); | 
|---|
| 54 | tlist.AddToList(&pedcalc); | 
|---|
| 55 |  | 
|---|
| 56 | MEvtLoop evtloop; | 
|---|
| 57 | evtloop.SetParList(&plist); | 
|---|
| 58 |  | 
|---|
| 59 | if (!evtloop.PreProcess()) | 
|---|
| 60 | return; | 
|---|
| 61 |  | 
|---|
| 62 | const UInt_t NumEnt = read.GetEntries(); | 
|---|
| 63 |  | 
|---|
| 64 | Float_t pedmeantohist[8][NumEnt]; | 
|---|
| 65 | Float_t pedMean[8][11]; | 
|---|
| 66 | Float_t pedRMS[8][11]; | 
|---|
| 67 |  | 
|---|
| 68 | Int_t Ecount = 0; | 
|---|
| 69 |  | 
|---|
| 70 | while (read.Process()) | 
|---|
| 71 | { | 
|---|
| 72 |  | 
|---|
| 73 | pedcalc.Process(); | 
|---|
| 74 |  | 
|---|
| 75 | for (Int_t i=0; i<8; i++){ | 
|---|
| 76 | pedmeantohist[i][Ecount] = pedest[i].GetMean(); | 
|---|
| 77 | } | 
|---|
| 78 |  | 
|---|
| 79 | Ecount++; | 
|---|
| 80 |  | 
|---|
| 81 | } | 
|---|
| 82 |  | 
|---|
| 83 | evtloop.PostProcess(); | 
|---|
| 84 |  | 
|---|
| 85 |  | 
|---|
| 86 | // Create Histogram to get Mean & RMS per 100 pixel events | 
|---|
| 87 |  | 
|---|
| 88 | gROOT->Reset(); | 
|---|
| 89 |  | 
|---|
| 90 | PixelHist = new TH1F("Pixel Hist","Pixel x - Ped hist",100,0,1000); | 
|---|
| 91 |  | 
|---|
| 92 | cout << files[stab_f] << endl; | 
|---|
| 93 |  | 
|---|
| 94 | for (Int_t pix=0; pix<8 ; pix++){ | 
|---|
| 95 | for (Int_t ev=0; ev<NumEnt; ev++){ | 
|---|
| 96 | PixelHist->Fill(pedmeantohist[pix][ev]); | 
|---|
| 97 | } | 
|---|
| 98 |  | 
|---|
| 99 | pedMean[pix][stab_f] = PixelHist->GetMean(); | 
|---|
| 100 | pedRMS[pix][stab_f] = PixelHist->GetRMS(); | 
|---|
| 101 |  | 
|---|
| 102 | //        cout << "Px" << pix << " - Ped = " | 
|---|
| 103 | //          << PixelHist->GetMean() << " +/- " << PixelHist->GetRMS() << endl; | 
|---|
| 104 |  | 
|---|
| 105 | PixelHist->Reset(); | 
|---|
| 106 |  | 
|---|
| 107 | } | 
|---|
| 108 | } | 
|---|
| 109 |  | 
|---|
| 110 |  | 
|---|
| 111 | // Plot the results | 
|---|
| 112 |  | 
|---|
| 113 | // Create the Canvas | 
|---|
| 114 |  | 
|---|
| 115 | c1 = new TCanvas("c1","Pedestals for all pixels",605,0,600,650); | 
|---|
| 116 | c1->Divide(3,3); | 
|---|
| 117 |  | 
|---|
| 118 | for (Int_t pix=0; pix<8 ; pix++){ | 
|---|
| 119 |  | 
|---|
| 120 | Float_t Time[11] = {0,51,117,170,229,341,409,475,533,585,643}; | 
|---|
| 121 | Float_t Err_Time[11]; | 
|---|
| 122 |  | 
|---|
| 123 | Float_t PedestMeantoGraph[11]; | 
|---|
| 124 | Float_t PedestRMStoGraph[11]; | 
|---|
| 125 |  | 
|---|
| 126 | char Title[40]; | 
|---|
| 127 |  | 
|---|
| 128 | for (Int_t ev=0; ev<11; ev++){ | 
|---|
| 129 | PedestMeantoGraph[ev] = pedMean[pix][ev]; | 
|---|
| 130 | PedestRMStoGraph[ev] = pedRMS[pix][ev]; | 
|---|
| 131 | } | 
|---|
| 132 | c1->cd(pix+1); | 
|---|
| 133 | gr = new TGraphErrors(11,Time,PedestMeantoGraph,Err_Time,PedestRMStoGraph); | 
|---|
| 134 |  | 
|---|
| 135 | sprintf(Title,"Pedestal Stability - Pixel %d",pix+1); | 
|---|
| 136 | gr->SetMarkerStyle(20); | 
|---|
| 137 | gr->SetMarkerSize(0.7); | 
|---|
| 138 | gr->SetTitle(Title); | 
|---|
| 139 | gr->Draw("ALP"); | 
|---|
| 140 | gr->GetXaxis()->SetTitle("Time (min)"); | 
|---|
| 141 | gr->GetYaxis()->SetTitle("ADC Counts"); | 
|---|
| 142 | gr->Draw("ALP"); | 
|---|
| 143 |  | 
|---|
| 144 | } | 
|---|
| 145 | c1->Update(); | 
|---|
| 146 |  | 
|---|
| 147 | } | 
|---|