1 #include "StFttHitCalibMaker.h"
5 #include "StEvent/StFttRawHit.h"
6 #include "StEvent/StEvent.h"
7 #include "StEvent/StFttCollection.h"
9 #include "StEvent/StFttCluster.h"
11 #include "StFttDbMaker/StFttDb.h"
19 StMaker(
"fttHitCalib",name), mHelper(nullptr)
21 LOG_DEBUG <<
"StFttHitCalibMaker::ctor" << endm;
25 StFttHitCalibMaker::~StFttHitCalibMaker()
27 if(mHelper)
delete mHelper;
32 Int_t StFttHitCalibMaker::Init()
34 LOG_INFO <<
"StFttHitCalibMaker::Init" << endm;
38 Int_t StFttHitCalibMaker::InitRun(Int_t runnumber)
45 Int_t StFttHitCalibMaker::FinishRun(Int_t runnumber)
53 LOG_INFO <<
"StFttHitCalibMaker::Finish()" << endm;
55 if (this->mCalibMode == StFttHitCalibMaker::CalibMode::Calibration) {
56 LOG_INFO <<
"Writing StFttHitCalib parameters to plaintext: " << endm;
57 WriteCalibrationToPlainText();
64 void StFttHitCalibMaker::WriteCalibrationToPlainText() {
66 ofstream outf(
"fttRawHitTime.dat" );
67 for (
int uuid = 0; uuid <= 400; uuid++ ){
68 Short_t anchor = mHelper->anchor( uuid );
69 auto hist = mHelper->histFor( uuid );
70 size_t counts = hist.size();
71 size_t samples = mHelper->samples( uuid );
72 outf << TString::Format(
"%d\t%d\t%lu\t%lu", uuid, (
int) anchor, counts, samples ) << endl;
81 LOG_INFO <<
"StFttHitCalibMaker::Make()" << endm;
83 mEvent = (
StEvent*)GetInputDS(
"StEvent");
85 LOG_DEBUG<<
"Found StEvent"<<endm;
89 mFttCollection=mEvent->fttCollection();
93 LOG_DEBUG <<
"Found StFttCollection"<<endm;
96 mFttDb =
static_cast<StFttDb*
>(GetDataSet(
"fttDb"));
99 for (
auto rawHit : mFttCollection->rawHits() ) {
101 UShort_t fob = (UShort_t)mFttDb->fob( rawHit );
102 UShort_t uuid = rawHit->vmm() + ( StFttDb::nVMMPerFob * fob );
104 mHelper->fill( uuid, rawHit->dbcid() );
106 if ( mHelper->ready( uuid ) ){
107 rawHit->setTime( mHelper->time( uuid, rawHit->dbcid()) );
109 rawHit->setTime( -4097 );
StFttHitCalibMaker(const char *name="fttHitCalib")
Default constructor.