Changeset 1888


Ignore:
Timestamp:
04/02/03 09:03:22 (22 years ago)
Author:
wittek
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r1886 r1888  
    11                                                 -*-*- END OF LINE -*-*-
     2
     3 2003/04/02: Wolfgang Wittek
     4
     5   * mfileio/Makefile
     6     - mhist added, because MBinning is used in MCT1ReadPreproc
     7
     8   * mfileio/MCT1ReadPreProc.[h,cc]
     9     - new member function SmearTheta
     10     - store smeared  Theta in MMcEvt::fTelescopeTheta
     11       store original Theta in MParameterD container "ThetaOrig"
     12       store fhourangle     in MParameterD container "HourAngle"
     13
     14   * manalysis/MPointingCorr.[h,cc]
     15     - get hour angle from ParameterD container "HourAngle"
     16
     17   * manalysis/MSelBasic.[h,cc]
     18               MSelStandard.[h,cc]
     19               MSelFinal.[h,cc]
     20     - new member functions SetCuts()
     21
    222
    323 2003/04/01: Abelardo Moralejo
     
    1333
    1434 2003/03/31: Thomas Bretz
    15 
    16    * mhist/MHArray.[h,cc]:
    17      - added default constructor
    18      - added Set-function
    19      - added Init function
    20      - moved code from constructors to Set and Init
    2135 
    2236   * Makefile.conf.linux:
  • trunk/MagicSoft/Mars/manalysis/MPointingCorr.cc

    r1885 r1888  
    3838#include "MSrcPosCam.h"
    3939#include "MGeomCam.h"
     40#include "MParameters.h"
    4041
    4142#include "MLog.h"
     
    8182    }
    8283
     84    fHourAngle = (MParameterD*)pList->FindObject("HourAngle", "MParameterD");
     85    if (!fHourAngle)
     86    {
     87        *fLog << dbginf << "HourAngle not found... aborting." << endl;
     88        return kFALSE;
     89    }
     90
    8391
    8492    fSrcPos = (MSrcPosCam*)pList->FindObject(fSrcName, "MSrcPosCam");
     
    104112   // (cx, cy) is the source position in the camera [mm]
    105113   //
    106    Float_t fhourangle = fMcEvt->GetOtherCphFraction();
     114   Float_t fhourangle = fHourAngle->GetVal();
     115
     116   //*fLog << "MPointingCorr::Process; fhourangle = "
     117   //      << fhourangle << endl;
     118
    107119   Float_t cx = -0.05132 - 0.001064 * fhourangle
    108120                         - 3.530e-6 * fhourangle * fhourangle;
  • trunk/MagicSoft/Mars/manalysis/MPointingCorr.h

    r1868 r1888  
    1616class MMcEvt;
    1717class MSrcPosCam;
     18class MParameterD;
     19
    1820
    1921class MPointingCorr : public MTask
     
    2325    MSrcPosCam   *fSrcPos;
    2426    TString       fSrcName;
     27    MParameterD  *fHourAngle;
    2528
    2629    Float_t      fMm2Deg;
  • trunk/MagicSoft/Mars/manalysis/MSelBasic.cc

    r1885 r1888  
    6161    fTitle = title ? title : "Task to evaluate basic cuts";
    6262
    63     ThetaMin =  0.0;
    64     ThetaMax = 60.0;
     63    fThetaMin =  0.0;
     64    fThetaMax = 60.0;
    6565}
    6666
     
    109109    }
    110110
    111     memset(fErrors, 0, sizeof(fErrors));
     111    memset(fCut, 0, sizeof(fCut));
    112112
    113113    return kTRUE;
     
    123123Bool_t MSelBasic::Process()
    124124{
    125   /*
    126   //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    127   *fLog << "=========================================================" << endl;
    128   *fLog << "" << endl;
    129   *fLog << "MmcEvt data : " << endl;
    130   *fLog << "" << endl;
    131   fMcEvt->Print();
    132   *fLog << "" << endl;
    133   *fLog << "PartId() = " << fMcEvt->GetPartId() << endl;
    134   *fLog << "Energy() = " << fMcEvt->GetEnergy() << endl;
    135   *fLog << "Theta()  = " << fMcEvt->GetTheta() << endl;
    136 
    137   *fLog << "Phi()    = " << fMcEvt->GetPhi() << endl;
    138   //*fLog << "CoreD()  = " << fMcEvt->GetCoreD() << endl;
    139   //*fLog << "CoreX()  = " << fMcEvt->GetCoreX() << endl;
    140 
    141   //*fLog << "CoreY()  = " << fMcEvt->GetCoreY() << endl;
    142   *fLog << "Impact() = " << fMcEvt->GetImpact() << endl;
    143   //*fLog << "PhotIni()= " << fMcEvt->GetPhotIni() << endl;
    144 
    145   //*fLog << "PassPhotAtm() = " << fMcEvt->GetPassPhotAtm() << endl;
    146   //*fLog << "PassPhotRef() = " << fMcEvt->GetPassPhotRef() << endl;
    147   //*fLog << "PassPhotCone()  = " << fMcEvt->GetPassPhotCone() << endl;
    148 
    149   //*fLog << "PhotElfromShower()    = " << fMcEvt->GetPhotElfromShower() << endl;
    150   //*fLog << "PhotElinCamera()  = " << fMcEvt->GetPhotElinCamera() << endl;
    151   *fLog << "TelescopePhi()  = " << fMcEvt->GetTelescopePhi() << endl;
    152 
    153   *fLog << "TelescopeTheta()  = " << fMcEvt->GetTelescopeTheta() << endl;
    154   *fLog << "Impact() = " << fMcEvt->GetImpact() << endl;
    155   //*fLog << "PhotIni()= " << fMcEvt->GetPhotIni() << endl;
    156   *fLog << "" << endl;
    157   *fLog << "=========================================================" << endl;
    158 
    159   *fLog << "=========================================================" << endl;
    160   *fLog << "" << endl;
    161   *fLog << "MPedestalPix data : " << endl;
    162   *fLog << "" << endl;
    163 
    164   Int_t ntot;
    165   ntot = fPed->GetSize();
    166     *fLog << "MeanRms() :" << endl;   
    167   for (Int_t i=0; i<ntot; i++)
    168   {
    169     MPedestalPix &pix = (*fPed)[i];
    170     //*fLog << "Mean()    = " << i << ",  " << pix.GetMean() << endl;   
    171     //*fLog << "Sigma()   = " << i << ",  " << pix.GetSigma() << endl;   
    172     *fLog << pix.GetMeanRms() << " ";   
    173     //*fLog << "SigmaRms()= " << i << ",  " << pix.GetSigmaRms() << endl;   
    174   }
    175   *fLog << "" << endl;
    176 
    177   *fLog << "" << endl;
    178   ntot = fEvt->GetNumPixels();
    179     *fLog << "MCerPhotPix :  pix.GetNumPhotons()" << endl;   
    180   for (Int_t i=0; i<ntot; i++)
    181   {
    182     MCerPhotPix &pix = (*fEvt)[i];
    183     *fLog << pix.GetNumPhotons() << " ";   
    184   }
    185   *fLog << "" << endl;
    186 
    187   *fLog << "" << endl;
    188   ntot = fEvt->GetNumPixels();
    189     *fLog << "MCerPhotPix :  pix.GetErrorPhot()" << endl;   
    190   for (Int_t i=0; i<ntot; i++)
    191   {
    192     MCerPhotPix &pix = (*fEvt)[i];
    193     *fLog << pix.GetErrorPhot() << " ";   
    194   }
    195   *fLog << "" << endl;
    196 
    197   //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    198   */
    199 
    200 
    201125    Int_t rc = 0;
    202126
     
    207131    //}
    208132
    209     Double_t Theta = kRad2Deg*fMcEvt->GetTelescopeTheta();
    210     if ( Theta < ThetaMin )
     133    Double_t theta = kRad2Deg*fMcEvt->GetTelescopeTheta();
     134    if ( theta < fThetaMin )
    211135    {
    212136      *fLog << "MSelBasic::Process; Run, Event, Theta = "
    213137            << fRawRun->GetRunNumber()<< ",  "
    214             << fMcEvt->GetEvtNumber() << ",  " << Theta << endl;
     138            << fMcEvt->GetEvtNumber() << ",  " << theta << endl;
    215139      rc = 1;
    216140    }   
    217141
    218     else if ( Theta > ThetaMax )
     142    else if ( theta > fThetaMax )
    219143    {
    220144      rc = 2;
     
    227151    }   
    228152
    229     fErrors[rc]++;
     153    fCut[rc]++;
    230154
    231155    return rc==0 ? kTRUE : kCONTINUE;
     
    246170    const Int_t entries = fEvt->GetNumPixels();
    247171 
    248     //$$$$$$$$$$$$$$$$$$
    249     //const Int_t nall = fPed->GetSize(); 
    250     //*fLog << "nall = " << nall << endl;
    251     //for (Int_t id=0; id<nall; id++)
    252     //{
    253     //  MGeomPix &gpix = (*fCam)[id];
    254     //  if ( gpix.IsInOutermostRing() )
    255     //  {
    256     //    *fLog << "IsInOutermostRing : pixel no. = " << id << endl;
    257     //  }
    258 
    259     //  if ( gpix.IsInOuterRing() )
    260     //  {
    261     //    *fLog << "IsInOuterRing : pixel no. = " << id << endl;
    262     //  }
    263     //}
    264     //$$$$$$$$$$$$$$$$$$
    265 
    266 
    267172    for (Int_t i=0; i<entries; i++)
    268173    {
     
    316221    *fLog << GetDescriptor() << " execution statistics:" << endl;
    317222    *fLog << dec << setfill(' ');
    318     *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3)
    319           << (int)(fErrors[1]*100/GetNumExecutions())
    320           << "%) Evts skipped due to: Zenith angle < " << ThetaMin << endl;
    321 
    322     *fLog << " " << setw(7) << fErrors[2] << " (" << setw(3)
    323           << (int)(fErrors[2]*100/GetNumExecutions())
    324           << "%) Evts skipped due to: Zenith angle > " << ThetaMax << endl;
    325 
    326     *fLog << " " << setw(7) << fErrors[3] << " (" << setw(3)
    327           << (int)(fErrors[3]*100/GetNumExecutions())
     223    *fLog << " " << setw(7) << fCut[1] << " (" << setw(3)
     224          << (int)(fCut[1]*100/GetNumExecutions())
     225          << "%) Evts skipped due to: Zenith angle < " << fThetaMin << endl;
     226
     227    *fLog << " " << setw(7) << fCut[2] << " (" << setw(3)
     228          << (int)(fCut[2]*100/GetNumExecutions())
     229          << "%) Evts skipped due to: Zenith angle > " << fThetaMax << endl;
     230
     231    *fLog << " " << setw(7) << fCut[3] << " (" << setw(3)
     232          << (int)(fCut[3]*100/GetNumExecutions())
    328233          << "%) Evts skipped due to: Software trigger not fullfilled" << endl;
    329234
    330     *fLog << " " << fErrors[0] << " (" << (int)(fErrors[0]*100/GetNumExecutions())
     235    *fLog << " " << fCut[0] << " (" << (int)(fCut[0]*100/GetNumExecutions())
    331236          << "%) Evts survived Basic selections!" << endl;
    332237    *fLog << endl;
     
    336241
    337242
     243
     244
     245
     246
     247
     248
     249
  • trunk/MagicSoft/Mars/manalysis/MSelBasic.h

    r1872 r1888  
    2424{
    2525private:
    26     const MPedestalCam *fPed;      // Pedestal information
    27     const MGeomCam     *fCam;      // Camera Geometry
    28     const MCerPhotEvt  *fEvt;      // Cerenkov Photon Event
    29     const MMcEvt       *fMcEvt;       
     26    const MPedestalCam  *fPed;      // Pedestal information
     27    const MGeomCam      *fCam;      // Camera Geometry
     28    const MCerPhotEvt   *fEvt;      // Cerenkov Photon Event
     29    const MMcEvt        *fMcEvt;       
    3030    const MRawRunHeader *fRawRun;       
    3131
    32     Double_t     ThetaMin;
    33     Double_t     ThetaMax;
     32    Float_t     fThetaMin;
     33    Float_t     fThetaMax;
    3434
    35     Int_t        fErrors[4];
     35    Int_t        fCut[4];
    3636
    3737public:
     
    4343
    4444    Bool_t SwTrigger();
     45    void SetCuts(Float_t thetamin, Float_t thetamax)
     46         { fThetaMin = thetamin; fThetaMax = thetamax; }
    4547
    4648    ClassDef(MSelBasic, 0)   // Task to evaluate basic cuts
  • trunk/MagicSoft/Mars/manalysis/MSelFinal.cc

    r1885 r1888  
    6767    fHilSrcName = HilSrcName;
    6868
    69     fHadronnessCut =   0.2;
    70     fAlphaCut      = 100.0; //degrees
     69    // default values of cuts
     70    fHadronnessMax =   1.0;
     71    fAlphaMax      = 100.0; //degrees
    7172}
    7273
     
    109110    }
    110111
    111     memset(fErrors, 0, sizeof(fErrors));
     112    memset(fCut, 0, sizeof(fCut));
    112113
    113114    return kTRUE;
     
    133134    Double_t h = fHadronness->GetHadronness();
    134135
    135     if ( h>fHadronnessCut )
     136    if ( h>fHadronnessMax )
    136137    {
    137138      //*fLog << "MSelFinal::Process; h, alpha = " << h << ",  "
     
    140141    }   
    141142
    142     else if ( modalpha > fAlphaCut )
     143    else if ( modalpha > fAlphaMax )
    143144    {
    144145      //*fLog << "MSelFinal::Process; h, alpha = " << h << ",  "
     
    147148    }   
    148149
    149     fErrors[rc]++;
     150    fCut[rc]++;
    150151
    151152    return rc==0 ? kTRUE : kCONTINUE;
     
    164165    *fLog << GetDescriptor() << " execution statistics:" << endl;
    165166    *fLog << dec << setfill(' ');
    166     *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3)
    167           << (int)(fErrors[1]*100/GetNumExecutions())
    168           << "%) Evts skipped due to: g/h separation cut (" << fHadronnessCut
    169           << ")" << endl;
     167    *fLog << " " << setw(7) << fCut[1] << " (" << setw(3)
     168          << (int)(fCut[1]*100/GetNumExecutions())
     169          << "%) Evts skipped due to: hadroness > "<< fHadronnessMax << endl;
    170170
    171     *fLog << " " << setw(7) << fErrors[2] << " (" << setw(3)
    172           << (int)(fErrors[2]*100/GetNumExecutions())
    173           << "%) Evts skipped due to: cut in ALPHA (" << fAlphaCut
    174           << " degrees)" << endl;
     171    *fLog << " " << setw(7) << fCut[2] << " (" << setw(3)
     172          << (int)(fCut[2]*100/GetNumExecutions())
     173          << "%) Evts skipped due to: |ALPHA| > " << fAlphaMax
     174          << " [degrees]" << endl;
    175175
    176     *fLog << " " << fErrors[0] << " ("
    177           << (int)(fErrors[0]*100/GetNumExecutions())
     176    *fLog << " " << fCut[0] << " ("
     177          << (int)(fCut[0]*100/GetNumExecutions())
    178178          << "%) Evts survived Final selections!" << endl;
    179179    *fLog << endl;
  • trunk/MagicSoft/Mars/manalysis/MSelFinal.h

    r1847 r1888  
    3232
    3333    Double_t     fMm2Deg;   // conversion mm to degrees in camera
    34     Int_t        fErrors[3];
     34    Int_t        fCut[3];
    3535    TString      fHilName;
    3636    TString      fHilSrcName;
    3737 
    38     Float_t      fHadronnessCut;
    39     Float_t      fAlphaCut;
     38    Float_t      fHadronnessMax;
     39    Float_t      fAlphaMax;
    4040
    4141public:
     
    4747    Bool_t PostProcess();
    4848
    49     void SetHadronnessCut(Float_t hadcut) { fHadronnessCut = hadcut; }
    50     void SetAlphaCut(Float_t alpha)       { fAlphaCut      = alpha;  }
     49    void SetCuts(Float_t hadmax, Float_t alphamax)
     50         { fHadronnessMax = hadmax; fAlphaMax = alphamax;  }
    5151
    5252    ClassDef(MSelFinal, 0)   // Task to evaluate final cuts
  • trunk/MagicSoft/Mars/manalysis/MSelStandard.cc

    r1885 r1888  
    6464    fHilName    = HilName;
    6565    fHilSrcName = HilSrcName;
     66
     67    // default values of cuts
     68    fUsedPixelsMax =   92;
     69    fCorePixelsMin =    4;
     70    fSizeMin       =   60;
     71    fDistMin       =  0.4;
     72    fDistMax       = 1.05;
     73    fLengthMin     =  0.0;
     74    fWidthMin      =  0.0;
    6675}
    6776
     
    114123    //*fLog << "fMm2Deg = " << fMm2Deg << endl;
    115124
    116     memset(fErrors, 0, sizeof(fErrors));
     125    memset(fCut, 0, sizeof(fCut));
    117126
    118127    return kTRUE;
     
    131140    Int_t rc = 0;
    132141
    133     Double_t fLength       = fHil->GetLength() * fMm2Deg;
    134     Double_t fWidth        = fHil->GetWidth()  * fMm2Deg;
    135     Double_t fDist         = fHilSrc->GetDist()* fMm2Deg;
    136     //Double_t fDelta        = fHil->GetDelta()  * kRad2Deg;
    137     Double_t fSize         = fHil->GetSize();
    138     Int_t fNumUsedPixels   = fHil->GetNumUsedPixels();
    139     Int_t fNumCorePixels   = fHil->GetNumCorePixels();
    140 
    141     if ( fNumUsedPixels >= 92  ||  fNumCorePixels <= 4 )
    142     {
    143       //*fLog << "MSelStandard::Process; fSize, fDist, fNumUsedPixels, fNumCorePixels = "
    144       //      << fSize << ",  " << fDist << ",  " << fNumUsedPixels << ",  "
    145       //      << fNumCorePixels << endl;
     142    Double_t length       = fHil->GetLength() * fMm2Deg;
     143    Double_t width        = fHil->GetWidth()  * fMm2Deg;
     144    Double_t dist         = fHilSrc->GetDist()* fMm2Deg;
     145    //Double_t delta        = fHil->GetDelta()  * kRad2Deg;
     146    Double_t size         = fHil->GetSize();
     147    Int_t numusedpixels   = fHil->GetNumUsedPixels();
     148    Int_t numcorepixels   = fHil->GetNumCorePixels();
     149
     150    if ( numusedpixels >= fUsedPixelsMax  ||  numcorepixels <= fCorePixelsMin )
     151    {
    146152      rc = 1;
    147153    }   
    148154
    149     else if ( fSize <= 60.0         ||  fDist< 0.4           ||  fDist > 1.05 )
    150     {
    151       //*fLog << "MSelStandard::Process; fSize, fDist, fNumUsedPixels, fNumCorePixels = "
    152       //      << fSize << ",  " << fDist << ",  " << fNumUsedPixels << ",  "
    153       //      << fNumCorePixels << endl;
     155    else if ( size <= fSizeMin )
     156    {
    154157      rc = 2;
    155158    }   
    156159
    157     else if ( fLength <= 0.0         ||  fWidth <= 0.0 )
    158     {
    159       //*fLog << "MSelStandard::Process; fLength, fWidth = "
    160       //      << fLength << ",  " << fWidth << endl;
     160    else if ( dist< fDistMin   ||  dist > fDistMax )
     161    {
    161162      rc = 3;
    162163    }   
    163164
    164 
    165     fErrors[rc]++;
     165    else if ( length <= fLengthMin   ||  width <= fWidthMin )
     166    {
     167      rc = 4;
     168    }   
     169
     170
     171    fCut[rc]++;
    166172
    167173    return rc==0 ? kTRUE : kCONTINUE;
     
    180186    *fLog << GetDescriptor() << " execution statistics:" << endl;
    181187    *fLog << dec << setfill(' ');
    182     *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3)
    183           << (int)(fErrors[1]*100/GetNumExecutions())
    184           << "%) Evts skipped due to: Requirements on no.of used or core pxels not fullfilled" << endl;
    185 
    186     *fLog << " " << setw(7) << fErrors[2] << " (" << setw(3)
    187           << (int)(fErrors[2]*100/GetNumExecutions())
    188           << "%) Evts skipped due to: Requirements on SIZE or DIST not fullfilled" << endl;
    189 
    190     *fLog << " " << setw(7) << fErrors[3] << " (" << setw(3)
    191           << (int)(fErrors[3]*100/GetNumExecutions())
    192           << "%) Evts skipped due to: Length or Width is <= 0" << endl;
    193 
    194     *fLog << " " << fErrors[0] << " ("
    195           << (int)(fErrors[0]*100/GetNumExecutions())
     188    *fLog << " " << setw(7) << fCut[1] << " (" << setw(3)
     189          << (int)(fCut[1]*100/GetNumExecutions())
     190          << "%) Evts skipped due to: Used pixels >= " << fUsedPixelsMax
     191          << " or Core pixels <= " << fCorePixelsMin << endl;
     192
     193    *fLog << " " << setw(7) << fCut[2] << " (" << setw(3)
     194          << (int)(fCut[2]*100/GetNumExecutions())
     195          << "%) Evts skipped due to: SIZE <= " << fSizeMin << endl;
     196
     197    *fLog << " " << setw(7) << fCut[3] << " (" << setw(3)
     198          << (int)(fCut[3]*100/GetNumExecutions())
     199          << "%) Evts skipped due to: DIST < " << fDistMin
     200          << " or DIST > " << fDistMax << endl;
     201
     202    *fLog << " " << setw(7) << fCut[4] << " (" << setw(3)
     203          << (int)(fCut[4]*100/GetNumExecutions())
     204          << "%) Evts skipped due to: LENGTH <= " << fLengthMin
     205          << " or WIDTH <= " << fWidthMin << endl;
     206
     207    *fLog << " " << fCut[0] << " ("
     208          << (int)(fCut[0]*100/GetNumExecutions())
    196209          << "%) Evts survived Standard selections!" << endl;
    197210    *fLog << endl;
     
    201214
    202215
     216
     217
     218
     219
     220
     221
     222
     223
     224
     225
  • trunk/MagicSoft/Mars/manalysis/MSelStandard.h

    r1847 r1888  
    3030
    3131    Double_t     fMm2Deg;   // conversion mm to degrees in camera
    32     Int_t        fErrors[4];
     32    Int_t        fCut[5];
    3333    TString      fHilName;
    3434    TString      fHilSrcName;
     35
     36    Float_t     fUsedPixelsMax;
     37    Float_t     fCorePixelsMin;
     38    Float_t     fSizeMin;
     39    Float_t     fDistMin;
     40    Float_t     fDistMax;
     41    Float_t     fLengthMin;
     42    Float_t     fWidthMin;
    3543
    3644public:
     
    4250    Bool_t PostProcess();
    4351
     52    void SetCuts(Float_t usedpixelsmax, Float_t corepixelsmin,
     53                 Float_t sizemin, Float_t distmin, Float_t distmax,
     54                 Float_t lengthmin, Float_t widthmin)
     55      { fUsedPixelsMax = usedpixelsmax; fCorePixelsMin = corepixelsmin;
     56        fSizeMin = sizemin; fDistMin = distmin; fDistMax = distmax;
     57        fLengthMin = lengthmin; fWidthMin = widthmin; }
    4458
    4559    ClassDef(MSelStandard, 0)   // Task to evaluate standard cuts
  • trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc

    r1880 r1888  
    7979#include "MMcEvt.hxx"
    8080#include "MMcTrig.hxx"
     81#include "MBinning.h"
     82
     83#include "TRandom3.h"
     84#include "MParameters.h"
    8185
    8286ClassImp(MCT1ReadPreProc);
     
    119123// Add this file as the last entry in the chain
    120124//
    121 Int_t MCT1ReadPreProc::AddFile(const char *txt, Int_t)
     125void MCT1ReadPreProc::AddFile(const char *txt)
    122126{
    123127    const char *name = gSystem->ExpandPathName(txt);
     
    129133    {
    130134        *fLog << warn << "WARNING - Problem reading header... ignored." << endl;
    131         return 0;
     135        return;
    132136    }
    133137
     
    136140    {
    137141        *fLog << warn << "WARNING - File contains no data... ignored." << endl;
    138         return 0;
     142        return;
    139143    }
    140144
     
    144148
    145149    fFileNames->AddLast(new TNamed(txt, ""));
    146     return 1;
    147150}
    148151
     
    703706
    704707    //
     708    //  look for the HourAngle container in the plist
     709    //
     710    fHourAngle = (MParameterD*)pList->FindCreateObj("MParameterD","HourAngle");
     711    if (!fHourAngle)
     712        return kFALSE;
     713    fHourAngle->SetTitle("Store the CT1 hour angle [deg]");
     714
     715    //
     716    //  look for the ThetaOrig container in the plist
     717    //
     718    fThetaOrig = (MParameterD*)pList->FindCreateObj("MParameterD","ThetaOrig");
     719    if (!fThetaOrig)
     720        return kFALSE;
     721    fThetaOrig->SetTitle("Store the original CT1 zenith angle [rad]");
     722
     723    //
    705724    //  look for the MCerPhotEvt class in the plist
    706725    //
     
    772791
    773792    return GetSelector() ? GetSelector()->CallPreProcess(pList) : kTRUE;
     793}
     794
     795
     796// --------------------------------------------------------------------------
     797//
     798// Smear Theta uniformly in a bin of Theta; result is stored in ThetaSmeared
     799//
     800//
     801Bool_t MCT1ReadPreProc::SmearTheta(MParList *plist, Float_t *Theta,
     802                             Float_t *ThetaSmeared)
     803{
     804  // both Theta and ThetaSmeared are in [radians]
     805  // the edges are in [degrees]
     806
     807  const MBinning *binstheta = (MBinning*)plist->FindObject("BinningTheta");
     808  if (!binstheta)
     809  {
     810    *fLog << err << dbginf << "BinningTheta not found ... aborting." << endl;
     811    return kFALSE;
     812  }
     813
     814  Int_t nedges = binstheta->GetNumEdges();
     815  Double_t *edges  = (Double_t*)binstheta->GetEdges();
     816
     817  Int_t bin = -1;
     818  *ThetaSmeared = *Theta;
     819
     820  Float_t Thetadeg = (*Theta) * 180.0/TMath::Pi();
     821  Float_t ThetaSmeareddeg;
     822 
     823  // search Theta bin
     824  Int_t i;
     825  for (i=1; i<nedges; i++)
     826  {
     827    if (Thetadeg >= *(edges+i)  ) continue;
     828    if (Thetadeg  < *(edges+i-1)) break;
     829    bin = i;
     830    break;
     831  }
     832
     833  Float_t low=0.0;
     834  Float_t up =0.0;
     835
     836  // smear Theta within the Theta bin
     837  ThetaSmeareddeg = -1.0;
     838  if (bin != -1)
     839  {
     840    low = *(edges+bin-1);
     841    up  = *(edges+bin);
     842
     843    Double_t ran = ran3.Rndm(1);
     844    ThetaSmeareddeg = (low + ran * (up-low));
     845  }
     846  *ThetaSmeared = ThetaSmeareddeg * TMath::Pi()/180.0;
     847
     848  //*fLog << "SmearTheta : Thetadeg, ThetaSmeareddeg, low, up, bin = "
     849  //      << Thetadeg
     850  //      << ",  " << ThetaSmeareddeg << ",  " << low << ",  " << up << ",  "
     851  //      << bin << endl;   
     852
     853  return kTRUE;
    774854}
    775855
     
    860940    // int ipreproc_alt_arcs; // "should be" alt according to preproc (arcseconds)
    861941    // int ipreproc_az_arcs;  // "should be" az according to preproc (arcseconds)
     942
     943    // smear Theta in its Theta bin
     944    Float_t ThetaOrig =  TMath::Pi()*(0.5-1./180*event.ialt_arcs/3600); // [radians]
     945    Float_t ThetaSmeared;                                               // [radians]
     946    SmearTheta(fParList, &ThetaOrig, &ThetaSmeared);
     947    fThetaOrig->SetVal(ThetaOrig);
     948
     949    // store hour angle
     950    fHourAngle->SetVal(event.fhourangle);
     951
     952    //*fLog << "MCt1ReadPreProc::ProcessEvent; fhourangle = "
     953    //      << event.fhourangle << endl;
    862954
    863955    fMcEvt->Fill(event.isecs_since_midday,     //0, /*fEvtNum*/
     
    877969                 fIsMcFile ? event.imcimpact_m*100 : 0,
    878970                 TMath::Pi()/180*event.iaz_arcs/3600, // azimuth (arcseconds)
    879                  TMath::Pi()*(0.5-1./180*event.ialt_arcs/3600), // altitude (arcseconds)
     971                 ThetaSmeared,
    880972                 0, /* fTFirst */
    881973                 0, /* fTLast */
     
    895987                 0, /* elec */
    896988                 0, /* muon */
    897                  event.fhourangle  /* other */
     989                 0  /* other */
    898990                 );
    899991
  • trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.h

    r1880 r1888  
    99#include "MRead.h"
    1010#endif
     11
     12#include <TRandom3.h>
    1113
    1214class TList;
     
    2224class MTaskList;
    2325class MParList;
     26class MParameterD;
    2427
    2528struct outputpars;
     
    4245    MRawRunHeader *fRawRunHeader; // raw run header
    4346    MParList      *fParList;      // parameter list
     47    MParameterD   *fHourAngle;    // hour angle [deg]
     48    MParameterD   *fThetaOrig;    // original zenith angle [rad]
    4449
    4550    Bool_t fIsMcFile;       // Flag whether current run is a MC run
     
    5358    TArrayF fPedRMS;
    5459
     60    TRandom3 ran3;
    5561
    5662    Bool_t OpenNextFile();
     
    7783    ~MCT1ReadPreProc();
    7884
    79     Int_t AddFile(const char *fname, Int_t dummy=-1);
     85    void AddFile(const char *fname);
    8086
    8187    UInt_t GetEntries() { return fEntries; }
     88
     89    Bool_t SmearTheta(MParList *plist, Float_t *theta, Float_t *thetasmeared);
    8290
    8391    ClassDef(MCT1ReadPreProc, 0) // Reads the CT1 preproc data file
     
    8694#endif
    8795
     96
     97
  • trunk/MagicSoft/Mars/mfileio/Makefile

    r1600 r1888  
    2020# @endcode
    2121
    22 INCLUDES = -I. -I../mbase -I../mraw -I../mmc -I../mdata -I../manalysis -I../mgeom
     22INCLUDES = -I. -I../mbase -I../mraw -I../mmc -I../mdata -I../manalysis -I../mgeom -I../mhist
    2323
    2424# @code
Note: See TracChangeset for help on using the changeset viewer.