Changeset 5844 for trunk/MagicSoft
- Timestamp:
- 01/14/05 15:58:24 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r5843 r5844 35 35 36 36 37 37 38 2005/01/14 Thomas Bretz 38 39 … … 42 43 * manalysis/MGeomApply.cc: 43 44 - removed some old code already in comments 45 - added possibility to switch off automatic processing (used 46 if two different geometries around) 44 47 45 48 * manalysis/MMultiDimDistCalc.cc, mhbase/MHMatrix.[h,cc], -
trunk/MagicSoft/Mars/manalysis/MGeomApply.cc
r5832 r5844 47 47 // specified in the constructor. The default geometry is 48 48 // MGeomCamMagic. 49 // 50 // In a standard setup all containers in the parameter list which derive 51 // from MCamEvent are processed automatically in ReInit. To allow having 52 // two parallel geometries in the parameter list or for MCamEvent in the 53 // parameter list you can switch off the automatic procedure by adding 54 // the containers to be processed using AddCamEvent(). 55 // 49 56 // 50 57 // Input Containers: 51 58 // [MGeomCam] 59 // [all MCamEvent] 52 60 // 53 61 // Output Containers: 54 // [MPedestalCam] 55 // [MCalibrationChargeCam] 56 // [MCalibrationRelTimeCam] 57 // [MCalibrationQECam] 58 // [MCalibrationPedCam] 59 // [MPedPhotCam] 60 // [MExtractedSignalCam] 61 // [MArrivalTime] 62 // [MArrivalTimeCam] 62 // [all MCamEvent] 63 63 // 64 64 ////////////////////////////////////////////////////////////////////////////// … … 67 67 #include <fstream> 68 68 69 #include <TObjString.h> 70 69 71 #include "MLog.h" 70 72 #include "MLogManip.h" … … 73 75 74 76 #include "MGeomCam.h" 75 #include "MPedestalCam.h" 76 #include "MCalibrationCam.h" 77 #include "MPedPhotCam.h" 78 #include "MExtractedSignalCam.h" 79 #include "MArrivalTimeCam.h" 80 #include "MArrivalTime.h" 81 #include "MBadPixelsCam.h" 77 #include "MCamEvent.h" 82 78 83 79 ClassImp(MGeomApply); … … 89 85 // Default constructor. MGeomCamMagic is the default geometry. 90 86 // 91 MGeomApply::MGeomApply(const char *name, const char *title) : fGeomName("MGeomCamMagic") 87 MGeomApply::MGeomApply(const char *name, const char *title) 88 : fGeomName("MGeomCamMagic"), fNamesList(0), fList(0) 92 89 { 93 90 fName = name ? name : "MGeomApply"; 94 91 fTitle = title ? title : "Task to apply geometry settings"; 92 } 93 94 // -------------------------------------------------------------------------- 95 // 96 // Delete fList if available. 97 // 98 MGeomApply::~MGeomApply() 99 { 100 if (fList) 101 delete fList; 102 if (fNamesList) 103 delete fNamesList; 95 104 } 96 105 … … 109 118 110 119 return cam ? kTRUE : kFALSE; 120 } 121 122 // -------------------------------------------------------------------------- 123 // 124 // Check the whole parameter list for MCamEvent. For all MCamEvent 125 // MCamEvent::Init(MGeomCam&) is called. 126 // 127 void MGeomApply::ProcessAutomatic(MParList &list, const MGeomCam &geom) const 128 { 129 TIter Next(list); 130 TObject *o = 0; 131 132 while ((o=Next())) 133 { 134 MCamEvent *cam = dynamic_cast<MCamEvent*>(o); 135 if (cam) 136 cam->Init(geom); 137 } 138 } 139 140 // -------------------------------------------------------------------------- 141 // 142 // Check all containers in fNamesList and fList. For all MCamEvent 143 // MCamEvent::Init(MGeomCam&) is called. 144 // 145 Bool_t MGeomApply::ProcessManual(MParList &list, const MGeomCam &geom) const 146 { 147 TIter NextN(fNamesList); 148 TObject *o = 0; 149 150 while ((o=NextN())) 151 { 152 TObject *cont = list.FindObject(o->GetName(), "MCamEvent"); 153 if (!cont) 154 { 155 *fLog << err << o->GetName() << " [MCamEvent] not found... abort." << endl; 156 return kFALSE; 157 } 158 159 MCamEvent *cam = dynamic_cast<MCamEvent*>(o); 160 cam->Init(geom); 161 } 162 163 TIter NextL(fList); 164 while ((o=NextL())) 165 { 166 MCamEvent *cam = dynamic_cast<MCamEvent*>(o); 167 cam->Init(geom); 168 } 169 170 return kTRUE; 111 171 } 112 172 … … 130 190 geom->CalcPixRatio(); 131 191 132 TIter Next(*pList); 133 TObject *o = 0; 134 135 while ((o=Next())) 136 { 137 MCamEvent *cam = dynamic_cast<MCamEvent*>(o); 138 if (cam) 139 cam->Init(*geom); 140 } 192 if (fList) 193 return ProcessManual(*pList, *geom); 194 195 ProcessAutomatic(*pList, *geom); 141 196 142 197 return kTRUE; … … 160 215 out << fGeomName << "\");" << endl; 161 216 } 217 218 // -------------------------------------------------------------------------- 219 // 220 // Add a MCamEvent to be processed. This switches off the automatic 221 // processing of all MCamEvent in the parameter list completely! 222 // 223 void MGeomApply::AddCamEvent(TObject *obj) 224 { 225 if (!obj->InheritsFrom(MCamEvent::Class())) 226 { 227 *fLog << warn << "MGeomApply::AddCamEvent - WARNING: Object doesn't inherit from MCamEvent... ignored." << endl; 228 return; 229 } 230 231 if (!fList) 232 { 233 fList = new TList; 234 fNamesList = new TList; 235 236 fNamesList->SetOwner(); 237 } 238 239 fList->Add(obj); 240 } 241 242 // -------------------------------------------------------------------------- 243 // 244 // Add a MCamEvent to be processed. This switches off the automatic 245 // processing of all MCamEvent in the parameter list completely! 246 // 247 void MGeomApply::AddCamEvent(const char *name) 248 { 249 if (!fList) 250 { 251 fList = new TList; 252 fNamesList = new TList; 253 254 fNamesList->SetOwner(); 255 } 256 257 fNamesList->Add(new TObjString(name)); 258 } -
trunk/MagicSoft/Mars/manalysis/MGeomApply.h
r2899 r5844 7 7 8 8 class MParList; 9 class MGeomCam; 9 10 10 11 class MGeomApply : public MTask … … 12 13 private: 13 14 TString fGeomName; // Name of geometry class 15 16 TList *fNamesList; 17 TList *fList; 18 19 void ProcessAutomatic(MParList &plist, const MGeomCam &geom) const; 20 Bool_t ProcessManual(MParList &plist, const MGeomCam &geom) const; 14 21 15 22 Int_t PreProcess(MParList *plist); … … 19 26 public: 20 27 MGeomApply(const char *name=NULL, const char *title=NULL); 28 ~MGeomApply(); 21 29 22 30 void SetGeometry(TString geom) { fGeomName = geom; } 31 32 void AddCamEvent(TObject *obj); 33 void AddCamEvent(const char *name); 23 34 24 35 ClassDef(MGeomApply, 0) // Task to apply geometry settings
Note:
See TracChangeset
for help on using the changeset viewer.