Changeset 3524
- Timestamp:
- 03/16/04 14:25:48 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3523 r3524 18 18 19 19 -*-*- END OF LINE -*-*- 20 21 2004/03/16: Thomas Bretz 22 23 * mjobs/MJ*.[h,cc] 24 - removed some obsolete comments 25 - removed projections from Directory (SetDirectory(0)) 26 27 20 28 21 29 2004/03/16: Wolfgang Wittek -
trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
r3501 r3524 70 70 71 71 ClassImp(MJCalibration); 72 72 73 using namespace std; 73 74 … … 80 81 void MJCalibration::DrawProjection(MHCamera *obj1, Int_t fit) const 81 82 { 82 83 TH1D *obj2 = (TH1D*)obj1->Projection(obj1->GetName());84 obj2->Draw();85 obj2->SetBit(kCanDelete);86 87 if (obj1->GetGeomCam().InheritsFrom("MGeomCamMagic"))88 { 89 TArrayI s0(3);90 s0[0] = 6;91 s0[1] = 1;92 s0[2] = 2;93 94 TArrayI s1(3);95 s1[0] = 3;96 s1[1] = 4;97 s1[2] = 5;98 99 TArrayI inner(1);100 inner[0] = 0;101 102 TArrayI outer(1);103 outer[0] = 1;104 105 // Just to get the right (maximum) binning106 TH1D *half[4];107 half[0] = obj1->ProjectionS(s0, inner, "Sector 6-1-2 Inner");108 half[1] = obj1->ProjectionS(s1, inner, "Sector 3-4-5 Inner");109 half[2] = obj1->ProjectionS(s0, outer, "Sector 6-1-2 Outer");110 half[3] = obj1->ProjectionS(s1, outer, "Sector 3-4-5 Outer");111 112 for (int i=0; i<4; i++)83 TH1D *obj2 = (TH1D*)obj1->Projection(obj1->GetName()); 84 obj2->SetDirectory(0); 85 obj2->Draw(); 86 obj2->SetBit(kCanDelete); 87 88 if (obj1->GetGeomCam().InheritsFrom("MGeomCamMagic")) 89 { 90 TArrayI s0(3); 91 s0[0] = 6; 92 s0[1] = 1; 93 s0[2] = 2; 94 95 TArrayI s1(3); 96 s1[0] = 3; 97 s1[1] = 4; 98 s1[2] = 5; 99 100 TArrayI inner(1); 101 inner[0] = 0; 102 103 TArrayI outer(1); 104 outer[0] = 1; 105 106 // Just to get the right (maximum) binning 107 TH1D *half[4]; 108 half[0] = obj1->ProjectionS(s0, inner, "Sector 6-1-2 Inner"); 109 half[1] = obj1->ProjectionS(s1, inner, "Sector 3-4-5 Inner"); 110 half[2] = obj1->ProjectionS(s0, outer, "Sector 6-1-2 Outer"); 111 half[3] = obj1->ProjectionS(s1, outer, "Sector 3-4-5 Outer"); 112 113 for (int i=0; i<4; i++) 113 114 { 114 half[i]->SetLineColor(kRed+i);115 half[i]->SetDirectory(0);116 half[i]->SetBit(kCanDelete);117 half[i]->Draw("same");115 half[i]->SetLineColor(kRed+i); 116 half[i]->SetDirectory(0); 117 half[i]->SetBit(kCanDelete); 118 half[i]->Draw("same"); 118 119 } 119 120 } 120 121 const Double_t min = obj2->GetBinCenter(obj2->GetXaxis()->GetFirst());122 const Double_t max = obj2->GetBinCenter(obj2->GetXaxis()->GetLast());123 const Double_t integ = obj2->Integral("width")/2.5;124 const Double_t mean = obj2->GetMean();125 const Double_t rms = obj2->GetRMS();126 const Double_t width = max-min;127 128 const TString dgausformula = "([0]-[3])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])"129 130 131 const TString tgausformula = "([0]-[3]-[6])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])"132 133 134 TF1 *f=0;135 switch (fit)121 122 const Double_t min = obj2->GetBinCenter(obj2->GetXaxis()->GetFirst()); 123 const Double_t max = obj2->GetBinCenter(obj2->GetXaxis()->GetLast()); 124 const Double_t integ = obj2->Integral("width")/2.5; 125 const Double_t mean = obj2->GetMean(); 126 const Double_t rms = obj2->GetRMS(); 127 const Double_t width = max-min; 128 129 const TString dgausformula = "([0]-[3])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])" 130 "+[3]/[5]*exp(-0.5*(x-[4])*(x-[4])/[5]/[5])"; 131 132 const TString tgausformula = "([0]-[3]-[6])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])" 133 "+[3]/[5]*exp(-0.5*(x-[4])*(x-[4])/[5]/[5])" 134 "+[6]/[8]*exp(-0.5*(x-[7])*(x-[7])/[8]/[8])"; 135 TF1 *f=0; 136 switch (fit) 136 137 { 137 138 case 1: 138 f = new TF1("sgaus", "gaus(0)", min, max);139 f->SetLineColor(kYellow);140 f->SetBit(kCanDelete);141 f->SetParNames("Area", "#mu", "#sigma");142 f->SetParameters(integ/rms, mean, rms);143 f->SetParLimits(0, 0, integ);144 f->SetParLimits(1, min, max);145 f->SetParLimits(2, 0, width/1.5);146 147 obj2->Fit(f, "QLR");148 break;149 139 f = new TF1("sgaus", "gaus(0)", min, max); 140 f->SetLineColor(kYellow); 141 f->SetBit(kCanDelete); 142 f->SetParNames("Area", "#mu", "#sigma"); 143 f->SetParameters(integ/rms, mean, rms); 144 f->SetParLimits(0, 0, integ); 145 f->SetParLimits(1, min, max); 146 f->SetParLimits(2, 0, width/1.5); 147 148 obj2->Fit(f, "QLR"); 149 break; 150 150 151 case 2: 151 f = new TF1("dgaus",dgausformula.Data(),min,max);152 f->SetLineColor(kYellow);153 f->SetBit(kCanDelete);154 f->SetParNames("A_{tot}", "#mu1", "#sigma1", "A2", "#mu2", "#sigma2");155 f->SetParameters(integ,(min+mean)/2.,width/4.,156 integ/width/2.,(max+mean)/2.,width/4.);157 // The left-sided Gauss158 f->SetParLimits(0,integ-1.5 , integ+1.5);159 f->SetParLimits(1,min+(width/10.), mean);160 f->SetParLimits(2,0 , width/2.);161 // The right-sided Gauss162 f->SetParLimits(3,0 , integ);163 f->SetParLimits(4,mean, max-(width/10.));164 f->SetParLimits(5,0 , width/2.);165 obj2->Fit(f,"QLRM");166 break;167 152 f = new TF1("dgaus",dgausformula.Data(),min,max); 153 f->SetLineColor(kYellow); 154 f->SetBit(kCanDelete); 155 f->SetParNames("A_{tot}", "#mu1", "#sigma1", "A2", "#mu2", "#sigma2"); 156 f->SetParameters(integ,(min+mean)/2.,width/4., 157 integ/width/2.,(max+mean)/2.,width/4.); 158 // The left-sided Gauss 159 f->SetParLimits(0,integ-1.5 , integ+1.5); 160 f->SetParLimits(1,min+(width/10.), mean); 161 f->SetParLimits(2,0 , width/2.); 162 // The right-sided Gauss 163 f->SetParLimits(3,0 , integ); 164 f->SetParLimits(4,mean, max-(width/10.)); 165 f->SetParLimits(5,0 , width/2.); 166 obj2->Fit(f,"QLRM"); 167 break; 168 168 169 case 3: 169 f = new TF1("tgaus",tgausformula.Data(),min,max);170 f->SetLineColor(kYellow);171 f->SetBit(kCanDelete);172 f->SetParNames("A_{tot}","#mu_{1}","#sigma_{1}",173 "A_{2}","#mu_{2}","#sigma_{2}",174 "A_{3}","#mu_{3}","#sigma_{3}");175 f->SetParameters(integ,(min+mean)/2,width/4.,176 integ/width/3.,(max+mean)/2.,width/4.,177 integ/width/3.,mean,width/2.);178 // The left-sided Gauss179 f->SetParLimits(0,integ-1.5,integ+1.5);180 f->SetParLimits(1,min+(width/10.),mean);181 f->SetParLimits(2,width/15.,width/2.);182 // The right-sided Gauss183 f->SetParLimits(3,0.,integ);184 f->SetParLimits(4,mean,max-(width/10.));185 f->SetParLimits(5,width/15.,width/2.);186 // The Gauss describing the outliers187 f->SetParLimits(6,0.,integ);188 f->SetParLimits(7,min,max);189 f->SetParLimits(8,width/4.,width/1.5);190 obj2->Fit(f,"QLRM");191 break;170 f = new TF1("tgaus",tgausformula.Data(),min,max); 171 f->SetLineColor(kYellow); 172 f->SetBit(kCanDelete); 173 f->SetParNames("A_{tot}","#mu_{1}","#sigma_{1}", 174 "A_{2}","#mu_{2}","#sigma_{2}", 175 "A_{3}","#mu_{3}","#sigma_{3}"); 176 f->SetParameters(integ,(min+mean)/2,width/4., 177 integ/width/3.,(max+mean)/2.,width/4., 178 integ/width/3.,mean,width/2.); 179 // The left-sided Gauss 180 f->SetParLimits(0,integ-1.5,integ+1.5); 181 f->SetParLimits(1,min+(width/10.),mean); 182 f->SetParLimits(2,width/15.,width/2.); 183 // The right-sided Gauss 184 f->SetParLimits(3,0.,integ); 185 f->SetParLimits(4,mean,max-(width/10.)); 186 f->SetParLimits(5,width/15.,width/2.); 187 // The Gauss describing the outliers 188 f->SetParLimits(6,0.,integ); 189 f->SetParLimits(7,min,max); 190 f->SetParLimits(8,width/4.,width/1.5); 191 obj2->Fit(f,"QLRM"); 192 break; 192 193 193 194 case 4: 194 obj2->Fit("pol0", "Q");195 obj2->GetFunction("pol0")->SetLineColor(kYellow);196 break;197 195 obj2->Fit("pol0", "Q"); 196 obj2->GetFunction("pol0")->SetLineColor(kYellow); 197 break; 198 198 199 case 9: 199 break;200 200 break; 201 201 202 default: 202 obj2->Fit("gaus", "Q");203 obj2->GetFunction("gaus")->SetLineColor(kYellow);204 break;203 obj2->Fit("gaus", "Q"); 204 obj2->GetFunction("gaus")->SetLineColor(kYellow); 205 break; 205 206 } 206 207 } -
trunk/MagicSoft/Mars/mjobs/MJExtractSignal.cc
r3501 r3524 71 71 fTitle = title ? title : "Tool to create a pedestal file (MPedestalCam)"; 72 72 } 73 /* 74 void MJExtractSignal::CamDraw(TCanvas &c, MHCamera &cam1, MCamEvent ¬e, Int_t i) 75 { 76 c.cd(i); 77 gPad->SetBorderMode(0); 78 MHCamera *obj1=(MHCamera*)cam1.DrawCopy("hist"); 79 obj1->AddNotify(note); 80 81 c.cd(i+2); 82 gPad->SetBorderMode(0); 83 obj1->Draw(); 84 85 c.cd(i+4); 86 gPad->SetBorderMode(0); 87 TH1D *obj2 = (TH1D*)obj1->Projection(); 88 obj2->Draw(); 89 obj2->SetBit(kCanDelete); 90 obj2->Fit("gaus","Q"); 91 obj2->GetFunction("gaus")->SetLineColor(kYellow); 92 } 93 94 void MJExtractSignal::CamDraw(TCanvas &c, MHCamera &cam1, MHCamera &cam2, MCamEvent ¬e) 95 { 96 c.Divide(2, 3); 97 98 CamDraw(c, cam1, note, 1); 99 CamDraw(c, cam2, note, 2); 100 } 101 102 void MJExtractSignal::DisplayResult(MParList &plist) 103 { 104 if (!fDisplay) 105 return; 106 107 // 108 // Update display 109 // 110 TString title = fDisplay->GetTitle(); 111 title += "-- Calibration"; 112 title += fRunNumber<0 ? Form("File %s", (const char*)fFileName) : Form("Run #%d", fRunNumber); 113 title += " --"; 114 fDisplay->SetTitle(title); 115 116 // 117 // Get container from list 118 // 119 MGeomCam &geomcam = *(MGeomCam*)plist.FindObject("MGeomCam"); 120 121 // Create histograms to display 122 MHCamera disp1 (geomcam, "Cal;Charge", "Fitted Mean Charges"); 123 MHCamera disp3 (geomcam, "Cal;SigmaCharge", "Sigma of Fitted Charges"); 124 MHCamera disp5 (geomcam, "Cal;ChargeProb", "Probability of Fit"); 125 MHCamera disp6 (geomcam, "Cal;Time", "Arrival Times"); 126 MHCamera disp7 (geomcam, "Cal;SigmaTime", "Sigma of Arrival Times"); 127 MHCamera disp8 (geomcam, "Cal;TimeChiSquare", "Chi Square of Time Fit"); 128 // MHCamera disp9 (geomcam, "Cal;Ped", "Pedestals"); 129 // MHCamera disp10(geomcam, "Cal;PedRms", "Pedestal RMS"); 130 MHCamera disp11(geomcam, "Cal;RSigma", "Reduced Sigmas"); 131 MHCamera disp12(geomcam, "Cal;PheFFactorMethod", "Nr. of Phe's (F-Factor Method)"); 132 MHCamera disp13(geomcam, "Cal;MeanConversionFFactorMethod", "Conversion Factor (F-Factor Method)"); 133 MHCamera disp14(geomcam, "Cal;MeanPhotInsidePlexiglass", "Nr. of Photons (Blind Pixel Method)"); 134 MHCamera disp15(geomcam, "Cal;MeanConversionBlindPixelMethod", "Conversion Factor (Blind Pixel Method)"); 135 MHCamera disp16(geomcam, "Cal;RSigma/Charge", "Reduced Sigma per Charge"); 136 137 disp1.SetCamContent(fCalibrationCam, 0); 138 disp1.SetCamError(fCalibrationCam, 1); 139 140 disp3.SetCamContent(fCalibrationCam, 2); 141 disp3.SetCamError(fCalibrationCam, 3); 142 143 disp5.SetCamContent(fCalibrationCam, 4); 144 145 disp6.SetCamContent(fCalibrationCam, 5); 146 disp6.SetCamError(fCalibrationCam, 6); 147 disp7.SetCamContent(fCalibrationCam, 6); 148 disp8.SetCamContent(fCalibrationCam, 7); 149 disp11.SetCamContent(fCalibrationCam, 10); 150 151 disp12.SetCamContent(fCalibrationCam, 11); 152 disp12.SetCamError(fCalibrationCam, 12); 153 154 disp13.SetCamContent(fCalibrationCam, 13); 155 disp13.SetCamError(fCalibrationCam, 14); 156 157 disp14.SetCamContent(fCalibrationCam, 15); 158 disp15.SetCamContent(fCalibrationCam, 16); 159 disp16.SetCamContent(fCalibrationCam, 17); 160 161 disp1.SetYTitle("Charge [FADC counts]"); 162 disp3.SetYTitle("\\sigma_{Charge} [FADC counts]"); 163 disp5.SetYTitle("P_{Charge} [1]"); 164 disp6.SetYTitle("Arr. Time [Time Slice Nr.]"); 165 disp7.SetYTitle("\\sigma_{Time} [Time Slices]"); 166 disp8.SetYTitle("\\chi^{2}_{Time} [1]"); 167 // disp9.SetYTitle("Ped [FADC Counts ]"); 168 // disp10.SetYTitle("RMS_{Ped} [FADC Counts ]"); 169 disp11.SetYTitle("\\sqrt{\\sigma^{2}_{Charge} - RMS^{2}_{Ped}} [FADC Counts]"); 170 disp12.SetYTitle("Nr. Photo-Electrons [1]"); 171 disp13.SetYTitle("Conversion Factor [PhE/FADC Count]"); 172 disp14.SetYTitle("Nr. Photons [1]"); 173 disp15.SetYTitle("Conversion Factor [Phot/FADC Count]"); 174 disp16.SetYTitle("Reduced Sigma / Charge [1]"); 175 176 gStyle->SetOptStat(1111); 177 gStyle->SetOptFit(); 178 179 // Display Histograms: Charges 180 CamDraw(fDisplay->AddTab("FitdCharge"), disp1, disp3, fCalibrationCam); 181 182 // Fit Probability 183 TCanvas &c12 = fDisplay->AddTab("Fit Prob."); 184 c12.Divide(1, 3); 185 186 c12.cd(1); 187 gPad->SetBorderMode(0); 188 MHCamera *obj1=(MHCamera*)disp5.DrawCopy("hist"); 189 obj1->AddNotify(fCalibrationCam); 190 191 c12.cd(2); 192 gPad->SetBorderMode(0); 193 obj1->Draw(); 194 195 c12.cd(3); 196 gPad->SetBorderMode(0); 197 TH1D *obj2 = (TH1D*)obj1->Projection(); 198 obj2->Draw(); 199 obj2->SetBit(kCanDelete); 200 obj2->Fit("pol0","Q"); 201 obj2->GetFunction("pol0")->SetLineColor(kYellow); 202 203 // Times 204 CamDraw(fDisplay->AddTab("FitdTimes"), disp6, disp8, fCalibrationCam); 205 206 // Pedestals 207 //CamDraw(fDisplay->AddTab("Pedestals"), disp9, disp10, calcam); 208 209 // Reduced Sigmas 210 CamDraw(fDisplay->AddTab("RedSigma"), disp11, disp16, fCalibrationCam); 211 212 // F-Factor Method 213 CamDraw(fDisplay->AddTab("F-Factor"), disp12, disp13, fCalibrationCam); 214 215 } 216 */ 73 217 74 Bool_t MJExtractSignal::WriteResult() 218 75 { -
trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
r3456 r3524 113 113 { 114 114 TH1D *obj2 = (TH1D*)obj1->Projection(obj1->GetName()); 115 obj2->SetDirectory(0); 115 116 obj2->Draw(); 116 117 obj2->SetBit(kCanDelete); … … 141 142 half[2] = obj1->ProjectionS(s0, outer, "Sector 6-1-2 Outer"); 142 143 half[3] = obj1->ProjectionS(s1, outer, "Sector 3-4-5 Outer"); 143 /* 144 half[0]->Reset(); 145 half[1]->Reset(); 146 147 TH1D *dummy = obj1->Projection("Dummy"); 148 149 for (int i=1; i<7; i++) 150 half[(i/3)%2]->Add(obj1->ProjectionS(i, "Dummy")); 151 */ 144 152 145 for (int i=0; i<4; i++) 153 146 { … … 157 150 half[i]->Draw("same"); 158 151 } 159 160 //delete dummy;161 152 } 162 153
Note:
See TracChangeset
for help on using the changeset viewer.