Changeset 4691


Ignore:
Timestamp:
08/19/04 19:30:00 (20 years ago)
Author:
marcos
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mtemp/mucm/classes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mtemp/mucm/classes/MDataSetIter.cc

    r4683 r4691  
    719719    TString file;
    720720
    721     *fLog << endl << " pedestal runs: " << endl;
    722     *fLog << " -------------- " << endl;
     721    *fLog << all << endl << " pedestal runs: " << endl;
     722    *fLog << "---------------" << endl;
    723723    while( !(file=fPedRuns->Next()).IsNull() )
    724724        *fLog << file << endl;
     
    726726           
    727727    *fLog << endl << " calibration runs: " << endl;
    728     *fLog << " ----------------- " << endl;
     728    *fLog << "------------------" << endl;
    729729    while( !(file=fCalRuns->Next()).IsNull() )
    730730        *fLog << file << endl;
     
    732732
    733733    *fLog << endl << " data runs: " << endl;
    734     *fLog << "----------- " << endl;
     734    *fLog << "-----------" << endl;
    735735    while( !(file=fDataRuns->Next()).IsNull() )
    736736        *fLog << file << endl;
  • trunk/MagicSoft/Mars/mtemp/mucm/classes/MExtrapolatePointingPos.cc

    r4683 r4691  
    6666// ---------------------------------------------------------------------------
    6767//
    68 //
    69 //
    70 void MExtrapolatePointingPos::ReadDriveReport(const TString filename)
    71 {
     68// Read the drive report file for the whole night, a build from it the splines
     69//
     70Bool_t MExtrapolatePointingPos::ReadDriveReport(const TString filename)
     71{
     72
     73    *fLog << endl << "["<< GetName() << "]: Loading report file \"" << filename << "\" into TSpline..." << endl;
     74
    7275
    7376    //
    7477    // ParList
    75     // -------
    7678    //
    7779    MParList  plist;
     
    8284    //
    8385    // TaskList
    84     // --------
    85     //
    86     // Reads the trees of the root file and the analysed branches
     86    //
    8787    MReadReports read;
    8888    read.AddTree("Drive");
     
    9090    read.AddToBranchList("MReportDrive.*");
    9191   
    92     // Add all the task to the task list
    9392    tlist.AddToList(&read);
    9493 
    95    
    96    
     94   
    9795    //
    9896    // EventLoop
    99     // ---------
    10097    //
    10198    MEvtLoop evtloop;
    10299    evtloop.SetParList(&plist);
    103100
    104    
    105     //
    106     // Execute your analysis
    107     //
    108101    if (!evtloop.PreProcess())
    109         return;
    110 
    111 
    112     //
    113     // Store the ReportTime, CurrentZd, CurrentAz, Ra, Dec and Ha into arrays
    114     //
     102        return kFALSE;
     103
     104
    115105    TArrayD ReportTime(10000);
    116106    TArrayD CurrentZd(10000);
     
    120110    TArrayD Ra(10000);
    121111    TArrayD Dec(10000);
    122     TArrayD Ha(10000);
    123    
     112
    124113   
    125114    Int_t n=0;
    126 
    127115    while (tlist.Process())
    128116    {
    129        
    130117        MReportDrive* report = (MReportDrive*)plist.FindObject("MReportDrive");
    131118        MTime* reporttime = (MTime*)plist.FindObject("MTimeDrive");
     119       
     120        if(n==0)
     121            fFirstDriveTime = *reporttime;
     122        else
     123            fLastDriveTime = *reporttime;
    132124
    133125        //
     
    136128        if (reporttime->GetTime() == ReportTime[n-1])
    137129        {
    138             //cout << " *********** Error " << endl;
     130            cout << warn <<"["<< GetName() << "]: Warning: this report has the same time that the previous one...skipping it " << endl;
    139131            continue;
    140132        }
     
    147139        Ra[n] = report->GetRa();
    148140        Dec[n] = report->GetDec();
    149         Ha[n] = report->GetHa();
    150141
    151142        n++;
    152143    }
    153144
    154     //tlist.PrintStatistics();
     145    tlist.PrintStatistics();
     146
     147    *fLog << "["<< GetName() << "]: loaded " << n << " ReportDrive from "
     148          << fFirstDriveTime << " to " << fLastDriveTime << endl << endl;
    155149
    156150
     
    165159    Ra.Set(n);
    166160    Dec.Set(n);
    167     Ha.Set(n);
    168    
    169 
    170 
    171     //   for(int i=0;i<time.GetSize();i++)
    172 //       {
    173 //       cout << i << " " << time[i] << " " << Zd[i] << endl;
    174 //       }
    175161     
    176 
    177      
     162    // for(int i=0;i<ReportTime.GetSize();i++)
     163//      *fLog << i            << " " << ReportTime[i] << " "
     164//            << CurrentZd[i] << " " << CurrentAz[i]  << " "
     165//            << NominalZd[i] << " " << NominalAz[i]  << " "
     166//            << Ra[i]        << " " << Dec[i]        << endl;
     167   
    178168
    179169    fSplineZd = new TSpline3("zenith",
     
    186176                             ReportTime.GetArray(), Dec.GetArray(), n);
    187177
    188 
    189   //    TCanvas* c = new TCanvas();
    190 //      c->Divide(2,2);
    191 //      c->cd(1);
    192 //      fSplineZd->Draw();
    193 //      c->cd(2);
    194 //      fSplineAz->Draw();
    195 //      c->cd(3);
    196 //      fSplineRa->Draw();
    197 //      c->cd(4);
    198 //      fSplineDec->Draw();
     178   
     179   
     180   //  TCanvas* c = new TCanvas();
     181//     c->Divide(2,2);
     182//     c->cd(1);
     183//     fSplineZd->Draw();
     184//     c->cd(2);
     185//     fSplineAz->Draw();
     186//     c->cd(3);
     187//     fSplineRa->Draw();
     188//     c->cd(4);
     189//     fSplineDec->Draw();
     190//     c->Modified();
     191//     c->Update();
     192   
     193    return kTRUE;
    199194}
    200195
     
    202197// --------------------------------------------------------------------------
    203198//
    204 // default constructor
     199//  Constructor
    205200//
    206201MExtrapolatePointingPos::MExtrapolatePointingPos(const TString filename, const char *name, const char *title)
    207    
    208202{
    209203    fName  = name  ? name  : "MExtrapolatePointingPos";
    210204    fTitle = title ? title : "Task to calculate pedestals from pedestal runs raw data";
    211205
    212    
    213206    fFilename = filename;
     207
     208    // Init
     209    fSplineZd  = NULL;
     210    fSplineAz  = NULL;
     211    fSplineRa  = NULL;
     212    fSplineDec = NULL;
    214213}
    215214
    216215MExtrapolatePointingPos::~MExtrapolatePointingPos()
    217216{
    218     delete fSplineZd;
    219     delete fSplineAz;
    220     delete fSplineRa;   
    221     delete fSplineDec;
     217    if(fSplineZd)
     218        delete fSplineZd;
     219    if(fSplineAz)
     220        delete fSplineAz;
     221    if(fSplineRa)
     222        delete fSplineRa;   
     223    if(fSplineDec)
     224        delete fSplineDec;
    222225}
    223226
     
    252255
    253256
    254     ReadDriveReport(fFilename);
     257    if( !ReadDriveReport(fFilename) )
     258        return kFALSE;
    255259
    256260
     
    261265// --------------------------------------------------------------------------
    262266//
    263 // Fill the MPedestalCam container with the signal mean and rms for the event.
    264 // Store the measured signal in arrays fSumx and fSumx2 so that we can
    265 // calculate the overall mean and rms in the PostProcess()
     267//  Get the run start time, and get the pointing position for that time
    266268//
    267269Int_t MExtrapolatePointingPos::Process()
    268270{
    269271
    270     const MTime* StartRunTime  = &fRunHeader->GetRunStart();
    271     Int_t run = fRunHeader->GetRunNumber();
    272 
    273     Long_t time;
    274 
    275      //   if(run < 20000)
    276 //      time = fEvtTime->GetTime();
    277 //        else
    278         time = StartRunTime->GetTime();
    279 
    280 
    281  
    282    
    283     Double_t zd = fSplineZd->Eval( time );
    284     Double_t az = fSplineAz->Eval( time );
    285     Double_t ra = fSplineRa->Eval( time );
    286     Double_t dec = fSplineDec->Eval( time );
     272    //const Int_t run = fRunHeader->GetRunNumber();
     273    const MTime* StartRunTime = &fRunHeader->GetRunStart();
     274    const Double_t time = StartRunTime->GetTime();
     275
     276
     277    //
     278    // Check that we have drive report for this time
     279    //
     280    if( *StartRunTime<fFirstDriveTime || *StartRunTime>fLastDriveTime)
     281    {
     282        *fLog << err << dbginf << GetName() << ": Run time " << *StartRunTime
     283              << " outside range of drive reports  (" << fFirstDriveTime
     284              << ", " << fLastDriveTime << ")" << endl;
     285        return kFALSE;
     286    }
     287
     288    //if(run < 20000)
     289    //   time = fEvtTime->GetTime();
     290    //else
     291    //   time = StartRunTime->GetTime();
     292
     293
     294    const Double_t zd = fSplineZd->Eval( time );
     295    const Double_t az = fSplineAz->Eval( time );
     296    const Double_t ra = fSplineRa->Eval( time );
     297    const Double_t dec = fSplineDec->Eval( time );
    287298
    288299    fPointingPos->SetLocalPosition( zd, az );
    289300    fPointingPos->SetSkyPosition( ra*TMath::DegToRad()/15, dec*TMath::DegToRad());
    290301
    291     //  *fLog << " PointingPos: " << " time = " << time << " " << *fEvtTime << " (zd, az, ra, dec) = (" << zd << ", "  << az << ", " << ra << ", "  << dec << ")" << endl;
    292 
    293 
    294   return kTRUE;
    295 }
    296 
    297 
     302   //  *fLog << " PointingPos: time = " << time << " (" << *fEvtTime << ") (zd, az, ra, dec) = (" << zd << ", "  << az << ", " << ra << ", "  << dec << ")" << endl;
     303
     304
     305    return kTRUE;
     306}
     307
     308
  • trunk/MagicSoft/Mars/mtemp/mucm/classes/MExtrapolatePointingPos.h

    r4683 r4691  
    1818#endif
    1919
     20#ifndef MARS_MTime
     21#include "MTime.h"
     22#endif
     23
    2024
    2125class MTime;
     
    3034
    3135    TString fFilename;
     36    MTime  fFirstDriveTime;
     37    MTime  fLastDriveTime;
    3238
    3339    MTime  *fEvtTime;            // raw event time
     
    4349    Int_t PreProcess(MParList *pList);
    4450    Int_t Process();
    45    
     51    Bool_t ReadDriveReport(const TString filename);   
    4652
    4753
     
    5258    ~MExtrapolatePointingPos();
    5359
    54     void ReadDriveReport(const TString filename);
    55  
    5660
    5761    ClassDef(MExtrapolatePointingPos, 1) 
Note: See TracChangeset for help on using the changeset viewer.