- Timestamp:
- 10/15/02 17:02:46 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 44 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1539 r1540 85 85 - added some comments 86 86 87 * manalysis/MImgCleanStd.cc: 88 - pixels with to many 'used' neighbors are left used 87 89 88 90 -
trunk/MagicSoft/Mars/NEWS
r1503 r1540 76 76 - PrintStatistics can now be instructud to print also the title, too: 77 77 use PrintStatistics(0, kTRUE) 78 79 - Changed the image cleaning so that pixels with to many 'used' 80 neighbors are left used (to get rid of 'holes' in events) 81 78 82 79 83 -
trunk/MagicSoft/Mars/macros/readMagic.C
r1325 r1540 46 46 } 47 47 48 void readMagic(const char *fname="~/data/ camera.root")48 void readMagic(const char *fname="~/data/Gamma_0_7*.root") 49 49 { 50 50 MParList plist; 51 51 52 52 MGeomCamMagic geomcam; 53 MHillas 53 MHillasExt hillas; 54 54 MTaskList tlist; 55 55 … … 59 59 60 60 MReadMarsFile read("Events", fname); 61 read.DisableAutoScheme(); 61 62 63 MPrint print("MMcEvt"); 62 64 MMcPedestalCopy pcopy; 63 65 MMcPedestalNSBAdd pnsb; 64 66 MCerPhotCalc ncalc; 67 MBlindPixelCalc blind; 68 blind.SetUseInterpolation(); 65 69 MClone clone("MCerPhotEvt"); 66 70 MImgCleanStd clean; 67 MBlindPixelCalc blind;68 71 MHillasCalc hcalc; 69 72 70 73 71 74 tlist.AddToList(&read); 75 tlist.AddToList(&print); 72 76 tlist.AddToList(&pcopy); 73 77 tlist.AddToList(&pnsb); 74 78 tlist.AddToList(&ncalc); 79 tlist.AddToList(&blind); 75 80 tlist.AddToList(&clone); 76 81 tlist.AddToList(&clean); 77 tlist.AddToList(&blind);78 82 tlist.AddToList(&hcalc); 79 83 -
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc
r1438 r1540 34 34 35 35 #include "MGeomCam.h" 36 #include "MGeomPix.h"37 36 38 37 ClassImp(MCerPhotEvt); … … 159 158 return -5.; 160 159 161 const Float_t A0 = geom ? (*geom)[0].GetA() : 0;162 163 160 Float_t minval = (*this)[0].GetNumPhotons(); 164 161 … … 170 167 171 168 if (geom) 172 testval *= A0/(*geom)[pix.GetPixId()].GetA();169 testval *= geom->GetPixRatio(pix.GetPixId()); 173 170 174 171 if (testval < minval) … … 190 187 return 50.; 191 188 192 const Float_t A0 = geom ? (*geom)[0].GetA() : 0;193 189 Float_t maxval = (*this)[0].GetNumPhotons(); 194 190 … … 200 196 201 197 if (geom) 202 testval *= A0/(*geom)[pix.GetPixId()].GetA();198 testval *= geom->GetPixRatio(pix.GetPixId()); 203 199 204 200 if (testval > maxval) … … 208 204 } 209 205 206 // -------------------------------------------------------------------------- 207 // 208 // get the minimum ratio of photons/error 209 // 210 Float_t MCerPhotEvt::GetRatioMin() const 211 { 212 if (fNumPixels <= 0) 213 return -5.; 214 215 Float_t minval = (*this)[0].GetNumPhotons()/(*this)[0].GetErrorPhot(); 216 217 for (UInt_t i=1; i<fNumPixels; i++) 218 { 219 const MCerPhotPix &pix = (*this)[i]; 220 221 Float_t testval = pix.GetNumPhotons()/pix.GetErrorPhot(); 222 if (testval < minval) 223 minval = testval; 224 } 225 226 return minval; 227 } 228 229 // -------------------------------------------------------------------------- 230 // 231 // get the maximum ratio of photons/error 232 // 233 Float_t MCerPhotEvt::GetRatioMax() const 234 { 235 if (fNumPixels <= 0) 236 return -5.; 237 238 Float_t maxval = (*this)[0].GetNumPhotons()/(*this)[0].GetErrorPhot(); 239 240 for (UInt_t i=1; i<fNumPixels; i++) 241 { 242 const MCerPhotPix &pix = (*this)[i]; 243 244 Float_t testval = pix.GetNumPhotons()/pix.GetErrorPhot(); 245 if (testval > maxval) 246 maxval = testval; 247 } 248 249 return maxval; 250 } 251 252 // -------------------------------------------------------------------------- 253 // 254 // get the minimum of error 255 // If you specify a geometry the number of photons is weighted with the 256 // area of the pixel 257 // 258 Float_t MCerPhotEvt::GetErrorPhotMin(const MGeomCam *geom) const 259 { 260 if (fNumPixels <= 0) 261 return 50.; 262 263 Float_t minval = (*this)[0].GetErrorPhot(); 264 265 for (UInt_t i=1; i<fNumPixels; i++) 266 { 267 const MCerPhotPix &pix = (*this)[i]; 268 269 Float_t testval = pix.GetErrorPhot(); 270 271 if (geom) 272 testval *= geom->GetPixRatio(pix.GetPixId()); 273 274 if (testval < minval) 275 minval = testval; 276 } 277 return minval; 278 } 279 280 // -------------------------------------------------------------------------- 281 // 282 // get the maximum ratio of photons/error 283 // If you specify a geometry the number of photons is weighted with the 284 // area of the pixel 285 // 286 Float_t MCerPhotEvt::GetErrorPhotMax(const MGeomCam *geom) const 287 { 288 if (fNumPixels <= 0) 289 return 50.; 290 291 Float_t maxval = (*this)[0].GetErrorPhot(); 292 293 for (UInt_t i=1; i<fNumPixels; i++) 294 { 295 const MCerPhotPix &pix = (*this)[i]; 296 297 Float_t testval = pix.GetErrorPhot(); 298 299 if (geom) 300 testval *= geom->GetPixRatio(pix.GetPixId()); 301 302 if (testval > maxval) 303 maxval = testval; 304 } 305 return maxval; 306 } 307 -
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h
r1268 r1540 38 38 Float_t GetNumPhotonsMax(const MGeomCam *geom=NULL) const; 39 39 40 Float_t GetRatioMin() const; 41 Float_t GetRatioMax() const; 42 43 Float_t GetErrorPhotMin(const MGeomCam *geom=NULL) const; 44 Float_t GetErrorPhotMax(const MGeomCam *geom=NULL) const; 45 40 46 MCerPhotPix &operator[](int i) { return *(MCerPhotPix*)(fPixels->UncheckedAt(i)); } 41 47 MCerPhotPix &operator[](int i) const { return *(MCerPhotPix*)(fPixels->UncheckedAt(i)); } -
trunk/MagicSoft/Mars/manalysis/MHillas.cc
r1528 r1540 220 220 // In case you don't call Calc from within an eventloop make sure, that 221 221 // you call the Reset member function before. 222 // 223 Bool_t MHillas::Calc(const MGeomCam &geom, const MCerPhotEvt &evt) 222 // Returns: 223 // 0 no error 224 // 1 number of pixels < 3 225 // 2 size==0 226 // 3 number of used pixel < 3 227 // 4 CorrXY == 0 228 // 229 Int_t MHillas::Calc(const MGeomCam &geom, const MCerPhotEvt &evt) 224 230 { 225 231 const UInt_t npixevt = evt.GetNumPixels(); … … 228 234 // sanity check 229 235 // 230 if (npixevt < = 2)231 { 232 *fLog << warn << "MHillas::Calc: Event has less than twopixels... skipped." << endl;233 return kFALSE;236 if (npixevt < 3) 237 { 238 //*fLog << warn << "MHillas::Calc: Event has less than three pixels... skipped." << endl; 239 return 1; 234 240 } 235 241 … … 280 286 { 281 287 //*fLog << inf << GetDescriptor() << ": Event has zero cerenkov photons... skipped." << endl; 282 return kFALSE;288 return 2; 283 289 } 284 290 … … 286 292 { 287 293 //*fLog << inf << GetDescriptor() << ": Event has less than 3 used pixels... skipped." << endl; 288 return kFALSE;294 return 3; 289 295 } 290 296 … … 334 340 if (corrxy==0) 335 341 { 336 *fLog << inf << GetDescriptor() << ": Event has CorrXY==0... skipped." << endl;337 return kFALSE;342 //*fLog << inf << GetDescriptor() << ": Event has CorrXY==0... skipped." << endl; 343 return 4; 338 344 } 339 345 … … 375 381 SetReadyToSave(); 376 382 377 return kTRUE;383 return 0; 378 384 } 379 385 -
trunk/MagicSoft/Mars/manalysis/MHillas.h
r1524 r1540 45 45 void Reset(); 46 46 47 virtual Bool_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix);47 virtual Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix); 48 48 49 49 virtual void Print(Option_t *opt=NULL) const; -
trunk/MagicSoft/Mars/manalysis/MHillasCalc.cc
r1211 r1540 88 88 return kFALSE; 89 89 90 memset(fErrors, 0, sizeof(fErrors)); 91 90 92 return kTRUE; 91 93 } … … 100 102 Bool_t MHillasCalc::Process() 101 103 { 102 return fHillas->Calc(*fGeomCam, *fCerPhotEvt) ? kTRUE : kCONTINUE; 104 const Int_t rc = fHillas->Calc(*fGeomCam, *fCerPhotEvt); 105 if (rc<0 || rc>4) 106 { 107 *fLog << err << dbginf << "MHillas::Calc returned unknown error code!" << endl; 108 return kFALSE; 109 } 110 fErrors[rc]++; 111 112 return rc==0 ? kTRUE : kCONTINUE; 103 113 } 104 114 115 // -------------------------------------------------------------------------- 116 // 117 // Prints some statistics about the hillas calculation. The percentage 118 // is calculated with respect to the number of executions of this task. 119 // 120 Bool_t MHillasCalc::PostProcess() 121 { 122 if (GetNumExecutions()==0) 123 return kTRUE; 124 125 *fLog << inf << endl; 126 *fLog << GetDescriptor() << " execution statistics:" << endl; 127 *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3) << (int)(fErrors[1]*100/GetNumExecutions()) << "%) Evts skipped due to: Event has less than 3 pixels" << endl; 128 *fLog << " " << setw(7) << fErrors[2] << " (" << setw(3) << (int)(fErrors[2]*100/GetNumExecutions()) << "%) Evts skipped due to: Calculated Size == 0" << endl; 129 *fLog << " " << setw(7) << fErrors[3] << " (" << setw(3) << (int)(fErrors[3]*100/GetNumExecutions()) << "%) Evts skipped due to: Number of used pixels < 3" << endl; 130 *fLog << " " << setw(7) << fErrors[4] << " (" << setw(3) << (int)(fErrors[4]*100/GetNumExecutions()) << "%) Evts skipped due to: CorrXY==0" << endl; 131 *fLog << " " << fErrors[0] << " (" << (int)(fErrors[0]*100/GetNumExecutions()) << "%) Evts survived Hillas calculation!" << endl; 132 *fLog << endl; 133 134 return kTRUE; 135 } -
trunk/MagicSoft/Mars/manalysis/MHillasCalc.h
r1203 r1540 24 24 MHillas *fHillas; // ouput container to store result 25 25 26 TString fHilName; 27 public: 28 MHillasCalc(const char *hil="MHillas", const char *name=NULL, const char *title=NULL); 26 TString fHilName; 27 Int_t fErrors[5]; 29 28 30 29 Bool_t PreProcess(MParList *pList); 31 30 Bool_t Process(); 31 Bool_t PostProcess(); 32 33 public: 34 MHillasCalc(const char *hil="MHillas", const char *name=NULL, const char *title=NULL); 32 35 33 36 ClassDef(MHillasCalc, 0) // Task to calculate Hillas parameters -
trunk/MagicSoft/Mars/manalysis/MHillasExt.cc
r1524 r1540 111 111 // and the cerenkov photon event 112 112 // 113 Bool_t MHillasExt::Calc(const MGeomCam &geom, const MCerPhotEvt &evt) 114 { 115 if (!MHillas::Calc(geom, evt)) 116 return kFALSE; 113 Int_t MHillasExt::Calc(const MGeomCam &geom, const MCerPhotEvt &evt) 114 { 115 const Int_t rc = MHillas::Calc(geom, evt); 116 if (rc>0) 117 return rc; 117 118 118 119 // … … 237 238 SetReadyToSave(); 238 239 239 return kTRUE;240 return 0; 240 241 } 241 242 -
trunk/MagicSoft/Mars/manalysis/MHillasExt.h
r1524 r1540 30 30 Float_t GetM3Trans() const { return fM3Trans; } 31 31 32 Bool_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix);32 Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix); 33 33 34 34 void Print(Option_t *opt=NULL) const; -
trunk/MagicSoft/Mars/manalysis/MHillasSrc.cc
r1524 r1540 113 113 if (dist==0) 114 114 { 115 *fLog << warn << GetDescriptor() << ": Event has Dist==0... skipped." << endl;115 //*fLog << warn << GetDescriptor() << ": Event has Dist==0... skipped." << endl; 116 116 return kFALSE; 117 117 } -
trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.cc
r1487 r1540 91 91 fHillasSrc->SetSrcPos(fSrcPos); 92 92 93 fErrors = 0; 94 93 95 return kTRUE; 94 96 } … … 98 100 Bool_t MHillasSrcCalc::Process() 99 101 { 100 return fHillasSrc->Calc(fHillas) ? kTRUE : kCONTINUE; 102 103 if (!fHillasSrc->Calc(fHillas)) 104 { 105 fErrors++; 106 return kCONTINUE; 107 108 } 109 return kTRUE; 101 110 } 102 111 112 // -------------------------------------------------------------------------- 113 // 114 // Prints some statistics about the hillas calculation. The percentage 115 // is calculated with respect to the number of executions of this task. 116 // 117 Bool_t MHillasSrcCalc::PostProcess() 118 { 119 if (GetNumExecutions()==0) 120 return kTRUE; 121 122 *fLog << inf << endl; 123 *fLog << GetDescriptor() << " execution statistics:" << endl; 124 *fLog << " " << fErrors << " (" << (int)(fErrors*100/GetNumExecutions()) << "%) Evts skipped due to: Dist==0" << endl; 125 *fLog << endl; 126 127 return kTRUE; 128 } 103 129 104 130 // -------------------------------------------------------------------------- -
trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.h
r1487 r1540 20 20 TString fHillasName; 21 21 22 Int_t fErrors; 23 22 24 void StreamPrimitive(ofstream &out) const; 25 26 Bool_t PreProcess(MParList *plist); 27 Bool_t Process(); 28 Bool_t PostProcess(); 23 29 24 30 public: … … 26 32 const char *name=NULL, const char *title=NULL); 27 33 28 Bool_t PreProcess(MParList *plist);29 Bool_t Process();30 31 34 ClassDef(MHillasSrcCalc, 1) // task to calculate the source position depandant hillas parameters 32 35 }; -
trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc
r1503 r1540 159 159 // check if pixel is in use, if not goto next pixel in list 160 160 // 161 #if 0 161 162 if (!pix.IsPixelUsed()) 162 163 continue; 164 #endif 163 165 164 166 // … … 168 170 169 171 // 170 // count number of next neighbors of this pixel which 171 // state is 'used' 172 // check for 'used' neighbors this pixel which 172 173 // 173 174 const MGeomPix &gpix = (*fCam)[id]; 174 175 const Int_t nnmax = gpix.GetNumNeighbors(); 175 176 177 #if 0 176 178 Bool_t cnt = kFALSE; 177 179 for (Int_t j=0; j<nnmax; j++) … … 179 181 const Int_t id2 = gpix.GetNeighbor(j); 180 182 181 if ( !ispixused[id2])183 if (id2>max || !ispixused[id2]) 182 184 continue; 183 185 … … 187 189 if (cnt) 188 190 continue; 191 #else 192 Int_t cnt = 0; 193 for (Int_t j=0; j<nnmax; j++) 194 { 195 const Int_t id2 = gpix.GetNeighbor(j); 196 197 if (id2>max || !ispixused[id2]) 198 continue; 199 200 if (cnt++>nnmax-4) 201 break; 202 } 203 if (cnt==nnmax-2 && nnmax>=4) 204 { 205 pix.SetPixelUsed(); 206 continue; 207 } 208 if (cnt>0) 209 continue; 210 #endif 189 211 190 212 // … … 238 260 const Float_t noise = pix.GetErrorPhot(); 239 261 240 if (entry <= fCleanLvl2 * noise 262 if (entry <= fCleanLvl2 * noise) 241 263 continue; 242 264 -
trunk/MagicSoft/Mars/manalysis/MImgCleanStd.h
r1477 r1540 36 36 void Print(Option_t *o="") const; 37 37 38 Float_t GetCleanLvl1() const { return fCleanLvl1; } 39 Float_t GetCleanLvl2() const { return fCleanLvl2; } 40 38 41 Bool_t ProcessMessage(Int_t msg, Int_t submsg, Long_t param1, Long_t param2); 39 42 -
trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc
r1173 r1540 46 46 #include "MLogManip.h" 47 47 48 #include "MPedestalPix.h" 48 49 #include "MPedestalCam.h" 50 49 51 #include "MRawRunHeader.h" 50 52 #include "MMcFadcHeader.hxx" … … 113 115 // -------------------------------------------------------------------------- 114 116 // 115 // Check for the runtype. (not yet: If the check fails the eventloop is 116 // stopped.) 117 // Check for the runtype. 117 118 // Initialize the size of MPedestalCam to the number of pixels from 118 119 // MMcFadcHeader. -
trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc
r1186 r1540 26 26 // // 27 27 // MMcPedestalNSBAdd // 28 // ----------------- // 28 29 // // 29 30 // This Task adds the contribution of the diffuse NSB to the FADC // 30 31 // pedestals. We assume that NSB introduces larger fluctuation but does // 31 32 // not change the mean value. // 32 // To be precise we add quadratically to the rms that is already in//33 // MPedestalCam the NSB contribution.//33 // To be precise we add quadratically to the rms, which is already in // 34 // MPedestalCam, the NSB contribution. // 34 35 // The number of photons from the diffuse NSB follows a poisson // 35 36 // distribution with expected mean value X, then its standard deviation // … … 50 51 // // 51 52 ///////////////////////////////////////////////////////////////////////////// 52 53 53 #include "MMcPedestalNSBAdd.h" 54 54 … … 58 58 #include "MLogManip.h" 59 59 60 #include "MGeomCam.h" 61 #include "MGeomPix.h" 62 63 #include "MPedestalPix.h" 60 64 #include "MPedestalCam.h" 65 61 66 #include "MRawRunHeader.h" 62 67 #include "MMcRunHeader.hxx" 63 68 #include "MMcFadcHeader.hxx" 64 #include "MGeomCam.h"65 #include "MGeomPix.h"66 69 67 70 ClassImp(MMcPedestalNSBAdd); -
trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc
r1155 r1540 31 31 ///////////////////////////////////////////////////////////////////////////// 32 32 #include "MPedestalCam.h" 33 #include "MPedestalPix.h" 34 35 #include <TClonesArray.h> 33 36 34 37 #include "MLog.h" 38 #include "MLogManip.h" 39 40 #include "MGeomCam.h" 41 35 42 36 43 ClassImp(MPedestalCam); … … 62 69 // -------------------------------------------------------------------------- 63 70 // 71 // Set the size of the camera 72 // 73 inline void MPedestalCam::InitSize(const UInt_t i) 74 { 75 fArray->ExpandCreate(i); 76 } 77 78 // -------------------------------------------------------------------------- 79 // 80 // Get the size of the MPedestalCam 81 // 82 inline Int_t MPedestalCam::GetSize() const 83 { 84 return fArray->GetEntries(); 85 } 86 87 // -------------------------------------------------------------------------- 88 // 89 // Get i-th pixel (pixel number) 90 // 91 inline MPedestalPix &MPedestalCam::operator[](Int_t i) 92 { 93 return *(MPedestalPix*)fArray->UncheckedAt(i); 94 } 95 96 // -------------------------------------------------------------------------- 97 // 98 // Get i-th pixel (pixel number) 99 // 100 inline MPedestalPix &MPedestalCam::operator[](Int_t i) const 101 { 102 return *(MPedestalPix*)fArray->UncheckedAt(i); 103 } 104 105 // -------------------------------------------------------------------------- 106 // 64 107 // Check if position i is inside bounds 65 108 // … … 69 112 } 70 113 114 void MPedestalCam::Clear(Option_t *o) 115 { 116 fArray->ForEach(TObject, Clear)(); 117 } 71 118 119 void MPedestalCam::Print(Option_t *o="") const 120 { 121 *fLog << all << GetDescriptor() << ":" << endl; 122 int id = 0; 123 124 TIter Next(fArray); 125 MPedestalPix *pix; 126 while ((pix=(MPedestalPix*)Next())) 127 { 128 id++; 129 130 if (!pix->IsValid()) 131 continue; 132 133 *fLog << id-1 << ": "; 134 *fLog << pix->GetMean() << " " << pix->GetSigma() << " "; 135 *fLog << pix->GetMeanRms() << " " << pix->GetSigmaRms() << endl; 136 } 137 } 138 139 Float_t MPedestalCam::GetMeanMin(const MGeomCam *geom) const 140 { 141 if (fArray->GetEntries() <= 0) 142 return 50.; 143 144 Float_t minval = (*this)[0].GetMean(); 145 146 for (Int_t i=1; i<fArray->GetEntries(); i++) 147 { 148 const MPedestalPix &pix = (*this)[i]; 149 150 Float_t testval = pix.GetMean(); 151 152 if (geom) 153 testval *= geom->GetPixRatio(i); 154 155 if (testval < minval) 156 minval = testval; 157 } 158 return minval; 159 } 160 161 Float_t MPedestalCam::GetMeanMax(const MGeomCam *geom) const 162 { 163 if (fArray->GetEntries() <= 0) 164 return 50.; 165 166 Float_t maxval = (*this)[0].GetMean(); 167 168 for (Int_t i=1; i<fArray->GetEntries(); i++) 169 { 170 const MPedestalPix &pix = (*this)[i]; 171 172 Float_t testval = pix.GetMean(); 173 174 if (geom) 175 testval *= geom->GetPixRatio(i); 176 177 if (testval > maxval) 178 maxval = testval; 179 } 180 return maxval; 181 } -
trunk/MagicSoft/Mars/manalysis/MPedestalCam.h
r1268 r1540 6 6 #endif 7 7 8 #ifndef MARS_MPedestalPix 9 #include "MPedestalPix.h" 10 #endif 8 class TClonesArray; 11 9 12 #ifndef ROOT_TClonesArray 13 #include <TClonesArray.h> 14 #endif 10 class MGeomCam; 11 class MPedestalPix; 15 12 16 13 class MPedestalCam : public MParContainer … … 23 20 ~MPedestalCam(); 24 21 25 void InitSize(const UInt_t i) { fArray->ExpandCreate(i); }22 void Clear(Option_t *o=""); 26 23 27 MPedestalPix &operator[](Int_t i) { return *(MPedestalPix*)fArray->UncheckedAt(i); } 28 MPedestalPix &operator[](Int_t i) const { return *(MPedestalPix*)fArray->UncheckedAt(i); } 24 void InitSize(const UInt_t i); 25 Int_t GetSize() const; 26 27 MPedestalPix &operator[](Int_t i); 28 MPedestalPix &operator[](Int_t i) const; 29 30 Float_t GetMeanMin(const MGeomCam *cam) const; 31 Float_t GetMeanMax(const MGeomCam *cam) const; 29 32 30 33 Bool_t CheckBounds(Int_t i); 34 35 void Print(Option_t *o="") const; 31 36 32 37 ClassDef(MPedestalCam, 1) // Storage Container for all pedestal information of the camera -
trunk/MagicSoft/Mars/manalysis/MPedestalPix.cc
r1081 r1540 38 38 39 39 MPedestalPix::MPedestalPix() 40 : fMean(0.0), fSigma(0.0), fMeanRms(0.0), fSigmaRms(0.0)41 40 { 41 Clear(); 42 42 } 43 43 44 // ------------------------------------------------------------------------ 45 // 46 // Invalidate values 47 // 48 void MPedestalPix::Clear(Option_t *o) 49 { 50 fMean = -1; 51 fSigma = -1; 52 fMeanRms = -1; 53 fSigmaRms = -1; 54 } 55 -
trunk/MagicSoft/Mars/manalysis/MPedestalPix.h
r1014 r1540 17 17 MPedestalPix(); 18 18 19 void Clear(Option_t *o=""); 20 19 21 Float_t GetMean() const { return fMean; } 20 22 Float_t GetSigma() const { return fSigma; } … … 30 32 void SetPedestalRms(Float_t m, Float_t s) { fMeanRms = m; fSigmaRms = s; } 31 33 34 Bool_t IsValid() const { return fMean>=0||fSigma>=0||fMeanRms>=0||fSigmaRms>=0; } 35 32 36 ClassDef(MPedestalPix, 1) // Storage Container for Pedestal information of one pixel 33 37 }; -
trunk/MagicSoft/Mars/mbase/BaseLinkDef.h
r1492 r1540 35 35 #pragma link C++ class MClone+; 36 36 #pragma link C++ class MPrint+; 37 #pragma link C++ class MContinue+; 37 38 38 39 #pragma link C++ class MArray; -
trunk/MagicSoft/Mars/mbase/MClone.h
r1014 r1540 30 30 Bool_t Process(); 31 31 32 TObject *GetClone() const { return fClone; } 32 TObject *GetClone() const { return fClone; } 33 const TObject *GetObject() const { return fObject; } 33 34 34 35 void Clear(Option_t *opt=NULL); -
trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
r1528 r1540 86 86 #ifdef __MARS__ 87 87 #include "MReadTree.h" // for setting progress bar 88 #include "MProgressBar.h" // MProgressBar::GetBar 88 89 #endif 89 90 … … 126 127 enable ? SetBit(kIsOwner) : ResetBit(kIsOwner); 127 128 } 129 130 #ifdef __MARS__ 131 // -------------------------------------------------------------------------- 132 // 133 // Specify an existing MProgressBar object. It will display the progress 134 // graphically. This will make thing about 1-2% slower. 135 // 136 void MEvtLoop::SetProgressBar(MProgressBar *bar) 137 { 138 fProgress = bar->GetBar(); 139 } 140 #endif 128 141 129 142 // -------------------------------------------------------------------------- -
trunk/MagicSoft/Mars/mbase/MEvtLoop.h
r1526 r1540 17 17 class MTaskList; 18 18 class TGProgressBar; 19 #ifdef __MARS__ 20 class MProgressBar; 21 #endif 19 22 20 23 class MEvtLoop : public MParContainer … … 44 47 45 48 void SetProgressBar(TGProgressBar *bar) { fProgress = bar; } 49 #ifdef __MARS__ 50 void SetProgressBar(MProgressBar *bar); 51 #endif 46 52 47 53 Bool_t PreProcess(const char *tlist="MTaskList"); -
trunk/MagicSoft/Mars/mbase/MTask.cc
r1501 r1540 252 252 // -------------------------------------------------------------------------- 253 253 // 254 // Prints the number of times this task has been processed. 255 // For convinience the lvl argument results in a number of spaces at the 256 // beginning of the line. So that the structur of a tasklist can be 257 // identified. 254 // Prints the number of times all the tasks in the list has been. 255 // For convinience the lvl argument results in a number of spaces at the 256 // beginning of the line. So that the structur of a tasklist can be 257 // identified. If a Tasklist or task has filter applied the name of the 258 // filter is printer in <>-brackets behind the number of executions. 259 // Use MTaskList::PrintStatistics without an argument. 258 260 // 259 261 void MTask::PrintStatistics(const Int_t lvl, Bool_t title) const … … 261 263 *fLog << all << setw(lvl) << " " << GetDescriptor() << "\t"; 262 264 *fLog << dec << fNumExecutions; 265 if (fFilter) 266 *fLog << " <" << fFilter->GetName() << ">"; 263 267 if (title) 264 268 *fLog << "\t" << fTitle; … … 280 284 /* 281 285 If we don't stream filter which are not in the task list itself 282 (which means: alr teady streamed) we may be able to use the283 primitive streameras some kind of validity check for the macros286 (which means: already streamed) we may be able to use 287 SavePrimitive as some kind of validity check for the macros 284 288 285 289 fFilter->SavePrimitive(out); -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r1527 r1540 66 66 #include "MLogManip.h" 67 67 68 #include "MFilter.h" 68 69 #include "MParList.h" 69 70 #include "MInputStreamID.h" … … 71 72 ClassImp(MTaskList); 72 73 73 static const TString gsDefName = "MTaskList"; 74 static const TString gsDefTitle = "A list for tasks to be executed"; 74 const TString MTaskList::gsDefName = "MTaskList"; 75 const TString MTaskList::gsDefTitle = "A list for tasks to be executed"; 76 75 77 // -------------------------------------------------------------------------- 76 78 // … … 492 494 // For convinience the lvl argument results in a number of spaces at the 493 495 // beginning of the line. So that the structur of a tasklist can be 494 // identified. Use MTaskList::PrintStatistics without an argument. 496 // identified. If a Tasklist or task has filter applied the name of the 497 // filter is printer in <>-brackets behind the number of executions. 498 // Use MTaskList::PrintStatistics without an argument. 495 499 // 496 500 void MTaskList::PrintStatistics(const Int_t lvl, Bool_t title) const … … 502 506 *fLog << "---------------------" << endl; 503 507 *fLog << GetDescriptor(); 508 if (GetFilter()) 509 *fLog << " <" << GetFilter()->GetName() << ">"; 504 510 if (title) 505 511 *fLog << "\t" << fTitle; -
trunk/MagicSoft/Mars/mbase/MTaskList.h
r1501 r1540 21 21 { 22 22 private: 23 TList *fTasks; // Container for the ordered list of different tasks 24 TList fTasksProcess; //! 25 MParList *fParList; //! 23 static const TString gsDefName; // default name 24 static const TString gsDefTitle; // default title 26 25 27 UInt_t *fCntContinue; //! 28 UInt_t *fCntTrue; //! 26 TList *fTasks; // Container for the ordered list of different tasks 27 TList fTasksProcess; //! Task which overload the Process function 28 MParList *fParList; //! The parameter list given in PreProcess 29 29 30 30 enum { kIsOwner = BIT(14) }; -
trunk/MagicSoft/Mars/mbase/Makefile
r1528 r1540 20 20 # @endcode 21 21 22 INCLUDES = -I. -I../mraw -I../MRawFormat -I../mmc -I../mfileio 22 INCLUDES = -I. -I../mraw -I../MRawFormat -I../mmc -I../mfileio -I../mmain 23 23 24 24 # @code … … 48 48 MTime.cc \ 49 49 MClone.cc \ 50 MContinue.cc \ 50 51 MPrint.cc \ 51 52 MLogManip.cc -
trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc
r1384 r1540 32 32 #include "MGTask.h" // MGTask::CreateGui 33 33 #include "MClone.h" // MClone 34 #include "MHillas .h" // MHillas34 #include "MHillasExt.h" // MHillasExt 35 35 #include "MParList.h" // MParList::AddToList 36 36 #include "MEvtLoop.h" // MEvtLoop::GetParList … … 81 81 WARNING: 82 82 Bacause of some strage and hidden dependencies the 83 GetMai Frame call in the destructor of TGButton may fail if some83 GetMainFrame call in the destructor of TGButton may fail if some 84 84 of the other gui elements are deleted first. 85 85 AddFirst adds the buttons at the beginning of the deletion list, … … 134 134 MGeomCamMagic *geom = new MGeomCamMagic; 135 135 MPedestalCam *pedest = new MPedestalCam; 136 MHillasExt *hext = new MHillasExt; 136 137 137 138 plist->AddToList(geom); 138 139 plist->AddToList(pedest); 140 plist->AddToList(hext); 139 141 140 142 return geom; … … 160 162 AddSetupElements(); 161 163 164 TCanvas *canv2 = AddTab("Errors"); 165 TCanvas *canv3 = AddTab("Phot/Err"); 166 TCanvas *canv4 = AddTab("Levels"); 167 TCanvas *canv5 = AddTab("Pedestals"); 168 162 169 // 163 170 // Show camera display for the actual geometry 164 171 // 172 fDisplay = new MCamDisplay(geom); 173 fDisplay2 = new MCamDisplay(geom); 174 fDisplay3 = new MCamDisplay(geom); 175 fDisplay4 = new MCamDisplay(geom); 176 fDisplay5 = new MCamDisplay(geom); 177 178 fList->Add(fDisplay); 179 fList->Add(fDisplay2); 180 fList->Add(fDisplay3); 181 fList->Add(fDisplay4); 182 fList->Add(fDisplay5); 183 165 184 fCanvas->cd(); 166 fDisplay = new MCamDisplay(geom);167 185 fDisplay->Draw(); 168 fList->Add(fDisplay); 186 canv2->cd(); 187 fDisplay2->Draw(); 188 canv3->cd(); 189 fDisplay3->Draw(); 190 canv4->cd(); 191 fDisplay4->Draw(); 192 canv5->cd(); 193 fDisplay5->Draw(); 194 169 195 170 196 ReadFirstEvent(); … … 213 239 // Display the requested event. This does a Canvas update, too. 214 240 // 215 MCerPhotEvt *evt = NULL;241 MCerPhotEvt *evt = NULL; 216 242 if (fDisplayRaw) 217 243 { … … 230 256 } 231 257 258 const MImgCleanStd *clean = (MImgCleanStd*)GetTaskList()->FindObject("MImgCleanStd"); 259 const MPedestalCam *ped = (MPedestalCam*)plist->FindObject("MPedestalCam"); 260 232 261 fDisplay->DrawPhotNum(evt); 262 fDisplay2->DrawErrorPhot(evt); 263 fDisplay3->DrawRatio(evt); 264 fDisplay4->DrawLevels(evt, *clean); 265 fDisplay5->DrawPedestals(ped); 233 266 } 234 267 -
trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.h
r1015 r1540 18 18 19 19 TGListBox *fPixelList; 20 20 21 MCamDisplay *fDisplay; 22 MCamDisplay *fDisplay2; 23 MCamDisplay *fDisplay3; 24 MCamDisplay *fDisplay4; 25 MCamDisplay *fDisplay5; 21 26 22 27 void AddSetupElements(); -
trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.cc
r1385 r1540 208 208 // -------------------------------------------------------------------------- 209 209 // 210 // Add a tab with an embedded canvas for an camera display and return the 211 // pointer to the canvas 212 // 213 TCanvas *MGEvtDisplay::AddTab(TString name) 214 { 215 TGLayoutHints *laycanvas = new TGLayoutHints(kLHintsCenterX|kLHintsCenterY|kLHintsExpandX|kLHintsExpandY); 216 fList->Add(laycanvas); 217 218 TGCompositeFrame *frame = fEvtDisplay->AddTab(name); 219 TRootEmbeddedCanvas *canvas = new TRootEmbeddedCanvas(name+"Display", frame, 400, 400); 220 frame->AddFrame(canvas, laycanvas); 221 fList->Add(canvas); 222 return canvas->GetCanvas(); 223 } 224 225 // -------------------------------------------------------------------------- 226 // 210 227 // Add the mid frame: This are the two tabs with the canvas in the right one 211 228 // … … 230 247 // 231 248 // Create second part of frame 232 // 233 TGTab *tabdisp = new TGTab(frame, 300, 300); 234 235 TGLayoutHints *laycanvas = new TGLayoutHints(kLHintsCenterX|kLHintsCenterY|kLHintsExpandX|kLHintsExpandY); 236 237 TGCompositeFrame *tab2 = tabdisp->AddTab("Event Display"); 238 TRootEmbeddedCanvas *canvas = new TRootEmbeddedCanvas("EventDisplay", tab2, 400, 400); 239 tab2->AddFrame(canvas, laycanvas); 240 fList->Add(canvas); 241 242 fCanvas = canvas->GetCanvas(); 243 244 TGCompositeFrame *tab3 = tabdisp->AddTab("Geometry"); 245 canvas = new TRootEmbeddedCanvas("CamDisplay", tab3, 400, 400); 246 tab3->AddFrame(canvas, laycanvas); 247 fList->Add(canvas); 248 249 // 250 fEvtDisplay = new TGTab(frame, 300, 300); 251 252 fCanvas=AddTab("Photons"); 253 254 AddTab("Geometry"); 249 255 MGeomCamMagic geom; 250 256 MCamDisplay *display = new MCamDisplay(&geom); … … 257 263 // 258 264 TGLayoutHints *laydisp = new TGLayoutHints(kLHintsNormal|kLHintsExpandY|kLHintsExpandX, 10, 10, 10, 10); 259 frame->AddFrame( tabdisp, laydisp);265 frame->AddFrame(fEvtDisplay, laydisp); 260 266 261 267 // 262 268 // Now add all gui elements to 'autodel'-list 263 269 // 264 fList->Add(tabdisp); 265 fList->Add(laycanvas); 270 fList->Add(fEvtDisplay); 266 271 fList->Add(laydisp); 267 272 fList->Add(laytabs); … … 475 480 txt += "m ZA="; 476 481 txt += (int)(evt->GetTheta()*180/TMath::Pi()+.5); 477 txt += "° "; 482 txt += "° "; 483 txt += evt->GetPhotElfromShower(); 484 txt += "PhEl"; 478 485 479 486 fEvtInfo->SetText(txt); … … 640 647 return kTRUE; 641 648 } 649 -
trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.h
r1385 r1540 10 10 #endif 11 11 12 class TGTab; 12 13 class TList; 13 14 class TCanvas; … … 29 30 TGLabel *fEvtInfo; 30 31 TGTextEntry *fTxtEvtNr; 32 33 TGTab *fEvtDisplay; 31 34 32 35 void AddMenuBar(); … … 60 63 MReadTree *GetReader() const; 61 64 65 TCanvas *AddTab(TString name); 66 62 67 void ReadFirstEvent(); 63 68 Bool_t IsInitOk() { return fInitOk; } -
trunk/MagicSoft/Mars/mfileio/MCT1ReadAscii.cc
r1381 r1540 51 51 #include "MParList.h" 52 52 #include "MCerPhotEvt.h" 53 54 #include "MPedestalPix.h" 53 55 #include "MPedestalCam.h" 54 56 -
trunk/MagicSoft/Mars/mgeom/MGeomCam.cc
r1458 r1540 112 112 // -------------------------------------------------------------------------- 113 113 // 114 // returns the ratio of the area of the given pixel to the pixel with 115 // the id 0 to scale variables with the pixel size. 116 // 117 inline Float_t MGeomCam::GetPixRatio(Int_t i) const 118 { 119 return (*this)[0].GetA()/(*this)[i].GetA(); 120 } 121 122 // -------------------------------------------------------------------------- 123 // 114 124 // Prints the Geometry information of all pixels in the camera 115 125 // -
trunk/MagicSoft/Mars/mgeom/MGeomCam.h
r1458 r1540 31 31 virtual ~MGeomCam(); 32 32 33 Float_t GetCameraDist() const { return fCamDist; }34 Float_t GetConvMm2Deg() const { return fConvMm2Deg; }33 Float_t GetCameraDist() const { return fCamDist; } 34 Float_t GetConvMm2Deg() const { return fConvMm2Deg; } 35 35 36 UInt_t GetNumPixels() const { return fNumPixels; } 37 Float_t GetMaxRadius() const { return fMaxRadius; } 36 UInt_t GetNumPixels() const { return fNumPixels; } 37 Float_t GetMaxRadius() const { return fMaxRadius; } 38 Float_t GetPixRatio(Int_t i) const; 38 39 39 40 MGeomPix &operator[](Int_t i) { return *(MGeomPix*)fPixels->UncheckedAt(i); } 40 41 MGeomPix &operator[](Int_t i) const { return *(MGeomPix*)fPixels->UncheckedAt(i); } 42 43 41 44 42 45 virtual void Print(Option_t *opt=NULL) const; -
trunk/MagicSoft/Mars/mgui/MCamDisplay.cc
r1426 r1540 28 28 // MCamDisplay 29 29 // 30 // Camera Display 30 // Camera Display. The Pixels are displayed in 31 // contents/area [somthing/mm^2] 31 32 // 32 33 //////////////////////////////////////////////////////////////////////////// … … 38 39 #include <TBox.h> 39 40 #include <TText.h> 41 #include <TArrow.h> 40 42 #include <TStyle.h> 41 43 #include <TCanvas.h> … … 45 47 #include "MHexagon.h" 46 48 47 #include "MGeomPix.h"48 49 #include "MGeomCam.h" 49 50 … … 51 52 #include "MCerPhotEvt.h" 52 53 54 #include "MPedestalPix.h" 55 #include "MPedestalCam.h" 56 57 #include "MImgCleanStd.h" 58 53 59 #define kItemsLegend 50 // see SetPalette(1,0) 54 60 … … 60 66 // 61 67 MCamDisplay::MCamDisplay(MGeomCam *geom) 62 : fAutoScale(kTRUE), f MinPhe(-2), fMaxPhe(50), fW(0), fH(0), fDrawingPad(NULL), fIsAllocated(kFALSE)68 : fAutoScale(kTRUE), fW(0), fH(0), fDrawingPad(NULL), fIsAllocated(kFALSE) 63 69 { 64 70 fGeomCam = (MGeomCam*)geom; // FIXME: Clone doesn't work! (MGeomCam*)geom->Clone(); … … 108 114 newtxt->SetTextAlign(12); 109 115 } 116 117 fArrowX = new TArrow(-fRange*.9, -fRange*.9, -fRange*.6, -fRange*.9, 0.025); 118 fArrowY = new TArrow(-fRange*.9, -fRange*.9, -fRange*.9, -fRange*.6, 0.025); 119 120 TString text; 121 text += (int)(fRange*.3); 122 text += "mm"; 123 124 fLegRadius = new TText(-fRange*.85, -fRange*.85, text); 125 text = ""; 126 text += (float)((int)(fRange*.3*geom->GetConvMm2Deg()*10))/10; 127 text += "°"; 128 text = text.Strip(TString::kLeading); 129 fLegDegree = new TText(-fRange*.85, -fRange*.75, text); 130 fLegRadius->SetTextSize(0.04); 131 fLegDegree->SetTextSize(0.04); 110 132 } 111 133 … … 124 146 delete fLegText; 125 147 148 delete fArrowX; 149 delete fArrowY; 150 151 delete fLegRadius; 152 delete fLegDegree; 153 126 154 // delete fGeomCam; 127 155 128 if (fDrawingPad->GetListOfPrimitives()->FindObject(this)==this &&129 fIsAllocated)156 // Maybe harmfull! Don't exchange the order! 157 if (fIsAllocated && fDrawingPad->GetListOfPrimitives()->FindObject(this)==this) 130 158 { 131 159 fDrawingPad->RecursiveRemove(this); … … 134 162 } 135 163 136 inline void MCamDisplay::SetPixColor(const MCerPhotPix &pix, const Int_t i )137 { 138 // 139 // Fixme: Divide pnum by the (real) area of the pixel140 // 141 const Float_t ratio = (*fGeomCam)[0].GetA()/(*fGeomCam)[i].GetA();164 inline void MCamDisplay::SetPixColor(const MCerPhotPix &pix, const Int_t i, Float_t min, Float_t max) 165 { 166 // 167 // Fixme: Use absolute value per mm^2. Needs another scaling algorithm. 168 // 169 const Float_t ratio = fGeomCam->GetPixRatio(i); 142 170 const Float_t pnum = ratio*pix.GetNumPhotons(); 143 171 144 (*this)[pix.GetPixId()].SetFillColor(GetColor(pnum)); 172 (*this)[pix.GetPixId()].SetFillColor(GetColor(pnum, min, max)); 173 } 174 175 inline void MCamDisplay::SetPixColorPedestal(const MPedestalPix &pix, const Int_t i, Float_t min, Float_t max) 176 { 177 // 178 // Fixme: Use absolute value per mm^2. Needs another scaling algorithm. 179 // 180 const Float_t ratio = fGeomCam->GetPixRatio(i); 181 const Float_t pnum = ratio*pix.GetMean(); 182 183 (*this)[i].SetFillColor(GetColor(pnum, min, max)); 184 } 185 186 inline void MCamDisplay::SetPixColorError(const MCerPhotPix &pix, const Int_t i, Float_t min, Float_t max) 187 { 188 // 189 // Fixme: Use absolute value per mm^2. Needs another scaling algorithm. 190 // 191 const Float_t ratio = fGeomCam->GetPixRatio(i); 192 const Float_t pnum = ratio*pix.GetErrorPhot(); 193 194 (*this)[pix.GetPixId()].SetFillColor(GetColor(pnum, min, max)); 195 } 196 197 inline void MCamDisplay::SetPixColorRatio(const MCerPhotPix &pix, Float_t min, Float_t max) 198 { 199 // 200 // Fixme: Use absolute value per mm^2. Needs another scaling algorithm. 201 // 202 const Float_t pnum = pix.GetNumPhotons()/pix.GetErrorPhot(); 203 (*this)[pix.GetPixId()].SetFillColor(GetColor(pnum, min, max)); 204 } 205 206 inline void MCamDisplay::SetPixColorLevel(const MCerPhotPix &pix, Float_t lvl1, Float_t lvl2) 207 { 208 const Int_t maxcolidx = kItemsLegend-1; 209 210 MHexagon &hex = (*this)[pix.GetPixId()]; 211 212 const Float_t r = pix.GetNumPhotons()/pix.GetErrorPhot(); 213 214 if (r>lvl1) 215 hex.SetFillColor(fColors[4*maxcolidx/5]); 216 else 217 if (r>lvl2) 218 hex.SetFillColor(fColors[maxcolidx/2]); 219 else 220 hex.SetFillColor(fColors[maxcolidx/5]); 145 221 } 146 222 … … 189 265 // 190 266 gPad->Range(-fRange, -y, x, y); 267 268 // 269 // Make sure, that the correct aspect is always displayed also 270 // if - by chance - there is not update for the pad after the 271 // Paint function was called. 272 // 273 gPad->Update(); 191 274 } 192 275 … … 359 442 } 360 443 444 fArrowX->Draw(); 445 fArrowY->Draw(); 446 447 fLegRadius->Draw(); 448 fLegDegree->Draw(); 449 361 450 // 362 451 // initialize and draw legend … … 433 522 return; 434 523 524 Draw(); 525 526 fDrawingPad->cd(); 527 528 for (int i=0; i<kItemsLegend; i++) 529 GetBox(i)->SetFillColor(fColors[i]); 530 531 // 532 // Reset pixel colors to default value 533 // 534 Reset(); 535 536 // 537 // if the autoscale is true, set the values for the range for 538 // each event 539 // 540 Float_t min = 0; 541 Float_t max = 50; 542 if (fAutoScale) 543 { 544 min = event->GetNumPhotonsMin(fGeomCam); 545 max = event->GetNumPhotonsMax(fGeomCam); 546 547 if (max < 20.) 548 max = 20.; 549 550 UpdateLegend(min, max); 551 } 552 553 // 554 // update the colors in the picture 555 // 556 const Int_t entries = event->GetNumPixels(); 557 558 for (Int_t i=0; i<entries; i++) 559 { 560 const MCerPhotPix &pix = (*event)[i]; 561 562 if (!pix.IsPixelUsed()) 563 continue; 564 565 SetPixColor(pix, i, min, max); 566 } 567 568 // 569 // Update display physically 570 // 571 fDrawingPad->Modified(); 572 fDrawingPad->Update(); 573 } 574 575 // ------------------------------------------------------------------------ 576 // 577 // Call this function to draw the number of photo electron into the 578 // camera. 579 // 580 void MCamDisplay::DrawPedestals(const MPedestalCam *event) 581 { 582 if (!event) 583 return; 584 585 Draw(); 586 587 fDrawingPad->cd(); 588 589 for (int i=0; i<kItemsLegend; i++) 590 GetBox(i)->SetFillColor(fColors[i]); 591 592 // 593 // Reset pixel colors to default value 594 // 595 Reset(); 596 597 // 598 // if the autoscale is true, set the values for the range for 599 // each event 600 // 601 Float_t min = 0; 602 Float_t max = 50; 603 if (fAutoScale) 604 { 605 min = event->GetMeanMin(fGeomCam); 606 max = event->GetMeanMax(fGeomCam); 607 608 if (max < 20.) 609 max = 20.; 610 611 UpdateLegend(min, max); 612 } 613 614 // 615 // update the colors in the picture 616 // 617 const Int_t entries = event->GetSize(); 618 619 for (Int_t i=0; i<entries; i++) 620 SetPixColorPedestal((*event)[i], i, min, max); 621 622 // 623 // Update display physically 624 // 625 fDrawingPad->Modified(); 626 fDrawingPad->Update(); 627 } 628 629 // ------------------------------------------------------------------------ 630 // 631 // Call this function to draw the error of number of photo electron 632 // into the camera. 633 // 634 void MCamDisplay::DrawErrorPhot(const MCerPhotEvt *event) 635 { 636 if (!event) 637 return; 638 435 639 if (!fDrawingPad) 436 640 Draw(); … … 450 654 // each event 451 655 // 656 Float_t min = 0; 657 Float_t max = 50; 452 658 if (fAutoScale) 453 659 { 454 fMinPhe = event->GetNumPhotonsMin(fGeomCam);455 fMaxPhe = event->GetNumPhotonsMax(fGeomCam);456 457 if ( fMaxPhe< 20.)458 fMaxPhe= 20.;459 460 UpdateLegend( );660 min = event->GetErrorPhotMin(fGeomCam); 661 max = event->GetErrorPhotMax(fGeomCam); 662 663 if (max < 20.) 664 max = 20.; 665 666 UpdateLegend(min, max); 461 667 } 462 668 … … 473 679 continue; 474 680 475 SetPixColor (pix, i);681 SetPixColorError(pix, i, min, max); 476 682 } 477 683 … … 481 687 fDrawingPad->Modified(); 482 688 fDrawingPad->Update(); 689 } 690 691 // ------------------------------------------------------------------------ 692 // 693 // Call this function to draw the ratio of the number of photons 694 // divided by its error 695 // 696 void MCamDisplay::DrawRatio(const MCerPhotEvt *event) 697 { 698 if (!event) 699 return; 700 701 if (!fDrawingPad) 702 Draw(); 703 704 fDrawingPad->cd(); 705 706 for (int i=0; i<kItemsLegend; i++) 707 GetBox(i)->SetFillColor(fColors[i]); 708 709 // 710 // Reset pixel colors to default value 711 // 712 Reset(); 713 714 // 715 // if the autoscale is true, set the values for the range for 716 // each event 717 // 718 Float_t min = 0; 719 Float_t max = 20; 720 if (fAutoScale) 721 { 722 min = event->GetRatioMin(); 723 max = event->GetRatioMax(); 724 725 UpdateLegend(min, max); 726 } 727 728 // 729 // update the colors in the picture 730 // 731 const Int_t entries = event->GetNumPixels(); 732 733 for (Int_t i=0; i<entries; i++) 734 { 735 const MCerPhotPix &pix = (*event)[i]; 736 737 if (!pix.IsPixelUsed()) 738 continue; 739 740 SetPixColorRatio(pix, min, max); 741 } 742 743 // 744 // Update display physically 745 // 746 fDrawingPad->Modified(); 747 fDrawingPad->Update(); 748 } 749 750 // ------------------------------------------------------------------------ 751 // 752 // Draw the colors in respect to the cleaning levels 753 // 754 void MCamDisplay::DrawLevels(const MCerPhotEvt *event, Float_t lvl1, Float_t lvl2) 755 { 756 if (!event) 757 return; 758 759 if (!fDrawingPad) 760 Draw(); 761 762 fDrawingPad->cd(); 763 764 for (int i=0; i<kItemsLegend; i++) 765 GetBox(i)->SetFillColor(fColors[i]); 766 767 // 768 // Reset pixel colors to default value 769 // 770 Reset(); 771 772 // 773 // update the colors in the picture 774 // 775 const Int_t entries = event->GetNumPixels(); 776 777 for (Int_t i=0; i<entries; i++) 778 { 779 const MCerPhotPix &pix = (*event)[i]; 780 781 if (!pix.IsPixelUsed()) 782 continue; 783 784 SetPixColorLevel(pix, lvl1, lvl2); 785 } 786 787 // 788 // Update display physically 789 // 790 fDrawingPad->Modified(); 791 fDrawingPad->Update(); 792 } 793 794 // ------------------------------------------------------------------------ 795 // 796 // Draw the colors in respect to the cleaning levels 797 // 798 void MCamDisplay::DrawLevels(const MCerPhotEvt *event, const MImgCleanStd &clean) 799 { 800 DrawLevels(event, clean.GetCleanLvl1(), clean.GetCleanLvl2()); 483 801 } 484 802 … … 504 822 // with 0 up to 49. 505 823 // 506 Int_t MCamDisplay::GetColor(Float_t val )824 Int_t MCamDisplay::GetColor(Float_t val, Float_t min, Float_t max) 507 825 { 508 826 // … … 511 829 const Int_t maxcolidx = kItemsLegend-1; 512 830 513 if (val >= fMaxPhe)831 if (val >= max) 514 832 return fColors[maxcolidx]; 515 833 516 if (val <= fMinPhe)834 if (val <= min) 517 835 return fColors[0]; 518 836 … … 520 838 // calculate the color index 521 839 // 522 const Float_t ratio = (val- fMinPhe) / (fMaxPhe-fMinPhe);840 const Float_t ratio = (val-min) / (max-min); 523 841 const Int_t colidx = (Int_t)(ratio*maxcolidx + .5); 524 842 … … 531 849 // Display 532 850 // 533 void MCamDisplay::UpdateLegend( )851 void MCamDisplay::UpdateLegend(Float_t minphe, Float_t maxphe) 534 852 { 535 853 char text[10]; … … 537 855 for (Int_t i=0; i<kItemsLegend; i+=3) 538 856 { 539 const Float_t val = fMinPhe + (Float_t)i/kItemsLegend * (fMaxPhe-fMinPhe) ;857 const Float_t val = minphe + (Float_t)i/kItemsLegend * (maxphe-minphe) ; 540 858 541 859 sprintf(text, "%5.1f", val); -
trunk/MagicSoft/Mars/mgui/MCamDisplay.h
r1426 r1540 11 11 class TBox; 12 12 class TText; 13 class TArrow; 13 14 class TVirtualPad; 14 15 … … 17 18 class MCerPhotEvt; 18 19 class MCerPhotPix; 20 class MImgCleanStd; 21 class MPedestalPix; 22 class MPedestalCam; 19 23 20 24 class MCamDisplay : public TObject … … 28 32 Float_t fRange; // the range in millimeters of the present geometry 29 33 30 Float_t fMinPhe; // The minimal number of Phe 31 Float_t fMaxPhe; // The maximum number of Phe 34 Int_t fColors[50]; 32 35 33 Int_t fColors[50]; 36 TArrow *fArrowX; // Coordinate System 37 TArrow *fArrowY; // Coordinate System 38 39 TText *fLegRadius; // Coordinate System 40 TText *fLegDegree; // Coordinate System 34 41 35 42 TClonesArray *fPixels; // array of all hexagons … … 47 54 MHexagon &operator[](int i) { return *((MHexagon*)fPixels->At(i)); } 48 55 49 void SetPixColor(const MCerPhotPix &pix, const Int_t i); 50 Int_t GetColor(Float_t wert); 56 void SetPixColor(const MCerPhotPix &pix, const Int_t i, Float_t min, Float_t max); 57 void SetPixColorRatio(const MCerPhotPix &pix, Float_t min, Float_t max); 58 void SetPixColorLevel(const MCerPhotPix &pix, Float_t lvl1, Float_t lvl2); 59 void SetPixColorError(const MCerPhotPix &pix, const Int_t i, Float_t min, Float_t max); 60 void SetPixColorPedestal(const MPedestalPix &pix, Int_t i, Float_t min, Float_t max); 61 Int_t GetColor(Float_t val, Float_t min, Float_t max); 51 62 52 void UpdateLegend( );63 void UpdateLegend(Float_t min, Float_t max); 53 64 void Paint(Option_t *option=""); 54 65 … … 59 70 void SetAutoScale(Bool_t input=kTRUE) { fAutoScale = input; } 60 71 void DrawPhotNum(const MCerPhotEvt *event); 72 void DrawRatio(const MCerPhotEvt *event); 73 void DrawLevels(const MCerPhotEvt *event, Float_t lvl1, Float_t lvl2); 74 void DrawErrorPhot(const MCerPhotEvt *event); 75 void DrawLevels(const MCerPhotEvt *event, const MImgCleanStd &clean); 76 void DrawPedestals(const MPedestalCam *event); 61 77 62 78 void DrawPixelNumbers(); -
trunk/MagicSoft/Mars/mhist/MHHillasSrc.cc
r1489 r1540 155 155 void MHHillasSrc::SetMm2Deg(Float_t mmdeg) 156 156 { 157 if (mmdeg< 0)158 { 159 *fLog << warn << dbginf << "Warning - Conversion factor < 0 - nonsense. Ignored." << endl;157 if (mmdeg<=0) 158 { 159 *fLog << warn << dbginf << "Warning - Conversion factor <= 0 - nonsense. Ignored." << endl; 160 160 return; 161 161 } 162 162 163 if (fMm2Deg> =0)163 if (fMm2Deg>0) 164 164 *fLog << warn << dbginf << "Warning - Conversion factor already set. Overwriting" << endl; 165 165 -
trunk/MagicSoft/Mars/mhist/MHStarMap.cc
r1524 r1540 119 119 { 120 120 float r = geom ? geom->GetMaxRadius() : 600; 121 r *= 2./3;121 r *= 5./6; 122 122 if (!fUseMmScale) 123 123 r *= fMm2Deg; -
trunk/MagicSoft/Mars/mmain/MMars.cc
r1330 r1540 111 111 } 112 112 113 void MMars::CreateTextButton(TGVerticalFrame *tab, const char *text, 114 const UInt_t id, TGLayoutHints *hints) const 113 #include <TGLabel.h> 114 115 void MMars::CreateTextButton(TGVerticalFrame *tab, 116 const char *text, const char *descr, 117 const UInt_t id) const 115 118 { 116 119 // 117 120 // Create the button 118 121 // 119 TGTextButton *button = new TGTextButton(tab, text, id); 122 TGHorizontalFrame *frame = new TGHorizontalFrame(tab, 1, 1); 123 TGTextButton *button = new TGTextButton(frame, text, id); 124 TGLabel *label = new TGLabel(frame, descr); 125 TGLayoutHints *hints1 = new TGLayoutHints(kLHintsLeft|kLHintsCenterY|kLHintsExpandX, 5, 5, 2, 2); 120 126 121 127 // 122 128 // Add button for 'auto-delete' 123 129 // 130 fList->Add(hints1); 124 131 fList->Add(button); 132 fList->Add(label); 133 fList->Add(frame); 125 134 126 135 // … … 132 141 // Add button with corresponding layout to containing frame 133 142 // 134 tab->AddFrame(button, hints); 143 tab->AddFrame(frame, hints1); 144 frame->AddFrame(button, hints1); 145 frame->AddFrame(label, hints1); 135 146 } 136 147 … … 143 154 fList->Add(laytabs); 144 155 145 TGTab *tabs = new TGTab(low, 400, 400);156 TGTab *tabs = new TGTab(low, 1, 1); 146 157 fList->Add(tabs); 147 158 low->AddFrame(tabs, laytabs); … … 152 163 TGCompositeFrame *tf = tabs->AddTab("Control"); 153 164 154 TGVerticalFrame *tab1 = new TGVerticalFrame(tf, 300, 100); 155 TGVerticalFrame *tab2 = new TGVerticalFrame(tf, 300, 100); 156 157 fList->Add(tab1); 158 fList->Add(tab2); 159 160 TGLayoutHints *laytabx = new TGLayoutHints(kLHintsTop|kLHintsExpandX); 161 fList->Add(laytabx); 162 163 tf->AddFrame(tab1, laytabx); 164 tf->AddFrame(tab2, laytabx); 165 166 TGLayoutHints *laybut = new TGLayoutHints(kLHintsTop|kLHintsCenterX, 10, 10, 10, 10); 167 fList->Add(laybut); 168 169 CreateTextButton(tab2, "Event Display", kButEvtDisplay, laybut); 170 CreateTextButton(tab2, "Data Check", kButDataCheck, laybut); 171 CreateTextButton(tab2, "Analysis", kButAnalysis, laybut); 172 CreateTextButton(tab2, "Monte Carlo", kButMonteCarlo, laybut); 173 CreateTextButton(tab2, "Camera Display", kButCameraDisplay, laybut); 165 TGLayoutHints *laytab = new TGLayoutHints(kLHintsCenterY|kLHintsExpandX); 166 TGVerticalFrame *tab = new TGVerticalFrame(tf, 1, 1); 167 fList->Add(laytab); 168 fList->Add(tab); 169 170 CreateTextButton(tab, "Event Display", "Historgrams: Pix per Event", 171 kButEvtDisplay); 172 CreateTextButton(tab, "Data Check", "Histograms: Pix per Run", 173 kButDataCheck); 174 CreateTextButton(tab, "Analysis", "Calculate image parameters", 175 kButAnalysis); 176 CreateTextButton(tab, "Monte Carlo", "Calculate MC stuff", 177 kButMonteCarlo); 178 CreateTextButton(tab, "Camera Display", "Display Cerenekov Photons", 179 kButCameraDisplay); 180 181 tf->AddFrame(tab, laytab); 174 182 } 175 183 176 184 MMars::MMars() 177 : TGMainFrame(gClient->GetRoot(), 330, 400, kVerticalFrame|kFixedSize)185 : TGMainFrame(gClient->GetRoot(), 400, 400, kVerticalFrame) 178 186 { 179 187 // … … 191 199 // create and layout the frame/contents 192 200 // 193 TGHorizontalFrame *top = new TGHorizontalFrame(this, 300, 100);194 TGHorizontalFrame *low = new TGHorizontalFrame(this, 300, 100);201 TGHorizontalFrame *top = new TGHorizontalFrame(this, 1, 1); 202 TGHorizontalFrame *low = new TGHorizontalFrame(this, 1, 1); 195 203 196 204 TGHorizontal3DLine *linesep = new TGHorizontal3DLine(this); … … 203 211 CreateBottomFrame(low); 204 212 205 TGLayoutHints *layout = new TGLayoutHints(kLHintsTop|kLHintsExpandX); 206 fList->Add(layout); 207 208 AddFrame(top, layout); 209 AddFrame(linesep, layout); 210 AddFrame(low, layout); 211 212 // CreateTopFrame(fTop2); 213 // CreateBottomFrame(fTop3); 213 TGLayoutHints *layout1 = new TGLayoutHints(kLHintsTop|kLHintsExpandX); 214 TGLayoutHints *layout2 = new TGLayoutHints(kLHintsTop|kLHintsExpandX|kLHintsExpandY); 215 fList->Add(layout1); 216 fList->Add(layout2); 217 218 AddFrame(top, layout1); 219 AddFrame(linesep, layout1); 220 AddFrame(low, layout2); 214 221 215 222 // 216 223 // Map the window, set up the layout, etc. 217 // kFixedSize seems to be ignored 218 // 219 SetWMSizeHints(GetWidth(), GetHeight(), GetWidth(), GetHeight(), 0, 0); // set the smallest and biggest size of the Main frame 224 // 220 225 Move(rand()%100, rand()%100); 221 226 227 Layout(); 228 222 229 MapSubwindows(); 223 224 Layout();225 230 226 231 SetWindowName("MARS Main Window"); -
trunk/MagicSoft/Mars/mmain/MMars.h
r1108 r1540 21 21 22 22 void CreateTextButton(TGVerticalFrame *tab, const char *text, 23 const UInt_t id, TGLayoutHints *hints) const;23 const char *descr, const UInt_t id) const; 24 24 25 25 void CreateMenuBar(); -
trunk/MagicSoft/Mars/mmain/MProgressBar.cc
r1527 r1540 53 53 fList->SetOwner(); 54 54 55 //SetMWMHints(0, 0, 0); 56 55 57 SetWMSizeHints(150, 15, 640, 480, 10, 10); // set the smallest and biggest size of the Main frame 56 58 Move(rand()%100+50, rand()%100+50);
Note:
See TracChangeset
for help on using the changeset viewer.