Collaboration diagram for CalTupleAlg:

Public Member Functions | |
| CalTupleAlg (const string &name, ISvcLocator *pSvcLocator) | |
| StatusCode | initialize () |
| initialize internal data members. | |
| StatusCode | execute () |
| Reconstruct ene & pos for all xtal hits in event. | |
| StatusCode | finalize () |
| required by Gaudi Algorithm class | |
Private Attributes | |
| CalTupleEntry | m_tupleEntry |
| reusable store for CalTuple entries. | |
| StringProperty | m_calCalibSvcName |
| name of svc from which i get calibrations | |
| StringProperty | m_tupleName |
| name of tuple to which i write | |
| StringProperty | m_tupleFilename |
| name of file to which i write tuple | |
| ICalCalibSvc * | m_calCalibSvc |
| pointer to CalCalibSvc object. | |
| INTupleWriterSvc * | m_tupleWriterSvc |
| pointer to tupleWriterSvc | |
| INeighborXtalkTool * | m_xtalkTool |
| pointer to NeighborXtalk tool for calculating electronic crosstalk from neighboring crystals | |
| StringProperty | m_xtalkToolName |
| name of INeigbhorXtalkTool instantiation | |
CalTuple contains 1 row per GLAST event w/ the following 2 values for each xtal face
jobOptions:
Definition at line 52 of file CalTupleAlg.cxx.
|
||||||||||||
|
Definition at line 128 of file CalTupleAlg.cxx. References m_calCalibSvcName, m_tupleFilename, m_tupleName, and m_xtalkToolName.
00128 : 00129 Algorithm(name, pSvcLocator), 00130 m_calCalibSvc(0), 00131 m_tupleWriterSvc(0), 00132 m_xtalkTool(0) 00133 { 00134 00135 // declare jobOptions.txt properties 00136 declareProperty("CalCalibSvc", m_calCalibSvcName="CalCalibSvc"); 00137 declareProperty("tupleName", m_tupleName="CalTuple"); 00138 declareProperty("tupleFilename", m_tupleFilename=""); 00139 declareProperty("NeighborXtalkToolName", m_xtalkToolName=""); 00140 } |
|
|
Reconstruct ene & pos for all xtal hits in event.
Definition at line 245 of file CalTupleAlg.cxx. References INeighborXtalkTool::buildSignalMap(), INeighborXtalkTool::calcXtalkMeV(), CalTupleAlg::CalTupleEntry::Clear(), ICalCalibSvc::evalFaceSignal(), ICalCalibSvc::getPed(), m_calCalibSvc, CalTupleAlg::CalTupleEntry::m_calXtalAdcPed, CalTupleAlg::CalTupleEntry::m_calXtalAdcPedAllRange, CalTupleAlg::CalTupleEntry::m_calXtalAdcRng, CalTupleAlg::CalTupleEntry::m_calXtalFaceSignal, CalTupleAlg::CalTupleEntry::m_calXtalFaceSignalAllRange, CalTupleAlg::CalTupleEntry::m_eventId, CalTupleAlg::CalTupleEntry::m_runId, m_tupleEntry, m_tupleName, m_tupleWriterSvc, and m_xtalkTool.
00245 {
00246 StatusCode sc;
00247
00248 // _allways_ store a row, even if it's not empty
00249 m_tupleWriterSvc->storeRowFlag(m_tupleName.value(),
00250 true);
00251
00252 // clear tuple entry for this event
00253 m_tupleEntry.Clear();
00254
00255
00256 // Retrieve the Event data for this event
00257 SmartDataPtr<EventHeader> evtHdr(eventSvc(), EventModel::EventHeader);
00258 if (!evtHdr) {
00259 MsgStream msglog(msgSvc(), name());
00260 msglog << MSG::ERROR << "Failed to retrieve Event" << endreq;
00261 } else {
00262 // populate event id info
00263 m_tupleEntry.m_runId = evtHdr->run();
00264 m_tupleEntry.m_eventId = evtHdr->event();
00265 }
00266
00267 // get a pointer to the input TDS data collection
00268 SmartDataPtr<CalDigiCol> calDigiCol(eventSvc(), EventModel::Digi::CalDigiCol);
00269
00270 if (!calDigiCol) {
00271 if (msgSvc()->outputLevel(name()) <= MSG::VERBOSE) {
00272 // create msglog only when needed (for performance)
00273 MsgStream msglog(msgSvc(), name());
00274 msglog << MSG::VERBOSE << "No CalDigi data found"
00275 << endreq;
00276 }
00277 }
00278 else {
00279 // initialize neighborXtalkTool
00280 if (m_xtalkTool)
00281 m_xtalkTool->buildSignalMap(*calDigiCol);
00282
00283
00284 // loop over all calorimeter digis in CalDigiCol
00285 for (CalDigiCol::const_iterator digiIter = calDigiCol->begin();
00286 digiIter != calDigiCol->end(); digiIter++) {
00287
00288 // get CalXtalId
00289 const CalXtalId xtalId = (*digiIter)->getPackedId();
00290 // get CalUtil::XtalIdx
00291 const XtalIdx xtalIdx(xtalId);
00292 const TwrNum twr = xtalIdx.getTwr();
00293 const LyrNum lyr = xtalIdx.getLyr();
00294 const ColNum col = xtalIdx.getCol();
00295
00296 // usually using only 1st readout
00297 CalDigi::CalXtalReadoutCol::const_iterator ro =
00298 (*digiIter)->getReadoutCol().begin();
00299
00300 // PER FACE LOOP
00301 for (FaceNum face; face.isValid(); face++) {
00302 // get adc range
00303 const RngNum rng((*ro).getRange(face));
00304 // get adc values
00305 const float adc = (*ro).getAdc(face);
00306 const RngIdx rngIdx(xtalIdx, face, rng);
00307
00308 // adc range
00309 m_tupleEntry.m_calXtalAdcRng[twr.val()][lyr.val()][col.val()][face.val()] = rng.val();
00310
00311 // get pedestals
00312 // pedestals
00313 float ped;
00314 sc = m_calCalibSvc->getPed(rngIdx,ped);
00315 if (sc.isFailure()) return StatusCode::FAILURE;
00316
00317 // ped subtracted ADC
00318 const float adcPed = adc - ped;
00319
00320 //-- face signal --//
00321 if (adcPed > 0) {
00322 float faceSignal;
00323 sc = m_calCalibSvc->evalFaceSignal(rngIdx, adcPed, faceSignal);
00324 if (sc.isFailure()) return sc;
00325
00326 // (optional) Neighbor Xtalk Correction
00327 if (m_xtalkTool) {
00328 float xtalkMeV;
00329 sc = m_xtalkTool->calcXtalkMeV(DiodeIdx(xtalIdx,face,rng.getDiode()), xtalkMeV);
00330 if (sc.isFailure()) return sc;
00331
00332 faceSignal -= xtalkMeV;
00333 }
00334
00335 faceSignal = max<float>(0,faceSignal);
00336 m_tupleEntry.m_calXtalFaceSignal[twr.val()][lyr.val()][col.val()][face.val()] = faceSignal;
00337 m_tupleEntry.m_calXtalFaceSignalAllRange[twr.val()][lyr.val()][col.val()][face.val()][rng.val()] = faceSignal;
00338 }
00339
00340
00341 // fill in 1st readout for both bestrange and allrange arrays
00342 m_tupleEntry.m_calXtalAdcPed[twr.val()][lyr.val()][col.val()][face.val()] = adcPed;
00343 m_tupleEntry.m_calXtalAdcPedAllRange[twr.val()][lyr.val()][col.val()][face.val()][rng.val()] = adcPed;
00344
00345 // loop through remaining 3 readouts
00346 for (unsigned char nRO = 1; nRO < 4; nRO++) {
00347 // create my own local vars, sos i don't mess up the
00348 // ones used only for 1st readout
00349 const CalDigi::CalXtalReadout *ro = (*digiIter)->getXtalReadout(nRO);
00350 if (!ro) continue;
00351
00352 const RngNum rng(ro->getRange(face));
00353 const short adc = ro->getAdc(face);
00354
00355 // get pedestals
00356 // pedestals
00357 const RngIdx rngIdx(xtalIdx, face, rng);
00358 float ped;
00359 sc = m_calCalibSvc->getPed(rngIdx,ped);
00360 if (sc.isFailure()) return StatusCode::FAILURE;
00361
00362 // ped subtracted ADC
00363 const float adcPed = adc - ped;
00364
00365 m_tupleEntry.m_calXtalAdcPedAllRange[twr.val()][lyr.val()][col.val()][face.val()][rng.val()] = adcPed;
00366
00367 //-- FACE SIGNAL --//
00368 if (adcPed > 0) {
00369 float faceSignal;
00370 sc = m_calCalibSvc->evalFaceSignal(rngIdx, adcPed, faceSignal);
00371 if (sc.isFailure()) return sc;
00372
00373 // (optional) Neighbor Xtalk Correction
00374 if (m_xtalkTool) {
00375 float xtalkMeV;
00376 sc = m_xtalkTool->calcXtalkMeV(DiodeIdx(xtalIdx,face,rng.getDiode()), xtalkMeV);
00377 if (sc.isFailure()) return sc;
00378
00379 faceSignal -= xtalkMeV;
00380 }
00381
00382 faceSignal = max<float>(0,faceSignal);
00383 m_tupleEntry.m_calXtalFaceSignalAllRange[twr.val()][lyr.val()][col.val()][face.val()][rng.val()] = faceSignal;
00384 }
00385 }
00386 }
00387 }
00388 }
00389
00390 return StatusCode::SUCCESS;
00391 }
|
|
|
required by Gaudi Algorithm class
Definition at line 60 of file CalTupleAlg.cxx.
00060 {return StatusCode::SUCCESS;}
|
|
|
initialize internal data members.
Definition at line 143 of file CalTupleAlg.cxx. References m_calCalibSvc, m_calCalibSvcName, CalTupleAlg::CalTupleEntry::m_calXtalAdcPed, CalTupleAlg::CalTupleEntry::m_calXtalAdcPedAllRange, CalTupleAlg::CalTupleEntry::m_calXtalAdcRng, CalTupleAlg::CalTupleEntry::m_calXtalFaceSignal, CalTupleAlg::CalTupleEntry::m_calXtalFaceSignalAllRange, CalTupleAlg::CalTupleEntry::m_eventId, CalTupleAlg::CalTupleEntry::m_runId, m_tupleEntry, m_tupleFilename, m_tupleName, m_tupleWriterSvc, m_xtalkTool, and m_xtalkToolName.
00143 {
00144 StatusCode sc;
00145 MsgStream msglog(msgSvc(), name());
00146 msglog << MSG::INFO << "initialize" << endreq;
00147
00148 //-- JOB OPTIONS --//
00149 sc = setProperties();
00150 if (sc.isFailure()) {
00151 msglog << MSG::ERROR << "Could not set jobOptions properties" << endreq;
00152 return sc;
00153 }
00154
00155 // obtain CalCalibSvc
00156 sc = service(m_calCalibSvcName.value(), m_calCalibSvc);
00157 if (sc.isFailure()) {
00158 msglog << MSG::ERROR << "can't get " << m_calCalibSvcName << endreq;
00159 return sc;
00160 }
00161
00162 sc = service("RootTupleSvc", m_tupleWriterSvc);
00163 // if we can't retrieve the tuple svc just pretend we never wanted
00164 // it and continue anyway
00165 if (sc.isFailure()) {
00166 msglog << MSG::ERROR << "Could not locate the ntupleSvc" << endreq;
00167 m_tupleWriterSvc = 0;
00168 return sc;
00169 }
00170
00171 else { // tuple svc was successfully found
00172 // keep track of any branch creation errors
00173 bool branchFailure = false;
00174 sc = m_tupleWriterSvc->addItem(m_tupleName.value(),
00175 "RunID",
00176 &m_tupleEntry.m_runId,
00177 m_tupleFilename);
00178 if (sc.isFailure()) branchFailure |= true;
00179
00180 sc = m_tupleWriterSvc->addItem(m_tupleName.value(),
00181 "EventID",
00182 &m_tupleEntry.m_eventId,
00183 m_tupleFilename);
00184 if (sc.isFailure()) branchFailure |= true;
00185
00186 sc = m_tupleWriterSvc->addItem(m_tupleName.value(),
00187 "CalXtalAdcPed[16][8][12][2]",
00188 (float*)m_tupleEntry.m_calXtalAdcPed,
00189 m_tupleFilename);
00190 if (sc.isFailure()) branchFailure |= true;
00191
00192
00193 sc = m_tupleWriterSvc->addItem(m_tupleName.value(),
00194 "CalXtalAdcPedAllRange[16][8][12][2][4]",
00195 (float*)m_tupleEntry.m_calXtalAdcPedAllRange,
00196 m_tupleFilename);
00197 if (sc.isFailure()) branchFailure |= true;
00198
00199 sc = m_tupleWriterSvc->addItem(m_tupleName.value(),
00200 "CalXtalAdcRng[16][8][12][2]",
00201 (int*)(&m_tupleEntry.m_calXtalAdcRng),
00202 m_tupleFilename);
00203 if (sc.isFailure()) branchFailure |= true;
00204
00205
00206 sc = m_tupleWriterSvc->addItem(m_tupleName.value(),
00207 "CalXtalFaceSignal[16][8][12][2]",
00208 (float*)m_tupleEntry.m_calXtalFaceSignal,
00209 m_tupleFilename);
00210 if (sc.isFailure()) branchFailure |= true;
00211
00212 sc = m_tupleWriterSvc->addItem(m_tupleName.value(),
00213 "CalXtalFaceSignalAllRange[16][8][12][2][4]",
00214 (float*)m_tupleEntry.m_calXtalFaceSignalAllRange,
00215 m_tupleFilename);
00216 if (sc.isFailure()) branchFailure |= true;
00217
00218 if (branchFailure) {
00219 msglog << MSG::ERROR << "Failure creating tuple branches" << endl;
00220 return StatusCode::FAILURE;
00221 }
00222 }
00223
00224 //-- Neighbor Xtalk Tool --//
00225 if (!m_xtalkToolName.value().empty()) {
00226 sc = toolSvc()->retrieveTool(m_xtalkToolName,
00227 m_xtalkTool,
00228 0); // shared by other code
00229 if (sc.isFailure() ) {
00230 msglog << MSG::ERROR << " Unable to create " << m_xtalkToolName << endreq;
00231 return sc;
00232 }
00233 }
00234
00235 return StatusCode::SUCCESS;
00236 }
|
|
|
pointer to CalCalibSvc object.
Definition at line 113 of file CalTupleAlg.cxx. Referenced by execute(), and initialize(). |
|
|
name of svc from which i get calibrations
Definition at line 105 of file CalTupleAlg.cxx. Referenced by CalTupleAlg(), and initialize(). |
|
|
reusable store for CalTuple entries.
Definition at line 102 of file CalTupleAlg.cxx. Referenced by execute(), and initialize(). |
|
|
name of file to which i write tuple
Definition at line 109 of file CalTupleAlg.cxx. Referenced by CalTupleAlg(), and initialize(). |
|
|
name of tuple to which i write
Definition at line 107 of file CalTupleAlg.cxx. Referenced by CalTupleAlg(), execute(), and initialize(). |
|
|
pointer to tupleWriterSvc
Definition at line 116 of file CalTupleAlg.cxx. Referenced by execute(), and initialize(). |
|
|
pointer to NeighborXtalk tool for calculating electronic crosstalk from neighboring crystals
Definition at line 119 of file CalTupleAlg.cxx. Referenced by execute(), and initialize(). |
|
|
name of INeigbhorXtalkTool instantiation
Definition at line 122 of file CalTupleAlg.cxx. Referenced by CalTupleAlg(), and initialize(). |
1.3.3