Ignore:
Timestamp:
07/14/05 16:03:32 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbadpixels
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCam.cc

    r7095 r7189  
    180180// --------------------------------------------------------------------------
    181181//
    182 // Calculate the number of pixels with the given type-flags.
     182// Calculate the number of pixels without the given type-flags.
    183183//
    184184// The second argument aidx is the area index (see MGeomCam, MGeomPix)
     
    187187// Returns -1 if the geometry doesn't match.
    188188//
    189 Short_t MBadPixelsCam::GetNumUnsuitable(MBadPixelsPix::UnsuitableType_t type, const MGeomCam *geom, Int_t aidx) const
     189Short_t MBadPixelsCam::GetNumSuitable(MBadPixelsPix::UnsuitableType_t type, const MGeomCam *geom, Int_t aidx) const
    190190{
    191191    const UInt_t n = GetSize();
    192192
    193     if (aidx>=0 && geom->GetNumPixels()!=n)
     193    if (aidx>=0 && (!geom || geom->GetNumPixels()!=n))
    194194    {
    195195        *fLog << err << GetDescriptor() << "ERROR - Geometry (" << geom->ClassName() << ") size mismatch!" << endl;
     
    200200    for (UInt_t i=0; i<n; i++)
    201201    {
    202         if (aidx>=0 && (*geom)[i].GetAidx()!=aidx)
     202        if (aidx>=0 && geom && (*geom)[i].GetAidx()!=aidx)
     203            continue;
     204
     205        if (!(*this)[i].IsUnsuitable(type))
     206            rc++;
     207    }
     208    return rc;
     209}
     210
     211// --------------------------------------------------------------------------
     212//
     213// Calculate the number of pixels with the given type-flags.
     214//
     215// The second argument aidx is the area index (see MGeomCam, MGeomPix)
     216// The default (or any value less than 0) means: all
     217//
     218// Returns -1 if the geometry doesn't match.
     219//
     220Short_t MBadPixelsCam::GetNumUnsuitable(MBadPixelsPix::UnsuitableType_t type, const MGeomCam *geom, Int_t aidx) const
     221{
     222    const UInt_t n = GetSize();
     223
     224    if (aidx>=0 && geom && geom->GetNumPixels()!=n)
     225    {
     226        *fLog << err << GetDescriptor() << "ERROR - Geometry (" << geom->ClassName() << ") size mismatch!" << endl;
     227        return -1;
     228    }
     229
     230    Short_t rc = 0;
     231    for (UInt_t i=0; i<n; i++)
     232    {
     233        if (aidx>=0 && geom && (*geom)[i].GetAidx()!=aidx)
    203234            continue;
    204235
     
    334365void MBadPixelsCam::Print(Option_t *o) const
    335366{
    336 
    337367  *fLog << all << GetDescriptor() << ":" << endl;
    338368  *fLog << "Pixels without problems:" << endl;
     
    477507void MBadPixelsCam::PrintBadPixels( MBadPixelsPix::UncalibratedType_t typ, const char *text) const
    478508{
    479 
    480 
    481509  *fLog << "Pixels with " << text << ": " << endl;
    482510  UInt_t count = 0;
  • trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCam.h

    r5463 r7189  
    4242    Short_t GetNumUnsuitable(MBadPixelsPix::UnsuitableType_t type, const MGeomCam *geom, Int_t aidx=-1) const;
    4343    Short_t GetNumUnsuitable(MBadPixelsPix::UnsuitableType_t type) const { return GetNumUnsuitable(type, 0); }
     44    Short_t GetNumSuitable(MBadPixelsPix::UnsuitableType_t type, const MGeomCam *geom, Int_t aidx=-1) const;
     45    Short_t GetNumSuitable(MBadPixelsPix::UnsuitableType_t type) const { return GetNumSuitable(type, 0); }
    4446    Short_t GetNumIsolated(MBadPixelsPix::UnsuitableType_t type, const MGeomCam &geom, Int_t aidx=-1) const;
    4547    Short_t GetNumIsolated(const MGeomCam &geom, Int_t aidx=-1) const { return GetNumIsolated(MBadPixelsPix::kUnsuitableRun, geom, aidx); }
  • trunk/MagicSoft/Mars/mbadpixels/MBadPixelsIntensityCam.cc

    r5052 r7189  
    4444
    4545#include <TOrdCollection.h>
    46 
    47 #include "MGeomCam.h"
     46#include <TGraph.h>
     47
     48#include "MGeomPix.h"
     49#include "MHCamera.h"
     50#include "MLogManip.h"
    4851
    4952ClassImp(MBadPixelsIntensityCam);
     
    268271}
    269272
     273
     274// -------------------------------------------------------------------
     275//
     276// Returns a TGraph with the number of uncalibrated type pixels per area index
     277// vs. the calibration camera.
     278//
     279TGraph *MBadPixelsIntensityCam::GetUncalibratedPerAreaVsTime(const MBadPixelsPix::UncalibratedType_t typ,
     280                                                             const Int_t aidx, const MGeomCam &geom)
     281{
     282 
     283  const Int_t size = GetSize();
     284 
     285  if (size == 0)
     286    return NULL;
     287 
     288  TArrayF uncal(size);
     289  TArrayF time(size);
     290 
     291  for (Int_t i=0;i<GetSize();i++)
     292    {
     293      //
     294      // Get the calibration cam from the intensity cam
     295      //
     296      MBadPixelsCam *cam = GetCam(i);
     297
     298      //
     299      // Get the calibration pix from the calibration cam
     300      //
     301      for (Int_t j=0; j<cam->GetSize(); j++)
     302        {
     303
     304          if (geom[j].GetAidx() != aidx && aidx > -1)
     305            continue;
     306
     307          const MBadPixelsPix &pix = (*cam)[j];
     308          //
     309          // Don't use bad pixels
     310          //
     311          if (pix.IsUncalibrated(typ))
     312            uncal[i]++;
     313        }
     314      time[i] = i;
     315    }
     316 
     317  TGraph *gr = new TGraph(size,time.GetArray(),uncal.GetArray());
     318 
     319  gr->SetTitle(Form("Uncalibrated Pixels Area %d",aidx));
     320  gr->GetXaxis()->SetTitle("Camera Nr.");
     321  gr->GetYaxis()->SetTitle("<N_{uncal}> [1]");     
     322  return gr;
     323}
     324
     325TGraph *MBadPixelsIntensityCam::GetUnsuitablePerAreaVsTime(const MBadPixelsPix::UnsuitableType_t typ, const Int_t aidx, const MGeomCam &geom)
     326{
     327  const Int_t size = GetSize();
     328 
     329  if (size == 0)
     330    return NULL;
     331 
     332  TArrayF unsuit(size);
     333  TArrayF time(size);
     334 
     335  for (Int_t i=0;i<GetSize();i++)
     336    {
     337      //
     338      // Get the calibration cam from the intensity cam
     339      //
     340      MBadPixelsCam *cam = GetCam(i);
     341
     342      //
     343      // Get the calibration pix from the calibration cam
     344      //
     345      for (Int_t j=0; j<cam->GetSize(); j++)
     346        {
     347          if (geom[j].GetAidx() != aidx && aidx > -1)
     348            continue;
     349
     350          const MBadPixelsPix &pix = (*cam)[j];
     351          //
     352          // Don't use bad pixels
     353          //
     354          if (pix.IsUnsuitable(typ))
     355            unsuit[i]++;
     356        }
     357      time[i] = i;
     358    }
     359 
     360  TGraph *gr = new TGraph(size,time.GetArray(),unsuit.GetArray());
     361 
     362  gr->SetTitle(Form("Unsuitable Pixels Area %d",aidx));
     363  gr->GetXaxis()->SetTitle("Camera Nr.");
     364  gr->GetYaxis()->SetTitle("<N_{unsuit}> [1]");     
     365  return gr;
     366}
     367
     368MHCamera *MBadPixelsIntensityCam::GetUnsuitableSpectrum(const MBadPixelsPix::UnsuitableType_t typ, const MGeomCam &geom)
     369{
     370  const Int_t size = GetSize();
     371 
     372  if (size == 0)
     373    return NULL;
     374 
     375  TString title;
     376  TString axist;
     377 
     378  switch (typ)
     379    {
     380    case MBadPixelsPix::kUnsuitableRun:
     381      title = "Unsuitable Pixels";
     382      break;
     383    case MBadPixelsPix::kUnreliableRun:
     384      title = "Unreliable Pixels";
     385      break;
     386    default:
     387      *fLog << warn << "Could not determine unsuitable type ... abort " << endl;
     388      return NULL;
     389    }
     390 
     391  MHCamera *camunsuit = new MHCamera(geom,"Unsuitables",title.Data());
     392
     393  for (Int_t i=0;i<GetSize();i++)
     394    {
     395      //
     396      // Get the calibration cam from the intensity cam
     397      //
     398      MBadPixelsCam *cam = GetCam(i);
     399
     400      //
     401      // Get the calibration pix from the calibration cam
     402      //
     403      for (Int_t j=0; j<cam->GetSize(); j++)
     404        {
     405          const MBadPixelsPix &pix = (*cam)[j];
     406          //
     407          // Don't use bad pixels
     408          //
     409          if (pix.IsUnsuitable(typ))
     410            {
     411              camunsuit->Fill(j,1);
     412              camunsuit->SetUsed(j);
     413            }
     414        }
     415    }
     416 
     417  return camunsuit;
     418}
     419
     420MHCamera *MBadPixelsIntensityCam::GetUncalibratedSpectrum(const MBadPixelsPix::UncalibratedType_t typ, const MGeomCam &geom)
     421{
     422
     423  const Int_t size = GetSize();
     424 
     425  if (size == 0)
     426    return NULL;
     427 
     428  TString title;
     429  TString axist;
     430 
     431  switch (typ)
     432    {
     433      case MBadPixelsPix::kPreviouslyExcluded:
     434        title = "PreviouslyExcluded";
     435        break;
     436      case MBadPixelsPix::kHiGainNotFitted:
     437        title = "HiGainNotFitted";
     438        break;
     439      case MBadPixelsPix::kLoGainNotFitted:
     440        title = "LoGainNotFitted";
     441        break;
     442      case MBadPixelsPix::kRelTimeNotFitted:
     443        title = "RelTimeNotFitted";
     444        break;
     445      case MBadPixelsPix::kHiGainOscillating:
     446        title = "HiGainOscillating";
     447        break;
     448      case MBadPixelsPix::kLoGainOscillating:
     449        title = "LoGainOscillating";
     450        break;
     451      case MBadPixelsPix::kRelTimeOscillating:
     452        title = "RelTimeOscillating";
     453        break;
     454      case MBadPixelsPix::kLoGainSaturation:
     455        title = "LoGainSaturation";
     456        break;
     457      case MBadPixelsPix::kChargeIsPedestal:
     458        title = "ChargeIsPedestal";
     459        break;
     460      case MBadPixelsPix::kChargeErrNotValid:
     461        title = "ChargeErrNotValid";
     462        break;
     463      case MBadPixelsPix::kChargeRelErrNotValid:
     464        title = "ChargeRelErrNotValid";
     465        break;
     466      case MBadPixelsPix::kChargeSigmaNotValid:
     467        title = "ChargeSigmaNotValid";
     468        break;
     469      case MBadPixelsPix::kMeanTimeInFirstBin:
     470        title = "MeanTimeInFirstBin";
     471        break;
     472      case MBadPixelsPix::kMeanTimeInLast2Bins:
     473        title = "MeanTimeInLast2Bins";
     474        break;
     475      case MBadPixelsPix::kDeviatingNumPhes:
     476        title = "DeviatingNumPhes";
     477        break;
     478      case MBadPixelsPix::kDeviatingNumPhots:
     479        title = "DeviatingNumPhots";
     480        break;
     481      case MBadPixelsPix::kDeviatingFFactor:
     482        title = "DeviatingFFactor";
     483        break;
     484      case MBadPixelsPix::kDeviatingTimeResolution:
     485        title = "DeviatingTimeResolution";
     486        break;
     487      case MBadPixelsPix::kConversionHiLoNotValid:
     488        title = "ConversionHiLoNotValid";
     489        break;
     490      case MBadPixelsPix::kHiGainOverFlow:
     491        title = "HiGainOverFlow";
     492        break;
     493      case MBadPixelsPix::kLoGainOverFlow:
     494        title = "LoGainOverFlow";
     495        break;
     496      case MBadPixelsPix::kHiLoNotFitted:
     497        title = "HiLoNotFitted";
     498        break;
     499      case MBadPixelsPix::kHiLoOscillating:
     500        title = "HiLoOscillating";
     501        break;
     502      case MBadPixelsPix::kDeadPedestalRms:
     503        title = "DeadPedestalRms";
     504        break;
     505      case MBadPixelsPix::kFluctuatingArrivalTimes:
     506        title = "FluctuatingArrivalTimes";
     507        break;
     508    default:
     509      *fLog << warn << "Could not determine uncalibrated type ... abort " << endl;
     510      return NULL;
     511    }
     512 
     513  MHCamera *camuncal = new MHCamera(geom,"Uncalibrated",title.Data());
     514
     515  for (Int_t i=0;i<GetSize();i++)
     516    {
     517      //
     518      // Get the calibration cam from the intensity cam
     519      //
     520      MBadPixelsCam *cam = GetCam(i);
     521
     522      //
     523      // Get the calibration pix from the calibration cam
     524      //
     525      for (Int_t j=0; j<cam->GetSize(); j++)
     526        {
     527          const MBadPixelsPix &pix = (*cam)[j];
     528          //
     529          // Don't use bad pixels
     530          //
     531          if (pix.IsUncalibrated(typ))
     532            {
     533              camuncal->Fill(j,1);
     534              camuncal->SetUsed(j);
     535            }
     536        }
     537    }
     538 
     539  return camuncal;
     540}
     541
     542
     543
     544void MBadPixelsIntensityCam::DrawUnsuitablePerAreaVsTime(const MBadPixelsPix::UnsuitableType_t typ, const Int_t aidx, const MGeomCam &geom)
     545{
     546  TGraph *gr = GetUnsuitablePerAreaVsTime(typ,aidx,geom);
     547  gr->SetBit(kCanDelete);
     548  gr->Draw("A*");
     549}
     550
     551void MBadPixelsIntensityCam::DrawUncalibratedPerAreaVsTime(const MBadPixelsPix::UncalibratedType_t typ, const Int_t aidx, const MGeomCam &geom)
     552{
     553  TGraph *gr = GetUncalibratedPerAreaVsTime(typ,aidx,geom);
     554  gr->SetBit(kCanDelete);
     555  gr->Draw("A*");
     556}
  • trunk/MagicSoft/Mars/mbadpixels/MBadPixelsIntensityCam.h

    r5052 r7189  
    1111#include "MBadPixelsCam.h"
    1212#endif
     13#ifndef MARS_MGeomCamMagic
     14#include "MGeomCamMagic.h"
     15#endif
    1316
    1417class TOrdCollection;
    15 class MGeomCam;
     18class TGraph;
     19class MHCamera;
    1620class MBadPixelsIntensityCam : public MParContainer, public MCamEvent
    1721{
     
    7478  void   DrawPixelContent( Int_t num) const;
    7579
     80  TGraph *GetUncalibratedPerAreaVsTime( const MBadPixelsPix::UncalibratedType_t typ,
     81                                        const Int_t aidx=-1, const MGeomCam &geom=MGeomCamMagic());
     82  TGraph *GetUnsuitablePerAreaVsTime( const MBadPixelsPix::UnsuitableType_t typ,
     83                                      const Int_t aidx=-1, const MGeomCam &geom=MGeomCamMagic());
     84
     85  MHCamera *GetUnsuitableSpectrum( const MBadPixelsPix::UnsuitableType_t typ, const MGeomCam &geom=MGeomCamMagic());
     86
     87  MHCamera *GetUncalibratedSpectrum( const MBadPixelsPix::UncalibratedType_t typ, const MGeomCam &geom=MGeomCamMagic());
     88
     89  void DrawUncalibratedPerAreaVsTime( const MBadPixelsPix::UncalibratedType_t typ,
     90                                        const Int_t aidx=-1, const MGeomCam &geom=MGeomCamMagic()); // *MENU*
     91  void DrawUnsuitablePerAreaVsTime( const MBadPixelsPix::UnsuitableType_t typ,
     92                                      const Int_t aidx=-1, const MGeomCam &geom=MGeomCamMagic()); // *MENU*
     93 
     94
     95
    7696  ClassDef(MBadPixelsIntensityCam, 1) // Base Container Intensity BadPixels Results
    7797};
  • trunk/MagicSoft/Mars/mbadpixels/Makefile

    r4957 r7189  
    2121INCLUDES = -I. -I../mbase -I../manalysis -I../mgeom -I../mgui \
    2222           -I../mmc -I../mpedestal -I../msignal -I../mpointing \
    23            -I../mhbase
     23           -I../mhbase -I../mhist
    2424# MBadPixelsCalc  (manalysis): MPedPhotCam, MSigmabar
    2525# MBadPixelsCalc  (mgeom):     MGeomCam
Note: See TracChangeset for help on using the changeset viewer.