Changeset 9519 for trunk/MagicSoft/Mars
- Timestamp:
- 10/26/09 15:13:28 (15 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MStatusArray.cc
r9039 r9519 72 72 // -------------------------------------------------------------------------- 73 73 // 74 // Remove objects matching the id (the first character of their class 75 // name) recuresively 76 // 77 void MStatusArray::RecursiveDelete(TVirtualPad *p, const char id) const 78 { 79 if (!p) 80 return; 81 82 TIter Next2(p->GetListOfPrimitives()); 83 TObject *o=0; 84 while ((o=Next2())) 85 { 86 if (!dynamic_cast<TVirtualPad*>(o) && (o->ClassName()[0]==id || id==0)) 87 delete p->GetListOfPrimitives()->Remove(o); 88 else 89 RecursiveDelete(dynamic_cast<TVirtualPad*>(o), id); 90 } 91 92 } 93 94 // -------------------------------------------------------------------------- 95 // 96 // Make sure to set the kMustCleanup for all object in our tree 97 // which will later be deleted when the array is destructed. 98 // 99 void MStatusArray::SetCleanup(TObject *obj) const 100 { 101 if (!obj) 102 return; 103 104 TVirtualPad *pad = dynamic_cast<TVirtualPad*>(obj); 105 106 // Do not set the bit for pads because it would end in 107 // endless recursions 108 if (pad && !dynamic_cast<TCanvas*>(obj)) 109 obj->ResetBit(kMustCleanup); 110 else 111 obj->SetBit(kMustCleanup); 112 113 if (!pad) 114 return; 115 116 TIter Next(pad->GetListOfPrimitives()); 117 TObject *o=0; 118 while ((o=Next())) 119 SetCleanup(o); 120 } 121 122 // -------------------------------------------------------------------------- 123 // 124 // Try to do a delete of the whole list in a way which is less vulnarable 125 // to double deletion due to wrongly set bits or other things 126 // 127 void MStatusArray::Delete(Option_t *) 128 { 129 // Add this to the list of cleanups to ensure as many cleaning 130 // operations as possible are propagated 131 gROOT->GetListOfCleanups()->Add(this); 132 133 // First make sure that all kMustCleanup bits are se 134 TIter Next(this); 135 TObject *o=0; 136 while ((o=Next())) 137 SetCleanup(o); 138 139 // Now delete the MARS object first because we have full control 140 // of them 141 TIter Next2(this); 142 while ((o=Next2())) 143 RecursiveDelete(dynamic_cast<TVirtualPad*>(o), 'M'); 144 145 // Now delete all root objects 146 TIter Next3(this); 147 while ((o=Next3())) 148 RecursiveDelete(dynamic_cast<TVirtualPad*>(o)); 149 150 // And delete all the rest 151 TObjArray::Delete(); 152 153 // Remove it from the list again 154 gROOT->GetListOfCleanups()->Remove(this); 155 } 156 157 // -------------------------------------------------------------------------- 158 // 74 159 // If o==NULL a new status display is created, otherwise the one with name o 75 160 // is searched in gROOT->GetListOfSpecials(). … … 335 420 } 336 421 422 MStatusArray::~MStatusArray() 423 { 424 // This is the destructor from TObjArray... 425 // It must be here, because for some reason I don't know it 426 // is otherwise not correctly executed from the Interpreter 427 // (root 5.12/00f) 428 if (IsOwner()) 429 Delete(); 430 431 TStorage::Dealloc(fCont); 432 433 fCont = 0; 434 fSize = 0; 435 } 436 337 437 // -------------------------------------------------------------------------- 338 438 // … … 344 444 // It seems that the contents are not properly deleted by TObjArray::Read 345 445 Delete(); 446 447 SetOwner(); 346 448 347 449 const TString keyname = name?name:"MStatusDisplay"; … … 372 474 TObject *o2=0; 373 475 while ((o2=Next2())) 374 if (o2->InheritsFrom( "MParContainer"))476 if (o2->InheritsFrom(MParContainer::Class())) 375 477 o2->SetBit(kCanDelete); 376 478 } -
trunk/MagicSoft/Mars/mbase/MStatusArray.h
r9490 r9519 19 19 }; 20 20 21 void SetCleanup(TObject *obj) const; 22 void RecursiveDelete(TVirtualPad *p, const char id=0) const; 23 21 24 void SetCanDelete(const TCollection *list) const; 22 25 void SetMyCanDelete(const TCollection *list) const; … … 28 31 MStatusArray() : TObjArray() { } 29 32 MStatusArray(const MStatusDisplay &d); 33 ~MStatusArray(); 30 34 31 35 TObject *DisplayIn(Option_t *o=0) const; // *MENU* … … 56 60 57 61 void EnableTH1Workaround(const TCollection *list=0) const; 62 void Delete(Option_t *option=""); 58 63 59 64 ClassDef(MStatusArray, 0) // Helper class for status display -
trunk/MagicSoft/Mars/mgeom/MGeomPix.h
r9441 r9519 38 38 } 39 39 40 void SetD(Float_t d=1) { fD=d; fA=d*d*gs Tan60/2; }40 void SetD(Float_t d=1) { fD=d; fA=d*d*gsSin60; } 41 41 void SetPhi(Double_t phi=0); 42 42 … … 45 45 Float_t GetT() const { return fD/gsTan60; } // Distance between two opposite edges (traverse) 46 46 47 Float_t GetDx() const { return fD; } 48 Float_t GetDy() const { return fD*gs Tan60/2; } // Distance of two rows in y-direction (without rotation)47 Float_t GetDx() const { return fD; } // Distance of two rows in x-direction (without rotation) 48 Float_t GetDy() const { return fD*gsSin60; } // Distance of two rows in y-direction (without rotation) 49 49 50 50 Bool_t IsInside(Float_t px, Float_t py) const; -
trunk/MagicSoft/Mars/mhist/Makefile
r9379 r9519 6 6 # 7 7 ################################################################## 8 include ../Makefile.conf.general 8 9 include ../Makefile.conf.$(OSTYPE) 9 include ../Makefile.conf.general10 10 11 11 #------------------------------------------------------------------------------ -
trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc
r9481 r9519 126 126 // 127 127 MJCalibrateSignal::MJCalibrateSignal(const char *name, const char *title) 128 : fExtractor(0), fIsInterlaced(kTRUE), fIsRelTimesUpdate(kTRUE), fIsMovieMode(kFALSE) 128 : fExtractor(0), fIsInterlaced(kTRUE), fIsRelTimesUpdate(kTRUE), fIsMovieMode(kFALSE), fIsTestMode(kFALSE) 129 129 { 130 130 fName = name ? name : "MJCalibrateSignal"; … … 263 263 if (fSequence.IsValid()) 264 264 { 265 if (fSequence.GetRuns(iter, MSequence::kRawDat)<=0)265 if (fSequence.GetRuns(iter, fIsTestMode?MSequence::kRawCal:MSequence::kRawDat)<=0) 266 266 return kFALSE; 267 267 } … … 383 383 read->AddFiles(iter); 384 384 385 const TString fname(Form("s/(([0-9]+_)?(M[12]_)?[0-9.]+)_ D_(.*[.])(raw|raw[.]gz|root)$/%s\\/$1_Y_$4root/",385 const TString fname(Form("s/(([0-9]+_)?(M[12]_)?[0-9.]+)_[CD]_(.*[.])(raw|raw[.]gz|root)$/%s\\/$1_Y_$4root/", 386 386 Esc(fPathOut).Data())); 387 387 … … 460 460 fcalped.AllowTriggerLvl2(); 461 461 fcalped.AllowSumTrigger(); 462 if (fIsTestMode) 463 fcalped.AllowCalibration(); 462 464 463 465 // This will skip interleaved events with a cal- or ped-trigger … … 810 812 811 813 //MFDataPhrase filcalco("MCalibrationConstCam.IsReadyToSave>0.5", "CalibConstFilter"); 812 if (fIsInterlaced )814 if (fIsInterlaced && !fIsTestMode) 813 815 { 814 816 // The task list is executed for all events with the calibration … … 867 869 // Check if we have an extremely bright event (remove them, 868 870 // they are presumably errornous events or calibration events) 869 tlist2.AddToList(&contbright); 871 if (!fIsTestMode) 872 tlist2.AddToList(&contbright); 870 873 871 874 /* -
trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.h
r8518 r9519 25 25 Bool_t fIsRelTimesUpdate; // Choose to update relative times from interlaced 26 26 Bool_t fIsMovieMode; // Choose to encode a movie 27 Bool_t fIsTestMode; // Testmode to calibrate the cal run 27 28 28 29 Bool_t CheckEnvLocal(); … … 46 47 void SetRelTimesUpdate(const Bool_t b=kTRUE) { fIsRelTimesUpdate = b; } 47 48 void SetMovieMode (const Bool_t b=kTRUE) { fIsMovieMode = b; } 49 void SetTestMode (const Bool_t b=kTRUE) { fIsTestMode = b; } 48 50 49 51 void SetExtractor(const MExtractor *ext=NULL); -
trunk/MagicSoft/Mars/mjtrain/Makefile
r8643 r9519 6 6 # 7 7 ################################################################## 8 include ../Makefile.conf.general 8 9 include ../Makefile.conf.$(OSTYPE) 9 include ../Makefile.conf.general10 10 11 11 #------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.