Update of pad status calculation (pad capacity dep. of noise, bridged pads)
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 13 Aug 2008 15:26:24 +0000 (15:26 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 13 Aug 2008 15:26:24 +0000 (15:26 +0000)
TRD/AliTRDCalibPadStatus.cxx
TRD/AliTRDCalibraFillHisto.cxx
TRD/AliTRDCalibraFillHisto.h
TRD/AliTRDPreprocessor.cxx
TRD/Cal/AliTRDCalROC.cxx
TRD/Cal/AliTRDCalROC.h

index 3d0f2d9..6b4cea4 100644 (file)
@@ -397,7 +397,7 @@ TH2F* AliTRDCalibPadStatus::GetHisto(Int_t det, TObjArray *arr, /*FOLD00*/
     // if we are forced and histogram doesn't yes exist create it
     Char_t name[255], title[255];
 
-    sprintf(name,"hCalib%s%.2d",type,det);
+    sprintf(name,"hCalib%s%.3d",type,det);
     sprintf(title,"%s calibration histogram detector %.2d;ADC channel;Channel (pad)",type,det);
 
    
@@ -581,6 +581,7 @@ AliTRDCalPadStatus* AliTRDCalibPadStatus::CreateCalPadStatus()
 {
   //
   // Create Pad Status out of Mean and RMS values
+  // The chamber without data are masked, this is the corrected in the preprocessor
   //
 
   AliTRDCalPadStatus* obj = new AliTRDCalPadStatus("padstatus", "padstatus");
@@ -589,45 +590,95 @@ AliTRDCalPadStatus* AliTRDCalibPadStatus::CreateCalPadStatus()
     {
       AliTRDCalSingleChamberStatus *calROC = obj->GetCalROC(idet);
 
-      //Take the stuff
-      AliTRDCalROC *calRocMean    = ((AliTRDCalROC *)GetCalRocMean(idet));
-      AliTRDCalROC *calRocRMS     = ((AliTRDCalROC *)GetCalRocRMS(idet));
-
-      //Take the stuff second chance
-      AliTRDCalROC *calRocMeand    = ((AliTRDCalROC *)GetCalRocMeand(idet));
-      AliTRDCalROC *calRocRMSd     = ((AliTRDCalROC *)GetCalRocRMSd(idet));
 
-      if ( !calRocMean ) {
+      if ( !GetCalRocMean(idet)) {
        for(Int_t k = 0; k < calROC->GetNchannels(); k++){
-         calROC->SetStatus(k,AliTRDCalPadStatus::kMasked);
+         calROC->SetStatus(k,AliTRDCalPadStatus::kNotConnected);
        }
        continue;
       }
       
+
+      //Take the stuff
+      AliTRDCalROC *calRocMean    = new AliTRDCalROC(*( (AliTRDCalROC *) GetCalRocMean(idet)));
+      AliTRDCalROC *calRocRMS     = new AliTRDCalROC(*( (AliTRDCalROC *) GetCalRocRMS(idet)));
+
+      //Take the stuff second chance
+      AliTRDCalROC *calRocMeand    = new AliTRDCalROC(*( (AliTRDCalROC *) GetCalRocMeand(idet)));
+      AliTRDCalROC *calRocRMSd     = new AliTRDCalROC(*( (AliTRDCalROC *) GetCalRocRMSd(idet)));
+
+      calRocRMS->Unfold();
+      calRocRMSd->Unfold();
+
+     
       //Range
-      Int_t channels = calROC->GetNchannels();
+      Int_t row      = calROC->GetNrows();
+      Int_t col      = calROC->GetNcols();
       
       Double_t rmsmean       = calRocMean->GetRMS()*10.0;
       Double_t meanmean      = calRocMean->GetMean()*10.0;
-      Double_t meansquares   = calRocRMS->GetMean()*10.0;
+      Double_t meansquares   = calRocRMS->GetMean();
 
-      for(Int_t ich = 0; ich < channels; ich++){
+      
+      for(Int_t irow = 0; irow < row; irow++){
        
-       Float_t mean     = calRocMean->GetValue(ich)*10.0;
-       Float_t rms      = calRocRMS->GetValue(ich)*10.0;
+       // for bridged pads
+       Float_t meanprevious = 0.0;
+       Float_t rmsprevious  = 0.0; 
+       Float_t mean         = 0.0;
+       Float_t rms          = 0.0;
        
-       if((rms <= 0.0001) || (TMath::Abs(mean-meanmean)>(5*rmsmean)) || (TMath::Abs(rms)>(5.0*TMath::Abs(meansquares)))) {
-         // look at second chance
-         Float_t meand     = calRocMeand->GetValue(ich)*10.0;
-         Float_t rmsd      = calRocRMSd->GetValue(ich)*10.0;
+       for(Int_t icol = 0; icol < col; icol++){
+         
+         mean     = calRocMean->GetValue(icol,irow)*10.0;
+         rms      = calRocRMS->GetValue(icol,irow);
+
+         if(icol > 0) {
+           meanprevious     = calRocMean->GetValue((icol -1),irow)*10.0;
+           rmsprevious      = calRocRMS->GetValue((icol - 1),irow);
+         }
+         
+         Bool_t pb = kFALSE;
+         // masked if two noisy
+         if((rms <= 0.0001) || (TMath::Abs(mean-meanmean)>(5*rmsmean)) || (TMath::Abs(rms)>(5.0*TMath::Abs(meansquares)))) {
+           
+           pb = kTRUE;
+           // look at second chance
+           Float_t meand     = calRocMeand->GetValue(icol,irow)*10.0;
+           Float_t rmsd      = calRocRMSd->GetValue(icol,irow);
+           
+           if((rmsd <= 0.0001) || (TMath::Abs(meand-meanmean)>(5*rmsmean)) || (TMath::Abs(rmsd)>(5.0*TMath::Abs(meansquares)))) {
+             if((rmsd <= 0.0001) && (rms <= 0.0001)) {
+               calROC->SetStatus(icol,irow,AliTRDCalPadStatus::kNotConnected);
+             }
+             else {
+               calROC->SetStatus(icol, irow, AliTRDCalPadStatus::kMasked);
+             }
+           }
+           else {
+             calROC->SetStatus(icol, irow, AliTRDCalPadStatus::kReadSecond);
+           }
+         }
 
-         if((rmsd <= 0.0001) || (TMath::Abs(meand-meanmean)>(5*rmsmean)) || (TMath::Abs(rmsd)>(5.0*TMath::Abs(meansquares)))) {
-           calROC->SetStatus(ich, AliTRDCalPadStatus::kMasked);
+
+         // bridge if previous pad found something
+         if(!pb) {
+           if((meanprevious == mean) && (rmsprevious == rms) && (mean > 0.0001)) {
+             //printf("mean previous %f, mean %f, rms %f, rmsprevious %f, col %d\n",meanprevious,mean,rms,rmsprevious,icol);
+             calROC->SetStatus(icol -1 ,irow, AliTRDCalPadStatus::kPadBridgedRight);
+             calROC->SetStatus(icol ,irow, AliTRDCalPadStatus::kPadBridgedLeft);
+           }       
          }
-         else calROC->SetStatus(ich, AliTRDCalPadStatus::kReadSecond);
+
        }
-       
       }
+
+      delete calRocMean;
+      delete calRocRMS;
+      delete calRocMeand;
+      delete calRocRMSd;
+
+
     }
   
   return obj;
index dcb4abf..713853a 100644 (file)
@@ -132,13 +132,14 @@ AliTRDCalibraFillHisto::AliTRDCalibraFillHisto()
   ,fRelativeScale(0)
   ,fThresholdClusterPRF2(15.0)
   ,fLimitChargeIntegration(kFALSE)
+  ,fFillWithZero(kTRUE)
   ,fCalibraMode(new AliTRDCalibraMode())
   ,fDebugStreamer(0)
   ,fDebugLevel(0)
   ,fDetectorPreviousTrack(-1)
   ,fMCMPrevious(-1)
   ,fROBPrevious(-1)
-  ,fNumberClusters(18)
+  ,fNumberClusters(0)
   ,fNumberClustersf(30)
   ,fProcent(6.0)
   ,fDifference(17)
@@ -195,6 +196,7 @@ AliTRDCalibraFillHisto::AliTRDCalibraFillHisto(const AliTRDCalibraFillHisto &c)
   ,fRelativeScale(c.fRelativeScale)
   ,fThresholdClusterPRF2(c.fThresholdClusterPRF2)
   ,fLimitChargeIntegration(c.fLimitChargeIntegration)
+  ,fFillWithZero(c.fFillWithZero)
   ,fCalibraMode(0x0)
   ,fDebugStreamer(0)
   ,fDebugLevel(c.fDebugLevel)
@@ -345,7 +347,7 @@ Bool_t AliTRDCalibraFillHisto::Init2Dhistos()
   fSf                 = parCom->GetSamplingFrequency();
   fRelativeScale      = 20;
   fNumberClustersf    = fTimeMax;
-  fNumberClusters     = (Int_t)(0.6*fTimeMax);
+  fNumberClusters     = (Int_t)(0.5*fTimeMax);
  
   //calib object from database used for reconstruction
   if(fCalDetGain) delete fCalDetGain;
@@ -762,7 +764,7 @@ Bool_t AliTRDCalibraFillHisto::FindP1TrackPHtracklet(AliTRDtrack *t, Int_t index
   TVectorD pars;
   linearFitterTracklet.Eval();
   linearFitterTracklet.GetParameters(pars);
-  pointError  =  TMath::Sqrt(linearFitterTracklet.GetChisquare()/nbli);
+  pointError  =  TMath::Sqrt(linearFitterTracklet.GetChisquare()/(nbli-2));
   errorpar    =  linearFitterTracklet.GetParError(1)*pointError;
   dydt        = pars[1]; 
 
@@ -907,10 +909,11 @@ Bool_t AliTRDCalibraFillHisto::FindP1TrackPHtrackletV1(const AliTRDseedV1 *track
   ////////////////////////////////////
   // Do the straight line fit now
   ///////////////////////////////////
+  if(nbli <= 2) return kFALSE; 
   TVectorD pars;
   linearFitterTracklet.Eval();
   linearFitterTracklet.GetParameters(pars);
-  pointError  =  TMath::Sqrt(linearFitterTracklet.GetChisquare()/nbli);
+  pointError  =  TMath::Sqrt(linearFitterTracklet.GetChisquare()/(nbli-2));
   errorpar    =  linearFitterTracklet.GetParError(1)*pointError;
   dydt        = pars[1]; 
  
@@ -1042,7 +1045,7 @@ Bool_t AliTRDCalibraFillHisto::HandlePRFtracklet(AliTRDtrack *t, Int_t index0, I
     //Take the cluster
     AliTRDcluster *cl  = (AliTRDcluster *) t->GetCluster(k+index0);
     Short_t  *signals  = cl->GetSignals();
-    Double_t     time  = cl->GetPadTime();
+    Double_t     time  = cl->GetLocalTimeBin();
     //Calculate x if possible 
     Float_t xcenter    = 0.0;    
     Bool_t  echec1      = kTRUE;   
@@ -1082,7 +1085,9 @@ Bool_t AliTRDCalibraFillHisto::HandlePRFtracklet(AliTRDtrack *t, Int_t index0, I
   TVectorD line(2);
   fitter.GetParameters(line);
   Float_t  pointError  = -1.0;
-  pointError  =  TMath::Sqrt(fitter.GetChisquare()/nb3pc);
+  if(fitter.GetChisquare()>=0.0) {
+    pointError  =  TMath::Sqrt(fitter.GetChisquare()/(nb3pc-2));
+  }
   
   /////////////////////////////////////////////////////
   // Now fill the PRF: second loop over clusters
@@ -1091,7 +1096,7 @@ Bool_t AliTRDCalibraFillHisto::HandlePRFtracklet(AliTRDtrack *t, Int_t index0, I
     //Take the cluster
     AliTRDcluster *cl      = (AliTRDcluster *) t->GetCluster(k+index0);
     Short_t  *signals      = cl->GetSignals();              // signal
-    Double_t     time      = cl->GetPadTime();              // time bin
+    Double_t     time      = cl->GetLocalTimeBin();              // time bin
     Float_t padPosTracklet = line[0]+line[1]*time;          // reconstruct position from fit
     Float_t padPos         = cl->GetPadCol();               // middle pad
     Double_t dpad          = padPosTracklet - padPos;       // reconstruct position relative to middle pad from fit 
@@ -1351,7 +1356,7 @@ Bool_t AliTRDCalibraFillHisto::HandlePRFtrackletV1(const AliTRDseedV1 *tracklet,
   for(int ic=0; ic<AliTRDseed::knTimebins; ic++){
     if(!(cl = tracklet->GetClusters(ic))) continue;
     
-    Double_t     time  = cl->GetPadTime();
+    Double_t     time  = cl->GetLocalTimeBin();
     if((time<=7) || (time>=21)) continue;
     Short_t  *signals  = cl->GetSignals(); 
     Float_t xcenter    = 0.0;    
@@ -1401,7 +1406,7 @@ Bool_t AliTRDCalibraFillHisto::HandlePRFtrackletV1(const AliTRDseedV1 *tracklet,
   fitter.GetParameters(line);
   Float_t  pointError  = -1.0;
   if(fitter.GetChisquare()>=0.0) {
-  pointError  =  TMath::Sqrt(fitter.GetChisquare()/nb3pc);
+  pointError  =  TMath::Sqrt(fitter.GetChisquare()/(nb3pc-2));
   }
 
   //printf("PRF second loop \n");
@@ -1412,7 +1417,7 @@ Bool_t AliTRDCalibraFillHisto::HandlePRFtrackletV1(const AliTRDseedV1 *tracklet,
     if(!(cl = tracklet->GetClusters(ic))) continue;
 
     Short_t  *signals      = cl->GetSignals();              // signal
-    Double_t     time      = cl->GetPadTime();              // time bin
+    Double_t     time      = cl->GetLocalTimeBin();         // time bin
     Float_t padPosTracklet = line[0]+line[1]*time;          // reconstruct position from fit
     Float_t padPos         = cl->GetPadCol();               // middle pad
     Double_t dpad          = padPosTracklet - padPos;       // reconstruct position relative to middle pad from fit 
@@ -1893,7 +1898,7 @@ void AliTRDCalibraFillHisto::FillTheInfoOfTheTrackCH(Int_t nbclusters)
       fEntriesCH[fCalibraMode->GetXbins(0)+fd]++;
       if (fHisto2d) {
        FillCH2d(fCalibraMode->GetXbins(0)+fd,fAmpTotal[fd]/fRelativeScale);
-       //fCH2d->Fill(fAmpTotal[fd]/fRelativeScale,fCalibraMode->GetXbins(0)+fd+0.5);
+       //fCH2d->Fill(fAmpTotal[fd]/fRelativeScale,fCalibraMode->GetXbins(0)+fd+0.5);
       }
       if (fVector2d) {
        fCalibraVector->UpdateVectorCH(fDetectorPreviousTrack,fd,fAmpTotal[fd]/fRelativeScale);
@@ -2011,11 +2016,17 @@ void AliTRDCalibraFillHisto::FillTheInfoOfTheTrackPH()
       fNumberUsedPh[0]++;
       for (Int_t i = 0; i < fTimeMax; i++) {
        if (fHisto2d) {
-         fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd1)+0.5,(Float_t) fPHValue[i]);
+         if(fFillWithZero) fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd1)+0.5,(Float_t) fPHValue[i]);
+         else {
+           if(((Float_t) fPHValue[i] > 0.0)) fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd1)+0.5,(Float_t) fPHValue[i]);
+             }
          //printf("Fill the time bin %d with %f\n",i,fPHValue[i]);
        }
        if (fVector2d) {
-         fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd1,i,fPHValue[i]);
+         if(fFillWithZero) fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd1,i,fPHValue[i]);
+         else {
+           if(((Float_t) fPHValue[i] > 0.0)) fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd1,i,fPHValue[i]);  
+         }
        }
       }
       break;
@@ -2028,10 +2039,16 @@ void AliTRDCalibraFillHisto::FillTheInfoOfTheTrackPH()
          fNumberUsedPh[1]++;
          for (Int_t i = 0; i < fTimeMax; i++) {
            if (fHisto2d) {
-             fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd1)+0.5,(Float_t) fPHValue[i]);
+             if(fFillWithZero) fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd1)+0.5,(Float_t) fPHValue[i]);
+             else {
+               if(((Float_t) fPHValue[i] > 0.0)) fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd1)+0.5,(Float_t) fPHValue[i]);
+                 }
            }
            if (fVector2d) {
-             fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd1,i,fPHValue[i]);
+             if(fFillWithZero) fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd1,i,fPHValue[i]);
+             else {
+               if(((Float_t) fPHValue[i] > 0.0)) fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd1,i,fPHValue[i]);
+                 }
            }
          }
        }
@@ -2040,10 +2057,16 @@ void AliTRDCalibraFillHisto::FillTheInfoOfTheTrackPH()
          fNumberUsedPh[1]++;
          for (Int_t i = 0; i < fTimeMax; i++) {
            if (fHisto2d) {
-             fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd2)+0.5,(Float_t) fPHValue[i]);
+             if(fFillWithZero) fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd2)+0.5,(Float_t) fPHValue[i]);
+             else {
+               if(((Float_t) fPHValue[i] > 0.0)) fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd2)+0.5,(Float_t) fPHValue[i]);
+             }
            }
          if (fVector2d) {
-           fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd2,i,fPHValue[i]);
+           if(fFillWithZero) fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd2,i,fPHValue[i]);
+           else {
+             if(((Float_t) fPHValue[i] > 0.0)) fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd2,i,fPHValue[i]);
+           }
          }
          }
        }
@@ -2059,10 +2082,16 @@ void AliTRDCalibraFillHisto::FillTheInfoOfTheTrackPH()
              fNumberUsedPh[1]++;
              for (Int_t i = 0; i < fTimeMax; i++) {
                if (fHisto2d) {
-                 fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd1)+0.5,(Float_t) fPHValue[i]);
+                 if(fFillWithZero) fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd1)+0.5,(Float_t) fPHValue[i]);
+                 else {
+                   if(((Float_t) fPHValue[i] > 0.0)) fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd1)+0.5,(Float_t) fPHValue[i]);
+                 }
                }
                if (fVector2d) {
-                 fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd1,i,fPHValue[i]);
+                 if(fFillWithZero) fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd1,i,fPHValue[i]);
+                 else {
+                   if(((Float_t) fPHValue[i] > 0.0)) fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd1,i,fPHValue[i]);
+                 }
                }
              }
            }
@@ -2071,10 +2100,16 @@ void AliTRDCalibraFillHisto::FillTheInfoOfTheTrackPH()
              fNumberUsedPh[1]++;
              for (Int_t i = 0; i < fTimeMax; i++) {
                if (fHisto2d) {
-                 fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd2)+0.5,(Float_t) fPHValue[i]);
+                 if(fFillWithZero) fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd2)+0.5,(Float_t) fPHValue[i]);
+                 else {
+                   if(((Float_t) fPHValue[i] > 0.0)) fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd2)+0.5,(Float_t) fPHValue[i]);
+                 }
                }
                if (fVector2d) {
-                 fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd2,i,fPHValue[i]);
+                 if(fFillWithZero) fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd2,i,fPHValue[i]);
+                 else {
+                   if(((Float_t) fPHValue[i] > 0.0)) fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd2,i,fPHValue[i]);
+                 }
                }
              }
            }
@@ -2090,10 +2125,16 @@ void AliTRDCalibraFillHisto::FillTheInfoOfTheTrackPH()
              fNumberUsedPh[1]++;
              for (Int_t i = 0; i < fTimeMax; i++) {
                if (fHisto2d) {
-                 fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd1)+0.5,(Float_t) fPHValue[i]);
+                 if(fFillWithZero) fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd1)+0.5,(Float_t) fPHValue[i]);
+                 else {
+                   if(((Float_t) fPHValue[i] > 0.0)) fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd1)+0.5,(Float_t) fPHValue[i]);
+                 }
                }
                if (fVector2d) {
-                 fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd1,i,fPHValue[i]);
+                 if(fFillWithZero) fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd1,i,fPHValue[i]);
+                 else {
+                   if(((Float_t) fPHValue[i] > 0.0)) fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd1,i,fPHValue[i]);
+                 }
                }
              }
            }
@@ -2102,10 +2143,16 @@ void AliTRDCalibraFillHisto::FillTheInfoOfTheTrackPH()
              fNumberUsedPh[1]++;
              for (Int_t i = 0; i < fTimeMax; i++) {
                if (fHisto2d) {
-                 fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd2)+0.5,(Float_t) fPHValue[i]);
+                 if(fFillWithZero) fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd2)+0.5,(Float_t) fPHValue[i]);
+                 else {
+                   if(((Float_t) fPHValue[i] > 0.0)) fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd2)+0.5,(Float_t) fPHValue[i]);
+                 }
                }
                if (fVector2d) {
-                 fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd2,i,fPHValue[i]);
+                 if(fFillWithZero) fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd2,i,fPHValue[i]);
+                 else {
+                   if(((Float_t) fPHValue[i] > 0.0)) fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd2,i,fPHValue[i]);
+                 }
                }
              }
            }
@@ -2874,7 +2921,10 @@ Int_t AliTRDCalibraFillHisto::FillDAQ(Double_t phvalue[16][144][36]){
   //if((TMath::RMS(fTimeMax,sum) <= 10.0) && (sum[0] > 200.0)) return 1;
   if(used == 0){
     for(Int_t it = 0; it < fTimeMax; it++){
-      UpdateDAQ(fDetectorPreviousTrack,0,0,it,sum[it],fTimeMax);  
+      if(fFillWithZero) UpdateDAQ(fDetectorPreviousTrack,0,0,it,sum[it],fTimeMax); 
+      else{
+       if(sum[it] > 0.0) UpdateDAQ(fDetectorPreviousTrack,0,0,it,sum[it],fTimeMax); 
+      } 
     }
     
    
index cb95781..c644519 100644 (file)
@@ -131,6 +131,7 @@ class AliTRDCalibraFillHisto : public TObject {
           void     SetRelativeScale(Float_t relativeScale);                      
           void     SetThresholdClusterPRF2(Float_t thresholdClusterPRF2)     { fThresholdClusterPRF2 = thresholdClusterPRF2; }
          void     SetLimitChargeIntegration(Bool_t limitChargeIntegration)  { fLimitChargeIntegration = limitChargeIntegration; }
+         void     SetFillWithZero(Bool_t fillWithZero)                      { fFillWithZero = fillWithZero;   }
          void     SetNz(Int_t i, Short_t nz);
           void     SetNrphi(Int_t i, Short_t nrphi);
           void     SetProcent(Float_t procent)                               { fProcent              = procent;              }
@@ -144,6 +145,7 @@ class AliTRDCalibraFillHisto : public TObject {
           Float_t  GetRelativeScale() const                                  { return fRelativeScale;          }
           Float_t  GetThresholdClusterPRF2() const                           { return fThresholdClusterPRF2;   }
          Bool_t   GetLimitChargeIntegration() const                         { return fLimitChargeIntegration; }
+         Bool_t   GetFillWithZero() const                                   { return fFillWithZero;           }
          Float_t  GetProcent() const                                        { return fProcent;                }
           Short_t  GetDifference() const                                     { return fDifference;             }
           Short_t  GetNumberClusters() const                                 { return fNumberClusters;         }
@@ -178,6 +180,7 @@ AliTRDCalibraVector *GetCalibraVector() const                                { r
           Float_t  fRelativeScale;          // Scale of the deposited charge
           Float_t  fThresholdClusterPRF2;   // Threshold on cluster pad signals
           Bool_t   fLimitChargeIntegration; // Integration range for the gain calibration
+         Bool_t   fFillWithZero;           // Fill with zero or not the average pulse height
   // Calibration mode
          AliTRDCalibraMode *fCalibraMode;  // Calibration mode
 
index 8b9f59f..50b3d42 100644 (file)
@@ -421,7 +421,7 @@ Bool_t AliTRDPreprocessor::ExtractPedestals()
     for(Int_t half = 0; half < 2; half++){
 
       Bool_t data         = AreThereDataPedestal(calROCStatus,(Bool_t)half);
-      printf("There are data for the detector %d the half %d: %d\n",det,half,data);
+      //printf("There are data for the detector %d the half %d: %d\n",det,half,data);
       if(!data){
        // look if data in the OCDB
        Bool_t dataPrevious = AreThereDataPedestal(calROCPreviousStatus,(Bool_t)half);
@@ -498,7 +498,7 @@ Bool_t AliTRDPreprocessor::AreThereDataPedestal(AliTRDCalSingleChamberStatus *ca
   for(Int_t col = nCol0; col < nColE; col++){
     for(Int_t row = 0; row < calROCStatus->GetNrows(); row++){
       //printf("ismasked %d\n",(Int_t)calROCStatus->IsMasked(col,row));
-      if(!calROCStatus->IsMasked(col,row)) {
+      if(!calROCStatus->GetStatus(col,row)) {
        data = kTRUE;
        continue;
       }
index 4ed4343..5320731 100644 (file)
@@ -241,8 +241,10 @@ Double_t AliTRDCalROC::GetMean(AliTRDCalROC* outlierROC)
    Int_t NPoints = 0;
    for (Int_t i=0;i<fNchannels;i++) {
       if ((!outlierROC) || (!(outlierROC->GetValue(i)))) {
-         ddata[NPoints]= (Double_t) fData[NPoints]/10000;
+       if(fData[i] > 0.000000000000001){
+         ddata[NPoints]= (Double_t) fData[i]/10000;
          NPoints++;
+       }
       }
    }
    Double_t mean = TMath::Mean(NPoints,ddata);
@@ -261,9 +263,11 @@ Double_t AliTRDCalROC::GetMedian(AliTRDCalROC* outlierROC)
    Int_t NPoints = 0;
    for (Int_t i=0;i<fNchannels;i++) {
        if ((!outlierROC) || (!(outlierROC->GetValue(i)))) {
-         ddata[NPoints]= (Double_t) fData[NPoints]/10000;
-         NPoints++;
-      }
+        if(fData[i] > 0.000000000000001){         
+          ddata[NPoints]= (Double_t) fData[i]/10000;
+          NPoints++;
+        }
+       }
    }
    Double_t mean = TMath::Median(NPoints,ddata);
    delete [] ddata;
@@ -278,16 +282,18 @@ Double_t AliTRDCalROC::GetRMS(AliTRDCalROC* outlierROC)
   //
 
   Double_t *ddata = new Double_t[fNchannels];
-   Int_t NPoints = 0;
-   for (Int_t i=0;i<fNchannels;i++) {
-     if ((!outlierROC) || (!(outlierROC->GetValue(i)))) {
-         ddata[NPoints]= (Double_t)fData[NPoints]/10000;
+  Int_t NPoints = 0;
+  for (Int_t i=0;i<fNchannels;i++) {
+    if ((!outlierROC) || (!(outlierROC->GetValue(i)))) {
+       if(fData[i] > 0.000000000000001){
+         ddata[NPoints]= (Double_t)fData[i]/10000;
          NPoints++;
-      }
-   }
-   Double_t mean = TMath::RMS(NPoints,ddata);
-   delete [] ddata;
-   return mean;
+       }
+    }
+  }
+  Double_t mean = TMath::RMS(NPoints,ddata);
+  delete [] ddata;
+  return mean;
 }
 
 //______________________________________________________________________________________________
@@ -302,8 +308,10 @@ Double_t AliTRDCalROC::GetLTM(Double_t *sigma, Double_t fraction, AliTRDCalROC*
   UInt_t NPoints = 0;
   for (Int_t i=0;i<fNchannels;i++) {
      if (!outlierROC || !(outlierROC->GetValue(i))) {
-        ddata[NPoints]= (Double_t) fData[NPoints]/10000;
-        NPoints++;
+       if(fData[i] > 0.000000000000001){
+        ddata[NPoints]= (Double_t) fData[i]/10000;
+        NPoints++;
+       }
      }
   }
   Int_t hh = TMath::Min(TMath::Nint(fraction *NPoints), Int_t(NPoints));
@@ -406,6 +414,53 @@ Bool_t AliTRDCalROC::Divide(const AliTRDCalROC*  roc)
   }
   return result;
 }
+//______________________________________________________________________________________________
+Bool_t AliTRDCalROC::Unfold() 
+{
+  //
+  // Compute the mean value per pad col
+  // Divide with this value each pad col
+  // This is for the noise study
+  // Return kFALSE if one or more of the pad col was not normalised
+  //
+  Bool_t result = kTRUE;
+  Float_t kEpsilon=0.00000000000000001;
+  
+  // calcul the mean value per col
+  for(Int_t icol = 0; icol < fNcols; icol++){
+
+    Float_t mean = 0.0;
+    Float_t nb   = 0.0;
+
+    for(Int_t irow = 0; irow < fNrows; irow++){
+      if((GetValue(icol,irow) > 0.06) && (GetValue(icol,irow) < 0.15)){
+       mean += GetValue(icol,irow);
+       nb += 1.0;
+      }
+    }
+    
+    if(nb > kEpsilon) {
+      
+      mean = mean/nb;
+
+      if(mean > kEpsilon){
+       for(Int_t irow = 0; irow < fNrows; irow++){
+         Float_t value = GetValue(icol,irow);
+         SetValue(icol,irow,(Float_t)(value/mean));
+       }    
+      }
+      else result = kFALSE;
+      
+    }
+
+    else result = kFALSE;
+
+    
+  }
+
+  return result;
+}
 
 //__________________________________________________________________________________
 TH2F * AliTRDCalROC::MakeHisto2D(Float_t min, Float_t max,Int_t type,  Float_t mu)
index 2d8c1f3..3fd0d9c 100644 (file)
@@ -62,6 +62,9 @@ class AliTRDCalROC : public TObject
   Bool_t Add(const AliTRDCalROC * roc, Double_t c1 = 1);
   Bool_t Multiply(const AliTRDCalROC * roc);   
   Bool_t Divide(const AliTRDCalROC * roc);   
+
+  // noise
+  Bool_t Unfold();
   
   //Plots
   TH2F *   MakeHisto2D(Float_t min, Float_t max,Int_t type, Float_t mu = 1.0);