Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

OccupancyAlg.h

Go to the documentation of this file.
00001 
00002 #ifndef  OCCUPANCYALG_H
00003 #define OCCUPANCYALG_H
00004 
00005 #include "Headers.h"
00006 #include "Event.h"
00007 #include "Geometry.h"
00008 #include "SystemAlg.h"
00009 
00010 #include "NoiseAlg.h"
00011 #include "CalibrationAlg.h"
00012 
00013 #include <string>
00014 #include <map>
00015 
00016 using std::string;
00017 using std::map;
00018 
00019 /*! -Class:   OccupancyAlg
00020   - Author:   Michel Lefebvre
00021   - Date:     29/7/2003
00022   - Description: OccupancyAlg is a systemAlg that computes the occupancy of each channel.
00023     The cut is |signal| > NoiseCut*noise.  The occupancy results are stored to files.
00024     Occupancy files can also be read back and the occupancy values accessed.
00025   */
00026 class OccupancyAlg : public SystemAlg {
00027 public:
00028 
00029   /** The user should never need to use this contructor
00030     * @param event A pointer in the event. Information contained in the event
00031     *                             gets refreshed before the execute method is run
00032     * @param hecGeom Pointer to the singleton Geometry object
00033     * @param runHeader Pointer to the singleton HecRunHeader object
00034     */
00035 
00036   OccupancyAlg(Event* event, Geometry* hecGeom, Headers* runHeader);
00037 
00038   //! Gets run once at the begining of the event Loop
00039   bool initialize();
00040 
00041   //! Gets run for every event
00042   bool execute();
00043 
00044   //! Gets run after all events have been executed
00045   bool finalize();
00046 
00047   //################################
00048   // hec public methods
00049 
00050   /** Enable the computation of channel occupancy for the hec
00051     * If no noise file name is given, then the file is assumed to be
00052     * hec_nnnnn_noise.dat
00053     * @param noiseFileName Name of noise file 
00054     */
00055   void hecEnable(string noiseFileName = "");
00056 
00057   /** Set the noise cut level
00058     * |signal| > m_hecNoiseCut*Noise
00059     * @param noiseCut the noise cut level in noise sigma units
00060     */
00061   void hecNoiseCut(float noiseCut){m_hecNoiseCut = noiseCut;};
00062 
00063   /** Read the noise cut level
00064     * Useful when reading occupancy files (where it is stored)
00065     */
00066   float hecNoiseCut(){return m_hecNoiseCut;};
00067 
00068   /** Set the print level for noise computation for the hec
00069     * 0 minimum
00070     * 1 print occupancy results (default)
00071     * @param level Print level
00072     */
00073   void hecPrintLevel(int level){m_hecPrintLevel = level;};
00074 
00075   /** Set the hec occupancy file name
00076     * @param occupancyFileName the name of the occupancy file
00077     */
00078   void hecOccupancyFileName(string occupancyFileName){m_hecOccupancyFileName = occupancyFileName;};
00079 
00080   /** Get the febno keyed occupancy map
00081     * The map contains entries for all connected channels
00082     */
00083   map<int, float> hecOccupancyMap(){return m_hecOccupancyMap;};
00084 
00085   /** Get the hec occupancy
00086     * @param febno channel febno
00087     */
00088   float hecOccupancy(int febno);
00089 
00090   /** Get the febno keyed hec occupancy error estimate map
00091     * The map contains entries for all connected channels
00092     */
00093   map<int, float> hecOccupancyErrorMap(){return m_hecOccupancyErrorMap;};
00094 
00095   /** Get the hec occupancy error estimate
00096     * @param febno channel febno
00097     */
00098   float hecOccupancyError(int febno);
00099 
00100   /** Read a hec occupancy file
00101     * If no noise file name is given, then the file is assumed to be
00102     * hec_nnnnn_occupancy.dat
00103     * Returns the run number in the occupancy file
00104     * @param occupancyFileName the name of the occupancy file
00105     */
00106   int hecReadOccupancyFile(string occupancyFileName = "");
00107 
00108   //! Print hec occupancy data
00109   void hecPrintOccupancy();
00110 
00111   /** Set the hec calibration file name
00112     * Needed if the ntuple data is in ADC 
00113     * Must be called before hecEnable 
00114     * @param calibrationFileName the name of the calibration file
00115     */
00116   void hecCalibrationFileName(string calibrationFileName){m_hecCalibrationFileName = calibrationFileName;};
00117 
00118   //################################
00119   // emec public methods
00120 
00121   /** Enable the computation of channel occupancy for the emec
00122     * If no noise file name is given, then the file is assumed to be
00123     * emec?_nnnnn_noise.dat where ? is given by the input data file name
00124     * @param noiseFileName Name of noise file 
00125     */
00126   void emecEnable(string noiseFileName = "");
00127 
00128   /** Set the noise cut level
00129     * |signal| > m_emecNoiseCut*Noise
00130     * @param noiseCut the noise cut level in noise sigma units
00131     */
00132   void emecNoiseCut(float noiseCut){m_emecNoiseCut = noiseCut;};
00133 
00134   /** Read the noise cut level
00135     * Useful when reading occupancy files (where it is stored)
00136     */
00137   float emecNoiseCut(){return m_emecNoiseCut;};
00138 
00139   /** Set the print level for noise computation for the emec
00140     * 0 minimum
00141     * 1 print occupancy results (default)
00142     * @param level Print level
00143     */
00144   void emecPrintLevel(int level){m_emecPrintLevel = level;};
00145 
00146   /** Set the emec occupancy file name
00147     * @param occupancyFileName the name of the occupancy file
00148     */
00149   void emecOccupancyFileName(string occupancyFileName){m_emecOccupancyFileName = occupancyFileName;};
00150 
00151   /** Get the febno keyed occupancy map
00152     * The map contains entries for all connected channels
00153     */
00154   map<int, float> emecOccupancyMap(){return m_emecOccupancyMap;};
00155 
00156   /** Get the emec occupancy
00157     * @param febno channel febno
00158     */
00159   float emecOccupancy(int febno);
00160 
00161   /** Get the febno keyed emec occupancy error estimate map
00162     * The map contains entries for all connected channels
00163     */
00164   map<int, float> emecOccupancyErrorMap(){return m_emecOccupancyErrorMap;};
00165 
00166   /** Get the emec occupancy error estimate
00167     * @param febno channel febno
00168     */
00169   float emecOccupancyError(int febno);
00170 
00171   /** Read a emec occupancy file
00172     * If no occupancy file name is given, then assume the file is
00173     * emec?_nnnnn_occupancy.dat where ? is given by the input data file name
00174     * Returns the run number in the occupancy file
00175     * @param occupancyFileName the name of the occupancy file
00176     */
00177   int emecReadOccupancyFile(string occupancyFileName = "");
00178 
00179   //! Print emec occupancy data
00180   void emecPrintOccupancy();
00181 
00182   /** Set the emec calibration file name
00183     * Needed if the ntuple data is in ADC
00184     * Must be called before emecEnable 
00185     * @param calibrationFileName the name of the calibration file
00186     */
00187   void emecCalibrationFileName(string calibrationFileName){m_emecCalibrationFileName = calibrationFileName;};
00188 
00189 private:
00190 
00191   //################################
00192   // hec private methods
00193 
00194   // write occupancy data to file
00195   void hecWriteOccupancyFile();
00196 
00197   //################################
00198   // emec private methods
00199 
00200   // write occupancy data to file
00201   void emecWriteOccupancyFile();
00202 
00203   //################################
00204   // private variables
00205 
00206   Geometry* m_geo;
00207   Event* m_event;
00208   Headers* m_runHeader;
00209   // pointer to NoiseAlg systemAlg
00210   NoiseAlg* m_noise;
00211   // pointer to CalibrationAlg systemAlg
00212   CalibrationAlg* m_calibration;
00213 
00214   //################################
00215   // hec private variables
00216 
00217   // enable flags
00218   bool m_hecEnable;
00219   // signal cut variable
00220   float m_hecNoiseCut;   // |signal| > m_hecNoiseCut*Noise
00221   // print level
00222   int m_hecPrintLevel;
00223   // occupancy result file name
00224   string m_hecOccupancyFileName;
00225   // febno keyed occupancy maps for all connected channels
00226   map<int, float> m_hecOccupancyMap;
00227   map<int, float> m_hecOccupancyErrorMap;
00228   // calibration file name
00229   string m_hecCalibrationFileName;
00230   // event counter
00231   int m_hecEvents;
00232 
00233   //################################
00234   // emec private variables
00235 
00236   // enable flags
00237   bool m_emecEnable;
00238   // signal cut variable
00239   float m_emecNoiseCut;   // |signal| > m_emecNoiseCut*Noise
00240    // print level
00241   int m_emecPrintLevel;
00242   // occupancy result file name
00243   string m_emecOccupancyFileName;
00244   // febno keyed occupancy maps for all connected channels
00245   map<int, float> m_emecOccupancyMap;
00246   map<int, float> m_emecOccupancyErrorMap;
00247   // calibration file name
00248   string m_emecCalibrationFileName;
00249   // event counter
00250   int m_emecEvents;
00251 
00252 };
00253 
00254 #endif

Generated on Fri Aug 15 10:52:04 2003 for TBRootAna by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002