Added two missing includes to allow macro compilation (thanks to Laurent for remarkin...
[u/mrichter/AliRoot.git] / ITS / AliITSOnlineSDDTP.cxx
index dd01f00..a4efc27 100644 (file)
@@ -93,10 +93,10 @@ void AliITSOnlineSDDTP::ReadBaselines(){
   sprintf(basfilnam,"SDDbase_step2_ddl%02dc%02d_sid%d.data",fDDL,fCarlos,fSide);
   FILE* basf=fopen(basfilnam,"r");
   if(basf==0){
-    AliWarning(Form("Baseline file not present (ddl %d  carlos %d side %d, Set all baselines to 50\n",fDDL,fCarlos,fSide));
+    AliWarning(Form("Baseline file not present (ddl %d  carlos %d side %d, Set all baselines to 20",fDDL,fCarlos,fSide));
     for(Int_t ian=0;ian<fgkNAnodes;ian++){ 
-      fBaseline[ian]=50.;
-      fEqBaseline[ian]=50;
+      fBaseline[ian]=20.;
+      fEqBaseline[ian]=20;
       fOffsetBaseline[ian]=0;
       fGoodAnode[ian]=1;
     }
@@ -152,13 +152,16 @@ void AliITSOnlineSDDTP::StatGain(Float_t &mean, Float_t  &rms){
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
     if(!fGoodAnode[ian]) continue;
     if(fNEvents[ian]==0) continue;
-    sum+=GetChannelGain(ian);
-    sumq+=TMath::Power(GetChannelGain(ian),2);
+    Float_t chgain=GetChannelGain(ian);
+    sum+=chgain;
+    sumq+=chgain*chgain;
     cnt++;
   }
   if(cnt>0){ 
     mean=sum/(Float_t)cnt;
-    rms=TMath::Sqrt(sumq/(Float_t)cnt-mean*mean);
+    Float_t variance=sumq/(Float_t)cnt-mean*mean;
+    if(variance>0.) rms=TMath::Sqrt(variance);
+    else rms = 0;
   }else{ 
     mean=0.;
     rms=0.;
@@ -181,6 +184,72 @@ void AliITSOnlineSDDTP::WriteToASCII(){
   fclose(outf);  
 }
 //______________________________________________________________________
+TH1F* AliITSOnlineSDDTP::GetBaselineAnodeHisto() const {
+  //
+  Char_t hisnam[20];  
+  sprintf(hisnam,"hbase%02dc%02ds%d",fDDL,fCarlos,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* AliITSOnlineSDDTP::GetRawNoiseAnodeHisto() const {
+  //
+  Char_t hisnam[20];  
+  sprintf(hisnam,"hnois%02dc%02ds%d",fDDL,fCarlos,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* AliITSOnlineSDDTP::GetCorrNoiseAnodeHisto() const {
+  //
+  Char_t hisnam[20];  
+  sprintf(hisnam,"hcorn%02dc%02ds%d",fDDL,fCarlos,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* AliITSOnlineSDDTP::GetCMNCoefAnodeHisto() const {
+//
+  Char_t hisnam[20];  
+  sprintf(hisnam,"hcmn%02dc%02ds%d",fDDL,fCarlos,fSide);
+  TH1F* h=new TH1F(hisnam,"",256,-0.5,255.5);
+  for(Int_t ian=0;ian<fgkNAnodes;ian++){
+    h->SetBinContent(ian+1,GetAnodeCommonMode(ian));
+  }
+  return h;
+}
+//______________________________________________________________________
+TH1F* AliITSOnlineSDDTP::GetStatusAnodeHisto() const {
+//
+  Char_t hisnam[20];  
+  sprintf(hisnam,"hgood%02dc%02ds%d",fDDL,fCarlos,fSide);
+  TH1F* h=new TH1F(hisnam,"",256,-0.5,255.5);
+  for(Int_t ian=0;ian<fgkNAnodes;ian++){
+    h->SetBinContent(ian+1,float(IsAnodeGood(ian)));
+  }
+  return h;
+}
+//______________________________________________________________________
+TH1F* AliITSOnlineSDDTP::GetGainAnodeHisto() const {
+//
+  Char_t hisnam[20];  
+  sprintf(hisnam,"hgain%02dc%02ds%d",fDDL,fCarlos,fSide);
+  TH1F* h=new TH1F(hisnam,"",256,-0.5,255.5);
+  for(Int_t ian=0;ian<fgkNAnodes;ian++){
+    h->SetBinContent(ian+1,GetChannelGain(ian));
+  }
+  return h;
+}
+//______________________________________________________________________
 Bool_t AliITSOnlineSDDTP::WriteToROOT(TFile *fil){
   //
   if(fil==0){ 
@@ -201,6 +270,8 @@ Bool_t AliITSOnlineSDDTP::WriteToROOT(TFile *fil){
   TH1F hcorn(hisnam,"",256,-0.5,255.5);
   sprintf(hisnam,"hgain%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F hgain(hisnam,"",256,-0.5,255.5);
+  sprintf(hisnam,"htptb%02dc%02ds%d",fDDL,fCarlos,fSide);
+  TH1F htptb(hisnam,"",256,-0.5,255.5);
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
     hgood.SetBinContent(ian+1,float(IsAnodeGood(ian)));
     hbase.SetBinContent(ian+1,GetAnodeBaseline(ian));
@@ -208,6 +279,7 @@ Bool_t AliITSOnlineSDDTP::WriteToROOT(TFile *fil){
     hcmn.SetBinContent(ian+1,GetAnodeCommonMode(ian));
     hcorn.SetBinContent(ian+1,GetAnodeCorrNoise(ian));
     hgain.SetBinContent(ian+1,GetChannelGain(ian));
+    htptb.SetBinContent(ian+1,GetTimeBinTPPeak(ian));
   }
   hgood.Write();
   hbase.Write();
@@ -215,6 +287,7 @@ Bool_t AliITSOnlineSDDTP::WriteToROOT(TFile *fil){
   hcmn.Write();
   hcorn.Write();
   hgain.Write();
+  htptb.Write();
   return kTRUE;
 }