Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

LIPlexMaps.h

Go to the documentation of this file.
00001 
00002 
00003 // Program name: LIPlexMaps.h
00004 //                                                                     
00005 // Package: LISummary                                         
00006 //                                                                    
00007 // Coded by Jeff Hartnell Oct/2002-Sep/2003          
00008 //                                                                    
00009 // Purpose: To create wiring maps of LI cabling using the plex 
00010 //                                                                    
00011 // Contact: jeffrey.hartnell@physics.ox.ac.uk                         
00013 
00014 #ifndef LIPLEXMAPS_H
00015 #define LIPLEXMAPS_H
00016 
00017 #include <vector>
00018 #include <string>
00019 #include <map>
00020 
00021 #include "TStyle.h"
00022 #include "TRandom.h"
00023 #include "TGraph.h"
00024 
00025 #include "DatabaseInterface/DbiResultPtr.h"
00026 #include "Plex/PlexHandle.h"
00027 #include "Plex/PlexPinDiodeToLed.h"
00028 #include "Plex/PlexStripEndToLed.h"
00029 #include "PulserCalibration/PulserRawDrift.h"
00030 #include "PulserCalibration/PulserRawDriftF.h"
00031 #include "Validity/VldContext.h"
00032 #include "Validity/VldRange.h"
00033 
00034 #include "LISummary/LILookup.h"
00035 #include "LISummary/LIPlane.h"
00036 
00037 //......................................................................
00038 
00039 class LIPulserPin
00040 {
00041   
00042   //a little class to hold the pulser raw drift pin table info
00043 
00044 public:
00045   
00046   LIPulserPin() { 
00047     mean=-1;
00048     numEnt=-1;
00049     error=-1;
00050   };
00051 
00052   Float_t mean;
00053   Float_t numEnt;
00054   Float_t error;
00055 
00056 };
00057 
00058 //......................................................................
00059 
00060 class myCalStripToStrip
00061 {
00062   //a little class to hold the CalStripToStrip objects data since they
00063   //can't be copy constructed
00064 
00065 public:
00066   
00067   myCalStripToStrip() { 
00068     seid_enc=-1;
00069     response=-1;
00070     responseErr=-1;
00071   };
00072 
00073   myCalStripToStrip(Int_t s,Float_t r,Float_t rErr) { 
00074     seid_enc=s;
00075     response=r;
00076     responseErr=rErr;
00077   };
00078 
00079   Int_t seid_enc;
00080   Float_t response;
00081   Float_t responseErr;
00082 };
00083 
00084 //......................................................................
00085 
00086 class LIPlexMaps : public LILookup
00087 {
00088 
00089  public:  
00090   
00091   LIPlexMaps();
00092   ~LIPlexMaps();
00093 
00094   void CompareStripToStrip(Int_t det,VldTimeStamp ts,Int_t taskA,
00095                            Int_t taskB);
00096   void DriftWithTime(VldRange vldRng,Float_t pointSpacingMinutes=20);
00097   std::map<Int_t,Float_t> GetRawPinMap(VldContext vldCtx);
00098   std::map<PlexLedId,LIPulserPin> GetRawPinLedMap(VldContext vldCtx); 
00099   std::map<Int_t,LIPulserPin> GetRefAdcPinRatio(VldContext vldCtx);
00100   //map<Int_t,LIPulserPin> GetPulserRawDrift
00101   //(DbiResultPtr<PulserRawDrift> dbiPulserRawDrift,VldContext vldCtx);
00102   void DumpCalStripToStrip(std::string sDataFileName,
00103                            Detector::Detector_t det,
00104                            SimFlag::ESimFlag simFlag,
00105                            VldTimeStamp ts,Int_t task) const;
00106   void DumpCalStripAtten(std::string sDataFileName,
00107                          Detector::Detector_t det,
00108                          SimFlag::ESimFlag simFlag,
00109                          VldTimeStamp ts,Int_t task);
00110 
00111 //  void DumpGains(Detector::Detector_t det, VldTimeStamp ts,
00112 //               std::string gaindump_filename);
00113 
00114   Bool_t IsPermitted() const;
00115 
00116   void MakeCalAdcToPe(std::string gainsFileName,
00117                       Detector::Detector_t det,
00118                       SimFlag::ESimFlag simFlag,
00119                       VldTimeStamp vldStart,VldTimeStamp vldEnd,
00120                       Int_t aggNo,Int_t task,
00121                       Int_t aggStat[484],
00122                       VldTimeStamp creationDate,std::string dbName,
00123                       std::string sLogComment,
00124                       Int_t gainTooHigh,Int_t gainCeiling,
00125                       Bool_t writeToDb=false);
00126   void MakeCalStripToStrip(std::string sDataFileName,
00127                            Detector::Detector_t det,
00128                            SimFlag::ESimFlag simFlag,
00129                            VldTimeStamp vldStart,VldTimeStamp vldEnd,
00130                            Int_t aggNo,Int_t task,
00131                            VldTimeStamp creationDate,std::string dbName,
00132                            std::string sLogComment,
00133                            Bool_t writeToDb=false);
00134   void MakeCalStripAtten(std::string sDataFileName,
00135                          Detector::Detector_t det,
00136                          SimFlag::ESimFlag simFlag,
00137                          VldTimeStamp vldStart,VldTimeStamp vldEnd,
00138                          Int_t aggNo,Int_t task,
00139                          VldTimeStamp creationDate,std::string dbName,
00140                          std::string sLongComment,
00141                          Int_t iFileFormat,
00142                          Bool_t writeToDb=false);
00143   void MakeCalMIPCalibration(Float_t scale,
00144                              Detector::Detector_t det,
00145                              SimFlag::ESimFlag simFlag,
00146                              VldTimeStamp vldStart,
00147                              VldTimeStamp vldEnd,
00148                              Int_t aggNo,Int_t task,
00149                              VldTimeStamp creationDate,
00150                              std::string dbName,std::string sLogComment,
00151                              Bool_t writeToDb);
00152   void MakePinPlexTables();
00153   void MakePlexStripEndToLed(Bool_t writeToDb=false); 
00154   void NormaliseVector(std::vector<Double_t>& v,Int_t mode=1);
00155   void PlotPlexPinMap();
00156   void PlotPlexStripMap(Int_t detectorType);
00157   void PrintPlexPinDiodeInfo(Int_t detectorType);
00158   void PrintDbPinDiodeInfo();
00159   void RatioRawToRefDrift();
00160   void ReadDbCalStripToStrip(Int_t det,VldTimeStamp ts,Int_t task);
00161   void ReadDbCalStripAtten(Int_t det,VldTimeStamp ts, Int_t task);
00163   void ReadDbGains(Int_t det,SimFlag::ESimFlag simFlag,VldTimeStamp ts,std::string runNumber,std::string sAgg,Int_t task=0);
00164   // Remake this as a less bloated function, to grab the detector gains avearge
00165   Double_t ReadDbGainAverage(Detector::Detector_t det, VldTimeStamp ts, VldTimeStamp *end = 0, VldTimeStamp *start = 0);
00166   TH1D *ReadDbGains(Detector::Detector_t det, VldTimeStamp ts);
00167   std::map<Int_t,Double_t> GetGainMap(Detector::Detector_t det, VldTimeStamp ts);
00168   TH1D GainDifference(Detector::Detector_t det, VldTimeStamp t1, VldTimeStamp t2);
00169   TH2D GainDifferenceSvP(Detector::Detector_t det, VldTimeStamp t1, VldTimeStamp t2);
00171   void DumpGains(Detector::Detector_t det, VldTimeStamp ts, std::string filename);
00172   
00173   void ReadDbPulserDrift(Int_t det,VldTimeStamp ts);
00174   void ReadDbPulserDriftPin();
00175   void ReadDbPulserRawGain(); 
00176   void SetGraphAxisEtc(TGraph* g,Int_t startTimeSecs,Int_t endTimeSecs);
00177 
00178   //MC methods
00179   void ADCRailEffect();
00180   void Attenuation();
00181   void BinomialGen(std::vector<Double_t>& v,Int_t N,Double_t p);
00182   void FactorialGen(std::vector<Double_t>& v);
00183   void LIErrors();
00184   void NonLinearity();
00185   void PeGen();
00186   Int_t SampleDist(std::vector<Double_t> v,TRandom* tRand);
00187   void ScaleVector(std::vector<Double_t>& v,Double_t scaleFactor);
00188 
00189  private:
00190 
00191   std::string GetElecString(RawChannelId rChId);
00192   std::string fS;//a general purpose string
00193   Bool_t IsScintStrip(PlexStripEndId& stripEndId,
00194                       PlexHandle* plexHandle);
00195 
00196   //data members:
00197   LILookup fLookup;
00198 
00199   ClassDef(LIPlexMaps,0)
00200 };
00201 
00202 //......................................................................
00203 
00204 #endif // LIPLEXMAPS_H

Generated on Mon Feb 15 11:06:52 2010 for loon by  doxygen 1.3.9.1