Changeset 9308 for trunk


Ignore:
Timestamp:
02/09/09 11:30:54 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r9303 r9308  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20
     21 2009/02/08 Thomas Bretz
     22
     23   * Makefile.conf.linux:
     24     - added -Winit-self
     25
     26   * msimcamera/MSimCalibrationSignal.[h,cc]:
     27     - account for the pulse shape/width
     28     - make number of photons settable
     29     - make time jitter settable
     30     - renamned fNumEntries to fNumEvents
     31     - don't set daq event number (should be set by the "daq")
     32     - set trigger pattern
     33     - print number of events in PreProcess
     34
     35   * msimreflector/MSimReflector.[h,cc]:
     36     - made the detector margin settable
     37
     38   * datacenter/macros/insertcacofile.C, datacenter/macros/insertsequence.C:
     39     - print an error and exit
     40
     41   * macros/optim/optimdisp.C:
     42     - set the default values as default
     43     - added a short summary what a good strategy for optimization is
     44
     45   * mastro/MAstro.cc:
     46     - replaced Form by MString::Form
     47
     48   * mcorsika/MCorsikaEvtHeader.[h,cc], mcorsika/MCorsikaRunHeader.[h,cc]:
     49     - moved fParticleID from event header to run header
     50     - increased Class Version accordingly
     51     - added an error if more than one observation levels are read
     52
     53   * mhcalib/MHGausEvents.cc:
     54     - replaced Form by MString::Form
     55     - handle the creating of the TF1 fExpFit a bit more "root-safe"
     56
     57   * mhist/MHCamEvent.[h,cc]:
     58     - added a new option to collect the maximum or minimum contents
     59
     60   * mhist/MHCamera.[h,cc]:
     61     - added new functions SetMax/MinCamContent
     62
     63   * mraw/MRawEvtHeader.cc:
     64     - initialize the data members in constructor
     65
     66   * mraw/MRawEvtHeader.h:
     67     - removed bits for trigger type they were never used
     68
     69   * mraw/MRawRunHeader.cc:
     70     - tiny cosmetics
     71
     72   * msim/MHPhotonEvent.[h,cc]:
     73     - added a histogram to display the height
     74     - don't fill kNightSky photons
     75
     76   * msim/MPhotonData.h:
     77     - added getter for fProductionHeight
     78
     79   * msim/MPhotonEvent.h:
     80     - commented IsValid (was not used anyhow)
     81
     82   * msimcamera/MSimGeomCam.[h,cc]:
     83     - added one sample to the window to allow for time jitter of one sample
     84     - make the code for the window indentical to MSimCalibrationSignal
     85
     86   * msimcamera/MSimReadout.[h,cc]:
     87     - Set the daq event number (readout number)
     88
     89   * msimcamera/MSimTrigger.[h,cc]:
     90     - added comments
     91     - made the signal length settable
     92     - made the coincidence time settable
     93     - removed setting of the daq event number (should be done by the "daq")
     94     - changed the trigger output from all to inf/inf2
     95
     96   * msimcamera/Makefile:
     97     - added -I../mtrigger
     98
     99
     100
     101
    20102
    21103 2009/02/07 Thomas Bretz
  • trunk/MagicSoft/Mars/NEWS

    r9296 r9308  
    33== <cvs> ==
    44
    5  ;merpp
    6 
    7    * added support for Arehucas Version >= 200812140
     5 ;general
     6
     7   * fixed a few small bugs which could cause the display to crash in ganymed
     8     and sponde
    89
    910 ;database
     
    1213     to set size of plot
    1314
     15 ;merpp
     16
     17   * added support for Arehucas Version >= 200812140
     18
     19 ;ceres
     20
     21   * added a uniformly distributed one-bin time jitter for the start of the
     22     digitization. Otherwise the first photon would be digitized always with
     23     the same alignment to the bins
     24
     25   * Added a plot showing the production height of the photons
     26
     27   * Moved the particle id from the event header to the run header
     28
     29   * Added the possibility to simulate a psf on the camera plane (MSimPSF)
     30
     31   * Added a new plot ''SignalMax'' showing the maximum entry into the pixels
     32
     33   * Added many new options to control the tasks. For deatils see ''ceres.rc''
     34
     35   * Removed obsolete plots in pedestal and calibration mode
     36
     37   * Removed the non-NightSky photons from the plots where they are just
     38     disturbing
     39
     40   * Added a trigger pattern to the output (Ped, Cal or Lvl1)
     41
     42   * The daq event number now represents the readout number
    1443
    1544
  • trunk/MagicSoft/Mars/datacenter/macros/insertcacofile.C

    r8996 r9308  
    6868int insertcacofile(TString runnumber, TString newrunnumber)
    6969{
     70    cout << "ERROR - TelescopeNumber and FileNumber not implemeted." << endl;
     71    return 2;
     72/*
    7073    MSQLServer serv("sql.rc");
    7174    if (!serv.IsConnected())
     
    9699    delete res;
    97100    return 1;
     101    */
    98102}
    99 
    100 
  • trunk/MagicSoft/Mars/datacenter/macros/insertsequence.C

    r8108 r9308  
    6060int insertsequence(TString filename, Bool_t dummy=kTRUE)
    6161{
     62    cout << "ERROR - TelescopeNumber and FileNumber not implemeted." << endl;
     63    return 2;
     64/*
    6265    TEnv env("sql.rc");
    6366    TEnv sequ(filename);
     
    220223
    221224    return 1;
     225    */
    222226}
    223227
  • trunk/MagicSoft/Mars/macros/optim/optimdisp.C

    r8656 r9308  
    1818    char *r = "M[0]*([0] + [1]*M[1] + [2]*M[2] + (M[3]>[3])*[4]*(M[3]-[3])^2)";
    1919
    20     opt.FixParameter(0, 1.266195);
    21     opt.FixParameter(1, 0.100577);
    22     opt.FixParameter(2, 1.80309);
    23     opt.FixParameter(3, 2.87177);
    24     opt.FixParameter(4, 0.616823);
     20    opt.FixParameter(0, 1.15136);
     21    opt.FixParameter(1, 0.0681437);
     22    opt.FixParameter(2, 2.62932);
     23    opt.FixParameter(3, 1.51279);
     24    opt.FixParameter(4, 0.0507821);
    2525
    2626    opt.AddPreCut("MNewImagePar.fLeakage1>0");
    27     opt.AddPreCut("log10(MHillas.fSize)<3.2");
     27    //opt.AddPreCut("log10(MHillas.fSize)<2.5"); //3.2
     28
     29    opt.AddPreCut("MHillasExt.fM3Long*sign(MHillasSrc.fCosDeltaAlpha)*MGeomCam.fConvMm2Deg>-0.07");
     30    opt.AddPreCut("DataType.fVal>0.5");
    2831
    2932    //opt.AddPreCut("abs(MHillasSrc.fDCA*MGeomCam.fConvMm2Deg)<0.2");
    3033    //opt.AddPreCut("(MHillasSrc.fDist*MGeomCam.fConvMm2Deg-0.5)*7.2>MHillasExt.fSlopeLong*sign(MHillasSrc.fCosDeltaAlpha)/MGeomCam.fConvMm2Deg");
    31     opt.AddPreCut("MHillasExt.fM3Long*sign(MHillasSrc.fCosDeltaAlpha)*MGeomCam.fConvMm2Deg>-0.07");
    32     opt.AddPreCut("DataType.fVal>0.5");
    3334
    3435    // -------------------- Run ----------------------------
     
    6667     */
    6768
     69    // opt.SetPathOut("optimdisp.root");
    6870    opt.RunDisp("ganymed00000001-summary.root", r);
    6971}
     
    7375   Par  |   0    1     2      3     4     |  Cut
    7476 -------+---------------------------------+-----------------------
    75   Fit 1 |  1.3  0.8  fix=0  fix=0  fix=0  | Leak1==0 lgSize<2.5
    76   Fit 2 |  fix  fix  fix=0   2.4    0.3   | Leak1==0
     77  Fit 1 |  1.3  0.1  fix=0  fix=0  fix=0  | Leak1==0 lgSize<2.5
     78  Fit 2 |  fix  fix  fix=0   2.5    0.2   | Leak1==0
    7779  Fit 2 |  fix  fix   1.8    fix    fix   | Leak1>0
    7880  Fit 3 |  free free  fix    fix    fix   | -/-
     81  Fit 4 |  fix  fix   fix    free   free  | -/-
     82  Fit 5 |  fix  fix   free   fix    fix   | -/-
    7983 -------+---------------------------------+-----------------------
    8084*/
  • trunk/MagicSoft/Mars/mcorsika/MCorsikaEvtHeader.cc

    r9252 r9308  
    2626//
    2727// MCorsikaEvtHeader
    28 //   
     28//
     29// Class Version 2:
     30// ----------------
     31//  - UInt_t fParticleID
     32//
     33//
    2934/////////////////////////////////////////////////////////////////////////////
    3035#include "MCorsikaEvtHeader.h"
     
    3843#include "MLogManip.h"
    3944
    40 #include "MMcEvt.hxx"
     45//#include "MMcEvt.hxx"
    4146
    4247ClassImp(MCorsikaEvtHeader);
     
    7176    *fLog << all;
    7277    *fLog << "Event Number:              " << dec << fEvtNumber << endl;
    73     *fLog << "Particle ID:               " << MMcEvt::GetParticleName(fParticleID) << endl;
     78//    *fLog << "Particle ID:               " << MMcEvt::GetParticleName(fParticleID) << endl;
    7479    *fLog << "Energy:                    " << fTotalEnergy << "GeV" << endl;
    7580    *fLog << "Starting Altitude:         " << fStartAltitude << "g/cm²" << endl;
     
    102107
    103108    fEvtNumber  = TMath::Nint(f[0]);
    104     fParticleID = TMath::Nint(f[1]);
     109//    fParticleID = TMath::Nint(f[1]);
    105110
    106111    fTotalEnergy            = f[2];
  • trunk/MagicSoft/Mars/mcorsika/MCorsikaEvtHeader.h

    r9292 r9308  
    1818private:
    1919    UInt_t   fEvtNumber;              // Event number
    20     UInt_t   fParticleID;             // Particle ID (see MMcEvtBasic or CORSIKA manual)
     20//    UInt_t   fParticleID;             // Particle ID (see MMcEvtBasic or CORSIKA manual)
    2121    Float_t  fTotalEnergy;            // [GeV]
    2222
     
    4444
    4545    UInt_t GetEvtNumber() const { return fEvtNumber; }
    46     UInt_t GetParticleID() const { return fParticleID; }
     46//    UInt_t GetParticleID() const { return fParticleID; }
    4747
    4848    TVector3 GetMomentum() const { return TVector3(fMomentumX, fMomentumY, fMomentumZ); }
  • trunk/MagicSoft/Mars/mcorsika/MCorsikaRunHeader.cc

    r9229 r9308  
    3030// Root storage container for the RUN HEADER information
    3131//
     32// Class Version 2:
     33// ----------------
     34//  + UInt_t fParticleID
     35//
    3236////////////////////////////////////////////////////////////////////////////
    3337
     
    3943#include "MLog.h"
    4044#include "MLogManip.h"
     45
     46#include "MMcEvt.hxx"
    4147
    4248ClassImp(MCorsikaRunHeader);
     
    8187    fProgramVersion = f[2];          //FIXME: INT???
    8288    fNumObsLevel    = TMath::Nint(f[3]);
     89
     90    if (fNumObsLevel!=1)
     91    {
     92        *fLog << err << "ERROR - Currently only one observation level is allowed." << endl;
     93        return kFALSE;
     94    }
    8395
    8496    memset(fObsLevel, 0, 10*4);
     
    127139    fin.seekg(-274*4, ios::cur);
    128140
    129     const Int_t n = TMath::Nint(g[96]);  // Numbr i of uses of each cherenkov event
     141    const Int_t n = TMath::Nint(g[96]);  // Number i of uses of each cherenkov event
    130142    if (n!=1)
    131143    {
     
    133145        return kFALSE;
    134146    }
     147
     148    fParticleID = TMath::Nint(g[1]);
    135149
    136150    //fImpactMax = g[86];
     
    208222    *fLog << all << endl;
    209223    *fLog << "Run Number:  " << fRunNumber << "  (" << fRunStart.GetStringFmt("%d.%m.%Y") << ", V" << fProgramVersion << ")" << endl;
     224    *fLog << "Particle ID: " << MMcEvt::GetParticleName(fParticleID) << endl;
    210225    if (fNumEvents>0)
    211226        *fLog << "Num Events:  " << fNumEvents << endl;
  • trunk/MagicSoft/Mars/mcorsika/MCorsikaRunHeader.h

    r9212 r9308  
    1717private:
    1818    UInt_t    fRunNumber;         // Run number
     19    UInt_t    fParticleID;        // Particle ID (see MMcEvtBasic or CORSIKA manual)
    1920    UInt_t    fNumEvents;         // Number of events
    2021    MTime     fRunStart;          // Date of begin (yymmdd)
     
    2223
    2324    Byte_t    fNumObsLevel;       // Number of observation levels
    24     Float_t   fObsLevel[10];      //[fNumObsLevel] Observation levels [cm]
     25    Float_t   fObsLevel[10];      // Observation levels [cm]
    2526
    2627    Float_t   fSlopeSpectrum;     // Slope of energy spectrum
     
    5657    Float_t GetWavelengthMax() const { return fWavelengthMax; }
    5758
     59    UInt_t GetParticleID() const { return fParticleID; }
     60
    5861    //Float_t GetImpactMax() const { return fImpactMax; }
    5962
     
    6871    Bool_t SeekEvtEnd(istream &fin);
    6972
    70     ClassDef(MCorsikaRunHeader, 1)      // storage container for general info
     73    ClassDef(MCorsikaRunHeader, 2)      // storage container for general info
    7174};
    7275#endif
  • trunk/MagicSoft/Mars/mhcalib/MHGausEvents.cc

    r8907 r9308  
    9090
    9191#include "MFFT.h"
     92#include "MString.h"
    9293#include "MArrayF.h"
    9394
     
    320321  fPowerSpectrum     = fourier.PowerSpectrumDensity(&fEvents);
    321322  fHPowerProbability = ProjectArray(*fPowerSpectrum, fPowerProbabilityBins,
    322                                     Form("%s%s","PowerProb",GetName()),
     323                                    MString::Format("PowerProb%s", GetName()),
    323324                                    "Probability of Power occurrance");
    324325  fHPowerProbability->SetXTitle("P(f)");
     
    332333  const Double_t xmax = fHPowerProbability->GetXaxis()->GetXmax();
    333334
    334   fFExpFit = new TF1("FExpFit","exp([0]-[1]*x)",0.,xmax);
     335  fFExpFit = new TF1("","exp([0]-[1]*x)",0.,xmax);
     336  fFExpFit->SetName("FExpFit");
     337  gROOT->GetListOfFunctions()->Remove(fFExpFit);
     338
    335339
    336340  const Double_t slope_guess  = (TMath::Log(fHPowerProbability->GetEntries())+1.)/xmax;
  • trunk/MagicSoft/Mars/mhist/MHCamEvent.cc

    r9303 r9308  
    159159    if (!fTitle.Contains(";"))
    160160        fSum->SetYTitle("a.u.");
    161     fSum->SetBit(MHCamera::kProfile);
     161    if (fUseThreshold!=kCollectMin && fUseThreshold!=kCollectMax)
     162        fSum->SetBit(MHCamera::kProfile);
    162163    if (!fErrorSpread)
    163164        fSum->SetBit(MHCamera::kErrorMean);
     
    178179        return kERROR;
    179180    }
    180     if (fUseThreshold)
     181
     182    switch (fUseThreshold)
     183    {
     184    case kNoBound:
     185        fSum->AddCamContent(*evt, fType);
     186        break;
     187
     188    case kIsLowerBound:
     189    case kIsUpperBound:
    181190        fSum->CntCamContent(*evt, fThreshold, fType, fUseThreshold>0);
    182     else
    183         fSum->AddCamContent(*evt, fType);
     191        break;
     192
     193    case kCollectMin:
     194        fSum->SetMinCamContent(*evt, /*fThreshold,*/ fType);
     195        break;
     196
     197    case kCollectMax:
     198        fSum->SetMaxCamContent(*evt, /*fThreshold,*/ fType);
     199        break;
     200
     201    default:
     202        *fLog << err << "ERROR - MHCamEvent::Fill: Unknown type." << endl;
     203        return kERROR;
     204    }
     205
    184206    return kTRUE;
    185207}
  • trunk/MagicSoft/Mars/mhist/MHCamEvent.h

    r9153 r9308  
    3535
    3636public:
    37     enum { kIsLowerBound=1, kIsUpperBound=-1, kNoBound=0 };
     37    enum { kIsLowerBound=1, kIsUpperBound=-1, kNoBound=0, kCollectMin=-2, kCollectMax=2 };
    3838
    3939    MHCamEvent(const char *name=NULL, const char *title=NULL);
     
    5757
    5858    void SetThreshold(Float_t f=0, Char_t direction=kIsLowerBound) { fThreshold = f; fUseThreshold=direction; }
     59    void SetCollectMin() { fUseThreshold=kCollectMin; }
     60    void SetCollectMax() { fUseThreshold=kCollectMax; }
    5961    void SetErrorSpread(Bool_t b=kTRUE) { fErrorSpread = b; }
    6062    void SetErrorRelative(Bool_t b=kTRUE) { fErrorRelative = b; }
  • trunk/MagicSoft/Mars/mhist/MHCamera.cc

    r9303 r9308  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MHCamera.cc,v 1.113 2009-02-07 20:47:41 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MHCamera.cc,v 1.114 2009-02-09 11:30:53 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    15911591//
    15921592// Call this function to add a MCamEvent on top of the present contents.
    1593 // 1 is added to each pixel if the contents of MCamEvent>threshold (in case isabove is set to kTRUE == default)
    1594 // 1 is added to each pixel if the contents of MCamEvent<threshold (in case isabove is set to kFALSE)
     1593// 1 is added to each pixel if the contents of MCamEvent>threshold
     1594//   (in case isabove is set to kTRUE == default)
     1595// 1 is added to each pixel if the contents of MCamEvent<threshold
     1596//   (in case isabove is set to kFALSE)
    15951597//
    15961598// in unused pixel is not counted if it didn't fullfill the condition.
     
    16581660//
    16591661// Call this function to add a MCamEvent on top of the present contents.
    1660 // 1 is added to each pixel if the contents of MCamEvent>threshold (in case isabove is set to kTRUE == default)
    1661 // 1 is added to each pixel if the contents of MCamEvent<threshold (in case isabove is set to kFALSE)
     1662// 1 is added to each pixel if the contents of MCamEvent>threshold
     1663//   (in case isabove is set to kTRUE == default)
     1664// 1 is added to each pixel if the contents of MCamEvent<threshold
     1665//   (in case isabove is set to kFALSE)
    16621666//
    16631667// in unused pixel is not counted if it didn't fullfill the condition.
     
    17021706        if (!ispos || fArray[idx+1]>0)
    17031707            SetUsed(idx);
     1708    }
     1709    fEntries++;
     1710}
     1711
     1712// ------------------------------------------------------------------------
     1713//
     1714// Call this function to add a MCamEvent on top of the present contents.
     1715// 1 is added to each pixel if the contents of MCamEvent>threshold
     1716//   (in case isabove is set to kTRUE == default)
     1717// 1 is added to each pixel if the contents of MCamEvent<threshold
     1718//   (in case isabove is set to kFALSE)
     1719//
     1720// in unused pixel is not counted if it didn't fullfill the condition.
     1721//
     1722void MHCamera::SetMaxCamContent(const MCamEvent &event, Int_t type)
     1723{
     1724    if (fNcells<=1 || IsFreezed())
     1725        return;
     1726
     1727    // FIXME: Security check missing!
     1728    for (Int_t idx=0; idx<fNcells-2; idx++)
     1729    {
     1730        Double_t val=0;
     1731        const Bool_t rc = event.GetPixelContent(val, idx, *fGeomCam, type);
     1732        if (!rc)
     1733            continue;
     1734
     1735        if (!IsUsed(idx))
     1736        {
     1737            fArray[idx+1] = val;
     1738            SetUsed(idx);
     1739            fBinEntries.fArray[idx+1]=1;
     1740        }
     1741        else
     1742            if (val>fArray[idx+1])
     1743                fArray[idx+1] = val;
     1744    }
     1745    fEntries++;
     1746}
     1747
     1748// ------------------------------------------------------------------------
     1749//
     1750// Call this function to add a MCamEvent on top of the present contents.
     1751// 1 is added to each pixel if the contents of MCamEvent>threshold
     1752//   (in case isabove is set to kTRUE == default)
     1753// 1 is added to each pixel if the contents of MCamEvent<threshold
     1754//   (in case isabove is set to kFALSE)
     1755//
     1756// in unused pixel is not counted if it didn't fullfill the condition.
     1757//
     1758void MHCamera::SetMinCamContent(const MCamEvent &event, Int_t type)
     1759{
     1760    if (fNcells<=1 || IsFreezed())
     1761        return;
     1762
     1763    // FIXME: Security check missing!
     1764    for (Int_t idx=0; idx<fNcells-2; idx++)
     1765    {
     1766        Double_t val=0;
     1767        const Bool_t rc = event.GetPixelContent(val, idx, *fGeomCam, type);
     1768        if (!rc)
     1769            continue;
     1770
     1771        if (!IsUsed(idx))
     1772        {
     1773            fArray[idx+1] = val;
     1774            SetUsed(idx);
     1775            fBinEntries.fArray[idx+1]=1;
     1776        }
     1777        else
     1778            if (val<fArray[idx+1])
     1779                fArray[idx+1] = val;
    17041780    }
    17051781    fEntries++;
  • trunk/MagicSoft/Mars/mhist/MHCamera.h

    r9186 r9308  
    11/* ======================================================================== *\
    2 !  $Name: not supported by cvs2svn $:$Id: MHCamera.h,v 1.66 2008-12-02 11:22:19 tbretz Exp $
     2!  $Name: not supported by cvs2svn $:$Id: MHCamera.h,v 1.67 2009-02-09 11:30:53 tbretz Exp $
    33\* ======================================================================== */
    44#ifndef MARS_MHCamera
     
    180180    virtual void     CntCamContent(const TArrayD &evt, Double_t threshold, Bool_t ispos=kTRUE);
    181181    virtual void     CntCamContent(const MCamEvent &event, Int_t type1, const MCamEvent &thresevt, Int_t type2, Double_t threshold, Bool_t isabove);
     182
     183    virtual void     SetMaxCamContent(const MCamEvent &evt, Int_t type=0);
     184    virtual void     SetMinCamContent(const MCamEvent &evt, Int_t type=0);
    182185
    183186    Stat_t   GetBinContent(Int_t bin) const;
  • trunk/MagicSoft/Mars/mraw/MRawEvtHeader.cc

    r8944 r9308  
    129129//
    130130MRawEvtHeader::MRawEvtHeader(const char *name, const char *title)
     131    : fTime(0), fNumTrigLvl1(0), fNumTrigLvl2(0), fNumLoGainOn(0), fPixLoGainOn(0)
    131132{
    132133    fName  = name  ? name  : "MRawEvtHeader";
  • trunk/MagicSoft/Mars/mraw/MRawEvtHeader.h

    r9229 r9308  
    2323    //
    2424    // Trigger Type (TT)
    25     //
     25    /*
    2626    enum {
    2727        kTTEvent       = 0,
     
    3030        kTTPinDiode    = 3
    3131    };
    32 
     32    */
    3333    enum CLColor_t
    3434      {
  • trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc

    r9272 r9308  
    11241124    {
    11251125    case 1:
     1126        fNumSamplesHiGain  =   15;
    11261127        fNumSamplesLoGain  =   15;
    1127         fNumSamplesHiGain  =   15;
    11281128        fNumBytesPerSample =    1;    // number of bytes per sample
    11291129        fSamplingFrequency =  300;    // Sampling Frequency [MHz]
  • trunk/MagicSoft/Mars/msim/MHPhotonEvent.cc

    r9263 r9308  
    5454// Fill expects a MPhotonEvent (the second argumnet in MFillH).
    5555//
     56//
     57// Class Version 2:
     58// ----------------
     59//  + TH1D fHistH;
     60//
     61//
    5662/////////////////////////////////////////////////////////////////////////////
    5763#include "MHPhotonEvent.h"
     
    113119    fHistWL.SetDirectory(NULL);
    114120
     121    fHistH.SetName("Height");
     122    fHistH.SetTitle("Production Height");
     123    fHistH.SetXTitle("h [km]");
     124    fHistH.SetYTitle("Counts");
     125    fHistH.SetDirectory(NULL);
     126
    115127    // FIXME: Get this information from the corsika run-header
    116128    MBinning(70, 275, 625).Apply(fHistWL);
     129    MBinning(100, 0, 25).Apply(fHistH);
    117130}
    118131
     
    259272        const MPhotonData &ph = (*evt)[idx];
    260273
     274        if (ph.GetPrimary()==MMcEvtBasic::kNightSky)
     275            continue;
     276
    261277        const Double_t x = ph.GetPosX();
    262278        const Double_t y = ph.GetPosY();
     
    265281        const Double_t t = ph.GetTime()-min;
    266282        const Double_t w = ph.GetWavelength();
     283        const Double_t h = ph.GetProductionHeight()/100000;
    267284
    268285        //TVector3 dir = dat->GetDir3();
     
    273290        fHistT.Fill(x, y, t);
    274291        fHistWL.Fill(w);
     292        fHistH.Fill(h);
    275293    }
    276294
     
    341359    gPad->SetGrid();
    342360    fHistWL.Draw();
    343 }
     361
     362    pad->cd(6);
     363    gPad->SetBorderMode(0);
     364    gPad->SetGrid();
     365    fHistH.Draw();
     366}
  • trunk/MagicSoft/Mars/msim/MHPhotonEvent.h

    r9232 r9308  
    2323    TProfile2D fHistT;
    2424    TH1D       fHistWL;
     25    TH1D       fHistH;
    2526
    2627    Int_t      fType;
     
    4041    void Paint(Option_t *o="");
    4142
    42     ClassDef(MHPhotonEvent, 1) // Histogram to display the information of MPhotonEvents
     43    ClassDef(MHPhotonEvent, 2) // Histogram to display the information of MPhotonEvents
    4344};
    4445
  • trunk/MagicSoft/Mars/msim/MPhotonData.h

    r9252 r9308  
    8383    // Getter Others
    8484    UShort_t GetWavelength() const { return fWavelength; }
     85    Float_t GetProductionHeight() const { return fProductionHeight; }
    8586    MMcEvtBasic::ParticleId_t GetPrimary() const { return fPrimary; }
    8687
  • trunk/MagicSoft/Mars/msim/MPhotonEvent.h

    r9301 r9308  
    157157    Int_t GetMaxIndex() const { return fMaxIndex; }
    158158
    159     Bool_t IsValid() const { return fTimeLast>=fTimeFirst; }
     159//    Bool_t IsValid() const { return fTimeLast>=fTimeFirst; }
    160160
    161161    ClassDef(MPhotonStatistics, 1)
  • trunk/MagicSoft/Mars/msimcamera/MSimGeomCam.cc

    r9274 r9308  
    170170    }
    171171
     172    const Float_t freq = fHeader->GetFreqSampling()/1000.;
     173
     174    // We add an additional sample at the end to support a possible shift
     175    // of the start time of the first event by 0 to 1 sample.
     176    const Int_t   ns   = fHeader->GetNumSamplesHiGain()+1;
     177
    172178    const Float_t first = cnt>0 ? fEvt->GetFirst()->GetTime() :  0;
    173     const Float_t last  = cnt>0 ? fEvt->GetLast()->GetTime()  : -1;
     179    const Float_t last  = cnt>0 ? fEvt->GetLast()->GetTime()  : ns*freq;
    174180
    175181    // Length (ns), Pulse position (Units ns)
    176     const Float_t ns = fHeader->GetFreqSampling()/1000.*fHeader->GetNumSamplesHiGain();
    177     const Float_t pp = fPulsePos->GetVal();
    178     const Float_t pw = fPulse->GetPulseWidth();
    179 
    180     fStat->SetTime(first-pp-pw, last+(ns-pp)+pw);
     182    const Float_t pp   = fPulsePos->GetVal();
     183    const Float_t pw   = fPulse->GetPulseWidth();
     184
     185    fStat->SetTime(first-pp-pw, last-pp+pw + ns*freq);
    181186    fStat->SetMaxIndex(fGeom->GetNumPixels()-1);
    182187    fStat->SetReadyToSave();
  • trunk/MagicSoft/Mars/msimcamera/MSimReadout.cc

    r9274 r9308  
    7373//
    7474MSimReadout::MSimReadout(const char* name, const char *title)
    75 : fRunHeader(0), fCamera(0), fPulsePos(0), fTrigger(0), fData(0)
     75: fRunHeader(0), fEvtHeader(0), fCamera(0), fPulsePos(0), fTrigger(0), fData(0)
    7676{
    7777    fName  = name  ? name  : "MSimReadout";
     
    113113        return kFALSE;
    114114    }
     115
     116    fEvtHeader = (MRawEvtHeader*)pList->FindCreateObj("MRawEvtHeader");
     117    if (!fEvtHeader)
     118        return kFALSE;
    115119
    116120    fData = (MRawEvtData*)pList->FindCreateObj("MRawEvtData");
     
    244248    fData->SetReadyToSave();
    245249
     250    // Set the trigger/daq event number
     251    fEvtHeader->SetDAQEvtNumber(GetNumExecutions());
     252    fEvtHeader->SetReadyToSave();
     253
    246254    // FIMXE: This will never be stored correctly :(
    247255    fRunHeader->SetNumEvents(fRunHeader->GetNumEvents()+1);
  • trunk/MagicSoft/Mars/msimcamera/MSimReadout.h

    r9270 r9308  
    1010class MRawEvtData;
    1111class MRawRunHeader;
     12class MRawEvtHeader;
    1213class MAnalogChannels;
    1314
     
    1617private:
    1718    MRawRunHeader    *fRunHeader;  //! Digitization window and frequency
     19    MRawEvtHeader    *fEvtHeader;  //! Event header which is filled with the event number
    1820    MAnalogChannels  *fCamera;     //! Analog channes to be read out
    1921    MParameterD      *fPulsePos;   //! Intended pulse position
  • trunk/MagicSoft/Mars/msimcamera/MSimTrigger.cc

    r9278 r9308  
    3636// is calculated using a threshold and optional a fixed digital signal length.
    3737//
     38// The signal length of the digital signal emitted by the discriminator
     39// can either be bound to the time the signal is above the threshold
     40// defined by fDiscriminatorThreshold if fDigitalSignalLength<0 or set to a
     41// fixed length (fDigitalSignalLength>0).
     42//
    3843// With a second look-up table fCoincidenceMap the analog channels are
    39 // checked for coincidences. The earliest coincide is then stored as
     44// checked for coincidences. The coincidense must at least be of the length
     45// defined by fCoincidenceTime. The earliest coincide is then stored as
    4046// trigger position.
     47//
     48//
     49// For MAGIC1:
     50//  - fDigitalSignalLength between 6ns and 12ns
     51//  - fCoincidenceTime between 0.25ns to 1ns
    4152//
    4253//
     
    6980#include "MDigitalSignal.h"
    7081
     82#include "MTriggerPattern.h"
     83
    7184ClassImp(MSimTrigger);
    7285
     
    7992MSimTrigger::MSimTrigger(const char *name, const char *title)
    8093    : fCamera(0), fPulsePos(0), fTrigger(0), fRunHeader(0), fEvtHeader(0),
    81     fDiscriminatorThreshold(-1)
     94    fDiscriminatorThreshold(-1), fDigitalSignalLength(8), fCoincidenceTime(0.5)
    8295{
    8396    fName  = name  ? name  : "MSimTrigger";
     
    189202    fTrigger->SetVal(-1);
    190203
    191     // FIXME: Set from somewhere else? (see also MSimCalibrationSignal)
    192     fEvtHeader->SetDAQEvtNumber(GetNumExecutions());
    193     fEvtHeader->SetReadyToSave();
    194 
    195204    // ================== Simulate channel bundling ====================
    196205
     
    204213        for (UInt_t j=0; j<row.GetSize(); j++)
    205214        {
     215            // FIXME: Simulate clipping
    206216            const UInt_t idx = row[j];
    207217            patches[i].AddSignal((*fCamera)[idx]);
     
    216226    ttls.SetOwner();
    217227
    218         // MAGIC: Constant length of signals between 6ns and 12ns
    219     const Double_t siglen = 8; // Signal length (-1: As long as Signal-above-Threshold)
    220 
    221228    for (UInt_t i=0; i<npatch; i++)
    222         ttls.AddAt(patches[i].Discriminate(fDiscriminatorThreshold, siglen), i);
     229        ttls.AddAt(patches[i].Discriminate(fDiscriminatorThreshold, fDigitalSignalLength), i);
    223230
    224231    // FIXME: Write TTLs!
     
    235242    const Float_t max = fCamera->GetValidRangeMax()-(nsamp-pulspos);
    236243
    237     // Define gate time (minimum coincidence time)
    238     const Double_t gate = 1; // MAGIC: minimum coincidence time 0.25ns to 1ns,
    239 
    240244    // Create an array for the individual triggers
    241245    TObjArray triggers;
     
    258262        {
    259263            TObjArray *res = CalcCoincidence(*arr, *static_cast<TObjArray*>(ttls[idx[k]]),
    260                                              gate);
     264                                             fCoincidenceTime);
    261265
    262266            // Delete the original array and keep the new one
     
    303307    {
    304308        if (rmlo>0 || rmhi>0)
    305             *fLog << all << rmlo << "/" << rmhi << " trigger out of valid range. No trigger raised." << endl;
     309            *fLog << inf2 << rmlo << "/" << rmhi << " trigger out of valid range. No trigger raised." << endl;
    306310        return kTRUE;
    307311    }
     
    315319    // FIXME: Jitter! (Own class?)
    316320    fTrigger->SetVal(static_cast<MDigitalSignal*>(triggers[0])->GetStart());
     321    fTrigger->SetReadyToSave();
     322
     323    // Flag this event as triggered by the lvl1 trigger (FIXME?)
     324    fEvtHeader->SetTriggerPattern((UInt_t)~(MTriggerPattern::kTriggerLvl1 | (MTriggerPattern::kTriggerLvl1<<8)));
     325    fEvtHeader->SetReadyToSave();
    317326
    318327    // inf2?
    319     *fLog << all;
     328    *fLog << inf;
    320329    *fLog << cnt << " triggers left in " << triggers.GetEntriesFast() << " patches (" << rmlo << "/" << rmhi << " trigger out of valid range), T=" << fTrigger->GetVal();
    321330    *fLog << endl;
     
    329338// FileNameCoincidenceMap:  coincidence.txt
    330339// DiscriminatorTheshold:   3.5
     340// DigitalSignalLength:     8
     341// CoincidenceTime:         0.5
    331342//
    332343Int_t MSimTrigger::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     
    351362    }
    352363
     364    if (IsEnvDefined(env, prefix, "DigitalSignalLength", print))
     365    {
     366        rc = kTRUE;
     367        fDigitalSignalLength = GetEnvValue(env, prefix, "DigitalSignalLength", fDigitalSignalLength);
     368    }
     369
     370    if (IsEnvDefined(env, prefix, "CoincidenceTime", print))
     371    {
     372        rc = kTRUE;
     373        fCoincidenceTime = GetEnvValue(env, prefix, "CoincidenceTime", fCoincidenceTime);
     374    }
     375
    353376    return rc;
    354377}
  • trunk/MagicSoft/Mars/msimcamera/MSimTrigger.h

    r9261 r9308  
    3232
    3333    Float_t fDiscriminatorThreshold;  // Discriminator threshold
     34    Float_t fDigitalSignalLength;     // Length of the output of the discriminator
     35    Float_t fCoincidenceTime;         // Minimum coincidence time (gate)
    3436
    3537    // MSimTrigger
     
    5052
    5153    void SetDiscriminatorThreshold(Float_t th) { fDiscriminatorThreshold=th; }
     54    void SetDigitalSignalLength(Float_t ln) { fDigitalSignalLength=ln; }
     55    void SetCoincidenceTime(Float_t tm) { fCoincidenceTime=tm; }
    5256
    5357    ClassDef(MSimTrigger, 0) // Task to simulate trigger electronics
  • trunk/MagicSoft/Mars/msimcamera/Makefile

    r9256 r9308  
    2020#
    2121INCLUDES = -I. -I../mbase -I../mgeom -I../msim -I../msignal -I../mcorsika \
    22            -I../mmc -I../mgui -I../mcalib -I../mraw -I../mfileio -I../melectronics
     22           -I../mmc -I../mgui -I../mcalib -I../mraw -I../mfileio -I../melectronics \
     23           -I../mtrigger
    2324
    2425SRCFILES = MSimPSF.cc \
Note: See TracChangeset for help on using the changeset viewer.