Changeset 7441 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
12/01/05 17:41:14 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/NEWS

    r7440 r7441  
    3333     forest.
    3434
    35    - general: Between the rund 53300 and 68754 six pixels were not
    36      correctly assigned in the raw data assignement table. A fix to
    37      correct the assignment tabel have been implemented.
     35   - general: Between the rund 53300 and 68754 the pixels 553-558 were not
     36     correctly assigned in the raw data assignement table. A fix to correct
     37     the assignment tabel have been implemented.
    3838
    3939   - StatusDisplay: Fixed the algorithm to calculate the size ratio
  • trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc

    r7035 r7441  
    129129// --------------------------------------------------------------------------
    130130//
     131// Swap the assignment of the pixels with hardware id id0 and id1
     132//
     133Bool_t MRawRunHeader::SwapAssignment(Short_t id0, Short_t id1)
     134{
     135    const Int_t n = fPixAssignment->GetSize();
     136
     137    // Look-up-table
     138    UShort_t *lut = fPixAssignment->GetArray();
     139
     140    // Search for one of the hardware indices to get exchanged
     141    int i;
     142    for (i=0; i<n; i++)
     143        if (lut[i]==id0 || lut[i]==id1)
     144            break;
     145
     146    // Check if one of the two pixels were found
     147    if (i==n)
     148    {
     149        *fLog << err << "ERROR - Assignment of pixels with hardware ID " << id0 << " and " << id1;
     150        *fLog << " should be exchanged, but none were found." << endl;
     151        return kFALSE;
     152    }
     153
     154    // Store first index
     155    const Int_t idx0 = i;
     156
     157    // Search for the other hardware indices to get exchanged
     158    for (i++; i<n; i++)
     159        if (lut[i]==id0 || lut[i]==id1)
     160            break;
     161
     162    // Check if the second pixel was found
     163    if (i==n)
     164    {
     165        *fLog << err << "ERROR - Assignment of pixels with hardware ID " << id0 << " and " << id1;
     166        *fLog << " should be exchanged, but only one was found." << endl;
     167        return kFALSE;
     168    }
     169
     170    const Int_t idx1 = i;
     171
     172    const Short_t p0 = lut[idx0];
     173    const Short_t p1 = lut[idx1];
     174
     175    lut[idx0] = p1;
     176    lut[idx1] = p0;
     177
     178    *fLog << inf << "Assignment of pixels with hardware ID " << id0 << " and " << id1 << " exchanged." << endl;
     179
     180    return kTRUE;
     181}
     182
     183// --------------------------------------------------------------------------
     184//
     185// This implements a fix of the pixel assignment before 25.9.2005
     186//
     187// From magic_online (the pixel numbers are hardware indices):
     188// --------------------------------------------------------------------------
     189//   From: Florian Goebel <fgoebel@mppmu.mpg.de>
     190//   Date: Sun Sep 25 2005 - 05:13:19 CEST
     191//   
     192//   [...]
     193//   - problem 2: pixels were swaped
     194//   - cause: opical fibers were wrongly connected to receiver board
     195//      554 <-> 559
     196//      555 <-> 558
     197//      556 <-> 557
     198//   - action: reconnect correctly
     199//   - result: ok now
     200//   - comment: I don't know when this error was introduced, so backward
     201//      correction of the data is difficult.
     202//      Fortunately the effect is not too large since the affected 6 pixels are
     203//      on the outermost edge of the camera
     204//      Since this board has special pixels the optical fibers have been
     205//      unplugged several times.
     206//   !!!!! Whenever you unplug and reconnect optical fibers make really !!!!!
     207//   !!!!! sure you connect them back correctly. !!!!!
     208//   !!!!! Always contact me before you do so and if you have any doubts !!!!!
     209//   !!!!! how to reconnect the fibers ask me. !!!!!
     210//      These swapped pixels have only been found by chance when doing the
     211//      flatfielding.
     212//   [...]
     213//
     214Bool_t MRawRunHeader::FixAssignment()
     215{
     216    if (fRunNumber<53300 || fRunNumber>68754)
     217        return kTRUE;
     218
     219    if (!SwapAssignment(554, 559))
     220        return kFALSE;
     221
     222    if (!SwapAssignment(555, 558))
     223        return kFALSE;
     224
     225    if (!SwapAssignment(556, 557))
     226        return kFALSE;
     227
     228    return kTRUE;
     229}
     230
     231// --------------------------------------------------------------------------
     232//
    131233// Read in one run header from the binary file
    132234//
     
    199301    fin.read((char*)&dummy, 16);
    200302
    201     return kTRUE;
     303    return FixAssignment();
    202304}
    203305
  • trunk/MagicSoft/Mars/mraw/MRawRunHeader.h

    r7023 r7441  
    5555    MTime     fRunStop;
    5656    MArrayS  *fPixAssignment;
     57
     58    Bool_t SwapAssignment(Short_t id0, Short_t id1);
     59    Bool_t FixAssignment();
    5760
    5861public:
Note: See TracChangeset for help on using the changeset viewer.