Ignore:
Timestamp:
05/02/03 08:56:31 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/manalysis
Files:
3 edited

Legend:

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

    r1965 r2052  
    351351}
    352352
    353 /*
    354 // --------------------------------------------------------------------------
    355 //
    356 // Use this function to sum photons in events together.
    357 //
    358 Bool_t MCerPhotEvt::AddEvent(const MCerPhotEvt &evt)
    359 {
    360     if (evt.fNumPixels<=0)
    361     {
    362         *fLog << "Warning - Event to be added has no pixels." << endl;
    363         return kFALSE;
    364     }
    365     if (fNumPixels<=0)
    366     {
    367         *fLog << "Warning - Event to add pixels to has no pixels." << endl;
    368         return kFALSE;
    369     }
    370 
    371     for (UInt_t i=0; i<evt.fNumPixels; i++)
    372     {
    373         const UInt_t id = evt[i].GetPixId();
    374 
    375         MCerPhotPix *pix2 = GetPixById(id);
    376         if (!pix2)
    377         {
    378             *fLog << "Error - Pixel#" << dec << id << " does not exist in this event!" << endl;
    379             return kFALSE;
    380         }
    381 
    382         pix2->AddNumPhotons(evt[i].GetNumPhotons());
    383     }
    384     return kTRUE;
    385 }
    386 */
    387 
    388353void MCerPhotEvt::Scale(Double_t f)
    389354{
    390355    fPixels->ForEach(MCerPhotPix, Scale)(f);
    391356}
     357
     358void MCerPhotEvt::RemoveUnusedPixels()
     359{
     360    TIter Next(fPixels);
     361    MCerPhotPix *pix = NULL;
     362
     363    while ((pix=(MCerPhotPix*)Next()))
     364        if (!pix->IsPixelUsed())
     365            fPixels->Remove(pix);
     366
     367    fPixels->Compress();
     368    fNumPixels=fPixels->GetEntriesFast();
     369}
  • trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h

    r1965 r2052  
    4949
    5050    void Scale(Double_t f);
     51    void RemoveUnusedPixels();
    5152
    5253    MCerPhotPix *GetPixById(int id) const;
  • trunk/MagicSoft/Mars/manalysis/MSigmabar.cc

    r1961 r2052  
    172172    fSigmabarInner = 0;
    173173    fSigmabarOuter = 0;
    174     for (UInt_t i=0; i<6; i++) {
     174    for (UInt_t i=0; i<6; i++)
     175    {
    175176        fSigmabarInner += innerSquaredSum[i];
    176177        fInnerPixels   += innerPixels[i];
     
    187188    if (fOuterPixels > 0) fSigmabarOuter /= fOuterPixels;
    188189
    189   //
    190   // this is the sqrt of the average sigma^2
    191   // for the inner and outer pixels respectively
    192   //
    193   fSigmabarInner = sqrt( fSigmabarInner );
    194   fSigmabarOuter = sqrt( fSigmabarOuter );
    195 
    196   for (UInt_t i=0; i<6; i++) {
    197       fSigmabarSector[i] = innerPixels[i]+outerPixels[i]<=0?0:sqrt((innerSquaredSum[i]+outerSquaredSum[i])/(innerPixels[i]+outerPixels[i]));
    198 
    199       const Double_t is = innerPixels[i]<=0?0:innerSquaredSum[i]/innerPixels[i];
    200       const Double_t os = outerPixels[i]<=0?0:outerSquaredSum[i]/outerPixels[i];
    201 
    202       fSigmabarInnerSector[i] = sqrt( is );
    203       fSigmabarOuterSector[i] = sqrt( os );
    204   }
    205    
     190    //
     191    // this is the sqrt of the average sigma^2
     192    // for the inner and outer pixels respectively
     193    //
     194    fSigmabarInner = sqrt( fSigmabarInner );
     195    fSigmabarOuter = sqrt( fSigmabarOuter );
     196
     197    for (UInt_t i=0; i<6; i++)
     198    {
     199        const Double_t ip  = innerPixels[i];
     200        const Double_t op  = outerPixels[i];
     201        const Double_t iss = innerSquaredSum[i];
     202        const Double_t oss = outerSquaredSum[i];
     203
     204        const Double_t sum = ip + op;
     205
     206        fSigmabarSector[i]      = sum<=0 ? 0 : sqrt((iss+oss)/sum);
     207        fSigmabarInnerSector[i] = ip <=0 ? 0 : sqrt(iss/ip);
     208        fSigmabarOuterSector[i] = op <=0 ? 0 : sqrt(oss/op);
     209    }
     210
    206211  return fSigmabar;
    207212}
     
    237242
    238243}
    239 
    240 
    241 
    242 
    243 
    244 
Note: See TracChangeset for help on using the changeset viewer.