]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - T0/AliT0CalibWalk.cxx
Removed warning
[u/mrichter/AliRoot.git] / T0 / AliT0CalibWalk.cxx
index 8d5c721aa02cca2ad8fe2ca0ee657d72c5d52b5b..7a5352dab7d8ca7ce178ccd0af74d7a1b834edd4 100644 (file)
@@ -103,6 +103,7 @@ Bool_t AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
   Int_t index[20];
   Bool_t ok=true;
   Float_t   mips[20];
+  Int_t nfound=0;
   
   gFile = TFile::Open(laserFile);
   if(!gFile) {
@@ -113,17 +114,20 @@ 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);
          cout<<ibin<<" bincont "<<bincont<<" amp "<< mips[nmips]<<endl;
          nmips++;
        }       
-      }     
-      Float_t x1[20], y1[20]; 
-      Float_t x2[20], xx2[20],y2[20];
-      Float_t xx1[20],yy1[20], xx[20];
+      }    
+      
+      if (nmips<15) ok=false; 
+       
+      Float_t x1[50], y1[50]; 
+      Float_t x2[50], xx2[50],y2[50];
+      Float_t xx1[50],yy1[50], xx[50];
       
       Float_t cfd0[24];
       Int_t startim = 0;
@@ -135,7 +139,6 @@ Bool_t AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
        {
          for (Int_t im=startim; im<nmips; im++)
            {         
-             Float_t fitmean=0;
              TString cfd = Form("hCFD%i_%i",i+1,im+1);
              TString qtc = Form("hQTC%i_%i",i+1,im+1);
              TString led = Form("hLED%i_%i",i+1,im+1);
@@ -155,7 +158,7 @@ Bool_t AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
              
              if(hCFD ) {
                TSpectrum *s = new TSpectrum(2*npeaks,1);
-               Int_t nfound = s->Search(hCFD,sigma," ",0.1);
+               nfound = s->Search(hCFD,sigma," ",0.1);
                if(nfound!=0){
                  Float_t *xpeak = s->GetPositionX();
                  TMath::Sort(nfound, xpeak, index,down);
@@ -167,10 +170,10 @@ Bool_t AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
                else
                  {
                    hCFD->Rebin(2);
-                   TSpectrum *s = new TSpectrum(2*npeaks,1);
-                   Int_t nfound = s->Search(hCFD,sigma," ",0.1);
+                   TSpectrum *s1 = new TSpectrum(2*npeaks,1);
+                   nfound = s1->Search(hCFD,sigma," ",0.1);
                    if(nfound!=0){
-                     Float_t *xpeak = s->GetPositionX();
+                     Float_t *xpeak = s1->GetPositionX();
                      TMath::Sort(nfound, xpeak, index,down);
                      Float_t xp = xpeak[index[0]];
                      Double_t hmax = xp+3*sigma;
@@ -188,7 +191,7 @@ Bool_t AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
              
              if( hLED){
                TSpectrum *s = new TSpectrum(2*npeaks,1);
-               Int_t nfound = s->Search(hLED,sigma," ",0.1);
+               nfound = s->Search(hLED,sigma," ",0.1);
                if(nfound!=0){
                  Float_t *xpeak = s->GetPositionX();
                  TMath::Sort(nfound, xpeak, index,down);
@@ -200,7 +203,7 @@ Bool_t AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
                else 
                  ok=false;
                x2[im] = hLED->GetMean();
-               xx2[im] = x2[nmips-im-1]; 
+               xx2[im] = x2[nmips-im-1];
              }
              xx[im]=mips[im];
              
@@ -217,26 +220,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
+  ok=true;
   return ok;
 }