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

PulserTimePlotter.cxx

Go to the documentation of this file.
00001 
00002 //
00003 // $Id: PulserTimePlotter.cxx,v 1.3 2006/04/19 20:00:55 rhatcher Exp $
00004 //
00005 // Plots time variation of various pulser calibration constants 
00006 // and so on
00007 //
00008 // Author: Phil Adamson 9/2002
00009 //
00010 // $Log: PulserTimePlotter.cxx,v $
00011 // Revision 1.3  2006/04/19 20:00:55  rhatcher
00012 // convert DetectorType:: to Detector:: everywhere.
00013 //
00014 // Revision 1.2  2002/10/04 16:40:57  rhatcher
00015 // introduces "using std::{vector,cout,endl}" for loss of "using namespace std"
00016 // re-order ctor initialization to match declaration order
00017 //
00018 // Revision 1.1  2002/10/01 16:58:32  phil.adamson
00019 // PulserTimePlotter isn't workimng, but it compiles, so it won't break
00020 // anything else. Cosmetic changes.
00021 //
00022 //
00024 
00025 #include "PulserCalibration/PulserTimePlotter.h"
00026 #include "PulserCalibration/PulserRawDriftPin.h"
00027 #include "Plex/PlexPinDiodeId.h"
00028 #include "DatabaseInterface/DbiResultPtr.h"
00029 #include <vector>
00030 
00031 using std::vector;
00032 using std::cout;
00033 using std::endl;
00034 
00035 ClassImp(PulserTimePlotter)
00036 
00037   
00038 
00039 PulserTimePlotter::PulserTimePlotter(VldContext vc)
00040   : fStartVC(vc), fVC(vc), fPlex(vc)
00041 {
00042 
00043 }
00044 
00045 PulserTimePlotter::~PulserTimePlotter()
00046 {
00047 
00048 }
00049 
00050 TGraphErrors * PulserTimePlotter::CreateGraph(PlexLedId &led, int gain)
00051 {
00052   vector<float> mean;
00053   vector<float> error;
00054   vector<float> secs;
00055   int sec;
00056   // Find the correct PIN diode, pull it from the DB.
00057   std::pair<PlexPinDiodeId,PlexPinDiodeId> pinids =
00058     fPlex.GetPinDiodeIds(led);
00059   const PulserRawDriftPin *pin;
00060   DbiResultPtr<PulserRawDriftPin> pinRP(fStartVC);
00061   for (;;) {
00062     cout<<"In loop "<<*(pinRP.GetValidityRec())<<endl;
00063     if (pinRP.GetNumRows()>0) {
00064       switch (gain) {
00065       case 0:
00066         pin = pinRP.GetRowByIndex(pinids.second.GetEncoded());
00067         break;
00068       case 1:
00069         pin = pinRP.GetRowByIndex(pinids.first.GetEncoded());
00070         break;
00071       default:
00072         cout<<"You asked for non-existent gain "<<gain<<endl;
00073         return 0;
00074       }
00075       if (!pin) {
00076         cout<<"Couldn't get PIN data for gain "<<gain<<" of led "<<led<<endl;
00077         return 0;
00078       }
00079       cout<<pin->GetMean()<<" "<<pin->GetError()<<endl;
00080       mean.push_back(pin->GetMean());
00081       error.push_back(pin->GetError());
00082       sec = pinRP.GetValidityRec()->GetVldRange().GetTimeStart().GetSec();
00083       secs.push_back(sec);
00084     }
00085     // if (pinRP.NextQuery()==0) break;
00086     int ntime = pinRP.GetValidityRec()->GetVldRange().GetTimeEnd().GetSec() + 1;
00087     VldContext v(Detector::Detector_t(pinRP.GetValidityRec()->GetVldRange().GetDetectorMask()),
00088                  SimFlag::SimFlag_t(pinRP.GetValidityRec()->GetVldRange().GetSimMask()),
00089                  VldTimeStamp(ntime,0));
00090     cout<<v<<endl;
00091     if (pinRP.NewQuery(v,pinRP.GetValidityRec()->GetTask())==0) break;
00092   }
00093   TGraphErrors *g = new TGraphErrors(mean.size(),&(secs[0]),0,&(mean[0]),&(error[0]));
00094   return g;
00095 }

Generated on Mon Nov 23 05:28:08 2009 for loon by  doxygen 1.3.9.1