diff --git a/Software/AttenuationScan/AttenuationScan.C b/Software/AttenuationScan/AttenuationScan.C index d9dcd2c..192b04d 100644 --- a/Software/AttenuationScan/AttenuationScan.C +++ b/Software/AttenuationScan/AttenuationScan.C @@ -130,6 +130,9 @@ Float_t meanADC[steps]; Float_t mean4ADC[steps]; + // Open output ROOT file. + TFile *output = TFile::Open(TString(output_ROOT),"RECREATE"); + for (Int_t step=0;stepClose(); } - // Open output ROOT file. - TFile *output = TFile::Open(TString(output_ROOT),"RECREATE"); + output->cd(); // Only one strip. TGraph *gattenuationScan = new TGraph(steps,dB,meanADC); diff --git a/Software/ComputePedestals/ComputePedestals.C b/Software/ComputePedestals/ComputePedestals.C index 5eb768e..caf3d66 100644 --- a/Software/ComputePedestals/ComputePedestals.C +++ b/Software/ComputePedestals/ComputePedestals.C @@ -242,19 +242,37 @@ } } - DrawHist(cADCBeetle1,hADCBeetle1,"",path_to_figures); DrawHist(cADCBeetle2,hADCBeetle2,"",path_to_figures); - // Remove potential outliers. Use the mean and the RMS of the hADCBeetle1 and hADCBeetle2 histograms and exclude everything that is outside 5 times the RMS. - double mean1 = hADCBeetle1->GetMean(); - double rms1 = hADCBeetle1->GetRMS(); - - double mean2 = hADCBeetle2->GetMean(); - double rms2 = hADCBeetle2->GetRMS(); + // Remove potential outliers. Use the mean and the RMS of the hADCTemp histograms and exclude everything that is outside times the RMS. + double mean[N]; + double rms[N]; double factor = 5.; // Entries further than factor*rms from the mean are excluded from the pedestal calculation. + // Fill histograms, necessary to remove potential outliers. + TH1F *hADCTemp[N]; + for (int ch=0;chGetEntry(iEvent); + hADCTemp[ch]->Fill(ADC->at(ch)); + if (ADC->at(ch) > 1024.) + cout << "Error! ADC counts of Beetle channel " << ch << ": " << ADC->at(ch) << endl; + } + + TF1 *fGaussian = new TF1("fGaussian","gaus",400,600); + hADCTemp[ch]->Fit("fGaussian","R"); + // mean[ch] = hADCTemp[ch]->GetMean(); + // rms[ch] = hADCTemp[ch]->GetMean(); + mean[ch] = fGaussian->GetParameter(1); + rms[ch] = fGaussian->GetParameter(2); + } + // Fill histograms. TH1F *hADC[N]; // TPaveStats *sADC[N]; @@ -264,7 +282,7 @@ double noise[N]; for (int ch=0;chGetEntry(iEvent); - if (((chat(ch)-mean1)=NBeetle) && (abs(ADC->at(ch)-mean2)at(ch)-mean[ch])Fill(ADC->at(ch)); if (ADC->at(ch) > 1024.) cout << "Error! ADC counts of Beetle channel " << ch << ": " << ADC->at(ch) << endl; @@ -292,8 +310,8 @@ for (int ch=0;chSetFillColor(kAzure); hADCvsStripBeetle1->SetMinimum(-1200); hADCvsStripBeetle1->SetMaximum(1200); - hADCPedSubvsStripBeetle1->SetMinimum(-400); - hADCPedSubvsStripBeetle1->SetMaximum(400); + hADCPedSubvsStripBeetle1->SetMinimum(-500); + hADCPedSubvsStripBeetle1->SetMaximum(500); // Style and range for Beetle 2 plots. hADCvsStripBeetle2->SetFillColor(kRed); hADCPedSubvsStripBeetle2->SetFillColor(kRed); hADCvsStripBeetle2->SetMinimum(-1200); hADCvsStripBeetle2->SetMaximum(1200); - hADCPedSubvsStripBeetle2->SetMinimum(-400); - hADCPedSubvsStripBeetle2->SetMaximum(400); + hADCPedSubvsStripBeetle2->SetMinimum(-500); + hADCPedSubvsStripBeetle2->SetMaximum(500); // Fill histograms. for (int iEvent=0;iEvent