#include <CalIRFAlg.h>
Public Methods | |
CalIRFAlg (const std::string &name, ISvcLocator *pSvcLocator) | |
Constructor of this form must be provided. More... | |
StatusCode | initialize () |
mandatory. More... | |
StatusCode | execute () |
mandatory. More... | |
StatusCode | finalize () |
mandatory. More... | |
Private Attributes | |
IGlastDetSvc * | m_detSvc |
ICalGeometrySvc * | m_CalGeo |
Definition at line 16 of file CalIRFAlg.h.
|
Constructor of this form must be provided.
Definition at line 29 of file CalIRFAlg.cxx.
00029 : 00030 Algorithm(name, pSvcLocator), m_detSvc(0) { 00031 } |
|
mandatory.
Definition at line 74 of file CalIRFAlg.cxx. References CalRecLog::asymmetry(), CalAxis::axis, ICalGeometrySvc::getLog(), CalRecLogs::getLogID(), CalLogID::ID(), ICalGeometrySvc::light_att(), m_CalGeo, CalDetGeo::makeAxis(), ICalGeometrySvc::numLayers(), ICalGeometrySvc::numLogs(), ICalGeometrySvc::numModulesX(), ICalGeometrySvc::numModulesY(), ICalGeometrySvc::numViews(), CalGeo::position(), CalRecLog::setNegEnergy(), CalRecLog::setPosEnergy(), CalRecLog::setPosition(), CalGeo::size(), slope, CalAxis::X, and CalAxis::Y.
00074 { 00075 00076 StatusCode sc = StatusCode::SUCCESS; 00077 MsgStream log( msgSvc(), name() ); 00078 log << MSG::INFO << "execute" << endreq; 00079 00080 int nModX = m_CalGeo->numModulesX(); 00081 int nModY = m_CalGeo->numModulesY(); 00082 int nLogs = m_CalGeo->numLogs(); 00083 int nLayers = m_CalGeo->numLayers(); 00084 int nViews = m_CalGeo->numViews(); 00085 CalRecLogs* crl = new CalRecLogs(nModX,nModY,nLogs,nLayers,nViews); 00086 DataObject* pnode=0; 00087 00088 sc = eventSvc()->retrieveObject( "/Event/CalRecon", pnode ); 00089 00090 if( sc.isFailure() ) { 00091 sc = eventSvc()->registerObject("/Event/CalRecon",new DataObject); 00092 if( sc.isFailure() ) { 00093 00094 log << MSG::ERROR << "Could not create CalRecon directory" << endreq; 00095 return sc; 00096 } 00097 } 00098 sc = eventSvc()->registerObject("/Event/CalRecon/CalRecLogs",crl); 00099 00100 // get the CsiData object from the TDS by a converter 00101 // SmartDataPtr<TdGlastData> (eventSvc(), "/Event/Raw/TdCsIDatas"); 00102 00103 00104 SmartDataPtr<TdGlastData> glastData(eventSvc(),"/Event/TdGlastData"); 00105 00106 if( 0==glastData) { 00107 log << MSG::ERROR << "could not find \""<< "/Event/TdGlastData" <<"\"" << endreq; 00108 return StatusCode::FAILURE; 00109 } 00110 00111 00112 const CsIData* csi = glastData->getCsIData(); 00113 00114 00115 00116 // see what is there 00117 // csi->printOn(std::cout); 00118 00119 double latt = m_CalGeo->light_att(); 00120 double slope = (2-latt)/latt; 00121 double ene = 0.0; 00122 for (int l=0; l < m_CalGeo->numLayers();l++){ 00123 for (int v=0; v< m_CalGeo->numViews(); v++){ 00124 CalDetGeo::axis view = CalDetGeo::makeAxis(v); 00125 int ilayer = l*(m_CalGeo->numViews())+v; 00126 int nhits = csi->nHits(ilayer); 00127 if(nhits == 0)continue; 00128 for ( int ihit = 0; ihit < nhits; ihit++){ 00129 idents::ModuleId mod = csi->moduleId(ilayer, ihit); 00130 idents::XtalId xtalid = csi->xtalId(ilayer,ihit); 00131 int icol = xtalid.xtal()-1; 00132 00133 // to fix incorrect log numbering for X layers (with view==Y, numbers should increase with Y) 00134 if(v == 1) icol = m_CalGeo->numLogs()-1 - icol; 00135 00136 float enePos = csi->Rresp(ilayer,ihit)*1000.; 00137 float eneNeg = csi->Lresp(ilayer,ihit)*1000.; 00138 ene += (enePos+eneNeg)/2; 00139 CalRecLog* recLog = crl->getLogID(CalLogID::ID(l,view,icol,mod)); 00140 recLog->setNegEnergy(eneNeg); 00141 recLog->setPosEnergy(enePos); 00142 CalDetGeo geoLog = m_CalGeo->getLog(l,view,icol,mod); 00143 00144 Point pCenter = geoLog.position(); 00145 Point pSize = geoLog.size(); 00146 00147 double xdir = 0.; 00148 double ydir = 0.; 00149 ydir = (view == CalDetGeo::X? pSize.y() : 0); 00150 xdir = (view == CalDetGeo::Y? pSize.x() : 0); 00151 00152 Vector dirLog(xdir,ydir,0.); 00153 double asym = recLog->asymmetry(); 00154 // std::cout << " dirLog = " << dirLog << std::endl; 00155 Point pLog = pCenter+dirLog*asym*slope; 00156 ; 00157 00158 recLog->setPosition(pLog); 00159 00160 } 00161 } 00162 } 00163 00164 // crl->writeOut(); 00165 // std::cout << std::endl << " ene = " << ene << std::endl << std::endl; 00166 00167 return sc; 00168 } |
|
mandatory.
Definition at line 172 of file CalIRFAlg.cxx.
00172 { 00173 00174 MsgStream log(msgSvc(), name()); 00175 log << MSG::INFO << "finalize" << endreq; 00176 00177 return StatusCode::SUCCESS; 00178 } |
|
mandatory. The "functional" part of the class: For the EmptyAlgorithm example they do nothing apart from print out info messages. NB in the initialize method: you must explicitly initialize the base class before using any services (message service, event data service etc.) otherwise the behaviour will be unpredictable at best. Definition at line 41 of file CalIRFAlg.cxx. References m_CalGeo, and m_detSvc.
00041 { 00042 00043 MsgStream log(msgSvc(), name()); 00044 log << MSG::INFO << "initialize" << endreq; 00045 00046 00047 00048 // Use the Job options service to set the Algorithm's parameters 00049 setProperties(); 00050 00051 //Look for the geometry service 00052 StatusCode sc = service("CalGeometrySvc", m_CalGeo); 00053 00054 if (!sc.isSuccess ()){ 00055 log << MSG::ERROR << "Couldn't find the CalGeometrySvc!" << endreq; 00056 return sc; 00057 } 00058 00059 // now try to find the GlastDevSvc service 00060 sc = service("GlastDetSvc", m_detSvc); 00061 00062 00063 if (!sc.isSuccess ()){ 00064 log << MSG::ERROR << "Couldn't find the GlastDetSvc!" << endreq; 00065 } 00066 00067 00068 00069 return sc; 00070 } |
|
Definition at line 34 of file CalIRFAlg.h. Referenced by execute(), and initialize(). |
|
Definition at line 32 of file CalIRFAlg.h. Referenced by initialize(). |