00001 TH2 *h1fast, *h1full;
00002 TH1 *h2fast, *h2full, *h3fast, *h3full;
00003 TCanvas *c;
00004 TLegend *leg;
00005
00006 void testPmtSignal(float pmtGain=1.5e+6, float cathodeNoise=0.0, float dynodeNoise=0.0) {
00007 gROOT->Macro("LoadLogger.C");
00008 gSystem->Load("StChain");
00009 gSystem->Load("StMcEvent");
00010 gSystem->Load("StEmcSimulatorMaker");
00011 cout << "loaded libraries" << endl;
00012
00013 gStyle->SetOptStat(0);
00014
00015 StPmtSignal p(pmtGain, cathodeNoise, dynodeNoise);
00016 int maxAdc = 4096;
00017 float maxEnergy = 60.0;
00018 float photoElectronsPerMIP = 63.0;
00019 float energyPerMIP = 0.0198;
00020 float samplingFraction = 14.1;
00021 float totalGain = (maxAdc / maxEnergy) * (energyPerMIP / photoElectronsPerMIP) * samplingFraction;
00022 p.setTotalGain(totalGain);
00023 p.setPedestalMean(30.0);
00024 p.setPedestalRMS(1.5);
00025
00026 h1fast = new TH2D("h1fast","<ADC> / photoElectrons",50, 0.0, 16000.0, 50, 0.0, 4000.0);
00027 h1full = new TH2D("h1full","<ADC> / photoElectrons",50, 0.0, 16000.0, 50, 0.0, 4000.0);
00028
00029 h2fast = new TH1D("h2fast","ADC distributions for 400 photoElectrons",50, 125.0, 175.0);
00030 h2full = new TH1D("h2full","ADC distributions for 400 photoElectrons",50, 125.0, 175.0);
00031
00032 h3fast = new TH1D("h3fast","ADC distributions for 8000 photoElectrons",50, 2350.0, 2550.0);
00033 h3full = new TH1D("h3full","ADC distributions for 8000 photoElectrons",50, 2350.0, 2550.0);
00034
00035 for(int i=0; i<16000; i++) {
00036 if(i%1000 == 0) cout << "processing " << i << endl;
00037 h1fast->Fill(i, p.getAdc(i, StPmtSignal::kFastSimulator));
00038 h1full->Fill(i, p.getAdc(i, StPmtSignal::kFullSimulator));
00039
00040 h2fast->Fill(p.getAdc(400, StPmtSignal::kFastSimulator));
00041 h2full->Fill(p.getAdc(400, StPmtSignal::kFullSimulator));
00042
00043 h3fast->Fill(p.getAdc(8000, StPmtSignal::kFastSimulator));
00044 h3full->Fill(p.getAdc(8000, StPmtSignal::kFullSimulator));
00045 }
00046
00047 h1fast->SetXTitle("nPhotoElectrons");
00048 h1fast->SetYTitle("ADC");
00049
00050 h2fast->SetXTitle("ADC");
00051 h3fast->SetXTitle("ADC");
00052
00053 h1full->SetLineColor(kRed);
00054 h2full->SetLineColor(kRed);
00055 h3full->SetLineColor(kRed);
00056
00057 c = new TCanvas("c","",900,300);
00058 c->Divide(3,1);
00059
00060 c->cd(1);
00061 h1fast->Draw("box");
00062 h1full->Draw("box same");
00063
00064 leg = new TLegend(0.1,0.7,0.5,0.9);
00065 leg->AddEntry(h1fast,"fastSimulator");
00066 leg->AddEntry(h1full,"fullSimulator");
00067 leg->Draw();
00068
00069 TVirtualPad * pad = c->cd(2);
00070 pad->SetLogy();
00071 h2fast->Draw();
00072 h2full->Draw("same");
00073
00074 pad = c->cd(3);
00075 pad->SetLogy();
00076 h3fast->Draw();
00077 h3full->Draw("same");
00078 }