Changeset 3417


Ignore:
Timestamp:
03/07/04 14:05:58 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3415 r3417  
    44
    55                                                 -*-*- END OF LINE -*-*-
     6
     72004/03/06: Markus Gaug
     8
     9  * macros/calibration.C
     10    - adapted call to MHCamera::ProjectionS to the new version
     11
     12  * mcalib/Makefile
     13    - include directory mbadpixels
     14
     15  * mcalib/MCalibrationChargeCalc.[h,cc]
     16    - include MBadPixelsCam
     17    - remove exclusion of pixels from ascii-file
     18      (now accessible from MBadPixelsCam)
     19
    620
    7212004/03/05: Nadia Tonello
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc

    r3414 r3417  
    3737//               Initialize pulser light wavelength
    3838//               
    39 //   ReInit:     MCalibrationCam::InitSize(NumPixels) is called which allocates
    40 //               memory in a TClonesArray of type MCalibrationChargePix
     39//   ReInit:     MCalibrationCam::InitSize(NumPixels) is called from MGeomApply (which allocates
     40//               memory in a TClonesArray of type MCalibrationChargePix)
     41//               Initializes pointer to MBadPixelsCam
    4142//
    4243//   Process:    Nothing done by this class, histograms are filled by
     
    5758//   MRawEvtData
    5859//   MPedestalCam
    59 //   MCalibrationCam
     60//   MBadPixelsCam
    6061//
    6162//  Output Containers:
    6263//   MCalibrationCam
     64//   MBadPixelsCam
    6365//
    6466//
     
    174176#include "MCalibrationChargeCalc.h"
    175177
    176 // FXIME: Usage of fstream is a preliminary workaround!
    177 #include <fstream>
    178 
    179178#include <TSystem.h>
    180179#include <TH1.h>
     
    200199#include "MExtractedSignalPix.h"
    201200
     201#include "MBadPixelsCam.h"
     202#include "MBadPixelsPix.h"
     203
    202204
    203205ClassImp(MCalibrationChargeCalc);
     
    211213MCalibrationChargeCalc::MCalibrationChargeCalc(const char *name, const char *title)
    212214    : fPedestals(NULL), fCam(NULL),
    213       fRawEvt(NULL), fRunHeader(NULL), fGeom(NULL), fEvtTime(NULL),
     215      fRawEvt(NULL), fRunHeader(NULL), fGeom(NULL),
     216      fBadPixels(NULL), fEvtTime(NULL),
    214217      fSignals(NULL), fPINDiode(NULL), fBlindPixel(NULL)
    215218{
     
    235238    fNumLoGainSamples  = 0;
    236239    fConversionHiLo    = 0;
    237     fNumExcludedPixels = 0;
    238240
    239241}
     
    323325    }
    324326 
     327  fBadPixels = (MBadPixelsCam*)pList->FindCreateObj("MBadPixelsCam");
     328  if (!fBadPixels)
     329    {
     330      *fLog << err << "Could not find or create MBadPixelsCam ... aborting." << endl;
     331      return kFALSE;
     332    }
     333 
    325334  fCam->SetGeomCam(fGeom);
    326 
    327   fNumHiGainSamples =  fSignals->GetNumUsedHiGainFADCSlices();
    328   fNumLoGainSamples =  fSignals->GetNumUsedLoGainFADCSlices();
    329   fSqrtHiGainSamples = TMath::Sqrt((Float_t)fNumHiGainSamples);
    330  
    331   UInt_t npixels = fGeom->GetNumPixels();
     335  fCam->SetBadPixelsCam(fBadPixels);
     336
     337  fNumHiGainSamples  =  fSignals->GetNumUsedHiGainFADCSlices();
     338  fNumLoGainSamples  =  fSignals->GetNumUsedLoGainFADCSlices();
     339  fSqrtHiGainSamples =  TMath::Sqrt((Float_t)fNumHiGainSamples);
     340 
     341  UInt_t npixels     = fGeom->GetNumPixels();
    332342 
    333343  for (UInt_t i=0; i<npixels; i++)
    334344    {
    335345      MCalibrationChargePix &pix = (*fCam)[i];
     346      MBadPixelsPix         &bad = (*fBadPixels)[i];
     347
    336348      pix.DefinePixId(i);
     349
     350      if (bad.IsBad())
     351        {
     352          pix.SetExcluded();
     353          continue;
     354        }
    337355     
    338356      pix.SetAbsTimeBordersHiGain(fSignals->GetFirstUsedSliceHiGain(),
     
    341359                                  fSignals->GetLastUsedSliceLoGain());
    342360    }
    343  
    344   if (fExcludedPixelsFile.IsNull())
    345         return kTRUE;
    346 
    347     //
    348     // Look for file to exclude pixels from analysis
    349     //
    350     gSystem->ExpandPathName(fExcludedPixelsFile);
    351 
    352     //
    353     // Initialize reading the file
    354     //
    355     ifstream in(fExcludedPixelsFile);
    356     if (!in)
    357     {
    358         *fLog << warn << "Cannot open file '" << fExcludedPixelsFile << "'" << endl;
    359         return kTRUE;
    360     }
    361 
    362     *fLog << inf << "Use excluded pixels from file: '" << fExcludedPixelsFile << "'" << endl;
    363 
    364     //
    365     // Read the file and count the number of entries
    366     //
    367     UInt_t pixel = 0;
    368 
    369     while (++fNumExcludedPixels)
    370     {
    371         in >> pixel;
    372         if (!in)
    373             break;
    374 
    375         //
    376         // Check for out of range
    377         //
    378         if (pixel > npixels)
    379         {
    380             *fLog << warn << "WARNING: To be excluded pixel: " << pixel << " is out of range " << endl;
    381             continue;
    382         }
    383         //
    384         // Exclude pixel
    385         //
    386         MCalibrationChargePix &pix = (*fCam)[pixel];
    387         pix.SetExcluded();
    388 
    389         *fLog << GetDescriptor() << inf << ": Exclude Pixel: " << pixel << endl;
    390 
    391     }
    392 
    393     if (--fNumExcludedPixels == 0)
    394         *fLog << warn << "WARNING: File '" << fExcludedPixelsFile << "'" << " is empty " << endl;
    395     else
    396         fCam->SetNumPixelsExcluded(fNumExcludedPixels);
    397361
    398362    return kTRUE;
     
    436400      const Float_t num    = TMath::Sqrt((Float_t)fPedestals->GetTotalEntries());
    437401
    438       if (ped == -1.)
    439           pix.SetExcluded();
    440      
    441402      //
    442403      // Check if the pixel has been excluded from the fits
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h

    r3351 r3417  
    1515#endif
    1616
    17 #include "TString.h"
    18 
    1917class MRawEvtData;
    2018class MRawRunHeader;
     
    2523class MGeomCam;
    2624class MExtractedSignalCam;
     25class MBadPixelsCam;
    2726class MTime;
    2827class MCalibrationChargeCalc : public MTask
     
    3534  MRawRunHeader              *fRunHeader;                 //! RunHeader information
    3635  MGeomCam                   *fGeom;                      //! Geometry information
    37 
     36  MBadPixelsCam              *fBadPixels;                 //! Bad Pixels information
     37 
    3838  MTime                      *fEvtTime;                   //! Time of the event
    3939
     
    4242  MCalibrationChargeBlindPix *fBlindPixel;                // Calibration results of the Blind Pixel
    4343
    44  
    4544  Byte_t  fNumHiGainSamples;
    4645  Byte_t  fNumLoGainSamples;
     
    4948  Float_t fConversionHiLo;
    5049  Int_t   fFlags;                                // Flag for the fits used
    51 
    52   TString fExcludedPixelsFile;
    53   UInt_t  fNumExcludedPixels;
    5450
    5551  enum  { kUseQualityChecks,
     
    7268      {b ? CLRBIT(fFlags, kHiLoGainCalibration) : SETBIT(fFlags, kHiLoGainCalibration);}
    7369
    74 
    75   // Exclude pixels from configuration file
    76   void ExcludePixelsFromAsciiFile(const char *file) { fExcludedPixelsFile = file;  }
    77  
    7870  ClassDef(MCalibrationChargeCalc, 1)   // Task to fill the Calibration Containers from raw data
    7971};
  • trunk/MagicSoft/Mars/mcalib/Makefile

    r3322 r3417  
    2323#
    2424INCLUDES = -I. -I../mbase -I../mhbase -I../mgui -I../mgeom -I../manalysis \
    25            -I../mraw -I../mtools -I../mmc -I../mimage -I../msignal
     25           -I../mraw -I../mtools -I../mmc -I../mimage -I../msignal -I../mbadpixels
    2626
    2727# mhbase:    MBinning MH
Note: See TracChangeset for help on using the changeset viewer.