]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - T0/AliT0PreprocessorOffline.cxx
Moving the copy constructors and assignment operators to private: and removing the...
[u/mrichter/AliRoot.git] / T0 / AliT0PreprocessorOffline.cxx
index 907a8e299da6dc4cdcfb2a3291e17567986e4f6c..f8a1c63841fb4795fb07bcccafa7b409f8f508f5 100644 (file)
 #include "AliCDBStorage.h"
 #include "AliCDBMetaData.h"
 #include "AliCDBManager.h"
+#include "AliCTPTimeParams.h"
+#include "AliLHCClockPhase.h"
 #include "AliT0CalibSeasonTimeShift.h"
-
+#include "AliT0CalibLatency.h"
 #include "AliCDBEntry.h"
 #include "AliLog.h"
 
@@ -44,11 +46,12 @@ 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(""),
+  fNewDArun(9999999)
   
 {
   //constructor
@@ -63,7 +66,8 @@ AliT0PreprocessorOffline::~AliT0PreprocessorOffline()
 //____________________________________________________
 void AliT0PreprocessorOffline::Process(TString filePhysName, Int_t ustartRun, Int_t uendRun, TString pocdbStorage)
 {
-  CalibOffsetChannels(filePhysName, ustartRun, uendRun, pocdbStorage);
+  if ( ustartRun < fNewDArun)
+    CalibOffsetChannels(filePhysName, ustartRun, uendRun, pocdbStorage);
   CalibT0sPosition(filePhysName, ustartRun, uendRun, pocdbStorage);
 }
 //____________________________________________________
@@ -71,81 +75,60 @@ void AliT0PreprocessorOffline::Process(TString filePhysName, Int_t ustartRun, In
 void AliT0PreprocessorOffline::CalibOffsetChannels(TString filePhysName, Int_t ustartRun, Int_t uendRun, TString pocdbStorage)
 {
 
-  Float_t *timecdb = 0x0;
-  for (Int_t i=0; i<24; i++)  timecdb[i]=999;
-  Int_t badpmt=0;
+  Float_t zero_timecdb[24]={0};
+  Float_t *timecdb = zero_timecdb;
+  Float_t *cfdvalue = zero_timecdb;
+  Int_t badpmt=-1;
   //Processing data from DAQ Physics run
   AliInfo("Processing Time Offset between channels");
-
-  if (filePhysName)
-    {
-   if (pocdbStorage.Length()>0) ocdbStorage=pocdbStorage;
+  if (pocdbStorage.Length()>0) ocdbStorage=pocdbStorage;
   else
-  ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB";
-   //      AliCDBManager* man = AliCDBManager::Instance();
-      // man->SetDefaultStorage("raw://");
-   //   man->SetDefaultStorage("ocdbStorage");
-   //     man->SetRun(ustartRun);
-      AliCDBEntry *entryCalib = AliCDBManager::Instance()->Get("T0/Calib/TimeDelay");
-      if(!entryCalib) {
-       AliWarning(Form("Cannot find any AliCDBEntry for [Calib, TimeDelay]!"));
-      }
-      else
-       {
-         AliT0CalibTimeEq *clb = (AliT0CalibTimeEq*)entryCalib->GetObject();
-         timecdb = clb->GetTimeEq();
-       }
-      AliCDBEntry *entryCalibreco = AliCDBManager::Instance()->Get("T0/Calib/RecoParam");
-      if(entryCalibreco) {
-       AliT0RecoParam *rpr = (AliT0RecoParam*) entryCalibreco->GetObject();
-       badpmt = rpr->GetRefPoint();
-       printf(" bad PMT %i \n", badpmt);
-      }
-      AliT0CalibTimeEq *offline = new AliT0CalibTimeEq();
-      offline->Reset();
-      Bool_t writeok = offline->ComputeOfflineParams(filePhysName.Data(), timecdb, badpmt);
-      AliCDBMetaData metaData;
-      metaData.SetBeamPeriod(1);
-      metaData.SetResponsible("Alla Maevskaya");
-      metaData.SetComment("Time equalizing result with slew");
-      
-      if (writeok)  {
-       AliCDBId* id1=NULL;
-       id1=new AliCDBId("T0/Calib/TimeDelay", ustartRun, uendRun );
-       AliCDBStorage* gStorage = AliCDBManager::Instance()->GetStorage(ocdbStorage);
-       gStorage->Put(offline, (*id1), &metaData);
-      }
-      else {
-       
-          AliWarning(Form("writeok = %d data is not OK to be in OCDB",writeok));
+    ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB";
+  AliT0CalibTimeEq *offline = new AliT0CalibTimeEq();
+  Int_t writeok = offline->ComputeOfflineParams(filePhysName.Data(), timecdb, cfdvalue, badpmt);
+  printf(" AliT0PreprocessorOffline::CalibOffsetChannels :: writeok %i \n", writeok);
+  AliCDBMetaData metaData;
+  metaData.SetBeamPeriod(1);
+  metaData.SetResponsible("Alla Maevskaya");
+  metaData.SetComment("Time equalizing result with slew");
+  if (writeok<=0)  {
+    AliCDBId* id1=NULL;
+    id1=new AliCDBId("T0/Calib/TimeDelay", ustartRun, uendRun );
+    AliCDBStorage* gStorage = AliCDBManager::Instance()->GetStorage(ocdbStorage);
+    gStorage->Put(offline, (*id1), &metaData);
+  }
+  else {
+    
+    AliWarning(Form("writeok = %d data is not OK to be in OCDB",writeok));
       }                  
-   
-      delete offline;
-    }
-       
-
+  
+  delete offline;
 }
 //-------------------------------------------------------------------------------------
 void AliT0PreprocessorOffline::CalibT0sPosition(TString filePhysName, Int_t ustartRun, Int_t uendRun, TString pocdbStorage)
 {
- if (filePhysName)
-    {
-      if (pocdbStorage.Length()>0) ocdbStorage=pocdbStorage;
-      else
-       ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB";
-      
-      AliT0CalibSeasonTimeShift *offline = new AliT0CalibSeasonTimeShift();
-      Bool_t writeok = offline->SetT0Par(filePhysName.Data());
-      AliCDBMetaData metaData;
-      metaData.SetBeamPeriod(1);
-      metaData.SetResponsible("Alla Maevskaya");
-      metaData.SetComment("Time equalizing result with slew");
-      
-      if (writeok)  {
-       AliCDBId* id1=NULL;
-       id1=new AliCDBId("T0/Calib/TimeAdjust", ustartRun, uendRun);
-       AliCDBStorage* gStorage = AliCDBManager::Instance()->GetStorage(ocdbStorage);
-       gStorage->Put(offline, (*id1), &metaData);
-      }
-    }
+  printf(" AliT0PreprocessorOffline::CalibT0sPosition \n");
+  Float_t zero_timecdb[4]={0};
+  Float_t *timecdb = zero_timecdb;
+  if (pocdbStorage.Length()>0) ocdbStorage=pocdbStorage;
+  else
+    ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB";
+  
+  AliT0CalibSeasonTimeShift *offline = new AliT0CalibSeasonTimeShift();
+  Int_t writeok = offline->SetT0Par(filePhysName.Data(), timecdb);
+  printf(" AliT0PreprocessorOffline::CalibT0sPosition :: writeok %i \n", writeok);
+  AliCDBMetaData metaData;
+  metaData.SetBeamPeriod(1);
+  metaData.SetResponsible("Alla Maevskaya");
+  metaData.SetComment("Time equalizing result with slew");
+  
+  if (writeok <= 0)  {
+    AliCDBId* id1=NULL;
+    id1=new AliCDBId("T0/Calib/TimeAdjust", ustartRun, uendRun);
+    AliCDBStorage* gStorage = AliCDBManager::Instance()->GetStorage(ocdbStorage);
+    gStorage->Put(offline, (*id1), &metaData);
+  }
+
 }