00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00013
00014 #ifndef LILOOKUP_H
00015 #define LILOOKUP_H
00016
00017 #include <string>
00018 #include <vector>
00019
00020 #include "TObject.h"
00021 #include "TGraph.h"
00022 #include "TGraphAsymmErrors.h"
00023
00024 #include "Conventions/Detector.h"
00025 #include "Plex/PlexHandle.h"
00026 #include "Plex/PlexPinDiodeToLed.h"
00027
00028 class LILookup : public TObject{
00029
00030 public:
00031
00032
00033
00034
00035 typedef enum ELINearOrFarSide {
00036 kUnknownSide = 0,
00037 kNearSide = 1,
00038 kFarSide = 2
00039 } LINearOrFarSide_t;
00040
00041 LILookup();
00042 ~LILookup();
00043
00044 Double_t CalcGain(Double_t mean,Double_t rms, Double_t QE=0);
00045 Double_t CalcMean(Double_t gain,Double_t rms,Double_t QE=0);
00046 Double_t CalcMeanFromNpe(Double_t npe,Double_t rms, Double_t QE=0);
00047 Double_t CalcNpe(Double_t mean,Double_t rms, Double_t QE=0);
00048 Double_t CalcRms(Double_t mean,Double_t gain, Double_t QE=0);
00049 Int_t Chip2Pmt(Int_t chip,Int_t detectorType);
00050 Int_t ConvertEastWest(std::string sEastWest);
00051 Int_t ConvertRackLevel(std::string sRackLevel);
00052 UInt_t FindInsertPoint(const std::vector<Double_t>& v,
00053 Double_t valueToInsert);
00054 std::pair<PlexPinDiodeId,PlexPinDiodeId> GetPinDiodeIds
00055 (PlexHandle plexHandle,Int_t led);
00056 Int_t GetOppCrate(Int_t pulserBox,Int_t detectorType);
00057 Int_t GetOppPb(Int_t crate,Int_t detectorType);
00058 std::pair<Int_t,Int_t> GetPinDiodePlanes(PlexPinDiodeId pinId,
00059 PlexHandle* plexHandle);
00060 std::string GetVectorAsString(std::vector<Double_t>& v,
00061 const std::string& prefix="") const;
00062 std::string GetVectorAsString(std::vector<Int_t>& v,
00063 const std::string& prefix="") const;
00064 Double_t GetVectorPoint(const std::vector<Double_t>& v,UInt_t point);
00065 Int_t Led2Ashtray(Int_t led,Int_t plane,Int_t detectorType);
00066 Int_t NearOrFar(Int_t crate,Int_t pulserBox,
00067 Int_t farPulserBox, Int_t nearPulserBox,
00068 Int_t led,Int_t detectorType,
00069 Int_t plane,Int_t runNumber);
00070 Int_t Pb2TrigPmtChannel(Int_t pulserBox,Int_t detectorType);
00071 Int_t Plane2Pb(Int_t plane, Int_t side);
00072 Int_t Plane2PbEast(Int_t plane);
00073 Int_t Plane2PbWest(Int_t plane);
00074 Int_t Plane2Crate(Int_t plane, Int_t side,Int_t detectorType);
00075 Int_t Plane2CrateEast(Int_t plane,Int_t detectorType);
00076 Int_t Plane2CrateWest(Int_t plane,Int_t detectorType);
00077 void SetDetector(Int_t det);
00078 void SetNewPoint(std::vector<Double_t>& v,Double_t value,UInt_t i);
00079 void SetPbPlanes(Int_t *planeMin,Int_t *planeMax,
00080 Int_t detectorType);
00081 Int_t Strip2Ashtray(Int_t strip,Int_t detectorType);
00082 Int_t Strip2Led(Int_t strip,Int_t plane,Int_t detectorType,
00083 Int_t crate=0);
00084 TGraphAsymmErrors* TGraphAsymmErrorsVectEY
00085 (std::vector<Double_t>& vX,std::vector<Double_t>& vY,
00086 std::vector<Double_t>& vEX,std::vector<Double_t>& vEY);
00087 TGraph* TGraphVect(std::vector<Double_t>& vX,
00088 std::vector<Double_t>& vY);
00089 void UnencodePlnStripEndKey(Int_t plnStripEndKey,
00090 Detector::Detector_t det,
00091 Int_t& plane,Int_t& strip,
00092 Int_t& stripEnd);
00093 Int_t GetNumericMuxBox(Int_t pmtNo,Int_t detectorType=1);
00094
00095
00096 static Int_t FIRSTSTRIP;
00097 static Int_t LASTSTRIP;
00098 static Int_t NUMSTRIPS;
00099
00100 static Int_t NUMCHADD;
00101
00102 static Int_t FIRSTLED;
00103 static Int_t LASTLED;
00104 static Int_t NUMLEDS;
00105
00106 static Int_t FIRSTASHTRAY;
00107 static Int_t LASTASHTRAY;
00108 static Int_t NUMASHTRAYS;
00109
00110 static Int_t FIRSTPULSERBOX;
00111 static Int_t LASTPULSERBOX;
00112 static Int_t NUMPULSERBOXES;
00113 static Int_t NUMPULSERBOXESCURRENT;
00114
00115 static Int_t NUMCHANNELS;
00116
00117 static Int_t FIRSTCRATE;
00118 static Int_t LASTCRATE;
00119 static Int_t NUMCRATES;
00120
00121 static Int_t FIRSTVARC;
00122 static Int_t LASTVARC;
00123 static Int_t NUMVARCS;
00124
00125 static Int_t FIRSTVMM;
00126 static Int_t LASTVMM;
00127 static Int_t NUMVMMS;
00128
00129 static Int_t FIRSTVFB;
00130 static Int_t LASTVFB;
00131 static Int_t NUMVFBS;
00132
00133 static Int_t FIRSTCHIP;
00134 static Int_t LASTCHIP;
00135 static Int_t NUMCHIPS;
00136
00137 static Int_t FIRSTPMT;
00138 static Int_t LASTPMT;
00139 static Int_t NUMPMTS;
00140
00141 static Int_t FIRSTPIXEL;
00142 static Int_t LASTPIXEL;
00143 static Int_t NUMPIXELS;
00144
00145 static Int_t FIRSTPIXELSPOT;
00146 static Int_t LASTPIXELSPOT;
00147 static Int_t NUMPIXELSPOTS;
00148
00149 static Int_t FIRSTVACHANNEL;
00150 static Int_t LASTVACHANNEL;
00151 static Int_t NUMVACHANNELS;
00152
00153 static Int_t FIRSTSIDE;
00154 static Int_t LASTSIDE;
00155 static Int_t NUMSIDES;
00156
00157 static Int_t FIRSTEND;
00158 static Int_t LASTEND;
00159 static Int_t SECONDEND;
00160 static Int_t NUMENDS;
00161
00162 static Int_t NUMRACKLEVELS;
00163 static Int_t NUMLEVELS;
00164
00165 static Int_t FIRSTRACK;
00166 static Int_t LASTRACK;
00167 static Int_t NUMRACKS;
00168
00169 static Int_t FIRSTMUX;
00170 static Int_t LASTMUX;
00171 static Int_t NUMMUX;
00172
00173 static Int_t NUMPINGAINS;
00174
00175 static Int_t PB0STARTPLANE;
00176 static Int_t PB2STARTPLANE;
00177 static Int_t PB4STARTPLANE;
00178 static Int_t PB6STARTPLANE;
00179 static Int_t PB8STARTPLANE;
00180 static Int_t PB10STARTPLANE;
00181 static Int_t PB12STARTPLANE;
00182 static Int_t PB14STARTPLANE;
00183
00184 static Int_t FIRSTPLANE;
00185 static Int_t FIRSTSCINTPLANE;
00186 static Int_t LASTSM1SCINTPLANE;
00187 static Int_t FIRSTSM2PLANE;
00188 static Int_t FIRSTSM2SCINTPLANE;
00189 static Int_t LASTSCINTPLANE;
00190 static Int_t LASTPLANE;
00191 static Int_t NUMPLANES;
00192
00193 static Int_t NUMBOOKENDS;
00194 static Int_t SM1BOOKEND;
00195 static Int_t SM2BOOKEND;
00196
00197 static Int_t FIRSTSPECTROMETERPLANE;
00198
00199 private:
00200
00201 ClassDef(LILookup,0);
00202 };
00203
00204 #endif // LILOOKUP_H