*/
//____________________________________________________________________
//
+// This class stores which strips are read-out.
+// In principle this can be set for each half-ring.
+// However, in real life, all the detectors will probably read out all
+// strips, and dead areas can be handled off-line.
+// This information comes from DCS or the like.
//
-//
+#include "iostream"
#include "AliFMDCalibStripRange.h" // ALIFMDCALIBGAIN_H
-#include "AliFMDParameters.h" // ALIFMDPARAMETERS_H
+#include "TString.h"
+// #include "AliFMDParameters.h" // ALIFMDPARAMETERS_H
//____________________________________________________________________
ClassImp(AliFMDCalibStripRange)
//____________________________________________________________________
AliFMDCalibStripRange::AliFMDCalibStripRange()
- : fRates(AliFMDMap::kMaxDetectors, AliFMDMap::kMaxRings, 2, 1)
- // fRates(3)
+ : fRanges(AliFMDMap::kMaxDetectors, AliFMDMap::kMaxRings, 2, 1)
+ // fRanges(3)
{
- fRates.Reset(1);
+ // CTOR
+ fRanges.Reset(1);
}
//____________________________________________________________________
AliFMDCalibStripRange::AliFMDCalibStripRange(const AliFMDCalibStripRange& o)
- : TObject(o), fRates(o.fRates)
-{}
+ : TObject(o), fRanges(o.fRanges)
+{
+ // Copy CTOR
+}
//____________________________________________________________________
AliFMDCalibStripRange&
AliFMDCalibStripRange::operator=(const AliFMDCalibStripRange& o)
{
- fRates = o.fRates;
+ // Assignement operator
+ fRanges = o.fRanges;
return (*this);
}
UShort_t sector, UShort_t, UShort_t min,
UShort_t max)
{
- UInt_t nSec = (ring == 'I' ? 20 : 40);
+ // Set the min and max for a half-ring
+ UInt_t nSec = (ring == 'I' ? 10 : 20);
UInt_t board = sector / nSec;
- fRates(det, ring, board, 0) = ((max & 0x7f) << 8) + (min & 0x7f);
+ fRanges(det, ring, board, 0) = ((max & 0x7f) << 8) + (min & 0x7f);
}
//____________________________________________________________________
AliFMDCalibStripRange::Min(UShort_t det, Char_t ring,
UShort_t sec, UShort_t) const
{
- UInt_t nSec = (ring == 'I' ? 20 : 40);
+ // Get the min for a half-ring
+ UInt_t nSec = (ring == 'I' ? 10 : 20);
UInt_t board = sec / nSec;
- return (fRates(det, ring, board, 0) & 0x7f);
+
+ return (fRanges(det, ring, board, 0) & 0x7f);
}
//____________________________________________________________________
AliFMDCalibStripRange::Max(UShort_t det, Char_t ring,
UShort_t sec, UShort_t) const
{
- UInt_t nSec = (ring == 'I' ? 20 : 40);
+ // Get the max for a half-ring
+ UInt_t nSec = (ring == 'I' ? 10 : 20);
UInt_t board = sec / nSec;
- return ((fRates(det, ring, board, 0) >> 8) & 0x7f);
+ return ((fRanges(det, ring, board, 0) >> 8) & 0x7f);
+}
+//____________________________________________________________________
+void
+AliFMDCalibStripRange::WriteToFile(ofstream &outFile)
+{
+ outFile.write("# StripRange \n",14);
+ for(Int_t det=1;det<=3;det++) {
+ UShort_t FirstRing = (det == 1 ? 1 : 0);
+ for (UShort_t ir = FirstRing; ir < 2; ir++) {
+ Char_t ring = (ir == 0 ? 'O' : 'I');
+ for(UShort_t board =0; board < 2; board++) {
+ outFile << det << ','
+ << ring << ','
+ << board << ','
+ << Min(det,ring,board) << ','
+ << Max(det,ring,board) << "\n";
+
+
+ }
+ }
+ }
+
+
+}
+//____________________________________________________________________
+void
+AliFMDCalibStripRange::ReadFromFile(ifstream &inFile)
+{
+ TString line;
+ Bool_t readData=kFALSE;
+
+ while(line.ReadLine(inFile)) {
+ if(line.Contains("striprange",TString::kIgnoreCase)) {
+ readData = kTRUE;
+ break;
+ }
+
+ }
+
+ UShort_t det, board;
+ Char_t ring;
+ UShort_t min, max;
+
+ Int_t thisline = inFile.tellg();
+ Char_t c[4];
+
+ while( readData ) {
+ thisline = inFile.tellg();
+ line.ReadLine(inFile);
+
+ if(line.Contains("# ",TString::kIgnoreCase)) {
+ readData = kFALSE;
+ continue;
+ }
+
+ inFile.seekg(thisline);
+ inFile >> det >> c[0]
+ >> ring >> c[1]
+ >> board >> c[2]
+ >> min >> c[3]
+ >> max;
+
+ UInt_t nSec = (ring == 'I' ? 10 : 20);
+ UShort_t sector = board*nSec;
+ Set(det,ring,sector,0,min,max);
+
+ }
+
+ inFile.seekg(0);
+
+
}
//____________________________________________________________________