Changeset 3237 for trunk/MagicSoft


Ignore:
Timestamp:
02/19/04 10:30:23 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3236 r3237  
    44
    55                                                 -*-*- END OF LINE -*-*-
     6 2004/01/19: Thomas Bretz
     7
     8   * manalysis/MCerPhotEvt.h:
     9     - added operator= to MCerPhotEvtIter -- is this correct?
     10
     11   * mhist/MHCamera.[h,cc]:
     12     - added member function to calculate minimum content and
     13       maximum content for a single sector
     14     - Added possibility to get a projection for a single sector.
     15     - GetMinimum/GetMaximum now only takes used pixels into account
     16       (you can request all pixels using a different member function)
     17     - fixed projection (projection only took pixels with contents!=0
     18       instead of 'used' pixels
     19     - Don't call Sumw2() anymore for projection
     20
     21   * mjobs/MJExtractSignal.cc:
     22     - added MPedestalCam to output again - MPedestalCam was fixed
     23       yesterday
     24     - Added Histograms for the two camera halves
     25
     26
    627
    728 2004/01/18: Markus Gaug
     
    1536    * mcalib/MCalibrationPix.h
    1637      - move CalcFFactorMethod to public
    17  
     38
     39
    1840
    1941 2004/01/18: Abelardo Moralejo
  • trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h

    r3148 r3237  
    9696    MCerPhotEvtIter(const MCerPhotEvt *evt, Bool_t usedonly=kTRUE, Bool_t dir=kIterForward) : TObjArrayIter(evt->fPixels, dir), fUsedOnly(usedonly) { }
    9797    TObject *Next();
     98    TIterator &operator=(const TIterator &) { return *this; }
    9899    ClassDef(MCerPhotEvtIter, 0)
    99100};
  • trunk/MagicSoft/Mars/mhist/MHCamera.cc

    r3143 r3237  
    162162// ------------------------------------------------------------------------
    163163//
     164// Return kTRUE for sector<0. Otherwise return kTRUE only if the specified
     165// sector idx matches the sector of the pixel with index idx.
     166//
     167Bool_t MHCamera::MatchSector(Int_t idx, Int_t sector) const
     168{
     169    return sector<0 ? kTRUE : (*fGeomCam)[idx].GetSector()==(UInt_t)sector;
     170}
     171
     172// ------------------------------------------------------------------------
     173//
    164174// Taken from TH1D::Fill(). Uses the argument directly as bin index.
    165175// Doesn't increment the number of entries.
     
    255265}
    256266
    257 Stat_t MHCamera::GetMean(Int_t axis) const
     267// ------------------------------------------------------------------------
     268//
     269// Return the mean value of all entries which are used if all=kFALSE and
     270// of all entries if all=kTRUE if sector<0. If sector>=0 only
     271// entries with match the given sector are taken into account.
     272//
     273Stat_t MHCamera::GetMeanSector(Int_t sector, Bool_t all) const
    258274{
    259275    if (fNcells<=1)
    260276        return 0;
    261277
     278    Int_t n=0;
     279
    262280    Stat_t mean = 0;
    263     for (int i=1; i<fNcells-1; i++)
    264         mean += fArray[i];
    265 
    266     return Profile(mean/(fNcells-2));
    267 }
    268 
    269 Stat_t MHCamera::GetRMS(Int_t axis) const
     281    for (int i=0; i<fNcells-2; i++)
     282    {
     283        if ((all || IsUsed(i)) && MatchSector(i, sector))
     284        {
     285            mean += fArray[i+1];
     286            n++;
     287        }
     288    }
     289
     290    return Profile(mean/n);
     291}
     292
     293// ------------------------------------------------------------------------
     294//
     295// Return the rms value of all entries which are used if all=kFALSE and
     296// of all entries if all=kTRUE if sector<0. If sector>=0 only
     297// entries with match the given sector are taken into account.
     298//
     299Stat_t MHCamera::GetRmsSector(Int_t sector, Bool_t all) const
    270300{
    271301    if (fNcells<=1)
    272302        return -1;
    273303
    274     const Int_t n = fNcells-2;
     304    Int_t n=0;
    275305
    276306    Stat_t sum = 0;
    277307    Stat_t sq  = 0;
    278     for (int i=1; i<n+1; i++)
    279     {
    280         sum += fArray[i];
    281         sq  += fArray[i]*fArray[i];
     308    for (int i=0; i<fNcells-2; i++)
     309    {
     310        if ((all || IsUsed(i)) && MatchSector(i, sector))
     311        {
     312            sum += fArray[i+1];
     313            sq  += fArray[i+1]*fArray[i+1];
     314            n++;
     315        }
    282316    }
    283317
     
    291325//
    292326// Return the minimum contents of all pixels (if all is set, otherwise
    293 // only of all 'used' pixels), fMinimum if fMinimum set
    294 //
    295 Double_t MHCamera::GetMinimum(Bool_t all) const
     327// only of all 'used' pixels), fMinimum if fMinimum set. If sector>=0
     328// only pixels with matching sector number are taken into account.
     329//
     330Double_t MHCamera::GetMinimumSector(Int_t sector, Bool_t all) const
    296331{
    297332    if (fMinimum != -1111)
     
    303338    Double_t minimum=FLT_MAX;
    304339
    305     if (all)
    306     {
    307         for (Int_t idx=0; idx<fNcells-2; idx++)
    308             if (fArray[idx+1] < minimum)
    309                 minimum = fArray[idx+1];
    310     }
    311     else
    312     {
    313         for (Int_t idx=0; idx<fNcells-2; idx++)
    314             if (IsUsed(idx) && fArray[idx+1] < minimum)
    315                 minimum = fArray[idx+1];
    316     }
     340    for (Int_t idx=0; idx<fNcells-2; idx++)
     341        if (MatchSector(idx, sector) && (all || IsUsed(idx)) && fArray[idx+1]<minimum)
     342            minimum = fArray[idx+1];
     343
    317344    return Profile(minimum);
    318345}
     
    321348//
    322349// Return the maximum contents of all pixels (if all is set, otherwise
    323 // only of all 'used' pixels), fMaximum if fMaximum set
    324 //
    325 Double_t MHCamera::GetMaximum(Bool_t all) const
     350// only of all 'used' pixels), fMaximum if fMaximum set. If sector>=0
     351// only pixels with matching sector number are taken into account.
     352//
     353Double_t MHCamera::GetMaximumSector(Int_t sector, Bool_t all) const
    326354{
    327355    if (fMaximum!=-1111)
     
    332360
    333361    Double_t maximum=-FLT_MAX;
    334     if (all)
    335     {
    336         for (Int_t idx=0; idx<fNcells-2; idx++)
    337             if (fArray[idx+1] > maximum)
    338                 maximum = fArray[idx+1];
    339     }
    340     else
    341     {
    342         for (Int_t idx=0; idx<fNcells-2; idx++)
    343             if (IsUsed(idx) && fArray[idx+1] > maximum)
    344                 maximum = fArray[idx+1];
    345     }
     362    for (Int_t idx=0; idx<fNcells-2; idx++)
     363        if (MatchSector(idx, sector) && (all || IsUsed(idx)) && fArray[idx+1]>maximum)
     364            maximum = fArray[idx+1];
     365
    346366    return Profile(maximum);
    347367}
     
    474494// is more or less the same than to TH2-projections.
    475495//
    476 TH1D *MHCamera::Projection(const char *name) const
     496// If sector>=0 only entries with matching sector index are taken
     497// into account.
     498//
     499TH1D *MHCamera::ProjectionS(Int_t sector, const char *name) const
    477500{
    478501    Int_t nbins = 50;
     
    481504    TString pname(name);
    482505    if (name=="_py")
     506    {
    483507        pname.Prepend(GetName());
     508        if (sector>=0)
     509            pname += sector;
     510    }
    484511
    485512    TH1D *h1=0;
     
    494521    if (!h1)
    495522    {
    496         Double_t min = GetMinimum();
    497         Double_t max = GetMaximum();
     523        Double_t min = GetMinimumSector(sector);
     524        Double_t max = GetMaximumSector(sector);
    498525
    499526        Int_t newbins=0;
     
    505532        h1->SetXTitle(GetYaxis()->GetTitle());
    506533        h1->SetYTitle("Counts");
    507         h1->Sumw2();
     534        //h1->Sumw2();
    508535    }
    509536
    510537    // Fill the projected histogram
    511     for (Int_t binx =0;binx<=GetNbinsX()+1;binx++) {
    512         const Double_t cont = GetBinContent(binx);
    513         if (cont!=0)
    514             h1->Fill(cont);
    515     }
    516 
    517     h1->SetEntries(GetXaxis()->GetNbins());
     538    for (Int_t idx=0; idx<fNcells-2; idx++)
     539        if (IsUsed(idx) && MatchSector(idx, sector))
     540            h1->Fill(GetBinContent(idx+1));
    518541
    519542    return h1;
  • trunk/MagicSoft/Mars/mhist/MHCamera.h

    r3142 r3237  
    7878    void   ResetUsed(Int_t idx)    { CLRBIT(fUsed[idx], kIsUsed); }
    7979
     80    Bool_t MatchSector(Int_t idx, Int_t sector) const;
     81
    8082    // This is a trick to remove TH1 entries from the context menu
    8183    TH1 *Rebin(Int_t ngroup=2, const char*newname="") { return this; }
     
    138140    Stat_t   GetBinError(Int_t binx, Int_t biny, Int_t binz) const { return GetBinError(binx); }
    139141
    140     Double_t GetMinimum(Bool_t all) const;
    141     Double_t GetMaximum(Bool_t all) const;
    142 
    143     Double_t GetMinimum() const { return GetMinimum(0/*kTRUE*/); }
    144     Double_t GetMaximum() const { return GetMaximum(0/*kTRUE*/); }
     142    Double_t GetMinimum(Bool_t all) const { return GetMinimumSector(-1, all); }
     143    Double_t GetMaximum(Bool_t all) const { return GetMaximumSector(-1, all); }
     144
     145    Double_t GetMinimum() const { return GetMinimumSector(-1, kFALSE); }
     146    Double_t GetMaximum() const { return GetMaximumSector(-1, kFALSE); }
     147
     148    Double_t GetMinimumSector(Int_t sector, Bool_t all=kFALSE) const;
     149    Double_t GetMaximumSector(Int_t sector, Bool_t all=kFALSE) const;
    145150
    146151    void     SetLevels(const TArrayF &arr);
     
    181186    void     AddNotify(TObject *event);
    182187
    183     Stat_t   GetMean(Int_t axis=-1) const;
    184     Stat_t   GetRMS(Int_t axis=-1) const;
     188    Stat_t   GetMean(Bool_t all) const { return GetMeanSector(-1, all); }
     189    Stat_t   GetRMS(Bool_t all)  const { return GetRmsSector(-1, all); }
     190
     191    Stat_t   GetMean(Int_t sector=-1) const { return GetMeanSector(-1, kFALSE); }
     192    Stat_t   GetRMS(Int_t sector=-1)  const { return GetRmsSector(-1, kFALSE); }
     193
     194    Stat_t   GetMeanSector(Int_t sector, Bool_t all=kFALSE) const;
     195    Stat_t   GetRmsSector(Int_t sector, Bool_t all=kFALSE) const;
    185196
    186197    UInt_t   GetNumPixels() const;
    187198
    188     TH1D    *Projection(const char *name="_py") const;
     199    TH1D    *Projection(const char *name="_py") const { return ProjectionS(-1, name); }
     200    TH1D    *ProjectionS(Int_t sector, const char *name="_py") const;
    189201
    190202    const MGeomCam &GetGeomCam() const { return *fGeomCam; }
  • trunk/MagicSoft/Mars/mjobs/MJExtractSignal.cc

    r3199 r3237  
    328328    write.AddContainer("MExtractedSignalCam", "Events");
    329329    write.AddContainer("MTime",               "Events");
    330     // FIXME: CRAHSES! write.AddContainer("MPedestalCam",        "RunHeaders");
     330    write.AddContainer("MPedestalCam",        "RunHeaders");
    331331    write.AddContainer("MRawRunHeader",       "RunHeaders");
    332332    write.AddContainer("MBadPixelsCam",       "RunHeaders");
Note: See TracChangeset for help on using the changeset viewer.