Changeset 855 for trunk/MagicSoft
- Timestamp:
- 07/05/01 13:23:12 (23 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r852 r855 1 1 -*-*- END -*-*- 2 2 3 2001/07/05: Thomas Bretz 4 5 * macros/CT1Hillas.C: 6 - changed the wrong pointers to dots. 7 8 * macros/getThreshold.C: 9 - added some comments 10 - removed the canvas creation 11 - drawing replaced by a loop 12 - changed trigger conditions to 1 (should work with any MC file) 13 14 * macros/readMagic.C: 15 - changed the event counter to the number of the event in the file 16 - removed icound 17 18 * manalysis/MPedCalcPedRun.cc, manalysis/MCerPhotCalc.cc, 19 mbase/MParContainer.cc, mbase/MParContainer.h, mbase/MParList.cc, 20 mbase/MParList.h, mbase/MTaskList.cc, mbase/MWriteAsciiFile.cc, 21 mbase/MWriteRootFile.cc, mhist/MFillHFadc.cc, mhist/MFillHHillas.cc, 22 mhist/MFillHStarMap.cc, 23 - changed HasChanged to ReadyToSave 24 25 * mbase/MReadTree.cc: 26 - added some comments 27 28 * mhist/MHMcEnergies.h: 29 - fixed bug in []-operator 30 31 * mhist/MHMcEnergy.cc: 32 - added canvas creation to draw function 33 34 * mmontecarlo/MMcThresholdCalc.cc: 35 - fixed a bug in the constructor 36 37 38 3 39 2001/06/20: Thomas Bretz 4 40 -
trunk/MagicSoft/Mars/macros/getThreshold.C
r851 r855 1 void getThreshold( char* filename = " /hdb1/users/jlopez/temp_loop.root")1 void getThreshold( char* filename = "data/oscar_protons.root") 2 2 { 3 // 3 4 // This macro fill the container MMcEnerThre using the task 4 5 // MMcEnerThreCalc and shows the results. 6 // 7 MParList parlist; 5 8 6 MParList parlist;7 9 MTaskList tasklist; 10 parlist.AddToList(&tasklist); 8 11 12 // 9 13 // Setup the parameter list 10 14 // - You need create the container MMcEnerThre. 11 15 // + You need to put the number of trigger conditions when 12 // you declarete the M McEnerThre13 // + If you don't put any dimension to M McEnerThreit works16 // you declarete the MHMcEnergies 17 // + If you don't put any dimension to MHMcEnergies it works 14 18 // taking only the trigger information from MMcTrig 15 // - You can control the number of bins in the energy distribution 16 // histogram used to compute the energy threshold using 17 // the SetBins() function. 19 // 20 const UInt_t numtriggerconditions = 1; 18 21 19 Int_t numtrigcond = 5; 20 MHMcEnergies *hists = new MHMcEnergies(numtrigcond); 21 22 parlist.AddToList(&tasklist); 22 MHMcEnergies *hists = new MHMcEnergies(numtriggerconditions); 23 23 hists->AddEntriesToList(&parlist); 24 24 25 // 25 26 // Setup the task list 26 // - You need the read and the MMcEnerThreCalc tasks 27 // - You need the read and the MMcThresholdCalc tasks 28 // - You have to fill the histograms for the Energy threshold 27 29 // + You need to put the number of trigger conditions when 28 // you declarete the MMcEnerThreCalc 29 // + If you don't put any dimension to MMcEnerThreCalc it works 30 // like one dimension MMcEnerThreCalc 31 32 MReadTree read("Events", filename); 33 34 MMcThresholdCalc tcalc(numtrigcond); 30 // you declarete the MMcThresholdCalc 31 // + If you don't put any dimension to MMcThresholdCalc it works 32 // like one dimension MMcThresholdCalc 33 // 34 MReadTree read("Events", filename); 35 MMcThresholdCalc calc(numtriggerconditions); 35 36 36 37 tasklist.AddToList(&read); 37 tasklist.AddToList(& tcalc);38 tasklist.AddToList(&calc); 38 39 39 40 MEvtLoop evtloop; 40 41 evtloop.SetParList(&parlist); 41 42 43 // 42 44 // Begin the loop 43 45 // 44 46 evtloop.Eventloop(); 45 47 48 // 46 49 // Now you can display the results 47 48 TCanvas *c; 49 50 c=new TCanvas("c0","Energy distribution for triggered events", 50, 50, 850, 550); 51 hists[0].Print(); 52 hists[0].Draw(); 53 c->Update(); 54 55 c= new TCanvas("c1","Energy distribution for triggered events", 50, 50, 850, 550); 56 hists[1].Print(); 57 hists[1].Draw(); 58 c->Update(); 59 60 c= new TCanvas("c2","Energy distribution for triggered events", 50, 50, 850, 550); 61 hists[2].Print(); 62 hists[2].Draw(); 63 c->Update(); 64 65 c= new TCanvas("c3","Energy distribution for triggered events", 50, 50, 850, 550); 66 hists[3].Print(); 67 hists[3].Draw(); 68 c->Update(); 69 70 c= new TCanvas("c4","Energy distribution for triggered events", 50, 50, 850, 550); 71 hists[4].Print(); 72 hists[4].Draw(); 73 c->Update(); 50 // 51 for (UInt_t i=0; i<numtriggerconditions; i++) 52 ((*hists)[i]).Draw(); 74 53 } -
trunk/MagicSoft/Mars/macros/readMagic.C
r706 r855 31 31 MCerPhotEvt &phevt = *(MCerPhotEvt*)plist->FindObject("MCerPhotEvt"); 32 32 33 Int_t icount = 0 ;34 33 MCamDisplay display(&geomcam) ; 35 34 36 35 while (read.Process()) 37 36 { 38 cout << "Event : " << icount++ << endl;37 cout << "Event #" << read.GetEventNum() ":" << endl; 39 38 40 39 ncalc.Process(); -
trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc
r842 r855 113 113 } 114 114 115 fCerPhotEvt->Set HasChanged();115 fCerPhotEvt->SetReadyToSave(); 116 116 117 117 return kTRUE; -
trunk/MagicSoft/Mars/manalysis/MPedCalcPedRun.cc
r845 r855 92 92 } 93 93 94 fPedestals->Set HasChanged();94 fPedestals->SetReadyToSave(); 95 95 96 96 return kTRUE; -
trunk/MagicSoft/Mars/mbase/MParContainer.cc
r851 r855 51 51 MParContainer::MParContainer(const MParContainer &named) 52 52 { 53 *fName = *(named.fName);53 *fName = *(named.fName); 54 54 *fTitle = *(named.fTitle); 55 55 56 56 fLog = named.fLog; 57 57 58 f HasChanged = named.fHasChanged;58 fReadyToSave = named.fReadyToSave; 59 59 } 60 60 … … 73 73 *fTitle = *(rhs.fTitle); 74 74 75 fLog = rhs.fLog;76 f HasChanged = rhs.fHasChanged;75 fLog = rhs.fLog; 76 fReadyToSave = rhs.fReadyToSave; 77 77 78 78 return *this; … … 103 103 *cont.fTitle = *fTitle; 104 104 105 cont.fLog = fLog;106 cont.f HasChanged = fHasChanged;105 cont.fLog = fLog; 106 cont.fReadyToSave = fReadyToSave; 107 107 } 108 108 -
trunk/MagicSoft/Mars/mbase/MParContainer.h
r848 r855 35 35 36 36 protected: 37 MLog *fLog; //! The general log facility for this object, initialized with the global object37 MLog *fLog; //! The general log facility for this object, initialized with the global object 38 38 39 TString *fName; //! parameter container identifier (name)40 TString *fTitle; //! parameter container title39 TString *fName; //! parameter container identifier (name) 40 TString *fTitle; //! parameter container title 41 41 42 Bool_t f HasChanged; //! should be set to true if the contents of the container is changed somehow42 Bool_t fReadyToSave; //! should be set to true if the contents of the container is changed somehow 43 43 44 44 public: 45 MParContainer(const char *name="", const char *title="") : fLog(&gLog), f HasChanged(kFALSE) { Init(name, title); }46 MParContainer(const TString &name, const TString &title) : fLog(&gLog), f HasChanged(kFALSE) { Init(name, title); }45 MParContainer(const char *name="", const char *title="") : fLog(&gLog), fReadyToSave(kFALSE) { Init(name, title); } 46 MParContainer(const TString &name, const TString &title) : fLog(&gLog), fReadyToSave(kFALSE) { Init(name, title); } 47 47 MParContainer(const MParContainer &named); 48 48 MParContainer& operator=(const MParContainer& rhs); … … 69 69 virtual void Reset() {}; 70 70 71 virtual Bool_t HasChanged() { return fHasChanged; }72 virtual void Set HasChanged(Bool_t flag=kTRUE) { fHasChanged=flag; }71 virtual Bool_t IsReadyToSave() { return fReadyToSave; } 72 virtual void SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; } 73 73 74 74 virtual void AsciiRead(ifstream &fin); -
trunk/MagicSoft/Mars/mbase/MParList.cc
r852 r855 265 265 // itself) to unchanged 266 266 // 267 void MParList::Set HasChanged(Bool_t flag)267 void MParList::SetReadyToSave(Bool_t flag) 268 268 { 269 269 TIter Next(&fContainer); … … 275 275 // 276 276 while ( (cont=(MParContainer*)Next()) ) 277 cont->Set HasChanged(flag);278 279 MParContainer::Set HasChanged(flag);277 cont->SetReadyToSave(flag); 278 279 MParContainer::SetReadyToSave(flag); 280 280 } 281 281 -
trunk/MagicSoft/Mars/mbase/MParList.h
r843 r855 45 45 46 46 void Reset(); 47 void Set HasChanged(Bool_t flag=kTRUE);47 void SetReadyToSave(Bool_t flag=kTRUE); 48 48 49 49 void Print(Option_t *t = NULL); -
trunk/MagicSoft/Mars/mbase/MReadTree.cc
r768 r855 35 35 // outside. It makes also possible to go back by decreasing the number. // 36 36 // // 37 // If you don't want to start reading the first event you have to call // 38 // MReadTree::SetEventNum after instantiating your MReadTree-object. // 39 // // 37 40 ///////////////////////////////////////////////////////////////////////////// 38 41 … … 178 181 // the actual branch should be stored - enable branch. 179 182 // 183 // FIXME: is it correct, that the pointer is deleted immediatly afterwards? 180 184 branch->SetAddress(&pcont); 181 185 } … … 190 194 // (Remark: The position can also be set by some member functions 191 195 // If the end of the file is reached the Eventloop is stopped. 196 // 192 197 Bool_t MReadTree::Process() 193 198 { … … 267 272 // this function makes Process() read event number nr next 268 273 // 269 // Remark: You can use this function to set the event number from which270 // you want to start reading.274 // Remark: You can use this function after instatiating you MReadTree-object 275 // to set the event number from which you want to start reading. 271 276 // 272 277 Bool_t MReadTree::SetEventNum(UInt_t nr) -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r851 r855 59 59 MTaskList::MTaskList(MTaskList &ts) 60 60 { 61 fTasks.AddAll(&ts.fTasks); 62 } 63 64 // -------------------------------------------------------------------------- 65 // 66 // create the Iterator over the tasklist 61 fTasks.AddAll(&ts.fTasks); 62 } 63 64 // -------------------------------------------------------------------------- 65 // 66 // Set the logging stream for the all tasks in the list and the tasklist 67 // itself. 67 68 // 68 69 void MTaskList::SetLogStream(MLog *log) 69 70 { 71 // 72 // create the Iterator over the tasklist 73 // 70 74 TIter Next(&fTasks); 71 75 … … 167 171 { 168 172 // 169 // Reset the HasChangedflag.173 // Reset the ReadyToSave flag. 170 174 // Reset all containers. 171 175 // 172 fParList->SetHasChanged(kFALSE); 176 // FIXME: To run a tasklist as a single task in another tasklist we 177 // have to make sure, that the Parameter list isn't reset. 178 // 179 fParList->SetReadyToSave(kFALSE); 173 180 fParList->Reset(); 174 181 … … 231 238 232 239 // 233 // Reset the HasChangedflag.240 // Reset the ReadyToSave flag. 234 241 // Reset all containers. 235 242 // 236 fParList->SetHasChanged(kFALSE); 243 // FIXME: To run a tasklist as a single task in another tasklist we 244 // have to make sure, that the Parameter list isn't reset. 245 // 246 fParList->SetReadyToSave(kFALSE); 237 247 fParList->Reset(); 238 248 -
trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.cc
r852 r855 32 32 // This can be the name of the class or a given name, which identifies // 33 33 // the container in a parameter container list (MParList). // 34 // The container is writte to the ascii file if its HasChangedflag is //34 // The container is writte to the ascii file if its ReadyToSave flag is // 35 35 // set (MParContainer) // 36 36 // // … … 102 102 void MWriteAsciiFile::CheckAndWrite() const 103 103 { 104 if (fContainer-> HasChanged())104 if (fContainer->IsReadyToSave()) 105 105 fContainer->AsciiWrite(*fOut); 106 106 } -
trunk/MagicSoft/Mars/mbase/MWriteRootFile.cc
r852 r855 322 322 // Check for the Write flag 323 323 // 324 if (!entry->GetContainer()-> HasChanged())324 if (!entry->GetContainer()->IsReadyToSave()) 325 325 continue; 326 326 -
trunk/MagicSoft/Mars/mhist/MFillHFadc.cc
r852 r855 112 112 Bool_t MFillHFadc::PostProcess() 113 113 { 114 fHistos->Set HasChanged();114 fHistos->SetReadyToSave(); 115 115 return kTRUE; 116 116 } -
trunk/MagicSoft/Mars/mhist/MFillHHillas.cc
r852 r855 75 75 Bool_t MFillHHillas::PostProcess() 76 76 { 77 fHistos->Set HasChanged();77 fHistos->SetReadyToSave(); 78 78 return kTRUE; 79 79 } -
trunk/MagicSoft/Mars/mhist/MFillHStarMap.cc
r852 r855 76 76 Bool_t MFillHStarMap::PostProcess() 77 77 { 78 fHistos->SetHasChanged(); 79 78 fHistos->SetReadyToSave(); 80 79 return kTRUE; 81 80 } -
trunk/MagicSoft/Mars/mhist/MHMcEnergies.h
r851 r855 30 30 void AddEntriesToList(MParList *plist); 31 31 32 MHMcEnergy &operator[](UInt_t idx) { return (MHMcEnergy&)fHists[idx]; }32 MHMcEnergy &operator[](UInt_t idx) { return *(MHMcEnergy*)(*fHists)[idx]; } 33 33 34 34 ClassDef(MHMcEnergies, 1) // container to hold several MHMcEnergy histograms -
trunk/MagicSoft/Mars/mhist/MHMcEnergy.cc
r851 r855 29 29 #include <TH1.h> 30 30 #include <TF1.h> 31 #include <TCanvas.h> 31 32 #include <TPaveLabel.h> 32 33 … … 58 59 sprintf(aux+10, ";%i", idx); 59 60 hLogEner = new TH1F(aux, "", 100, 0.5, 4.5); 61 hLogEner->SetXTitle("log(E) [GeV]"); 62 hLogEner->SetYTitle("dN/dE"); 60 63 //hLogEner->SetBins(60); 61 64 } … … 75 78 { 76 79 // 80 // 0: don't draw the function (it is drawn together with the histogram) 81 // +: add these function to the list of fits. Don't delete the last fit. 82 // 77 83 // FIXME: R means: use the range specified in the function (xxmin, xxmax are ignored!) 78 84 // Q means: quiet (why?) 79 85 // 80 86 // 81 hLogEner->Fit(fLogEner->GetName(), " RQ", "", xxmin, xxmax);87 hLogEner->Fit(fLogEner->GetName(), "Q0+", "", xxmin, xxmax); 82 88 } 83 89 … … 92 98 const Float_t sum = min+max; 93 99 100 TCanvas *c=new TCanvas("Energy Distribution","Energy distribution for triggered events"); 101 102 hLogEner->Draw(option); 103 94 104 TPaveLabel* label = new TPaveLabel(2.2, 0.75*sum, 4.4, 0.90*sum, text); 95 96 hLogEner->SetYTitle("dN/dE") ;97 hLogEner->SetXTitle("log(E) [GeV]") ;98 hLogEner->Draw(option) ;99 105 label->SetFillColor(10); 100 106 label->SetTextSize(0.3); 101 107 label->Draw(); 108 109 c->Modified(); 110 c->Update(); 102 111 } 103 112 -
trunk/MagicSoft/Mars/mmontecarlo/MMcThresholdCalc.cc
r851 r855 57 57 58 58 for (unsigned int i=0; i<fDimension; i++) 59 fMustDelete =kFALSE;59 fMustDelete[i]=kFALSE; 60 60 } 61 61
Note:
See TracChangeset
for help on using the changeset viewer.