Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members

CalCalibSvc Class Reference

Instatiates ICalCalibSvc interface, gets data from CalibDataSvc. More...

#include <CalCalibSvc.h>

Inheritance diagram for CalCalibSvc:

Inheritance graph
[legend]
Collaboration diagram for CalCalibSvc:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CalCalibSvc (const string &name, ISvcLocator *pSvcLocator)
StatusCode initialize ()
 intialize / retrieve all needed Gaudi based objects

StatusCode finalize ()
StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown)
 queryInterface - for implementing a Service this is necessary

const InterfaceID & type () const
 return the service type

const CalibData::CalMevPerDac * getMPD (CalUtil::XtalIdx xtalIdx)
 get calibration for given crystal

const std::vector< float > * getInlAdc (CalUtil::RngIdx rngIdx)
 get adc points for given intNonlin (cidac2adc) calibration curve

const std::vector< float > * getInlCIDAC (CalUtil::RngIdx rngIdx)
 get cidac points for given intNonlin calibration curve

StatusCode getPed (CalUtil::RngIdx rngIdx, float &ped)
 get pedestal calibration data for given adc channel

StatusCode getPedSig (CalUtil::RngIdx rngIdx, float &sig)
const CalibData::CalAsym * getAsym (CalUtil::XtalIdx xtalIdx)
 get asymmetry calib data for give crystal

const CalibData::Xpos * getAsymXpos ()
 get positions in mm from center of xtal for asymmetry calibratoin data points

const CalibData::CalTholdCI * getTholdCI (CalUtil::FaceIdx faceIdx)
 get threshold calib values for given crystal face

StatusCode evalCIDAC (CalUtil::RngIdx rngIdx, float adc, float &cidac)
 calculate associated cidac (charge-injection dac) signal level for given channel and adc value.

StatusCode evalADC (CalUtil::RngIdx rngIdx, float cidac, float &adc)
 calculate associated adc value for given channel and cidac (charge-injection dac) setting

StatusCode evalAsym (CalUtil::XtalIdx xtalIdx, CalUtil::AsymType asymType, float pos, float &asym)
 calculate light asymmetry value for given crystal and crystal position

StatusCode evalPos (CalUtil::XtalIdx xtalIdx, CalUtil::AsymType asymType, float asym, float &pos)
 calculate crystal longitudinal position for energy deposit with given light asymmetry.

StatusCode evalFaceSignal (CalUtil::RngIdx rngIdx, float adc, float &ene)
 calculate associated MeV deposit @ center of crystal that would result in given ADC readout for given ADC channel

StatusCode getMPDDiode (CalUtil::DiodeIdx diodeIdx, float &mpdDiode)
 get MeVPerDAC value for single diode (instead of both faces)

StatusCode getAsymCtr (CalUtil::XtalIdx xtalIdx, CalUtil::AsymType asymType, float &asymCtr)
 get light asymmetry associated with deposit at center of given crystal


Static Public Attributes

const unsigned short INCIDENT_PRIORITY = 50
 'BeginEvent' handle needs lower priority (higher number) than CalibDataSvc


Private Member Functions

void handle (const Incident &inc)
 hook the BeginEvent so that we can check our validity once per event.

int getSerNoPed ()
 get calib db serial number for current calibration data

int getSerNoINL ()
 get calib db serial number for current calibration data

int getSerNoAsym ()
 get calib db serial number for current calibration data

int getSerNoMPD ()
 get calib db serial number for current calibration data

int getSerNoTholdCI ()
 get calib db serial number for current calibration data


Private Attributes

StringProperty m_defaultFlavor
 default flavor for all calib types, unless otherwise specified.

StringProperty m_flavorIntNonlin
 calib flavor override for int-nonlin constants

StringProperty m_flavorAsym
 calib flavor override for asymmetry constants

StringProperty m_flavorPed
 calib flavor override for ped constants

StringProperty m_flavorMPD
 calib flavor override for MeVPerDac constants

StringProperty m_flavorTholdCI
 calib flavor override for CI measured thresholds

StringProperty m_temperatureFile
 file with CU CAL tower temperature measurements

StringProperty m_pedTempCorFile
 file with pedestal temperature correction data

vector< int > m_tempTime
 CU temperature measurements table.

vector< float > m_cuTwrTemp [4]
float m_cur_temp_twr [4]
int m_nEvent
CalUtil::CalVec< CalUtil::RngIdx,
float > 
m_pedT0
 CU pedestal temperature correction data.

CalUtil::CalVec< CalUtil::RngIdx,
float > 
m_pedTempCoef
CalCalibShared m_ccsShared
 this class is shared amongt the CalibItemMgr classes

PedMgr m_pedMgr
 manage calibration data of given data type

IntNonlinMgr m_inlMgr
 manage calibration data of given data type

AsymMgr m_asymMgr
 manage calibration data of given data type

MPDMgr m_mpdMgr
 manage calibration data of given data type

TholdCIMgr m_tholdCIMgr
 manage calibration data of given data type

IDataProviderSvc * m_eventSvc
bool m_gotPedTime
 set to true when we have retrieved event time for current event.


Detailed Description

Instatiates ICalCalibSvc interface, gets data from CalibDataSvc.

Author:
Z.Fewtrell
handles:

jobOptions:

Definition at line 51 of file CalCalibSvc.h.


Constructor & Destructor Documentation

CalCalibSvc::CalCalibSvc const string &  name,
ISvcLocator *  pSvcLocator
 

Definition at line 33 of file CalCalibSvc.cxx.

References CalCalibShared::m_calibDataSvcName, m_ccsShared, m_defaultFlavor, m_flavorAsym, m_flavorIntNonlin, m_flavorMPD, m_flavorPed, m_flavorTholdCI, CalCalibShared::m_idealCalibXMLPath, m_pedTempCorFile, and m_temperatureFile.

00034   : Service(name,Svc),
00035     m_nEvent(0),
00036     m_pedT0(CalUtil::RngIdx::N_VALS,-5000),
00037     m_pedTempCoef(CalUtil::RngIdx::N_VALS,0),
00038     m_pedMgr(m_ccsShared),
00039     m_inlMgr(m_ccsShared),
00040     m_asymMgr(m_ccsShared),
00041     m_mpdMgr(m_ccsShared),
00042     m_tholdCIMgr(m_ccsShared),
00043     m_eventSvc(0),
00044     m_gotPedTime(false)
00045 {
00046   // declare the properties
00047   declareProperty("CalibDataSvc",      m_ccsShared.m_calibDataSvcName = 
00048                   "CalibDataSvc");
00049   declareProperty("idealCalibXMLPath", m_ccsShared.m_idealCalibXMLPath = 
00050                   "$(CALUTILXMLPATH)/idealCalib_flight.xml");
00051   declareProperty("DefaultFlavor", m_defaultFlavor    
00052                   = "ideal");
00053   declareProperty("FlavorIntNonlin", m_flavorIntNonlin  = "");
00054   declareProperty("FlavorAsym",      m_flavorAsym       = "");
00055   declareProperty("FlavorPed",       m_flavorPed        = "");
00056   declareProperty("FlavorMeVPerDac", m_flavorMPD        = "");
00057   declareProperty("FlavorTholdCI",   m_flavorTholdCI    = "");
00058   declareProperty("TemperatureFile",   m_temperatureFile    = "");
00059   declareProperty("PedTempCor",   m_pedTempCorFile    = "");
00060 }


Member Function Documentation

StatusCode CalCalibSvc::evalADC CalUtil::RngIdx  rngIdx,
float  cidac,
float &  adc
[inline, virtual]
 

calculate associated adc value for given channel and cidac (charge-injection dac) setting

Implements ICalCalibSvc.

Definition at line 100 of file CalCalibSvc.h.

References IntNonlinMgr::evalADC(), and m_inlMgr.

00100                                                                        {
00101     return m_inlMgr.evalADC(rngIdx, cidac, adc);
00102   }

StatusCode CalCalibSvc::evalAsym CalUtil::XtalIdx  xtalIdx,
CalUtil::AsymType  asymType,
float  pos,
float &  asym
[inline, virtual]
 

calculate light asymmetry value for given crystal and crystal position

Implements ICalCalibSvc.

Definition at line 105 of file CalCalibSvc.h.

References AsymMgr::evalAsym(), and m_asymMgr.

00106                                                 {
00107     return m_asymMgr.evalAsym(xtalIdx, asymType, pos, asym);
00108   }

StatusCode CalCalibSvc::evalCIDAC CalUtil::RngIdx  rngIdx,
float  adc,
float &  cidac
[inline, virtual]
 

calculate associated cidac (charge-injection dac) signal level for given channel and adc value.

Implements ICalCalibSvc.

Definition at line 94 of file CalCalibSvc.h.

References IntNonlinMgr::evalCIDAC(), and m_inlMgr.

Referenced by evalFaceSignal().

00094                                                                          {
00095     return m_inlMgr.evalCIDAC(rngIdx, adc, cidac);
00096   }

StatusCode CalCalibSvc::evalFaceSignal CalUtil::RngIdx  rngIdx,
float  adc,
float &  ene
[virtual]
 

calculate associated MeV deposit @ center of crystal that would result in given ADC readout for given ADC channel

Implements ICalCalibSvc.

Definition at line 250 of file CalCalibSvc.cxx.

References evalCIDAC(), and getMPDDiode().

00250                                                                                           {
00251   StatusCode sc;
00252 
00253   // adc -> cidac
00254   float cidac;
00255   sc = evalCIDAC(rngIdx, adcPed, cidac);
00256   if (sc.isFailure()) return sc;
00257 
00258   float mpdDiode;
00259   sc = getMPDDiode(rngIdx.getDiodeIdx(), mpdDiode);
00260   if (sc.isFailure()) return StatusCode::FAILURE;
00261 
00262   ene = cidac*mpdDiode;
00263   
00264   return StatusCode::SUCCESS;
00265 }

StatusCode CalCalibSvc::evalPos CalUtil::XtalIdx  xtalIdx,
CalUtil::AsymType  asymType,
float  asym,
float &  pos
[inline, virtual]
 

calculate crystal longitudinal position for energy deposit with given light asymmetry.

Implements ICalCalibSvc.

Definition at line 113 of file CalCalibSvc.h.

References AsymMgr::evalPos(), and m_asymMgr.

00114                                                {
00115     return m_asymMgr.evalPos(xtalIdx, asymType, asym, pos);
00116   }

StatusCode CalCalibSvc::finalize  )  [inline]
 

Definition at line 60 of file CalCalibSvc.h.

00060 {return StatusCode::SUCCESS;}

const CalibData::CalAsym* CalCalibSvc::getAsym CalUtil::XtalIdx  xtalIdx  )  [inline, virtual]
 

get asymmetry calib data for give crystal

Implements ICalCalibSvc.

Definition at line 84 of file CalCalibSvc.h.

References AsymMgr::getAsym(), and m_asymMgr.

00084 {return m_asymMgr.getAsym(xtalIdx);}

StatusCode CalCalibSvc::getAsymCtr CalUtil::XtalIdx  xtalIdx,
CalUtil::AsymType  asymType,
float &  asymCtr
[inline, virtual]
 

get light asymmetry associated with deposit at center of given crystal

Implements ICalCalibSvc.

Definition at line 126 of file CalCalibSvc.h.

References AsymMgr::getAsymCtr(), and m_asymMgr.

Referenced by getMPDDiode().

00127                                         {
00128     return m_asymMgr.getAsymCtr(xtalIdx, asymType, asymCtr);
00129   }

const CalibData::Xpos* CalCalibSvc::getAsymXpos  )  [inline, virtual]
 

get positions in mm from center of xtal for asymmetry calibratoin data points

Implements ICalCalibSvc.

Definition at line 88 of file CalCalibSvc.h.

References AsymMgr::getXpos(), and m_asymMgr.

00088 {return m_asymMgr.getXpos();}

const std::vector<float>* CalCalibSvc::getInlAdc CalUtil::RngIdx  rngIdx  )  [inline, virtual]
 

get adc points for given intNonlin (cidac2adc) calibration curve

Implements ICalCalibSvc.

Definition at line 72 of file CalCalibSvc.h.

References IntNonlinMgr::getInlAdc(), and m_inlMgr.

00072                                                           {
00073     return m_inlMgr.getInlAdc(rngIdx);}

const std::vector<float>* CalCalibSvc::getInlCIDAC CalUtil::RngIdx  rngIdx  )  [inline, virtual]
 

get cidac points for given intNonlin calibration curve

Implements ICalCalibSvc.

Definition at line 76 of file CalCalibSvc.h.

References IntNonlinMgr::getInlCIDAC(), and m_inlMgr.

00076                                                             {
00077     return m_inlMgr.getInlCIDAC(rngIdx);}

const CalibData::CalMevPerDac* CalCalibSvc::getMPD CalUtil::XtalIdx  xtalIdx  )  [inline, virtual]
 

get calibration for given crystal

Implements ICalCalibSvc.

Definition at line 69 of file CalCalibSvc.h.

References MPDMgr::getMPD(), and m_mpdMgr.

Referenced by getMPDDiode().

00069 {return m_mpdMgr.getMPD(xtalIdx);}

StatusCode CalCalibSvc::getMPDDiode CalUtil::DiodeIdx  diodeIdx,
float &  mpdDiode
[virtual]
 

get MeVPerDAC value for single diode (instead of both faces)

Implements ICalCalibSvc.

Definition at line 343 of file CalCalibSvc.cxx.

References getAsymCtr(), and getMPD().

Referenced by evalFaceSignal().

00343                                                                                    {
00344   const XtalIdx xtalIdx(diodeIdx.getXtalIdx());
00345 
00346   // MeVPerDAC
00347   // need to create tmp rngIdx w/ only twr/lyr/col info
00348   CalibData::CalMevPerDac const*const calMPD = getMPD(xtalIdx);
00349   if (!calMPD) return StatusCode::FAILURE;
00350 
00351   float mpd;
00352   float asymCtr;
00353 
00354   // get overall asymmetry & mpd for this xtal
00355   StatusCode sc;
00356   if (diodeIdx.getDiode() == LRG_DIODE) {
00357     mpd = calMPD->getBig()->getVal();
00358     sc = getAsymCtr(xtalIdx, ASYM_LL, asymCtr);
00359     if (sc.isFailure()) return sc;
00360   }
00361   else { // diode == SM_DIODE
00362     mpd = calMPD->getSmall()->getVal();
00363     sc = getAsymCtr(xtalIdx, ASYM_SS, asymCtr);
00364     if (sc.isFailure()) return sc;
00365   }
00366 
00367   // correct for overall asymmetry of diodes (use asym at center
00368   // of xtal)
00369   if (diodeIdx.getFace() == POS_FACE)
00370     mpd *= exp(-1*asymCtr/2);
00371   else // face == NEG_FACE
00372     mpd *= exp(asymCtr/2);
00373 
00374   mpdDiode = mpd;
00375 
00376 
00377   return StatusCode::SUCCESS;
00378 }

StatusCode CalCalibSvc::getPed CalUtil::RngIdx  rngIdx,
float &  ped
[virtual]
 

get pedestal calibration data for given adc channel

Implements ICalCalibSvc.

Definition at line 268 of file CalCalibSvc.cxx.

References PedMgr::getPed(), m_cur_temp_twr, m_cuTwrTemp, m_eventSvc, m_gotPedTime, m_nEvent, m_pedMgr, m_pedT0, m_pedTempCoef, m_pedTempCorFile, m_temperatureFile, and m_tempTime.

00269 {
00270 
00271   static const facilities::Timestamp bt06Start("2006-7-28 00:00");
00272   static const facilities::Timestamp missionStart("2001-1-1 00:00");
00273   static const unsigned bt06Sec = (unsigned) bt06Start.getClibTime();
00274   static const unsigned missionSec = (unsigned) missionStart.getClibTime();
00275 
00276   MsgStream msglog(msgSvc(), name()); 
00277 
00278   if (m_gotPedTime == false) {
00279     SmartDataPtr<Event::EventHeader> eventHeader(m_eventSvc, "/Event");
00280   
00281     if (!eventHeader) {
00282       msglog << MSG::ERROR << "Unable to retrieve event timestamp for digis" 
00283              << endreq;
00284       return 0;
00285     }
00286     
00287     m_nEvent++;
00288  
00289   if(m_pedTempCorFile.value() != "" && m_temperatureFile.value() != ""){
00290 
00291     double fromMissionStart = (eventHeader->time()).time();
00292     int fromBtStartSec = fromMissionStart-(bt06Sec-missionSec);
00293     vector<int>::iterator it_btstart = m_tempTime.begin();
00294     vector<int>::iterator it_btend = m_tempTime.end();
00295     vector<int>::iterator it_curtime = lower_bound(it_btstart,it_btend, fromBtStartSec/60);
00296     unsigned cur_temp_idx = it_curtime - it_btstart;
00297     for(int twr=1;twr<4;twr++)
00298       m_cur_temp_twr[twr] = (m_cuTwrTemp[twr])[cur_temp_idx];
00299 
00300 
00301 
00302     if ((m_nEvent == ((m_nEvent/1000) * 1000) ) ) {
00303 
00304       msglog << MSG::DEBUG << "event time in seconds from beam test start: " 
00305              << fromBtStartSec 
00306                       <<" temp_twr1=" << m_cur_temp_twr[1]
00307                       <<" temp_twr2=" << m_cur_temp_twr[2] 
00308                       <<" temp_twr3=" << m_cur_temp_twr[3]
00309              << endreq;
00310     }
00311   }
00312     m_gotPedTime = true;
00313   }
00314 
00315   const CalibData::Ped* pedptr = m_pedMgr.getPed(rngIdx);
00316   if(pedptr == 0)return StatusCode::FAILURE;
00317                
00318   ped = pedptr->getAvr();
00319 
00320   if(m_pedTempCorFile.value() != ""){
00321 
00322     float ped0 = m_pedT0[rngIdx];
00323     if(ped0 > 0){
00324       float dpdt = m_pedTempCoef[rngIdx];
00325       int twr = rngIdx.getTwr().val();
00326       if(twr>=0 && twr<=3) ped = ped0+dpdt*(m_cur_temp_twr[twr]-23.0);
00327     }
00328   }
00329   return StatusCode::SUCCESS;
00330 }

StatusCode CalCalibSvc::getPedSig CalUtil::RngIdx  rngIdx,
float &  sig
[virtual]
 

Implements ICalCalibSvc.

Definition at line 332 of file CalCalibSvc.cxx.

References PedMgr::getPed(), and m_pedMgr.

00332                                                                  {
00333 
00334   const CalibData::Ped* pedptr = m_pedMgr.getPed(rngIdx);
00335   if(pedptr == 0)return StatusCode::FAILURE;
00336                
00337   sig = pedptr->getSig();
00338   return StatusCode::SUCCESS;
00339 }

int CalCalibSvc::getSerNoAsym  )  [inline, private, virtual]
 

get calib db serial number for current calibration data

Implements ICalCalibSvc.

Definition at line 205 of file CalCalibSvc.h.

References CalibItemMgr::getSerNo(), and m_pedMgr.

00205                     {
00206     return m_pedMgr.getSerNo();
00207   }

int CalCalibSvc::getSerNoINL  )  [inline, private, virtual]
 

get calib db serial number for current calibration data

Implements ICalCalibSvc.

Definition at line 200 of file CalCalibSvc.h.

References CalibItemMgr::getSerNo(), and m_pedMgr.

00200                    {
00201     return m_pedMgr.getSerNo();
00202   }

int CalCalibSvc::getSerNoMPD  )  [inline, private, virtual]
 

get calib db serial number for current calibration data

Implements ICalCalibSvc.

Definition at line 210 of file CalCalibSvc.h.

References CalibItemMgr::getSerNo(), and m_pedMgr.

00210                    {
00211     return m_pedMgr.getSerNo();
00212   }

int CalCalibSvc::getSerNoPed  )  [inline, private, virtual]
 

get calib db serial number for current calibration data

Implements ICalCalibSvc.

Definition at line 195 of file CalCalibSvc.h.

References CalibItemMgr::getSerNo(), and m_pedMgr.

00195                    {
00196     return m_pedMgr.getSerNo();
00197   }

int CalCalibSvc::getSerNoTholdCI  )  [inline, private, virtual]
 

get calib db serial number for current calibration data

Implements ICalCalibSvc.

Definition at line 215 of file CalCalibSvc.h.

References CalibItemMgr::getSerNo(), and m_pedMgr.

00215                        {
00216     return m_pedMgr.getSerNo();
00217   }

const CalibData::CalTholdCI* CalCalibSvc::getTholdCI CalUtil::FaceIdx  faceIdx  )  [inline, virtual]
 

get threshold calib values for given crystal face

Implements ICalCalibSvc.

Definition at line 91 of file CalCalibSvc.h.

References TholdCIMgr::getTholdCI(), and m_tholdCIMgr.

00091 {return m_tholdCIMgr.getTholdCI(faceIdx);}

void CalCalibSvc::handle const Incident &  inc  )  [private]
 

hook the BeginEvent so that we can check our validity once per event.

Definition at line 237 of file CalCalibSvc.cxx.

References CalibItemMgr::invalidate(), m_asymMgr, m_gotPedTime, m_inlMgr, m_mpdMgr, m_pedMgr, and m_tholdCIMgr.

00237                                                { 
00238   if ((inc.type() == "BeginEvent")) {
00239     m_mpdMgr.invalidate();
00240     m_pedMgr.invalidate();
00241     m_asymMgr.invalidate();
00242     m_inlMgr.invalidate();
00243     m_tholdCIMgr.invalidate();
00244 
00245     m_gotPedTime = false;
00246   }
00247   return; 
00248 }

StatusCode CalCalibSvc::initialize  ) 
 

intialize / retrieve all needed Gaudi based objects

init all the CalCalibShared stuff

Definition at line 70 of file CalCalibSvc.cxx.

References INCIDENT_PRIORITY, AsymMgr::initialize(), CalibItemMgr::initialize(), CalCalibShared::initialize(), m_asymMgr, CalCalibShared::m_calibDataSvcName, m_ccsShared, m_cuTwrTemp, m_defaultFlavor, m_eventSvc, m_flavorAsym, m_flavorIntNonlin, m_flavorMPD, m_flavorPed, m_flavorTholdCI, m_inlMgr, m_mpdMgr, m_pedMgr, m_pedT0, m_pedTempCoef, m_pedTempCorFile, m_temperatureFile, m_tempTime, and m_tholdCIMgr.

00071 {
00072   // Call super-class
00073   Service::initialize ();
00074 
00075   MsgStream msglog(msgSvc(), name()); 
00076   msglog << MSG::INFO << "initialize" << endreq;
00077 
00078   StatusCode sc;
00079 
00080   //-- jobOptions --//
00081   if ((sc = setProperties()).isFailure()) {
00082     msglog << MSG::ERROR << "Failed to set properties" << endreq;
00083     return sc;
00084   }
00085 
00086   // Post-init processing of jobOptions.
00087   // set default flavors unless otherwise specified
00088   if (!m_flavorIntNonlin.value().length())  m_flavorIntNonlin = m_defaultFlavor;
00089   if (!m_flavorAsym.value().length())       m_flavorAsym      = m_defaultFlavor;
00090   if (!m_flavorPed.value().length())        m_flavorPed       = m_defaultFlavor;
00091   if (!m_flavorMPD.value().length())        m_flavorMPD       = m_defaultFlavor;
00092   if (!m_flavorTholdCI.value().length())    m_flavorTholdCI   = m_defaultFlavor;
00093 
00094   msglog << MSG::DEBUG << "Initializing..."     << endreq;
00095   msglog << MSG::DEBUG << "  CalibDavaSvc   : " << m_ccsShared.m_calibDataSvcName  << endreq;
00096   msglog << MSG::DEBUG << "  DefaultFlavor  : " << m_defaultFlavor     << endreq;
00097   msglog << MSG::DEBUG << "  FlavorIntNonlin: " << m_flavorIntNonlin   << endreq;
00098   msglog << MSG::DEBUG << "  FlavorAsym     : " << m_flavorAsym        << endreq;
00099   msglog << MSG::DEBUG << "  FlavorPed      : " << m_flavorPed         << endreq;
00100   msglog << MSG::DEBUG << "  FlavorMeVPerDac: " << m_flavorMPD         << endreq;  
00101   msglog << MSG::DEBUG << "  FlavorTholdCI  : " << m_flavorTholdCI     << endreq;    
00102 
00103   msglog << MSG::INFO << "  TemperatureFile  : " << m_temperatureFile     << endreq;    
00104   msglog << MSG::INFO << "  PedTempCor  : " << m_pedTempCorFile     << endreq;    
00105 
00106 
00108   sc = m_ccsShared.initialize(*this);
00109   if (sc.isFailure()) return sc;
00110 
00111   // Initialize individual CalibItemMgr members.
00112   sc = m_mpdMgr.initialize(m_flavorMPD);
00113   if (sc.isFailure()) return sc;
00114   sc = m_pedMgr.initialize(m_flavorPed);
00115   if (sc.isFailure()) return sc;
00116   sc = m_asymMgr.initialize(m_flavorAsym);
00117   if (sc.isFailure()) return sc;
00118   sc = m_inlMgr.initialize(m_flavorIntNonlin);
00119   if (sc.isFailure()) return sc;
00120   sc = m_tholdCIMgr.initialize(m_flavorTholdCI);
00121   if (sc.isFailure()) return sc;
00122 
00123 
00124   if(m_temperatureFile.value() != ""){
00125 
00126     ifstream tempfile(m_temperatureFile.value().c_str());
00127     if (!tempfile.is_open())
00128             throw runtime_error(string("Unable to open " + m_temperatureFile.value()));
00129     string line;
00130     while (tempfile.good()) {
00131       unsigned short day;
00132       unsigned short month;
00133       unsigned short year;
00134       unsigned short hour;
00135       unsigned short minutes;
00136       unsigned short seconds;
00137       getline(tempfile, line);
00138       if (tempfile.fail()) break; // bad get
00139     
00140       // check for comments
00141       if (line[0] == ';')
00142         continue;
00143 
00144       istringstream istrm(line);
00145       
00146       istrm >> day >> month >> year >> hour >> minutes >> seconds;
00147 
00148       int time = ((day+3 + (month-8)*31)*24 + hour)*60+minutes;
00149       m_tempTime.push_back(time);
00150       for (int twr=3;twr>0;twr--){
00151         float temp0,temp1,temp2,temp3,tempav;
00152         istrm >> temp0 >> temp1 >> temp2 >> temp3;
00153         tempav=(temp0+temp1+temp2+temp3)/4.0;
00154         float dtempSPS[]={0,1.0,1.3,0.7};
00155         if(time/1440 > 30)tempav -= dtempSPS[twr];  //   temperature bias during SPS beam test period
00156         (m_cuTwrTemp[twr]).push_back(tempav);
00157       }
00158     }
00159     msglog << MSG::INFO << "  successfully read " << m_tempTime.size()
00160            << " temperature records "     << endreq;   
00161   }
00162  
00163   if(m_pedTempCorFile.value() != ""){
00164 
00165     ifstream pedfile(m_pedTempCorFile.value().c_str());
00166     if (!pedfile.is_open())
00167             throw runtime_error(string("Unable to open " + m_pedTempCorFile.value()));
00168     string line;
00169     while (pedfile.good()) {
00170       unsigned short twr;
00171       unsigned short lyr;
00172       unsigned short col;
00173       unsigned short face;
00174       unsigned short rng;
00175       float ped,dpdt;
00176       
00177       getline(pedfile, line);
00178       if (pedfile.fail()) break; // bad get
00179 
00180       // check for comments
00181       if (line[0] == ';')
00182         continue;
00183 
00184       istringstream istrm(line);
00185 
00186       istrm >> twr
00187             >> lyr
00188             >> col
00189             >> face
00190             >> rng
00191             >> ped
00192             >> dpdt;
00193 
00194       //      cout <<" "<< twr <<" "  << lyr <<" " << col <<" "
00195       //           << face <<" " << rng<<" " << ped<<" " << dpdt << endl;
00196 
00197       const RngIdx rngIdx(twr,
00198                     LyrNum(lyr),
00199                     col,
00200                     FaceNum((idents::CalXtalId::XtalFace)face),
00201                     RngNum(rng));
00202 
00203       m_pedT0[rngIdx]   = ped;
00204       m_pedTempCoef[rngIdx] = dpdt;
00205 
00206     }
00207 
00208     msglog << MSG::INFO << "  successfully read pedestal temperature corrections"      
00209            << endreq;   
00210 
00211   }
00212 
00213 
00214   // Get ready to listen for BeginEvent
00215   IIncidentSvc* incSvc;
00216   sc = service("IncidentSvc", incSvc, true);
00217   if (sc.isSuccess() ) {
00218     incSvc->addListener(this, "BeginEvent", INCIDENT_PRIORITY);
00219   } else {
00220     msglog << MSG::ERROR << "can't find IncidentSvc" << endreq;
00221     return sc;
00222   }
00223 
00224 
00225 // Need event data service for timestamp stuff
00226   sc = serviceLocator()->service("EventDataSvc", m_eventSvc, true);
00227   if (sc .isFailure() ) {
00228     msglog << MSG::ERROR << "Unable to find EventDataSvc " << endreq;
00229     return sc;
00230   }
00231 
00232 
00233   return StatusCode::SUCCESS;
00234 }

StatusCode CalCalibSvc::queryInterface const InterfaceID &  riid,
void **  ppvUnknown
 

queryInterface - for implementing a Service this is necessary

Definition at line 62 of file CalCalibSvc.cxx.

00062                                                                               {
00063   if (IID_ICalCalibSvc == riid) {
00064     *ppvIF = (ICalCalibSvc*)(this);
00065     return StatusCode::SUCCESS;
00066   } else return Service::queryInterface (riid, ppvIF);
00067 }

const InterfaceID& CalCalibSvc::type  )  const [inline]
 

return the service type

Definition at line 66 of file CalCalibSvc.h.

00066 {return IID_ICalCalibSvc;}


Member Data Documentation

const unsigned short CalCalibSvc::INCIDENT_PRIORITY = 50 [static]
 

'BeginEvent' handle needs lower priority (higher number) than CalibDataSvc

Definition at line 132 of file CalCalibSvc.h.

Referenced by PrecalcCalibTool::initialize(), and initialize().

AsymMgr CalCalibSvc::m_asymMgr [private]
 

manage calibration data of given data type

Definition at line 179 of file CalCalibSvc.h.

Referenced by evalAsym(), evalPos(), getAsym(), getAsymCtr(), getAsymXpos(), handle(), and initialize().

CalCalibShared CalCalibSvc::m_ccsShared [private]
 

this class is shared amongt the CalibItemMgr classes

Definition at line 172 of file CalCalibSvc.h.

Referenced by CalCalibSvc(), and initialize().

float CalCalibSvc::m_cur_temp_twr[4] [private]
 

Definition at line 163 of file CalCalibSvc.h.

Referenced by getPed().

vector<float> CalCalibSvc::m_cuTwrTemp[4] [private]
 

Definition at line 162 of file CalCalibSvc.h.

Referenced by getPed(), and initialize().

StringProperty CalCalibSvc::m_defaultFlavor [private]
 

default flavor for all calib types, unless otherwise specified.

Definition at line 142 of file CalCalibSvc.h.

Referenced by CalCalibSvc(), and initialize().

IDataProviderSvc* CalCalibSvc::m_eventSvc [private]
 

Definition at line 185 of file CalCalibSvc.h.

Referenced by getPed(), and initialize().

StringProperty CalCalibSvc::m_flavorAsym [private]
 

calib flavor override for asymmetry constants

Definition at line 147 of file CalCalibSvc.h.

Referenced by CalCalibSvc(), and initialize().

StringProperty CalCalibSvc::m_flavorIntNonlin [private]
 

calib flavor override for int-nonlin constants

Definition at line 145 of file CalCalibSvc.h.

Referenced by CalCalibSvc(), and initialize().

StringProperty CalCalibSvc::m_flavorMPD [private]
 

calib flavor override for MeVPerDac constants

Definition at line 151 of file CalCalibSvc.h.

Referenced by CalCalibSvc(), and initialize().

StringProperty CalCalibSvc::m_flavorPed [private]
 

calib flavor override for ped constants

Definition at line 149 of file CalCalibSvc.h.

Referenced by CalCalibSvc(), and initialize().

StringProperty CalCalibSvc::m_flavorTholdCI [private]
 

calib flavor override for CI measured thresholds

Definition at line 153 of file CalCalibSvc.h.

Referenced by CalCalibSvc(), and initialize().

bool CalCalibSvc::m_gotPedTime [private]
 

set to true when we have retrieved event time for current event.

Definition at line 188 of file CalCalibSvc.h.

Referenced by getPed(), and handle().

IntNonlinMgr CalCalibSvc::m_inlMgr [private]
 

manage calibration data of given data type

Definition at line 177 of file CalCalibSvc.h.

Referenced by evalADC(), evalCIDAC(), getInlAdc(), getInlCIDAC(), handle(), and initialize().

MPDMgr CalCalibSvc::m_mpdMgr [private]
 

manage calibration data of given data type

Definition at line 181 of file CalCalibSvc.h.

Referenced by getMPD(), handle(), and initialize().

int CalCalibSvc::m_nEvent [private]
 

Definition at line 164 of file CalCalibSvc.h.

Referenced by getPed().

PedMgr CalCalibSvc::m_pedMgr [private]
 

manage calibration data of given data type

Definition at line 175 of file CalCalibSvc.h.

Referenced by getPed(), getPedSig(), getSerNoAsym(), getSerNoINL(), getSerNoMPD(), getSerNoPed(), getSerNoTholdCI(), handle(), and initialize().

CalUtil::CalVec<CalUtil::RngIdx, float> CalCalibSvc::m_pedT0 [private]
 

CU pedestal temperature correction data.

Definition at line 168 of file CalCalibSvc.h.

Referenced by getPed(), and initialize().

CalUtil::CalVec<CalUtil::RngIdx, float> CalCalibSvc::m_pedTempCoef [private]
 

Definition at line 169 of file CalCalibSvc.h.

Referenced by getPed(), and initialize().

StringProperty CalCalibSvc::m_pedTempCorFile [private]
 

file with pedestal temperature correction data

Definition at line 158 of file CalCalibSvc.h.

Referenced by CalCalibSvc(), getPed(), and initialize().

StringProperty CalCalibSvc::m_temperatureFile [private]
 

file with CU CAL tower temperature measurements

Definition at line 156 of file CalCalibSvc.h.

Referenced by CalCalibSvc(), getPed(), and initialize().

vector<int > CalCalibSvc::m_tempTime [private]
 

CU temperature measurements table.

Definition at line 161 of file CalCalibSvc.h.

Referenced by getPed(), and initialize().

TholdCIMgr CalCalibSvc::m_tholdCIMgr [private]
 

manage calibration data of given data type

Definition at line 183 of file CalCalibSvc.h.

Referenced by getTholdCI(), handle(), and initialize().


The documentation for this class was generated from the following files:
Generated on Wed Nov 26 20:29:23 2008 by doxygen 1.3.3