/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
FastQCtrTool Class Reference

#include <FastQCtrTool.h>

Inheritance diagram for FastQCtrTool:
Inheritance graph
[legend]
Collaboration diagram for FastQCtrTool:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 FastQCtrTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~FastQCtrTool ()
virtual StatusCode reconstruct (const DayaBay::CalibReadout &, DayaBay::RecTrigger &)
virtual StatusCode initialize ()
virtual StatusCode finalize ()

Static Public Member Functions

static const InterfaceID & interfaceID ()

Private Types

typedef std::map
< DayaBay::DetectorSensor,
bool > 
UsedPMTsMap

Private Member Functions

StatusCode setUsedPMTs (const DayaBay::CalibReadoutPmtCrate *calibCrate, DayaBay::RecTrigger *recTrigger)

Private Attributes

std::string m_cableSvcName
ICableSvcm_cableSvc
std::string m_pmtGeomSvcName
IPmtGeomInfoSvcm_pmtGeomSvc
UsedPMTsMap m_usedPMTs
float m_timeCutLow
float m_timeCutHigh

Detailed Description

Definition at line 29 of file FastQCtrTool.h.


Member Typedef Documentation

typedef std::map<DayaBay::DetectorSensor, bool> FastQCtrTool::UsedPMTsMap [private]

Definition at line 48 of file FastQCtrTool.h.


Constructor & Destructor Documentation

FastQCtrTool::FastQCtrTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 19 of file FastQCtrTool.cc.

  :  GaudiTool(type, name, parent)
  ,  m_cableSvc(0)
  ,  m_pmtGeomSvc(0)
  ,  m_usedPMTs()
{
  declareInterface< IReconTool >(this);
  declareProperty("CableSvcName", m_cableSvcName = "CableSvc",
    "Name of service to map between detector, hardware, and electronic IDs");
  declareProperty("PmtGeomSvcName", m_pmtGeomSvcName = "PmtGeomInfoSvc",
    "Name of Pmt Geometry Information Service");
  declareProperty("m_timeCutLow", m_timeCutLow=-1700., "Lower limit of the TDC cut to get rid of noise");
  declareProperty("m_timeCutHigh", m_timeCutHigh=-1400., "Higher limit of the TDC cut to get rid of noise");
}
FastQCtrTool::~FastQCtrTool ( ) [virtual]

Definition at line 36 of file FastQCtrTool.cc.

{}

Member Function Documentation

StatusCode FastQCtrTool::reconstruct ( const DayaBay::CalibReadout calibReadout,
DayaBay::RecTrigger recTrigger 
) [virtual]

Implements IReconTool.

Definition at line 55 of file FastQCtrTool.cc.

{
  debug() << "running reconstruct() " << endreq;

  if(!calibReadout.detector().isAD()){
    debug() << "Ignore non-AD detector: " << calibReadout.detector().detName()
            << endreq;
    recTrigger.setEnergyStatus( ReconStatus::kNotProcessed);
    recTrigger.setPositionStatus( ReconStatus::kNotProcessed);
    return StatusCode::SUCCESS;
  }

  // Get CalibPmtCrate
  DayaBay::CalibReadout* calibTest 
     = const_cast<DayaBay::CalibReadout*> (&calibReadout);
  DayaBay::CalibReadoutPmtCrate* calibCrate 
     = dynamic_cast<DayaBay::CalibReadoutPmtCrate*> (calibTest);
  
  // Check CalibPmtCrate
  if(calibCrate == NULL) {
    error() << "reconstruction():  no calib readouts." << endreq;
    recTrigger.setEnergyStatus( ReconStatus::kBadReadout);
    recTrigger.setPositionStatus( ReconStatus::kBadReadout);
    return StatusCode::FAILURE;
  }
  
  debug() << "successfully get PmtChannelReadouts " << endreq;
  
  //  Context, ServiceMode for this data
  int task = 0;
  ServiceMode svcMode(calibCrate->header()->context(), task);

  Site::Site_t site = calibCrate->detector().site();
  DetectorId::DetectorId_t  detid = calibCrate->detector().detectorId();

  debug() << "successfully get service mode " << endreq;

  // determine PMTs that used for reconstruction
  setUsedPMTs(calibCrate, &recTrigger);

  // Calculate the charge center, loop over all calibrated channels
  double sumQ = 0.0, Xc = 0., Yc = 0., Zc = 0;
  
  for(int local_id=0; local_id<192; local_id++) {
    int ring = local_id/24 + 1;
    int col  = local_id%24 + 1;

    if(m_usedPMTs[local_id]==false) continue;
    AdPmtSensor adPmtId(ring, col, site, detid);
    DayaBay::CalibReadoutPmtChannel* calibChannel = calibCrate->sensor(adPmtId);

    // Get charge on this PMT
    float charge = 0.;
    if(calibChannel) {
      for(unsigned int i=0; i<calibChannel->time().size(); i++){
        if(calibChannel->time(i)>m_timeCutLow && calibChannel->time(i)<m_timeCutHigh){
          if(charge<calibChannel->charge(i)) charge = calibChannel->charge(i);
        }
      } 
    }

    // Get Pmt Position from its id
    unsigned int pmtid = adPmtId.fullPackedData();
    if(adPmtId.site() == Site::kSAB) {
       pmtid = DayaBay::AdPmtSensor(adPmtId.ring(),adPmtId.column(),Site::kDayaBay,adPmtId.detectorId()).fullPackedData();
    }
    const CLHEP::Hep3Vector pos = m_pmtGeomSvc->get(pmtid)->localPosition();
    
    Xc   +=  charge * pos.x();
    Yc   +=  charge * pos.y();
    Zc   +=  charge * pos.z();
    sumQ +=  charge;
  }
  if(sumQ!=0) { Xc /= sumQ; Yc /= sumQ; Zc /= sumQ;}
  double position_unit= CLHEP::millimeter;
  debug() << "Xc, Yc, Zc (mm): " << Xc/position_unit
         << ", " << Yc/position_unit << ", " << Zc/position_unit << endreq;

  CLHEP::HepLorentzVector Qcenter(Xc, Yc, Zc, 0);
  recTrigger.setEnergy(sumQ/180.);
  recTrigger.setPosition(Qcenter);
  
  return StatusCode::SUCCESS;
}
StatusCode FastQCtrTool::initialize ( ) [virtual]

Definition at line 38 of file FastQCtrTool.cc.

{
  // Get Cable Service
  m_cableSvc = svc<ICableSvc>(m_cableSvcName, true);

  // Get PmtGeomInfo Service
  m_pmtGeomSvc = svc<IPmtGeomInfoSvc>(m_pmtGeomSvcName, true);

  return StatusCode::SUCCESS;
}
StatusCode FastQCtrTool::finalize ( ) [virtual]

Definition at line 50 of file FastQCtrTool.cc.

{
  return StatusCode::SUCCESS;
}
StatusCode FastQCtrTool::setUsedPMTs ( const DayaBay::CalibReadoutPmtCrate calibCrate,
DayaBay::RecTrigger recTrigger 
) [private]

Definition at line 141 of file FastQCtrTool.cc.

{
  m_usedPMTs.clear();
  
  Context context = calibCrate->header()->context();
  int task = 0;
  ServiceMode svcMode(context, task);

  Site::Site_t site = calibCrate->detector().site();
  DetectorId::DetectorId_t  detid = calibCrate->detector().detectorId();

  // default is use all channels
  for(int local_id=0; local_id<192; local_id++) {
    int ring = local_id/24 + 1;
    int col  = local_id%24 + 1;

    AdPmtSensor adPmtId(ring, col, site, detid);
    m_usedPMTs[local_id] = true;
  }

  return StatusCode::SUCCESS;
}

Member Data Documentation

std::string FastQCtrTool::m_cableSvcName [private]

Definition at line 53 of file FastQCtrTool.h.

Definition at line 56 of file FastQCtrTool.h.

std::string FastQCtrTool::m_pmtGeomSvcName [private]

Definition at line 59 of file FastQCtrTool.h.

Definition at line 62 of file FastQCtrTool.h.

Definition at line 65 of file FastQCtrTool.h.

float FastQCtrTool::m_timeCutLow [private]

Definition at line 67 of file FastQCtrTool.h.

float FastQCtrTool::m_timeCutHigh [private]

Definition at line 68 of file FastQCtrTool.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:13:26 for AdRec by doxygen 1.7.4