Changeset 9309


Ignore:
Timestamp:
02/09/09 14:14:59 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r9308 r9309  
    9797     - added -I../mtrigger
    9898
    99 
     99   * mjobs/MJSimulation.[h,cc]:
     100     - added new mode to force the use of the trigger "electronics"
     101     - moved setup of the fadc to the resource file
     102     - added a new histogram to show the maximum signal in all pixels
     103     - automatically setup the range of the TrigPos histogram
     104     - don't show all histograms in all run conditions
     105
     106   * mraw/MRawRunHeader.[h,cc]:
     107     - added ReadEnv for a setup from a resource file in ceres
     108
     109   * msimcamera/MSimAPD.cc:
     110     - added a sanity check if ReInit has not been called
    100111
    101112
  • trunk/MagicSoft/Mars/mjobs/MJSimulation.cc

    r9303 r9309  
    2727//  MJSimulation
    2828//
     29//
     30// Force reading a corsika file even if the footer (RUNE-section) is missing
     31// by setting fForceMode to kTRUE or from the resource file by
     32//
     33//    ForceMode: Yes
     34//
     35//
     36// In case of a pedestal or calibration run the artificial trigger can
     37// be "switched off" and the cosmics trrigger "switched on" by setting
     38// fForceTrigger to kTRUE or from the resource file by
     39//
     40//    ForceTrigger: Yes
     41//
     42//
    2943/////////////////////////////////////////////////////////////////////////////
    3044#include "MJSimulation.h"
     
    95109// Sets fRuns to 0, fExtractor to NULL, fDataCheck to kFALSE
    96110//
    97 MJSimulation::MJSimulation(const char *name, const char *title) : fForceMode(kFALSE)
     111MJSimulation::MJSimulation(const char *name, const char *title)
     112    : fForceMode(kFALSE), fForceTrigger(kFALSE)
    98113{
    99114    fName  = name  ? name  : "MJSimulation";
     
    103118Bool_t MJSimulation::CheckEnvLocal()
    104119{
    105     fForceMode = GetEnv("ForceMode", fForceMode);
     120    fForceMode    = GetEnv("ForceMode",    fForceMode);
     121    fForceTrigger = GetEnv("ForceTrigger", fForceTrigger);
    106122
    107123    return kTRUE;
     
    231247
    232248    MRawRunHeader header;
    233     header.InitFadcType(3);
     249    header.SetValidMagicNumber();
     250    //header.InitFadcType(3);
    234251
    235252    header.SetRunInfo(/*MRawRunHeader::kRTMonteCarlo|*/MRawRunHeader::kRTData,        1, 1);
     
    237254    {
    238255        if (!args.GetArgumentStr(0).CompareTo("pedestal", TString::kIgnoreCase))
     256        {
    239257            header.SetRunInfo(/*MRawRunHeader::kRTMonteCarlo|*/MRawRunHeader::kRTPedestal,    1, 1);
     258            header.SetSourceInfo("Pedestal");
     259        }
    240260        if (!args.GetArgumentStr(0).CompareTo("calibration", TString::kIgnoreCase))
     261        {
    241262            header.SetRunInfo(/*MRawRunHeader::kRTMonteCarlo|*/MRawRunHeader::kRTCalibration,    1, 1);
     263            header.SetSourceInfo("Calibration");
     264        }
    242265        if (!args.GetArgumentStr(0).CompareTo("pointrun", TString::kIgnoreCase))
    243266            header.SetRunInfo(/*MRawRunHeader::kRTMonteCarlo|*/MRawRunHeader::kRTPointRun,    1, 1);
     
    288311    MBinning binszd( 70,     0,       70, "BinningZd");
    289312    MBinning binsvc(155,     0,       31, "BinningViewCone");
    290     MBinning binstr(150,   -25,      125, "BinningTrigger");
    291313    MBinning binsew(150,     0,       25, "BinningEvtWidth");
     314    MBinning binstr("BinningTrigPos");
    292315
    293316    plist.AddToList(&binse);
     
    298321    plist.AddToList(&binsaz);
    299322    plist.AddToList(&binsvc);
     323    plist.AddToList(&binsew);
    300324    plist.AddToList(&binstr);
    301     plist.AddToList(&binsew);
    302325
    303326    MHn mhn1, mhn2, mhn3;
     
    307330
    308331    MH3 mhtp("TriggerPos.fVal-IntendedPulsePos.fVal-MPulseShape.GetPulseWidth");
    309     mhtp.SetName("Trigger");
     332    mhtp.SetName("TrigPos");
    310333    mhtp.SetTitle("Trigger position w.r.t. the first photon hitting an APD");
    311334
     
    456479    hcalc.Disable(MHillasCalc::kCalcConc);
    457480
    458     MHCamEvent evt0a(/*10*/0, "Signal",   "Average signal;;S [ph]");
    459     MHCamEvent evt0d(/*11*/8, "ArrTm",    "Time after first photon;;T [ns]");
     481    MHCamEvent evt0a(/*10*/0, "Signal",    "Average signal;;S [ph]");
     482    MHCamEvent evt0c(/*10*/0, "MaxSignal", "Maximum signal;;S [ph]");
     483    MHCamEvent evt0d(/*11*/8, "ArrTm",     "Time after first photon;;T [ns]");
    460484    evt0a.SetErrorSpread(kFALSE);
    461 
    462     MFillH fillx0a(&evt0a,             "MSignalCam",      "FillSignal");
     485    evt0c.SetCollectMax();
     486
     487    MFillH fillx0a(&evt0a,             "MSignalCam",      "FillAvgSignal");
     488    MFillH fillx0c(&evt0c,             "MSignalCam",      "FillMaxSignal");
    463489    MFillH fillx0d(&evt0d,             "MSignalCam",      "FillArrTm");
    464490    MFillH fillx1("MHHillas",          "MHillas",         "FillHillas");
     
    517543    tasks.AddToList(&simsum);
    518544    tasks.AddToList(&simcam);
    519     if (header.IsDataRun())
     545    if (header.IsDataRun() || fForceTrigger)
    520546        tasks.AddToList(&simtrig);
    521547    tasks.AddToList(&conttrig);
     
    525551    {
    526552        tasks.AddToList(&write1);
    527         tasks.AddToList(&write2);
     553        if (!header.IsPedestalRun())
     554            tasks.AddToList(&write2);
    528555        tasks.AddToList(&write3);
    529556    }
     
    532559        tasks.AddToList(&fillh3);
    533560    tasks.AddToList(&filltp);
    534     tasks.AddToList(&fillew);
    535     tasks.AddToList(&fillx0a);
    536 //    tasks.AddToList(&clean);
    537     tasks.AddToList(&hcalc);
    538     tasks.AddToList(&fillx0d);
    539     tasks.AddToList(&fillx1);
    540     //tasks.AddToList(&fillx2);
    541     tasks.AddToList(&fillx3);
    542     //tasks.AddToList(&fillx4);
    543     //tasks.AddToList(&fillx5);
     561    if (header.IsDataRun())
     562        tasks.AddToList(&fillew);
     563    if (!header.IsPedestalRun())
     564    {
     565        tasks.AddToList(&fillx0a);
     566        tasks.AddToList(&fillx0c);
     567        //tasks.AddToList(&clean);
     568        tasks.AddToList(&hcalc);
     569        tasks.AddToList(&fillx0d);
     570        tasks.AddToList(&fillx1);
     571        //tasks.AddToList(&fillx2);
     572        tasks.AddToList(&fillx3);
     573        //tasks.AddToList(&fillx4);
     574        //tasks.AddToList(&fillx5);
     575    }
    544576
    545577    //-------------------------------------------
     
    555587        return kFALSE;
    556588
     589    if (binstr.IsDefault())
     590        binstr.SetEdgesLin(150, -shape.GetPulseWidth(),
     591                           header.GetFreqSampling()/1000.*header.GetNumSamples()+shape.GetPulseWidth());
     592
     593    header.Print();
     594
    557595    // Execute first analysis
    558596    if (!evtloop.Eventloop(fMaxEvents))
  • trunk/MagicSoft/Mars/mjobs/MJSimulation.h

    r9275 r9309  
    1212{
    1313private:
    14     Bool_t fForceMode;
     14    Bool_t fForceMode;      // Force execution even if RUNE-section was not found
     15
     16    Bool_t fForceTrigger;   // Force the use of the trigger "electronics"
    1517
    1618    Bool_t WriteResult();
  • trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc

    r9308 r9309  
    938938        switch (fFadcType)
    939939        {
    940         case 1: *fLog << "Siegen"; break;
    941         case 2: *fLog << "MUX"; break;
     940        case 1:      *fLog << "Siegen"; break;
     941        case 2:      *fLog << "MUX"; break;
     942        case 0xffff: *fLog << "artificial"; break;
    942943        default: *fLog << "unknown";
    943944        }
     
    953954    *fLog << "Source:      '" << fSourceName << "' " << "  ";
    954955    *fLog << fSourceEpochChar << dec << fSourceEpochDate << endl;
    955     *fLog << "Run Start:    " << fRunStart << endl;
    956     *fLog << "Run Stop:     " << fRunStop << endl;
    957     *fLog << "Crates:       " << fNumCrates << " x " << fNumPixInCrate << " Pixel/Crate = " << fNumCrates*fNumPixInCrate << " Pixel/Evt" << endl;
    958     *fLog << "Num Pixels:   " << GetNumNormalPixels() << " (normal) + " << GetNumSpecialPixels() << " (special) = " << GetNumConnectedPixels() << " (total)" << endl;
     956    if (fRunStart)
     957        *fLog << "Run Start:    " << fRunStart << endl;
     958    if (fRunStop)
     959        *fLog << "Run Stop:     " << fRunStop << endl;
     960    if (fNumCrates>0 || fNumPixInCrate>0)
     961        *fLog << "Crates:       " << fNumCrates << " x " << fNumPixInCrate << " Pixel/Crate = " << fNumCrates*fNumPixInCrate << " Pixel/Evt" << endl;
     962    if (GetNumConnectedPixels()>0)
     963        *fLog << "Num Pixels:   " << GetNumNormalPixels() << " (normal) + " << GetNumSpecialPixels() << " (special) = " << GetNumConnectedPixels() << " (total)" << endl;
    959964    if (fFormatVersion>6)
    960965        *fLog << "Sampling:     " << fSamplingFrequency << "MHz with " << (int)fFadcResolution << " significant bits" << endl;
     
    12481253    fNumEventsRead = num;
    12491254}
     1255
     1256// --------------------------------------------------------------------------
     1257//
     1258//  NumSamples: 50
     1259//  NumBytePerSample: 2
     1260//  SamplingFrequency: 2000
     1261//  FadcResolution: 12
     1262//  FadcType: XXXX
     1263//
     1264Int_t MRawRunHeader::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     1265{
     1266    Bool_t rc = kFALSE;
     1267
     1268    if (IsEnvDefined(env, prefix, "NumSamples", print))
     1269    {
     1270        rc = kTRUE;
     1271        fNumSamplesHiGain = GetEnvValue(env, prefix, "NumSamples", fNumSamplesHiGain);
     1272        fNumSamplesLoGain = 0;
     1273    }
     1274
     1275    if (IsEnvDefined(env, prefix, "NumBytesPerSample", print))
     1276    {
     1277        rc = kTRUE;
     1278        fNumBytesPerSample = GetEnvValue(env, prefix, "NumBytesPerSample", fNumBytesPerSample);
     1279    }
     1280
     1281    if (IsEnvDefined(env, prefix, "SamplingFrequency", print))
     1282    {
     1283        rc = kTRUE;
     1284        fSamplingFrequency = GetEnvValue(env, prefix, "SamplingFrequency", fSamplingFrequency);
     1285    }
     1286
     1287    if (IsEnvDefined(env, prefix, "FadcResolution", print))
     1288    {
     1289        rc = kTRUE;
     1290        fFadcResolution = GetEnvValue(env, prefix, "FadcResolution", fFadcResolution);
     1291    }
     1292    // Saturation behaviour etc.
     1293    if (IsEnvDefined(env, prefix, "FadcType", print))
     1294    {
     1295        //rc = kTRUE;
     1296        //TString type = GetEnvValue(env, prefix, "FadcType", "");
     1297        // Eval "Siegen", "MUX", Dwarf"
     1298    }
     1299    else
     1300        if (rc)
     1301            fFadcType = 0xffff; // "Artificial"
     1302
     1303    return rc;
     1304}
     1305
  • trunk/MagicSoft/Mars/mraw/MRawRunHeader.h

    r9270 r9309  
    7878
    7979    Bool_t ReadEvtOld(istream& fin);
     80
     81    // MParContainer
     82    Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
    8083
    8184public:
  • trunk/MagicSoft/Mars/msimcamera/MSimAPD.cc

    r9243 r9309  
    154154    // average hit rate
    155155    const UInt_t npix = fAPDs.GetEntriesFast();
     156
     157    // Check if we can safely proceed (this can fail if we either haven't been
     158    // ReInit'ed or the max index in MPhotonStatistics is wrong)
     159    if ((Int_t)npix<fStat->GetMaxIndex())
     160    {
     161        *fLog << err << "ERROR - MSimAPD::Process: Only " << npix << " APDs initialized. At least " << fStat->GetMaxIndex() << " needed... abort." << endl;
     162        return kERROR;
     163    }
     164
    156165    for (UInt_t idx=0; idx<npix; idx++)
    157166        static_cast<APD*>(fAPDs.UncheckedAt(idx))->FillRandom(fFreq, fStat->GetTimeFirst());
Note: See TracChangeset for help on using the changeset viewer.