| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

ROsFeeTdcTool.cc

Go to the documentation of this file.
00001 #include "ROsFeeTdcTool.h"
00002 
00003 #include "Conventions/Detectors.h"
00004 #include "Conventions/Electronics.h"
00005 #include "Conventions/Trigger.h"
00006 #include "Conventions/Site.h"
00007 
00008 #include "Event/SimReadoutHeader.h"
00009 #include "Event/ReadoutPmtCrate.h"
00010 
00011 #include "Event/ElecCrateHeader.h"
00012 #include "Event/ElecFeeCrate.h"
00013 #include "Event/ElecFeeChannel.h"
00014 
00015 #include "Event/SimTrigCommand.h"
00016 #include "Event/SimTrigCommandHeader.h"
00017 #include "Event/SimTrigCommandCollection.h"
00018 
00019 #include <set>
00020 #include <vector>
00021 
00022 ROsFeeTdcTool::ROsFeeTdcTool(const std::string& type,
00023              const std::string& name, 
00024              const IInterface* parent)
00025   : GaudiTool(type,name,parent)
00026 {
00027   declareInterface< IROsFeeTdcTool >(this) ;
00028 
00029   declareProperty("UseMultiHitTdc",m_multiHitTdc=true,
00030                   "Allow multi-hit TDC functionality?");
00031   declareProperty("MultiLimit",m_multiLimit=5,
00032                   "Number of allowed TDC's in one readout");
00033   declareProperty("TdcResetCycles",m_tdcResetCycles=16,
00034                   "Reset Time on the TDC, in TDC counts (640 MHz)");
00035 }
00036 
00037 ROsFeeTdcTool::~ROsFeeTdcTool(){}
00038 
00039 StatusCode ROsFeeTdcTool::initialize()
00040 {
00041   return StatusCode::SUCCESS;
00042 }
00043 
00044 StatusCode ROsFeeTdcTool::finalize()
00045 {
00046   return StatusCode::SUCCESS;
00047 }
00048 
00049 StatusCode ROsFeeTdcTool::readoutTdc(const std::vector<int>& tdc_in,
00050              unsigned int first_cycle,
00051              unsigned int last_cycle,
00052              std::vector<int>& tdc_out)
00053 {
00054     verbose() << "reading out tdc window ["
00055               << first_cycle << "," << last_cycle << ")" << endreq;
00056 
00057     if(tdc_out.size()>0) tdc_out.clear();
00058     
00059     // Select TDC values for readout
00060     std::vector<int>::const_iterator tdcIt;
00061     int prevTdcCycle = -2;
00062     int prevReadoutTdcCycle = -1000;
00063     for(tdcIt = tdc_in.begin(); tdcIt != tdc_in.end(); ++tdcIt){
00064       int tdcCycle= *tdcIt;
00065       // Skip TDC value if the signal has not dropped below threshold since last crossing
00066       if(tdcIt != tdc_in.begin())
00067         if( tdcCycle-*(tdcIt-1) == 1 ) {prevTdcCycle = tdcCycle; continue;} 
00068       // Skip TDC value if it is too close to previous threshold crossing
00069       if( (tdcCycle-prevReadoutTdcCycle)<m_tdcResetCycles ) {prevTdcCycle = tdcCycle; continue;}
00070       prevReadoutTdcCycle = tdcCycle;
00071       // Check if current TDC is in the readout window
00072       if( tdcCycle >= (int)first_cycle && tdcCycle < (int)last_cycle ){ 
00073         tdc_out.push_back(tdcCycle);
00074         // If multi-hit TDC is disabled, don't consider any more tdc values
00075         if( !m_multiHitTdc ) break;
00076         // If it reaches the number of tdc's limit, leave this.
00077         if( tdc_out.size() >= m_multiLimit ) break;
00078       }
00079       prevTdcCycle = tdcCycle;
00080     }
00081 
00082     verbose() << "      NTDC = " << tdc_out.size() << endreq; 
00083     
00084     return StatusCode::SUCCESS;
00085 }
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:50:36 2011 for ReadoutSim by doxygen 1.4.7