]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDCalibStripRange.cxx
Added SPD outlier trigger bit
[u/mrichter/AliRoot.git] / FMD / AliFMDCalibStripRange.cxx
index 18c05a4331463ac0f8183b705bf1269c35a1376b..124b5aab69fbe35fe6e83fe6ab9c1652df43114d 100644 (file)
 // strips, and dead areas can be handled off-line. 
 // This information comes from DCS or the like.
 //
+// IMPORTANT:  The member function WriteToFile writes out the entries
+// in the format 
+//
+//     det,ring,id,min,max
+//
+// Here, id is a number from 0 to 1, which represents the division in
+// half-rings.  The mapping is as follows: 
+//
+//  Inner rings:              Outer Rings
+//    id   Sectors   Board     id   Sectors   Board 
+//   ----+---------+-------   ----+---------+-------
+//     0 |  0 -  9 |  0x10     0  |  0 - 19 |  0x11
+//     1 | 10 - 19 |  0x0      1  | 20 - 39 |  0x1
+//
+// The same mapping is used in the ReadFromFile member function
+//
+#include <iostream>
 #include "AliFMDCalibStripRange.h"     // ALIFMDCALIBGAIN_H
 #include "TString.h"
 // #include "AliFMDParameters.h"           // ALIFMDPARAMETERS_H
@@ -68,7 +85,7 @@ AliFMDCalibStripRange::Set(UShort_t det, Char_t ring,
                           UShort_t max)
 {
   // Set the min and max for a half-ring 
-  UInt_t nSec  = (ring == 'I' ? 20 : 40);
+  UInt_t nSec  = (ring == 'I' ? 10 : 20);
   UInt_t board = sector / nSec;
   fRanges(det, ring, board, 0) = ((max & 0x7f) << 8) + (min & 0x7f);
 }
@@ -79,8 +96,9 @@ AliFMDCalibStripRange::Min(UShort_t det, Char_t ring,
                           UShort_t sec, UShort_t) const
 {
   // Get the min for a half-ring 
-  UInt_t nSec  = (ring == 'I' ? 20 : 40);
+  UInt_t nSec  = (ring == 'I' ? 10 : 20);
   UInt_t board = sec / nSec;
   return (fRanges(det, ring, board, 0) & 0x7f);
 }
 
@@ -90,27 +108,30 @@ AliFMDCalibStripRange::Max(UShort_t det, Char_t ring,
                           UShort_t sec, UShort_t) const
 {
   // Get the max for a half-ring 
-  UInt_t nSec  = (ring == 'I' ? 20 : 40);
+  UInt_t nSec  = (ring == 'I' ? 10 : 20);
   UInt_t board = sec / nSec;
   return ((fRanges(det, ring, board, 0) >> 8) & 0x7f);
 }
 //____________________________________________________________________
 void 
-AliFMDCalibStripRange::WriteToFile(ofstream &outFile)
+AliFMDCalibStripRange::WriteToFile(std::ostream &outFile, Bool_t* detectors)
 {
   outFile.write("# StripRange \n",14);
   for(Int_t det=1;det<=3;det++) {
+    if (detectors && !detectors[det-1]) { 
+      continue;
+    }
     UShort_t FirstRing = (det == 1 ? 1 : 0);
     for (UShort_t ir = FirstRing; ir < 2; ir++) {
       Char_t   ring = (ir == 0 ? 'O' : 'I');
-      UShort_t nsec = (ir == 0 ? 40  : 20);
-      UShort_t nstr = (ir == 0 ? 256 : 512);
-      for(UShort_t sec =0; sec < nsec;  sec++)  {
-       outFile << det                   << ','
-               << ring                  << ','
-               << sec                   << ','
-               << Min(det,ring,sec    << ','
-               << Max(det,ring,sec    << "\n";
+      UInt_t   nSec = (ring == 'I' ? 10 : 20);
+      for(UShort_t board =0; board < 2;  board++)  {
+       UShort_t sector = board*nSec;
+       outFile << det                     << ','
+               << ring                    << ','
+               << board                   << ','
+               << Min(det,ring,sector)    << ','
+               << Max(det,ring,sector)    << "\n";
          
 
       }
@@ -121,7 +142,7 @@ AliFMDCalibStripRange::WriteToFile(ofstream &outFile)
 }
 //____________________________________________________________________
 void 
-AliFMDCalibStripRange::ReadFromFile(ifstream &inFile)
+AliFMDCalibStripRange::ReadFromFile(std::istream &inFile)
 {
   TString line;
   Bool_t readData=kFALSE;
@@ -134,29 +155,33 @@ AliFMDCalibStripRange::ReadFromFile(ifstream &inFile)
     
   }
   
-  UShort_t det, sec;
+  UShort_t det, board;
   Char_t ring;
   UShort_t min, max;
+  
   Int_t thisline = inFile.tellg();
   Char_t c[4];
   
-  while(line.ReadLine(inFile) && readData ) {
+  while( readData ) {
     thisline = inFile.tellg();
-    thisline = thisline--;
-    if(line.Contains("# ",TString::kIgnoreCase)) {
-      readData = kFALSE;
-      continue;
-    }
+    line.ReadLine(inFile);
+   
+      if(line.Contains("# ",TString::kIgnoreCase)) {
+       readData = kFALSE;
+       continue;
+      }
     
     inFile.seekg(thisline);
     inFile     >> det          >> c[0]
               >> ring         >> c[1]
-              >> sec          >> c[2]
+              >> board        >> c[2]
               >> min          >> c[3]
               >> max;
     
-    Set(det,ring,sec,0,min,max);
-
+    UInt_t nSec  = (ring == 'I' ? 10 : 20);
+    UShort_t sector = board*nSec;
+    Set(det,ring,sector,0,min,max);
+   
   }
   
   inFile.seekg(0);