00001
00002
00004
00005 #include "PEGain/PEGainMuxBox.h"
00006 #include "MessageService/MsgService.h"
00007 #include "TGraphErrors.h"
00008
00009 ClassImp(PEGainMuxBox)
00010
00011 CVSID("$Id: PEGainMuxBox.cxx,v 1.1 2003/02/24 14:54:27 rjn Exp $");
00012
00013
00014
00015 PEGainMuxBox::PEGainMuxBox()
00016 {
00017
00018 MSG("PEGain",Msg::kVerbose) << "PEGainMuxBox::PEGainMuxBox()\n";
00019
00020 }
00021
00022
00023 PEGainMuxBox::~PEGainMuxBox()
00024 {
00025
00026 MSG("PEGain",Msg::kVerbose) << "PEGainMuxBox::~PEGainMuxBox()\n";
00027
00028 }
00029
00030
00031 void PEGainMuxBox::New(RawChannelId &rcid,PlexHandle &plex) {
00032 fRcid=rcid;
00033 fRcid.SetVaChip(0);
00034 fPlane=plex.GetSEIdAltL(rcid).GetPlane();
00035 fEnd=plex.GetSEIdAltL(rcid).GetEnd();
00036
00037 }
00038
00039 void PEGainMuxBox::AddRealHit(const PulserSummary &ps,const RawChannelId &rcid)
00040 {
00041 MSG("PEGain",Msg::kVerbose) << "PEGainMuxBox::AddRealHit()\n";
00042
00043 fRealHits.insert(make_pair(rcid.GetEncoded(),ps));
00044 }
00045
00046 void PEGainMuxBox::AddOtherHit(const PulserSummary &ps,const RawChannelId &rcid)
00047 {
00048 MSG("PEGain",Msg::kVerbose) << "PEGainMuxBox::AddRealHit()\n";
00049
00050 fOtherHits.insert(make_pair(rcid.GetEncoded(),ps));
00051 }
00052
00053 int PEGainMuxBox::GetPixel(int channel) {
00054 Int_t pixelnums[16]={15,1,16,2,11,5,12,6,7,9,8,10,3,14,4,13};
00055 if(channel<2 || channel>17) return -1;
00056 return pixelnums[channel-2];
00057
00058 }
00059
00060 TMultiGraph *PEGainMuxBox::MakeGraphs(char *tag) {
00061 char name[180];
00062
00063
00064
00065 sprintf(name,"pl%d_end%d_%s",fPlane,fEnd,tag);
00066 TMultiGraph *mg = new TMultiGraph(name,name);
00067
00068 Int_t pmtNums[3]={0,2,1};
00069 Int_t numRealHits=fRealHits.size();
00070 Int_t numOtherHits=fOtherHits.size();
00071 Int_t uptoPoint=0;
00072
00073
00074 if(numRealHits>0) {
00075 TGraphErrors *grReal = new TGraphErrors(numRealHits);
00076 for (std::map<UInt_t,PulserSummary>::iterator it =
00077 fRealHits.begin();
00078 it!=fRealHits.end(); it++) {
00079 RawChannelId rcid((*it).second.GetChannel());
00080 Int_t tempVaChip=rcid.GetVaChip();
00081 Int_t tempPmt=pmtNums[tempVaChip];
00082 Int_t tempVaChannel=rcid.GetVaChannel();
00083 Int_t tempPixel=GetPixel(tempVaChannel);
00084 Double_t x=(double)tempPixel+20*tempPmt;
00085 Double_t y=(*it).second.GetMean();
00086 Double_t ex=0;
00087 Double_t ey=(*it).second.GetError();
00088 grReal->SetPoint(uptoPoint,x,y);
00089 grReal->SetPointError(uptoPoint,ex,ey);
00090 uptoPoint++;
00091 }
00092 grReal->SetMarkerColor(kRed);
00093 sprintf(name,"real_pl%d_end%d_%s",fPlane,fEnd,tag);
00094 grReal->SetNameTitle(name,name);
00095 mg->Add(grReal,"p");
00096 }
00097
00098 if(numOtherHits>0) {
00099 TGraphErrors *grOther = new TGraphErrors(numOtherHits);
00100 uptoPoint=0;
00101 for (std::map<UInt_t,PulserSummary>::iterator it =
00102 fOtherHits.begin();
00103 it!=fOtherHits.end(); it++) {
00104 RawChannelId rcid((*it).second.GetChannel());
00105 Int_t tempVaChip=rcid.GetVaChip();
00106 Int_t tempPmt=pmtNums[tempVaChip];
00107 Int_t tempVaChannel=rcid.GetVaChannel();
00108 Int_t tempPixel=GetPixel(tempVaChannel);
00109 Double_t x=(double)tempPixel+20*tempPmt;
00110 Double_t y=(*it).second.GetMean();
00111 Double_t ex=0;
00112 Double_t ey=(*it).second.GetError();
00113 grOther->SetPoint(uptoPoint,x,y);
00114 grOther->SetPointError(uptoPoint,ex,ey);
00115 uptoPoint++;
00116 grOther->SetMarkerColor(kBlue);
00117 sprintf(name,"other_pl%d_end%d_%s",fPlane,fEnd,tag);
00118 grOther->SetNameTitle(name,name);
00119 mg->Add(grOther,"p");
00120
00121 }
00122 }
00123 return mg;
00124
00125 }