- Timestamp:
- 08/19/04 19:30:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mtemp/mucm/classes/MExtrapolatePointingPos.cc
r4683 r4691 66 66 // --------------------------------------------------------------------------- 67 67 // 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 // 70 Bool_t MExtrapolatePointingPos::ReadDriveReport(const TString filename) 71 { 72 73 *fLog << endl << "["<< GetName() << "]: Loading report file \"" << filename << "\" into TSpline..." << endl; 74 72 75 73 76 // 74 77 // ParList 75 // -------76 78 // 77 79 MParList plist; … … 82 84 // 83 85 // TaskList 84 // -------- 85 // 86 // Reads the trees of the root file and the analysed branches 86 // 87 87 MReadReports read; 88 88 read.AddTree("Drive"); … … 90 90 read.AddToBranchList("MReportDrive.*"); 91 91 92 // Add all the task to the task list93 92 tlist.AddToList(&read); 94 93 95 96 94 97 95 // 98 96 // EventLoop 99 // ---------100 97 // 101 98 MEvtLoop evtloop; 102 99 evtloop.SetParList(&plist); 103 100 104 105 //106 // Execute your analysis107 //108 101 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 115 105 TArrayD ReportTime(10000); 116 106 TArrayD CurrentZd(10000); … … 120 110 TArrayD Ra(10000); 121 111 TArrayD Dec(10000); 122 TArrayD Ha(10000); 123 112 124 113 125 114 Int_t n=0; 126 127 115 while (tlist.Process()) 128 116 { 129 130 117 MReportDrive* report = (MReportDrive*)plist.FindObject("MReportDrive"); 131 118 MTime* reporttime = (MTime*)plist.FindObject("MTimeDrive"); 119 120 if(n==0) 121 fFirstDriveTime = *reporttime; 122 else 123 fLastDriveTime = *reporttime; 132 124 133 125 // … … 136 128 if (reporttime->GetTime() == ReportTime[n-1]) 137 129 { 138 //cout << " *********** Error" << endl;130 cout << warn <<"["<< GetName() << "]: Warning: this report has the same time that the previous one...skipping it " << endl; 139 131 continue; 140 132 } … … 147 139 Ra[n] = report->GetRa(); 148 140 Dec[n] = report->GetDec(); 149 Ha[n] = report->GetHa();150 141 151 142 n++; 152 143 } 153 144 154 //tlist.PrintStatistics(); 145 tlist.PrintStatistics(); 146 147 *fLog << "["<< GetName() << "]: loaded " << n << " ReportDrive from " 148 << fFirstDriveTime << " to " << fLastDriveTime << endl << endl; 155 149 156 150 … … 165 159 Ra.Set(n); 166 160 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 // }175 161 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 178 168 179 169 fSplineZd = new TSpline3("zenith", … … 186 176 ReportTime.GetArray(), Dec.GetArray(), n); 187 177 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; 199 194 } 200 195 … … 202 197 // -------------------------------------------------------------------------- 203 198 // 204 // default constructor199 // Constructor 205 200 // 206 201 MExtrapolatePointingPos::MExtrapolatePointingPos(const TString filename, const char *name, const char *title) 207 208 202 { 209 203 fName = name ? name : "MExtrapolatePointingPos"; 210 204 fTitle = title ? title : "Task to calculate pedestals from pedestal runs raw data"; 211 205 212 213 206 fFilename = filename; 207 208 // Init 209 fSplineZd = NULL; 210 fSplineAz = NULL; 211 fSplineRa = NULL; 212 fSplineDec = NULL; 214 213 } 215 214 216 215 MExtrapolatePointingPos::~MExtrapolatePointingPos() 217 216 { 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; 222 225 } 223 226 … … 252 255 253 256 254 ReadDriveReport(fFilename); 257 if( !ReadDriveReport(fFilename) ) 258 return kFALSE; 255 259 256 260 … … 261 265 // -------------------------------------------------------------------------- 262 266 // 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 266 268 // 267 269 Int_t MExtrapolatePointingPos::Process() 268 270 { 269 271 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 ); 287 298 288 299 fPointingPos->SetLocalPosition( zd, az ); 289 300 fPointingPos->SetSkyPosition( ra*TMath::DegToRad()/15, dec*TMath::DegToRad()); 290 301 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
Note:
See TracChangeset
for help on using the changeset viewer.