Automatic HTML document generation
////////////////////////////////////////////////////////////////////////////
// Author: Glen MacLachlan (maclach@jlab.org)
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stddef.h>
#include "GMSAnalyzer.h"
#include <TApplication.h>
#include <TGClient.h>
int main(int argc, char **argv)
{
TApplication theApp("App", &argc, argv);
MyMainFrame mainWin(gClient->GetRoot(), 600, 320);
Progenitor * Conductor = new Progenitor;
theApp.Run();
return 0;
}
MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h)
: TGMainFrame(p, w, h)
{
// Create a main frame with a number of different buttons.
fButton1 = new TGTextButton(this, "&Start Analysis", 1);
// fButton1->SetCommand("printf("This is ROOT version %s\n","
// "gROOT->GetVersion());");
fButton1->SetCommand("Conductor->Setup("21440","4","10")");
fButton2 = new TGTextButton(this, "&Exit", 2);
fButton2->SetCommand(".q" );
fPicBut = new TGPictureButton(this, gClient->GetPicture("rjmac_132913.xpm"), 3);
fPicBut->SetCommand("printf("hello world!\n");");
fChkBut = new TGCheckButton(this, "Check Button", 4);
fRBut1 = new TGRadioButton(this, "Radio Button 1", 5);
fRBut2 = new TGRadioButton(this, "Radio Button 2", 6);
fLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY);
AddFrame(fButton1, fLayout);
AddFrame(fPicBut, fLayout);
AddFrame(fButton2, fLayout);
AddFrame(fChkBut, fLayout);
AddFrame(fRBut1, fLayout);
AddFrame(fRBut2, fLayout);
MapSubwindows();
Layout();
SetWindowName("GMSAnalyzer 3.0");
SetIconName("GMSAnalyzer 3.0");
MapWindow();
gStyle->SetOptStat(1110);
// Progenitor * Conductor = new Progenitor;
// Conductor->Setup("21440","4","10");
// Conductor->SetupHistograms();
// Conductor->DoPositionCalibration();
// Conductor->GetPedestals();
// Conductor->FillADCHistos();
// // Conductor->GetPedestals();
// Conductor->DoMethod3and4("21440","4","10");
// Conductor->DrawTDC("10");
// // Conductor->DrawADC("10");
// //Conductor->DrawRef("10");
// //Conductor->DrawLeftRightGraph("10");
// Conductor->DrawLeftRight("10");
// Conductor->DrawGoodFlash("10");
// return 0;
}
Int_t Progenitor::Setup(char *Run,char *Oct,char *Det){
cout << "######################################################n"<<endl;
cout << "t\tStarting GMSAnalyzer.2.5" << endl;
cout << "n######################################################n\n"<<endl;
cout <<"Run: "<<Run<<"tOct: "<<Oct<<"tDet: "<<Det<<endl;
RunNumber = Run;
OctNumber = Oct;
DetNumber = atoi(Det);
NorthAmerican = true;
switch(atoi(OctNumber.c_str())){
case 2:
NorthAmerican = false;
break;
case 4:
NorthAmerican = false;
break;
case 6:
NorthAmerican = false;
break;
case 8:
NorthAmerican = false;
break;
}
// FileName = "/Volumes/ext/G0/trimmed/GMS.";
// FileName = "/w/work2403/gzero/jschaub/scratch/rootfiles/G0Fastbus.";
FileName = "/w/work2403/gzero/maclach/scratch/rootfiles/G0Fastbus.";
// FileName = "/w/work2403/gzero/maclach/scratch/rootfiles/GMS.";
// FileName = "G0Fastbus.";
// FileName = "/home/maclach/G0/rootfiles/G0Fastbus.";
FileName+=RunNumber;
FileName+=".root";
FastBus = "fastbus_nt_0";
FastBus+=OctNumber;
TFile *RootFile = new TFile(FileName.c_str());
tree_init = (TTree*)RootFile->Get(FastBus.c_str());
cout<<"Number of Events:t"<<tree_init->GetEntries()<<endl;
#include "GMSBranch.h"
return 0;
}
Int_t Progenitor::SetupHistograms(){
PositionFront = new TH1F("PositionFront","PositionFront",200,-400.,400.);
PositionFront->GetXaxis()->SetTitle("Time Difference [channel]");
PositionFront->GetYaxis()->SetTitle("Counts");
PositionBack = new TH1F("PositionBack","positionBack",200,-400.,400.);
PositionBack->GetXaxis()->SetTitle("Time Difference [channel]");
PositionBack->GetYaxis()->SetTitle("Counts");
PositionFrontCorrected = new TH1F("PositionFrontCorrected","PositionFrontCorrected",200,-400.,400.);
PositionFrontCorrected->GetXaxis()->SetTitle("Time Difference [channel]");
PositionFrontCorrected->GetYaxis()->SetTitle("Counts");
PositionBackCorrected = new TH1F("PositionBackCorrected","positionBackCorrected",200,-400.,400.);
PositionBackCorrected->GetXaxis()->SetTitle("Time Difference [channel]");
PositionBackCorrected->GetYaxis()->SetTitle("Counts");
PositionFront_MeanTime = new TH2F("PositionFront_MeanTime","PositionFront_MeanTime",400,10,4086,200,-400.,400.);
PositionFront_MeanTime->GetXaxis()->SetTitle("Time [channel]");
PositionFront_MeanTime->GetYaxis()->SetTitle("Time Difference [channel]");
PositionBack_MeanTime = new TH2F("PositionBack_MeanTime","positionBack_MeanTime",400,10,4086,200,-400.,400.);
PositionBack_MeanTime->GetXaxis()->SetTitle("Time [channel]");
PositionBack_MeanTime->GetYaxis()->SetTitle("Time Difference [channel]");
FrontMeanTime = new TH1F("FrontMeanTime","FrontMeanTime",700,500.,4000.);
BackMeanTime = new TH1F("BackMeanTime","BackMeanTime",700,500.,4000.);
FrontMeanTime->GetXaxis()->SetTitle("Time [channel]");
FrontMeanTime->GetYaxis()->SetTitle("Counts");
BackMeanTime->GetXaxis()->SetTitle("Time [channel]");
BackMeanTime->GetYaxis()->SetTitle("Counts");
ADC_FL_05 = new TH1F("ADC_FL_05","ADC_FL_05",NumberOfBins,0.,NumberOfChannels);
ADC_FL_05->GetXaxis()->SetTitle("ADC [channel]");
ADC_FL_05->GetYaxis()->SetTitle("Counts");
ADC_FL_Ped = new TH1F("ADC_FL_Ped","ADC_FL_Ped",PedestalBins,0.,PedestalChannels);
ADC_FL = new TH1F("ADC_FL","ADC_FL",NumberOfBins,0.,NumberOfChannels);
ADC_FR_05 = new TH1F("ADC_FR_05","ADC_FR_05",NumberOfBins,0.,NumberOfChannels);
ADC_FR_Ped = new TH1F("ADC_FR_Ped","ADC_FR_Ped",PedestalBins,0.,PedestalChannels);
ADC_FR = new TH1F("ADC_FR","ADC_FR",NumberOfBins,0.,NumberOfChannels);
ADC_FR_05->GetXaxis()->SetTitle("ADC [channel]");
ADC_FR_05->GetYaxis()->SetTitle("Counts");
ADC_BL_05 = new TH1F("ADC_BL_05","ADC_BL_05",NumberOfBins,0.,NumberOfChannels);
ADC_BL_Ped = new TH1F("ADC_BL_Ped","ADC_BL_Ped",PedestalBins,0.,PedestalChannels);
ADC_BL = new TH1F("ADC_BL","ADC_BL",NumberOfBins,0.,NumberOfChannels);
ADC_BL_05->GetXaxis()->SetTitle("ADC [channel]");
ADC_BL_05->GetYaxis()->SetTitle("Counts");
ADC_BR_05 = new TH1F("ADC_BR_05","ADC_BR_05",NumberOfBins,0.,NumberOfChannels);
ADC_BR_Ped = new TH1F("ADC_BR_Ped","ADC_BR_Ped",PedestalBins,0.,PedestalChannels);
ADC_BR = new TH1F("ADC_BR","ADC_BR",NumberOfBins,0.,NumberOfChannels);
ADC_BR_05->GetXaxis()->SetTitle("ADC [channel]");
ADC_BR_05->GetYaxis()->SetTitle("Counts");
ADCRefPed = new TH1F("ADCRefPed","ADCRefPed",PedestalBins,0.,PedestalChannels);
ADCRefFlashL = new TH1F("ADCRefFlashL","ADCRefFlashL",50,2500.,6000.);
ADCRefFlashR = new TH1F("ADCRefFlashR","ADCRefFlashR",50,2500.,6000.);
ADCRefFlashPedestalSubtracted = new TH1F("ADCRefFlashPedestalSubtracted","ADCRefFlashPedestalSubtracted"
,NumberOfBins,0.,NumberOfChannels);
RefQ = new TH2F("RefQ","RefQ",NumberOfBins,0.,NumberOfChannels,75,0.,6000.);
FrontQLL = new TH1F("FrontQLL","FrontQLL",NumberOfBins,0.,NumberOfChannels);
FrontQLR = new TH1F("FrontQLR","FrontQLR",NumberOfBins,0.,NumberOfChannels);
FrontQRL = new TH1F("FrontQRL","FrontQRL",NumberOfBins,0.,NumberOfChannels);
FrontQRR = new TH1F("FrontQRR","FrontQLR",NumberOfBins,0.,NumberOfChannels);
FrontLeft = new TH1F("FrontLeft","FrontLeft",NumberOfBins,0.,1.);
FrontRight = new TH1F("FrontRight","FrontRight",NumberOfBins,0.,1.);
FrontLeftSquared = new TH1F("FrontLeftSquared","FrontLeftSquared",NumberOfBins,0.,1.);
FrontRightSquared = new TH1F("FrontRightSquared","FrontRightSquared",NumberOfBins,0.,1.);
BackLeft = new TH1F("BackLeft","BackLeft",NumberOfBins,0.,1.);
BackRight = new TH1F("BackRight","BackRight",NumberOfBins,0.,1.);
BackLeftSquared = new TH1F("BackLeftSquared","BackLeftSquared",NumberOfBins,0.,1.);
BackRightSquared = new TH1F("BackRightSquared","BackRightSquared",NumberOfBins,0.,1.);
return 0;
}
Int_t Progenitor::DoPositionCalibration(){
Int_t nentries = static_cast<Int_t>(tree_init->GetEntries());
cout << "Doing Time Calibration." << endl;
for(Int_t i=0; i<nentries;i++){
for(Int_t k=0;k<nRings;k++){
if(k==DetNumber-1){
tree_init->GetEvent(i);
if(5==misc.evt_type){ // Pedestal Events
if(0==tdc_fl[k]&&0==tdc_fr[k]&&0==mt_f[k]){
ADC_FL_Ped->Fill(adc_fl[k]);
ADC_FR_Ped->Fill(adc_fr[k]);
}
if(10<=tdc_fl[k]&&4086>=tdc_fl[k]&&
10<=tdc_fr[k]&&4086>=tdc_fr[k]){//&&
PositionDifference = tdc_fl[k]-tdc_fr[k];
PositionFront->Fill(PositionDifference);
PositionFront_MeanTime->Fill(mt_f[k],PositionDifference);
FrontMeanTime->Fill(mt_f[k]);
}
if(0==tdc_bl[k]&&0==tdc_br[k]&&0==mt_b[k]){
ADC_BL_Ped->Fill(adc_bl[k]);
ADC_BR_Ped->Fill(adc_br[k]);
}
if(10<=tdc_bl[k]&&4086>=tdc_bl[k]&&
10<=tdc_br[k]&&4086>=tdc_br[k]){//&&
PositionDifference = tdc_bl[k]-tdc_br[k];
PositionBack->Fill(PositionDifference);
PositionBack_MeanTime->Fill(mt_b[k],PositionDifference);
BackMeanTime->Fill(mt_b[k]);
}
}
if(6==misc.evt_type){ADCRefPed->Fill(gmsref.ref);}
}
}
}
FrontMeanTimePeak = FrontMeanTime->GetMaximumBin();
BackMeanTimePeak = BackMeanTime->GetMaximumBin();
PositionFrontMeanPeak = PositionFront->GetMean();
PositionBackMeanPeak = PositionBack->GetMean();
// cout <<"tFront Mean-Time Peak:t"<<FrontMeanTimePeak<<endl;
// cout <<"tBack Mean-Time Peak: t"<<BackMeanTimePeak<<endl;
cout <<"n------------------------------"<<endl;
cout <<"Time Calibration Completed"<<endl;
cout <<"------------------------------n"<<endl;
return 0;
}
Int_t Progenitor::FillADCHistos(){
Int_t nentries = static_cast<Int_t>(tree_init->GetEntries());
Double_t EventArray[nentries],LRArray[nentries];
Int_t LRCounter =0;
Double_t FrontRightRatio,FrontLeftRatio;
Double_t BackRightRatio,BackLeftRatio;
cout << "Starting Transmittance Analysis."<< endl;
for(Int_t i=0; i<nentries;i++){
for(Int_t k=0;k<nRings;k++){
// Fill histograms which depend on event type.
if(k==DetNumber-1){
tree_init->GetEvent(i);
// EventArray[i] = i;
// LRArray[i] = 0.;
if(adc_fl[k]<ADCOverFlow&&adc_fr[k]<ADCOverFlow){
if(10<=tdc_fl[k]&&4086>=tdc_fl[k]&&
10<=tdc_fr[k]&&4086>=tdc_fr[k]){
if(5==misc.evt_type){ // Flash Events
ADC_FL_05->Fill(adc_fl[k]);
ADC_FR_05->Fill(adc_fr[k]);
PositionDifference = tdc_fl[k]-tdc_fr[k];
if(fabs(5.*FrontMeanTimePeak+500-mt_f[k])<=30){
PositionFrontCorrected->Fill(PositionDifference-PositionFrontMeanPeak);
// Passed Mean Time Cut!
LRArray[LRCounter] = 0.;
if(0<=(PositionDifference-PositionFrontMeanPeak)){
EventArray[LRCounter] = LRCounter;
FrontRightRatio = (adc_fl[k]-PedestalFL)/(adc_fr[k]-PedestalFR);
FrontRightSquared->Fill(FrontRightRatio);
FrontRight->Fill(sqrt(FrontRightRatio));
FrontQLR->Fill(adc_fl[k]);//-PedestalFL);
FrontQRR->Fill(adc_fr[k]);//-PedestalFR);
ADCRefFlashR->Fill(gmsref.ref);
RefQ->Fill(adc_fr[k],gmsref.ref);
LRArray[LRCounter]=1.;
LRCounter++;
}
if(0>=(PositionDifference-PositionFrontMeanPeak)){
EventArray[LRCounter] = LRCounter;
FrontLeftRatio = (adc_fr[k]-PedestalFR)/(adc_fl[k]-PedestalFL);
FrontLeftSquared->Fill(FrontLeftRatio);
FrontLeft->Fill(sqrt(FrontLeftRatio));
FrontQRL->Fill(adc_fr[k]);//-PedestalFR);
FrontQLL->Fill(adc_fl[k]);//-PedestalFL);
ADCRefFlashL->Fill(gmsref.ref);
RefQ->Fill(adc_fl[k],gmsref.ref);
LRArray[LRCounter]=-1.;
LRCounter++;
}
}
}
}
}
if(adc_bl[k]<ADCOverFlow&&adc_br[k]<ADCOverFlow){
if(10<=tdc_bl[k]&&4086>=tdc_bl[k]&&
10<=tdc_br[k]&&4086>=tdc_br[k]){
if(5==misc.evt_type){ // Flash Events
ADC_BL_05->Fill(adc_bl[k]);
ADC_BR_05->Fill(adc_br[k]);
}
if(5==misc.evt_type){ // Pedestal Events
PositionDifference = tdc_bl[k]-tdc_br[k];
if(fabs(5.*BackMeanTimePeak+500-mt_b[k])<=30){
PositionBackCorrected->Fill(PositionDifference-PositionBackMeanPeak);
if(0<=(PositionDifference-PositionBackMeanPeak)){
BackRightRatio = (adc_bl[k]-PedestalBL)/(adc_br[k]-PedestalBR);
BackRightSquared->Fill(BackRightRatio);
BackRight->Fill(sqrt(BackRightRatio));
}
if(0>=(PositionDifference-PositionBackMeanPeak)){
BackLeftRatio = (adc_br[k]-PedestalBR)/(adc_bl[k]-PedestalBL);
BackLeftSquared->Fill(BackLeftRatio);
BackLeft->Fill(sqrt(BackLeftRatio));
}
}
}
}
}
}
}
}
LeftRightGraph = new TGraph(LRCounter,EventArray,LRArray);
// LeftRightGraph = new TGraph(nentries,EventArray,LRArray);
cout<<"GMS Analysis Completed..."<<nentries<<" events."<<endl;
return 0;
}
Int_t Progenitor::GetPedestals(){
PedestalFL=PedestalFR=PedestalBL=PedestalBR=PedestalRef=0;
PedestalFL=(ADC_FL_Ped->GetMean());
PedestalFR=(ADC_FR_Ped->GetMean());
PedestalBL=(ADC_BL_Ped->GetMean());
PedestalBR=(ADC_BR_Ped->GetMean());
// PedestalRef=(ADCRefPed->GetMean());
Int_t bin = 0;
while(ADCRefPed->GetBinContent(bin)<0.10*ADCRefPed->GetMaximum()){
bin++;
PedestalRef=PedestalChannels*bin/PedestalBins;
// cout <<"REFERENCE PEDt"<< PedestalRef<<" "<<bin<<endl;
}
cout<<"tPedestals:t"<<PedestalFL<<" "<<PedestalFR<<" "<<PedestalBL<<" "<<PedestalBR<<" "<<PedestalRef<<endl;
return 0;
}
Int_t Progenitor::DoMethod3and4(char *Run,char *Oct,char *Det){
string OutPut;
Double_t FrontMethod3,FrontMethod4;
Double_t BackMethod3,BackMethod4;
Double_t FrontMethod3Error,FrontMethod4Error;
Double_t BackMethod3Error,BackMethod4Error;
Double_t FLSmean, FRSmean, BLSmean, BRSmean;
Double_t FLSerror, FRSerror, BLSerror, BRSerror;
Double_t FLmean, FRmean, BLmean, BRmean;
Double_t FLerror, FRerror, BLerror, BRerror;
FLSmean=FrontLeftSquared->GetMean();
FRSmean=FrontRightSquared->GetMean();
BLSmean=BackLeftSquared->GetMean();
BRSmean=BackRightSquared->GetMean();
FLmean=FrontLeft->GetMean();
FRmean=FrontRight->GetMean();
BLmean=BackLeft->GetMean();
BRmean=BackRight->GetMean();
FLSerror=FrontLeftSquared->GetMeanError();
FRSerror=FrontRightSquared->GetMeanError();
BLSerror=BackLeftSquared->GetMeanError();
BRSerror=BackRightSquared->GetMeanError();
FLerror=FrontLeft->GetMeanError();
FRerror=FrontRight->GetMeanError();
BLerror=BackLeft->GetMeanError();
BRerror=BackRight->GetMeanError();
FrontMethod3 = sqrt( FLSmean * FRSmean ) ;
FrontMethod4 = FLmean * FRmean ;
BackMethod3 = sqrt( BLSmean * BRSmean ) ;
BackMethod4 = BLmean * BRmean ;
FrontMethod3Error = sqrt( (pow(FLSmean*FRSerror,2) + pow
(FRSmean*FLSerror,2))/(4*FrontMethod3) );
FrontMethod4Error = sqrt( pow(FLmean*FRerror,2) + pow
(FRmean*FLerror,2));
BackMethod3Error = sqrt( (pow(BLSmean*BRSerror,2) + pow
(BRSmean*BLSerror,2))/(4*BackMethod3) );
BackMethod4Error = sqrt( pow(BLmean*BRerror,2) + pow
(BRmean*BLerror,2));
/*OutPut = "/w/work2403/gzero/maclach/scratch/rootfiles/NewClass/";
OutPut += "Output_";
//OutPut = "Output_";
OutPut += Run;
OutPut += "_";
OutPut += Oct;
OutPut += "_";
OutPut += Det;
OutPut += ".dat";
*/
OutPut = "/w/work2403/gzero/maclach/scratch/rootfiles/NewClass/data7.3.dat";
// cout<<OutPut<<endl;
// ofstream fout(OutPut.c_str(),ios::app
ofstream fout("Transmittance.log", ios::app
/* TransmittanceFrontErr = 1.;
cout TransmittanceBackErr = 1.;
cout<<"n"<<endl;
cout<<"---------------------------------------------------------------"<
<endl;
cout << "tFront Transmittance:t"<<TransmittanceFront<<" +/-
"<<TransmittanceFrontErr<<endl;
cout << "tBack Transmittance:t"<<TransmittanceBack<<" +/-
"<<TransmittanceBackErr<<endl;
cout<<"---------------------------------------------------------------"<
<endl;
*/
// fout << Run <<" "<< TransmittanceFront <<" "<< TransmittanceFrontErr <<" "<<endl;
cout<<"n"<<endl;
cout<<"---------------------------------------------------------------"<<endl;
cout << "tMethod 3 (Front Plane):t"<<FrontMethod3<<endl;
cout << "tMethod 4 (Front Plane):t"<<FrontMethod4<<endl;
cout << "tMethod 3 (Back Plane):t"<<BackMethod3<<endl;
cout << "tMethod 4 (Back Plane):t"<<BackMethod4<<endl;
cout<<"---------------------------------------------------------------"<<endl;
fout <<Run <<" "<<Oct<<" "<<Det<<" "<< FrontMethod3 <<" "<< FrontMethod3Error <<" "<<FrontMethod4<<" "<<FrontMethod4Error<<" 0"<<endl;
fout <<Run <<" "<<Oct<<" "<<Det<<" "<< BackMethod3 <<" "<< BackMethod3Error <<" "<<BackMethod4<<" "<<BackMethod4Error<<" 1"<<endl;
fout.close();
cout<<"Output written to Transmittance.log"<<endl;
return 0;
}
Int_t Progenitor::DrawTDC(char *Det){
string PostScript;
TCanvas *c2;
c2 = new TCanvas("c2","TDC Channels",0,0,1000,714);
c2->Clear();
c2->Divide(2,2);
c2->SetLogy(1);
c2->cd(1);
PositionFront->Draw("");
c2->cd(3);
PositionBack->Draw("");
c2->cd(2);
TLine *lineleft = new TLine(5.*FrontMeanTimePeak+470,0,5.*FrontMeanTimePeak+470,0.25*(FrontMeanTime->GetMaximum()));
TLine *lineright = new TLine(5.*FrontMeanTimePeak+530,0,5.*FrontMeanTimePeak+530,0.25*(FrontMeanTime->GetMaximum()));
FrontMeanTime->SetLineWidth(3);
FrontMeanTime->Draw("");
lineleft->SetLineWidth(2);
lineleft->SetLineColor(2);
lineright->SetLineWidth(2);
lineright->SetLineColor(2);
lineleft->Draw();
lineright->Draw();
c2->cd(4);
TLine*linebackleft=new TLine(5.*BackMeanTimePeak+470,0,5.*BackMeanTimePeak+470,0.25*(BackMeanTime->GetMaximum()));
TLine*linebackright=new TLine(5.*BackMeanTimePeak+530,0,5.*BackMeanTimePeak+530,0.25*(BackMeanTime->GetMaximum()));
BackMeanTime->SetLineWidth(3);
BackMeanTime->Draw("");
linebackleft->SetLineWidth(2);
linebackleft->SetLineColor(2);
linebackright->SetLineWidth(2);
linebackright->SetLineColor(2);
linebackleft->Draw();
linebackright->Draw();
c2->cd(1);
PositionFrontCorrected->SetLineColor(2);
PositionFrontCorrected->SetLineWidth(3);
PositionFrontCorrected->Draw("SAME");
c2->cd(3);
PositionBackCorrected->SetLineColor(2);
PositionBackCorrected->SetLineWidth(3);
PositionBackCorrected->Draw("SAME");
// PostScript = "/w/work2403/gzero/maclach/scratch/rootfiles/NewClass/tdc_";
PostScript = "tdc_";
PostScript +=RunNumber;
PostScript +="_Oct";
PostScript +=OctNumber;
PostScript +="_Det";
PostScript +=Det;
PostScript +=".ps";
c2->Print(PostScript.c_str());
return 0;
}
Int_t Progenitor::DrawADC(char *Det){
string PostScript;
TCanvas *c1;
c1 = new TCanvas("c1","ADC Channels",0,0,1000,714);
c1->Clear();
c1->Divide(1,2);
c1->SetLogy(1);
TLegend *legendLeft = new TLegend(.7,.6,.9,.8);
TLegend *legendRight = new TLegend(.7,.6,.9,.8);
legendLeft->AddEntry(FrontQLL,"Left Spigot");
legendLeft->AddEntry(FrontQLR,"Right Spigot");
legendLeft->AddEntry(ADC_FL_Ped,"Pedestal");
legendRight->AddEntry(FrontQRL,"Left Spigot");
legendRight->AddEntry(FrontQRR,"Right Spigot");
legendRight->AddEntry(ADC_FR_Ped,"Pedestal");
c1->cd(1);
ADC_FL_05->Smooth(10);
ADC_FL_05->Draw("AXIS");
ADC_FL_Ped->SetLineWidth(3);
legendLeft->Draw();
ADC_FL_Ped->Draw("SAME");
c1->cd(2);
ADC_FR_05->Draw("AXIS");
ADC_FR_Ped->SetLineWidth(3);
legendRight->Draw();
ADC_FR_Ped->Draw("SAME");
// PostScript = "/w/work2403/gzero/maclach/scratch/rootfiles/NewClass/adc_";
PostScript = "adc_";
PostScript +=RunNumber;
PostScript +="_Oct";
PostScript +=OctNumber;
PostScript +="_Det";
PostScript +=Det;
PostScript +=".ps";
c1->Print(PostScript.c_str());
return 0;
}
Int_t Progenitor::DrawRef(char *Det){
string PostScript;
TCanvas *c3;
c3 = new TCanvas("c3","ADC Channels",0,0,1000,714);
c3->Clear();
c3->Divide(1,2);
// c3->SetLogy(1);
c3->cd(1);
ADCRefFlashL->SetLineColor(2);
ADCRefFlashR->SetLineColor(4);
// ADCRefFlashL->Smooth(10);
// ADCRefFlashR->Smooth(10);
TLegend *legendRef = new TLegend(.1,.6,.3,.8);
legendRef->AddEntry(ADCRefFlashL,"Left Spigot");
legendRef->AddEntry(ADCRefFlashR,"Right Spigot");
ADCRefFlashR->GetXaxis()->SetTitle("Ref ADC");
Double_t Maximum;
if(ADCRefFlashR->GetMaximum()>=ADCRefFlashL->GetMaximum()){
ADCRefFlashR->Draw();
ADCRefFlashL->Draw("SAME");
Maximum = ADCRefFlashR->GetMaximum();
}else{
ADCRefFlashL->Draw();
ADCRefFlashR->Draw("SAME");
Maximum = ADCRefFlashL->GetMaximum();
}
TAxis *axis1 = ADCRefFlashL->GetXaxis();
Int_t ncx1 = axis1->GetNbins();
// Int_t ncx2 = axis2->GetNbins();
Double_t sum1 = 0, sum2 = 0;
Double_t ew1, ew2, w1 = 0, w2 = 0;
Int_t bin;
for (bin=1;bin<=ncx1;bin++) {
sum1 += ADCRefFlashL->GetBinContent(bin);
sum2 += ADCRefFlashR->GetBinContent(bin);
ew1 = ADCRefFlashL->GetBinError(bin);
ew2 = ADCRefFlashR->GetBinError(bin);
w1 += ew1*ew1;
w2 += ew2*ew2;
}
cout <<"Bin Statistics Leftt"<< sum1<<" "<<ADCRefFlashL->GetEntries()<<endl;
cout <<"Bin Statistics Rightt"<< sum2<<" "<<ADCRefFlashR->GetEntries()<<endl;
Double_t ProbabilityMatch;
ProbabilityMatch = ADCRefFlashL->KolmogorovTest(ADCRefFlashR,"D");
cout << "Probability that reference flashes [Left/Right]"<<endl;
cout << "came from the same parent distribution"<<endl;
cout << ProbabilityMatch<<endl;
char Prob[10];
sprintf(Prob,"%8.2f",ProbabilityMatch);
TPaveText pt(4500,0.5*Maximum,5750,0.8*Maximum);
pt.AddText("Probability that reference flashes [Left/Right]");
pt.AddText("came from the same parent distribution");
pt.AddText(Prob);
pt.SetLabel("Kolmogorov-Smirnov Test");
pt.Draw();
legendRef->Draw();
c3->cd(2);
RefQ->Draw("BOX");
RefQ->GetXaxis()->SetTitle("Flash ADC");
RefQ->GetYaxis()->SetTitle("Ref ADC");
Double_t Slope;
cout<<"Slopet"<<Slope<<endl;
TLine *line = new TLine(PedestalFR,PedestalRef,NumberOfChannels,NumberOfChannels*Slope+PedestalRef);
line->SetLineStyle(2);
line->Draw();
TLegend *legend2d = new TLegend(.7,.3,.9,.5);
legend2d->AddEntry(line,"Ref/FPD Relation");
legend2d->Draw();
// PostScript = "/w/work2403/gzero/maclach/scratch/rootfiles/NewClass/ref_";
PostScript = "ref_";
PostScript +=RunNumber;
PostScript +="_Oct";
PostScript +=OctNumber;
PostScript +="_Det";
PostScript +=Det;
PostScript +=".ps";
c3->Print(PostScript.c_str());
return 0;
}
Int_t Progenitor::DrawLeftRightGraph(char *Det){
string PostScript;
TCanvas *c4;
c4 = new TCanvas("c4","ADC Channels",0,0,1000,714);
c4->SetTitle("Flash Parity Plotted Against Event Number");
c4->Clear();
LeftRightGraph->SetFillColor(40);
LeftRightGraph->GetXaxis()->SetTitle("Flash Event Number");
LeftRightGraph->GetYaxis()->SetTitle("Left Right");
LeftRightGraph->Draw("AB");
PostScript = "LeftRightGraph_";
PostScript +=RunNumber;
PostScript +="_Oct";
PostScript +=OctNumber;
PostScript +="_Det";
PostScript +=Det;
PostScript +=".ps";
c4->Print(PostScript.c_str());
return 0;
}
Int_t Progenitor::DrawLeftRight(char *Det){
string PostScript;
TCanvas *c5;
c5 = new TCanvas("c5","ADC Channels",0,0,1000,714);
c5->SetTitle("Flash Parity Plotted Against Event Number");
c5->Clear();
c5->Divide(2,2);
gStyle->SetOptStat(1);
FrontLeftSquared->GetXaxis()->SetTitle("L^{2}");
FrontRightSquared->GetXaxis()->SetTitle("R^{2}");
FrontLeft->GetXaxis()->SetTitle("L");
FrontRight->GetXaxis()->SetTitle("R");
c5->cd(1);
FrontLeftSquared->Draw();
c5->cd(2);
FrontRightSquared->Draw();
c5->cd(3);
FrontLeft->Draw();
c5->cd(4);
FrontRight->Draw();
PostScript = "LeftRight_";
PostScript +=RunNumber;
PostScript +="_Oct";
PostScript +=OctNumber;
PostScript +="_Det";
PostScript +=Det;
PostScript +=".ps";
c5->Print(PostScript.c_str());
return 0;
}
Int_t Progenitor::DrawGoodFlash(char *Det){
string PostScript;
TCanvas *c6;
c6 = new TCanvas("c6","ADC Channels",0,0,1000,714);
c6->SetTitle("Flash Parity Plotted Against Event Number");
c6->Clear();
c6->Divide(1,2);
TLegend *legendLeft = new TLegend(.7,.6,.9,.8);
TLegend *legendRight = new TLegend(.7,.6,.9,.8);
legendLeft->AddEntry(FrontQLL,"Left Spigot");
legendLeft->AddEntry(FrontQLR,"Right Spigot");
legendRight->AddEntry(FrontQRL,"Left Spigot");
legendRight->AddEntry(FrontQRR,"Right Spigot");
FrontQLR->GetXaxis()->SetTitle("ADC Channel");
FrontQRL->GetXaxis()->SetTitle("ADC Channel");
FrontQRR->GetXaxis()->SetTitle("ADC Channel");
FrontQLL->GetXaxis()->SetTitle("ADC Channel");
FrontQLR->GetYaxis()->SetTitle("Counts");
FrontQRL->GetYaxis()->SetTitle("Counts");
FrontQRR->GetYaxis()->SetTitle("Counts");
FrontQLL->GetYaxis()->SetTitle("Counts");
c6->cd(1);
FrontQLR->SetLineColor(4);
FrontQLL->SetLineColor(2);
FrontQLL->Draw("");
FrontQLR->Draw("SAME");
legendLeft->Draw();
c6->cd(2);
FrontQRR->SetLineColor(4);
FrontQRL->SetLineColor(2);
FrontQRL->Draw("");
FrontQRR->Draw("SAME");
legendRight->Draw();
PostScript = "GoodFlash_";
PostScript +=RunNumber;
PostScript +="_Oct";
PostScript +=OctNumber;
PostScript +="_Det";
PostScript +=Det;
PostScript +=".ps";
c6->Print(PostScript.c_str());
return 0;
}
// Continuation of MyMain.cxx
Bool_t MyMainFrame::ProcessMessage(Long_t msg, Long_t parm1, Long_t)
{
// Process events generated by the buttons in the frame.
switch (GET_MSG(msg)) {
case kC_COMMAND:
switch (GET_SUBMSG(msg)) {
case kCM_BUTTON:
printf("text button id %ld pressedn", parm1);
break;
case kCM_CHECKBUTTON:
printf("check button id %ld pressedn", parm1);
break;
case kCM_RADIOBUTTON:
if (parm1 == 5)
fRBut2->SetState(kButtonUp);
if (parm1 == 6)
fRBut1->SetState(kButtonUp);
printf("radio button id %ld pressedn", parm1);
break;
default:
break;
}
default:
break;
}
return kTRUE;
}
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.