]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - T0/AliT0CalibWalk.cxx
i forgot header, sorry
[u/mrichter/AliRoot.git] / T0 / AliT0CalibWalk.cxx
index 63b99460b8ae2a80c0f90436ba94342def57cdc9..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;
@@ -114,7 +114,7 @@ Bool_t AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
       //      gFile->ls();
       TH1F* hAmp = (TH1F*) gFile->Get("hAmpLaser");
       Int_t nmips=0;
-      for (Int_t ibin=0; ibin<1000; ibin++) {
+      for (Int_t ibin=0; ibin<2000; ibin++) {
        Float_t bincont = hAmp->GetBinContent(ibin);
        if(bincont>0){ 
          mips[nmips] = hAmp->GetXaxis()->GetBinCenter(ibin);
@@ -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];
@@ -181,13 +184,25 @@ Bool_t AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
                      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();
                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,10 +215,14 @@ Bool_t AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
                  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]; 
+               xx2[im] = x2[nmips-im-1];
              }
              xx[im]=mips[im];
              
@@ -220,26 +239,46 @@ Bool_t AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
            }
          
          if(i==0) cout<<"Making graphs..."<<endl;
-                 
-         TGraph *grwalkqtc = new TGraph (nmips,x1,y1);
-         grwalkqtc->SetTitle(Form("PMT%i",i));
-         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,xx1,yy1);
-         TGraph *grqtc = new TGraph (nmips,x1,xx);
-         fQTC.AddAtAndExpand(grqtc,i);  
-         fAmpLED.AddAtAndExpand(grampled,i);
-         //      cout<<" add amp "<<i<<endl;
-
-         if(i==23)
-           cout<<"Graphs created..."<<endl;
+         
+         
+         /*
+         
+         
+         Float_t x1[50], y1[50]; 
+         Float_t x2[50], xx2[50],y2[50];
+         Float_t xx1[50],yy1[50], xx[50];
+         
+         Int_t nmips=20;
+         for (Int_t i=0; i<24; i++)
+         {
+         for (Int_t im=0; im<nmips; im++)
+         {
+         x1[im]=xx[im]=500+im*200;
+         y1[im]=0;
+         x2[im]=xx1[im]=yy1[im]=260+20*im;
+         } 
+         */      
+       TGraph *grwalkqtc = new TGraph (nmips,x1,y1);
+      grwalkqtc->SetTitle(Form("PMT%i",i));
+      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,xx1,yy1);
+      TGraph *grqtc = new TGraph (nmips,x1,xx);
+      fQTC.AddAtAndExpand(grqtc,i);     
+      fAmpLED.AddAtAndExpand(grampled,i);
+      //         cout<<" add amp "<<i<<endl;
+      
+      if(i==23)
+       cout<<"Graphs created..."<<endl;
        }
     } //if gFile exits
+
   return ok;
 }