Index: trunk/MagicSoft/Mars/mtemp/mifae/Changelog
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/Changelog	(revision 7136)
+++ 	(revision )
@@ -1,738 +1,0 @@
-Please  do  not write behind the end of line tag so that it is  possible
-to   send  a   Changelog   file  to  a  line  printer  directly.  Thanks.
-
-For your entries please follow this style:
-
-_yyyy/mm/dd:_[Your Name]
-_
-___*_filename:
-_____-_description
-_
-___*_filename2, filename3:
-_____-_description
-_
-_
-_
-
-While an underscore is a placeholder for a white-space or an empty line.
-
-                                                 -*-*- END OF LINE -*-*-
- 2005/03/03 Javier Rico
-    * programs/makeHillas.cc programs/makehillas.datacard
-      - read initial list of bad pixels from ascii file
-      - include MImagePar as output container
-
- 2005/02/15 Javier Rico
-    * library/MEffAreaAndCoeffCalc.[h,cc]
-    * macros/computeCoeff.C
-      - extend the energy bounds to compute weights
-      - add possibility to set the zenith angle binning from outside
-
- 2005/02/14 Javier Rico
-    * library/MEffAreaAndCoeffCalc.[h,cc]
-    * macros/computeCoeff.C
-      - compute the coefficients in the big bins
-      - migrate to new data format
-      
-	
- 2005/02/10 Javier Rico
-    * library/MEffAreaAndCoeffCalc.[h,cc]
-      - added class to compute Effective areas and unfolding coefficients
-    * library/Makefile, IFAELinkDef.h
-      - add MEffAreaAndCoeffCalc
-    * macros/computeCoeff.C
-      - add macro example to use MEffAreaAndCoeffCalc	
-	
- 2005/02/02 Oscar Blanch Bigas
-    * library/MGainFluctuationPix.[h,cc],MGainFluctuationCam.[h,cc]
-      - added parameter containers to handle gain fluctuaions
-    * library/MAddGainFluctuation.[h,cc]
-      - added task to add gain fluctuaions
-    * library/Makefile,IFAELinkDef.h
-      - modified to compile new classes
-    * macros/makeHillasMC.C
-      - modified to compute also Mhadronness and MDisp
-      - modified adding class to introduce gain fluctuations
-      - modified adding display hillas
-
- 2005/01/27 Javier Rico
-    * programs/DISPstd.root, programs/RF*.root
-     - removed, will be available at 
-       http://atlas.ifae.es/~jrico/Mars_Standard06/mtemp/mifae/bin/
-
- 2005/01/27 Eva Domingo
-    * programs/DISPstd.root
-     - updated optimal DISP parameters, running over the MC treated
-       with the Spline signal extractor
-    * macros/DispSkymap.C
-     - added first version of a macro that creates the On, Off and
-       On-Off skymaps from the makeHillas program output files
-    * macros/makeHillasMC.C
-     - added macro equivalent to current makeHillas program 
-       for MC files (it is in fact a version of several already 
-       existing macros)
-
- 2005/01/25 Javier Rico
-    * macros/mmcCleaning.C
-     - added extractor spline and input arguments
-	
- 2005/01/24 Javier Rico
-    * programs/RFstd.root, programs/RFdist.root, programs/RFalpha.root
-     - added default forest files for standard analysis, for 
-       off-axis or exteded sources (disp analysis), and analysis 
-       on hadronness including alpha.
-	
- 2005/01/24 Eva Domingo
-    * library/MFDisp.[cc,h] 
-     - Number of islands read from MImagePar container
-       to be used as cut parameter if wanted
-    * library/MHDisp.cc 
-     - corrected to be able to run Disp method also over
-       data (MMcEvt container info just used if available)
-    * library/MDispCalc.cc
-     - introduced DISP = Xi*(1/(1+width/length)) as default
-       Disp parameterization for the moment
-
- 2005/01/24 Eva Domingo
-    * programs/makeHillas.cc 
-      programs/makehillas.datacard
-      programs/DISPstd.root, default DISP parameters values
-     - Add Disp computation
-
- 2005/01/21 Javier Rico
-    * programs/makeHillas.cc, programs/Makefile, 
-      programs/makehillas.datacard
-     - Add Random Forest computation
-	
- 2005/01/20 Eva Domingo
-    * library/MDispParameters.[cc,h]
-     - Added substituting previous MDisp.[cc,h] classes.
-       Old MDisp::Calc function moved to MDispCalc task.
-    * library/MDispCalc.[cc,h]
-     - Now includes the DISP parameterization, defined in 
-       MDispCalc::Calc. MDispCalc::InitMapping now defines 
-       training and test matrices with only the columns of 
-       variables needed in the DISP expression.
-    * library/MHDisp.[cc,h]
-     - Changed the Chi2 name by MinPar (to clarify it accounts for 
-       the parameter asked to be minimized in the Disp optimization).
-       Added MHDisp::InitMapping, defines matrices with only the columns
-       of variables needed for computing the minimization parameter 
-       and for filling the DISP histograms.
-
- 2005/01/18 Javier Rico & Markus Gaug
-    * programs/controlPlot.cc, programs/controlplot.datacard,
-      programs/Makefile
-     - correct bugs: cuts in the proper units; separate ON and OFF 
-       task lists since before it was reading who knows what
-    * library/MControlPlots.[h,cc]
-     - add Clear() method and remove some (minor) memory leaks
-    * library/MIslands.cc
-     - place call to SetOwner() in the correct place
-	
- 2005/01/10 Javier Rico
-    * programs/makeHillas, programs/makehillas.datacard
-     - adapt to new mars version
-	
- 2004/12/22 Eva Domingo
-    * library/MImageParDisp.[cc,h]
-     - Container for the estimated distance to source position DISP.
-    * library/MDisp.[cc,h]
-     - Container holding the parameters used for the DISP expression.
-       The current DISP parameterization is defined in MDisp::Calc.
-    * library/MDispCalc.[cc,h]
-     - Task calculating DISP with the expression and parameter values
-       stored in MDisp. Training and test matrix of variables to be 
-       used in the DISP optimization are also defined within 
-       MDispCalc::InitMapping.
-    * library/MHDisp.[cc,h]
-     - Container for the histograms to judge the quality of the DISP 
-       estimate. MHDisp::GetChi2 returns the value of the quantity 
-       requested to be minimized by Minuit, which is defined and 
-       computed in MHDisp::Fill and MHDisp::Finalize. 
-       MHDisp::GetSkymapXY returns the reconstructed map of source 
-       positions. MHDisp::SetSelectedPos function to choose the 
-       selection method of the DISP source position solution.
-    * library/MFDisp.[cc,h]
-     - Filter to select a sample of events to do the DISP optimization.
-       Use MFDisp::SetCuts function.
-    * library/MFindDisp.[cc,h]
-     - Main class for DISP optimization:
-        ::DefineTrainMatrix, ::DefineTestMatrix, ::DefineTrainTestMatrix
-       generate the training and test samples (in the form of matrices)
-       from the input file.
-	::FindParams is the function steering the optimization (over the
-       training sample), calling Minuit, passing the fcn function to be 
-       minimize and defining the event loop to be executed in each step.
-	::TestParams tests the quality of the DISP estimate using the 
-       test matrix sample
-    * macros/OptimizeDisp.C
-     - macro for estimating the DISP parameter: create training and test
-       matrix; optimize DISP; test quality optimization; calculate DISP
-       and construct skymap for an input file.
-    * library/Makefile, library/IFAELinkDef.h
-     - include Disp classes.
-
- 2004/12/21 Pepe Flix (represented by jrico)
-    * library/MTopology.[cc,h], library/MTopologyCalc.[cc,h], 
-      library/Makefile, library/IFAELinkDef.h
-     - include topology classes
-	
- 2004/12/21 Javier Rico
-    * programs/makeHillas.cc, programs/makehillas.datacard
-     - Include spline extractor and remove possibility of computing 
-       pedestals from pedestal runs instead of from low gains
-
- 2004/11/24  Ester Aliu
-    * library/MIslandsCalc.h
-     - Remove a memmory leak, and add a sort function to order the 
-     pixels by index after their interpolation
-     - Other minor changes 
-    * library/MImgIsland.[h,cc]
-     - Reset some variables
-
- 2004/11/11  Ester Aliu
-    * library/MIslands.h
-     - Add the variable AlphaW
-    * library/MImgIsland.[h,cc]
-     - Add alpha for each island
-    * library/MIslandsCalc.cc
-     - Bug solved
-    * library/MIslandsClean.cc
-     - More different island cleanings added	
-
-  2004/10/20  Javier Rico
-    * programs/makeHillas.cc
-     - Correct reading in MReportDrive
-	
-  2004/10/15  Javier Rico
-    * programs/makeHillas.cc, programs/Makefile
-     - Write out MReportDrive
-	
-  2004/10/15  Javier Rico
-    * macros/mmcCleaning.C
-     - Include islands
-     - Do not save uncalibrated nonoise file
-
-  2004/10/08  Javier Rico
-    * programs/makeHillas.cc, programs/makehillas.datacard
-     - Include possibility to select signal extractor in datacard
-     - Include possitility to compute pedestals from data themselves, 
-       by selecting word PRUNS 0. For the time being, the old option
-       of computing them from a pedestal run is still available
-	
-  2004/10/05  Javier Rico
-    * programs/srcPos.cc
-     - Change kRotate by kRotating since the former is a used name
-    * programs/makeHillas.cc
-     - Change SetProcessRMS by SetProcessPedestal since name has changed
-    * programs/Makefile
-     - add mhcalib to the list of include dirs since it is now needed
-
-  2004/10/05  Ester Aliu
-    * library/Makefile ,library/IFAELinkDef
-     - modified according to the new classes implemented
-    * programs/makeHillas.cc
-     - modified according to the new classes implemented 
-
-  2004/10/05  Ester Aliu
-    * library MIslands.[h,cc] ,library/MIslandCalc.[h,cc],
-      MIslandClean.[h,cc]
-     - removed
-    * library MIslands.[h,cc],library/MIslandsCalc.[h,cc], 
-     MIslandsClean.[h,cc] , MImgIsland.[h,cc]
-     - added
-    * library/MControlPlots.[h,cc], MIslands.[h,cc]
-     - changed. A bug in the islands has been solved and a new structure
-     for the islands classes similar to the MStarPos and MStarCam classes
-     is proposed
-
-  2004/09/16 Javier Rico
-    * macros/pedrmsonoff.C
-     - Added
-
-  2004/09/02 Javier Rico
-    * programs/srcPos.cc
-     - Add include MArgs.h to cope with changes in Mars
-
-  2004/08/31 Javier Rico
-    * macros/mergeClean.C, mmcCleaning, cleanComp.C
-     - Added macros for the cleaning comparison analysis
-
-  2004/08/27 Javier Rico
-    * library/MDisplay.[cc,h]
-     - Dump run and event numbers
-     - Add possibility to produce ps file of the image
-
-  2004/08/10 Javier Rico
-    * programs/makeHillas.cc
-     - include recomendations of Nadia to interpolate bad pixels
-
-  2004/08/10 Ester Aliu
-    * library/MIslands.[h,cc], MIslandCalc.[h,cc]
-     - remove som bugs
-    * programs/makeHillas.[cc]
-     - fixed window(14 slices) by default 
-  
-  2004/08/04 Javier Rico
-    * programs/makeHillas.cc
-     - remove "#include" of obsolete MBlindPixel.h
-     - do not interpolate "unreliable" pixels
-	
-    * library/MIslands.[cc]
-     - Correct tiny compilation error
-    
-    * library/MDisplay.cc, library/MHillasDisplay.[h,cc]
-     - Print hillas source position dependent stuff
-
-  2004/08/03 Ester Aliu Fusté
-    * library/MIslands.[h, cc], MIslandCalc.[h,cc]
-     - Add the delete for the pointers  
-
-  2004/08/02 Ester Aliu Fusté
-    * library/MIslands.[h, cc], MIslandCalc.[h,cc]
-     - Added the variables: distance (Dist) between the larger island and 
-       the other ones, width and lenght of the larger island. 
-     
-     - Written pointers instead of vectors 
-     
-  2004/07/28 Javi Lopez
-    * script/
-     - Created directory call scripts
-     - Added srcPosRun.sh script to create the *.pos file for the MSrcPosFromFile
-       task.
-     - Added makeHillas.sh script that run several makeHillas making groups of
-       data runs with preavius pedestal run.
-  
-  2004/07/28 Ester Aliu Fuste
-    * programa/makeHillas.cc
-     - Add a flag for the time calibration
- 
-  2004/07/26 Ester Aliu Fuste
-    * library/MIslandCalc.cc
-     - Add the initialization of Dist(to -1) and MeanX/MeanY (to -10000) vectors
-
-  2004/07/22 Oscar Blanch Bigas
-    * programs/makeHillas.cc
-     - Solved backwards compatibility on the CLEANLEVEL
-       options.
-
-  2004/07/22 Ester Aliu 
-    * library/MIslands.[h,cc],MIslandCalc.cc
-     - Add meanX, meanY and dist of each of the islands
-     - Now the island with id 0 is the larger one
-
-  2004/07/21  Javier Rico
-    * programs/makeHillas.cc, srcPos.cc
-      - Add time information
-
-    * programs/makehillas.datacard
-      - Add comment
-
-  2004/07/20  Javier Lopez
-    * library/MLiveTime.[h,cc]
-      - Containers to hold the live time. It has the option to
-      have several time bins.
-    * library/MLiveTimeCalc.[h,cc]
-      - Task to compute the live time from the data. 
-    * macros/runlivetime.C
-      - Macro to use the MLiveTime+ stuff.
-
-  2004/07/15  Javier Lopez
-    * macros/ligthcurve.C
-      - Macro to compute a light curve from hillas files.
-
-  2004/07/04  Oscar Blanch Bigas
-    * library/MControlPlots.cc
-      - Off MHCamera normalised to On
-
-    * programs/makeHillas.cc
-      - Added clean flags to chose: number of rings and kDemocratic.
-      - Using different Pedestal run for the calibration.
-
-    * programs/optimizeCuts.cc
-      - Added alias for MNewImageParameters.fInnerLeakage
-
-    * calib.[cc,datacard]
-      - Added : produces ascci file with relevant factors of
-                Calibration
-
-    * controlPlot.cc, controlplot.datacard
-      - Added : It makes Number of hits plot.
-
-  2004/06/30: Javier Rico
-
-    * mifae/library/MDisp.cc
-      - Remove include of deprecated library
-      - Define namespace
-
-    * mifae/library/MControlPlots.cc
-      - Define style
-      - Add projection
-      - Plot 3rd plot correctly
-      - Search for "MIsland" instead of "MIsland1" container
-
-  2004/06/26: Eva Domingo - Pepe Flix
-
-    * mifae/library/MDisp.[h,cc]
-    * mifae/library/MDispCalc.[h,cc]
-      - Added classes for evaluation of DISP method.
-
-  2004/06/22  Javier Rico
-    * library/MControlPlots.[h,cc]
-      - Added
-
-    * library/Makefile, IFAELinkDef.h
-      - Add MControlPlots. So far, it produces plots with the number
-        of times each pixel survives the cleaning. It needs a MIsland
-        object to be included on the parameter list
-
-    * programs/makeHillas.cc
-      - Change pointer to MWriteRootFile object for MWriteRootFile 
-	object (otherwise the tree "Parameters" is not saved)
-      - Islands are always computed since are needed for some control
-        plots
-
-    * programs/srcPos.cc
-      - Add MControlPlots to the task list
-
-    * library/MSrcPosFromFile.cc
-      - Cope with case where first analyzed run is not in input file
-
-  2004/06/15  Javier Lopez
-    * library/MSrcPosFromStars.[h,cc]
-      - Task to compute the position of a source from
-        the positions of several stars.
-
-    * library/MHPSFFromStars.[h,cc]
-      - Histogram task that holds and fills the histograms of 
-        positioning and point spread function of an star.
-
-    * macros/distancebetweenstars.C
-      - Add macros that show in an histogram the distance between
-        the stars in a field of view. 
-
-    * macros/psffromstars.C
-      - Add task that show the point spread funtion and positon of
-        the most central star in the field of view. This information
-        is compute using the MFindStars tool.
-
- 2004/06/11 Ester Aliu 
-   * programs/makeHillas.cc
-     - add the possibility of using more than one algorithm to 
-      calculate the islands and use different algorithms for counting
-      islands
-
-   * library/MIslands.[h,cc],MIslandCalc.[h,cc], MIslandCleaning.[h,cc]
-     - add a new island cleaning which consists in removing all the
-      islands except the larger one
-     - add a new algorithm of counting islands consisting in consider
-      as the same islands those islands separated by 2 or less pixels
-
- 2004/06/02 Javier Rico
-   * srcpositions, srcpositions/Mrk421_220404_pos.txt
-     - add directory to store files with source positions and a first
-       sample file (with real data)
-
- 2004/06/01 Javier Rico
-   * macros/observationTime.C
-     - add macro to compute observation time
-
- 2004/05/28 Javier Rico
-   * programs/optimizeCuts.cc programs/optimizecuts.datacard
-     - Include loop on size
-
- 2004/05/27 Ester Aliu 
-   * programs/makeHillas.cc
-     - Add the name of the MIslands container
-
-   * library/MHillasDisplay.[h,cc]
-     - Add a function which retuns the name of the MIslands container
-
-   * library/MIslands.[h,cc],MIslandCalc.cc
-     - Add MIslands::Print() function wich prints the island parameters
-     - Change some part of the code to take into account that some 
-     times there are bad pixels
-
- 2004/05/27 Javier Rico
-   * programs/makeHillas.cc, programs/makehillas.datacard
-     - Remove unneeded MCalibrationQECam and MBadPixelsCam objects, 
-       trying to trace back a bug in the calibration
-     - Add possibility to interpolate bad pixels
-
-   * library/MHillasDisplay.cc
-     - Initialize MIslands object in constructor
-	
- 2004/05/26 Javier Rico
-   * library/MHillasDisplay.[h,cc]
-     - Call for MIslands::Print() in the process if any MIslands is 
-       found
-	
- 2004/05/24 Javier Rico
-   * library/MDisplay.[h,cc], programs/makeHillas.cc, 
-     programs/makehillas.datacard
-     - Add possibility to save a ps file
-     - Update documentation
-     - Cope with the case when no cut is provided
-	
-   * library/MHillasDisplay[h.cc]
-     - correct minor axis paint
-     - include MNewImagePar dumping
-     - update documentation
-	
- 2004/05/21 Oscar Blanch
-   * makeHillas.cc
-     - Adde a couple of conditionals to allow makeHillas in 
-       NON calibration mode without giving a Cailbration file,
-	
- 2004/05/21  Javier Rico
-   * library/MDCA.[cc.h]
-     - removed
-
-   * library/MDisplay.[h,cc], library/MHillasDisplay.[h,cc]
-     - added
-
-   * library/Makefile, library/IFAELinkDef.h
-     - remove MDCA
-     - add MDisplay and MHillasDisplay
-
-   * library/MSrcPlace.[h,cc], library/MSrcRotate.[h,cc],
-     library/MSrcTranslate.[h,cc], library/MSrcPosFromFile.cc
-     - remove MDCA dependences
-
-   * programs/makeHillas.cc, programs/makehillas.datacard
-     - include display and selection cuts options
-	
-   * programs/Makefile
-     - include mfbase in the list of includes directory
-
- 2004/05/18  Javier Rico
-   * macros/plotOptimal.C
-     - dump value of maximal significance and cuts
-
- 2004/05/18  Javier Rico
-   * library/MSrcPlace.[cc,h], library/MSrcRotate.[cc,h], 
-     library/MSrcTranslate.[cc,h], library/MSrcPosFromFile.[cc,h]
-     - Add the possibility of having different input and output 
-       MSrcPosCam containers (CONSTRUCTORS HAVE CHANGED!)
-     - Move the creation of internal histogram to PreProcess, so that
-       it can be configured before creation. Now configurable: whether
-       histo must be created or not (fCreateHisto), histo bin size 
-       (fHistoBinPrec), histogram name (fHistoName), with corresponding
-       getters and setters
-     - Update documentation
-
-   * library/MSrcPosFromFile.cc	
-     - If no position has been measured for the first analyzed run, use
-       the one of the first run in file instead.
-
-   * programs/falseSource.cc
-     - Change obsolete MSrcPosCam predefinitions for modern 
-       MSrcTranslate objects, which allow relative displacement of the
-       source position from a previously assigned one. 
-     - Add flag for relative translation
-     - Include control histograms (hOn[Off]SrcPos) for the source 
-       position
-
-   * programs/falsesource.datacard
-     - Add datacard SRCABS for relative/absolute source translation
-
-   * programs/srcPos.cc
-     - Avoid creation of internal histograms for the translation
-
-   * programs/optimizeCuts.cc
-     - Correct bug on width initial value
-
-   * programs/makeHillas.cc
-     - Pass MCalibrationQECam from the MJCalibration to the following
-       loops (to be able to perform calibration of data)
-	
-	
- 2004/05/17  Javier Rico
-   * library/MSrcPlace.[cc,h], library/MSrcRotate.cc, 
-     library/MSrcTranslate.cc
-     - Assign the internal histogram a class-dependent name
-     - Add some log lines to trace the classes behaviour
-     - Remove function SearchForSrcPos
-
-   * library/MSrcPosFromFile.[cc,h]
-     - Correct behaviour for not found runs
-     - Keep latest good MSrcPosCam to fill for next events
-     - Initialize pointers to NULL
-     - Fill also MDCA
-
-	
- 2004/05/14  Javier Rico
-   * library/MSrcPlace.[cc,h]
-     - added
-
-   * library/MSrcPosFromFile.[cc,h], library/MSrcRotate.[cc,h],
-     library/MSrcTranslate.[cc,h]
-     - inherit from MSrcPlace
-
-   * programs/srcPos.cc programs/srcpos.datacard
-     - adapt to new MSrcPlace class
-	
-   * library/Makefile, library/IFAELinkDef.h
-     - include MSrcPlace
-
- 2004/05/13  Javier Rico
-   * macros/rotation.C
-     - added
-
-
- 2004/05/13  Javier Lopez
-   * library/MCalibrateDC.[h,cc]
-     - Task to intercalibrate the dc response of the dc
-       current for all the pmts from a continuos light
-       run.
-
- 2004/05/12: Javier Rico
-   * macros/alpha.C, macros/plotOptimal.C
-     - added
-
-   * library/MSrcRotate.[cc.h]
-     - correct bug in computation of run time for rotation
-	
-   * programs/srcPos.cc
-     - change mjdpos type to Double_t
-	
-	
-	
- 2004/05/11: Javier Rico
-   * programs/optimizeCuts.cc, programs/optimizecuts.datacard
-     - added
-
-   * programs/Makefile
-     - include optimizeCuts
-
-   * programs/srcPos.cc, programs/srcpos.datacard
-     - add reference rotation angle
-
-	
- 2004/05/11: Ester Aliu
-   *  macros/signal.cc 
-     - change some things
-   *  programs/falseSource.cc 
-     - change some mathematical functions to root equivalents 
-   *  programs/psffit.cc
-     - add <stdlib.h> library 
-
- 2004/05/11: Ester Aliu 
-   * programs/makeHillas.cc, programs/makehillas.datacard
-     - add island calculations
- 
- 2004/05/11: Javier Rico
-   * programs/makeHillas.cc
-     - prevent it from bombing because of the mjobs
-
-
- 2004/05/10: Javier Rico
-   * programs/Makefile
-     - specify libmars.so with absolute path
-
-	
- 2004/05/07: Javier Rico
-   * programs/pedvsslices.cc
-     - added
-
-	
- 2004/05/05: Ester Aliu
-   * library/MPSFFitCalc.cc library/MSrcRotate.cc
-     - change some mathematical functions to root equivalents 
-
-   * library/MIslands.[h,cc], library/MIslandCalc.[h,cc],
-    library/MIslandClean.[h,cc]
-     - added
-
-   * library/Makefile, library/IFAELinkDef.h
-     - add MIslands, MIslandCalc, MIslandClean
- 
- 2004/05/05: Javier Lopez
-   * library/MFHVNotNominal.[h,cc]
-     - filter to flag events(pixels) with non nominal hv
- 
-   * macros/hvnotnominal.C
-     - macro to test MFHVNotNominal filter
-
- 2004/05/05: Javier Rico
-   * library/MSrcTranslate.[h,cc]
-     - added
-
-   * library/Makefile, library/IFAELinkDef.h
-     - add MSrcTranslate
-
-   * library/MSrcRotate.[h.cc]
-     - adapted to changes in MObservatory and MAstro
-   
-   * programs/falseSource.cc programs/falsesource.datacard 
-     programs/srcPos.cc programs/srcpos.datacard
-     - added
-
-   * programs/Makefile
-     - add falseSource and srcPos
-
-   * macros/signal.C macros/signalPoint.C
-     - added
-	
- 2004/05/03: Javier Rico
-   * makeHillas.cc
-     - put back Jobs for pedestal and calibration parts
-
-   * .rootrc
-     - added
-
- 2004/05/03: Javier Rico
-   * library,programs,macros,*:
-     - new directories added
-     - directory macros contains macros (.C) and scripts (.sh)
-     - directory programs contains root compilables and associated
-       [input] files
-     - directory library contains routines to be linked with libmars.so
-	
- 2004/04/30: Javier López
-   * alpha_plot.C
-     - macro to display hillas disttributions with corrected 
-       miss pointing
-
-   * srcPosRun.sh
-     - Script to produce the file with the positions of UMa51 using 
-       psffit executable
-
-   * MSrcPosFromFile.[h,cc]
-     - Tool to correct the position of the source for on and off data 
-       from a file
- 
-   * psffit.C & psffit.cc
-     - Macro and executable to calculate the mean position of a star.
-
-   * MPSFFit.[h,cc] & MPSFFitCalc.[h,cc]
-     - Container and taks to do calculation of the psf and position of 
-       stars.
-
- 2004/04/28: Javier Rico
-   * makeHillas.cc, makehillas.datacard
-     - Use MJPedestal and MJCalibration and simplified datacard
-
-   * Makefile
-     - include mjobs
-
-	
- 2004/04/28: Javier Rico
-   * mifae/Changelog
-     - Added. Next changes in directory mifae will be reported 
-       exclusively in here
-
-	
- 2004/04/27: Javier Rico
-   * mifae
-     - Add new directory for IFAE temporal stuff
-	
-   * mifae/Makefile,IFAEIncl.h,IFAELinkDef.h
-     - Add basic stuff to run the directory
-	
-   * mifae/MDCA.[h,cc]
-     - Add Commichau & Starks's MDCA (provisional)
-
-   * mifae/makeHillas.cc,makehillas.datacard
-     - Add program to generate hillas parameters' file
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MDispParameters.cc
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MDispParameters.cc	(revision 7136)
+++ 	(revision )
@@ -1,129 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Eva Domingo,     12/2004 <mailto:domingo@ifae.es>
-!              Wolfgang Wittek, 12/2004 <mailto:wittek@mppmu.mpg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2005
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-//   MDispParameters                                                       //
-//                                                                         //
-//   this is the container for the Disp parameters                         //
-//                                                                         //
-/////////////////////////////////////////////////////////////////////////////
-#include "MDispParameters.h"
-
-#include <math.h>
-#include <fstream>
-
-#include <TArrayD.h>
-
-#include "MImageParDisp.h"
-
-#include "MParList.h"
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-
-ClassImp(MDispParameters);
-
-using namespace std;
-
-// --------------------------------------------------------------------------
-//
-// constructor
-//
-MDispParameters::MDispParameters(const char *name, const char *title)
-{
-    fName  = name  ? name  : "MDispParameters";
-    fTitle = title ? title : "Container for the Disp parameters";
-}
-
-
-// --------------------------------------------------------------------------
-//
-// set default values for the Disp parameters
-//
-void MDispParameters::InitParameters()
-{
-    //---------------------------------------------------
-    //  these are the default values
-
-    fParameters[0] =  0.93227;
-    fParameters[1] =  0.187132;
-    fParameters[2] = -0.192808;
-    fParameters[3] =  0.0350143;
-    fParameters[4] = -0.0110078;
-
-
-    //---------------------------------------------------
-    // fStepsizes 
-    // if == 0.0    the parameter will be fixed in the minimization
-    //    != 0.0    initial step sizes for the parameters
-
-    fStepsizes[0] = 0.010;
-    fStepsizes[1] = 0.002;
-    fStepsizes[2] = 0.002;
-    fStepsizes[3] = 0.0004;
-    fStepsizes[4] = 0.0001;
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Set the parameter values from the array 'd'
-//
-//
-Bool_t MDispParameters::SetParameters(const TArrayD &d)
-{
-    if (d.GetSize() != fParameters.GetSize())
-    {
-        *fLog << err << "Sizes of d and of fParameters are different : "
-              << d.GetSize() << ",  " << fParameters.GetSize() << endl;
-        return kFALSE;
-    }
-
-    fParameters = d;
-
-    return kTRUE;
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Set the step sizes from the array 'd'
-//
-//
-Bool_t MDispParameters::SetStepsizes(const TArrayD &d)
-{
-    if (d.GetSize() != fStepsizes.GetSize())
-    {
-        *fLog << err << "Sizes of d and of fStepsizes are different : "
-              << d.GetSize() << ",  " << fStepsizes.GetSize() << endl;
-        return kFALSE;
-    }
-
-    fStepsizes = d;
-
-    return kTRUE;
-}
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MDispParameters.h
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MDispParameters.h	(revision 7136)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#ifndef MARS_MDispParameters
-#define MARS_MDispParameters
-
-#ifndef MARS_MParContainer
-#include "MParContainer.h"
-#endif
-
-#ifndef ROOT_TArrayD
-#include <TArrayD.h>
-#endif
-
-class MDispParameters : public MParContainer
-{
-private:
-
-    TArrayD fParameters;      // Disp parameters
-    TArrayD fStepsizes;       //! step sizes of Disp parameters
-
-
-public:
-
-    MDispParameters(const char *name=NULL, const char *title=NULL);
-
-    void InitParameters();
-
-    Bool_t SetParameters(const TArrayD &d);
-    Bool_t SetStepsizes(const TArrayD &d);
-
-    void SetVariables(const TArrayD &d)    { SetParameters(d); }
- 
-    TArrayD &GetParameters() { return fParameters; }
-    TArrayD &GetStepsizes()  { return fStepsizes;  }
-
-    ClassDef(MDispParameters, 1) // Container for the Disp parameters
-};
-
-#endif
-
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MDisplay.cc	(revision 7136)
+++ 	(revision )
@@ -1,176 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!   Author(s): Javier Rico     05/2004 <mailto:jrico@ifae.es>
-!
-!   Copyright: MAGIC Software Development, 2000-2004
-!
-!
-\* ======================================================================== */
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// MDisplay
-//
-// Class to display camera events (MCamEvent)
-// You can set an event-by-event display with pause between two consecutive 
-// events. You can set an output PS file.
-//
-// Input containers (to be provided to the constructor):
-//
-//  MCamEvent
-//  MGeomCam
-//
-// Output containers:
-//
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#include <fstream>
-#include <math.h>
-
-#include "TCanvas.h"
-#include "TPostScript.h"
-
-#include "MParList.h"
-#include "MDisplay.h"
-#include "MCamEvent.h"
-#include "MGeomCam.h"
-#include "MHCamera.h"
-#include "MRawRunHeader.h"
-#include "MRawEvtHeader.h"
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-ClassImp(MDisplay);
-
-using namespace std;
-
-static const TString gsDefName       = "MDisplay";
-static const TString gsDefTitle      = "Camera display task";
-static const TString gsDefPSFileName = "display.ps";
-
-// -------------------------------------------------------------------------
-//
-// Constructor. Need to provide the MCamEvent container to be displayed <event>
-// and camera geometry <geom>. Also the display type <type> can be specified
-// (see the MHCamera documentation for more details)
-//
-MDisplay::MDisplay(MCamEvent* event, MGeomCam* geom, Int_t type, const char* name, const char* title) 
-  :  fGeomCam(geom), fCamEvent(event),  fCanvas(NULL), fPSFile(NULL), fDisplayType(type), fCreatePSFile(kFALSE), fPause(kTRUE)
-{
-  fName  = name  ? name  : gsDefName.Data();
-  fTitle = title ? title : gsDefTitle.Data();
-
-  fDisplay = new MHCamera(*geom);
-  fDisplay->SetPrettyPalette();
-  
-  fPSFileName = gsDefPSFileName;
-}
-// -------------------------------------------------------------------------
-//
-// Destructor
-//
-MDisplay::~MDisplay()
-{
-  delete fDisplay;
-  if(fCanvas)
-    delete fCanvas;
-  if(fPSFile)
-    delete fPSFile;
-}
-
-// -------------------------------------------------------------------------
-//
-// Create the canvas, eventually set the batch mode and open ps file
-//
-Int_t MDisplay::PreProcess(MParList* pList)
-{ 
-  fCanvas = new TCanvas("myCanvas","Event Display",600,600);
-  if(fCreatePSFile) 
-    fPSFile = new TPostScript(fPSFileName,111);
-  if(!fPause)
-    fCanvas->SetBatch();
-  fCanvas->cd(1);
-  fDisplay->Draw();
-
-  //look for the run and event headers
-  fEvtHeader = (MRawEvtHeader*)pList->FindObject("MRawEvtHeader");
-  if (!fEvtHeader)
-    {
-      *fLog << err << "MRawEvtHeader not found... aborting." << endl;
-      return kFALSE;
-    }
-  
-  fRunHeader = (MRawRunHeader*)pList->FindObject(AddSerialNumber("MRawRunHeader"));
-  if (!fRunHeader)
-    {
-      *fLog << err << AddSerialNumber("MRawRunHeader") << " not found... aborting." << endl;
-      return kFALSE;
-    }
-
-  return kTRUE;
-}
-
-// -------------------------------------------------------------------------
-//
-// Set the new containt of the camera event and update the display.
-// Set new page if ps file is requested
-// Pause execution if event-by-event display is chosen
-//
-Int_t MDisplay::Process()
-{  
-  // new page in ps file
-  if(fPSFile)
-    fPSFile->NewPage();
-
-  // update the display contents
-  fDisplay->SetCamContent(*fCamEvent,fDisplayType);
-  fCanvas->GetPad(1)->Modified();
-  fCanvas->GetPad(1)->Update();
-  
-  *fLog << all << "Run: " << fRunHeader->GetRunNumber() << ", Event: " << fEvtHeader->GetDAQEvtNumber() << endl;
-
-  // pause execution
-  if(fPause)
-    {
-      cout << "Type 'q' to exit, 'p' to print event into ps file, <return> to go on: ";      
-      TString input;
-      input =cin.get(); 
-      
-      if (input=='q')
-	return kFALSE;
-      if(input=='p')
-	{
-	  Char_t psfile[200];
-	  sprintf(psfile,"Run%06dEvent%07d.ps", fRunHeader->GetRunNumber(), fEvtHeader->GetDAQEvtNumber());
-	  fCanvas->Print(psfile);
-	}
-    }
-
-  return kTRUE;
-}
-
-// -------------------------------------------------------------------------
-//
-// Close ps file if it was open
-//
-Int_t MDisplay::PostProcess()
-{
-  if(fPSFile) fPSFile->Close();
-  return kTRUE;
-}
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MDisplay.h
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MDisplay.h	(revision 7136)
+++ 	(revision )
@@ -1,57 +1,0 @@
-#ifndef MARS_MDisplay
-#define MARS_MDisplay
-
-#ifndef MARS_MTask
-#include "MTask.h"
-#endif
-
-class MRawRunHeader;
-class MRawEvtHeader;
-class MHCamera;
-class MCamEvent;
-class MGeomCam;
-class TCanvas;
-class TPostScript;
-
-class MDisplay : public MTask
-{
- private:
-  MRawEvtHeader*  fEvtHeader;    // event header
-  MRawRunHeader*  fRunHeader;    // run header
-  MHCamera*       fDisplay;      // pointer to the camera display
-  MGeomCam*       fGeomCam;      // pointer to the camera geometry
-  MCamEvent*      fCamEvent;     // pointer to camera event
-  TCanvas*        fCanvas;       // pointer to the canvas
-  TPostScript*    fPSFile;       // pointer to ps file
-  TString         fPSFileName;   // name for ps file
-  Int_t           fDisplayType;  // display type (see MHCamera)
-  Bool_t          fCreatePSFile; // flag to produce a ps file with events
-  Bool_t          fPause;        // flag to pause execution between events
-  
-
-  virtual Int_t PostProcess();
-
- protected:
-  virtual Int_t PreProcess(MParList *plist);  
-  virtual Int_t Process();
-
- public:
-  MDisplay(MCamEvent* event, MGeomCam* geom, Int_t type=0, const char* name=NULL, const char* title=NULL);
-  virtual ~MDisplay();
-
-  virtual void Paint(Option_t* option)     {};
-
-  MGeomCam*    GetGeomCam()                {return fGeomCam;}
-  Bool_t       GetPauseMode()              {return fPause;}
-  Bool_t       GetCreatePSFile()           {return fCreatePSFile;}
-
-  void         SetDisplayType(Int_t type)  {fDisplayType=type;}
-  void         SetPSFile(Bool_t set=kTRUE) {fCreatePSFile=set;}
-  void         SetPSFileName(TString name) {fPSFileName=name;}
-  void         SetPause(Bool_t set=kTRUE)  {fPause=set;}
-
-  ClassDef(MDisplay, 0) // Task to display camera containers
-};
-
-#endif
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MFDisp.cc
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MFDisp.cc	(revision 7136)
+++ 	(revision )
@@ -1,299 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Eva Domingo,     12/2004 <mailto:domingo@ifae.es> 
-!              Wolfgang Wittek, 12/2004 <mailto:wittek@mppmu.mpg.de>
-!
-!
-!   Copyright: MAGIC Software Development, 2000-2005
-!
-!
-\* ======================================================================== */
-
-//////////////////////////////////////////////////////////////////////////////
-//                                                                          //
-//  MFDisp                                                                  //
-//                                                                          //
-//  This is a class to set cuts to select an event sample                   //
-//  for the Disp optimization                                               //
-//                                                                          //
-//                                                                          //
-//////////////////////////////////////////////////////////////////////////////
-
-#include "MFDisp.h"
-
-#include "MGeomCam.h"
-#include "MHillas.h"
-#include "MHillasSrc.h"
-#include "MImagePar.h"
-#include "MNewImagePar.h"
-
-#include "MParList.h"
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-
-ClassImp(MFDisp);
-
-using namespace std;
-
-// --------------------------------------------------------------------------
-//
-// Default constructor.
-//
-MFDisp::MFDisp(const char *name, const char *title)
-{
-    fName  = name  ? name  : "MFDisp";
-    fTitle = title ? title : "Cuts for Disp optimization";
-
-    // default values of cuts
-    SetCuts(0, 1000,   0, 1000,   0, 1000, 
-            0.0, 1.e10,  0.0, 1.0,  0.0, 1.0,   0.0, 0.0);
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Set the values for the cuts 
-// 
-void MFDisp::SetCuts(Int_t islandsmin,      Int_t islandsmax,
-                     Int_t usedpixelsmin,   Int_t usedpixelsmax, 
-                     Int_t corepixelsmin,   Int_t corepixelsmax,
-                     Float_t sizemin,       Float_t sizemax,
-                     Float_t leakage1min,   Float_t leakage1max,
-                     Float_t leakage2min,   Float_t leakage2max,
-                     Float_t lengthmin,     Float_t widthmin)
-{ 
-  fIslandsMin    = islandsmin;
-  fIslandsMax    = islandsmax;
-
-  fUsedPixelsMin = usedpixelsmin;
-  fUsedPixelsMax = usedpixelsmax;
-
-  fCorePixelsMin = corepixelsmin;
-  fCorePixelsMax = corepixelsmax;
-
-  fSizeMin       = sizemin;
-  fSizeMax       = sizemax;
-
-  fLeakage1Min   = leakage1min;
-  fLeakage1Max   = leakage1max;
-
-  fLeakage2Min   = leakage2min;
-  fLeakage2Max   = leakage2max;
-
-  fLengthMin     = lengthmin;
-  fWidthMin      = widthmin;
-}
-
-
-// --------------------------------------------------------------------------
-//
-Int_t MFDisp::PreProcess(MParList *pList)
-{
-    MGeomCam *cam = (MGeomCam*)pList->FindObject("MGeomCam");
-    if (!cam)
-    {
-        *fLog << err << "MGeomCam (Camera Geometry) not found... aborting." << endl;
-        return kFALSE;
-    }
-
-    fMm2Deg = cam->GetConvMm2Deg();
-
-
-    fHil = (MHillas*)pList->FindObject("MHillas");
-    if (!fHil)
-    {
-        *fLog << err << "MHillas not found... aborting." << endl;
-        return kFALSE;
-    }
-
-    fHilSrc = (MHillasSrc*)pList->FindObject("MHillasSrc");
-    if (!fHilSrc)
-    {
-        *fLog << err << "MHillasSrc not found... aborting." << endl;
-        return kFALSE;
-    }
-
-    fImgPar = (MImagePar*)pList->FindObject("MImagePar");
-    if (!fImgPar)
-    {
-        *fLog << err << "MImagePar not found... aborting." << endl;
-        return kFALSE;
-    }
-
-    fNewImgPar = (MNewImagePar*)pList->FindObject("MNewImagePar");
-    if (!fNewImgPar)
-    {
-        *fLog << err << "MNewImagePar not found... aborting." << endl;
-        return kFALSE;
-    }
-
-
-    memset(fCut, 0, sizeof(fCut));
-
-
-    //--------------------
-    *fLog << inf << "MFDisp cut values :" << endl; 
-
-    *fLog << inf << "     fIslandsMin, fIslandsMax = "
-          << fIslandsMin << ",  " << fIslandsMax << endl;
-
-    *fLog << inf << "     fUsedPixelsMin, fUsedPixelsMax = "
-          << fUsedPixelsMin << ",  " << fUsedPixelsMax << endl;
-
-    *fLog << inf << "     fCorePixelsMin, fCorePixelsMax = "
-          << fCorePixelsMin << ",  " << fCorePixelsMax << endl;
-
-    *fLog << inf << "     fSizeMin, fSizeMax = " 
-          << fSizeMin << ",  " << fSizeMax << endl;
-
-    *fLog << inf << "     fLeakage1Min, fLeakage1Max = " 
-          << fLeakage1Min << ",  " << fLeakage1Max << endl;
-
-    *fLog << inf << "     fLeakage2Min, fLeakage2Max = " 
-          << fLeakage2Min << ",  " << fLeakage2Max << endl;
-
-    *fLog << inf << "     fLengthMin, fWidthMin = " 
-          << fLengthMin << ",  " << fWidthMin << endl;
-    //--------------------
-
-    return kTRUE;
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Sum up the number of events passing each cut
-//
-Bool_t MFDisp::Set(Int_t rc)
-{
-    fResult = kTRUE;
-    fCut[rc]++;
-    return kTRUE;
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Evaluate cuts for Disp optimization
-// if selections are fulfilled set fResult = kTRUE;
-// 
-Int_t MFDisp::Process()
-{
-    const Double_t length     = fHil->GetLength() * fMm2Deg;
-    const Double_t width      = fHil->GetWidth()  * fMm2Deg;
-    //const Double_t dist       = fHilSrc->GetDist()* fMm2Deg;
-    //const Double_t delta      = fHil->GetDelta()  * kRad2Deg;
-    const Double_t size       = fHil->GetSize();
-
-    const Double_t leakage1   = fNewImgPar->GetLeakage1();
-    const Double_t leakage2   = fNewImgPar->GetLeakage2();
-
-    const Int_t numusedpixels = fNewImgPar->GetNumUsedPixels();
-    const Int_t numcorepixels = fNewImgPar->GetNumCorePixels();
-    const Int_t numislands    = fImgPar->GetNumIslands();
-
-    fResult = kFALSE;
-
-    if  (numislands<fIslandsMin  || numislands>fIslandsMax )
-        return Set(1);
-
-    if  (numusedpixels<fUsedPixelsMin  || numusedpixels>fUsedPixelsMax )
-        return Set(2);
-
-    if  (numcorepixels<fCorePixelsMin  || numcorepixels>fCorePixelsMax )
-        return Set(3);
-
-    if (size<fSizeMin  ||  size>fSizeMax)
-        return Set(4);
-
-    if (leakage1<fLeakage1Min || leakage1>fLeakage1Max)
-        return Set(5);
-
-    if (leakage2<fLeakage2Min || leakage2>fLeakage2Max)
-        return Set(6);
-
-    if (length<fLengthMin || width<fWidthMin)
-        return Set(7);
-
-    fCut[0]++;
-    return kTRUE;
-}
-
-
-// --------------------------------------------------------------------------
-//
-//  Prints some statistics about the cuts selections
-//
-Int_t MFDisp::PostProcess()
-{
-    if (GetNumExecutions()==0)
-        return kTRUE;
-
-    *fLog << inf << endl;
-    *fLog << GetDescriptor() << " execution statistics:" << endl;
-
-    *fLog << dec << setfill(' ');
-    *fLog << " " << setw(7) << fCut[1] << " (" << setw(3);
-    *fLog << (int)(fCut[1]*100/GetNumExecutions()+0.5) ;
-    *fLog << "%) Evts skipped due to: No.of islands < " << fIslandsMin ;
-    *fLog << " or > " << fIslandsMax << endl;
-
-    *fLog << " " << setw(7) << fCut[2] << " (" << setw(3);
-    *fLog << (int)(fCut[2]*100/GetNumExecutions()+0.5) ;
-    *fLog << "%) Evts skipped due to: No.of used pixels < " << fUsedPixelsMin ;
-    *fLog << " or > " << fUsedPixelsMax << endl;
-
-    *fLog << " " << setw(7) << fCut[3] << " (" << setw(3);
-    *fLog << (int)(fCut[3]*100/GetNumExecutions()+0.5) ;
-    *fLog << "%) Evts skipped due to: No.of core pixels < " << fCorePixelsMin ;
-    *fLog << " or > " << fCorePixelsMax << endl;
-
-    *fLog << " " << setw(7) << fCut[4] << " (" << setw(3) ;
-    *fLog << (int)(fCut[4]*100/GetNumExecutions()+0.5) ;
-    *fLog << "%) Evts skipped due to: SIZE < " << fSizeMin;
-    *fLog << " or > " << fSizeMax << endl;
-
-    *fLog << " " << setw(7) << fCut[5] << " (" << setw(3) ;
-    *fLog << (int)(fCut[5]*100/GetNumExecutions()+0.5) ;
-    *fLog << "%) Evts skipped due to: Leakage1 < " << fLeakage1Min;
-    *fLog << " or > " << fLeakage1Max << endl;
-
-    *fLog << " " << setw(7) << fCut[6] << " (" << setw(3) ;
-    *fLog << (int)(fCut[6]*100/GetNumExecutions()+0.5) ;
-    *fLog << "%) Evts skipped due to: Leakage2 < " << fLeakage2Min;
-    *fLog << " or > " << fLeakage2Max << endl;
-
-    *fLog << " " << setw(7) << fCut[7] << " (" << setw(3) ;
-    *fLog << (int)(fCut[7]*100/GetNumExecutions()+0.5) ;
-    *fLog << "%) Evts skipped due to: LENGTH <= " << fLengthMin;
-    *fLog << " or WIDTH <= " << fWidthMin << endl;
-
-    *fLog << " " << fCut[0] << " (" ;
-    *fLog << (int)(fCut[0]*100/GetNumExecutions()+0.5) ;
-    *fLog << "%) Evts survived the Disp cuts!" << endl;
-    *fLog << endl;
-
-    return kTRUE;
-}
-
-
-
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MFDisp.h
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MFDisp.h	(revision 7136)
+++ 	(revision )
@@ -1,90 +1,0 @@
-#ifndef MARS_MFDisp
-#define MARS_MFDisp
-
-#ifndef MARS_MFilter
-#include "MFilter.h"
-#endif
-
-class MHillas;
-class MHillasSrc;
-class MImagePar;
-class MNewImagePar;
-
-class MFDisp : public MFilter
-{
-private:
-
-    MHillas      *fHil;
-    MHillasSrc   *fHilSrc;
-    MImagePar    *fImgPar;
-    MNewImagePar *fNewImgPar;
-
-    //--------------------------    
-
-    // cutting variables to select the sample
-    // for the Disp optimization
-
-    Int_t      fIslandsMin;
-    Int_t      fIslandsMax;
-
-    Int_t      fUsedPixelsMin;
-    Int_t      fUsedPixelsMax;
-
-    Int_t      fCorePixelsMin;
-    Int_t      fCorePixelsMax;
-
-    Float_t      fSizeMin;
-    Float_t      fSizeMax;
-
-    Float_t      fLeakage1Min;
-    Float_t      fLeakage1Max;
-
-    Float_t      fLeakage2Min;
-    Float_t      fLeakage2Max;
-
-    Float_t      fLengthMin;
-    Float_t      fWidthMin;
-
-    //--------------------------    
-
-    Double_t     fMm2Deg;     // conversion mm to degrees in camera
-
-    Int_t        fCut[8];     // array to save cuts statistics
-
-    Bool_t       fResult;
-
-    Int_t PreProcess(MParList *pList);
-    Int_t Process();
-    Int_t PostProcess();
-
-    Bool_t IsExpressionTrue() const  { return fResult; }
-
-    Bool_t Set(Int_t rc);
-
-public:
-
-    MFDisp(const char *name=NULL, const char *title=NULL);
-
-    void SetCuts(Int_t islandsmin,      Int_t islandsmax,
-                 Int_t usedpixelsmin,   Int_t usedpixelsmax,
-                 Int_t corepixelsmin,   Int_t corepixelsmax,
-                 Float_t sizemin,       Float_t sizemax, 
-                 Float_t leakage1min,   Float_t leakage1max,
-                 Float_t leakage2min,   Float_t leakage2max,
-                 Float_t lengthmin,     Float_t widthmin);
-
-    ClassDef(MFDisp, 0)   // Class to set cuts for Disp optimization
-};
-
-#endif
-
-
-
-
-
-
-
-
-
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MFindDisp.cc
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MFindDisp.cc	(revision 7136)
+++ 	(revision )
@@ -1,1158 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Eva Domingo,     12/2004 <mailto:domingo@ifae.es>
-!              Wolfgang Wittek, 12/2004 <mailto:wittek@mppmu.mpg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2005
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-// MFindDisp                                                               //
-//                                                                         //
-// Class for otimizing the estimation of Disp                              //
-//                                                                         //
-//                                                                         //
-//                                                                         //
-/////////////////////////////////////////////////////////////////////////////
-#include "MFindDisp.h"
-
-#include <math.h>            // fabs 
-
-#include <TArrayD.h>
-#include <TCanvas.h>
-#include <TFile.h>
-#include <TH1.h>
-#include <TH2.h>
-#include <TMinuit.h>
-#include <TStopwatch.h>
-#include <TVirtualFitter.h>
-
-#include "MBinning.h"
-#include "MContinue.h"
-#include "MDispParameters.h"
-#include "MDispCalc.h"
-#include "MDataElement.h"
-#include "MDataMember.h"
-
-#include "MEvtLoop.h"
-#include "MFSelFinal.h"
-#include "MF.h"
-#include "MFDisp.h"
-#include "MFEventSelector.h"
-#include "MFEventSelector2.h"
-#include "MFillH.h"
-#include "MFEventSelector.h"
-#include "MGeomCamMagic.h"
-#include "MH3.h"
-#include "MHDisp.h"
-#include "MHFindSignificance.h"
-#include "MHMatrix.h"
-#include "MHOnSubtraction.h"
-
-#include "MLog.h"
-#include "MLogManip.h"
-#include "MMatrixLoop.h"
-#include "MMinuitInterface.h"
-#include "MParameters.h"
-#include "MParList.h"
-#include "MProgressBar.h"
-#include "MReadMarsFile.h"
-#include "MReadTree.h"
-#include "MStatusDisplay.h"
-#include "MTaskList.h"
-
-
-ClassImp(MFindDisp);
-
-using namespace std;
-
-
-//------------------------------------------------------------------------
-// fcnDisp 
-//------------------------------------------------------------------------
-//
-// - calculates the quantity to be minimized (by TMinuit)
-//
-// - the quantity to be minimized is defined in 
-//   MHDisp::Fill() and MHDisp::Finalize()
-//
-// - the parameters to be varied in the minimization are the parameters
-//   appearing in the parametrization of Disp (MDispCalc::Calc())
-//
-//------------------------------------------------------------------------
-
-static void fcnDisp(Int_t &npar, Double_t *gin, Double_t &f, 
-                    Double_t *par, Int_t iflag)
-{
-    cout <<  "entry fcnDisp" << endl;
-
-    // save pointer to the MINUIT object (for optimizing Disp) for the case
-    // that it is overwritten by the pointer to another Minuit object
-    //    TMinuit *savePointer = gMinuit;
-    //-------------------------------------------------------------
-
-
-    MEvtLoop *evtloopfcn = (MEvtLoop*)gMinuit->GetObjectFit();
-
-    MParList *plistfcn   = (MParList*)evtloopfcn->GetParList();
-    MTaskList *tasklistfcn   = (MTaskList*)plistfcn->FindObject("MTaskList");
-
-    // get needed Disp containers from the existing parList
-    MDispParameters *dispparams = (MDispParameters*)plistfcn->FindObject("MDispParameters");
-    if (!dispparams)
-    {
-        gLog << "fcnDisp : MDispParameters object '" << "MDispParameters"
-            << "' not found... aborting" << endl;
-        return;
-    }
-
-    MHDisp *hdisp = (MHDisp*)plistfcn->FindObject("MHDisp");
-    if (!hdisp)
-    {
-        gLog << "fcnDisp : MHDisp object '" << "MHDisp"
-            << "' not found... aborting" << endl;
-        return;
-    }
-
-    MParameterD *minpar = (MParameterD*)plistfcn->FindObject("MinimizationParameter");
-
-    //
-    // transfer current parameter values to MDispParameters
-    //
-    // Attention : npar is the number of variable parameters
-    //                  not the total number of parameters
-    //
-    Double_t fMin,   fEdm,   fErrdef;
-    Int_t    fNpari, fNparx, fIstat;
-    gMinuit->mnstat(fMin, fEdm, fErrdef, fNpari, fNparx, fIstat);
-
-    dispparams->SetParameters(TArrayD(fNparx, par));
-
-    // checking that parameters have been properly set
-    TArrayD checkparameters = dispparams->GetParameters();
-    gLog << "fcnDisp : fNpari, fNparx =" << fNpari << ",  " 
-         << fNparx  << endl;
-    gLog << "fcnDisp : i, par, checkparameters =" << endl;
-    for (Int_t i=0; i<fNparx; i++)
-    {
-      gLog << i << ",  " << par[i] << ",  " << checkparameters[i] << endl;
-    }
-
-    //
-    // loop over the events in the training matrices to compute the parameter 
-    // to minimize for the current Disp parameter values
-    evtloopfcn->Eventloop();
-
-    tasklistfcn->PrintStatistics(0, kTRUE);
-
-    //-------------------------------------------
-    // get the Minimization parameter value for the current values 
-    // of the Disp parameters
-    if (minpar)
-      f = minpar->GetVal();
-    else
-    {
-      gLog << "fcnDisp : MParameterD object '" << "MinimizationParameter"
-	   << "' not found... aborting" << endl;
-      return;
-    }
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Default constructor.
-//
-MFindDisp::MFindDisp(MFDisp *fdisp, const char *name, const char *title)
-  : fHowManyTrain(10000), fHowManyTest(10000)
-{
-    fName  = name  ? name  : "MFindDisp";
-    fTitle = title ? title : "Optimizer of Disp";
-
-    //---------------------------
-    // camera geometry is needed for conversion mm ==> degree
-    fCam = new MGeomCamMagic; 
-
-    // initialize MFDisp filter cuts to default (no cutting) values
-    // (done at MFDisp constructor)
-    fDispFilter = fdisp;
-
-    // matrices to contain the training/test samples
-    fMatrixTrainCalc  = new MHMatrix("MatrixTrainCalc");
-    fMatrixTrainHists = new MHMatrix("MatrixTrainHists");
-    fMatrixTestCalc   = new MHMatrix("MatrixTestCalc");
-    fMatrixTestHists  = new MHMatrix("MatrixTestHists");
-
-    // objects of MDispCalc where the first part of the matrices mapping is defined
-    fDispCalcTrain = new MDispCalc("DispTrain","MDispParameters");
-    fDispCalcTest  = new MDispCalc("DispTest","MDispParametersTest");
-
-    // objects of MHDisp where the second part of the matrices mapping is defined
-    fHDispTrain = new MHDisp("DispTrain");
-    fHDispTest  = new MHDisp("DispTest");
-
-    // define columns of matrices
-    // Train matrix
-    fDispCalcTrain->InitMapping(fMatrixTrainCalc);
-    fHDispTrain->InitMapping(fMatrixTrainHists);
-    // Test matrix
-    fDispCalcTest->InitMapping(fMatrixTestCalc);
-    fHDispTest->InitMapping(fMatrixTestHists);
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Default destructor.
-//
-MFindDisp::~MFindDisp()
-{
-    delete fCam;
-    delete fMatrixTrainCalc;
-    delete fMatrixTrainHists;
-    delete fMatrixTestCalc;
-    delete fMatrixTestHists;
-    delete fDispCalcTrain;
-    delete fDispCalcTest;
-    delete fHDispTrain;
-    delete fHDispTest;
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Define the matrices 'fMatrixTrainCalc' and 'fMatrixTrainHists' 
-// for the TRAINING sample
-//
-// alltogether 'howmanytrain' events are read from file 'nametrain';
-// the events are selected according to a target distribution 'hreftrain'
-//
-//
-Bool_t MFindDisp::DefineTrainMatrix(
-			  const TString &nametrain, MH3 &hreftrain, 
-			  const Int_t howmanytrain, const TString &filetrain, 
-			  Int_t iflag)
-{
-    if (nametrain.IsNull() || howmanytrain <= 0)
-        return kFALSE;
-
-    *fLog   << "=============================================" << endl;
-    *fLog   << "Fill TRAINING Matrices from file '" << nametrain << endl;
-    *fLog   << "     select " << howmanytrain << " events " << endl;
-    if (!hreftrain.GetHist().GetEntries()==0)
-    {
-      *fLog << "     according to a distribution given by the MH3 object '"
-            << hreftrain.GetName() << "'" << endl;
-    }
-    else
-    {
-      *fLog << "     randomly" << endl;
-    }
-    *fLog   << "=============================================" << endl;
-
-
-    MParList  plist;
-    MTaskList tlist;
-
-    // initialize display to check the reference distribution
-    // for the event selection (just if iflag==1)
-    MStatusDisplay *display = NULL;
-    if (iflag)
-      display = new MStatusDisplay;
-
-    MReadMarsFile read("Events", nametrain);
-    read.DisableAutoScheme();
-
-    // apply cuts for event selection
-    MContinue contdisp(fDispFilter);
-    contdisp.SetName("ContFilterSelector2");
-
-    // choose a reference distribution
-    MFEventSelector2 seltrain(hreftrain);
-    seltrain.SetNumMax(howmanytrain);
-    seltrain.SetName("selectTrain");
-
-    MFillH filltraincalc(fMatrixTrainCalc);
-    filltraincalc.SetFilter(&seltrain);
-    filltraincalc.SetName("fillMatrixTrainCalc");
-
-    MFillH filltrainhists(fMatrixTrainHists);
-    filltrainhists.SetFilter(&seltrain);
-    filltrainhists.SetName("fillMatrixTrainHists");
-
-    //******************************
-    // entries in MParList 
-    
-    plist.AddToList(&tlist);
-    plist.AddToList(fCam);
-    plist.AddToList(fMatrixTrainCalc);
-    plist.AddToList(fMatrixTrainHists);
-
-    //******************************
-    // entries in MTaskList 
-
-    tlist.AddToList(&read);
-    if (fDispFilter != NULL)
-      tlist.AddToList(&contdisp);
-    tlist.AddToList(&seltrain);
-    tlist.AddToList(&filltraincalc);
-    tlist.AddToList(&filltrainhists);
-
-    //******************************
-
-    MProgressBar bar;
-    MEvtLoop evtloop;
-    if (display != NULL)
-      evtloop.SetDisplay(display);
-    evtloop.SetParList(&plist);
-    evtloop.SetName("EvtLoopMatrixTrain");
-    evtloop.SetProgressBar(&bar);
-
-    if (!evtloop.Eventloop())
-      return kFALSE;
-
-    tlist.PrintStatistics(0, kTRUE);
-
-
-    // print the filled Training Matrices
-    fMatrixTrainCalc->Print("SizeCols");
-    fMatrixTrainHists->Print("SizeCols");
-
-    // check that number of generated events is compatible with the resquested
-    Int_t howmanygeneratedcalc = fMatrixTrainCalc->GetM().GetNrows();
-    if (TMath::Abs(howmanygeneratedcalc-howmanytrain) > TMath::Sqrt(9.*howmanytrain))
-    {
-      *fLog << "MFindDisp::DefineTrainMatrix; no.of generated events ("
-	    << howmanygeneratedcalc 
-            << ") is incompatible with the no.of requested events ("
-            << howmanytrain << ")" << endl;
-    }
-
-    Int_t howmanygeneratedhists = fMatrixTrainHists->GetM().GetNrows();
-    if (TMath::Abs(howmanygeneratedhists-howmanytrain) > TMath::Sqrt(9.*howmanytrain))
-    {
-      *fLog << "MFindDisp::DefineTrainMatrix; no.of generated events ("
-	    << howmanygeneratedhists 
-            << ") is incompatible with the no.of requested events ("
-            << howmanytrain << ")" << endl;
-    }
-
-
-    *fLog << "TRAINING Matrices were filled" << endl;
-    *fLog << "=============================================" << endl;
-
-
-    //--------------------------
-    // write out training matrices
-
-    if (filetrain != "")
-    {
-      TFile filetr(filetrain, "RECREATE");
-      fMatrixTrainCalc->Write();
-      fMatrixTrainHists->Write();
-      filetr.Close();
-
-      *fLog << "MFindDisp::DefineTrainMatrix; Training matrices were written onto file '"
-            << filetrain << "'" << endl;
-    }
-
-
-    if (display != NULL)
-      delete display;
-
-    return kTRUE;
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Define the matrices 'fMatrixTestCalc' and 'fMatrixTestHists' 
-// for the TEST sample
-//
-// alltogether 'howmanytest' events are read from file 'nametest'
-// the events are selected according to a target distribution 'hreftest'
-//
-//
-Bool_t MFindDisp::DefineTestMatrix(
-			  const TString &nametest, MH3 &hreftest,
-	                  const Int_t howmanytest, const TString &filetest,
-			  Int_t iflag)
-{
-    if (nametest.IsNull() || howmanytest<=0)
-        return kFALSE;
-
-    *fLog   << "=============================================" << endl;
-    *fLog   << "Fill TEST Matrices from file '" << nametest << endl;
-    *fLog   << "     select " << howmanytest << " events " << endl;
-    if (!hreftest.GetHist().GetEntries()==0)
-    {
-      *fLog << "     according to a distribution given by the MH3 object '"
-            << hreftest.GetName() << "'" << endl;
-    }
-    else
-    {
-      *fLog << "     randomly" << endl;
-    }
-
-
-    MParList  plist;
-    MTaskList tlist;
-
-    // initialize display to check the reference distribution
-    // for the event selection (just if iflag==1)
-    MStatusDisplay *display = NULL;
-    if (iflag)
-      display = new MStatusDisplay;
-
-    MReadMarsFile read("Events", nametest);
-    read.DisableAutoScheme();
-
-    // apply cuts for event selection
-    MContinue contdisp(fDispFilter);
-    contdisp.SetName("ContFilterSelector2");
- 
-    // choose a reference distribution 
-    MFEventSelector2 seltest(hreftest);
-    seltest.SetNumMax(howmanytest);
-    seltest.SetName("selectTest");
- 
-    MFillH filltestcalc(fMatrixTestCalc);
-    filltestcalc.SetFilter(&seltest);
-    filltestcalc.SetName("fillMatrixTestCalc");
-
-    MFillH filltesthists(fMatrixTestHists);
-    filltesthists.SetFilter(&seltest);
-    filltesthists.SetName("fillMatrixTestHists");
-
-    //******************************
-    // entries in MParList 
-    
-    plist.AddToList(&tlist);
-    plist.AddToList(fCam);
-    plist.AddToList(fMatrixTestCalc);
-    plist.AddToList(fMatrixTestHists);
-
-    //******************************
-    // entries in MTaskList 
-
-    tlist.AddToList(&read);
-    if (fDispFilter != NULL)
-      tlist.AddToList(&contdisp);
-    tlist.AddToList(&seltest);
-    tlist.AddToList(&filltestcalc);
-    tlist.AddToList(&filltesthists);
-
-    //******************************
-
-    MProgressBar bar;
-    MEvtLoop evtloop;
-    if (display != NULL)
-      evtloop.SetDisplay(display);
-    evtloop.SetParList(&plist);
-    evtloop.SetName("EvtLoopMatrixTest");
-    evtloop.SetProgressBar(&bar);
-
-    if (!evtloop.Eventloop())
-      return kFALSE;
-
-    tlist.PrintStatistics(0, kTRUE);
-
-
-    // print the filled Test Matrices
-    fMatrixTestCalc->Print("SizeCols");
-    fMatrixTestHists->Print("SizeCols");
-
-    // check that number of generated events is compatible with the resquested
-    const Int_t howmanygeneratedcalc = fMatrixTestCalc->GetM().GetNrows();
-    if (TMath::Abs(howmanygeneratedcalc-howmanytest) > TMath::Sqrt(9.*howmanytest))
-    {
-      *fLog << "MFindDisp::DefineTestMatrix; no.of generated events ("
-	    << howmanygeneratedcalc
-            << ") is incompatible with the no.of requested events ("
-            << howmanytest << ")" << endl;
-    }
-
-    const Int_t howmanygeneratedhists = fMatrixTestHists->GetM().GetNrows();
-    if (TMath::Abs(howmanygeneratedhists-howmanytest) > TMath::Sqrt(9.*howmanytest))
-    {
-      *fLog << "MFindDisp::DefineTestMatrix; no.of generated events ("
-	    << howmanygeneratedhists
-            << ") is incompatible with the no.of requested events ("
-            << howmanytest << ")" << endl;
-    }
-
-    *fLog << "TEST Matrices were filled" << endl;
-    *fLog << "=============================================" << endl;
-
-
-    //--------------------------
-    // write out test matrices
-
-    if (filetest != "")
-    {
-      TFile filete(filetest, "RECREATE");
-      fMatrixTestCalc->Write();
-      fMatrixTestHists->Write();
-      filete.Close();
-
-      *fLog << "MFindDisp::DefineTestMatrix; Test matrices were written onto file '"
-            << filetest << "'" << endl;
-    }
-
-
-    if (display != NULL)
-      delete display;
-
-    return kTRUE;
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Define the matrices for the TRAINING and TEST sample respectively
-//
-//   - this is for the case that training and test samples are generated
-//     from the same input file (which has the name 'name')
-//
-Bool_t MFindDisp::DefineTrainTestMatrix(
-			  const TString &name, MH3 &href,
-	                  const Int_t howmanytrain, const Int_t howmanytest,
-                          const TString &filetrain, const TString &filetest,
-			  Int_t iflag)
-{
-    *fLog   << "=============================================" << endl;
-    *fLog   << "Fill TRAINING and TEST Matrices from file '" << name << endl;
-    *fLog   << "     select "   << howmanytrain 
-	    << " training and " << howmanytest << " test events " << endl;
-    if (!href.GetHist().GetEntries()==0)
-    {
-      *fLog << "     according to a distribution given by the MH3 object '"
-            << href.GetName() << "'" << endl;
-    }
-    else
-    {
-      *fLog << "     randomly" << endl;
-    }
-
-
-    MParList  plist;
-    MTaskList tlist;
-
-    // initialize display to check the reference distribution
-    // for the event selection (just if iflag==1)
-    MStatusDisplay *display = NULL;
-    if (iflag)
-      display = new MStatusDisplay;
-
-    MReadMarsFile read("Events", name);
-    read.DisableAutoScheme();
-
-    // apply cuts for event selection
-    MContinue contdisp(fDispFilter);
-    contdisp.SetName("ContFilterSelector2");
-
-    // choose a reference distribution 
-    MFEventSelector2 selector(href);
-    selector.SetNumMax(howmanytrain+howmanytest);
-    selector.SetName("selectTrainTest");
-    selector.SetInverted();
-    MContinue cont(&selector);
-    cont.SetName("ContTrainTest");
-
-    // choose randomly the events to fill the Training Matrix
-    Double_t prob =  ( (Double_t) howmanytrain )
-                   / ( (Double_t)(howmanytrain+howmanytest) );
-    MFEventSelector split;
-    split.SetSelectionRatio(prob);
-
-    MFillH filltraincalc(fMatrixTrainCalc);
-    filltraincalc.SetFilter(&split);
-    filltraincalc.SetName("fillMatrixTrainCalc");
-
-    MFillH filltrainhists(fMatrixTrainHists);
-    filltrainhists.SetFilter(&split);
-    filltrainhists.SetName("fillMatrixTrainHists");
-
-    // consider this event as candidate for a test event 
-    // only if event was not accepted as a training event
-    MContinue conttrain(&split);
-    conttrain.SetName("ContTrain");
-
-    MFillH filltestcalc(fMatrixTestCalc);
-    filltestcalc.SetName("fillMatrixTestCalc");
-
-    MFillH filltesthists(fMatrixTestHists);
-    filltesthists.SetName("fillMatrixTestHists");
-
-
-    //******************************
-    // entries in MParList 
-    
-    plist.AddToList(&tlist);
-    plist.AddToList(fCam);
-    plist.AddToList(fMatrixTrainCalc);
-    plist.AddToList(fMatrixTrainHists);
-    plist.AddToList(fMatrixTestCalc);
-    plist.AddToList(fMatrixTestHists);
-
-    //******************************
-    // entries in MTaskList 
-
-    tlist.AddToList(&read);
-    if (fDispFilter != NULL)
-      tlist.AddToList(&contdisp);
-    tlist.AddToList(&cont);
-    tlist.AddToList(&filltraincalc);
-    tlist.AddToList(&filltrainhists);
-    tlist.AddToList(&conttrain);
-    tlist.AddToList(&filltestcalc);
-    tlist.AddToList(&filltesthists);
-
-    //******************************
-
-    MProgressBar bar;
-    MEvtLoop evtloop;
-    if (display != NULL)
-      evtloop.SetDisplay(display);
-    evtloop.SetParList(&plist);
-    evtloop.SetName("EvtLoopMatrixTrainTest");
-    evtloop.SetProgressBar(&bar);
-
-    Int_t maxev = -1;
-    if (!evtloop.Eventloop(maxev))
-      return kFALSE;
-
-    tlist.PrintStatistics(0, kTRUE);
-
-
-    // print the filled Train Matrices
-    fMatrixTrainCalc->Print("SizeCols");
-    fMatrixTrainHists->Print("SizeCols");
-
-    // check that number of generated events is compatible with the resquested
-    const Int_t generatedtraincalc = fMatrixTrainCalc->GetM().GetNrows();
-    if (TMath::Abs(generatedtraincalc-howmanytrain) > TMath::Sqrt(9.*howmanytrain))
-    {
-      *fLog << "MFindDisp::DefineTrainTestMatrix; no.of generated events ("
-	    << generatedtraincalc
-            << ") is incompatible with the no.of requested events ("
-            << howmanytrain << ")" << endl;
-    }
-    const Int_t generatedtrainhists = fMatrixTrainHists->GetM().GetNrows();
-    if (TMath::Abs(generatedtrainhists-howmanytrain) > TMath::Sqrt(9.*howmanytrain))
-    {
-      *fLog << "MFindDisp::DefineTrainTestMatrix; no.of generated events ("
-	    << generatedtrainhists
-            << ") is incompatible with the no.of requested events ("
-            << howmanytrain << ")" << endl;
-    }
-
-
-    // print the filled Test Matrices
-    fMatrixTestCalc->Print("SizeCols");
-    fMatrixTestHists->Print("SizeCols");
-
-    // check that number of generated events is compatible with the resquested
-    const Int_t generatedtestcalc = fMatrixTestCalc->GetM().GetNrows();
-    if (TMath::Abs(generatedtestcalc-howmanytest) > TMath::Sqrt(9.*howmanytest))
-    {
-      *fLog << "MFindDisp::DefineTrainTestMatrix; no.of generated events ("
-	    << generatedtestcalc
-            << ") is incompatible with the no.of requested events ("
-            << howmanytest << ")" << endl;
-    }
-    const Int_t generatedtesthists = fMatrixTestHists->GetM().GetNrows();
-    if (TMath::Abs(generatedtesthists-howmanytest) > TMath::Sqrt(9.*howmanytest))
-    {
-      *fLog << "MFindDisp::DefineTrainTestMatrix; no.of generated events ("
-	    << generatedtesthists
-            << ") is incompatible with the no.of requested events ("
-            << howmanytest << ")" << endl;
-    }
-
-
-    *fLog << "TRAINING and TEST Matrices were filled" << endl;
-    *fLog << "=============================================" << endl;
-
-
-    //----------------------------
-    // write out training matrices
-
-    if (filetrain != "")
-    {
-      TFile filetr(filetrain, "RECREATE");
-      fMatrixTrainCalc->Write();
-      fMatrixTrainHists->Write();
-      filetr.Close();
-
-      *fLog << "MFindDisp::DefineTrainTestMatrix; Training matrices were written onto file '"
-            << filetrain << "'" << endl;
-    }
-
-    //--------------------------
-    // write out test matrices
-
-    if (filetest != "")
-    {
-      TFile filete(filetest, "RECREATE");
-      fMatrixTestCalc->Write();
-      fMatrixTestHists->Write();
-      filete.Close();
-
-      *fLog << "MFindDisp::DefineTrainTestMatrix; Test matrices were written onto file '"
-            << filetest << "'" << endl;
-    }
-
-    if (display != NULL)
-      delete display;
-
-    return kTRUE;
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Read training and test matrices from files
-//
-//
-Bool_t MFindDisp::ReadMatrix(const TString &filetrain, const TString &filetest)
-{
-  //--------------------------
-  // read in training matrices
-
-  TFile filetr(filetrain);
-  fMatrixTrainCalc->Read("MatrixTrainCalc");
-  fMatrixTrainHists->Read("MatrixTrainHists");
-  fMatrixTrainCalc->Print("SizeCols");
-  fMatrixTrainHists->Print("SizeCols");
-
-  *fLog << "MFindDisp::ReadMatrix; Training matrices were read in from file '"
-        << filetrain << "'" << endl;
-  filetr.Close();
-
-
-  //--------------------------
-  // read in test matrices
-
-  TFile filete(filetest);
-  fMatrixTestCalc->Read("MatrixTestCalc");
-  fMatrixTestHists->Read("MatrixTestHists");
-  fMatrixTestCalc->Print("SizeCols");
-  fMatrixTestHists->Print("SizeCols");
-
-  *fLog << "MFindDisp::ReadMatrix; Test matrices were read in from file '"
-        << filetest << "'" << endl;
-  filete.Close();
-
-  return kTRUE;  
-}
-
-
-//------------------------------------------------------------------------
-//
-// Steering program for optimizing Disp
-// ------------------------------------
-//
-//      the criterion for the 'optimum' is defined in 
-//      MHDisp::Fill()  and  MHDisp::Finalize(); 
-//      for example : smallest sum (over all events) of d^2, where d is the 
-//                    distance between the estimated source position 
-//                    (calculated using the current value of Disp) and
-//                    the true source position     
-//
-// The various steps are :
-//
-// - setup the event loop to be executed for each call to fcnDisp 
-//
-// - call TMinuit to do the minimization :
-//        the fcnDisp function calculates the parameter to minimize 
-//                            for the current Disp parameter values;
-//        for this - Disp is calculated in the event loop by calling 
-//                   MDispCalc::Process() ==> MDispCalc::Calc() 
-//                 - the Minimization parameter contributions are summed up 
-//                   in the event loop by calling MHDisp::Fill()
-//                 - after the event loop the final value of the Minimization
-//                   parameter is calculated by calling MHDisp::Finalize()
-//
-// Needed as input : (to be set by the Set functions)
-//
-// - fFilenameParam      name of file to which optimum values of the 
-//                       parameters are written
-//
-// - for the minimization, the starting values of the parameters are taken  
-//     - from the file parDispInit (if it is != "")
-//     - or from the arrays params and/or steps 
-//     - or from the DispParameters constructor
-//
-//----------------------------------------------------------------------
-Bool_t MFindDisp::FindParams(TString parDispInit,
-                             TArrayD &params, TArrayD &steps)
-{
-    // Setup the event loop which will be executed in the 
-    //                 fcnDisp function  of MINUIT
-    //
-    // parDispInit is the name of the file containing the initial values 
-    // of the parameters; 
-    // if parDispInit = ""   'params' and 'steps' are taken as initial values
-    //
-
-    *fLog << "=============================================" << endl;
-    *fLog << "Setup event loop for fcnDisp" << endl;
-
-
-    if (fMatrixTrainCalc == NULL || fMatrixTrainHists == NULL)
-    {
-      *fLog << "MFindDisp::FindParams; training matrices are not defined... aborting"
-            << endl;
-      return kFALSE;
-    }
-
-    if (fMatrixTrainCalc->GetM().GetNrows() <= 0  ||  fMatrixTrainHists->GetM().GetNrows() <= 0)
-    {
-      *fLog << "MFindDisp::FindParams; training matrices have no entries"
-            << endl;
-      return kFALSE;
-    }
-
-    //---------------------------------------------------------
-    MParList  parlistfcn;
-    MTaskList tasklistfcn;
-
-    // loop over rows of matrix
-    MMatrixLoop loopcalc(fMatrixTrainCalc);
-    MMatrixLoop loophists(fMatrixTrainHists);
-
-    //--------------------------------
-    // create container for the Disp parameters
-    // and set them to their initial values
-    MDispParameters *dispparams = fDispCalcTrain->GetDispParameters();
-
-    // take initial values from file parDispInit
-    if (parDispInit != "")
-    {
-      TFile inparam(parDispInit);
-      dispparams->Read("MDispParameters");
-      inparam.Close();
-      *fLog << "MFindDisp::FindParams; initial values of parameters are taken from file "
-            << parDispInit << endl;
-    }
-
-    // take initial values from 'params' and/or 'steps'
-    else if (params.GetSize() != 0  || steps.GetSize()  != 0 )
-    {
-      if (params.GetSize()  != 0)
-      {
-        *fLog << "MFindDisp::FindParams; initial values of parameters are taken from 'params'"
-              << endl;
-        dispparams->SetParameters(params);
-      }
-      if (steps.GetSize()  != 0)
-      {
-        *fLog << "MFindDisp::FindParams; initial step sizes are taken from 'steps'"
-              << endl;
-        dispparams->SetStepsizes(steps);
-      }
-    }
-    else
-    {
-        *fLog << "MFindDisp::FindParams; initial values and step sizes are taken "
-	      << "from the MDispParameters constructor" << endl;
-    }
-
-    // fill the plots for Disp and sum up the Minimization parameter contributions
-    MFillH filldispplots("MHDisp", "");
-
-    //******************************
-    // entries in MParList
-    
-    parlistfcn.AddToList(&tasklistfcn);
-    parlistfcn.AddToList(dispparams);
-    parlistfcn.AddToList(fHDispTrain);
-    parlistfcn.AddToList(fCam);
-    parlistfcn.AddToList(fMatrixTrainCalc);
-    parlistfcn.AddToList(fMatrixTrainHists);
-
-    //******************************
-    // entries in MTaskList
-
-    tasklistfcn.AddToList(&loopcalc);
-    tasklistfcn.AddToList(&loophists);
-    tasklistfcn.AddToList(fDispCalcTrain);
-    tasklistfcn.AddToList(&filldispplots);
-
-    //******************************
-
-    MEvtLoop evtloopfcn("EvtLoopFCN");
-    evtloopfcn.SetParList(&parlistfcn);
-    *fLog << "Event loop for fcnDisp has been setup" << endl;
-
-    // address of evtloopfcn is used in CallMinuit()
-
-
-    //-----------------------------------------------------------------------
-    //
-    //----------   Start of minimization part   --------------------
-    //
-    // Do the minimization with MINUIT
-    //
-    // Be careful: This is not thread safe
-    //
-    *fLog << "========================================================" << endl;
-    *fLog << "Start minimization for Disp" << endl;
-
-
-    // -------------------------------------------
-    // prepare call to MINUIT
-    //
-
-    // get initial values of parameters 
-    fVinit = dispparams->GetParameters();
-    fStep  = dispparams->GetStepsizes();
-
-    TString name[fVinit.GetSize()];
-    fStep.Set(fVinit.GetSize());
-    fLimlo.Set(fVinit.GetSize());
-    fLimup.Set(fVinit.GetSize());
-    fFix.Set(fVinit.GetSize());
-
-    fNpar = fVinit.GetSize();
-
-    // define names, step sizes, lower and upper limits of the parameters
-    // fFix[] = 0;  means the parameter is not fixed
-    for (UInt_t i=0; i<fNpar; i++)
-    {
-        name[i]   = "p";
-        name[i]  += i+1;
-        //fStep[i]  = TMath::Abs(fVinit[i]/10.0);
-        fLimlo[i] = -100.0;
-        fLimup[i] =  100.0;
-        fFix[i]   =     0;
-    }
-
-    // fix some parameters
-    //for (UInt_t i=0; i<fNpar; i++)
-    //{
-    //  if (i == 1  ||  i==3)
-    //	{
-    //      fStep[i] = 0.0;
-    //      fFix[i]  =   1;
-    //	}
-    //}
- 
-
-    // -------------------------------------------
-    // call MINUIT
-
-    TStopwatch clock;
-    clock.Start();
-
-    *fLog << "before calling CallMinuit" << endl;
-
-    MMinuitInterface inter;               
-    Bool_t rc = inter.CallMinuit(fcnDisp, name,
-                                 fVinit, fStep, fLimlo, fLimup, fFix,
-                                 &evtloopfcn, "MIGRAD", kFALSE);
- 
-    *fLog << "after calling CallMinuit" << endl;
-
-    *fLog << "Time spent for the minimization in MINUIT :   " << endl;;
-    clock.Stop();
-    clock.Print();
-
-
-    if (!rc)
-        return kFALSE;
-
-    *fLog << "Minimization for Disp finished" << endl;
-    *fLog << "========================================================" << endl;
-
-
-    // -----------------------------------------------------------------
-    // in 'fcnDisp' the optimum parameter values were put into MDisp
-
-    // write optimum parameter values onto file fFilenameParam
-    
-    TFile outparam(fFilenameParam, "RECREATE"); 
-    dispparams->Write();
-    outparam.Close();
-
-    *fLog << "Optimum parameter values for Disp were written onto file '"
-              << fFilenameParam << "' :" << endl;
-
-    const TArrayD &check = dispparams->GetParameters();
-    for (Int_t i=0; i<check.GetSize(); i++)
-        *fLog << check[i] << ",  ";
-    *fLog << endl;
-
-
-
-    //-------------------------------------------
-    // draw the plots
-    fHDispTrain->Draw();
-
-    *fLog << "End of Disp optimization part" << endl;
-    *fLog << "======================================================" << endl;
-
-    return kTRUE;
-}
-
-
-// -----------------------------------------------------------------------
-//
-// Test the result of the Disp optimization on the test sample
-//
-
-Bool_t MFindDisp::TestParams()
-{
-    if (fMatrixTestCalc == NULL || fMatrixTestHists == NULL)
-    {
-      *fLog << "MFindDisp::TestParams; test matrices are not defined... aborting"
-            << endl;
-      return kFALSE;
-    }
-
-    if (fMatrixTestCalc->GetM().GetNrows() <= 0  ||  fMatrixTestHists->GetM().GetNrows() <= 0)
-    {
-        *fLog << "MFindDisp::TestParams; test matrices have no entries" 
-              << endl;
-        return kFALSE;
-    }
-
-    // -------------   TEST the Disp optimization    -------------------
-    //
-    *fLog << "Test the Disp optimization on the test sample" << endl;
-
-    // -----------------------------------------------------------------
-    // read optimum parameter values from file fFilenameParam
-    // into array 'dispPar'
-
-    TFile inparam(fFilenameParam);
-    MDispParameters dispin; 
-    dispin.Read("MDispParameters");
-    inparam.Close();
-
-    *fLog << "Optimum parameter values for Disp were read from file '";
-    *fLog << fFilenameParam << "' :" << endl;
-
-    const TArrayD &dispPar = dispin.GetParameters();
-    for (Int_t i=0; i<dispPar.GetSize(); i++)
-        *fLog << dispPar[i] << ",  ";
-    *fLog << endl;
-    //---------------------------
-
-
-    // -----------------------------------------------------------------
-    MParList  parlist2;
-    MTaskList tasklist2;
-
-    MDispParameters *dispparams = fDispCalcTest->GetDispParameters();
-    dispparams->SetParameters(dispPar);
-
-    MMatrixLoop loopcalc(fMatrixTestCalc);
-    MMatrixLoop loophists(fMatrixTestHists);
-
-    MHMatrix *imatrix = NULL;
-    TArrayI  imap;
-    fHDispTest->GetMatrixMap(imatrix,imap);
-
-    // attention: argument of MHDisp is the name of MImageParDisp container, that should
-    // be the same than the name given to it when creating MDispCalc object at the MFindDisp
-    // constructor:  fDispCalcTrain = new MDispCalc("DispTest");
-    // fill the plots for Disp and sum up the Minimization parameter contributions
-    MHDisp hdisp1("DispTest");
-    hdisp1.SetName("MHDispCorr");
-    hdisp1.SetSelectedPos(1);
-    hdisp1.SetMatrixMap(imatrix,imap);
-    MFillH filldispplots1("MHDispCorr[MHDisp]", "");
-    
-    MHDisp hdisp2("DispTest");
-    hdisp2.SetName("MHDispWrong");
-    hdisp2.SetSelectedPos(2);
-    hdisp2.SetMatrixMap(imatrix,imap);
-    MFillH filldispplots2("MHDispWrong[MHDisp]", "");
-    
-    MHDisp hdisp3("DispTest");
-    hdisp3.SetName("MHDispM3Long");
-    hdisp3.SetSelectedPos(3);
-    hdisp3.SetMatrixMap(imatrix,imap);
-    MFillH filldispplots3("MHDispM3Long[MHDisp]", "");
-    
-    MHDisp hdisp4("DispTest");
-    hdisp4.SetName("MHDispAsym");
-    hdisp4.SetSelectedPos(4);
-    hdisp4.SetMatrixMap(imatrix,imap);
-    MFillH filldispplots4("MHDispAsym[MHDisp]", "");
-    
-
-    //******************************
-    // entries in MParList
-
-    parlist2.AddToList(&tasklist2);
-    parlist2.AddToList(dispparams);
-    parlist2.AddToList(&hdisp1);
-    parlist2.AddToList(&hdisp2);
-    parlist2.AddToList(&hdisp3);
-    parlist2.AddToList(&hdisp4);
-    parlist2.AddToList(fCam);
-    parlist2.AddToList(fMatrixTestCalc);
-    parlist2.AddToList(fMatrixTestHists);
-
-    //******************************
-    // entries in MTaskList
-
-    tasklist2.AddToList(&loopcalc);
-    tasklist2.AddToList(&loophists);
-    tasklist2.AddToList(fDispCalcTest);
-    tasklist2.AddToList(&filldispplots1);
-    tasklist2.AddToList(&filldispplots2);
-    tasklist2.AddToList(&filldispplots3);
-    tasklist2.AddToList(&filldispplots4);
-
-    //******************************
-
-    MProgressBar bar2;
-    MEvtLoop evtloop2;
-    evtloop2.SetParList(&parlist2);
-    evtloop2.SetName("EvtLoopTestParams");
-    evtloop2.SetProgressBar(&bar2);
-    Int_t maxevents2 = -1;
-    if (!evtloop2.Eventloop(maxevents2))
-        return kFALSE;
-
-    tasklist2.PrintStatistics(0, kTRUE);
-
-
-    //-------------------------------------------
-    // draw the plots
-
-    hdisp1.Draw();
-    hdisp2.Draw();
-    hdisp3.Draw();
-    hdisp4.Draw();
-
-    //-------------------------------------------
-
-
-    *fLog << "Test of Disp otimization finished" << endl;
-    *fLog << "======================================================" << endl;
-
-    return kTRUE;
-}
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MFindDisp.h
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MFindDisp.h	(revision 7136)
+++ 	(revision )
@@ -1,134 +1,0 @@
-#ifndef MARS_MFindDisp
-#define MARS_MFindDisp
-
-#ifndef MARS_MParContainer
-#include "MParContainer.h"
-#endif
-
-#ifndef ROOT_TArrayD
-#include <TArrayD.h>
-#endif
-
-#ifndef ROOT_TArrayI
-#include <TArrayI.h>
-#endif
-
-class MHMatrix;
-class MDispCalc;
-class MHDisp;
-class MFDisp;
-class MFilter;
-class MH3;
-class MGeomCam;
-class MEvtLoop;
-
-class MFindDisp : public MParContainer
-{
-private:
-
-  TString   fFilenameParam;  // filename to store optimum Disp parameters
-
-  TString   fFilenameTrain;
-  TString   fFilenameTest;
-
-  Int_t     fHowManyTrain;   // number of events for training
-  Int_t     fHowManyTest;    // number of events for testing
-
-  MHMatrix  *fMatrixTrainCalc;    // training matrix with variables needed in MDispCalc
-  MHMatrix  *fMatrixTrainHists;   // training matrix with variables needed in MHDisp
-  MHMatrix  *fMatrixTestCalc;     // testing matrix with variables needed in MDispCalc
-  MHMatrix  *fMatrixTestHists;    // testing matrix with variables needed in MHDisp
-
-  MDispCalc *fDispCalcTrain;
-  MDispCalc *fDispCalcTest;
-
-  MHDisp    *fHDispTrain;
-  MHDisp    *fHDispTest;
-
-  MFDisp    *fDispFilter;    // filter to select an events sample
-
-  MGeomCam  *fCam;
-
-  MEvtLoop  *fObjectFit;
-
-  //--------------------------------------------
-  // To comunicate with MINUIT
-  //--------------------------------------------
-  // attention : dimensions must agree with those in 
-  //             MMinuitInterface::CallMinuit()
-  //char  fParName [80][100];
-  TArrayD   fVinit;
-  TArrayD   fStep;
-  TArrayD   fLimlo;
-  TArrayD   fLimup;
-  TArrayI   fFix;
-
-  UInt_t    fNpar;
-
-  TString   fMethod;
-
-  Double_t  fMin,   fEdm,   fErrdef;
-  Int_t     fNpari, fNparx, fIstat;
-  Int_t     fErrMinimize;
-  //--------------------------------------------
-
-public:
-
-  MFindDisp(MFDisp *fdisp=NULL, const char *name=NULL, const char *title=NULL);
-  ~MFindDisp();
-
-  void SetFilenameParam(const TString &name)    {fFilenameParam  = name;}
-
-  void SetFilenameTraining(const TString &name, const Int_t howmany) 
-      {fFilenameTrain = name;  fHowManyTrain = howmany; }
-
-  void SetFilenameTest(const TString &name, const Int_t howmany)     
-      {fFilenameTest     = name;  fHowManyTest  = howmany; }
-
-  Bool_t DefineTrainMatrix(const TString &name, MH3 &href,
-                           const Int_t howmany, const TString &filetrain,
-			   Int_t iflag=0); 
-
-  Bool_t DefineTestMatrix(const TString &name, MH3 &href,
-                          const Int_t howmany, const TString &filetest,
-			  Int_t iflag=0); 
-
-  Bool_t DefineTrainTestMatrix(const TString &name, MH3 &href,
-			       const Int_t howmanytrain, const Int_t howmanytest, 
-			       const TString &filetrain, const TString &filetest,
-			       Int_t iflag=0); 
-
-  MHMatrix *GetMatrixTrainCalc()  { return fMatrixTrainCalc;  }
-  MHMatrix *GetMatrixTrainHists() { return fMatrixTrainHists; }
-  MHMatrix *GetMatrixTestCalc()   { return fMatrixTestCalc;   }
-  MHMatrix *GetMatrixTestHists()  { return fMatrixTestHists;  }
-
-  Bool_t ReadMatrix( const TString &filetrain, const TString &filetest);
-
-  Bool_t FindParams(TString parSCinit, TArrayD &params, TArrayD &steps);
-
-  Bool_t TestParams();
-
-  ClassDef(MFindDisp, 1) // Class for optimizing Disp
-};
-
-#endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MHDisp.cc
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MHDisp.cc	(revision 7136)
+++ 	(revision )
@@ -1,717 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Eva Domingo,     12/2004 <mailto:domingo@ifae.es>
-!              Wolfgang Wittek, 12/2004 <mailto:wittek@mppmu.mpg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2005
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-//   MHDisp                                                                //
-//                                                                         //
-//   container holding the histograms for Disp                             //
-//   also computes the minimization parameter of the Disp optimization     // 
-//                                                                         //
-/////////////////////////////////////////////////////////////////////////////
-#include "MHDisp.h"
-
-#include <math.h>
-
-#include <TH1.h>
-#include <TH2.h>
-#include <TProfile.h>
-#include <TArrayI.h>
-#include <TPad.h>
-#include <TCanvas.h>
-#include <TStyle.h>
-
-#include "MGeomCam.h"
-#include "MSrcPosCam.h"
-#include "MHillas.h"
-#include "MHillasExt.h"
-#include "MNewImagePar.h"
-#include "MMcEvt.hxx"
-#include "MPointingPos.h"
-#include "MImageParDisp.h"
-
-#include "MHMatrix.h"
-#include "MParameters.h"
-
-#include "MParList.h"
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-ClassImp(MHDisp);
-
-using namespace std;
-
-enum dispVar_t {kX,kY,kMeanX,kMeanY,kDelta,kSize,kM3Long,kAsym,
-		kEnergy,kImpact,kLongitmax,kZd,kAz,kTotVar};    // enum variables for the
-                                                                // matrix columns mapping
-
-// --------------------------------------------------------------------------
-//
-// Constructor 
-//
-MHDisp::MHDisp(const char *imagepardispname,
-	       const char *name, const char *title)
-  : fImageParDispName(imagepardispname)
-{
-    fName  = name  ? name  : "MHDisp";
-    fTitle = title ? title : "Histograms for Disp";
-
-    fSelectedPos = 1;  // default MHDisp flag (selects Correct Disp source position solution)
-
-    fMatrix = NULL;
-
-    // initialize mapping array dimension to the number of columns of fMatrix
-    fMap.Set(kTotVar);
-
-    //--------------------------------------------------
-    // creating the Disp related histograms
-
-    fHistEnergy   = new TH1F("fHistEnergy", 
-	 "log10(Energy)", 50, 1., 3.);
-    fHistEnergy->SetDirectory(NULL);
-    fHistEnergy->UseCurrentStyle();
-    fHistEnergy->SetXTitle("log10(Energy) [GeV]");
-    fHistEnergy->SetYTitle("# events");
-
-    fHistSize   = new TH1F("fHistSize", 
-	 "log10(Size)", 50, 2., 4.);
-    fHistSize->SetDirectory(NULL);
-    fHistSize->UseCurrentStyle();
-    fHistSize->SetXTitle("log10(Size) [#phot]");
-    fHistSize->SetYTitle("# events");
-
-    fHistcosZA   = new TH1F("fHistcosZA", 
-	 "cos(Zenith Angle)", 10, 0., 1.);
-    fHistcosZA->SetDirectory(NULL);
-    fHistcosZA->UseCurrentStyle();
-    fHistcosZA->SetXTitle("cos(Theta)");
-    fHistcosZA->SetYTitle("# events");
-
-    fSkymapXY = new TH2F("fSkymapXY", 
-         "Disp estimated source positions Skymap", 71, -2., 2., 71, -2., 2.);
-    fSkymapXY->SetDirectory(NULL);
-    fSkymapXY->UseCurrentStyle();
-    fSkymapXY->SetXTitle("X Disp source position [deg]");
-    fSkymapXY->SetYTitle("Y Disp source position [deg]");
-
-    fHistMinPar   = new TH1F("fHistMinPar"  , 
-         "Distance^2 between Disp and real srcpos", 100, 0., 2.);
-    fHistMinPar->SetDirectory(NULL);
-    fHistMinPar->UseCurrentStyle();
-    fHistMinPar->SetXTitle("Minimization parameter = d^2 Disp to real srcpos [deg^2]");
-    fHistMinPar->SetYTitle("# events");
-    
-    fHistDuDv   = new TH2F("fHistDuDv", 
-	 "Du vs. Dv (distances between Disp and real srcpos)", 
-	 100, -2., 2., 100, -2., 2.);
-    fHistDuDv->SetDirectory(NULL);
-    fHistDuDv->UseCurrentStyle();
-    fHistDuDv->SetXTitle("Dv = transveral distance [deg]");
-    fHistDuDv->SetYTitle("Du = longitudinal distance [deg]");
-
-    fHistMinParEnergy   = new TH2F("fHistMinParEnergy", 
-	 "Minimization parameter vs. Energy", 50, 1., 3., 100, 0., 2.);
-    fHistMinParEnergy->SetDirectory(NULL);
-    fHistMinParEnergy->UseCurrentStyle();
-    fHistMinParEnergy->SetXTitle("log10(Energy) [GeV]");
-    fHistMinParEnergy->SetYTitle("Minimization parameter = d^2 Disp to real srcpos [deg^2]");
-
-    fHistMinParSize   = new TH2F("fHistMinParSize", 
-	 "Minimization parameter vs. Size", 50, 2., 4., 100, 0., 2.);
-    fHistMinParSize->SetDirectory(NULL);
-    fHistMinParSize->UseCurrentStyle();
-    fHistMinParSize->SetXTitle("log10(Size) [#phot]");
-    fHistMinParSize->SetYTitle("Minimization parameter = d^2 Disp to real srcpos [deg^2]");
-
-    fHistDuEnergy   = new TH2F("fHistDuEnergy", 
-	 "Du vs. Energy", 50, 1., 3., 100, -2., 2.);
-    fHistDuEnergy->SetDirectory(NULL);
-    fHistDuEnergy->UseCurrentStyle();
-    fHistDuEnergy->SetXTitle("log10(Energy) [GeV]");
-    fHistDuEnergy->SetYTitle("Du = longitudinal distance Disp to real srcpos [deg]");
-
-    fHistDuSize   = new TH2F("fHistDuSize", 
-	 "Du vs. Size", 50, 2., 4., 100, -2., 2.);
-    fHistDuSize->SetDirectory(NULL);
-    fHistDuSize->UseCurrentStyle();
-    fHistDuSize->SetXTitle("log10(Size) [#phot]");
-    fHistDuSize->SetYTitle("Du = longitudinal distance Disp to real srcpos [deg]");
-
-    fHistDvEnergy   = new TH2F("fHistDvEnergy", 
-	 "Dv vs. Energy", 50, 1., 3., 100, -2., 2.);
-    fHistDvEnergy->SetDirectory(NULL);
-    fHistDvEnergy->UseCurrentStyle();
-    fHistDvEnergy->SetXTitle("log10(Energy) [GeV]");
-    fHistDvEnergy->SetYTitle("Dv = transveral distance Disp to real srcpos [deg]");
-
-    fHistDvSize   = new TH2F("fHistDvSize", 
-	 "Dv vs. Size", 50, 2., 4., 100, -2., 2.);
-    fHistDvSize->SetDirectory(NULL);
-    fHistDvSize->UseCurrentStyle();
-    fHistDvSize->SetXTitle("log10(Size) [#phot]");
-    fHistDvSize->SetYTitle("Dv = transveral distance Disp to real srcpos [deg]");
-
-    fEvCorrAssign   = new TProfile("fEvCorrAssign", 
-	 "Fraction events srcpos well assign vs. Size", 50, 2., 4., 0., 1.);
-    fEvCorrAssign->SetDirectory(NULL);
-    fEvCorrAssign->SetStats(0);
-    fEvCorrAssign->SetXTitle("log10(Size) [#phot]");
-    fEvCorrAssign->SetYTitle("Fraction of events with srcpos well assign");
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Destructor 
-//
-MHDisp::~MHDisp()
-{
-  delete fHistEnergy;
-  delete fHistSize;
-  delete fHistcosZA;
-  delete fSkymapXY;
-  delete fHistMinPar;
-  delete fHistDuDv;
-  delete fHistMinParEnergy;
-  delete fHistMinParSize;
-  delete fHistDuEnergy;
-  delete fHistDuSize;
-  delete fHistDvEnergy;
-  delete fHistDvSize;
-  delete fEvCorrAssign;
-}
-
-// --------------------------------------------------------------------------
-//
-// Set the pointers to the containers 
-// 
-//
-Bool_t MHDisp::SetupFill(const MParList *pList)
-{
-    // reset all histograms and Minimization parameter computing variables
-    // before each new eventloop
-    fNumEv = 0;
-    fSumMinPar  = 0.;
-    fMinPar = (MParameterD*)const_cast<MParList*>(pList)->FindCreateObj("MParameterD", "MinimizationParameter");
-    if (!fMinPar)
-    {
-      *fLog << err << "MParameterD (MinimizationParameter) not found and could not be created... aborting." 
-	    << endl;
-      return kFALSE;
-    }
-    fMinPar->SetVal(0);
-
-    fHistEnergy->Reset();
-    fHistSize->Reset();
-    fHistcosZA->Reset();
-    fSkymapXY->Reset();
-    fHistMinPar->Reset();
-    fHistDuDv->Reset();
-    fHistMinParEnergy->Reset();
-    fHistMinParSize->Reset();
-    fHistDuEnergy->Reset();
-    fHistDuSize->Reset();
-    fHistDvEnergy->Reset();
-    fHistDvSize->Reset();
-    fEvCorrAssign->Reset();
-
-
-    // look for the defined camera geometry to get mm to deg conversion factor
-    MGeomCam *cam = (MGeomCam*)pList->FindObject("MGeomCam");
-    if (!cam)
-    {
-        *fLog << err << "MGeomCam (Camera Geometry) not found... aborting." 
-              << endl;
-        return kFALSE;
-    }
-    fMm2Deg = cam->GetConvMm2Deg();
-
-
-    // look for Disp related containers
-    fImageParDisp = (MImageParDisp*)pList->FindObject(fImageParDispName,
-						      "MImageParDisp");
-    if (!fImageParDisp)
-    {
-        *fLog << err << fImageParDispName 
-              << " [MImageParDisp] not found... aborting." << endl;
-        return kFALSE;
-    }
-
-
-    //-----------------------------------------------------------
-    // if fMatrix exists, skip preprocessing and just read events from matrix;
-    // if doesn't exist, read variables values from containers, so look for them
-    if (fMatrix)
-      return kTRUE;
-    
-    fSrcPos = (MSrcPosCam*)pList->FindObject("MSrcPosCam");
-    if (!fSrcPos)
-    {
-        *fLog << err << "MSrcPosCam not found... aborting." << endl;
-        return kFALSE;
-    }
-
-    fHil = (MHillas*)pList->FindObject("MHillas");
-    if (!fHil)
-    {
-        *fLog << err << "MHillas not found... aborting." << endl;
-        return kFALSE;
-    }
-
-    fHilExt = (MHillasExt*)pList->FindObject("MHillasExt");
-    if (!fHilExt)
-    {
-        *fLog << err << "MHillasExt not found... aborting." << endl;
-        return kFALSE;
-    }
-
-    fNewPar = (MNewImagePar*)pList->FindObject("MNewImagePar");
-    if (!fNewPar)
-    {
-        *fLog << err << "MNewImagePar not found... aborting." << endl;
-        return kFALSE;
-    }
-
-    fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
-    if (!fMcEvt)
-    {
-        *fLog << err << "MMcEvt not found... This is not a MC file,"
-	      << " you are not trying to optimize Disp, just calculating it."
-	      << endl;
-	//        return kFALSE;
-    }
-
-    fPointing = (MPointingPos*)pList->FindObject("MPointingPos");
-    if (!fPointing)
-    {
-        *fLog << err << "MPointingPos not found... aborting." << endl;
-	return kFALSE;
-    }
-
-    //------------------------------------------
-
-    return kTRUE;
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Set which selection algorithm for the Disp estimated source position 
-// solutions we want to follow when filling the histograms:
-//  * iflag == 1 --> Correct source position, the closest to the real srcpos
-//                   (only applicable to MC or well known source real data)
-//  * iflag == 2 --> Wrong source position, the furthest to the real srcpos
-//                   (same applicability than case 1)
-//  * iflag == 3 --> Source position assigned as M3Long sign indicates
-//  * iflag == 4 --> Source position assigned as Asym sign indicates
-//
-void MHDisp::SetSelectedPos(Int_t iflag)
-{ 
-    fSelectedPos = iflag; 
-}    
-
-
-// --------------------------------------------------------------------------
-//
-// Sets the Matrix and the array of mapped values for each Matrix column
-//
-void MHDisp::SetMatrixMap(MHMatrix *matrix, TArrayI &map)
-{
-    fMatrix = matrix;
-    fMap = map;
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Returns the Matrix and the mapped value for each Matrix column
-//
-void MHDisp::GetMatrixMap(MHMatrix* &matrix, TArrayI &map)
-{
-    map = fMap;
-    matrix = fMatrix;
-}
-
-
-// --------------------------------------------------------------------------
-//
-// You can use this function if you want to use a MHMatrix instead of the
-// given containers for the Disp optimization. This function adds all 
-// necessary columns to the given matrix. Afterwards, you should fill 
-// the matrix with the corresponding data (eg from a file by using 
-// MHMatrix::Fill). Then, if you loop through the matrix (eg using 
-// MMatrixLoop), MHDisp::Fill will take the values from the matrix 
-// instead of the containers.
-//
-void MHDisp::InitMapping(MHMatrix *mat)
-{
-    if (fMatrix)
-      return;
-
-    fMatrix = mat;
-
-    fMap[kX]          = fMatrix->AddColumn("MSrcPosCam.fX");
-    fMap[kY]          = fMatrix->AddColumn("MSrcPosCam.fY");
-    fMap[kMeanX]      = fMatrix->AddColumn("MHillas.fMeanX");
-    fMap[kMeanY]      = fMatrix->AddColumn("MHillas.fMeanY");
-    fMap[kDelta]      = fMatrix->AddColumn("MHillas.fDelta");
-
-    fMap[kSize]       = fMatrix->AddColumn("MHillas.fSize");
-    
-    fMap[kM3Long]     = fMatrix->AddColumn("MHillasExt.fM3Long");
-    fMap[kAsym]       = fMatrix->AddColumn("MHillasExt.fAsym");
-    
-    fMap[kEnergy]     = fMatrix->AddColumn("MMcEvt.fEnergy");
-    fMap[kImpact]     = fMatrix->AddColumn("MMcEvt.fImpact");
-    fMap[kLongitmax]  = fMatrix->AddColumn("MMcEvt.fLongitmax");
-    
-    fMap[kZd]         = fMatrix->AddColumn("MPointingPos.fZd");
-    fMap[kAz]         = fMatrix->AddColumn("MPointingPos.fAz");
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Returns a mapped value from the Matrix
-//
-Double_t MHDisp::GetVal(Int_t i) const
-{
-    Double_t val = (*fMatrix)[fMap[i]];
-
-    //*fLog << "MHDisp::GetVal; i, fMatrix, fMap, val = "
-    //    << i << ",  " << fMatrix << ",  " << fMap[i] << ",  " << val << endl;
-
-    return val;
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Fill the histograms and sum up the Minimization paramter outcome 
-// of each processed event
-//
-Bool_t MHDisp::Fill(const MParContainer *par, const Stat_t w)
-{
-    Double_t energy = 0.;
-    Double_t impact = 0.;
-    Double_t xmax = 0.;
-
-    if ( fMatrix || (!fMatrix && fMcEvt) )
-    {  
-      energy   = fMatrix ? GetVal(kEnergy)     : fMcEvt->GetEnergy();
-      impact   = fMatrix ? GetVal(kImpact)     : fMcEvt->GetImpact();
-      xmax     = fMatrix ? GetVal(kLongitmax)  : fMcEvt->GetLongitmax();      
-    }
-
-    Double_t theta      = fMatrix ? GetVal(kZd)  : fPointing->GetZd();
-    //    Double_t phi        = fMatrix ? GetVal(kAz)  : fPointing->GetAz();
-
-    Double_t xsrcpos0   = fMatrix ? GetVal(kX)       : fSrcPos->GetX();
-    Double_t ysrcpos0   = fMatrix ? GetVal(kY)       : fSrcPos->GetY();
-    Double_t xmean0     = fMatrix ? GetVal(kMeanX)   : fHil->GetMeanX();  
-    Double_t ymean0     = fMatrix ? GetVal(kMeanY)   : fHil->GetMeanY();
-    Double_t delta      = fMatrix ? GetVal(kDelta)   : fHil->GetDelta();
-    
-    Double_t size       = fMatrix ? GetVal(kSize)    : fHil->GetSize();
-    
-    Double_t m3long     = fMatrix ? GetVal(kM3Long)  : fHilExt->GetM3Long();
-    Double_t asym       = fMatrix ? GetVal(kAsym)    : fHilExt->GetAsym();
-
-    //------------------------------------------
-    // convert to deg
-    Double_t xsrcpos  = xsrcpos0 * fMm2Deg;
-    Double_t ysrcpos  = ysrcpos0 * fMm2Deg;
-    Double_t xmean    = xmean0 * fMm2Deg;
-    Double_t ymean    = ymean0 * fMm2Deg;
-    
-    // calculate cosinus of the angle between d and a vectors
-    Double_t a = (xmean-xsrcpos)*cos(delta) + (ymean-ysrcpos)*sin(delta);
-    Double_t b = sqrt( (xmean-xsrcpos)*(xmean-xsrcpos) + (ymean-ysrcpos)*(ymean-ysrcpos) );
-    Double_t cosda = a/b;
-    
-    // sign of cosda
-    Int_t s0 = cosda>0 ? 1 : -1;   
-    
-    // get the sign of M3Long and Asym variables
-    Int_t sm3 = m3long>0 ? 1 : -1;
-    Int_t sa  =   asym>0 ? 1 : -1;
-    
-    // set the sign "s" that will select one Disp source position for each
-    // shower, according to each of the possible algorithms for solution selection:
-    //   SelectedPos = 1  means choose the right source position
-    //                 2                   wrong
-    //                 3               the position according to M3Long
-    //                 4               the position according to Asym
-    Int_t s = s0;
-    if (fSelectedPos == 1)    
-      s = s0;  
-    else if (fSelectedPos == 2)
-      s = -s0;
-    else if (fSelectedPos == 3)
-      s = sm3;
-    else if (fSelectedPos == 4)
-      s = sa;
-    else
-      *fLog << "Illegal value for Disp srcpos selection algorithm: " 
-	    << " fSelectedPos = " << fSelectedPos << endl;
-    
-    // count the number of events where source position has been correctly assigned
-    if (s == s0)
-      fEvCorrAssign->Fill(log10(size), 1.);
-    else
-      fEvCorrAssign->Fill(log10(size), 0.);
-    
-    // get estimated Disp value
-    Double_t disp = fImageParDisp->GetDisp();
-    
-    //------------------------------------------
-    // Disp estimated source position
-    Double_t xdisp = xmean - s*cos(delta)*disp;
-    Double_t ydisp = ymean - s*sin(delta)*disp;
-    fSkymapXY->Fill(xdisp,ydisp);
-    
-    // Distance between estimated Disp and real source position
-    Double_t d2 = (xdisp-xsrcpos)*(xdisp-xsrcpos) +  (ydisp-ysrcpos)*(ydisp-ysrcpos); 
-    fHistMinPar->Fill(d2);
-    
-    // Longitudinal and transversal distances between Disp and real source positon
-    Double_t Du = -s*( (xdisp-xsrcpos)*cos(delta) + (ydisp-ysrcpos)*sin(delta));
-    Double_t Dv = -s*(-(xdisp-xsrcpos)*sin(delta) + (ydisp-ysrcpos)*cos(delta));
-    fHistDuDv->Fill(Dv,Du);
-    
-    // Fill Energy, Size and ZA distributions
-    if (fMatrix || (!fMatrix && fMcEvt))
-      fHistEnergy->Fill(log10(energy));
-    fHistSize->Fill(log10(size));
-    fHistcosZA->Fill(cos(theta/kRad2Deg));
-    
-    // to check the size and energy dependence of the optimization
-    if (fMatrix || (!fMatrix && fMcEvt))
-    {
-      fHistMinParEnergy->Fill(log10(energy),d2);
-      fHistDuEnergy->Fill(log10(energy),Du);
-      fHistDvEnergy->Fill(log10(energy),Dv);
-    }
-    fHistMinParSize->Fill(log10(size),d2);
-    fHistDuSize->Fill(log10(size),Du);
-    fHistDvSize->Fill(log10(size),Dv);
-    
-    // variables for the Minimization parameter calculation (= d^2)
-    fNumEv += 1;
-    fSumMinPar += d2;  
-    
-    return kTRUE;
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Calculates the final Minimization parameter of the Disp optimization
-//
-Bool_t MHDisp::Finalize()
-{
-    fMinPar->SetVal(fSumMinPar/fNumEv);
-    *fLog << endl;
-    *fLog << "MHDisp::Finalize: SumMinPar, NumEv = " << fSumMinPar << ", " << fNumEv << endl;
-    *fLog << "MHDisp::Finalize: Final MinPar = " << fMinPar->GetVal() << endl;
-    
-    fMinPar->SetVal(fHistMinPar->GetMean());
-    *fLog << "MHDisp::Finalize: Final MinPar = " << fMinPar->GetVal() << endl;
-
-    SetReadyToSave();
-
-    return kTRUE;
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Creates a new canvas and draws the Disp related histograms into it.
-// Be careful: The histograms belongs to this object and won't get deleted
-// together with the canvas.
-//
-void MHDisp::Draw(Option_t *opt)
-{
-    gStyle->SetPalette(1);
-
-    TString title = GetName();
-    title += ": ";
-    title += GetTitle();
-
-    TCanvas *pad = new TCanvas(GetName(),title,0,0,900,1500);    
-    pad->SetBorderMode(0);
-    pad->Divide(3,5);
-
-    pad->cd(1);
-    gPad->SetBorderMode(0);
-    fHistcosZA->SetTitleOffset(1.2,"Y");
-    fHistcosZA->DrawClone(opt);
-    fHistcosZA->SetBit(kCanDelete);
-    gPad->Modified();
-
-    pad->cd(2);
-    gPad->SetBorderMode(0);
-    fHistEnergy->SetTitleOffset(1.2,"Y");
-    fHistEnergy->DrawClone(opt);
-    fHistEnergy->SetBit(kCanDelete);
-    gPad->Modified();
-
-    pad->cd(3);
-    gPad->SetBorderMode(0);
-    fHistSize->SetTitleOffset(1.2,"Y");
-    fHistSize->DrawClone(opt);
-    fHistSize->SetBit(kCanDelete);
-    gPad->Modified();
-
-    pad->cd(4);
-    gPad->SetBorderMode(0);
-    fHistMinPar->SetTitleOffset(1.2,"Y");
-    fHistMinPar->DrawClone(opt);
-    fHistMinPar->SetBit(kCanDelete);
-    gPad->Modified();
-
-    TProfile *profMinParEnergy = fHistMinParEnergy->ProfileX("Minimization parameter vs. Energy",0,99999,"s");
-    profMinParEnergy->SetXTitle("log10(Energy) [GeV]");
-    profMinParEnergy->SetYTitle("Minimization parameter = d^2 Disp to real srcpos [deg^2]");
-    pad->cd(5);
-    gPad->SetBorderMode(0);
-    profMinParEnergy->SetTitleOffset(1.2,"Y");
-    profMinParEnergy->SetStats(0);
-    profMinParEnergy->DrawClone(opt);
-    profMinParEnergy->SetBit(kCanDelete);
-    gPad->Modified();
-
-    TProfile *profMinParSize = fHistMinParSize->ProfileX("Minimization parameter vs. Size",0,99999,"s");
-    profMinParSize->SetXTitle("log10(Size) [#phot]");
-    profMinParSize->SetYTitle("Minimization parameter = d^2 Disp to real srcpos [deg^2]");
-    pad->cd(6);
-    gPad->SetBorderMode(0);
-    profMinParSize->SetTitleOffset(1.2,"Y");
-    profMinParSize->SetStats(0);
-    profMinParSize->DrawClone(opt);
-    profMinParSize->SetBit(kCanDelete);
-    gPad->Modified();
-
-    pad->cd(7);
-    gPad->SetBorderMode(0);
-    fSkymapXY->SetTitleOffset(1.2,"Y");
-    fSkymapXY->DrawClone("COLZ");
-    fSkymapXY->SetBit(kCanDelete);
-    gPad->Modified();
-
-    pad->cd(8);
-    gPad->SetBorderMode(0);
-    fEvCorrAssign->SetTitleOffset(1.2,"Y");
-    fEvCorrAssign->DrawClone(opt);
-    fEvCorrAssign->SetBit(kCanDelete);
-    gPad->Modified();
-
-    pad->cd(9);
-    gPad->SetBorderMode(0);
-    fHistDuDv->SetTitleOffset(1.2,"Y");
-    fHistDuDv->DrawClone("COLZ");
-    fHistDuDv->SetBit(kCanDelete);
-    gPad->Modified();
-
-    TH1F *histDu = (TH1F*)fHistDuDv->ProjectionY("histDu");
-    histDu->SetTitle("Longitudinal distance Du");
-    histDu->SetXTitle("Du = longitudinal distance [deg]");
-    pad->cd(10);
-    gPad->SetBorderMode(0);
-    histDu->SetTitleOffset(1.2,"Y");
-    histDu->DrawClone(opt);
-    histDu->SetBit(kCanDelete);
-    gPad->Modified();
-
-    TProfile *profDuEnergy = fHistDuEnergy->ProfileX("Du vs. Energy",0,99999,"s");
-    profDuEnergy->SetXTitle("log10(Energy) [GeV]");
-    profDuEnergy->SetYTitle("Du = longitudinal distance [deg]");
-    pad->cd(11);
-    gPad->SetBorderMode(0);
-    profDuEnergy->SetTitleOffset(1.2,"Y");
-    profDuEnergy->SetStats(0);
-    profDuEnergy->DrawClone(opt);
-    profDuEnergy->SetBit(kCanDelete);
-    gPad->Modified();
-
-    TProfile *profDuSize = fHistDuSize->ProfileX("Du vs. Size",0,99999,"s");
-    profDuSize->SetXTitle("log10(Size) [#phot]");
-    profDuSize->SetYTitle("Du = longitudinal distance [deg]");
-    pad->cd(12);
-    gPad->SetBorderMode(0);
-    profDuSize->SetTitleOffset(1.2,"Y");
-    profDuSize->SetStats(0);
-    profDuSize->DrawClone(opt);
-    profDuSize->SetBit(kCanDelete);
-    gPad->Modified();
-
-    TH1F *histDv = (TH1F*)fHistDuDv->ProjectionX("histDv");
-    histDv->SetTitle("Transversal distance Dv");
-    histDv->SetXTitle("Dv = transversal distance [deg]");
-    pad->cd(13);
-    gPad->SetBorderMode(0);
-    histDv->SetTitleOffset(1.2,"Y");
-    histDv->DrawClone(opt);
-    histDv->SetBit(kCanDelete);
-    gPad->Modified();
-
-    TProfile *profDvEnergy = fHistDvEnergy->ProfileX("Dv vs. Energy",0,99999,"s");
-    profDvEnergy->SetXTitle("log10(Energy) [GeV]");
-    profDvEnergy->SetYTitle("Dv = transversal distance [deg]");
-    pad->cd(14);
-    gPad->SetBorderMode(0);
-    profDvEnergy->SetTitleOffset(1.2,"Y");
-    profDvEnergy->SetStats(0);
-    profDvEnergy->DrawClone(opt);
-    profDvEnergy->SetBit(kCanDelete);
-    gPad->Modified();
-
-    TProfile *profDvSize = fHistDvSize->ProfileX("Dv vs. Size",0,99999,"s");
-    profDvSize->SetXTitle("log10(Size) [#phot]");
-    profDvSize->SetYTitle("Dv = transversal distance [deg]");
-    pad->cd(15);
-    gPad->SetBorderMode(0);
-    profDvSize->SetTitleOffset(1.2,"Y");
-    profDvSize->SetStats(0);
-    profDvSize->DrawClone(opt);
-    profDvSize->SetBit(kCanDelete);
-    gPad->Modified();
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MHDisp.h
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MHDisp.h	(revision 7136)
+++ 	(revision )
@@ -1,111 +1,0 @@
-#ifndef MARS_MHDisp
-#define MARS_MHDisp
-
-#ifndef MARS_MH
-#include "MH.h"
-#endif
-
-#ifndef ROOT_TArrayI
-#include <TArrayI.h>
-#endif
-
-class TH1F;
-class TH2F;
-class TProfile;
-class MImageParDisp;
-class MSrcPosCam;
-class MHillas;
-class MHillasExt;
-class MNewImagePar;
-class MMcEvt;
-class MPointingPos;
-class MHMatrix;
-class MParameterD;
-
-class MHDisp : public MH
-{
-private:
-
-    MImageParDisp *fImageParDisp;  // container with the estimated Disp
-    MSrcPosCam    *fSrcPos;
-    MHillas       *fHil;
-    MHillasExt    *fHilExt;
-    MNewImagePar  *fNewPar;
-    MMcEvt        *fMcEvt;
-    MPointingPos  *fPointing;
-
-    TString fImageParDispName;
-
-    Int_t fSelectedPos;      // flag to select which of the two Disp source position
-                             // solutions we want to fill the histograms (see Set function)
-
-    TH1F *fHistEnergy;       // Energy distribution of events
-    TH1F *fHistSize;         // Size distribution of events
-    TH1F *fHistcosZA;        // cosinus Zenith angle distribution of events
-    TH2F *fSkymapXY;         // 2D histogram for Disp estimated source positions
-    TH1F *fHistMinPar;       // Histogram of the event Minimization Parameter (= d^2 = 
-                             // = distance^2 between Disp estimated and true source position)
-    TH2F *fHistDuDv;         // Distribution of longitudinal (Du) and transversal 
-                             // (Dv) distances between Disp and true source position    
-    TH2F *fHistMinParEnergy; // Minimization Parameter (= d^2) vs. Energy
-    TH2F *fHistMinParSize;   // Minimization Parameter (= d^2) vs. Size
-    TH2F *fHistDuEnergy;     // Du vs. Energy
-    TH2F *fHistDuSize;       // Du vs. Size
-    TH2F *fHistDvEnergy;     // Dv vs. Energy
-    TH2F *fHistDvSize;       // Dv vs. Size
-    TProfile *fEvCorrAssign; // % events with source position well assign vs. Size 
-
-
-    Double_t fMm2Deg;        // conversion factor from mm to deg
-
-    MHMatrix *fMatrix;       // matrix storing variables needed for the Disp optimization
-    TArrayI fMap;            // array storing the matrix mapping column numbers corresponding
-                             // to each variable added to fMatrix
-
-    Double_t GetVal(Int_t i) const;
-
-    Int_t fNumEv;            // total number of events
-    Double_t fSumMinPar;     // current sum of the minimization parameter   
-    MParameterD *fMinPar;    // final minimization parameters of the Disp optimization
-
-public:
-
-    MHDisp(const char *imagepardispname = "MImageParDisp",
-	   const char *name=NULL, const char *title=NULL);
-    ~MHDisp();
-
-    Bool_t SetupFill(const MParList *plist);
-    Bool_t Fill(const MParContainer *par, const Stat_t w=1);
-    Bool_t Finalize();  
-
-    void SetSelectedPos(Int_t iflag);
-
-    void SetMatrixMap(MHMatrix *matrix, TArrayI &map);    
-    void GetMatrixMap(MHMatrix* &matrix, TArrayI &map);  // get matrix and its mapping array
-
-    void InitMapping(MHMatrix *mat);       // define the matrix of variables
-                                           // needed for the Disp optimization
-
-    TH1F *GetHistEnergy()       { return fHistEnergy; } 
-    TH1F *GetHistSize()         { return fHistSize; } 
-    TH1F *GetHistcosZA()        { return fHistcosZA; } 
-    TH2F *GetSkymapXY()         { return fSkymapXY; }
-    TH1F *GetHistMinPar()       { return fHistMinPar; }
-    TH2F *GetHistDuDv()         { return fHistDuDv; }
-    TH2F *GetHistMinParEnergy() { return fHistMinParEnergy; }
-    TH2F *GetHistMinParSize()   { return fHistMinParSize; }
-    TH2F *GetHistDuEnergy()     { return fHistDuEnergy; }
-    TH2F *GetHistDuSize()       { return fHistDuSize; }
-    TH2F *GetHistDvEnergy()     { return fHistDvEnergy; }
-    TH2F *GetHistDvSize()       { return fHistDvSize; }
-    TProfile *GetEvCorrAssign() { return fEvCorrAssign; }
-
-    void Draw(Option_t *opt="");
-
-    ClassDef(MHDisp, 1) // Container holding the Histograms for Disp and
-                        // the parameter to minimize in the Disp optimization
-};
-
-#endif
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MImageParDisp.cc
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MImageParDisp.cc	(revision 7136)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Eva Domingo    , 12/2004 <mailto:domingo@ifae.es>
-!              Wolfgang Wittek, 12/2004 <mailto:wittek@mppmu.mpg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2005
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// MImageParDisp
-//
-// Storage Container for estimated distance to source position (Disp)
-//
-/////////////////////////////////////////////////////////////////////////////
-#include "MImageParDisp.h"
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-
-ClassImp(MImageParDisp);
-
-using namespace std;
-
-// --------------------------------------------------------------------------
-//
-// Default constructor.
-//
-MImageParDisp::MImageParDisp(const char *name, const char *title)
-{
-    fName  = name  ? name  : "MImageParDisp";
-    fTitle = title ? title : "Estimated distance to source position (Disp)";
-
-    Reset();
-}
-
-// --------------------------------------------------------------------------
-//
-void MImageParDisp::Reset()
-{
-    fDisp = -1;
-}
-
-// --------------------------------------------------------------------------
-//
-void MImageParDisp::Print(Option_t *) const
-{
-    *fLog << all;
-    *fLog << "Estimated distance to source position (" << GetName() << ")" << endl;
-    *fLog << " - Disp [deg] = " << fDisp << endl;
-}
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MImageParDisp.h
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MImageParDisp.h	(revision 7136)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#ifndef MARS_MImageParDisp
-#define MARS_MImageParDisp
-
-#ifndef MARS_MParContainer
-#include "MParContainer.h"
-#endif
-
-class MImageParDisp : public MParContainer
-{
-private:
-
-    Float_t fDisp;     // [deg] distance between the image center
-                       //       and the estimated source position,
-                       //       along the major axis of the image
-
-public:
-
-    MImageParDisp(const char *name=NULL, const char *title=NULL);
-
-    void Reset();
-
-    void SetDisp(Float_t disp)  { fDisp = disp; }
-    Float_t GetDisp() const     { return fDisp; }
-
-    void Print(Option_t *opt=NULL) const;
-
-    ClassDef(MImageParDisp, 1) // Container to hold estimated distance to source position (Disp)
-};
-
-#endif
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MLiveTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MLiveTime.cc	(revision 7136)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Javier López , 7/2004 <mailto:jlopez@ifae.es>
-!
-!   Copyright: MAGIC Software Development, 2000-2004
-!
-!
-\* ======================================================================== */
-
-#include "MLiveTime.h"
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-ClassImp(MLiveTime);
-
-using namespace std;
-
-MLiveTime::MLiveTime(UInt_t numberbins, const char *name, const char *title)
-{
-
-    fName  = name  ? name  : "MLiveTime";
-    fTitle = title ? title : "Container to hold the live time for a certain time bin";
-    
-    Set(numberbins);
-}
-
-void MLiveTime::Set(UInt_t numberbins)
-{
-  fNumberTimeBins = numberbins;
-  fLiveTimeBin.Set(numberbins);
-  fMeanRealTimeBin.Set(numberbins);
-  fWidthRealTimeBin.Set(numberbins);
-}
-
-void MLiveTime::Print(const Option_t* o) const
-{
-    TString opt = o;
-
-    Double_t totalLiveTime = 0;
-
-    if (opt.Contains("last", TString::kIgnoreCase))
-    {
-	*fLog << GetName() << ": Present real time bin " << setprecision(10) << fMeanRealTimeBin[fNumberTimeBins-1] << " +- " << setprecision(5) << fWidthRealTimeBin[fNumberTimeBins-1] << " [" <<  2*fWidthRealTimeBin[fNumberTimeBins-1]*24*60*60 << " sec] MJD" << endl;
-	*fLog << GetName() << ": Present live time " << fLiveTimeBin[fNumberTimeBins-1] << " sec" << endl;
-    }
-    else if (opt.Contains("all", TString::kIgnoreCase))
-    {
-	*fLog << GetName() << ": " << fNumberTimeBins << " time bins" << endl;
-	for (UInt_t bin = 0; bin<fNumberTimeBins; bin++)
-	{
-	    *fLog << GetName() << ": Present real time bin " << setprecision(10) << fMeanRealTimeBin[bin] << " +- " << setprecision(5) <<  fWidthRealTimeBin[bin] << " [" <<  2*fWidthRealTimeBin[bin]*24*60*60 << " sec] MJD" << endl;
-	    *fLog << GetName() << ": Present live time " << fLiveTimeBin[bin] << " sec" << endl;
-	    totalLiveTime += fLiveTimeBin[bin];
-	}		
-	*fLog << GetName() << ": Total live time " << totalLiveTime << " sec" << endl;
-    }
-    else
-	*fLog << GetName() << warn << "::Print() Bad argument " << opt << endl; 
-}
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MLiveTime.h
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MLiveTime.h	(revision 7136)
+++ 	(revision )
@@ -1,51 +1,0 @@
-#ifndef MARS_MLiveTime
-#define MARS_MLiveTime
-
-#ifndef MARS_MParContainer
-#include "MParContainer.h"
-#endif
-
-#ifndef ROOT_TArrayD
-#include <TArrayD.h>
-#endif
-
-class MLiveTime : public MParContainer
-{
- private:
-  
-  UInt_t fNumberTimeBins;
-  TArrayD fLiveTimeBin;
-  TArrayD fMeanRealTimeBin;
-  TArrayD fWidthRealTimeBin;
-  
-  void Set(UInt_t numberbins);
-
- public:
-
-  MLiveTime(UInt_t numberbins = 1, const char *name=NULL, const char *title=NULL);
-  //~MLiveTime;
-
-  void AddBin() { Set(fNumberTimeBins+1); }
-  void AddTime(Double_t time) { fLiveTimeBin[fNumberTimeBins-1]+=time; }
-  void SetRealTime (Double_t mean, Double_t width)
-      {
-	  fMeanRealTimeBin[fNumberTimeBins-1]=mean;
-	  fWidthRealTimeBin[fNumberTimeBins-1]=width;
-      }
-
-  UInt_t GetNumberTimeBins() { return fNumberTimeBins;}
-  Double_t GetLiveTime() { return fLiveTimeBin[fNumberTimeBins-1]; }
-  Double_t GetMeanRealTime() { return fMeanRealTimeBin[fNumberTimeBins-1]; }
-  Double_t GetWidthRealTime() { return fWidthRealTimeBin[fNumberTimeBins-1]; }
-
-  TArrayD& GetLiveTimeTArray()      { return fLiveTimeBin; }
-  TArrayD& GetMeanRealTimeTArray()  { return fMeanRealTimeBin; }
-  TArrayD& GetWidthRealTimeTArray() { return fWidthRealTimeBin; }
-
-  void Print(const Option_t*) const;
-
- ClassDef(MLiveTime, 1)    // Storage for the live time extracted from real data
-
-};
-
-#endif
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MLiveTimeCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MLiveTimeCalc.cc	(revision 7136)
+++ 	(revision )
@@ -1,360 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!   Author(s): Javier López , 7/2004 <mailto:jlopez@ifae.es>
-!
-!   Copyright: MAGIC Software Development, 2000-2004
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//
-//  MLiveTimeCalc
-//
-/////////////////////////////////////////////////////////////////////////////
-#include "MLiveTimeCalc.h"
-
-#include "MRawRunHeader.h"
-#include "MRawEvtHeader.h"
-#include "MLiveTime.h"
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-#include "MParList.h"
-#include "MTaskList.h"
-
-ClassImp(MLiveTimeCalc)
-using namespace std;
-
-Bool_t Debug = kFALSE;
-Bool_t PrintNewRun = kTRUE;
-
-MLiveTimeCalc::MLiveTimeCalc(const char *name, const char *title) : kSecTomSec(1e3), kDayToSec(24.*60.*60.), fRunHeader(NULL), fEvtHeader(NULL), fPresentEventTime(NULL), fLiveTime(NULL)
-{
-
-  fName  = name  ? name  : "MLiveTimeCalc";
-  fTitle = title ? title : "Task to compute the live time from real data.";
-
-  for (Int_t i=0; i<10; i++)
-    fNumberLostEvents[i] = 0;
-  
-  fFirstEventMjd = 0.;
-  fPresentEventMjd = 0.;
-  fLastEventMjd = 0.;
-
-  fPresentEventNumber = 0;
-  fLastEventNumber = 0;
-
-  fPresentEventRunNumber = 0;
-  fLastEventRunNumber = 0;
-
-  fRealTimeBinSize = 0.;
-
-  fPrintNextEvent = kFALSE;
-}
-
-Int_t MLiveTimeCalc::PreProcess(MParList *pList)
-{
-  
-  fEvtHeader = (MRawEvtHeader*)pList->FindObject(AddSerialNumber("MRawEvtHeader"));
-  if (!fEvtHeader)
-    {
-      *fLog << err << AddSerialNumber("MRawEvtHeader") << " not found ... aborting" << endl;
-      return kFALSE;
-    }
-  
-  fRunHeader = (MRawRunHeader*)pList->FindObject(AddSerialNumber("MRawRunHeader"));
-  if (!fRunHeader)
-    {
-      *fLog << err << AddSerialNumber("MRawRunHeader") << " not found ... aborting" << endl;
-      return kFALSE;
-    }
-  
-  fPresentEventTime = (MTime*)pList->FindObject(AddSerialNumber("MTime"));
-  if (!fPresentEventTime)
-    {
-      *fLog << err << AddSerialNumber("MTime") << " not found ... aborting" << endl;
-      return kFALSE;
-    }
-  
-  
-  fLiveTime = (MLiveTime*)pList->FindCreateObj(AddSerialNumber("MLiveTime"));
-  if (!fLiveTime)
-    {
-      *fLog << err << AddSerialNumber("MLiveTime") << " cannot be created ... aborting" << endl;
-      return kFALSE;
-    }
-  
-  return kTRUE;
-}
-
-Int_t MLiveTimeCalc::Process()
-{
-
-  fPresentEventMjd       = fPresentEventTime->GetMjd(); 
-  fLastEventMjd          = fLastEventTime.GetMjd();
-  fPreaviusLastEventMjd  = fPreaviusLastEventTime.GetMjd();
-
-  fPresentEventNumber    = fEvtHeader->GetDAQEvtNumber();
-  fPresentEventRunNumber = fRunHeader->GetRunNumber();;
-  
-  if (fPrintNextEvent && Debug)
-  {
-      *fLog << dbg << GetName() << ": Printing next event" << endl;
-      Print("all");
-      fLiveTime->Print("last");
-      *fLog << inf << endl; 
-      fPrintNextEvent = kFALSE;
-  }
-	  
-  if (fFirstEventMjd == 0)
-  {
-      fFirstEventMjd = fPresentEventMjd;
-
-      fPreaviusLastEventTime = fLastEventTime;
-      fLastEventTime = *fPresentEventTime;
-
-      fPreaviusLastEventRunNumber = fLastEventRunNumber;
-      fLastEventRunNumber = fPresentEventRunNumber;
-
-      fPreaviusLastEventNumber = fLastEventNumber;
-      fLastEventNumber = fPresentEventNumber;
-  }
-  else
-  {
-      if (isTimeStampOk())
-      {
-	  if (fRealTimeBinSize > 0 &&
-	      (fPresentEventMjd - fFirstEventMjd)*kDayToSec > fRealTimeBinSize)
-	  {
-
-	      Double_t width = (fLastEventMjd - fFirstEventMjd)/2;
-	      Double_t mean  = fFirstEventMjd + width;
-	      
-	      fLiveTime->SetRealTime(mean,width);
-	      
-	      if (Debug)
-		{
-		  *fLog << inf << GetName() << ": New time bin" << endl;
-		  Print("all");
-		  *fLog << GetName() << ": First event time " << setprecision(10) << fFirstEventMjd << setprecision(5) << endl;
-		  fLiveTime->Print("last");
-		}
-	      
-	      fLiveTime->AddBin();
-	      fFirstEventMjd = fPresentEventMjd;
-	  }      
-
-	  if (fPresentEventRunNumber!=fLastEventRunNumber)
-	  {
-	      if (fLastEventRunNumber != 0 && PrintNewRun)
-	      {
-		  *fLog << dbg << GetName() << ": New run" << endl;
-		  Print("all");
-		  fLiveTime->Print("last");
-		  *fLog << inf << endl;
-	      }
-	      fLastEventRunNumber = fPresentEventRunNumber;
-	  }
-	  else
-	      fLiveTime->AddTime((fPresentEventMjd-fLastEventMjd)*kDayToSec);
-	  
-
-      
-      fPreaviusLastEventTime = fLastEventTime;
-      fLastEventTime = *fPresentEventTime;
-
-      fPreaviusLastEventRunNumber = fLastEventRunNumber;
-      fLastEventRunNumber = fPresentEventRunNumber;
-
-      fPreaviusLastEventNumber = fLastEventNumber;      
-      fLastEventNumber = fPresentEventNumber;
-
-      }
-  }
-
-  return kTRUE;
-}
-  
-Int_t MLiveTimeCalc::PostProcess()
-{
-  Double_t width = (fLastEventMjd - fFirstEventMjd)/2;
-  Double_t mean  = fFirstEventMjd + width;
- 
-  fLiveTime->SetRealTime(mean,width);
-
-  *fLog << dbg << endl;
-  *fLog << dbg << GetName() << ": PostProcess" << endl;
-  fLiveTime->Print("all");
-  *fLog << inf << endl;
-
-  *fLog << GetName() << " execution statistics:" << endl;
-  *fLog << dec << setfill(' ');
-
-  ULong_t fTotalNumberLostEvents = 0;
-  for (Int_t i=0; i<6; i++)
-    fTotalNumberLostEvents += fNumberLostEvents[i];
-
-  *fLog << " " << setw(7) << fTotalNumberLostEvents << " (" << setw(3) ;
-  *fLog << (Int_t)(fTotalNumberLostEvents*100/GetNumExecutions()) ;
-  *fLog << "%) bad time stamp events" << endl;
-
-  *fLog << "\t\t(" << setw(3) << (Int_t)(fNumberLostEvents[0]*100/fTotalNumberLostEvents) ;
-  *fLog << "%) time stamp == 0" << endl;
-
-  *fLog << "\t\t(" << setw(3) << (Int_t)(fNumberLostEvents[1]*100/fTotalNumberLostEvents) ;
-  *fLog << "%) last time stamp  == 0" << endl;
-
-  *fLog << "\t\t(" << setw(3) << (Int_t)(fNumberLostEvents[2]*100/fTotalNumberLostEvents) ;
-  *fLog << "%) time stamp in the past" << endl;
-
-  *fLog << "\t\t(" << setw(3) << (Int_t)(fNumberLostEvents[3]*100/fTotalNumberLostEvents) ;
-  *fLog << "%) time stamp == last one" << endl;
-
-  *fLog << "\t\t(" << setw(3) << (Int_t)(fNumberLostEvents[4]*100/fTotalNumberLostEvents) ;
-  *fLog << "%) time stamp just with integer part" << endl;
-
-  *fLog << "\t\t(" << setw(3) << (Int_t)(fNumberLostEvents[5]*100/fTotalNumberLostEvents) ;
-  *fLog << "%) run number < last one" << endl;
-
-  return kTRUE;
-}
-
-Bool_t MLiveTimeCalc::isTimeStampOk()
-{
-
-  Bool_t result = kTRUE;
-  
-
-  if (fPresentEventMjd == 0)
-    {
-	
-      if (Debug)
-	{
-	    *fLog << err << GetName() << ": Present event time stamp equal to 0" << endl;
-	    Print("all");
-	}
-
-      fNumberLostEvents[0]++;
-      result = kFALSE;
-      fPrintNextEvent = kTRUE;
-    }
-  else if (fLastEventMjd == 0)
-    {
-	
-      if (Debug)
-	{
-	    *fLog << err << GetName() << ": Last event time stamp equal to 0" << endl;
-	    Print("all");
-	}
-
-      fNumberLostEvents[1]++;
-      result = kFALSE;
-      fPrintNextEvent = kTRUE;
-    }
-  else if (fPresentEventMjd-fLastEventMjd < 0)
-    {
-      
-      if (Debug)
-	{
-	    *fLog << err << GetName() << ": Present event with time stamp in the past" << endl;
-	    Print("all");
-	}
-	  
-      fNumberLostEvents[2]++;
-      result = kFALSE;
-      fPrintNextEvent = kTRUE;
-    }
-  else if (fPresentEventMjd-fLastEventMjd == 0)
-    {
-      
-      if (Debug)
-	{
-	    *fLog << err << GetName() << ": Present event time stamp equal than last event" << endl;
-	    Print("all");
-	}
-      
-      fNumberLostEvents[3]++;
-      result = kFALSE;
-      fPrintNextEvent = kTRUE;
-    }
-  else if (fPresentEventNumber- fLastEventNumber<= 0 && fPresentEventRunNumber == fLastEventRunNumber)
-    {
-      
-      if (Debug)
-	{
-	    *fLog << warn << GetName() << ": Present event number equal or smaller than last event" << endl;
-	  Print("all");
-	}
-
-      result = kTRUE;
-      fPrintNextEvent = kTRUE;
-    }
-  else if ((Int_t)fPresentEventMjd == fPresentEventMjd)
-    {
-      
-      if (Debug)
-	{
-	    *fLog << err << GetName() << ": Present event time stamp idetical to midnight" << endl;
-	    Print("all");
-	}
-      
-      fNumberLostEvents[4]++;
-      result = kFALSE;
-      fPrintNextEvent = kTRUE;
-    }
-  else if  ((fPresentEventMjd-fLastEventMjd)*kDayToSec > 1.)
-  {
-      
-      if (Debug)
-      {
-	  *fLog << warn << GetName() << ": Time from last event bigger than 1 sec" << endl;
-	  Print("all");
-      }
-      
-      result = kTRUE;
-      fPrintNextEvent = kTRUE;
-  }
-  else if  (fPresentEventRunNumber-fLastEventRunNumber < 0)
-  {
-      
-      if (Debug)
-      {
-	  *fLog << warn << GetName() << ": Present run number previuos than last one" << endl;
-	  Print("all");
-      }
-      
-      fNumberLostEvents[5]++;
-      result = kTRUE;
-      fPrintNextEvent = kTRUE;
-  }
-
-  return result;
-}
-
-void MLiveTimeCalc::Print(const Option_t *o) const
-{
-
-  *fLog << "Present event run number       ["  << fPresentEventRunNumber << "] event number [" << fPresentEventNumber << ']' << endl;
-  *fLog << "Last event run number          ["  << fLastEventRunNumber << "] event number [" << fLastEventNumber << ']' << endl;
-  *fLog << "Preavius last event run number ["  << fPreaviusLastEventRunNumber << "] event number [" << fPreaviusLastEventNumber << ']' << endl;
-  *fLog << "Present, last and preavius to last event times:"  << endl;
-  fPresentEventTime->Print();
-  fLastEventTime.Print();
-  fPreaviusLastEventTime.Print();
-}
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MLiveTimeCalc.h
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MLiveTimeCalc.h	(revision 7136)
+++ 	(revision )
@@ -1,71 +1,0 @@
-#ifndef MARS_MLiveTimeCalc
-#define MARS_MLiveTimeCalc
-
-#ifndef MARS_MTask
-#include "MTask.h"
-#endif
-
-#ifndef MARS_MTime
-#include "MTime.h"
-#endif
-
-class MRawRunHeader;
-class MRawEvtHeader;
-class MLiveTime;
-
-class MLiveTimeCalc : public MTask
-{
- public:
-  
-  const Double_t kSecTomSec;
-  const Double_t kDayToSec;
-  
- private:
-  
-  MRawRunHeader* fRunHeader;
-  MRawEvtHeader* fEvtHeader;
-
-  MTime*         fPresentEventTime;
-  MTime          fLastEventTime;
-  MTime          fPreaviusLastEventTime;
-
-  MLiveTime*     fLiveTime;
-
-  
-  UInt_t   fNumberLostEvents[10];
-
-  Double_t fFirstEventMjd;
-  Double_t fPresentEventMjd;
-  Double_t fLastEventMjd;
-  Double_t fPreaviusLastEventMjd;
-
-  Int_t    fPresentEventNumber;
-  Int_t    fLastEventNumber;
-  Double_t fPreaviusLastEventNumber;
-
-  Int_t    fPresentEventRunNumber;
-  Int_t    fLastEventRunNumber;
-  Double_t fPreaviusLastEventRunNumber;
-
-  Double_t fRealTimeBinSize;
-  
-  Bool_t fPrintNextEvent;
-
- public:
-
-  MLiveTimeCalc(const char *name=NULL, const char *title=NULL);
-  //~MLiveTimeCalc;
-
-  Int_t PreProcess(MParList *pList);
-  Int_t Process();
-  Int_t PostProcess();
-
-  void SetRealTimeBinSize(Double_t time) { fRealTimeBinSize=time; }
-
-  Bool_t isTimeStampOk();
-  void Print(const Option_t *o) const;
-
- ClassDef(MLiveTimeCalc, 0)    // Task to compute the live time from real data
-};
-
-#endif
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MTopologyCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MTopologyCalc.cc	(revision 7136)
+++ 	(revision )
@@ -1,133 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Josep Flix   09/2004 <mailto:jflix@ifae.es>
-!
-!   Copyright: MAGIC Software Development, 2004
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// MTopologyCalc
-//
-// Taks that evaluates the Topological Parameters of images after image cleaning
-//
-// fDistance = SUM_(i,j) D_ij , where i,j<UsedPixels and d_ij are distances
-//                              between pixels. This characterizes topology.
-//
-// fUsed = Used Pixels after image cleaning.
-//
-/////////////////////////////////////////////////////////////////////////////
-
-#include "MTopologyCalc.h"
-
-#include "MParList.h"
-
-#include "MTopology.h"
-
-#include "MCerPhotEvt.h"
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-ClassImp(MTopologyCalc);
-
-using namespace std;
-
-static const TString gsDefName  = "MTopologyCalc";
-static const TString gsDefTitle = "Calculate Topology related parameters";
-
-// -------------------------------------------------------------------------
-//
-// Default constructor.
-//
-MTopologyCalc::MTopologyCalc(const char *name, const char *title)
-    : fTopology(NULL)
-{
-    fName  = name  ? name  : gsDefName.Data();
-    fTitle = title ? title : gsDefTitle.Data();
-
-}
-
-// -------------------------------------------------------------------------
-//
-Int_t MTopologyCalc::PreProcess(MParList *pList)
-{
-
-    fCerPhotEvt = (MCerPhotEvt*)pList->FindObject("MCerPhotEvt");
-    if (!fCerPhotEvt)
-    {
-        *fLog << err << dbginf << "MCerPhotEvt not found... aborting." << endl;
-        return kFALSE;
-    }
-
-    fGeomCam = (MGeomCam*)pList->FindObject("MGeomCam");
-    if (!fGeomCam)
-    {
-        *fLog << err << dbginf << "MGeomCam not found... aborting." << endl;
-        return kFALSE;
-    }
-
-    fTopology = (MTopology*)pList->FindCreateObj("MTopology");
-    if (!fTopology)
-        return kFALSE;
- 
-    return kTRUE;
-
-}
-
-// -------------------------------------------------------------------------
-//
-Int_t MTopologyCalc::Process()
-{
-
-    Int_t rc = fTopology->Calc(*fGeomCam, *fCerPhotEvt);
-    
-    if (rc == 1)
-	fErrors++;
-
-    return kTRUE;
-}
-
-// --------------------------------------------------------------------------
-//
-//  Prints some statistics about the Topology calculation. The percentage
-//  is calculated with respect to the number of executions of this task.
-//
-Int_t MTopologyCalc::PostProcess()
-{
-    if (GetNumExecutions()==0)
-        return kTRUE;
-
-    *fLog << inf << endl;
-    *fLog << GetDescriptor() << " execution statistics:" << endl;
-    *fLog << dec << setfill(' ');
-    *fLog << " " << fErrors << " (" << (int)(fErrors*100/GetNumExecutions()) 
-	  << "%) Evts skipped due to UsedPixels == -1" << endl;
-    *fLog << endl;
-
-    /*
-    delete fHillas;
-    delete fHillasSrc;
-    delete fSrcPos;
-    delete fTopology;
-    */
-
-    return kTRUE;
-}
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MTopologyCalc.h
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MTopologyCalc.h	(revision 7136)
+++ 	(revision )
@@ -1,34 +1,0 @@
-#ifndef MARS_MTopologyCalc
-#define MARS_MTopologyCalc
-
-#ifndef MARS_MTask
-#include "MTask.h"
-#endif
-
-class MGeomCam;
-class MCerPhotEvt;
-class MTopology;
-
-class MTopologyCalc : public MTask
-{
-private:
-
-    const MGeomCam     *fGeomCam;
-    const MCerPhotEvt  *fCerPhotEvt;
-
-    MTopology      *fTopology;
-
-    Int_t       fErrors;
-   
-    Int_t PreProcess(MParList *plist);
-    Int_t Process();
-    Int_t PostProcess();
-
-public:
-
-    MTopologyCalc(const char *name=NULL, const char *title=NULL);
-    
-    ClassDef(MTopologyCalc, 0) // task to calculate....
-};
-
-#endif
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/DispSkymap.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/DispSkymap.C	(revision 7136)
+++ 	(revision )
@@ -1,223 +1,0 @@
-//************************************************************************
-//
-// Authors : Eva Domingo,     1/2005 <mailto:domingo@ifae.es>
-//
-//
-// Macro for generating DISP Skymap of the FoV
-// -------------------------------------------
-//
-//************************************************************************
-
-void DispSkymap(TString onfilename  = "ONhillasfile.root",
-		TString offfilename = "OFFhillasfile.root",
-		TString outfilename = "skymaps.root",
-		Float_t HadronnessCut = 0.06, 
-		Float_t SizeCut = 1000.)
-{
-  //======================================================================
-  // Make Disp plots
-  //======================================================================
-  
-  gLog << "-----------------------------------------------------" << endl; 
-  gLog << "Make Disp related plots" << endl;
-  gLog << "-----------------------------------------------------" << endl; 
-  
-  // Input root file/s storing the computed Hillas and Disp parameters
-  gLog << "Input ON file/s: "  <<  onfilename  << endl;
-  gLog << "Input OFF file/s: " <<  offfilename << endl;
-  
-
-  //----------------------------------------------------
-  MTaskList tliston;
-  MParList  pliston;
-
-  MTaskList tlistoff;
-  MParList  plistoff;
-  
-  // MReadMarsFile readon("Events", onfilename);
-  MReadTree readon("Parameters", onfilename);
-  readon.DisableAutoScheme();
-
-  // MReadMarsFile readoff("Events", offfilename);
-  MReadTree readoff("Parameters", offfilename);
-  readoff.DisableAutoScheme();
-  
-  MGeomCamMagic geomcam;
-
-  // set cuts to select an event sample to apply Disp
-  MFDisp *fdisp = NULL;
-  //      fdisp = new MFDisp;
-  //      fdisp->SetCuts(0,1,7,600,0,600,0.,3000000.,0.,0.,0.,0.,0.,0.);
-  //      MContinue contdisp(fdisp);
-
-  // Hadroness cut
-  TString hadrcut = "MHadronness.fHadronness<";
-  hadrcut += HadronnessCut;
-  gLog << "Hadronness Cut applied = " << hadrcut << endl;
-  MF hadrfilter(hadrcut);  
-  MContinue conthadr(&hadrfilter);
-  conthadr.SetInverted(kTRUE);
-
-  // Size cut
-  TString sizecut = "MHillas.fSize>";
-  sizecut += SizeCut;
-  gLog << "Size Cut applied = " << sizecut << endl;
-  MF sizefilter(sizecut);  
-  MContinue contsize(&sizefilter);
-  contsize.SetInverted(kTRUE);
-
-  // make Disp plots
-  // SelectedPos = 1  means choose the right source position
-  //               2                   wrong
-  //               3               the position according to M3Long
-  //               4               the position according to Asym
-  MHDisp hdispon;
-  hdispon.SetName("MHDispAsymOn");
-  hdispon.SetSelectedPos(4);
-  MFillH filldispon("MHDispAsymOn[MHDisp]", "");
-
-  MHDisp hdispoff;
-  hdispoff.SetName("MHDispAsymOff");
-  hdispoff.SetSelectedPos(4);
-  MFillH filldispoff("MHDispAsymOff[MHDisp]", "");
-  
-  
-  //*****************************
-  // entries in MParList On
-  pliston.AddToList(&tliston);
-  pliston.AddToList(&geomcam);
-  pliston.AddToList(&hdispon);
-
-  // entries in MParList Off
-  plistoff.AddToList(&tlistoff);
-  plistoff.AddToList(&geomcam);
-  plistoff.AddToList(&hdispoff);
-
-  
-  //*****************************
-  // entries in MTaskList On
-  tliston.AddToList(&readon);
-  if (fdisp != NULL)
-    tliston.AddToList(&contdisp);
-  tliston.AddToList(&conthadr);
-  tliston.AddToList(&contsize);
-  tliston.AddToList(&filldispon);
-
-  // entries in MTaskList Off
-  tlistoff.AddToList(&readoff);
-  if (fdisp != NULL)
-    tlist.AddToList(&contdisp);
-  tlistoff.AddToList(&conthadr);
-  tlistoff.AddToList(&contsize);
-  tlistoff.AddToList(&filldispoff);
-  
-  //*****************************
-  
-  //-------------------------------------------
-  // Execute event loop On
-  MProgressBar barOn;
-  MEvtLoop evtloopOn;
-  evtloopOn.SetParList(&pliston);
-  evtloopOn.SetProgressBar(&barOn);
-  
-  Int_t maxeventsOn = -1;
-  if ( !evtloopOn.Eventloop(maxeventsOn) )
-    return;
-  
-  tliston.PrintStatistics(0, kTRUE);
-
-  //-------------------------------------------
-  // Execute event loop Off
-  MProgressBar barOff;
-  MEvtLoop evtloopOff;
-  evtloopOff.SetParList(&plistoff);
-  evtloopOff.SetProgressBar(&barOff);
-  
-  Int_t maxeventsOff = -1;
-  if ( !evtloopOff.Eventloop(maxeventsOff) )
-    return;
-  
-  tlistoff.PrintStatistics(0, kTRUE);
-  
-
-  //-------------------------------------------
-  // Get the skymaps
-  TH2F *skymapOn  = hdispon.GetSkymapXY();
-  skymapOn->SetName("fSkymapXYOn");
-  skymapOn->SetTitle("ON DATA: Disp estimated source positions Skymap");
-  skymapOn->SetTitleOffset(1.2,"Y");
-  TH2F *skymapOff = hdispoff.GetSkymapXY();
-  skymapOff->SetName("fSkymapXYOff");
-  skymapOff->SetTitle("OFF DATA: Disp estimated source positions Skymap");
-  skymapOff->SetTitleOffset(1.2,"Y");
-
-  // Normalize to the number of events and subtract Off to On skymap
-  Double_t onentries  = skymapOn->GetEntries();
-  Double_t offentries = skymapOff->GetEntries();
-  Double_t norm = onentries/offentries;
-  cout << "Number of ON events after cuts = "  << onentries  << endl;
-  cout << "Number of OFF events after cuts = " << offentries << endl;
-  cout << "Normalization factor = " << norm << endl;
-
-  TH2F *skymap = new TH2F("fSkymapXY", 
-         "ON-OFF: Disp estimated source positions Skymap", 71, -2., 2., 71, -2., 2.);
-  skymap->Add(skymapOn,skymapOff,1.,-norm);
-  skymap->SetTitleOffset(1.2,"Y");
-  
-  //-------------------------------------------
-  // Display the skymaps
-  gLog << endl;
-  gLog << "Drawing DISP Skymaps for the FoV ...... "   << endl;
-  gLog << "(srcpos solution selected according Asym sign)" << endl; 
-
-  gStyle->SetPalette(1);
-  gStyle->SetOptStat(11);
-
-  TCanvas *c = new TCanvas("c","Disp Skymaps",0,0,900,900);    
-  c->SetBorderMode(0);
-  c->Divide(2,2);
-
-  c->cd(1);
-  gPad->SetBorderMode(0);
-  skymapOn->DrawClone("COLZ");
-  skymapOn->SetBit(kCanDelete);
-  gPad->Modified();
-
-  c->cd(2);
-  gPad->SetBorderMode(0);
-  skymapOff->DrawClone("COLZ");
-  skymapOff->SetBit(kCanDelete);
-  gPad->Modified();
-
-  c->cd(3);
-  gPad->SetBorderMode(0);
-  skymap->DrawClone("COLZ");
-  skymap->SetBit(kCanDelete);
-  gPad->Modified();
-
-  //-------------------------------------------
-  // Save the skymaps in a .root file
-  TFile outfile(outfilename,"RECREATE");
-  skymapOn->Write();
-  skymapOff->Write();
-  skymap->Write();
-  outfile.Close();
-  gLog << endl << "Skymaps stored in file: " << outfilename <<endl;
-
-  //-------------------------------------------
-  gLog << endl << "Disp plots were made for files: " << endl;
-  gLog << "ON data:  " << onfilename  << endl; 
-  gLog << "OFF data: " << offfilename << endl; 
-  gLog << "-----------------------------------------------------" << endl; 
-
-}
-
-
-
-
-
-
-
-
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/alpha.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/alpha.C	(revision 7136)
+++ 	(revision )
@@ -1,175 +1,0 @@
-/* ======================================================================== *\!
-!   Author(s): Oscar Blanch & Javier Rico
-\* ======================================================================== */
-
-void alpha(
-    Float_t cutsize=2000,
-    Float_t upcutsize=9999999,
-    Float_t lengthlowcut=0.,
-    Float_t lengthcut=0.26,
-    Float_t widthlowcut=0.,
-    Float_t widthcut=0.12
-)
-{    
-    // constants
-    const Int_t nbins = 9;
-    TString psname("alphaMrk.gif");
-    // general settings
-    gROOT->Reset();
-    gStyle->SetCanvasColor(0);
-    gStyle->SetCanvasBorderMode(0);
-    gStyle->SetPadBorderMode(0);
-    gStyle->SetFrameBorderMode(0);
-    gStyle->SetOptTitle(0);
-    gStyle->SetTitleOffset(1.7,"y");
-    gStyle->SetPadLeftMargin(0.15);
-    gStyle->SetOptStat(111110);
-    gStyle->SetStatColor(0);
-    gStyle->SetStatBorderSize(1);
-    gStyle->SetStatW(0.2);
-    gStyle->SetStatH(0.1);
-    gStyle->SetStatX(0.9);
-    gStyle->SetStatY(0.9);
-    
-    // define files, chain, trees, canvas...
-    TChain* ton= new TChain("Parameters");
-    
-    // ON data
-    ton->Add("/mnt/users/jrico/magic/mars/mars/mtemp/mifae/hillas/crab20040215OnRotateCalA-D.root");
-
-    TChain* toff= new TChain("Parameters");
-
-    // OFF data
-    toff->Add("/mnt/users/jrico/magic/mars/mars/mtemp/mifae/hillas/crab20040215OffRotateCalA-H.root");
-    
-    TCanvas *c1 = new TCanvas("c1","c1",800,500);
-    c1->cd(1);
-
-    // define aliases
-    ton->SetAlias("length","MHillas.fLength*0.6/189");
-    ton->SetAlias("width","MHillas.fWidth*0.6/189");
-    ton->SetAlias("dist","MHillasSrc.fDist*0.6/189");
-    ton->SetAlias("conc","MNewImagePar.fConc");
-    ton->SetAlias("size","MHillas.fSize");
-    ton->SetAlias("event","MRawEvtHeader.fDAQEvtNumber");
-    ton->SetAlias("alpha","abs(MHillasSrc.fAlpha)");
-    ton->SetAlias("leakage","MNewImagePar.fInnerLeakage1");
-    
-    toff->SetAlias("length","MHillas.fLength*0.6/189");
-    toff->SetAlias("width","MHillas.fWidth*0.6/189");
-    toff->SetAlias("dist","MHillasSrc.fDist*0.6/189");
-    toff->SetAlias("conc","MNewImagePar.fConc");
-    toff->SetAlias("size","MHillas.fSize");
-    toff->SetAlias("event","MRawEvtHeader.fDAQEvtNumber");
-    toff->SetAlias("alpha","abs(MHillasSrc.fAlpha)");
-    toff->SetAlias("leakage","MNewImagePar.fInnerLeakage1");
-
-    // define  cut(s)
-//    const char* eventcut="event%4==0 &&";
-    const char* eventcut="";
-    const char varcut[512];
-    //    sprintf(varcut,"size>%f && size<%f && length>%f  &&length<%f && width>%f &&  width<%f",cutsize,upcutsize,lengthlowcut,lengthcut,widthlowcut,widthcut);
-    sprintf(varcut,"size>%f && size<%f  && dist>0.2 && dist<1.1 && leakage==0 && length>%f  &&length<%f && width>%f &&  width<%f",cutsize,upcutsize,lengthlowcut,lengthcut,widthlowcut,widthcut);
-//    sprintf(varcut,"size>%f && dist>0.2 && dist<0.8 && length<0.21 && width<0.125",cutsize,upcutsize,lengthcut,widthcut);
-//    sprintf(varcut,"size>%f && size<%f  && dist>0.2 && dist<0.8 && length<0.21 && width<0.125",cutsize,upcutsize);
-//    sprintf(varcut,"size>%f && size<%f  && dist>0.2 && dist<0.8 && length<0.21",cutsize,upcutsize);
-//    sprintf(varcut,"size>%f && size<%f  && dist>0.2 && dist<0.8",cutsize,upcutsize);
-//    sprintf(varcut,"size>%f && size<%f",cutsize,upcutsize)
-//    sprintf(varcut,"");
-    Char_t cut[256];
-    Char_t cutoff[256];
-    strcat(cut,eventcut);
-    strcat(cut,varcut);
-    strcat(cutoff,varcut);
-
-    // fill on/off histos
-    TH1F* onhisto       = new TH1F("OnHist" ,"Alpha Plot",nbins,0,90);
-    TH1F* offhisto      = new TH1F("OffHist","Alpha Plot",nbins,0,90);    
-    ton->Draw("alpha>>OnHist",cut);
-    toff->Draw("alpha>>OffHist",cutoff);
-    cout << "Applied cut: " << cut << endl;
-    
-    // line/normalization
-    const Int_t inibin = 20./90.*nbins+1;
-    Float_t level=0;
-    Float_t leveloff=0;
-    Float_t levelofferror=0;
-    for(Int_t ibin = inibin; ibin<=nbins;ibin++)
-    {
-	level+=onhisto->GetBinContent(ibin);
-	leveloff+=offhisto->GetBinContent(ibin);
-    }
-    level/=(nbins-inibin+1);
-    leveloff/=(nbins-inibin+1);
-    
-    // normalize on/off
-    offhisto->Sumw2(); // needed to compute correct errors after normalization
-    const Float_t norm = level/leveloff;
-    cout << "Normalizing by factor " << norm <<endl;
-    offhisto->Scale(norm);    
-
-    // significance:
-    Float_t sig=0,bg=0,esig=0,ebg=0;
-    Float_t significance=0;
-    const Int_t signbins = inibin-1;
-    for(Int_t ibin = 1; ibin<=signbins;ibin++)
-    {
-//	Float_t sigma = (onhisto->GetBinContent(ibin)-level)/onhisto->GetBinError(ibin);
-//	significance+=sigma*sigma;
-	sig  += onhisto->GetBinContent(ibin);
-	esig += onhisto->GetBinError(ibin)*onhisto->GetBinError(ibin);
-	bg   += offhisto->GetBinContent(ibin);
-	ebg  += offhisto->GetBinError(ibin)*offhisto->GetBinError(ibin);
-    }
-    Float_t error= TMath::Sqrt(esig+ebg);
-    significance = (sig-bg)/error;
-    
-    cout << "Excess: " << sig-bg << endl;
-    cout << "N bkg: "  << bg << endl; 
-    cout << "Significance: " << significance << endl;
-
-    // plot
-    onhisto->SetXTitle("alpha (deg)");
-    onhisto->SetYTitle("Entries");
-    onhisto->SetMarkerColor(4);
-    onhisto->SetMarkerStyle(20);
-    onhisto->SetMarkerSize(.7);
-    onhisto->SetLineColor(4);
-    onhisto->SetMaximum(onhisto->GetBinContent(nbins)*1.5);
-
-    offhisto->SetFillColor(2);
-    offhisto->SetMaximum(offhisto->GetBinContent(nbins)*1.5);
-    offhisto->SetXTitle("alpha (deg)");
-    offhisto->SetYTitle("Entries");
-
-    offhisto->Draw("HIST");
-    offhisto->Draw("ESAME");
-    onhisto->Draw("ESAMES");
-    //    onhisto->Draw("E");
-
-    // move stat box to make them all visible
-    gPad->Update();
-    TPaveStats* offpavstat = (TPaveStats*) offhisto->GetListOfFunctions()->FindObject("stats");
-    if(offpavstat)
-    {
-	Float_t shiftx = offpavstat->GetX2NDC()-offpavstat->GetX1NDC();
-	offpavstat->SetX1NDC(offpavstat->GetX1NDC()-shiftx);
-	offpavstat->SetX2NDC(offpavstat->GetX2NDC()-shiftx);
-    }
-
-    // draw line
-    TLine* line = new TLine(0.,level,90.,level);
-    line->SetLineColor(2);
-    line->SetLineStyle(2);
-//    line->Draw();
-
-    gPad->Modified();
-    gPad->Update();
-
-    // produce ps
-    //  char psname[50];
-    //  sprintf(psname,"%s.ps",var);
-    c1->Print(psname);
-}
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/alpha_plot.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/alpha_plot.C	(revision 7136)
+++ 	(revision )
@@ -1,835 +1,0 @@
-Double_t ChiSquareNDof(TH1D *h1, TH1D *h2)
-{
-    Double_t chiq = 0.;
-    Double_t chi;
-    Double_t error;
-    Int_t nbinsnozero = 0;
-
-    Int_t nbins = h1->GetNbinsX();
-    if (nbins != h2->GetNbinsX() || nbins == 0)
-	return -1;
-
-    for (UInt_t bin=1; bin<=nbins; bin++)
-    {
-	error = sqrt(h1->GetBinError(bin)*h1->GetBinError(bin) +
-			   h2->GetBinError(bin)*h2->GetBinError(bin));
-	if (error != 0)
-	{
-	    chi = (h1->GetBinContent(bin)-h2->GetBinContent(bin))/error;
-	    chiq += chi*chi;
-	    nbinsnozero++;
-	}
-    }
-
-    return chiq/nbinsnozero;
-}
-
-void alpha_plot(TString f_on_name  = "../HillasFiles/Mrk421/*_H.root",
-		TString f_off_name = "../HillasFiles/OffMrk421/*_H.root",
-		TString f_src_name = "../HillasFiles/20040319_OffMrk421.fake.pos")	     
-{
-
-    const UInt_t numEntries = 100000000;
-    
-    //cuts
-    Float_t sizemin   = 2000.; //[ADC]
-    Float_t sizemax   = 10000000000.; //[ADC]
-    Float_t widthmin  = 0.06; 
-    Float_t widthmax  = 0.12;
-    Float_t lengthmin = 0.10; 
-    Float_t lengthmax = 0.26;
-    Float_t distmin   = 0.3; 
-    Float_t distmax   = 1.2;
-    Float_t alphamin   = 0.; 
-    Float_t alphamax   = 90.;
-
-    //integration
-    Float_t sigexccmin = 0.;
-    Float_t sigexccmax = 30.;
-    Float_t bkgnormmin = 30.;
-    Float_t bkgnormmax = 90.;
-    
-    gStyle->SetOptStat(111111);
-    gStyle->SetOptFit();
-    
-    //
-    // Make a loop only for the ON data:
-    //
-    
-    MParList plist_on;
-    MTaskList tlist_on;
-    plist_on.AddToList(&tlist_on);
-  
-    // ON containers
-    MGeomCamMagic geomcam;
-    MSrcPosCam source_on;
-    MHillas hillas;
-    MHillasSrc hillasscr;
-    
-    plist_on.AddToList(&geomcam);
-    plist_on.AddToList(&source_on);
-    plist_on.AddToList(&hillas);
-    plist_on.AddToList(&hillasscr);
-    
-    //create some 1-dim histo to test only for the ON distribution of dist, width , length, size...
-    MH3 hDist_on("MHillasSrc.fDist/315.");
-    hDist_on.SetName("Dist_on");
-    plist_on.AddToList(&hDist_on);
-    MBinning binsDist_on("BinningDist_on");
-    Int_t nbins_Dist = 20;
-    Float_t min_Dist = 0.;
-    Float_t max_Dist = distmax*1.2;
-    binsDist_on.SetEdges(nbins_Dist, min_Dist, max_Dist);
-    plist_on.AddToList(&binsDist_on);
-    
-    MH3 hWidth_on("MHillas.fWidth/315.");
-    hWidth_on.SetName("Width_on");
-    plist_on.AddToList(&hWidth_on);
-    MBinning binsWidth_on("BinningWidth_on");
-    Int_t nbins_Width = 20;
-    Float_t min_Width = 0.;
-    Float_t max_Width = widthmax*1.2;
-    binsWidth_on.SetEdges(nbins_Width, min_Width, max_Width);
-    plist_on.AddToList(&binsWidth_on);
-    
-    MH3 hLength_on("MHillas.fLength/315.");
-    hLength_on.SetName("Length_on");
-    plist_on.AddToList(&hLength_on);
-    MBinning binsLength_on("BinningLength_on");
-    Int_t nbins_Length = 20;
-    Float_t min_Length = 0.;
-    Float_t max_Length =  lengthmax*1.2;
-    binsLength_on.SetEdges(nbins_Length, min_Length, max_Length);
-    plist_on.AddToList(&binsLength_on);
-    
-    MH3 hSize_on("log10(MHillas.fSize)");
-    hSize_on.SetName("Size_on");
-    plist_on.AddToList(&hSize_on);
-    MBinning binsSize_on("BinningSize_on");
-    Int_t nbins_Size = 60;
-    Float_t min_Size = log10(sizemin)*0.8;
-    Float_t max_Size = log10(1000000)*1.2;
-    binsSize_on.SetEdges(nbins_Size, min_Size, max_Size);
-    plist_on.AddToList(&binsSize_on);
-    
-    //create a histo to fill the alpha values: one alpha plot form 0 to +90 deg in abs value
-    MH3 hAlpha_on_abs("abs(MHillasSrc.fAlpha)");
-    hAlpha_on_abs.SetName("Alpha_on_abs");
-    plist_on.AddToList(&hAlpha_on_abs);
-    MBinning binsAlpha_on_abs("BinningAlpha_on_abs");
-    Int_t nbins_abs = 9;
-    Float_t minalpha_abs = 0.;
-    Float_t maxalpha_abs =90.;
-    binsAlpha_on_abs.SetEdges(nbins_abs, minalpha_abs, maxalpha_abs);
-    plist_on.AddToList(&binsAlpha_on_abs);
-    
-    //create a histo to fill the alpha values: one alpha plot form -90 to +90 deg.
-    MH3 hAlpha_on("MHillasSrc.fAlpha");
-    hAlpha_on.SetName("Alpha_on");
-    plist_on.AddToList(&hAlpha_on);
-    MBinning binsAlpha_on("BinningAlpha_on");
-    Int_t nbins = nbins_abs*2;
-    Float_t minalpha = -90.;
-    Float_t maxalpha =  90.;
-    binsAlpha_on.SetEdges(nbins, minalpha, maxalpha);
-    plist_on.AddToList(&binsAlpha_on);
-    
-
-    MH3 hSrcPos_on("MSrcPosCam.fX","MSrcPosCam.fY");
-    hSrcPos_on.SetName("SrcPos_on");
-    plist_on.AddToList(&hSrcPos_on);
-    MBinning binsSrcPos_onX("BinningSrcPos_onX");
-    MBinning binsSrcPos_onY("BinningSrcPos_onY");
-    Int_t nbins_srcpos = 400;
-    Float_t minsrcpos = -600.;
-    Float_t maxsrcpos =  600.;
-    binsSrcPos_onX.SetEdges(nbins_srcpos, minsrcpos, maxsrcpos);
-    binsSrcPos_onY.SetEdges(nbins_srcpos, minsrcpos, maxsrcpos);
-    plist_on.AddToList(&binsSrcPos_onX);
-    plist_on.AddToList(&binsSrcPos_onY);
-
-    MH3 hDAQEvtNumber_on("MRawEvtHeader.fDAQEvtNumber");
-    hDAQEvtNumber_on.SetName("DAQEvtNumber_on");
-    plist_on.AddToList(&hDAQEvtNumber_on);
-    MBinning binsDAQEvtNumber_onX("BinningDAQEvtNumber_onX");
-    Int_t nbins_evtnum = 1000;
-    Float_t minevtnum =  0.;
-    Float_t maxevtnum =  1000.;
-    binsDAQEvtNumber_onX.SetEdges(nbins_evtnum,minevtnum,maxevtnum);
-    plist_on.AddToList(&binsDAQEvtNumber_onX);
-
-    //
-    //tasks
-    //
-    
-    MReadTree read_on("Parameters", f_on_name);
-    read_on.DisableAutoScheme();
- 
-
-    //cuts
-    TString sizestr = "(MHillas.fSize < ";
-    sizestr += sizemin;
-    sizestr += ") || (";
-    sizestr += "MHillas.fSize > ";
-    sizestr += sizemax;
-    sizestr += ")";
-    MF sizefilter(sizestr);
-    
-    TString widthstr = "({MHillas.fWidth/315.} < ";
-    widthstr += widthmin;
-    widthstr += ") || (";
-    widthstr += "{MHillas.fWidth/315.} > ";
-    widthstr += widthmax;
-    widthstr += ")";
-    MF widthfilter(widthstr);
-    
-    TString lengthstr = "({MHillas.fLength/315.} < ";
-    lengthstr += lengthmin;
-    lengthstr += ") || (";
-    lengthstr += "{MHillas.fLength/315.} > ";
-    lengthstr += lengthmax;
-    lengthstr += ")";
-    MF lengthfilter(lengthstr);
-    
-    TString diststr = "({MHillasSrc.fDist/315.} < ";
-    diststr += distmin;
-    diststr += ") || (";
-    diststr += "{MHillasSrc.fDist/315.} > ";
-    diststr += distmax;
-    diststr += ")";
-    MF distfilter(diststr);
-    
-    TString alphastr = "({abs(MHillasSrc.fAlpha)} < ";
-    alphastr += alphamin;
-    alphastr += ") || (";
-    alphastr += "{abs(MHillasSrc.fAlpha)} > ";
-    alphastr += alphamax;
-    alphastr += ")";
-    MF alphafilter(alphastr);
-    
-    MF evenfilter("{MRawEvtHeader.fDAQEvtNumber%3}<0.5");
-    MF oddfilter("{MRawEvtHeader.fDAQEvtNumber%3}>0.5");
-
-    MContinue cont_size(&sizefilter);
-    MContinue cont_width(&widthfilter);
-    MContinue cont_length(&lengthfilter);
-    MContinue cont_dist(&distfilter);
-    MContinue cont_alpha(&alphafilter);
-    MContinue cont_even(&evenfilter);
-    MContinue cont_odd(&oddfilter);
-    
-    //    MSrcPosFromFile srccalc(f_src_name);
-    MSrcPlace srccalc;
-    
-    MHillasSrcCalc csrc_on;
-
-    // fill all histograms
-    MFillH falpha_on_abs(&hAlpha_on_abs);
-    MFillH falpha_on(&hAlpha_on);
-    MFillH fdist_on(&hDist_on);
-    MFillH fwidth_on(&hWidth_on);
-    MFillH flength_on(&hLength_on);
-    MFillH fsize_on(&hSize_on);
-    MFillH fsrcpos_on(&hSrcPos_on);
-    MFillH fevtnum_on(&hDAQEvtNumber_on);
-    
-
-    // prints
-    MPrint pevent("MRawEvtHeader");
-    MPrint phillas("MHillas");
-    MPrint phillassrc("MHillasSrc");
-    MPrint psrcpos("MSrcPosCam");
-
-    //tasklist
-    tlist_on.AddToList(&read_on);
-    tlist_on.AddToList(&srccalc);
-    tlist_on.AddToList(&csrc_on);
-    tlist_on.AddToList(&fsrcpos_on);
-//    tlist_on.AddToList(&cont_odd);
-    tlist_on.AddToList(&cont_size);
-    tlist_on.AddToList(&cont_width);
-    tlist_on.AddToList(&cont_length);
-    tlist_on.AddToList(&cont_dist);
-    tlist_on.AddToList(&cont_alpha);
-    tlist_on.AddToList(&falpha_on_abs);
-    tlist_on.AddToList(&falpha_on);
-    tlist_on.AddToList(&fdist_on);
-    tlist_on.AddToList(&fwidth_on);
-    tlist_on.AddToList(&flength_on);
-    tlist_on.AddToList(&fsize_on);
-    tlist_on.AddToList(&fevtnum_on);
-    
-    // Create and setup the eventloop
-    MEvtLoop loop_on;
-    loop_on.SetParList(&plist_on);
-  //loop_on.SetDisplay(display);
-    
-    MProgressBar bar;
-    loop_on.SetProgressBar(&bar);
-    
-    if (!loop_on.Eventloop(numEntries))
-	return;
-
-    tlist_on.PrintStatistics();
-    
-    // 
-    // Make a loop only for the OFF data:
-    //
-    
-    MParList plist_off;
-    MTaskList tlist_off;
-    plist_off.AddToList(&tlist_off);
-    
-    MSrcPosCam source_off;
-
-    plist_off.AddToList(&geomcam);
-    plist_off.AddToList(&source_off);
-    plist_off.AddToList(&hillas);
-    plist_off.AddToList(&hillasscr);
-
-    //create some 1-dim histo to test only for the OFF distribution of dist, width , length, size...
-    MH3 hDist_off("MHillasSrc.fDist/315.");
-    hDist_off.SetName("Dist_off");
-    plist_off.AddToList(&hDist_off);
-    MBinning binsDist_off("BinningDist_off");
-    binsDist_off.SetEdges(nbins_Dist, min_Dist, max_Dist);
-    plist_off.AddToList(&binsDist_off);
-    
-    MH3 hWidth_off("MHillas.fWidth/315.");
-    hWidth_off.SetName("Width_off");
-    plist_off.AddToList(&hWidth_off);
-    MBinning binsWidth_off("BinningWidth_off");
-    binsWidth_off.SetEdges(nbins_Width, min_Width, max_Width);
-    plist_off.AddToList(&binsWidth_off);
-
-    MH3 hLength_off("MHillas.fLength/315.");
-    hLength_off.SetName("Length_off");
-    plist_off.AddToList(&hLength_off);
-    MBinning binsLength_off("BinningLength_off");
-    binsLength_off.SetEdges(nbins_Length, min_Length, max_Length);
-    plist_off.AddToList(&binsLength_off);
-    
-    MH3 hSize_off("log10(MHillas.fSize)");
-    hSize_off.SetName("Size_off");
-    plist_off.AddToList(&hSize_off);
-    MBinning binsSize_off("BinningSize_off");
-    binsSize_off.SetEdges(nbins_Size, min_Size, max_Size);
-    plist_off.AddToList(&binsSize_off);
-    
-    //create a histo to fill the alpha values: from 0 to 90 deg -> abs value
-    MH3 hAlpha_off_abs("abs(MHillasSrc.fAlpha)");
-    hAlpha_off_abs.SetName("Alpha_off_abs");
-    plist_off.AddToList(&hAlpha_off_abs);
-    MBinning binsAlpha_off_abs("BinningAlpha_off_abs");
-    binsAlpha_off_abs.SetEdges(nbins_abs, minalpha_abs, maxalpha_abs);
-    plist_off.AddToList(&binsAlpha_off_abs);
-    
-    //create a histo to fill the alpha values: from -90 to 90 deg
-    MH3 hAlpha_off("MHillasSrc.fAlpha");
-    hAlpha_off.SetName("Alpha_off");
-    plist_off.AddToList(&hAlpha_off);
-    MBinning binsAlpha_off("BinningAlpha_off");
-    binsAlpha_off.SetEdges(nbins, minalpha, maxalpha);
-    plist_off.AddToList(&binsAlpha_off);
-    
-    
-    MH3 hSrcPos_off("MSrcPosCam.fX","MSrcPosCam.fY");
-    hSrcPos_off.SetName("SrcPos_off");
-    plist_off.AddToList(&hSrcPos_off);
-    MBinning binsSrcPos_offX("BinningSrcPos_offX");
-    MBinning binsSrcPos_offY("BinningSrcPos_offY");
-    binsSrcPos_offX.SetEdges(nbins_srcpos, minsrcpos, maxsrcpos);
-    binsSrcPos_offY.SetEdges(nbins_srcpos, minsrcpos, maxsrcpos);
-    plist_off.AddToList(&binsSrcPos_offX);
-    plist_off.AddToList(&binsSrcPos_offY);
-
-    MH3 hDAQEvtNumber_off("MRawEvtHeader.fDAQEvtNumber");
-    hDAQEvtNumber_off.SetName("DAQEvtNumber_off");
-    plist_off.AddToList(&hDAQEvtNumber_off);
-    MBinning binsDAQEvtNumber_offX("BinningDAQEvtNumber_offX");
-    Int_t nbins_evtnum = 100;
-    Float_t minevtnum =  0.;
-    Float_t maxevtnum =  100.;
-    binsDAQEvtNumber_offX.SetEdges(nbins_evtnum,minevtnum,maxevtnum);
-    plist_off.AddToList(&binsDAQEvtNumber_offX);
-
-   //tasks
-    MReadTree read_off("Parameters", f_off_name);
-    read_off.DisableAutoScheme();
-    
-    srccalc.SetMode(MSrcPlace::kOff);
-
-    MHillasSrcCalc csrc_off;
-
-    // fill all histograms
-    MFillH falpha_off_abs(&hAlpha_off_abs);
-    MFillH falpha_off(&hAlpha_off);
-    MFillH fdist_off(&hDist_off);
-    MFillH fwidth_off(&hWidth_off);
-    MFillH flength_off(&hLength_off);
-    MFillH fsize_off(&hSize_off);
-    MFillH fsrcpos_off(&hSrcPos_off);
-    MFillH fevtnum_off(&hDAQEvtNumber_off);
-   
-    //tasklist
-    tlist_off.AddToList(&read_off);
-    tlist_off.AddToList(&srccalc);
-    tlist_off.AddToList(&csrc_off);
-    tlist_off.AddToList(&fsrcpos_off);
-//    tlist_off.AddToList(&cont_even);
-    tlist_off.AddToList(&cont_size);
-    tlist_off.AddToList(&cont_width);
-    tlist_off.AddToList(&cont_length);
-    tlist_off.AddToList(&cont_dist);
-    tlist_off.AddToList(&cont_alpha);
-    tlist_off.AddToList(&falpha_off_abs);
-    tlist_off.AddToList(&falpha_off);
-    tlist_off.AddToList(&fdist_off);
-    tlist_off.AddToList(&fwidth_off);
-    tlist_off.AddToList(&flength_off);
-    tlist_off.AddToList(&fsize_off);
-    tlist_off.AddToList(&fevtnum_off);
-     
-    // Create and setup the eventloop
-    MEvtLoop loop_off;
-    loop_off.SetParList(&plist_off);
-    //loop_off.SetDisplay(display);
-    
-    MProgressBar bar_off;
-    loop_off.SetProgressBar(&bar_off);
-    
-    if (!loop_off.Eventloop(numEntries))
-	return;
-    
-    tlist_off.PrintStatistics();
-    
-  // ############################################################################
-  //  look for the histograms
-  // ############################################################################
-
-  TH1F *hist_size_on = (TH1F*)hSize_on.GetHist();
-  TH1F *hist_size_off = (TH1F*)hSize_off.GetHist();
-
-  TH1F *hist_dist_on = (TH1F*)hDist_on.GetHist();
-  TH1F *hist_dist_off = (TH1F*)hDist_off.GetHist();
-
-  TH1F *hist_width_on = (TH1F*)hWidth_on.GetHist();
-  TH1F *hist_width_off = (TH1F*)hWidth_off.GetHist();
-
-  TH1F *hist_length_on = (TH1F*)hLength_on.GetHist();
-  TH1F *hist_length_off = (TH1F*)hLength_off.GetHist();
-
-  TH1F *hist_on_abs = (TH1F*)hAlpha_on_abs.GetHist();
-  TH1F *hist_off_abs = (TH1F*)hAlpha_off_abs.GetHist();
-
-  TH1F *hist_on = (TH1F*)hAlpha_on.GetHist();
-  TH1F *hist_off = (TH1F*)hAlpha_off.GetHist();
-
-
-  // ############################################################################
-  // Calculate significance and excess: 
-  // ############################################################################
-
-  Double_t norm_on_abs  = (Double_t) hist_on_abs->Integral((Int_t)bkgnormmin*nbins_abs/90+1,(Int_t)bkgnormmax*nbins_abs/90+1);
-  Double_t exces_on_abs = (Double_t) hist_on_abs->Integral((Int_t)sigexccmin*nbins_abs/90+1,(Int_t)sigexccmax*nbins_abs/90+1);
-  Double_t norm_off_abs  = (Double_t) hist_off_abs->Integral((Int_t)bkgnormmin*nbins_abs/90+1,(Int_t)bkgnormmax*nbins_abs/90+1);
-  Double_t exces_off_abs = (Double_t) hist_off_abs->Integral((Int_t)sigexccmin*nbins_abs/90+1,(Int_t)sigexccmax*nbins_abs/90+1);
-  Double_t norm = norm_on_abs/norm_off_abs;
-
-  char text_tit_alpha[256];
-  sprintf(text_tit_alpha, " Alpha Plot On and Off ");
-  hist_off_abs->SetTitle(text_tit_alpha);
-  hist_on_abs->SetTitle(text_tit_alpha);
-
-  Double_t excess  = exces_on_abs - exces_off_abs*norm;
-  Double_t sign    = excess / sqrt( exces_on_abs + norm*norm*exces_off_abs );
-  Double_t int_off = (Double_t) hist_off_abs->Integral(1, 18);
-  int hist_on_entries  = (int) hist_on_abs->GetEntries();
-  int hist_off_entries = (int) hist_off_abs->GetEntries();
-    
-  cout << "---> Normalization F factor =\t" << norm <<endl;
-  cout << "---> Excess =\t\t\t" << excess <<endl;
-  cout << "---> Significancia =\t\t" << sign <<endl;    
-  cout << "---> entries on   =\t\t" << hist_on_entries  <<endl;
-  cout << "---> entries off  =\t\t" << hist_off_entries <<endl;
-  cout << "---> integral off =\t\t" << int_off <<endl;
-
-  Float_t shiftx;
-
-  //
-  //Create the display -> from now on, all histos are plotted
-  MStatusDisplay *display = new MStatusDisplay;
-  display->SetUpdateTime(3000);
-  display->Resize(850,700);
-  
-  // ############################################################################
-  // Draw SIZE
-  // ############################################################################
-  display->AddTab("SIZE");
-
-  gPad->cd();
-
-  gPad->SetLogy();
-  hist_size_on->Sumw2();
-  hist_size_off->Sumw2();
-  hist_size_off->Scale(norm); 
-  hist_size_on->SetLineColor(kBlack);
-  hist_size_on->SetMarkerStyle(21);
-  hist_size_on->SetMarkerSize(0.7);
-  hist_size_on->SetMarkerColor(kBlack);
-  hist_size_off->SetFillColor(46);
-  hist_size_off->SetLineColor(46);
-  hist_size_off->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines
-  hist_size_off->SetMinimum(0.1);
-  hist_size_on->SetMinimum(0.1);
-  hist_size_on->SetTitle("SIZE distribution");
-  hist_size_off->SetTitle("SIZE distribution");
-
-  hist_size_on->DrawCopy("E1P");
-
-  // move stat box to make them all visible
-  gPad->Update();
-  TPaveStats* pavs_on_size = (TPaveStats*) hist_size_on->GetListOfFunctions()->FindObject("stats");
-  if(pavs_on_size){
-    shiftx = pavs_on_size->GetX2NDC() - pavs_on_size->GetX1NDC();
-    pavs_on_size->SetX1NDC(pavs_on_size->GetX1NDC() - shiftx);
-    pavs_on_size->SetX2NDC(pavs_on_size->GetX2NDC() - shiftx);  
-  }
-  gPad->Modified();
-  gPad->Update();
-
-  hist_size_off->DrawCopy("HISTSAME");
-  hist_size_off->DrawCopy("ESAME");
-
-  gPad->Modified();
-  gPad->Update();
-
-  Double_t chisize = ChiSquareNDof((TH1D*)hist_size_on,(TH1D*)hist_size_off);
-
-  Double_t x_label_pos  = log10(1000000)*0.7;
-  Double_t y_label_pos  = log10((hist_size_on->GetBinContent(hist_size_on->GetMaximumBin()))/2.);
-  Double_t textsize = 0.03;
-
-  char text_size[256];
-  sprintf(text_size,"ChiSquare/NDof = %4.2f",chisize);
-
-  TLatex *tsize = new TLatex(x_label_pos, y_label_pos, text_size);
-  tsize->SetTextSize(textsize);
-//  tsize->Draw();
-
-  gPad->Modified();
-  gPad->Update();
-
-  // ############################################################################
-  // DrawCopy DIST
-  // ############################################################################
-  display->AddTab("DIST");
-
-  gPad->cd();
-
-  hist_dist_on->Sumw2();
-  hist_dist_off->Sumw2();
-  hist_dist_off->Scale(norm); 
-  hist_dist_on->SetLineColor(kBlack);
-  hist_dist_on->SetMarkerStyle(21);
-  hist_dist_on->SetMarkerSize(0.7);
-  hist_dist_on->SetMarkerColor(kBlack);
-  hist_dist_off->SetFillColor(46);
-  hist_dist_off->SetLineColor(46);
-  hist_dist_off->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines
-  hist_dist_off->SetMinimum(0.);
-  hist_dist_on->SetTitle("DIST distribution");
-  hist_dist_off->SetTitle("DIST distribution");
-
-  hist_dist_on->DrawCopy("E1P");
-
-  // move stat box to make them all visible
-  gPad->Update();
-  TPaveStats* pavs_on_dist = (TPaveStats*) hist_dist_on->GetListOfFunctions()->FindObject("stats");
-  if(pavs_on_dist){
-    shiftx = pavs_on_dist->GetX2NDC() - pavs_on_dist->GetX1NDC();
-    pavs_on_dist->SetX1NDC(pavs_on_dist->GetX1NDC() - shiftx);
-    pavs_on_dist->SetX2NDC(pavs_on_dist->GetX2NDC() - shiftx);  
-  }
-  gPad->Modified();
-  gPad->Update();
-
-  hist_dist_off->DrawCopy("HISTSAME");
-  hist_dist_off->DrawCopy("ESAME");
-  hist_dist_on->DrawCopy("E1PSAME");
-
-  Double_t chidist = ChiSquareNDof((TH1D*)hist_dist_on,(TH1D*)hist_dist_off);
-
-  x_label_pos  = distmax*0.7;
-  y_label_pos  = hist_dist_on->GetBinContent(hist_dist_on->GetMaximumBin())/2.;
-
-  char text_dist[256];
-  sprintf(text_size,"ChiSquare/NDof = %4.2f",chidist);
-
-  TLatex *tdist = new TLatex(x_label_pos, y_label_pos, text_dist);
-  tdist->SetTextSize(textsize);
-//  tdist->Draw();
-
-  gPad->Modified();
-  gPad->Update();
-
-   // ############################################################################
-  // DrawCopy WIDTH
-  // ############################################################################
-  display->AddTab("WIDTH");
-
-  gPad->cd();
-
-  hist_width_off->Sumw2();
-  hist_width_off->Scale(norm); 
-  hist_width_on->SetLineColor(kBlack);
-  hist_width_on->SetMarkerStyle(21);
-  hist_width_on->SetMarkerSize(0.7);
-  hist_width_on->SetMarkerColor(kBlack);
-  hist_width_off->SetFillColor(46);
-  hist_width_off->SetLineColor(46);
-  hist_width_off->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines
-  hist_width_off->SetMinimum(0.);
-  hist_width_on->SetTitle("WIDTH distribution");
-  hist_width_off->SetTitle("WIDTH distribution");
-
-  hist_width_on->DrawCopy("E1P");
-
-  // move stat box to make them all visible
-  gPad->Update();
-  TPaveStats* pavs_on_width = (TPaveStats*) hist_width_on->GetListOfFunctions()->FindObject("stats");
-  if(pavs_on_width){
-    shiftx = pavs_on_width->GetX2NDC() - pavs_on_width->GetX1NDC();
-    pavs_on_width->SetX1NDC(pavs_on_width->GetX1NDC() - shiftx);
-    pavs_on_width->SetX2NDC(pavs_on_width->GetX2NDC() - shiftx);  
-  }
-  gPad->Modified();
-  gPad->Update();
-
-  hist_width_off->DrawCopy("HISTSAME");
-  hist_width_off->DrawCopy("ESAME");
-  hist_width_on->DrawCopy("E1PSAME");
-
-  Double_t chiwidth = ChiSquareNDof((TH1D*)hist_width_on,(TH1D*)hist_width_off);
-
-  x_label_pos  = widthmax*0.7;
-  y_label_pos  = hist_width_on->GetBinContent(hist_width_on->GetMaximumBin())/2.;
-
-  char text_width[256];
-  sprintf(text_size,"ChiSquare/NDof = %4.2f",chiwidth);
-
-  TLatex *twidth = new TLatex(x_label_pos, y_label_pos, text_width);
-  twidth->SetTextSize(textsize);
-//  twidth->Draw();
-
-  gPad->Modified();
-  gPad->Update();
- 
-  // ############################################################################
-  // DrawCopy LENGTH
-  // ############################################################################
-  display->AddTab("LENGTH");
- 
-  gPad->cd();
-
-  hist_length_on->Sumw2();
-  hist_length_off->Sumw2();
-  hist_length_off->Scale(norm); 
-  hist_length_on->SetLineColor(kBlack);
-  hist_length_on->SetMarkerStyle(21);
-  hist_length_on->SetMarkerSize(0.7);
-  hist_length_on->SetMarkerColor(kBlack);
-  hist_length_off->SetFillColor(46);
-  hist_length_off->SetLineColor(46);
-  hist_length_off->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines
-  hist_length_off->SetMinimum(0.);
-  hist_length_on->SetTitle("LENGTH distribution");
-  hist_length_off->SetTitle("LENGTH distribution");
-
-  hist_length_on->DrawCopy("E1P");
-
-  // move stat box to make them all visible
-  gPad->Update();
-  TPaveStats* pavs_on_length = (TPaveStats*) hist_length_on->GetListOfFunctions()->FindObject("stats");
-  if(pavs_on_length){
-    shiftx = pavs_on_length->GetX2NDC() - pavs_on_length->GetX1NDC();
-    pavs_on_length->SetX1NDC(pavs_on_length->GetX1NDC() - shiftx);
-    pavs_on_length->SetX2NDC(pavs_on_length->GetX2NDC() - shiftx);  
-  }
-  gPad->Modified();
-  gPad->Update();
-
-  hist_length_off->DrawCopy("HISTSAME");
-  hist_length_off->DrawCopy("ESAME");
-  hist_length_on->DrawCopy("E1PSAME");
-
-  Double_t chilength = ChiSquareNDof((TH1D*)hist_length_on,(TH1D*)hist_length_off);
-
-  x_label_pos  = lengthmax*0.7;
-  y_label_pos  = hist_length_on->GetBinContent(hist_length_on->GetMaximumBin())/2.;
-
-  char text_length[256];
-  sprintf(text_size,"ChiSquare/NDof = %4.2f",chilength);
-
-  TLatex *tlength = new TLatex(x_label_pos, y_label_pos, text_length);
-  tlength->SetTextSize(textsize);
-//  tlength->Draw();
-
-  gPad->Modified();
-  gPad->Update();
-
-  // ############################################################################
-  // DrawCopy normalized ALPHA plot
-  // ############################################################################
-  display->AddTab("ALPHA");
-  
-  gPad->cd();
-
-  hist_on_abs->Sumw2();
-  hist_off_abs->SetStats(0);
-  hist_off_abs->Sumw2();
-  hist_off_abs->Scale(norm); 
-  hist_on_abs->SetStats(0); //-> Do NOT show the legend with statistics
-  hist_on_abs->SetLineColor(kBlack);
-  hist_on_abs->SetMarkerStyle(21);
-  //hist_on_abs->SetMarkerSize();
-  hist_on_abs->SetMarkerColor(kBlack);
-  hist_on_abs->SetMarkerSize(0.7);
-  hist_off_abs->SetFillColor(46);
-  hist_off_abs->SetLineColor(46);
-  hist_off_abs->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines
-  hist_off_abs->SetMinimum(0.);
-  hist_on_abs->SetTitle("Alpha plot");
-  hist_off_abs->SetTitle("Alpha plot");
-
-  
-  hist_on_abs->DrawCopy("E1P");
-  hist_off_abs->DrawCopy("HISTSAME");
-  hist_off_abs->DrawCopy("ESAME");
-  hist_on_abs->DrawCopy("E1PSAME");
-
-
-   //draw the LEGEND with excess and significance values in the alpha plot:
-  char text_Fnorm[256], text_excess[256], text_sign[256];
-  char text_entries_on[256], text_entries_off[256], text_integral_off[256];
-  int hist_on_entries  = (int) hist_on_abs->GetEntries();
-  int hist_off_entries = (int) hist_off_abs->GetEntries();
-  sprintf(text_Fnorm,       " F norm =       %.3f", norm);
-  sprintf(text_excess,      " Excess =       %.3f", excess);
-  sprintf(text_sign,        " Significance = %.3f", sign);
-  sprintf(text_entries_on,  " Entries ON   = %d",  hist_on_entries);
-  sprintf(text_entries_off, " Entries OFF  = %d",  hist_off_entries);
-  sprintf(text_integral_off," Integral OFF = %d",  int_off);
-  
-  x_label_pos  = alphamax*0.7;
-  y_label_pos  = (hist_on_abs->GetBinContent(hist_on_abs->GetMaximumBin()))/1.6; //2.;
-  Double_t y_label_step = y_label_pos / 8.;
-
-  TLatex *t0 = new TLatex(x_label_pos, y_label_pos - y_label_step*0, text_Fnorm);
-  t0->SetTextSize(textsize);
-  t0->Draw();
-  TLatex *t1 = new TLatex(x_label_pos, y_label_pos - y_label_step*1, text_excess);
-  t1->SetTextSize(textsize);
-  t1->Draw();
-  TLatex *t2 = new TLatex(x_label_pos, y_label_pos - y_label_step*2, text_sign);
-  t2->SetTextSize(textsize);
-  t2->Draw();
-  TLatex *t3 = new TLatex(x_label_pos, y_label_pos - y_label_step*3, text_entries_on);
-  t3->SetTextSize(textsize);
-  t3->Draw();
-  TLatex *t4 = new TLatex(x_label_pos, y_label_pos - y_label_step*4, text_entries_off);
-  t4->SetTextSize(textsize);
-  t4->Draw();
-  TLatex *t5 = new TLatex(x_label_pos, y_label_pos - y_label_step*5, text_integral_off);
-  t5->SetTextSize(textsize);
-  t5->Draw();
-  
-
-  Double_t chialpha = ChiSquareNDof((TH1D*)hist_on_abs,(TH1D*)hist_off_abs);
-
-  y_label_pos  = (hist_on_abs->GetBinContent(hist_on_abs->GetMaximumBin()))/2.;
-
-  char text_alpha[256];
-  sprintf(text_size,"ChiSquare/NDof = %4.2f",chialpha);
-
-  TLatex *talpha = new TLatex(x_label_pos, y_label_pos, text_alpha);
-  talpha->SetTextSize(textsize);
-//  talpha->Draw();
-
-  gPad->Modified();
-  gPad->Update();
-
-  // ############################################################################
-  // DrawCopy normalized alpha histos for alpha form -90 to 90 deg.
-  // ############################################################################
-  display->AddTab("ALPHA +-90");
-
-  gPad->cd();
-
-  hist_on->Sumw2();
-  hist_off->SetStats(0);
-  hist_off->Sumw2();
-  hist_off->Scale(norm); 
-  hist_off->SetFillColor(46);
-  hist_off->SetLineColor(46);
-  hist_off->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines
-  hist_off->SetMinimum(0.); 
-  hist_on->SetStats(0); //-> Do NOT show the legend with statistics
-  hist_on->SetLineColor(kBlack);
-  hist_on->SetMarkerStyle(21);
-  hist_on->SetMarkerSize(0.7);
-  hist_on->SetMarkerColor(kBlack);
-  hist_on->SetTitle("Alpha plot form -90 to 90 deg");
-  hist_off->SetTitle("Alpha plot form -90 to 90 deg");
-
-  hist_on->DrawCopy("E1P");
-  hist_off->DrawCopy("HISTSAME");
-  hist_off->DrawCopy("ESAME");
-  hist_on->DrawCopy("E1PSAME");
-
-  Double_t chialpha90 = ChiSquareNDof((TH1D*)hist_on,(TH1D*)hist_off);
-
-  x_label_pos  = alphamax*0.5;
-  y_label_pos  = hist_on->GetBinContent(hist_on->GetMaximumBin())/2.;
-
-  char text_alpha90[256];
-  sprintf(text_alpha90,"ChiSquare/NDof = %4.2f",chialpha90);
-
-  TLatex *talpha90 = new TLatex(x_label_pos, y_label_pos, text_alpha90);
-  talpha90->SetTextSize(textsize);
-//  talpha90->Draw();
-
-  gPad->Update();
-  gPad->Modified();
-
-
-  cout << "---> ChiSquare/NDof [Size] =\t\t" << chisize << endl;
-  cout << "---> ChiSquare/NDof [Dist] =\t\t" << chidist << endl;
-  cout << "---> ChiSquare/NDof [Width] =\t\t" << chiwidth << endl;
-  cout << "---> ChiSquare/NDof [Length] =\t\t" << chilength << endl;
-  cout << "---> ChiSquare/NDof [Abs(Alpha)] =\t" << chialpha << endl;
-  cout << "---> ChiSquare/NDof [Alpha] =\t\t" << chialpha90 << endl;
-
-
-  display->AddTab("SRCPOS ON");
-  TH2F *hist_srcpos_on = (TH2F*)hSrcPos_on.GetHist();
-  hist_srcpos_on->DrawCopy("BOX");
-
-  display->AddTab("SRCPOS OFF");
-  TH2F *hist_srcpos_off = (TH2F*)hSrcPos_off.GetHist();
-  hist_srcpos_off->DrawCopy("BOX");
-
-  display->AddTab("EVTNUM ON");
-  TH1F *hist_evtnum_on = (TH1F*)hDAQEvtNumber_on.GetHist();
-  hist_evtnum_on->DrawCopy();
-
-  display->AddTab("EVTNUM OFF");
-  TH1F *hist_evtnum_off = (TH1F*)hDAQEvtNumber_off.GetHist();
-  hist_evtnum_off->DrawCopy();
-
-  cout << "Done!!" <<endl;
-
-}
-
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/cleanComp.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/cleanComp.C	(revision 7136)
+++ 	(revision )
@@ -1,445 +1,0 @@
-/* ======================================================================== *\!
-!   Author(s): Javier Rico
-\* ======================================================================== */
-
-void cleanComp()
-{    
-  // general settings
-  gROOT->Reset();
-  gStyle->SetCanvasColor(0);
-  gStyle->SetCanvasBorderMode(0);
-  gStyle->SetPadBorderMode(0);
-  gStyle->SetFrameBorderMode(0);
-  gStyle->SetOptTitle(1);
-  //  gStyle->SetTitleOffset(1.7,"y");
-  //  gStyle->SetPadLeftMargin(0.15);
-  gStyle->SetOptStat(111110);
-  gStyle->SetStatColor(0);
-  gStyle->SetStatBorderSize(1);
-  gStyle->SetStatW(0.2);
-  gStyle->SetStatH(0.1);
-  gStyle->SetStatX(0.9);
-  gStyle->SetStatY(0.9);
-  
-  // define files, chain, trees, canvas...
-  TChain* ton;
-  ton= new TChain("Events");
-  
-  // data file(s)
-  ton->Add("/local_disk/jrico/mc/cleanComp0-3.root");
-  
-  // define aliases
-  ton->SetAlias("run","MRawRunHeader.fRunNumber");
-  ton->SetAlias("event","MRawEvtHeader.fDAQEvtNumber");
-  ton->SetAlias("energy","MMcEvt.fEnergy");
-
-  // alpha0 is for the file without noise
-  // alphaNOCL is for the file with noise and no cleaning
-  ton->SetAlias("alpha0","MHillasSrc0.fAlpha");
-  ton->SetAlias("alphaNOCL","MHillasSrcnoclean.fAlpha");
-  ton->SetAlias("alpha3015","MHillasSrc3015.fAlpha");
-  ton->SetAlias("alpha4025","MHillasSrc4025.fAlpha");
-  ton->SetAlias("alpha5035","MHillasSrc5035.fAlpha");
-  ton->SetAlias("alpha6045","MHillasSrc6045.fAlpha");
-  
-  //  ton->Scan("run:event","alpha0<-30 && energy>2500 && energy<5000");
-  
-  //  plotAlphaWidth(ton);
-   plotAlphaWidthVsEnergy(ton);
-  // plotEfficiencies(ton);
-}
-
-void plotAlphaWidth(TChain* ton)
-{
-  // define and fill histos
-  const Int_t nbins=90;
-  TH1F* halpha3015 = new TH1F("Alpha3015" ,"Alpha3015",nbins,-180,180);
-  TH1F* halpha4025 = new TH1F("Alpha4025" ,"Alpha4025",nbins,-180,180);
-  TH1F* halpha5035 = new TH1F("Alpha5035" ,"Alpha5035",nbins,-180,180);
-  TH1F* halpha6045 = new TH1F("Alpha6045" ,"Alpha6045",nbins,-180,180);
-  
-  halpha3015->SetXTitle("alpha-alpha0 (deg)");
-  halpha3015->SetYTitle("Entries");
-  
-  halpha3015->SetLineColor(1);
-  halpha4025->SetLineColor(2);
-  halpha5035->SetLineColor(3);
-  halpha6045->SetLineColor(4);
-  
-  ton->Draw("alpha3015-alpha0>>Alpha3015","alpha3015!=0");
-  ton->Draw("alpha4025-alpha0>>Alpha4025","alpha4025!=0");
-  ton->Draw("alpha5035-alpha0>>Alpha5035","alpha5035!=0");
-  ton->Draw("alpha6045-alpha0>>Alpha6045","alpha6045!=0");
-  
-  // plot
-  TCanvas *c1 = new TCanvas("c1","c1",800,500);
-  c1->cd(1);
-  
-  halpha3015->Draw("HIST");
-  halpha4025->Draw("HISTSAMES");
-  halpha5035->Draw("HISTSAMES");
-  halpha6045->Draw("HISTSAMES");
-  
-  gPad->Update();
-  TPaveStats* pvstat4025  = (TPaveStats*) halpha4025->GetListOfFunctions()->FindObject("stats");
-  TPaveStats* pvstat5035  = (TPaveStats*) halpha5035->GetListOfFunctions()->FindObject("stats");
-  TPaveStats* pvstat6045  = (TPaveStats*) halpha6045->GetListOfFunctions()->FindObject("stats");
-  
-  Float_t shifty = pvstat4025->GetY2NDC()-pvstat4025->GetY1NDC();
-  
-  pvstat4025->SetY1NDC(pvstat4025->GetY1NDC()-shifty);
-  pvstat4025->SetY2NDC(pvstat4025->GetY2NDC()-shifty);
-  pvstat5035->SetY1NDC(pvstat5035->GetY1NDC()-2*shifty);
-  pvstat5035->SetY2NDC(pvstat5035->GetY2NDC()-2*shifty);
-  pvstat6045->SetY1NDC(pvstat6045->GetY1NDC()-3*shifty);
-  pvstat6045->SetY2NDC(pvstat6045->GetY2NDC()-3*shifty);
-  
-  gPad->Modified();
-  gPad->Update();
-  
-  c1->Print("cleanComp.ps");
-}
-
-/*******************************************************************************/
-void plotAlphaWidthVsEnergy(TChain* ton)
-{
-  const Int_t nbins = 8;
-  Float_t bound[nbins+1] ={0,30,50,80,150,300,600,1200,3000}; // boundary of considered size bins
-  
-  // define the arrays that will feed the graphs
-  // value of rms of the alpha-alpha0 distribution, and errors
-  Float_t alpha0[nbins];
-  Float_t alpha3015[nbins];
-  Float_t alpha4025[nbins];
-  Float_t alpha5035[nbins];
-  Float_t alpha6045[nbins];
-
-  Float_t ealpha0[nbins];
-  Float_t ealpha3015[nbins];
-  Float_t ealpha4025[nbins];
-  Float_t ealpha5035[nbins];
-  Float_t ealpha6045[nbins];
-
-  // x axis and error
-  Float_t x[nbins];
-  Float_t ex[nbins];
-
-  TH1F* hp[nbins];
-
-  // define the function that will be used to fit the histograms
-  TF1 f2("f2","[0]+[1]/[3]*exp(-(x-[2])*(x-[2])/(2*[3]*[3]))",-180.,180.);
-  f2.SetParameters(0,100,0,02);
-  f2.FixParameter(0,0);
-  f2.SetLineWidth(1);
-
-  // fill the arrays
-  for(Int_t i=0;i<nbins;i++)
-    {
-      //      cout << "Bin " << i << endl;
-      TH1F dummy0("dummy0" ,"dummy0",100,-90,90);
-      TH1F dummy3015("dummy3015" ,"dummy3015",100,-180,180);
-      TH1F dummy4025("dummy4025" ,"dummy4025",100,-180,180);
-      TH1F dummy5035("dummy5035" ,"dummy5035",100,-180,180);
-      TH1F dummy6045("dummy6045" ,"dummy6045",100,-180,180);
-
-      TH1F xdummy("xdummy" ,"xdummy",100,bound[i],bound[i+1]);
-
-      // define the cuts for each of the cleaning levels
-      char cut[100];
-      sprintf(cut,"energy>%f && energy<%f && alpha0!=0",bound[i],bound[i+1]);
-      char cut3015[200];
-      sprintf(cut3015,"%s && alpha3015!=0",cut);
-      char cut4025[200];
-      sprintf(cut4025,"%s && alpha4025!=0",cut);
-      char cut5035[200];
-      sprintf(cut5035,"%s && alpha5035!=0",cut);
-      char cut6045[200];
-      sprintf(cut6045,"%s && alpha6045!=0",cut);
-
-      TF1 f1("f1","[0]+[1]/[3]*exp(-(x-[2])*(x-[2])/(2*[3]*[3]))",-180.,180.);
-      f1.SetParameters(0,100,0,02);
-      f1.FixParameter(0,0);
-
-
-      // fill the histograms to extract later the information from rms, entries, means, etc
-      ton->Draw("alpha0>>dummy0",cut);
-      ton->Draw("alpha3015-alpha0>>dummy3015",cut3015);
-      ton->Draw("alpha4025-alpha0>>dummy4025",cut4025);
-      ton->Draw("alpha5035-alpha0>>dummy5035",cut5035);
-      ton->Draw("alpha6045-alpha0>>dummy6045",cut6045);
-
-      ton->Draw("energy>>xdummy",cut);
-
-      // fit to a gaussian and get the sigma to be plotted later
-      dummy0.Fit("f1");
-      alpha0[i]   =f1.GetParameter(3);
-      dummy3015.Fit("f1");
-      alpha3015[i]=f1.GetParameter(3);
-      dummy4025.Fit("f1");
-      alpha4025[i]=f1.GetParameter(3);
-      dummy5035.Fit("f1");
-      alpha5035[i]=f1.GetParameter(3);
-      dummy6045.Fit("f1");
-      alpha6045[i]=f1.GetParameter(3);
-
-      Float_t nevt0    = dummy0.GetEntries();
-      Float_t nevt3015 = dummy3015.GetEntries();
-      Float_t nevt4025 = dummy4025.GetEntries();
-      Float_t nevt5035 = dummy5035.GetEntries();
-      Float_t nevt6045 = dummy6045.GetEntries();
-
-      // since gaussian is not so good aproximation, compute error like follows
-      ealpha0[i]   = alpha0[i]/TMath::Sqrt(2*nevt0);
-      ealpha3015[i]= alpha3015[i]/TMath::Sqrt(2*nevt3015);
-      ealpha4025[i]= alpha4025[i]/TMath::Sqrt(2*nevt4025);
-      ealpha5035[i]= alpha5035[i]/TMath::Sqrt(2*nevt5035);
-      ealpha6045[i]= alpha6045[i]/TMath::Sqrt(2*nevt6045);
-
-      // copy some histos to be plotted later
-      Char_t nom[10];
-      sprintf(nom,"hp[%02d]",i);
-      hp[i] = new TH1F(nom,nom,100,-180,180);
-      hp[i]->GetXaxis()->SetTitle("alpha (deg)");
-      hp[i]->Add(&dummy6045);
-      hp[i]->Fit("f2");
-
-      //      cout << xdummy.GetMean() << " " << xdummy.GetRMS()<< " " << xdummy.GetEntries() << endl;
-      x[i]  = xdummy.GetMean();            
-      //      Float_t rms = xdummy.GetRMS();
-      ex[i] = 0;//rms*rms/xdummy.GetEntries();
-    }
-
-  //#if 0
-  TCanvas* cdum = new TCanvas("cdum","cdum",600,900);
-  cdum->Divide(2,nbins/2+1);
-  for(Int_t i=0;i<nbins;i++)
-    {
-      cdum->cd(i+1);
-      hp[i]->Draw();
-      gPad->Modified();
-      gPad->Update();
-    }
-  //#endif
-  
-  // create the graphs
-  TGraphErrors* gr0    = new TGraphErrors(nbins,x,alpha0,ex,ealpha0);
-  TGraphErrors* gr3015 = new TGraphErrors(nbins,x,alpha3015,ex,ealpha3015);
-  TGraphErrors* gr4025 = new TGraphErrors(nbins,x,alpha4025,ex,ealpha4025);
-  TGraphErrors* gr5035 = new TGraphErrors(nbins,x,alpha5035,ex,ealpha5035);
-  TGraphErrors* gr6045 = new TGraphErrors(nbins,x,alpha6045,ex,ealpha6045);  
-
-  // marker/line colors
-  gr0->SetMarkerStyle(20);
-  gr3015->SetMarkerStyle(24);
-  gr4025->SetMarkerStyle(21);
-  gr5035->SetMarkerStyle(25);
-  gr6045->SetMarkerStyle(22);
-
-  gr0->SetMarkerColor(1);
-  gr3015->SetMarkerColor(2);
-  gr4025->SetMarkerColor(3);
-  gr5035->SetMarkerColor(4);
-  gr6045->SetMarkerColor(6);
-
-  gr0->SetLineColor(1);
-  gr3015->SetLineColor(2);
-  gr4025->SetLineColor(3);
-  gr5035->SetLineColor(4);
-  gr6045->SetLineColor(6);
-
-  //////////////////////
-  // plot alpha width //
-  //////////////////////
-  TCanvas *c1 = new TCanvas("c1","c1",800,500);
-  c1->cd(1);
-  gPad->SetGridx();  
-  gPad->SetGridy();  
-  gPad->SetLogx();
-
-  TGraphErrors* grfirst = gr4025;
-  grfirst->Draw("APL");
-  gr0->Draw("PL");
-  gr3015->Draw("PL");
-  gr4025->Draw("PL");
-  gr5035->Draw("PL");
-  gr6045->Draw("PL");
-
-  grfirst->GetHistogram()->SetTitle("Cleaning comparison (alpha)");
-  grfirst->GetHistogram()->GetXaxis()->SetTitle("E_{MC} [GeV]");
-  grfirst->GetHistogram()->GetYaxis()->SetTitle("#sigma (alpha-alpha_{0}) [deg]");
-  grfirst->GetHistogram()->SetMaximum(80);
-
-  TPaveLabel* label = new TPaveLabel(0.25,0.75,0.6,0.85,"MC Gammas - zbins 0-3","NDC");
-  label->SetBorderSize(0);
-  label->SetFillColor(0);
-  label->Draw();
-
-  // legend
-  TLegend* leg = new TLegend(.6,.5,.8,.8);
-  leg->SetHeader("");
-  leg->SetFillColor(0);
-  leg->SetLineColor(0);
-  leg->SetBorderSize(0);
-  leg->AddEntry(gr0,"No noise","p");
-  leg->AddEntry(gr3015,"(3.0,1.5)","p");
-  leg->AddEntry(gr4025,"(4.0,2.5)","p");
-  leg->AddEntry(gr5035,"(5.0,3.5)","p");
-  leg->AddEntry(gr6045,"(6.0,4.5)","p");
-  leg->Draw();
-
-  gPad->Modified();
-  gPad->Update();
-  // print to file
-  c1->Print("cleanAlphaWidthVSEnergy.ps");
-}
-
-/*******************************************************************************/
-void plotEfficiencies(TChain* ton)
-{
-  const Int_t nbins = 8;
-  Float_t bound[nbins+1] ={0,30,50,80,150,300,600,1200,3000}; // boundary of considered size bins
-  
-  // define the arrays that will feed the graphs
-  // gamma detection efficiency, and errors  
-  Float_t effNOCL[nbins];
-  Float_t eff3015[nbins];
-  Float_t eff4025[nbins];
-  Float_t eff5035[nbins];
-  Float_t eff6045[nbins];
-
-  Float_t eeffNOCL[nbins];
-  Float_t eeff3015[nbins];
-  Float_t eeff4025[nbins];
-  Float_t eeff5035[nbins];
-  Float_t eeff6045[nbins];
-
-  // x axis and error
-  Float_t x[nbins];
-  Float_t ex[nbins];
-
-  // fill the arrays
-  for(Int_t i=0;i<nbins;i++)
-    {
-      //      cout << "Bin " << i << endl;
-      TH1F dummyNOCL("dummyNOCL" ,"dummyNOCL",100,-90,90);
-      TH1F dummy3015("dummy3015" ,"dummy3015",100,-90,90);
-      TH1F dummy4025("dummy4025" ,"dummy4025",100,-90,90);
-      TH1F dummy5035("dummy5035" ,"dummy5035",100,-90,90);
-      TH1F dummy6045("dummy6045" ,"dummy6045",100,-90,90);
-
-      TH1F xdummy("xdummy" ,"xdummy",100,bound[i],bound[i+1]);
-
-      // define the cuts for each of the cleaning levels
-      char cut[100];
-      sprintf(cut,"energy>%f && energy<%f && alpha0!=0",bound[i],bound[i+1]);
-      char cutNOCL[200];
-      sprintf(cutNOCL,"%s && alphaNOCL!=0",cut);
-      char cut3015[200];
-      sprintf(cut3015,"%s && alpha3015!=0",cut);
-      char cut4025[200];
-      sprintf(cut4025,"%s && alpha4025!=0",cut);
-      char cut5035[200];
-      sprintf(cut5035,"%s && alpha5035!=0",cut);
-      char cut6045[200];
-      sprintf(cut6045,"%s && alpha6045!=0",cut);
-
-
-      // fill the histograms to extract later the information from rms, entries, means, etc
-      ton->Draw("alpha0>>dummyNOCL",cutNOCL);
-      ton->Draw("alpha0>>dummy3015",cut3015);
-      ton->Draw("alpha0>>dummy4025",cut4025);
-      ton->Draw("alpha0>>dummy5035",cut5035);
-      ton->Draw("alpha0>>dummy6045",cut6045);
-
-      ton->Draw("energy>>xdummy",cut);
-
-      Float_t nevt0    = dummyNOCL.GetEntries();
-      Float_t nevt3015 = dummy3015.GetEntries();
-      Float_t nevt4025 = dummy4025.GetEntries();
-      Float_t nevt5035 = dummy5035.GetEntries();
-      Float_t nevt6045 = dummy6045.GetEntries();
-
-      // fill the array of efficiencies
-      eff3015[i] = nevt3015/nevt0*100;
-      eff4025[i] = nevt4025/nevt0*100;
-      eff5035[i] = nevt5035/nevt0*100;
-      eff6045[i] = nevt6045/nevt0*100;
-
-      eeff3015[i] = TMath::Sqrt(nevt3015)/nevt0*100;
-      eeff4025[i] = TMath::Sqrt(nevt4025)/nevt0*100;
-      eeff5035[i] = TMath::Sqrt(nevt5035)/nevt0*100;
-      eeff6045[i] = TMath::Sqrt(nevt6045)/nevt0*100;
-
-      //      cout << xdummy.GetMean() << " " << xdummy.GetRMS()<< " " << xdummy.GetEntries() << endl;
-      x[i]  = xdummy.GetMean();            
-      //      Float_t rms = xdummy.GetRMS();
-      ex[i] = 0;//rms*rms/xdummy.GetEntries();
-    }
-
-  // create the graphs
-  TGraphErrors* efgr3015 = new TGraphErrors(nbins,x,eff3015,ex,eeff3015);
-  TGraphErrors* efgr4025 = new TGraphErrors(nbins,x,eff4025,ex,eeff4025);
-  TGraphErrors* efgr5035 = new TGraphErrors(nbins,x,eff5035,ex,eeff5035);
-  TGraphErrors* efgr6045 = new TGraphErrors(nbins,x,eff6045,ex,eeff6045);  
-
-  // marker/line colors
-  efgr3015->SetMarkerStyle(24);
-  efgr4025->SetMarkerStyle(21);
-  efgr5035->SetMarkerStyle(25);
-  efgr6045->SetMarkerStyle(22);
-
-  efgr3015->SetMarkerColor(2);
-  efgr4025->SetMarkerColor(3);
-  efgr5035->SetMarkerColor(4);
-  efgr6045->SetMarkerColor(6);
-
-  efgr3015->SetLineColor(2);
-  efgr4025->SetLineColor(3);
-  efgr5035->SetLineColor(4);
-  efgr6045->SetLineColor(6);
-
-  ///////////////////////
-  // plot efficiencies //
-  ///////////////////////
-  TCanvas *c1 = new TCanvas("c1","c1",800,500);
-  c1->cd(1);
-  gPad->SetGridx();  
-  gPad->SetGridy();  
-  gPad->SetLogx();
-
-  TGraphErrors* efgrfirst = efgr6045;
-  efgrfirst->Draw("APL");
-  efgr3015->Draw("PL");
-  efgr4025->Draw("PL");
-  efgr5035->Draw("PL");
-  efgr6045->Draw("PL");
-
-  efgrfirst->GetHistogram()->SetTitle("Cleaning comparison (efficiency)");
-  efgrfirst->GetHistogram()->GetXaxis()->SetTitle("E_{MC} [GeV]");
-  efgrfirst->GetHistogram()->GetYaxis()->SetTitle("Detection efficiency (%)");
-
-  // label
-  TPaveLabel* eflabel = new TPaveLabel(0.5,0.49,0.85,0.59,"MC Gammas - zbins 0-3","NDC");
-  eflabel->SetBorderSize(0);
-  eflabel->SetFillColor(0);
-  eflabel->Draw();
- 
-  // legend
-  TLegend* efleg = new TLegend(.6,.2,.8,.5);
-  efleg->SetHeader("");
-  efleg->SetFillColor(0);
-  efleg->SetLineColor(0);
-  efleg->SetBorderSize(0);
-  efleg->AddEntry(efgr3015,"(3.0,1.5)","p");
-  efleg->AddEntry(efgr4025,"(4.0,2.5)","p");
-  efleg->AddEntry(efgr5035,"(5.0,3.5)","p");
-  efleg->AddEntry(efgr6045,"(6.0,4.5)","p");
-  efleg->Draw();
-
-  gPad->Modified();
-  gPad->Update();
-
-  // print to file
-  c1->Print("cleanEfficiency.ps");
-}
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/computeCoeff.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/computeCoeff.C	(revision 7136)
+++ 	(revision )
@@ -1,61 +1,0 @@
-
-
-void computeCoeff()
-{    
-  MEffAreaAndCoeffCalc calc;
-  calc.AddFile("/data/star_gamma_test.root");
-
-  /************************************************/
-  /* Build spectrum                               */
-  /* now it's just a cross check with the same MC */
-  /************************************************/
-  const Int_t ebins = 20;              // number of bins to build spectrum
-  const Double_t emin=10;
-  const Double_t emax=200;
-  const Int_t tbins = 2;
-  const Double_t thetab[tbins+1] = {0,10,20};
-  calc.SetEbins(ebins);
-  calc.SetEmin(emin);
-  calc.SetEmax(emax);
-  calc.SetThetaBinning(tbins,thetab);
-  
-  // define the funtion of the desired spectrum
-  calc.SetFunction("4.e9*pow(x,-2.6+1)");
-  calc.ComputeAllFactors();
-  
-  const UInt_t ncutfiles=1;
-  Char_t* cutName[ncutfiles]={"/data/star_gamma_test.root"};
-
-  TChain* ccut = new TChain("Events");
-  for(Int_t i = 0; i < ncutfiles; i++)
-    ccut->Add(cutName[i]);
-  ccut->SetAlias("logestenergy","log10(MHillas.fSize/0.18/15.)");
-  ccut->SetAlias("theta","MMcEvt.fTelescopeTheta*180./3.14159");
-
-
-  const Double_t logemin = TMath::Log10(emin);
-  const Double_t logemax = TMath::Log10(emax);
-  TH1D* hspec = new TH1D("hspec","Spectrum",ebins,logemin,logemax);
-  hspec->Sumw2();
-  ccut->Draw("logestenergy>>hspec","theta<10","goff");
-
-  for(Int_t i=0;i<ebins;i++)
-    {
-      const Float_t uncorrval = hspec->GetBinContent(i+1);
-      const Float_t effa  =  calc.GetEffectiveAreaHisto()->GetBinContent(i+1,1);
-      const Float_t unfold = calc.GetCoefficientHisto()->GetBinContent(i+1,1);
-      Float_t corrval;
-      if(effa)
-	corrval = uncorrval*unfold/effa*1e9;
-      else
-	corrval = 0;
-      hspec->SetBinContent(i+1,corrval);
-    }
-
-  // SAVE RESULTS
-  TFile file("prueba.root","RECREATE");
-  hspec->Write();
-  calc.GetEffectiveAreaHisto()->Write();
-  calc.GetCoefficientHisto()->Write();
-  return;
-}
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/distancebetweenstars.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/distancebetweenstars.C	(revision 7136)
+++ 	(revision )
@@ -1,249 +1,0 @@
- /* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Javier López, 05/2004 <mailto:jlopez@ifae.es>
-!
-!   Copyright: MAGIC Software Development, 2000-2004
-!
-!
-\* ======================================================================== */
-
-Bool_t HandleInput()
-{
-    TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
-    while (1)
-    {
-        //
-        // While reading the input process gui events asynchronously
-        //
-        timer.TurnOn();
-        TString input = Getline("Type 'q' to exit, <return> to go on: ");
-        timer.TurnOff();
-
-        if (input=="q\n")
-            return kFALSE;
-
-        if (input=="\n")
-            return kTRUE;
-    };
-
-    return kFALSE;
-}
-
-Double_t fitfunc(Double_t *x, Double_t *par);
-
-void distancebetweenstars(const TString filename="dc_2004_03_17_01_16_51_20440_Mrk421.root", const TString directory="/nfs/magic/CaCodata/rootdata/Mrk421/Period015/2004_03_17/", const UInt_t numEvents = 100000000)
-{
-
-    // general settings
-    gROOT->Reset();
-    gStyle->SetCanvasColor(0);
-    gStyle->SetCanvasBorderMode(0);
-    gStyle->SetPadBorderMode(0);
-    gStyle->SetFrameBorderMode(0);
-    gStyle->SetOptTitle(0);
-    gStyle->SetTitleOffset(1.7,"y");
-    gStyle->SetPadLeftMargin(0.15);
-    gStyle->SetOptStat(111110);
-    gStyle->SetOptFit(1);
-    gStyle->SetStatColor(0);
-    gStyle->SetStatBorderSize(1);
-    gStyle->SetStatW(0.2);
-    gStyle->SetStatH(0.1);
-    gStyle->SetStatX(0.9);
-    gStyle->SetStatY(0.9);
-
-  Int_t nbins  = 100;
-  Float_t mindist = 0.0;
-  Float_t maxdist = 400.0;
-  
-  TH1F* histStarsDintances = new TH1F("StarsDintances","Distance between stars",nbins,mindist,maxdist);
-  histStarsDintances->SetXTitle("Distance [mm]");
-  histStarsDintances->SetYTitle("Counts [#]");
-  TH1F* histStarsDintances1 = new TH1F("StarsDintances1","Distance between stars",nbins,mindist,maxdist);
-  TH1F* histStarsDintances2 = new TH1F("StarsDintances2","Distance between stars [1]-[3]",nbins,mindist,maxdist);
-  TH1F* histStarsDintances3 = new TH1F("StarsDintances3","Distance between stars [2]-[3]",nbins,mindist,maxdist);
-  //
-  // Create a empty Parameter List and an empty Task List
-  // The tasklist is identified in the eventloop by its name
-  //
-  MParList  plist;
-  
-  MTaskList tlist;
-  plist.AddToList(&tlist);
-
-  MGeomCamMagic geomcam;
-  MCameraDC     dccam;
-  MStarLocalCam starcam;
-
-  plist.AddToList(&geomcam);
-  plist.AddToList(&dccam);
-  plist.AddToList(&starcam);
-
-  //
-  // Now setup the tasks and tasklist:
-  // ---------------------------------
-  //
-
-  // Reads the trees of the root file and the analysed branches
-  MReadReports read;
-  read.AddTree("Currents"); 
-  read.AddFile(directory+filename);     // after the reading of the trees!!!
-  read.AddToBranchList("MReportCurrents.*");
-
-  MGeomApply geomapl;
-  TString continuoslightfile = 
-    //    "/home/Javi/mnt_magic_data/CaCo/rootdata/Miscellaneous/Period016/2004_04_16/dc_2004_04_16_04_46_18_22368_Off3c279-2CL100.root";
-        "/nfs/magic/CaCodata/rootdata/Miscellaneous/Period016/2004_04_16/dc_2004_04_16_04_46_18_22368_Off3c279-2CL100.root";
-
-  Float_t mindc = 0.7;
-  MCalibrateDC dccal;
-  dccal.SetFileName(continuoslightfile);
-  dccal.SetMinDCAllowed(mindc);
-
-  const Int_t numblind = 5;
-  const Short_t x[numblind] = { 47, 124, 470, 475, 571};
-  const TArrayS blindpixels(numblind,(Short_t*)x);
-  Float_t ringinterest = 100; //[mm]
-  Float_t tailcut = 4.0;
-  UInt_t integratedevents = 1;
-
-  MFindStars findstars;
-  findstars.SetBlindPixels(blindpixels);
-  findstars.SetRingInterest(ringinterest);
-  findstars.SetDCTailCut(tailcut);
-  findstars.SetNumIntegratedEvents(integratedevents);
-  findstars.SetMinuitPrintOutLevel(-1);
-
-  tlist.AddToList(&geomapl);
-  tlist.AddToList(&read);
-  tlist.AddToList(&dccal);
-  tlist.AddToList(&findstars, "Currents");
-
-  //
-  // Create and setup the eventloop
-  //
-  MEvtLoop evtloop;
-  evtloop.SetParList(&plist);
-  
-//   MProgressBar bar;
-//   evtloop.SetProgressBar(&bar);
-  
-  //
-  // Execute your analysis
-  //
-  
-//   if (!evtloop.Eventloop(numEvents))
-//     return;
-
-  if (!evtloop.PreProcess())
-    return;
-
-  Float_t maxchindof = 4.;
-  
-  while (tlist.Process())
-    {
-  
-      Int_t numStars = starcam.GetNumStars();
-      if ( numStars == 3)
-        {
-          
-          for (Int_t first=0; first<numStars; first++)
-            {
-              if (starcam[first].GetChiSquareNdof()>0. && starcam[first].GetChiSquareNdof()<maxchindof)
-                {
-                  for (Int_t second=first+1; second<numStars; second++)
-                    {
-                      if (starcam[second].GetChiSquareNdof()>0. && starcam[second].GetChiSquareNdof()<maxchindof)
-                        {
-                          Float_t dist = TMath::Sqrt((starcam[first].GetMeanX()-starcam[second].GetMeanX())*
-                                                     (starcam[first].GetMeanX()-starcam[second].GetMeanX()) +
-                                                     (starcam[first].GetMeanY()-starcam[second].GetMeanY())*
-                                                     (starcam[first].GetMeanY()-starcam[second].GetMeanY()));
-
-                            histStarsDintances->Fill(dist);
-                          if (first == 0 && second == 1)
-                            histStarsDintances1->Fill(dist);
-                          else if (first == 0 && second == 2)
-                            histStarsDintances2->Fill(dist);
-                          else if (first == 1 && second == 2)
-                            histStarsDintances3->Fill(dist);
-
-                        }
-                    }
-                }
-            }
-        }
-    }
-  
-  
-
-  evtloop.PostProcess();
-
-  tlist.PrintStatistics();
-
-  //Draw results
-
-  //   histStarsDintances->Draw();
-
-// Creates a Root function based on function fitf above
-   TF1 *func = new TF1("fitfunc",fitfunc,mindist,maxdist,7);
-
-// Sets initial values and parameter names
-   func->SetParNames("ConvF","Max0","Sig0","Max1","Sig1","Max2","Sig2");
-   func->SetParameters(300.,500.,5.,500.,5.,500.,5.);
-
-// Fit histogram in range defined by function
-   histStarsDintances->Fit("fitfunc","R");
-
-//   histStarsDintances1->Draw();
-//   histStarsDintances2->Fit("gaus","0");
-//   histStarsDintances2->Draw("same");
-//   histStarsDintances2->Fit("gaus","0");
-//   histStarsDintances3->Draw("same");
-//   histStarsDintances3->Fit("gaus","0");
-
-  if (!HandleInput())
-
-  delete histStarsDintances;
-  delete histStarsDintances1;
-  delete histStarsDintances2;
-  delete histStarsDintances3;
-  
-}
-
-Double_t fitfunc(Double_t *x, Double_t *par)
-{
-  Double_t dist[3] = 
-    {
-      0.64,0.750,1.203
-    };
-  
-  
-   Double_t fitval = 
-     par[1]*TMath::Exp(-0.5*(x[0]-par[0]*dist[0])*(x[0]-par[0]*dist[0])/(par[2]*par[2])) +
-     par[3]*TMath::Exp(-0.5*(x[0]-par[0]*dist[1])*(x[0]-par[0]*dist[1])/(par[4]*par[4])) +
-     par[5]*TMath::Exp(-0.5*(x[0]-par[0]*dist[2])*(x[0]-par[0]*dist[2])/(par[6]*par[6]));
-
-   //   cout << "x "  << x[0] << " fitval " << fitval << endl;
-   
-
-   return fitval;
-}
-
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/findstars.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/findstars.C	(revision 7136)
+++ 	(revision )
@@ -1,175 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Javier López, 05/2004 <mailto:jlopez@ifae.es>
-!
-!   Copyright: MAGIC Software Development, 2000-2004
-!
-!
-\* ======================================================================== */
-
-
-Bool_t HandleInput()
-{
-    TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
-    while (1)
-    {
-        //
-        // While reading the input process gui events asynchronously
-        //
-        timer.TurnOn();
-        TString input = Getline("Type 'q' to exit, <return> to go on: ");
-        timer.TurnOff();
-
-        if (input=="q\n")
-            return kFALSE;
-
-        if (input=="\n")
-            return kTRUE;
-    };
-
-    return kFALSE;
-}
-
-
-void findstars(const TString filename="20040422_*_D_Mrk421_E.root", const TString directory="/local_disk/Data/rootdata/Mrk421/Period016/2004_04_22/", const UInt_t numEvents = 0)
-{
-
-  //
-  // Create a empty Parameter List and an empty Task List
-  // The tasklist is identified in the eventloop by its name
-  //
-  MParList  plist;
-  
-  MTaskList tlist;
-  plist.AddToList(&tlist);
-
-
-  MGeomCamMagic geomcam;
-  MCameraDC     dccam;
-  MStarLocalCam starcam;
-
-  plist.AddToList(&geomcam);
-  plist.AddToList(&dccam);
-  plist.AddToList(&starcam);
-
-  //
-  // Now setup the tasks and tasklist:
-  // ---------------------------------
-  //
-
-  // Reads the trees of the root file and the analysed branches
-  MReadReports read;
-  read.AddTree("Currents"); 
-  read.AddFile(directory+filename);     // after the reading of the trees!!!
-  read.AddToBranchList("MReportCurrents.*");
-
-  MGeomApply geomapl;
-  TString continuoslightfile = 
-    "/local_disk/CaCoData/rootdata/Miscellaneous/Period016/2004_04_16/dc_2004_04_16_04_46_18_22368_Off3c279-2CL100.root";
-
-  Float_t mindc = 0.9; //[uA]
-  MCalibrateDC dccal;
-  dccal.SetFileName(continuoslightfile);
-  dccal.SetMinDCAllowed(mindc);
-
-  const Int_t numblind = 5;
-  const Short_t x[numblind] = { 47, 124, 470, 475, 571};
-  const TArrayS blindpixels(numblind,(Short_t*)x);
-  Float_t ringinterest = 100; //[mm]
-  Float_t tailcut = 3.5;
-  UInt_t integratedevents = 4;
-
-  MFindStars findstars;
-  findstars.SetBlindPixels(blindpixels);
-  findstars.SetRingInterest(ringinterest);
-  findstars.SetDCTailCut(tailcut);
-  findstars.SetNumIntegratedEvents(integratedevents);
-  findstars.SetMinuitPrintOutLevel(-1);
-
-  
-  tlist.AddToList(&geomapl);
-  tlist.AddToList(&read);
-  tlist.AddToList(&dccal);
-  tlist.AddToList(&findstars, "Currents");
-
-  //
-  // Create and setup the eventloop
-  //
-  MEvtLoop evtloop;
-  evtloop.SetParList(&plist);
-     
-  //
-  // Execute your analysis
-  //
-
-  if (numEvents > 0)
-  {
-      if (!evtloop.Eventloop(numEvents))
-	  return;
-  }
-  else
-  {
-      if (!evtloop.PreProcess())
-	  return;
-      
-//        MHCamera display0(geomcam);
-//        display0.SetPrettyPalette();
-//        display0.Draw();
-//        //       display0.SetCamContent(dccal.GetDisplay());
-//        display0.SetCamContent(dccal.GetDCCalibrationFactor());
-//        gPad->Modified();
-//        gPad->Update();
-
-//        // Remove the comments if you want to go through the file
-//        // event-by-event:
-//        if (!HandleInput())
-//          break;
-
-       MHCamera display(geomcam);
-       display.SetPrettyPalette();
-       display.Draw();
-       gPad->cd(1);
-       starcam.Draw();
-      
-       UInt_t numevents=0;
-       
-       while (tlist.Process())
-         {
-           numevents++;
-           if (numevents%integratedevents==0)
-             {
-               //               display.SetCamContent(dccam);
-               display.SetCamContent(findstars.GetDisplay());
-               gPad->Modified();
-               gPad->Update();
-               starcam.Print("maxpossizechi");
-               // Remove the comments if you want to go through the file
-               // event-by-event:
-               if (!HandleInput())
-                 break;
-             }
-      } 
-
-      evtloop.PostProcess();
-  }
-
-  tlist.PrintStatistics();
-
-}
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/hillasONOFF.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/hillasONOFF.C	(revision 7136)
+++ 	(revision )
@@ -1,1339 +1,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//
-//           _____Macro for checking the hillas parameters_____
-//
-//                       Ester Aliu  <aliu@ifae.es>
-////////////////////////////////////////////////////////////////////////////
-void hillasONOFF()
-{    
-    // general settings
-    gROOT->Reset();
-    gStyle->SetCanvasColor(0);
-    gStyle->SetCanvasBorderMode(0);
-    gStyle->SetPadBorderMode(0);
-    gStyle->SetFrameBorderMode(0);
-    gStyle->SetOptStat(kFALSE);
-    // gStyle->SetTitleSize(0);
-    gStyle->SetStatColor(0);
-    gStyle->SetStatBorderSize(1);
-    gStyle->SetStatW(0.2);
-    gStyle->SetStatH(0.1);
-    gStyle->SetStatX(0.9);
-    gStyle->SetStatY(0.9);
- 
-       
-    // define file, tree, canvas
-    TChain* t= new TChain("Parameters");
-    //    t->AddFile("/local_disk/jrico/hillas/hillasOn21.root");
-    //    t->AddFile("/local_disk/jrico/hillas/hillasOn22.root");
-    t->AddFile("/local_disk/jrico/hillas/RFOnnoAlpha.root");
-    
-    // define file, tree, canvas
-    TChain *t2 = new TChain("Parameters");
-    //    t2->AddFile("/local_disk/jrico/hillas/hillasOff09.root");
-    //    t2->AddFile("/local_disk/jrico/hillas/hillasOff18.root");
-    //    t2->AddFile("/local_disk/jrico/hillas/hillasOff21.root");
-    t2->AddFile("/local_disk/jrico/hillas/RFOffnoAlpha.root");
-
-   
-    TString psname="hillasonoff.ps";
-    TString title;
-
-    TH1F* hLength; 
-    TH1F* hWidth; 
-    TH1F* hDist;
-    TH1F* hConc;
-    TH1F* hConc1;
-    TH1F* hConc6;
-    TH1F* hAlpha; 
-    TH1F* hSize; 
-
-    TH2F *hXY;
-
-    // define aliases
-    t->SetAlias("length","MHillas.fLength*0.6/189");
-    t->SetAlias("width","MHillas.fWidth*0.6/189");
-    t->SetAlias("dist","MHillasSrc.fDist*0.6/189");
-    t->SetAlias("conc","MNewImagePar.fConc");
-    t->SetAlias("conc1","MNewImagePar.fConc1");
-    t->SetAlias("conc6","MConcentration.fConc[6]");
-    t->SetAlias("size","MHillas.fSize");
-    t->SetAlias("alpha","abs(MHillasSrc.fAlpha)");
-    t->SetAlias("meanx","MHillas.fMeanX");
-    t->SetAlias("meany","MHillas.fMeanY");
-
-    // define aliases
-    t2->SetAlias("length","MHillas.fLength*0.6/189");
-    t2->SetAlias("width","MHillas.fWidth*0.6/189");
-    t2->SetAlias("dist","MHillasSrc.fDist*0.6/189");
-    t2->SetAlias("conc","MNewImagePar.fConc");
-    t2->SetAlias("conc1","MNewImagePar.fConc1");
-    t2->SetAlias("conc6","MConcentration.fConc[6]");
-    t2->SetAlias("size","MHillas.fSize");
-    t2->SetAlias("alpha","abs(MHillasSrc.fAlpha)");
-    t2->SetAlias("meanx","MHillas.fMeanX");
-    t2->SetAlias("meany","MHillas.fMeanY");
-
-      
-    // define  cuts
-    const char* cut1 = "size>500 && MHadronness.fHadronness<0.1";
-    const char* cut2 = "size>1000";
-    const char* cut3 = "size>2000";
-    const char* cut4 = "size>5000";
-    const char* cut5 = "size>10000";
-
-    const char* cutDist = "MHillasSrc.fDist*0.6/189.>0.2 && MHillasSrc.fDist*0.6/189.<0.8";
-
-
-    /*****************************************************************
-    ****                         PLOTS                            ****
-    *****************************************************************/
-    
-    Int_t nbin;
-    Float_t min;
-    Float_t max;
-
-
-    TString openpsname;
-    openpsname = psname + "(";
-
-    TString closepsname;
-    closepsname = psname  + ")";
-
-
-    //////////////////////////////////////////////////////////////
-    //                    Cuts in Size
-    //////////////////////////////////////////////////////////////
-    TCanvas *c1 = new TCanvas("c1","c1",500,800);
-    c1->Divide(2,3);
-    /////////////////////////////////////////////////////////////////
-
-    char* var="length>>hLength";    
-
-    nbin = 40; min = 0.; max = 1.;
-
-    c1->cd(1);
-    c1->GetPad(1)->SetGrid();    
-    title = "length " ;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t->Draw(var, "","goff");  
-    hLength->SetXTitle("degrees");
-    hLength->SetNormFactor(1.);
-    hLength->Draw("Ehist");
-    c1->GetPad(1)->Update();    
-    
-    c1->cd(2);
-    c1->GetPad(2)->SetGrid();    
-    title = "length ";  
-    title = title + cut1;
-    hLength = new TH1F("hLength",title, nbin, min, max);
-    t->Draw(var,cut1,"goff");
-    hLength->SetXTitle("degrees");
-    hLength->SetNormFactor(1.);
-    hLength->Draw("Ehist");    
-    c1->GetPad(2)->Update();
-  
-    c1->cd(3);
-    c1->GetPad(3)->SetGrid();    
-    title = "length ";  
-    title = title + cut2;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t->Draw(var,cut2,"goff");
-    hLength->SetXTitle("degrees");
-    hLength->SetNormFactor(1.);
-    hLength->Draw("Ehist");
-    c1->GetPad(3)->Update();
-  
-    c1->cd(4);
-    c1->GetPad(4)->SetGrid();    
-    title = "length ";  
-    title = title + cut3;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t->Draw(var,cut3, "goff");
-    hLength->SetXTitle("degrees");
-    hLength->SetNormFactor(1.);
-    hLength->Draw("Ehist");
-    c1->GetPad(4)->Update();
-        
-    c1->cd(5);
-    c1->GetPad(5)->SetGrid();    
-    title = "length ";  
-    title = title + cut4;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t->Draw(var,cut4, "goff");
-    hLength->SetXTitle("degrees");
-    hLength->SetNormFactor(1.);
-    hLength->Draw("Ehist");
-    c1->GetPad(5)->Update();
-        
-    c1->cd(6);
-    c1->GetPad(6)->SetGrid();    
-    title = "length ";  
-    title = title + cut5;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t->Draw(var,cut5, "goff");
-    hLength->SetXTitle("degrees");
-    hLength->SetNormFactor(1.);
-    hLength->Draw("Ehist");
-    c1->GetPad(6)->Update();
-   
-    //off data
-
-    c1->cd(1);
-    title = "length " ;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t2->Draw(var, "","goff");  
-    hLength->SetXTitle("degrees");
-    //hLength->SetLineStyle(2);
-    hLength->SetMarkerStyle(20);
-    hLength->SetMarkerSize(0.4);
-    hLength->SetNormFactor(1);
-    hLength->Draw("samePE");
-    c1->GetPad(1)->Modified();    
-    c1->GetPad(1)->Update();    
-    
-    c1->cd(2);
-    title = "length ";  
-    title = title + cut1;
-    hLength = new TH1F("hLength",title, nbin, min, max);
-    t2->Draw(var,cut1,"goff");
-    hLength->SetXTitle("degrees");
-    //hLength->SetLineStyle(2);
-    hLength->SetMarkerSize(0.4);
-    hLength->SetMarkerStyle(20);
-    hLength->SetNormFactor(1);
-    hLength->Draw("samePE");    
-    c1->GetPad(2)->Modified();    
-    c1->GetPad(2)->Update();
-  
-    c1->cd(3);
-    title = "length ";  
-    title = title + cut2;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t2->Draw(var,cut2,"goff");
-    //hLength->SetXTitle("degrees");
-    hLength->SetMarkerSize(0.4);
-    hLength->SetMarkerStyle(20);
-    //hLength->SetLineStyle(2);
-    hLength->SetNormFactor(1);
-    hLength->Draw("samePE");
-    c1->GetPad(3)->Modified();    
-    c1->GetPad(3)->Update();
-  
-    c1->cd(4);
-    title = "length ";  
-    title = title + cut3;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t2->Draw(var,cut3, "goff");
-    hLength->SetXTitle("degrees");
-    //    hLength->SetLineStyle(2);
-    hLength->SetMarkerStyle(20);
-    hLength->SetMarkerSize(0.4);
-    hLength->SetNormFactor(1);
-    hLength->Draw("samePE");
-    c1->GetPad(4)->Modified();    
-    c1->GetPad(4)->Update();
-        
-    c1->cd(5);
-    title = "length ";  
-    title = title + cut4;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t2->Draw(var,cut4, "goff");
-    hLength->SetXTitle("degrees");
-    //hLength->SetLineStyle(2);
-    hLength->SetMarkerStyle(20);
-    hLength->SetMarkerSize(0.4);
-    hLength->SetNormFactor(1);
-    hLength->Draw("samePE");
-    c1->GetPad(5)->Modified();    
-    c1->GetPad(5)->Update();
-        
-    c1->cd(6);
-    title = "length ";  
-    title = title + cut5;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t2->Draw(var,cut5, "goff");
-    hLength->SetXTitle("degrees");
-    // hLength->SetLineStyle(2);
-    hLength->SetMarkerStyle(20);
-    hLength->SetMarkerSize(0.4);
-    hLength->SetNormFactor(1);
-    hLength->Draw("samePE");
-    c1->GetPad(6)->Modified();    
-    c1->GetPad(6)->Update();
-    
-    c1->Print(openpsname); 
-
-    /////////////////////////////////////////////////////////////////
-    char* var="width>>hWidth";
-
-    nbin = 40; min = 0.; max = 0.8;
-
-    c1->cd(1);
-    title = "width ";  
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t->Draw(var, "", "goff");
-    hWidth->SetXTitle("degrees");
-    hWidth->SetNormFactor(1.);
-    hWidth->Draw("Ehist");
-    c1->GetPad(1)->Update();    
-
-    c1->cd(2);
-    title = "width ";  
-    title = title + cut1;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t->Draw(var,cut1, "goff");
-    hWidth->SetXTitle("degrees");
-    hWidth->SetNormFactor(1.);
-    hWidth->Draw("Ehist");    
-    c1->GetPad(2)->Update();
-    
-    c1->cd(3);
-    title = "width ";  
-    title = title + cut2;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t->Draw(var,cut2, "goff");
-    hWidth->SetXTitle("degrees");
-    hWidth->SetNormFactor(1.);
-    hWidth->Draw("Ehist");
-    c1->GetPad(3)->Update();
-    
-    c1->cd(4);
-    title = "width ";  
-    title = title + cut3;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t->Draw(var,cut3, "goff");
-    hWidth->SetXTitle("degrees");
-    hWidth->SetNormFactor(1.);
-    hWidth->Draw("Ehist");
-    c1->GetPad(4)->Update();
-    
-    c1->cd(5);
-    title = "width ";  
-    title = title + cut4;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t->Draw(var,cut4, "goff");
-    hWidth->SetXTitle("degrees");
-    hWidth->SetNormFactor(1.);
-    hWidth->Draw("Ehist");
-    c1->GetPad(5)->Update();
-    
-    c1->cd(6);
-    title = "width ";  
-    title = title + cut5;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t->Draw(var,cut5, "goff");
-    hWidth->SetXTitle("degrees");
-    hWidth->SetNormFactor(1.);
-    hWidth->Draw("Ehist");
-    c1->GetPad(6)->Update();
-
-    // offdata
-   
-    c1->cd(1);
-    title = "width ";  
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t2->Draw(var, "", "goff");
-    hWidth->SetXTitle("degrees");
-    //hWidth->SetLineStyle(2);
-    hWidth->SetMarkerStyle(20);
-    hWidth->SetMarkerSize(0.4);
-    hWidth->SetNormFactor(1);
-    hWidth->Draw("samePE");
-    c1->GetPad(1)->Modified();    
-    c1->GetPad(1)->Update();    
-
-    c1->cd(2);
-    title = "width ";  
-    title = title + cut1;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t2->Draw(var,cut1, "goff");
-    hWidth->SetXTitle("degrees");
-    //hWidth->SetLineStyle(2);
-    hWidth->SetMarkerStyle(20);
-    hWidth->SetMarkerSize(0.4);
-    hWidth->SetNormFactor(1);
-    hWidth->Draw("samePE");    
-    c1->GetPad(2)->Modified();    
-    c1->GetPad(2)->Update();
-    
-    c1->cd(3);
-    title = "width ";  
-    title = title + cut2;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t2->Draw(var,cut2, "goff");
-    hWidth->SetXTitle("degrees");
-    //hWidth->SetLineStyle(2);
-    hWidth->SetMarkerStyle(20);
-    hWidth->SetMarkerSize(0.4);
-    hWidth->SetNormFactor(1);
-    hWidth->Draw("samePE");
-    c1->GetPad(3)->Modified();    
-    c1->GetPad(3)->Update();
-    
-    c1->cd(4);
-    title = "width ";  
-    title = title + cut3;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t2->Draw(var,cut3, "goff");
-    hWidth->SetXTitle("degrees");
-    //hWidth->SetLineStyle(2);
-    hWidth->SetMarkerStyle(20);
-    hWidth->SetMarkerSize(0.4);
-    hWidth->SetNormFactor(1);
-    hWidth->Draw("samePE");
-    c1->GetPad(4)->Modified();    
-    c1->GetPad(4)->Update();
-    
-    c1->cd(5);
-    title = "width ";  
-    title = title + cut4;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t2->Draw(var,cut4, "goff");
-    hWidth->SetXTitle("degrees");
-    // hWidth->SetLineStyle(2);
-    hWidth->SetMarkerStyle(20);
-    hWidth->SetMarkerSize(0.4);
-    hWidth->SetNormFactor(1);
-    hWidth->Draw("samePE");
-    c1->GetPad(5)->Modified();    
-    c1->GetPad(5)->Update();
-    
-    c1->cd(6);
-    title = "width ";  
-    title = title + cut5;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t2->Draw(var,cut5, "goff");
-    hWidth->SetXTitle("degrees");
-    //hWidth->SetLineStyle(2);
-    hWidth->SetMarkerStyle(20);
-    hWidth->SetMarkerSize(0.4);
-    hWidth->SetNormFactor(1);
-    hWidth->Draw("samePE");
-    c1->GetPad(6)->Modified();    
-    c1->GetPad(6)->Update();
-
-   
-    c1->Print(psname); 
- 
-    /////////////////////////////////////////////////////////////////
-
-    char* var="dist>>hDist";
-      
-    nbin = 40; min = 0.; max = 1.6;
-
-    c1->cd(1);
-    title = "dist ";  
-    hDist = new TH1F("hDist",title,nbin, min, max);   
-    t->Draw(var, "", "goff");
-    hDist->SetXTitle("degrees");
-    hDist->SetNormFactor(1.);
-    hDist->Draw("Ehist");
-    c1->GetPad(1)->Update();    
-
-    c1->cd(2);
-    title = "dist ";  
-    title = title + cut1;
-    hDist = new TH1F("hDist",title,nbin, min, max);
-    t->Draw(var,cut1, "goff");
-    hDist->SetXTitle("degrees");
-    hDist->SetNormFactor(1.);
-    hDist->Draw("Ehist");    
-    c1->GetPad(2)->Update();
-    
-    c1->cd(3);
-    title = "dist ";  
-    title = title + cut2;
-    hDist = new TH1F("hDist",title,nbin, min, max);
-    t->Draw(var,cut2, "goff");
-    hDist->SetXTitle("degrees");
-    hDist->SetNormFactor(1.);
-    hDist->Draw("Ehist");
-    c1->GetPad(3)->Update();
-    
-    c1->cd(4);
-    title = "dist ";  
-    title = title + cut3;
-    hDist = new TH1F("hDist",title,nbin, min, max);
-    t->Draw(var,cut3, "goff");
-    hDist->SetXTitle("degrees");
-    hDist->SetNormFactor(1.);
-    hDist->Draw("Ehist");
-    c1->GetPad(4)->Update();
-    
-    c1->cd(5);
-    title = "dist ";  
-    title = title + cut4;
-    hDist = new TH1F("hDist",title,nbin, min, max);
-    t->Draw(var,cut4, "goff");
-    hDist->SetXTitle("degrees");
-    hDist->SetNormFactor(1.);
-    hDist->Draw("Ehist");
-    c1->GetPad(5)->Update();
-    
-    c1->cd(6);
-    title = "dist ";  
-    title = title + cut5;
-    hDist = new TH1F("hDist",title,nbin, min, max);
-    t->Draw(var,cut5,"goff");
-    hDist->SetXTitle("degrees");
-    hDist->SetNormFactor(1.);
-    hDist->Draw("Ehist");
-    c1->GetPad(6)->Update();
-
-    //offdata
-
-    c1->cd(1);
-    title = "dist ";  
-    hDist = new TH1F("hDist",title,nbin, min, max);   
-    t2->Draw(var, "", "goff");
-    hDist->SetXTitle("degrees");
-    //hDist->SetLineStyle(2);
-    hDist->SetMarkerStyle(20);
-    hDist->SetMarkerSize(0.4);
-    hDist->SetNormFactor(1);
-    hDist->Draw("samePE");
-    c1->GetPad(1)->Modified();    
-    c1->GetPad(1)->Update();    
-
-    c1->cd(2);
-    title = "dist ";  
-    title = title + cut1;
-    hDist = new TH1F("hDist",title,nbin, min, max);
-    t2->Draw(var,cut1, "goff");
-    hDist->SetXTitle("degrees");
-    //hDist->SetLineStyle(2);
-    hDist->SetMarkerStyle(20);
-    hDist->SetMarkerSize(0.4);
-    hDist->SetNormFactor(1);
-    hDist->Draw("samePE");    
-    c1->GetPad(2)->Modified();    
-    c1->GetPad(2)->Update();
-    
-    c1->cd(3);
-    title = "dist ";  
-    title = title + cut2;
-    hDist = new TH1F("hDist",title,nbin, min, max);
-    t2->Draw(var,cut2, "goff");
-    hDist->SetXTitle("degrees");
-    //hDist->SetLineStyle(2);
-    hDist->SetMarkerStyle(20);
-    hDist->SetMarkerSize(0.4);   
-    hDist->SetNormFactor(1);
-    hDist->Draw("samePE");
-    c1->GetPad(3)->Modified();    
-    c1->GetPad(3)->Update();
-    
-    c1->cd(4);
-    title = "dist ";  
-    title = title + cut3;
-    hDist = new TH1F("hDist",title,nbin, min, max);
-    t2->Draw(var,cut3, "goff");
-    hDist->SetXTitle("degrees");
-    //hDist->SetLineStyle(2);
-    hDist->SetMarkerStyle(20);
-    hDist->SetMarkerSize(0.4);
-    hDist->SetNormFactor(1);
-    hDist->Draw("samePE");
-    c1->GetPad(4)->Modified();    
-    c1->GetPad(4)->Update();
-    
-    c1->cd(5);
-    title = "dist ";  
-    title = title + cut4;
-    hDist = new TH1F("hDist",title,nbin, min, max);
-    t2->Draw(var,cut4, "goff");
-    hDist->SetXTitle("degrees");
-    //hDist->SetLineStyle(2);
-    hDist->SetMarkerStyle(20);
-    hDist->SetMarkerSize(0.4);
-    hDist->SetNormFactor(1);
-    hDist->Draw("samePE");
-    c1->GetPad(5)->Modified();    
-    c1->GetPad(5)->Update();
-    
-    c1->cd(6);
-    title = "dist ";  
-    title = title + cut5;
-    hDist = new TH1F("hDist",title,nbin, min, max);
-    t2->Draw(var,cut5,"goff");
-    hDist->SetXTitle("degrees");
-    //hDist->SetLineStyle(2);
-    hDist->SetMarkerStyle(20);
-    hDist->SetMarkerSize(0.4);
-    hDist->SetNormFactor(1);
-    hDist->Draw("samePE");
-    c1->GetPad(6)->Modified();    
-    c1->GetPad(6)->Update();
-
-    c1->Print(psname); 
-
-    /////////////////////////////////////////////////////////////////
-    char* var="conc>>hConc";
-
-    nbin = 40; min = 0.; max = 1.;
-
-    c1->cd(1);
-    title = "conc ";  
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t->Draw(var,"","goff");
-    hConc->SetNormFactor(1.);
-    hConc->Draw("Ehist");
-    c1->GetPad(1)->Update();    
-
-    c1->cd(2);
-    title = "conc ";  
-    title = title + cut1;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t->Draw(var,cut1,"goff");    
-    hConc->SetNormFactor(1.);
-    hConc->Draw("Ehist");
-    c1->GetPad(2)->Update();
-    
-    c1->cd(3);
-    title = "conc ";  
-    title = title + cut2;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t->Draw(var,cut2,"goff");
-    hConc->SetNormFactor(1.);
-    hConc->Draw("Ehist");
-    c1->GetPad(3)->Update();
-    
-    c1->cd(4);
-    title = "conc ";  
-    title = title + cut3;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t->Draw(var,cut3,"goff");
-    hConc->SetNormFactor(1.);
-    hConc->Draw("Ehist");
-    c1->GetPad(4)->Update();
-    
-    c1->cd(5);
-    title = "conc ";  
-    title = title + cut4;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t->Draw(var,cut4,"goff");
-    hConc->SetNormFactor(1.);
-    hConc->Draw("Ehist");
-    c1->GetPad(5)->Update();
-    
-    c1->cd(6);
-    title = "conc ";  
-    title = title + cut5;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t->Draw(var,cut5,"goff");
-    hConc->SetNormFactor(1.);
-    hConc->Draw("Ehist");
-    c1->GetPad(6)->Update();
-  
-    //offdata 
-
-    c1->cd(1);
-    title = "conc ";  
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t2->Draw(var, "","goff");
-    hConc->SetNormFactor(1.);
-    //hConc->SetLineStyle(2);
-    hConc->SetMarkerStyle(20);
-    hConc->SetMarkerSize(0.4);
-    hConc->Draw("samePE");
-    c1->GetPad(1)->Modified();    
-    c1->GetPad(1)->Update();    
-
-    c1->cd(2);
-    title = "conc ";  
-    title = title + cut1;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t2->Draw(var,cut1,"goff");
-    hConc->SetNormFactor(1.);
-    hConc->SetMarkerStyle(20);
-    hConc->SetMarkerSize(0.4);
-    // hConc->SetLineStyle(2);
-    hConc->Draw("samePE");
-    c1->GetPad(2)->Modified();        
-    c1->GetPad(2)->Update();
-    
-    c1->cd(3);
-    title = "conc ";  
-    title = title + cut2;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t2->Draw(var,cut2,"goff");
-    hConc->SetNormFactor(1.);
-    hConc->SetMarkerStyle(20);
-    hConc->SetMarkerSize(0.4);
-    //hConc->SetLineStyle(2);
-    hConc->Draw("samePE");
-    c1->GetPad(3)->Modified();    
-    c1->GetPad(3)->Update();
-    
-    c1->cd(4);
-    title = "conc ";  
-    title = title + cut3;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t2->Draw(var,cut3,"goff");
-    hConc->SetNormFactor(1.);
-    hConc->SetMarkerStyle(20);
-    hConc->SetMarkerSize(0.4);
-    //hConc->SetLineStyle(2);
-    hConc->Draw("samePE");
-    c1->GetPad(4)->Modified();    
-    c1->GetPad(4)->Update();
-    
-    c1->cd(5);
-    title = "conc ";  
-    title = title + cut4;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t2->Draw(var,cut4,"goff");
-    hConc->SetNormFactor(1.);
-    hConc->SetMarkerStyle(20);
-    hConc->SetMarkerSize(0.4);
-    //hConc->SetLineStyle(2);
-    hConc->Draw("samePE");
-    c1->GetPad(5)->Modified();    
-    c1->GetPad(5)->Update();
-    
-    c1->cd(6);
-    title = "conc ";  
-    title = title + cut5;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t2->Draw(var,cut5,"goff");
-    hConc->SetNormFactor(1.);
-    hConc->SetMarkerStyle(20);
-    hConc->SetMarkerSize(0.4);
-    //hConc->SetLineStyle(2);
-    hConc->Draw("samePE");
-    c1->GetPad(6)->Modified();    
-    c1->GetPad(6)->Update();
-  
-    c1->Print(psname); 
-
-    /////////////////////////////////////////////////////////////////
-    char* var="conc6>>hConc6";
-
-    nbin = 40; min = 0.; max = 1.;
-
-    c1->cd(1);
-    title = "conc6 ";  
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t->Draw(var,"","goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->Draw("Ehist");
-    c1->GetPad(1)->Update();    
-
-    c1->cd(2);
-    title = "conc6 ";  
-    title = title + cut1;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t->Draw(var,cut1,"goff");  
-    hConc6->SetNormFactor(1.);
-    hConc6->Draw("Ehist");  
-    c1->GetPad(2)->Update();
-    
-    c1->cd(3);
-    title = "conc6 ";  
-    title = title + cut2;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t->Draw(var,cut2,"goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->Draw("Ehist");
-    c1->GetPad(3)->Update();
-    
-    c1->cd(4);
-    title = "conc6 ";  
-    title = title + cut3;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t->Draw(var,cut3,"goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->Draw("Ehist");
-    c1->GetPad(4)->Update();
-    
-    c1->cd(5);
-    title = "conc6 ";  
-    title = title + cut4;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t->Draw(var,cut4,"goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->Draw("Ehist");
-    c1->GetPad(5)->Update();
-    
-    c1->cd(6);
-    title = "conc6 ";  
-    title = title + cut5;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t->Draw(var,cut5,"goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->Draw("Ehist");
-    c1->GetPad(6)->Update();
-
-    //offdata
-
-    c1->cd(1);
-    title = "conc6 ";  
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t2->Draw(var,"","goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->SetMarkerStyle(20);
-    hConc6->SetMarkerSize(0.4);
-    //hConc6->SetLineStyle(2);
-    hConc6->Draw("samePE");
-    c1->GetPad(1)->Modified();    
-    c1->GetPad(1)->Update();    
-
-    c1->cd(2);
-    title = "conc6 ";  
-    title = title + cut1;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t2->Draw(var,cut1,"goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->SetMarkerStyle(20);
-    hConc6->SetMarkerSize(0.4);
-    //hConc6->SetLineStyle(2);
-    hConc6->Draw("samePE");
-    c1->GetPad(2)->Modified();        
-    c1->GetPad(2)->Update();
-    
-    c1->cd(3);
-    title = "conc6 ";  
-    title = title + cut2;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t2->Draw(var,cut2,"goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->SetMarkerStyle(20);
-    hConc6->SetMarkerSize(0.4);
-    //hConc6->SetLineStyle(2);
-    hConc6->Draw("samePE");
-    c1->GetPad(3)->Modified();    
-    c1->GetPad(3)->Update();
-    
-    c1->cd(4);
-    title = "conc6 ";  
-    title = title + cut3;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t2->Draw(var,cut3,"goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->SetMarkerStyle(20);
-    hConc6->SetMarkerSize(0.4);
-    //hConc6->SetLineStyle(2);
-    hConc6->Draw("samePE");
-    c1->GetPad(4)->Modified();    
-    c1->GetPad(4)->Update();
-    
-    c1->cd(5);
-    title = "conc6 ";  
-    title = title + cut4;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t2->Draw(var,cut4,"goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->SetMarkerStyle(20);
-    hConc6->SetMarkerSize(0.4);
-    // hConc6->SetLineStyle(2);
-    hConc6->Draw("samePE");
-    c1->GetPad(5)->Modified();    
-    c1->GetPad(5)->Update();
-    
-    c1->cd(6);
-    title = "conc6 ";  
-    title = title + cut5;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t2->Draw(var,cut5,"goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->SetMarkerStyle(20);
-    hConc6->SetMarkerSize(0.4);
-    //hConc6->SetLineStyle(2);
-    hConc6->Draw("samePE");
-    c1->GetPad(6)->Modified();    
-    c1->GetPad(6)->Update();
-
-    c1->Print(psname); 
-
-    /////////////////////////////////////////////////////////////////
-    char* var="alpha>>hAlpha";
-
-    nbin = 18; min = 0.; max = 90.;
-    
-    c1->cd(1);
-    title = "alpha ";  
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t->Draw(var, "", "goff");
-    hAlpha->SetXTitle("degrees");
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("Ehist");
-    c1->GetPad(1)->Update();    
-
-    c1->cd(2);
-    title = "alpha ";  
-    title = title + cut1;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t->Draw(var,cut1, "goff");
-    hAlpha->SetXTitle("degrees");
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("Ehist");    
-    c1->GetPad(2)->Update();
-    
-    c1->cd(3);
-    title = "alpha ";  
-    title = title + cut2;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t->Draw(var,cut2, "goff");
-    hAlpha->SetXTitle("degrees");
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("Ehist");
-    c1->GetPad(3)->Update();
-    
-    c1->cd(4);
-    title = "alpha ";  
-    title = title + cut3;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t->Draw(var,cut3, "goff");
-    hAlpha->SetXTitle("degrees");
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("Ehist");
-    c1->GetPad(4)->Update();
-    
-    c1->cd(5);
-    title = "alpha ";  
-    title = title + cut4;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t->Draw(var,cut4, "goff");
-    hAlpha->SetXTitle("degrees");
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("Ehist");
-    c1->GetPad(5)->Update();
-    
-    c1->cd(6);
-    title = "alpha ";  
-    title = title + cut5;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t->Draw(var,cut5, "goff");
-    hAlpha->SetXTitle("degrees");
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("Ehist");
-    c1->GetPad(6)->Update();
-
-    //offdata
-
-    c1->cd(1);
-    title = "alpha ";  
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t2->Draw(var, "", "goff");
-    hAlpha->SetXTitle("degrees");
-    //hAlpha->SetLineStyle(2);
-    hAlpha->SetNormFactor(1);
-    hAlpha->SetMarkerStyle(20);
-    hAlpha->SetMarkerSize(0.4);
-    hAlpha->Draw("samePE");
-    c1->GetPad(1)->Modified();    
-    c1->GetPad(1)->Update();    
-
-    c1->cd(2);
-    title = "alpha ";  
-    title = title + cut1;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t2->Draw(var,cut1, "goff");
-    hAlpha->SetXTitle("degrees");
-    //hAlpha->SetLineStyle(2);
-    hAlpha->SetMarkerStyle(20);
-    hAlpha->SetMarkerSize(0.4);
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("samePE");    
-    c1->GetPad(2)->Modified();    
-    c1->GetPad(2)->Update();
-    
-    c1->cd(3);
-    title = "alpha ";  
-    title = title + cut2;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t2->Draw(var,cut2, "goff");
-    hAlpha->SetXTitle("degrees");
-    //hAlpha->SetLineStyle(2);
-    hAlpha->SetNormFactor(1);
-    hAlpha->SetMarkerStyle(20);
-    hAlpha->SetMarkerSize(0.4);
-    hAlpha->Draw("samePE");
-    c1->GetPad(3)->Modified();    
-    c1->GetPad(3)->Update();
-    
-    c1->cd(4);
-    title = "alpha ";  
-    title = title + cut3;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t2->Draw(var,cut3, "goff");
-    hAlpha->SetXTitle("degrees");
-    //hAlpha->SetLineStyle(2);
-    hAlpha->SetMarkerStyle(20);
-    hAlpha->SetMarkerSize(0.4);
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("samePE");
-    c1->GetPad(4)->Modified();    
-    c1->GetPad(4)->Update();
-    
-    c1->cd(5);
-    title = "alpha ";  
-    title = title + cut4;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t2->Draw(var,cut4, "goff");
-    hAlpha->SetXTitle("degrees");
-    //hAlpha->SetLineStyle(2);
-    hAlpha->SetMarkerStyle(20);
-    hAlpha->SetMarkerSize(0.4);
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("samePE");
-    c1->GetPad(5)->Modified();    
-    c1->GetPad(5)->Update();
-    
-    c1->cd(6);
-    title = "alpha ";  
-    title = title + cut5;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t2->Draw(var,cut5, "goff");
-    hAlpha->SetXTitle("degrees");
-    //hAlpha->SetLineStyle(2);
-    hAlpha->SetMarkerStyle(20);
-    hAlpha->SetMarkerSize(0.4);
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("samePE");
-    c1->GetPad(6)->Modified();    
-    c1->GetPad(6)->Update();
-
-    c1->Print(psname); 
-
-    /////////////////////////////////////////////////////////////////
-    //                     Cuts in Dist
-    /////////////////////////////////////////////////////////////////
-
-    TCanvas *c2 = new TCanvas("c2","Cuts in Dist",500,800);
-    c2->Divide(2,3);
-    /////////////////////////////////////////////////////////////////
-    char* var="length>>hLength";
-
-    nbin = 40; min = 0.; max = 1.;
-
-    c2->cd(1);
-    //    c2->GetPad(1)->SetGrid();    
-    title = "length "; 
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t->Draw(var, "", "goff");
-    hLength->SetXTitle("degrees");
-    hLength->SetNormFactor(1);
-    hLength->Draw("Ehist");
-    c2->GetPad(1)->Update();
- 
-    c2->cd(2);
-    //c2->GetPad(2)->SetGrid();    
-    title = "length ";  
-    title = title + cutDist;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t->Draw(var,cutDist, "goff");
-    hLength->SetXTitle("degrees");
-    hLength->SetNormFactor(1);
-    hLength->Draw("Ehist");
-    c2->GetPad(2)->Update();
-
-    //offdata
-        
-    c2->cd(1);
-    c2->GetPad(1)->SetGrid();    
-    title = "length "; 
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t2->Draw(var, "", "goff");
-    hLength->SetXTitle("degrees");
-    //   hLength->SetLineStyle(2);
-    hLength->SetMarkerStyle(20);
-    hLength->SetMarkerSize(0.4);
-    hLength->SetNormFactor(1);
-    hLength->Draw("samePE");
-    c2->GetPad(1)->Modified();    
-    c2->GetPad(1)->Update();
- 
-    c2->cd(2);
-    c2->GetPad(2)->SetGrid();    
-    title = "length ";  
-    title = title + cutDist;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t2->Draw(var,cutDist, "goff");
-    hLength->SetXTitle("degrees");
-    hLength->SetMarkerStyle(20);
-    hLength->SetMarkerSize(0.4);
-    //hLength->SetLineStyle(2);
-    hLength->SetNormFactor(1);
-    hLength->Draw("samePE");
-    c2->GetPad(1)->Modified();    
-    c2->GetPad(2)->Update();
-
-    /////////////////////////////////////////////////////////////////
-    char* var="width>>hWidth";
-
-    nbin = 40; min = 0.; max = 1.;
-
-    c2->cd(3);
-    c2->GetPad(3)->SetGrid();    
-    title = "width ";  
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t->Draw(var, "", "goff");
-    hWidth->SetXTitle("degrees");
-    hWidth->SetNormFactor(1);
-    hWidth->Draw("Ehist");
-    c2->GetPad(3)->Update();
-    
-    c2->cd(4);
-    c2->GetPad(4)->SetGrid();    
-    title = "width ";  
-    title = title + cutDist;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t->Draw(var,cutDist, "goff");
-    hWidth->SetXTitle("degrees");
-    hWidth->SetNormFactor(1);
-    hWidth->Draw("Ehist");
-    c2->GetPad(4)->Update();
-    
-    //offdata
-
-    c2->cd(3);
-    c2->GetPad(3)->SetGrid();    
-    title = "width ";  
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t2->Draw(var, "", "goff");
-    hWidth->SetXTitle("degrees");
-    //hWidth->SetLineStyle(2);
-    hWidth->SetMarkerStyle(20);
-    hWidth->SetMarkerSize(0.4);
-    hWidth->SetNormFactor(1);
-    hWidth->Draw("samePE");
-    c2->GetPad(3)->Modified();    
-    c2->GetPad(3)->Update();
-    
-    c2->cd(4);
-    c2->GetPad(4)->SetGrid();    
-    title = "width ";  
-    title = title + cutDist;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t2->Draw(var,cutDist, "goff");
-    hWidth->SetXTitle("degrees");
-    //hWidth->SetLineStyle(2);
-    hWidth->SetMarkerStyle(20);
-    hWidth->SetMarkerSize(0.4);
-    hWidth->SetNormFactor(1);
-    hWidth->Draw("samePE");
-    c2->GetPad(4)->Modified();    
-    c2->GetPad(4)->Update();
-
-    /////////////////////////////////////////////////////////////////
-    char* var="conc>>hConc";
-
-    nbin = 40; min = 0.; max = 1.;
-
-    c2->cd(5);
-    c2->GetPad(5)->SetGrid();    
-    title = "conc ";  
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t->Draw(var,"","goff");
-    hConc->SetNormFactor(1.);
-    hConc->Draw("Ehist");
-    c2->GetPad(5)->Update();
-    
-    c2->cd(6);
-    c2->GetPad(6)->SetGrid();    
-    title = "conc ";  
-    title = title + cutDist;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t->Draw(var,cutDist,"goff");
-    hConc->SetNormFactor(1.);
-    hConc->Draw("Ehist");
-    c2->GetPad(6)->Update();
-    
-    //offdata
-
-    c2->cd(5);
-    c2->GetPad(5)->SetGrid();    
-    title = "conc ";  
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t2->Draw(var,"", "goff");
-    //  hConc->SetLineStyle(2);
-    hConc->SetMarkerStyle(20);
-    hConc->SetMarkerSize(0.4);
-    hConc->SetNormFactor(1.);
-    hConc->Draw("samePE");
-    c2->GetPad(5)->Modified();    
-    c2->GetPad(5)->Update();
-    
-    c2->cd(6);
-    c2->GetPad(6)->SetGrid();    
-    title = "conc ";  
-    title = title + cutDist;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t2->Draw(var,cutDist,"goff");
-    //hConc->SetLineStyle(2);
-    hConc->SetMarkerStyle(20);
-    hConc->SetMarkerSize(0.4);
-    hConc->SetNormFactor(1.);
-    hConc->Draw("samePE");
-    c2->GetPad(6)->Modified();    
-    c2->GetPad(6)->Update();
-    
-    c2->Print(psname); 
-
-    /////////////////////////////////////////////////////////////////
-    char* var="conc6>>hConc6";
-
-    nbin = 40; min = 0.; max = 1.;
-
-    c2->cd(1);
-    title = "conc6 ";  
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t->Draw(var,"","goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->Draw("Ehist");
-    c2->GetPad(1)->Update();
-    
-    c2->cd(2);
-    title = "conc6 ";  
-    title = title + cutDist;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t->Draw(var,cutDist,"goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->Draw("Ehist");
-    c2->GetPad(2)->Update();
-
-    //offdata
-
-    c2->cd(1);
-    title = "conc6 ";  
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t2->Draw(var,"","goff");
-    //hConc6->SetLineStyle(2);
-    hConc6->SetMarkerStyle(20);
-    hConc6->SetMarkerSize(0.4);
-    hConc6->SetNormFactor(1.);
-    hConc6->Draw("samePE");
-    c2->GetPad(1)->Modified();    
-    c2->GetPad(1)->Update();
-    
-    c2->cd(2);
-    title = "conc6 ";  
-    title = title + cutDist;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t2->Draw(var,cutDist,"goff");
-    // hConc6->SetLineStyle(2);
-    hConc6->SetMarkerStyle(20);
-    hConc6->SetMarkerSize(0.4);
-    hConc6->SetNormFactor(1.);
-    hConc6->Draw("samePE");
-    c2->GetPad(2)->Modified();    
-    c2->GetPad(2)->Update(); 
-  
-    /////////////////////////////////////////////////////////////////
-    char* var="alpha>>hAlpha";
-
-    nbin = 18; min = 0.; max = 90.;
-
-    c2->cd(3);
-    title = "alpha ";  
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t->Draw(var, "", "goff");
-    hAlpha->SetXTitle("degrees");
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("Ehist");
-    c2->GetPad(3)->Update();
-    
-    c2->cd(4);
-    title = "alpha ";  
-    title = title + cutDist;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t->Draw(var,cutDist, "goff");
-    hAlpha->SetXTitle("degrees");
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("Ehist");
-    c2->GetPad(4)->Update();
-   
-    //offdata
-
-    c2->cd(3);
-    title = "alpha ";  
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t2->Draw(var, "", "goff");
-    hAlpha->SetXTitle("degrees");
-    //hAlpha->SetLineStyle(2);
-    hAlpha->SetMarkerStyle(20);
-    hAlpha->SetMarkerSize(0.4);
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("samePE");
-    c2->GetPad(3)->Modified();    
-    c2->GetPad(3)->Update();
-    
-    c2->cd(4);
-    title = "alpha ";  
-    title = title + cutDist;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t2->Draw(var,cutDist, "goff");
-    hAlpha->SetXTitle("degrees");
-    //hAlpha->SetLineStyle(2);
-    hAlpha->SetMarkerStyle(20);
-    hAlpha->SetMarkerSize(0.4);
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("samePE");
-    c2->GetPad(4)->Modified();    
-    c2->GetPad(4)->Update();
-
-
-    /////////////////////////////////////////////////////////////////
-    char* var="log10(size)>>hSize";
-
-    nbin = 40; min = 0.5; max = 4.5;
-
-    c2->cd(5);
-    c2->GetPad(5)->SetLogy(); 
-    title = "size ";  
-    hSize = new TH1F("hSize",title,nbin, min, max);
-    t->Draw(var, "1/MHillas.fSize", "goff");
-    hSize->SetNormFactor(1.);
-    hSize->SetXTitle("log10(ADC counts)");
-    hSize->Draw("Ehist");
-    c2->GetPad(5)->Update();
-    
-    c2->cd(6);
-    c2->GetPad(6)->SetLogy(); 
-    title = "size ";  
-    title = title + cutDist;
-    hSize = new TH1F("hSize",title,nbin, min, max);
-    t->Draw(var,"1/MHillas.fSize*(MHillasSrc.fDist*0.6/189.>0.2 && MHillasSrc.fDist*0.6/189<0.8)", "goff");
-    hSize->SetXTitle("log10(ADC counts)");
-    hSize->SetNormFactor(1.);
-    hSize->Draw("Ehist");
-    c2->GetPad(6)->Update(); 
-
-    //offdata
-    c2->cd(5);
-    c2->GetPad(5)->SetLogy(); 
-    title = "size ";  
-    hSize = new TH1F("hSize",title,nbin, min, max);
-    t2->Draw(var, "1/MHillas.fSize", "goff");
-    hSize->SetXTitle("log10(ADC counts)");
-    hSize->SetNormFactor(1.);
-    hSize->SetMarkerStyle(20);
-    hSize->SetMarkerSize(0.4);
-    //hSize->SetLineStyle(2);
-    hSize->Draw("samePE");
-    c2->GetPad(5)->Modified();    
-    c2->GetPad(5)->Update();
-    
-    c2->cd(6);
-    c2->GetPad(6)->SetLogy(); 
-    title = "size ";  
-    title = title + cutDist;
-    hSize = new TH1F("hSize",title,nbin, min, max);
-    t2->Draw(var,"1/MHillas.fSize*(MHillasSrc.fDist*0.6/189.>0.2 && MHillasSrc.fDist*0.6/189<0.8)", "goff");
-    hSize->SetXTitle("log10(ADC counts)");
-    //hSize->SetLineStyle(2);
-    hSize->SetNormFactor(1.);
-    hSize->SetMarkerStyle(20);
-    hSize->SetMarkerSize(0.4);
-    hSize->Draw("samePE");
-    c2->GetPad(6)->Modified();    
-    c2->GetPad(6)->Update(); 
-       
-    c2->Print(closepsname);                                                    
-  
-}
-
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/hvnotnominal.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/hvnotnominal.C	(revision 7136)
+++ 	(revision )
@@ -1,167 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Javier López, 04/2004 <mailto:jlopez@ifae.es>
-!
-!   Copyright: MAGIC Software Development, 2000-2004
-!
-!
-\* ======================================================================== */
-
-
-Bool_t HandleInput()
-{
-    TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
-    while (1)
-    {
-        //
-        // While reading the input process gui events asynchronously
-        //
-        timer.TurnOn();
-        TString input = Getline("Type 'q' to exit, <return> to go on: ");
-        timer.TurnOff();
-
-        if (input=="q\n")
-            return kFALSE;
-
-        if (input=="\n")
-            return kTRUE;
-    };
-
-    return kFALSE;
-}
-
-
-void hvnotnominal(const TString filename="20040319_20821_D_Mrk421_S.root", const TString directory="/nfs/magic/CaCodata/2004_03_19/", Float_t percent = 0.01)
-{
-
-  //
-  // Create a empty Parameter List and an empty Task List
-  // The tasklist is identified in the eventloop by its name
-  //
-  MParList  plist;
-  
-  MTaskList tlist;
-  plist.AddToList(&tlist);
-
-
-  MGeomCamMagic geomcam;
-  MBadPixelsCam badcam;
-  MCameraHV     hvcam;
-
-  // this line is needed because the CC rep rootified file don't have run header,
-  // then the MGeomApply can not initialitaze the containers with the number of 
-  // pixels because this is done in the reinit().
-  badcam.InitSize(geomcam.GetNumPixels());
-  
-  plist.AddToList(&geomcam);
-  plist.AddToList(&badcam);
-  plist.AddToList(&hvcam);
-
-  //
-  // Now setup the tasks and tasklist:
-  // ---------------------------------
-  //
-
-  // Reads the trees of the root file and the analysed branches
-  MReadReports read;
-  read.AddTree("Camera"); 
-  read.AddFile(directory+filename);     // after the reading of the trees!!!
-  read.AddToBranchList("MReportCamera.*");
-
-  MGeomApply geomapl;
-  MFHVNotNominal fHVNominal;
-  TString hvnominal = "/mnt/users/jlopez/Mars/Files4Mars/Config/HVSettings_FF35q.conf";
-  fHVNominal.SetHVNominalValues(hvnominal);
-  //  fHVNominal.SetMaxNumPixelsDeviated(10);
-  MContinue cont_hv(&fHVNominal);
-
-  tlist.AddToList(&read);
-  tlist.AddToList(&geomapl);
-  tlist.AddToList(&cont_hv);
-
-  //
-  // Create and setup the eventloop
-  //
-  MEvtLoop evtloop;
-  evtloop.SetParList(&plist);
-     
-  //
-  // Execute your analysis
-  //
-
-  MHCamera hvnotnominal(geomcam);
-  MHCamera lowhvnotnominal(geomcam);
-  MHCamera uphvnotnominal(geomcam);
-
-  if (!evtloop.PreProcess())
-    return;
-
-  TArrayD nominal = fHVNominal.GetHVNominal();
-  TArrayD lownominal = nominal;
-  TArrayD upnominal = nominal;
-  
-  for (UInt_t pix=0; pix<nominal.GetSize(); pix++)
-    {
-      lownominal[pix] *= (1-percent);
-      upnominal[pix]  *= (1+percent);
-    }
-  
-  
-  while(tlist.Process())
-    {
-      
-      hvnotnominal.CntCamContent(hvcam,lownominal,0,kFALSE);
-      hvnotnominal.CntCamContent(hvcam,upnominal,0,kTRUE);
-      
-      lowhvnotnominal.CntCamContent(hvcam,lownominal,0,kFALSE);
-      uphvnotnominal.CntCamContent(hvcam,upnominal,0,kTRUE);
-    }
-  
-
-  evtloop.PostProcess();
-  
-  tlist.PrintStatistics();
-  
-  TCanvas c1;
-  c1.Divide(2,1);
-  c1.cd(1);
-  lowhvnotnominal.SetPrettyPalette();
-  lowhvnotnominal.Draw();
-  gPad->cd(1);
-  gPad->Modified();
-  gPad->Update();
-  c1.cd(2);
-  uphvnotnominal.SetPrettyPalette();
-  uphvnotnominal.Draw();
-  gPad->cd(2);
-  gPad->Modified();
-  gPad->Update();
-
-  TCanvas c2;
-  hvnotnominal.SetPrettyPalette();
-  hvnotnominal.Draw();
-  gPad->cd(1);
-  gPad->Modified();
-  gPad->Update();
-
-  if (!HandleInput())
-    break;
-
-}
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/makeHillas.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/makeHillas.C	(revision 7136)
+++ 	(revision )
@@ -1,558 +1,0 @@
-/*********************************/
-/* Compute the hillas parameters */
-/*********************************/
-
-Bool_t readDatacards(TString& filename);
-
-// initial and final time slices to be used in signal extraction
-const Byte_t hifirst = 0;
-const Byte_t hilast  = 13;
-const Byte_t lofirst = 3;
-const Byte_t lolast  = 12;
-
-// declaration of variables read from datacards
-TString  outname;
-TString  idirname;
-MRunIter pedcaliter;
-MRunIter caliter;
-MRunIter pediter;
-MRunIter datiter;
-ULong_t  nmaxevents=999999999;
-Short_t  calflag=1;
-Float_t  lcore = 3.0;
-Float_t  ltail = 1.5;
-Int_t islflag = 0;
-Float_t  lnew  = 40;
-Int_t  kmethod = 1;
-Int_t    nfiles = 0;
-
-const TString defaultcard="input.datacard";
-
-//Slow control varialbles
-Short_t slowflag=0;
-Bool_t  isSlowControlAvailable = kFALSE;
-TString hvConfigFile="/mnt/users/jlopez/Mars/Files4Mars/Config/HVSettings_FF35q.conf";
-TString continuosLightFile="/local_disk/rootdata/Miscellaneous/Period016/2004_04_16/dc_2004_04_16_04_46_18_22368_Off3c279-2CL100.root";
-
-
-/*************************************************************/
-int makeHillas(TString datacard = defaultcard)
-{
-
-  if(!datacard.Length())
-    datacard = defaultcard;
-
-  if(!readDatacards(datacard))
-    {
-      cout << "Error reading datacards. Stoping" << endl;
-      return -1;
-    }
-
-  // Set the general tasks/containers
-  MExtractFixedWindow    extractor;
-  extractor.SetRange(hifirst,hilast,lofirst,lolast);
-
-  MCalibrationQECam   qecam;
-  MBadPixelsCam       badcam;
-  MGeomCamMagic       geomcam;
-  MGeomApply          geomapl;
-
-  cout << endl;
-  cout << "/****************************************************/" << endl;
-  cout << "/* FIRST LOOP: PEDESTAL FOR CALIBRATION COMPUTATION */" << endl;
-  cout << "/****************************************************/" << endl;
-  cout << endl;
-
-  // If you want to exclude pixels from the beginning, read 
-  // an ascii-file with the corr. pixel numbers (see MBadPixelsCam)  
-  ifstream fin("badpixels.dat");
-  badcam.AsciiRead(fin);
-  fin.close();
-
-  MJPedestal pedloop0;
-  pedloop0.SetOutputPath("./");
-  pedloop0.SetInput(&pedcaliter);
-  pedloop0.SetExtractor(&extractor);
-  pedloop0.SetBadPixels(badcam);
-
-  if (!pedloop0.Process())
-    return;
-
-  cout << endl;
-  cout << "/*****************************/" << endl;
-  cout << "/* SECOND LOOP: CALIBRATION  */" << endl;
-  cout << "/*****************************/" << endl;        
-  cout << endl;
-
-  MJCalibration calloop;
-
-  calloop.SetOutputPath("./");
-  calloop.SetExtractor(&extractor);
-  calloop.SetInput(&caliter);
-  calloop.SetQECam(qecam);
-  calloop.SetBadPixels(pedloop0.GetBadPixels());
-  if (!calloop.Process(pedloop0.GetPedestalCam()))
-    return;
-
-  cout << endl;
-  cout << "/*************************************************/" << endl;
-  cout << "/* THIRD LOOP: PEDESTAL CALIBRATION INTO PHOTONS */" << endl;
-  cout << "/*************************************************/" << endl;
-  cout << endl;
-
-  // First Compute the pedestals
-  MJPedestal pedloop;
-  pedloop.SetOutputPath("./");
-  pedloop.SetInput(&pediter);
-
-  if (!pedloop.Process())
-    return;
-
-  MPedestalCam pedcam = pedloop.GetPedestalCam();
-
-  // Now convert this pedestals in photons
-  MParList  plist3;
-  MTaskList tlist3;
-  plist3.AddToList(&tlist3);
-  
-  // containers
-  MCerPhotEvt         nphot;
-  MPedPhotCam         nphotrms;
-  MExtractedSignalCam sigcam;
-
-  plist3.AddToList(&geomcam);
-  plist3.AddToList(&pedcam);
-  plist3.AddToList(&calloop.GetCalibrationCam());
-  plist3.AddToList(&qecam);
-  plist3.AddToList(&badcam);
-  plist3.AddToList(&sigcam);
-  plist3.AddToList(&nphot);
-  plist3.AddToList(&nphotrms);
-
-  
-  MCalibrate::CalibrationMode_t calMode=MCalibrate::kDefault;  
-  if(calflag==0)
-    calMode=MCalibrate::kNone;
-  if(calflag==-1)
-    calMode=MCalibrate::kDummy;
-
-  //tasks
-  MReadMarsFile read3("Events");
-  static_cast<MRead&>(read3).AddFiles(pediter); 
-  read3.DisableAutoScheme();
- 
-//   MReadReports read3;
-//   read3.AddTree("Events","MTime.",kFALSE);
-//   static_cast<MRead&>(read3).AddFiles(pediter); 
-
-   //  MExtractSignal  extsig;
-  //  extsig.SetRange(hifirst,hilast,lofirst,lolast);
-  MCalibrate      photcalc(calMode);
-  MPedPhotCalc    photrmscalc; 
-  
-  tlist3.AddToList(&read3);
-  tlist3.AddToList(&geomapl);
-  tlist3.AddToList(&extractor);
-  tlist3.AddToList(&photcalc);
-  tlist3.AddToList(&photrmscalc);
-
-  // Create and setup the eventloop
-  MEvtLoop evtloop3;
-  evtloop3.SetParList(&plist3);
-  if (!evtloop3.Eventloop())
-    return;
-  
-  tlist3.PrintStatistics();
-
-  cout << "/**********************************************/" << endl;
-  cout << "/* FOURTH LOOP: DATA CALIBRATION INTO PHOTONS */" << endl;
-  cout << "/**********************************************/" << endl;
-
-  MParList  plist4;
-  MTaskList tlist4;
-  plist4.AddToList(&tlist4);
-  
-  // containers 
-  MHillas       hillas;
-  MSrcPosCam    source;
-  MRawRunHeader runhead;
-
-  MArrivalTimeCam   timecam;
-     
-  MIslands      isl;
-  isl.SetName("MIslands1");
-  
-  MIslands      isl2;
-  isl2.SetName("MIslands2");
-
-  MReportDrive  drive;
-  MStarLocalCam starcam;
-
-  if (islflag == 1 || islflag == 2)
-    {
-      plist4.AddToList(&timecam);
-      plist4.AddToList(&isl);
-    }
-  
-  if (islflag == 2)
-    {
-      plist4.AddToList(&isl2);
-    }
-
-  if (isSlowControlAvailable)
-    {
-      plist4.AddToList(&starcam);
-    }
-  
-  
-  plist4.AddToList(&geomcam);
-  plist4.AddToList(&pedcam);
-  plist4.AddToList(&calloop.GetCalibrationCam());
-  plist4.AddToList(&qecam);
-  plist4.AddToList(&badcam);
-  plist4.AddToList(&nphot);
-  plist4.AddToList(&nphotrms);
-  plist4.AddToList(&source);
-  plist4.AddToList(&hillas);
-  plist4.AddToList(&runhead);
-  
-  //tasks
-//   MReadMarsFile read4("Events");
-//   static_cast<MRead&>(read4).AddFiles(datiter); 
-//   read4.DisableAutoScheme();
-
-  MReadReports read4;
-  read4.AddTree("Events","MTime.",kTRUE);
-  read4.AddTree("Currents");
-  read4.AddTree("Camera");
-  read4.AddTree("Drive");
-  static_cast<MRead&>(read4).AddFiles(datiter); 
-  read4.AddToBranchList("MReportCurrents.*");
-
-  // Task that use Slow control information 
-  MFHVNotNominal fhvnotnominal;
-  fhvnotnominal.SetHVNominalValues(hvConfigFile);
-  fhvnotnominal.SetMaxNumPixelsDeviated(40);
- 
-  MContinue hvnotnominal(&fhvnotnominal);
-
-  MCalibrateDC dccalib;
-  dccalib.SetFileName(continuosLightFile);
-
-  const Int_t numblind = 5;
-  const Short_t w[numblind] = { 47, 124, 470, 475, 571};
-  const TArrayS blindpixels(numblind,(Short_t*)w);
-  Float_t ringinterest = 100; //[mm]
-  Float_t tailcut = 3.5;
-  UInt_t integratedevents = 4;
-
-  MFindStars findstars;
-  findstars.SetBlindPixels(blindpixels);
-  findstars.SetRingInterest(ringinterest);
-  findstars.SetDCTailCut(tailcut);
-  findstars.SetNumIntegratedEvents(integratedevents);
-  findstars.SetMinuitPrintOutLevel(-1);
-
-  MSrcPosFromStars srcposfromstar;
-    
-  MBadPixelsTreat   interpolatebadpixels;
-  interpolatebadpixels.SetUseInterpolation();
-  
-  MImgCleanStd      clean(lcore,ltail);
-
-  MArrivalTimeCalc2 timecalc;
-  
-  MIslandCalc       island;
-  island.SetOutputName("MIslands1");
-
-  MIslandClean      islclean(lnew);
-  islclean.SetInputName("MIslands1");
-  islclean.SetMethod(kmethod);
-      
-  MIslandCalc       island2;
-  island2.SetOutputName("MIslands2");  
-  
-  
-  MHillasCalc       hcalc;
-  MHillasSrcCalc    csrc1;
-  
-  MWriteRootFile write(outname,"RECREATE");
-  
-  write.AddContainer("MTime"          , "Parameters");
-  write.AddContainer("MHillas"        , "Parameters");
-  write.AddContainer("MHillasSrc"     , "Parameters");
-  write.AddContainer("MHillasExt"     , "Parameters");
-  write.AddContainer("MNewImagePar"   , "Parameters");
-  write.AddContainer("MRawEvtHeader"  , "Parameters");
-  write.AddContainer("MRawRunHeader"  , "Parameters");
-  write.AddContainer("MConcentration" , "Parameters");
-  write.AddContainer("MSrcPosCam"     , "Parameters");
-
-  if (islflag == 1 || islflag == 2)
-    write.AddContainer("MIslands1" , "Parameters");
-  if (islflag == 2) 
-    write.AddContainer("MIslands2" , "Parameters");
-  if (isSlowControlAvailable)
-    {
-      write.AddContainer("MStarLocalCam" , "Parameters");
-      write.AddContainer("MReportDrive" , "Parameters");
-    }
-  
-  tlist4.AddToList(&read4);
-  tlist4.AddToList(&geomapl);
-  if (isSlowControlAvailable)
-    {
-      tlist4.AddToList(&hvnotnominal,"Events");
-      tlist4.AddToList(&dccalib,"Currents");
-      tlist4.AddToList(&findstars,"Currents");
-      tlist4.AddToList(&srcposfromstar,"Events");
-    }
-                       
-  tlist4.AddToList(&extractor,"Events");
-  tlist4.AddToList(&photcalc,"Events");
-  if(calflag==11)
-    tlist4.AddToList(&interpolatebadpixels);
-  tlist4.AddToList(&clean,"Events");
-
-  if (islflag == 1 || islflag == 2)
-    {
-      tlist4.AddToList(&timecalc,"Events");
-      tlist4.AddToList(&island,"Events");
-    }
-
-  if (islflag == 2)
-    {
-      tlist4.AddToList(&islclean,"Events");
-      tlist4.AddToList(&island2,"Events");
-    }
-  
-  //tlist4.AddToList(&blind2,"Events");
-  tlist4.AddToList(&hcalc,"Events");
-  tlist4.AddToList(&csrc1,"Events");
-  tlist4.AddToList(&write,"Events");
-
-  // Create and setup the eventloop
-  MEvtLoop datloop;
-  datloop.SetParList(&plist4);
-
-  cout << endl;
-  cout << "******************************************************" << endl;
-  cout << "* COMPUTING DATA USING EXTRACTED SIGNAL (IN PHOTONS) *" << endl;
-  cout << "******************************************************" << endl;
-  cout << endl;
-
-  if (!datloop.Eventloop(nmaxevents))
-    return;
-
-  tlist4.PrintStatistics();    
-
-}
-//-------------------------------------------------------------------------------
-
-Bool_t readDatacards(TString& filename)
-{
-  ifstream ifun(filename.Data());
-  if(!ifun)
-    {
-      cout << "File " << filename << " not found" << endl;
-      return kFALSE;
-    }
-
-  TString word;
-  
-  while(ifun >> word)
-    {
-
-      // skip comments
-      if(word[0]=='/' && word[1]=='/')
-	{
-	  while(ifun.get()!='\n'); // skip line
-	  continue;
-	}
-
-      // number of events
-      if(strcmp(word.Data(),"NEVENTS")==0)
-	ifun >> nmaxevents;
-
-
-      // input file directory
-      if(strcmp(word.Data(),"IDIR")==0)
-	{
-	  if(idirname.Length())
-	    cout << "readDataCards Warning: overriding input directory file name" << endl;
-	  ifun >> idirname;
-	}
-
-       // pedestal runs for calibration
-      if(strcmp(word.Data(),"PCRUNS")==0)
-	{
-	  if(pedcaliter.GetNumRuns())
-	    cout << "readDataCards Warning: adding pedestal runs for calibration to the existing list" << endl;
-	  ifun >> word;
-	  pedcaliter.AddRuns(word.Data(),idirname.Data());
-	}
-
-      // calibration runs
-      if(strcmp(word.Data(),"CRUNS")==0)
-	{
-	  if(caliter.GetNumRuns())
-	    cout << "readDataCards Warning: adding calibration runs to the existing list" << endl;
-	  ifun >> word;
-	  caliter.AddRuns(word.Data(),idirname.Data());
-	}
-
-     // pedestal runs for data
-      if(strcmp(word.Data(),"PRUNS")==0)
-	{
-	  if(pediter.GetNumRuns())
-	    cout << "readDataCards Warning: adding pedestal runs for data to the existing list" << endl;
-	  ifun >> word;
-	  pediter.AddRuns(word.Data(),idirname.Data());
-	}
-
-      // data runs
-      if(strcmp(word.Data(),"DRUNS")==0)
-	{
-	  if(datiter.GetNumRuns())
-	    cout << "readDataCards Warning: adding data runs to the existing list" << endl;
-	  ifun >> word;
-	  datiter.AddRuns(word.Data(),idirname.Data());
-	}
-      
-      // output file name
-      if(strcmp(word.Data(),"OUTFILE")==0)
-	{
-	  if(outname.Length())
-	    cout << "readDataCards Warning: overriding output file name" << endl;
-	  ifun >> outname;
-	}
-
-      // calibration flag
-      if(strcmp(word.Data(),"CALFLAG")==0)
-	ifun >> calflag;
-
-      // cleaning level
-      if(strcmp(word.Data(),"CLEANLEVEL")==0)
-	{
-	  ifun >> lcore;
-	  ifun >> ltail;
-	}
-
-      if(strcmp(word.Data(),"ISLFLAG")==0)
-	{
-	  ifun >> islflag;
-	}
-
-      // island cleaning 
-      if (islflag == 2){
-	if(strcmp(word.Data(),"ISLANDCLEAN")==0)
-	  {
-	    ifun >> kmethod;
-	    ifun >> lnew;
-	  }
-      }
-
-      // slow control data available
-      if(strcmp(word.Data(),"SLOWCRT")==0)
-	{
-	  ifun >> slowflag;
-          if (slowflag == 1) isSlowControlAvailable = kTRUE;
-	}
-
-      // hv configuration file
-      if(strcmp(word.Data(),"HVCONFFILE")==0)
-	{
-	  ifun >> hvConfigFile;
-	}
-
-      // countinous light file to calibrate the dc data
-      if(strcmp(word.Data(),"CLFILE")==0)
-	{
-	  ifun >> continuosLightFile;
-	}
-    }
-
-  pedcaliter.Reset();
-  pediter.Reset();
-  caliter.Reset();
-  datiter.Reset();
-  TString pfile;
-
-  // Dump read values
-  cout << "************************************************" << endl;
-  cout << "* Datacards read from file " << filename << endl;
-  cout << "************************************************" << endl;
-  cout << "Pedestal file (s) for calibration: "  << endl;
-  while(kTRUE)
-  {
-      pfile=pedcaliter.Next();
-      if (pfile.IsNull())
-	  break;
-      cout << pfile << endl;
-  }
-  cout << "Calibration file (s): "  << endl;
-  while(kTRUE)
-  {
-      pfile=caliter.Next();
-      if (pfile.IsNull())
-	  break;
-      cout << pfile << endl;
-  }
-  cout << "Pedestal file (s) for data: "  << endl;
-  while(kTRUE)
-  {
-      pfile=pediter.Next();
-      if (pfile.IsNull())
-	  break;
-      cout << pfile << endl;
-  }
-  cout << "Data file (s): "  << endl;
-  while(kTRUE)
-  {
-      pfile=datiter.Next();
-      if (pfile.IsNull())
-	  break;
-      cout << pfile << endl;
-  }
-  cout << "Maximum number of events: " << nmaxevents << endl;
-  cout << "Output file name: " << outname << endl;
-  cout << "Calibration flag: " << calflag << endl;
-  cout << "Cleaning level: ("<<lcore<<","<<ltail<<")" << endl;
-  if (islflag == 1 || islflag == 2)
-    cout << "Island calcultation..." << endl;
-  if (islflag == 2)
-    {
-      cout << "Island Cleaning: "<< kmethod <<" method  "<< lnew << " new threshold" << endl;
-    }
-  cout << "***********" << endl << endl;
-  
-  if(!pediter.GetNumEntries())
-    {
-      cout << "No pedestal file name specified" << endl;
-      return kFALSE;
-    }
-  if(!caliter.GetNumEntries())
-    {
-      cout << "No calibration file name specified" << endl;
-      return kFALSE;
-    }
-  if(!datiter.GetNumEntries())
-    {
-      cout << "No data file name specified" << endl;
-      return kFALSE;
-    }
-  if(!outname.Length())
-    {
-      cout << "No output file name specified" << endl;
-      return kFALSE;
-    }
-
-  if (isSlowControlAvailable)
-    {
-      cout << "HV Configuratin file: " << hvConfigFile << endl;
-      cout << "Continous Light file: " << continuosLightFile << endl;
-    }
-  
-
-  return kTRUE;
-}
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/makeHillasMC.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/makeHillasMC.C	(revision 7136)
+++ 	(revision )
@@ -1,435 +1,0 @@
-/* ======================================================================== *\
-   !
-   ! *
-   ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-   ! * Software. It is distributed to you in the hope that it can be a useful
-   ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-   ! * It is distributed WITHOUT ANY WARRANTY.
-   ! *
-   ! * Permission to use, copy, modify and distribute this software and its
-   ! * documentation for any purpose is hereby granted without fee,
-   ! * provided that the above copyright notice appear in all copies and
-   ! * that both that copyright notice and this permission notice appear
-   ! * in supporting documentation. It is provided "as is" without express
-   ! * or implied warranty.
-   ! *
-   !
-   !
-   !   Author(s): Thomas Bretz      5/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
-   !              Abelardo Moralejo 1/2004 <mailto:moralejo@pd.infn.it>
-   !              Eva Domingo       1/2005 <mailto:domingo@ifae.es>
-   !             
-   !   Copyright: MAGIC Software Development, 2000-2004
-   !
-   !
-   \* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//
-//  STARMC - STandard Analysis and Reconstruction (MC example)
-//
-//  This macro is a version of the standard converter to convert raw data 
-//  into image parameters, made to show how to run analysis on MC files. 
-//
-//  (1/2005):: Spline extractor added and additional containers written out
-//
-/////////////////////////////////////////////////////////////////////////////
-
-#include "MImgCleanStd.h"
-
-void makeHillasMC()
-{
-  //
-  // This is a demonstration program which calculates the image 
-  // parameters from Magic Monte Carlo files (output of camera).
-
-
-  TString* CalibrationFilename;
-  TString* AnalysisFilename;
-  TString* OutFilename1;
-  TString* OutFilename2;
-
-  TString  rffilename;
-  TString  dispfilename;
-
-  // ------------- USER CHANGE -----------------
-  // Comment line starting "CalibrationFileName" to disable calibration. 
-  // In that case the units of the MHillas.fSize parameter will be ADC counts 
-  // (rather, equivalent ADC counts in inner pixels, since we correct for the 
-  // possible differences in gain of outer pixels)
-
-  // File to be used in the calibration (must be a camera file without added noise)
-  CalibrationFilename = new TString("/mnt/local_wdjrico/jrico/mc/Gammas/Gamma_zbin3_90_7_1290to1299_w0_nonoise.root");
-  // File to be analyzed
-  AnalysisFilename = new TString("/mnt/users/blanch/magic/TestSample/file*.root");
-
-  // Change output file names as desired. 
-  // If you want only one output (not dividing the events in Train and Test samples),
-  // comment the initialization of OutFilename2.
-  OutFilename1 = new TString("/mnt/users/blanch/Temp/Prova.root");
-  //  OutFilename2 = new TString("star_test.root");    // Output file name 2 (train)
-
-  // File to read RandomForest
-  rffilename="/mnt/users/blanch/magic/Mars-All/Mars_Standard06/mtemp/mifae/programs/RFstd.root";
-  // File to read Disp
-  dispfilename="/mnt/users/blanch/magic/Mars-All/Mars_Standard06/mtemp/mifae/programs/DISPstd.root";
-
-  // Fraction of events (taken at random) which one wants to process from the 
-  // file to be analyzed (useful to make smaller files if starting sample is too large).
-  Float_t accepted_fraction = 1.;
-
-
-  // ------------- USER CHANGE -----------------
-  // Cleaning levels
-  Float_t CleanLev[2] = {4.0, 3.5}; // Tail cuts for image analysis
-
-  // Signal extractor
-  // (default=Spline, other extraction methods can be used)
-  const Int_t wsize=2;
-  MExtractor* sigextract = new MExtractTimeAndChargeSpline();
-  ((MExtractTimeAndChargeSpline*)sigextract)->SetTimeType(MExtractTimeAndChargeSpline::kHalfMaximum);
-  ((MExtractTimeAndChargeSpline*)sigextract)->SetChargeType(MExtractTimeAndChargeSpline::kIntegral);      
-  ((MExtractTimeAndChargeSpline*)sigextract)->SetRiseTime((Float_t)wsize*0.25); 
-  ((MExtractTimeAndChargeSpline*)sigextract)->SetFallTime((Float_t)wsize*0.75);  
-  // Define FADC slices to be integrated in high and low gain:
-  sigextract->SetRange(1, 11, 2, 12);
-  // Defines when to switch to low gain
-  sigextract->SetSaturationLimit(240);
-
-
-  // -------------------------------------------
-  //
-  // Create a empty Parameter List and an empty Task List
-  // The tasklist is identified in the eventloop by its name
-  //
-  MParList  plist;
-  MTaskList tlist;
-  plist.AddToList(&tlist);
-
-  //  MGeomCamMagic geomcam;
-
-  //  MSrcPosCam src;
-  // WOBBLE MODE!!
-  //  src.SetX(120.);  // units: mm
-  //  src.SetXY(0.,0.4/geomcam.GetConvMm2Deg());
-  //  src.SetXY(0.,0.); 
-  //  src.SetReadyToSave();
-
-  MBadPixelsCam badpix;
-
-  //  plist.AddToList(&geomcam);
-  //  plist.AddToList(&src);
-  plist.AddToList(&badpix);
-
-  MCerPhotEvt     nphot;
-  // Stores number of phe
-  plist.AddToList(&nphot);
-  
-  // Now setup the tasks and tasklist:
-  // ---------------------------------
-  //
-  MReadMarsFile read("Events");
-  if (CalibrationFilename)
-    read.AddFile(CalibrationFilename->Data());
-  read.DisableAutoScheme();
-
-  MGeomApply geom; 
-  // Reads in geometry from MC file and sets the right sizes for
-  // several parameter containers.
-
-  MMcPedestalCopy   pcopy; 
-  // Copies pedestal data from the MC file run fadc header to the MPedestalCam container.
-
-  MPointingPosCalc pointcalc;
-  // Creates MPointingPos object and fill it with the telescope orientation
-  // information taken from MMcEvt.
-
-  MMcCalibrationUpdate  mccalibupdate;
-
-  MCalibrateData calib; 
-  // Transforms signals from ADC counts into photons. In the first
-  // loop it applies a "dummy" calibration supplied by MMcCalibrationUpdate, just 
-  // to equalize inner and outer pixels. At the end of the first loop, in the
-  // PostProcess of MMcCalibrationCalc (see below) the true calibration constants
-  // are calculated.
-  calib.SetCalibrationMode(MCalibrateData::kFfactor);
-
-  //    MBlindPixelCalc   blind;
-  //    blind.SetUseInterpolation();
-
-  MMcCalibrationCalc mccalibcalc; 
-  // Calculates calibration constants to convert from ADC counts to photons.
-
-  MAddGainFluctuation gainfluc;
-  //gainfluc.FillHist(1,0.5);
-  gainfluc.FillHist(0,0.1); // defaul line to not add fluctuations
-  // Adds Gain fluctuations
-
-  MImgCleanStd  clean(CleanLev[0], CleanLev[1]); 
-  // Applies tail cuts to image. Since the calibration is performed on 
-  // noiseless camera files, the precise values of the cleaning levels 
-  // are unimportant for the calibration file processing (in any case, 
-  // only pixels without any C-photon will be rejected).
-  clean.SetCleanRings(1);
-  //  clean.SetRemoveSingle(kFALSE);
-  //  clean.SetMethod(MImgCleanStd::kDemocratic);
-
-  MHillasCalc   hcalc; 
-  // Calculates Hillas parameters.
-
-  tlist.AddToList(&read);
-  tlist.AddToList(&geom);
-  tlist.AddToList(&pcopy);
-  tlist.AddToList(&pointcalc);
-  tlist.AddToList(sigextract);
-  tlist.AddToList(&mccalibupdate);
-  tlist.AddToList(&calib);
-  tlist.AddToList(&clean);
-  //  tlist.AddToList(&blind);
-  tlist.AddToList(&hcalc);
-  tlist.AddToList(&mccalibcalc);
-
-
-  //
-  // Open output files:
-  //
-
-  MWriteRootFile write1(OutFilename1->Data()); // Writes output1
-  write1.AddContainer("MRawRunHeader",       "RunHeaders");
-  write1.AddContainer("MMcRunHeader",        "RunHeaders");
-  write1.AddContainer("MSrcPosCam",          "RunHeaders");
-  write1.AddContainer("MGeomCam",            "RunHeaders");
-  write1.AddContainer("MMcConfigRunHeader",  "RunHeaders");
-  write1.AddContainer("MMcCorsikaRunHeader", "RunHeaders");
-  write1.AddContainer("MMcFadcHeader",       "RunHeaders");
-  write1.AddContainer("MMcTrigHeader",       "RunHeaders");
-  write1.AddContainer("MGainFluctuationCam", "RunHeaders");
-
-  write1.AddContainer("MRawEvtHeader",   "Events");
-  write1.AddContainer("MMcEvt",          "Events");
-  write1.AddContainer("MHillas",         "Events");
-  write1.AddContainer("MHillasExt",      "Events");
-  write1.AddContainer("MHillasSrc",      "Events");
-  write1.AddContainer("MImagePar",       "Events");
-  write1.AddContainer("MNewImagePar",    "Events");
-  write1.AddContainer("MConcentration",  "Events");
-  write1.AddContainer("MIslands",        "Events");
-  write1.AddContainer("MTopology",       "Events");
-  write1.AddContainer("MPointingPos",    "Events");
-  write1.AddContainer("MHadronness",     "Events");
-  write1.AddContainer("MImageParDisp"  , "Events");
-  //write1.AddContainer("MArrivalTimeCam", "Events");
-  //write1.AddContainer("MCerPhotEvt",     "Events");
-
-  if (OutFilename2)
-    {
-      MWriteRootFile write2(OutFilename2->Data()); // Writes output2
-      write2.AddContainer("MRawRunHeader",       "RunHeaders");
-      write2.AddContainer("MMcRunHeader",        "RunHeaders");
-      write2.AddContainer("MSrcPosCam",          "RunHeaders");
-      write2.AddContainer("MGeomCam",            "RunHeaders");
-      write2.AddContainer("MMcConfigRunHeader",  "RunHeaders");
-      write2.AddContainer("MMcCorsikaRunHeader", "RunHeaders");
-      write2.AddContainer("MMcFadcHeader",       "RunHeaders");
-      write2.AddContainer("MMcTrigHeader",       "RunHeaders");
-      write2.AddContainer("MGainFluctuationCam", "RunHeaders");
-
-      write2.AddContainer("MRawEvtHeader",   "Events");
-      write2.AddContainer("MMcEvt",          "Events");
-      write2.AddContainer("MHillas",         "Events");
-      write2.AddContainer("MHillasExt",      "Events");
-      write2.AddContainer("MHillasSrc",      "Events");
-      write2.AddContainer("MImagePar",       "Events");
-      write2.AddContainer("MNewImagePar",    "Events");
-      write2.AddContainer("MConcentration",  "Events");
-      write2.AddContainer("MIslands",        "Events");
-      write2.AddContainer("MTopology",       "Events");
-      write2.AddContainer("MPointingPos",    "Events");
-      write2.AddContainer("MHadronness",     "Events");
-      write2.AddContainer("MImageParDisp"  , "Events");
-      //write2.AddContainer("MArrivalTimeCam", "Events");
-      //write2.AddContainer("MCerPhotEvt",     "Events");
-
-
-      // Divide output in train and test samples, using the event number
-      // (odd/even) to achieve otherwise unbiased event samples:
-      MF filter1("{MMcEvt.fEvtNumber%2}>0.5");
-      MF filter2("{MMcEvt.fEvtNumber%2}<0.5");
-
-      write1.SetFilter(&filter1);
-      write2.SetFilter(&filter2);
-    }
-
-
-  //
-  // FIRST LOOP: Calibration loop (with no noise file)
-  //
-  MProgressBar bar;
-  bar.SetWindowName("Calibrating...");
-
-  MEvtLoop evtloop;
-  evtloop.SetProgressBar(&bar);
-  evtloop.SetParList(&plist);
-
-  if (CalibrationFilename)
-    {
-      if (!evtloop.Eventloop())
-	return;
-      mccalibcalc.GetHistADC2PhotEl()->Write();
-      mccalibcalc.GetHistPhot2PhotEl()->Write();
-      // Writes out the histograms used for calibration.
-    }
-
-  //
-  // SECOND LOOP: TO READ THE RANDOM FOREST FILE(S) 
-  //
-
-  MParList   plistrf;
-  MTaskList  tlistrf;
-  MRanForest ranforest;
-  MRanTree   rantree;
-
-  if(rffilename.Length())
-    {
-      plistrf.AddToList(&tlistrf);
-      plistrf.AddToList(&ranforest);
-      plistrf.AddToList(&rantree);
-
-      MReadTree readrf("Tree",rffilename);
-      readrf.DisableAutoScheme();
-      
-      MRanForestFill rffill;
-      rffill.SetNumTrees(100);
-      
-      tlistrf.AddToList(&readrf);
-      tlistrf.AddToList(&rffill);
-      
-      MEvtLoop evtlooprf;
-      evtlooprf.SetParList(&plistrf);
-      if (!evtlooprf.Eventloop())
-	return;
-      
-      tlistrf.PrintStatistics();
-    }
-  
-
-  //
-  // THIRD LOOP: Analysis loop (process file with noise)
-  //
-  bar.SetWindowName("Analyzing...");
-
-  MIslands         isl;
-  MArrivalTimeCam  timecam;      
-  MTopology        topology;
-  plist.AddToList(&isl);
-  plist.AddToList(&timecam);
-  plist.AddToList(&topology);
-  plist.AddToList(&rantree);
-  plist.AddToList(&ranforest);
- 
-  MArrivalTimeCalc2  timecalc;
-  // Calculates the arrival time as the mean time of the fWindowSize 
-  // time slices which have the highest integral content.
-  //  MArrivalTimeCalc timecalc;            
-  // Calculates the arrival times of photons. Returns the absolute 
-  // maximum of the spline that interpolates the FADC slices.
-
-  MIslandsCalc       islcalc;
-  islcalc.SetOutputName("MIslands");
-  islcalc.SetAlgorithm(1);
-  //  MIslandsClean      islclean(40);
-  //  islclean.SetInputName("MIslands");
-  //  islclean.SetMethod(1);
-
-  MTopologyCalc      topcalc;
-
-  // Change the read task by another one which reads the file we want to analyze:
-  MReadMarsFile read2("Events","/mnt/users/blanch/magic/TestSample/file*.root");
-  //  MReadMarsFile read2("Events","/mnt/users/blanch/magic/TestSample/file53.root");
-  //  read2.AddFile(AnalysisFilename->Data());
-  read2.DisableAutoScheme();
-  tlist.AddToListBefore(&read2, &read);
-  tlist.RemoveFromList(&read);
-
-
-  // Add new tasks (Islands and Topology calculations)
-  tlist.AddToListBefore(&timecalc,&mccalibupdate);
-  tlist.AddToListBefore(&islcalc,&hcalc);
-  //  tlist.AddToListBefore(&islclean,&hcalc);
-  tlist.AddToListBefore(&topcalc,&hcalc);
-
-  // Add Task to Add Gain Fluctuations
-  tlist.AddToListBefore(&gainfluc, &hcalc);
-
-  MGeomCamMagic geomcam;// = new MGeomCam();
-  plist.AddToList(&geomcam);
-
-
-  MHillasDisplay*  disphillas=NULL;
-  disphillas = new MHillasDisplay(&nphot,&geomcam);
-
-  // Analyze only the desired fraction of events, skip the rest:
-  MFEventSelector eventselector;
-  Float_t rejected_fraction = 1. - accepted_fraction; 
-  eventselector.SetSelectionRatio(rejected_fraction);
-  MContinue skip(&eventselector);
-  tlist.AddToListBefore(&skip, sigextract);
-
-  // Remove calibration task from list.
-  tlist.RemoveFromList(&mccalibcalc); 
-
-  // disp
-  // (read in optimum Disp parameter values)  
-  MDispParameters dispin;
-  TArrayD dispPar;
-  if(dispfilename.Length())
-    {
-      TFile inparam(dispfilename);
-      dispin.Read("MDispParameters");
-      cout << "Optimum parameter values taken for calculating Disp : " << endl;
-
-      dispPar =  dispin.GetParameters();
-      for (Int_t i=0; i<dispPar.GetSize(); i++)
-	cout << dispPar[i] << ",  ";
-      cout << endl;
-      
-      inparam.Close();
-    }
-  // Disp results container
-  MImageParDisp imagepardisp;
-  // Disp histograms
-  MHDisp hdisp;
-  hdisp.SetName("MHDispAsym");
-  hdisp.SetSelectedPos(4);
-  MFillH filldisp("MHDispAsym[MHDisp]", "");
-  
-  // Add RandomForest and Disp task computation
-  MRanForestCalc hadrcalc;
-  MDispCalc         dispcalc;  
-
-  tlist.AddToList(&dispcalc);
-  tlist.AddToList(&filldisp);
-  if(rffilename.Length())
-    tlist.AddToList(&hadrcalc);
- 
-  // Add tasks to write output:
-  if (OutFilename2)
-    {
-      tlist.AddToList(&filter1);
-      tlist.AddToList(&filter2);
-      tlist.AddToList(&write2); 
-    }
-  tlist.AddToList(&write1); 
-
-  // Add display image with hillas
-  disphillas->SetPSFile();
-  disphillas->SetPSFileName("provaGF.ps");
-  disphillas->SetPause(kFALSE);	
-  //tlist.AddToList(disphillas);
-  
-
-  if (!evtloop.Eventloop())
-    return;
-
-  tlist.PrintStatistics();
-}
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/mergeClean.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/mergeClean.C	(revision 7136)
+++ 	(revision )
@@ -1,411 +1,0 @@
-/* ======================================================================== *\
-!   Take different MC input files and combine them into single one
-!   Author(s): Oscar Blanch & Javier Rico
-\* ======================================================================== */
-
-void mergeClean()
-{
-  const TString fileout = "/local_disk/jrico/mc/prueba.root";
-
-  const Int_t nfiles = 11;
-  const Int_t nlevels= 5;
-
-  const Char_t* levelname[nlevels]={"noclean","3015","4025","5035","6045"};
-
-  // input files -- no noise
-  const Char_t* NonoiseOutFilename[nfiles] = 
-    {"/local_disk/jrico/mc/Gamma_zbin0_0_7_1000to1009_w0_cleaned_nonoise.root",
-     "/local_disk/jrico/mc/Gamma_zbin0_0_7_1130to1139_w0_cleaned_nonoise.root",
-     "/local_disk/jrico/mc/Gamma_zbin0_90_7_1260to1269_w0_cleaned_nonoise.root",
-     "/local_disk/jrico/mc/Gamma_zbin1_0_7_1010to1019_w0_cleaned_nonoise.root",
-     "/local_disk/jrico/mc/Gamma_zbin1_0_7_1140to1149_w0_cleaned_nonoise.root",
-     "/local_disk/jrico/mc/Gamma_zbin1_90_7_1270to1279_w0_cleaned_nonoise.root",
-     "/local_disk/jrico/mc/Gamma_zbin2_0_7_1020to1029_w0_cleaned_nonoise.root",
-     "/local_disk/jrico/mc/Gamma_zbin2_0_7_1150to1159_w0_cleaned_nonoise.root",
-     "/local_disk/jrico/mc/Gamma_zbin3_0_7_1030to1039_w0_cleaned_nonoise.root",
-     "/local_disk/jrico/mc/Gamma_zbin3_0_7_1160to1169_w0_cleaned_nonoise.root",
-     "/local_disk/jrico/mc/Gamma_zbin3_90_7_1290to1299_w0_cleaned_nonoise.root"
-    };
-
-  // input files -- different cleaning levels
-  const Char_t* NoiseOutFilename[nlevels][nfiles]   = 
-    {{"/local_disk/jrico/mc/Gamma_zbin0_0_7_1000to1009_w0_cleaned_noclean.root",   
-      "/local_disk/jrico/mc/Gamma_zbin0_0_7_1130to1139_w0_cleaned_noclean.root",   
-      "/local_disk/jrico/mc/Gamma_zbin0_90_7_1260to1269_w0_cleaned_noclean.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_0_7_1010to1019_w0_cleaned_noclean.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_0_7_1140to1149_w0_cleaned_noclean.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_90_7_1270to1279_w0_cleaned_noclean.root",
-      "/local_disk/jrico/mc/Gamma_zbin2_0_7_1020to1029_w0_cleaned_noclean.root",
-      "/local_disk/jrico/mc/Gamma_zbin2_0_7_1150to1159_w0_cleaned_noclean.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_0_7_1030to1039_w0_cleaned_noclean.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_0_7_1160to1169_w0_cleaned_noclean.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_90_7_1290to1299_w0_cleaned_noclean.root"},
-     {"/local_disk/jrico/mc/Gamma_zbin0_0_7_1000to1009_w0_cleaned_3015.root",   
-      "/local_disk/jrico/mc/Gamma_zbin0_0_7_1130to1139_w0_cleaned_3015.root",   
-      "/local_disk/jrico/mc/Gamma_zbin0_90_7_1260to1269_w0_cleaned_3015.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_0_7_1010to1019_w0_cleaned_3015.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_0_7_1140to1149_w0_cleaned_3015.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_90_7_1270to1279_w0_cleaned_3015.root",
-      "/local_disk/jrico/mc/Gamma_zbin2_0_7_1020to1029_w0_cleaned_3015.root",
-      "/local_disk/jrico/mc/Gamma_zbin2_0_7_1150to1159_w0_cleaned_3015.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_0_7_1030to1039_w0_cleaned_3015.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_0_7_1160to1169_w0_cleaned_3015.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_90_7_1290to1299_w0_cleaned_3015.root"},
-     {"/local_disk/jrico/mc/Gamma_zbin0_0_7_1000to1009_w0_cleaned_4025.root",   
-      "/local_disk/jrico/mc/Gamma_zbin0_0_7_1130to1139_w0_cleaned_4025.root",   
-      "/local_disk/jrico/mc/Gamma_zbin0_90_7_1260to1269_w0_cleaned_4025.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_0_7_1010to1019_w0_cleaned_4025.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_0_7_1140to1149_w0_cleaned_4025.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_90_7_1270to1279_w0_cleaned_4025.root",
-      "/local_disk/jrico/mc/Gamma_zbin2_0_7_1020to1029_w0_cleaned_4025.root",
-      "/local_disk/jrico/mc/Gamma_zbin2_0_7_1150to1159_w0_cleaned_4025.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_0_7_1030to1039_w0_cleaned_4025.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_0_7_1160to1169_w0_cleaned_4025.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_90_7_1290to1299_w0_cleaned_4025.root"},   
-     {"/local_disk/jrico/mc/Gamma_zbin0_0_7_1000to1009_w0_cleaned_5035.root",   
-      "/local_disk/jrico/mc/Gamma_zbin0_0_7_1130to1139_w0_cleaned_5035.root",   
-      "/local_disk/jrico/mc/Gamma_zbin0_90_7_1260to1269_w0_cleaned_5035.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_0_7_1010to1019_w0_cleaned_5035.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_0_7_1140to1149_w0_cleaned_5035.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_90_7_1270to1279_w0_cleaned_5035.root",
-      "/local_disk/jrico/mc/Gamma_zbin2_0_7_1020to1029_w0_cleaned_5035.root",
-      "/local_disk/jrico/mc/Gamma_zbin2_0_7_1150to1159_w0_cleaned_5035.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_0_7_1030to1039_w0_cleaned_5035.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_0_7_1160to1169_w0_cleaned_5035.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_90_7_1290to1299_w0_cleaned_5035.root"},
-     {"/local_disk/jrico/mc/Gamma_zbin0_0_7_1000to1009_w0_cleaned_6045.root",   
-      "/local_disk/jrico/mc/Gamma_zbin0_0_7_1130to1139_w0_cleaned_6045.root",   
-      "/local_disk/jrico/mc/Gamma_zbin0_90_7_1260to1269_w0_cleaned_6045.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_0_7_1010to1019_w0_cleaned_6045.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_0_7_1140to1149_w0_cleaned_6045.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_90_7_1270to1279_w0_cleaned_6045.root",
-      "/local_disk/jrico/mc/Gamma_zbin2_0_7_1020to1029_w0_cleaned_6045.root",
-      "/local_disk/jrico/mc/Gamma_zbin2_0_7_1150to1159_w0_cleaned_6045.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_0_7_1030to1039_w0_cleaned_6045.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_0_7_1160to1169_w0_cleaned_6045.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_90_7_1290to1299_w0_cleaned_6045.root"}
-    };   
-
-
-  // Getting input braches 
-  TChain* tno  = new TChain("Events");
-  TChain* tyes[nlevels];
-  for(Int_t i=0;i<nlevels;i++)
-    tyes[i] = new TChain("Events");
-
-  for(Int_t i=0;i<nfiles;i++)
-    {
-      tno->Add(NonoiseOutFilename[i]);
-      for(Int_t j=0;j<nlevels;j++)
-	tyes[j]->Add(NoiseOutFilename[j][i]);
-    }
-
-  // input braches for no noise file
-  MCerPhotEvt*   nphotNo;
-  MHillas*       hillasNo;
-  MHillasSrc*    hillassrcNo;
-  MMcEvt*        mcevtNo;
-  MRawEvtHeader* evtheaderNo;
-  MRawRunHeader* runheaderNo;
-
-  tno->SetBranchAddress("MCerPhotEvt.",&nphotNo);
-  tno->SetBranchAddress("MHillas.",&hillasNo);
-  tno->SetBranchAddress("MHillasSrc.",&hillassrcNo);
-  tno->SetBranchAddress("MMcEvt.",&mcevtNo);
-  tno->SetBranchAddress("MRawEvtHeader.",&evtheaderNo);
-  tno->SetBranchAddress("MRawRunHeader.",&runheaderNo);
-
-  
-  // input branches for noise files
-  MCerPhotEvt*   nphotYes[nlevels];
-  MHillas*       hillasYes[nlevels];
-  MHillasSrc*    hillassrcYes[nlevels];
-  MMcEvt*        mcevtYes[nlevels];
-  MRawEvtHeader* evtheaderYes[nlevels];
-  MRawRunHeader* runheaderYes[nlevels];
-
-  for(Int_t i=0;i<nlevels;i++)
-    {      
-      tyes[i]->SetBranchAddress("MCerPhotEvt.",&nphotYes[i]);
-      tyes[i]->SetBranchAddress("MHillas.",&hillasYes[i]);
-      tyes[i]->SetBranchAddress("MHillasSrc.",&hillassrcYes[i]);
-      tyes[i]->SetBranchAddress("MMcEvt.",&mcevtYes[i]);
-      tyes[i]->SetBranchAddress("MRawEvtHeader.",&evtheaderYes[i]);
-      tyes[i]->SetBranchAddress("MRawRunHeader.",&runheaderYes[i]);
-    }
-
-  // Setting ouput branches
-  TFile* fout = new TFile(fileout,"RECREATE");
-  TTree* to   = new TTree("Events","Events");   
-
-  // common containers
-  TBranch* bmcevt        = to->Branch("MMcEvt.",       "MMcEvt",       &mcevtNo);
-  TBranch* brawevtheader = to->Branch("MRawEvtHeader.","MRawEvtHeader",&evtheaderNo);
-  TBranch* brawrunheader = to->Branch("MRawRunHeader.","MRawRunHeader",&runheaderNo);
-
-  // noise/cleaning dependent containers
-  to->Branch("MCerPhotEvt0.",  "MCerPhotEvt",  &nphotNo);
-  to->Branch("MHillas0.",      "MHillas",      &hillasNo);
-  to->Branch("MHillasSrc0.",   "MHillasSrc",   &hillassrcNo);
-
-  //  cout << "llego1" << endl;
-  for(Int_t i=0;i<nlevels;i++)
-    {
-      //      cout << "i: " << i << endl;
-      
-      char mcerphot[100];
-      char mhillas[100];
-      char mhillassrc[100];
-
-
-      sprintf(mcerphot,  "MCerPhotEvt%s.",levelname[i]);
-      sprintf(mhillas,   "MHillas%s."    ,levelname[i]);
-      sprintf(mhillassrc,"MHillasSrc%s." ,levelname[i]);
-
-      to->Branch(mcerphot,  "MCerPhotEvt",  &nphotYes[i]);
-      to->Branch(mhillas,   "MHillas",      &hillasYes[i]);
-      to->Branch(mhillassrc,"MHillasSrc",   &hillassrcYes[i]);      
-    }
-  //  cout << "llego2" << endl;
-  
-      
-  Int_t nentries1 = (Int_t)tno->GetEntries();
-  cout << "Entries: No noise file: " << nentries1 << endl;
-  Int_t nentries2[nlevels];
-  Int_t latestk[nlevels];
-  Int_t latestevt[nlevels];
-  Int_t nfound[nlevels];
-  for(Int_t i=0;i<nlevels;i++)
-    {
-      nfound[i]=0;
-      latestk[i]=0;
-      latestevt[i]=99999999;
-      nentries2[i] = (Int_t)tyes[i]->GetEntries();
-      cout << "Entries: cleaning level [" << levelname[i] << "] :" << nentries2[i] << endl;
-    }
-
-  // loop over all events in no-noise file and look for them in the other files
-  for(Int_t i=0;i<nentries1;i++)
-    //  for(Int_t i=0;i<100;i++)
-    {      
-      tno->GetEntry(i);
-      Int_t runno = runheaderNo->GetRunNumber();
-      Int_t evtno = evtheaderNo->GetDAQEvtNumber();
-
-      cout << "Checking run " << runno<< ", event " << evtno << endl;
-
-      //check if the no-noise event is present in all of the other files
-      for(Int_t j=0;j<nlevels;j++)
-	{
-	  Int_t runyes;
-	  Int_t evtyes;
-	  cout << "Level " << levelname[j] << endl;
-	  Int_t k=latestk[j];	  
-	  while(k<nentries2[j])
-	    {
-	      //	      cout << k << endl;
-	      tyes[j]->GetEntry(k++);
-	      runyes = runheaderYes[j]->GetRunNumber();
-	      evtyes = evtheaderYes[j]->GetDAQEvtNumber();
-	      if(runyes==runno && evtyes==evtno)
-		break;
-	      // next condition speeds up selection when events are grouped by runs and
-	      // in event increasing order
-	      if(runyes==runno && latestevt[j]<evtno && evtno<evtyes)
-		break;
-	      // next condition speeds up selection when events are grouped by runs
-	      // and in run increasing order
-	      //	      if(runyes>runno)
-	      //		break;
-	    }
-
-	  if(k>=nentries2[j])
-	    {
-	      k=0;
-	      while(k<latestk[j])
-		{
-		  //		  cout << k << endl;
-		  tyes[j]->GetEntry(k++);
-		  runyes = runheaderYes[j]->GetRunNumber();
-		  evtyes = evtheaderYes[j]->GetDAQEvtNumber();
-		  if(runyes==runno && evtyes==evtno)
-		    break;
-		  // next condition speeds up selection when events are grouped by runs and
-		  // in event increasing order
-		  if(runyes==runno && latestevt[j]<evtno && evtno<evtyes)
-		    break;
-		  // next condition speeds up selection when events are grouped by runs
-		  // and in run increasing order
-		  //		  if(runyes>runno)
-		  //		    break;
-		}
-	    }
-	  
-	  // the event has not been found, assign dummy containers
-	  if(runyes=!runno || evtyes!=evtno)
-	    {
-	      cout << "Not Found!" << endl;	      
-	      for(Int_t l=j;l<nlevels;l++)
-		{
-		  nphotYes[l]->Reset();
-		  hillasYes[l]->Reset();
-		  hillassrcYes[l]->Reset();		  
-		}
-	      break;
-	    }
-	  else
-	    {
-	      cout << "Found!" << endl;
-	      latestevt[j] = evtyes;
-	      latestk[j]=k;	  
-	      nfound[j]++;
-	    }
-	}
-      to->Fill();
-    }
-
-  // loop over all events in first noise file and look for them in the no-noise file in order to save also purely noisy events  
-  cout << "***************************************" << endl;
-  cout << "*** Looking for purely noisy events ***" << endl;
-  cout << "***************************************" << endl;
-  Int_t nfound2[nlevels];
-  for(Int_t i=0;i<nlevels;i++)
-    {
-      nfound2[i]=0;
-      latestk[i]=0;
-      latestevt[i]=99999999;
-    }
-  
-  // readdress the common container addresses
-  bmcevt->SetAddress(&mcevtYes[0]);
-  brawevtheader->SetAddress(&evtheaderYes[0]);
-  brawrunheader->SetAddress(&runheaderYes[0]);
-
-  for(Int_t i=0;i<nentries2[0];i++)
-  //  for(Int_t i=0;i<100;i++)
-    {      
-      tyes[0]->GetEntry(i);
-      Int_t run = runheaderYes[0]->GetRunNumber();
-      Int_t evt = evtheaderYes[0]->GetDAQEvtNumber();
-      Int_t runno;
-      Int_t evtno;
-
-      cout << "Checking run " << run << ", event " << evt << endl;
-
-      //check if the event is present in the no-noise file
-      Int_t kk=latestk[0];	  
-      while(kk<nentries1)
-	{
-	  //	  cout << kk << endl;
-	  tno->GetEntry(kk++);
-	  runno = runheaderNo->GetRunNumber();
-	  evtno = evtheaderNo->GetDAQEvtNumber();
-	  if(run==runno && evt==evtno)
-	    break;
-	  if(run==runno && latestevt[0]<evt && evt<evtno)
-	    break;
-	  //	  if(runno>run)
-	  //	    break;
-	}
-
-      if(kk>=nentries1)
-	{
-	  kk=0;
-	  while(kk<latestk[0])
-	    {
-	      //		  cout << kk << endl;
-	      tno->GetEntry(kk++);
-	      runno = runheaderNo->GetRunNumber();
-	      evtno = evtheaderNo->GetDAQEvtNumber();
-	      if(run==runno && evt==evtno)
-		break;
-	      if(run==runno && latestevt[0]<evt && evt<evtno)
-		break;
-	      //	      if(runno>run)
-	      //		break;
-	    }
-	}
-
-      // the event is already included because it is also a no-noise event, dismiss it
-      if(run==runno && evt==evtno)
-	{
-	  cout << "Found already in the no-noise sample, continuing... " << endl;
-	  latestevt[0] = evtno;
-	  latestk[0]=kk;	  
-	  continue;
-	}
-
-      nfound2[0]++;
-      nphotNo->Reset();
-      hillasNo->Reset();
-      hillassrcNo->Reset();
-
-      // look for the event in the rest of the noisy samples
-      for(Int_t j=1;j<nlevels;j++)
-	{
-	  Int_t runyes;
-	  Int_t evtyes;
-	  cout << "Level " << levelname[j] << endl;
-	  Int_t k=latestk[j];	  
-	  while(k<nentries2[j])
-	    {
-	      //	      cout << k << endl;
-	      tyes[j]->GetEntry(k++);
-	      runyes = runheaderYes[j]->GetRunNumber();
-	      evtyes = evtheaderYes[j]->GetDAQEvtNumber();
-	      if(runyes==run && evtyes==evt)
-		break;
-	      if(runyes==run && latestevt[j]<evt && evt<evtyes)
-		break;
-	      //	      if(runyes>run)
-	      //		break;
-	    }
-
-	  if(k>=nentries2[j])
-	    {
-	      k=0;
-	      while(k<latestk[j])
-		{
-		  //		  cout << k << endl;
-		  tyes[j]->GetEntry(k++);
-		  runyes = runheaderYes[j]->GetRunNumber();
-		  evtyes = evtheaderYes[j]->GetDAQEvtNumber();
-		  if(runyes==run && evtyes==evt)
-		    break;
-		  if(runyes==run && latestevt[j]<evt && evt<evtyes)
-		    break;
-		  //		  if(runyes>run)
-		  //		    break;
-		}
-	    }
-	  
-	  // the event has not been found, assign dummy containers
-	  if(runyes=!run || evtyes!=evt)
-	    {
-	      cout << "Not Found!" << endl;	      
-	      for(Int_t l=j;l<nlevels;l++)
-		{
-		  nphotYes[l]->Reset();
-		  hillasYes[l]->Reset();
-		  hillassrcYes[l]->Reset();		  
-		}
-	      break;
-	    }
-	  else
-	    {
-	      cout << "Found!" << endl;
-	      latestevt[j] = evtyes;
-	      latestk[j]=k;	  
-	      nfound2[j]++;
-	    }
-	}
-      to->Fill();    
-    }
-
-  fout->Write();
-  fout->Close();
-
-  for(Int_t i=0;i<nlevels;i++)
-    cout << "Found " << nfound[i] << "+" << nfound2[i] << " for cleaning level " << levelname[i] << endl;
-
-}
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/mmcCleaning.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/mmcCleaning.C	(revision 7136)
+++ 	(revision )
@@ -1,197 +1,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//
-//  mmcCleaning - calibrate/clean mc events
-//
-/////////////////////////////////////////////////////////////////////////////
-
-
-void mmcCleaning(TString NoiseFilename, TString NoiseOutFilename)
-{
-  //
-  // This is a demonstration program which reads in MC camera files
-  // and produces and output with calibrated events (signal in photons
-  // for all pixels, in MCerPhotEvt containers).
-  //
-
-  // ------------- user change -----------------
-  Char_t*  NonoiseFilename = "/local_disk/jrico/mc/Gamma_zbin0_0_7_1000to1009_w0.root";
-  //  Char_t*  NoiseFilename   = "/mnt/wdflix/root_0.73mirror/wuerzburg/gammas/Gamma_zbin3_0_7_1160to1169_w0.root"; // File to be analyzed
-
-  //  Char_t* NoiseOutFilename   = "/mnt/users/jrico/prueba.root";   // Output file name
-
-  const Int_t wsize=2;
-  // Signal sigextract
-  // (other extraction methods can be used)
-  MExtractor* sigextract = new MExtractTimeAndChargeSpline();
-  ((MExtractTimeAndChargeSpline*)sigextract)->SetTimeType(MExtractTimeAndChargeSpline::kHalfMaximum);
-  ((MExtractTimeAndChargeSpline*)sigextract)->SetChargeType(MExtractTimeAndChargeSpline::kIntegral);      
-  ((MExtractTimeAndChargeSpline*)sigextract)->SetRiseTime((Float_t)wsize*0.25); 
-  ((MExtractTimeAndChargeSpline*)sigextract)->SetFallTime((Float_t)wsize*0.75);
-  
-  // Define FADC slices to be integrated in high and low gain:
-  sigextract->SetRange(1, 11, 2, 12);
-
-  // Defines when to switch to low gain
-  sigextract->SetSaturationLimit(240);
-
-  // ---------------------------------------------------------------------
-  //
-  // Create a empty Parameter List and an empty Task List
-  // The tasklist is identified in the eventloop by its name
-  //
-  MParList  plist;
-  MTaskList tlist;
-  plist.AddToList(&tlist);
-
-  MPedestalCam  pedcam;
-  MGeomCamMagic geomcam;
-  MCerPhotEvt   nphot;
-
-  plist.AddToList(&pedcam);
-  plist.AddToList(&geomcam);
-  plist.AddToList(&nphot);
-
-  //
-  // Now setup the tasks and tasklist:
-  // ---------------------------------
-  //
-  MReadMarsFile read("Events");
-  read.AddFile(NonoiseFilename);
-  read.DisableAutoScheme();
-
-  MGeomApply geom; 
-  // Reads in geometry from MC file and sets the right sizes for
-  // several parameter containers.
-
-  MMcPedestalCopy   pcopy; 
-  // Copies pedestal data from the MC file run fadc header to the 
-  // MPedestalCam container.
-
-  MDisplay       display(&nphot,&geomcam);
-  MHillasDisplay display2(&nphot,&geomcam);
-
-  MPointingPosCalc pointcalc;
-  // Creates MPointingPos object and fill it with the telescope orientation
-  // information taken from MMcEvt.
-
-  MMcCalibrationUpdate  mccalibupdate;
-
-  MCalibrate calib; 
-  // MCalibrate transforms signals from ADC counts into photons. In the first
-  // loop it applies a "dummy" calibration supplied by MMcCalibrationUpdate, just 
-  // to equalize inner and outer pixels. At the end of the first loop, in the
-  // PostProcess of MMcCalibrationCalc (see below) the true calibration constants
-  // are calculated.
-
-  calib.SetCalibrationMode(MCalibrate::kFfactor);
-
-  MImgCleanStd clean(4.0,3.5);
-  clean.SetCleanRings(1);
-  //  clean.SetRemoveSingle(kFALSE);
-  //
-  // Applies tail cuts to image. Since the calibration is performed on 
-  // noiseless camera files, the precise values of the cleaning levels 
-  // are unimportant (in any case, only pixels without any C-photon will
-  // be rejected).
-  //
-
-  MHillasCalc hcalc; // Calculates Hillas parameters not dependent on source position.
-  MHillasSrcCalc hsrccalc;
-
-  MMcCalibrationCalc mccalibcalc; 
-  // Calculates calibration constants to convert from ADC counts to photons.
-
-  tlist.AddToList(&read);
-  tlist.AddToList(&geom);
-  tlist.AddToList(&pcopy);
-  tlist.AddToList(&pointcalc);
-  tlist.AddToList(sigextract);
-  tlist.AddToList(&mccalibupdate);
-  tlist.AddToList(&calib);
-  tlist.AddToList(&clean);
-  tlist.AddToList(&hcalc);
-  tlist.AddToList(&hsrccalc); 
-  tlist.AddToList(&mccalibcalc);
-  //tlist.AddToList(&display2);
-
-  //
-  // First loop: No noise
-  //
-  MProgressBar bar;
-  bar.SetWindowName("No noise...");
-
-  MEvtLoop evtloop;
-  //  evtloop.SetProgressBar(&bar);
-  evtloop.SetParList(&plist);
-
-  if (!evtloop.Eventloop())
-    return;
-  mccalibcalc.GetHistADC2PhotEl()->Write();
-  mccalibcalc.GetHistPhot2PhotEl()->Write();
-  // Writes out the histograms used for calibration.
-
-
-  //
-  // Second loop: process file with noise
-  //  
-  MIslands      isl;
-  MArrivalTimeCam timecam;      
-  MTopology     topology;
-  plist.AddToList(&isl);
-  plist.AddToList(&timecam);
-  plist.AddToList(&topology);
-
-  MArrivalTimeCalc2 timecalc;
-  MIslandsCalc      islandcalc;
-  islandcalc.SetOutputName("MIslands");
-  islandcalc.SetAlgorithm(1);
-  MIslandsClean     islclean(40);
-  islclean.SetInputName("MIslands");
-  islclean.SetMethod(1);
-  MTopologyCalc     topcalc;
-
-  MReadMarsFile read2("Events");
-  read2.AddFile(NoiseFilename);
-  read2.DisableAutoScheme();
-  tlist.AddToListBefore(&read2, &read, "All");
-  tlist.RemoveFromList(&read);
-
-  tlist.AddToListBefore(&timecalc,&mccalibupdate,"All");
-  tlist.AddToListBefore(&islandcalc,&hcalc,"All");
-  tlist.AddToListBefore(&topcalc,&hcalc,"All");
-
-  MWriteRootFile write(NoiseOutFilename); // Writes output
-  write.AddContainer("MRawRunHeader", "RunHeaders");
-  write.AddContainer("MMcRunHeader",  "RunHeaders");
-  write.AddContainer("MSrcPosCam",    "RunHeaders");
-  write.AddContainer("MGeomCam",      "RunHeaders");
-  write.AddContainer("MMcConfigRunHeader",  "RunHeaders");
-  write.AddContainer("MMcCorsikaRunHeader", "RunHeaders");
-  write.AddContainer("MMcFadcHeader",  "RunHeaders");
-  write.AddContainer("MMcTrigHeader",  "RunHeaders");
-
-  write.AddContainer("MMcEvt",        "Events");
-  write.AddContainer("MRawEvtHeader", "Events");
-  write.AddContainer("MHillas",       "Events");
-  write.AddContainer("MHillasSrc",    "Events");
-  write.AddContainer("MHillasExt",    "Events");
-  write.AddContainer("MConcentration","Events");
-  write.AddContainer("MImagePar",     "Events");
-  write.AddContainer("MNewImagePar",  "Events");
-  write.AddContainer("MIslands",      "Events");
-  write.AddContainer("MPointingPos",  "Events");
-  write.AddContainer("MTopology",      "Events");
-
-  tlist.RemoveFromList(&mccalibcalc);
-  tlist.AddToList(&write);
-  //  tlist.AddToListBefore(&display2,&write, "All");
-
-  bar.SetWindowName("Calibrating/Cleaning...");
-  //  clean.SetRemoveSingle();
-  //  clean.SetMethod(MImgCleanStd::kDemocratic);
-
-  if (!evtloop.Eventloop())
-    return;
-
-  tlist.PrintStatistics();
-}
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/observationTime.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/observationTime.C	(revision 7136)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/* ======================================================================== *\!
-!   Author(s): Javier Rico
-\* ======================================================================== */
-
-void observationTime(
-		     Int_t iniRun=0,
-		     Int_t finRun=99999,
-		     TString filename="/mnt/users/jrico/magic/mars/mars/mtemp/mifae/hillas/AllCrabNebula_3015_kDefault_MispE.root"
-)
-{    
-    // define files, chains...
-    TChain* t= new TChain("Parameters");
-    t->Add(filename);
-
-    // define aliases
-    t->SetAlias("run",     "MRawRunHeader.fRunNumber");
-    t->SetAlias("runiniT", "MRawRunHeader.fRunStart.fTime.fMilliSec/1000");
-    t->SetAlias("runfinT", "MRawRunHeader.fRunStop.fTime.fMilliSec/1000");
-
-    TH1I* hrun = new TH1I("hrun","",finRun-iniRun+1,iniRun,finRun+1);
-    TH1I* hent = new TH1I("hent","",finRun-iniRun+1,iniRun,finRun+1);
-	
-    const char varcut[512];
-    const char runcut[512];
-    sprintf(runcut,"(run>=%d && run<=%d)",iniRun,finRun);
-    sprintf(varcut,"%s*(runfinT-runiniT)",runcut);
-
-    t->Draw("run>>hrun",runcut);
-    t->Draw("run>>hent",varcut);
-
-    Float_t seconds=0;
-    for(Int_t irun = 1; irun<=finRun-iniRun+1; irun++)
-      {
-	Int_t nev;
-	if(nev=hrun->GetBinContent(irun))
-	  {
-	    Float_t time = hent->GetBinContent(irun)/nev;
-	    seconds += time;	    
-	    cout << "run " << iniRun-1+irun << ", " << time <<  " seconds" << endl;
-	  }
-      }
-    
-    cout << "Total observation time = " << seconds << " seconds = " << seconds/60. << " minutes = " << seconds/3600. << " hours" << endl;
-    delete hrun;
-    delete hent;
-}
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/pedrmsonoff.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/pedrmsonoff.C	(revision 7136)
+++ 	(revision )
@@ -1,284 +1,0 @@
-// pedrmsonoff.C
-// compare pedestal rms for two different sets
-//
-
-#include "MParList.h"
-#include "MTaskList.h"
-#include "MPedestalCam.h"
-#include "MReadMarsFile.h"
-#include "MGeomApply.h"
-#include "MPedCalcPedRun.h"
-#include "MEvtLoop.h"
-#include "MPedestalPix.h"
-#include "MHCamera.h"
-
-#include "TTimer.h"
-#include "TString.h"
-#include "TCanvas.h"
-#include "TFile.h"
-#include "TGraphErrors.h"
-#include "TMultiGraph.h"
-#include "TLegend.h"
-#include "TPaveStats.h"
-#include "TH1F.h"
-#include "TStyle.h"
-#include "TROOT.h"
-
-#include <iostream>
-
-using namespace std;	     
-
-void compare(TCanvas* canvas,TString onfname, TString offfname,TString descon, TString descoff, UInt_t index=-1);
-
-void pedrmsonoff()
-//int main()
-{
-  // general settings
-  gROOT->Reset();
-  gStyle->SetCanvasColor(0);
-  gStyle->SetStatColor(0);
-  gStyle->SetStatBorderSize(1);
-  gStyle->SetOptStat(111111);
-  gStyle->SetStatW(0.2);
-  gStyle->SetStatH(0.1);
-  gStyle->SetStatX(0.9);
-  gStyle->SetStatY(0.9);
-
-  // create canvas
-  TCanvas* canvas = new TCanvas("canvas","On/Off crab pedestal rms", 0, 100, 800, 500);
-  canvas->SetBorderMode(0);    // Delete the Canvas' border line     
-  canvas->cd();
-
-#ifdef TEMPLATE
-  // define input files/parameters
-  const UInt_t ncomp = 9;
-
-  //  const TString onfile ="/mnt/disc02/Data/rootdata/CrabNebula/2004_01_26/20040125_10412_P_Crab-On_E.root";
-  TString onfile[ncomp] = {
-    "/local_disk/jrico/rootdata/20040126_12149_P_Cab-On_E.root",
-    "/local_disk/jrico/rootdata/20040125_10412_P_Crab-On_E.root", 
-    "/local_disk/jrico/rootdata/20040125_10412_P_Crab-On_E.root",
-    "/local_disk/jrico/rootdata/20040119_04642_P_Crab-On_E.root",
-    "/local_disk/jrico/rootdata/20040128_1342*_P_ClosedLidsHVoff_E.root",
-    "/local_disk/jrico/rootdata/20040128_1342*_P_ClosedLidsLVoff_E.root",
-    "/local_disk/jrico/rootdata/20040128_1343*_P_ReciversOff_E.root",
-    "/local_disk/jrico/rootdata/20040126_12386_P_Cab-On_E.root",
-    "/local_disk/jrico/rootdata/20040126_12543_P_OffCrab-1_E.root"};
-
-  
-  TString ondesc[ncomp] = {"Run 12149 Jan 27th, Crab On, #theta 28 deg",
-			   "Run 10412 Jan 26th, Crab On, #theta 12.5 deg",
-			   "Run 10412 Jan 26th, Crab On, #theta 12.5 deg",			      
-			   "Run 4642 Jan 20th, Crab On, #theta 14.1 deg",
-			   "Runs 13426-7 Jan 29th, Closed lids HV off",
-			   "Runs 13428-9 Jan 29th, Closed lids LV off",
-			   "Runs 13430-1 Jan 29th, Recivers Off",
-			   "Run 12386 Jan 27th, Crab On #theta 37.1 deg",
-			   "Run 12543 Jan 27th, Crab Off #theta 8.6 deg"};
-
-  
-  TString offfile[ncomp] = {
-    "/local_disk/jrico/rootdata/20040121_06773_P_OffCrab1_E.root",
-    "/local_disk/jrico/rootdata/20040125_11477_P_OffCrab1_E.root",
-    "/local_disk/jrico/rootdata/20040125_10415_P_Crab-On_E.root",
-    "/local_disk/jrico/rootdata/20040125_10415_P_Crab-On_E.root",
-    "/local_disk/jrico/rootdata/20040128_13425_P_ClosedLidsHVon_E.root",
-    "/local_disk/jrico/rootdata/20040128_13425_P_ClosedLidsHVon_E.root",
-    "/local_disk/jrico/rootdata/20040128_13425_P_ClosedLidsHVon_E.root",
-    "/local_disk/jrico/rootdata/20040128_13425_P_ClosedLidsHVon_E.root",
-    "/local_disk/jrico/rootdata/20040128_13425_P_ClosedLidsHVon_E.root"};
-
-  
-  TString offdesc[ncomp] = {"Run 6773 Jan 22nd, Crab Off #theta 28 deg",
-			    "Run 11477 Jan 26th, Crab Off #theta 9.2 deg",
-			    "Run 10415 Jan 26th, Crab On, #theta 13.8 deg",
-			    "Run 10415 Jan 26th, Crab On, #theta 13.8 deg",
-			    "Run 13425 Jan 29th, Closed lids HV on",
-			    "Run 13425 Jan 29th, Closed lids HV on",
-			    "Run 13425 Jan 29th, Closed lids HV on",
-			    "Run 13425 Jan 29th, Closed lids HV on",
-			    "Run 13425 Jan 29th, Closed lids HV on"};
-#endif
-
-  // define input files/parameters
-  const UInt_t ncomp = 1;
-
-  TString onfile[ncomp] = {"/local_disk/jrico/rootdata/pedestals/20040619_*_P_OffPSR1957-1_E.root"};  
-  TString ondesc[ncomp] = {"Off-PSR1957"};  
-  TString offfile[ncomp] = {"/local_disk/jrico/mc/empty_disc00.root"};  
-  TString offdesc[ncomp] = {"MC (Vela)"};
-
-  canvas->Print("pedrmsonoff.ps[");  
-  for(UInt_t i=0;i<ncomp;i++)    
-    compare(canvas,onfile[i],offfile[i],ondesc[i],offdesc[i],i);
-  canvas->Print("pedrmsonoff.ps]");  
-}
-
-
-void compare(TCanvas* canvas,TString onfname, TString offfname,TString descon, TString descoff,UInt_t index)
-{
-  /*************************/
-  /* FIRST LOOP: ON DATA   */
-  /*************************/
-
-  // basic lists
-  MParList plist;
-  MTaskList tlist;
-  plist.AddToList(&tlist);
-  
-  // containers
-  MPedestalCam   onpedcam;
-  plist.AddToList(&onpedcam);
-    
-  //tasks
-  MReadMarsFile read("Events", onfname);
-  MGeomApply     geomapl;
-  MPedCalcPedRun pedcalc;
-
-  read.DisableAutoScheme();
-
-  tlist.AddToList(&read);
-  tlist.AddToList(&geomapl);
-  tlist.AddToList(&pedcalc);
-
-  // Create and execute the event looper
-  MEvtLoop evtloop;
-  evtloop.SetParList(&plist);
-  
-  cout << "*********************" << endl;
-  cout << "** RUNNING ON DATA **" << endl;
-  cout << "*********************" << endl;
-
-  if (!evtloop.Eventloop())
-    return;
-  
-  tlist.PrintStatistics();
-
-  /**************************/
-  /* SECOND LOOP: OFF DATA  */
-  /**************************/
-  MReadMarsFile read2("Events",offfname);
-  read2.DisableAutoScheme();
-  tlist.AddToListBefore(&read2, &read, "All");
-  tlist.RemoveFromList(&read);
-  
-  // containers
-  MPedestalCam   offpedcam;
-  plist.Remove(&onpedcam);
-  plist.AddToList(&offpedcam);
-  
-  // Execute the event looper
-  cout << "**********************" << endl;
-  cout << "** RUNNING OFF DATA **" << endl;
-  cout << "**********************" << endl;
-
-  if (!evtloop.Eventloop())
-    return;
-  
-  tlist.PrintStatistics();
-
-  /*******************/
-  /* FILL HISTOGRAMS */
-  /*******************/
-  const UInt_t npix = 577;
-  const UInt_t ninner = 397;
-  const UInt_t imin =  0;
-  const UInt_t imax = 20;
-  const UInt_t itot = 50;
-  
-  TH1F* honinpedrms  = new TH1F(descon+TString(" Inner"),"Pedestal RMS" ,itot,imin,imax);
-  TH1F* hoffinpedrms = new TH1F(descoff+TString(" Inner"),"Pedestal RMS",itot,imin,imax);
-  TH1F* honoutpedrms  = new TH1F(descon+TString(" Outer"),"Pedestal RMS" ,itot,imin,imax);
-  TH1F* hoffoutpedrms = new TH1F(descoff+TString(" Outer"),"Pedestal RMS",itot,imin,imax);
-
-  for(UInt_t i=0;i<npix;i++)
-    {
-      const Float_t onpedrms  =  onpedcam[i].GetPedestalRms();
-      const Float_t offpedrms = offpedcam[i].GetPedestalRms();
-      
-      if(i<ninner)
-	{
-	  honinpedrms->Fill(onpedrms);
-	  hoffinpedrms->Fill(offpedrms);
-	}
-      else
-	{
-	  honoutpedrms->Fill(onpedrms);
-	  hoffoutpedrms->Fill(offpedrms);
-	}
-    }
-
-  /*******************/
-  /* DRAW HISTOGRAMS */
-  /*******************/
-     
-  // draw pedestal histos
-  honinpedrms->GetXaxis()->SetTitle("Pedestal RMS (ADC cnts)");
-  honinpedrms->GetYaxis()->SetTitle("# pixels");
-  honinpedrms->SetFillStyle(3004);
-  honinpedrms->SetFillColor(1);
-
-  hoffinpedrms->GetXaxis()->SetTitle("Pedestal RMS (ADC cnts)");
-  hoffinpedrms->GetYaxis()->SetTitle("# pixels");
-  hoffinpedrms->SetFillStyle(3005);
-  hoffinpedrms->SetFillColor(2);
-  hoffinpedrms->SetLineColor(2);
-
-  honoutpedrms->GetXaxis()->SetTitle("Pedestal RMS (ADC cnts)");
-  honoutpedrms->GetYaxis()->SetTitle("# pixels");
-  honoutpedrms->SetFillStyle(3017);
-  honoutpedrms->SetFillColor(1);
-
-  hoffoutpedrms->GetXaxis()->SetTitle("Pedestal RMS (ADC cnts)");
-  hoffoutpedrms->GetYaxis()->SetTitle("# pixels");
-  hoffoutpedrms->SetFillStyle(3018);
-  hoffoutpedrms->SetFillColor(2);
-  hoffoutpedrms->SetLineColor(2);
-
-  hoffinpedrms->Draw();
-  hoffoutpedrms->Draw("sames");
-  honinpedrms->Draw("sames");
-  honoutpedrms->Draw("sames");
-
-  // move stat boxes to make them all visible
-  gPad->Update();
-  TPaveStats* onoutpavstat  = (TPaveStats*) honoutpedrms->GetListOfFunctions()->FindObject("stats");
-  TPaveStats* offinpavstat  = (TPaveStats*) hoffinpedrms->GetListOfFunctions()->FindObject("stats");
-  TPaveStats* offoutpavstat = (TPaveStats*) hoffoutpedrms->GetListOfFunctions()->FindObject("stats");
-  Float_t shifty = offinpavstat->GetY2NDC()-offinpavstat->GetY1NDC();
-  Float_t shiftx = onoutpavstat->GetX2NDC()-onoutpavstat->GetX1NDC();
-
-  onoutpavstat->SetX1NDC(onoutpavstat->GetX1NDC()-shiftx);
-  onoutpavstat->SetX2NDC(onoutpavstat->GetX2NDC()-shiftx);
-
-  offinpavstat->SetY1NDC(offinpavstat->GetY1NDC()-shifty);
-  offinpavstat->SetY2NDC(offinpavstat->GetY2NDC()-shifty);
-
-  offoutpavstat->SetX1NDC(offoutpavstat->GetX1NDC()-shiftx);
-  offoutpavstat->SetX2NDC(offoutpavstat->GetX2NDC()-shiftx);
-  offoutpavstat->SetY1NDC(offoutpavstat->GetY1NDC()-shifty);
-  offoutpavstat->SetY2NDC(offoutpavstat->GetY2NDC()-shifty);
-
-  // include legend
-  TLegend* leg1 = new TLegend(.52,.25,.88,.45);
-  leg1->SetHeader("");
-  leg1->AddEntry(honinpedrms,descon+TString(" (Inner)"),"f");
-  leg1->AddEntry(hoffinpedrms,descoff+TString(" (Inner)"),"f");
-  leg1->AddEntry(honoutpedrms,descon+TString(" (Outer)"),"f");
-  leg1->AddEntry(hoffoutpedrms,descoff+TString(" (Outer)"),"f");
-  leg1->SetFillColor(0);
-  leg1->SetLineColor(0);
-  leg1->SetBorderSize(0);
-  leg1->Draw();
-
-  if(index>=0)
-    {
-      char fname[100];
-      sprintf(fname,"pedrmsonoff%02d.eps",index);
-      canvas->Print(fname);        
-    }
-  canvas->Print("pedrmsonoff.ps");  
-
-  return; 
-  
-}
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/plotOptimal.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/plotOptimal.C	(revision 7136)
+++ 	(revision )
@@ -1,124 +1,0 @@
-////////////////////////////////////////////////////////////////////////////////////
-//
-//             _____ Plot Optimized cuts _____
-//
-//  Take as input an output from programs/optimizeCuts and plot the results
-//  You only need to specify the input file name
-//
-//                 Jose Flix    <jflix@ifae.es>
-//                 Javier Rico  <jrico@ifae.es>
-////////////////////////////////////////////////////////////////////////////////////
-
-
-void plotOptimal(TString fname="optimize.out")
-{
-  gROOT->Reset();
-  gStyle->SetCanvasColor(0);
-  gStyle->SetCanvasBorderMode(0);
-  gStyle->SetPadBorderMode(0);
-  gStyle->SetFrameBorderMode(0);
-  gStyle->SetOptStat(000000);
-  gStyle->SetPalette(1);
-
-  ifstream ifun(fname.Data());
-  Float_t width,length,excess,significance;
-
-  Float_t wmin=9999999;
-  Float_t lmin=9999999;
-  Float_t wmax=-9999999;
-  Float_t lmax=-9999999;
-  Float_t emax=-9999999;
-  Float_t smax=-9999999;
-
-  Float_t dw=-1;
-  Float_t dl=-1;
-  Float_t prevw=-1;
-  Float_t prevl=-1;
-
-  // first loop to get parameters
-  Int_t i=0;
-  while(ifun >> width)
-    {
-      // read data
-      ifun >> length;
-      ifun >> excess;
-      ifun >> significance;
-      
-      // keep max/min
-      if(width<wmin)  wmin=width;
-      if(length<lmin) lmin=length;
-      if(width>wmax)  wmax=width;
-      if(length>lmax) lmax=length;
-      if(significance>smax) 
-	{
-	  smax=significance;
-	  emax=excess;
-	}
-
-      if(width!=prevw)   dw=width-prevw;
-      if(length!=prevl) dl=length-prevl;
-
-      prevw=width;
-      prevl=length;
-      i++;
-    }
-  ifun.close();
-
-  cout << "wmin: " << wmin << ", wmax: " << wmax+dw << ", lmin: " << lmin << ", lmax: " << lmax+dl << endl;
-
-  // define histos
-  Int_t nx = TMath::Nint((wmax-wmin)/dw)+1;
-  Int_t ny = TMath::Nint((lmax-lmin)/dl)+1;
-  TH2F *ex  = new TH2F("Excess","Excess",nx,wmin,wmax+dw,ny,lmin,lmax+dl);
-  TH2F *sig = new TH2F("Significance","Significance",nx,wmin,wmax+dw,ny,lmin,lmax+dl);
-
-  cout << "nx: " << nx << ", ny: " << ny << endl;
-  cout << "dw: " << dw << ", dl: " << dl << endl;
-
-  ifstream ifun2;
-  ifun2.open(fname.Data());
-  
-  // second loop to fill the histograms
-  Float_t wopt,lopt,eopt;
-  while(ifun2 >> width)
-    {
-      // read data
-      ifun2 >> length;
-      ifun2 >> excess;
-      ifun2 >> significance;
-
-      cout << "Width: " << width << '\t' << "Length: " << length << '\t' << "Excess: " << excess << '\t' << "Significance: " << significance;
-      if(significance==smax)
-	{
-	  cout << " *****";
-	  wopt=width;
-	  lopt=length;
-	  eopt=excess;
-	}
-	    
-      cout << endl;
-
-      Int_t binx = TMath::Nint(((width-wmin)/dw));
-      Int_t biny = TMath::Nint(((length-lmin)/dl));
-
-      //      cout << "binnx: " << binx+1 << ", biny: " << biny+1 << endl;
-
-      ex->SetBinContent(binx+1,biny+1,excess+.00001);
-      sig->SetBinContent(binx+1,biny+1,significance+.00001);    
-    }
-  cout << "Maximal significance: " << smax << " (excess=" << eopt << ") for width="<<wopt<<", length=" << lopt << endl;
-
-  // plot
-  TCanvas *c3 = new TCanvas("c3","c3",0,0,500,750);
-  c3->Divide(1,2);
-  
-  c3->cd(1);
-  ex->GetXaxis()->SetTitle("Width (degrees)");
-  ex->GetYaxis()->SetTitle("Length (degrees)");
-  ex->Draw("colz");
-  
-  c3->cd(2);
-  sig->GetXaxis()->SetTitle("Width (degrees)");
-  sig->GetYaxis()->SetTitle("Length (degrees)");
-  sig->Draw("colz");
-}
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/rotation.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/rotation.C	(revision 7136)
+++ 	(revision )
@@ -1,101 +1,0 @@
-
-// Macro to compare the rotation obtained from simple FOV rotation, with 
-// measured values
-
-void rotation()
-{
-  const Int_t rmax=17427;
-  gStyle->SetMarkerStyle(20);
-  gStyle->SetMarkerSize(1);
-
-  const char* fname="/mnt/users/jrico/magic/mars/Mars_Standard02/mtemp/mifae/macros/20040215_Mrk421.B.pos";
-  TFile* file= new TFile("/mnt/users/jrico/magic/mars/Mars_Standard02/mtemp/mifae/hillas/mrk20040215OnRotateNoCalB.root");
-  TTree* chain = (TTree*)file->Get("Parameters");
-
-  // read position data from file
-  ifstream ifun(fname);
-
-  Int_t irun;
-  Float_t ix;
-  Float_t iy;
-
-  // first loop to evaluate number of entries
-  Int_t nentries=0;  
-  while(ifun >> irun)
-    {
-      ifun >> ix;
-      ifun >> iy;
-      nentries++;
-    }
-  ifun.close();
-  const Int_t size = nentries;
-  Float_t x[size];
-  Float_t y[size];
-  Int_t run[size];
-
-  // second loop to actually read values into arrays
-  Int_t i=0;
-  ifstream ifun2(fname);
-  while(ifun2 >> run[i])
-    {
-      ifun2 >> x[i];
-      ifun2 >> y[i];
-      x[i]/=315.;
-      y[i]/=315.;
-      i++;
-    }  
-  ifun2.close();
-  TGraph* tray = new TGraph(nentries,x,y);
-
-  // get data from tree
-  MSrcPosCam* srpos = new MSrcPosCam; 
-  MRawRunHeader* hrun = new MRawRunHeader;
-  chain->SetBranchAddress("MSrcPosCam.",&srpos);
-  chain->SetBranchAddress("MRawRunHeader.",&hrun);
-
-  Int_t ntot = chain->GetEntries();
-  const Int_t ctot =ntot;
-  Float_t xth[ctot];
-  Float_t yth[ctot];
-  Int_t rtot=0;
-  for(Int_t j=0;j<ctot;j++)
-    {
-      chain->GetEntry(j);
-      Int_t arun=hrun->GetRunNumber();
-      if(arun<=rmax)
-	{
-	  xth[j]=srpos->GetX()/315.;
-	  yth[j]=srpos->GetY()/315.;
-	  rtot++;
-	}
-    }     
-  TGraph* trayth = new TGraph(rtot,xth,yth);
-  
-
-  // Plot   
-  TPostScript myps("rotation.ps",111);
-  myps.Range(15,15);
-  TCanvas* myC = new TCanvas("myC","pedestal studies",500,500);
-  myC->cd(1);
-
-  // Null graph to adjust plot limits
-  Float_t nullx[2]={-0.4,0.4};
-  Float_t nully[2]={-0.4,0.4};
-
-  TGraph grnull(2,nullx,nully);
-  grnull.SetMarkerSize(0);
-  grnull.SetMarkerColor(0);
-  grnull.GetXaxis()->SetTitle("x (deg)");
-  grnull.GetYaxis()->SetTitle("y (deg)");
-  grnull.SetTitle("Source position in camera Mrk421 15th February");
-  grnull.DrawClone("AP");
-
-  tray->SetMarkerStyle(2);
-  tray->SetMarkerSize(2);
-  trayth->SetMarkerStyle(6);
-  trayth->SetMarkerColor(2);
-
-  tray->DrawClone("P");
-  trayth->DrawClone("P");
-  myps.Close();
-}
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/signal.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/signal.C	(revision 7136)
+++ 	(revision )
@@ -1,180 +1,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//
-//       This macro makes the two-dimension plot of the False Source Method:
-//        root > .x signal.C(TString name, TString psname)
-//
-//                 Ester Aliu   <aliu@ifae.es>
-//                 Oscar Blanch <blanch@ifae.es>
-//                 Javier Rico  <jrico@ifae.es>
-////////////////////////////////////////////////////////////////////////////
-void signal(
-TString fname ="hillasCrab/falseSourceCrab20040215.root",
-TString psname ="kk.ps")
-{
-  Float_t excess;
-  Float_t significance;
-  Float_t array[2];
-  
-  Int_t nbin2d = 5;
-  Int_t ntotal = 2*nbin2d+1;
-  
-  Int_t nx = 0;
-  Int_t ny = 0;
-  
-  Float_t max = -10000;
-  Int_t imax;
-  Int_t jmax;
-  Float_t A ;
-  Float_t B;
-  
-  TH2F *hsignif = new TH2F("hsignif","Significance", ntotal, -1.0, 1.0, ntotal, -1.0, 1.0);
-  TH2F *hexcess = new TH2F("hexcess","Excess", ntotal, -1.0, 1.0, ntotal, -1.0, 1.0);
-  
-  
-  // loop on the histos and compute excess and significance
-  for( Int_t i = -nbin2d; i <= nbin2d ; i++)  
-    {    
-      nx++;
-      ny = 0;
-      for( Int_t j = -nbin2d; j <= nbin2d ; j++)  
-	{	
-	  ny++;	  
-	  step_signal(i,j,&array[0], fname);
-	  
-	  excess = array[0];
-	  significance = array[1];
-
-	  hexcess->SetBinContent(nx, ny, excess);
-	  hsignif->SetBinContent(nx, ny, significance);
-
-	  if ( significance > max)
-	    {
-	      max = significance;
-	      imax = i;
-	      jmax = j;
-	      A = excess;
-	      B = significance;
-	    }
-	}
-    }
-  
-  cout << "The position of maximum significance is ( " << imax << " , " << jmax << " )" << endl;
-  cout << "Excess: " << A << endl;
-  cout << "Significance: " << B << endl;
-    
-  // Plot 
-  gROOT->Reset();
-  gStyle->SetCanvasColor(0);
-  gStyle->SetCanvasBorderMode(0);
-  gStyle->SetPadBorderMode(0);
-  gStyle->SetFrameBorderMode(0);
-  gStyle->SetOptTitle(0);
-  gStyle->SetTitleOffset(1.7,"y");
-  gStyle->SetPadLeftMargin(0.15);
-  gStyle->SetOptStat(kFALSE);
-  gStyle->SetStatColor(0);
-  gStyle->SetStatBorderSize(1);
-  gStyle->SetStatW(0.2);
-  gStyle->SetStatH(0.1);
-  gStyle->SetStatX(0.9);
-  gStyle->SetStatY(0.9);
-  
-
-  TPostScript myps(psname,111);
-  myps.Range(15,15);
-  TCanvas *c2d = new TCanvas("c2d", "Matrices", 0, 0, 800,800);  
-  c2d->Divide(2,2);
-  gStyle->SetPalette(1); 
-  
-  c2d->cd(1);
-  hexcess->Draw("colz");
-  hexcess->SetXTitle("X position (deg)");
-  hexcess->SetYTitle("Y position (deg)");
-  gPad->Update();    
-  
-  c2d->cd(2);
-  hsignif->Draw("colz");
-  hsignif->SetXTitle("X position (deg)");
-  hsignif->SetYTitle("Y position (deg)");
-  gPad->Update();
-
-  c2d->cd(3);
-  hexcess->Draw("lego2");
-  hexcess->SetXTitle("X position (deg)");
-  hexcess->SetYTitle("Y position (deg)");
-  gPad->Update();    
-  
-  c2d->cd(4);
-  hsignif->Draw("lego2");
-  hsignif->SetXTitle("X position (deg)");
-  hsignif->SetYTitle("Y position (deg)");
-  gPad->Update();    
-
-  myps.Close();
-}
-  
-  
-void step_signal(Int_t i, Int_t j, Float_t *array, TString fname) 
-{
-  cout << "Bin (" << i << "," << j << ")" << endl;
-  TH1F *onhisto;
-  TH1F *offhisto;
-
-  // open file and access to the histograms  
-  TFile *f = new TFile(fname);
-  Char_t name[20]; 
-  Char_t title[50]; 
-
-  // histo name
-  sprintf(name,"hOnAlpha[%d][%d]", i, j);
-  sprintf(title,"Alpha-Plot(On data) (%d ,%d)", i, j);
-  onhisto = (TH1F*)gDirectory->Get(name);   
-  
-  sprintf(name,"hOffAlpha[%d][%d]", i, j);
-  sprintf(title,"Alpha-Plot(Off data) (%d ,%d)", i, j);
-  offhisto = (TH1F*)gDirectory->Get(name);   
-  
-  // line/normalization
-  const Int_t nbins = 18;
-  const Int_t inibin = 20./90.*nbins+1;
-  Float_t level=0;
-  Float_t leveloff=0;
-  Float_t levelofferror=0;
-  for(Int_t ibin = inibin; ibin<=nbins;ibin++)
-    {
-      level+=onhisto->GetBinContent(ibin);
-      leveloff+=offhisto->GetBinContent(ibin);
-    }
-  level/=(nbins-inibin+1);
-  leveloff/=(nbins-inibin+1);
-  
-  // normalize on/off
-  offhisto->Sumw2(); // needed to compute correct errors after normalization
-  const Float_t norm = level/leveloff;
-  cout << "Normalizing by factor " << norm <<endl;
-  offhisto->Scale(norm);    
-  
-  // significance:
-  Float_t sig=0,bg=0,esig=0,ebg=0;
-  Float_t significance=0;
-  const Int_t signbins = inibin-1;
-  for(Int_t ibin = 1; ibin<=signbins;ibin++)
-    {
-      sig  += onhisto->GetBinContent(ibin);
-      esig += onhisto->GetBinError(ibin)*onhisto->GetBinError(ibin);
-      bg   += offhisto->GetBinContent(ibin);
-      ebg  += offhisto->GetBinError(ibin)*offhisto->GetBinError(ibin);
-    }
-  Float_t error= TMath::Sqrt(esig+ebg);
-  Float_t excess = sig-bg;
-  Float_t significance = excess/error;
-  
-  cout << "Excess:       " << excess << endl;
-  cout << "Significance: " << significance << endl;
-  
-  array[0] = excess;
-  array[1] = significance;
-}
-
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/signalPoint.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/signalPoint.C	(revision 7136)
+++ 	(revision )
@@ -1,131 +1,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//
-//       This macro makes the alpha-plot for one of the positions of the 
-//     False Source Method:
-//
-//                 Ester Aliu   <aliu@ifae.es>
-//                 Oscar Blanch <blanch@ifae.es>
-//                 Javier Rico  <jrico@ifae.es>
-////////////////////////////////////////////////////////////////////////////
-
-void signalPoint(Int_t i=0, Int_t j=0, TString fname="hillasCrab/falseSourceCrab20040215.root")
-{  
-  // constants
-  const Int_t nbins = 18;
-  
-  // general settings
-  gROOT->Reset();
-  gStyle->SetCanvasColor(0);
-  gStyle->SetCanvasBorderMode(0);
-  gStyle->SetPadBorderMode(0);
-  gStyle->SetFrameBorderMode(0);
-  gStyle->SetOptTitle(0);
-  gStyle->SetTitleOffset(1.7,"y");
-  gStyle->SetPadLeftMargin(0.15);
-  gStyle->SetOptStat(111110);
-  gStyle->SetStatColor(0);
-  gStyle->SetStatBorderSize(1);
-  gStyle->SetStatW(0.2);
-  gStyle->SetStatH(0.1);
-  gStyle->SetStatX(0.9);
-  gStyle->SetStatY(0.9);
-  
-  
-  //  open file and access to the histograms
-  TFile *f = new TFile(fname);
-  
-  Char_t name[20]; 
-  Char_t title[50]; 
-  
-  sprintf(name,"hOnAlpha[%d][%d]", i, j);
-  sprintf(title,"Alpha-Plot(On data) (%d ,%d)", i, j);
-  TH1F* onhisto = (TH1F*)gDirectory->Get(name);   
-  
-  sprintf(name,"hOffAlpha[%d][%d]", i, j);
-  sprintf(title,"Alpha-Plot(Off data) (%d ,%d)", i, j);
-  TH1F* offhisto = (TH1F*)gDirectory->Get(name);   
-
-  TPostScript myps("signalpoint.ps",111);
-  myps.Range(15,15);
-  TCanvas *c1 = new TCanvas("c1","c1",800,600);
-  c1->cd(1);
-
-  // line/normalization
-  const Int_t inibin = 20./90.*nbins+1;
-  Float_t level=0;
-  Float_t leveloff=0;
-  Float_t levelofferror=0;
-  for(Int_t ibin = inibin; ibin<=nbins;ibin++)
-    {
-      level+=onhisto->GetBinContent(ibin);
-      leveloff+=offhisto->GetBinContent(ibin);
-    }
-  level/=(nbins-inibin+1);
-  leveloff/=(nbins-inibin+1);
-  
-  // normalize on/off
-  offhisto->Sumw2(); // needed to compute correct errors after normalization
-  const Float_t norm = level/leveloff;
-  cout << "Normalizing by factor " << norm <<endl;
-  offhisto->Scale(norm);    
-  
-  // significance:
-  Float_t sig=0,bg=0,esig=0,ebg=0;
-  Float_t significance=0;
-  const Int_t signbins = inibin-1;
-  for(Int_t ibin = 1; ibin<=signbins;ibin++)
-    {
-      //	Float_t sigma = (onhisto->GetBinContent(ibin)-level)/onhisto->GetBinError(ibin);
-      //	significance+=sigma*sigma;
-      sig  += onhisto->GetBinContent(ibin);
-      esig += onhisto->GetBinError(ibin)*onhisto->GetBinError(ibin);
-      bg   += offhisto->GetBinContent(ibin);
-      ebg  += offhisto->GetBinError(ibin)*offhisto->GetBinError(ibin);
-    }
-  Float_t error= TMath::Sqrt(esig+ebg);
-  significance = (sig-bg)/error;
-  
-  cout << "Significance: " << significance << endl;
-  
-  // plot
-  onhisto->SetXTitle("alpha (deg)");
-  onhisto->SetYTitle("Entries");
-  onhisto->SetMarkerColor(4);
-  onhisto->SetMarkerStyle(20);
-  onhisto->SetMarkerSize(.7);
-  onhisto->SetLineColor(4);
-  onhisto->SetMaximum(onhisto->GetBinContent(nbins)*1.5);
-  
-  offhisto->SetFillColor(2);
-  offhisto->SetMaximum(offhisto->GetBinContent(nbins)*1.5);
-  offhisto->SetXTitle("alpha (deg)");
-  offhisto->SetYTitle("Entries");
-  
-  offhisto->Draw("HIST");
-  offhisto->Draw("ESAME");
-  onhisto->Draw("ESAMES");
-  //    onhisto->Draw("E");
-  
-  // move stat box to make them all visible
-  gPad->Update();
-  TPaveStats* offpavstat = (TPaveStats*) offhisto->GetListOfFunctions()->FindObject("stats");
-  if(offpavstat)
-    {
-      Float_t shiftx = offpavstat->GetX2NDC()-offpavstat->GetX1NDC();
-      offpavstat->SetX1NDC(offpavstat->GetX1NDC()-shiftx);
-      offpavstat->SetX2NDC(offpavstat->GetX2NDC()-shiftx);
-    }
-  
-  // draw line
-  TLine* line = new TLine(0.,level,90.,level);
-  line->SetLineColor(2);
-  line->SetLineStyle(2);
-  //    line->Draw();
-  
-  gPad->Modified();
-  gPad->Update();
-  
-  myps.Close();
-}
-
-
