Ignore:
Timestamp:
11/18/04 15:55:40 (20 years ago)
Author:
wittek
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbadpixels
Files:
4 edited

Legend:

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

    r4635 r5431  
    106106        if (!fPedPhotCam)
    107107        {
    108             *fLog << err << "MPedPhotCam not found... aborting." << endl;
     108          *fLog << err << fNamePedPhotContainer << "[MPedPhotCam] not found... aborting." << endl;
    109109            return kFALSE;
    110110        }
     
    117117        }
    118118    }
     119
     120    *fLog << inf << "Name of MPedPhotCam container : " << fNamePedPhotContainer
     121          << endl;
     122
    119123    return kTRUE;
    120124}
     
    257261        fPedPhotCam->ReCalc(*fGeomCam, fBadPixels);
    258262    }
     263
    259264    return kTRUE;
    260265}
  • trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.h

    r5117 r5431  
    3737
    3838#endif
     39
     40
     41
     42
  • trunk/MagicSoft/Mars/mbadpixels/MHBadPixels.cc

    r4887 r5431  
    3535#include "MBadPixelsCam.h"
    3636#include "MGeomCam.h"
     37#include "MPedPhotCam.h"
    3738#include "MParList.h"
    3839#include "MBinning.h"
     
    4748// -------------------------------------------------------------------------
    4849//
    49 //  Default Constructor.
     50//  Constructor.
    5051//
    5152MHBadPixels::MHBadPixels(const char *name, const char *title)
    52     : fNamePedPhotCam("MPedPhotCam")
    5353{
    5454    fName  = name  ? name  : "MHBadPixels";
    5555    fTitle = title ? title : "Histogram for Bad Pixels vs. Theta";
    5656
    57     fBadId.SetName("2D-IdBadPixels");
    58     fBadId.SetTitle("2D-IdBadPixels");
    59     fBadId.SetDirectory(NULL);
    60     fBadId.SetXTitle("\\Theta [\\circ]");
    61     fBadId.SetYTitle("pixel Id");
    62 
    63     fBadN.SetName("2D-NBadPixels");
    64     fBadN.SetTitle("2D-NBadPixels");
    65     fBadN.SetDirectory(NULL);
    66     fBadN.SetXTitle("\\Theta [\\circ]");
    67     fBadN.SetYTitle("number of bad pixels");
    68 
     57    fBadId = new TH2D;
     58    fBadId->SetName("2D-IdBadPixels");
     59    fBadId->SetTitle("2D-IdBadPixels");
     60    fBadId->SetDirectory(NULL);
     61    fBadId->UseCurrentStyle();
     62    fBadId->SetXTitle("\\Theta [\\circ]");
     63    fBadId->SetYTitle("pixel Id");
     64    fBadId->SetTitleOffset(1.2, "Y");
     65
     66    fBadN = new TH2D;
     67    fBadN->SetName("2D-NBadPixels");
     68    fBadN->SetTitle("2D-NBadPixels");
     69    fBadN->SetDirectory(NULL);
     70    fBadN->UseCurrentStyle();
     71    fBadN->SetXTitle("\\Theta [\\circ]");
     72    fBadN->SetYTitle("number of bad pixels");
     73    fBadN->SetTitleOffset(1.2, "Y");
     74
     75    // define default binnings
     76    fBinsTheta = new MBinning;
     77    fBinsTheta->SetEdgesCos(10,  0.0,  90.0);    // theta
     78
     79    fBinsPix = new MBinning;
     80    fBinsPix->SetEdges(578, -0.5, 577.5);    // pixel id
     81
     82    SetBinning(fBadId, fBinsTheta, fBinsPix);
     83    SetBinning(fBadN,  fBinsTheta, fBinsPix);
     84
     85    //-----------------------------------------
     86    fNamePedPhotCam = "MPedPhotCamFromData";
     87}
     88
     89
     90// -------------------------------------------------------------------------
     91//
     92//  Destructor.
     93//
     94MHBadPixels::~MHBadPixels()
     95{
     96  delete fBadId;
     97  delete fBadN;
     98
     99  delete fBinsTheta;
     100  delete fBinsPix;
    69101}
    70102
     
    75107Bool_t MHBadPixels::SetupFill(const MParList *plist)
    76108{
    77     MGeomCam *fCam = (MGeomCam*)plist->FindObject(AddSerialNumber("MGeomCam"));
     109    fCam = (MGeomCam*)plist->FindObject(AddSerialNumber("MGeomCam"));
    78110    if (!fCam)   
    79111    {
    80         *fLog << err << "MGeomCam not found... aborting." << endl;
    81         return kFALSE;
    82     }
     112        *fLog << err << "MHBadPixels::SetupFill; MGeomCam not found... aborting." << endl;
     113        return kFALSE;
     114    }
     115    *fLog << "MHBadPixels::SetupFill; fCam = " << fCam << endl;
     116
    83117    fPointPos = (MPointingPos*)plist->FindObject("MPointingPos");
    84118    if (!fPointPos)
     
    87121        return kFALSE;
    88122    }
     123   
     124    fPedPhot = (MPedPhotCam*)plist->FindObject(AddSerialNumber(fNamePedPhotCam), "MPedPhotCam");
     125    if (!fPedPhot)
     126    {
     127        *fLog << err << AddSerialNumber(fNamePedPhotCam)
     128              << "[MPedPhotCam] not found... aborting." << endl;
     129        return kFALSE;
     130    }
     131    fPedPhot->InitSize(fCam->GetNumPixels());
     132
    89133
    90134    //----------------------------------------------------
     135    *fLog << inf << "Name of MPedPhotCam container : " << fNamePedPhotCam
     136          << endl;
     137
     138
     139    //----------------------------------------------------
     140    // redefine the binnings
     141   
    91142    // Get Theta Binning
    92     MBinning* binstheta  = (MBinning*)plist->FindObject("BinningTheta", "MBinning");
     143    const MBinning* binstheta  = (MBinning*)plist->FindObject("BinningTheta", "MBinning");
    93144    if (!binstheta)
    94145    {
    95         *fLog << err << "BinningTheta [MBinning] not found... aborting" << endl;
    96         return kFALSE;
    97     }
    98 
    99     // Get binning for pixel number
    100     const UInt_t npix1 = fCam->GetNumPixels()+1;
    101 
     146        *fLog << err << "Object 'BinningTheta' [MBinning] not found... use default binning." << endl;
     147        binstheta = fBinsTheta;
     148    }
     149
     150    // Define binning for pixel number
     151    const UInt_t npix1 = fPedPhot->GetSize()+1;
     152    //*fLog << "MHBadPixels::SetupFill(); npix1 = " << npix1 << endl;
    102153    MBinning binspix("BinningPixel");
    103154    binspix.SetEdges(npix1, -0.5, npix1-0.5);
    104155
    105156    // Set binnings in histograms
    106     SetBinning(&fBadId, binstheta, &binspix);
    107     SetBinning(&fBadN,  binstheta, &binspix);
     157    SetBinning(fBadId, binstheta, &binspix);
     158    SetBinning(fBadN,  binstheta, &binspix);
     159
     160    *fLog << "MHBadPixels::SetupFill(); binnings were set" << endl;
     161   
     162
    108163
    109164    return kTRUE;
     
    122177    Double_t theta = fPointPos->GetZd();
    123178
    124     const MBadPixelsCam *badpixels = (MBadPixelsCam*)par;
    125 
    126     const UInt_t entries = badpixels->GetSize();
    127 
     179    const MBadPixelsCam *fBadPixels = (MBadPixelsCam*)par;
     180
     181    const UInt_t entries = fPedPhot->GetSize();
    128182    UInt_t nb = 0;
    129183    for (UInt_t i=0; i<entries; i++)
    130184    {
    131         if ( (*badpixels)[i].IsUnsuitable() )
    132         {
    133             fBadId.Fill(theta, i, w);
    134             nb++;
    135         }
    136     }
    137     fBadN.Fill(theta, nb, w);
     185      //*fLog << "MHBadPixels::Fill; i = " << i << endl;
     186
     187      if ( (*fBadPixels)[i].IsUnsuitable() )
     188      {
     189        //*fLog << "MHBadPixels::Fill; (UnSuitable) " << endl;
     190
     191          fBadId->Fill(theta, i, w);
     192          nb++;
     193      }   
     194    }
     195    fBadN->Fill(theta, nb, w);
    138196
    139197    return kTRUE;
     
    154212
    155213    pad->cd(1);
    156     fBadId.Draw(option);
     214    fBadId->Draw(option);
    157215
    158216    pad->cd(2);
    159     fBadN.Draw(option);
     217    fBadN->Draw(option);
    160218
    161219    pad->cd(3);
    162220    gPad->SetBorderMode(0);
    163     h = ((TH2*)&fBadId)->ProjectionY("ProjY-pixId", -1, 9999, "");
     221    h = ((TH2*)fBadId)->ProjectionY("ProjY-pixId", -1, 9999, "");
    164222    h->SetDirectory(NULL);
    165223    h->SetTitle("Distribution of bad pixel Id");
    166224    h->SetXTitle("Id of bad pixel");
    167225    h->SetYTitle("No. of events");
     226    h->SetTitleOffset(1.2, "Y");
    168227    h->Draw(option);
    169228    h->SetBit(kCanDelete);
     
    171230    pad->cd(4);
    172231    gPad->SetBorderMode(0);
    173     h = ((TH2*)&fBadN)->ProjectionY("ProjY-pixN", -1, 9999, "");
     232    h = ((TH2*)fBadN)->ProjectionY("ProjY-pixN", -1, 9999, "");
    174233    h->SetDirectory(NULL);
    175234    h->SetTitle("Distribution of no.of bad pixels");
    176235    h->SetXTitle("No. of bad pixels");
    177236    h->SetYTitle("No. of events");
     237    h->SetTitleOffset(1.2, "Y");
    178238    h->Draw(option);
    179239    h->SetBit(kCanDelete);
     
    182242    pad->Update();
    183243}
     244//==========================================================================
     245
     246
     247
     248
     249
     250
     251
     252
     253
     254
     255
  • trunk/MagicSoft/Mars/mbadpixels/MHBadPixels.h

    r4887 r5431  
    1818private:
    1919    MGeomCam      *fCam;      //!
     20    MPedPhotCam   *fPedPhot;  //!
    2021    MPointingPos  *fPointPos; //!
    2122
    2223    TString  fNamePedPhotCam; //! name of the 'MPedPhotCam' container
     24    MBinning *fBinsTheta;     //!
     25    MBinning *fBinsPix;       //!
    2326
    24     TH2D          fBadId; // 2D-histogram : pixel Id vs. Theta
    25     TH2D          fBadN;  // 2D-histogram : no.of bad pixels vs. Theta
     27    TH2D          *fBadId; // 2D-histogram : pixel Id vs. Theta
     28    TH2D          *fBadN;  // 2D-histogram : no.of bad pixels vs. Theta
    2629
    2730public:
    2831    MHBadPixels(const char *name=NULL, const char *title=NULL);
     32    ~MHBadPixels();
    2933
    3034    void SetNamePedPhotCam(const char *name)  { fNamePedPhotCam = name; }
    3135
    32     const TH2D *GetBadId()       { return &fBadId; }
    33     const TH2D *GetBadId() const { return &fBadId; }
     36    const TH2D *GetBadId()       { return fBadId; }
     37    const TH2D *GetBadId() const { return fBadId; }
    3438
    35     const TH2D *GetBadN()       { return &fBadN; }
    36     const TH2D *GetBadN() const { return &fBadN; }
     39    const TH2D *GetBadN()       { return fBadN; }
     40    const TH2D *GetBadN() const { return fBadN; }
     41
     42    TH2 *GetBadIdByName(const TString name) { return fBadId; }
     43    TH2 *GetBadNByName(const TString name)  { return fBadN; }
    3744
    3845    void Draw(Option_t* option = "");
Note: See TracChangeset for help on using the changeset viewer.