New methods for retrieving QA histograms + coding conventions (F.Prino)
authormasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 26 Sep 2007 13:18:14 +0000 (13:18 +0000)
committermasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 26 Sep 2007 13:18:14 +0000 (13:18 +0000)
ITS/AliITSOnlineSDDBase.cxx
ITS/AliITSOnlineSDDCMN.cxx
ITS/AliITSOnlineSDDCMN.h
ITS/AliITSOnlineSDDInjectors.cxx
ITS/AliITSOnlineSDDInjectors.h

index b046ff5..c620786 100644 (file)
@@ -79,7 +79,7 @@ void  AliITSOnlineSDDBase::ValidateAnodes(){
 void AliITSOnlineSDDBase::AddEvent(TH2F* hrawd){
   // 
   fNEvents++;
-  const Int_t nTimeBins=fLastGoodTB-fFirstGoodTB+1;
+  const Int_t kTimeBins=fLastGoodTB-fFirstGoodTB+1;
   Float_t sum[fgkNAnodes];
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
     Float_t sumQ=0.;
@@ -88,16 +88,16 @@ void AliITSOnlineSDDBase::AddEvent(TH2F* hrawd){
       sum[ian]+=hrawd->GetBinContent(itb+1,ian+1);
       sumQ+=TMath::Power(hrawd->GetBinContent(itb+1,ian+1),2);      
     }
-    sum[ian]/=(Float_t)nTimeBins;
-    sumQ/=(Float_t)nTimeBins;
+    sum[ian]/=(Float_t)kTimeBins;
+    sumQ/=(Float_t)kTimeBins;
     fSumBaseline[ian]+=sum[ian];
     fSumRawNoise[ian]+=sumQ;
     if(fNEvents==1) ValidateAnodes();
   }
 
 
-  Float_t *cmnEven = new Float_t[nTimeBins];
-  Float_t *cmnOdd  = new Float_t[nTimeBins];
+  Float_t *cmnEven = new Float_t[kTimeBins];
+  Float_t *cmnOdd  = new Float_t[kTimeBins];
   for(Int_t itb=fFirstGoodTB;itb<=fLastGoodTB;itb++){
     Float_t sumEven=0., sumOdd=0.;
     Int_t countEven=0,countOdd=0;
index 4d8e5d6..7b83a35 100644 (file)
@@ -103,7 +103,7 @@ void  AliITSOnlineSDDCMN::ValidateAnodes(){
 void AliITSOnlineSDDCMN::AddEvent(TH2F* hrawd){
   // 
   fNEvents++;
-  const Int_t nTimeBins=fLastGoodTB-fFirstGoodTB+1;
+  const Int_t kTimeBins=fLastGoodTB-fFirstGoodTB+1;
   TH2F* hcorrd=new TH2F("hcorrd","",hrawd->GetNbinsX(),hrawd->GetXaxis()->GetXmin(),hrawd->GetXaxis()->GetXmax(),hrawd->GetNbinsY(),hrawd->GetYaxis()->GetXmin(),hrawd->GetYaxis()->GetXmax());
   for(Int_t itb=fFirstGoodTB;itb<=fLastGoodTB;itb++){
     Float_t sumEven=0., sumOdd=0.;
@@ -134,7 +134,7 @@ void AliITSOnlineSDDCMN::AddEvent(TH2F* hrawd){
     for(Int_t itb=fFirstGoodTB;itb<=fLastGoodTB;itb++){
       sumQ+=TMath::Power(hcorrd->GetBinContent(itb+1,ian+1)-fBaseline[ian],2);      
     }
-    fSumCorrNoise[ian]+=TMath::Sqrt(sumQ/(Float_t)nTimeBins);
+    fSumCorrNoise[ian]+=TMath::Sqrt(sumQ/(Float_t)kTimeBins);
   }
   delete hcorrd;
 }
@@ -162,6 +162,73 @@ void AliITSOnlineSDDCMN::WriteToASCII(){
   }
   fclose(outf);  
 }
+
+//______________________________________________________________________
+TH1F* AliITSOnlineSDDCMN::GetBaselineAnodeHisto() const {
+  //
+  Char_t hisnam[20];  
+  sprintf(hisnam,"hb%03ds%d",fModuleId,fSide);
+  TH1F* h=new TH1F(hisnam,"",256,-0.5,255.5);
+  for(Int_t ian=0;ian<fgkNAnodes;ian++){
+    h->SetBinContent(ian+1,GetAnodeBaseline(ian));
+  }
+  return h;
+}
+//______________________________________________________________________
+TH1F* AliITSOnlineSDDCMN::GetRawNoiseAnodeHisto() const {
+  //
+  Char_t hisnam[20];  
+  sprintf(hisnam,"hn%03ds%d",fModuleId,fSide);
+  TH1F* h=new TH1F(hisnam,"",256,-0.5,255.5);
+  for(Int_t ian=0;ian<fgkNAnodes;ian++){
+    h->SetBinContent(ian+1,GetAnodeRawNoise(ian));
+  }
+  return h;
+}
+//______________________________________________________________________
+TH1F* AliITSOnlineSDDCMN::GetCorrNoiseAnodeHisto() const {
+  //
+  Char_t hisnam[20];  
+  sprintf(hisnam,"hc%03ds%d",fModuleId,fSide);
+  TH1F* h=new TH1F(hisnam,"",256,-0.5,255.5);
+  for(Int_t ian=0;ian<fgkNAnodes;ian++){
+    h->SetBinContent(ian+1,GetAnodeCorrNoise(ian));
+  }
+  return h;
+}
+//______________________________________________________________________
+TH1F* AliITSOnlineSDDCMN::GetBaselineHisto() const {
+  //
+  Char_t hisnam[20];  
+  sprintf(hisnam,"hdb%03ds%d",fModuleId,fSide);
+  TH1F* h=new TH1F(hisnam,"",100,0.,150.);
+  for(Int_t ian=0;ian<fgkNAnodes;ian++){
+    h->Fill(GetAnodeBaseline(ian));
+  }
+  return h;
+}
+//______________________________________________________________________
+TH1F* AliITSOnlineSDDCMN::GetRawNoiseHisto() const {
+  //
+  Char_t hisnam[20];  
+  sprintf(hisnam,"hdn%03ds%d",fModuleId,fSide);
+  TH1F* h=new TH1F(hisnam,"",100,0.,8.);
+  for(Int_t ian=0;ian<fgkNAnodes;ian++){
+    h->Fill(GetAnodeRawNoise(ian));
+  }
+  return h;
+}
+//______________________________________________________________________
+TH1F* AliITSOnlineSDDCMN::GetCorrNoiseHisto() const {
+  //
+  Char_t hisnam[20];  
+  sprintf(hisnam,"hdc%03ds%d",fModuleId,fSide);
+  TH1F* h=new TH1F(hisnam,"",100,0.,8.);
+  for(Int_t ian=0;ian<fgkNAnodes;ian++){
+    h->Fill(GetAnodeCorrNoise(ian));
+  }
+  return h;
+}
 //______________________________________________________________________
 Bool_t AliITSOnlineSDDCMN::WriteToROOT(TFile *fil){
   //
index c603084..bc3d330 100644 (file)
@@ -9,6 +9,7 @@
 ///////////////////////////////////////////////////////////////////
 #include "AliITSOnlineSDD.h"
 
+class TH1F;
 class TH2F;
 class TGraph;
 class AliITSOnlineSDDCMN : public AliITSOnlineSDD {
@@ -37,6 +38,14 @@ class AliITSOnlineSDDCMN : public AliITSOnlineSDD {
 
   Float_t CalcMeanNoise() const;
   Int_t GetNEvents() const {return fNEvents;}
+  
+  TH1F* GetBaselineAnodeHisto() const;
+  TH1F* GetRawNoiseAnodeHisto() const;
+  TH1F* GetCorrNoiseAnodeHisto() const;
+  TH1F* GetBaselineHisto() const;
+  TH1F* GetRawNoiseHisto() const;
+  TH1F* GetCorrNoiseHisto() const;
+
   void WriteToASCII();
   Bool_t WriteToROOT(TFile *fil);
 
index e5e95aa..dac882a 100644 (file)
 ClassImp(AliITSOnlineSDDInjectors)
 
 const Float_t AliITSOnlineSDDInjectors::fgkSaturation = 1008.;
-const Float_t AliITSOnlineSDDInjectors::fgkJitterTB = 8.;
 
 //______________________________________________________________________
-  AliITSOnlineSDDInjectors::AliITSOnlineSDDInjectors():AliITSOnlineSDD(),fHisto(),fTbZero(0.),fParam(),fPolOrder(0),fMinDriftVel(0.),fMaxDriftVel(0.),fThreshold(0.)
+AliITSOnlineSDDInjectors::AliITSOnlineSDDInjectors():AliITSOnlineSDD(),fHisto(),fTbZero(0.),fParam(),fPolOrder(0),fMinDriftVel(0.),fMaxDriftVel(0.),fThreshold(0.),fTimeDiffTB()
 {
   // default constructor
   SetMinDriftVel();
@@ -43,9 +42,10 @@ const Float_t AliITSOnlineSDDInjectors::fgkJitterTB = 8.;
   SetPositions();
   SetPolOrder();
   SetThreshold();
+  SetTimeDiffTB();
 }
 //______________________________________________________________________
-AliITSOnlineSDDInjectors::AliITSOnlineSDDInjectors(Int_t mod, Int_t sid):AliITSOnlineSDD(mod,sid),fHisto(),fTbZero(0.),fParam(),fPolOrder(0),fMinDriftVel(0.),fMaxDriftVel(0.),fThreshold(0.)
+AliITSOnlineSDDInjectors::AliITSOnlineSDDInjectors(Int_t mod, Int_t sid):AliITSOnlineSDD(mod,sid),fHisto(),fTbZero(0.),fParam(),fPolOrder(0),fMinDriftVel(0.),fMaxDriftVel(0.),fThreshold(0.),fTimeDiffTB()
 { 
 // standard constructor
   SetMinDriftVel();
@@ -56,6 +56,7 @@ AliITSOnlineSDDInjectors::AliITSOnlineSDDInjectors(Int_t mod, Int_t sid):AliITSO
   SetPositions();
   SetPolOrder();
   SetThreshold();
+  SetTimeDiffTB();
 }
 //______________________________________________________________________
 AliITSOnlineSDDInjectors::~AliITSOnlineSDDInjectors(){
@@ -100,7 +101,7 @@ void AliITSOnlineSDDInjectors::AnalyzeEvent(TH2F* his){
   FitDriftVelocityVsAnode();
 }
 //______________________________________________________________________
-TGraphErrors* AliITSOnlineSDDInjectors::GetLineGraph(Int_t jlin){
+TGraphErrors* AliITSOnlineSDDInjectors::GetLineGraph(Int_t jlin) const{
   // 
   Float_t x[4],y[4],ex[4],ey[4];
   x[0]=0.;
@@ -121,7 +122,7 @@ Float_t AliITSOnlineSDDInjectors::GetDriftCoordinate(Float_t cAnode, Float_t cTi
   //
   Float_t vel=0;
   for(Int_t i=0;i<=fPolOrder;i++) vel+=fParam[i]*TMath::Power(cAnode,(Float_t)i);
-  return vel*(cTimeBin-(fTbZero-fgkJitterTB))*25/1000.; 
+  return vel*(cTimeBin-(fTbZero-fTimeDiffTB))*25/1000.; 
 }
 //______________________________________________________________________
 TGraphErrors* AliITSOnlineSDDInjectors::GetDriftVelocityGraph() const{
@@ -154,13 +155,14 @@ void AliITSOnlineSDDInjectors::CalcTimeBinZero(){
 }
 //______________________________________________________________________
 void AliITSOnlineSDDInjectors::FitDriftVelocityVsAnode(){
-  const Int_t nn=fPolOrder+1;
-  Float_t **mat = new Float_t*[nn];
-  for(Int_t i=0; i < nn; i++) mat[i] = new Float_t[nn];
-  Float_t *vect = new Float_t[nn];
-  for(Int_t k1=0;k1<nn;k1++){
+  // fits the anode dependence of drift velocity with a polynomial
+  const Int_t kNn=fPolOrder+1;
+  Float_t **mat = new Float_t*[kNn];
+  for(Int_t i=0; i < kNn; i++) mat[i] = new Float_t[kNn];
+  Float_t *vect = new Float_t[kNn];
+  for(Int_t k1=0;k1<kNn;k1++){
     vect[k1]=0;
-    for(Int_t k2=0;k2<nn;k2++){
+    for(Int_t k2=0;k2<kNn;k2++){
       mat[k1][k2]=0;
       for(Int_t n=0; n<kNInjectors;n++){
        Float_t x=(Float_t)GetAnodeNumber(n);
@@ -168,22 +170,22 @@ void AliITSOnlineSDDInjectors::FitDriftVelocityVsAnode(){
       }
     }
   }
-  for(Int_t k1=0;k1<nn;k1++){
+  for(Int_t k1=0;k1<kNn;k1++){
     for(Int_t n=0; n<kNInjectors;n++){
       Float_t x=(Float_t)GetAnodeNumber(n);
       if(fDriftVel[n]>0) vect[k1]+=fDriftVel[n]*TMath::Power(x,k1)/TMath::Power(fSigmaDriftVel[n],2);
     }
   }
-  Int_t *iPivot = new Int_t[nn];
-  Int_t *indxR = new Int_t[nn];
-  Int_t *indxC = new Int_t[nn];
-  for(Int_t i=0;i<nn;i++) iPivot[i]=0;
+  Int_t *iPivot = new Int_t[kNn];
+  Int_t *indxR = new Int_t[kNn];
+  Int_t *indxC = new Int_t[kNn];
+  for(Int_t i=0;i<kNn;i++) iPivot[i]=0;
   Int_t iCol=-1,iRow=-1;
-  for(Int_t i=0;i<nn;i++){
+  for(Int_t i=0;i<kNn;i++){
     Float_t big=0.;
-    for(Int_t j=0;j<nn;j++){
+    for(Int_t j=0;j<kNn;j++){
       if(iPivot[j]!=1){
-       for(Int_t k=0;k<nn;k++){
+       for(Int_t k=0;k<kNn;k++){
           if(iPivot[k]==0){
             if(TMath::Abs(mat[j][k])>=big){
               big=TMath::Abs(mat[j][k]);
@@ -197,7 +199,7 @@ void AliITSOnlineSDDInjectors::FitDriftVelocityVsAnode(){
     iPivot[iCol]++;
     Float_t aux;
     if(iRow!=iCol){
-      for(Int_t l=0;l<nn;l++){
+      for(Int_t l=0;l<kNn;l++){
        aux=mat[iRow][l];
        mat[iRow][l]=mat[iCol][l];
        mat[iCol][l]=aux;
@@ -211,13 +213,13 @@ void AliITSOnlineSDDInjectors::FitDriftVelocityVsAnode(){
     if(mat[iCol][iCol]==0) break;
     Float_t pivinv=1./mat[iCol][iCol];
     mat[iCol][iCol]=1;
-    for(Int_t l=0;l<nn;l++) mat[iCol][l]*=pivinv;
+    for(Int_t l=0;l<kNn;l++) mat[iCol][l]*=pivinv;
     vect[iCol]*=pivinv;
-    for(Int_t m=0;m<nn;m++){
+    for(Int_t m=0;m<kNn;m++){
       if(m!=iCol){
        aux=mat[m][iCol];
        mat[m][iCol]=0;
-       for(Int_t n=0;n<nn;n++) mat[m][n]-=mat[iCol][n]*aux;
+       for(Int_t n=0;n<kNn;n++) mat[m][n]-=mat[iCol][n]*aux;
        vect[m]-=vect[iCol]*aux;
       }
     }    
@@ -227,10 +229,10 @@ void AliITSOnlineSDDInjectors::FitDriftVelocityVsAnode(){
   delete [] indxC;
 
   if(fParam) delete [] fParam;
-  fParam=new Float_t[nn];
-  for(Int_t i=0; i<nn;i++)fParam[i]=vect[i];
+  fParam=new Float_t[kNn];
+  for(Int_t i=0; i<kNn;i++)fParam[i]=vect[i];
 
-  for(Int_t i=0; i < nn; i++) delete [] mat[i];
+  for(Int_t i=0; i < kNn; i++) delete [] mat[i];
   delete [] mat;
   delete [] vect;
 }
index 0539ce7..fe17876 100644 (file)
@@ -10,7 +10,7 @@
 ///////////////////////////////////////////////////////////////////
 #include "AliITSOnlineSDD.h"
 
-/* $Id$ */
+/* $Id: */
 class TH2F;
 class TGraphErrors;
 class AliITSOnlineSDDInjectors : public AliITSOnlineSDD {
@@ -34,8 +34,9 @@ class AliITSOnlineSDDInjectors : public AliITSOnlineSDD {
   void SetPolOrder(Int_t n=3){fPolOrder=n;}
   void SetMinDriftVel(Float_t vmin=4.){fMinDriftVel=vmin;}
   void SetMaxDriftVel(Float_t vmax=9.){fMaxDriftVel=vmax;}
+  void SetTimeDiffTB(Float_t tbDiff=8.){fTimeDiffTB=tbDiff;}
 
-  TGraphErrors* GetLineGraph(Int_t jlin);
+  TGraphErrors* GetLineGraph(Int_t jlin) const;
   TGraphErrors* GetDriftVelocityGraph() const;
   Float_t* GetDriftVelFitParam()const{ return fParam;}
   Float_t GetDriftVelocity(Int_t jlin) const{return fDriftVel[jlin];}
@@ -73,8 +74,7 @@ class AliITSOnlineSDDInjectors : public AliITSOnlineSDD {
 
   AliITSOnlineSDDInjectors(const AliITSOnlineSDDInjectors& source);
   AliITSOnlineSDDInjectors& operator = (const AliITSOnlineSDDInjectors& source);
-  static const Float_t fgkSaturation;
-  static const Float_t fgkJitterTB;
+  static const Float_t fgkSaturation;   // ADC saturation value (1008)
 
   TH2F* fHisto;                         // histogram of module channel counts
   Float_t fTbZero;                      // Time zero for injector event
@@ -93,6 +93,8 @@ class AliITSOnlineSDDInjectors : public AliITSOnlineSDD {
   Float_t fMaxDriftVel;                 // Cut value for maximum drift speed
   Float_t fThreshold;                   // Threshold for injector signal
 
-  ClassDef(AliITSOnlineSDDInjectors,1)
+  Float_t fTimeDiffTB;                  // time difference (in TB) between injector trigger and particle trigger
+
+  ClassDef(AliITSOnlineSDDInjectors,2)
 };
 #endif