Changeset 3889 for trunk/MagicSoft/Mars/mjobs
- Timestamp:
- 04/29/04 15:48:38 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mjobs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mjobs/MGCamDisplays.cc
r3875 r3889 121 121 // 3: Triple Gauss (for distributions with inner, outer pixels and outliers) 122 122 // 4: flat (for the probability distributions) 123 // (1-4:) Moreover, sectors 6,1 and 2 of the camera and sectors 3,4 and 5 are 124 // drawn separately, for inner and outer pixels. 123 125 // 5: Fit Inner and Outer pixels separately by a single Gaussian 124 126 // (only for MAGIC cameras) 125 // 126 // Moreover, sectors 6,1 and 2 of the camera and sectors 3,4 and 5 are127 // drawn separately, for inner and outer pixels.127 // 6: Fit Inner and Outer pixels separately by a single Gaussian and display 128 // additionally the two camera halfs separately (for MAGIC camera) 129 // 128 130 // 129 131 void MGCamDisplays::DrawProjection(MHCamera *obj, Int_t fit) const … … 136 138 outer[0] = 1; 137 139 138 if (fit==5 )140 if (fit==5 || fit==6) 139 141 { 140 142 … … 149 151 s0[5] = 5; 150 152 153 TArrayI s1(3); 154 s1[0] = 6; 155 s1[1] = 1; 156 s1[2] = 2; 157 158 TArrayI s2(3); 159 s2[0] = 3; 160 s2[1] = 4; 161 s2[2] = 5; 162 151 163 gPad->Clear(); 152 164 TVirtualPad *pad = gPad; 153 165 pad->Divide(2,1); 154 166 155 TH1D * half[2];156 half[0] = obj->ProjectionS(s0, inner, "Inner");157 half[1] = obj->ProjectionS(s0, outer, "Outer");158 159 half[0]->SetDirectory(NULL);160 half[1]->SetDirectory(NULL);167 TH1D *inout[2]; 168 inout[0] = obj->ProjectionS(s0, inner, "Inner"); 169 inout[1] = obj->ProjectionS(s0, outer, "Outer"); 170 171 inout[0]->SetDirectory(NULL); 172 inout[1]->SetDirectory(NULL); 161 173 162 174 for (int i=0; i<2; i++) 163 175 { 164 176 pad->cd(i+1); 165 half[i]->SetLineColor(kRed+i); 166 half[i]->SetBit(kCanDelete); 167 half[i]->Draw(); 168 half[i]->Fit("gaus","Q"); 177 inout[i]->SetLineColor(kRed+i); 178 inout[i]->SetBit(kCanDelete); 179 inout[i]->Draw(); 180 inout[i]->Fit("gaus","Q"); 181 182 if (fit == 6) 183 { 184 TH1D *half[2]; 185 half[0] = obj->ProjectionS(s1, i==0 ? inner : outer , "Sector 6-1-2"); 186 half[1] = obj->ProjectionS(s2, i==0 ? inner : outer , "Sector 3-4-5"); 187 188 for (int j=0; j<2; j++) 189 { 190 half[j]->SetLineColor(kRed+i+j); 191 half[j]->SetDirectory(0); 192 half[j]->SetBit(kCanDelete); 193 half[j]->Draw("same"); 194 } 195 } 196 169 197 } 170 198 171 199 gLog << all << obj->GetName() 172 200 << Form("%s%5.3f%s%3.2f"," Mean: Inner Pixels: ", 173 half[0]->GetFunction("gaus")->GetParameter(1),"+-",174 half[0]->GetFunction("gaus")->GetParError(1));201 inout[0]->GetFunction("gaus")->GetParameter(1),"+-", 202 inout[0]->GetFunction("gaus")->GetParError(1)); 175 203 gLog << Form("%s%5.3f%s%3.2f"," Outer Pixels: ", 176 half[1]->GetFunction("gaus")->GetParameter(1),"+-",177 half[1]->GetFunction("gaus")->GetParError(1)) << endl;204 inout[1]->GetFunction("gaus")->GetParameter(1),"+-", 205 inout[1]->GetFunction("gaus")->GetParError(1)) << endl; 178 206 gLog << all << obj->GetName() 179 207 << Form("%s%5.3f%s%3.2f"," Sigma: Inner Pixels: ", 180 half[0]->GetFunction("gaus")->GetParameter(2),"+-",181 half[0]->GetFunction("gaus")->GetParError(2));208 inout[0]->GetFunction("gaus")->GetParameter(2),"+-", 209 inout[0]->GetFunction("gaus")->GetParError(2)); 182 210 gLog << Form("%s%5.3f%s%3.2f"," Outer Pixels: ", 183 half[1]->GetFunction("gaus")->GetParameter(2),"+-",184 half[1]->GetFunction("gaus")->GetParError(2)) << endl;185 211 inout[1]->GetFunction("gaus")->GetParameter(2),"+-", 212 inout[1]->GetFunction("gaus")->GetParError(2)) << endl; 213 186 214 } 187 215 return; -
trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
r3810 r3889 45 45 #include "MTaskList.h" 46 46 #include "MEvtLoop.h" 47 #include "MExtractor.h" 47 48 48 49 #include "MStatusDisplay.h" … … 62 63 63 64 using namespace std; 64 65 // -------------------------------------------------------------------------- 66 // 67 // Default constructor. 68 // 69 // Sets fRuns to 0, fExtractor to NULL, fDataCheck to kFALSE 70 // 65 71 MJPedestal::MJPedestal(const char *name, const char *title) 66 : fRuns(0), fDataCheck(kFALSE) 67 72 : fRuns(0), fExtractor(NULL), fDataCheck(kFALSE) 68 73 { 69 74 fName = name ? name : "MJPedestal"; … … 115 120 } 116 121 117 void MJPedestal::DrawProjection(MHCamera *obj1, Int_t fit) const118 {119 TH1D *obj2 = (TH1D*)obj1->Projection(obj1->GetName());120 obj2->SetDirectory(0);121 obj2->Draw();122 obj2->SetBit(kCanDelete);123 gPad->SetLogy();124 125 if (obj1->GetGeomCam().InheritsFrom("MGeomCamMagic"))126 {127 TArrayI s0(3);128 s0[0] = 6;129 s0[1] = 1;130 s0[2] = 2;131 132 TArrayI s1(3);133 s1[0] = 3;134 s1[1] = 4;135 s1[2] = 5;136 137 TArrayI inner(1);138 inner[0] = 0;139 140 TArrayI outer(1);141 outer[0] = 1;142 143 // Just to get the right (maximum) binning144 TH1D *half[4];145 half[0] = obj1->ProjectionS(s0, inner, "Sector 6-1-2 Inner");146 half[1] = obj1->ProjectionS(s1, inner, "Sector 3-4-5 Inner");147 half[2] = obj1->ProjectionS(s0, outer, "Sector 6-1-2 Outer");148 half[3] = obj1->ProjectionS(s1, outer, "Sector 3-4-5 Outer");149 150 for (int i=0; i<4; i++)151 {152 half[i]->SetLineColor(kRed+i);153 half[i]->SetDirectory(0);154 half[i]->SetBit(kCanDelete);155 half[i]->Draw("same");156 }157 }158 159 const Double_t min = obj2->GetBinCenter(obj2->GetXaxis()->GetFirst());160 const Double_t max = obj2->GetBinCenter(obj2->GetXaxis()->GetLast());161 const Double_t integ = obj2->Integral("width")/2.5066283;162 const Double_t mean = obj2->GetMean();163 const Double_t rms = obj2->GetRMS();164 const Double_t width = max-min;165 166 if (rms==0 || width==0)167 return;168 169 const TString dgausformula("([0]-[3])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])"170 "+[3]/[5]*exp(-0.5*(x-[4])*(x-[4])/[5]/[5])");171 172 TF1 *f=0;173 switch (fit)174 {175 // FIXME: MAYBE add function to TH1?176 case 0:177 f = new TF1("sgaus", "gaus(0)", min, max);178 f->SetLineColor(kYellow);179 f->SetBit(kCanDelete);180 f->SetParNames("Area", "#mu", "#sigma");181 f->SetParameters(integ/rms, mean, rms);182 f->SetParLimits(0, 0, integ);183 f->SetParLimits(1, min, max);184 f->SetParLimits(2, 0, width/1.5);185 obj2->Fit(f, "QLRM");186 break;187 188 case 1:189 f = new TF1("dgaus", dgausformula, min, max);190 f->SetLineColor(kYellow);191 f->SetBit(kCanDelete);192 f->SetParNames("A_{tot}", "#mu_{1}", "#sigma_{1}", "A_{2}", "#mu_{2}", "#sigma_{2}");193 f->SetParameters(integ, (min+mean)/2, width/4,194 integ/width/2, (max+mean)/2, width/4);195 // The left-sided Gauss196 f->SetParLimits(0, integ-1.5, integ+1.5);197 f->SetParLimits(1, min+(width/10), mean);198 f->SetParLimits(2, 0, width/2);199 // The right-sided Gauss200 f->SetParLimits(3, 0, integ);201 f->SetParLimits(4, mean, max-(width/10));202 f->SetParLimits(5, 0, width/2);203 obj2->Fit(f, "QLRM");204 break;205 206 default:207 obj2->Fit("gaus", "Q");208 obj2->GetFunction("gaus")->SetLineColor(kYellow);209 break;210 }211 }212 213 void MJPedestal::CamDraw(TCanvas &c, Int_t x, Int_t y, MHCamera &cam1, Int_t fit)214 {215 c.cd(x);216 gPad->SetBorderMode(0);217 MHCamera *obj1=(MHCamera*)cam1.DrawCopy("hist");218 219 obj1->AddNotify(&fPedestalCam);220 221 c.cd(x+y);222 gPad->SetBorderMode(0);223 obj1->Draw();224 225 c.cd(x+2*y);226 gPad->SetBorderMode(0);227 DrawProjection(obj1, fit);228 }229 122 230 123 void MJPedestal::DisplayResult(MParList &plist) … … 251 144 // Create container to display 252 145 // 253 MHCamera disp0(geomcam, "MPedestalCam;ped", "Pedestal s");254 MHCamera disp1(geomcam, "MPedestalCam; var", "Sigma Pedestal");146 MHCamera disp0(geomcam, "MPedestalCam;ped", "Pedestal"); 147 MHCamera disp1(geomcam, "MPedestalCam;RMS", "Ped. RMS"); 255 148 256 149 disp0.SetCamContent(fPedestalCam, 0); … … 269 162 c3.Divide(2,3); 270 163 271 CamDraw(c3, 1, 2, disp0, 0);272 CamDraw(c3, 2, 2, disp1, 1);164 CamDraw(c3, 1, 2, disp0, 1); 165 CamDraw(c3, 2, 2, disp1, 6); 273 166 } 274 167 … … 368 261 MPedCalcPedRun pedcalc; 369 262 263 if (fExtractor) 264 { 265 pedcalc.SetWindowSize((Int_t)fExtractor->GetNumHiGainSamples()); 266 pedcalc.SetRange(fExtractor->GetHiGainFirst(), fExtractor->GetHiGainLast()); 267 } 268 else 269 { 270 *fLog << warn << GetDescriptor() 271 << ": No extractor has been chosen, take default number of FADC samples " << endl; 272 } 273 370 274 tlist.AddToList(&geomapl); 371 275 // tlist.AddToList(&merge); -
trunk/MagicSoft/Mars/mjobs/MJPedestal.h
r3810 r3889 8 8 #include "MBadPixelsCam.h" 9 9 #endif 10 10 #ifndef MARS_MGCamDisplays 11 #include "MGCamDisplays.h" 12 #endif 11 13 12 14 class TCanvas; … … 14 16 class MRunIter; 15 17 class MHCamera; 16 17 class MJPedestal : public MParContainer 18 class MExtractor; 19 class MJPedestal : public MParContainer, public MGCamDisplays 18 20 { 19 21 private: 20 TString fOutputPath;21 22 22 MRunIter *fRuns; 23 TString fOutputPath; 24 25 MRunIter *fRuns; 26 MExtractor *fExtractor; // Signal extractor, used to find the nr. of used FADC slices 23 27 24 MPedestalCam fPedestalCam; 25 MBadPixelsCam fBadPixels; 28 MPedestalCam fPedestalCam; 29 MBadPixelsCam fBadPixels; 30 31 Bool_t fDataCheck; // Flag if the data check is run on raw data 32 33 Bool_t ReadPedestalCam(); 34 Bool_t WriteResult(); 35 36 void DisplayResult(MParList &plist); 37 38 public: 26 39 27 Bool_t fDataCheck; // Flag if the data check is run on raw data40 MJPedestal(const char *name=NULL, const char *title=NULL); 28 41 29 Bool_t ReadPedestalCam(); 30 Bool_t WriteResult(); 31 32 void DrawProjection(MHCamera *obj1, Int_t fit) const; 33 void CamDraw(TCanvas &c, Int_t x, Int_t y, MHCamera &cam1, Int_t fit); 34 void DisplayResult(MParList &plist); 35 36 public: 37 MJPedestal(const char *name=NULL, const char *title=NULL); 38 39 void SetOutputPath(const char *path="."); 40 void SetInput(MRunIter *iter) { fRuns=iter; } 41 42 // Data Check 43 void SetDataCheck(const Bool_t b=kTRUE) { fDataCheck = b; } 44 45 TString GetOutputFile() const; 46 47 MPedestalCam &GetPedestalCam() { return fPedestalCam; } 48 const MBadPixelsCam &GetBadPixels() const { return fBadPixels; } 49 50 void SetBadPixels(const MBadPixelsCam &bad) { bad.Copy(fBadPixels); } 51 52 Bool_t ProcessFile(); 53 Bool_t Process(); 54 55 ClassDef(MJPedestal, 0) // Tool to create a pedestal file (MPedestalCam) 42 MPedestalCam &GetPedestalCam() { return fPedestalCam; } 43 const MBadPixelsCam &GetBadPixels() const { return fBadPixels; } 44 45 TString GetOutputFile() const; 46 47 Bool_t Process(); 48 Bool_t ProcessFile(); 49 50 void SetBadPixels ( const MBadPixelsCam &bad) { bad.Copy(fBadPixels); } 51 void SetDataCheck ( const Bool_t b=kTRUE ) { fDataCheck = b; } 52 void SetExtractor ( MExtractor* ext ) { fExtractor = ext; } 53 void SetInput ( MRunIter *iter ) { fRuns = iter; } 54 void SetOutputPath( const char *path="." ); 55 56 ClassDef(MJPedestal, 0) // Tool to create a pedestal file (MPedestalCam) 56 57 }; 57 58
Note:
See TracChangeset
for help on using the changeset viewer.