]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDCalibraVector.cxx
Coverity fix
[u/mrichter/AliRoot.git] / TRD / AliTRDCalibraVector.cxx
index 2ba3199d39ecfd5bef652d302577e139029eb00f..8b928fe2e95fb98e0b9083a9bf657faadc1392d5 100644 (file)
@@ -167,19 +167,49 @@ AliTRDCalibraVector::~AliTRDCalibraVector()
   // AliTRDCalibraVector destructor
   //
 
-  if(fPHEntries) delete fPHEntries;
-  if(fPHMean) delete fPHMean;
-  if(fPHSquares) delete fPHSquares;
-  if(fPRFEntries) delete fPRFEntries;
-  if(fPRFMean) delete fPRFMean;
-  if(fPRFSquares) delete fPRFSquares;
-  if(fCHEntries) delete fCHEntries;
+  for (Int_t i=0; i<540; i++) {
+    delete fPHEntries[i];
+    delete fPHMean[i];
+    delete fPHSquares[i];
+    delete fPRFEntries[i];
+    delete fPRFMean[i];
+    delete fPRFSquares[i];
+    delete fCHEntries[i];
+  }
+
   if(fHisto) delete fHisto;
   if(fGraph) delete fGraph;
   if(fCalVector) delete fCalVector;
 
 }
 //_____________________________________________________________________________
+Long64_t AliTRDCalibraVector::Merge(const TCollection* list) 
+{
+  // Merge list of objects (needed by PROOF)
+
+  if (!list)
+    return 0;
+  
+  if (list->IsEmpty())
+    return 1;
+  
+  TIterator* iter = list->MakeIterator();
+  TObject* obj = 0;
+  
+  // collection of generated histograms
+  Int_t count=0;
+  while((obj = iter->Next()) != 0) 
+    {
+      AliTRDCalibraVector* entry = dynamic_cast<AliTRDCalibraVector*>(obj);
+      if (entry == 0) continue; 
+      
+      if(this->Add(entry)) count++;
+    
+    }
+  
+  return count;
+}
+//_____________________________________________________________________________
 void AliTRDCalibraVector::TestInit(Int_t i, Int_t detmax)
 {
   //
@@ -926,10 +956,10 @@ Bool_t AliTRDCalibraVector::FindTheMaxEntries(Int_t i, Int_t &detectormax, Int_t
   }
   max = -10.0;
   groupmax = -1;
-  for(Int_t i = 0; i < numberofgroup; i++){
-    if(nbgroup[i] > max){
-      max = nbgroup[i];
-      groupmax = i;
+  for(Int_t io = 0; io < numberofgroup; io++){
+    if(nbgroup[io] > max){
+      max = nbgroup[io];
+      groupmax = io;
     }
   }
   if((max == 0.0) || (groupmax < 0.0) || (groupmax >= numberofgroup)) return kFALSE;
@@ -953,10 +983,12 @@ TGraphErrors *AliTRDCalibraVector::ConvertVectorPHTGraphErrors(Int_t det, Int_t
   // Axis
   Float_t sf = 10.0;
   AliTRDCommonParam *parCom = AliTRDCommonParam::Instance();
-  if (!parCom) {
+  if (parCom) {
+    sf = parCom->GetSamplingFrequency();
+  }
+  else {
     AliInfo("Could not get CommonParam, take the default 10MHz");
   }
-  sf = parCom->GetSamplingFrequency();
   // Axis
   Double_t x[35];  // Xaxis
   Double_t y[35];  // Sum/entries
@@ -1300,6 +1332,9 @@ AliTRDPrfInfo* AliTRDCalibraVector::GetMeanSquaresPRF(Int_t det
 //_____________________________________________________________________________
 Int_t AliTRDCalibraVector::GetTotalNumberOfBinsInDetector(Int_t det, Int_t i, Int_t nbBin) const
 {
+  //
+  // Get the total number of bins (Nb of bins*Nb of groups) in the detector det for the group i
+  //
 
   Int_t ngroup = 0;
   Int_t stack  = AliTRDgeometry::GetStack(det);
@@ -1312,6 +1347,9 @@ Int_t AliTRDCalibraVector::GetTotalNumberOfBinsInDetector(Int_t det, Int_t i, In
 //____________________________________________________________________________
 Int_t AliTRDCalibraVector::GetNz(Int_t i) const
 {
+  //
+  // Get Nz the granularity in row
+  //
 
   Int_t nz = 0;
   if(i==0) nz = (Int_t)(fModeCH>>4);
@@ -1324,6 +1362,9 @@ Int_t AliTRDCalibraVector::GetNz(Int_t i) const
 //____________________________________________________________________________
 Int_t AliTRDCalibraVector::GetNrphi(Int_t i) const
 {
+  //
+  // Get Nrphi the granularity in col
+  //
 
   Int_t nrphi = 0;
   if(i==0) nrphi = (Int_t)(fModeCH&15);
@@ -1336,6 +1377,9 @@ Int_t AliTRDCalibraVector::GetNrphi(Int_t i) const
 //_________________________________________________________________________________
 TString AliTRDCalibraVector::GetNamePH() const
 {
+  //
+  // Get the name of PH to know the granularity
+  //
   
   Int_t nz = GetNz(1);
   Int_t nrphi = GetNrphi(1);
@@ -1351,6 +1395,9 @@ TString AliTRDCalibraVector::GetNamePH() const
 //_________________________________________________________________________________
 TString AliTRDCalibraVector::GetNameCH() const
 {
+  //
+  // Get the name of CH to know the granularity
+  //
   
   Int_t nz = GetNz(0);
   Int_t nrphi = GetNrphi(0);
@@ -1366,7 +1413,10 @@ TString AliTRDCalibraVector::GetNameCH() const
 //_________________________________________________________________________________
 TString AliTRDCalibraVector::GetNamePRF() const
 {
-  
+  //
+  // Get the name of PRF to know the granularity
+  //
+
   Int_t nz = GetNz(2);
   Int_t nrphi = GetNrphi(2);
   
@@ -1381,7 +1431,11 @@ TString AliTRDCalibraVector::GetNamePRF() const
 
 }
 //____________________________________________________________________________
-void AliTRDCalibraVector::SetNzNrphi(Int_t i, Int_t nz, Int_t nrphi) {
+void AliTRDCalibraVector::SetNzNrphi(Int_t i, Int_t nz, Int_t nrphi) 
+{
+  //
+  // Set NzNrphi for the granularity
+  //
   
   if(i==0) {
     fModeCH = nz;
@@ -1399,4 +1453,5 @@ void AliTRDCalibraVector::SetNzNrphi(Int_t i, Int_t nz, Int_t nrphi) {
     fModePRF |= nrphi;
   }
   
-}  
+}
+