Ignore:
Timestamp:
06/26/03 17:00:06 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/manalysis
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/manalysis/MCT1PadSchweizer.cc

    r2206 r2237  
    293293      continue;
    294294
    295     fEvt->AddPixel(i, 0.0, (*fPed)[i].GetMeanRms());
     295    fEvt->AddPixel(i, 0.0, (*fPed)[i].GetPedestalRms());
    296296  }
    297297
     
    543543
    544544    MPedestalPix &ppix = (*fPed)[j];
    545     Double_t oldsigma = ppix.GetMeanRms();
     545    Double_t oldsigma = ppix.GetPedestalRms();
    546546    Double_t oldsigma2 = oldsigma*oldsigma;
    547547
     
    691691    Double_t oldphotons = pix.GetNumPhotons();
    692692    Double_t newphotons = oldphotons + NSB;
    693     pix.SetNumPhotons(  newphotons );
     693    pix.SetNumPhotons(newphotons);
    694694
    695695
     
    700700    // error: add sigma of padded noise quadratically
    701701    Double_t olderror = pix.GetErrorPhot();
    702     Double_t newerror = sqrt( olderror*olderror + addSig2 );
    703     pix.SetErrorPhot( newerror );
    704 
    705 
    706     Double_t newsigma = sqrt( oldsigma2 + addSig2 );
    707     ppix.SetMeanRms( newsigma );
    708 
    709     fHSigmaPedestal->Fill( oldsigma, newsigma );
     702    Double_t newerror = sqrt(olderror*olderror + addSig2);
     703    pix.SetErrorPhot(newerror);
     704
     705
     706    Double_t newsigma = sqrt(oldsigma2 + addSig2);
     707    ppix.SetPedestalRms(newsigma);
     708
     709    fHSigmaPedestal->Fill(oldsigma, newsigma);
    710710  }
    711711  //----------   end of loop over pixels   ---------------------------------
  • trunk/MagicSoft/Mars/manalysis/MCerPhotAnal.cc

    r2211 r2237  
    9999    }
    100100
    101     fPedestals = (MPedestalCam*)pList->FindCreateObj("MPedestalCam");
    102     if (!fPedestals)
    103     {
    104         *fLog << dbginf << "MPedestalCam not found... aborting." << endl;
    105         return kFALSE;
    106     }
    107 
    108101    fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt");
    109102    if (!fCerPhotEvt)
     103        return kFALSE;
     104
     105    const MRawRunHeader *runheader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
     106    if (!runheader)
     107        *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl;
     108    else
     109        if (runheader->GetRunType() == kRTMonteCarlo)
     110        {
     111            fPedestals=NULL;
     112            return kTRUE;
     113        }
     114
     115    fPedestals = (MPedestalCam*)pList->FindCreateObj("MPedestalCam");
     116    if (runheader && !fPedestals)
    110117        return kFALSE;
    111118
     
    184191        const UInt_t pixid = pixel.GetPixelId();
    185192
    186         MPedestalPix &ped = (*fPedestals)[pixid];
    187 
    188193        //
    189194        // sanity check (old MC files sometimes have pixids>577)
    190195        //
    191         if (!fPedestals->CheckBounds(pixid))
     196        if (fPedestals && !fPedestals->CheckBounds(pixid))
    192197        {
    193198            *fLog << inf << "Pixel ID larger than camera... skipping event." << endl;
     
    196201
    197202        fCerPhotEvt->AddPixel(pixid, nphot, sigmaped/2.236);
    198         ped.SetPedestal(pedes, sigmaped);
    199         ped.SetPedestalRms(sigmaped/sqrt(fRawEvt->GetNumHiGainSamples()-5.),
    200                            sigmaped/sqrt(2.*(fRawEvt->GetNumHiGainSamples()-5)));
    201 
     203
     204        if (fPedestals)
     205            (*fPedestals)[pixid].Set(pedes, sigmaped);
     206
     207        /*
     208         ped.SetPedestalRms(sigmaped/sqrt(fRawEvt->GetNumHiGainSamples()-5.),
     209                            sigmaped/sqrt(2.*(fRawEvt->GetNumHiGainSamples()-5)));
     210                            */
    202211        // FIXME! Handling of Lo Gains is missing!
    203212    }
     
    206215    fCerPhotEvt->SetReadyToSave();
    207216
     217    if (fPedestals)
     218        fPedestals->SetReadyToSave();
     219
    208220    return kTRUE;
    209221}
  • trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc

    r2213 r2237  
    107107    fPedestals = (MPedestalCam*)pList->FindCreateObj("MPedestalCam");
    108108    if (!fPedestals)
    109         return kFALSE;
     109    {
     110        *fLog << dbginf << "MPedestalCam not found... aborting." << endl;
     111        return kFALSE;
     112    }
    110113
    111114    fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt");
     
    148151    }
    149152
    150     if (runheader->GetRunType() != kRTMonteCarlo)
     153    Bool_t fIsMcFile = runheader->GetRunType() == kRTMonteCarlo;
     154    if (!fIsMcFile)
    151155        return kTRUE;
     156
     157    ScalePedestals();
    152158
    153159    MMcRunHeader *mcrunheader = (MMcRunHeader*)pList->FindObject("MMcRunHeader");
     
    165171}
    166172
     173void MCerPhotCalc::ScalePedestals()
     174{
     175    Int_t n = 577; //FIXME: fPedestals->GetNumPixel();
     176
     177    for (int idx=0; idx<n; idx++)
     178    {
     179        MPedestalPix &ped = (*fPedestals)[idx];
     180
     181        const Double_t offset = fEnableFix ? ped.GetPedestal()-0.5 : ped.GetPedestal();
     182        ped.Set(offset*fSumWeights, ped.GetPedestalRms()*fSumQuadWeights);
     183    }
     184
     185    fPedestals->SetReadyToSave();
     186}
     187
    167188// --------------------------------------------------------------------------
    168189//
     
    174195    //fCerPhotEvt->InitSize(fRawEvt->GetNumPixels());
    175196
     197    if (fIsMcFile)
     198        ScalePedestals();
     199
    176200    MRawEvtPixelIter pixel(fRawEvt);
    177201
    178202    while (pixel.Next())
    179203    {
    180         const UInt_t pixid = pixel.GetPixelId();
    181         const MPedestalPix &ped = (*fPedestals)[pixid];
     204        const UInt_t idx = pixel.GetPixelId();
     205        MPedestalPix &ped = (*fPedestals)[idx];
    182206
    183207        //
    184208        // sanity check (old MC files sometimes have pixids>577)
    185209        //
    186         if (!fPedestals->CheckBounds(pixid))
     210        if (!fPedestals->CheckBounds(idx))
    187211        {
    188             *fLog << inf << "Pixel ID larger than camera... skipping event." << endl;
     212            *fLog << inf << "Pixel Index larger than camera... skipping event." << endl;
    189213            return kCONTINUE;
    190214        }
    191 
    192         //
    193         // Mean pedestal:
    194         //
    195         const Double_t mean = fEnableFix ? ped.GetMean()-0.5 : ped.GetMean();
    196215
    197216        //
     
    204223            nphot += ptr[i]*fWeight[i];
    205224
    206         nphot -= mean*fSumWeights;
    207 
    208         const Float_t nphoterr = ped.GetSigma()* fSumQuadWeights;
    209 
    210         fCerPhotEvt->AddPixel(pixid, nphot, nphoterr);
     225        nphot -= ped.GetPedestal();
     226
     227        fCerPhotEvt->AddPixel(idx, nphot, 0);
    211228
    212229        // FIXME! Handling of Lo Gains is missing!
  • trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.h

    r2213 r2237  
    3131 
    3232    Bool_t          fEnableFix;  // fix for a bug in files from older camera versions (<=40)
     33    Bool_t          fIsMcFile;
    3334
    3435    TArrayF         fWeight;  // Weights for adding up the ADC slices
     
    4243
    4344    Bool_t ReInit(MParList *pList);
     45    void ScalePedestals();
    4446
    4547public:
  • trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc

    r2206 r2237  
    138138
    139139        const Float_t pedest = fMcPed->GetPedestal(i);
    140         const Float_t pedrms = pedest/sqrt((float)num);
     140        //const Float_t pedrms = pedest/sqrt((float)num);
    141141
    142142        const Float_t sigma  = fMcPed->GetPedestalRms(i);
    143         const Float_t sigrms = sigma/sqrt(num*2.);
     143        //const Float_t sigrms = sigma/sqrt(num*2.);
    144144
    145         pix.SetPedestal(pedest, sigma);
    146         pix.SetPedestalRms(pedrms, sigrms);
     145        //pix.SetPedestalRms(pedrms, sigrms);
     146        pix.Set(pedest, sigma);
    147147    }
    148148
  • trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc

    r2206 r2237  
    215215        MPedestalPix &pix    = (*fPedCam)[i];
    216216
    217         const Float_t pedrms = pix.GetSigma();
     217        const Float_t pedrms = pix.GetPedestalRms();
    218218        const Float_t ratio  = fGeom->GetPixRatio(i);
    219219        const Float_t ampl   = fFadc->GetAmplitud();
    220220
    221         pix.SetSigma(sqrt(pedrms*pedrms + dnsbpix*ampl*ampl/ratio));
     221        pix.SetPedestalRms(sqrt(pedrms*pedrms + dnsbpix*ampl*ampl/ratio));
    222222    }
    223223
  • trunk/MagicSoft/Mars/manalysis/MPedCalcPedRun.cc

    r2206 r2237  
    9595        const Float_t higainrms = CalcHiGainRms(ptr, end, higainped);
    9696
    97         const Float_t higainpederr = CalcHiGainMeanErr(higainrms);
    98         const Float_t higainrmserr = CalcHiGainRmsErr(higainrms);
     97        //const Float_t higainpederr = CalcHiGainMeanErr(higainrms);
     98        //const Float_t higainrmserr = CalcHiGainRmsErr(higainrms);
    9999
    100100        const UInt_t pixid = pixel.GetPixelId();
    101101        MPedestalPix &pix = (*fPedestals)[pixid];
    102102
    103         pix.SetPedestal(higainped, higainrms);
    104         pix.SetPedestalRms(higainpederr, higainrmserr);
     103        pix.Set(higainped, higainrms);
     104        //pix.SetPedestalRms(higainpederr, higainrmserr);
    105105    }
    106106
     
    132132    } while (++ptr != end);
    133133
    134     return sqrt(rms/(fNumHiGainSamples-1));
     134    return sqrt(rms/fNumHiGainSamples);
    135135}
    136 
     136/*
    137137Float_t MPedCalcPedRun::CalcHiGainMeanErr(Float_t higainrms) const
    138138{
     
    144144    return higainrms/sqrt(2.*fNumHiGainSamples);
    145145}
    146 
     146*/
  • trunk/MagicSoft/Mars/manalysis/MPedCalcPedRun.h

    r2206 r2237  
    2626    Float_t CalcHiGainMean(Byte_t *ptr, const Byte_t *end) const;
    2727    Float_t CalcHiGainRms(Byte_t *ptr, const Byte_t *end, Float_t higainped) const;
    28     Float_t CalcHiGainMeanErr(Float_t higainrms) const;
    29     Float_t CalcHiGainRmsErr(Float_t higainrms) const;
     28    //Float_t CalcHiGainMeanErr(Float_t higainrms) const;
     29    //Float_t CalcHiGainRmsErr(Float_t higainrms) const;
    3030
    3131    Int_t PreProcess(MParList *pList);
  • trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc

    r2206 r2237  
    133133
    134134        *fLog << id-1 << ": ";
    135         *fLog << pix->GetMean() << " " << pix->GetSigma() << " ";
    136         *fLog << pix->GetMeanRms() << " " << pix->GetSigmaRms() << endl;
     135        *fLog << pix->GetPedestal() << " " << pix->GetPedestalRms() << endl;
    137136    }
    138137}
    139138
    140 Float_t MPedestalCam::GetMeanMin(const MGeomCam *geom) const
     139Float_t MPedestalCam::GetPedestalMin(const MGeomCam *geom) const
    141140{
    142141    if (fArray->GetEntries() <= 0)
    143142        return 50.;
    144143
    145     Float_t minval = (*this)[0].GetMean();
     144    Float_t minval = (*this)[0].GetPedestalRms();
    146145
    147146    for (Int_t i=1; i<fArray->GetEntries(); i++)
     
    149148        const MPedestalPix &pix = (*this)[i];
    150149
    151         Float_t testval = pix.GetMean();
     150        Float_t testval = pix.GetPedestalRms();
    152151
    153152        if (geom)
     
    160159}
    161160
    162 Float_t MPedestalCam::GetMeanMax(const MGeomCam *geom) const
     161Float_t MPedestalCam::GetPedestalMax(const MGeomCam *geom) const
    163162{
    164163    if (fArray->GetEntries() <= 0)
    165164        return 50.;
    166165
    167     Float_t maxval = (*this)[0].GetMean();
     166    Float_t maxval = (*this)[0].GetPedestalRms();
    168167
    169168    for (Int_t i=1; i<fArray->GetEntries(); i++)
     
    171170        const MPedestalPix &pix = (*this)[i];
    172171
    173         Float_t testval = pix.GetMean();
     172        Float_t testval = pix.GetPedestalRms();
    174173
    175174        if (geom)
     
    184183Bool_t MPedestalCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
    185184{
    186     val = (*this)[idx].GetMean()*cam.GetPixRatio(idx);
     185    switch (type)
     186    {
     187    case 0:
     188        val = (*this)[idx].GetPedestal();
     189        break;
     190    case 1:
     191        val = (*this)[idx].GetPedestalRms();
     192        break;
     193    }
    187194    return kTRUE;
    188195}
  • trunk/MagicSoft/Mars/manalysis/MPedestalCam.h

    r2206 r2237  
    2828    MPedestalPix &operator[](Int_t i) const;
    2929
    30     Float_t GetMeanMin(const MGeomCam *cam) const;
    31     Float_t GetMeanMax(const MGeomCam *cam) const;
     30    Float_t GetPedestalMin(const MGeomCam *cam) const;
     31    Float_t GetPedestalMax(const MGeomCam *cam) const;
    3232
    3333    Bool_t CheckBounds(Int_t i);
  • trunk/MagicSoft/Mars/manalysis/MPedestalPix.cc

    r1540 r2237  
    4848void MPedestalPix::Clear(Option_t *o)
    4949{
    50     fMean = -1;
    51     fSigma = -1;
    52     fMeanRms = -1;
    53     fSigmaRms = -1;
     50    fPedestal = -1;
     51    fPedestalRms = -1;
    5452}
    5553
  • trunk/MagicSoft/Mars/manalysis/MPedestalPix.h

    r1540 r2237  
    99{
    1010private:
    11     Float_t fMean;     // mean value of pedestal (PMT offset)
    12     Float_t fSigma;    // sigma (standard deviation) of pedestal
    13     Float_t fMeanRms;  // root mean square of pedestal
    14     Float_t fSigmaRms; // root mean sqare of sigma of the pedestal
     11    Float_t fPedestal;     // mean value of pedestal (PMT offset)
     12    Float_t fPedestalRms;  // root mean square / sigma  / standard deviation of pedestal
    1513
    1614public:
     
    1917    void Clear(Option_t *o="");
    2018
    21     Float_t GetMean() const     { return fMean;     }
    22     Float_t GetSigma() const    { return fSigma;    }
    23     Float_t GetMeanRms() const  { return fMeanRms;  }
    24     Float_t GetSigmaRms() const { return fSigmaRms; }
    25 
     19    Float_t GetPedestal() const    { return fPedestal; }
     20    Float_t GetPedestalRms() const { return fPedestalRms; }
     21/*
    2622    void SetMean(Float_t f)     { fMean = f;     }
    2723    void SetSigma(Float_t f)    { fSigma = f;    }
    2824    void SetMeanRms(Float_t f)  { fMeanRms = f;  }
    2925    void SetSigmaRms(Float_t f) { fSigmaRms = f; }
     26    */
    3027
    31     void SetPedestal(Float_t m, Float_t s) { fMean = m; fSigma = s; }
    32     void SetPedestalRms(Float_t m, Float_t s) { fMeanRms = m; fSigmaRms = s; }
     28    void SetPedestal(Float_t f)    { fPedestal = f; }
     29    void SetPedestalRms(Float_t f) { fPedestalRms = f; }
     30    void Set(Float_t m, Float_t r) { fPedestal = m; fPedestalRms = r; }
    3331
    34     Bool_t IsValid() const { return fMean>=0||fSigma>=0||fMeanRms>=0||fSigmaRms>=0; }
     32    Bool_t IsValid() const { return fPedestal>=0||fPedestalRms>=0; }
    3533
    3634    ClassDef(MPedestalPix, 1)   // Storage Container for Pedestal information of one pixel
  • trunk/MagicSoft/Mars/manalysis/MSigmabar.cc

    r2209 r2237  
    135135        */
    136136
    137         const Int_t id = cerpix.GetPixId();
    138         const Double_t area = geom.GetPixRatio(id);
    139 
    140         if (id == 0)
     137        const Int_t idx = cerpix.GetPixId();
     138        const Double_t area = geom.GetPixRatio(idx);
     139
     140        if (idx == 0)
    141141        {
    142142          //*fLog << "MSigmabar : id = 0;  pixel '0' is used, ignore it"
     
    145145        }
    146146
    147         const MGeomPix &gpix = geom[id];
     147        const MGeomPix &gpix = geom[idx];
    148148
    149149        Int_t sector = (Int_t)(atan2(gpix.GetY(),gpix.GetX())*6 / (TMath::Pi()*2));
     
    152152
    153153        // count only those pixels which have a sigma != 0.0
    154         const Float_t sigma = ped[id].GetMeanRms();
     154        const Float_t sigma = ped[idx].GetPedestalRms();
    155155
    156156        if ( sigma <= 0 )
Note: See TracChangeset for help on using the changeset viewer.