SDD DA updated: baseline equalized to 20 for each hybrid. Added Carlos thresholds...
authormasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 29 Feb 2008 17:02:26 +0000 (17:02 +0000)
committermasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 29 Feb 2008 17:02:26 +0000 (17:02 +0000)
ITS/AliITSOnlineSDDBase.cxx
ITS/AliITSOnlineSDDBase.h
ITS/AliITSOnlineSDDCMN.cxx
ITS/AliITSOnlineSDDCMN.h
ITS/AliITSOnlineSDDTP.cxx
ITS/AliITSOnlineSDDTP.h
ITS/AliITSPreprocessorSDD.cxx

index 277bac8a0c4b57ed6c7bca93f5363acb6a9c328f..242ba0bf341e56d71603b9452ae854b6e621d75e 100644 (file)
 //                                                               //
 ///////////////////////////////////////////////////////////////////
 
-/*  $Id:$   */
+/*  $Id$   */
+
+const Int_t AliITSOnlineSDDBase::fgkMaxCorr=63; // 6 but correction
 
 ClassImp(AliITSOnlineSDDBase)
 //______________________________________________________________________
-  AliITSOnlineSDDBase::AliITSOnlineSDDBase():AliITSOnlineSDD(),fNEvents(0),fMinBaseline(0.),fMaxBaseline(0.),fMinRawNoise(0.),fMaxRawNoise(0.),fNSigmaNoise(0.)
+  AliITSOnlineSDDBase::AliITSOnlineSDDBase():AliITSOnlineSDD(),fNEvents(0),fMinBaseline(0.),fMaxBaseline(0.),fMinRawNoise(0.),fMaxRawNoise(0.),fNSigmaNoise(0.),fGoldenBaseline(0.),fLowThrFact(0.),fHighThrFact(0.)
 {
   // default constructor
   Reset();
@@ -38,9 +40,11 @@ ClassImp(AliITSOnlineSDDBase)
   SetMinRawNoise();
   SetMaxRawNoise();
   SetNSigmaNoise();
+  SetGoldenBaselineValue();
+  SetZeroSuppThresholds();
 }
 //______________________________________________________________________
-  AliITSOnlineSDDBase::AliITSOnlineSDDBase(Int_t nddl, Int_t ncarlos, Int_t sid):AliITSOnlineSDD(nddl,ncarlos,sid),fNEvents(0),fMinBaseline(0.),fMaxBaseline(0.),fMinRawNoise(0.),fMaxRawNoise(0.),fNSigmaNoise(0.)
+AliITSOnlineSDDBase::AliITSOnlineSDDBase(Int_t nddl, Int_t ncarlos, Int_t sid):AliITSOnlineSDD(nddl,ncarlos,sid),fNEvents(0),fMinBaseline(0.),fMaxBaseline(0.),fMinRawNoise(0.),fMaxRawNoise(0.),fNSigmaNoise(0.),fGoldenBaseline(0.),fLowThrFact(0.),fHighThrFact(0.)
 {
   // default constructor
   Reset();
@@ -49,6 +53,8 @@ ClassImp(AliITSOnlineSDDBase)
   SetMinRawNoise();
   SetMaxRawNoise();
   SetNSigmaNoise();
+  SetGoldenBaselineValue();
+  SetZeroSuppThresholds();
 }
 //______________________________________________________________________
 AliITSOnlineSDDBase::~AliITSOnlineSDDBase(){
@@ -131,6 +137,18 @@ void AliITSOnlineSDDBase::AddEvent(TH2F* hrawd){
   delete [] cmnOdd;
 }
 //______________________________________________________________________
+void AliITSOnlineSDDBase::GetMinAndMaxBaseline(Float_t &basMin, Float_t &basMax) const {
+  // fills mininum and maximum baseline values
+  basMin=1008.;
+  basMax=0.;
+  for(Int_t ian=0;ian<fgkNAnodes;ian++){
+    if(!fGoodAnode[ian]) continue;
+    Float_t bas=GetAnodeBaseline(ian);
+    if(bas>0 && bas < basMin) basMin=bas;
+    if(bas>0 && bas > basMax) basMax=bas;
+  }
+}
+//______________________________________________________________________
 Float_t AliITSOnlineSDDBase::GetMinimumBaseline() const {
   // returns anode with minum baseline value in hybrid
   Float_t basMin=1008.;
@@ -158,16 +176,27 @@ Float_t AliITSOnlineSDDBase::CalcMeanRawNoise() const{
 void AliITSOnlineSDDBase::WriteToASCII(){
   //
   Char_t outfilnam[100];
-  Float_t basMin=GetMinimumBaseline();
+  Float_t basMin,basMax;
+  GetMinAndMaxBaseline(basMin,basMax);
+  Float_t finalVal=basMin;
+  if(basMin>fGoldenBaseline && basMax<fGoldenBaseline+fgkMaxCorr) finalVal=fGoldenBaseline;
+  if(basMax<basMin+fgkMaxCorr && basMax>fGoldenBaseline+fgkMaxCorr) finalVal=basMax-fgkMaxCorr;
+  
+  Float_t avNoise=CalcMeanRawNoise();
+  Int_t thrL=(Int_t)(finalVal+fLowThrFact*avNoise+0.5);
+  Int_t thrH=(Int_t)(finalVal+fHighThrFact*avNoise+0.5);
+
   sprintf(outfilnam,"SDDbase_step1_ddl%02dc%02d_sid%d.data",fDDL,fCarlos,fSide);
   FILE* outf=fopen(outfilnam,"w");
+  fprintf(outf,"%d\n",thrH);
+  fprintf(outf,"%d\n",thrL);
   Float_t corrnoise=2.;
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
     Float_t bas=GetAnodeBaseline(ian);
-    Int_t corr=(Int_t)(bas-basMin+0.5);
-    if(corr>63) corr=63; // only 6 bits in jtag for correction
+    Int_t corr=(Int_t)(bas-finalVal+0.5);
+    if(corr>fgkMaxCorr) corr=fgkMaxCorr; // only 6 bits in jtag for correction
     if(corr<0) corr=0; // avoid negative numbers
-    fprintf(outf,"%d %d %11.6f %d %d %11.6f %11.6f %11.6f\n",ian,IsAnodeGood(ian),GetAnodeBaseline(ian),(Int_t)basMin,corr,GetAnodeRawNoise(ian),GetAnodeCommonMode(ian),corrnoise);
+    fprintf(outf,"%d %d %11.6f %d %d %11.6f %11.6f %11.6f\n",ian,IsAnodeGood(ian),GetAnodeBaseline(ian),(Int_t)finalVal,corr,GetAnodeRawNoise(ian),GetAnodeCommonMode(ian),corrnoise);
   }
   fclose(outf);  
 }
index c9fd05c4438dc48578876d8f50133008097968f3..9657568a904f059132fef47413ba703ba631b087 100644 (file)
@@ -27,12 +27,18 @@ class AliITSOnlineSDDBase : public AliITSOnlineSDD {
   void SetMinRawNoise(Float_t ns=0.001){fMinRawNoise=ns;}
   void SetMaxRawNoise(Float_t ns=9.){fMaxRawNoise=ns;}
   void SetNSigmaNoise(Float_t ns=4.){fNSigmaNoise=ns;}
+  void SetGoldenBaselineValue(Float_t val=20.){fGoldenBaseline=val;}
+  void SetZeroSuppThresholds(Float_t vall=2.2,Float_t valh=4.){
+    fLowThrFact=vall;
+    fHighThrFact=valh;
+  }
 
   Bool_t IsAnodeGood(Int_t iAnode)const{ return fGoodAnode[iAnode];}
   Float_t GetAnodeBaseline(Int_t iAnode) const{
     if(fNEvents>0) return fSumBaseline[iAnode]/fNEvents;
     else return 0;
   }
+  void GetMinAndMaxBaseline(Float_t &basMin, Float_t &basMax) const;
   Float_t GetMinimumBaseline() const;
   Float_t GetAnodeRawNoise(Int_t iAnode) const{
     if(fNEvents>0) return TMath::Sqrt(fSumRawNoise[iAnode]/fNEvents-TMath::Power(GetAnodeBaseline(iAnode),2));
@@ -51,6 +57,8 @@ class AliITSOnlineSDDBase : public AliITSOnlineSDD {
  protected:
 
  private:
+  static const Int_t fgkMaxCorr;     // maximum baseline correction in AMBRA (=63)
+
   Int_t fNEvents;                    // number of events
   Bool_t fGoodAnode[fgkNAnodes];     // anode quality: good(1) - bad (0)
   Float_t fSumBaseline[fgkNAnodes];  // baseline summed over events
@@ -61,7 +69,10 @@ class AliITSOnlineSDDBase : public AliITSOnlineSDD {
   Float_t fMinRawNoise;              // Cut value for minimum noise
   Float_t fMaxRawNoise;              // Cut value for maximum noise
   Float_t fNSigmaNoise;              // Cut value for noise (n*sigma)
+  Float_t fGoldenBaseline;           // golden value for equalizing baselines
+  Float_t fLowThrFact;               // factor for low threshold
+  Float_t fHighThrFact;              // factor for high threshold
 
-  ClassDef(AliITSOnlineSDDBase,1);
+  ClassDef(AliITSOnlineSDDBase,2);
 };
 #endif
index 62f4accc9c762e1e0bf23ef9efc0cdf9053bdd37..f31d5e95126e6b42a79eaac5b8e99c766dbbb069 100644 (file)
@@ -30,7 +30,7 @@
 
 ClassImp(AliITSOnlineSDDCMN)
 //______________________________________________________________________
-  AliITSOnlineSDDCMN::AliITSOnlineSDDCMN():AliITSOnlineSDD(),fNEvents(0),fMinCorrNoise(0.),fMaxCorrNoise(0.),fNSigmaNoise(0.)
+  AliITSOnlineSDDCMN::AliITSOnlineSDDCMN():AliITSOnlineSDD(),fNEvents(0),fLowThreshold(0),fHighThreshold(0),fMinCorrNoise(0.),fMaxCorrNoise(0.),fNSigmaNoise(0.)
 {
   // default constructor
   Reset();
@@ -39,7 +39,7 @@ ClassImp(AliITSOnlineSDDCMN)
   SetNSigmaNoise();
 }
 //______________________________________________________________________
-  AliITSOnlineSDDCMN::AliITSOnlineSDDCMN(Int_t nddl, Int_t ncarlos, Int_t sid):AliITSOnlineSDD(nddl,ncarlos,sid),fNEvents(0),fMinCorrNoise(0.),fMaxCorrNoise(0.),fNSigmaNoise(0.)
+  AliITSOnlineSDDCMN::AliITSOnlineSDDCMN(Int_t nddl, Int_t ncarlos, Int_t sid):AliITSOnlineSDD(nddl,ncarlos,sid),fNEvents(0),fLowThreshold(0),fHighThreshold(0),fMinCorrNoise(0.),fMaxCorrNoise(0.),fNSigmaNoise(0.)
 {
   // default constructor
   Reset();
@@ -71,7 +71,7 @@ void AliITSOnlineSDDCMN::ReadBaselines(){
   sprintf(basfilnam,"SDDbase_step1_ddl%02dc%02d_sid%d.data",fDDL,fCarlos,fSide);
   FILE* basf=fopen(basfilnam,"r");
   if(basf==0){
-    AliWarning("Baseline file not present, Set all baselines to 50\n");
+    AliWarning(Form("Baseline file not present (ddl %d  carlos %d side %d, Set all baselines to 50\n",fDDL,fCarlos,fSide));
     for(Int_t ian=0;ian<fgkNAnodes;ian++){ 
       fBaseline[ian]=50.;
       fEqBaseline[ian]=50;
@@ -80,6 +80,8 @@ void AliITSOnlineSDDCMN::ReadBaselines(){
     }
     return;
   }
+  fscanf(basf,"%d\n",&fHighThreshold);
+  fscanf(basf,"%d\n",&fLowThreshold);
   Int_t n,ok,eqbase,offbase;
   Float_t base,rms,cmn,corrnoi;
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
@@ -161,6 +163,8 @@ void AliITSOnlineSDDCMN::WriteToASCII(){
   Char_t outfilnam[100];
   sprintf(outfilnam,"SDDbase_step2_ddl%02dc%02d_sid%d.data",fDDL,fCarlos,fSide);
   FILE* outf=fopen(outfilnam,"w");
+  fprintf(outf,"%d\n",fHighThreshold);
+  fprintf(outf,"%d\n",fLowThreshold);
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
     fprintf(outf,"%d %d %8.3f %d %d %8.3f %8.3f %8.3f\n",ian,IsAnodeGood(ian),GetAnodeBaseline(ian),GetAnodeEqualizedBaseline(ian),GetAnodeBaselineOffset(ian),GetAnodeRawNoise(ian),GetAnodeCommonMode(ian),GetAnodeCorrNoise(ian));
   }
index 36155e45ed53468d70a8c51efdeb2eb7a7d6de7a..1e1024e7f4732385755f5175d3a9c9fe2d6f8985 100644 (file)
@@ -55,6 +55,8 @@ class AliITSOnlineSDDCMN : public AliITSOnlineSDD {
 
  private:
   Int_t fNEvents;                    // number of events
+  Int_t fLowThreshold;             // low threshold for zero supp.
+  Int_t fHighThreshold;            // high threshold for zero supp.
   Bool_t fGoodAnode[fgkNAnodes];     // anode quality: good(1) - bad (0)
   Float_t fBaseline[fgkNAnodes];     // array of anode baselines
   Int_t fEqBaseline[fgkNAnodes];     // array of anode baselines after equalization
@@ -66,6 +68,6 @@ class AliITSOnlineSDDCMN : public AliITSOnlineSDD {
   Float_t fMaxCorrNoise;             // Cut value for maximum corrected noise
   Float_t fNSigmaNoise;              // Cut value for corrected noise (n*sigma)
 
-  ClassDef(AliITSOnlineSDDCMN,2);
+  ClassDef(AliITSOnlineSDDCMN,3);
 };
 #endif
index ba9a3d5b1b3a5ac2ff443f916d6e6591327485f4..dd01f00723242bb5dbd986419c7b9cd69054d690 100644 (file)
@@ -30,7 +30,7 @@
 ClassImp(AliITSOnlineSDDTP)
 
 //______________________________________________________________________
-AliITSOnlineSDDTP::AliITSOnlineSDDTP():AliITSOnlineSDD(),fDAC(0.),fNSigmaGain(0.),fNSigmaNoise(0.)
+AliITSOnlineSDDTP::AliITSOnlineSDDTP():AliITSOnlineSDD(),fDAC(0.),fLowThreshold(0),fHighThreshold(0),fNSigmaGain(0.),fNSigmaNoise(0.)
 {
   // default constructor
   Reset();
@@ -38,7 +38,7 @@ AliITSOnlineSDDTP::AliITSOnlineSDDTP():AliITSOnlineSDD(),fDAC(0.),fNSigmaGain(0.
   SetNSigmaNoise();
 }
 //______________________________________________________________________
-AliITSOnlineSDDTP::AliITSOnlineSDDTP(Int_t nddl, Int_t ncarlos, Int_t sid, Float_t xDAC):AliITSOnlineSDD(nddl,ncarlos,sid),fDAC(xDAC),fNSigmaGain(0.),fNSigmaNoise(0.)
+AliITSOnlineSDDTP::AliITSOnlineSDDTP(Int_t nddl, Int_t ncarlos, Int_t sid, Float_t xDAC):AliITSOnlineSDD(nddl,ncarlos,sid),fDAC(xDAC),fLowThreshold(0),fHighThreshold(0),fNSigmaGain(0.),fNSigmaNoise(0.)
 {
   // standard constructor
   Reset();
@@ -93,7 +93,7 @@ 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("Baselinefile not present, Set all baselines to 50\n");
+    AliWarning(Form("Baseline file not present (ddl %d  carlos %d side %d, Set all baselines to 50\n",fDDL,fCarlos,fSide));
     for(Int_t ian=0;ian<fgkNAnodes;ian++){ 
       fBaseline[ian]=50.;
       fEqBaseline[ian]=50;
@@ -102,6 +102,8 @@ void AliITSOnlineSDDTP::ReadBaselines(){
     }
     return;
   }
+  fscanf(basf,"%d\n",&fHighThreshold);
+  fscanf(basf,"%d\n",&fLowThreshold);
   Int_t n,ok,eqbase,offbase;
   Float_t base,rms,cmn,corrnoi;
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
@@ -171,6 +173,8 @@ void AliITSOnlineSDDTP::WriteToASCII(){
   sprintf(outfilnam,"SDDbase_ddl%02dc%02d_sid%d.data",fDDL,fCarlos,fSide);
   FILE* outf=fopen(outfilnam,"w");
   fprintf(outf,"%d %d %d\n",fCarlos,fSide,IsModuleGood());
+  fprintf(outf,"%d\n",fHighThreshold);
+  fprintf(outf,"%d\n",fLowThreshold);
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
     fprintf(outf,"%d %d %8.3f %d %d %8.3f %8.3f %8.3f %8.3f\n",ian,IsAnodeGood(ian),GetAnodeBaseline(ian),GetAnodeEqualizedBaseline(ian),GetAnodeBaselineOffset(ian),GetAnodeRawNoise(ian),GetAnodeCommonMode(ian),GetAnodeCorrNoise(ian),GetChannelGain(ian));
   }
index c91e302b1f6dd14818f55474e69343aa23e3ded9..7778c37f22089f27fff0d5e0104665922f7e65ba 100644 (file)
@@ -51,6 +51,8 @@ class AliITSOnlineSDDTP : public AliITSOnlineSDD {
  private:
   Int_t fNEvents[fgkNAnodes];      // number of TP events for given anode
   Float_t fDAC;                    // Pascal Test Pulse amplitude (DAC units)
+  Int_t fLowThreshold;           // low threshold for zero supp.
+  Int_t fHighThreshold;          // high threshold for zero supp.
   Bool_t fGoodAnode[fgkNAnodes];   // array of anode quality (1 good, 0 bad) 
   Float_t fBaseline[fgkNAnodes];   // array of anode baselines
   Int_t fEqBaseline[fgkNAnodes];   // array of anode baselines after equalization
index 4d859654533146b400b239a7fc7a576890a3d0c3..aa15a56c4aa101f1ba198405fffe91e0fe69f5c1 100644 (file)
@@ -13,7 +13,7 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/* $Id$ */
+/* $Id:$ */
 
 ///////////////////////////////////////////////////////////////////
 //                                                               //
@@ -84,6 +84,7 @@ Bool_t AliITSPreprocessorSDD::ProcessPulser(AliITSDDLModuleMapSDD* ddlmap){
   Char_t inpFileName[100];
   Float_t baseline,rawnoise,cmn,corn,gain;
   Int_t isgoodan,i,im,is,isgoodmod,basmin,basoff;
+  Int_t th,tl;
   Int_t numOfBadChannels[kNumberOfSDD];
   
   TList* sourceList = GetFileSources(kDAQ, "SDD_Calib");
@@ -123,6 +124,8 @@ Bool_t AliITSPreprocessorSDD::ProcessPulser(AliITSDDLModuleMapSDD* ddlmap){
          continue;
        }
        fscanf(basFil,"%d %d %d\n",&im,&is,&isgoodmod);
+       fscanf(basFil,"%d\n",&th);
+       fscanf(basFil,"%d\n",&tl);
        if(!isgoodmod) cal->SetBad();
        for(Int_t ian=0;ian<(kNumberOfChannels/2);ian++){
          fscanf(basFil,"%d %d %f %d %d %f %f %f %f\n",&i,&isgoodan,&baseline,&basmin,&basoff,&rawnoise,&cmn,&corn,&gain);