Changeset 7109


Ignore:
Timestamp:
05/30/05 18:12:10 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
1 added
11 edited

Legend:

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

    r7094 r7109  
    136136Bool_t MBadPixelsCalc::CheckPedestalRms(MBadPixelsPix::UnsuitableType_t type) const
    137137{
     138    if (!fGeomCam || !fPedPhotCam || !fBadPixels)
     139    {
     140        *fLog << err << "MBadPixelsCalc::CheckPedestalRms: ERROR - One of the necessary container are not initialized..." << endl;
     141        return kFALSE;
     142    }
     143
    138144    if (fPedestalLevel<=0 && fPedestalLevelVariance<=0)
    139145        return kTRUE;
     
    247253    // Check if the number of pixels to blind is > 60% of total number of pixels
    248254    //
    249     //    if (bads>0.6*entries)
    250     //    {
    251     //    fErrors[2]++;
    252     //    return kFALSE;
    253     //    }
     255    if (bads>0.5*entries)
     256    {
     257        *fLog << err << "ERROR - More than 50% unsuitable pixels... something must be wrong!" << endl;
     258        return kFALSE;
     259    }
    254260
    255261    return kTRUE;
     262}
     263
     264Bool_t MBadPixelsCalc::CheckPedestalRms(MBadPixelsCam &cam, const MPedPhotCam &ped, MBadPixelsPix::UnsuitableType_t t)
     265{
     266    MBadPixelsCam *store1 = fBadPixels;
     267    const MPedPhotCam *store2 = fPedPhotCam;
     268
     269    fBadPixels  = &cam;
     270    fPedPhotCam = &ped;
     271
     272    const Bool_t rc = CheckPedestalRms(t);
     273
     274    fBadPixels  = store1;
     275    fPedPhotCam = store2;
     276
     277    return rc;
     278}
     279
     280Bool_t MBadPixelsCalc::CheckPedestalRms(MBadPixelsCam &cam, const MPedestalCam &ped, MBadPixelsPix::UnsuitableType_t t)
     281{
     282    return CheckPedestalRms(cam, MPedPhotCam(ped), t);
    256283}
    257284
  • trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.h

    r7094 r7109  
    1212class MGeomCam;
    1313class MPedPhotCam;
     14class MPedestalCam;
    1415
    1516class MBadPixelsCalc : public MTask
    1617{
    1718private:
    18     MGeomCam      *fGeomCam;    //! Input container storing the pixel sizes
    19     MPedPhotCam   *fPedPhotCam; //! Input container storing the pedestal and pedestal rms of all pixels
    20     MBadPixelsCam *fBadPixels;  //! Output container holding the bad pixels
     19    const MGeomCam      *fGeomCam;    //! Input container storing the pixel sizes
     20    const MPedPhotCam   *fPedPhotCam; //! Input container storing the pedestal and pedestal rms of all pixels
     21          MBadPixelsCam *fBadPixels;  //! Output container holding the bad pixels
    2122
    2223    Float_t fPedestalLevel;
     
    2728    Bool_t fCheckInProcess;
    2829    Bool_t fCheckInPostProcess;
    29 
    30     // MBadPixelsCalc
    31     Bool_t CheckPedestalRms(MBadPixelsPix::UnsuitableType_t t) const;
    3230
    3331    // MTask
     
    4745    void SetNamePedPhotCam(const char *name) { fNamePedPhotCam = name; }
    4846
     47    void SetGeomCam(const MGeomCam *geom) { fGeomCam = geom; }
     48
    4949    void EnableCheckInProcess(Bool_t b=kTRUE)     { fCheckInProcess = b; }
    5050    void EnableCheckInPostProcess(Bool_t b=kTRUE) { fCheckInPostProcess = b; }
     51
     52    // MBadPixelsCalc
     53    Bool_t CheckPedestalRms(MBadPixelsPix::UnsuitableType_t t) const;
     54    Bool_t CheckPedestalRms(MBadPixelsCam &cam, const MPedPhotCam  &ped, MBadPixelsPix::UnsuitableType_t t=MBadPixelsPix::kUnsuitableRun);
     55    Bool_t CheckPedestalRms(MBadPixelsCam &cam, const MPedestalCam &ped, MBadPixelsPix::UnsuitableType_t t=MBadPixelsPix::kUnsuitableRun);
    5156
    5257    ClassDef(MBadPixelsCalc, 1) // Task to find bad pixels (star, broken pixels, etc)
  • trunk/MagicSoft/Mars/mhflux/FluxLinkDef.h

    r7038 r7109  
    77#pragma link C++ class MAlphaFitter+;
    88
     9#pragma link C++ class MHDisp+;
    910#pragma link C++ class MHAlpha+;
    1011#pragma link C++ class MHThetaSq+;
     
    1314#pragma link C++ class MHEffectiveOnTime+;
    1415#pragma link C++ class MHCollectionArea+;
     16#pragma link C++ class MMcSpectrumWeight+;
     17
     18//#pragma link C++ class MMatrixHist+;
     19//#pragma link C++ class MMatrixUnfold+;
     20//#pragma link C++ class MUnfoldBert+;
    1521
    1622#endif
  • trunk/MagicSoft/Mars/mhflux/MHFalseSource.cc

    r6892 r7109  
    246246    fMm2Deg = geom->GetConvMm2Deg();
    247247
    248     if (fName!=(TString)"MHFalseSourceOff" && fHistOff==NULL)
    249     {
    250         MHFalseSource *hoff = (MHFalseSource*)plist->FindObject("MHFalseSourceOff", "MHFalseSource");
     248    const TString off(Form("%sOff", fName.Data()));
     249    if (fName!=off && fHistOff==NULL)
     250    {
     251        const TString desc(Form("%s [%s] found... using ", off.Data(), ClassName()));
     252        MHFalseSource *hoff = (MHFalseSource*)plist->FindObject(off, ClassName());
    251253        if (!hoff)
    252             *fLog << inf << "No MHFalseSourceOff [MHFalseSource] found... using current data only!" << endl;
     254            *fLog << inf << "No " << desc << "current data only!" << endl;
    253255        else
    254256        {
    255             *fLog << inf << "MHFalseSource [MHFalseSource] found... using on-off mode!" << endl;
     257            *fLog << inf << desc << "on-off mode!" << endl;
    256258            SetOffData(*hoff);
    257259        }
     
    294296        *fLog << warn << "MObservatory not found... no derotation." << endl;
    295297
     298    MPointingPos *point = (MPointingPos*)plist->FindObject("MSourcePos", "MPointingPos");
     299    if (!point)
     300        point = fPointPos;
     301
    296302    // FIXME: Because the pointing position could change we must check
    297303    // for the current pointing position and add a offset in the
    298304    // Fill function!
    299     fRa  = fPointPos ? fPointPos->GetRa()  :  0;
    300     fDec = fPointPos ? fPointPos->GetDec() : 90;
     305    fRa  = point ? point->GetRa()  :  0;
     306    fDec = point ? point->GetDec() : 90;
    301307
    302308    return kTRUE;
     
    615621                const Int_t l = h0->GetXaxis()->FindFixBin(fAlphaCut*3)+f-1;
    616622                h0->Scale(h1->Integral(f, l)/h0->Integral(f, l));
     623
     624
    617625                //h0->Scale(h1->GetEntries()/h0->GetEntries());
    618626
     
    854862}
    855863
    856 Double_t FcnGauss2d(Double_t *x, Double_t *par)
     864static Double_t FcnGauss2d(Double_t *x, Double_t *par)
    857865{
    858866    TVector2 v = TVector2(x[0], x[1]).Rotate(par[5]*TMath::DegToRad());
  • trunk/MagicSoft/Mars/mhflux/MHFalseSource.h

    r6978 r7109  
    2020class MHFalseSource : public MH
    2121{
    22 private:
     22protected:
    2323    MTime         *fTime;        //! container to take the event time from
    2424    MPointingPos  *fPointPos;    //! container to take pointing position from
     
    2828    Float_t fMm2Deg;             // conversion factor for display in degrees
    2929
     30private:
    3031    Float_t fAlphaCut;           // Alpha cut
    3132    Float_t fBgMean;             // Background mean
     
    3738    Float_t fMaxDW;              // Maximum distance in percent of dist
    3839
     40protected:
    3941    TH3D    fHist;               // Alpha vs. x and y
    4042
     
    4446    Double_t fDec;
    4547
     48private:
    4649    Int_t DistancetoPrimitive(Int_t px, Int_t py);
    4750    void Modified();
  • trunk/MagicSoft/Mars/mjobs/MJCut.cc

    r7075 r7109  
    304304
    305305    SetNameHist(GetEnv("NameHist", fNameHist));
     306    SetNameHistFS(GetEnv("NameHistFS", fNameHistFS));
    306307
    307308    return kTRUE;
     
    366367    }
    367368
    368     const TString objname(Form("%s%s", "Hist"/*fNameHist.Data()*/, name));
     369    const TString objname(Form("Hist%s", name));
    369370    MHAlpha *h = (MHAlpha*)plist.FindCreateObj(fNameHist, objname);
    370371    if (!h)
     
    374375
    375376    return h;
     377}
     378
     379// --------------------------------------------------------------------------
     380//
     381// Create a new instance of an object with name name of class
     382// type fNameHistFS in parlist. It must derive from MHFalseSource
     383// If something fails NULL is returned.
     384//
     385MH *MJCut::CreateNewHistFS(MParList &plist, const char *name) const
     386{
     387    const TString cname(fNameHistFS.IsNull()?"MHFalseSource":fNameHistFS);
     388
     389    TClass *cls = gROOT->GetClass(cname);
     390    if (!cls)
     391    {
     392        *fLog << err << "Class " << cname << " not found in dictionary... abort." << endl;
     393        return NULL;
     394    }
     395    if (!cls->InheritsFrom("MHFalseSource"))
     396    {
     397        *fLog << err << "Class " << cname << " doesn't inherit from MHFalseSource... abort." << endl;
     398        return NULL;
     399    }
     400
     401    const TString objname(Form("FS%s", name));
     402    return (MH*)plist.FindCreateObj(cname, objname);
    376403}
    377404
     
    452479    MHAlpha *halphaoff = CreateNewHist(plist, "Off");
    453480    MFillH falpha(halphaoff, "", "FillHist");
    454     MFillH ffs("MHFalseSourceOff [MHFalseSource]", "MHillas", "FillFS");
     481    MH *hfsoff = CreateNewHistFS(plist, "Off");
     482    MFillH ffs(hfsoff, "MHillas", "FillFS");
    455483
    456484    // FIXME: If fPathIn read cuts and energy estimator from file!
     
    531559    tlist2.AddToList(&scalc);
    532560    tlist2.AddToList(&hcalc);
    533     if (fIsWobble)
     561    //if (fIsWobble)
    534562        tlist2.AddToList(&hcalc2);
    535563    //tlist2.AddToList(&taskenv1);
     
    541569        tlist2.AddToList(&fill1a);
    542570    tlist2.AddToList(&cont1);
    543     if (!fWriteOnly && !fIsWobble)
     571    if (!fWriteOnly && (!fIsWobble || !fNameHistFS.IsNull()))
    544572        tlist2.AddToList(&ffs);
    545573    tlist2.AddToList(&cont2);
     
    679707    MHAlpha *halphaon=CreateNewHist(plist);
    680708    MFillH falpha2(halphaon, "", "FillHist");
    681     MFillH ffs2("MHFalseSource", "MHillas", "FillFS");
     709    MH *hfs=CreateNewHistFS(plist);
     710    MFillH ffs2(hfs, "MHillas", "FillFS");
    682711
    683712    tlist.Replace(&readon);
     
    702731        }
    703732        tlist2.Replace(&falpha2);
    704         if (!fIsWobble)
     733        if (!fIsWobble/* || !fNameHist.IsNull()*/)
    705734            tlist2.Replace(&ffs2);
     735        if (fIsWobble && !fNameHist.IsNull())
     736            tlist2.RemoveFromList(&ffs);
    706737
    707738        if (!fIsMonteCarlo)
  • trunk/MagicSoft/Mars/mjobs/MJCut.h

    r6988 r7109  
    1010class MParList;
    1111class MHAlpha;
     12class MH;
    1213class MWriteRootFile;
    1314
     
    2829
    2930    TString fNameHist;
     31    TString fNameHistFS;
    3032
    3133    //MTask *fEstimateEnergy;
     
    3840    Bool_t   WriteResult(const MParList &plist, UInt_t num) const;
    3941    MHAlpha *CreateNewHist(MParList &plist, const char *name="") const;
     42    MH      *CreateNewHistFS(MParList &plist, const char *name="") const;
    4043
    4144    Bool_t   CanStoreSummary() const { return !fPathOut.IsNull() && fStoreSummary; }
     
    6164
    6265    void SetNameHist(const char *name) { fNameHist=name; }
     66    void SetNameHistFS(const char *name) { fNameHistFS=name; }
    6367
    6468    //void SetEnergyEstimator(const MTask *task=0);
  • trunk/MagicSoft/Mars/mpedestal/MPedPhotCam.cc

    r5807 r7109  
    5555#include "MBadPixelsPix.h"
    5656
     57#include "MPedestalCam.h"
     58#include "MPedestalPix.h"
     59
    5760ClassImp(MPedPhotCam);
    5861
     
    6164// --------------------------------------------------------------------------
    6265//
    63 // Default constructor. Creates a MPedPhotPix object for each pixel
    64 //
    65 MPedPhotCam::MPedPhotCam(const char *name, const char *title)
     66// Contains the default constructor. Creates a MPedPhotPix object
     67// for each pixel
     68//
     69void MPedPhotCam::InitArrays(const char *name, const char *title)
    6670{
    6771    fName  = name  ? name  : "MPedPhotCam";
     
    7175    fAreas   = new TClonesArray("MPedPhotPix", 1);
    7276    fSectors = new TClonesArray("MPedPhotPix", 1);
     77}
     78
     79// --------------------------------------------------------------------------
     80//
     81// Default constructor. Creates a MPedPhotPix object for each pixel
     82//
     83MPedPhotCam::MPedPhotCam(const char *name, const char *title)
     84{
     85    InitArrays(name, title);
     86}
     87
     88// --------------------------------------------------------------------------
     89//
     90// Initialize the mean, rms and number of events with the values from
     91// the MPedestalCam converted 1:1
     92//
     93MPedPhotCam::MPedPhotCam(const MPedestalCam &p)
     94{
     95    const Int_t n = p.GetSize();
     96
     97    InitArrays();
     98    InitSize(n);
     99
     100    for (int i=0; i<n; i++)
     101        (*this)[i].Set(p[i].GetPedestal(), p[i].GetPedestalRms(), p[i].GetNumEvents());
    73102}
    74103
  • trunk/MagicSoft/Mars/mpedestal/MPedPhotCam.h

    r4609 r7109  
    1414class MPedPhotPix;
    1515class MBadPixelsCam;
     16class MPedestalCam;
    1617
    1718class MPedPhotCam : public MParContainer, public MCamEvent
     
    2223    TClonesArray *fSectors;  //-> Array of MPedPhotPix, one per camera sector
    2324
     25    void InitArrays(const char *name=NULL, const char *title=NULL);
     26
    2427    //  void InitSize(const UInt_t i);
    2528    void InitAreas(const UInt_t i);
     
    2831public:
    2932    MPedPhotCam(const char *name=NULL, const char *title=NULL);
     33    MPedPhotCam(const MPedestalCam &pcam);
    3034    ~MPedPhotCam();
    3135
  • trunk/MagicSoft/Mars/mpointing/MSrcPosCam.cc

    r3568 r7109  
    5656    fName  = name  ? name  : gsDefName.Data();
    5757    fTitle = title ? title : gsDefTitle.Data();
     58}
     59
     60// --------------------------------------------------------------------------
     61//
     62// Copy constructor, set default name and title
     63//
     64MSrcPosCam::MSrcPosCam(const MSrcPosCam &p) : fX(p.fX), fY(p,fY)
     65{
     66    fName  = gsDefName.Data();
     67    fTitle = gsDefTitle.Data();
    5868}
    5969
  • trunk/MagicSoft/Mars/mpointing/MSrcPosCam.h

    r4710 r7109  
    1616public:
    1717    MSrcPosCam(const char *name=NULL, const char *title=NULL);
     18    MSrcPosCam(const MSrcPosCam &p);
    1819
    1920    void Clear(Option_t *)           { fX = 0; fY = 0; }
Note: See TracChangeset for help on using the changeset viewer.