| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

PmtCalibLeadingEdge.h

Go to the documentation of this file.
00001 /*
00002  *  PmtCalibLeadingEdge.h
00003  *  
00004  *  Generate calibration fit parameters from PMT data
00005  *
00006  *  This method uses the leading edge of the signals on each channel
00007  *  to determine timing offsets.
00008  * 
00009  * dandwyer@caltech.edu 2009/01/08
00010  */
00011 
00012 #ifndef PMTCALIBLEADINGEDGE_H
00013 #define PMTCALIBLEADINGEDGE_H
00014 
00015 #include "CalibParam/IPmtCalibParamTool.h"
00016 #include "GaudiAlg/GaudiTool.h"
00017 #include "Conventions/Electronics.h"
00018 #include "Conventions/Detectors.h"
00019 #include "Context/Context.h"
00020 #include <fstream>
00021 #include <string>
00022 #include <vector>
00023 #include "FloatingFeePedestalSvc/IFloatingFeePedestalSvc.h"
00024 
00025 using namespace std;
00026 
00027 namespace DayaBay{
00028   class ReadoutHeader;
00029 }
00030 
00031 class IStatisticsSvc;
00032 class ICableSvc;
00033 class ICalibDataSvc;
00034 
00035 /*
00036 // Statistics container class for one PMT channel
00037 class PmtStatsOneChannelLE {
00038  public:
00039   PmtStatsOneChannelLE(const DayaBay::FeeChannelId& channelId)
00040     { m_channelId = channelId; m_nHits = 0; m_tdcRaw=0; m_tdcByMedian=0; 
00041       m_adcRaw=0; m_adc=0; m_adcByClock=0;}
00042   ~PmtStatsOneChannelLE(){;}
00043  public:
00044   DayaBay::FeeChannelId m_channelId;
00045   DayaBay::AdPmtSensor m_pmtId;
00046   int m_nHits;
00047   TH1F* m_tdcRaw;
00048   TH1F* m_tdcByMedian;
00049   TH1F* m_adcRaw;
00050   TH1F* m_adc;
00051   TH1F* m_adcByClock;
00052 };
00053 
00054 // Statistics container class for one detector
00055 class PmtStatsLE {
00056  public:
00057   PmtStatsLE(const DayaBay::Detector& detector){m_detector=detector; 
00058     m_nReadouts=0;}
00059   ~PmtStatsLE(){;}
00060  public:
00061   DayaBay::Detector m_detector;
00062   std::map<DayaBay::FeeChannelId,PmtStatsOneChannelLE*> m_channel;
00063   int m_nReadouts;
00064   TH1F* m_adcSum;
00065   TH1F* m_tdcMedian;
00066   std::map<int, TH1F*> m_occupancy;
00067   std::map<int, TH1F*> m_tdcOffset;
00068   std::map<int, TH1F*> m_adcMedian;
00069   std::map<int, TH1F*> m_adcSigma;
00070 };
00071 */
00072 
00073 class PmtCalibLeadingEdge : public GaudiTool, virtual public IPmtCalibParamTool
00074 {
00075  public:
00076   PmtCalibLeadingEdge(const std::string& type,
00077                       const std::string& name,
00078                       const IInterface* parent);
00079 
00080   virtual ~PmtCalibLeadingEdge();
00081 
00082   virtual StatusCode initialize();
00083   virtual StatusCode finalize();
00084 
00086   
00089   virtual StatusCode process(const DayaBay::ReadoutHeader& readout);
00090   
00094   virtual StatusCode calibrate();
00095   
00096  private:
00098   bool hasStats(const DayaBay::Detector& detector);
00100   StatusCode prepareStats(const Context& context);
00101 
00102   // Format path to detector statistics
00103   std::string getPath(const DayaBay::Detector& detector);
00104   // Format path to detector, ring statistics
00105   std::string getPath(const DayaBay::Detector& detector, int ring);
00106   // Format path to channel statistics
00107   std::string getPath(const DayaBay::FeeChannelId& channelId);
00108 
00109   // Tdc cut
00110   bool GoodTdc(int Tdc)
00111     {
00112       if(Tdc>900&&Tdc<1050) return true;
00113       else return false;
00114     };
00115 
00116  private:
00117     
00118   // Property CableSvcName - Name of the cable service
00119   std::string m_cableSvcName;
00120 
00121   // Property CalibSvcName - Name of the calibration service
00122   std::string m_calibSvcName;
00123 
00124   // Property FloatFeePedesSvcName - Name of floating fee pedestal service
00125   std::string m_floatFeePedesSvcName;
00126 
00127   // Property FilePath - File path of registered histograms
00128   std::string m_filepath;
00129 
00130   // CableSvc
00131   ICableSvc *m_cableSvc;
00132 
00133   // CalibSvc
00134   ICalibDataSvc *m_calibSvc;
00135 
00136   // IStatisticsSvc
00137   IStatisticsSvc *m_statsSvc;
00138 
00139   // IFloatingFeePedestalSvc;
00140   IFloatingFeePedestalSvc *m_floatFeePedesSvc;
00141 
00142   // Use FloatFeePedes or not? In case of false, it will use CalibSvc.
00143   bool m_useFloatFeePedes;
00144 
00145   // Cached list of processed detectors
00146   std::vector<DayaBay::Detector> m_processedDetectors;
00147 
00148   // text output
00149   ofstream m_textFile;
00150   string m_textFileName;
00151 };
00152 
00153 #endif  // PMTCALIBLEADINGEDGE_H
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:29:39 2011 for CalibParam by doxygen 1.4.7