/[PAMELA software]/quicklook/tof/src/TofScan.cpp
ViewVC logotype

Diff of /quicklook/tof/src/TofScan.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by campana, Tue May 23 10:51:21 2006 UTC revision 1.3 by campana, Mon Jul 3 15:38:21 2006 UTC
# Line 4  Line 4 
4  * Version 1.2  * Version 1.2
5  * Modified by G.De Rosa  * Modified by G.De Rosa
6  * Date 27 Apr 2006  * Date 27 Apr 2006
7    * Modified by G.De Rosa
8    * Date 03 Jul 2006
9  *  *
10  * Description:  * Description:
11  * Describe the performance of the TOF.  * Describe the performance of the TOF.
# Line 14  Line 16 
16  *       TString format          - the format which will be used fo rsave the produced images (Default = "gif")  *       TString format          - the format which will be used fo rsave the produced images (Default = "gif")
17  */  */
18    
19    #include <TROOT.h>
20    #include <TH1.h>
21    #include <TFile.h>
22    #include <TObjArray.h>
23  #include <TString.h>  #include <TString.h>
24  #include <TObjString.h>  #include <TObjString.h>
25  #include <TTree.h>  #include <TTree.h>
# Line 52  void TofScan(TString base, TString outDi Line 58  void TofScan(TString base, TString outDi
58       file->Close();       file->Close();
59       return;       return;
60     }     }
     
    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);  
     
61    
62     /*     /*
63      * Array to convert hdc/adc to the real Photomultiplier      * Array to convert hdc/adc to the real Photomultiplier
# Line 94  void TofScan(TString base, TString outDi Line 96  void TofScan(TString base, TString outDi
96       "S32_1A", "S32_1B", "S32_2A", "S32_2B", "S32_3A", "S32_3B"       "S32_1A", "S32_1B", "S32_2A", "S32_2B", "S32_3A", "S32_3B"
97     };     };
98        
99     int i  = 0;     const Int_t nh = 48;
100       TH1F *htdc[nh];
101       TH1F *hadc[nh];
102      
103       TObjArray *hhtdc = new TObjArray(nh);
104       TObjArray *hhadc = new TObjArray(nh);
105       char tdcname[48]="";
106       char adcname[48]="";
107      
108     int j  = 0;     int j  = 0;
109     int k  = 0;     int k  = 0;
110     int z  = 0;     int z  = 0;
111     int ch = 0;     int ch = 0;
112     int hb = 0;     int hb = 0;
113         int ind =0;
114     while(i < nevents){  
115    
116       for (int i=0; i < nevents; i++){
117    
118       TofBr->GetEntry(i);       TofBr->GetEntry(i);
119    
120       k = 0;       k = 0;
121       while (k < 24){       while (k < 24){
122         j = 0;         j = 0;
123         while (j < 2){         while (j < 2){
124           ch = tof[2*j][k]     - 1;           ch = tof[2*j][k]     - 1;
125           hb = tof[2*j + 1][k] - 1;           hb = tof[2*j + 1][k] - 1;
126           tdcHisto->Fill(tofEvent->tdc[ch][hb], 2*k + j);           ind = 2*k + j;
127           adcHisto->Fill(tofEvent->adc[ch][hb], 2*k + j);  
128             if(i==0){
129               sprintf(tdcname,"TDChist%4.4d",ind);
130               sprintf(adcname,"ADChist%4.4d",ind);
131          
132               htdc[ind] = new TH1F(tdcname,tdcname,409,0,4096);
133               hadc[ind] = new TH1F(adcname,adcname,409,0,4096);
134          
135               hhtdc->Add(htdc[ind]);
136               hhadc->Add(hadc[ind]);
137             }
138    
139             htdc[ind]->Fill(tofEvent->tdc[ch][hb]);
140             hadc[ind]->Fill(tofEvent->adc[ch][hb]);
141            
142           j++;           j++;
143         }         }
144         k++;         k++;
145       }       }
      i++;  
146     }     }
         
    TH1D       *tpADC = 0;  
    TH1D       *tpTDC = 0;  
    TH1D       *tpADCall = 0;  
    TH1D       *tpTDCall = 0;  
147        
148     float *X       = new float[48];     float *X       = new float[48];
149     float *means   = new float[48];     float *means   = new float[48];
150     float *entries = new float[48];     float *entries = new float[48];
151     int *entriestdc = new int[48];     int *entriestdc = new int[48];
152     int *entriesadc = new int[48];     int *entriesadc = new int[48];
153      
154     const char *saveas = format;     const char *saveas = format;
   
    // all range ADC/TDC  
155        
156     j = 0;     int i=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++;  
       
    }  
157        
158     gStyle->SetStatW(0.4);     gStyle->SetStatW(0.4);
159     gStyle->SetStatH(0.4);     gStyle->SetStatH(0.4);
# Line 166  void TofScan(TString base, TString outDi Line 163  void TofScan(TString base, TString outDi
163        
164     TCanvas *SCanvas = new TCanvas("SCanvas","SCanvas", 1280, 1024);     TCanvas *SCanvas = new TCanvas("SCanvas","SCanvas", 1280, 1024);
165     SCanvas->Divide(4,2);     SCanvas->Divide(4,2);
166    
167     j = 0;     j = 0;
168     while (j < 12){     while (j < 12){
169       k = 0;       k = 0;
# Line 184  void TofScan(TString base, TString outDi Line 182  void TofScan(TString base, TString outDi
182         X[i] = i;         X[i] = i;
183                
184         SCanvas->cd(k+3+z);         SCanvas->cd(k+3+z);
185         tpTDC = tdcHisto->ProjectionX(" ", i+1, i+1);         htdc[i] = (TH1F*)hhtdc->At(i);  
186           entriestdc[i] = (Int_t)htdc[i]->Integral();
187         sst.str("");         sst.str("");
188         sst << "TDC - " << photoS[i].Data() << " (Nev < 4096 = " << entriestdc[i] << ")";         sst << "TDC - " << photoS[i].Data() << " (Nev < 4096 = " << entriestdc[i] << ")";
189         tpTDC->SetTitle(sst.str().c_str());         htdc[i]->SetTitle(sst.str().c_str());
190         tpTDC->SetTitleSize(10);         htdc[i]->SetTitleSize(10);
191         tpTDC->SetAxisRange(690,1510);         htdc[i]->SetAxisRange(690,1510);
192         tpTDC->DrawCopy();         htdc[i]->DrawCopy();
193         tpTDC->ComputeIntegral();         htdc[i]->ComputeIntegral();
194         entries[i] = tpTDC->Integral();         entries[i] = htdc[i]->Integral();
195                
196         SCanvas->cd(k+1+z);               SCanvas->cd(k+1+z);      
197         tpADC = adcHisto->ProjectionX(" ", i+1, i+1);         hadc[i] = (TH1F*)hhadc->At(i);
198           entriesadc[i] = (Int_t)hadc[i]->Integral();
199         sst.str("");         sst.str("");
200         sst << "ADC - " << photoS[i].Data() << " (Nev < 4096 = " << entriesadc[i] << ")";         sst << "ADC - " << photoS[i].Data() << " (Nev < 4096 = " << entriesadc[i] << ")";
201         tpADC->SetTitle(sst.str().c_str());         hadc[i]->SetTitle(sst.str().c_str());
202         tpADC->SetAxisRange(-10,710);         hadc[i]->SetAxisRange(-10,710);
203         tpADC->DrawCopy();         hadc[i]->DrawCopy();
204         means[i]   = tpADC->GetMean();         means[i]   = hadc[i]->GetMean();
205                
206         k++;         k++;
207       }       }
208        
209    
210       if ( !strcmp(saveas,"ps") ) {       if ( !strcmp(saveas,"ps") ) {
211         sst.str("");         sst.str("");
212         sst << outDirectory.Data() << filename.Data() << "TOFScan.ps(";         sst << outDirectory.Data() << filename.Data() << "TOFScan.ps(";
# Line 217  void TofScan(TString base, TString outDi Line 219  void TofScan(TString base, TString outDi
219       }       }
220       j++;       j++;
221     }     }
222    
223     if (gROOT->IsBatch()) SCanvas->Close();     if (gROOT->IsBatch()) SCanvas->Close();
224        
225     /*     /*

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.23