Changeset 1490 for trunk/MagicSoft/Mars
- Timestamp:
- 08/08/02 14:01:38 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/macros/CT1Hillas.C
r1281 r1490 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 12/2000 (tbretz@uni-sw.gwdg.de)18 ! Author(s): Thomas Bretz et al, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 120 ! Copyright: MAGIC Software Development, 2000-2002 21 21 ! 22 22 ! … … 24 24 25 25 26 void CT1Hillas( )26 void CT1Hillas(const char *filename) 27 27 { 28 28 // 29 29 // This is a demonstration program which calculates the Hillas 30 // parameter out of a CT1 dataset. 30 // parameter out of a Magic root file (raw data file). 31 // 31 32 32 33 // … … 34 35 // The tasklist is identified in the eventloop by its name 35 36 // 36 MParList plist; 37 MParList plist; 38 37 39 38 40 MTaskList tlist; … … 47 49 48 50 // 49 // Setup binning for your histograms. 51 // Use this if you want to change the binning of one of 52 // the histograms. You can use: 53 // BinningConc, BinningConc1, BinningAsym, BinningM3Long, 54 // BinningM3Trans, BinningWidth, BinningLength, BinningDist, 55 // BinningHeadTail, BinningAlpha, BinningSize, BinningDelta, 56 // BinningPixels and BinningCamera 50 57 // 51 MBinning binswidth("BinningWidth"); 52 binswidth.SetEdges(100, 0, 1); // 100 bins from 0 to 1 deg 58 // For more information see MBinning and the corresponding 59 // histograms 60 // 61 // MBinning binsalpha("BinningAlpha"); 62 // binsalpha.SetEdges(90, 0, 90); // 90 bins from 0 to 90 deg 63 // plist.AddToList(&binsalpha); 53 64 54 MBinning binslength("BinningLength"); 55 binslength.SetEdges(100, 0, 1); // 100 bins from 0 to 1 deg 56 57 MBinning binsalpha("BinningAlpha"); 58 binsalpha.SetEdges(90, 0, 90); // 90 bins from 0 to 90 deg 59 60 MBinning binsdist("BinningDist"); 61 binsdist.SetEdges(100, 0, 2); // 100 bins from 0 to 2 deg 62 63 plist.AddToList(&binswidth); 64 plist.AddToList(&binslength); 65 plist.AddToList(&binsalpha); 66 plist.AddToList(&binsdist); 65 // MBinning binssize("BinningSize"); 66 // binssize.SetEdgesLog(50, 1, 1e7); 67 // plist.AddToList(&binssize); 67 68 68 69 // … … 73 74 MSrcPosCam source("Source") 74 75 source.SetXY(0, 0); 75 76 76 plist.AddToList(&source); 77 77 … … 87 87 //read.AddFile("../data/CT1_97_off1.dat"); 88 88 89 MImgCleanStd clean; 89 MMcPedestalCopy pcopy; 90 MMcPedestalNSBAdd pnsb; 91 92 MCerPhotCalc ncalc; 93 // 94 // Alternative photon calculation: 95 // Example: use only 2nd to 6th FADC slices for photon calculation: 96 // 97 // MCerPhotCalc2 ncalc; 98 // const Float_t x[15]={0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 99 // TArrayF w(15,x); 100 // ncalc.SetWeights(w); 101 // 102 103 MCameraSmooth smooth; 104 MImgCleanStd clean; 105 MBlindPixelCalc blind; 106 // 107 // Instead of unmapping the pixels you can also 108 // 109 // blind.SetUseInterpolation(); 110 // blind.SetUseCetralPixel(); 111 // 90 112 MHillasCalc hcalc; 91 113 MHillasSrcCalc csrc1("Source", "HillasSource"); 92 114 93 MFillH hfill("MHHillas", "MHillas"); 94 MFillH sfill("MHStarMap", "MHillas"); 95 MFillH hfill2s("HistSource [MHHillasSrc]", "HillasSource"); 115 // 116 // Uncomment this two line if you want to use MHillasExt instead 117 // of MHillas 118 // 119 //MHillasExt hext; 120 //plist.AddToList(&hext); 121 122 MFillH hfill1("MHHillas", "MHillas"); 123 MFillH hfill2("MHHillasExt"); 124 MFillH hfill3("MHStarMap", "MHillas"); 125 MFillH hfill4("HistExtSource [MHHillasExt]", "HillasSource"); 126 MFillH hfill5("HistSource [MHHillasSrc]", "HillasSource"); 127 128 MWriteRootFile write("hillas.root"); 129 write.AddContainer("HillasSource", "Hillas"); 130 write.AddContainer("MHStarMap"); 131 write.AddContainer("MMcEvt","Hillas"); 132 write.AddContainer("Source","RunHeaders"); 96 133 97 134 tlist.AddToList(&read); 135 tlist.AddToList(&pcopy); 136 tlist.AddToList(&pnsb); 137 tlist.AddToList(&ncalc); 98 138 tlist.AddToList(&clean); 139 tlist.AddToList(&blind); 140 99 141 tlist.AddToList(&hcalc); 100 142 tlist.AddToList(&csrc1); 101 tlist.AddToList(&hfill); 102 tlist.AddToList(&sfill); 103 tlist.AddToList(&hfill2s); 143 tlist.AddToList(&csrc2); 144 145 tlist.AddToList(&hfill1); 146 tlist.AddToList(&hfill2); 147 tlist.AddToList(&hfill3); 148 tlist.AddToList(&hfill4); 149 tlist.AddToList(&hfill5); 150 tlist.AddToList(&write); 104 151 105 152 // … … 115 162 return; 116 163 164 tlist.PrintStatistics(); 165 117 166 // 118 167 // After the analysis is finished we can display the histograms 119 168 // 120 169 plist.FindObject("MHHillas")->DrawClone(); 170 plist.FindObject("MHHillasExt")->DrawClone(); 171 plist.FindObject("MHStarMap")->DrawClone(); 121 172 plist.FindObject("HistSource")->DrawClone(); 122 plist.FindObject(" MHStarMap")->DrawClone();173 plist.FindObject("HistExtSource")->DrawClone(); 123 174 } 175 -
trunk/MagicSoft/Mars/macros/MagicHillas.C
r1463 r1490 24 24 25 25 26 void MagicHillas(const char *filename="~/data/Gamma *.root")26 void MagicHillas(const char *filename="~/data/Gamma_20_N*.root") 27 27 { 28 28 // … … 35 35 // The tasklist is identified in the eventloop by its name 36 36 // 37 MParList plist; 37 MParList plist; 38 38 39 39 40 MTaskList tlist; 40 41 plist.AddToList(&tlist); 41 42 //43 // Uncomment this two line if you want to use MHillasExt instead44 // of MHillas45 //46 /*47 MHillasExt hext;48 plist.AddToList(&hext);49 */50 42 51 43 // … … 58 50 // 59 51 // Use this if you want to change the binning of one of 60 // the histograms 52 // the histograms. You can use: 53 // BinningConc, BinningConc1, BinningAsym, BinningM3Long, 54 // BinningM3Trans, BinningWidth, BinningLength, BinningDist, 55 // BinningHeadTail, BinningAlpha, BinningSize, BinningDelta, 56 // BinningPixels and BinningCamera 61 57 // 62 /* 63 MBinning binswidth("BinningWidth"); 64 binswidth.SetEdges(100, 0, 0.1); // 100 bins from 0 to 1 deg 65 plist.AddToList(&binswidth); 58 // For more information see MBinning and the corresponding 59 // histograms 60 // 61 // MBinning binsalpha("BinningAlpha"); 62 // binsalpha.SetEdges(90, 0, 90); // 90 bins from 0 to 90 deg 63 // plist.AddToList(&binsalpha); 66 64 67 MBinning binslength("BinningLength"); 68 binslength.SetEdges(100, 0, 1); // 100 bins from 0 to 1 deg 69 plist.AddToList(&binslength); 70 71 MBinning binsdist("BinningDist"); 72 binsdist.SetEdges(100, 0, 1.5); // 100 bins from 0 to 1 deg 73 plist.AddToList(&binsdist); 74 75 MBinning binsht("BinningHeadTail"); 76 binsht.SetEdges(100, -1.5, 1.5); // 100 bins from 0 to 1 deg 77 plist.AddToList(&binsht); 78 79 MBinning binsalpha("BinningAlpha"); 80 binsalpha.SetEdges(90, 0, 90); // 90 bins from 0 to 90 deg 81 plist.AddToList(&binsalpha); 82 83 MBinning binscam("BinningCamera"); 84 binscam.SetEdges(50, -1.5, 1.5); // 20 bins from -2 to 2 deg 85 plist.AddToList(&binscam); 86 */ 65 // MBinning binssize("BinningSize"); 66 // binssize.SetEdgesLog(50, 1, 1e7); 67 // plist.AddToList(&binssize); 87 68 88 69 // … … 112 93 read.DisableAutoScheme(); 113 94 114 MMcPedestalCopy 95 MMcPedestalCopy pcopy; 115 96 MMcPedestalNSBAdd pnsb; 116 97 117 MCerPhotCalc 98 MCerPhotCalc ncalc; 118 99 // 119 100 // Alternative photon calculation: … … 126 107 // 127 108 128 MImgCleanStd clean; 129 MBlindPixelCalc blind; 130 MHillasCalc hcalc; 131 MHillasSrcCalc csrc1("Source", "HillasSource"); 132 MHillasSrcCalc csrc2("AntiSrc", "HillasAntiSrc"); 109 MCameraSmooth smooth; 110 MImgCleanStd clean; 111 MBlindPixelCalc blind; 112 // 113 // Instead of unmapping the pixels you can also 114 // 115 // blind.SetUseInterpolation(); 116 // blind.SetUseCetralPixel(); 117 // 118 MHillasCalc hcalc; 119 MHillasSrcCalc csrc1("Source", "HillasSource"); 120 MHillasSrcCalc csrc2("AntiSrc", "HillasAntiSrc"); 133 121 134 MFillH hfill("MHHillas", "MHillas"); 135 MFillH sfill("MHStarMap", "MHillas"); 136 MFillH hfill2s("HistSource [MHHillasSrc]", "HillasSource"); 137 MFillH hfill2a("HistAntiSrc [MHHillasSrc]", "HillasAntiSrc"); 122 // 123 // Uncomment this two line if you want to use MHillasExt instead 124 // of MHillas 125 // 126 //MHillasExt hext; 127 //plist.AddToList(&hext); 128 129 MFillH hfill1("MHHillas", "MHillas"); 130 MFillH hfill2("MHHillasExt"); 131 MFillH hfill3("MHStarMap", "MHillas"); 132 MFillH hfill4("HistExtSource [MHHillasExt]", "HillasSource"); 133 MFillH hfill5("HistExtAntiSource [MHHillasExt]", "HillasAntiSource"); 134 MFillH hfill6("HistSource [MHHillasSrc]", "HillasSource"); 135 MFillH hfill7("HistAntiSrc [MHHillasSrc]", "HillasAntiSrc"); 138 136 139 137 MWriteRootFile write("hillas.root"); 140 write.AddContainer("MHillas", "Hillas");141 138 write.AddContainer("HillasSource", "Hillas"); 142 139 write.AddContainer("HillasAntiSrc", "Hillas"); 143 140 write.AddContainer("MHStarMap"); 144 141 write.AddContainer("MMcEvt","Hillas"); 145 146 /* 147 MWriteAsciiFile write("hillas.txt"); 148 write.AddColumn("MHillas.fLength*MGeomCam.fConvMm2Deg"); 149 write.AddColumn("MHillas", "fConc"); 150 write.AddColumns("MHillas"); 151 */ 142 write.AddContainer("Source","RunHeaders"); 143 write.AddContainer("AntiSource","RunHeaders"); 152 144 153 145 tlist.AddToList(&read); … … 157 149 tlist.AddToList(&clean); 158 150 tlist.AddToList(&blind); 151 159 152 tlist.AddToList(&hcalc); 160 153 tlist.AddToList(&csrc1); 154 tlist.AddToList(&csrc2); 161 155 162 tlist.AddToList(&csrc2); 163 tlist.AddToList(&hfill); 164 tlist.AddToList(&sfill); 165 tlist.AddToList(&hfill2s); 166 tlist.AddToList(&hfill2a); 156 tlist.AddToList(&hfill1); 157 tlist.AddToList(&hfill2); 158 tlist.AddToList(&hfill3); 159 tlist.AddToList(&hfill4); 160 tlist.AddToList(&hfill5); 161 tlist.AddToList(&hfill6); 162 tlist.AddToList(&hfill7); 167 163 tlist.AddToList(&write); 168 164 … … 184 180 // After the analysis is finished we can display the histograms 185 181 // 182 plist.FindObject("MHHillas")->DrawClone(); 183 plist.FindObject("MHHillasExt")->DrawClone(); 184 plist.FindObject("MHStarMap")->DrawClone(); 186 185 plist.FindObject("HistSource")->DrawClone(); 187 plist.FindObject(" MHHillas")->DrawClone();188 plist.FindObject("Hist AntiSrc")->DrawClone();189 plist.FindObject(" MHStarMap")->DrawClone();186 plist.FindObject("HistAntiSource")->DrawClone(); 187 plist.FindObject("HistExtSource")->DrawClone(); 188 plist.FindObject("HistExtAntiSource")->DrawClone(); 190 189 } 191 190 -
trunk/MagicSoft/Mars/macros/starplot.C
r1489 r1490 79 79 read.DisableAutoScheme(); 80 80 81 MFillH hfill("MHHillasExt", "MHillas"); 82 MFillH sfill("MHStarMap", "MHillas"); 83 MFillH hfill2s("HistSource [MHHillasSrc]", "HillasSource"); 84 MFillH hfill2a("HistAntiSrc [MHHillasSrc]", "HillasAntiSrc"); 81 MFillH hfill1("MHHillas", "MHillas"); 82 MFillH hfill2("MHHillasExt"); 83 MFillH hfill3("MHStarMap", "MHillas"); 84 MFillH hfill4("HistExtSource [MHHillasExt]", "HillasSource"); 85 MFillH hfill5("HistExtAntiSource [MHHillasExt]", "HillasAntiSource"); 86 MFillH hfill6("HistSource [MHHillasSrc]", "HillasSource"); 87 MFillH hfill7("HistAntiSrc [MHHillasSrc]", "HillasAntiSrc"); 85 88 86 89 tlist.AddToList(&read); 87 tlist.AddToList(&hfill); 88 tlist.AddToList(&sfill); 89 tlist.AddToList(&hfill2s); 90 tlist.AddToList(&hfill2a); 90 tlist.AddToList(&hfill1); 91 tlist.AddToList(&hfill2); 92 tlist.AddToList(&hfill3); 93 tlist.AddToList(&hfill4); 94 tlist.AddToList(&hfill5); 95 tlist.AddToList(&hfill6); 96 tlist.AddToList(&hfill7); 91 97 92 98 // … … 107 113 // After the analysis is finished we can display the histograms 108 114 // 115 plist.FindObject("MHHillas")->DrawClone(); 116 plist.FindObject("MHHillasExt")->DrawClone(); 117 plist.FindObject("MHStarMap")->DrawClone(); 109 118 plist.FindObject("HistSource")->DrawClone(); 110 plist.FindObject(" MHHillasExt")->DrawClone();111 plist.FindObject("Hist AntiSrc")->DrawClone();112 plist.FindObject(" MHStarMap")->DrawClone();119 plist.FindObject("HistAntiSource")->DrawClone(); 120 plist.FindObject("HistExtSource")->DrawClone(); 121 plist.FindObject("HistExtAntiSource")->DrawClone(); 113 122 } 114 123 -
trunk/MagicSoft/Mars/mhist/MHHillas.h
r1489 r1490 28 28 void SetColors() const; 29 29 30 protected:31 30 Float_t fMm2Deg; 32 33 Bool_t fUseMmScale; 31 Bool_t fUseMmScale; 34 32 35 33 public: -
trunk/MagicSoft/Mars/mhist/MHHillasExt.cc
r1489 r1490 57 57 // 58 58 MHHillasExt::MHHillasExt(const char *name, const char *title) 59 : fMm2Deg(1), fUseMmScale(kTRUE) 59 60 { 60 61 // … … 107 108 bins.Apply(fHM3Trans); 108 109 109 bins.SetEdges( 89, -297, 593);110 bins.SetEdges(101, -593, 593); 110 111 bins.Apply(fHAsym); 111 112 } … … 131 132 Bool_t MHHillasExt::SetupFill(const MParList *plist) 132 133 { 134 TObject *obj = plist->FindObject("MHillas"); 135 if (!obj) 136 { 137 *fLog << err << dbginf << "Sorry 'MHillas' not found in parameter list... aborting." << endl; 138 return kFALSE; 139 } 140 if (!obj->InheritsFrom(MHillasExt::Class())) 141 { 142 *fLog << err << dbginf << "Sorry 'MHillas' doesn't inherit from MHillasExt... aborting." << endl; 143 return kFALSE; 144 } 145 fHillasExt = (MHillasExt*)obj; 146 133 147 const MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam"); 134 148 if (!geom) … … 146 160 ApplyBinning(*plist, "M3Trans", &fHM3Trans); 147 161 148 fHillasSrc = (MHillasSrc*)plist->FindObject("HillasSource"); 149 if (!fHillasSrc) 150 *fLog << warn << dbginf << "Sorry 'HillasSource' [MHillasSrc] not found. Histograms will be source independant." << endl; 151 152 return MHHillas::SetupFill(plist); 162 return kTRUE; 153 163 } 154 164 … … 160 170 Bool_t MHHillasExt::Fill(const MParContainer *par) 161 171 { 162 const MHillas Ext &ext = *(MHillasExt*)par;163 164 const Double_t scale = fHillasSrc ? TMath::Sign(fUseMmScale?1:fMm2Deg, fHillasSrc->GetCosDeltaAlpha()) : 1;165 166 fHConc.Fill( ext.GetConc());167 fHConc1.Fill( ext.GetConc1());168 169 fHAsym.Fill(scale* ext.GetAsym());170 fHM3Long.Fill(scale* ext.GetM3Long());171 fHM3Trans.Fill(scale* ext.GetM3Trans());172 const MHillasSrc *src = (MHillasSrc*)par; 173 174 const Double_t scale = src ? TMath::Sign(fUseMmScale?1:fMm2Deg, src->GetCosDeltaAlpha()) : 1; 175 176 fHConc.Fill(fHillasExt->GetConc()); 177 fHConc1.Fill(fHillasExt->GetConc1()); 178 179 fHAsym.Fill(scale*fHillasExt->GetAsym()); 180 fHM3Long.Fill(scale*fHillasExt->GetM3Long()); 181 fHM3Trans.Fill(scale*fHillasExt->GetM3Trans()); 172 182 //fHAsymna.Fill(scale*ext.GetAsymna()); 173 183 //fHAsym0.Fill(scale*ext.GetAsym0()); 174 184 175 return MHHillas::Fill(par);185 return kTRUE; 176 186 } 177 187 … … 200 210 { 201 211 fHAsym.SetXTitle("Asym [mm]"); 202 fHM3Long.SetXTitle("3^{rd} M_{l} [mm]");212 fHM3Long.SetXTitle("3^{rd} M_{l} [mm]"); 203 213 fHM3Trans.SetXTitle("3^{rd} M_{t} [mm]"); 204 214 } … … 210 220 } 211 221 212 MHHillas::SetMmScale(mmscale); 222 fUseMmScale = mmscale; 223 } 224 225 // -------------------------------------------------------------------------- 226 // 227 // Use this function to setup your own conversion factor between degrees 228 // and millimeters. The conversion factor should be the one calculated in 229 // MGeomCam. Use this function with Caution: You could create wrong values 230 // by setting up your own scale factor. 231 // 232 void MHHillasExt::SetMm2Deg(Float_t mmdeg) 233 { 234 if (mmdeg<0) 235 { 236 *fLog << warn << dbginf << "Warning - Conversion factor < 0 - nonsense. Ignored." << endl; 237 return; 238 } 239 240 if (fMm2Deg>=0) 241 *fLog << warn << dbginf << "Warning - Conversion factor already set. Overwriting" << endl; 242 243 fMm2Deg = mmdeg; 213 244 } 214 245 … … 245 276 c.Update(); 246 277 247 MHHillas::DrawClone();248 249 278 return &c; 250 279 } … … 279 308 gPad->Modified(); 280 309 gPad->Update(); 281 282 MHHillas::DrawClone(); 283 } 310 } -
trunk/MagicSoft/Mars/mhist/MHHillasExt.h
r1465 r1490 5 5 #include <TH1.h> 6 6 #endif 7 #ifndef MARS_MH Hillas8 #include "MH Hillas.h"7 #ifndef MARS_MH 8 #include "MH.h" 9 9 #endif 10 10 11 class MHillas Src;11 class MHillasExt; 12 12 13 class MHHillasExt : public MH Hillas13 class MHHillasExt : public MH 14 14 { 15 15 private: 16 MHillas Src *fHillasSrc; //! Pointer to an MHillasSrc to be able to add sign to Asym, M3Long and M3Trans16 MHillasExt *fHillasExt; //! Pointer to the MHillasExt container 17 17 18 18 TH1F fHConc; // [ratio] concentration ratio: sum of the two highest pixels / fSize … … 22 22 TH1F fHM3Trans; // [mm] 3rd moment (e-weighted) along minor axis 23 23 24 Float_t fMm2Deg; 25 Bool_t fUseMmScale; 26 24 27 public: 25 28 MHHillasExt(const char *name=NULL, const char *title=NULL); … … 27 30 28 31 void SetMmScale(Bool_t mmscale=kTRUE); 32 virtual void SetMm2Deg(Float_t mmdeg); 29 33 30 34 Bool_t SetupFill(const MParList *pList); … … 34 38 TObject *DrawClone(Option_t *opt=NULL) const; 35 39 36 ClassDef(MHHillasExt, 1) // Container which holds histograms for length and width40 ClassDef(MHHillasExt, 1) // Container which holds histograms for the extended hillas parameters 37 41 }; 38 42
Note:
See TracChangeset
for help on using the changeset viewer.