Changeset 3957
- Timestamp:
- 05/04/04 15:27:25 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3955 r3957 19 19 -*-*- END OF LINE -*-*- 20 20 21 2004/05/04: Thomas Bretz 22 23 * macros/MagicHillas.C, macros/comprob.C, macros/derotatedc.C, 24 macros/dohtml.C, macros/evtrate.C, macros/merpp.C, 25 macros/pixfirerate.C, macros/pixsatrate.C, macros/plot.C, 26 macros/plot2.C, macros/pointing.C, macros/readMagic.C, 27 macros/rootlogon.C, macros/runbook.C, macros/sectorvstime.C, 28 macros/star.C, macros/sumcurrents.C, macros/tar.C, 29 macros/testenv.C, macros/weights.C: 30 - updated documentation 31 32 * mastro/MAstroCamera.[h,cc]: 33 - added member function to read MC .def files for mirror geometry 34 - added GetDiffZdAz 35 36 * mastro/MObservatory.[h,cc]: 37 - added Copy-member function 38 39 * mbase/MLog.[h,cc]: 40 - updated handling of mutices 41 - added a new mutex to lock the stream 42 43 * mhist/MHCamera.[h,cc]: 44 - added functionality to linear deform the camera display 45 (to correct for abberation) 46 47 * mtools/MFFT.cc: 48 - added more documentation 49 50 51 21 52 2004/05/04: Markus Gaug 22 53 … … 24 55 - intialized the 2 vectors differently, now they don't give 25 56 warnings any more. 57 26 58 27 59 -
trunk/MagicSoft/Mars/macros/MagicHillas.C
r2377 r3957 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz et al,12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>18 ! Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 220 ! Copyright: MAGIC Software Development, 2000-2004 21 21 ! 22 22 ! 23 23 \* ======================================================================== */ 24 24 25 /////////////////////////////////////////////////////////////////////////// 26 // 27 // MagicHillas.C 28 // ============= 29 // 30 // This is a demonstration program which calculates image (Hillas +) 31 // parameters using as input a Merpp output file (raw data). 32 // All parameters are written to an output file called hillas.root. Also 33 // filles histograms are displayed. 34 // For the calculation an arbitrary signal extractor (MCerPhotAnal2/Calc) 35 // is used. 36 // 37 /////////////////////////////////////////////////////////////////////////// 25 38 26 39 void MagicHillas(const char *filename="~/data/Gamma_20_N*.root") 27 40 { 28 //29 // This is a demonstration program which calculates the Hillas30 // parameter out of a Magic root file (raw data file).31 //32 33 41 // 34 42 // Create a empty Parameter List and an empty Task List … … 80 88 read.DisableAutoScheme(); 81 89 90 // Setup a task which makes sure that all used arrays have 91 // the correct size 82 92 MGeomApply geomapl; 83 93 94 // tasks used if MC files are detected to calculate pedestals 84 95 MMcPedestalCopy pcopy; 85 96 MMcPedestalNSBAdd pnsb; 86 97 98 // calculate the signal in a very simple way 99 // for real adat files use MCerPhotAnal2 instead which also 100 // calculates the pedestal. 87 101 MCerPhotCalc ncalc; 88 102 // … … 95 109 // 96 110 111 // setup image cleaning and blind pixel treatment 97 112 MImgCleanStd clean; 98 113 MBlindPixelCalc blind; 114 99 115 // 100 // Instead of unmapping the pixels you can also 116 // Instead of unmapping the pixels you can also (The use of this 117 // class is deprecated, it will be replaced by MBadPixels*) 101 118 // 102 119 // blind.SetUseInterpolation(); 103 120 // blind.SetUseCetralPixel(); 104 121 // 122 123 // setup tasks to calculate image parameters 105 124 MHillasCalc hcalc; 106 125 MHillasSrcCalc csrc1; 107 126 127 // setup tasks to fill histograms 108 128 MFillH hfill1("MHHillas", "MHillas"); 109 129 MFillH hfill2("MHHillasExt"); … … 113 133 MFillH hfill6("MHNewImagePar"); 114 134 135 // setup task to write containers to a file 115 136 MWriteRootFile write("hillas.root"); 116 137 write.AddContainer("MHStarMap"); … … 121 142 write.AddContainer("MHNewImagePar"); 122 143 144 // Setup the contents of zour tasklist 123 145 tlist.AddToList(&read); 124 146 tlist.AddToList(&geomapl); -
trunk/MagicSoft/Mars/macros/comprob.C
r1609 r3957 1 1 /* ======================================================================== *\ 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ! Copyright: MAGIC Software Development, 2000-2002 23 24 25 2 ! 3 ! * 4 ! * This file is part of MARS, the MAGIC Analysis and Reconstruction 5 ! * Software. It is distributed to you in the hope that it can be a useful 6 ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. 7 ! * It is distributed WITHOUT ANY WARRANTY. 8 ! * 9 ! * Permission to use, copy, modify and distribute this software and its 10 ! * documentation for any purpose is hereby granted without fee, 11 ! * provided that the above copyright notice appear in all copies and 12 ! * that both that copyright notice and this permission notice appear 13 ! * in supporting documentation. It is provided "as is" without express 14 ! * or implied warranty. 15 ! * 16 ! 17 ! macro comprob.C 18 ! 19 ! Author(s): Abelardo Moralejo 20 ! Author(s): Thomas Bretz, 2002 <mailto:tbretz@astro.uni-wuerzburg.de> 21 ! 22 ! Copyright: MAGIC Software Development, 2000-2004 23 ! 24 ! 25 \* ======================================================================== */ 26 26 27 // -------------------------------------------------------------------------27 /////////////////////////////////////////////////////////////////////////// 28 28 // 29 29 // This macro demonstrates one way of gamma hadron separation using the … … 31 31 // a file ouput by the star.C macro containing image parameters) 32 32 // 33 /////////////////////////////////////////////////////////////////////////// 33 34 void comprob() 34 35 { -
trunk/MagicSoft/Mars/macros/derotatedc.C
r3785 r3957 25 25 ///////////////////////////////////////////////////////////////////////////// 26 26 // 27 // derotate.C - STandard Analysis and Reconstruction (MC example) 27 // derotatedc.C 28 // ============ 28 29 // 29 // Derotate a MCamEvent and fill a histogram with derotated data 30 // (sky-plot) 30 // Derotate a MCamEvent and fill a histogram with derotated data 31 // (sky-plot). 32 // 33 // As an input you need a merpped root file conataining DC information 34 // from a camera report file. To be able to derotate you also need 35 // aproproitate time-stamps and the corresponding pointing information. 36 // 37 // All events are filled into a 2D histograms - derotated. 38 // 39 // The example shows the usage of MHCamEventRot. The output is the derotated 40 // sky-plot. 31 41 // 32 42 ///////////////////////////////////////////////////////////////////////////// -
trunk/MagicSoft/Mars/macros/dohtml.C
r3930 r3957 22 22 ! 23 23 \* ======================================================================== */ 24 25 /////////////////////////////////////////////////////////////////////////// 26 // 27 // dohtml.C 28 // ======== 29 // 30 // This is a service macro used to create the html-documentation from 31 // source code (THtml) 32 // 33 // Add here all directories in which files are stored from which the 34 // documentation should be created an add all macros which should be 35 // converted to HTML. 36 // 37 /////////////////////////////////////////////////////////////////////////// 24 38 25 39 void dohtml() -
trunk/MagicSoft/Mars/macros/evtrate.C
r2626 r3957 1 /* ======================================================================== *\ 2 ! 3 ! * 4 ! * This file is part of MARS, the MAGIC Analysis and Reconstruction 5 ! * Software. It is distributed to you in the hope that it can be a useful 6 ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. 7 ! * It is distributed WITHOUT ANY WARRANTY. 8 ! * 9 ! * Permission to use, copy, modify and distribute this software and its 10 ! * documentation for any purpose is hereby granted without fee, 11 ! * provided that the above copyright notice appear in all copies and 12 ! * that both that copyright notice and this permission notice appear 13 ! * in supporting documentation. It is provided "as is" without express 14 ! * or implied warranty. 15 ! * 16 ! 17 ! 18 ! Author(s): Thomas Bretz, 12/2003 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! 20 ! Copyright: MAGIC Software Development, 2000-2004 21 ! 22 ! 23 \* ======================================================================== */ 24 25 /////////////////////////////////////////////////////////////////////////// 26 // 27 // evtrate.C 28 // ========= 29 // 30 // Example macro how to calulate the eventrate (per event) and display 31 // the result versus time. 32 // 33 // As an input you need a merpped raw-data file containing correct times. 34 // The output is the plot: Eventrate vs. time. 35 // 36 /////////////////////////////////////////////////////////////////////////// 37 1 38 void evtrate() 2 39 { 40 // Setup parameter- and tasklist 3 41 MParList plist; 4 42 MTaskList tlist; 5 43 plist.AddToList(&tlist); 6 44 45 // Setup reading task 7 46 MReadMarsFile read("Events"); 8 47 read.DisableAutoScheme(); 9 48 read.AddFile("test-time.root"); 10 49 50 // Setup event rate calculator 11 51 MEventRateCalc calc; 52 // Setup number of events to be averaged 12 53 calc.SetNumEvents(200); 13 54 55 // Setup histogram to be filles with rate 14 56 MHVsTime rate("MEventRate.fRate"); 15 57 58 // Setup task to fill the histogram 16 59 MFillH fill(&rate, "MTime"); 17 60 61 // Setup tasklist 18 62 tlist.AddToList(&read); 19 63 tlist.AddToList(&calc); 20 64 tlist.AddToList(&fill); 21 65 66 // Execute your eventloop 22 67 MEvtLoop loop; 23 68 loop.SetParList(&plist); 24 69 25 loop.Eventloop(); 70 if (!loop.Eventloop()) 71 return; 26 72 73 // print some execution statistics 74 tlist.PrintStatistics(); 75 76 // Draw result 27 77 rate.DrawClone(); 28 78 } -
trunk/MagicSoft/Mars/macros/merpp.C
r2222 r3957 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 12/2000 (tbretz@uni-sw.gwdg.de)18 ! Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 120 ! Copyright: MAGIC Software Development, 2000-2004 21 21 ! 22 22 ! 23 23 \* ======================================================================== */ 24 24 25 26 25 ///////////////////////////////////////////////////////////////////////////// 26 // 27 // merpp.C 28 // ======= 27 29 // 28 30 // This is an easy implementation of the Merging process (as root Macro) 29 31 // 30 // at the moment it reads a binary file ("rawtest. bin") which was written32 // at the moment it reads a binary file ("rawtest.raw") which was written 31 33 // in the DAQ raw format. 32 34 // … … 35 37 // 36 38 // This containers are written to a root file ("rawtest.root") 39 // 40 // It also demonstrates how you can loop over files in a single or more 41 // than one directory and process them. For details see MRunIter. 37 42 // 38 43 ///////////////////////////////////////////////////////////////////////////// -
trunk/MagicSoft/Mars/macros/pixfirerate.C
r2377 r3957 17 17 ! 18 18 ! Author(s): Abelardo Moralejo <mailto:moralejo@pd.infn.it> 19 ! Author(s): Thomas Bretz <mailto:tbretz@astro.uni-wuerzburg.de> 19 20 ! 20 ! Copyright: MAGIC Software Development, 2000-200 321 ! Copyright: MAGIC Software Development, 2000-2004 21 22 ! 22 23 ! … … 26 27 // 27 28 // pixfirerate.C 29 // ============= 28 30 // 29 31 // This macro can help to find "hot" pixels firing too often … … 73 75 tlist.AddToList(&geomapl); 74 76 77 // A list of threshold which should be displayed. The last entry 78 // MUST be -1. 75 79 Double_t threshold[] = { 10, 20, 100, 200, -1 }; 76 80 … … 78 82 while (threshold[cnt]>0) cnt++; 79 83 84 // Create the corresponding fill tasks and containers 80 85 for (int i=0; i<cnt; i++) 81 86 { … … 95 100 } 96 101 102 // create the eventloop 97 103 MEvtLoop evtloop; 98 104 evtloop.SetParList(&plist); -
trunk/MagicSoft/Mars/macros/pixsatrate.C
r2377 r3957 17 17 ! 18 18 ! Author(s): Abelardo Moralejo <mailto:moralejo@pd.infn.it> 19 ! Author(s): Thomas Bretz <mailto:tbretz@astro.uni-wuerzburg.de> 19 20 ! 20 ! Copyright: MAGIC Software Development, 2000-200 321 ! Copyright: MAGIC Software Development, 2000-2004 21 22 ! 22 23 ! … … 26 27 // 27 28 // pixfirerate.C 29 // ============= 28 30 // 29 31 // This macro can help to find "hot" pixels firing too often … … 73 75 tlist.AddToList(&geomapl); 74 76 77 // Create histograms with saturation limits at 254 75 78 MHTriggerLvl0 trighi(254, "SaturationHi", "Saturation Rate of Hi Gains"); 76 79 MHTriggerLvl0 triglo(254, "SaturationLo", "Saturation Rate of Lo Gains"); … … 78 81 triglo.SetType(2); 79 82 83 // craete fill tasks to fill the histogarms 80 84 MFillH fillhi(&trighi, "MRawEvtData"); 81 85 MFillH filllo(&triglo, "MRawEvtData"); … … 83 87 tlist.AddToList(&filllo); 84 88 89 // create eventloop 85 90 MEvtLoop evtloop; 86 91 evtloop.SetParList(&plist); -
trunk/MagicSoft/Mars/macros/plot.C
r2377 r3957 19 19 ! Author(s): Rudy Bock, 5/2002 <mailto:rkb@mppmu.mpg.de> 20 20 ! 21 ! Copyright: MAGIC Software Development, 2000-200 221 ! Copyright: MAGIC Software Development, 2000-2004 22 22 ! 23 23 ! 24 24 \* ======================================================================== */ 25 25 26 // -------------------------------------------------------------------------26 /////////////////////////////////////////////////////////////////////////// 27 27 // 28 28 // plot.C 29 // ====== 29 30 // 30 31 // This macro shows how to fill and display a histogram using Mars 31 32 // 33 // The advantage of using Mars histograms instead of root-trees is that 34 // you can fill values in your histogram which is calculated in the 35 // eventloop. 36 // 37 // In this particular sample we fill a histogram with the size parameter 38 // of gammas and one with hadron's size. At the end we display both in a 39 // single plot. 40 // 41 // The input is a star-macro already conatining image parameters. 42 // 43 /////////////////////////////////////////////////////////////////////////// 44 32 45 void plot() 33 46 { 47 // Create a status display for graphical output 34 48 MStatusDisplay *d = new MStatusDisplay; 35 49 d->SetLogStream(&gLog); … … 57 71 58 72 // Create a filter for Gammas 59 MFParticleId fgamma("MMcEvt", '=', kGAMMA);73 MFParticleId fgamma("MMcEvt", '=', MMcEvt::kGAMMA); 60 74 tlist.AddToList(&fgamma); 61 75 62 76 // Create a filter for Non-Gammas 63 MFParticleId fhadrons("MMcEvt", '!', kGAMMA);77 MFParticleId fhadrons("MMcEvt", '!', MMcEvt::kGAMMA); 64 78 tlist.AddToList(&fhadrons); 65 79 -
trunk/MagicSoft/Mars/macros/plot2.C
r1543 r3957 19 19 ! Author(s): Rudy Bock, 5/2002 <mailto:rkb@mppmu.mpg.de> 20 20 ! 21 ! Copyright: MAGIC Software Development, 2000-200 221 ! Copyright: MAGIC Software Development, 2000-2004 22 22 ! 23 23 ! 24 24 \* ======================================================================== */ 25 25 26 // -------------------------------------------------------------------------26 /////////////////////////////////////////////////////////////////////////// 27 27 // 28 // plot.C 28 // plot2.C 29 // ======= 29 30 // 30 // This macro shows how to fill and display a 2Dhistogram using Mars31 // This macro shows how to fill and display a histogram using Mars 31 32 // 33 // The advantage of using Mars histograms instead of root-trees is that 34 // you can fill values in your histogram which is calculated in the 35 // eventloop. 36 // 37 // In this particular sample we fill a histogram with width vs length 38 // of gammas and hadrons. At the end we display both in a single plot. 39 // 40 // The input is a star-macro already conatining image parameters. 41 // 42 /////////////////////////////////////////////////////////////////////////// 43 32 44 void plot2() 33 45 { … … 52 64 53 65 // Create a filter for the gamma events 54 MFParticleId fgamma("MMcEvt", '=', kGAMMA);66 MFParticleId fgamma("MMcEvt", '=', MMcEvt::kGAMMA); 55 67 tlist.AddToList(&fgamma); 56 68 57 69 // Create a filter for the non-gamma events 58 MFParticleId fhadrons("MMcEvt", '!', kGAMMA);70 MFParticleId fhadrons("MMcEvt", '!', MMcEvt::kGAMMA); 59 71 tlist.AddToList(&fhadrons); 60 72 … … 66 78 plist.AddToList(&cam); 67 79 80 // Set the variables (converted to deg) 68 81 TString vary("MHillas.fWidth*MGeomCam.fConvMm2Deg"); 69 82 TString varx("MHillas.fLength*MGeomCam.fConvMm2Deg"); 70 83 84 // Set the binning 71 85 MBinning binsy("BinningMH3Y"); 72 86 MBinning binsx("BinningMH3X"); -
trunk/MagicSoft/Mars/macros/pointing.C
r3909 r3957 1 /* ======================================================================== *\ 2 ! 3 ! * 4 ! * This file is part of MARS, the MAGIC Analysis and Reconstruction 5 ! * Software. It is distributed to you in the hope that it can be a useful 6 ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. 7 ! * It is distributed WITHOUT ANY WARRANTY. 8 ! * 9 ! * Permission to use, copy, modify and distribute this software and its 10 ! * documentation for any purpose is hereby granted without fee, 11 ! * provided that the above copyright notice appear in all copies and 12 ! * that both that copyright notice and this permission notice appear 13 ! * in supporting documentation. It is provided "as is" without express 14 ! * or implied warranty. 15 ! * 16 ! 17 ! 18 ! Author(s): Thomas Bretz, 5/2004 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! 20 ! Copyright: MAGIC Software Development, 2000-2004 21 ! 22 ! 23 \* ======================================================================== */ 24 25 ///////////////////////////////////////////////////////////////////////////// 26 // 27 // pointing.C 28 // ========== 29 // 30 // This macro is a demonstartion how check plots for a subsystem 31 // (here the drive) can be made using Mars. 32 // 33 // In this case a merpped (root-) cc-report file is read in. The data 34 // of the Drive branch is extracted using MReadReports and the 35 // Stream-Id feature of MTaskList (second argument in AddToList). 36 // 37 // The output are plots showing (hopefully) the peformance of the system. 38 // 39 ///////////////////////////////////////////////////////////////////////////// 40 1 41 /* 2 42 class MGraph : public TGraph -
trunk/MagicSoft/Mars/macros/readMagic.C
r3682 r3957 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@ uni-sw.gwdg.de>19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 118 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! 20 ! Copyright: MAGIC Software Development, 2000-2004 21 21 ! 22 22 ! 23 23 \* ======================================================================== */ 24 24 25 /////////////////////////////////////////////////////////////////////////// 26 // 27 // readMagic.C 28 // =========== 29 // 30 // This is a demonstration program showing how to do particular processing 31 // on a single event basis. Here we simply display uncleand und cleand 32 // images. 33 // Therefor MInteractiveTask is used, which gives you the possibility 34 // to develop new tasks without the need of compilation. 35 // The input is a merpp raw-data file. 36 // 37 /////////////////////////////////////////////////////////////////////////// 25 38 26 39 Bool_t HandleInput() 27 40 { 41 // This must be there to get accesss to the GUI while the macro 42 // is still running! 43 28 44 TTimer timer("gSystem->ProcessEvents();", 50, kFALSE); 29 45 while (1) … … 46 62 } 47 63 64 // 65 // Setup the data-members of your 'virtual' class 66 // 48 67 MHCamera display[4]; 49 68 … … 52 71 MTaskList *fTaskList; 53 72 73 // 74 // Called like all PreProcess functions of tasks. Get the access to 75 // the containers necessary for you. 76 // 54 77 Int_t PreProcess(MParList *plist) 55 78 { 79 // Get parameter and tasklist, see Process 56 80 fParList = plist; 57 81 fTaskList = (MTaskList*)plist->FindObject("MTaskList"); 58 82 83 // Get camera geoemtry 59 84 MGeomCam *geomcam = (MGeomCam*)plist->FindObject("MGeomCam"); 60 85 86 // setup canvas and camera-histograms 61 87 c = new TCanvas("Events", "Real Events", 600, 600); 62 88 c->SetBorderMode(0); … … 73 99 } 74 100 101 // 102 // Called like all Process functions of tasks. Process a single 103 // event - here display it. 104 // 75 105 Int_t Process() 76 106 { 107 // For simplicity we search in the Process function for the 108 // objects. This is deprectaed! Store the pointers to the objects 109 // as data member and get the pointers in PreProcess. 77 110 MReadMarsFile *read = (MReadMarsFile*)fTaskList->FindObject("MRead"); 78 111 MClone *clone = (MClone*)fTaskList->FindObject("MClone"); … … 80 113 MGeomCam *geom = (MGeomCam*)fParList->FindObject("MGeomCam"); 81 114 115 // Ouput event number 82 116 cout << "Event #" << read->GetNumEntry() << ":" << endl; 83 117 118 // Fill the data into your camera-histograms 84 119 display[0].SetCamContent(*(MCerPhotEvt*)clone->GetClone()); 85 120 display[1].SetCamContent(*(MCerPhotEvt*)fParList->FindObject("MCerPhotEvt")); … … 87 122 display[3].SetCamContent(*(MCameraData*)fParList->FindObject("MCameraData")); 88 123 124 // Setup the cleaning level histogram 89 125 TArrayF lvl(2); 90 126 lvl[0] = clean->GetCleanLvl2(); … … 92 128 display[3].SetLevels(lvl); 93 129 130 // Update the display 94 131 for (int i=1; i<=4; i++) 95 132 { … … 98 135 } 99 136 137 // print the data on the console 100 138 ((MHillas*)fParList->FindObject("MHillas"))->Print(*geom); 101 139 ((MHillasExt*)fParList->FindObject("MHillasExt"))->Print(*geom); 102 140 ((MNewImagePar*)fParList->FindObject("MNewImagePar"))->Print(*geom); 103 141 142 // wait for 'return' 104 143 return HandleInput(); 105 144 } 106 145 146 // 147 // Called like all PostProcess functions of tasks. Delete 148 // instanciated objects. 149 // 107 150 Int_t PostProcess() 108 151 { … … 111 154 112 155 void readMagic(const char *fname="../Proton*.root") 113 { 156 { 157 // Setup parameter- and tasklist 114 158 MParList plist; 115 159 MTaskList tlist; … … 117 161 plist.AddToList(&tlist); 118 162 163 // setup reading task 119 164 MReadMarsFile read("Events", fname); 120 165 read.DisableAutoScheme(); 121 166 167 // setup a task making sure that all arrays are resized correctly 122 168 MGeomApply geomapl; 169 170 // Setup a print task calling TObject::Print 123 171 MPrint print1("MMcEvt"); 124 172 MPrint print2("MRawEvtHeader"); 173 // Skip them if conatainers are not found 125 174 print1.EnableSkip(); 126 175 print2.EnableSkip(); 127 176 177 // Copy MC pedestals to apropriate conatiners (if MC file) 128 178 MMcPedestalCopy pcopy; 129 179 MMcPedestalNSBAdd pnsb; 180 181 // Calculate signal and pedestal from data (use MCerPhotCalc 182 // in case of MC files) 130 183 MCerPhotAnal2 ncalc; 184 185 // Blind Pixel Treatment (deprecated, will be replaced by 186 // MBadPixel*) 131 187 MBlindPixelCalc blind; 132 188 blind.SetUseInterpolation(); 189 190 // Clone MCerPhotEvt befor eimage cleaning 133 191 MClone clone("MCerPhotEvt"); 192 193 // Setup image cleaning 134 194 MImgCleanStd clean; 195 196 // Setup calculation of Image parameters 135 197 MHillasCalc hcalc; 198 199 // Setup intercative task calling the functions defined above 136 200 MTaskInteractive mytask; 137 201 … … 139 203 mytask.SetProcess(Process); 140 204 205 // Setup your tasklist 141 206 tlist.AddToList(&read); 142 207 tlist.AddToList(&geomapl); … … 152 217 tlist.AddToList(&mytask); 153 218 219 // Run your analysis 154 220 MEvtLoop evtloop; 155 221 evtloop.SetParList(&plist); … … 158 224 return; 159 225 226 // Print statistics information about your loop 160 227 tlist.PrintStatistics(); 161 228 } -
trunk/MagicSoft/Mars/macros/rootlogon.C
r3927 r3957 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 12/2000 (tbretz@uni-sw.gwdg.de)18 ! Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 120 ! Copyright: MAGIC Software Development, 2000-2004 21 21 ! 22 22 ! 23 23 \* ======================================================================== */ 24 25 /////////////////////////////////////////////////////////////////////////// 26 // 27 // rootlogon.C 28 // =========== 29 // 30 // This file is the startup script ("autoexec.bat") executed when root is 31 // started. The definition which file to start is done in ".rootrc". 32 // There are three files which are automatically processed by root at 33 // startup: A systemwide .rootrc, one in your home directory and one 34 // in the current directory. 35 // So rootlogon.C is correctly executed if your start root from your 36 // Mars directory. 37 // 38 // The script setupts some small environmental things and makes 39 // sure that the Mars shared object (libmars.so) is loaded. This shared 40 // object gives you access to all Mars features from within the root 41 // interpreter. 42 // 43 // If libmars.so is not found in the current directory we search in the 44 // directory given in "MARSSYS" environment variable. 45 // 46 /////////////////////////////////////////////////////////////////////////// 24 47 25 48 Bool_t isloaded() -
trunk/MagicSoft/Mars/macros/runbook.C
r2197 r3957 1 /* ======================================================================== *\ 2 ! 3 ! * 4 ! * This file is part of MARS, the MAGIC Analysis and Reconstruction 5 ! * Software. It is distributed to you in the hope that it can be a useful 6 ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. 7 ! * It is distributed WITHOUT ANY WARRANTY. 8 ! * 9 ! * Permission to use, copy, modify and distribute this software and its 10 ! * documentation for any purpose is hereby granted without fee, 11 ! * provided that the above copyright notice appear in all copies and 12 ! * that both that copyright notice and this permission notice appear 13 ! * in supporting documentation. It is provided "as is" without express 14 ! * or implied warranty. 15 ! * 16 ! 17 ! 18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! 20 ! Copyright: MAGIC Software Development, 2000-2004 21 ! 22 ! 23 \* ======================================================================== */ 24 25 /////////////////////////////////////////////////////////////////////////// 26 // 27 // runbook.C 28 // ========= 29 // 30 // This is an example macro how to extract the runbook information of 31 // a given date from the runbook files. 32 // 33 // The argument is a date in regexp format, eg. 34 // .x runbook.C("2004-05-1[0-9]") 35 // 36 // With an MDirIter you can tell the macro which directories and files 37 // should be searched. 38 // 39 // The output are the runbook entries matching your query. 40 // 41 /////////////////////////////////////////////////////////////////////////// 42 1 43 void Wrap(TString &str) 2 44 { 45 // Wrap lines to 80 chars 3 46 while (str.Length()>80) 4 47 { … … 15 58 void ProcessFile(TString fname, TString date) 16 59 { 60 // File processed 17 61 cout << fname << endl; 18 62 63 // Open file 19 64 ifstream fin(fname); 20 65 … … 32 77 while (!fin.eof()) 33 78 { 79 // Read file line by line 34 80 char *txt=new char[i]; 35 81 fin.getline(txt, i-1); … … 58 104 } 59 105 106 // Check whether line matches regexp 60 107 if (!line(r0).IsNull()) 61 108 print = !line(r1).IsNull(); 62 109 110 // Wrap lines to 80 chars 63 111 if (print) 64 112 Wrap(line); … … 71 119 void runbook(const char *d="20[0-2][0-9]-[0-1][0-9]-[0-3][0-9]") 72 120 { 121 // Regexp to check for valid date 73 122 TString regexp = "20[0-2][0-9]-[0-1][0-9]-[0-3][0-9]"; 74 123 … … 85 134 } 86 135 136 // Tell which dierctories and files to search 87 137 MDirIter Next; 88 138 Next.AddDirectory("/home/MAGIC/online_data/runbook", "CC_*.rbk"); 89 139 140 // Loop over files 90 141 TString name; 91 142 while (1) -
trunk/MagicSoft/Mars/macros/sectorvstime.C
r3393 r3957 18 18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 220 ! Copyright: MAGIC Software Development, 2000-2004 21 21 ! 22 22 ! … … 25 25 ///////////////////////////////////////////////////////////////////////////// 26 26 // 27 // This macro is an example of how to plot the value of a part of the 28 // camera or the whole camera. 27 // sectorvstime.C 28 // ============== 29 // 30 // In this example we plot the mean content of the right and left half of 31 // camera. As an input we use a class derived from MCamEvent. Here this 32 // are dc currents read directly from a camera control report file. 33 // 34 // The output are two histograms one for each half. 29 35 // 30 36 ///////////////////////////////////////////////////////////////////////////// -
trunk/MagicSoft/Mars/macros/star.C
r2621 r3957 18 18 ! Author(s): Thomas Bretz, 5/2002 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 320 ! Copyright: MAGIC Software Development, 2000-2004 21 21 ! 22 22 ! … … 27 27 // STAR - STandard Analysis and Reconstruction 28 28 // 29 // This macro is the standard converter to convert raw data into image 30 // parameters 29 // This macro is the standard converter to convert raw data into image 30 // parameters. It is a demonstration how the star-executable implementation 31 // looks like. 32 // 33 // As an input you need a Merpp output file (raw data). 34 // All parameters are written to an output file called starfile.root. 35 // For the calculation an arbitrary signal extractor (MCerPhotAnal2/Calc) 36 // is used. 31 37 // 32 38 ///////////////////////////////////////////////////////////////////////////// … … 34 40 void star() 35 41 { 36 //37 // This is a demonstration program which calculates the image38 // parameters from a Magic raw data root file.39 40 42 // 41 43 // Create a empty Parameter List and an empty Task List … … 101 103 // 102 104 // tlist.SetSerialNumber(1); // Serial number of telescope 103 104 105 write.AddContainer(write.AddSerialNumber("MMcEvt"), "Events", kFALSE); 105 106 write.AddContainer(write.AddSerialNumber("MSigmabar"), "Events"); -
trunk/MagicSoft/Mars/macros/sumcurrents.C
r2633 r3957 18 18 ! Author(s): Thomas Bretz, 6/2003 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 320 ! Copyright: MAGIC Software Development, 2000-2004 21 21 ! 22 22 ! 23 23 \* ======================================================================== */ 24 25 /////////////////////////////////////////////////////////////////////////// 26 // 27 // sumcurrents.C 28 // ============= 29 // 30 // This is a demonstration macro to display mean DC currents for all pixels. 31 // The input is cc report file. The output are histograms and plots. 32 // Using the MDirIter functionality you can process more than one file 33 // in one or more directories. For more information see MDirIter. 34 // 35 /////////////////////////////////////////////////////////////////////////// 24 36 25 37 void ProcessFile(TString fname) … … 39 51 // 40 52 53 // Create the magic geometry 41 54 MGeomCamMagic geom; 42 55 plist.AddToList(&geom); … … 49 62 tlist.AddToList(&read); 50 63 64 // create a task to fill a histogram 51 65 MFillH fill("MHCamEvent", "MCameraDC"); 52 66 tlist.AddToList(&fill); … … 66 80 tlist.PrintStatistics(); 67 81 82 // 83 // Now display the result of the loop 84 // 68 85 MHCamEvent &h2 = *(MHCamEvent*)plist->FindObject("MHCamEvent"); 69 86 MHCamera &h = *(MHCamera*)h2.GetHistByName("sum"); … … 129 146 } 130 147 131 // -------------------------------------------------------------------------132 //133 // plot.C134 //135 // This macro shows how to fill and display a histogram using Mars136 //137 148 void sumcurrents(const char *dirname=".") 138 149 { -
trunk/MagicSoft/Mars/macros/tar.C
r2611 r3957 1 /* ======================================================================== *\ 2 ! 3 ! * 4 ! * This file is part of MARS, the MAGIC Analysis and Reconstruction 5 ! * Software. It is distributed to you in the hope that it can be a useful 6 ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. 7 ! * It is distributed WITHOUT ANY WARRANTY. 8 ! * 9 ! * Permission to use, copy, modify and distribute this software and its 10 ! * documentation for any purpose is hereby granted without fee, 11 ! * provided that the above copyright notice appear in all copies and 12 ! * that both that copyright notice and this permission notice appear 13 ! * in supporting documentation. It is provided "as is" without express 14 ! * or implied warranty. 15 ! * 16 ! 17 ! 18 ! Author(s): Thomas Bretz <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! 20 ! Copyright: MAGIC Software Development, 2000-2004 21 ! 22 ! 23 \* ======================================================================== */ 24 25 /////////////////////////////////////////////////////////////////////////// 26 // 27 // tar.C 28 // ===== 29 // 30 // Service script. used to create the tar archive for an release. It makes 31 // sure that the correct files are included and the name of the archive is 32 // the name of the current directory (+.tar.gz) 33 // 34 /////////////////////////////////////////////////////////////////////////// 1 35 void tar() 2 36 { -
trunk/MagicSoft/Mars/macros/testenv.C
r1902 r3957 1 /* ======================================================================== *\ 2 ! 3 ! * 4 ! * This file is part of MARS, the MAGIC Analysis and Reconstruction 5 ! * Software. It is distributed to you in the hope that it can be a useful 6 ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. 7 ! * It is distributed WITHOUT ANY WARRANTY. 8 ! * 9 ! * Permission to use, copy, modify and distribute this software and its 10 ! * documentation for any purpose is hereby granted without fee, 11 ! * provided that the above copyright notice appear in all copies and 12 ! * that both that copyright notice and this permission notice appear 13 ! * in supporting documentation. It is provided "as is" without express 14 ! * or implied warranty. 15 ! * 16 ! 17 ! 18 ! Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! 20 ! Copyright: MAGIC Software Development, 2000-2004 21 ! 22 ! 23 \* ======================================================================== */ 24 25 /////////////////////////////////////////////////////////////////////////// 26 // 27 // testenv.C 28 // ========= 29 // 30 // This example reads an config-file (steering card, input card, ...) 31 // The contents of the file a forwarded to the apropriate eventloop 32 // setup in your file. 33 // 34 // All tasks and containers in an eventloop should implement the 35 // ReadEnv/WriteEnv function (for an example see the tasks used below). 36 // 37 // The functions gets the corresponding setup data from the file as an 38 // argument and can change their behaviour and setup on this information. 39 // 40 /////////////////////////////////////////////////////////////////////////// 41 1 42 void testenv() 2 43 { -
trunk/MagicSoft/Mars/macros/weights.C
r2474 r3957 18 18 ! Author(s): Marcos Lopez, 10/2003 <mailto:marcos@gae.ucm.es> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 320 ! Copyright: MAGIC Software Development, 2000-2004 21 21 ! 22 22 ! 23 23 \* ======================================================================== */ 24 24 25 26 25 ////////////////////////////////////////////////////////////////////////////// 27 // // 28 // This macro shows how to use the class MMcWeightEnergySpecCalc // 29 // to convert the energy spectrum of the MC showers generated with Corsika, // 30 // to a different one. // 31 // // 26 // 27 // weights.C 28 // ========= 29 // 30 // This macro shows how to use the class MMcWeightEnergySpecCalc 31 // to convert the energy spectrum of the MC showers generated with Corsika, 32 // to a different one. 33 // 32 34 ////////////////////////////////////////////////////////////////////////////// 33 35 34 35 // --------------------------------------------------------------------------36 //37 //38 36 Double_t myfunction(Double_t *x, Double_t *par) 39 37 { … … 43 41 } 44 42 45 46 47 // --------------------------------------------------------------------------48 //49 //50 43 void weights(TString filename="/up1/data/Magic-MC/CameraAll/Gammas/zbin0/Gamma_zbin0_0_7_1000to1009_w0-4:4:2.root") 51 44 { … … 109 102 //------------------------------------------------------------- 110 103 111 112 104 MFillH hfill(&h1,"MMcEvt"); 113 105 MFillH hfill2(&h2,"MMcEvt"); … … 118 110 tasklist.AddToList(&hfill); 119 111 tasklist.AddToList(&hfill2); 120 121 112 122 113 // … … 132 123 parlist.Print(); 133 124 134 135 // 125 // 136 126 // Draw the Results 137 127 // … … 146 136 hist1->DrawClone(); 147 137 hist2->DrawClone("same"); 148 149 138 } 150 151 152 153 154 155 156 157 158 159 160 161 162 -
trunk/MagicSoft/Mars/mastro/MAstroCamera.cc
r3918 r3957 70 70 #include "MAstroCamera.h" 71 71 72 #include <KeySymbols.h> // kKey_* 73 74 #include <TH2.h> // TH2D 75 #include <TMarker.h> // TMarker 76 #include <TVirtualPad.h> // gPad 72 #include <errno.h> // strerror 73 #include <fstream> // ifstream 74 75 #include <KeySymbols.h> // kKey_* 76 77 #include <TH2.h> // TH2D 78 #include <TMarker.h> // TMarker 79 #include <TVirtualPad.h> // gPad 77 80 78 81 #include "MLog.h" … … 144 147 memcpy((*fMirrors)[i], arr[i], sizeof(MGeomMirror)); 145 148 149 } 150 151 // -------------------------------------------------------------------------- 152 // 153 // Read the mirror geometry from a MC .def file. The following 154 // structure is expected: 155 // 156 // #* TYPE=1 (MAGIC) 157 // #* i f sx sy x y z thetan phin 158 // #* 159 // #* i : number of the mirror 160 // #* f : focal distance of that mirror 161 // #* sx : curvilinear coordinate of mirror's center in X[cm] 162 // #* sy : curvilinear coordinate of mirror's center in X[cm] 163 // #* x : x coordinate of the center of the mirror [cm] 164 // #* y : y coordinate of the center of the mirror [cm] 165 // #* z : z coordinate of the center of the mirror [cm] 166 // #* thetan : polar theta angle of the direction where the mirror points to 167 // #* phin : polar phi angle of the direction where the mirror points to 168 // #* xn : xn coordinate of the normal vector in the center (normalized) 169 // #* yn : yn coordinate of the normal vector in the center (normalized) 170 // #* zn : zn coordinate of the normal vector in the center (normalized) 171 // # 172 // define_mirrors 173 // 1 1700.9200 25.0002 75.0061 25.0000 75.0000 0.9207 0.02328894 1.24904577 -0.00736394 -0.02209183 0.99972882 174 // 2 ... 175 // 176 void MAstroCamera::SetMirrors(const char *fname) 177 { 178 ifstream fin(fname); 179 if (!fin) 180 { 181 gLog << err << "Cannot open file " << fname << ": "; 182 gLog << strerror(errno) << endl; 183 return; 184 } 185 186 TString line; 187 while (1) 188 { 189 line.ReadLine(fin); 190 if (!fin) 191 return; 192 193 line = line.Strip(TString::kBoth); 194 195 if (line.BeginsWith("n_mirrors")) 196 { 197 Int_t n; 198 sscanf(line.Data(), "%*s %d", &n); 199 200 if (!fMirrors) 201 fMirrors = new TClonesArray(MGeomMirror::Class(), n); 202 203 fMirrors->ExpandCreate(n); 204 continue; 205 } 206 207 208 Int_t id; 209 Float_t f, sx, sy, x, y, z, thetan, phin, xn, yn, zn; 210 211 const Int_t n = sscanf(line.Data(), "%d %f %f %f %f %f %f %f %f %f %f %f", 212 &id, &f, &sx, &sy, &x, &y, &z, &thetan, 213 &phin, &xn, &yn, &zn); 214 if (n!=12) 215 continue; 216 217 new ((*fMirrors)[id-1]) MGeomMirror; 218 ((MGeomMirror*)(*fMirrors)[id-1])->SetMirrorContent(id, f, sx, sy, x, y, z, thetan, phin, xn, yn, zn); 219 } 146 220 } 147 221 … … 287 361 { 288 362 const Double_t mag = radec->Magnitude(); 363 if (mag>GetLimMag()) 364 continue; 289 365 290 366 TVector3 star(*radec); … … 334 410 const TVector3 spot = fMirror0->GetReflection(star, fGeom->GetCameraDist())*1000; 335 411 DrawStar(spot(0), spot(1), *radec, !hasmean, Form("x=%.1fmm y=%.1fmm", mean(0), mean(1))); 412 //cout << TMath::Hypot(spot(0), spot(1)) << " " << TMath::Hypot(mean(0)-spot(0), mean(1)-spot(1)) << endl; 336 413 } 337 414 } … … 362 439 } 363 440 364 // Get camera 365 MHCamera *camera=(MHCamera*)FindObjectInPad("MHCamera", gPad); 366 if (camera) 367 { 368 if (!camera->GetGeometry() || camera->GetGeometry()->IsA()!=fGeom->IsA()) 369 camera->SetGeometry(*fGeom); 370 } 371 else 372 { 373 camera = new MHCamera(*fGeom); 374 camera->SetName("MHCamera"); 375 camera->SetStats(0); 376 camera->SetInvDeepBlueSeaPalette(); 377 camera->SetBit(kCanDelete); 378 camera->Draw(); 379 } 380 381 const TRotation rot(GetGrid(kTRUE)); 441 const MAstroSky2Local s2l(*fTime, *fObservatory); 442 const TRotation trans(AlignCoordinates(rot*fRaDec)); 443 444 // Return the correct rotation matrix 445 const TRotation rot = trans*s2l; 382 446 383 447 MVector3 *radec; … … 397 461 list->Add(starpos); 398 462 } 463 // For MAGIC the distance of the mean of the light distribution 464 // to the Mirror0 reflection of the star (Abberation) can be 465 // expressed as: dr = (0.0713 +/- 0.0002) * r = r/14.03 466 // with r = hypot(mean(0), mean(1)) 399 467 } 400 468 */ … … 402 470 // ------------------------------------------------------------------------ 403 471 // 472 // Uses fRaDec as a reference point. 473 // 474 // Return dZd and dAz corresponding to the distance from x,y to fRaDec 475 // 476 // Before calling this function you should correct for abberation. In 477 // case of MAGIC you can do this by: 478 // x /= 1.0713; 479 // y /= 1.0713; 480 // 481 // x [mm]: x coordinate in the camera plane (assuming a perfect mirror) 482 // y [mm]: y coordinate in the camera plane (assuming a perfect mirror) 483 // 484 // dzd [deg]: Delta Zd 485 // daz [deg]: Delta Az 486 // 487 void MAstroCamera::GetDiffZdAz(Double_t x, Double_t y, Double_t &dzd, Double_t &daz) 488 { 489 // Reflect the corrected pixel on a perfect mirror 490 TVector3 v(x, y, fGeom->GetCameraDist()*1000); 491 TVector3 spot = fMirror0->GetReflection(v); 492 493 // Derotate into the local coordinate system 494 const MAstroSky2Local rot(*fTime, *fObservatory); 495 const TRotation align(AlignCoordinates(rot*fRaDec).Inverse()); 496 spot *= align; 497 498 cout << "Zd="<<spot.Theta()*TMath::RadToDeg() << " "; 499 cout << "Az="<<spot.Phi() *TMath::RadToDeg()+360 << endl; 500 501 // Derotatet the center of the camera 502 TVector3 c(0, 0, 1); 503 c *= align; 504 505 dzd = (spot.Theta()-c.Theta())*TMath::RadToDeg(); 506 daz = (spot.Phi() -c.Phi()) *TMath::RadToDeg(); 507 508 if (daz> 180) daz -= 360; 509 if (daz<-180) daz += 360; 510 } 511 512 // ------------------------------------------------------------------------ 513 // 404 514 // Execute a gui event on the camera 405 515 // 406 516 void MAstroCamera::ExecuteEvent(Int_t event, Int_t mp1, Int_t mp2) 407 517 { 518 // if (mp1>0 && mp2>0) 519 // { 520 // // Calculate World coordinates from pixel 521 // Double_t x = gPad->AbsPixeltoX(mp1); 522 // Double_t y = gPad->AbsPixeltoY(mp2); 523 // 524 // // Correct for abberation 525 // x /= 1.0713; 526 // y /= 1.0713; 527 // 528 // Double_t dzd, daz; 529 // GetDiffZdAz(x, y, dzd, daz); 530 // 531 // cout << "dZd="<< dzd << " " << "dAz="<< daz << endl; 532 // } 533 // 534 // For MAGIC the distance of the mean of the light distribution 535 // to the Mirror0 reflection of the star (Abberation) can be 536 // expressed as: dr = 0.0713*r = r/14.03 537 // +-0.0002 538 408 539 if (event==kKeyPress && fTime) 409 540 switch (mp2) -
trunk/MagicSoft/Mars/mastro/MAstroCamera.h
r3918 r3957 32 32 33 33 void SetMirrors(TClonesArray &arr); 34 void SetMirrors(const char *fname); 34 35 void SetGeom(const MGeomCam &cam); 36 37 void GetDiffZdAz(Double_t x, Double_t y, Double_t &dzd, Double_t &daz); 35 38 36 39 ClassDef(MAstroCamera, 1) // Display class to display stars on the camera -
trunk/MagicSoft/Mars/mastro/MObservatory.h
r3568 r3957 36 36 MObservatory(LocationName_t key, const char *name=NULL, const char *title=NULL); 37 37 38 void Copy(TObject &obj) const 39 { 40 MObservatory &obs = (MObservatory&)obj; 41 obs.fObservatoryName = fObservatoryName; 42 obs.fLongitude = fLongitude; 43 obs.fLatitude = fLatitude; 44 obs.fSinLatitude = fSinLatitude; 45 obs.fCosLatitude = fCosLatitude; 46 obs.fHeight = fHeight; 47 } 48 38 49 void SetLocation(LocationName_t name); 39 50 -
trunk/MagicSoft/Mars/mbase/MLog.cc
r3927 r3957 149 149 // 150 150 #ifdef _REENTRANT 151 fMuxGui = new TMutex; 151 fMuxGui = new TMutex; 152 fMuxStream = new TMutex; 152 153 #endif 153 154 … … 213 214 delete fPlugins; 214 215 #ifdef _REENTRANT 216 delete fMuxStream; 215 217 delete fMuxGui; 216 218 #endif … … 359 361 360 362 // lock mutex 361 Lock ("UpdateGui");363 LockUpdate("UpdateGui"); 362 364 363 365 TGText &txt=*fGui->GetText(); … … 387 389 388 390 // release mutex 389 UnLock("UpdateGui"); 391 UnLockUpdate("UpdateGui"); 392 } 393 394 void MLog::LockUpdate(const char *msg) 395 { 396 #ifdef _REENTRANT 397 if (fMuxGui->Lock()==13) 398 Error("LockUpdate", "%s - mutex is already locked by this thread\n", msg); 399 #endif 400 } 401 402 void MLog::UnLockUpdate(const char *msg) 403 { 404 #ifdef _REENTRANT 405 if (fMuxGui->UnLock()==13) 406 Error("UnLockUpdate", "%s - tried to unlock mutex locked by other thread\n", msg); 407 #endif 390 408 } 391 409 … … 393 411 { 394 412 #ifdef _REENTRANT 395 if (fMux Gui->Lock()==13)413 if (fMuxStream->Lock()==13) 396 414 Error("Lock", "%s - mutex is already locked by this thread\n", msg); 397 415 #endif … … 401 419 { 402 420 #ifdef _REENTRANT 403 if (fMux Gui->UnLock()==13)421 if (fMuxStream->UnLock()==13) 404 422 Error("UnLock", "%s - tried to unlock mutex locked by other thread\n", msg); 405 423 #endif … … 412 430 int MLog::sync() 413 431 { 414 Lock ("sync");432 LockUpdate("sync"); 415 433 WriteBuffer(); 416 UnLock ("sync");434 UnLockUpdate("sync"); 417 435 418 436 if (fDevice&eStdout) … … 448 466 if (fOutputLevel <= fDebugLevel) 449 467 { 450 Lock ("overflow");468 LockUpdate("overflow"); 451 469 452 470 *fPPtr++ = (char)i; … … 455 473 WriteBuffer(); 456 474 457 UnLock ("overflow");475 UnLockUpdate("overflow"); 458 476 } 459 477 -
trunk/MagicSoft/Mars/mbase/MLog.h
r3927 r3957 71 71 #ifdef _REENTRANT 72 72 TMutex *fMuxGui; //! Mutex locking access of TGListBox 73 TMutex *fMuxStream; //! Mutex locking access to streaming 73 74 #endif 74 75 … … 102 103 ~MLog(); 103 104 104 void Lock(const char *msg); 105 void UnLock(const char *msg); 105 void LockUpdate(const char *msg); 106 void UnLockUpdate(const char *msg); 107 108 void Lock(const char *msg=""); 109 void UnLock(const char *msg=""); 106 110 107 111 void EnableDirectGui() { fIsDirectGui = kTRUE; } -
trunk/MagicSoft/Mars/mhist/MHCamera.cc
r3953 r3957 34 34 // To change the scale to a logarithmic scale SetLogy() of the Pad. 35 35 // 36 // You can correct for the abberation. Assuming that the distance 37 // between the mean position of the light distribution and the position 38 // of a perfect reflection on a perfect mirror in the distance r on 39 // the camera plane is dr it is d = a*dr while a is the abberation 40 // constant (for the MAGIC mirror it is roughly 0.0713). You can 41 // set this constant by calling SetAbberation(a) which results in a 42 // 'corrected' display (all outer pixels are shifted towards the center 43 // of the camera to correct for this abberation) 44 // 36 45 // Be carefull: Entries in this context means Entries/bin or Events 37 46 // … … 102 111 // Default Constructor. To be used by the root system ONLY. 103 112 // 104 MHCamera::MHCamera() : TH1D(), fGeomCam(NULL), fColors(kItemsLegend) 113 MHCamera::MHCamera() : TH1D(), fGeomCam(NULL), fColors(kItemsLegend), fAbberation(0) 105 114 { 106 115 Init(); … … 114 123 // 115 124 MHCamera::MHCamera(const MGeomCam &geom, const char *name, const char *title) 116 : fGeomCam(NULL), fColors(kItemsLegend) 125 : fGeomCam(NULL), fColors(kItemsLegend), fAbberation(0) 117 126 { 118 127 //fGeomCam = (MGeomCam*)geom.Clone(); … … 759 768 const MGeomPix &pix = (*fGeomCam)[i]; 760 769 761 const Float_t x = pix.GetX()*conv;762 const Float_t y = pix.GetY()*conv;763 constFloat_t d = pix.GetD()*conv;770 Float_t x = pix.GetX()*conv/(fAbberation+1); 771 Float_t y = pix.GetY()*conv/(fAbberation+1); 772 Float_t d = pix.GetD()*conv; 764 773 765 774 if (!isbox) -
trunk/MagicSoft/Mars/mhist/MHCamera.h
r3929 r3957 47 47 //#endif 48 48 49 Float_t fAbberation; 50 49 51 void Init(); 50 52 … … 188 190 void Draw(Option_t *option=""); 189 191 TObject *DrawClone(Option_t *option="") const; 190 void DrawProjection (Int_t fit=0) const; 191 void DrawRadialProfile() const; 192 void DrawProjection (Int_t fit=0) const; 193 void DrawRadialProfile() const; 192 194 193 195 void SavePrimitive(ofstream &out, Option_t *); … … 209 211 Bool_t IsFreezed() const { return TestBit(kFreezed); } 210 212 //void SetOptStat(Int_t os=-1) { fOptStat = os; } // *MENU* 213 214 void SetAbberation(Float_t f=0.0713) { fAbberation=f; } // *MENU* 211 215 212 216 void AddNotify(TObject *event); -
trunk/MagicSoft/Mars/mtools/MFFT.cc
r3125 r3957 63 63 // * If the PSD does NOT CONVERGE to 0 at the maximum bin, // 64 64 // you HAVE TO sample your data finer! // 65 // // 65 // 66 // Fourier-Transformation: 67 // ======================= 68 69 // (taken from http://www.parasitaere-kapazitaeten.net/Pd/ft.htm) 70 // 71 // The Fourier-Transformation is a mathematical function that breaks 72 // down a signal (like sound) into its frequency-spectrum as a set of 73 // sinusoidal components, converting it from the Time Domain to the 74 // Frequency Domain. 75 // 76 // In the Time Domain the signal x[ ] consists of N samples, labeled 77 // from 0 to N-1. In the Frequency Domain the RFFT produces two signals 78 // (signalvectors), treated as complex numbers representing the Real Part: 79 // Re X[ ] and the Imaginary Part: Im X[ ]. They are seen as the Cosine- 80 // und Sine-Components of the base frequencies. Each of these two signals 81 // contains one more sample than the half of the original signal: N/2 + 1 82 // samples. (this results from the fact, that the sine-components of the 83 // first frequency (0) and the last (nyquist, N/2) are always 0). With the 84 // complex Fourier-Transformation N complexe values are transformed to N 85 // new complex values. For both it applies to: the Frequency Domain 86 // contains exactly the same information as the Time-Domain. 87 // 88 // A Real FFT over 64 samples produces values for 33 cosine- and 33 89 // sine-wave-amplitudes with the frequencies 0, 1, 2, 3, ..., 30, 31, 32. 90 // The first value (frequency 0) is the DC (direct current), the other 91 // values have to be seen in practice as factors of a 92 // fundamental-frequency which can be calculated by dividing samplerate by 93 // windowsize. The highest frequency is the nyquist-frequency 94 // (samplerate/2). 95 // 66 96 ////////////////////////////////////////////////////////////////////////////// 67 97
Note:
See TracChangeset
for help on using the changeset viewer.