- Timestamp:
- 07/13/01 18:13:06 (23 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r866 r867 1 1 -*-*- END -*-*- 2 3 2001/07/13: Thomas Bretz 4 5 * mbase/MEvtLoop.[h,cc]: 6 - Added a result value to Eventloop to be able to detect if the 7 execution was successfull 8 - changes postProcess to return the return value from 9 MTaskList::PostProcess 10 11 * mbase/MParList.cc: 12 - FindCreateObj removes now a 'dot' from the end of an indexed 13 object name like "Events;7." 14 15 * mbase/MReadTree.cc: 16 - small changes to the output 17 18 * mbase/MTask.[h,cc]: 19 - added Preprocessed flag. This enables the tasklist to only postprocess 20 already preprocessed tasks 21 22 * mbase/MTaskList.cc: 23 - don't postprocess non preprocessed tasks 24 25 * mhist/MHMcCollectionArea.cc: 26 - added descriptions to histrograms 27 - changed names of histograms 28 - added drawing of canvas to Draw-functions 29 30 * mhist/MHMcEnergy.[h,cc]: 31 - added variables to store the calculated result 32 - changed names and titles of histogram 33 - added axis titles to histogram 34 - moved result calculation into fit-function 35 36 * mmontecarlo/MMcCollectionAreaCalc.cc: 37 - added name of input container to be able to process another 38 container than "MMcTrig" 39 40 * mmontecarlo/MMcThresholdCalc.cc: 41 - removed trailing dot from container name creation 42 43 * mhist/MMcThresholdCalc.cc: 44 - removed a wrong '.' behind the number when processing more than 45 one trigger condition 46 47 * mraw/MRawRunHeader.cc: 48 - added "Monte Carlo Data" as runtype 49 50 2 51 3 52 2001/07/10: Thomas Bretz -
trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
r858 r867 105 105 106 106 if (fLog != &gLog) 107 {108 107 fParList ->SetLogStream(fLog); 109 fTaskList->SetLogStream(fLog);110 }111 108 112 109 // … … 180 177 << " --> " << (maxcnt<0?dummy:maxcnt)/clock.CpuTime() << " Events/s" 181 178 << endl << endl; 182 183 179 } 184 180 … … 188 184 // for developers use only! 189 185 // 190 voidMEvtLoop::PostProcess() const186 Bool_t MEvtLoop::PostProcess() const 191 187 { 192 188 // 193 189 // execute the post process of all tasks 194 190 // 195 fTaskList->PostProcess(); 196 } 197 198 // -------------------------------------------------------------------------- 199 // 200 // See class description above. 201 // 202 void MEvtLoop::Eventloop(Int_t maxcnt, const char *tlist) 203 { 204 if (!PreProcess(tlist)) 205 return; 206 207 Process(maxcnt); 208 209 PostProcess(); 210 } 211 191 return fTaskList->PostProcess(); 192 } 193 194 // -------------------------------------------------------------------------- 195 // 196 // See class description above. 197 // 198 Bool_t MEvtLoop::Eventloop(Int_t maxcnt, const char *tlist) 199 { 200 Bool_t rc = PreProcess(); 201 202 if (rc) 203 Process(maxcnt); 204 205 if (!PostProcess()) 206 return kFALSE; 207 208 return rc; 209 } 210 -
trunk/MagicSoft/Mars/mbase/MEvtLoop.h
r698 r867 35 35 Bool_t PreProcess(const char *tlist="MTaskList"); 36 36 void Process(Int_t maxcnt) const; 37 voidPostProcess() const;37 Bool_t PostProcess() const; 38 38 39 voidEventloop(Int_t maxcnt=-1, const char *tlist="MTaskList");39 Bool_t Eventloop(Int_t maxcnt=-1, const char *tlist="MTaskList"); 40 40 41 41 ClassDef(MEvtLoop, 0) // Class to execute the tasks in a tasklist -
trunk/MagicSoft/Mars/mbase/MParList.cc
r860 r867 199 199 // after the last appearance of a semicolon is stripped to get the 200 200 // Name of the Class. Normally this is used to number your objects. 201 // "Name;1", "Name;2", ... 201 // "Name;1", "Name;2", ... If a semicolon is detected leading dots 202 // are stripped from the object-name (eg. "name;5.") 202 203 // 203 204 MParContainer *MParList::FindCreateObj(const char *classname, const char *objname) … … 223 224 const char *semicolon = strrchr(cname, ';'); 224 225 226 TString oname(objname); 227 225 228 if (semicolon) 229 { 226 230 cname.Remove(semicolon-cname); 231 232 // 233 // Remove leading dots from objectname (eg. "MMcTrig;5.") 234 // 235 Int_t sz = oname.Sizeof()-2; 236 237 while (sz>=0 && oname[sz]=='.') 238 oname.Remove(sz--); 239 } 227 240 228 241 // … … 230 243 // in the List. If we can find one we are done. 231 244 // 232 MParContainer *pcont = (MParContainer*)FindObject(o bjname);245 MParContainer *pcont = (MParContainer*)FindObject(oname); 233 246 234 247 if (pcont) … … 238 251 // if object is not existing in the list try to create one 239 252 // 240 *fLog << dbginf << "Object '" << o bjname << "' of type '" << cname << "' not found... creating." << endl;253 *fLog << dbginf << "Object '" << oname << "' of type '" << cname << "' not found... creating." << endl; 241 254 242 255 // … … 263 276 // set the new object name of the object 264 277 // 265 pcont->SetName(o bjname);278 pcont->SetName(oname); 266 279 267 280 // -
trunk/MagicSoft/Mars/mbase/MReadTree.cc
r858 r867 173 173 // we cannot proceed reading this branch 174 174 // 175 *fLog << "MReadTree::PreProcess -Warning: Class '" << name << "' not existing in dictionary. Branch skipped." << endl;175 *fLog << dbginf << "Warning: Class '" << name << "' not existing in dictionary. Branch skipped." << endl; 176 176 continue; 177 177 } -
trunk/MagicSoft/Mars/mbase/MTask.h
r858 r867 22 22 const MFilter *fFilter; 23 23 24 Bool_t fIsPreprocessed; // Indicates the success of the PreProcessing (set by MTaskList) 25 24 26 public: 25 MTask() : fFilter(NULL) {}27 MTask() : fFilter(NULL), fIsPreprocessed(kFALSE) {} 26 28 ~MTask() 27 29 { … … 30 32 const MFilter *GetFilter() const { return fFilter; } 31 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; } 32 37 33 38 virtual Bool_t PreProcess(MParList *pList); -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r860 r867 193 193 if (!task->PreProcess(fParList)) 194 194 return kFALSE; 195 196 task->SetIsPreprocessed(); 195 197 } 196 198 … … 307 309 while ( (task=(MTask*)Next()) ) 308 310 { 311 if (!task->IsPreprocessed()) 312 continue; 313 309 314 *fLog << task->GetName() << "... " << flush; 310 315 -
trunk/MagicSoft/Mars/mhist/MHMcCollectionArea.cc
r859 r867 26 26 #include "MHMcCollectionArea.h" 27 27 28 #include < MLog.h>29 #include <T H2.h>28 #include <TH2.h> 29 #include <TCanvas.h> 30 30 31 31 ClassImp(MHMcCollectionArea); … … 49 49 50 50 51 fHistAll = new TH2D(" collAreaAll", "all showers - Radius vs log(E) distribution",51 fHistAll = new TH2D("All Events", "All showers - Radius vs log(E) distribution", 52 52 50, 0., 5., 53 53 50, 0., 500.); 54 54 55 fHistSel = new TH2D("collAreaSel", "selected showers - Radius vs log(E) distribution", 55 fHistAll->SetXTitle("log(E/GeV)"); 56 fHistAll->SetYTitle("r/m"); 57 fHistAll->SetZTitle("N"); 58 59 fHistSel = new TH2D("Selected Events", "Selected showers - Radius vs log(E) distribution", 56 60 50, 0., 5., 57 61 50, 0., 500.); 58 62 59 fHistCol = new TH1D("collArea", "Collection Area", 63 fHistSel->SetXTitle("log(E/GeV)"); 64 fHistSel->SetYTitle("r/m"); 65 fHistSel->SetYTitle("N"); 66 67 fHistCol = new TH1D("Area", "Collection Area vs. log(E)", 60 68 50, 0., 5.); 69 70 fHistCol->SetXTitle("log(E/GeV)"); 71 fHistCol->SetYTitle("A/m^2"); 61 72 } 62 73 … … 78 89 } 79 90 80 void MHMcCollectionArea::DrawAll( )91 void MHMcCollectionArea::DrawAll(Option_t* option) 81 92 { 82 fHistAll->Draw(); 93 TCanvas *c=new TCanvas(fHistAll->GetName(), fHistAll->GetTitle()); 94 95 fHistSel->Draw(option); 96 97 c->Modified(); 98 c->Update(); 83 99 } 84 100 85 void MHMcCollectionArea::DrawSel( )101 void MHMcCollectionArea::DrawSel(Option_t* option) 86 102 { 87 fHistSel->Draw(); 103 TCanvas *c=new TCanvas(fHistSel->GetName(), fHistSel->GetTitle()); 104 105 fHistSel->Draw(option); 106 107 c->Modified(); 108 c->Update(); 88 109 } 89 110 90 111 void MHMcCollectionArea::Draw(Option_t* option) 91 112 { 113 TCanvas *c=new TCanvas(fHistCol->GetName(), fHistCol->GetTitle()); 114 92 115 fHistCol->Draw(option); 116 117 c->Modified(); 118 c->Update(); 93 119 } 94 120 -
trunk/MagicSoft/Mars/mhist/MHMcCollectionArea.h
r853 r867 21 21 { 22 22 private: 23 TH2D *fHistAll ; //! all simulated showers 24 TH2D *fHistSel ; //! the selected showers 25 TH1D *fHistCol ; // the collection area 23 TH2D *fHistAll; //! all simulated showers 24 TH2D *fHistSel; //! the selected showers 25 26 TH1D *fHistCol; // the collection area 26 27 27 28 public: 28 29 29 MHMcCollectionArea(const char *name=NULL, const char *title=NULL) 30 ~MHMcCollectionArea() 30 MHMcCollectionArea(const char *name=NULL, const char *title=NULL); 31 ~MHMcCollectionArea(); 31 32 32 void FillAll(Float_t log10E, Float_t radius) ; 33 void FillSel(Float_t log10E, Float_t radius) ; 34 void DrawAll() ; 35 void DrawSel() ; 36 void Draw(Option_t* option = "") ; 37 void CalcEfficiency() ; 33 void FillAll(Float_t log10E, Float_t radius); 34 void FillSel(Float_t log10E, Float_t radius); 35 36 void DrawAll(Option_t *option = ""); 37 void DrawSel(Option_t *option = ""); 38 void Draw (Option_t *option = ""); 39 40 void CalcEfficiency(); 38 41 39 42 ClassDef(MHMcCollectionArea, 1) // Data Container to calculate Collection Area -
trunk/MagicSoft/Mars/mhist/MHMcEnergies.cc
r861 r867 66 66 delete fHists; 67 67 } 68 68 69 // -------------------------------------------------------------------------- 69 70 // -
trunk/MagicSoft/Mars/mhist/MHMcEnergy.cc
r863 r867 51 51 52 52 if (idx>0) 53 sprintf(aux+10, ";%i", idx); 53 sprintf(aux+strlen(aux), ";%i", idx); 54 54 55 *fName = name ? name : aux; 55 *fTitle = title ? title : "Container for a MC energyhistogram" ;56 *fTitle = title ? title : "Container for an energy distribution histogram" ; 56 57 57 // - we initialize the histogram and the gaus function58 // - we initialize the histogram 58 59 // - we have to give diferent names for the diferent histograms because 59 60 // root don't allow us to have diferent histograms with the same name 60 61 61 strcpy(aux, "fLogEnergy"); 62 char text[256]; 63 sprintf(text, "Energy Distribution for trigger condition #%i", idx); 64 65 strcpy(aux, "log(E)"); 62 66 if (idx>0) 63 sprintf(aux+10, ";%i", idx); 64 fLogEner = new TF1(aux, "gaus", 1., 3.); 65 66 strcpy(aux, "hLogEnergy"); 67 if (idx>0) 68 sprintf(aux+10, ";%i", idx); 69 hLogEner = new TH1F(aux, "", 40, 0.5, 4.5); 70 hLogEner->SetXTitle("log(E) [GeV]"); 71 hLogEner->SetYTitle("dN/dE"); 67 sprintf(aux+strlen(aux), " #%i", idx); 68 fHist = new TH1F(aux, text, 40, 0.5, 4.5); 69 fHist->SetXTitle("log(E/GeV)"); 70 fHist->SetYTitle("dN/dE"); 72 71 } 73 72 … … 78 77 MHMcEnergy::~MHMcEnergy() 79 78 { 80 delete hLogEner; 81 delete fLogEner; 79 delete fHist; 82 80 } 83 81 … … 88 86 void MHMcEnergy::Fill(Float_t log10E, Float_t w) 89 87 { 90 hLogEner->Fill(log10E, w);88 fHist->Fill(log10E, w); 91 89 } 92 90 … … 101 99 // Q: quiet mode 102 100 // 103 hLogEner->Fit(fLogEner->GetName(), "Q0", "", xxmin, xxmax); 101 fHist->Fit("gaus", "Q0", "", xxmin, xxmax); 102 103 TF1 *result = fHist->GetFunction("gaus"); 104 105 fThreshold = CalcThreshold(result); 106 fThresholdErr = CalcThresholdErr(result); 107 fGaussPeak = CalcGaussPeak(result); 108 fGaussSigma = CalcGaussSigma(result); 104 109 } 105 110 … … 110 115 void MHMcEnergy::Draw(Option_t *option) 111 116 { 112 char text[50]; 113 sprintf(text, "Energy Threshold = %4.1f +- %4.1f GeV", 114 GetThreshold(), GetThresholdErr()); 117 char text[256]; 115 118 116 const Float_t min = hLogEner->GetMinimum();117 const Float_t max = hLogEner->GetMaximum();119 const Float_t min = fHist->GetMinimum(); 120 const Float_t max = fHist->GetMaximum(); 118 121 const Float_t sum = min+max; 119 122 120 TCanvas *c=new TCanvas( "Energy Distribution","Energy distribution for triggered events");123 TCanvas *c=new TCanvas(fHist->GetName(), fHist->GetTitle()); 121 124 122 hLogEner->Draw(option); 125 fHist->Draw(option); 126 127 sprintf(text, "Energy Threshold = %4.1f +- %4.1f GeV", 128 fThreshold, fThresholdErr); 123 129 124 130 TPaveLabel* label = new TPaveLabel(2.2, 0.75*sum, 4.4, 0.90*sum, text); 125 131 label->SetFillColor(10); 126 132 label->SetTextSize(0.3); 133 label->SetBit(kCanDelete); 127 134 label->Draw(); 128 135 … … 137 144 void MHMcEnergy::SetNumBins(Int_t nbins) 138 145 { 139 hLogEner->SetBins(nbins, 0.5, 4.5);146 fHist->SetBins(nbins, 0.5, 4.5); 140 147 } 141 148 // -------------------------------------------------------------------------- … … 145 152 void MHMcEnergy::Print(Option_t*) 146 153 { 147 cout << "Threshold: " << GetThreshold() << " +- " << GetThresholdErr()<< endl;154 cout << "Threshold: " << fThreshold << " +- " << fThresholdErr << endl; 148 155 } 149 156 … … 152 159 // Return the threshold 153 160 // 154 Float_t MHMcEnergy:: GetThreshold() const161 Float_t MHMcEnergy::CalcThreshold(TF1 *gauss) 155 162 { 156 const Float_t p1 = fLogEner->GetParameter(1);163 const Float_t p1 = gauss->GetParameter(1); 157 164 158 165 return pow(10, p1); … … 163 170 // Return the error of the threshold. 164 171 // 165 Float_t MHMcEnergy:: GetThresholdErr() const172 Float_t MHMcEnergy::CalcThresholdErr(TF1 *gauss) 166 173 { 167 174 const Float_t lg10 = log(10); 168 const Float_t p1 = fLogEner->GetParameter(1);169 const Float_t p1err = fLogEner->GetParError(1);175 const Float_t p1 = gauss->GetParameter(1); 176 const Float_t p1err = gauss->GetParError(1); 170 177 171 178 // The error has into accuont the error in the fit … … 177 184 // Return the peak of the fitted gaussan function. 178 185 // 179 Float_t MHMcEnergy:: GetGaussPeak() const186 Float_t MHMcEnergy::CalcGaussPeak(TF1 *gauss) 180 187 { 181 return fLogEner->GetParameter(1);188 return gauss->GetParameter(1); 182 189 } 183 190 … … 186 193 // Return the sigma of the fitted gaussan function. 187 194 // 188 Float_t MHMcEnergy:: GetGaussSigma() const195 Float_t MHMcEnergy::CalcGaussSigma(TF1 *gauss) 189 196 { 190 return fLogEner->GetParameter(2);197 return gauss->GetParameter(2); 191 198 } 192 199 -
trunk/MagicSoft/Mars/mhist/MHMcEnergy.h
r863 r867 16 16 private: 17 17 18 TH1F *hLogEner; // histogram with the logarith of the energy 19 TF1 *fLogEner; // gausian function to fit the histogram 18 TH1F *fHist; // histogram with the logarith of the energy 19 20 Float_t fThreshold; 21 Float_t fThresholdErr; 22 Float_t fGaussPeak; 23 Float_t fGaussSigma; 24 25 Float_t CalcThreshold(TF1 *gauss); 26 Float_t CalcThresholdErr(TF1 *gauss); 27 28 Float_t CalcGaussPeak(TF1 *gauss); 29 Float_t CalcGaussSigma(TF1 *gauss); 20 30 21 31 public: … … 24 34 ~MHMcEnergy(); 25 35 26 Float_t GetThreshold() const ;27 Float_t GetThresholdErr() const ;36 Float_t GetThreshold() const { return fThreshold; } 37 Float_t GetThresholdErr() const { return fThresholdErr; } 28 38 29 Float_t GetGaussPeak() const ;30 Float_t GetGaussSigma() const ;39 Float_t GetGaussPeak() const { return fGaussPeak; } 40 Float_t GetGaussSigma() const { return fGaussSigma; }; 31 41 32 42 void Fill(Float_t log10E, Float_t w); -
trunk/MagicSoft/Mars/mmontecarlo/MMcCollectionAreaCalc.cc
r853 r867 36 36 #include "MHMcCollectionArea.h" 37 37 38 ClassImp(MMcCollectionAreaCalc) 38 ClassImp(MMcCollectionAreaCalc); 39 39 40 MMcCollectionAreaCalc::MMcCollectionAreaCalc (const char *name, const char *title) 40 MMcCollectionAreaCalc::MMcCollectionAreaCalc(const char *input, 41 const char *name, const char *title) 41 42 { 42 43 *fName = name ? name : "MMcCollectionAreaCalc"; 43 *fTitle = title ? title : "Task to calc the collection area "; 44 *fTitle = title ? title : "Task to calculate the collection area"; 45 46 fObjName = input ? input : "MMcTrig"; 44 47 } 45 48 … … 55 58 } 56 59 57 fMcTrig = (MMcTrig*)pList->FindObject( "MMcTrig");60 fMcTrig = (MMcTrig*)pList->FindObject(fObjName); 58 61 if (!fMcTrig) 59 62 { 60 *fLog << dbginf << "MMcTrignot found... exit." << endl;63 *fLog << dbginf << fObjName << " not found... exit." << endl; 61 64 return kFALSE; 62 65 } … … 84 87 } 85 88 86 Bool_t MMcCollectionAreaCalc::PostProcess ()89 Bool_t MMcCollectionAreaCalc::PostProcess() 87 90 { 88 91 // -
trunk/MagicSoft/Mars/mmontecarlo/MMcCollectionAreaCalc.h
r860 r867 19 19 MHMcCollectionArea *fCollArea; 20 20 21 TString fObjName; 22 21 23 public: 22 MMcCollectionAreaCalc(const char *name=NULL, const char *title=NULL); 24 MMcCollectionAreaCalc(const char *input=NULL, 25 const char *name=NULL, const char *title=NULL); 23 26 24 27 Bool_t PreProcess(MParList *pList); 25 Bool_t Process() 26 Bool_t PostProcess() 28 Bool_t Process(); 29 Bool_t PostProcess(); 27 30 28 31 ClassDef(MMcCollectionAreaCalc, 0) // Task to calculate the collection area histogram -
trunk/MagicSoft/Mars/mmontecarlo/MMcThresholdCalc.cc
r866 r867 110 110 { 111 111 if (fDimension>1) 112 sprintf(auxname+7, ";%i .", i+1);112 sprintf(auxname+7, ";%i", i+1); 113 113 114 114 fMcTrig[i] = (MMcTrig*)pList->FindObject(auxname); -
trunk/MagicSoft/Mars/mmontecarlo/Makefile
r851 r867 33 33 SRCS = $(SRCFILES) 34 34 HEADERS = $(SRCFILES:.cc=.h) 35 OBJS = $(SRCFILES:.cc=.o) 35 OBJS = $(SRCFILES:.cc=.o) 36 36 37 37 ############################################################ -
trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc
r859 r867 141 141 *fLog << "Calibration"; 142 142 break; 143 case 256: 144 *fLog << "Monte Carlo Data"; 145 break; 143 146 } 144 147 *fLog << ")" << endl;
Note:
See TracChangeset
for help on using the changeset viewer.