// $Id$ //**************************************************************************** //* This file is property of and copyright by the ALICE HLT Project * //* ALICE Experiment at CERN, All rights reserved. * //* * //* Primary Authors: Sergey Gorbunov, Torsten Alt * //* Developers: Sergey Gorbunov * //* Torsten Alt * //* for The ALICE HLT Project. * //* * //* Permission to use, copy, modify and distribute this software and its * //* documentation strictly for non-commercial purposes is hereby granted * //* without fee, provided that the above copyright notice appears in all * //* copies and that both the copyright notice and this permission notice * //* appear in the supporting documentation. The authors make no claims * //* about the suitability of this software for any purpose. It is * //* provided "as is" without express or implied warranty. * //**************************************************************************** // @file AliHLTTPCHWCFMergerUnit.cxx // @author Sergey Gorbunov // @author Torsten Alt // @date // @brief Channel Merger unit of FPGA ClusterFinder Emulator for TPC // @brief ( see AliHLTTPCHWCFEmulator class ) // @note #include "AliHLTTPCHWCFMergerUnit.h" #include AliHLTTPCHWCFMergerUnit::AliHLTTPCHWCFMergerUnit() : fDebug(0), fMatchDistance(0), fMatchTimeFollow(0), fDeconvolute(0), fByPassMerger(0), fInput() { //constructor Init(); } AliHLTTPCHWCFMergerUnit::~AliHLTTPCHWCFMergerUnit() { //destructor } AliHLTTPCHWCFMergerUnit::AliHLTTPCHWCFMergerUnit(const AliHLTTPCHWCFMergerUnit&) : fDebug(0), fMatchDistance(0), fMatchTimeFollow(0), fDeconvolute(0), fByPassMerger(0), fInput() { // dummy Init(); } AliHLTTPCHWCFMergerUnit& AliHLTTPCHWCFMergerUnit::operator=(const AliHLTTPCHWCFMergerUnit&) { // dummy return *this; } int AliHLTTPCHWCFMergerUnit::Init() { // initialise fInput.fFlag = 0; for( int i=0; i<2; i++ ){ fSearchRange[i] = fMemory[i]; fInsertRange[i] = (fMemory[i]+AliHLTTPCHWCFDefinitions::kMaxNTimeBins); fSearchStart[i] = 0; fSearchEnd[i] = 0; fInsertEnd[i] = 0; fInsertRow[i] = -1; fInsertPad[i] = -1; } return 0; } int AliHLTTPCHWCFMergerUnit::InputStream( const AliHLTTPCHWCFClusterFragment *fragment ) { // input stream of data fInput.fFlag = 0; if( fragment ){ fInput = *fragment; fInput.fSlope = 0; fInput.fLastQ = fInput.fQ; if( fDebug ){ std::cout<<"Merger: input Br: "<fBranch<<" F: "<fFlag<<" R: "<fRow <<" Q: "<<(fragment->fQ>>AliHLTTPCHWCFDefinitions::kFixedPoint) <<" P: "<fPad<<" Tmean: "<fTMean; if( fragment->fFlag==1 && fragment->fQ > 0 ){ std::cout<<" Pw: "<<((float)fragment->fP)/fragment->fQ <<" Tw: "<<((float)fragment->fT)/fragment->fQ; std::cout<<" MC: "; for( unsigned int j=0; jfMC.size(); j++ ){ for( int k=0; k<3; k++ ){ std::cout<<"("<fMC[j].fClusterID[k].fMCID<<" "<fMC[j].fClusterID[k].fWeight<<") "; } } std::cout<=fSearchEnd[ib] && fInsertEnd[ib]>0 ){ AliHLTTPCHWCFClusterFragment *tmp = fSearchRange[ib]; fSearchRange[ib] = fInsertRange[ib]; fSearchStart[ib] = 0; fSearchEnd[ib] = fInsertEnd[ib]; fInsertRange[ib] = tmp; fInsertEnd[ib] = 0; fInsertPad[ib]++; } // flush the search range if( fSearchStart[ib]=fSearchEnd[ib] && fInsertEnd[ib]>0 ){ // cout<<"move insert range pad "<=fInput.fTMean+fMatchDistance ){ //cout<<"push from search range at "<fInput.fTMean ){ AliHLTTPCHWCFClusterFragment &s = fSearchRange[ib][fSearchStart[ib]++]; if( fDeconvolute && s.fSlope && s.fLastQ fInput.fQ ) fInput.fSlope = 1; if (fInput.fQmax < s.fQmax) fInput.fQmax = s.fQmax; fInput.fQ += s.fQ; fInput.fT += s.fT; fInput.fT2 += s.fT2; fInput.fP += s.fP; fInput.fP2 += s.fP2; fInput.fMC.insert(fInput.fMC.end(), s.fMC.begin(), s.fMC.end()); if( !fMatchTimeFollow ) fInput.fTMean = s.fTMean; ret = 0; } } // insert fInsertRange[ib][fInsertEnd[ib]++] = fInput; fInput.fFlag = 0; return ret; }