Changeset 1481 for trunk/MagicSoft/Mars
- Timestamp:
- 08/05/02 14:30:21 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1480 r1481 1 1 -*-*- END -*-*- 2 2 3 2002/08/05: Thomas Bretz 4 5 * mbase/MEvtLoop.[h,cc]: 6 - added a warning in case of duplicate names in the lists 7 - added orresponding member functions (HasDuplicateNames) 8 - added some sanity checks, checking for an open file 9 10 * mbase/MFilter.[h,cc]: 11 - added GetRule virtual member function 12 13 * mbase/MFilterList.[h,cc]: 14 - added GetRule 15 - added StreamPrimitive 16 - added name and title to the constructor 17 - set version number to 1 18 19 * mbase/MTask.h: 20 - removed const qualifiers from fFilter (seems, that the root io 21 doesn't like it) 22 23 * mdata/MDataChain.[h,cc], mdata/MDataList.[h,cc], mdata/MDataMember.[h,cc], 24 mdata/MDataValue.[h,cc]: 25 - set class version to 1 26 - added default constructor if missing 27 - added fDataMember to MDataMember (formaly fName isn't stored) 28 29 * mfilter/MF.[h,cc], mfilter/MFAlpha.[h,cc], mfilter/MFDataMember.[h,cc], 30 mfilter/MFParticleId.[h,cc], mfilter/MFTriggerLvl1.[h,cc]: 31 - added StreamPrimitive 32 - removed const qualifiers from data members 33 - added the "!" to the data member storing the result 34 - added GetRule 35 36 * mhist/MFillH.[h,cc]: 37 - fixed some small bugs in StreamPrimitive 38 39 * mhist/MH3.[h,cc]: 40 - added the missing const-qualifier of StreamPrimitive 41 42 43 3 44 2002/08/06: Wolfgang Wittek 4 45 5 46 * mbase/MTask.cc : 6 - redefinition of default argument in MTask: SavePrimitive removed47 - redefinition of default argument in MTask::SavePrimitive removed 7 48 8 49 -
trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
r1476 r1481 70 70 #include "MEvtLoop.h" 71 71 72 #include <time.h> 73 #include <fstream.h> // ofstream, SavePrimitive72 #include <time.h> // time_t 73 #include <fstream.h> // ofstream, SavePrimitive 74 74 #include <iostream.h> 75 75 76 #include <TSystem.h> 76 #include <TFile.h> // gFile 77 #include <TSystem.h> // gSystem 77 78 #include <TStopwatch.h> 78 79 #include <TGProgressBar.h> … … 352 353 // to a macro. In the original root implementation it is used to write 353 354 // gui elements to a macro-file. 354 355 355 // 356 356 void MEvtLoop::SavePrimitive(ofstream &out, Option_t *) 357 357 { 358 fParList->SavePrimitive(out); 358 if (HasDuplicateNames("MEvtLoop::SavePrimitive")) 359 { 360 out << " // !" << endl; 361 out << " // ! WARNING - Your eventloop (MParList, MTaskList, ...) contains more than" << endl; 362 out << " // ! one object (MParContainer, MTask, ...) with the same name. The created macro" << endl; 363 out << " // ! may need manual intervention before it can be used." << endl; 364 out << " // !" << endl; 365 out << endl; 366 } 367 368 if (fParList) 369 fParList->SavePrimitive(out); 359 370 360 371 out << " MEvtLoop evtloop;" << endl; 361 out << " evtloop.SetParList(&" << ToLower(fParList->GetName()) << ");" << endl; 372 if (fParList) 373 out << " evtloop.SetParList(&" << ToLower(fParList->GetName()) << ");" << endl; 374 else 375 out << " // fParList empty..." << endl; 362 376 out << " if (!evtloop.Eventloop())" << endl; 363 377 out << " return;" << endl; 364 378 } 365 379 380 // -------------------------------------------------------------------------- 381 // 382 // Get a list of all conmtainer names which are somehow part of the 383 // eventloop. Chack for duplicate members and print a warning if 384 // duplicates are found. Return kTRUE if duplicates are found, otherwise 385 // kFALSE; 386 // 387 Bool_t MEvtLoop::HasDuplicateNames(TObjArray &arr, const TString txt) const 388 { 389 arr.Sort(); 390 391 TIter Next(&arr); 392 TObject *obj; 393 TString name; 394 Bool_t found = kFALSE; 395 while ((obj=Next())) 396 { 397 if (name==obj->GetName()) 398 { 399 if (!found) 400 { 401 *fLog << warn << endl; 402 *fLog << " ! WARNING (" << txt << ")" << endl; 403 *fLog << " ! Your eventloop (MParList, MTaskList, ...) contains more than" << endl; 404 *fLog << " ! one object (MParContainer, MTask, ...) with the same name." << endl; 405 *fLog << " ! Creating a macro from it using MEvtLoop::MakeMacro may create" << endl; 406 *fLog << " ! a macro which needs manual intervention before it can be used." << endl; 407 found = kTRUE; 408 } 409 *fLog << " ! Please rename: " << obj->GetName() << endl; 410 } 411 name = obj->GetName(); 412 } 413 414 return found; 415 } 416 417 // -------------------------------------------------------------------------- 418 // 419 // Get a list of all conmtainer names which are somehow part of the 420 // eventloop. Chack for duplicate members and print a warning if 421 // duplicates are found. Return kTRUE if duplicates are found, otherwise 422 // kFALSE; 423 // 424 Bool_t MEvtLoop::HasDuplicateNames(const TString txt) const 425 { 426 if (!fParList) 427 return kFALSE; 428 429 TObjArray list; 430 list.SetOwner(); 431 432 fParList->GetNames(list); 433 434 return HasDuplicateNames(list, txt); 435 } 436 437 // -------------------------------------------------------------------------- 438 // 439 // Reads a saved eventloop from a file. The default name is "Evtloop". 440 // Therefor an open file must exist (See TFile for more information) 441 // 442 // eg: 443 // TFile file("myfile.root", "READ"); 444 // MEvtLoop evtloop; 445 // evtloop.Read(); 446 // evtloop.MakeMacro("mymacro"); 447 // 366 448 Int_t MEvtLoop::Read(const char *name) 367 449 { 450 if (!gFile) 451 { 452 *fLog << err << "MEvtloop::Read: No file found. Please create a TFile first." << endl; 453 return 0; 454 } 455 456 if (!gFile->IsOpen()) 457 { 458 *fLog << err << "MEvtloop::Read: File not open. Please open the TFile first." << endl; 459 return 0; 460 } 461 368 462 Int_t n = 0; 369 463 TObjArray list; 370 464 371 465 n += TObject::Read(name); 466 467 if (n==0) 468 { 469 *fLog << err << "MEvtloop::Read: No objects read." << endl; 470 return 0; 471 } 472 372 473 n += list.Read((TString)name+"_names"); 373 474 374 475 fParList->SetNames(list); 375 476 477 HasDuplicateNames(list, "MEvtLoop::Read"); 478 376 479 return n; 377 480 } 378 481 482 // -------------------------------------------------------------------------- 483 // 484 // Writes a eventloop to a file. The default name is "Evtloop". 485 // Therefor an open file must exist (See TFile for more information) 486 // 487 // eg: 488 // TFile file("myfile.root", "RECREATE"); 489 // MEvtLoop evtloop; 490 // evtloop.Write(); 491 // file.Close(); 492 // 379 493 Int_t MEvtLoop::Write(const char *name, Int_t option, Int_t bufsize) 380 494 { 495 if (!gFile) 496 { 497 *fLog << err << "MEvtloop::Write: No file found. Please create a TFile first." << endl; 498 return 0; 499 } 500 501 if (!gFile->IsOpen()) 502 { 503 *fLog << err << "MEvtloop::Write: File not open. Please open the TFile first." << endl; 504 return 0; 505 } 506 507 if (!gFile->IsWritable()) 508 { 509 *fLog << err << "MEvtloop::Write: File not writable." << endl; 510 return 0; 511 } 512 381 513 Int_t n = 0; 382 514 … … 386 518 fParList->GetNames(list); 387 519 520 n += TObject::Write(name, option, bufsize); 521 522 if (n==0) 523 { 524 *fLog << err << "MEvtloop::Read: No objects written." << endl; 525 return 0; 526 } 527 388 528 n += list.Write((TString)name+"_names", kSingleKey); 389 n += TObject::Write(name, option, bufsize); 529 530 HasDuplicateNames(list, "MEvtLoop::Write"); 390 531 391 532 return n; -
trunk/MagicSoft/Mars/mbase/MEvtLoop.h
r1474 r1481 27 27 28 28 enum { kIsOwner = BIT(14) }; 29 30 Bool_t HasDuplicateNames(const TString txt) const; 31 Bool_t HasDuplicateNames(TObjArray &arr, const TString txt) const; 29 32 30 33 public: -
trunk/MagicSoft/Mars/mbase/MFilter.cc
r1211 r1481 98 98 return kTRUE; 99 99 } 100 101 TString MFilter::GetRule() const 102 { 103 return "<GetRule not available for " + fName + ">"; 104 } -
trunk/MagicSoft/Mars/mbase/MFilter.h
r1211 r1481 19 19 virtual Bool_t PostProcess(); 20 20 21 virtual TString GetRule() const; 22 21 23 ClassDef(MFilter, 0) // Abstract base class for the filters 22 24 }; -
trunk/MagicSoft/Mars/mbase/MFilterList.cc
r1283 r1481 31 31 #include "MFilterList.h" 32 32 33 #include <fstream.h> 34 33 35 #include <TString.h> 34 36 … … 53 55 // lor, || : is a logical or 54 56 // 55 MFilterList::MFilterList(const char *type) 56 { 57 MFilterList::MFilterList(const char *type, const char *name, const char *title) 58 { 59 fName = name ? name : "MFilterList"; 60 fTitle = title ? title : "List combining filters logically."; 61 57 62 fFilterType = kEAnd; 58 63 … … 236 241 void MFilterList::Print(Option_t *opt) const 237 242 { 243 *fLog << all << GetRule(opt) << flush; 244 } 245 246 // -------------------------------------------------------------------------- 247 // 248 // Implementation of SavePrimitive. Used to write the call to a constructor 249 // to a macro. In the original root implementation it is used to write 250 // gui elements to a macro-file. 251 // 252 void MFilterList::StreamPrimitive(ofstream &out) const 253 { 254 out << " MFilterList " << ToLower(fName) << "(\""; 255 256 switch (fFilterType) 257 { 258 case kEAnd: 259 out << "&"; 260 break; 261 262 case kEOr: 263 out << "|"; 264 break; 265 266 case kEXor: 267 out << "^"; 268 break; 269 270 case kELAnd: 271 out << "&&"; 272 break; 273 274 case kELOr: 275 out << "||"; 276 break; 277 } 278 279 out << fName << "\", \"" << fName << "\", \"" << fTitle << "\");" << endl << endl; 280 281 TIter Next(&fFilters); 282 283 TObject *cont = NULL; 284 while ((cont=Next())) 285 { 286 cont->SavePrimitive(out, ""); 287 288 out << " " << ToLower(fName) << ".AddToList(&"; 289 out << ToLower(cont->GetName()) << ");" << endl << endl; 290 } 291 } 292 293 TString MFilterList::GetRule(Option_t *opt) const 294 { 238 295 TString str(opt); 239 296 const Bool_t verbose = str.Contains("V", TString::kIgnoreCase); 240 297 241 //*fLog << all << "(" << GetName() << "=" << (int)fFilterType << ")"; 242 243 *fLog << all << "("; 298 TString ret = "("; 244 299 245 300 TIter Next(&fFilters); … … 251 306 // 252 307 if (!filter) 253 { 254 *fLog << "<empty>)" << flush; 255 return; 256 } 257 258 filter->Print(); 308 return "<empty>"; 309 310 ret += filter->GetRule(); 259 311 260 312 while ((filter=(MFilter*)Next())) … … 263 315 { 264 316 case kEAnd: 265 *fLog <<(verbose?" and ":" & ");317 ret += (verbose?" and ":" & "); 266 318 break; 267 319 268 320 case kEOr: 269 *fLog <<(verbose?" or ":" | ");321 ret += (verbose?" or ":" | "); 270 322 break; 271 323 272 324 case kEXor: 273 *fLog <<(verbose?" xor ":" ^ ");325 ret += (verbose?" xor ":" ^ "); 274 326 break; 275 327 276 328 case kELAnd: 277 *fLog <<(verbose?" land ":" && ");329 ret += (verbose?" land ":" && "); 278 330 break; 279 331 280 332 case kELOr: 281 *fLog <<(verbose?" lor ":" || ");333 ret += (verbose?" lor ":" || "); 282 334 break; 283 335 } 284 336 285 filter->Print(); 286 } 287 288 *fLog << ")" << flush; 289 } 290 337 ret += filter->GetRule(); 338 } 339 340 return ret+")"; 341 } -
trunk/MagicSoft/Mars/mbase/MFilterList.h
r1020 r1481 29 29 enum { kIsOwner = BIT(14) }; 30 30 31 void StreamPrimitive(ofstream &out) const; 32 31 33 public: 32 MFilterList(const char *type="&&" );34 MFilterList(const char *type="&&", const char *name=NULL, const char *title=NULL); 33 35 MFilterList(MFilterList &ts); 34 36 ~MFilterList() … … 48 50 49 51 void Print(Option_t *opt = "") const; 52 TString GetRule(Option_t *opt="") const; 50 53 51 ClassDef(MFilterList, 0) // List to combine several filters logically54 ClassDef(MFilterList, 1) // List to combine several filters logically 52 55 }; 53 56 -
trunk/MagicSoft/Mars/mbase/MTask.h
r1477 r1481 24 24 TList *fListOfBranches; //! List of Branch names for auto enabeling scheme 25 25 26 const MFilter *fFilter;// Filter for conditional task execution26 MFilter *fFilter; // Filter for conditional task execution 27 27 28 28 Bool_t fIsPreprocessed; //! Indicates the success of the PreProcessing (set by MTaskList) … … 68 68 virtual ~MTask(); 69 69 70 void SetFilter( constMFilter *filter) { fFilter=filter; }70 void SetFilter(MFilter *filter) { fFilter=filter; } 71 71 const MFilter *GetFilter() const { return fFilter; } 72 72 virtual void PrintStatistics(const Int_t lvl=0) const; -
trunk/MagicSoft/Mars/mdata/MDataChain.cc
r1474 r1481 496 496 switch (fOperatorType) 497 497 { 498 case kEAbs: str += "abs" 499 case kELog: str += "log" 500 case kELog10: str += "log10" 501 case kESin: str += "sin" 502 case kECos: str += "cos" 503 case kETan: str += "tan" 504 case kESinH: str += "sinh" 505 case kECosH: str += "cosh" 506 case kETanH: str += "tanh" 507 case kEASin: str += "asin" 508 case kEACos: str += "acos" 509 case kEATan: str += "atan" 510 case kESqrt: str += "sqrt" 511 case kEExp: str += "exp" 512 case kEPow10: str += "pow10" 513 case kESgn: str += "sgn" 514 case kENegative: str += "-" 515 case kEPositive: str += "+" 498 case kEAbs: str += "abs" ; break; 499 case kELog: str += "log" ; break; 500 case kELog10: str += "log10"; break; 501 case kESin: str += "sin" ; break; 502 case kECos: str += "cos" ; break; 503 case kETan: str += "tan" ; break; 504 case kESinH: str += "sinh" ; break; 505 case kECosH: str += "cosh" ; break; 506 case kETanH: str += "tanh" ; break; 507 case kEASin: str += "asin" ; break; 508 case kEACos: str += "acos" ; break; 509 case kEATan: str += "atan" ; break; 510 case kESqrt: str += "sqrt" ; break; 511 case kEExp: str += "exp" ; break; 512 case kEPow10: str += "pow10"; break; 513 case kESgn: str += "sgn" ; break; 514 case kENegative: str += "-" ; break; 515 case kEPositive: str += "+" ; break; 516 516 case kENoop: 517 517 break; -
trunk/MagicSoft/Mars/mdata/MDataChain.h
r1474 r1481 67 67 TString GetRule() const; 68 68 69 ClassDef(MDataChain, 0) // A chain/concatenation of MData objects69 ClassDef(MDataChain, 1) // A chain/concatenation of MData objects 70 70 }; 71 71 -
trunk/MagicSoft/Mars/mdata/MDataList.cc
r1474 r1481 38 38 // -------------------------------------------------------------------------- 39 39 // 40 // Default Constructor. Not for usage! 41 // 42 MDataList::MDataList() 43 { 44 fSign = kENone; 45 } 46 47 // -------------------------------------------------------------------------- 48 // 40 49 // Constructor. 41 50 // 42 // Specify the boolean operation which is used to evaluate the 43 // result of this list. If no operation is specified "land" is 44 // used. 51 // Specify the operation which is used to evaluate the 52 // result of this list. 45 53 // 46 54 // Options: 47 // and, & : is a bitwise and 48 // or, | : is a bitwise or 49 // xor, ^ : is a bitwise exclusive or 50 // land, && : is a logical and 51 // lor, || : is a logical or 55 // *, /, -, + 52 56 // 53 57 MDataList::MDataList(char type) -
trunk/MagicSoft/Mars/mdata/MDataList.h
r1474 r1481 29 29 30 30 public: 31 MDataList(); 31 32 MDataList(char type); 32 33 MDataList(MDataList &ts); … … 49 50 TString GetRule() const; 50 51 51 ClassDef(MDataList, 0) // A concatenation of MData objects by one operator52 ClassDef(MDataList, 1) // A concatenation of MData objects by one operator 52 53 }; 53 54 -
trunk/MagicSoft/Mars/mdata/MDataMember.cc
r1474 r1481 36 36 // 37 37 ///////////////////////////////////////////////////////////////////////////// 38 #include "MDataMember.h" 38 39 39 #include "MDataMember.h"40 #include <fstream.h> 40 41 41 42 #include <TMethodCall.h> … … 59 60 fObject = obj; 60 61 fCall = call; 62 63 fDataMember = (TString)obj->GetName() + "." + call->GetName(); 61 64 } 62 65 … … 72 75 fObject = obj; 73 76 fCall = obj->GetterMethod(call); 77 78 fDataMember = (TString)obj->GetName() + "." + call; 74 79 } 75 80 … … 82 87 if (!fCall) 83 88 { 84 *fLog << err << "No TMethodCall for " << f Name<< " of ";89 *fLog << err << "No TMethodCall for " << fDataMember << " of "; 85 90 *fLog << fObject->GetName() << " available... returning 0." << endl; 86 91 return 0; … … 100 105 101 106 default: 102 *fLog << err << "DataMember " << f Name<< " of ";107 *fLog << err << "DataMember " << fDataMember << " of "; 103 108 *fLog << fObject->GetName() << " neither int nor float... returning 0." << endl; 104 109 return 0; … … 120 125 return kTRUE; 121 126 122 TString cname(f Name);123 TString mname(f Name);127 TString cname(fDataMember); 128 TString mname(fDataMember); 124 129 125 130 const char *dot = strrchr(cname, '.'); … … 167 172 TString MDataMember::GetRule() const 168 173 { 169 return f Name;174 return fDataMember; 170 175 } -
trunk/MagicSoft/Mars/mdata/MDataMember.h
r1474 r1481 15 15 { 16 16 private: 17 TString fDataMember; 18 17 19 MParContainer *fObject; 18 20 TMethodCall *fCall; 19 21 20 22 public: 21 MDataMember(const char *member ) : fObject(NULL), fCall(NULL)23 MDataMember(const char *member=NULL) : fObject(NULL), fCall(NULL) 22 24 { 23 f Name= member;25 fDataMember = member; 24 26 } 27 25 28 MDataMember(MParContainer *obj, TMethodCall *call); 26 29 MDataMember(MParContainer *obj, const TString call); … … 35 38 TString GetRule() const; 36 39 37 ClassDef(MDataMember, 0) // MData object corresponding to a single data member of a Mars container40 ClassDef(MDataMember, 1) // MData object corresponding to a single data member of a Mars container 38 41 }; 39 42 -
trunk/MagicSoft/Mars/mdata/MDataValue.h
r1474 r1481 31 31 TString GetRule() const; 32 32 33 ClassDef(MDataValue, 0) // MData object corresponding to a single value33 ClassDef(MDataValue, 1) // MData object corresponding to a single value 34 34 }; 35 35 -
trunk/MagicSoft/Mars/mfilter/MF.cc
r1283 r1481 71 71 #include "MF.h" 72 72 73 #include <ctype.h> // isalnum, ... 73 74 #include <stdlib.h> // strtod, ... 74 #include < ctype.h> // isalnum, ...75 #include <fstream.h> // ofstream, ... 75 76 76 77 #include <TMethodCall.h> … … 368 369 return fFilter->IsExpressionTrue(); 369 370 } 371 372 void MF::StreamPrimitive(ofstream &out) const 373 { 374 out << " MF " << ToLower(fName) << ""; 375 } 376 -
trunk/MagicSoft/Mars/mfilter/MF.h
r1283 r1481 24 24 MFilter *ParseString(TString txt, Int_t level); 25 25 26 void StreamPrimitive(ofstream &out) const; 27 26 28 public: 27 29 MF(const char *text, const char *name=NULL, const char *title=NULL); -
trunk/MagicSoft/Mars/mfilter/MFAlpha.cc
r1276 r1481 28 28 // // 29 29 ///////////////////////////////////////////////////////////////////////////// 30 31 30 #include "MFAlpha.h" 32 31 33 32 #include <math.h> 33 #include <fstream.h> 34 35 #include "MLog.h" 36 #include "MLogManip.h" 34 37 35 38 #include "MParList.h" 36 #include "MLog.h"37 #include "MLogManip.h"38 39 39 40 #include "MHillasSrc.h" … … 53 54 // -------------------------------------------------------------------------- 54 55 // 55 MFAlpha::MFAlpha( constMHillasSrc *hillas, const char type, const Float_t val,56 MFAlpha::MFAlpha(MHillasSrc *hillas, const char type, const Float_t val, 56 57 const char *name, const char *title) : fHillas(hillas) 57 58 { … … 111 112 } 112 113 114 void MFAlpha::StreamPrimitive(ofstream &out) const 115 { 116 if (fHillas) 117 fHillas->SavePrimitive(out); 118 119 out << " MFParticleId " << ToLower(fName) << "("; 120 121 if (fHillas) 122 out << "&" << ToLower(fHillas->GetName()); 123 else 124 out << "\"" << fContName << "\""; 125 126 out << ", '" << (fFilterType==kELowerThan?"<":">") << "', " << fValue << ");" << endl; 127 128 } -
trunk/MagicSoft/Mars/mfilter/MFAlpha.h
r1276 r1481 18 18 { 19 19 private: 20 constMHillasSrc *fHillas;20 MHillasSrc *fHillas; 21 21 TString fContName; 22 22 … … 24 24 FilterType_t fFilterType; 25 25 26 Bool_t fResult; 26 Bool_t fResult; //! 27 27 Float_t fValue; // [deg] 28 28 … … 30 30 const char *name, const char *title); 31 31 32 void StreamPrimitive(ofstream &out) const; 33 32 34 public: 33 MFAlpha(const char 35 MFAlpha(const char *cname="MHillas", const char type='>', const Float_t deg=15, 34 36 const char *name=NULL, const char *title=NULL); 35 MFAlpha( const MHillasSrc *hillas,const char type='>', const Float_t deg=15,37 MFAlpha(MHillasSrc *hillas, const char type='>', const Float_t deg=15, 36 38 const char *name=NULL, const char *title=NULL); 37 39 … … 40 42 Bool_t Process(); 41 43 42 ClassDef(MFAlpha, 0) // A Filter for cuts in fabs(alpha)44 ClassDef(MFAlpha, 1) // A Filter for cuts in fabs(alpha) 43 45 }; 44 46 -
trunk/MagicSoft/Mars/mfilter/MFDataMember.cc
r1333 r1481 42 42 // 43 43 ///////////////////////////////////////////////////////////////////////////// 44 #include "MFDataMember.h" 44 45 45 #include "MFDataMember.h"46 #include <fstream.h> 46 47 47 48 #include <TMethodCall.h> … … 97 98 void MFDataMember::Print(Option_t *) const 98 99 { 99 fData.Print(); 100 *fLog << (fFilterType==kELowerThan?"<":">") << fValue << flush; 100 *fLog << GetRule() << flush; 101 101 } 102 103 void MFDataMember::StreamPrimitive(ofstream &out) const 104 { 105 out << " MFDataMember " << ToLower(fName) << "(\""; 106 out << fData.GetRule() << "\", '"; 107 out << (fFilterType==kELowerThan?"<":">"); 108 out << "', " << fValue << ");" << endl; 109 } 110 111 TString MFDataMember::GetRule() const 112 { 113 TString ret = fData.GetRule(); 114 ret += fFilterType==kELowerThan?"<":">"; 115 ret += fValue; 116 return ret; 117 } 118 -
trunk/MagicSoft/Mars/mfilter/MFDataMember.h
r1333 r1481 25 25 FilterType_t fFilterType; 26 26 27 Bool_t fResult; 27 Bool_t fResult; //! 28 28 Double_t fValue; 29 30 void StreamPrimitive(ofstream &out) const; 29 31 30 32 public: … … 37 39 38 40 void Print(Option_t *opt = "") const; 41 TString GetRule() const; 39 42 40 ClassDef(MFDataMember, 0) // A Filter for cuts in any data member43 ClassDef(MFDataMember, 1) // A Filter for cuts in any data member 41 44 }; 42 45 -
trunk/MagicSoft/Mars/mfilter/MFParticleId.cc
r1337 r1481 25 25 ///////////////////////////////////////////////////////////////////////////// 26 26 // // 27 // MFParticleId // 27 // MFParticleId // 28 // // 29 // A filter to choose between different particle types, identified by // 30 // their monte carlo particle type. For a list of idetifiers see // 31 // mbase/MAGIC.h // 28 32 // // 29 33 ///////////////////////////////////////////////////////////////////////////// 30 31 34 #include "MFParticleId.h" 32 35 33 #include "MParList.h" 36 #include <fstream.h> 37 34 38 #include "MLog.h" 35 39 #include "MLogManip.h" 40 41 #include "MParList.h" 36 42 37 43 #include "MMcEvt.hxx" … … 51 57 // -------------------------------------------------------------------------- 52 58 // 53 MFParticleId::MFParticleId( constMMcEvt *mcevt, const char type, const Int_t val,59 MFParticleId::MFParticleId(MMcEvt *mcevt, const char type, const Int_t val, 54 60 const char *name, const char *title) : fMcEvt(mcevt) 55 61 { … … 117 123 } 118 124 125 void MFParticleId::StreamPrimitive(ofstream &out) const 126 { 127 if (fMcEvt) 128 fMcEvt->SavePrimitive(out); 129 130 out << " MFParticleId " << ToLower(fName) << "("; 131 132 if (fMcEvt) 133 out << "&" << ToLower(fMcEvt->GetName()); 134 else 135 out << "\"" << fContName << "\""; 136 137 out << ", '" << (fFilterType==kEEqual?"=":"!") << "', "; 138 139 switch (fValue) 140 { 141 case kGAMMA: 142 out << "kGAMMA"; 143 break; 144 case kPROTON: 145 out << "kPROTON"; 146 break; 147 case kHELIUM: 148 out << "kHELIUM"; 149 break; 150 case kOXYGEN: 151 out << "kOXYGEN"; 152 break; 153 case kIRON: 154 out << "kIRON"; 155 break; 156 default: 157 out << fValue; 158 } 159 out << ");" << endl; 160 } -
trunk/MagicSoft/Mars/mfilter/MFParticleId.h
r1337 r1481 18 18 { 19 19 private: 20 constMMcEvt *fMcEvt;20 MMcEvt *fMcEvt; 21 21 TString fContName; 22 22 … … 24 24 FilterType_t fFilterType; 25 25 26 Bool_t fResult; 26 Bool_t fResult; //! 27 27 Int_t fValue; 28 28 … … 30 30 const char *name, const char *title); 31 31 32 void StreamPrimitive(ofstream &out) const; 33 32 34 public: 33 35 MFParticleId(const char *cname="MMcEvt", const char type='=', const Int_t val=0, 34 36 const char *name=NULL, const char *title=NULL); 35 MFParticleId( constMMcEvt *mcevt, const char type='=', const Int_t val=0,37 MFParticleId(MMcEvt *mcevt, const char type='=', const Int_t val=0, 36 38 const char *name=NULL, const char *title=NULL); 37 39 … … 40 42 Bool_t Process(); 41 43 42 ClassDef(MFParticleId, 0) // A Filter for the Level 1 Trigger44 ClassDef(MFParticleId, 1) // A Filter for the Level 1 Trigger 43 45 }; 44 46 -
trunk/MagicSoft/Mars/mfilter/MFTriggerLvl1.cc
r1211 r1481 28 28 // // 29 29 ///////////////////////////////////////////////////////////////////////////// 30 31 30 #include "MFTriggerLvl1.h" 32 31 33 #include "MParList.h" 32 #include <fstream.h> 33 34 34 #include "MLog.h" 35 35 #include "MLogManip.h" 36 37 #include "MParList.h" 36 38 37 39 #include "MMcTrig.hxx" … … 51 53 // -------------------------------------------------------------------------- 52 54 // 53 MFTriggerLvl1::MFTriggerLvl1( constMMcTrig *mctrig, const char type, const Int_t val,55 MFTriggerLvl1::MFTriggerLvl1(MMcTrig *mctrig, const char type, const Int_t val, 54 56 const char *name, const char *title) : fMcTrig(mctrig) 55 57 { … … 116 118 } 117 119 120 void MFTriggerLvl1::StreamPrimitive(ofstream &out) const 121 { 122 if (fMcTrig) 123 fMcTrig->SavePrimitive(out); 124 125 out << " MFTriggerLvl1 " << ToLower(fName) << "("; 126 127 if (fMcTrig) 128 out << "&" << ToLower(fMcTrig->GetName()); 129 else 130 out << "\"" << fContName << "\""; 131 132 out << ", '" << (fFilterType==kELowerThan?"<":">") << "', " << fValue << ");" << endl; 133 134 } -
trunk/MagicSoft/Mars/mfilter/MFTriggerLvl1.h
r1211 r1481 18 18 { 19 19 private: 20 constMMcTrig *fMcTrig;20 MMcTrig *fMcTrig; 21 21 TString fContName; 22 22 23 23 typedef enum { kELowerThan, kEGreaterThan } FilterType_t; 24 FilterType_t fFilterType; 24 FilterType_t fFilterType; 25 25 26 Bool_t fResult; 26 Bool_t fResult; //! 27 27 Int_t fValue; 28 28 … … 30 30 const char *name, const char *title); 31 31 32 void StreamPrimitive(ofstream &out) const; 33 32 34 public: 33 35 MFTriggerLvl1(const char *cname="MMcTrig", const char type='>', const Int_t val=0, 34 36 const char *name=NULL, const char *title=NULL); 35 MFTriggerLvl1( const MMcTrig *mctrig,const char type='>', const Int_t val=0,37 MFTriggerLvl1(MMcTrig *mctrig, const char type='>', const Int_t val=0, 36 38 const char *name=NULL, const char *title=NULL); 37 39 … … 40 42 Bool_t Process(); 41 43 42 ClassDef(MFTriggerLvl1, 0)// A Filter for the Level 1 Trigger44 ClassDef(MFTriggerLvl1, 1) // A Filter for the Level 1 Trigger 43 45 }; 44 46 -
trunk/MagicSoft/Mars/mhist/MFillH.cc
r1477 r1481 364 364 else 365 365 out << "\"" << fHName << "\""; 366 out << ", ";367 366 368 367 if (fParContainer) 369 out << " &" << ToLower(fParContainer->GetName());368 out << ", &" << ToLower(fParContainer->GetName()); 370 369 else 371 out << "\"" << fParContainerName << "\""; 370 if (!fParContainerName.IsNull()) 371 out << ", \"" << fParContainerName << "\""; 372 372 373 373 out << ");" << endl; -
trunk/MagicSoft/Mars/mhist/MH3.cc
r1477 r1481 384 384 // gui elements to a macro-file. 385 385 // 386 void MH3::StreamPrimitive(ofstream &out) 386 void MH3::StreamPrimitive(ofstream &out) const 387 387 { 388 388 TString name = ToLower(fName); -
trunk/MagicSoft/Mars/mhist/MH3.h
r1477 r1481 24 24 Double_t fScale[3]; 25 25 26 void StreamPrimitive(ofstream &out) ;26 void StreamPrimitive(ofstream &out) const; 27 27 28 28 public:
Note:
See TracChangeset
for help on using the changeset viewer.