/[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.5 by mocchiut, Fri Jan 17 15:10:36 2014 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    * Modified by W. Menn to select helium particles for PMT gain check
10    * Date 09 Aug 2007
11    * Last version 08 Oct 2007
12  *  *
13  * Description:  * Description:
14  * Describe the performance of the TOF.  * Describe the performance of the TOF.
# Line 14  Line 19 
19  *       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")
20  */  */
21    
22    #include <TROOT.h>
23    #include <TH1.h>
24    #include <TFile.h>
25    #include <TObjArray.h>
26  #include <TString.h>  #include <TString.h>
27  #include <TObjString.h>  #include <TObjString.h>
28  #include <TTree.h>  #include <TTree.h>
# Line 24  Line 33 
33  #include <TPaveText.h>  #include <TPaveText.h>
34  #include <TCanvas.h>  #include <TCanvas.h>
35  #include <physics/tof/TofEvent.h>  #include <physics/tof/TofEvent.h>
36    #include <cstdlib>
37    #include <sys/stat.h>
38    #include <math.h>
39  #include <iostream>  #include <iostream>
40    #include <fstream>
41    
42  using namespace std;  using namespace std;
43    
44  void TofScan(TString base, TString outDirectory = "", TString format = ""){  void TofScan(TString base, TString outDirectory = "", TString format = ""){
# Line 52  void TofScan(TString base, TString outDi Line 64  void TofScan(TString base, TString outDi
64       file->Close();       file->Close();
65       return;       return;
66     }     }
     
    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);  
     
67    
68     /*     /*
69      * 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 102  void TofScan(TString base, TString outDi
102       "S32_1A", "S32_1B", "S32_2A", "S32_2B", "S32_3A", "S32_3B"       "S32_1A", "S32_1B", "S32_2A", "S32_2B", "S32_3A", "S32_3B"
103     };     };
104        
105     int i  = 0;     const Int_t nh = 48;
106       TH1F *htdc[nh];
107       TH1F *hadc[nh];
108      
109       TObjArray *hhtdc = new TObjArray(nh);
110       TObjArray *hhadc = new TObjArray(nh);
111       char tdcname[48]="";
112       char adcname[48]="";
113    
114       char htitle[50];
115       TH1F *adche[48];
116       for(int i=0;i<48;i++) {
117       sprintf(htitle, "adche_%d",(i+1));
118       adche[i] = new TH1F(htitle,htitle,100,0.,1500.);
119                             }
120    
121    
122       Float_t adca[48];  // vector with adc values according to "ind"=pmt_id
123       Float_t tdca[48];  // the same for tdc
124      
125     int j  = 0;     int j  = 0;
126     int k  = 0;     int k  = 0;
127     int z  = 0;     int z  = 0;
128     int ch = 0;     int ch = 0;
129     int hb = 0;     int hb = 0;
130         int ind =0;
131     while(i < nevents){  
132       int heevent =0;
133    
134    // upper and lower limits  for the helium selection
135    Float_t A_l[24]={200,190,300,210,220,200,210,60, 60, 120,220,120,160,50, 300,200,120,250,350,300,350,250,280,300};
136    Float_t A_h[24]={550,490,800,600,650,600,600,260,200,380,620,380,550,200,850,560,400,750,900,800,880,800,750,800};
137    
138    // The k1 constants for the beta calculation, only for S1-S3
139    // k2 constant is taken to be the standard 2D/c
140    Float_t k1[72] = {50,59.3296,28.4328,-26.0818,5.91253,-19.588,-9.26316,24.7544,2.32465,
141    -50.5058,-15.3195,-39.1443,-91.2546,-58.6243,-84.5641,-63.1516,-32.2091,
142    -58.3358,13.8084,45.5322,33.2416,-11.5313,51.3271,75,-14.1141,
143    42.8466,15.1794,-63.6672,-6.07739,-32.164,-41.771,10.5274,-9.46096,
144    -81.7404,-28.783,-52.7167,-127.394,-69.6166,-93.4655,-98.9543,-42.863,
145    -67.8244,-19.3238,31.1221,8.7319,-43.1627,5.55573,-14.4078,-83.4466,
146    -47.4647,-77.8379,-108.222,-75.986,-101.297,-96.0205,-63.1881,-90.1372,
147    -22.7347,8.31409,-19.6912,-7.49008,23.6979,-1.66677,1.81556,34.4668,
148    6.23693,-100,-59.5861,-90.9159,-141.639,-89.2521,-112.881} ;
149    
150    //-------------------------------------------------------------------
151    
152    
153       for (int i=0; i < nevents; i++){
154    
155       TofBr->GetEntry(i);       TofBr->GetEntry(i);
156    
157       k = 0;       k = 0;
158       while (k < 24){       while (k < 24){
159         j = 0;         j = 0;
160         while (j < 2){         while (j < 2){
161           ch = tof[2*j][k]     - 1;           ch = tof[2*j][k]     - 1;
162           hb = tof[2*j + 1][k] - 1;           hb = tof[2*j + 1][k] - 1;
163           tdcHisto->Fill(tofEvent->tdc[ch][hb], 2*k + j);           ind = 2*k + j;
164           adcHisto->Fill(tofEvent->adc[ch][hb], 2*k + j);  
165             if(i==0){
166               sprintf(tdcname,"TDChist%4.4d",ind);
167               sprintf(adcname,"ADChist%4.4d",ind);
168          
169               htdc[ind] = new TH1F(tdcname,tdcname,409,0,4096);
170               hadc[ind] = new TH1F(adcname,adcname,409,0,4096);
171          
172               hhtdc->Add(htdc[ind]);
173               hhadc->Add(hadc[ind]);
174             }
175    
176             htdc[ind]->Fill(tofEvent->tdc[ch][hb]);
177             hadc[ind]->Fill(tofEvent->adc[ch][hb]);
178             tdca[ind]=tofEvent->tdc[ch][hb];
179             adca[ind]=tofEvent->adc[ch][hb];
180           j++;           j++;
181         }         }
182         k++;         k++;
183       }       }
184       i++;  
185     }  //============   calculate beta and select helium ====================
186          
187     TH1D       *tpADC = 0;  // find hitted paddle by looking for ADC values on both sides
188     TH1D       *tpTDC = 0;  // since we looking for helium this gives decent results
189     TH1D       *tpADCall = 0;  
190     TH1D       *tpTDCall = 0;  //Int_t tof11_i,tof12_i,tof21_i,tof22_i,tof31_i,tof32_i;
191      Int_t tof11_i,tof12_i,tof31_i,tof32_i;
192    Float_t  a1,a2;
193    Int_t jj;
194    
195    //  reset values
196    tof11_i = -1;
197    tof12_i = -1;
198    //tof21_i = -1;
199    //tof22_i = -1;
200    tof31_i = -1;
201    tof32_i = -1;
202    
203        for(jj=0; jj<8; jj++){
204        a1 = adca[2*jj];
205        a2 = adca[2*jj+1];
206        if ((a1 < 3000) && (a2 < 3000)) tof11_i = jj;
207                               }
208        for(jj=0; jj<6; jj++){
209        a1 = adca[16+2*jj];
210        a2 = adca[16+2*jj+1];
211        if ((a1 < 3000) && (a2 < 3000)) tof12_i = jj;
212                               }
213        /*    for(jj=0; jj<2; jj++){
214        a1 = adca[28+2*jj];
215        a2 = adca[28+2*jj+1];
216        //    if ((a1 < 3000) && (a2 < 3000)) tof21_i = jj;
217                               }
218        for(jj=0; jj<2; jj++){
219        a1 = adca[32+2*jj];
220        a2 = adca[32+2*jj+1];
221        //    if ((a1 < 3000) && (a2 < 3000)) tof22_i = jj;
222        }*/
223        for(jj=0; jj<3; jj++){
224        a1 = adca[36+2*jj];
225        a2 = adca[36+2*jj+1];
226        if ((a1 < 3000) && (a2 < 3000)) tof31_i = jj;
227                               }
228        for(jj=0; jj<3; jj++){
229        a1 = adca[42+2*jj];
230        a2 = adca[42+2*jj+1];
231        if ((a1 < 3000) && (a2 < 3000)) tof32_i = jj;
232                               }
233    
234    
235    //----------------------------------------------------------------
236    
237    Float_t zin[6] = {53.74, 53.04, 23.94, 23.44, -23.49, -24.34};
238    Float_t  c1,c2,xhelp,xhelp1,xhelp2,ds,dist,F;
239    Float_t sw,sxw,beta_mean_tof,w_i;
240    Float_t  theta,x1,x2,y1,y2,dx,dy,dr;
241    Int_t  ihelp;
242    Int_t ipmt[4];
243    Float_t time[4];
244    Float_t beta1[4];
245    
246    // Only use events with:  S11 and S12 and S31 and S32
247    
248    if ( (tof11_i>-1) && (tof12_i>-1) && (tof31_i>-1) && (tof32_i>-1) ) {
249    
250    //  calculate zenith angle theta using the locations of the hitted paddles
251    
252    
253            Float_t tof11_x[8] = {-17.85,-12.75,-7.65,-2.55,2.55,7.65,12.75,17.85};
254            Float_t tof12_y[6] = { -13.75,-8.25,-2.75,2.75,8.25,13.75};
255    //        Float_t tof21_y[2] = { 3.75,-3.75};
256    //        Float_t tof22_x[2] = { -4.5,4.5};
257            Float_t tof31_x[3] = { -6.0,0.,6.0};
258            Float_t tof32_y[3] = { -5.0,0.0,5.0};
259    
260            //  S11 8 paddles  33.0 x 5.1 cm
261            //  S12 6 paddles  40.8 x 5.5 cm
262            //  S21 2 paddles  18.0 x 7.5 cm
263            //  S22 2 paddles  15.0 x 9.0 cm
264            //  S31 3 paddles  15.0 x 6.0 cm
265            //  S32 3 paddles  18.0 x 5.0 cm
266    
267          x1 = 0.;
268          x2 = 0.;
269          y1 = 0.;
270          y2 = 0.;
271    
272          x1 = tof11_x[tof11_i] ;
273          y1 = tof12_y[tof12_i] ;
274          x2 = tof31_x[tof31_i] ;
275          y2 = tof32_y[tof32_i] ;
276    
277          theta=0.;
278          dx=0.;
279          dy=0.;
280          dr=0.;
281    
282          dx = x1-x2;
283          dy = y1-y2;
284          dr = sqrt(dx*dx+dy*dy);
285          theta = atan(dr/77.5);
286    
287    
288          beta_mean_tof=100.;
289    
290          for (Int_t jj=0; jj< 4; jj++) beta1[jj] = 100. ;
291    
292    
293    //----------------------------------------------------------------
294    //---------  S1 - S3 ---------------------------------------------
295    //----------------------------------------------------------------
296    
297    //---------  S11 - S31 -------------------------------------------
298    
299    if ((tof11_i>-1)&&(tof31_i>-1)) {
300    
301    dist = zin[0] - zin[4];
302    c2 = (2.*0.01*dist)/(3.E08*50.E-12);
303    F = 1./cos(theta);
304    
305               ipmt[0]   = (tof11_i)*2;
306               ipmt[1]   = (tof11_i)*2+1;
307               ipmt[2]   = 36+(tof31_i)*2;
308               ipmt[3]   = 36+(tof31_i)*2+1;
309    
310       for (Int_t jj=0; jj< 4; jj++) time[jj] = tdca[(ipmt[jj])] ;
311    
312       if ((time[0]<4095)&&(time[1]<4095)&&(time[2]<4095)&&(time[3]<4095)) {
313             xhelp1 = time[0] + time[1] ;
314             xhelp2 = time[2] + time[3] ;
315             ds = xhelp1-xhelp2;
316             ihelp=0+(tof11_i)*3+tof31_i ;
317             c1 = k1[ihelp] ;
318             beta1[0] = c2*F/(ds-c1);
319    }
320    }
321    
322    //---------  S11 - S32 -------------------------------------------
323    
324    if ((tof11_i>-1)&&(tof32_i>-1)) {
325    
326    dist = zin[0] - zin[5];
327    F = 1./cos(theta);
328    c2 = (2.*0.01*dist)/(3.E08*50.E-12);
329    
330               ipmt[0]   = (tof11_i)*2;
331               ipmt[1]   = (tof11_i)*2+1;
332               ipmt[2]   = 42+(tof32_i)*2;
333               ipmt[3]   = 42+(tof32_i)*2+1;
334    
335       for (Int_t jj=0; jj< 4; jj++) time[jj] = tdca[(ipmt[jj])] ;
336    
337       if ((time[0]<4095)&&(time[1]<4095)&&(time[2]<4095)&&(time[3]<4095)) {
338             xhelp1 = time[0] + time[1] ;
339             xhelp2 = time[2] + time[3] ;
340             ds = xhelp1-xhelp2;
341             ihelp=24+(tof11_i)*3+tof32_i ;
342             c1 = k1[ihelp] ;
343             beta1[1] = c2*F/(ds-c1);
344    }
345    }
346    
347    //---------  S12 - S31 -------------------------------------------
348    
349    if ((tof12_i>-1)&&(tof31_i>-1)) {
350    
351    dist = zin[1] - zin[4];
352    F = 1./cos(theta);
353    c2 = (2.*0.01*dist)/(3.E08*50.E-12);
354    
355               ipmt[0]   = 16+(tof12_i)*2;
356               ipmt[1]   = 16+(tof12_i)*2+1;
357               ipmt[2]   = 36+(tof31_i)*2;
358               ipmt[3]   = 36+(tof31_i)*2+1;
359    
360       for (Int_t jj=0; jj< 4; jj++) time[jj] = tdca[(ipmt[jj])] ;
361    
362       if ((time[0]<4095)&&(time[1]<4095)&&(time[2]<4095)&&(time[3]<4095)) {
363             xhelp1 = time[0] + time[1] ;
364             xhelp2 = time[2] + time[3] ;
365             ds = xhelp1-xhelp2;
366             ihelp=48+(tof12_i)*3+tof31_i ;
367             c1 = k1[ihelp] ;
368             beta1[2] = c2*F/(ds-c1);
369    }
370    }
371    
372    //---------  S12 - S32 -------------------------------------------
373    
374    if ((tof12_i>-1)&&(tof32_i>-1)) {
375    
376    dist = zin[1] - zin[5];
377    F = 1./cos(theta);
378    c2 = (2.*0.01*dist)/(3.E08*50.E-12);
379    
380               ipmt[0]   = 16+(tof12_i)*2;
381               ipmt[1]   = 16+(tof12_i)*2+1;
382               ipmt[2]   = 42+(tof32_i)*2;
383               ipmt[3]   = 42+(tof32_i)*2+1;
384    
385        for (Int_t jj=0; jj< 4; jj++) time[jj] = tdca[(ipmt[jj])] ;
386    
387       if ((time[0]<4095)&&(time[1]<4095)&&(time[2]<4095)&&(time[3]<4095)) {
388             xhelp1 = time[0] + time[1] ;
389             xhelp2 = time[2] + time[3] ;
390             ds = xhelp1-xhelp2;
391             ihelp=66+(tof12_i)*3+tof32_i ;
392             c1 = k1[ihelp] ;
393             beta1[3] = c2*F/(ds-c1);
394    }
395    }
396    
397    //----------------------   calculate  beta mean -----------------
398    
399          sw=0.;
400          sxw=0.;
401          beta_mean_tof=100.;
402    
403            for (Int_t jj=0; jj<4;jj++){
404            if ((beta1[jj]>0.1) && (beta1[jj]<1.5)) {
405                w_i=1./(0.13*0.13);
406                sxw=sxw + beta1[jj]*w_i ;
407                sw =sw + w_i ;
408             }
409             }
410    
411          if (sw>0) beta_mean_tof=sxw/sw;
412    
413    } //  if tof11_i > -1 && ...... beta calculation
414    
415    
416       Float_t   beta_help = beta_mean_tof ;  // pow(beta_mean_tof,1.0) gave best results
417    
418    //-----------------------  Select helium   --------------------------
419    
420       Int_t  icount=0;
421    
422       for (jj=0; jj<24; jj++){
423       a1 = adca[2*jj]*cos(theta);
424       a2 = adca[2*jj+1]*cos(theta);
425    
426       xhelp = 100000.;
427       if ((a1 < 3000) && (a2 < 3000)) xhelp = sqrt(a1*a2);  // geometric mean
428    // if geometric mean multiplied by beta_help  is inside helium limits, increase counter
429       if ((beta_mean_tof>0.6) && (beta_mean_tof<1.1) &&
430            ((beta_help*xhelp)>A_l[jj]) && ((beta_help*xhelp)<A_h[jj])) icount++ ;
431                         }
432    
433      Int_t   iz=0;
434    //  if (icount > 3) iz=2;   // if more than three paddles see helium, then set Z=2
435      if (icount > 4) iz=2;  
436    
437    //----------------------  Z=2 fill histograms  -----------------------------
438    
439        if (iz==2) {
440    
441        heevent++;
442        for (jj=0; jj<48; jj++)  adche[jj]->Fill(adca[jj]);
443                              
444                               }  // iz0==2
445    
446    
447    //=====================  end beta and helium part ===========================
448    
449       }  //  i < nevents
450    
451    
452     float *X       = new float[48];     float *X       = new float[48];
453     float *means   = new float[48];     float *means   = new float[48];
454     float *entries = new float[48];     float *entries = new float[48];
455     int *entriestdc = new int[48];     int *entriestdc = new int[48];
456     int *entriesadc = new int[48];     int *entriesadc = new int[48];
457      
458     const char *saveas = format;     const char *saveas = format;
   
    // all range ADC/TDC  
459        
460     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++;  
       
    }  
461        
462     gStyle->SetStatW(0.4);     gStyle->SetStatW(0.4);
463     gStyle->SetStatH(0.4);     gStyle->SetStatH(0.4);
# Line 166  void TofScan(TString base, TString outDi Line 467  void TofScan(TString base, TString outDi
467        
468     TCanvas *SCanvas = new TCanvas("SCanvas","SCanvas", 1280, 1024);     TCanvas *SCanvas = new TCanvas("SCanvas","SCanvas", 1280, 1024);
469     SCanvas->Divide(4,2);     SCanvas->Divide(4,2);
470    
471     j = 0;     j = 0;
472     while (j < 12){     while (j < 12){
473       k = 0;       k = 0;
# Line 184  void TofScan(TString base, TString outDi Line 486  void TofScan(TString base, TString outDi
486         X[i] = i;         X[i] = i;
487                
488         SCanvas->cd(k+3+z);         SCanvas->cd(k+3+z);
489         tpTDC = tdcHisto->ProjectionX(" ", i+1, i+1);         htdc[i] = (TH1F*)hhtdc->At(i);  
490           entriestdc[i] = (Int_t)htdc[i]->Integral();
491         sst.str("");         sst.str("");
492         sst << "TDC - " << photoS[i].Data() << " (Nev < 4096 = " << entriestdc[i] << ")";         sst << "TDC - " << photoS[i].Data() << " (Nev < 4096 = " << entriestdc[i] << ")";
493         tpTDC->SetTitle(sst.str().c_str());         htdc[i]->SetTitle(sst.str().c_str());
494         tpTDC->SetTitleSize(10);         htdc[i]->SetTitleSize(10);
495         tpTDC->SetAxisRange(690,1510);         htdc[i]->SetAxisRange(690,1510);
496         tpTDC->DrawCopy();         htdc[i]->DrawCopy();
497         tpTDC->ComputeIntegral();         htdc[i]->ComputeIntegral();
498         entries[i] = tpTDC->Integral();         entries[i] = htdc[i]->Integral();
499                
500         SCanvas->cd(k+1+z);               SCanvas->cd(k+1+z);      
501         tpADC = adcHisto->ProjectionX(" ", i+1, i+1);         hadc[i] = (TH1F*)hhadc->At(i);
502           entriesadc[i] = (Int_t)hadc[i]->Integral();
503         sst.str("");         sst.str("");
504         sst << "ADC - " << photoS[i].Data() << " (Nev < 4096 = " << entriesadc[i] << ")";         sst << "ADC - " << photoS[i].Data() << " (Nev < 4096 = " << entriesadc[i] << ")";
505         tpADC->SetTitle(sst.str().c_str());         hadc[i]->SetTitle(sst.str().c_str());
506         tpADC->SetAxisRange(-10,710);         hadc[i]->SetAxisRange(-10,710);
507         tpADC->DrawCopy();         hadc[i]->DrawCopy();
508         means[i]   = tpADC->GetMean();         means[i]   = hadc[i]->GetMean();
509                
510         k++;         k++;
511       }       }
512        
513    
514       if ( !strcmp(saveas,"ps") ) {       if ( !strcmp(saveas,"ps") ) {
515         sst.str("");         sst.str("");
516         sst << outDirectory.Data() << filename.Data() << "TOFScan.ps(";         sst << outDirectory.Data() << filename.Data() << "TOFScan.ps(";
# Line 217  void TofScan(TString base, TString outDi Line 523  void TofScan(TString base, TString outDi
523       }       }
524       j++;       j++;
525     }     }
526    
527     if (gROOT->IsBatch()) SCanvas->Close();     if (gROOT->IsBatch()) SCanvas->Close();
528        
529     /*     /*
530      * This Canvas will represent a summary of the performances for TOF TDC/ADC channels      * This Canvas will represent a summary of the performances for TOF TDC/ADC channels
531      */      */
532     TCanvas *performanceCanvas = new TCanvas("performanceCanvas","performanceCanvas", 1280, 1024);  //   TCanvas *performanceCanvas = new TCanvas("performanceCanvas","performanceCanvas", 1280, 1024);
533     performanceCanvas->Divide(1,2);     TCanvas *performanceCanvas = new TCanvas("performanceCanvas","performanceCanvas", 1024, 1280);
534       performanceCanvas->Divide(1,3);
535        
536     gStyle->SetTitleW(.9);     gStyle->SetTitleW(.9);
537    
# Line 252  void TofScan(TString base, TString outDi Line 560  void TofScan(TString base, TString outDi
560     tdcEntries->GetYaxis()->SetTitle("TDCIntegral");     tdcEntries->GetYaxis()->SetTitle("TDCIntegral");
561     tdcEntries->GetYaxis()->CenterTitle();           tdcEntries->GetYaxis()->CenterTitle();      
562     tdcEntries->Draw("AB");     tdcEntries->Draw("AB");
563      
564    //--------- new part PMT gain check  -----------------------------
565    
566       performanceCanvas->cd(3);
567    
568    Float_t  xc[48],xmean1[48],xmeana[48];
569    Float_t xmean_arr[12][48];
570    
571    //  xmean values from 2-3 april 2007
572    
573    char date_info[]="Reference Data: apr-2007";
574    
575    Float_t  xmean[48] = {
576    491.609,509.241,400.786,530.122,699.674,555.747,521.04,486.363,
577    470.173,227.752,611.038,455.889,553.601,520.54,403.527,382.099,
578    349.697,365.113,447.653,377.667,517.815,572.932,338.501,436.681,
579    485.696,450.491,395.375,329.631,751.258,626.681,385.561,578.476,
580    374.454,356.733,641.888,562.767,582.849,521.748,527.043,505.89,
581    489.828,628.408,532.924,506.511,482.872,532.236,554.554,498.849 };
582    
583    // new 01-oct-2007
584    int channelmap[] = {0,7,3,6,2,8,1,5,3,7,3,6,1,7,2,10,
585                        10,10,10,5,0,7,0,5,0,6,1,5,
586                        2,8,3,8,2,6,1,8,
587                        11,9,11,11,9,11,4,4,4,9,9,4};
588    
589    
590    int colormap[] = {46,2,29,4,5,6,7,8,9,11,28,34};
591    //int colormap[] = {417,400,632,617,603,600,434,419,591,625,403,424};
592    
593    
594    for (Int_t j=0; j<48; j++) xmeana[j]=0.;
595    for (Int_t j=0; j<24; j++) xmeana[2*j]=xmean[2*j];
596    
597    for (Int_t i=0; i<12; i++) {
598    for (Int_t j=0; j<48; j++) {
599    xmean_arr[i][j]=0.;
600    }
601    }
602    
603    for (Int_t j=0; j<48; j++) {
604    Int_t ichan = channelmap[j];
605    xmean_arr[ichan][j]=xmean[j];
606    }
607    
608    // get results from ADC histogram
609    for (Int_t j=0; j<48; j++) {
610    xc[j]=j;
611    xmean1[j]=adche[j]->GetMean();
612    }
613    
614    
615       gStyle->SetTitleW(.5);
616       gStyle->SetTitleH(.05);
617    
618    TH2F *hr = new TH2F("frame","2-Dim",2,-0.5,47.5,2,-300.,100.);
619    hr->SetStats(kFALSE);
620    hr->GetXaxis()->CenterTitle();
621    hr->GetXaxis()->SetTitle("Photomultipliers");
622    hr->GetYaxis()->CenterTitle();  
623    hr->GetYaxis()->SetTitle("Mean ADC Difference");
624    hr->SetTitle("Difference between Reference and Actual Values");
625    hr->Draw();
626    
627    Int_t npoint=48;
628    
629    for (Int_t j=0; j<12; j++) {
630    for (Int_t i=0; i<48; i++) xmeana[i] = 0.;
631    for (Int_t i=0; i<48; i++) {
632    if (xmean_arr[j][i] != 0)  xmeana[i] = xmean1[i] - xmean_arr[j][i];
633                               }
634    
635    
636    TGraph *graph1 = new TGraph(npoint,xc,xmeana);
637    graph1->SetFillColor(colormap[j]);
638    graph1->GetXaxis()->SetLimits(-0.5, 47.5);
639    graph1->Draw("BP");
640    }
641    
642    Float_t tp[10];
643    tp[0] = 15.5;
644    tp[1] = 27.5;
645    tp[2] = 31.5;
646    tp[3] = 35.5;
647    tp[4] = 41.5;
648    
649    for (Int_t ii=0; ii<5; ii++) {
650    TLine *l1=new TLine(tp[ii],-300,tp[ii],100);
651    l1->SetLineColor(38);
652    l1->Draw("same");
653                            }
654    
655    for (Int_t j=0; j<12; j++) {
656    sprintf(htitle, "HV_%d",j);
657    TText *text1 = new TText(0+j*4,80,htitle);
658    text1->SetTextColor(colormap[j]);
659    //text1->SetTextSize(0.03);
660    text1->SetTextSize(0.05);
661    text1->Draw();
662    }
663    
664    
665    TText *text1 = new TText(0,-185,date_info);
666    text1->SetTextColor(kBlack);
667    text1->SetTextSize(0.023);
668    text1->Draw();
669    
670    
671    sprintf(htitle, "Helium Events: %d",heevent);
672    TText *text2 = new TText(20,-185,htitle);
673    text2->SetTextColor(kBlack);
674    text2->SetTextSize(0.023);
675    text2->Draw();
676    
677    
678    for (Int_t i=0; i<6; i++) {
679    for (Int_t j=0; j<8; j++) {
680    Int_t ihelp = i*8+j;
681    sprintf(htitle, "%d: %.0f/%.0f",(ihelp+1),xmean[ihelp],xmean1[ihelp]);
682    TText *text1 = new TText(0+j*6,-200-i*15,htitle);
683    text1->SetTextColor(kBlack);
684    text1->SetTextSize(0.023);
685    text1->Draw();
686    }
687    }
688    
689    //-------- end new part -------------------------
690    
691      
692     //------print the ps     //------print the ps
693    
694     if ( !strcmp(saveas,"ps") ) {     if ( !strcmp(saveas,"ps") ) {
# Line 270  void TofScan(TString base, TString outDi Line 706  void TofScan(TString base, TString outDi
706       performanceCanvas->Close();       performanceCanvas->Close();
707     }     }
708    
709    
710    
711  }  }
712    
713  int main(int argc, char* argv[]){  int main(int argc, char* argv[]){
# Line 326  int main(int argc, char* argv[]){ Line 764  int main(int argc, char* argv[]){
764     TofScan(argv[1], outDir, format);     TofScan(argv[1], outDir, format);
765    
766  }  }
767    

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

  ViewVC Help
Powered by ViewVC 1.1.23