--- quicklook/tof/src/TofScan.cpp 2006/05/23 10:51:21 1.2 +++ quicklook/tof/src/TofScan.cpp 2006/07/03 15:38:21 1.3 @@ -4,6 +4,8 @@ * Version 1.2 * Modified by G.De Rosa * Date 27 Apr 2006 +* Modified by G.De Rosa +* Date 03 Jul 2006 * * Description: * Describe the performance of the TOF. @@ -14,6 +16,10 @@ * TString format - the format which will be used fo rsave the produced images (Default = "gif") */ +#include +#include +#include +#include #include #include #include @@ -52,10 +58,6 @@ file->Close(); return; } - - TH2S *tdcHisto = new TH2S("tdcHisto", sst.str().c_str(), 409, 0, 4096, 48, 0, 48); - TH2S *adcHisto = new TH2S("adcHisto", sst.str().c_str(), 409, 0, 4096, 48, 0, 48); - /* * Array to convert hdc/adc to the real Photomultiplier @@ -94,69 +96,64 @@ "S32_1A", "S32_1B", "S32_2A", "S32_2B", "S32_3A", "S32_3B" }; - int i = 0; + const Int_t nh = 48; + TH1F *htdc[nh]; + TH1F *hadc[nh]; + + TObjArray *hhtdc = new TObjArray(nh); + TObjArray *hhadc = new TObjArray(nh); + char tdcname[48]=""; + char adcname[48]=""; + int j = 0; int k = 0; int z = 0; int ch = 0; int hb = 0; - - while(i < nevents){ + int ind =0; + + + for (int i=0; i < nevents; i++){ + TofBr->GetEntry(i); + k = 0; while (k < 24){ j = 0; while (j < 2){ ch = tof[2*j][k] - 1; hb = tof[2*j + 1][k] - 1; - tdcHisto->Fill(tofEvent->tdc[ch][hb], 2*k + j); - adcHisto->Fill(tofEvent->adc[ch][hb], 2*k + j); + ind = 2*k + j; + + if(i==0){ + sprintf(tdcname,"TDChist%4.4d",ind); + sprintf(adcname,"ADChist%4.4d",ind); + + htdc[ind] = new TH1F(tdcname,tdcname,409,0,4096); + hadc[ind] = new TH1F(adcname,adcname,409,0,4096); + + hhtdc->Add(htdc[ind]); + hhadc->Add(hadc[ind]); + } + + htdc[ind]->Fill(tofEvent->tdc[ch][hb]); + hadc[ind]->Fill(tofEvent->adc[ch][hb]); + j++; } k++; } - i++; } - - TH1D *tpADC = 0; - TH1D *tpTDC = 0; - TH1D *tpADCall = 0; - TH1D *tpTDCall = 0; float *X = new float[48]; float *means = new float[48]; float *entries = new float[48]; int *entriestdc = new int[48]; int *entriesadc = new int[48]; - + const char *saveas = format; - - // all range ADC/TDC - j = 0; - while (j < 12){ - k = 0; - z = 0; - - while(k < 4){ - if (k > 1) z = 2; - i = j*4 + k; - X[i] = i; - - tpTDCall = tdcHisto->ProjectionX(" ", i+1, i+1); - tpTDCall->SetAxisRange(0,4095); - entriestdc[i] = (Int_t)tpTDCall->Integral(); - - tpADCall = adcHisto->ProjectionX(" ", i+1, i+1); - tpADCall->SetAxisRange(0,4095); - entriesadc[i] = (Int_t)tpADCall->Integral(); - - k++; - } - - j++; - - } + int i=0; gStyle->SetStatW(0.4); gStyle->SetStatH(0.4); @@ -166,6 +163,7 @@ TCanvas *SCanvas = new TCanvas("SCanvas","SCanvas", 1280, 1024); SCanvas->Divide(4,2); + j = 0; while (j < 12){ k = 0; @@ -184,27 +182,31 @@ X[i] = i; SCanvas->cd(k+3+z); - tpTDC = tdcHisto->ProjectionX(" ", i+1, i+1); + htdc[i] = (TH1F*)hhtdc->At(i); + entriestdc[i] = (Int_t)htdc[i]->Integral(); sst.str(""); sst << "TDC - " << photoS[i].Data() << " (Nev < 4096 = " << entriestdc[i] << ")"; - tpTDC->SetTitle(sst.str().c_str()); - tpTDC->SetTitleSize(10); - tpTDC->SetAxisRange(690,1510); - tpTDC->DrawCopy(); - tpTDC->ComputeIntegral(); - entries[i] = tpTDC->Integral(); + htdc[i]->SetTitle(sst.str().c_str()); + htdc[i]->SetTitleSize(10); + htdc[i]->SetAxisRange(690,1510); + htdc[i]->DrawCopy(); + htdc[i]->ComputeIntegral(); + entries[i] = htdc[i]->Integral(); SCanvas->cd(k+1+z); - tpADC = adcHisto->ProjectionX(" ", i+1, i+1); + hadc[i] = (TH1F*)hhadc->At(i); + entriesadc[i] = (Int_t)hadc[i]->Integral(); sst.str(""); sst << "ADC - " << photoS[i].Data() << " (Nev < 4096 = " << entriesadc[i] << ")"; - tpADC->SetTitle(sst.str().c_str()); - tpADC->SetAxisRange(-10,710); - tpADC->DrawCopy(); - means[i] = tpADC->GetMean(); + hadc[i]->SetTitle(sst.str().c_str()); + hadc[i]->SetAxisRange(-10,710); + hadc[i]->DrawCopy(); + means[i] = hadc[i]->GetMean(); k++; } + + if ( !strcmp(saveas,"ps") ) { sst.str(""); sst << outDirectory.Data() << filename.Data() << "TOFScan.ps("; @@ -217,6 +219,7 @@ } j++; } + if (gROOT->IsBatch()) SCanvas->Close(); /*