for pass0
authoralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 6 Jun 2011 07:21:29 +0000 (07:21 +0000)
committeralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 6 Jun 2011 07:21:29 +0000 (07:21 +0000)
T0/AliT0CalibSeasonTimeShift.cxx
T0/AliT0CalibTimeEq.cxx
T0/AliT0PreprocessorOffline.cxx

index 8a28080..fcb11cd 100644 (file)
@@ -109,7 +109,7 @@ Bool_t AliT0CalibSeasonTimeShift::SetT0Par(const char* filePhys, Float_t *cdbtim
   // compute online equalized time
   Float_t mean, sigma;
   Bool_t ok=false;
-
+  TH1F *cfd = NULL;
   gFile = TFile::Open(filePhys);
   if(!gFile) {
     AliError("No input PHYS data found ");
@@ -122,22 +122,21 @@ Bool_t AliT0CalibSeasonTimeShift::SetT0Par(const char* filePhys, Float_t *cdbtim
       AliWarning(Form("no Tzero Directory in file collected "));
       return ok;
     }
-    TObjArray * TzeroObj = (TObjArray*) dr->Get("fTzeroObject");
-    if(!TzeroObj) { 
-      AliWarning(Form("no Tzero Object in file collected "));
-      return ok;
-    }
+    TObjArray * TzeroObj = (TObjArray*) dr->Get("T0Calib");
     TString histname[4]={"fTzeroORAplusORC", "fTzeroORA", "fTzeroORC",  "fResolution"};
     for (Int_t i=0; i<4; i++)
       {
-         TH1F *cfd = (TH1F*)TzeroObj->FindObject( histname[i].Data());
-         gFile->Get(histname[i].Data());
-         if(!cfd) AliWarning(Form("no histograms collected for %s", histname[i].Data()));
-         if(cfd) {
+       if(cfd) cfd->Reset();
+       if(TzeroObj) 
+         cfd = (TH1F*)TzeroObj->FindObject( histname[i].Data());
+       else
+         dr->Get(histname[i].Data());
+       if(!cfd) AliWarning(Form("no histograms collected for %s", histname[i].Data()));
+       if(cfd) {
            //      printf(" T0s: %i %s mean %f  rms %f  \n", i, histname[i].Data(),cfd->GetMean , cfd ->GetRMS() ); 
            GetMeanAndSigma(cfd, mean, sigma);
-           if (sigma == 0 || sigma > 500) ok = false;
-           else
+           if (sigma == 0 || sigma > 500 || cfd->GetEntries()<500 ) ok = false;
+           if ( sigma > 0 && sigma < 500 && cfd->GetEntries()>500)
              { 
                fMeanPar[i] = cdbtime[i] +  mean;
                fSigmaPar[i] = sigma;
@@ -156,7 +155,7 @@ Bool_t AliT0CalibSeasonTimeShift::SetT0Par(const char* filePhys, Float_t *cdbtim
 //________________________________________________________________________
 void AliT0CalibSeasonTimeShift::GetMeanAndSigma(TH1F* hist,  Float_t &mean, Float_t &sigma) {
 
-  const double window = 5.;  //fit window 
+  const double window = 3.;  //fit window 
  
   double meanEstimate, sigmaEstimate; 
   int maxBin;
@@ -165,7 +164,7 @@ void AliT0CalibSeasonTimeShift::GetMeanAndSigma(TH1F* hist,  Float_t &mean, Floa
   sigmaEstimate = hist->GetRMS();
   TF1* fit= new TF1("fit","gaus", meanEstimate - window*sigmaEstimate, meanEstimate + window*sigmaEstimate);
   fit->SetParameters(hist->GetBinContent(maxBin), meanEstimate, sigmaEstimate);
-  hist->Fit("fit","R");
+  hist->Fit("fit","RQ","Q");
 
   mean  = (Float_t) fit->GetParameter(1);
   sigma = (Float_t) fit->GetParameter(2);
index ca16422..d6207c8 100644 (file)
@@ -202,6 +202,9 @@ Bool_t AliT0CalibTimeEq::ComputeOfflineParams(const char* filePhys, Float_t *tim
   Double_t rmsver=0;
   Int_t nent=0;
   Bool_t ok=false;
+  TH1F *cfddiff = NULL; 
+  TH1F *cfdtime = NULL;
+
   gFile = TFile::Open(filePhys);
   if(!gFile) {
     AliError("No input PHYS data found ");
@@ -209,22 +212,28 @@ Bool_t AliT0CalibTimeEq::ComputeOfflineParams(const char* filePhys, Float_t *tim
   }
   else
     {
-
       meandiff = sigmadiff =  meanver = meancfdtime = sigmacfdtime =0;
       ok=true;
       TDirectory *dr = (TDirectory*) gFile->Get("T0Calib");
       if (!dr ) { AliError("No input T0calib found "); 
        return ok;
       }
-      TObjArray * TzeroObj = (TObjArray*) dr->Get("fTzeroObject");
+      TObjArray * TzeroObj = (TObjArray*) dr->Get("T0Calib");
+
       for (Int_t i=0; i<24; i++)
        {
          if (i != badpmt) {
-         TH1F *cfddiff = (TH1F*)TzeroObj->At(i);
-         TH1F *cfdtime = (TH1F*)TzeroObj->At(i+24);
-         if(!cfddiff) AliWarning(Form("no Diff histograms collected by PHYS DA for channel %i", i));
-         //      printf(" i = %d buf1 = %s\n", i, buf1);
-         if(!cfdtime) AliWarning(Form("no CFD histograms collected by PHYS DA for channel %i", i));
+           if(TzeroObj) {
+             cfddiff = (TH1F*)TzeroObj->FindObject(Form("CFD1minCFD%d",i+1));
+             cfdtime = (TH1F*)TzeroObj->FindObject(Form("CFD1minCFD%d",i+1));
+           }
+           else
+             {
+               cfddiff = (TH1F*)dr->Get(Form("CFD1minCFD%d",i+1));
+               cfdtime = (TH1F*)dr->Get(Form("CFD1minCFD%d",i+1));
+             }
+           if(!cfddiff) AliWarning(Form("no Diff histograms collected by pass0 for channel %i", i));
+           if(!cfdtime) AliWarning(Form("no CFD histograms collected by pass0 %i", i));
          if(cfddiff) {
            nent = Int_t(cfddiff->GetEntries());
            if(nent>500 )  { //!!!!!
@@ -246,6 +255,7 @@ Bool_t AliT0CalibTimeEq::ComputeOfflineParams(const char* filePhys, Float_t *tim
                AliWarning(Form(" Not  enouph data in PMT %i- PMT1:  %i ", i, nent));
              }
          }         
+         
          if(cfdtime) {
            nent = Int_t(cfdtime->GetEntries());
            if(nent>500 )  { //!!!!!
@@ -266,21 +276,14 @@ Bool_t AliT0CalibTimeEq::ComputeOfflineParams(const char* filePhys, Float_t *tim
                AliWarning(Form(" Not  enouph data in PMT in CFD peak %i - %i ", i, nent));
              }
          }
+         
          SetTimeEq(i,timecdb[i] + meandiff);
          SetTimeEqRms(i,sigmadiff);
          SetCFDvalue(i,0,cfdvalue[i] );
-         if (cfddiff) delete cfddiff;
-         if (cfdtime) delete cfdtime;
+         if (cfddiff) cfddiff->Reset();
+         if (cfdtime) cfdtime->Reset();
          } //bad pmt
        }
-      TH1F *ver = (TH1F*) gFile->Get("hVertex");
-      if(!ver) AliWarning("no T0 histogram collected by PHYS DA ");
-      if(ver) {
-       meanver = ver->GetMean();
-       rmsver = ver->GetRMS();
-      }
-      SetMeanVertex(meanver);
-      SetRmsVertex(rmsver);
       
       gFile->Close();
       delete gFile;
index c45b90e..40ca9a5 100644 (file)
@@ -46,12 +46,11 @@ ClassImp(AliT0PreprocessorOffline)
 //____________________________________________________
 AliT0PreprocessorOffline::AliT0PreprocessorOffline():
 TNamed("AliT0PreprocessorOffline","AliT0PreprocessorOffline"),
-  startRun(0),                         // start Run - used to make fast selection in THnSparse
-  endRun(0),                           // end   Run - used to make fast selection in THnSparse
-  startTime(0),                        // startTime - used to make fast selection in THnSparse
-  endTime(0),                          // endTime   - used to make fast selection in THnSparse
-  ocdbStorage("")                  // path to the OCDB storage
-  
+  startRun(0),      
+  endRun(0),  
+  startTime(0),    
+  endTime(0),     
+  ocdbStorage("")  
 {
   //constructor
 }
@@ -113,16 +112,16 @@ void AliT0PreprocessorOffline::CalibOffsetChannels(TString filePhysName, Int_t u
        timecdb = clb->GetTimeEq();
        cfdvalue = clb->GetCFDvalue();
        for (Int_t i=0; i<24; i++) {
-        if( cfdvalue[i] < 500 ) cfdvalue[i] =( 1000.*fLatencyHPTDC - 1000.*fLatencyL1 + 1000.*fGRPdelays)/24.4;
+        if( cfdvalue[i] < 500 || cfdvalue[i] > 30000) cfdvalue[i] =( 1000.*fLatencyHPTDC - 1000.*fLatencyL1 + 1000.*fGRPdelays)/24.4;
         printf("Calc  mean CFD time %i %f \n",i,cfdvalue[i]);
        }
     }
-  AliCDBEntry *entryCalibreco = AliCDBManager::Instance()->Get("T0/Calib/RecoParam");
-  if(entryCalibreco) {
-    AliT0RecoParam *rpr = (AliT0RecoParam*) entryCalibreco->GetObject();
-    badpmt = rpr->GetRefPoint();
-    printf(" bad PMT %i \n", badpmt);
-  }
+  //AliCDBEntry *entryCalibreco = AliCDBManager::Instance()->Get("T0/Calib/RecoParam");
+  //  if(entryCalibreco) {
+  //  AliT0RecoParam *rpr = (AliT0RecoParam*) entryCalibreco->GetObject();
+    //    badpmt = rpr->GetRefPoint();
+    badpmt = -1;
+    // }
   AliT0CalibTimeEq *offline = new AliT0CalibTimeEq();
   Bool_t writeok = offline->ComputeOfflineParams(filePhysName.Data(), timecdb, cfdvalue, badpmt);
   AliCDBMetaData metaData;
@@ -171,9 +170,9 @@ void AliT0PreprocessorOffline::CalibT0sPosition(TString filePhysName, Int_t usta
   
   if (writeok)  {
     AliCDBId* id1=NULL;
-       id1=new AliCDBId("T0/Calib/TimeAdjust", ustartRun, uendRun);
-       AliCDBStorage* gStorage = AliCDBManager::Instance()->GetStorage(ocdbStorage);
-       gStorage->Put(offline, (*id1), &metaData);
+    id1=new AliCDBId("T0/Calib/TimeAdjust", ustartRun, uendRun);
+    AliCDBStorage* gStorage = AliCDBManager::Instance()->GetStorage(ocdbStorage);
+    gStorage->Put(offline, (*id1), &metaData);
   }
 
 }