Changeset 1222
- Timestamp:
- 02/21/02 14:46:59 (23 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/macros/MagicHillas.C
r1221 r1222 40 40 41 41 // 42 // Here I create MHillasExt, which replaces the usage of MHillas 42 // Uncomment this two line if you want to use MHillasExt instead 43 // of MHillas 43 44 // 44 MHillasExt hext;45 plist.AddToList(&hext);45 //MHillasExt hext; 46 //plist.AddToList(&hext); 46 47 47 48 // … … 110 111 MFillH hfill2s("HistSource [MHHillasSrc]", "HillasSource"); 111 112 MFillH hfill2a("HistAntiSrc [MHHillasSrc]", "HillasAntiSrc"); 112 /* 113 113 114 MWriteRootFile write("hillas.root"); 114 115 write.AddContainer("MHillas", "Hillas"); … … 116 117 write.AddContainer("HillasAntiSrc", "Hillas"); 117 118 write.AddContainer("MHStarMap"); 118 */ 119 MWriteAsciiFile write("hillas.txt"); 120 write.AddContainer("MHillas", "fLength"); 121 write.AddContainer("MHillas", "fConc"); 122 write.AddContainer("MHillas"); 119 120 /* 121 MWriteAsciiFile write("hillas.txt"); 122 write.AddContainer("MHillas", "fLength"); 123 write.AddContainer("MHillas", "fConc"); 124 write.AddContainer("MHillas"); 125 */ 123 126 124 127 tlist.AddToList(&read); … … 149 152 return; 150 153 151 return;152 153 154 tlist.PrintStatistics(); 154 155 -
trunk/MagicSoft/Mars/manalysis/MHillasExt.cc
r1220 r1222 41 41 42 42 #include <fstream.h> 43 #include <math.h>44 43 45 44 #include "MGeomPix.h" … … 162 161 m3y /= GetSize(); 163 162 164 fM3Long = m3x<0 ? -pow( fabs(m3x), 1./3) : pow(fabs(m3x), 1./3); // [mm]165 fM3Trans = m3y<0 ? -pow( fabs(m3y), 1./3) : pow(fabs(m3y), 1./3); // [mm]163 fM3Long = m3x<0 ? -pow(-m3x, 1./3) : pow(m3x, 1./3); // [mm] 164 fM3Trans = m3y<0 ? -pow(-m3y, 1./3) : pow(m3y, 1./3); // [mm] 166 165 167 166 SetReadyToSave(); … … 184 183 185 184 // ------------------------------------------------------------------------- 186 / /185 /* 187 186 void MHillasExt::AsciiWrite(ofstream &fout) const 188 187 { … … 196 195 fout << fM3Trans; 197 196 } 197 */ -
trunk/MagicSoft/Mars/manalysis/MHillasExt.h
r1203 r1222 24 24 void Reset(); 25 25 26 Float_t GetConc() const { return fConc; } 27 Float_t GetConc1() const { return fConc1; } 28 Float_t GetAsym() const { return fAsym; } 29 Float_t GetM3Long() const { return fM3Long; } 30 Float_t GetM3Trans() const { return fM3Trans; } 31 26 32 Bool_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix); 27 33 … … 29 35 30 36 void AsciiRead(ifstream &fin); 31 void AsciiWrite(ofstream &fout) const;37 //void AsciiWrite(ofstream &fout) const; 32 38 33 39 ClassDef(MHillasExt, 1) // Storage Container for extended Hillas Parameter -
trunk/MagicSoft/Mars/mbase/MParContainer.cc
r1218 r1222 40 40 41 41 #include <TClass.h> // IsA 42 #include <TBaseClass.h> // GetClassPointer 42 43 #include <TROOT.h> // TROOT::Identlevel 43 44 #include <TMethodCall.h> // TMethodCall, AsciiWrite … … 216 217 // Write out a data member given as a TDataMember object to an output stream. 217 218 // 218 Bool_t MParContainer::WriteDataMember(ostream &out, TDataMember *member) const219 Bool_t MParContainer::WriteDataMember(ostream &out, const TDataMember *member) const 219 220 { 220 221 if (!member) 221 222 return kFALSE; 222 223 223 if (!member->IsPersistent() )224 return kFALSE; 225 226 /*const*/ TMethodCall *call = member->GetterMethod(); //FIXME: Root224 if (!member->IsPersistent() || member->Property()&kIsStatic) 225 return kFALSE; 226 227 /*const*/ TMethodCall *call = ((TDataMember*)member)->GetterMethod(); //FIXME: Root 227 228 if (!call) 228 return kFALSE; 229 { 230 *fLog << warn << "Sorry, no getter method found for " << member->GetName() << endl; 231 return kFALSE; 232 } 229 233 230 234 switch (call->ReturnType()) … … 256 260 Bool_t MParContainer::WriteDataMember(ostream &out, const char *member) const 257 261 { 258 return WriteDataMember(out, IsA()->GetDataMember(member)); 262 /*const*/ TClass *cls = IsA()->GetBaseDataMember(member); 263 if (!cls) 264 return kFALSE; 265 266 return WriteDataMember(out, cls->GetDataMember(member)); 267 } 268 269 // -------------------------------------------------------------------------- 270 // 271 // Write out a data member from a given TList of TDataMembers. 272 // returns kTRUE when at least one member was successfully written 273 // 274 Bool_t MParContainer::WriteDataMember(ostream &out, const TList *list) const 275 { 276 Bool_t rc = kFALSE; 277 278 TDataMember *data = NULL; 279 280 TIter Next(list); 281 while ((data=(TDataMember*)Next())) 282 rc |= WriteDataMember(out, data); 283 284 return rc; 259 285 } 260 286 … … 267 293 // Only data members which are of integer (Bool_t, Int_t, ...) or 268 294 // floating point (Float_t, Double_t, ...) type are written. 269 // 270 void MParContainer::AsciiWrite(ostream &out) const 295 // returns kTRUE when at least one member was successfully written 296 // 297 Bool_t MParContainer::AsciiWrite(ostream &out) const 271 298 { 272 299 // *fLog << warn << "To use the the ascii output of " << GetName(); 273 300 // *fLog << " you have to overload " << ClassName() << "::AsciiWrite." << endl; 274 301 275 TDataMember *data = NULL; 276 277 TIter Next(IsA()->GetListOfDataMembers()); 278 while ((data=(TDataMember*)Next())) 279 WriteDataMember(out, data); 280 } 302 Bool_t rc = WriteDataMember(out, IsA()->GetListOfDataMembers()); 303 304 TIter NextBaseClass(IsA()->GetListOfBases()); 305 TBaseClass *base; 306 while ((base = (TBaseClass*) NextBaseClass())) 307 { 308 /*const*/ TClass *cls = base->GetClassPointer(); 309 310 if (!cls) 311 continue; 312 313 rc |= WriteDataMember(out, cls->GetListOfDataMembers()); 314 } 315 316 return rc; 317 } -
trunk/MagicSoft/Mars/mbase/MParContainer.h
r1218 r1222 67 67 68 68 Bool_t WriteDataMember(ostream &out, const char *member) const; 69 Bool_t WriteDataMember(ostream &out, TDataMember *member) const; 69 Bool_t WriteDataMember(ostream &out, const TDataMember *member) const; 70 Bool_t WriteDataMember(ostream &out, const TList *list) const; 70 71 71 72 virtual void AsciiRead(ifstream &fin); 72 virtual voidAsciiWrite(ostream &out) const;73 virtual Bool_t AsciiWrite(ostream &out) const; 73 74 74 75 ClassDef(MParContainer, 0) //The basis for all parameter containers -
trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.cc
r1219 r1222 154 154 155 155 if (memb->GetName()[0]=='\0') 156 cont->AsciiWrite(*fOut); 156 { 157 if (!cont->AsciiWrite(*fOut)) 158 continue; 159 } 157 160 else 158 161 { … … 167 170 } 168 171 169 if (written) 170 *fOut << endl; 172 if (!written) 173 return; 174 175 *fOut << endl; 171 176 172 177 if (num!=0) 173 *fLog << warn << "Warning - given number of containers doesn't fit number of written containers." << endl;178 *fLog << warn << "Warning - given number of containers doesn't fit number of written containers." << endl; 174 179 } 175 180
Note:
See TracChangeset
for help on using the changeset viewer.