data for new preprocessor
authoralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 6 Dec 2007 11:31:35 +0000 (11:31 +0000)
committeralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 6 Dec 2007 11:31:35 +0000 (11:31 +0000)
T0/AliT0CalibTimeEq.cxx
T0/AliT0CalibTimeEq.h
T0/AliT0CalibWalk.cxx
T0/AliT0CalibWalk.h
T0/AliT0Parameters.cxx
T0/AliT0Parameters.h
T0/Calib/TimeDelay/Run0_999999_v0_s0.root

index 128af62..f067b6a 100644 (file)
@@ -26,7 +26,6 @@
 #include "AliLog.h"
 #include "AliRun.h"
 
-#include <TCanvas.h>
 #include <TFile.h>
 #include <TMath.h>
 #include <TF1.h>
 #include <TSpectrum.h>
 #include <TVirtualFitter.h>
 #include <TProfile.h>
-
-#include <Riostream.h>
 #include <string>
 
 ClassImp(AliT0CalibTimeEq)
 
 //________________________________________________________________
-  AliT0CalibTimeEq::AliT0CalibTimeEq():   TNamed(),
-                                      fTimeDelayTVD(0),
-                                      fMeanT0(0) 
+  AliT0CalibTimeEq::AliT0CalibTimeEq():TNamed()
 {
   //
 }
 
 //________________________________________________________________
-AliT0CalibTimeEq::AliT0CalibTimeEq(const char* name):TNamed(),
-                                      fTimeDelayTVD(0),
-                                      fMeanT0(0)
+AliT0CalibTimeEq::AliT0CalibTimeEq(const char* name):TNamed()
 {
   TString namst = "Calib_";
   namst += name;
@@ -61,10 +54,7 @@ AliT0CalibTimeEq::AliT0CalibTimeEq(const char* name):TNamed(),
 }
 
 //________________________________________________________________
-AliT0CalibTimeEq::AliT0CalibTimeEq(const AliT0CalibTimeEq& calibda) :
-  TNamed(calibda),             
-  fTimeDelayTVD(0),
-  fMeanT0(0)
+AliT0CalibTimeEq::AliT0CalibTimeEq(const AliT0CalibTimeEq& calibda):TNamed(calibda)            
 {
 // copy constructor
   SetName(calibda.GetName());
@@ -107,59 +97,71 @@ void  AliT0CalibTimeEq::Print(Option_t*) const
 
 
 //________________________________________________________________
-void AliT0CalibTimeEq::ComputeOnlineParams(char* name1, char* name2, char* canv, Int_t npeaks, Double_t sigma, const char* filePhys)
+void AliT0CalibTimeEq::ComputeOnlineParams(char* name1, Int_t npeaks, Double_t sigma, const char* filePhys)
 {
   TFile *gFile = TFile::Open(filePhys);
-  gSystem->Load("libSpectrum");
-  npeaks = 20;
-  sigma=3.;
   Bool_t down=false;
   Int_t index[20];
-  TCanvas *c1 = new TCanvas(canv, canv,0,48,1280,951);
-  c1->Divide(4,3);
   Char_t buf1[15];
   Char_t temp[10];
-  Float_t p[12][3]={0.,0.,0.};
-  for (Int_t i=12; i<24; i++)
+  Float_t p[24][3]={0.,0.,0.};
+  for (Int_t i=0; i<24; i++)
+  {
+    sprintf(buf1,name1);
+    sprintf(temp,"%i",i+1);
+    strcat (buf1,temp);
+    //strcat (buf1,name2);
+    TH1F *cfd = (TH1F*) gFile->Get(buf1);
+    printf(" i = %d buf1 = %s\n", i, buf1);
+    TSpectrum *s = new TSpectrum(2*npeaks,1.);
+    printf(" buf1 = %s cfd = %x\n", buf1, cfd);
+    Int_t nfound = s->Search(cfd,sigma,"goff",0.2);
+    printf(" nfound = %d\n", nfound);
+    if(nfound!=0)
     {
-      c1->cd(i+1);
-      sprintf(buf1,name1);
-      sprintf(temp,"%i",i+1);
-      strcat (buf1,temp);
-      strcat (buf1,name2);
-      TH1F *cfd = (TH1F*) gFile->Get(buf1);
-      TSpectrum *s = new TSpectrum(2*npeaks,1.);
-      Int_t nfound = s->Search(cfd,sigma," ",0.2);
-      if(nfound!=0){
-        Float_t *xpeak = s->GetPositionX();
-        TMath::Sort(nfound, xpeak, index,down);
-        Float_t xp = xpeak[index[0]];
-        Float_t hmax = xp+3*sigma;
-        Float_t hmin = xp-3*sigma;
-        cfd->GetXaxis()->SetRange((Int_t)hmin-20,(Int_t)hmax+20);
-        TF1 *g1 = new TF1("g1", "gaus", hmin, hmax);
-              cfd->Fit("g1","IR");
-
-        for(Int_t j =0; j<3; j++){
-                p[i][j] = g1->GetParameter(j);
-                SetCFDvalue(i, j, p[i][j]);
+      Float_t *xpeak = s->GetPositionX();
+      TMath::Sort(nfound, xpeak, index,down);
+      Float_t xp = xpeak[index[0]];
+      Float_t hmax = xp+3*sigma;
+      Float_t hmin = xp-3*sigma;
+      cfd->GetXaxis()->SetRange((Int_t)hmin-20,(Int_t)hmax+20);
+      TF1 *g1 = new TF1("g1", "gaus", hmin, hmax);
+      cfd->Fit("g1","IRQN");
+      for(Int_t j =0; j<3; j++)
+      {
+        p[i][j] = g1->GetParameter(j);
+        SetCFDvalue(i, j, p[i][j]);
+      }
+
+      SetCFDvalue(i, 3, hmin);
+      SetCFDvalue(i, 4, hmax);
+
+      if (i<12)
+      {
+        SetTimeEq(i,(p[i][2]-p[0][2]));
+      }
+      else
+      {
+       SetTimeEq(i,(p[i][2]-p[12][2]));
+      }        
+    } 
+  }
+  
+   gFile->Close();
+   delete gFile;
+
+   for(int i=0;i<5;i++)
+     {
+      for(int j=0;j<24;j++)
+       {
+                printf("fCFDvalue[%d][%d]=%f\n",j,i,fCFDvalue[j][i]);
         }
-        SetCFDvalue(i, 3, hmin);
-        SetCFDvalue(i, 4, hmax);
-        SetTimeEq(i,p[i][2]);
-        // if(p[i][0]==0)
-        // cfd->Draw();
-
-        // cfd->Draw();
-      } // else
-        // cfd->Draw();
-    }
-  // TFile *onl = new TFile("onl.root","RECREATE");
-  // this->Write("Values");
-  // onl->Close();
-  // delete onl;
-  gFile->Close();
-  delete gFile;
+     }
+   printf("\n\n");
+   for(int j=0;j<24;j++)
+   {
+                printf("fTimeEq[%d]=%f\n",j,fTimeEq[j]);
+   }
 }
 
 
index 51fea49..fe362a7 100644 (file)
@@ -21,24 +21,19 @@ class AliT0CalibTimeEq: public TNamed {
   void Reset();
   
   virtual void  Print(Option_t* option= "") const; 
-  void     SetMeanT0(Int_t mean=500) { fMeanT0 = mean; };
-  Int_t    GetMeanT0 () {return fMeanT0;};
-  void     SetTimeDelayTVD(Int_t r=150)   { fTimeDelayTVD = r; };
-  Float_t  GetTimeDelayTVD()   { return fTimeDelayTVD; }
   
-  void ComputeOnlineParams(char* name1, char* name2, char* canv, Int_t npeaks, Double_t sigma, const char* filePhys);
+  void ComputeOnlineParams(char* name1, Int_t npeaks, Double_t sigma, const char* filePhys);
   Float_t  GetCFDvalue(Int_t channel,Int_t number)        const {return fCFDvalue[channel][number];}
   Float_t* GetCFDvalue()          const {return (float*)fCFDvalue;}
   Float_t  GetTimeEq(Int_t channel)        const {return fTimeEq[channel];}
   Float_t* GetTimeEq()          const {return (float*)fTimeEq;}
+  Float_t  GetMeanT0() const {return 1.;} // WARNING: USED IN AliT0Parameters!!!!
   void SetCFDvalue(Int_t channel, Int_t number, Float_t val) {fCFDvalue[channel][number]=val;}
   void SetTimeEq(Int_t channel, Float_t val) {fTimeEq[channel]=val;}
   
 
  protected:
 
-  Float_t     fTimeDelayTVD;          //time delay for TVD (vertex trigger channel)
-  Int_t       fMeanT0;                //mean of T0distribution with vertex=0;
   Float_t     fCFDvalue[24][5];       // CFD values
   Float_t     fTimeEq[24];           // Time Equalized for OCDB         
 
index 448792e..5dffa17 100644 (file)
@@ -187,9 +187,9 @@ void AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
   Bool_t down=false;
 
   Int_t index[20];
-  Char_t buf1[10], buf2[10],title[10];
+  Char_t buf1[10], buf2[10],title[10], title2[10] ;
 
-  for (Int_t i=0; i<24; i++)
+  for (Int_t i=0; i<12; i++)
   {
     sprintf(buf1,"T0_C_%i_CFD",i+1);
     sprintf(buf2,"CFD_QTC%i",i+1);
@@ -197,7 +197,7 @@ void AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
     TH2F *qtc_cfd = (TH2F*) gFile->Get(buf2);
     TH1F *cfd = (TH1F*) gFile->Get(buf1);
     TSpectrum *s = new TSpectrum(2*npeaks,1.);
-    Int_t nfound = s->Search(cfd,sigma," ",0.05);
+    Int_t nfound = s->Search(cfd,sigma,"goff",0.05);
     // cout<<"Found "<<nfound<<" peaks sigma "<<sigma<<endl;
     if(nfound!=0)
     {
@@ -239,13 +239,32 @@ void AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
       gr[i]->SetMinimum(hmin);
       gr[i]->SetMaximum(hmax);
       gr[i]->SetMarkerStyle(7);
+      sprintf(title2,"Walk %i",i+13);
+      gr[i+12] = new TGraph(np,xx,yy);
+      gr[i+12]->SetTitle(title2);
+      gr[i+12]->SetMinimum(hmin);
+      gr[i+12]->SetMaximum(hmax);
+      gr[i+12]->SetMarkerStyle(7);
+
       fWalk.AddAtAndExpand(gr[i],i);     
-       delete [] xx;
+      fWalk.AddAtAndExpand(gr[i+12],i+12);
+      delete [] xx;
       delete [] yy;
-      delete gr[i];
+//t      delete gr[i];
     }
   }
 
+//t
+  TFile *fitGraph = new TFile("qtc_cfd.root","RECREATE");
+  for (Int_t i=0; i<24; i++)
+  {
+    gr[i]->Write();
+    delete gr[i];
+  }
+  fitGraph->Close();
+  delete fitGraph;
+//t
+
   gFile->Close();
   delete gFile;
 }
index 746245b..cab5f28 100644 (file)
@@ -32,7 +32,7 @@ class AliT0CalibWalk: public TNamed {
   Float_t  GetAmpLEDRecVal(Int_t ipmt, Float_t mv)  const
     {return((TGraph*)fAmpLEDRec.At(ipmt))->Eval(mv);}
   void     SetAmpLEDRec(Int_t ipmt) ;
-    
+  TObjArray* GetfWalk() {return &fWalk;}    
    
  protected:
    
index b69fa40..b608387 100644 (file)
@@ -24,6 +24,7 @@
 // Eventually, this class will use the Conditions DB to get the
 // various parameters, which code can then request from here.
 //                                                       
+#include "AliT0.h"
 #include "AliLog.h"              
 #include "AliT0Parameters.h"     
 #include "AliT0CalibData.h"   
@@ -73,7 +74,7 @@ AliT0Parameters::AliT0Parameters()
    fTimeDelayCFD(0), 
  //  fTimeV0(0), 
    fTimeDelayTVD(0),
-   fMeanT0(500),
+   fMeanT0(510),
    fLookUp(0),
    fNumberOfTRMs(2),
    fCalibentry(), fLookUpentry(),fSlewCorr()
@@ -146,7 +147,7 @@ void AliT0Parameters::InitIfOnline()
 // for switching to this one should write
   // AliT0RawReader myrawreader(rawReader);
 //     myrawreader.SetOnlineMode(kTRUE);
-
+cout<<" AliT0Parameters::InitIfOnline() "<<endl;
   if (fIsInit) return;
    //standart configuration (used for simulation)
    //Int_t trm=0; Int_t tdc=0; Int_t chain=0; Int_t channel=0;
@@ -190,20 +191,6 @@ AliT0Parameters::GetTimeDelayCFD(Int_t ipmt)
    
   return fgCalibData->GetTimeEq(ipmt);
 }
-
-
-Int_t
-AliT0Parameters::GetMeanT0() 
-{
-  // return mean of T0 distrubution with vertex=0
-   // 
-  if (!fCalibentry) 
-    {
-      return fMeanT0;
-    }
-   
-  return fgCalibData->GetMeanT0();
-}
 //__________________________________________________________________
 
 TGraph *AliT0Parameters::GetAmpLEDRec(Int_t ipmt) const
index 189e5d4..b97d692 100644 (file)
@@ -76,8 +76,8 @@ public:
   Float_t GetTimeDelayCFD(Int_t ipmt);
 //  Float_t GetTimeV0(Int_t ipmt = 512) {return  fTimeV0;}
 
-  //  void SetMeanT0(Int_t mean=500) { fMeanT0 = mean; };
-  Int_t GetMeanT0 (); //{return fMeanT0;};
+  void SetMeanT0(Int_t mean=512) { fMeanT0 = mean; };
+  Int_t GetMeanT0 () {return fMeanT0;};
 
   TMap * GetMapLookup();
   Int_t GetChannel(Int_t trm,  Int_t tdc, Int_t chain, Int_t channel);
index 74a5865..84076ef 100644 (file)
Binary files a/T0/Calib/TimeDelay/Run0_999999_v0_s0.root and b/T0/Calib/TimeDelay/Run0_999999_v0_s0.root differ