Changeset 2454


Ignore:
Timestamp:
11/03/03 15:41:36 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2448 r2454  
    11                                                 -*-*- END OF LINE -*-*-
     2  2003/11/03: Thomas Bretz
     3 
     4   * manalysis/MMcPedestalCopy.[h,cc], manalysis/MMcPedestalNSBAdd.[h,cc]:
     5     - fixed such, that it now works correctly with non-MC files
     6     - moved container requests from PreProcess to ReInit
     7     - removed some obsolete data members - made them locally
     8     
     9   * manalysis/MMcPedestalRead.[h,cc]:
     10     - removed
     11     
     12   * mbase/MEvtLoop.cc:
     13     - replaced the gApplication->InheritsFrom(TRint::Class())
     14       workaround for thread safty by the more correct check
     15       whether we are running in the main Thread (TThread::Self())
     16       
     17   * mbase/MTask.h:
     18     - added the missing const-qualifier to GetNumExecutions
     19     
     20   * mbase/MTaskList.cc:
     21     - fixed a typo in the output
     22     
     23   * mimage/MHillasCalc.[h,cc]:
     24     - replaced TArrayC by TArrayL to support huge number of events
     25     - added PrintSkipped
     26     - added comments to the data members
     27
     28
     29
    230 2003/10/31: Marcos Lopez
    331
    4    * mhist/MFill.cc:
     32   * mhist/MFillH.cc:
    533     - Fixed a bug in function PreProcess(MParList *pList). Inside the
    634       conditional sentence "if (!fWeight && !fWeightName.IsNull())", 
    735       fWeight never pointed to the object MWeight recoverd from the
    836       parameter list.
    9  
    10     * mhistmc/MHMcEnergyImpact.cc 
    11       - In the Fill function, pass the weight to the histogram fHist.
    12 
    13    * mmontecarlo/MMcWeightEnergySpecCalc.[h,cc] 
    14       - Added new class for changing the energy spectrum of the showers
    15         simulated with Corsika to a different one, be using weights   
     37
     38   * mhistmc/MHMcEnergyImpact.cc:
     39     - In the Fill function, pass the weight to the histogram fHist.
     40
     41   * mmontecarlo/MMcWeightEnergySpecCalc.[h,cc]:
     42     - Added new class for changing the energy spectrum of the showers
     43       simulated with Corsika to a different one, be using weights   
    1644                       
    1745   * mmontecarlo/Makefile, MonteCarloLinkDef.h
  • trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc

    r2440 r2454  
    8989// --------------------------------------------------------------------------
    9090//
     91// Check for the runtype.
    9192// Search for MPedestalCam and MMcFadcHeader.
    9293//
    93 Int_t MMcPedestalCopy::PreProcess(MParList *pList)
     94Bool_t MMcPedestalCopy::ReInit(MParList *pList)
    9495{
    95     fMcRun = (MMcRunHeader*)pList->FindObject("MMcRunHeader");
    96     if (!fMcRun)
     96    //
     97    // If it is no MC file skip this function...
     98    //
     99    if (!CheckRunType(pList))
     100        return kTRUE;
     101
     102    //
     103    // Now check the existance of all necessary containers. This has
     104    // to be done only if this is a MC file.
     105    //
     106    MPedestalCam *pedcam = (MPedestalCam*)pList->FindCreateObj("MPedestalCam");
     107    if (!pedcam)
     108        return kFALSE;
     109
     110    MMcRunHeader *mcrun = (MMcRunHeader*)pList->FindObject("MMcRunHeader");
     111    if (!mcrun)
    97112        *fLog << warn << dbginf << "MMcRunHeader not found... assuming camera<0.7" << endl;
    98113
    99     fPedCam = (MPedestalCam*)pList->FindCreateObj("MPedestalCam");
    100     if (!fPedCam)
    101         return kFALSE;
    102 
    103     fMcPed = (MMcFadcHeader*)pList->FindObject("MMcFadcHeader");
    104     if (!fMcPed)
     114    MMcFadcHeader *fadc = (MMcFadcHeader*)pList->FindObject("MMcFadcHeader");
     115    if (!fadc)
    105116    {
    106117        *fLog << err << dbginf << "MMcFadcHeader not found... aborting." << endl;
     
    108119    }
    109120
    110     return kTRUE;
    111 }
     121    const int num = pedcam->GetSize();
    112122
    113 // --------------------------------------------------------------------------
    114 //
    115 // Check for the runtype.
    116 // Initialize the size of MPedestalCam to the number of pixels from
    117 // MMcFadcHeader.
    118 //
    119 Bool_t MMcPedestalCopy::ReInit(MParList *pList)
    120 {
    121     if (!CheckRunType(pList))
    122         return kFALSE;
    123 
    124     const int num = fPedCam->GetSize();
    125 
    126     const Bool_t camver70 = fMcRun && fMcRun->GetCamVersion()>=70;
     123    const Bool_t camver70 = mcrun && mcrun->GetCamVersion()>=70;
    127124
    128125    for (int i=0; i<num; i++)
    129126    {
    130         MPedestalPix &pix = (*fPedCam)[i];
     127        MPedestalPix &pix = (*pedcam)[i];
    131128
    132129        // Here one should compute the Pedestal taking into account how
    133130        // the MC makes the transformation analogic-digital for the FADC.
     131        // This is done only once per file -> not time critical.
    134132
    135         const Float_t pedest = fMcPed->GetPedestal(i);
    136         const Float_t sigma  = camver70 ? fMcPed->GetPedestalRmsHigh(i) : fMcPed->GetElecNoise(i);
     133        const Float_t pedest = fadc->GetPedestal(i);
     134        const Float_t sigma  = camver70 ? fadc->GetPedestalRmsHigh(i) : fadc->GetElecNoise(i);
    137135
    138136        pix.Set(pedest, sigma);
     
    140138
    141139    if (camver70)
    142         fPedCam->SetReadyToSave();
     140        pedcam->SetReadyToSave();
    143141
    144142    return kTRUE;
  • trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.h

    r2440 r2454  
    66#endif
    77
    8 class MMcFadcHeader;
    9 class MMcRunHeader;
    10 class MPedestalCam;
    11 
    128class MMcPedestalCopy : public MTask
    139{
    1410private:
    15     const MMcFadcHeader *fMcPed;
    16     const MMcRunHeader  *fMcRun;
    17 
    18     MPedestalCam *fPedCam;
    19 
    2011    Bool_t CheckRunType(MParList *pList) const;
    21 
    22     Int_t  PreProcess(MParList *pList);
    2312    Bool_t ReInit(MParList *pList);
    2413
  • trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc

    r2440 r2454  
    125125// --------------------------------------------------------------------------
    126126//
    127 // - check whether we have a monte carlo file. if not skip this task
    128 // - try to get MMcFadcHeader, MGeomCam and MPedestalCam from the parameter
    129 //   list
    130 // - try to find a MMcRunHeader, too
    131 //
    132 Int_t MMcPedestalNSBAdd::PreProcess(MParList *pList)
    133 {
    134     fFadc = (MMcFadcHeader*)pList->FindObject("MMcFadcHeader");
    135     if (!fFadc)
    136     {
    137         *fLog << err << dbginf << "MMcFadcHeader not found... aborting." << endl;
    138         return kFALSE;
    139     }
    140 
    141     fGeom = (MGeomCam*)pList->FindObject("MGeomCam");
    142     if (!fGeom)
    143     {
    144         *fLog << err << dbginf << "MGeomCam not found... aborting." << endl;
    145         return kFALSE;
    146     }
    147 
    148     fPedCam = (MPedestalCam*)pList->FindCreateObj("MPedestalCam");
    149     if (!fPedCam)
    150         return kFALSE;
    151 
    152     return kTRUE;
    153 }
    154 
    155 // --------------------------------------------------------------------------
    156 //
    157127// If a MMcRunHeader is available the DNSB MMcRunHeader::GetNumPheFromDNSB
    158128// is returned. Otherwise the user given number is used.
     
    199169Bool_t MMcPedestalNSBAdd::ReInit(MParList *pList)
    200170{
     171    //
     172    // If it is no MC file skip this function...
     173    //
    201174    if (!CheckRunType(pList))
    202         return kFALSE;
    203 
     175        return kTRUE;
     176
     177    //
     178    // If it is the wrong camera version this algorithm is not needed...
     179    //
    204180    if (!CheckCamVersion(pList))
    205181        return kTRUE;
    206182
     183    //
     184    // Now check the existance of all necessary containers. This has
     185    // to be done only if this is a MC file and the camera version
     186    // is correct.
     187    //
     188    MPedestalCam *pedcam = (MPedestalCam*)pList->FindCreateObj("MPedestalCam");
     189    if (!pedcam)
     190        return kFALSE;
     191
     192    MMcFadcHeader *fadc = (MMcFadcHeader*)pList->FindObject("MMcFadcHeader");
     193    if (!fadc)
     194    {
     195        *fLog << err << dbginf << "MMcFadcHeader not found... aborting." << endl;
     196        return kFALSE;
     197    }
     198
     199    MGeomCam *geom = (MGeomCam*)pList->FindObject("MGeomCam");
     200    if (!geom)
     201    {
     202        *fLog << err << dbginf << "MGeomCam not found... aborting." << endl;
     203        return kFALSE;
     204    }
     205
    207206    const Float_t dnsbpix = GetDnsb(pList) * 50.0/15.0;
    208207
     
    210209        return kFALSE;
    211210
    212     const int num = fPedCam->GetSize();
     211    const int num = pedcam->GetSize();
    213212
    214213    for (int i=0; i<num; i++)
    215214    {
    216         MPedestalPix &pix    = (*fPedCam)[i];
     215        MPedestalPix &pix    = (*pedcam)[i];
    217216
    218217        const Float_t pedrms = pix.GetPedestalRms();
    219         const Float_t ratio  = fGeom->GetPixRatio(i);
    220         const Float_t ampl   = fFadc->GetAmplitud();
     218        const Float_t ratio  = geom->GetPixRatio(i);
     219        const Float_t ampl   = fadc->GetAmplitud();
    221220
    222221        pix.SetPedestalRms(sqrt(pedrms*pedrms + dnsbpix*ampl*ampl/ratio));
    223222    }
    224223
    225     fPedCam->SetReadyToSave();
     224    pedcam->SetReadyToSave();
    226225
    227226    return kTRUE;
    228227}
    229 
  • trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.h

    r2442 r2454  
    66#endif
    77
    8 class MMcFadcHeader;
    9 class MGeomCam;
    10 class MPedestalCam;
    11 
    128class MMcPedestalNSBAdd : public MTask
    139{
    1410private:
    15     const MGeomCam      *fGeom;
    16     const MMcFadcHeader *fFadc;
    17 
    18     MPedestalCam *fPedCam;
    19 
    2011    Float_t fDnsbPixel;
    2112
     
    2516    Float_t GetDnsb(MParList *pList) const;
    2617
    27     Int_t  PreProcess(MParList *pList);
    2818    Bool_t ReInit(MParList *pList);
    29 
    3019
    3120public:
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.cc

    r2438 r2454  
    7575#include <TTime.h>          // TTime
    7676#include <TFile.h>          // gFile
     77#include <TThread.h>        // TThread::Self()
    7778#include <TDatime.h>        // TDatime
    7879#include <TSystem.h>        // gSystem
     
    372373        fProgress->SetPosition(num/fNumEvents);
    373374
    374     //
    375     // Handle GUI events (display changes)
    376     //
     375
     376    // FIXME: This is a workaround, because TApplication::Run is not
     377    //        thread safe against ProcessEvents. We assume, that if
     378    //        we are not in the Main-Thread ProcessEvents() is
     379    //        called by the TApplication Event Loop...
     380    if (!TThread::Self()/*gApplication->InheritsFrom(TRint::Class())*/)
     381    {
     382        //
     383        // Handle GUI events (display changes)
     384        //
    377385#if ROOT_VERSION_CODE < ROOT_VERSION(3,02,06)
    378     gSystem->ProcessEvents();
     386        gSystem->ProcessEvents();
    379387#else
    380     // FIXME: This is a workaround, because TApplication::Run is not thread safe against ProcessEvents
    381     if (gApplication->InheritsFrom(TRint::Class()))
    382     {
    383388        if (fDisplay)
    384389            gSystem->ProcessEvents();
     
    386391            if (fProgress)
    387392                gClient->ProcessEventsFor(fProgress);
    388     }
    389393#endif
     394    }
    390395
    391396    return rc;
     
    485490        //fProgress->SetPosition(maxcnt>0 ? TMath::Min(maxcnt, entries) : entries);
    486491        fProgress->SetPosition(1);
    487         // FIXME: This is a workaround, because TApplication::Run is not thread safe against ProcessEvents
    488         if (gApplication->InheritsFrom(TRint::Class()))
     492
     493        // FIXME: This is a workaround, because TApplication::Run is not
     494        //        thread safe against ProcessEvents. We assume, that if
     495        //        we are not in the Main-Thread ProcessEvents() is
     496        //        called by the TApplication Event Loop...
     497        if (!TThread::Self()/*gApplication->InheritsFrom(TRint::Class())*/)
    489498        {
    490499#if ROOT_VERSION_CODE < ROOT_VERSION(3,02,06)
  • trunk/MagicSoft/Mars/mbase/MTask.h

    r2206 r2454  
    7171    virtual void PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE) const;
    7272
    73     UInt_t GetNumExecutions() { return fNumExecutions; }
     73    UInt_t GetNumExecutions() const { return fNumExecutions; }
    7474
    7575    virtual Bool_t ReInit(MParList *pList);
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r2206 r2454  
    308308        if (!task->ReInit(pList?pList:fParList))
    309309        {
    310             *fLog << err << "ERROR - ReInit if Task " << task->GetDescriptor() << " failed." << endl;
     310            *fLog << err << "ERROR - ReInit of Task '" << task->GetDescriptor() << "' failed." << endl;
    311311            return kFALSE;
    312312        }
  • trunk/MagicSoft/Mars/mimage/MHillasCalc.cc

    r2440 r2454  
    173173// --------------------------------------------------------------------------
    174174//
     175//  This is used to print the output in the PostProcess. Later (having
     176//  millions of events) we may want to improve the output.
     177//
     178void MHillasCalc::PrintSkipped(int i, const char *str) const
     179{
     180    *fLog << " " << setw(7) << fErrors[i] << " (";
     181    *fLog << setw(3) << (int)(100.*fErrors[i]/GetNumExecutions());
     182    *fLog << "%) Evts skipped due to: " << str << endl;
     183}
     184
     185// --------------------------------------------------------------------------
     186//
    175187//  Prints some statistics about the hillas calculation. The percentage
    176188//  is calculated with respect to the number of executions of this task.
     
    184196    *fLog << GetDescriptor() << " execution statistics:" << endl;
    185197    *fLog << dec << setfill(' ');
    186     *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3) << (int)(fErrors[1]*100/GetNumExecutions()) << "%) Evts skipped due to: Event has less than 3 pixels" << endl;
    187     *fLog << " " << setw(7) << fErrors[2] << " (" << setw(3) << (int)(fErrors[2]*100/GetNumExecutions()) << "%) Evts skipped due to: Calculated Size == 0" << endl;
    188     *fLog << " " << setw(7) << fErrors[3] << " (" << setw(3) << (int)(fErrors[3]*100/GetNumExecutions()) << "%) Evts skipped due to: Number of used pixels < 3" << endl;
    189     *fLog << " " << setw(7) << fErrors[4] << " (" << setw(3) << (int)(fErrors[4]*100/GetNumExecutions()) << "%) Evts skipped due to: CorrXY==0" << endl;
    190     *fLog << " " << fErrors[0] << " (" << (int)(fErrors[0]*100/GetNumExecutions()) << "%) Evts survived Hillas calculation!" << endl;
     198    PrintSkipped(1, "Event has less than 3 pixels");
     199    PrintSkipped(2, "Calculated Size == 0");
     200    PrintSkipped(3, "Number of used pixels < 3");
     201    PrintSkipped(4, "CorrXY==0");
     202    *fLog << " " << (int)fErrors[0] << " (" << (int)(100.*fErrors[0]/GetNumExecutions()) << "%) Evts survived Hillas calculation!" << endl;
    191203    *fLog << endl;
    192204
Note: See TracChangeset for help on using the changeset viewer.