Changeset 8406
- Timestamp:
- 04/15/07 10:38:08 (18 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r8405 r8406 19 19 -*-*- END OF LINE -*-*- 20 20 21 2007/04/15 Thomas Bretz 22 23 * callisto.cc: 24 - added an option to write a movie 25 26 * mjobs/MJCalibrateSignal.[h,cc]: 27 - added the code to write a movie 28 - added new option (fIsMovieMode) to switch it on and off 29 30 * mmovie/MMovieData.h: 31 - added data member fMedianPedestalRms 32 33 * mmovie/MMoviePrepare.[h,cc]: 34 - added calculation of median pedestal rms 35 36 * mmovie/MMovieWrite.[h,cc]: 37 - added comments 38 - added return value to SetPalette 39 - delete palette entries after usage 40 - get median pedestal rms from MMovieData 41 42 43 21 44 2007/04/12 Daniela Dorner 22 45 … … 77 100 movie/MovieIncl.h: 78 101 - added 102 103 * mbase/MArrayB.h, mbase/MArrayD.h, mbase/MArrayF.h, mbase/MArrayI.h, 104 mbase/MArrayS.h: 105 - added Reset() member function or improved performance of it 106 107 * mcalib/MCalibrationChargeCalc.cc: 108 - fixed the alignment in an output 109 110 * mhbase/MBinning.h: 111 - added operator[] member function 112 113 * mhist/MHCamera.cc: 114 - changed such that it is allowed to use palettes with a different 115 number of contours. 116 - fixed the number of ticks written on the axis to 25 117 - use MBinnig to calculate the legend color boxes 118 - fixed a minor bug in the assignment of the color levels, which 119 gave visibly wrong result if the transition between two colors 120 was important but was not noticable in normal circumstances 121 122 * mjobs/MDataSet.h, mjobs/MSequence.h: 123 - increased class version to 1 to make it writable 124 - added Print to the context menu 125 126 * mgeom/MGeomCam.[h,cc]: 127 - removed fNumSectors 128 - removed fNumAreas 129 - added fNumPixInSector 130 - added fNumPixWithAidx 131 - changed CalcSectors and CalcArea to fill new data members 132 - fixed a bug in the range check of GetMaxRadius and GetMinRadius 133 (the range was to wide by 1 at the upper edge) 134 - increased class version from 4 to 5 79 135 80 136 -
trunk/MagicSoft/Mars/callisto.cc
r8245 r8406 83 83 gLog << " --use-test Apply calibration constants to same calibration" << endl; 84 84 gLog << " file (for testing, calibration mode only)" << endl; 85 gLog << " --movie Write a movie in addition to Mode-Y (this might " << endl; 86 gLog << " stop the eventloop before all evts are processed)" << endl; 85 87 gLog << " --moon Force using pedestal fits instead of calculated RMS" << endl; 86 88 gLog << " --config=callisto.rc Resource file [default=callisto.rc]" << endl; … … 170 172 const Bool_t kPrintFound = arg.HasOnlyAndRemove("--print-found"); 171 173 const Bool_t kUseTest = arg.HasOnlyAndRemove("--use-test"); 174 const Bool_t kMovie = arg.HasOnlyAndRemove("--movie"); 172 175 const Bool_t kDebugMem = arg.HasOnlyAndRemove("--debug-mem"); 173 176 Bool_t kMoon = arg.HasOnlyAndRemove("--moon"); … … 225 228 gLog << "specified! You can also give the operation mode by the options defining the" << endl; 226 229 gLog << "output path --outc, --outy or --out." << endl; 230 Usage(); 231 return 2; 232 } 233 if (!kModeY && kMovie) 234 { 235 gLog << err << "Signal extraction mode (-y) not switched on but movie requested." << endl; 227 236 Usage(); 228 237 return 2; … … 626 635 job4.SetPathOut(kOutpathY); 627 636 job4.SetDataType(kDataType); 637 job4.SetMovieMode(kMovie); 628 638 if (kDataType!=MJCalib::kIsUseMC) 629 639 job4.SetExtractor(job2.GetExtractor()); -
trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc
r8396 r8406 112 112 #include "MWriteRootFile.h" 113 113 114 /* 115 #include "MFEvtNumber.h" 116 #include "MMoviePrepare.h" 117 #include "MMovieWrite.h" 118 #include "MImgCleanStd.h" 119 */ 114 #include "MFEvtNumber.h" 115 #include "MMoviePrepare.h" 116 #include "MMovieWrite.h" 117 #include "MImgCleanStd.h" 120 118 121 119 ClassImp(MJCalibrateSignal); … … 134 132 // 135 133 MJCalibrateSignal::MJCalibrateSignal(const char *name, const char *title) 136 : fExtractor(0), fIsInterlaced(kTRUE), fIsRelTimesUpdate(kFALSE) 134 : fExtractor(0), fIsInterlaced(kTRUE), fIsRelTimesUpdate(kFALSE), fIsMovieMode(kFALSE) 137 135 { 138 136 fName = name ? name : "MJCalibrateSignal"; … … 224 222 SetInterlaced(GetEnv("Interlaced", fIsInterlaced)); 225 223 SetRelTimesUpdate(GetEnv("RelTimesUpdate", fIsRelTimesUpdate)); 224 SetMovieMode(GetEnv("MovieMode", fIsMovieMode)); 226 225 227 226 return MJCalib::CheckEnvLocal(); … … 802 801 803 802 tlist2.AddToList(&fillP); 804 805 // --- Start: Code for encoding movies ---806 807 MMoviePrepare movprep;808 MMovieWrite movwrite;809 movprep.SetRangeFromExtractor(*extractor1);810 811 MFDataPhrase movfilt("MMovieData.fMax>150");812 813 MImgCleanStd movclean(8.5, 4.0);814 movclean.SetMethod(MImgCleanStd::kAbsolute);815 816 //movprep.SetFilter(&evtnum);817 movclean.SetFilter(&movfilt);818 movwrite.SetFilter(&movfilt);819 820 MTaskList tlistmov;821 tlistmov.AddToList(&movprep);822 tlistmov.AddToList(&movfilt);823 tlistmov.AddToList(&movclean);824 tlistmov.AddToList(&movwrite);825 826 MFEvtNumber evtnum;827 //evtnum.SetFileName("ganymed00000001.root");828 tlistmov.SetFilter(&evtnum);829 830 //tlist2.AddToList(&evtnum);831 //tlist2.AddToList(&tlistmov);832 833 // --- End: Code for encoding movies ---834 803 */ 804 805 // ----- Start: Code for encoding movies ----- 806 807 MMoviePrepare movprep; 808 MMovieWrite movwrite; 809 movprep.SetRangeFromExtractor(*extractor1); 810 811 //MFDataPhrase movfilt("MMovieData.fMax>150"); 812 MFDataPhrase movfilt("MMovieData.fMax>5*MMovieData.fMedianPedestalRms", "MovieFilter"); 813 814 MImgCleanStd movclean(8.5, 4.0); 815 movclean.SetMethod(MImgCleanStd::kAbsolute); 816 817 //movprep.SetFilter(&evtnum); 818 movclean.SetFilter(&movfilt); 819 movwrite.SetFilter(&movfilt); 820 821 MTaskList tlistmov; 822 tlistmov.AddToList(&movprep); 823 tlistmov.AddToList(&movfilt); 824 tlistmov.AddToList(&movclean); 825 tlistmov.AddToList(&movwrite); 826 827 MFEvtNumber evtnum; 828 //evtnum.SetSelector("ThetaSquared.fVal<0.04"); 829 //evtnum.SetFileName("ganymed00000001.root"); 830 tlistmov.SetFilter(&evtnum); 831 832 if (fIsMovieMode) 833 { 834 tlist2.AddToList(&evtnum); 835 tlist2.AddToList(&tlistmov); 836 } 837 838 // ----- End: Code for encoding movies ----- 835 839 836 840 tlist2.AddToList(&fillflorian); -
trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.h
r6979 r8406 24 24 Bool_t fIsInterlaced; // Distinguish interlaced from other calibration 25 25 Bool_t fIsRelTimesUpdate; // Choose to update relative times from interlaced 26 26 Bool_t fIsMovieMode; // Choose to encode a movie 27 27 28 Bool_t CheckEnvLocal(); 28 29 … … 37 38 38 39 public: 39 40 40 MJCalibrateSignal(const char *name=NULL, const char *title=NULL); 41 41 ~MJCalibrateSignal(); … … 43 43 Bool_t Process(MPedestalCam &camab, MPedestalCam &cam1, MPedestalCam &cam2); 44 44 45 void SetInterlaced ( const Bool_t b=kTRUE ) { fIsInterlaced = b; } 46 void SetRelTimesUpdate ( const Bool_t b=kTRUE ) { fIsRelTimesUpdate = b; } 45 void SetInterlaced (const Bool_t b=kTRUE) { fIsInterlaced = b; } 46 void SetRelTimesUpdate(const Bool_t b=kTRUE) { fIsRelTimesUpdate = b; } 47 void SetMovieMode (const Bool_t b=kTRUE) { fIsMovieMode = b; } 47 48 48 49 void SetExtractor(const MExtractor *ext=NULL); -
trunk/MagicSoft/Mars/mmovie/MMovieData.h
r8397 r8406 23 23 24 24 Float_t fMax; 25 Float_t fMedianPedestalRms; 25 26 UInt_t fNumSlices; 26 27 … … 41 42 Float_t GetMax() const { return fMax; } 42 43 44 void SetMedianPedestalRms(Float_t m) { fMedianPedestalRms = m; } 45 Float_t GetMedianPedestalRms() const { return fMedianPedestalRms; } 46 43 47 void SetNumSlices(UInt_t n) { fNumSlices=n; } 44 48 UInt_t GetNumSlices() const { return fNumSlices; } -
trunk/MagicSoft/Mars/mmovie/MMoviePrepare.cc
r8397 r8406 48 48 // MGeomCam 49 49 // MPedestalSubtractedEvt 50 // MPedestalFundamental [MPedestalCam] 50 51 // MCalibrateData 51 52 // MCalibrationRelTimeCam … … 70 71 #include "MGeomCam.h" 71 72 #include "MGeomPix.h" 73 74 #include "MPedestalCam.h" 75 #include "MPedestalPix.h" 76 72 77 73 78 #include "MCalibrationRelTimeCam.h" … … 78 83 #include "MRawRunHeader.h" 79 84 #include "MCalibrateData.h" 80 //#include "MExtractedSignalCam.h"81 85 #include "MPedestalSubtractedEvt.h" 82 86 … … 111 115 // MGeomCam 112 116 // MPedestalSubtractedEvt 117 // MPedestalFundamental [MPedestalCam] 113 118 // MCalibrateData 114 119 // MCalibrationRelTimeCam … … 132 137 return kFALSE; 133 138 } 139 fPed = (MPedestalCam*)plist->FindObject("MPedestalFundamental", "MPedestalCam"); 140 if (!fPed) 141 { 142 *fLog << err << "MPedestalFundamental [MPedestalCam] not found ... aborting." << endl; 143 return kFALSE; 144 } 134 145 fCal = (MCalibrateData*)plist->FindTaskListWithTask("MCalibrateData")->FindTask("MCalibrateData"); 135 146 if (!fCal) … … 184 195 const MArrayF &calco = fCal->GetCalibConsts(); 185 196 186 Int_t n = fCam->GetNumPixWithA rea(0);187 188 MArrayF calco0(n);197 Int_t n = fCam->GetNumPixWithAidx(0); 198 199 MArrayF arr(n); 189 200 190 201 for (UInt_t i=0; i<fCam->GetNumPixels(); i++) 191 202 if ((*fCam)[i].GetAidx()==0) 192 calco0[--n] = calco[i]; 193 194 return TMath::Median(calco0.GetSize(), calco0.GetArray()); 203 arr[--n] = calco[i]; 204 205 return TMath::Median(arr.GetSize(), arr.GetArray()); 206 } 207 208 // -------------------------------------------------------------------------- 209 // 210 // Return the median of the pedestal rms of all pixels with area index 0 211 // 212 Double_t MMoviePrepare::GetMedianPedestalRms() const 213 { 214 Int_t n = fCam->GetNumPixWithAidx(0); 215 216 MArrayF rms(n); 217 218 for (UInt_t i=0; i<fCam->GetNumPixels(); i++) 219 if ((*fCam)[i].GetAidx()==0) 220 rms[--n] = (*fPed)[i].GetPedestalRms(); 221 222 return TMath::Median(rms.GetSize(), rms.GetArray()); 195 223 } 196 224 … … 252 280 fOut->SetMax(max); 253 281 fOut->SetNumSlices(width); 282 fOut->SetMedianPedestalRms(GetMedianPedestalRms()); 254 283 255 284 return kTRUE; -
trunk/MagicSoft/Mars/mmovie/MMoviePrepare.h
r8397 r8406 9 9 class MExtractor; 10 10 class MMovieData; 11 class MSignalCam; 12 class MRawEvtHeader; 11 class MPedestalCam; 13 12 class MRawRunHeader; 14 13 class MCalibrateData; … … 24 23 MRawRunHeader *fRun; //! Run Header (sampling frequency) 25 24 MGeomCam *fCam; //! Pixel size 26 // MCalibConstCam *fCal; 25 MPedestalCam *fPed; //! Fundamental pedestal (slice by slice) 27 26 28 27 MMovieData *fOut; //! Prepared output container … … 31 30 UInt_t fLastSlice; 32 31 33 //Float_t fSlope;34 35 32 // MTask 36 33 Int_t PreProcess(MParList *plist); 37 //Bool_t ReInit(MParList *plist);38 34 Int_t Process(); 39 35 … … 43 39 // MMoviePrepare 44 40 Double_t GetMedianCalibConst() const; 41 Double_t GetMedianPedestalRms() const; 45 42 46 43 public: … … 53 50 54 51 #endif 55 -
trunk/MagicSoft/Mars/mmovie/MMovieWrite.cc
r8397 r8406 60 60 // 61 61 // The interpolation of the frames is done using a TSpline3. If the spline 62 // would extrapolate the contents is set to zero. Unsuitable pixels are 63 // interpolated frame by frame using the surrounding suitable pixels. 64 // 65 // 66 // Input: 67 // - MGeomCam 68 // - MRawRunHeader 69 // - MRawEvtHeader 70 // - MSignalCam 71 // - MBadPixelsCam 72 // - MPedestalFundamental [MPedestalCam] 73 // - MMovieData 62 // would extrapolate due to the shift by the relative time calibration the 63 // contents is set to zero. Unsuitable pixels are interpolated frame by 64 // frame using the surrounding suitable pixels. 65 // 66 // A few words about file size: MPEG is a motion compensation compression, 67 // which means that if a region of a past frame is shown again at the same 68 // place or somewhere else this region is referenced instead of encoded again. 69 // This means that in our case (almost all frames are identical!) the 70 // increase of file size is far from linear with the number of encoded events! 71 // 72 // 73 // Input: 74 // MGeomCam 75 // MRawRunHeader 76 // MRawEvtHeader 77 // MSignalCam 78 // MBadPixelsCam 79 // MMovieData 74 80 // 75 81 ///////////////////////////////////////////////////////////////////////////// … … 91 97 #include "MGeomCam.h" 92 98 #include "MGeomPix.h" 93 94 #include "MPedestalCam.h"95 #include "MPedestalPix.h"96 99 97 100 #include "MH.h" … … 117 120 // 118 121 MMovieWrite::MMovieWrite(const char *name, const char *title) 119 : fPipe(0), fTargetLength(5), fThreshold(2), fNumEvents( 1000), fFilename("movie.mpg")122 : fPipe(0), fTargetLength(5), fThreshold(2), fNumEvents(25000), fFilename("movie.mpg") 120 123 { 121 124 fName = name ? name : "MMovieWrite"; … … 172 175 173 176 fPipe = gSystem->OpenPipe(name, "w"); 174 if (fPipe) 175 return kTRUE; 176 177 *fLog << err; 178 *fLog << "Pipe: " << name << endl; 179 *fLog << "Couldn't open pipe... aborting." << endl; 180 CheckPipe(); 181 return kFALSE; 177 if (!fPipe) 178 { 179 *fLog << err; 180 *fLog << "Pipe: " << name << endl; 181 *fLog << "Couldn't open pipe... aborting." << endl; 182 CheckPipe(); 183 return kFALSE; 184 } 185 186 *fLog << inf << "Setup pipe to ppmtoy4m and mpeg2enc to encode " << fFilename << "." << endl; 187 188 return kTRUE; 182 189 183 190 // 1: 37M name += "-f 9 -E 40 -H -4 1 -2 1 --dualprime-mpeg2"; … … 229 236 // - MSignalCam 230 237 // - MBadPixelsCam 231 // - MPedestalFundamental [MPedestalCam]232 238 // - MMovieData 233 239 // … … 265 271 { 266 272 *fLog << err << "MBadPixelsCam not found ... aborting." << endl; 267 return kFALSE;268 }269 fPed = (MPedestalCam*)plist->FindObject("MPedestalFundamental", "MPedestalCam");270 if (!fPed)271 {272 *fLog << err << "MPedestalFundamental [MPedestalCam] not found ... aborting." << endl;273 273 return kFALSE; 274 274 } … … 317 317 // and everything above gets colors. 318 318 // 319 voidMMovieWrite::SetPalette(Double_t rms, const TH1 &h) const319 Int_t MMovieWrite::SetPalette(Double_t rms, const TH1 &h) const 320 320 { 321 321 const Double_t min = h.GetMinimum(); … … 335 335 336 336 TArrayI col(99); 337 gStyle->CreateGradientColorTable(6, s, r, g, b, col.GetSize()); 337 338 const Int_t rc = gStyle->CreateGradientColorTable(6, s, r, g, b, col.GetSize()); 338 339 339 340 // --- Overwrite the 'underflow' bin with white --- … … 347 348 348 349 gStyle->SetPalette(col.GetSize(), col.GetArray()); 350 351 return rc; 352 } 353 354 // -------------------------------------------------------------------------- 355 // 356 // The created colors are not overwritten and must be deleted manually 357 // because having more than 32768 color in a palette will crash 358 // gPad->PaintBox 359 // 360 void MMovieWrite::DeletePalette(Int_t colidx) const 361 { 362 for (int i=0; i<99; i++) 363 { 364 TColor *col = gROOT->GetColor(colidx+i); 365 if (col) 366 delete col; 367 } 349 368 } 350 369 … … 563 582 // -------------------------------------------------------------------------- 564 583 // 565 // Return the median of the pedestal rms of all pixels with area index 0566 //567 Double_t MMovieWrite::GetMedianPedestalRms() const568 {569 Int_t n = fCam->GetNumPixWithAidx(0);570 571 MArrayF rms(n);572 573 for (UInt_t i=0; i<fCam->GetNumPixels(); i++)574 if ((*fCam)[i].GetAidx()==0)575 rms[--n] = (*fPed)[i].GetPedestalRms();576 577 return TMath::Median(rms.GetSize(), rms.GetArray());578 }579 580 // --------------------------------------------------------------------------581 //582 584 Bool_t MMovieWrite::Process(TH1 &h, TVirtualPad &c) 583 585 { … … 589 591 //const Float_t len = (slices-2)/freq; // [ns] length of data stream in data-time 590 592 591 const Double_t rms = GetMedianPedestalRms();593 const Double_t rms = fIn->GetMedianPedestalRms(); 592 594 593 595 h.SetMinimum(fIn->GetMax()-(fIn->GetMax()-rms)*99/98); // rms0 … … 601 603 602 604 // Set new adapted palette for further rendering 603 SetPalette(rms, h);605 const Int_t colidx = SetPalette(rms, h); 604 606 605 607 // Get the pad containing the camera with the movie … … 638 640 return kFALSE; 639 641 } 642 643 DeletePalette(colidx); 640 644 641 645 cout << setw(3) << GetNumExecutions() << ": " << Form("%6.2f", (float)numframes/(slices-2)) << " f/sl " << slices << " " << numframes+1 << endl; -
trunk/MagicSoft/Mars/mmovie/MMovieWrite.h
r8397 r8406 54 54 void TreatBadPixels(TH1 &h) const; 55 55 56 void SetPalette(Double_t rms, const TH1 &h) const; 56 Int_t SetPalette(Double_t rms, const TH1 &h) const; 57 void DeletePalette(Int_t colidx) const; 57 58 58 59 void UpdateImage(TASImage &img, TVirtualPad &pad);
Note:
See TracChangeset
for help on using the changeset viewer.