]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/Cal/AliTRDCalPad.cxx
default to all tracks in standard cuts
[u/mrichter/AliRoot.git] / TRD / Cal / AliTRDCalPad.cxx
index 730d340904aad4b57b001dfb5ab461690b839dd8..d4158b821834f74b4dafc92bf6b4aab3417d976a 100644 (file)
 #include <TH1F.h>
 #include <TStyle.h>
 
+//#include "AliMathBase.h"
+
 #include "AliTRDCalPad.h"
 #include "AliTRDCalROC.h"
 #include "AliTRDCalDet.h"
 #include "AliTRDpadPlane.h"
-#include "AliMathBase.h"
 #include "AliTRDgeometry.h"
 
 ClassImp(AliTRDCalPad)
@@ -150,6 +151,23 @@ Bool_t AliTRDCalPad::ScaleROCs(const AliTRDCalDet* values)
   return result;
 }
 
+//_____________________________________________________________________________
+void AliTRDCalPad::SetCalROC(Int_t det, AliTRDCalROC* calroc)
+{
+  // 
+  // Set the AliTRDCalROC to this one
+  //
+  
+  if (!calroc) return;
+  if (fROC[det]) { 
+    for(Int_t icol = 0; icol < calroc->GetNcols(); icol++){
+      for(Int_t irow = 0; irow < calroc->GetNrows(); irow++){
+       fROC[det]->SetValue(icol,irow,calroc->GetValue(icol,irow));
+      }
+    }
+  }
+
+}
 //_____________________________________________________________________________
 Double_t AliTRDCalPad::GetMeanRMS(Double_t &rms, const AliTRDCalDet *calDet, Int_t type)
 {
@@ -184,7 +202,8 @@ Double_t AliTRDCalPad::GetMeanRMS(Double_t &rms, const AliTRDCalDet *calDet, Int
 }
 
 //_____________________________________________________________________________
-Double_t AliTRDCalPad::GetMean(const AliTRDCalDet *calDet, Int_t type, AliTRDCalPad* outlierPad)
+Double_t AliTRDCalPad::GetMean(const AliTRDCalDet *calDet, Int_t type
+                             , AliTRDCalPad* const outlierPad)
 {
     //
     // return mean of the mean of all ROCs
@@ -211,7 +230,8 @@ Double_t AliTRDCalPad::GetMean(const AliTRDCalDet *calDet, Int_t type, AliTRDCal
 }
 
 //_____________________________________________________________________________
-Double_t AliTRDCalPad::GetRMS(const AliTRDCalDet *calDet, Int_t type, AliTRDCalPad* outlierPad)
+Double_t AliTRDCalPad::GetRMS(const AliTRDCalDet *calDet, Int_t type
+                            , AliTRDCalPad* const outlierPad)
 {
     //
     // return mean of the RMS of all ROCs
@@ -239,7 +259,7 @@ Double_t AliTRDCalPad::GetRMS(const AliTRDCalDet *calDet, Int_t type, AliTRDCalP
 
 //_____________________________________________________________________________
 Double_t AliTRDCalPad::GetMedian(const AliTRDCalDet *calDet, Int_t type
-                               , AliTRDCalPad* outlierPad)
+                               , AliTRDCalPad* const outlierPad)
 {
     //
     // return mean of the median of all ROCs
@@ -268,7 +288,7 @@ Double_t AliTRDCalPad::GetMedian(const AliTRDCalDet *calDet, Int_t type
 //_____________________________________________________________________________
 Double_t AliTRDCalPad::GetLTM(Double_t *sigma, Double_t fraction
                             , const AliTRDCalDet *calDet, Int_t type
-                            , AliTRDCalPad* outlierPad)
+                            , AliTRDCalPad* const outlierPad)
 {
     //
     // return mean of the LTM and sigma of all ROCs
@@ -352,7 +372,7 @@ TH1F * AliTRDCalPad::MakeHisto1D(const AliTRDCalDet *calDet, Int_t typedet
     }
   }
   char  name[1000];
-  sprintf(name,"%s Pad 1D",GetTitle());
+  snprintf(name,1000,"%s Pad 1D",GetTitle());
   TH1F * his = new TH1F(name,name,100, min,max);
     for (Int_t idet = 0; idet < kNdet; idet++) {
       if(calDet) factor = calDet->GetValue(idet);
@@ -430,7 +450,7 @@ TH2F *AliTRDCalPad::MakeHisto2DSmPl(Int_t sm, Int_t pl, const AliTRDCalDet *calD
   Double_t col0    = padPlane0->GetCol0();
 
   char  name[1000];
-  sprintf(name,"%s Pad 2D sm %d pl %d",GetTitle(),sm,pl);
+  snprintf(name,1000,"%s Pad 2D sm %d pl %d",GetTitle(),sm,pl);
   TH2F * his = new TH2F( name, name, 76,-TMath::Abs(row0),TMath::Abs(row0),144,-TMath::Abs(col0),TMath::Abs(col0));
 
   // Where we begin
@@ -447,9 +467,11 @@ TH2F *AliTRDCalPad::MakeHisto2DSmPl(Int_t sm, Int_t pl, const AliTRDCalDet *calD
          if (TMath::Abs(calRoc->GetValue(icol,irow))>kEpsilon){
            Int_t binz     = 0;
            Int_t kb       = kNcham-1-k;
-           if(kb > 2) binz = 16*(kb-1)+12+irow+1;
-           else binz = 16*kb+irow+1; 
-           Int_t biny = icol+1;
+           Int_t krow     = calRoc->GetNrows()-1-irow;
+           Int_t kcol     = calRoc->GetNcols()-1-icol;
+           if(kb > 2) binz = 16*(kb-1)+12+krow+1;
+           else binz = 16*kb+krow+1; 
+           Int_t biny = kcol+1;
            Float_t value = calRoc->GetValue(icol,irow);
            if(typedet == 0) his->SetBinContent(binz,biny,value*factor);
            else his->SetBinContent(binz,biny,value+factor);
@@ -528,7 +550,7 @@ TH2F *AliTRDCalPad::MakeHisto2DCh(Int_t ch, const AliTRDCalDet *calDet, Int_t ty
   Double_t posglobal[3] = {0.0,0.0,0.0};
   
   char  name[1000];
-  sprintf(name,"%s Pad 2D ch %d",GetTitle(),ch);
+  snprintf(name,1000,"%s Pad 2D ch %d",GetTitle(),ch);
   TH2F * his = new TH2F( name, name, 400,-400.0,400.0,400,-400.0,400.0);
 
   // Where we begin
@@ -557,7 +579,9 @@ TH2F *AliTRDCalPad::MakeHisto2DCh(Int_t ch, const AliTRDCalDet *calDet, Int_t ty
              nb++;         
            }
          }
-         value = value/nb;
+          if (nb > 0) {
+           value = value/nb;
+         }
          if(typedet == 0) his->SetBinContent(binx,biny,value*factor);
          else his->SetBinContent(binx,biny,value+factor);
        }