Changeset 1966 for trunk/MagicSoft/Mars/mimage
- Timestamp:
- 04/20/03 12:51:47 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mimage
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mimage/MHNewImagePar.cc
r1965 r1966 55 55 // 56 56 MHNewImagePar::MHNewImagePar(const char *name, const char *title) 57 : fUseMmScale(kTRUE)58 57 { 59 58 fName = name ? name : "MHNewImagePar"; 60 fTitle = title ? title : " Container for histograms of new image parameters";59 fTitle = title ? title : "Histograms of new image parameters"; 61 60 62 fLeakage1 = new TH1F("Leakage1", "Leakage 1", 100, 0.0, 1.0);61 fLeakage1 = new TH1F("Leakage1", "Leakage_{1}", 100, 0.0, 1.0); 63 62 fLeakage1->SetDirectory(NULL); 64 fLeakage1->SetXTitle("Leakage 1");63 fLeakage1->SetXTitle("Leakage"); 65 64 fLeakage1->SetYTitle("Counts"); 66 65 67 fLeakage2 = new TH1F("Leakage2", "Leakage 2", 100, 0.0, 1.0);66 fLeakage2 = new TH1F("Leakage2", "Leakage_{2}", 100, 0.0, 1.0); 68 67 fLeakage2->SetDirectory(NULL); 69 fLeakage2->SetXTitle("Leakage 2");68 fLeakage2->SetXTitle("Leakage"); 70 69 fLeakage2->SetYTitle("Counts"); 70 fLeakage2->SetLineColor(kBlue); 71 71 } 72 72 … … 79 79 delete fLeakage1; 80 80 delete fLeakage2; 81 }82 83 // --------------------------------------------------------------------------84 //85 // Setup the Binning for the histograms automatically if the correct86 // instances of MBinning (with the names 'BinningAlpha' and 'BinningDist')87 // are found in the parameter list88 // Use this function if you want to set the conversion factor which89 // is used to convert the mm-scale in the camera plain into the deg-scale90 // used for histogram presentations. The conversion factor is part of91 // the camera geometry. Please create a corresponding MGeomCam container.92 //93 Bool_t MHNewImagePar::SetupFill(const MParList *plist)94 {95 const MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam");96 if (!geom)97 *fLog << warn << dbginf << "No Camera Geometry available. Using mm-scale for histograms." << endl;98 else99 {100 fMm2Deg = geom->GetConvMm2Deg();101 SetMmScale(kFALSE);102 }103 104 //ApplyBinning(*plist, "Alpha", fAlpha);105 //ApplyBinning(*plist, "Dist", fDist);106 //ApplyBinning(*plist, "HeadTail", fHeadTail);107 108 return kTRUE;109 81 } 110 82 … … 125 97 // -------------------------------------------------------------------------- 126 98 // 127 // Use this function to setup your own conversion factor between degrees128 // and millimeters. The conversion factor should be the one calculated in129 // MGeomCam. Use this function with Caution: You could create wrong values130 // by setting up your own scale factor.131 //132 void MHNewImagePar::SetMm2Deg(Float_t mmdeg)133 {134 if (mmdeg<=0)135 {136 *fLog << warn << dbginf << "Warning - Conversion factor <= 0 - nonsense. Ignored." << endl;137 return;138 }139 140 if (fMm2Deg>0)141 *fLog << warn << dbginf << "Warning - Conversion factor already set. Overwriting" << endl;142 143 fMm2Deg = mmdeg;144 }145 146 // --------------------------------------------------------------------------147 //148 // With this function you can convert the histogram ('on the fly') between149 // degrees and millimeters.150 //151 void MHNewImagePar::SetMmScale(Bool_t mmscale)152 {153 if (fUseMmScale == mmscale)154 return;155 156 if (fMm2Deg<0)157 {158 *fLog << warn << GetDescriptor() << ": Warning - Sorry, no conversion factor for conversion available." << endl;159 return;160 }161 162 //const Double_t scale = mmscale ? 1./fMm2Deg : fMm2Deg;163 //MH::ScaleAxis(fDist, scale);164 //MH::ScaleAxis(fHeadTail, scale);165 166 if (mmscale)167 {168 // fDist->SetXTitle("Dist [mm]");169 // fHeadTail->SetXTitle("Head-Tail [mm]");170 }171 else172 {173 // fDist->SetXTitle("Dist [\\circ]");174 // fHeadTail->SetXTitle("Head-Tail [\\circ]");175 }176 177 fUseMmScale = mmscale;178 }179 180 // --------------------------------------------------------------------------181 //182 // Draw clones of all two histograms. So that the object can be deleted183 // and the histograms are still visible in the canvas.184 // The cloned object are deleted together with the canvas if the canvas is185 // destroyed. If you want to handle dostroying the canvas you can get a186 // pointer to it from this function187 //188 TObject *MHNewImagePar::DrawClone(Option_t *opt) const189 {190 return MH::DrawClone(opt, 300, 600);191 }192 193 // --------------------------------------------------------------------------194 //195 99 // Creates a new canvas and draws the two histograms into it. 196 100 // Be careful: The histograms belongs to this object and won't get deleted … … 199 103 void MHNewImagePar::Draw(Option_t *) 200 104 { 201 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this , 300, 600);105 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this); 202 106 pad->SetBorderMode(0); 203 107 204 108 AppendPad(""); 205 109 206 pad->Divide(1, 2); 207 208 pad->cd(1); 209 pad->SetBorderMode(0); 210 fLeakage1->Draw(); 211 212 pad->cd(2); 213 pad->SetBorderMode(0); 214 fLeakage2->Draw(); 110 MH::Draw(*fLeakage1, *fLeakage2, "Leakage1 and Leakage2"); 215 111 216 112 pad->Modified(); … … 228 124 return NULL; 229 125 } 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 -
trunk/MagicSoft/Mars/mimage/MHNewImagePar.h
r1940 r1966 15 15 TH1F *fLeakage2; //-> 16 16 17 Float_t fMm2Deg;18 Bool_t fUseMmScale;19 20 17 public: 21 18 MHNewImagePar(const char *name=NULL, const char *title=NULL); 22 19 ~MHNewImagePar(); 23 20 24 void SetMmScale(Bool_t mmscale=kTRUE);25 void SetMm2Deg(Float_t mmdeg);26 27 Bool_t SetupFill(const MParList *pList);28 21 Bool_t Fill(const MParContainer *par); 29 22 … … 34 27 35 28 void Draw(Option_t *opt=NULL); 36 TObject *DrawClone(Option_t *opt=NULL) const;37 29 38 ClassDef(MHNewImagePar, 1) // Container which holds histograms for thenew image parameters30 ClassDef(MHNewImagePar, 1) // Histograms of new image parameters 39 31 }; 40 32 -
trunk/MagicSoft/Mars/mimage/MNewImagePar.cc
r1940 r1966 72 72 const MHillas *hillas) 73 73 { 74 //fHillas = (MHillas*)hillas;75 76 74 const UInt_t npixevt = evt.GetNumPixels(); 77 75 78 Double_t edgepix1 = 0 .0;79 Double_t edgepix2 = 0 .0;76 Double_t edgepix1 = 0; 77 Double_t edgepix2 = 0; 80 78 81 79 for (UInt_t i=0; i<npixevt; i++) … … 87 85 const MGeomPix &gpix = geom[pix.GetPixId()]; 88 86 89 Double_t nphot = pix.GetNumPhotons();87 const Double_t nphot = pix.GetNumPhotons(); 90 88 91 89 // count photons in outer rings of camera
Note:
See TracChangeset
for help on using the changeset viewer.