coverity fixed
authoralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 8 Apr 2011 15:43:12 +0000 (15:43 +0000)
committeralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 8 Apr 2011 15:43:12 +0000 (15:43 +0000)
T0/AliT0CalibOffsetChannelsTask.cxx
T0/AliT0CalibSeasonTimeShift.cxx
T0/AliT0CalibSeasonTimeShift.h
T0/AliT0Calibrator.cxx
T0/AliT0PreprocessorOffline.cxx
T0/AliT0RawReader.cxx
T0/AliT0Reconstructor.cxx

index 67977fb..f6ea7ed 100644 (file)
@@ -73,9 +73,11 @@ AliT0CalibOffsetChannelsTask::~AliT0CalibOffsetChannelsTask()
   delete fTzeroORC;\r
   delete fResolution;\r
   delete fTzeroORAplusORC;\r
-  delete [] fTimeDiff;\r
-  delete [] fCFD;\r
-\r
+  for( Int_t  ip=0; ip < 24; ip++){\r
+    delete fTimeDiff[ip];\r
+    delete fCFD[ip];\r
+  }\r
+  \r
   delete fTzeroObject;\r
 }\r
 \r
@@ -106,8 +108,8 @@ void AliT0CalibOffsetChannelsTask::UserCreateOutputObjects()
   // Create histograms\r
   for (Int_t i=0; i<24; i++) {\r
     fTimeDiff[i]   = new TH1F (Form("CFD1minCFD%d",i+1),"fTimeDiff",300, -300, 300);\r
-    //   fCFD[i]        = new TH1F(Form("CFD%d",i+1),"CFD",500, 2000, 3000);//6000, 7000);\r
-    fCFD[i]        = new TH1F(Form("CFD%d",i+1),"CFD",500, -1000, 1000);//6000, 7000);\r
+    fCFD[i]        = new TH1F(Form("CFD%d",i+1),"CFD",500, 2000, 3000);//6000, 7000);\r
+    // fCFD[i]        = new TH1F(Form("CFD%d",i+1),"CFD",500, -1000, 1000);//6000, 7000);\r
   }\r
 \r
   fTzeroORAplusORC = new TH1F("fTzeroORAplusORC","ORA+ORC /2",400,-2000,2000);   //or A plus or C \r
index 828c4da..8a28080 100644 (file)
@@ -104,7 +104,7 @@ Bool_t  AliT0CalibSeasonTimeShift::SetT0Par(Float_t par[4],Float_t spar[4])
 }
 
 //________________________________________________________________
-Bool_t AliT0CalibSeasonTimeShift::SetT0Par(const char* filePhys)
+Bool_t AliT0CalibSeasonTimeShift::SetT0Par(const char* filePhys, Float_t *cdbtime)
 {
   // compute online equalized time
   Float_t mean, sigma;
@@ -116,9 +116,9 @@ Bool_t AliT0CalibSeasonTimeShift::SetT0Par(const char* filePhys)
   }
   else
     {
-      gFile->ls();
+      //    gFile->ls();
     TDirectory *dr = (TDirectory*) gFile->Get("T0Calib");
-      if (!dr) {
+    if (!dr) {
       AliWarning(Form("no Tzero Directory in file collected "));
       return ok;
     }
@@ -129,7 +129,7 @@ Bool_t AliT0CalibSeasonTimeShift::SetT0Par(const char* filePhys)
     }
     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()));
@@ -139,13 +139,13 @@ Bool_t AliT0CalibSeasonTimeShift::SetT0Par(const char* filePhys)
            if (sigma == 0 || sigma > 500) ok = false;
            else
              { 
-               fMeanPar[i] =  mean;
+               fMeanPar[i] = cdbtime[i] +  mean;
                fSigmaPar[i] = sigma;
-               printf(" T0s: %i %s %f %f  \n", i, histname[i].Data(), fMeanPar[i],fSigmaPar[i] ); 
+               //              printf(" T0s: %i %s %f %f  \n", i, histname[i].Data(), fMeanPar[i],fSigmaPar[i] ); 
                ok=true;
              }
          }
-       } 
+      } 
     
     gFile->Close();
     delete gFile;
index 3f6b8da..d52d9f9 100644 (file)
@@ -32,7 +32,8 @@ class AliT0CalibSeasonTimeShift: public TNamed {
   Float_t *GetT0Sigmas() { return fSigmaPar;};
  
   Bool_t SetT0Par(Float_t par[4],Float_t spar[4] );
-  Bool_t SetT0Par(const char* filePhys );
+  Bool_t SetT0Par(const char* filePhys , Float_t *cdbtime);
+  
   void GetMeanAndSigma(TH1F* hist, Float_t &mean, Float_t &sigma); 
 
  protected:
index 86bdd7c..d5094b1 100644 (file)
@@ -98,18 +98,11 @@ Int_t  AliT0Calibrator::WalkCorrection(Int_t refAmp,  Int_t ipmt, Int_t qt, Int_
 {
   //
   // referemce amplitude for walk correction now read from RecoParam
-
-  Double_t *grY ; 
-
   Int_t walk=0;
 
   Int_t timeEq=0, timeWalk=0;  
   TGraph *fu1=(TGraph*) fWalk.At(ipmt);
   if(fu1 && fu1->GetN()>0) {
-     grY = fu1->GetY();
-     //   fMaxValue[ipmt]=grY[refAmp-1];
-    // TGraph* fu  = param ->GetAmpLEDRec(i);
-    // walk = Int_t (fMaxValue[ipmt]) + Int_t(fu1->Eval(Double_t(qt)));
     walk = Int_t(fu1->Eval(Double_t(qt)));
   }
   
index b88345c..0a7d935 100644 (file)
@@ -65,7 +65,7 @@ AliT0PreprocessorOffline::~AliT0PreprocessorOffline()
 //____________________________________________________
 void AliT0PreprocessorOffline::Process(TString filePhysName, Int_t ustartRun, Int_t uendRun, TString pocdbStorage)
 {
-  CalibOffsetChannels(filePhysName, ustartRun, uendRun, pocdbStorage);
+  //  CalibOffsetChannels(filePhysName, ustartRun, uendRun, pocdbStorage);
   CalibT0sPosition(filePhysName, ustartRun, uendRun, pocdbStorage);
 }
 //____________________________________________________
@@ -73,104 +73,104 @@ 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, *cfdvalue;
-  for (Int_t i=0; i<24; i++) {  timecdb[i]=999; cfdvalue=0; }
+  Float_t zero_timecdb[24]={0};
+  Float_t *timecdb = zero_timecdb;
+  Float_t *cfdvalue = zero_timecdb;
   Int_t badpmt=0;
   //Processing data from DAQ Physics run
   AliInfo("Processing Time Offset between channels");
-
-  if (filePhysName)
+  if (pocdbStorage.Length()>0) ocdbStorage=pocdbStorage;
+  else
+    ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB";
+  AliCDBEntry *entry = AliCDBManager::Instance()->Get("GRP/CTP/CTPtiming");
+  if (!entry) AliFatal("CTP timing parameters are not found in OCDB !");
+  AliCTPTimeParams *ctpParams = (AliCTPTimeParams*)entry->GetObject();
+  Float_t l1Delay = (Float_t)ctpParams->GetDelayL1L0()*25.0;
+  
+  AliCDBEntry *entry1 = AliCDBManager::Instance()->Get("GRP/CTP/TimeAlign");
+  if (!entry1) AliFatal("CTP time-alignment is not found in OCDB !");
+  AliCTPTimeParams *ctpTimeAlign = (AliCTPTimeParams*)entry1->GetObject();
+  l1Delay += ((Float_t)ctpTimeAlign->GetDelayL1L0()*25.0);
+  
+  AliCDBEntry *entry4 = AliCDBManager::Instance()->Get("GRP/Calib/LHCClockPhase");
+  if (!entry4) AliFatal("LHC clock-phase shift is not found in OCDB !");
+  AliLHCClockPhase *phase = (AliLHCClockPhase*)entry4->GetObject();
+  Float_t fGRPdelays = l1Delay - phase->GetMeanPhase();
+  AliCDBEntry *entryL = AliCDBManager::Instance()->Get("T0/Calib/Latency");
+  AliT0CalibLatency *lat = (AliT0CalibLatency*)entryL->GetObject();
+  Float_t fLatencyHPTDC = lat->GetLatencyHPTDC();
+  Float_t fLatencyL1 = lat->GetLatencyL1();
+  AliCDBEntry *entryCalib = AliCDBManager::Instance()->Get("T0/Calib/TimeDelay");
+  if(!entryCalib) {
+    AliWarning(Form("Cannot find any AliCDBEntry for [Calib, TimeDelay]!"));
+  }
+  else
     {
-   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 *entry = AliCDBManager::Instance()->Get("GRP/CTP/CTPtiming");
-   if (!entry) AliFatal("CTP timing parameters are not found in OCDB !");
-   AliCTPTimeParams *ctpParams = (AliCTPTimeParams*)entry->GetObject();
-   Float_t l1Delay = (Float_t)ctpParams->GetDelayL1L0()*25.0;
-   
-   AliCDBEntry *entry1 = AliCDBManager::Instance()->Get("GRP/CTP/TimeAlign");
-   if (!entry1) AliFatal("CTP time-alignment is not found in OCDB !");
-   AliCTPTimeParams *ctpTimeAlign = (AliCTPTimeParams*)entry1->GetObject();
-   l1Delay += ((Float_t)ctpTimeAlign->GetDelayL1L0()*25.0);
-   
-   AliCDBEntry *entry4 = AliCDBManager::Instance()->Get("GRP/Calib/LHCClockPhase");
-   if (!entry4) AliFatal("LHC clock-phase shift is not found in OCDB !");
-   AliLHCClockPhase *phase = (AliLHCClockPhase*)entry4->GetObject();
-   Float_t fGRPdelays = l1Delay - phase->GetMeanPhase();
-   AliCDBEntry *entryL = AliCDBManager::Instance()->Get("T0/Calib/Latency");
-   AliT0CalibLatency *lat = (AliT0CalibLatency*)entryL->GetObject();
-   Float_t fLatencyHPTDC = lat->GetLatencyHPTDC();
-   Float_t fLatencyL1 = lat->GetLatencyL1();
-   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();
+      AliT0CalibTimeEq *clb = (AliT0CalibTimeEq*)entryCalib->GetObject();
        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;
         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);
-      }
-      AliT0CalibTimeEq *offline = new AliT0CalibTimeEq();
-      offline->Reset();
-      Bool_t writeok = offline->ComputeOfflineParams(filePhysName.Data(), timecdb, cfdvalue, badpmt);
-      AliCDBMetaData metaData;
-      metaData.SetBeamPeriod(1);
-      metaData.SetResponsible("Alla Maevskaya");
-      metaData.SetComment("Time equalizing result with slew");
+    }
+  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();
+  Bool_t writeok = offline->ComputeOfflineParams(filePhysName.Data(), timecdb, cfdvalue, 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));
+  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));
       }                  
-   
-      delete offline;
-    }
-       
-
+  
+  delete offline;
 }
 //-------------------------------------------------------------------------------------
 void AliT0PreprocessorOffline::CalibT0sPosition(TString filePhysName, Int_t ustartRun, Int_t uendRun, TString pocdbStorage)
 {
-  if (filePhysName)
+  Float_t zero_timecdb[4]={0};
+  Float_t *timecdb = zero_timecdb;
+  if (pocdbStorage.Length()>0) ocdbStorage=pocdbStorage;
+  else
+    ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB";
+  AliCDBEntry *entryCalib = AliCDBManager::Instance()->Get("T0/Calib/TimeAdjust");
+  if(!entryCalib) {
+    AliWarning(Form("Cannot find any AliCDBEntry for [Calib, TimeAdjust]!"));
+  }
+  else
     {
-      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;
+      AliT0CalibSeasonTimeShift *clb = (AliT0CalibSeasonTimeShift*)entryCalib->GetObject();
+      timecdb = clb->GetT0Means();
+    }
+  
+  AliT0CalibSeasonTimeShift *offline = new AliT0CalibSeasonTimeShift();
+  Bool_t writeok = offline->SetT0Par(filePhysName.Data(), timecdb);
+  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);
-      }
-    }
+  }
+
 }
index 3aefb2d..78d32f1 100644 (file)
@@ -202,9 +202,9 @@ Bool_t  AliT0RawReader::Next()
                }
                if(correct){
                  hit=koefhits[koef];
-                 if(hit>5) {  
+                 if(hit>4) {  
                    AliDebug(10,Form("Too many hits for %i channel - %i ! ",koef,koefhits[koef] )); 
-                   hit=5;
+                   hit=4;
                  }
                  fAllData[koef][hit]=time; 
                  koefhits[koef]++;
index ff392c7..c138091 100644 (file)
@@ -211,6 +211,8 @@ void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const
     else {
       time[ipmt] = 0;
       adc[ipmt] = 0;
+      adcmip[ipmt] = 0;
+
     }
   }
   
@@ -440,6 +442,7 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
         else {
           time[ipmt] = 0;
           adc[ipmt] = 0;
+          adcmip[ipmt] = 0;
           noncalibtime[ipmt] = 0;
         }
        }
@@ -524,6 +527,10 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
   ****************************************************/
   
   AliDebug(1,Form("Start FillESD T0"));
+  if(!pESD) {
+    AliError("No ESD Event");
+    return;
+  }
   pESD ->SetT0spread(fTimeSigmaShift);