]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Update of the noise procedure
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 30 Jun 2008 16:19:02 +0000 (16:19 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 30 Jun 2008 16:19:02 +0000 (16:19 +0000)
TRD/AliTRDPreprocessor.cxx
TRD/AliTRDPreprocessor.h

index 4be9b21e3d3c326326fdb97fe162c2feeb39b5a8..8b9f59f528f15203be39c2478f7d49e04a5a21ce 100644 (file)
 #include "AliTRDCalibPadStatus.h"
 #include "AliTRDSaxHandler.h"
 #include "Cal/AliTRDCalDet.h"
+#include "Cal/AliTRDCalPad.h"
 #include "Cal/AliTRDCalPadStatus.h"
 #include "Cal/AliTRDCalDCS.h"
+#include "Cal/AliTRDCalSingleChamberStatus.h"
+#include "Cal/AliTRDCalROC.h"
+
 
 ClassImp(AliTRDPreprocessor)
 
@@ -274,7 +278,7 @@ Bool_t AliTRDPreprocessor::ExtractPedestals()
   // PadStatus3 for sm-06-07-08-15-16-17
   // PadStatus0 if nothing found..means problems
   //
+
   Bool_t error = kFALSE;
 
   // Init a AliTRDCalibPadStatus
@@ -362,11 +366,83 @@ Bool_t AliTRDPreprocessor::ExtractPedestals()
   }
 
   //
-  // Store pedestal entry to OCDB
+  // Create pedestal 
   //
     
   // Create Pad Status
   AliTRDCalPadStatus *calPadStatus = calPedSum.CreateCalPadStatus();
+  // Create Noise 
+  //Make the AliTRDCalPad
+  AliTRDCalPad *calPad2 = calPedSum.CreateCalPad();
+  //Make the AliTRDCalDet correspondant
+  AliTRDCalDet *calDet = calPedSum.CreateCalDet();
+  //
+  // Take the noise and Pad status from the previous OCDB
+  //
+
+  AliTRDCalPad *calPadPrevious=0;
+  AliCDBEntry* entry = GetFromOCDB("Calib", "PadNoise");
+  if (entry) calPadPrevious = (AliTRDCalPad*)entry->GetObject();
+  if ( calPadPrevious==NULL ) {
+     Log("AliTRDPreprocsessor: No previous TRD pad noise entry available.\n");
+     calPadPrevious = new AliTRDCalPad("PadNoise", "PadNoise");
+  }
+
+  AliTRDCalPadStatus *calPadStatusPrevious=0;
+  entry = GetFromOCDB("Calib", "PadStatus");
+  if (entry) calPadStatusPrevious = (AliTRDCalPadStatus*)entry->GetObject();
+  if ( calPadStatusPrevious==NULL ) {
+    Log("AliTRDPreprocsessor: No previous TRD pad status entry available.\n");
+    calPadStatusPrevious = new AliTRDCalPadStatus("padstatus", "padstatus");
+    for (Int_t idet=0; idet<540; ++idet)
+      {
+       AliTRDCalSingleChamberStatus *calROC = calPadStatusPrevious->GetCalROC(idet);
+       for(Int_t k = 0; k < calROC->GetNchannels(); k++){
+         calROC->SetStatus(k,AliTRDCalPadStatus::kMasked);
+       }
+      }
+  }
+
+  
+  // Loop over detectors for check
+  for (Int_t det=0; det<AliTRDgeometry::kNdet; ++det)  {
+    
+    // noise
+    AliTRDCalROC *calROCPreviousNoise = calPadPrevious->GetCalROC(det);
+    AliTRDCalROC *calROCNoise         = calPad2->GetCalROC(det);
+
+    // padstatus
+    AliTRDCalSingleChamberStatus *calROCPreviousStatus = calPadStatusPrevious->GetCalROC(det);
+    AliTRDCalSingleChamberStatus *calROCStatus         = calPadStatus->GetCalROC(det);
+    
+    
+    // loop over first half and second half chamber
+    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);
+      if(!data){
+       // look if data in the OCDB
+       Bool_t dataPrevious = AreThereDataPedestal(calROCPreviousStatus,(Bool_t)half);
+       // if no data at all, set to default value
+       if(!dataPrevious){
+         SetDefaultStatus(*calROCStatus,(Bool_t)half);
+         SetDefaultNoise(*calROCNoise,(Bool_t)half);
+       }
+       else{
+         // if data, set to previous value
+         SetStatus(*calROCStatus,calROCPreviousStatus,(Bool_t)half);
+         SetNoise(*calROCNoise,calROCPreviousNoise,(Bool_t)half);
+       }
+      }
+    }
+  }
+  
+  //
+  // Store  
+  //  
+
   AliCDBMetaData md3; 
   md3.SetObjectClassName("AliTRDCalPadStatus");
   md3.SetResponsible("Raphaelle Bailhache");
@@ -378,9 +454,6 @@ Bool_t AliTRDPreprocessor::ExtractPedestals()
     return kTRUE;
   }
 
-  // Create Noise 
-  //Make the AliTRDCalPad
-  AliTRDCalPad *calPad2 = calPedSum.CreateCalPad();
   AliCDBMetaData md4; 
   md4.SetObjectClassName("AliTRDCalPad");
   md4.SetResponsible("Raphaelle Bailhache");
@@ -391,8 +464,7 @@ Bool_t AliTRDPreprocessor::ExtractPedestals()
     delete listpad;
     return kTRUE;
   }
-  //Make the AliTRDCalDet correspondant
-  AliTRDCalDet *calDet = calPedSum.CreateCalDet();
+  
   AliCDBMetaData md5; 
   md5.SetObjectClassName("AliTRDCalDet");
   md5.SetResponsible("Raphaelle Bailhache");
@@ -406,9 +478,117 @@ Bool_t AliTRDPreprocessor::ExtractPedestals()
 
   delete listpad;
   return error; 
+  
+}
+//__________________________________________________________________
+Bool_t AliTRDPreprocessor::AreThereDataPedestal(AliTRDCalSingleChamberStatus *calROCStatus, Bool_t second){
 
+  //
+  // Data for this half chamber
+  //
+
+  Bool_t data         = kFALSE;
+  Int_t nCols         = calROCStatus->GetNcols();
+  Int_t nCol0         = 0;
+  Int_t nColE         = (Int_t) nCols/2 - 2;
+  if(second) {
+    nCol0 = nColE + 4;
+    nColE = nCols;
+  }
+  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)) {
+       data = kTRUE;
+       continue;
+      }
+    }
+    if(data) continue;
+  }
+
+  return data;
+  
+}
+//__________________________________________________________________
+void AliTRDPreprocessor::SetDefaultStatus(AliTRDCalSingleChamberStatus &calROCStatus, Bool_t second){
+
+  //
+  // default status for this half chamber
+  //
+
+  Int_t nCols         = calROCStatus.GetNcols();
+  Int_t nCol0         = 0;
+  Int_t nColE         = (Int_t) nCols/2;
+  if(second) {
+    nCol0 = nColE;
+    nColE = nCols;
+  }
+  for(Int_t col = nCol0; col < nColE; col++){
+    for(Int_t row = 0; row < calROCStatus.GetNrows(); row++){
+      calROCStatus.SetStatus(col,row,0);
+    }
+  }
+}
+//__________________________________________________________________
+void AliTRDPreprocessor::SetStatus(AliTRDCalSingleChamberStatus &calROCStatus, AliTRDCalSingleChamberStatus *calROCStatusPrevious,Bool_t second){
+
+  //
+  // previous status for this half chamber
+  //
+
+  Int_t nCols         = calROCStatus.GetNcols();
+  Int_t nCol0         = 0;
+  Int_t nColE         = (Int_t) nCols/2;
+  if(second) {
+    nCol0 = nColE;
+    nColE = nCols;
+  }
+  for(Int_t col = nCol0; col < nColE; col++){
+    for(Int_t row = 0; row < calROCStatus.GetNrows(); row++){
+      calROCStatus.SetStatus(col,row,calROCStatusPrevious->GetStatus(col,row));
+    }
+  }
+}
+//__________________________________________________________________
+void AliTRDPreprocessor::SetDefaultNoise(AliTRDCalROC &calROCNoise, Bool_t second){
+
+  //
+  // default noise for this half chamber
+  //
+
+  Int_t nCols         = calROCNoise.GetNcols();
+  Int_t nCol0         = 0;
+  Int_t nColE         = (Int_t) nCols/2;
+  if(second) {
+    nCol0 = nColE;
+    nColE = nCols;
+  }
+  for(Int_t col = nCol0; col < nColE; col++){
+    for(Int_t row = 0; row < calROCNoise.GetNrows(); row++){
+      calROCNoise.SetValue(col,row,0.12);
+    }
+  }
 }
+//__________________________________________________________________
+void AliTRDPreprocessor::SetNoise(AliTRDCalROC &calROCNoise, AliTRDCalROC *calROCNoisePrevious, Bool_t second){
+
+  //
+  // previous noise for this half chamber
+  //
 
+  Int_t nCols         = calROCNoise.GetNcols();
+  Int_t nCol0         = 0;
+  Int_t nColE         = (Int_t) nCols/2;
+  if(second) {
+    nCol0 = nColE;
+    nColE = nCols;
+  }
+  for(Int_t col = nCol0; col < nColE; col++){
+    for(Int_t row = 0; row < calROCNoise.GetNrows(); row++){
+      calROCNoise.SetValue(col,row,calROCNoisePrevious->GetValue(col,row));
+    }
+  }
+}
 //______________________________________________________________________________________________
 Bool_t AliTRDPreprocessor::ExtractDriftVelocityDAQ()
 {
index 30495142eec6b680c8f7abb921ab9c03659a83a6..4549684af2c59a31634d7c6957f3122ded1b74f3 100644 (file)
@@ -15,6 +15,8 @@
 #include "AliPreprocessor.h"
 
 class TMap;
+class AliTRDCalROC;
+class AliTRDCalSingleChamberStatus;
 
 class AliTRDPreprocessor : public AliPreprocessor
 {
@@ -41,7 +43,14 @@ class AliTRDPreprocessor : public AliPreprocessor
           Bool_t  fVdriftHLT;             // HLT Vdrift
          UInt_t  ProcessDCSConfigData(); // process DCS configuration
 
-  ClassDef(AliTRDPreprocessor,1)          // The SHUTTLE preprocessor for TRD
+
+         Bool_t AreThereDataPedestal(AliTRDCalSingleChamberStatus *calROCStatus, Bool_t second);
+         void   SetDefaultStatus(AliTRDCalSingleChamberStatus &calROCStatus, Bool_t second);
+         void   SetStatus(AliTRDCalSingleChamberStatus &calROCStatus, AliTRDCalSingleChamberStatus *calROCStatusPrevious,Bool_t second);
+         void   SetDefaultNoise(AliTRDCalROC &calROCNoise, Bool_t second);
+         void   SetNoise(AliTRDCalROC &calROCNoise, AliTRDCalROC *calROCNoisePrevious, Bool_t second);
+
+         ClassDef(AliTRDPreprocessor,1)          // The SHUTTLE preprocessor for TRD
 
 };
 #endif