Changeset 2225 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 06/24/03 10:15:42 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mhist
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHHadronness.cc
r2180 r2225 56 56 // MFillH. 57 57 // 58 // If you are using filtercuts which gives you only two discrete values 59 // of the hadronness (0.25 and 0.75) you may want to use MHHadronness(2). 60 // If you request Q05() from such a MHHadronness instance you will get 61 // Acc_g/sqrt(Acc_h) 62 // 58 63 //////////////////////////////////////////////////////////////////////////// 59 64 #include "MHHadronness.h" … … 65 70 #include <TMarker.h> 66 71 72 #include "MParList.h" 73 #include "MBinning.h" 74 #include "MHMatrix.h" 75 #include "MHadronness.h" 76 67 77 #include "MLog.h" 68 78 #include "MLogManip.h" 69 79 70 #include "MParList.h"71 #include "MBinning.h"72 #include "MHadronness.h"73 74 80 #include "MMcEvt.hxx" 75 81 … … 84 90 // 85 91 MHHadronness::MHHadronness(Int_t nbins, const char *name, const char *title) 92 : fMatrix(NULL) 86 93 { 87 94 // … … 95 102 fGraph->SetMarkerStyle(kFullDotSmall); 96 103 97 fGhness = new TH1D("Ghness", " H. Gammas", nbins, 0, 1);98 fPhness = new TH1D("Phness", " H. Hadrons", nbins, 0, 1);104 fGhness = new TH1D("Ghness", "Acceptance vs. Hadronness (Gammas)", nbins, 0, 1); 105 fPhness = new TH1D("Phness", "Acceptance vs. Hadronness (Hadrons)", nbins, 0, 1); 99 106 fGhness->SetXTitle("Hadronness"); 100 107 fPhness->SetXTitle("Hadronness"); 101 fGhness->SetYTitle(" Counts");102 fPhness->SetYTitle(" Counts");108 fGhness->SetYTitle("Acceptance"); 109 fPhness->SetYTitle("Acceptance"); 103 110 fPhness->SetLineColor(kRed); 104 111 fGhness->SetDirectory(NULL); 105 112 fPhness->SetDirectory(NULL); 106 113 107 fIntGhness = new TH1D("AccGammas", " Acceptance", nbins, 0, 1);108 fIntPhness = new TH1D("AccHadrons", " Acceptance", nbins, 0, 1);114 fIntGhness = new TH1D("AccGammas", "Integral Acceptance vs. Hadronness (Gammas)", nbins, 0, 1); 115 fIntPhness = new TH1D("AccHadrons", "Integral Acceptance vs. Hadronness (Hadrons)", nbins, 0, 1); 109 116 fIntGhness->SetXTitle("Hadronness"); 110 117 fIntPhness->SetXTitle("Hadronness"); … … 145 152 Bool_t MHHadronness::SetupFill(const MParList *plist) 146 153 { 147 fMcEvt = (MMcEvt*)plist->FindObject("MMcEvt"); 148 if (!fMcEvt) 149 { 150 *fLog << err << dbginf << "MMcEvt not found... aborting." << endl; 151 return kFALSE; 154 if (!fMatrix) 155 { 156 fMcEvt = (MMcEvt*)plist->FindObject("MMcEvt"); 157 if (!fMcEvt) 158 { 159 *fLog << err << dbginf << "MMcEvt not found... aborting." << endl; 160 return kFALSE; 161 } 152 162 } 153 163 154 164 fHadronness = (MHadronness*)plist->FindObject("MHadronness"); 165 166 fGhness->Reset(); 167 fPhness->Reset(); 155 168 156 169 /* … … 200 213 return kCONTINUE; 201 214 202 if (fMcEvt->GetPartId()==kGAMMA) 215 const Int_t particleid = fMatrix ? (Int_t)(*fMatrix)[fMap] : fMcEvt->GetPartId(); 216 217 if (particleid==kGAMMA) 203 218 fGhness->Fill(h, w); 204 219 else … … 208 223 } 209 224 225 // -------------------------------------------------------------------------- 226 // 227 // Returns the quality factor at gamma acceptance 0.5. 228 // 229 // If the histogram containes only two bins we return the 230 // naive quality: ag/sqrt(ah) 231 // with ag the acceptance of gammas and ah the acceptance of hadrons. 232 // 233 // You can use this (nbins=2) in case of some kind of filter cuts giving 234 // only a result: gamma yes/no (means discrete values of hadronness 0.25 235 // or 0.75) 236 // 237 // FIXME: In the later case weights cannot be used! 238 // 210 239 Float_t MHHadronness::GetQ05() const 211 240 { 212 Int_t n = fQfac->GetN(); 241 if (fGhness->GetNbinsX()==2) 242 { 243 // acceptance of all gamma-like gammas (h<0.5) 244 const Double_t ig = fGhness->GetBinContent(1); 245 246 // acceptance of all gamma-like hadrons (h<0.5) 247 const Double_t ip = fPhness->GetBinContent(1); 248 249 if (ip==0) 250 return 0; // FIXME! 251 252 // naive quality factor 253 const Double_t q = ig / sqrt(ip); 254 255 *fLog << all << ip << "/" << ig << ": " << q << endl; 256 257 return q; 258 } 259 260 const Int_t n = fQfac->GetN(); 213 261 214 262 Double_t val1x=0; … … 479 527 } 480 528 } 529 530 // -------------------------------------------------------------------------- 531 // 532 // You can use this function if you want to use a MHMatrix instead of 533 // MMcEvt. This function adds all necessary columns to the 534 // given matrix. Afterward you should fill the matrix with the corresponding 535 // data (eg from a file by using MHMatrix::Fill). If you now loop 536 // through the matrix (eg using MMatrixLoop) MHHadronness::Fill 537 // will take the values from the matrix instead of the containers. 538 // 539 void MHHadronness::InitMapping(MHMatrix *mat) 540 { 541 if (fMatrix) 542 return; 543 544 fMatrix = mat; 545 fMap = fMatrix->AddColumn("MMcEvt.fPartId"); 546 } 547 548 void MHHadronness::StopMapping() 549 { 550 fMatrix = NULL; 551 } 552 -
trunk/MagicSoft/Mars/mhist/MHHadronness.h
r2043 r2225 11 11 class MMcEvt; 12 12 class MHadronness; 13 class MHMatrix; 13 14 14 15 class MHHadronness : public MH … … 17 18 const MMcEvt *fMcEvt; //! 18 19 const MHadronness *fHadronness; //! 20 MHMatrix *fMatrix; //! 21 Int_t fMap; //! 19 22 20 23 TH1D* fPhness; //-> Hadrons Hadronness … … 48 51 Bool_t Finalize(); 49 52 53 void InitMapping(MHMatrix *mat); 54 void StopMapping(); 55 50 56 void Print(Option_t *option="") const; 51 57
Note:
See TracChangeset
for help on using the changeset viewer.