Ignore:
Timestamp:
05/31/05 11:53:09 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mpointing/MPointingPosCalc.cc

    r5583 r7115  
    3434//  * Real Data: Copy the nominal poiting position (Nominal Zd, Nominal Az
    3535//               in MReportDrive) to MPointingPosition
     36//
     37// We do a trick: Because it is not guranteed, that MReadReports calls
     38//  ReInit before the first event from the drive-tree is read (because
     39//  the first data event may have a time-stamp later than the first
     40//  drive event) we always assume that the current run is a data run.
     41//  If the assumption is true fReport should be initialized correctly.
     42//  For MC runs this should never happen, Because they are read though
     43//  MReadMarsFile which gurantees, that ReInit is always called before
     44//  Process. If we encounter such a case we stop execution.
    3645//
    3746// Future: Interpolate the pointing position for each event between two
     
    8190    {
    8291    case MRawRunHeader::kRTData:
    83         fReport = (MReportDrive*)plist->FindObject("MReportDrive");
    8492        if (!fReport)
    8593        {
     
    121129{
    122130    fPosition = (MPointingPos*)plist->FindCreateObj("MPointingPos");
     131    fReport   = (MReportDrive*)plist->FindObject("MReportDrive");
     132
     133    // We use kRTNone here as a placeholder for data runs.
     134    fRunType  = MRawRunHeader::kRTNone;
     135
    123136    return fPosition ? kTRUE : kFALSE;
    124137}
     
    130143Int_t MPointingPosCalc::Process()
    131144{
    132     if (!fReport && fRunType == MRawRunHeader::kRTData)
    133     {
    134         *fLog << warn << "WARNING - MPointingPosCalc::Process was called BEFORE the first" << endl;
    135         *fLog <<         "          data event was read (means ReInit was executed!" << endl;
    136         return kTRUE;
    137     }
    138 
    139145    switch (fRunType)
    140146    {
     147    case MRawRunHeader::kRTNone:
    141148    case MRawRunHeader::kRTData:
     149        if (!fReport)
     150        {
     151            *fLog << warn;
     152            *fLog << "MPointingPosCalc::Process: fReport==NULL && fRunType!=kRTMonteCarlo... abort!" << endl;
     153            return kERROR;
     154        }
    142155        fPosition->SetLocalPosition(fReport->GetNominalZd(), fReport->GetNominalAz());
    143156        fPosition->SetSkyPosition(fReport->GetRa(), fReport->GetDec());
     
    145158
    146159    case MRawRunHeader::kRTMonteCarlo:
     160        if (!fMcEvt)
     161        {
     162            *fLog << warn;
     163            *fLog << "MPointingPosCalc::Process: fMcEvt==NULL && fRunType==kRTMonteCarlo... abort!" << endl;
     164            return kERROR;
     165        }
    147166        fPosition->SetLocalPosition(fMcEvt->GetTelescopeTheta()*TMath::RadToDeg(), fMcEvt->GetTelescopePhi()*TMath::RadToDeg());
    148167        return kTRUE;
Note: See TracChangeset for help on using the changeset viewer.