Changeset 3069 for trunk/MagicSoft/Mars/mjobs
- Timestamp:
- 02/09/04 15:44:04 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mjobs
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
r3055 r3069 51 51 #include "MReadMarsFile.h" 52 52 #include "MGeomApply.h" 53 #include "MBadPixelsMerge.h" 53 54 #include "MExtractSignal.h" 54 55 #include "MExtractSignal2.h" … … 382 383 return kFALSE; 383 384 } 385 386 if (fBadPixels.Write()<=0) 387 { 388 *fLog << err << "Unable to write MBadPixelsCam to " << oname << endl; 389 return kFALSE; 390 } 391 384 392 return kTRUE; 385 393 … … 426 434 *fLog << "Unable to read MCalibrationCam from " << fname << endl; 427 435 return kFALSE; 436 } 437 438 if (file.FindKey("MBadPixelsCam")) 439 { 440 MBadPixelsCam bad; 441 if (bad.Read()<=0) 442 { 443 *fLog << "Unable to read MBadPixelsCam from " << fname << endl; 444 return kFALSE; 445 } 446 fBadPixels.Merge(bad); 428 447 } 429 448 … … 466 485 467 486 MGeomApply apply; 487 MBadPixelsMerge merge(&fBadPixels); 488 // MExtractSignal extract; // Do not use this at the moment... 468 489 MExtractSignal2 extract; 469 490 MCalibrationCalc calcalc; … … 476 497 //calcalc.SkipBlindPixelFit(); 477 498 499 tlist.AddToList(&read); 478 500 tlist.AddToList(&apply); 479 tlist.AddToList(& read);501 tlist.AddToList(&merge); 480 502 tlist.AddToList(&extract); 481 503 tlist.AddToList(&calcalc); -
trunk/MagicSoft/Mars/mjobs/MJCalibration.h
r3054 r3069 4 4 #ifndef MARS_MCalibrationCam 5 5 #include "MCalibrationCam.h" 6 #endif 7 #ifndef MARS_MBadPixelsCam 8 #include "MBadPixelsCam.h" 6 9 #endif 7 10 … … 21 24 22 25 MCalibrationCam fCalibrationCam; 26 MBadPixelsCam fBadPixels; 23 27 24 28 void DrawProjection(MHCamera *obj1, Int_t fit) const; … … 35 39 36 40 TString GetOutputFile() const; 37 MCalibrationCam &GetCalibrationCam() { return fCalibrationCam; } 41 42 const MCalibrationCam &GetCalibrationCam() const { return fCalibrationCam; } 43 const MBadPixelsCam &GetBadPixels() const { return fBadPixels; } 44 45 void SetBadPixels(MBadPixelsCam &bad) { bad.Copy(fBadPixels); } 38 46 39 47 Bool_t ReadCalibrationCam(); -
trunk/MagicSoft/Mars/mjobs/MJExtractSignal.cc
r2992 r3069 51 51 #include "MReadMarsFile.h" 52 52 #include "MGeomApply.h" 53 #include "MBadPixelsMerge.h" 53 54 #include "MExtractSignal.h" 54 55 #include "MFillH.h" … … 236 237 return kFALSE; 237 238 } 239 240 if (fBadPixels.Write()<=0) 241 { 242 *fLog << err << "Unable to write MBadPixelsCam to " << oname << endl; 243 return kFALSE; 244 } 245 238 246 return kTRUE; 239 247 … … 301 309 plist.AddToList(&tlist); 302 310 303 MGeomApply apply; // Only necessary to craete geometry 304 MExtractSignal extract; 311 MGeomApply apply; // Only necessary to craete geometry 312 MBadPixelsMerge merge(&fBadPixels); 313 MExtractSignal extract; 305 314 306 315 MHCamEvent evt("ExtSignal"); … … 313 322 write.AddContainer("MRawRunHeader", "RunHeaders"); 314 323 write.AddContainer("MPedestalCam", "RunHeaders"); 324 write.AddContainer("MBadPixelsCam", "RunHeaders"); 315 325 316 326 tlist.AddToList(&read); 317 327 tlist.AddToList(&apply); 328 tlist.AddToList(&merge); 318 329 tlist.AddToList(&extract); 319 330 if (TestBit(kEnableGraphicalOutput)) … … 365 376 } 366 377 378 if (file.FindKey("MBadPixelsCam")) 379 { 380 MBadPixelsCam bad; 381 if (bad.Read()<=0) 382 { 383 *fLog << "Unable to read MBadPixelsCam from " << fname << endl; 384 return kFALSE; 385 } 386 fBadPixels.Merge(bad); 387 } 388 367 389 if (fDisplay /*&& !fDisplay->GetCanvas("Pedestals")*/) // FIXME! 368 390 fDisplay->Read(); … … 406 428 plist.AddToList(&calcam); 407 429 plist.AddToList(&fPedPhotCam); 430 plist.AddToList(&fBadPixels); 408 431 409 432 MTaskList tlist; 410 433 plist.AddToList(&tlist); 411 434 412 MGeomApply apply; // Only necessary to craete geometry 413 MExtractSignal extract; 414 MCalibrate calib; 415 MPedPhotCalc calc; 435 MGeomApply apply; // Only necessary to craete geometry 436 MBadPixelsMerge merge(&fBadPixels); 437 MExtractSignal extract; 438 MCalibrate calib; 439 MPedPhotCalc calc; 416 440 417 441 MHCamEvent evt1("ExtOffset"); … … 424 448 tlist.AddToList(&read); 425 449 tlist.AddToList(&apply); 450 tlist.AddToList(&merge); 426 451 tlist.AddToList(&extract); 427 452 if (TestBit(kEnableGraphicalOutput)) -
trunk/MagicSoft/Mars/mjobs/MJExtractSignal.h
r2992 r3069 4 4 #ifndef MARS_MPedPhotCam 5 5 #include "MPedPhotCam.h" 6 #endif 7 #ifndef MARS_MBadPixelsCam 8 #include "MBadPixelsCam.h" 6 9 #endif 7 10 … … 21 24 MRunIter *fRuns; 22 25 23 MPedPhotCam fPedPhotCam; 26 MPedPhotCam fPedPhotCam; 27 MBadPixelsCam fBadPixels; 24 28 25 29 void DisplayResult(MParList &plist); … … 40 44 TString GetOutputFileD() const; 41 45 46 const MPedPhotCam &GetPedPhotCam() const { return fPedPhotCam; } 47 const MBadPixelsCam &GetBadPixels() const { return fBadPixels; } 48 49 void SetBadPixels(MBadPixelsCam &bad) { bad.Copy(fBadPixels); } 50 42 51 Bool_t ProcessD(MPedestalCam &pedcam); 43 52 Bool_t ProcessP(MPedestalCam &pedcam, MCalibrationCam &calcam); 44 45 const MPedPhotCam &GetPedPhotCam() const { return fPedPhotCam; }46 53 47 54 ClassDef(MJExtractSignal, 0) // Tool to create a pedestal file (MPedestalCam) -
trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
r3051 r3069 52 52 #include "MReadMarsFile.h" 53 53 #include "MGeomApply.h" 54 #include "MBadPixelsMerge.h" 54 55 #include "MPedCalcPedRun.h" 55 56 … … 87 88 if (fPedestalCam.Read()<=0) 88 89 { 89 *fLog << "Unable to read MPedestalCam from " << fname << endl; 90 return kFALSE; 90 *fLog << err << "Unable to read MPedestalCam from " << fname << endl; 91 return kFALSE; 92 } 93 94 if (file.FindKey("MBadPixelsCam")) 95 { 96 MBadPixelsCam bad; 97 if (bad.Read()<=0) 98 { 99 *fLog << err << "Unable to read MBadPixelsCam from " << fname << endl; 100 return kFALSE; 101 } 102 fBadPixels.Merge(bad); 91 103 } 92 104 … … 95 107 96 108 return kTRUE; 109 } 110 111 void MJPedestal::DrawProjection(MHCamera *obj1, Int_t fit) const 112 { 113 TH1D *obj2 = (TH1D*)obj1->Projection(); 114 obj2->Draw(); 115 obj2->SetBit(kCanDelete); 116 117 const Double_t min = obj2->GetBinCenter(obj2->GetXaxis()->GetFirst()); 118 const Double_t max = obj2->GetBinCenter(obj2->GetXaxis()->GetLast()); 119 const Double_t integ = obj2->Integral("width")/2.5066283; 120 const Double_t mean = obj2->GetMean(); 121 const Double_t rms = obj2->GetRMS(); 122 const Double_t width = max-min; 123 124 if (rms==0 || width==0) 125 return; 126 127 const TString dgausformula("([0]-[3])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])" 128 "+[3]/[5]*exp(-0.5*(x-[4])*(x-[4])/[5]/[5])"); 129 130 TF1 *f=0; 131 switch (fit) 132 { 133 // FIXME: MAYBE add function to TH1? 134 case 0: 135 f = new TF1("sgaus", "gaus(0)", min, max); 136 f->SetLineColor(kYellow); 137 f->SetBit(kCanDelete); 138 f->SetParNames("Area", "#mu", "#sigma"); 139 f->SetParameters(integ/rms, mean, rms); 140 f->SetParLimits(0, 0, integ); 141 f->SetParLimits(1, min, max); 142 f->SetParLimits(2, 0, width/1.5); 143 obj2->Fit(f, "QLRM"); 144 break; 145 146 case 1: 147 f = new TF1("dgaus", dgausformula, min, max); 148 f->SetLineColor(kYellow); 149 f->SetBit(kCanDelete); 150 f->SetParNames("A_{tot}", "#mu_{1}", "#sigma_{1}", "A_{2}", "#mu_{2}", "#sigma_{2}"); 151 f->SetParameters(integ, (min+mean)/2, width/4, 152 integ/width/2, (max+mean)/2, width/4); 153 // The left-sided Gauss 154 f->SetParLimits(0, integ-1.5, integ+1.5); 155 f->SetParLimits(1, min+(width/10), mean); 156 f->SetParLimits(2, 0, width/2); 157 // The right-sided Gauss 158 f->SetParLimits(3, 0, integ); 159 f->SetParLimits(4, mean, max-(width/10)); 160 f->SetParLimits(5, 0, width/2); 161 obj2->Fit(f, "QLRM"); 162 break; 163 164 default: 165 obj2->Fit("gaus", "Q"); 166 obj2->GetFunction("gaus")->SetLineColor(kYellow); 167 break; 168 } 169 } 170 171 void MJPedestal::CamDraw(TCanvas &c, Int_t x, Int_t y, MHCamera &cam1, Int_t fit) 172 { 173 c.cd(x); 174 gPad->SetBorderMode(0); 175 MHCamera *obj1=(MHCamera*)cam1.DrawCopy("hist"); 176 obj1->AddNotify(fPedestalCam); 177 178 c.cd(x+y); 179 gPad->SetBorderMode(0); 180 obj1->Draw(); 181 182 c.cd(x+2*y); 183 gPad->SetBorderMode(0); 184 DrawProjection(obj1, fit); 97 185 } 98 186 … … 123 211 124 212 disp0.SetCamContent(fPedestalCam, 0); 125 disp0.SetCamError(fPedestalCam, 1); 213 disp0.SetCamError (fPedestalCam, 1); 214 126 215 disp1.SetCamContent(fPedestalCam, 2); 127 disp1.SetCamError (fPedestalCam, 3);216 disp1.SetCamError (fPedestalCam, 3); 128 217 129 218 disp0.SetYTitle("P [fadc/slice]"); … … 136 225 c3.Divide(2,3); 137 226 138 *fLog << "BALBALBALBA" <<endl;139 140 227 CamDraw(c3, 1, 2, disp0, 0); 141 228 CamDraw(c3, 2, 2, disp1, 1); 142 143 } 144 145 146 void MJPedestal::DrawProjection(MHCamera *obj1, Int_t fit) const 147 { 148 149 TH1D *obj2 = (TH1D*)obj1->Projection(); 150 obj2->Draw(); 151 obj2->SetBit(kCanDelete); 152 153 const Double_t min = obj2->GetBinCenter(obj2->GetXaxis()->GetFirst()); 154 const Double_t max = obj2->GetBinCenter(obj2->GetXaxis()->GetLast()); 155 const Double_t integ = obj2->Integral("width")/2.5066283; 156 const Double_t mean = obj2->GetMean(); 157 const Double_t rms = obj2->GetRMS(); 158 const Double_t width = max-min; 159 160 if (rms == 0. || width == 0. ) 161 return; 162 163 const TString dgausformula = TString("([0]-[3])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])" 164 "+[3]/[5]*exp(-0.5*(x-[4])*(x-[4])/[5]/[5])"); 165 166 TF1 *f=0; 167 switch (fit) 168 { 169 case 0: 170 f = new TF1("sgaus","gaus(0)",min,max); 171 f->SetLineColor(kYellow); 172 f->SetBit(kCanDelete); 173 f->SetParNames("Area","#mu","#sigma"); 174 f->SetParameters(integ/rms,mean,rms); 175 f->SetParLimits(0, 0. , integ); 176 f->SetParLimits(1, min , max); 177 f->SetParLimits(2, 0 , width/1.5); 178 obj2->Fit(f,"QLRM"); 179 break; 180 181 case 1: 182 f = new TF1("dgaus",dgausformula.Data(),min,max); 183 f->SetLineColor(kYellow); 184 f->SetBit(kCanDelete); 185 f->SetParNames("A_{tot}","#mu_{1}","#sigma_{1}","A_{2}","#mu_{2}","#sigma_{2}"); 186 f->SetParameters(integ,(min+mean)/2.,width/4., 187 integ/width/2.,(max+mean)/2.,width/4.); 188 // The left-sided Gauss 189 f->SetParLimits(0,integ-1.5 , integ+1.5); 190 f->SetParLimits(1,min+(width/10.), mean); 191 f->SetParLimits(2,0 , width/2.); 192 // The right-sided Gauss 193 f->SetParLimits(3,0 , integ); 194 f->SetParLimits(4,mean, max-(width/10.)); 195 f->SetParLimits(5,0 , width/2.); 196 obj2->Fit(f,"QLRM"); 197 break; 198 199 default: 200 obj2->Fit("gaus","Q"); 201 obj2->GetFunction("gaus")->SetLineColor(kYellow); 202 break; 203 } 204 } 205 206 207 208 void MJPedestal::CamDraw(TCanvas &c, Int_t x, Int_t y, MHCamera &cam1, Int_t fit) 209 { 210 211 c.cd(x); 212 gPad->SetBorderMode(0); 213 MHCamera *obj1=(MHCamera*)cam1.DrawCopy("hist"); 214 obj1->AddNotify(fPedestalCam); 215 216 c.cd(x+y); 217 gPad->SetBorderMode(0); 218 obj1->Draw(); 219 ((MHCamera*)obj1)->SetPrettyPalette(); 220 221 c.cd(x+2*y); 222 gPad->SetBorderMode(0); 223 DrawProjection(obj1, fit); 224 225 } 226 229 } 227 230 228 231 Bool_t MJPedestal::WriteResult() … … 248 251 return kFALSE; 249 252 } 253 254 if (fBadPixels.Write()<=0) 255 { 256 *fLog << err << "Unable to write MBadPixelsCam to " << oname << endl; 257 return kFALSE; 258 } 259 250 260 return kTRUE; 251 261 } … … 298 308 plist.AddToList(&tlist); 299 309 300 MGeomApply geomapl; 310 MGeomApply geomapl; 311 MBadPixelsMerge merge(&fBadPixels); 301 312 //MExtractSignal sigcalc; 302 MPedCalcPedRun pedcalc;313 MPedCalcPedRun pedcalc; 303 314 304 315 tlist.AddToList(&read); 305 316 tlist.AddToList(&geomapl); 317 tlist.AddToList(&merge); 306 318 //tlist.AddToList(&sigcalc); 307 319 tlist.AddToList(&pedcalc); -
trunk/MagicSoft/Mars/mjobs/MJPedestal.h
r3051 r3069 4 4 #ifndef MARS_MPedestalCam 5 5 #include "MPedestalCam.h" 6 #endif 7 #ifndef MARS_MBadPixelsCam 8 #include "MBadPixelsCam.h" 6 9 #endif 7 10 … … 17 20 MRunIter *fRuns; 18 21 19 MPedestalCam fPedestalCam; 22 MPedestalCam fPedestalCam; 23 MBadPixelsCam fBadPixels; 20 24 25 Bool_t ReadPedestalCam(); 26 Bool_t WriteResult(); 27 21 28 void DrawProjection(MHCamera *obj1, Int_t fit) const; 22 29 void CamDraw(TCanvas &c, Int_t x, Int_t y, MHCamera &cam1, Int_t fit); 23 30 void DisplayResult(MParList &plist); 24 Bool_t WriteResult();25 31 26 32 public: … … 31 37 32 38 TString GetOutputFile() const; 33 MPedestalCam &GetPedestalCam() { return fPedestalCam; }34 39 35 Bool_t ReadPedestalCam(); 40 const MPedestalCam &GetPedestalCam() const { return fPedestalCam; } 41 const MBadPixelsCam &GetBadPixels() const { return fBadPixels; } 42 43 void SetBadPixels(MBadPixelsCam &bad) { bad.Copy(fBadPixels); } 44 36 45 Bool_t ProcessFile(); 37 46 Bool_t Process(); -
trunk/MagicSoft/Mars/mjobs/Makefile
r2992 r3069 23 23 # 24 24 INCLUDES = -I. -I../mbase -I../mgui -I../mgeom -I../mdata -I../mhbase \ 25 -I../mfileio -I../mfilter -I../manalysis -I../mhist -I../mcalib 25 -I../mfileio -I../mfilter -I../manalysis -I../mhist -I../mcalib \ 26 -I../mbadpixels 26 27 27 28 #manalysis: MChisqEval (MParameters)
Note:
See TracChangeset
for help on using the changeset viewer.