]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - T0/AliT0CalibWalk.cxx
Fix (Yifei)
[u/mrichter/AliRoot.git] / T0 / AliT0CalibWalk.cxx
index 1138f86b3778cdb52ea954f603b292ba0d59f2cf..1dca2c32e631f33537076d1cf2a4a866d8dc12dd 100644 (file)
@@ -98,7 +98,7 @@ Bool_t AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
 {
   //make walk corerction for preprocessor
   Int_t npeaks = 20;
-  Int_t sigma=3.;
+  Int_t sigma=3;
   Bool_t down=false;
   Int_t index[20];
   Bool_t ok=true;
@@ -123,7 +123,10 @@ Bool_t AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
        }       
       }    
       
-      if (nmips<15) ok=false; 
+      if (nmips<17) {
+       ok=false;
+       return ok;
+      } 
        
       Float_t x1[50], y1[50]; 
       Float_t x2[50], xx2[50],y2[50];
@@ -137,7 +140,7 @@ Bool_t AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
       
       for (Int_t i=0; i<24; i++)
        {
-         for (Int_t im=startim; im<nmips-2; im++)
+         for (Int_t im=startim; im<nmips; im++)
            {         
              TString cfd = Form("hCFD%i_%i",i+1,im+1);
              TString qtc = Form("hQTC%i_%i",i+1,im+1);
@@ -146,7 +149,6 @@ Bool_t AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
              TH1F *hCFD = (TH1F*) gFile->Get(cfd.Data()) ;
              TH1F *hLED = (TH1F*) gFile->Get(led.Data());
              TH1F *hQTC = (TH1F*) gFile->Get(qtc.Data()) ;
-             printf(" hist get %d %d\n", i,im); 
              hCFD->SetDirectory(0);
              hQTC->SetDirectory(0);
              hLED->SetDirectory(0);
@@ -166,7 +168,6 @@ Bool_t AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
                  Float_t xp = xpeak[index[0]];
                  Double_t hmax = xp+3*sigma;
                  Double_t hmin = xp-3*sigma;
-                 cout<<i<<" "<<im<<" CFD  "<<xp<<endl;
                  hCFD->GetXaxis()->SetRangeUser(hmin-10,hmax+10);
                }
                else
@@ -180,18 +181,28 @@ Bool_t AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
                      Float_t xp = xpeak[index[0]];
                      Double_t hmax = xp+3*sigma;
                      Double_t hmin = xp-3*sigma;
-                     cout<<" CFD "<<xpeak<<" "<<xp<<endl;
                      hCFD->GetXaxis()->SetRangeUser(hmin-10,hmax+10);
                    }
                    else 
-                     ok=false;
+                     {
+                       ok=false;
+                       printf("no peak in CFD spectrum for PMT %i amplitude %i\n",i,im);
+                       return ok;
+                     }
+
                  }
 
                if (im == 0) cfd0[i] = hCFD->GetMean();
-               cout<<i<<" "<<im<<"CFD ok "<<ok<<endl; 
                y1[im] =  hCFD->GetMean() - cfd0[i];
              }
-             if( hQTC) x1[im] = hQTC->GetMean();
+             if( hQTC) {
+               x1[im] = hQTC->GetMean();
+               if( x1[im] == 0) {
+                 ok=false;
+                 printf("no peak in QTC signal for PMT %i amplitude %i\n",i,im);
+                 return ok;
+                 }
+             }
              
              if( hLED){
                TSpectrum *s = new TSpectrum(2*npeaks,1);
@@ -200,16 +211,18 @@ Bool_t AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
                  Float_t *xpeak = s->GetPositionX();
                  TMath::Sort(nfound, xpeak, index,down);
                  Float_t xp = xpeak[index[0]];
-                 cout<<i<<" "<<im<<" LED "<<xp<<endl;
                  Double_t hmax = xp+10*sigma;
                  Double_t hmin = xp-10*sigma;
                  hLED->GetXaxis()->SetRangeUser(hmin-10,hmax+10);
                }
-               else 
-                 ok=false;
+               else
+                 { 
+                   ok=false;
+                   printf("no peak in LED spectrum for PMT %i amplitude %i\n",i,im);
+                   return ok;
+                 }
                x2[im] = hLED->GetMean();
                xx2[im] = x2[nmips-im-1];
-               cout<<"LED ok "<<ok<<endl; 
              }
              xx[im]=mips[im];
              
@@ -246,18 +259,17 @@ Bool_t AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
          x2[im]=xx1[im]=yy1[im]=260+20*im;
          } 
          */      
-      Bool_t ok=true;
-      TGraph *grwalkqtc = new TGraph (nmips-2,x1,y1);
+       TGraph *grwalkqtc = new TGraph (nmips,x1,y1);
       grwalkqtc->SetTitle(Form("PMT%i",i));
-      TGraph *grwalkled = new TGraph (nmips-2,x2,y1);
+      TGraph *grwalkled = new TGraph (nmips,x2,y1);
       grwalkled->SetTitle(Form("PMT%i",i));
       fWalk.AddAtAndExpand(grwalkqtc,i);
       fAmpLEDRec.AddAtAndExpand(grwalkled,i);
       //         cout<<" add walk "<<i<<endl;
       
       //fit amplitude graphs to make comparison wth new one      
-      TGraph *grampled = new TGraph (nmips-2,xx1,yy1);
-      TGraph *grqtc = new TGraph (nmips-2,x1,xx);
+      TGraph *grampled = new TGraph (nmips,xx1,yy1);
+      TGraph *grqtc = new TGraph (nmips,x1,xx);
       fQTC.AddAtAndExpand(grqtc,i);     
       fAmpLED.AddAtAndExpand(grampled,i);
       //         cout<<" add amp "<<i<<endl;
@@ -266,7 +278,7 @@ Bool_t AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
        cout<<"Graphs created..."<<endl;
        }
     } //if gFile exits
-  ok=true;
+
   return ok;
 }