]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSOnlineSDDCMN.cxx
Trivial modifications for local tests (file list)
[u/mrichter/AliRoot.git] / ITS / AliITSOnlineSDDCMN.cxx
index f31cce3c8c7fdc379e7cb216862e443b2bad70ca..eefaa879c981a868bbd2584fcbf71fa23f3dc181 100644 (file)
@@ -53,7 +53,7 @@ AliITSOnlineSDDCMN::~AliITSOnlineSDDCMN(){
 }
 //______________________________________________________________________
 void AliITSOnlineSDDCMN::Reset(){
-  //
+  // Reset counters
   fNEvents=0;
   for(Int_t i=0;i<fgkNAnodes;i++){
     fGoodAnode[i]=1;
@@ -80,12 +80,15 @@ void AliITSOnlineSDDCMN::ReadBaselines(){
     }
     return;
   }
-  fscanf(basf,"%d\n",&fHighThreshold);
-  fscanf(basf,"%d\n",&fLowThreshold);
+  Int_t check = fscanf(basf,"%d\n",&fHighThreshold);
+  if(check<1)AliError("Error while reading file with baselines");
+  check = fscanf(basf,"%d\n",&fLowThreshold);
+  if(check<1)AliError("Error while reading file with baselines");
   Int_t n,ok,eqbase,offbase;
   Float_t base,rms,cmn,corrnoi;
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
-    fscanf(basf,"%d %d %f %d %d %f %f %f\n",&n,&ok,&base,&eqbase,&offbase,&rms,&cmn,&corrnoi);
+    check = fscanf(basf,"%d %d %f %d %d %f %f %f\n",&n,&ok,&base,&eqbase,&offbase,&rms,&cmn,&corrnoi);
+    if(check<1)AliError("Error while reading file with baselines");
     fGoodAnode[ian]=ok;
     fBaseline[ian]=base;
     fEqBaseline[ian]=eqbase;
@@ -97,7 +100,7 @@ void AliITSOnlineSDDCMN::ReadBaselines(){
 }
 //______________________________________________________________________
 void  AliITSOnlineSDDCMN::ValidateAnodes(){
-  //
+  // Tag good/bad anodes
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
     if(!fGoodAnode[ian]) continue;
     if(GetAnodeCorrNoise(ian)>fMaxCorrNoise || GetAnodeCorrNoise(ian)<fMinCorrNoise) fGoodAnode[ian]=0;
@@ -106,8 +109,9 @@ void  AliITSOnlineSDDCMN::ValidateAnodes(){
 }
 
 //______________________________________________________________________
-TH2F* AliITSOnlineSDDCMN::GetCleanEvent(TH2F* hrawd) const {
-  // 
+TH2F* AliITSOnlineSDDCMN::GetCleanEvent(const TH2F* hrawd) const {
+  // Fills an histogram with counts corrected for common mode noise
+
   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.;
@@ -135,7 +139,8 @@ TH2F* AliITSOnlineSDDCMN::GetCleanEvent(TH2F* hrawd) const {
 }
 //______________________________________________________________________
 void AliITSOnlineSDDCMN::AddEvent(TH2F* hrawd){
-  // 
+  // analyzes one event and adds its ontribution to the various counters
+
   fNEvents++;
   TH2F* hcorrd=GetCleanEvent(hrawd);
 
@@ -148,13 +153,14 @@ void AliITSOnlineSDDCMN::AddEvent(TH2F* hrawd){
       sumQ+=cntdiff*cntdiff;
       cnt++;    
     }
-    fSumCorrNoise[ian]+=TMath::Sqrt(sumQ/(Float_t)cnt);
+    if(cnt != 0)fSumCorrNoise[ian]+=TMath::Sqrt(sumQ/(Float_t)cnt);
   }
   delete hcorrd;
 }
 //______________________________________________________________________
 Float_t AliITSOnlineSDDCMN::CalcMeanNoise() const{
-  //
+  // compute average noise
+
   Float_t meanns=0.;
   Int_t cnt=0;
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
@@ -167,7 +173,9 @@ Float_t AliITSOnlineSDDCMN::CalcMeanNoise() const{
 }
 //______________________________________________________________________
 void AliITSOnlineSDDCMN::WriteToASCII(){
-  //
+  // writes parameters of each channel into an ASCII file 
+  // to be then read by the PULSER DA (AliITSOnlineSDDTP)
+
   TString outfilnam;
   outfilnam.Form("SDDbase_step2_ddl%02dc%02d_sid%d.data",fDDL,fCarlos,fSide);
   FILE* outf=fopen(outfilnam.Data(),"w");
@@ -181,7 +189,7 @@ void AliITSOnlineSDDCMN::WriteToASCII(){
 
 //______________________________________________________________________
 TH1F* AliITSOnlineSDDCMN::GetBaselineAnodeHisto() const {
-  //
+  // produce histogram with baseline vs. anode number
   TString hisnam;  
   hisnam.Form("hbase%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F* h=new TH1F(hisnam.Data(),"",256,-0.5,255.5);
@@ -192,7 +200,7 @@ TH1F* AliITSOnlineSDDCMN::GetBaselineAnodeHisto() const {
 }
 //______________________________________________________________________
 TH1F* AliITSOnlineSDDCMN::GetRawNoiseAnodeHisto() const {
-  //
+  // produce histogram with raw noise vs. anode number
   TString hisnam;  
   hisnam.Form("hnois%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F* h=new TH1F(hisnam.Data(),"",256,-0.5,255.5);
@@ -203,7 +211,7 @@ TH1F* AliITSOnlineSDDCMN::GetRawNoiseAnodeHisto() const {
 }
 //______________________________________________________________________
 TH1F* AliITSOnlineSDDCMN::GetCorrNoiseAnodeHisto() const {
-  //
+  // produce histogram with corrected noise vs. anode number
   TString hisnam;  
   hisnam.Form("hcorn%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F* h=new TH1F(hisnam.Data(),"",256,-0.5,255.5);
@@ -214,7 +222,7 @@ TH1F* AliITSOnlineSDDCMN::GetCorrNoiseAnodeHisto() const {
 }
 //______________________________________________________________________
 TH1F* AliITSOnlineSDDCMN::GetCMNCoefAnodeHisto() const {
-//
+  // produce histogram with coefficients for common mode noise subtraction
   TString hisnam;  
   hisnam.Form("hcmn%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F* h=new TH1F(hisnam.Data(),"",256,-0.5,255.5);
@@ -225,7 +233,7 @@ TH1F* AliITSOnlineSDDCMN::GetCMNCoefAnodeHisto() const {
 }
 //______________________________________________________________________
 TH1F* AliITSOnlineSDDCMN::GetStatusAnodeHisto() const {
-//
+  // produce histogram with status bit of each anode
   TString hisnam;  
   hisnam.Form("hgood%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F* h=new TH1F(hisnam.Data(),"",256,-0.5,255.5);
@@ -236,7 +244,7 @@ TH1F* AliITSOnlineSDDCMN::GetStatusAnodeHisto() const {
 }
 //______________________________________________________________________
 TH1F* AliITSOnlineSDDCMN::GetBaselineHisto() const {
-  //
+  // produce histogram with baseline distribution
   TString hisnam;  
   hisnam.Form("hdbd%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F* h=new TH1F(hisnam.Data(),"",100,0.,150.);
@@ -247,7 +255,7 @@ TH1F* AliITSOnlineSDDCMN::GetBaselineHisto() const {
 }
 //______________________________________________________________________
 TH1F* AliITSOnlineSDDCMN::GetRawNoiseHisto() const {
-  //
+  // produce histogram with raw noise distribution
   TString hisnam;  
   hisnam.Form("hdnd%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F* h=new TH1F(hisnam.Data(),"",100,0.,8.);
@@ -258,7 +266,7 @@ TH1F* AliITSOnlineSDDCMN::GetRawNoiseHisto() const {
 }
 //______________________________________________________________________
 TH1F* AliITSOnlineSDDCMN::GetCorrNoiseHisto() const {
-  //
+  // produce histogram with corrected noise distribution
   TString hisnam;  
   hisnam.Form("hdcd%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F* h=new TH1F(hisnam.Data(),"",100,0.,8.);
@@ -269,7 +277,7 @@ TH1F* AliITSOnlineSDDCMN::GetCorrNoiseHisto() const {
 }
 //______________________________________________________________________
 Bool_t AliITSOnlineSDDCMN::WriteToROOT(TFile *fil){
-  //
+  // writes output into a root file
   if(fil==0){ 
     AliWarning("Invalid pointer to ROOT file");
     return kFALSE;