Ignore:
Timestamp:
04/16/09 12:04:29 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/msimcamera
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/msimcamera/MSimCalibrationSignal.cc

    r9378 r9425  
    6161
    6262#include "MGeomCam.h"
    63 #include "MPulseShape.h"
     63#include "MParSpline.h"
    6464#include "MTriggerPattern.h"
    6565
     
    136136    }
    137137
    138     fPulse = (MPulseShape*)pList->FindObject("MPulseShape");
     138    fPulse = (MParSpline*)pList->FindObject("PulseShape", "MParSpline");
    139139    if (!fPulse)
    140140    {
    141         *fLog << err << "MPulsShape not found... aborting." << endl;
     141        *fLog << err << "PulsShape [MParSpline] not found... aborting." << endl;
    142142        return kFALSE;
    143143    }
     
    173173    }
    174174
     175    // FIXME: Is there a way to write them as LAST entry in the file?
    175176    fRunHeader->SetReadyToSave();
    176177
     
    195196        for (UInt_t idx=0; idx<fGeom->GetNumPixels(); idx++)
    196197        {
     198            // FIXME: Scale number of photons with the pixel size!
    197199            const Int_t num = TMath::Nint(gRandom->Gaus(fNumPhotons, fNumPhotons/10));
    198200
     
    229231    // Length (ns), Pulse position (Units ns)
    230232    const Float_t pp = fPulsePos->GetVal();
    231     const Float_t pw = fPulse->GetPulseWidth();
     233    const Float_t pw = fPulse->GetWidth();
    232234
    233235    const Float_t first = cnt>0 ? fEvt->GetFirst()->GetTime() : 0;
  • trunk/MagicSoft/Mars/msimcamera/MSimCalibrationSignal.h

    r9306 r9425  
    88class MGeomCam;
    99class MParList;
    10 class MPulseShape;
     10class MParSpline;
    1111class MPhotonEvent;
    1212class MPhotonStatistics;
     
    2020    MParList          *fParList;    //! Store pointer to MParList for initializing ReInit
    2121    MGeomCam          *fGeom;       //! Camera geometry to know the number of expected pixels
    22     MPulseShape       *fPulse;      //! Pulse Shape to get pulse width from
     22    MParSpline        *fPulse;      //! Pulse Shape to get pulse width from
    2323    MParameterD       *fPulsePos;   //! Expected position at which the pulse should be
    2424    MParameterD       *fTrigger;    //! Position in analog channels at which the triggersignal  is raised
  • trunk/MagicSoft/Mars/msimcamera/MSimCamera.cc

    r9413 r9425  
    4848
    4949#include "MSpline3.h"
    50 #include "MPulseShape.h"
     50#include "MParSpline.h"
    5151
    5252#include "MParList.h"
    53 //#include "MParameters.h"
    5453
    5554#include "MPhotonEvent.h"
     
    134133        return kFALSE;
    135134
    136     MPulseShape *pulse = (MPulseShape*)pList->FindObject("MPulseShape");
     135    MParSpline *pulse = (MParSpline*)pList->FindObject("PulseShape", "MParSpline");
    137136    if (!pulse)
    138137    {
    139         *fLog << err << "MPulseShape not found... aborting." << endl;
     138        *fLog << err << "PulseShape [MParSpline] not found... aborting." << endl;
    140139        return kFALSE;
    141140    }
  • trunk/MagicSoft/Mars/msimcamera/MSimCamera.h

    r9328 r9425  
    2828    MMcEvt            *fMcEvt;           //! For information stored in MMcEvt
    2929
    30     MSpline3 *fSpline;     // Pusle Shape
     30    const MSpline3    *fSpline;          // Pusle Shape
    3131
    3232    Bool_t fBaselineGain;  // Should the gain be applied to baseline and electronic noise?
  • trunk/MagicSoft/Mars/msimcamera/MSimGeomCam.cc

    r9374 r9425  
    6060
    6161#include "MParameters.h"
     62#include "MParSpline.h"
    6263#include "MRawRunHeader.h"
    63 
    64 #include "MPulseShape.h"
    6564
    6665ClassImp(MSimGeomCam);
     
    106105    }
    107106
    108     fPulse = (MPulseShape*)pList->FindObject("MPulseShape");
     107    fPulse = (MParSpline*)pList->FindObject("PulseShape", "MParSpline");
    109108/*
    110109    if (!fPulse)
     
    191190
    192191    // Length (ns), Pulse position (Units ns)
    193     const Float_t pp   = fPulsePos ? fPulsePos->GetVal()     : 0;
    194     const Float_t pw   = fPulse    ? fPulse->GetPulseWidth() : 0;
     192    const Float_t pp   = fPulsePos ? fPulsePos->GetVal() : 0;
     193    const Float_t pw   = fPulse    ? fPulse->GetWidth() : 0;
    195194
    196195    fStat->SetTimeMedDev(fEvt->GetTimeMedianDev());
  • trunk/MagicSoft/Mars/msimcamera/MSimGeomCam.h

    r9274 r9425  
    1313class MParameterD;
    1414class MRawRunHeader;
    15 class MPulseShape;
     15class MParSpline;
    1616
    1717class MSimGeomCam : public MTask
     
    2323    MParameterD       *fPulsePos; //! Intended pulse position in digitization window [ns]
    2424    MRawRunHeader     *fHeader;   //! Length of digitization window
    25     MPulseShape       *fPulse;    //!
     25    MParSpline        *fPulse;    //!
    2626
    2727    TString fNameGeomCam;
  • trunk/MagicSoft/Mars/msimcamera/MSimRandomPhotons.cc

    r9375 r9425  
    4343//  Output Containers:
    4444//   MPhotonEvent
     45//   AccidentalPhotonRate [MPedestalCam]
    4546//
    4647//////////////////////////////////////////////////////////////////////////////
     
    6263#include "MPhotonData.h"
    6364
     65#include "MPedestalCam.h"
     66#include "MPedestalPix.h"
     67
    6468#include "MCorsikaRunHeader.h"
     69
     70#include "MSpline3.h"
     71#include "MParSpline.h"
     72#include "MReflector.h"
    6573
    6674ClassImp(MSimRandomPhotons);
     
    7482MSimRandomPhotons::MSimRandomPhotons(const char* name, const char *title)
    7583    : fGeom(0), fEvt(0), fStat(0), /*fEvtHeader(0),*/ fRunHeader(0),
    76     fSimulateWavelength(kFALSE),  fNameGeomCam("MGeomCam")
     84    fRates(0), fSimulateWavelength(kFALSE),  fNameGeomCam("MGeomCam")
    7785{
    7886    fName  = name  ? name  : "MSimRandomPhotons";
     
    113121    }
    114122
     123    fRates = (MPedestalCam*)pList->FindCreateObj("MPedestalCam", "AccidentalPhotonRates");
     124    if (!fRates)
     125        return kFALSE;
     126
    115127    /*
    116128    fEvtHeader = (MCorsikaEvtHeader*)pList->FindObject("MCorsikaEvtHeader");
     
    132144    }
    133145
     146    MReflector *r = (MReflector*)pList->FindObject("Reflector", "MReflector");
     147    if (!r)
     148    {
     149        *fLog << err << "Reflector [MReflector] not found... aborting." << endl;
     150        return kFALSE;
     151    }
     152
     153    const MParSpline *s1 = (MParSpline*)pList->FindObject("PhotonDetectionEfficiency", "MParSpline");
     154    const MParSpline *s2 = (MParSpline*)pList->FindObject("ConesAngularAcceptance",    "MParSpline");
     155    const MParSpline *s3 = (MParSpline*)pList->FindObject("MirrorReflectivity",        "MParSpline");
     156
     157    const Double_t d2  = fGeom->GetCameraDist()*fGeom->GetCameraDist();
     158    const Double_t pde = s1 && s1->GetSpline() ? s1->GetSpline()->Integral() : 1;
     159    const Double_t sr  = s2 && s2->GetSpline() ? s2->GetSpline()->IntegralSolidAngle() : 1;
     160    const Double_t mir = s3 && s3->GetSpline() ? s3->GetSpline()->Integral() : 1;
     161    const Double_t Ar  = r->GetA()/1e4;
     162
     163    // Conversion factor to convert pixel area to steradians (because it
     164    // is a rather small area we can assume it is flat)
     165    const Double_t conv = fGeom->GetConvMm2Deg()*TMath::DegToRad();
     166
     167    // Multiply all relevant efficiencies
     168    MParSpline *s4 = (MParSpline*)s1->Clone();
     169    s4->Multiply(*s3->GetSpline());
     170
     171    const Double_t nm = s4 && s4->GetSpline() ? s4->GetSpline()->Integral() : 1;
     172
     173    delete s4;
     174
     175    // /100 to convert the pixel area from mm^2 to cm^2
     176    fScale =  nm * TMath::Min(Ar, sr*d2) * conv*conv;
     177
     178    *fLog << inf;
     179    *fLog << "Effective cone acceptance:      " << Form("%.2f", sr*d2) << "m^2" << endl;
     180    *fLog << "Reflector area:                 " << Form("%.2f", Ar) << "m^2" << endl;
     181    *fLog << "Resulting eff. collection area: " << Form("%.1f", TMath::Min(Ar, sr*d2)) << "m^2" << endl;
     182    *fLog << "Eff. wavelength band (PDE):     " << Form("%.1f", pde) << "nm" << endl;
     183    *fLog << "Eff. wavelength band (Mirror):  " << Form("%.1f", mir) << "nm" << endl;
     184    *fLog << "Eff. wavelength band (PDE+MIR): " << Form("%.1f", nm) << "nm" << endl;
     185    *fLog << "Pixel area of " << fNameGeomCam << "[0]: " << Form("%.2e", (*fGeom)[0].GetA()*conv*conv) << "sr" << endl;
     186    //*fLog << "Effective angular acceptance:     " << sr << "sr" << endl;
     187    //*fLog << "Resulting NSB frequency:           " << fFreqNSB*nm*Ar*1000 << "MHz/sr" << endl;
     188    *fLog << "Resulting Freq. in " << fNameGeomCam << "[0]: " << Form("%.2f", fFreqNSB*(*fGeom)[0].GetA()*fScale*1000) << "MHz" << endl;
     189
     190    // const MMcRunHeader *mcrunheader = (MMcRunHeader*)pList->FindObject("MMcRunHeader");
     191    // Set NumPheFromDNSB
     192
     193    // # Number of photons from the diffuse NSB (nphe / ns 0.1*0.1 deg^2 239 m^2) and
     194    // nsb_mean 0.20
     195    // Magic pixel: 0.00885361 deg
     196    // dnsbpix = 0.2*50/15
     197    // ampl = MMcFadcHeader->GetAmplitud()
     198    // sqrt(pedrms*pedrms + dnsbpix*ampl*ampl/ratio)
     199
     200    return kTRUE;
     201}
     202
     203Bool_t MSimRandomPhotons::ReInit(MParList *pList)
     204{
     205    // Overwrite the default set by MGeomApply
     206    fRates->Init(*fGeom);
    134207    return kTRUE;
    135208}
     
    160233    for (UInt_t idx=0; idx<npix; idx++)
    161234    {
    162         // Scale the rate with the pixel size. The rate must
    163         // always be given for the pixel with index 0.
    164         const Double_t avglen = 1./(fFreqFixed+fFreqNSB*(*fGeom)[idx].GetA()/100.);
     235        // Scale the rate with the pixel size.
     236        const Double_t rate = fFreqFixed+fFreqNSB*(*fGeom)[idx].GetA()*fScale;
     237
     238        (*fRates)[idx].SetPedestal(rate);
     239
     240        // Calculate the average distance between two consequtive photons
     241        const Double_t avglen = 1./rate;
    165242
    166243        // Start producing photons at time "start"
     
    215292//    FrequencyNSB:   0.040
    216293//
    217 // The frequency is given in units fitting the units of the time.
    218 // Usually the time is given in nanoseconds thus, e.g., 40 means 40MHz
     294// The fixed frequency is given in units fitting the units of the time.
     295// Usually the time is given in nanoseconds thus, e.g., 0.040 means 40MHz.
     296//
     297// The FrequencyNSB is scaled by the area of the pixel in cm^2. Therefore
     298// 0.040 would mean 40MHz/cm^2
    219299//
    220300Int_t MSimRandomPhotons::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
  • trunk/MagicSoft/Mars/msimcamera/MSimRandomPhotons.h

    r9241 r9425  
    1212//class MCorsikaEvtHeader;
    1313class MCorsikaRunHeader;
     14class MPedestalCam;
    1415
    1516class MSimRandomPhotons : public MTask
     
    2122//    MCorsikaEvtHeader *fEvtHeader;  //! Header storing event information
    2223    MCorsikaRunHeader *fRunHeader;  //! Header storing run information
    23 
     24    MPedestalCam      *fRates;   // Random count rate per pixel
    2425
    2526    // FIXME: Make this a single number per Pixel/APD
    2627    Double_t fFreqFixed; // [1/ns]      A fixed frequency per pixel
    2728    Double_t fFreqNSB;   // [1/ns/cm^2] A frequency depending on area
     29
     30    Double_t fScale;
    2831
    2932    Bool_t fSimulateWavelength;
     
    3235
    3336    // MTask
    34     Int_t PreProcess(MParList *pList);
    35     Int_t Process();
     37    Int_t  PreProcess(MParList *pList);
     38    Bool_t ReInit(MParList *pList);
     39    Int_t  Process();
    3640
    3741    // MParContainer
Note: See TracChangeset for help on using the changeset viewer.