- Timestamp:
- 10/24/01 15:12:21 (23 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 4 deleted
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/NEWS
r961 r988 12 12 object at any state of the analysis, so that the output are several 13 13 states 14 15 - Fixed a bug in the collection area error calculation 16 (Thanks to Ciro and Abelardo) 17 18 - Fixed a bug which causes merpp to crash in some environments 19 20 - Speed up reading MC files alot, by choosing the right Branches/Leafs 14 21 15 22 -
trunk/MagicSoft/Mars/macros/collarea.C
r971 r988 34 34 MTaskList tasklist; 35 35 36 //37 // Setup the parameter list.38 // - we need to create MCollArea only. The other containers39 // are created automatically without loss - we don't have to40 // access them-41 // - MCollArea must be created by us because we need the pointer42 // to it and if it would get created automatically it would also be43 // deleted automatically44 //45 36 parlist.AddToList(&tasklist); 46 47 MHMcCollectionArea *collArea = new MHMcCollectionArea;48 parlist.AddToList(collArea);49 37 50 38 // … … 64 52 MTask task; 65 53 tasklist.AddToList(&task); 66 67 54 68 55 // … … 84 71 // filled and can be displayd 85 72 // 86 collArea->Draw();73 parlist.FindObject("MHMcCollectionArea")->DrawClone(); 87 74 } -
trunk/MagicSoft/Mars/macros/threshold.C
r971 r988 24 24 25 25 26 void threshold(char* filename="data/ CrabNebula_dnsb_09_loop.root")26 void threshold(char* filename="data/camera.root") 27 27 { 28 28 // … … 30 30 // MMcThresholdCalc and shows the results. 31 31 // 32 MParList 32 MParList parlist; 33 33 34 34 MTaskList tasklist; … … 43 43 // taking only the trigger information from MMcTrig 44 44 // 45 const UInt_t numtriggerconditions = 4; 45 const UInt_t numtrigcond = 0; 46 47 UInt_t from = numtrigcond>0 ? 1 : -numtrigcond; 48 UInt_t to = numtrigcond>0 ? numtrigcond : -numtrigcond; 49 50 Int_t dim = to-from+1; 46 51 47 52 // … … 49 54 // and store the histograms in an TObjArray 50 55 // 51 TObjArray *hists = new TObjArray(MParList::CreateObjList("MHMcEnergy", numtriggerconditions)); 56 TObjArray hists(MParList::CreateObjList("MHMcEnergy", from, to)); 57 hists.SetOwner(); 52 58 53 59 // 54 60 // Check if the list really contains the right number of histograms 55 61 // 56 if (hists ->GetEntriesFast() != numtriggerconditions)62 if (hists.GetEntriesFast() != dim) 57 63 return; 58 64 … … 60 66 // Add the histograms to the paramater list. 61 67 // 62 parlist.AddToList( hists);68 parlist.AddToList(&hists); 63 69 64 70 // … … 71 77 // like one dimension MMcThresholdCalc 72 78 // 73 MReadTree read("Events;7", filename); 74 MMcThresholdCalc calc(numtriggerconditions); 79 MReadTree read("Events", filename); 80 read.UseLeaf("fEnergy"); 81 read.UseLeaf("fNumFirstLevel"); 82 83 MMcThresholdCalc calc(numtrigcond); 75 84 76 85 tasklist.AddToList(&read); … … 90 99 // Now you can display the results 91 100 // 92 for (UInt_t i=0; i<numtriggerconditions; i++) 93 ((*hists)[i])->Draw(); 101 TIter Next(&hists); 102 TObject *obj; 103 while ((obj=Next())) 104 obj->DrawClone(); 94 105 } -
trunk/MagicSoft/Mars/macros/trigrate.C
r984 r988 109 109 return; 110 110 111 TIter Next(&hists); 112 MHMcRate *r=NULL; 113 while ((r=(MHMcRate*)Next())) 114 r->Print(); 111 hists.Print(); 115 112 } -
trunk/MagicSoft/Mars/mbase/MReadTree.cc
r965 r988 42 42 // calling MReadTree::UseLeaf. // 43 43 // // 44 // FIXME: An automatic enabeling scheme would be nice. // 45 // // 44 46 // Later we'll use TChain::SetNotify to notify MReadTree if the TChain // 45 47 // starts to read a new file. // … … 258 260 Bool_t MReadTree::Process() 259 261 { 260 return fChain->GetEntry(fNumEntry++ , 0) == 0 ? kFALSE : kTRUE;262 return fChain->GetEntry(fNumEntry++) == 0 ? kFALSE : kTRUE; 261 263 } 262 264 -
trunk/MagicSoft/Mars/mbase/MTask.cc
r961 r988 67 67 #include "MTask.h" 68 68 69 #include "MLog.h" 70 #include "MLogManip.h" 71 72 #include "MFilter.h" 73 69 74 ClassImp(MTask); 75 76 MTask::MTask(const char *name, const char *title) 77 : fFilter(NULL), fIsPreprocessed(kFALSE), fNumExecutions() 78 { 79 *fName = name ? name : "MTask"; 80 *fTitle = title ? title : "Base class for all tasks (dummy task)."; 81 } 82 83 // -------------------------------------------------------------------------- 84 // 85 // Mapper function for PreProcess. 86 // Sets the preprocessed flag dependend on the return value of PreProcess. 87 // 88 Bool_t MTask::CallPreProcess(MParList *plist) 89 { 90 if (!PreProcess(plist)) 91 return kFALSE; 92 93 fIsPreprocessed = kTRUE; 94 return kTRUE; 95 } 96 97 // -------------------------------------------------------------------------- 98 // 99 // Mapper function for Process. 100 // Executes Process dependent on the existance of a filter and its possible 101 // return value. 102 // If Process is executed, the execution counter is increased. 103 // 104 inline Bool_t MTask::CallProcess() 105 { 106 // 107 // Check for the existance of a filter. If a filter is existing 108 // check for its value. If the value is kFALSE don't execute 109 // this task. 110 // 111 const Bool_t exec = fFilter ? fFilter->IsExpressionTrue() : kTRUE; 112 113 if (!exec) 114 return kTRUE; 115 116 fNumExecutions++; 117 return Process(); 118 } 119 120 // -------------------------------------------------------------------------- 121 // 122 // Mapper function for PreProcess. 123 // Calls Postprocess dependent on the state of the preprocessed flag, 124 // resets this flag. 125 // 126 Bool_t MTask::CallPostProcess() 127 { 128 if (!fIsPreprocessed) 129 return kTRUE; 130 131 fIsPreprocessed = kFALSE; 132 return PostProcess(); 133 } 70 134 71 135 // -------------------------------------------------------------------------- … … 105 169 } 106 170 107 171 // -------------------------------------------------------------------------- 172 // 173 // Prints the number of times this task has been processed. 174 // For convinience the lvl argument results in a number of spaces at the 175 // beginning of the line. So that the structur of a tasklist can be 176 // identified. 177 // 178 void MTask::PrintStatistics(const Int_t lvl) const 179 { 180 *fLog << setw(lvl) << " " << GetName() << " ["; 181 *fLog << ClassName() << "] \t" << fNumExecutions; 182 *fLog << endl; 183 } -
trunk/MagicSoft/Mars/mbase/MTask.h
r867 r988 23 23 24 24 Bool_t fIsPreprocessed; // Indicates the success of the PreProcessing (set by MTaskList) 25 26 public: 27 MTask() : fFilter(NULL), fIsPreprocessed(kFALSE) {} 28 ~MTask() 29 { 30 } 31 32 const MFilter *GetFilter() const { return fFilter; } 33 void SetFilter(const MFilter *filter) { fFilter=filter; } 34 35 Bool_t IsPreprocessed() const { return fIsPreprocessed; } 36 void SetIsPreprocessed(Bool_t state=kTRUE) { fIsPreprocessed = state; } 25 UInt_t fNumExecutions; // Number of Excutions 37 26 38 27 virtual Bool_t PreProcess(MParList *pList); … … 40 29 virtual Bool_t PostProcess(); 41 30 31 public: 32 MTask(const char *name=NULL, const char *title=NULL); 33 virtual ~MTask() 34 { 35 } 36 37 void SetFilter(const MFilter *filter) { fFilter=filter; } 38 virtual void PrintStatistics(const Int_t lvl=0) const; 39 40 Bool_t CallPreProcess(MParList *plist); 41 Bool_t CallProcess(); 42 Bool_t CallPostProcess(); 43 42 44 ClassDef(MTask, 0) //Abstract base class for a task 43 45 }; -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r961 r988 49 49 #include "MLog.h" 50 50 #include "MLogManip.h" 51 #include "MFilter.h" 51 52 52 #include "MParList.h" 53 53 #include "MInputStreamID.h" … … 232 232 *fLog << task->GetName() << "... " << flush; 233 233 234 if (!task-> PreProcess(fParList))234 if (!task->CallPreProcess(fParList)) 235 235 return kFALSE; 236 237 task->SetIsPreprocessed();238 236 } 239 237 … … 278 276 279 277 // 280 // Check for the existance of a filter. If a filter is existing 281 // check for its value. If the value is kFALSE don't execute 282 // this task. 283 // 284 const MFilter *filter = task->GetFilter(); 285 286 const Bool_t rc = filter ? filter->IsExpressionTrue() : kTRUE; 287 288 if (!rc) 289 continue; 290 291 // 292 // if it has the right stream id execute the Process() function 278 // if it has the right stream id execute the CallProcess() function 293 279 // and check what the result of it is. 294 // 295 switch (task->Process()) 280 // The CallProcess() function increases the execution counter and 281 // calls the Process() function dependent on the existance and 282 // return value of a filter. 283 // 284 switch (task->CallProcess()) 296 285 { 297 286 case kTRUE: … … 312 301 // 313 302 return kTRUE; 303 304 default: 305 *fLog << "MTaskList::Process: Unknown return value from MTask::Process()... ignored." << endl; 314 306 } 315 307 } … … 349 341 while ( (task=(MTask*)Next()) ) 350 342 { 351 if (!task-> IsPreprocessed())352 continue;343 if (!task->CallPostProcess()) 344 return kFALSE; 353 345 354 346 *fLog << task->GetName() << "... " << flush; 355 356 //357 // FIXME: should we only skip this task?358 //359 if (!task->PostProcess())360 return kFALSE;361 347 } 362 348 … … 367 353 368 354 // -------------------------------------------------------------------------- 369 void MTaskList::Print(Option_t *t) 370 { 371 *fLog << "TaskList: " << this->GetName() << " <" << this->GetTitle() << ">" << endl; 355 // 356 // Prints the number of times all the tasks in the list has been. 357 // For convinience the lvl argument results in a number of spaces at the 358 // beginning of the line. So that the structur of a tasklist can be 359 // identified. Use MTaskList::PrintStatistics without an argument. 360 // 361 void MTaskList::PrintStatistics(const Int_t lvl) const 362 { 363 if (lvl==0) 364 { 365 *fLog << endl; 366 *fLog << "Execution Statistics: " << endl; 367 *fLog << "---------------------" << endl; 368 *fLog << GetName() << " [" << ClassName() << "]" << endl; 369 } 370 else 371 { 372 *fLog << setw(lvl) << " " << GetName() << " ["; 373 *fLog << ClassName() << "]" << endl; 374 } 375 376 // 377 // create the Iterator for the TaskList 378 // 379 TIter Next(&fTasks); 380 381 MTask *task=NULL; 382 // 383 // loop over all tasks for postprocessing 384 // only tasks which have successfully been preprocessed are postprocessed. 385 // 386 while ( (task=(MTask*)Next()) ) 387 task->PrintStatistics(lvl+1); 388 389 if (lvl==0) 390 *fLog << endl; 391 } 392 393 // -------------------------------------------------------------------------- 394 void MTaskList::Print(Option_t *t) const 395 { 396 *fLog << "TaskList: " << GetName() << " <" << GetTitle() << ">" << endl; 372 397 373 398 fTasks.Print(); -
trunk/MagicSoft/Mars/mbase/MTaskList.h
r959 r988 27 27 MParList *fParList; 28 28 29 UInt_t *fCntContinue; 30 UInt_t *fCntTrue; 31 29 32 enum { kIsOwner = BIT(14) }; 30 33 … … 46 49 Bool_t PostProcess(); 47 50 48 void Print(Option_t *opt = ""); 51 void Print(Option_t *opt = "") const; 52 void PrintStatistics(const Int_t lvl=0) const; 49 53 void SetOwner(Bool_t enable=kTRUE); 50 54 -
trunk/MagicSoft/Mars/mmain/MMonteCarlo.cc
r954 r988 219 219 // 220 220 MReadTree reader("Events", fInputFile); 221 reader.UseLeaf("fImpact"); 222 reader.UseLeaf("fEnergy"); 223 reader.UseLeaf("fNumFirstLevel"); 224 221 225 tlist.AddToList(&reader); 222 226 … … 288 292 // Check if the list really contains the right number of histograms 289 293 // 290 if (hists.GetEntriesFast() != dim )294 if (hists.GetEntriesFast() != dim && dim) 291 295 return; 292 296 … … 304 308 // 305 309 MReadTree reader("Events", fInputFile); 310 reader.UseLeaf("fImpact"); 311 reader.UseLeaf("fEnergy"); 312 reader.UseLeaf("fPhi"); 313 reader.UseLeaf("fTheta"); 314 reader.UseLeaf("fNumFirstLevel"); 315 reader.UseLeaf("fPhotElfromShower"); 316 306 317 tlist.AddToList(&reader); 307 318 308 Float_t BgR[10]={660, 4,0,0,0,0,0,0,0,0};309 310 MMcTriggerRateCalc crate(dim, 14, BgR, 100000 , 2.75, 10.91e-2);319 Float_t BgR[10]={660, 4, 0, 0, 0, 0, 0, 0, 0, 0}; 320 321 MMcTriggerRateCalc crate(dim, 14, BgR, 100000); 311 322 tlist.AddToList(&crate); 312 323 … … 323 334 return; 324 335 325 TIter Next(&hists); 326 MHMcRate *rate=NULL; 327 while ((rate=(MHMcRate*)Next())) 328 rate->Print(); 336 hists.Print(); 329 337 } 330 338 … … 378 386 // like one dimension MMcThresholdCalc 379 387 // 380 MReadTree read("Events", fInputFile); 388 MReadTree read("Events", fInputFile); 389 read.VetoBranch("MRawEvtData"); 390 read.VetoBranch("MRawEvtHeader"); 391 381 392 MMcThresholdCalc calc(dim); 382 383 393 tlist.AddToList(&read); 384 394 tlist.AddToList(&calc); … … 398 408 // 399 409 TIter Next(&hists); 400 MHMcRate *hist=NULL;401 while (( hist=(MHMcRate*)Next()))402 hist->DrawClone();410 TObject *obj; 411 while ((obj=Next())) 412 obj->DrawClone(); 403 413 } 404 414 -
trunk/MagicSoft/Mars/mmontecarlo/MMcThresholdCalc.cc
r984 r988 63 63 // dim < 0: use only condition number dim (eg "MMcTrig;3") 64 64 // dim = 0: use only condition without a number ("MMcTrig") 65 // dim > 0: use conditions up to dim 65 // dim > 0: use conditions up to dim (from "MMcTrig;1" to "MMcTrig;dim") 66 66 // 67 67 MMcThresholdCalc::MMcThresholdCalc(const Int_t dim, const char* name, -
trunk/MagicSoft/Mars/mmontecarlo/MMcTriggerRateCalc.cc
r984 r988 43 43 *fTitle = title ? title : "Task to calc the trigger rate "; 44 44 45 fMcTrig = NULL; 46 fMcRate = NULL; 47 45 48 fDimension = dim; 46 49 … … 91 94 } 92 95 96 MMcTriggerRateCalc::~MMcTriggerRateCalc() 97 { 98 if (fMcTrig) 99 delete fMcTrig; 100 101 if (fMcRate) 102 delete fMcRate; 103 } 104 93 105 94 106 // -------------------------------------------------------------------------- -
trunk/MagicSoft/Mars/mmontecarlo/MMcTriggerRateCalc.h
r984 r988 50 50 const char *name=NULL, const char *title=NULL); 51 51 52 ~MMcTriggerRateCalc(); 53 52 54 Bool_t PreProcess(MParList *pList); 53 55 Bool_t Process(); -
trunk/MagicSoft/Mars/mraw/MRawCrateData.h
r654 r988 40 40 } 41 41 42 void Print(Option_t *t=NULL) ;42 void Print(Option_t *t=NULL) const; 43 43 44 44 void ReadEvt(istream& fin); -
trunk/MagicSoft/Mars/mraw/MRawEvtHeader.cc
r859 r988 178 178 // This member function prints all Data of one Event to *fLog. 179 179 // 180 void MRawEvtHeader::Print(Option_t *o) 180 void MRawEvtHeader::Print(Option_t *o) const 181 181 { 182 182 *fLog << "DAQEvtNr: " << dec << fDAQEvtNumber << " ("; -
trunk/MagicSoft/Mars/mraw/MRawEvtHeader.h
r766 r988 49 49 50 50 void Clear(Option_t * = NULL); 51 void Print(Option_t * = NULL) ;51 void Print(Option_t * = NULL) const; 52 52 53 53 void FillHeader(UInt_t, Float_t=0); -
trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc
r967 r988 123 123 // print run header information on *fLog 124 124 // 125 void MRawRunHeader::Print(Option_t *t) 125 void MRawRunHeader::Print(Option_t *t) const 126 126 { 127 127 *fLog << endl; -
trunk/MagicSoft/Mars/mraw/MRawRunHeader.h
r782 r988 88 88 UShort_t GetNumPixel() const; 89 89 90 void Print(Option_t *t=NULL) ;90 void Print(Option_t *t=NULL) const; 91 91 92 92 void ReadEvt(istream& fin);
Note:
See TracChangeset
for help on using the changeset viewer.