#include <CalTrigTool.h>
Inheritance diagram for CalTrigTool:


Public Member Functions | |
| CalTrigTool (const std::string &type, const std::string &name, const IInterface *parent) | |
| default ctor, declares jobOptions | |
| StatusCode | initialize () |
| gets needed parameters and pointers to required services | |
| StatusCode | finalize () |
| StatusCode | getCALTriggerVector (idents::CalXtalId::DiodeType diode, unsigned short &vec) |
| return 16 bit trigger vector for FLE trigger, one bit per tower | |
| StatusCode | getTriggerBit (CalUtil::DiodeIdx diodeIdx, bool &trigBit) |
| return trigger response for given channel (specify xtal, face & diode) | |
| void | handle (const Incident &inc) |
| hook the BeginEvent so that we can check our validity once per event. | |
Private Types | |
| typedef CalUtil::CalVec< CalUtil::DiodeIdx, bool > | CalTriggerMap |
| store trigger values for each channel in Cal | |
Private Member Functions | |
| StatusCode | calcGlobalTrig () |
| update all Cal Trigger bits w/ current TDS data (either MC or Digi) | |
| StatusCode | calcGlobalTrigSignalTool () |
| update all Cal Trigger bits w/ current TDS MC data (via CalSignalTool) | |
| StatusCode | calcGlobalTrigDigi (const Event::CalDigiCol &calDigiCol) |
| update all Cal Trigger bits w/ current TDS data from CalDigi | |
| void | newEvent () |
| call to clear all trigger bits (like @ beginning of event) | |
| void | setSingleBit (const CalUtil::DiodeIdx diodeIdx) |
| set single Cal trigger channel to high, set all corresponding records simultaneously. | |
| StatusCode | calcXtalTrig (const Event::CalDigi &calDigi) |
| calculate single xtal trigger response from cal Digi object. | |
| StatusCode | calcXtalTrigSignalTool (const CalUtil::XtalIdx xtalIdx) |
| calculate trigger response for single crystal from CIDAC diode levels | |
| StatusCode | calcXtalTrig (const CalUtil::XtalIdx xtalIdx, const Event::CalDigi::CalXtalReadout &ro) |
| calculate trigger response from single crystal readout | |
| StatusCode | calcXtalTrig (const CalUtil::XtalIdx xtalIdx, const CalUtil::CalVec< CalUtil::XtalRng, float > &adcPed) |
| calculate trigger response from pedestal subtracted adc values for all 8 adc channels | |
Private Attributes | |
| CalTriggerMap | m_calTriggerMap |
| store trigger values for each channel in Cal | |
| CalUtil::CalVec< CalUtil::DiodeNum, unsigned short > | m_calTriggerVec |
| store FLE trigger vector for each tower in cal | |
| StringProperty | m_calCalibSvcName |
| name of CalCalibSvc to use for calib constants. | |
| ICalCalibSvc * | m_calCalibSvc |
| pointer to CalCalibSvc object. | |
| StringProperty | m_precalcCalibName |
| name of precalc calib tool | |
| IPrecalcCalibTool * | m_precalcCalibTool |
| IDataProviderSvc * | m_evtSvc |
| ptr to event svc | |
| StringProperty | m_calSignalToolName |
| ICalSignalTool * | m_calSignalTool |
| ptr to CalSignalTool tool | |
| IGlastDetSvc * | m_detSvc |
| used for constants & conversion routines. | |
| std::vector< CalUtil::TwrNum > | m_twrList |
| list of active tower bays, populated at run time | |
| bool | m_isValid |
| if current private data store is valid | |
| StringProperty | m_selectionRule |
| CAL rows/columns selection for FLE/FHE trigger generation: "default" - enable all channels to produce trigger "erec" - enable only even columns in even rows and odd columns in odd rows "eroc" - enable only odd columns in even rows and even columns in odd rows. | |
jobOptions:
Definition at line 48 of file CalTrigTool.h.
|
|
store trigger values for each channel in Cal
Definition at line 114 of file CalTrigTool.h. |
|
||||||||||||||||
|
default ctor, declares jobOptions
Definition at line 45 of file CalTrigTool.cxx. References m_calCalibSvcName, m_calSignalToolName, m_precalcCalibName, and m_selectionRule.
00048 : AlgTool(type,name,parent), 00049 m_calCalibSvc(0), 00050 m_precalcCalibTool(0), 00051 m_evtSvc(0), 00052 m_calSignalTool(0), 00053 m_detSvc(0), 00054 m_isValid(false), 00055 m_selectionRule("default") 00056 { 00057 declareInterface<ICalTrigTool>(this); 00058 00059 declareProperty("CalCalibSvc", m_calCalibSvcName = "CalCalibSvc"); 00060 declareProperty("PrecalcCalibTool", m_precalcCalibName = "PrecalcCalibTool"); 00061 declareProperty("CalSignalToolName", m_calSignalToolName = "CalSignalTool"); 00062 declareProperty("selectionRule", m_selectionRule= "default"); 00063 } |
|
|
update all Cal Trigger bits w/ current TDS data (either MC or Digi)
Definition at line 134 of file CalTrigTool.cxx. References calcGlobalTrigDigi(), calcGlobalTrigSignalTool(), m_evtSvc, and m_isValid. Referenced by getCALTriggerVector(), and getTriggerBit().
00134 {
00135 // return success if data is valid for current event
00136 if (m_isValid)
00137 return StatusCode::SUCCESS;
00138
00139 // 1st check for presense of mc
00140 SmartDataPtr<Event::McIntegratingHitVector> mcHits(m_evtSvc, EventModel::MC::McIntegratingHitCol);
00141 if (mcHits != 0) {
00142 if (calcGlobalTrigSignalTool().isFailure())
00143 return StatusCode::FAILURE;
00144 }
00145
00146 // else calc with cal digis
00147 else {
00148 SmartDataPtr<Event::CalDigiCol> calDigiCol(m_evtSvc, EventModel::Digi::CalDigiCol);
00149 if (calDigiCol == 0) {
00150 MsgStream msglog(msgSvc(), name());
00151 msglog << MSG::DEBUG << "Unable to retrieve cal digis (or MC) for cal trigger processing" << endreq;
00152
00153 return StatusCode::SUCCESS;
00154 }
00155
00156 if (calcGlobalTrigDigi(calDigiCol).isFailure())
00157 return StatusCode::FAILURE;
00158 }
00159 m_isValid = true;
00160
00161 return StatusCode::SUCCESS;
00162 }
|
|
|
update all Cal Trigger bits w/ current TDS data from CalDigi
Definition at line 166 of file CalTrigTool.cxx. References calcXtalTrig(). Referenced by calcGlobalTrig().
00166 {
00167 StatusCode sc;
00168
00169 // loop over all calorimeter digis in CalDigiCol
00170 for (CalDigiCol::const_iterator digiIter = calDigiCol.begin();
00171 digiIter != calDigiCol.end(); digiIter++) {
00172 sc = calcXtalTrig(**digiIter);
00173 if (sc.isFailure()) return sc;
00174 }
00175
00176 return StatusCode::SUCCESS;
00177 }
|
|
|
update all Cal Trigger bits w/ current TDS MC data (via CalSignalTool) Loop through (installed) towers and crystals; Definition at line 181 of file CalTrigTool.cxx. References calcXtalTrigSignalTool(), and m_twrList. Referenced by calcGlobalTrig().
00181 {
00183 for (unsigned twrSeq = 0; twrSeq < m_twrList.size(); twrSeq++) {
00184 // get bay id of nth live tower
00185 const TwrNum twr(m_twrList[twrSeq]);
00186 for (LyrNum lyr; lyr.isValid(); lyr++)
00187 for (ColNum col; col.isValid(); col++) {
00188
00189 // assemble current calXtalId
00190 const XtalIdx xtalIdx(twr,lyr, col);
00191
00192 StatusCode sc = calcXtalTrigSignalTool(xtalIdx);
00193 if (sc.isFailure())
00194 return sc;
00195 } // xtal loop
00196 } // twr loop
00197
00198 return StatusCode::SUCCESS;
00199 }
|
|
||||||||||||
|
calculate trigger response from pedestal subtracted adc values for all 8 adc channels for each threshold, simply check the appropriate adc readout for comparison. Definition at line 398 of file CalTrigTool.cxx. References IPrecalcCalibTool::getTrigRngADC(), m_precalcCalibTool, and setSingleBit().
00400 {
00401 StatusCode sc;
00402
00403 //-- RETRIEVE CALIB --//
00404 for (FaceNum face; face.isValid(); face++) {
00405 const FaceIdx faceIdx(xtalIdx,face);
00406
00407 // FLE //
00408 DiodeIdx diodeIdx(faceIdx, LRG_DIODE);
00409 float fleADC;
00410 RngNum fleRng;
00411 sc = m_precalcCalibTool->getTrigRngADC(diodeIdx, fleRng, fleADC);
00412 if (sc.isFailure()) return sc;
00413
00414 // set trigger bit
00415 if (adcPed[XtalRng(face,fleRng)] >= fleADC)
00416 setSingleBit(diodeIdx);
00417
00418 // FHE //
00419 diodeIdx = DiodeIdx(faceIdx, SM_DIODE);
00420 float fheADC;
00421 RngNum fheRng;
00422 sc = m_precalcCalibTool->getTrigRngADC(diodeIdx, fheRng, fheADC);
00423 if (sc.isFailure()) return sc;
00424
00425 // set trigger bit
00426 if (adcPed[XtalRng(face,fheRng)] >= fheADC)
00427 setSingleBit(diodeIdx);
00428 }
00429
00430 return StatusCode::SUCCESS;
00431 }
|
|
||||||||||||
|
calculate trigger response from single crystal readout MeV readout -vs- MeV theshold regardless of which adc range was recorded. Definition at line 344 of file CalTrigTool.cxx. References ICalCalibSvc::evalFaceSignal(), ICalCalibSvc::getPed(), IPrecalcCalibTool::getTrigMeV(), m_calCalibSvc, m_precalcCalibTool, and setSingleBit().
00345 {
00346 StatusCode sc;
00347
00348 for (FaceNum face; face.isValid(); face++) {
00349 const FaceIdx faceIdx(xtalIdx, face);
00350
00351 // FLE //
00352 //-- RETRIEVE THESHOLD CALIB (per-face) --//
00353 float fleMeV;
00354 DiodeIdx diodeIdx(faceIdx, LRG_DIODE);
00355 sc = m_precalcCalibTool->getTrigMeV(diodeIdx, fleMeV);
00356 if (sc.isFailure()) return sc;
00357
00358 //-- CONVERT ADC READOUT TO MeV --//
00359 const RngNum rng(ro.getRange(face));
00360 const short adc = ro.getAdc(face);
00361 float ene;
00362 //-- retrieve pedestals
00363 const RngIdx rngIdx(xtalIdx,
00364 face, rng);
00365
00366 float ped;
00367 StatusCode sc = m_calCalibSvc->getPed(rngIdx,ped);
00368 if (sc.isFailure()) return StatusCode::FAILURE;
00369 const float adcPed = adc - ped;
00370
00371 //-- eval faceSignal
00372 sc = m_calCalibSvc->evalFaceSignal(rngIdx, adcPed, ene);
00373 if (sc.isFailure()) return sc;
00374
00375 // set trigger bit
00376 if (ene >= fleMeV)
00377 setSingleBit(diodeIdx);
00378
00379 // FHE //
00380 //-- RETRIEVE THESHOLD CALIB (per-face) --//
00381 float fheMeV;
00382 diodeIdx = DiodeIdx(faceIdx, SM_DIODE);
00383 sc = m_precalcCalibTool->getTrigMeV(diodeIdx, fheMeV);
00384 if (sc.isFailure()) return sc;
00385
00386 // set trigger bit
00387 if (ene >= fheMeV)
00388 setSingleBit(diodeIdx);
00389 } // face loop
00390
00391 return StatusCode::SUCCESS;
00392 }
|
|
|
calculate single xtal trigger response from cal Digi object. store results in internal private tables Definition at line 229 of file CalTrigTool.cxx. References ICalCalibSvc::getPed(), and m_calCalibSvc. Referenced by calcGlobalTrigDigi().
00229 {
00230 const XtalIdx xtalIdx(calDigi.getPackedId());
00231
00232 //-- CASE 1: SINGLE READOUT MODE --//
00233 // if anything but 4 range mode, simply process 0th readout
00234 if (calDigi.getMode() != CalXtalId::ALLRANGE) {
00235 Event::CalDigi::CalXtalReadout const*const ro = calDigi.getXtalReadout(0);
00236 if (!ro) {
00237 MsgStream msglog(msgSvc(), name());
00238 msglog << MSG::ERROR << "Empty CalDigi (no '0' readout)" << endreq;
00239 return StatusCode::FAILURE;
00240 }
00241
00242 return calcXtalTrig(xtalIdx, *ro);
00243 }
00244
00245 //-- CASE 2: 4RANGE READOUT MODE --//
00246 else {
00247 //-- store ped subtracted adc vals --//
00248 CalVec<XtalRng, float> adcPed;
00249
00250 //-- copy over CalDigi data from all available ranges --//
00251
00252 for (FaceNum face; face.isValid(); face++)
00253 for (CalDigi::CalXtalReadoutCol::const_iterator ro =
00254 calDigi.getReadoutCol().begin();
00255 ro != calDigi.getReadoutCol().end();
00256 ro++) {
00257 const RngNum rng((*ro).getRange(face));
00258
00259 //-- retrieve pedestals --//
00260 const RngIdx rngIdx(xtalIdx,
00261 face, rng);
00262
00263 float ped;
00264 StatusCode sc = m_calCalibSvc->getPed(rngIdx,ped);
00265 if (sc.isFailure()) return StatusCode::FAILURE;
00266
00267 adcPed[XtalRng(face, rng)] =
00268 (*ro).getAdc(face) - ped;
00269 }
00270
00271 return calcXtalTrig(xtalIdx, adcPed);
00272 }
00273 }
|
|
|
calculate trigger response for single crystal from CIDAC diode levels store results in internal private tables Definition at line 201 of file CalTrigTool.cxx. References ICalSignalTool::getDiodeSignal(), IPrecalcCalibTool::getTrigCIDAC(), m_calSignalTool, m_precalcCalibTool, and setSingleBit(). Referenced by calcGlobalTrigSignalTool().
00201 {
00202 StatusCode sc;
00203
00204 // get threholds
00205 for (XtalDiode xDiode; xDiode.isValid(); xDiode++) {
00206 const DiodeIdx diodeIdx(xtalIdx, xDiode);
00207
00209 float thresh;
00210 sc = m_precalcCalibTool->getTrigCIDAC(diodeIdx, thresh);
00211 if (sc.isFailure()) return sc;
00212
00214 float signal;
00215 sc = m_calSignalTool->getDiodeSignal(diodeIdx, signal);
00216 if (sc.isFailure()) return sc;
00217
00218 if (signal >= thresh)
00219 setSingleBit(diodeIdx);
00220 }
00221
00222 return StatusCode::SUCCESS;
00223 }
|
|
|
Definition at line 62 of file CalTrigTool.h.
00062 {return StatusCode::SUCCESS;}
|
|
||||||||||||
|
return 16 bit trigger vector for FLE trigger, one bit per tower update internal tables Implements ICalTrigTool. Definition at line 313 of file CalTrigTool.cxx. References calcGlobalTrig(), and m_calTriggerVec.
00314 {
00316 StatusCode sc(calcGlobalTrig());
00317 if (sc.isFailure())
00318 return sc;
00319
00320 vec = m_calTriggerVec[DiodeNum(diode)];
00321
00322 return StatusCode::SUCCESS;
00323 }
|
|
||||||||||||
|
return trigger response for given channel (specify xtal, face & diode) update internal tables Implements ICalTrigTool. Definition at line 325 of file CalTrigTool.cxx. References calcGlobalTrig(), and m_calTriggerMap.
00325 {
00327 StatusCode sc(calcGlobalTrig());
00328 if (sc.isFailure())
00329 return sc;
00330
00331 trigBit = m_calTriggerMap[diodeIdx];
00332
00333 return StatusCode::SUCCESS;
00334 }
|
|
|
hook the BeginEvent so that we can check our validity once per event.
Definition at line 434 of file CalTrigTool.cxx. References newEvent().
00434 {
00435 if ((inc.type() == "BeginEvent"))
00436 newEvent();
00437
00438 return;
00439 }
|
|
|
gets needed parameters and pointers to required services
Definition at line 65 of file CalTrigTool.cxx. References m_calCalibSvc, m_calCalibSvcName, m_calSignalTool, m_calSignalToolName, m_detSvc, m_evtSvc, m_precalcCalibName, m_precalcCalibTool, and m_twrList.
00065 {
00066 MsgStream msglog(msgSvc(), name());
00067 msglog << MSG::INFO << "initialize" << endreq;
00068
00069 StatusCode sc;
00070
00071 //-- jobOptions --//
00072 if ((sc = setProperties()).isFailure()) {
00073 msglog << MSG::ERROR << "Failed to set properties" << endreq;
00074 return sc;
00075 }
00076
00077 // obtain CalCalibSvc
00078 sc = service(m_calCalibSvcName.value(), m_calCalibSvc);
00079 if (sc.isFailure()) {
00080 msglog << MSG::ERROR << "can't get " << m_calCalibSvcName << endreq;
00081 return sc;
00082 }
00083
00084 // this tool may also be shared by CalTrigTool, global ownership
00085 sc = toolSvc()->retrieveTool("PrecalcCalibTool",
00086 m_precalcCalibName,
00087 m_precalcCalibTool,
00088 0); // shared
00089 if (sc.isFailure() ) {
00090 msglog << MSG::ERROR << " Unable to create " << m_precalcCalibName << endreq;
00091 return sc;
00092 }
00093
00094 sc = toolSvc()->retrieveTool("CalSignalTool",
00095 m_calSignalToolName,
00096 m_calSignalTool,
00097 0); // intended to be shared
00098 if (sc.isFailure() ) {
00099 msglog << MSG::ERROR << " can't create " << m_calSignalToolName << endreq;
00100 return sc;
00101 }
00102
00103 // now try to find the GlastDetSvc service
00104 sc = service("GlastDetSvc", m_detSvc);
00105 if (sc.isFailure() ) {
00106 MsgStream msglog(msgSvc(), name());
00107 msglog << MSG::ERROR << " Unable to get GlastDetSvc " << endreq;
00108 return sc;
00109 }
00110
00111 //-- find out which tems are installed.
00112 m_twrList = findActiveTowers(*m_detSvc);
00113
00114 //-- Retreive EventDataSvc
00115 sc = serviceLocator()->service( "EventDataSvc", m_evtSvc, true );
00116 if(sc.isFailure()){
00117 msglog << MSG::ERROR << "Could not find EventDataSvc" << endreq;
00118 return sc;
00119 }
00120
00121 // Get ready to listen for BeginEvent
00122 IIncidentSvc* incSvc;
00123 sc = service("IncidentSvc", incSvc, true);
00124 if (sc.isSuccess() ) {
00125 incSvc->addListener(this, "BeginEvent"); // priority not important
00126 } else {
00127 msglog << MSG::ERROR << "can't find IncidentSvc" << endreq;
00128 return sc;
00129 }
00130
00131 return StatusCode::SUCCESS;
00132 }
|
|
|
call to clear all trigger bits (like @ beginning of event)
Definition at line 441 of file CalTrigTool.cxx. References m_calTriggerMap, m_calTriggerVec, and m_isValid. Referenced by handle().
00441 {
00442 fill(m_calTriggerMap.begin(),
00443 m_calTriggerMap.end(),
00444 false);
00445
00446 fill(m_calTriggerVec.begin(),
00447 m_calTriggerVec.end(),
00448 0);
00449
00450 m_isValid = false;
00451 }
|
|
|
set single Cal trigger channel to high, set all corresponding records simultaneously.
Definition at line 276 of file CalTrigTool.cxx. References m_calTriggerMap, m_calTriggerVec, and m_selectionRule. Referenced by calcXtalTrig(), and calcXtalTrigSignalTool().
00276 {
00277
00278 //----- check whether rows/columns selection requested from jobOptions
00279 // GCRCNum, ColNum
00280
00281 short crc= diodeIdx.getLyr().getGCRC().val(); // get "CAL row controller" number - can be 0-3 for a CAL face
00282 short col= diodeIdx.getCol().val(); // get column number
00283 string sr= m_selectionRule; // get rows/columns selection rule specified in jobOptions
00284
00285 if(sr== "erec")
00286 {
00287 //----- disable trigger generation in [even rows, odd columns] OR [odd rows, even columns]
00288
00289 if((crc%2== 0 && col%2!= 0) || (crc%2!= 0 && col%2== 0)) return;
00290 }
00291 else
00292 {
00293 if(sr== "eroc")
00294 {
00295 //----- disable trigger generation in [even rows, even columns] OR [odd rows, odd columns]
00296
00297 if((crc%2== 0 && col%2== 0) || (crc%2!= 0 && col%2!= 0)) return;
00298 }
00299 }
00300
00301 //----- full trigger map
00302
00303 m_calTriggerMap[diodeIdx]= true;
00304
00305 //----- cal trigger vectors
00306
00307 const DiodeNum diode(diodeIdx.getDiode());
00308 const TwrNum twr(diodeIdx.getTwr());
00309 m_calTriggerVec[diode] |= (1 << twr.val());
00310 }
|
|
|
pointer to CalCalibSvc object.
Definition at line 127 of file CalTrigTool.h. Referenced by calcXtalTrig(), and initialize(). |
|
|
name of CalCalibSvc to use for calib constants.
Definition at line 124 of file CalTrigTool.h. Referenced by CalTrigTool(), and initialize(). |
|
|
ptr to CalSignalTool tool
Definition at line 140 of file CalTrigTool.h. Referenced by calcXtalTrigSignalTool(), and initialize(). |
|
|
Definition at line 138 of file CalTrigTool.h. Referenced by CalTrigTool(), and initialize(). |
|
|
store trigger values for each channel in Cal
Definition at line 117 of file CalTrigTool.h. Referenced by getTriggerBit(), newEvent(), and setSingleBit(). |
|
|
store FLE trigger vector for each tower in cal
Definition at line 121 of file CalTrigTool.h. Referenced by getCALTriggerVector(), newEvent(), and setSingleBit(). |
|
|
used for constants & conversion routines.
Definition at line 143 of file CalTrigTool.h. Referenced by initialize(). |
|
|
ptr to event svc
Definition at line 135 of file CalTrigTool.h. Referenced by calcGlobalTrig(), and initialize(). |
|
|
if current private data store is valid
Definition at line 149 of file CalTrigTool.h. Referenced by calcGlobalTrig(), and newEvent(). |
|
|
name of precalc calib tool
Definition at line 130 of file CalTrigTool.h. Referenced by CalTrigTool(), and initialize(). |
|
|
Definition at line 132 of file CalTrigTool.h. Referenced by calcXtalTrig(), calcXtalTrigSignalTool(), and initialize(). |
|
|
CAL rows/columns selection for FLE/FHE trigger generation: "default" - enable all channels to produce trigger "erec" - enable only even columns in even rows and odd columns in odd rows "eroc" - enable only odd columns in even rows and even columns in odd rows.
Definition at line 155 of file CalTrigTool.h. Referenced by CalTrigTool(), and setSingleBit(). |
|
|
list of active tower bays, populated at run time
Definition at line 146 of file CalTrigTool.h. Referenced by calcGlobalTrigSignalTool(), and initialize(). |
1.3.3