- Timestamp:
- 04/07/03 15:34:51 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1907 r1910 1 1 -*-*- END OF LINE -*-*- 2 2 3 2003/04/04: Thomas Bretz 4 5 * mtools/MagicReversi.cc: 3 2003/04/07: Thomas Bretz 4 5 * Makefile: 6 - changed order 7 8 * manalysis/MMultiDimDistCalc.[h,cc]: 9 - fixed default title 10 - simplified code 11 - added fHadronnessName 12 13 * manalysis/MRanForestCalc.[h,cc]: 14 - added fHadronnessName 15 16 * mbase/MAGIC.h: 17 - fixed a bug with rootcint 18 19 * meventdisp/MGFadcDisp.cc: 20 - fixed a variable name 21 22 * mhist/MHHadronness.cc: 23 - removed many old comments 24 - simplified some code 25 - uses argument in Fill now 26 27 28 29 2003/04/04: Thomas Bretz 30 31 * mtools/MagicReversi.[h,cc]: 6 32 - added support for Number of Players 7 33 - added instructions 8 34 - added support for Esc key 35 36 * mbase/MAGIC.h: 37 - added version check to MAGIC.h 9 38 10 39 -
trunk/MagicSoft/Mars/Makefile
r1721 r1910 38 38 mbase \ 39 39 mfileio \ 40 mfilter \ 40 41 manalysis \ 41 42 mmc \ … … 44 45 mmontecarlo \ 45 46 mhist \ 46 mfilter \47 47 mdata \ 48 48 mtools \ -
trunk/MagicSoft/Mars/manalysis/MMultiDimDistCalc.cc
r1809 r1910 61 61 62 62 static const TString gsDefName = "MMultiDimDistCalc"; 63 static const TString gsDefTitle = "Composite Probabilities Loop 1/2"; 63 static const TString gsDefTitle = "Calculate Hadronness with Nearest Neighbor/Kernel Method"; 64 64 65 // -------------------------------------------------------------------------- 65 66 // … … 68 69 // 69 70 MMultiDimDistCalc::MMultiDimDistCalc(const char *name, const char *title) 70 : fNum(0), fUseKernel(kTRUE), f Data(NULL)71 : fNum(0), fUseKernel(kTRUE), fHadronnessName("MHadronness"), fData(NULL) 71 72 { 72 73 // … … 151 152 } 152 153 153 fHadronness = (MHadronness*)plist->FindCreateObj( "MHadronness");154 fHadronness = (MHadronness*)plist->FindCreateObj(fHadronnessName, "MHadronness"); 154 155 if (!fHadronness) 155 156 return kFALSE; … … 208 209 } 209 210 210 Double_t arg; 211 212 if (dg+dh != 0.0) 213 arg = dg / (dg+dh); 214 else 215 arg = 1.e10; 216 //fHadronness->SetHadronness(arg); 217 218 if (dg != 0.0) 219 arg = exp(-dh/dg); 220 else 221 arg = 0.0; 222 fHadronness->SetHadronness(arg); 223 211 fHadronness->SetHadronness(dg==0 ? 0 : exp(-dh/dg)); 224 212 225 213 return kTRUE; … … 238 226 out << ";" << endl; 239 227 228 if (fHadronnessName!="MHadronness") 229 out << " " << GetUniqueName() << ".SetHadronnessName(\"" << fHadronnessName << "\");" << endl; 240 230 if (fNum!=0) 241 231 out << " " << GetUniqueName() << ".SetUseNumRows(" << fNum << ");" << endl; -
trunk/MagicSoft/Mars/manalysis/MMultiDimDistCalc.h
r1557 r1910 17 17 Bool_t fUseKernel; // Flag whether kernel method should be used 18 18 19 TString fHadronnessName; // Name of container storing hadronness 20 19 21 MHMatrix *fMGammas; //! Gammas describing matrix 20 22 MHMatrix *fMHadrons; //! Hadrons (non gammas) describing matrix … … 30 32 ~MMultiDimDistCalc(); 31 33 34 void SetHadronnessName(const TString name) { fHadronnessName = name; } 35 TString GetHadronnessName() const { return fHadronnessName; } 36 32 37 void SetUseNumRows(UShort_t n=0) { fNum = n; } 33 38 void SetUseKernelMethod(Bool_t k=kTRUE) { fUseKernel = k; } … … 36 41 Bool_t Process(); 37 42 38 ClassDef(MMultiDimDistCalc, 0) // Task to calculate multidimensional distances43 ClassDef(MMultiDimDistCalc, 0) // Task to calculate nearest neighbor-/kernel-hadronness 39 44 }; 40 45 -
trunk/MagicSoft/Mars/manalysis/MRanForestCalc.cc
r1870 r1910 60 60 // 61 61 MRanForestCalc::MRanForestCalc(const char *name, const char *title) 62 : fNum(100), f Data(NULL)62 : fNum(100), fHadronnessName("MHadronness"), fData(NULL) 63 63 { 64 64 // … … 125 125 } 126 126 127 fHadroness = (MHadronness*)plist->FindCreateObj( "MHadronness");127 fHadroness = (MHadronness*)plist->FindCreateObj(fHadronnessName, "MHadronness"); 128 128 if (!fHadroness) 129 129 return kFALSE; -
trunk/MagicSoft/Mars/manalysis/MRanForestCalc.h
r1864 r1910 15 15 { 16 16 private: 17 Int_t fNum; // number of trees used to compute hadronness17 Int_t fNum; // number of trees used to compute hadronness 18 18 19 MHadronness *fHadroness; //! Output container for calculated hadroness 20 MDataArray *fData; //! Used to store the MDataChains to get the event values 21 MRanForest *fRanForest; 22 MRanTree *fRanTree; 19 TString fHadronnessName; // Name of container storing hadronness 20 21 MHadronness *fHadroness; //! Output container for calculated hadroness 22 MDataArray *fData; //! Used to store the MDataChains to get the event values 23 MRanForest *fRanForest; 24 MRanTree *fRanTree; 23 25 24 26 public: 25 27 MRanForestCalc(const char *name=NULL, const char *title=NULL); 26 28 ~MRanForestCalc(); 29 30 void SetHadronnessName(const TString name) { fHadronnessName = name; } 31 TString GetHadronnessName() const { return fHadronnessName; } 27 32 28 33 void SetUseNumTrees(UShort_t n=100) { fNum = n; } -
trunk/MagicSoft/Mars/mbase/MAGIC.h
r1907 r1910 12 12 #endif 13 13 14 #ifndef __CINT__ 14 15 #if ROOT_VERSION_CODE < ROOT_VERSION(3,02,00) 15 16 #error Your root version is too old to compile Mars, use root>=3.02 17 #endif 16 18 #endif 17 19 -
trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc
r1668 r1910 77 77 fTab1->AddFrame(fPixelList, layplist); 78 78 79 TGVerticalFrame * fMidFrame = new TGVerticalFrame(fTab1, 300, 100);80 fList->Add( fMidFrame);79 TGVerticalFrame *midframe = new TGVerticalFrame(fTab1, 300, 100); 80 fList->Add(midframe); 81 81 82 82 TGLayoutHints *laytab = new TGLayoutHints(kLHintsRight|kLHintsExpandY, 5, 5, 5, 5); 83 83 fList->Add(laytab); 84 84 85 fTab1->AddFrame( fMidFrame, laytab);85 fTab1->AddFrame(midframe, laytab); 86 86 87 87 // 88 88 // Create gui elements for vertical frame 89 89 // 90 TGTextButton *prevpix = new TGTextButton( fMidFrame, "<< Prev Pixel", M_PREVPIXEL);91 TGTextButton *nextpix = new TGTextButton( fMidFrame, "Next Pixel >>", M_NEXTPIXEL);90 TGTextButton *prevpix = new TGTextButton(midframe, "<< Prev Pixel", M_PREVPIXEL); 91 TGTextButton *nextpix = new TGTextButton(midframe, "Next Pixel >>", M_NEXTPIXEL); 92 92 prevpix->Associate(this); 93 93 nextpix->Associate(this); 94 94 95 TGVSlider *slider = new TGVSlider( fMidFrame, 200, kSlider1|kScaleBoth);95 TGVSlider *slider = new TGVSlider(midframe, 200, kSlider1|kScaleBoth); 96 96 slider->Associate(this); 97 97 slider->SetRange(0, 576); … … 103 103 TGLayoutHints *layslider = new TGLayoutHints(kLHintsCenterX|kLHintsExpandY); 104 104 105 fMidFrame->AddFrame(prevpix, laybut);106 fMidFrame->AddFrame(slider, layslider);107 fMidFrame->AddFrame(nextpix, laybut);105 midframe->AddFrame(prevpix, laybut); 106 midframe->AddFrame(slider, layslider); 107 midframe->AddFrame(nextpix, laybut); 108 108 } 109 109 -
trunk/MagicSoft/Mars/mhist/MHHadronness.cc
r1809 r1910 19 19 ! Author(s): Abelardo Moralejo <mailto:moralejo@pd.infn.it> 20 20 ! 21 ! Copyright: MAGIC Software Development, 2000-200 221 ! Copyright: MAGIC Software Development, 2000-2003 22 22 ! 23 23 ! … … 51 51 // - blue cross: minimum of distance to (0, 1) 52 52 // 53 // As a default MHHadronness searches for the container "MHadronness". 54 // This can be overwritten by a different pointer specified in the 55 // Fill function (No type check is done!) Use a different name in 56 // MFillH. 57 // 53 58 //////////////////////////////////////////////////////////////////////////// 54 59 #include "MHHadronness.h" 55 56 /*57 // - blue: 2D distance of (acceptance_hadrons, acceptances_gammas)58 // to optimum (0, 1): 1-sqrt(Ag*Ag + (1-Ah)*(1-Ah))59 */60 60 61 61 #include <TPad.h> … … 107 107 fIntPhness->SetYTitle("Acceptance"); 108 108 109 /*110 fQfac = new TH1D("Qfac", "Naive Quality factor", nbins, 0, 1);111 fQfac->SetXTitle("Hadronness");112 fQfac->SetYTitle("Quality");113 */114 109 fQfac = new TGraph; 115 110 fQfac->SetTitle(" Naive Quality factor "); 116 111 117 /*118 fMinDist = new TH1D("MinDist", "Minimum Dist to (0, 1)", nbins, 0, 1);119 fMinDist->SetXTitle("Hadronness");120 fMinDist->SetYTitle("Distance");121 */122 123 //fQfac->SetDirectory(NULL);124 112 fGhness->SetDirectory(NULL); 125 113 fPhness->SetDirectory(NULL); 126 //fMinDist->SetDirectory(NULL);127 114 fIntGhness->SetDirectory(NULL); 128 115 fIntPhness->SetDirectory(NULL); … … 140 127 delete fIntPhness; 141 128 delete fQfac; 142 // delete fMinDist;143 129 delete fGraph; 144 130 } … … 159 145 160 146 fHadronness = (MHadronness*)plist->FindObject("MHadronness"); 161 if (!fHadronness)162 {163 *fLog << err << dbginf << "MHadronness not found... aborting." << endl;164 return kFALSE;165 }166 147 167 148 /* … … 186 167 // histogram dependant on the particle id. 187 168 // 169 // Every particle Id different than kGAMMA is considered a hadron. 170 // 171 // If you call Fill with a pointer (eg. from MFillH) this container is 172 // used as a hadronness (Warning: No type check is done!) otherwise 173 // the default is used ("MHadronness") 174 // 188 175 // Sometimes a distance is calculated as NaN (not a number). Such events 189 176 // are skipped at the moment. … … 192 179 { 193 180 // Preliminary Workaround: FIXME! 194 195 const Double_t h = fHadronness->GetHadronness(); 181 if (!par && !fHadronness) 182 { 183 *fLog << err << "MHHadronness::Fill: No MHadronness container specified!" << endl; 184 return kFALSE; 185 } 186 187 const MHadronness &had = par ? *(MHadronness*)par : *fHadronness; 188 189 const Double_t h = had.GetHadronness(); 196 190 197 191 if (TMath::IsNaN(h)) … … 235 229 } 236 230 237 Float_t retValue; 238 if (val2x-val1x != 0.0) 239 retValue = val1y - (val2y-val1y)/(val2x-val1x) * (val1x-0.5); 240 else 241 retValue = 0.0; 242 243 return retValue; 231 return val2x-val1x == 0 ? 0 : val1y - (val2y-val1y)/(val2x-val1x) * (val1x-0.5); 244 232 } 245 233 … … 258 246 fQfac->Set(n); 259 247 260 Stat_t sumg; 261 Stat_t sump; 262 263 sumg = fGhness->Integral(1, n); 264 sump = fPhness->Integral(1, n); 265 266 if (sumg == 0.0 || sump == 0.0) 267 { 268 *fLog << "MHHadronness::Finalize; sumg or sump is zero; sumg, sump = " 269 << sumg << ", " << sump << ". Cannot calculate hadronness" 270 << endl; 271 } 248 const Stat_t sumg = fGhness->Integral(); 249 const Stat_t sump = fPhness->Integral(); 250 251 *fLog << inf << "MHHadronness::Finalize - Sum Hadronness: gammas=" << sumg << " hadrons=" << sump << endl; 252 253 if (sumg==0 || sump==0) 254 *fLog << warn << "MHHadronness::Finalize: Cannot calculate hadronness." << endl; 272 255 273 256 274 257 // Normalize photon distribution 275 Stat_t con; 276 if (sumg > 0.0) 277 for (Int_t i=1; i<=n; i++) 278 { 279 con = (fGhness->GetBinContent(i)) / sumg; 280 fGhness->SetBinContent(i, con); 281 } 258 if (sumg>0) 259 fGhness->Scale(1./sumg); 282 260 283 261 // Normalize hadron distribution 284 if (sump > 0.0) 285 for (Int_t i=1; i<=n; i++) 286 { 287 con = (fPhness->GetBinContent(i)) / sump; 288 fPhness->SetBinContent(i, con); 289 } 262 if (sump>0) 263 fGhness->Scale(1./sump); 290 264 291 265 // Calculate acceptances 292 sumg = fGhness->Integral(1, n);293 sump = fPhness->Integral(1, n);294 295 *fLog << "MHHadronness::Finalize; sumg, sump = " << sumg << ", "296 << sump << endl;297 298 266 Float_t max=0; 299 267 300 268 for (Int_t i=1; i<=n; i++) 301 269 { 302 Stat_t ip; 303 if (sump != 0.0) 304 ip = fPhness->Integral(1, i)/sump; 305 else 306 ip = 0; 307 308 Stat_t ig; 309 if (sumg != 0.0) 310 ig = fGhness->Integral(1, i)/sumg; 311 else 312 ig = 0; 270 const Stat_t ip = sump!=0 ? fPhness->Integral(1, i)/sump : 0; 271 const Stat_t ig = sumg!=0 ? fGhness->Integral(1, i)/sumg : 0; 313 272 314 273 fIntPhness->SetBinContent(i, ip); … … 319 278 if (ip<=0) 320 279 continue; 321 322 //fMinDist->SetBinContent(i, 1-sqrt(ip*ip + (ig-1)*(ig-1)));323 280 324 281 const Double_t val = ig/sqrt(ip); … … 432 389 *fLog << endl; 433 390 434 /*435 const Int_t h = fMinDist->GetMaximumBin();436 *fLog << "Minimum Distance to (0, 1): " << Form("%.2f", 1-fMinDist->GetMaximum()) << " @ H=" << fMinDist->GetBinCenter(h) << endl;437 *fLog << " Acc Gammas = " << Form("%3.0f", fIntGhness->GetBinContent(h)*100) << "%, ";438 *fLog << "Acc Hadrons = " << Form("%3.0f", fIntPhness->GetBinContent(h)*100) << "%" << endl;439 */440 441 391 *fLog << "Q-Factor @ Acc Gammas=0.5: Q(0.5)=" << Form("%.1f", GetQ05()) << endl; 442 392 *fLog << " Acc Hadrons = " << Form("%5.1f", GetHadronAcceptance(0.5)*100) << "%" << endl; … … 463 413 Getphness()->SetLineColor(kRed); 464 414 Getphness()->DrawCopy("same"); 415 465 416 c.cd(2); 466 417 //gStyle->SetOptStat(0); … … 468 419 Getiphness()->SetLineColor(kRed); 469 420 Getiphness()->DrawCopy("same"); 470 /* 471 fMinDist->SetLineColor(kBlue); 472 fMinDist->DrawCopy("same"); 473 */ 421 474 422 c.cd(3); 475 //GetQfac()->DrawCopy();476 423 TGraph &g2 = (TGraph&)*fQfac->DrawClone("A*"); 477 424 g2.SetBit(kCanDelete); … … 489 436 gPad->Update(); 490 437 } 438 491 439 c.cd(4); 492 440 gPad->Modified(); … … 537 485 Getphness()->SetLineColor(kRed); 538 486 Getphness()->Draw("same"); 487 539 488 gPad->cd(2); 540 489 //gStyle->SetOptStat(0); … … 542 491 Getiphness()->SetLineColor(kRed); 543 492 Getiphness()->Draw("same"); 544 /* 545 fMinDist->SetLineColor(kBlue); 546 fMinDist->Draw("same"); 547 */ 493 548 494 gPad->cd(3); 549 //GetQfac()->Draw();550 495 fQfac->Draw("A*"); 551 496 gPad->Modified(); … … 578 523 gPad->Update(); 579 524 } 580 /* 581 const Int_t h = fMinDist->GetMaximumBin(); 582 TMarker *m = new TMarker(fIntPhness->GetBinContent(h), 583 fIntGhness->GetBinContent(h), kStar); 584 m->SetMarkerColor(kBlue); 585 m->SetBit(kCanDelete); 586 m->Draw(); 587 */ 588 } 525 } -
trunk/MagicSoft/Mars/mhist/MHHadronness.h
r1668 r1910 22 22 TH1D* fIntPhness; //-> Hadrons Acceptance 23 23 TH1D* fIntGhness; //-> Gammas Acceptance 24 //TH1D* fMinDist; //-> Minimum Distance to optimum acceptance25 24 26 25 TGraph *fQfac; //-> Quality factor
Note:
See TracChangeset
for help on using the changeset viewer.