Changeset 1443 for trunk/MagicSoft


Ignore:
Timestamp:
07/25/02 17:14:55 (22 years ago)
Author:
bigongia
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r1442 r1443  
    11                                                                  -*-*- END -*-*-
     2
     3 2002/07/25: Abelardo Moralejo
     4
     5   * manalysis/MCerPhotCalc2.[h,cc]:
     6     - Changed fWeight into a TArrayF to make the class usable for
     7       any number of FADC slices.
     8     - added procedure SetDefaultWeights for initialization.
     9
     10   * macros/MagicHillas.C:
     11     - changed accordingly
    212
    313 2002/07/25: Wolfgang Wittek, Thomas Bretz
  • trunk/MagicSoft/Mars/macros/MagicHillas.C

    r1424 r1443  
    106106//    MCerPhotCalc2     ncalc;
    107107//  Example: use only 2nd to 6th FADC slices for photon calculation:
    108 //    Float_t w[15] = {0., 1., 1., 1., 1., 1., 0.,0.,0.,0.,0.,0.,0.,0.,0.};
     108//    const Float_t x[15]={0., 1., 1., 1., 1., 1., 0.,0.,0.,0.,0.,0.,0.,0.,0.};
     109//    TArrayF w(15,x);
    109110//    ncalc.SetWeights(w);
    110111
  • trunk/MagicSoft/Mars/manalysis/MCerPhotCalc2.cc

    r1425 r1443  
    7373    AddToBranchList("MRawEvtData.fHiGainFadcSamples");
    7474    AddToBranchList("MRawEvtData.fLoGainFadcSamples");
     75
     76    SetDefaultWeights();
    7577}
    7678
     
    115117    // Calculate quadratic sum of weights:
    116118    fSumQuadWeights = 0.;
    117     for (Int_t i = 0; i < 15; i++)
     119    for (Int_t i = 0; i < fWeight.GetSize(); i++)
    118120      fSumQuadWeights += fWeight[i]*fWeight[i];
    119121
     
    138140    }
    139141
    140     if (fRunHeader->GetNumSamplesHiGain() != 15)
    141     {
    142         *fLog << dbginf << "Number of FADC slices (" << fRunHeader->GetNumSamplesHiGain() <<") is different from expected (15)... aborting." << endl;
     142    if (fRunHeader->GetNumSamplesHiGain() != fWeight.GetSize())
     143    {
     144        *fLog << dbginf << "Number of FADC slices (" << fRunHeader->GetNumSamplesHiGain() <<") is different from assumed one (" << fWeight.GetSize() << ")... aborting." << endl;
    143145        return kFALSE;
    144146    }
     
    171173    MRawEvtPixelIter pixel(fRawEvt);
    172174
    173     Float_t BinSignal[15];
     175    TArrayF BinSignal(fWeight.GetSize());
    174176
    175177    while (pixel.Next())
     
    194196        Float_t nphot = 0.;
    195197
    196         for(Int_t i = 0; i<15; i++)
     198        for(Int_t i = 0; i<fWeight.GetSize(); i++)
    197199          {
    198200            BinSignal[i] =  (Float_t) ptr[i] - mean;
     
    212214}
    213215
    214 // Default weights:
    215 Float_t MCerPhotCalc2::fWeight[] = {0, 0.0809835, 0.289593, 0.366926, 0.211665, 0.0508328, 0., 0., 0., 0., 0., 0., 0., 0., 0.};
     216//
     217// Set default values for the number of slices and weights:
     218//
     219
     220void MCerPhotCalc2::SetDefaultWeights()
     221{
     222  const Float_t dummy[15] = {0, 0.0809835, 0.289593, 0.366926, 0.211665, 0.0508328, 0., 0., 0., 0., 0., 0., 0., 0., 0.};
     223
     224  fWeight.Set(15,dummy);
     225  return;
     226}
     227
     228
     229
     230
  • trunk/MagicSoft/Mars/manalysis/MCerPhotCalc2.h

    r1425 r1443  
    1515#endif
    1616
     17#include <TArrayF.h>
     18
    1719class MRawEvtData;
    1820class MPedestalCam;
    1921class MCerPhotEvt;
    2022class MRawRunHeader;
     23class TArrayF;
    2124
    2225class MCerPhotCalc2 : public MTask
     
    2932    Bool_t          fEnableFix;  // fix for a bug in files from older camera versions (<=40)
    3033
    31     static Float_t  fWeight[15];  // Weights for adding up the ADC slices
     34    TArrayF         fWeight;  // Weights for adding up the ADC slices
    3235    Float_t         fSumQuadWeights;
     36
     37    void SetDefaultWeights();
    3338
    3439public:
     
    3944    Bool_t ReInit(MParList *pList);
    4045
    41     void   SetWeights(Float_t *w) {memcpy(fWeight,w,15*sizeof(Float_t));}
     46    void   SetWeights(TArrayF w) {fWeight.Set(w.GetSize(),w.GetArray());}
    4247
    4348    ClassDef(MCerPhotCalc2, 0)   // Task to calculate cerenkov photons from raw data
Note: See TracChangeset for help on using the changeset viewer.