Changeset 4710 for trunk/MagicSoft/Mars
- Timestamp:
- 08/23/04 14:15:49 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 4 added
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r4708 r4710 46 46 47 47 48 48 49 2004/08/23: Thomas Bretz 49 50 … … 90 91 * mmain/MEventDisplay.cc: 91 92 - added display of island index 93 94 * mhvstime/MHVsTime.[h,cc]: 95 - implemented the possibility to set a maximum number of points 96 97 * mbase/MParContainer.h: 98 - changed StreamPrimitive to public 99 100 * mcalib/MMcCalibrationCalc.[h,cc]: 101 - added fPar data member (MImagePar) to get number of 102 saturating hi gain pixels 103 104 * mimage/Makefile, mimage/ImageLinkDef.h: 105 - added MImagePar 106 - added MHImagePar 107 108 * mimage/MConcentration.[h,cc]: 109 - removed obsolete destructor 110 111 * mimage/MHillas.[h,cc]: 112 - added a check for island index to calculation 113 114 * mimage/MHillasCalc.cc: 115 - added option kCalcImagePar 116 - added option kCalcHillasSrc 117 - added Print function 118 - added StreamPrimitive function 119 - added resource support (ReadEnv) 120 121 * mimage/MHillasExt.[h,cc]: 122 - added a check for island index to calculation 123 - replaced for-loop by iterator 124 125 * mimage/MHillasSrc.[h,cc]: 126 - changed argument to Calc from pointer to reference 127 128 * mimage/MHillasSrcCalc.[h,cc]: 129 - fixed StreamPrimitive 130 - added some const-qualifiers to data members 131 - adapted to change in MHillasSrc 132 133 * mimage/MNewImagePar.[h,cc]: 134 - moved saturating pixels to new class MImagePar 135 - added a check for island index to calculation 136 - increased version number 137 138 * mpointing/MSrcPosCam.h: 139 - made StreamPrimitive public 92 140 93 141 -
trunk/MagicSoft/Mars/NEWS
r4702 r4710 20 20 The index corresponds to the order of the islands in size. 21 21 22 - Changed calculation of image parameters such, that it can be done 23 for all used pixels or the pixels with a defined island index only 24 25 - implemented new image parameters displaying the number of islands, 26 saturated hi-gain and lo-gain pixels (MImagePar, MHImagePar) 27 22 28 23 29 … … 25 31 26 32 - new Signal Extractors: MExtractFixedWindowSpline 27 33 and MExtractAmplitudeSpline 28 34 29 35 - implementes interleave in merpp to be able to merpp parts of a file -
trunk/MagicSoft/Mars/mbase/MParContainer.h
r4601 r4710 54 54 Bool_t fReadyToSave; // should be set to true if the contents of the container is changed somehow 55 55 56 // FIXME: Change to ostream!57 virtual void StreamPrimitive(ofstream &out) const;58 59 56 public: 60 57 enum { … … 103 100 104 101 virtual void SetDisplay(MStatusDisplay *d) { fDisplay = d; } 102 103 // FIXME: Change to ostream! 104 virtual void StreamPrimitive(ofstream &out) const; 105 105 106 106 TMethodCall *GetterMethod(const char *name) const; -
trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.cc
r4296 r4710 61 61 62 62 #include "MHillas.h" 63 #include "MImagePar.h" 63 64 #include "MNewImagePar.h" 64 65 … … 139 140 { 140 141 *fLog << err << AddSerialNumber("MNewImagePar") << "not found... aborting." << endl; 142 return kFALSE; 143 } 144 145 fPar = (MImagePar*)pList->FindObject(AddSerialNumber("MImagePar")); 146 if (!fPar) 147 { 148 *fLog << err << AddSerialNumber("MImagePar") << "not found... aborting." << endl; 141 149 return kFALSE; 142 150 } … … 236 244 // Exclude events with some saturated pixel 237 245 // 238 if (f New->GetNumSaturatedPixels()>0)246 if (fPar->GetNumSatPixelsHG()>0) 239 247 return kTRUE; 240 248 -
trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.h
r4296 r4710 10 10 class MGeomCam; 11 11 class MHillas; 12 class MImagePar; 12 13 class MNewImagePar; 13 14 class MMcEvt; … … 24 25 MHillas *fHillas; 25 26 MNewImagePar *fNew; 27 MImagePar *fPar; 26 28 MMcEvt *fMcEvt; 27 29 MMcFadcHeader *fHeaderFadc; -
trunk/MagicSoft/Mars/mimage/ImageLinkDef.h
r3526 r4710 15 15 #pragma link C++ class MHillasCalc+; 16 16 17 #pragma link C++ class MImagePar+; 17 18 #pragma link C++ class MNewImagePar+; 18 19 #pragma link C++ class MConcentration+; … … 21 22 #pragma link C++ class MHHillasSrc+; 22 23 #pragma link C++ class MHHillasExt+; 24 #pragma link C++ class MHImagePar+; 23 25 #pragma link C++ class MHNewImagePar+; 24 26 #pragma link C++ class MStereoPar+; -
trunk/MagicSoft/Mars/mimage/MConcentration.cc
r3568 r4710 75 75 // -------------------------------------------------------------------------- 76 76 // 77 // Destructor.78 //79 MConcentration::~MConcentration()80 {81 }82 83 // --------------------------------------------------------------------------84 //85 77 // Initializes the values with defaults. For the default values see the 86 78 // source code. … … 111 103 // In case you don't call Calc from within an eventloop make sure, that 112 104 // you call the Reset member function before. 105 // 113 106 // Returns: 114 107 // Nothing. 115 108 // 116 109 Int_t MConcentration::Calc(const MGeomCam &geom, const MCerPhotEvt &evt, const MHillas &hillas) 117 110 { -
trunk/MagicSoft/Mars/mimage/MConcentration.h
r3542 r4710 17 17 public: 18 18 MConcentration(const char *name=NULL, const char *title=NULL); 19 ~MConcentration();20 19 21 20 void Reset(); -
trunk/MagicSoft/Mars/mimage/MHillas.cc
r3540 r4710 188 188 // 4 CorrXY == 0 189 189 // 190 Int_t MHillas::Calc(const MGeomCam &geom, const MCerPhotEvt &evt )190 Int_t MHillas::Calc(const MGeomCam &geom, const MCerPhotEvt &evt, Int_t island) 191 191 { 192 192 // … … 215 215 while ((pix=(MCerPhotPix*)Next())) 216 216 { 217 if (island>=0 && pix->GetIdxIsland()!=island) 218 continue; 219 217 220 const MGeomPix &gpix = geom[pix->GetPixId()]; 218 221 … … 257 260 while ((pix=(MCerPhotPix*)Next())) 258 261 { 262 if (island>=0 && pix->GetIdxIsland()!=island) 263 continue; 264 259 265 const MGeomPix &gpix = geom[pix->GetPixId()]; 260 266 -
trunk/MagicSoft/Mars/mimage/MHillas.h
r3540 r4710 31 31 void Reset(); 32 32 33 Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix );33 Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix, Int_t island=-1); 34 34 35 35 void Print(const MGeomCam &geom) const; -
trunk/MagicSoft/Mars/mimage/MHillasCalc.cc
r4578 r4710 27 27 // 28 28 // MHillasCalc 29 // =========== 29 30 // 30 31 // This is a task to calculate the Hillas parameters from each event 31 32 // 32 // By default MHillas, MHillasExt and MNewImagePar are calculated 33 // with the information from MCerPhotEvt and MGeomCam. 33 // 34 // Flags 35 // -------- 36 // 37 // By default all flags are set: 34 38 // 35 39 // To switch of the calculation you may use: … … 37 41 // - Disable(MHillasCalc::kCalcHillasExt) 38 42 // - Disable(MHillasCalc::kCalcNewImagePar) 43 // - Disable(MHillasCalc::kCalcImagePar) 44 // - Disable(MHillasCalc::kCalcSrcPosCam) 45 // - Disable(MHillasCalc::kCalcConc) 39 46 // 40 47 // If the calculation of MHillas is switched off a container MHillas 41 48 // in the parameter list is nevertheless necessary for the calculation 42 // of MHillasExt and MNewImagePar. 49 // of some other containers, see below. 50 // 51 // If kCalcHillasSrc is set and no corresponding MSrcPosCam is found 52 // in the parameter list an empty container (X=0, Y=0) is created. 53 // 54 // 55 // Container names 56 // ----------------- 43 57 // 44 58 // The names of the containers to be used can be set with: … … 46 60 // - SetNameHillasExt("NewName") 47 61 // - SetNameNewImgPar("NewName") 48 // 49 // Input Containers: 50 // MCerPhotEvt 51 // MGeomCam 52 // [MHillas] 53 // 54 // Output Containers: 55 // [MHillas] 56 // MHillasExt 57 // MNewImagePar 62 // - SetNameImagePar("NewName") 63 // - SetNameSrcPosCam("NewName") 64 // - SetNameConc("NewName") 65 // - SetNameHillasSrc("NewName") 66 // 67 // 68 // Islands 69 // --------- 70 // 71 // You can change the islands for which the caluclations are done by: 72 // - SetNumIsland() 73 // The default is to use all used pixels (-1) 74 // 75 // fIdxIslands effects the calculations: 76 // - kCalcHillas 77 // - kCalcHillasExt 78 // - kCalcNewImgPar 79 // 80 // 81 // Example 82 // --------- 83 // 84 // MHillasCalc calc0; // calculate all image parameters except source dep. 85 // MHillasCalc calc1; // calculate source dependant image parameters for 'Source' 86 // MHillasCalc calc2; // calculate source dependant image parameters for 'AntiSource' 87 // MHillasCalc calc3; // calculate hillas parameters only for biggest island 88 // MHillasCalc calc4; // calculate hillas parameter for 2nd biggest island 89 // // setup names of input-/output-containers 90 // calc1.SetNameSrcPosCam("Source"); 91 // calc2.SetNameSrcPosCam("AntiSource"); 92 // calc1.SetNameHillasSrc("MHillasSource"); 93 // calc2.SetNameHillasSrc("MHillasAntiSource"); 94 // calc3.SetNameHillas("MHillas0"); 95 // calc4.SetNameHillas("MHillas1"); 96 // // setup calculations to be done 97 // calc0.Disable(MHillasCalc::kCalcHillasSrc); 98 // calc1.SetFlags(MHillasCalc::kCalcHillasSrc); 99 // calc2.SetFlags(MHillasCalc::kCalcHillasSrc); 100 // calc3.SetFlags(MHillasCalc::kCalcHillas); 101 // calc4.SetFlags(MHillasCalc::kCalcHillas); 102 // // choode index of island 103 // calc3.SetNumIsland(0); 104 // calc4.SetNumIsland(1); 105 // 106 // // setup tasklist 107 // MTaskList list; 108 // list.Add(&calc0); 109 // list.Add(&calc1); 110 // list.Add(&calc2); 111 // list.Add(&calc3); 112 // list.Add(&calc4); 113 // 114 // 115 // Input/Output Containers 116 // ------------------------- 117 // 118 // 1) MGeomCam 5) MHillas 8) MImagePar 119 // 2) MCerPhotEvt 6) MHillasSrc 9) MNewImagePar 120 // 3) MSrcPosCam 7) MHillasExt 10) MConcentration 121 // 4) fIdxIslands 122 // 123 // Flag | Input Container | Output 124 // -----------------+-----------------+-------- 125 // kCalcHillas | 1 2 4 | 5 126 // kCalcHillasSrc | 3 4 5 | 6 127 // kCalcHillasExt | 1 2 4 5 | 7 128 // kCalcImagePar | 2 | 8 129 // kCalcNewImgPar | 1 2 4 5 | 9 130 // kCalcConc | 1 2 5 | 10 131 // -----------------+-----------------+-------- 58 132 // 59 133 ///////////////////////////////////////////////////////////////////////////// 60 134 #include "MHillasCalc.h" 61 135 136 #include <fstream> // StreamPrimitive 137 62 138 #include "MParList.h" 139 140 #include "MCerPhotEvt.h" 63 141 64 142 #include "MHillas.h" 65 143 #include "MHillasExt.h" 144 #include "MHillasSrc.h" 145 #include "MImagePar.h" 66 146 #include "MNewImagePar.h" 67 147 #include "MConcentration.h" 68 #include "MCerPhotEvt.h"69 148 70 149 #include "MLog.h" … … 75 154 using namespace std; 76 155 156 const TString MHillasCalc::gsDefName = "MHillasCalc"; 157 const TString MHillasCalc::gsDefTitle = "Calculate Hillas and other image parameters"; 158 159 const TString MHillasCalc::gsNameHillas = "MHillas"; // default name of the 'MHillas' container 160 const TString MHillasCalc::gsNameHillasExt = "MHillasExt"; // default name of the 'MHillasExt' container 161 const TString MHillasCalc::gsNameNewImagePar = "MNewImagePar"; // default name of the 'MNewImagePar' container 162 const TString MHillasCalc::gsNameConc = "MConcentration"; // default name of the 'MConcentration' container 163 const TString MHillasCalc::gsNameImagePar = "MImagePar"; // default name of the 'MImagePar' container 164 const TString MHillasCalc::gsNameHillasSrc = "MHillasSrc"; // default name of the 'MHillasSrc' container 165 const TString MHillasCalc::gsNameSrcPosCam = "MSrcPosCam"; // default name of the 'MSrcPosCam' container 166 77 167 // -------------------------------------------------------------------------- 78 168 // … … 80 170 // 81 171 MHillasCalc::MHillasCalc(const char *name, const char *title) 82 : fNameHillas("MHillas"), fNameHillasExt("MHillasExt"), 83 fNameNewImgPar("MNewImagePar"), fNameConc("MConcentration"), 84 fFlags(0xff), fErrors(5) 85 { 86 fName = name ? name : "MHillasCalc"; 87 fTitle = title ? title : "Calculate Hillas and other image parameters"; 88 } 89 90 // -------------------------------------------------------------------------- 91 // 92 // Check for a MCerPhotEvt object from which the Hillas are calculated. 93 // Try to find the Geometry conatiner. Depending on the flags 94 // try to find (and maybe create) the containers MHillas, MHillasExt, 95 // MNewImagePar, too. 172 : fNameHillas(gsNameHillas), fNameHillasExt(gsNameHillasExt), 173 fNameHillasSrc(gsNameHillasSrc), fNameSrcPosCam(gsNameSrcPosCam), 174 fNameConc(gsNameConc), fNameImagePar(gsNameImagePar), 175 fNameNewImagePar(gsNameNewImagePar), 176 fErrors(5), fFlags(0xff), fIdxIsland(-1) 177 { 178 fName = name ? name : gsDefName.Data(); 179 fTitle = title ? title : gsDefTitle.Data(); 180 } 181 182 // -------------------------------------------------------------------------- 183 // 184 // Check for in-/output containers, see class description 96 185 // 97 186 Int_t MHillasCalc::PreProcess(MParList *pList) 98 187 { 99 // necessary 100 fCerPhotEvt = (MCerPhotEvt*)pList->FindObject(AddSerialNumber("MCerPhotEvt")); 101 if (!fCerPhotEvt) 102 { 103 *fLog << err << "MCerPhotEvt not found... aborting." << endl; 104 return kFALSE; 105 } 106 107 // necessary 108 fGeomCam = (MGeomCam*)pList->FindObject(AddSerialNumber("MGeomCam")); 109 if (!fGeomCam) 110 { 111 *fLog << err << "MGeomCam (Camera Geometry) missing in Parameter List... aborting." << endl; 112 return kFALSE; 188 if (TestFlags(~kCalcHillasSrc)) 189 { 190 fCerPhotEvt = (MCerPhotEvt*)pList->FindObject(AddSerialNumber("MCerPhotEvt")); 191 if (!fCerPhotEvt) 192 { 193 *fLog << err << "MCerPhotEvt not found... aborting." << endl; 194 return kFALSE; 195 } 196 } 197 198 if (TestFlags(kCalcHillas|kCalcHillasExt|kCalcNewImagePar|kCalcConc)) 199 { 200 fGeomCam = (MGeomCam*)pList->FindObject(AddSerialNumber("MGeomCam")); 201 if (!fGeomCam) 202 { 203 *fLog << err << "MGeomCam (Camera Geometry) missing in Parameter List... aborting." << endl; 204 return kFALSE; 205 } 113 206 } 114 207 115 208 // depend on whether MHillas is an in- or output container 116 209 if (TestFlag(kCalcHillas)) 210 { 117 211 fHillas = (MHillas*)pList->FindCreateObj("MHillas", AddSerialNumber(fNameHillas)); 118 else 212 if (!fHillas) 213 return kFALSE; 214 } 215 216 if (TestFlags(kCalcHillasExt|kCalcNewImagePar|kCalcConc|kCalcHillasSrc)) 119 217 { 120 218 fHillas = (MHillas*)pList->FindObject(AddSerialNumber(fNameHillas), "MHillas"); 121 *fLog << err << fNameHillas << " [MHillas] not found... aborting." << endl; 122 } 123 if (!fHillas) 124 return kFALSE; 219 if (!fHillas) 220 { 221 *fLog << err << fNameHillas << " [MHillas] not found... aborting." << endl; 222 return kFALSE; 223 } 224 } 125 225 126 226 // if enabled … … 133 233 134 234 // if enabled 235 if (TestFlag(kCalcHillasSrc)) 236 { 237 const MSrcPosCam *src = (MSrcPosCam*)pList->FindObject(AddSerialNumber(fNameSrcPosCam), "MSrcPosCam"); 238 if (!src) 239 { 240 *fLog << warn << AddSerialNumber(fNameSrcPosCam) << " [MSrcPosCam] not found... creating default container." << endl; 241 src = (MSrcPosCam*)pList->FindCreateObj("MSrcPosCam", AddSerialNumber(fNameSrcPosCam)); 242 } 243 if (!src) 244 return kFALSE; 245 246 fHillasSrc = (MHillasSrc*)pList->FindCreateObj("MHillasSrc", AddSerialNumber(fNameHillasSrc)); 247 if (!fHillasSrc) 248 return kFALSE; 249 250 fHillasSrc->SetSrcPos(src); 251 } 252 253 // if enabled 135 254 if (TestFlag(kCalcNewImagePar)) 136 255 { 137 fNewImgPar = (MNewImagePar*)pList->FindCreateObj("MNewImagePar", AddSerialNumber(fNameNewIm gPar));256 fNewImgPar = (MNewImagePar*)pList->FindCreateObj("MNewImagePar", AddSerialNumber(fNameNewImagePar)); 138 257 if (!fNewImgPar) 139 258 return kFALSE; 140 259 } 141 260 142 // if enabled 261 // if enabled 262 if (TestFlag(kCalcImagePar)) 263 { 264 fImagePar = (MImagePar*)pList->FindCreateObj("MImagePar", AddSerialNumber(fNameImagePar)); 265 if (!fImagePar) 266 return kFALSE; 267 } 268 269 // if enabled 143 270 if (TestFlag(kCalcConc)) 144 271 { … … 150 277 memset(fErrors.GetArray(), 0, sizeof(Char_t)*fErrors.GetSize()); 151 278 279 Print(); 280 152 281 return kTRUE; 153 282 } … … 164 293 if (TestFlag(kCalcHillas)) 165 294 { 166 Int_t rc = fHillas->Calc(*fGeomCam, *fCerPhotEvt );295 Int_t rc = fHillas->Calc(*fGeomCam, *fCerPhotEvt, fIdxIsland); 167 296 if (rc<0 || rc>4) 168 297 { … … 175 304 } 176 305 306 if (TestBit(kCalcHillasSrc)) 307 { 308 if (!fHillasSrc->Calc(*fHillas)) 309 { 310 fErrors[5]++; 311 return kCONTINUE; 312 } 313 } 314 177 315 if (TestFlag(kCalcHillasExt)) 178 fHillasExt->Calc(*fGeomCam, *fCerPhotEvt, *fHillas); 316 fHillasExt->Calc(*fGeomCam, *fCerPhotEvt, *fHillas, fIdxIsland); 317 318 if (TestFlag(kCalcImagePar)) 319 fImagePar->Calc(*fCerPhotEvt); 179 320 180 321 if (TestFlag(kCalcNewImagePar)) 181 fNewImgPar->Calc(*fGeomCam, *fCerPhotEvt, *fHillas );322 fNewImgPar->Calc(*fGeomCam, *fCerPhotEvt, *fHillas, fIdxIsland); 182 323 183 324 if (TestFlag(kCalcConc)) … … 209 350 return kTRUE; 210 351 352 if (!TestBit(kCalcHillas) && !TestBit(kCalcHillasSrc)) 353 return kTRUE; 354 211 355 *fLog << inf << endl; 212 356 *fLog << GetDescriptor() << " execution statistics:" << endl; 213 357 *fLog << dec << setfill(' '); 214 PrintSkipped(1, "Less than 3 pixels (before cleaning)"); 215 PrintSkipped(2, "Calculated Size == 0 (after cleaning)"); 216 PrintSkipped(3, "Number of used pixels < 3"); 217 PrintSkipped(4, "CorrXY==0"); 358 if (TestBit(kCalcHillas)) 359 { 360 PrintSkipped(1, "Less than 3 pixels (before cleaning)"); 361 PrintSkipped(2, "Calculated Size == 0 (after cleaning)"); 362 PrintSkipped(3, "Number of used pixels < 3"); 363 PrintSkipped(4, "CorrXY==0"); 364 } 365 if (TestBit(kCalcHillasSrc)) 366 PrintSkipped(5, "Dist==0"); 218 367 *fLog << " " << (int)fErrors[0] << " (" << (int)(100.*fErrors[0]/GetNumExecutions()) << "%) Evts survived Hillas calculation!" << endl; 219 368 *fLog << endl; … … 221 370 return kTRUE; 222 371 } 372 373 // -------------------------------------------------------------------------- 374 // 375 // Print 'Dataflow' 376 // 377 void MHillasCalc::Print(Option_t *o) const 378 { 379 *fLog << inf << GetDescriptor() << ":" << endl; 380 if (TestFlag(kCalcHillas)) 381 *fLog << " - Calculating " << fNameHillas << " from MGeomCam, MCerPhotEvt and fIdxIsland=" << fIdxIsland << endl; 382 if (TestFlag(kCalcHillasSrc)) 383 *fLog << " - Calculating " << fNameHillasSrc << " from " << fNameSrcPosCam << ", " << fNameHillas << " and fIdxIsland=" << fIdxIsland << endl; 384 if (TestFlag(kCalcHillasExt)) 385 *fLog << " - Calculating " << fNameHillasExt << " from MGeomCam, MCerPhotEvt, " << fNameHillas << " and fIdxIsland=" << fIdxIsland << endl; 386 if (TestFlag(kCalcImagePar)) 387 *fLog << " - Calculating " << fNameImagePar << " from MCerPhotEvt" << endl; 388 if (TestFlag(kCalcNewImagePar)) 389 *fLog << " - Calculating " << fNameNewImagePar << " from MGeomCam, MCerPhotEvt, " << fNameHillas << " and fIdxIsland=" << fIdxIsland << endl; 390 if (TestFlag(kCalcConc)) 391 *fLog << " - Calculating " << fNameConc << " from MGeomCam, MCerPhotEvt and " << fNameHillas << endl; 392 } 393 394 // -------------------------------------------------------------------------- 395 // 396 // Implementation of SavePrimitive. Used to write the call to a constructor 397 // to a macro. In the original root implementation it is used to write 398 // gui elements to a macro-file. 399 // 400 void MHillasCalc::StreamPrimitive(ofstream &out) const 401 { 402 out << " MHillasCalc " << GetUniqueName() << "("; 403 if (fName!=gsDefName || fTitle!=gsDefTitle) 404 { 405 out << ", \"" << fName << "\""; 406 if (fTitle!=gsDefTitle) 407 out << ", \"" << fTitle << "\""; 408 } 409 out << ");" << endl; 410 411 if (TestFlags(kCalcHillasExt|kCalcNewImagePar|kCalcConc|kCalcHillasSrc)) 412 { 413 if (fNameHillas!=gsNameHillas) 414 out << " " << GetUniqueName() << ".SetNameHillas(\"" << fNameHillas << "\");" << endl; 415 } 416 if (TestFlag(kCalcHillasSrc) && fNameHillasSrc!=gsNameHillasSrc) 417 { 418 out << " " << GetUniqueName() << ".SetNameHillasSrc(\"" << fNameHillasSrc << "\");" << endl; 419 out << " " << GetUniqueName() << ".SetNameSrcPosCam(\"" << fNameSrcPosCam << "\");" << endl; 420 } 421 if (TestFlag(kCalcHillasExt) && fNameHillasExt!=gsNameHillasExt) 422 out << " " << GetUniqueName() << ".SetNameHillasExt(\"" << fNameHillasExt << "\");" << endl; 423 if (TestFlag(kCalcConc) && fNameConc!=gsNameConc) 424 out << " " << GetUniqueName() << ".SetNameConc(\"" << fNameConc << "\");" << endl; 425 if (TestFlag(kCalcImagePar) && fNameImagePar!=gsNameImagePar) 426 out << " " << GetUniqueName() << ".SetNameImagePar(\"" << fNameImagePar << "\");" << endl; 427 if (TestFlag(kCalcNewImagePar) && fNameNewImagePar!=gsNameNewImagePar) 428 out << " " << GetUniqueName() << ".SetNameNewImagePar(\"" << fNameNewImagePar << "\");" << endl; 429 430 if (!TestFlag(kCalcHillas)) 431 out << " " << GetUniqueName() << ".Disable(MHilllasCalc::kCalcHillas);" << endl; 432 if (!TestFlag(kCalcHillasExt)) 433 out << " " << GetUniqueName() << ".Disable(MHilllasCalc::kCalcHillasExt);" << endl; 434 if (!TestFlag(kCalcHillasSrc)) 435 out << " " << GetUniqueName() << ".Disable(MHilllasCalc::kCalcHillasSrc);" << endl; 436 if (!TestFlag(kCalcNewImagePar)) 437 out << " " << GetUniqueName() << ".Disable(MHilllasCalc::kCalcNewImagePar);" << endl; 438 if (!TestFlag(kCalcConc)) 439 out << " " << GetUniqueName() << ".Disable(MHilllasCalc::kCalcConc);" << endl; 440 if (!TestFlag(kCalcImagePar)) 441 out << " " << GetUniqueName() << ".Disable(MHilllasCalc::kCalcImagePar);" << endl; 442 443 if (fIdxIsland>=0) 444 out << " " << GetUniqueName() << ".SetNumIsland(" << fIdxIsland << ");" << endl; 445 } 446 -
trunk/MagicSoft/Mars/mimage/MHillasCalc.h
r4578 r4710 21 21 class MHillas; 22 22 class MHillasExt; 23 class MHillasSrc; 24 class MImagePar; 23 25 class MNewImagePar; 24 26 class MConcentration; 27 class MSrcPosCam; 25 28 26 29 class MHillasCalc : public MTask 27 30 { 28 const MGeomCam *fGeomCam; //! Camera Geometry used to calculate Hillas29 const MCerPhotEvt *fCerPhotEvt; //! Cerenkov Photon Event used for calculation31 static const TString gsDefName; // default name 32 static const TString gsDefTitle; // default title 30 33 31 MHillas *fHillas; //! output container to store result 32 MHillasExt *fHillasExt; //! output container to store result 33 MNewImagePar *fNewImgPar; //! output container to store result 34 MConcentration *fConc; //! output container to store result 34 static const TString gsNameHillas; // default name of the 'MHillas' container 35 static const TString gsNameHillasExt; // default name of the 'MHillasExt' container 36 static const TString gsNameNewImagePar; // default name of the 'MNewImagePar' container 37 static const TString gsNameConc; // default name of the 'MConcentration' container 38 static const TString gsNameImagePar; // default name of the 'MImagePar' container 39 static const TString gsNameHillasSrc; // default name of the 'MHillasSrc' container 40 static const TString gsNameSrcPosCam; // default name of the 'MSrcPosCam' container 35 41 36 TString fNameHillas; // name of the 'MHillas' container 37 TString fNameHillasExt; // name of the 'MHillasExt' container 38 TString fNameNewImgPar; // name of the 'MNewImagePar' container 39 TString fNameConc; // name of the 'MConcentration' container 42 const MGeomCam *fGeomCam; //! Camera Geometry used to calculate Hillas 43 const MCerPhotEvt *fCerPhotEvt; //! Cerenkov Photon Event used for calculation 40 44 41 Int_t fFlags; // Flags defining the behaviour of MHillasCalc 45 MHillas *fHillas; //! output container to store result 46 MHillasExt *fHillasExt; //! output container to store result 47 MHillasSrc *fHillasSrc; //! output container to store result 48 MImagePar *fImagePar; //! output container to store result 49 MNewImagePar *fNewImgPar; //! output container to store result 50 MConcentration *fConc; //! output container to store result 42 51 43 TArrayL fErrors; //! Error counter. Do we have to change to Double? 52 TString fNameHillas; // name of the 'MHillas' container 53 TString fNameHillasExt; // name of the 'MHillasExt' container 54 TString fNameHillasSrc; // name of the 'MHillasSrc' container 55 TString fNameSrcPosCam; // name of the 'MSrcPosCam' container 56 TString fNameConc; // name of the 'MConcentration' container 57 TString fNameImagePar; // name of the 'MImagePar' container 58 TString fNameNewImagePar; // name of the 'MNewImagePar' container 44 59 60 TArrayL fErrors; //! Error counter. Do we have to change to Double? 61 62 Int_t fFlags; // Flags defining the behaviour of MHillasCalc 63 Short_t fIdxIsland; // Number of island to use for calculation 64 65 // Helper 45 66 void PrintSkipped(int i, const char *str) const; 46 67 68 // MParContainer 69 void StreamPrimitive(ofstream &out) const; 70 71 // MTask 47 72 Int_t PreProcess(MParList *pList); 48 73 Int_t Process(); … … 50 75 51 76 public: 77 // Constructor 78 MHillasCalc(const char *name=NULL, const char *title=NULL); 79 80 // Flags 52 81 enum CalcCont_t { 53 82 kCalcHillas = BIT(0), 54 83 kCalcHillasExt = BIT(1), 55 //kCalcHillasSrc = BIT(2),84 kCalcHillasSrc = BIT(2), 56 85 kCalcNewImagePar = BIT(3), 57 kCalcConc = BIT(4) 86 kCalcConc = BIT(4), 87 kCalcImagePar = BIT(5) 58 88 }; 59 89 60 MHillasCalc(const char *name=NULL, const char *title=NULL); 90 // Setup flags 91 void SetFlags(Int_t f) { fFlags = f; } 92 void Enable(Int_t f) { fFlags |= f; } 93 void Disable(Int_t f) { fFlags &= ~f; } 61 94 62 void SetNameHillas(const char *name) { fNameHillas = name; } 63 void SetNameHillasExt(const char *name) { fNameHillasExt = name; } 64 void SetNameNewImgPar(const char *name) { fNameNewImgPar = name; } 65 void SetNameConc(const char *name) { fNameConc = name; } 95 Bool_t TestFlag(CalcCont_t i) const { return fFlags&i; } 96 Bool_t TestFlags(Int_t i) const { return fFlags&i; } 66 97 67 void SetFlags(Int_t f) { fFlags = f; } 68 void Enable(Int_t f) { fFlags |= f; } 69 void Disable(Int_t f) { fFlags &= ~f; } 70 Bool_t TestFlag(CalcCont_t i) const { return fFlags&i; } 98 // Setup container names 99 void SetNameHillas(const char *name) { fNameHillas = name; } 100 void SetNameHillasExt(const char *name) { fNameHillasExt = name; } 101 void SetNameHillasSrc(const char *name) { fNameHillasSrc = name; } 102 void SetNameNewImagePar(const char *name) { fNameNewImagePar = name; } 103 void SetNameConc(const char *name) { fNameConc = name; } 104 void SetNameImagePar(const char *name) { fNameImagePar = name; } 105 void SetNameSrcPosCam(const char *name) { fNameSrcPosCam = name; } 106 107 // Setup island number 108 void SetIdxIsland(Short_t idx) { fIdxIsland = idx; } 109 110 // TObject 111 void Print(Option_t *o="") const; 71 112 72 113 ClassDef(MHillasCalc, 0) // Task to calculate Hillas and other image parameters -
trunk/MagicSoft/Mars/mimage/MHillasExt.cc
r3682 r4710 138 138 // and the cerenkov photon event 139 139 // 140 Int_t MHillasExt::Calc(const MGeomCam &geom, const MCerPhotEvt &evt, const MHillas &hil )140 Int_t MHillasExt::Calc(const MGeomCam &geom, const MCerPhotEvt &evt, const MHillas &hil, Int_t island) 141 141 { 142 142 // … … 151 151 Double_t m3x = 0; 152 152 Double_t m3y = 0; 153 154 const UInt_t npixevt = evt.GetNumPixels();155 153 156 154 Int_t maxpixid = 0; … … 158 156 Float_t maxdist = 0; 159 157 160 for (UInt_t i=0; i<npixevt; i++) 158 MCerPhotPix *pix = 0; 159 160 TIter Next(evt); 161 while ((pix=(MCerPhotPix*)Next())) 161 162 { 162 const MCerPhotPix &pix = evt[i]; 163 if (!pix.IsPixelUsed()) 163 if (island>=0 && pix->GetIdxIsland()!=island) 164 164 continue; 165 165 166 const Int_t pixid = pix .GetPixId();166 const Int_t pixid = pix->GetPixId(); 167 167 168 168 const MGeomPix &gpix = geom[pixid]; … … 170 170 const Double_t dy = gpix.GetY() - hil.GetMeanY(); // [mm] 171 171 172 Double_t nphot = pix .GetNumPhotons(); // [1]172 Double_t nphot = pix->GetNumPhotons(); // [1] 173 173 174 174 const Double_t dzx = hil.GetCosDelta()*dx + hil.GetSinDelta()*dy; // [mm] -
trunk/MagicSoft/Mars/mimage/MHillasExt.h
r3666 r4710 33 33 Float_t GetMaxDist() const { return fMaxDist; } 34 34 35 Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix, const MHillas &hil); 35 Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix, 36 const MHillas &hil, Int_t island=-1); 36 37 37 38 void Print(Option_t *opt=NULL) const; -
trunk/MagicSoft/Mars/mimage/MHillasSrc.cc
r2624 r4710 99 99 // you call the Reset member function before. 100 100 // 101 Bool_t MHillasSrc::Calc(const MHillas *hillas)101 Bool_t MHillasSrc::Calc(const MHillas &hillas) 102 102 { 103 const Double_t mx = hillas ->GetMeanX(); // [mm]104 const Double_t my = hillas ->GetMeanY(); // [mm]103 const Double_t mx = hillas.GetMeanX(); // [mm] 104 const Double_t my = hillas.GetMeanY(); // [mm] 105 105 106 106 const Double_t sx = mx - fSrcPos->GetX(); // [mm] 107 107 const Double_t sy = my - fSrcPos->GetY(); // [mm] 108 108 109 const Double_t sd = hillas ->GetSinDelta(); // [1]110 const Double_t cd = hillas ->GetCosDelta(); // [1]109 const Double_t sd = hillas.GetSinDelta(); // [1] 110 const Double_t cd = hillas.GetCosDelta(); // [1] 111 111 112 112 // -
trunk/MagicSoft/Mars/mimage/MHillasSrc.h
r2624 r4710 32 32 void Print(const MGeomCam &geom) const; 33 33 34 virtual Bool_t Calc(const MHillas *hillas);34 virtual Bool_t Calc(const MHillas &hillas); 35 35 36 36 void Set(const TArrayF &arr); -
trunk/MagicSoft/Mars/mimage/MHillasSrcCalc.cc
r3666 r4710 114 114 Int_t MHillasSrcCalc::Process() 115 115 { 116 if (!fHillasSrc->Calc( fHillas))116 if (!fHillasSrc->Calc(*fHillas)) 117 117 { 118 118 fErrors++; … … 150 150 void MHillasSrcCalc::StreamPrimitive(ofstream &out) const 151 151 { 152 if (fHillas )153 fHillas->S avePrimitive(out);152 if (fHillas && !fHillas->IsSavedAsPrimitive()) 153 fHillas->StreamPrimitive(out); 154 154 155 if (fSrcPos )156 fSrcPos->S avePrimitive(out);155 if (fSrcPos && !fSrcPos->IsSavedAsPrimitive()) 156 fSrcPos->StreamPrimitive(out); 157 157 158 if (fHillasSrc )159 fHillasSrc->S avePrimitive(out);158 if (fHillasSrc && !fHillasSrc->IsSavedAsPrimitive()) 159 fHillasSrc->StreamPrimitive(out); 160 160 161 161 out << " MHillasSrcCalc " << GetUniqueName() << "("; -
trunk/MagicSoft/Mars/mimage/MHillasSrcCalc.h
r2209 r4710 13 13 { 14 14 private: 15 MHillas *fHillas; //! Pointer to the source independant hillas parameters16 MSrcPosCam *fSrcPos; //! Pointer to the source position17 MHillasSrc *fHillasSrc; //! Pointer to the output container for the source dependant parameters15 const MHillas *fHillas; //! Pointer to the source independant hillas parameters 16 const MSrcPosCam *fSrcPos; //! Pointer to the source position 17 MHillasSrc *fHillasSrc; //! Pointer to the output container for the source dependant parameters 18 18 19 19 TString fSrcName; -
trunk/MagicSoft/Mars/mimage/MNewImagePar.cc
r4188 r4710 59 59 // - added fCoreArea 60 60 // 61 // Version 4: 62 // ---------- 63 // - moved cleaning/island independant parameters to MImagePar: 64 // + removed fNumHGSaturatedPixels 65 // + removed fNumSaturatedPixels 66 // 61 67 // 62 68 ///////////////////////////////////////////////////////////////////////////// … … 88 94 fName = name ? name : "MNewImagePar"; 89 95 fTitle = title ? title : "New image parameters"; 96 97 Reset(); 90 98 } 91 99 … … 109 117 fUsedArea = -1; 110 118 fCoreArea = -1; 111 112 fNumSaturatedPixels = -1;113 fNumHGSaturatedPixels = -1;114 119 } 115 120 … … 119 124 // 120 125 void MNewImagePar::Calc(const MGeomCam &geom, const MCerPhotEvt &evt, 121 const MHillas &hillas )126 const MHillas &hillas, Int_t island) 122 127 { 123 128 fNumUsedPixels = 0; … … 127 132 fCoreArea = 0; 128 133 129 fNumSaturatedPixels = 0;130 fNumHGSaturatedPixels = 0;131 132 134 fInnerSize = 0; 133 134 const UInt_t npixevt = evt.GetNumPixels();135 135 136 136 Double_t edgepix1 = 0; … … 143 143 Float_t maxpix2 = 0; // [#phot] 144 144 145 for (UInt_t i=0; i<npixevt; i++) 145 MCerPhotPix *pix = 0; 146 147 TIter Next(evt); 148 while ((pix=(MCerPhotPix*)Next())) 146 149 { 147 const MCerPhotPix &pix = evt[i]; 148 149 // count saturated pixels 150 if (pix.IsPixelHGSaturated()) 151 fNumHGSaturatedPixels++; 152 if (pix.IsPixelSaturated()) 153 fNumSaturatedPixels++; 154 155 // skip unused pixels 156 if (!pix.IsPixelUsed()) 150 // Check for requested islands 151 if (island>=0 && pix->GetIdxIsland()!=island) 157 152 continue; 158 153 159 154 // Get geometry of pixel 160 const Int_t pixid = pix .GetPixId();155 const Int_t pixid = pix->GetPixId(); 161 156 const MGeomPix &gpix = geom[pixid]; 162 157 163 158 // count used and core pixels 164 if (pix .IsPixelCore())159 if (pix->IsPixelCore()) 165 160 { 166 161 fNumCorePixels++; … … 172 167 fUsedArea += gpix.GetA(); 173 168 174 Double_t nphot = pix .GetNumPhotons();169 Double_t nphot = pix->GetNumPhotons(); 175 170 176 171 // … … 239 234 *fLog << " - Used Area [mm^2] = " << fUsedArea << endl; 240 235 *fLog << " - Core Area [mm^2] = " << fCoreArea << endl; 241 *fLog << " - Sat.Pixels/HG [#] = " << fNumHGSaturatedPixels << " Pixels" << endl;242 *fLog << " - Sat.Pixels/LG [#] = " << fNumSaturatedPixels << " Pixels" << endl;243 236 } 244 237 … … 263 256 *fLog << " - Used Area [deg^2] = " << fUsedArea*geom.GetConvMm2Deg()*geom.GetConvMm2Deg() << endl; 264 257 *fLog << " - Core Area [deg^2] = " << fCoreArea*geom.GetConvMm2Deg()*geom.GetConvMm2Deg() << endl; 265 *fLog << " - Sat.Pixels/HG [#] = " << fNumHGSaturatedPixels << " Pixels" << endl; 266 *fLog << " - Sat.Pixels/LG [#] = " << fNumSaturatedPixels << " Pixels" << endl; 267 } 258 } -
trunk/MagicSoft/Mars/mimage/MNewImagePar.h
r4143 r4710 13 13 { 14 14 private: 15 // FIXME: MOVE ALL PARAMETRS WHICH DOES'T DEPEND ON THE IMAGE 16 // CLEANING TO A NEW CLASS! 15 17 Float_t fLeakage1; // (photons in most outer ring of pixels) over fSize 16 18 Float_t fLeakage2; // (photons in the 2 outer rings of pixels) over fSize … … 26 28 Short_t fNumUsedPixels; // Number of pixels which survived the image cleaning 27 29 Short_t fNumCorePixels; // number of core pixels 28 Short_t fNumHGSaturatedPixels; // number of pixels with saturating hi-gains29 Short_t fNumSaturatedPixels; // number of pixels with saturating lo-gains30 30 31 31 public: … … 50 50 Float_t GetCoreArea() const { return fCoreArea; } 51 51 52 Short_t GetNumSaturatedPixels() const { return fNumSaturatedPixels; }53 Short_t GetNumHGSaturatedPixels() const { return fNumHGSaturatedPixels; }54 55 52 void Print(Option_t *opt=NULL) const; 56 53 void Print(const MGeomCam &geom) const; 57 54 58 55 void Calc(const MGeomCam &geom, const MCerPhotEvt &evt, 59 const MHillas &hillas );56 const MHillas &hillas, Int_t island=-1); 60 57 61 ClassDef(MNewImagePar, 3) // Container to hold new image parameters58 ClassDef(MNewImagePar, 4) // Container to hold new image parameters 62 59 }; 63 60 -
trunk/MagicSoft/Mars/mimage/Makefile
r4702 r4710 34 34 MHillasCalc.cc \ 35 35 MHillasSrcCalc.cc \ 36 MImagePar.cc \ 36 37 MNewImagePar.cc \ 37 38 MConcentration.cc \ … … 39 40 MHHillasSrc.cc \ 40 41 MHHillasExt.cc \ 42 MHImagePar.cc \ 41 43 MHNewImagePar.cc \ 42 44 MStereoPar.cc \ -
trunk/MagicSoft/Mars/mpointing/MSrcPosCam.h
r3568 r4710 13 13 Float_t fX; // [mm] x position of source in camera 14 14 Float_t fY; // [mm] y position of source in camera 15 16 void StreamPrimitive(ofstream &out) const;17 15 18 16 public: … … 31 29 32 30 void Print(Option_t *opt=NULL) const; 31 void StreamPrimitive(ofstream &out) const; 33 32 34 33 //void AsciiRead(ifstream &fin);
Note:
See TracChangeset
for help on using the changeset viewer.