Changeset 8364


Ignore:
Timestamp:
03/04/07 14:01:14 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhist/MHEvent.cc

    r7864 r8364  
    241241        fHist->SetCamContent(*event, 0);
    242242        break;
    243     case kEvtIdxMax:
    244         fHist->SetCamContent(*event, 5);
    245         break;
     243//    case kEvtIdxMax:
     244//        fHist->SetCamContent(*event, 3/*5*/);
     245//        break;
    246246    case kEvtArrTime:
    247247        fHist->SetCamContent(*event, 6);
     
    255255    case kEvtIslandIndex:
    256256        fHist->SetCamContent(*event, 5);
    257         break;
     257        break;
     258    default:
     259        *fLog << "ERROR - Case " << (int)fType << " not implemented..." << endl;
    258260    }
    259261
  • trunk/MagicSoft/Mars/mraw/MRawEvtData.cc

    r8353 r8364  
    550550    const UShort_t nhi  = fRunHeader->GetNumSamplesHiGain();
    551551    const UShort_t npic = fRunHeader->GetNumPixInCrate();
    552 
    553     return (nhi+nlo)*npic;
     552    const UShort_t nbps = fRunHeader->GetNumBytesPerSample();
     553
     554    return (nhi+nlo)*npic*nbps;
    554555}
    555556
     
    566567Bool_t MRawEvtData::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
    567568{
     569    *fLog << warn << "WARNING - The use of MRawEvtData::GetPixelContent is deprecated!" << endl;
     570
     571    /*
    568572    MRawEvtPixelIter Next(const_cast<MRawEvtData*>(this));
    569573    if (!Next.Jump(idx))
     
    592596        return val >= 0;
    593597    }
    594 
     598*/
    595599    return kTRUE;
    596600}
  • trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc

    r8348 r8364  
    164164}
    165165
     166/*
    166167// --------------------------------------------------------------------------
    167168//
    168169// Returns the index of the FADC slice the maximum signal in. If the highest
    169 // slices have the same value the last one is returned.
     170// slices have the same value the first one is returned.
    170171//
    171172Byte_t MRawEvtPixelIter::GetIdxMaxHiGainSample(const Byte_t hifirst, const Byte_t hilast) const
     
    188189//
    189190// Returns the index of the FADC slice the maximum signal in. If no lo-gains
    190 // are available -1 is returned. If the highest slices have the same value the
    191 // last one is returned.
     191// are available -1 is returned. If the highest slices have the same value
     192// the first one is returned.
    192193//
    193194Short_t MRawEvtPixelIter::GetIdxMaxLoGainSample(const Byte_t lofirst, const Byte_t lolast) const
     
    294295// If no lo-gains are existing and the hi-gains have saturating values
    295296// a negative value (-1) is returned.
    296 // 
     297//
    297298Short_t MRawEvtPixelIter::GetIdxMaxHiLoGainSample() const
    298299{
     
    371372    return sum;
    372373}
     374*/
  • trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.h

    r8348 r8364  
    9191    */
    9292
    93     Byte_t  GetNumHiGainSamples() const { return fNumHiGainSamples ; }// Use is deprecated!
    94     Byte_t  GetNumLoGainSamples() const { return fNumLoGainSamples ; }// Use is deprecated!
     93//    Byte_t  GetNumHiGainSamples() const { return fNumHiGainSamples ; }// Use is deprecated!
     94//    Byte_t  GetNumLoGainSamples() const { return fNumLoGainSamples ; }// Use is deprecated!
    9595    Byte_t  GetNumSamples() const { return fNumHiGainSamples+fNumLoGainSamples; }
    9696
    97     Byte_t  GetIdxMaxHiGainSample(const Byte_t hifirst=0, const Byte_t hilast=0xff) const;
    98     Short_t GetIdxMaxLoGainSample(const Byte_t lofirst=0, const Byte_t lolast=0xff) const;
     97//    Byte_t  GetIdxMaxHiGainSample(const Byte_t hifirst=0, const Byte_t hilast=0xff) const;
     98//    Short_t GetIdxMaxLoGainSample(const Byte_t lofirst=0, const Byte_t lolast=0xff) const;
    9999
    100     Byte_t  GetMaxHiGainSample(const Byte_t hifirst=0, const Byte_t hilast=0xff) const;
     100//    Byte_t  GetMaxHiGainSample(const Byte_t hifirst=0, const Byte_t hilast=0xff) const;
    101101
    102     ULong_t GetSumHiGainSamples() const;
    103     ULong_t GetSumSqrHiGainSamples() const;
    104     Float_t GetVarHiGainSamples() const;
     102//    ULong_t GetSumHiGainSamples() const;
     103//    ULong_t GetSumSqrHiGainSamples() const;
     104//    Float_t GetVarHiGainSamples() const;
    105105
    106     Byte_t  GetMaxLoGainSample() const;
    107     Short_t GetIdxMaxHiLoGainSample() const;
     106//    Byte_t  GetMaxLoGainSample() const;
     107//    Short_t GetIdxMaxHiLoGainSample() const;
    108108
    109     ULong_t GetSumLoGainSamples() const;
    110     ULong_t GetSumSqrLoGainSamples() const;
     109//    ULong_t GetSumLoGainSamples() const;
     110//    ULong_t GetSumSqrLoGainSamples() const;
    111111
    112112    Bool_t HasLoGain() const { return fNumLoGainSamples>0; }
  • trunk/MagicSoft/Mars/msignal/MExtractor.cc

    r8358 r8364  
    1717!
    1818!   Author(s): Markus Gaug, 04/2004 <mailto:markus@ifae.es>
    19 !
    20 !   Copyright: MAGIC Software Development, 2000-2004
     19!   Author(s): Thomas Bretz <mailto:tbretz@astro.uni-wuerzburg.de>
     20!
     21!   Copyright: MAGIC Software Development, 2000-2007
    2122!
    2223!
     
    7475//  - Byte_t fHiLoLast;                // Number of slices in fLoGainSamples counted for the High-Gain signal
    7576//
     77// Class Version 8:
     78// ----------------
     79//  - Byte_t fSaturationLimit;
     80//  + Uint_t fSaturationLimit;
     81//
    7682//
    7783// Input Containers:
     
    108114using namespace std;
    109115
    110 const Byte_t  MExtractor::fgSaturationLimit = 245;
     116const UInt_t  MExtractor::fgSaturationLimit = 245;
    111117const TString MExtractor::fgNamePedestalCam = "MPedestalCam";
    112118const TString MExtractor::fgNameSignalCam   = "MExtractedSignalCam";
     
    255261    if (numl==0)
    256262    {
    257         *fLog << inf << "No lo-gains... resetting lo-gain range and saturation limit." << endl;
     263        *fLog << inf << "No lo-gains... resetting lo-gain range";
    258264        fLoGainFirst=0;
    259265        fLoGainLast =0;
    260         fSaturationLimit=0xff;
     266        if (fSaturationLimit>0xff)
     267        {
     268            *fLog << " and saturation limit";
     269            fSaturationLimit=0xff;
     270        }
     271        *fLog << "." << endl;
    261272    }
    262273
     
    443454    if (IsEnvDefined(env, prefix, "SaturationLimit", print))
    444455    {
    445         SetSaturationLimit(GetEnvValue(env, prefix, "SaturationLimit", fSaturationLimit));
     456        SetSaturationLimit(GetEnvValue(env, prefix, "SaturationLimit", (Int_t)fSaturationLimit));
    446457        rc = kTRUE;
    447458    }
  • trunk/MagicSoft/Mars/msignal/MExtractor.h

    r8358 r8364  
    3232 
    3333protected:
    34   static const Byte_t  fgSaturationLimit;  //! Default for fSaturationLimit (now set to: 254)
     34  static const UInt_t  fgSaturationLimit;  //! Default for fSaturationLimit (now set to: 254)
    3535  static const TString fgNamePedestalCam;  //! "MPedestalCam"
    3636  static const TString fgNameSignalCam;    //! "MExtractedSignalCam"
     
    5959  Float_t  fSqrtLoGainSamples;             // Sqrt. nr. Low  Gain FADC slices used to extract the signal
    6060
    61   Byte_t   fSaturationLimit;               // Highest FADC slice value until being declared saturated
     61  UInt_t   fSaturationLimit;               // Highest FADC slice value until being declared saturated
    6262
    6363  TString  fNamePedestalCam;               // Name of the 'MPedestalCam' container
     
    9494  Float_t GetResolutionPerPheHiGain() const { return fResolutionPerPheHiGain; }
    9595  Float_t GetResolutionPerPheLoGain() const { return fResolutionPerPheLoGain; }
    96   Byte_t  GetSaturationLimit() const { return fSaturationLimit; }
     96  UInt_t  GetSaturationLimit() const { return fSaturationLimit; }
    9797
    9898  Bool_t  HasLoGain() const { return fLoGainFirst>0 || fLoGainLast>0; }
     
    106106
    107107  void SetOffsetLoGain    ( const Float_t  f=fgOffsetLoGain          ) { fOffsetLoGain     = f;    }
    108   void SetSaturationLimit ( const Byte_t lim=fgSaturationLimit       ) { fSaturationLimit  = lim;  }
     108  void SetSaturationLimit ( const UInt_t lim=fgSaturationLimit       ) { fSaturationLimit  = lim;  }
    109109  void SetNamePedestalCam ( const char *name=fgNamePedestalCam.Data()) { fNamePedestalCam  = name; }
    110110  void SetNameSignalCam   ( const char *name=fgNameSignalCam.Data()  ) { fNameSignalCam    = name; }
     
    122122  void Print(Option_t *o="") const; //*MENU*
    123123
    124   ClassDef(MExtractor, 7) // Signal Extractor Base Class
     124  ClassDef(MExtractor, 8) // Signal Extractor Base Class
    125125};
    126126
  • trunk/MagicSoft/Mars/msignal/MSignalCalc.cc

    r8357 r8364  
    4646
    4747#include "MRawRunHeader.h"
    48 #include "MRawEvtData.h"       // MRawEvtData::GetNumPixels
    4948#include "MSignalCam.h"
    5049#include "MPedestalPix.h"
    5150#include "MPedestalCam.h"
    5251#include "MRawEvtPixelIter.h"
     52#include "MPedestalSubtractedEvt.h"
    5353
    5454ClassImp(MSignalCalc);
     
    6666    fName  = name  ? name  : "MSignalCalc";
    6767    fTitle = title ? title : "Task to calculate Cerenkov photons from raw data";
    68 
    69     AddToBranchList("MRawEvtData.fHiGainPixId");
    70     AddToBranchList("MRawEvtData.fLoGainPixId");
    71     AddToBranchList("MRawEvtData.fHiGainFadcSamples");
    72     AddToBranchList("MRawEvtData.fLoGainFadcSamples");
    7368}
    7469
     
    9590    }
    9691
    97     fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");
     92    fRawEvt = (MPedestalSubtractedEvt*)pList->FindObject("MPedestalSubtractedEvt");
    9893    if (!fRawEvt)
    9994    {
    100         *fLog << dbginf << "MRawEvtData not found... aborting." << endl;
     95        *fLog << dbginf << "MPedestalSubtractedEvt not found... aborting." << endl;
    10196        return kFALSE;
    10297    }
     
    130125// pixel in the MSignalCam container.
    131126//
     127#include <TSystem.h>
    132128Int_t MSignalCalc::Process()
    133129{
    134     MRawEvtPixelIter pixel(fRawEvt);
    135 
    136     while (pixel.Next())
     130    const Int_t npix = fRawEvt->GetNumPixels();
     131    const Int_t nhi  = fRunHeader->GetNumSamplesHiGain();
     132    const Int_t nlo  = fRunHeader->GetNumSamplesLoGain();
     133
     134    for (int i=0; i<npix; i++)
    137135    {
    138         Byte_t *ptr   = pixel.GetHiGainSamples();
    139         Byte_t *max   = ptr+pixel.GetIdxMaxHiGainSample();
    140         Byte_t *end   = ptr+fRunHeader->GetNumSamplesHiGain();
     136        Byte_t *raw = fRawEvt->GetSamplesRaw(i);
     137
     138        Byte_t *ptr   = raw;
     139        Byte_t *max   = ptr+fRawEvt->GetMax(i, 0, nhi);
     140        Byte_t *end   = ptr+nhi;
    141141        Byte_t *first = max-fBefore;
    142142        Byte_t *last  = max+fAfter;
     
    144144        ULong_t sumb  = 0;   // sum background
    145145        ULong_t sqb   = 0;   // sum sqares background
    146         ULong_t sumsb = 0;   // sum signal+background
     146        //ULong_t sumsb = 0;   // sum signal+background
    147147        ULong_t sqsb  = 0;   // sum sqares signal+background
    148148
     
    168168            else
    169169            {
    170                 sumsb += *ptr;
     170                //sumsb += *ptr;
    171171                sqsb  += *ptr* *ptr;
    172172                nsb++;
     
    175175        }
    176176
    177         if (sat==0 && ishi)
     177        if (nlo>0 && sat==0 && ishi)
    178178        {
    179179            // Area: x9
    180             ptr = pixel.GetLoGainSamples();
    181             end = ptr+fRunHeader->GetNumSamplesLoGain();
     180            ptr = raw+nhi;
     181            end = ptr+nlo;
    182182
    183183            sumb = 0;   // sum background
     
    187187            while (ptr<end)
    188188            {
    189                 // Background already calced from hi-gains!
     189                // Background already caced from hi-gains!
    190190                sumb += *ptr;
    191191                sqb  += *ptr* *ptr;
     
    195195        }
    196196
    197         if (sat>1 && !ishi)
     197        if (nlo>0 && sat>1 && !ishi)
    198198        {
    199199            // Area: x9
    200             ptr = pixel.GetLoGainSamples();
    201             max = ptr+pixel.GetIdxMaxLoGainSample();
     200            ptr = raw+nhi;
     201            max = ptr+fRawEvt->GetMax(i, nhi, nhi+nlo);
    202202
    203203            if (*max>250)
     
    207207            }
    208208
    209             end   = ptr+fRunHeader->GetNumSamplesLoGain();
     209            end   = ptr+nlo;
    210210            first = max-fBefore;
    211211            last  = max+fAfter;
    212212
    213             sumsb = 0;   // sum signal+background
    214             sqsb  = 0;   // sum sqares signal+background
    215             //sumb  = 0;   // sum background
     213            //sumsb = 0;   // sum signal+background
     214            //sqsb  = 0;   // sum sqares signal+background
     215            sumb  = 0;   // sum background
    216216            //sqb   = 0;   // sum sqares background
    217217
     
    230230                else
    231231                {
    232                     sumsb += *ptr;
     232                    //sumsb += *ptr;
    233233                    sqsb  += *ptr* *ptr;
    234234                    nsb++;
     
    238238        }
    239239
    240         Float_t b  = (float)sumb/nb;       // background
    241         Float_t sb = (float)sumsb/nsb;     // signal+background
    242 
    243         Float_t msb  = (float)sqb/nb;      // mean square background
     240        Float_t b  = nb==0 ? 0 : (float)sumb/nb;       // background
     241        //Float_t sb = (float)sumsb/nsb;     // signal+background
     242
     243        Float_t msb  = nb==0 ? 0 : (float)sqb/nb;      // mean square background
    244244        //Float_t mssb = (float)sqsb/nsb;    // mean square signal+background
    245245
     
    247247        //Float_t sigsb = sqrt(mssb-sb*sb);  // sigma signal+background
    248248
    249         Float_t s   = sb-b;                // signal
     249        //Float_t s   = sb-b;                // signal
    250250        //Float_t sqs = sqsb-nsb*b;          // sum squares signal
    251251
     
    253253        //Float_t sigs = sqrt(mss-s*s);      // sigma signal
    254254
    255         if (sat>1)
    256             s *= 11.3;
    257 
    258         Int_t idx = pixel.GetPixelId();
     255        //if (sat>1)
     256        //    s *= 11.3;
     257
    259258        //fCerPhotEvt->AddPixel(idx, s, sigs);
    260259
     
    262261        // MMcPedestalCopy and MMcPedestalNSBAdd
    263262        if (fPedestals)
    264             (*fPedestals)[idx].Set(b, sigb);
     263            (*fPedestals)[i].Set(b, sigb);
    265264    }
    266265
  • trunk/MagicSoft/Mars/msignal/MSignalCalc.h

    r8357 r8364  
    66#endif
    77
    8 class MRawEvtData;
    98class MPedestalCam;
    109class MSignalCam;
    1110class MRawRunHeader;
     11class MPedestalSubtractedEvt;
    1212
    1313class MSignalCalc : public MTask
    1414{
    1515private:
    16     MPedestalCam  *fPedestals;  // Pedestals of all pixels in the camera
    17     MRawEvtData  *fRawEvt;     // raw event data (time slices)
    18     MSignalCam    *fCerPhotEvt; // Cerenkov Photon Event used for calculation
    19     MRawRunHeader *fRunHeader;  // RunHeader information
     16    MRawRunHeader          *fRunHeader;  // RunHeader information
     17    MPedestalSubtractedEvt *fRawEvt;     // raw event data (time slices)
     18    MSignalCam             *fCerPhotEvt; // Cerenkov Photon Event used for calculation
     19    MPedestalCam           *fPedestals;  // Pedestals of all pixels in the camera
    2020
    2121    Byte_t fBefore;
Note: See TracChangeset for help on using the changeset viewer.