#include "hpidhitdata.h"
#include "hshowerhittof.h"
#include "htofhit.h"
#include "htofcluster.h"
#include "hshowerhittoftrack.h"
#include "hcategory.h"
#include "hmetamatch.h"
#include "hmdctrkcand.h"
#include "hmdctrackgdef.h"
#include "hrichhit.h"
#include "hkicktrack.h"
#include "hades.h"
#include "hpidmdcfunc.h"
#include "hpidfl.h"
#include "hevent.h"
#include "hcategory.h"
#include "TObject.h"
#include "TError.h"
#include "piddef.h"
#include "richdef.h"
#include "showertofinodef.h"
#include "hmdcdef.h"
#include "hmdcseg.h"
#include "hrichhitIPU.h"
#include "triggerinfodef.h"
#include "hbasetrack.h"
ClassImp(HPidHitData)
HPidHitData::HPidHitData(const HPidHitData& source):TObject(source)
{
nSector=source.getSector();
iSystem=source.getSystem();
nRingPadNr=source.getRingPadNr();
fRingCentroid=source.getRingCentroid();
fRichTheta=source.getRichTheta();
fRichPhi=source.getRichPhi();
nRingPatMat=source.getRingPatMat();
nRingHouTra=source.getRingHouTra();
nRingAmplitude=source.getRingAmplitude();
nRingLocalMax4=source.getRingLocalMax4();
fInnerMdcdEdx=source.getInnerMdcdEdx();
fInnerMdcdEdxSigma=source.getInnerMdcdEdxSigma();
fInnerMdcChiSquare=source.getInnerMdcChiSquare();
fMdcRCoord=source.getMdcRCoord();
fMdcZCoord=source.getMdcZCoord();
fMdcTheta=source.getMdcTheta();
fMdcPhi=source.getMdcPhi();
fOuterMdcdEdx=source.getOuterMdcdEdx();
fOuterMdcdEdxSigma=source.getOuterMdcdEdxSigma();
fOuterMdcChiSquare=source.getOuterMdcChiSquare();
fCombinedMdcdEdx=source.getCombinedMdcdEdx();
fCombinedMdcdEdxSigma=source.getCombinedMdcdEdxSigma();
iIPURingQuality=source.getIPURingQuality();
iIPUVetoQuality=source.getIPUVetoQuality();
for (Int_t i=0;i<3;i++)
{
fShowerSum[i]=source.getShowerSum(i);
nShowerClS[i]=source.getShowerClS(i);
}
nShowerRow = source.getShowerRow();
nShowerCol = source.getShowerCol();
fShowerTimeOfFlight=source.getShowerTimeOfFlight();
fTOFTimeOfFlight=source.getTOFTimeOfFlight();
fTOFLeftAmplitude=source.getTOFLeftAmplitude();
fTOFRightAmplitude=source.getTOFRightAmplitude();
fTofEloss=source.getTofEloss();
fMetaLocalX = source.getMetaLocalX();
fMetaLocalY = source.getMetaLocalY();
iTofinoMult=source.getTofinoMult();
nTofClsSize=source.getTofClsSize();
nMetaCell=source.getMetaCell();
nTofCell=source.getTofCell();
nTofModule=source.getTofModule();
iIndRICH=source.getIndRICH();
iIndRICHIPU=source.getIndRICHIPU();
iIndInnerSeg=source.getIndInnerSeg();
iIndOuterSeg=source.getIndOuterSeg();
iIndTOF=source.getIndTOF();
iIndShower=source.getIndShower();
iIndMatch=source.getIndMatch();
iIndClusInf0=source.getIndClusInf(0);
iIndClusInf1=source.getIndClusInf(1);
iIndClusInf2=source.getIndClusInf(2);
iIndClusInf3=source.getIndClusInf(3);
for(Int_t i=0;i<MAX_MOM_ALGS;i++)
{
fDistanceToVertex[i]=source.getDistanceToVertex(i);
hasRingCorrelation[i]=source.getRingCorrelation(i);
hasMetaTrackCorrelation[i]=source.getMetaTrackCorrelation(i);
}
}
Short_t HPidHitData::getIndClusInf(Int_t i) const
{
switch (i)
{
case 0:
return iIndClusInf0;
break;
case 1:
return iIndClusInf1;
break;
case 2:
return iIndClusInf2;
break;
case 3:
return iIndClusInf3;
break;
default:
Error("HPidHitdata::getIndClusInf","Requested invalid ClusInf index: %d",i);
return -1;
}
}
void HPidHitData::reset(void)
{
nSector=-1;
iSystem=-1;
nRingPadNr=-1;
fRingCentroid=-1.0;
fRichTheta=-1.0;
fRichPhi=-1.0;
nRingPatMat=-1;
nRingHouTra=-1;
nRingAmplitude=-1;
nRingLocalMax4=-1;
fInnerMdcdEdx=-1.0;
fInnerMdcdEdxSigma=-1.0;
fInnerMdcChiSquare=-1.0;
fMdcRCoord=-1.0;
fMdcZCoord=-1.0;
fMdcTheta=-1.0;
fMdcPhi=-1.0;
fOuterMdcChiSquare=-1.0;
fOuterMdcdEdx=-1.0;
fOuterMdcdEdxSigma=-1.0;
iIPURingQuality=-1;
iIPUVetoQuality=-1;
for (Int_t i=0;i<3;i++)
{
fShowerSum[i]=-1.0;
nShowerClS[i]=-1;
}
nShowerRow = -1;
nShowerCol = -1;
fShowerTimeOfFlight=-1.0;
fMetaLocalX = -999.0;
fMetaLocalY = -999.0;
fTOFTimeOfFlight=-1.0;
fTOFLeftAmplitude=-1.0;
fTOFRightAmplitude=-1.0;
iTofinoMult=-1;
nTofClsSize=-1;
nMetaCell= -1;
nTofCell= -1;
nTofModule= -1;
fTofEloss = -1.0;
iIndRICH=-1;
iIndRICHIPU=-1;
iIndInnerSeg=-1;
iIndOuterSeg=-1;
iIndTOF=-1;
iIndShower=-1;
iIndMatch=-1;
iIndClusInf0=-1;
iIndClusInf1=-1;
iIndClusInf2=-1;
iIndClusInf3=-1;
clearFlags();
for(Int_t i=0;i<MAX_MOM_ALGS;i++)
{
fDistanceToVertex[i]=-1.;
hasRingCorrelation[i]=kFALSE;
hasMetaTrackCorrelation[i]=kFALSE;
}
}
Int_t HPidHitData::getMdcNWires(Int_t i) const
{
HMdcSeg* pInnerMdcSeg=NULL;
HMdcSeg* pOuterMdcSeg=NULL;
if(iIndInnerSeg>=0)
{
pInnerMdcSeg = HPidFL::getMdcSeg(iIndInnerSeg);
}
if(iIndOuterSeg>=0)
{
pOuterMdcSeg = HPidFL::getMdcSeg(iIndOuterSeg);
}
switch(i)
{
case 0:
if(pInnerMdcSeg)
{
return HPidMdcFunc::getMdcNWires(pInnerMdcSeg,0);
}
else
{
Error("HPidHitData::getMdcNWires","Pointer to inner segment is NULL");
return -1;
}
break;
case 1:
if(pInnerMdcSeg)
{
return HPidMdcFunc::getMdcNWires(pInnerMdcSeg,1);
}
else
{
Error("HPidHitData::getMdcNWires","Pointer to inner segment is NULL");
return -1;
}
break;
case 2:
if(pOuterMdcSeg)
{
return HPidMdcFunc::getMdcNWires(pOuterMdcSeg,0);
}
else
{
Error("HPidHitData::getMdcNWires","Pointer to outer segment is NULL");
return -1;
}
break;
case 3:
if(pOuterMdcSeg)
{
return HPidMdcFunc::getMdcNWires(pOuterMdcSeg,1);
}
else
{
Error("HPidHitData::getMdcNWires","Pointer to outer segment is NULL");
return -1;
}
break;
default:
return -1;
}
return -1;
}
Int_t HPidHitData::getMdcClsSize(Int_t i) const
{
HMdcSeg* pInnerMdcSeg=NULL;
HMdcSeg* pOuterMdcSeg=NULL;
if(iIndInnerSeg>=0)
{
pInnerMdcSeg = HPidFL::getMdcSeg(iIndInnerSeg);
}
if(iIndOuterSeg>=0)
{
pOuterMdcSeg = HPidFL::getMdcSeg(iIndOuterSeg);
}
switch(i)
{
case 0:
if(pInnerMdcSeg)
{
return HPidMdcFunc::getMdcClsSize(pInnerMdcSeg,0);
}
else
{
Error("HPidHitData::getMdcClsSize","Pointer to inner segment is NULL");
return -1;
}
break;
case 1:
if(pInnerMdcSeg)
{
return HPidMdcFunc::getMdcClsSize(pInnerMdcSeg,1);
}
else
{
Error("HPidHitData::getMdcClsSize","Pointer to inner segment is NULL");
return -1;
}
break;
case 2:
if(pOuterMdcSeg)
{
return HPidMdcFunc::getMdcClsSize(pOuterMdcSeg,0);
}
else
{
Error("HPidHitData::getMdcClsSize","Pointer to outer segment is NULL");
return -1;
}
break;
case 3:
if(pOuterMdcSeg)
{
return HPidMdcFunc::getMdcClsSize(pOuterMdcSeg,1);
}
else
{
Error("HPidHitData::getMdcClsSize","Pointer to outer segment is NULL");
return -1;
}
break;
default:
return -1;
}
return -1;
}
Int_t HPidHitData::getMdcLevelCls(Int_t i) const
{
HMdcSeg* pInnerMdcSeg=NULL;
HMdcSeg* pOuterMdcSeg=NULL;
if(iIndInnerSeg>=0)
{
pInnerMdcSeg = HPidFL::getMdcSeg(iIndInnerSeg);
}
if(iIndOuterSeg>=0)
{
pOuterMdcSeg = HPidFL::getMdcSeg(iIndOuterSeg);
}
switch(i)
{
case 0:
if(pInnerMdcSeg)
{
return HPidMdcFunc::getMdcLevelCls(pInnerMdcSeg,0);
}
else
{
Error("HPidHitData::getMdcLevelCls","Pointer to inner segment is NULL");
return -1;
}
break;
case 1:
if(pInnerMdcSeg)
{
return HPidMdcFunc::getMdcLevelCls(pInnerMdcSeg,1);
}
else
{
Error("HPidHitData::getMdcLevelCls","Pointer to inner segment is NULL");
return -1;
}
break;
case 2:
if(pOuterMdcSeg)
{
return HPidMdcFunc::getMdcLevelCls(pOuterMdcSeg,0);
}
else
{
Error("HPidHitData::getMdcLevelCls","Pointer to outer segment is NULL");
return -1;
}
break;
case 3:
if(pOuterMdcSeg)
{
return HPidMdcFunc::getMdcLevelCls(pOuterMdcSeg,1);
}
else
{
Error("HPidHitData::getMdcLevelCls","Pointer to outer segment is NULL");
return -1;
}
break;
default:
return -1;
}
return -1;
}
void HPidHitData::fillFromMetaMatch(HMetaMatch *pMatch, Int_t iMatchIndex)
{
HMdcSeg* pInnerMdcSeg=NULL;
HMdcSeg* pOuterMdcSeg=NULL;
HRichHit* pRichHit=NULL;
HRichHitIPU* pRichHitIPU=NULL;
HShowerHitTof* pShowerHitTof = NULL;
HTofHit* pTofHit=NULL;
reset();
nSector = pMatch->getSector();
if(nSector>5 || nSector<0)
cout << "wrong sector from metamatch!" << nSector <<endl;
iIndMatch = iMatchIndex;
HMdcTrkCand* pTrackCand = HPidFL::getMdcTrkCand(pMatch->getTrkCandInd());
if(pTrackCand!=NULL)
{
fCombinedMdcdEdx=pTrackCand->getdedxCombinedSeg();
fCombinedMdcdEdxSigma=pTrackCand->getSigmadedxCombinedSeg();
if(pTrackCand->getSeg1Ind()>-1)
{
pInnerMdcSeg = HPidFL::getMdcSeg(pTrackCand->getSeg1Ind());
}
if (pInnerMdcSeg != NULL)
{
if(pMatch->getKickInd()>-1){
fDistanceToVertex[ALG_KICK] = ((HBaseTrack*)HPidFL::getKickTrackB(pMatch->getKickInd()))->getTarDist();
}
if(pMatch->getSplineInd()>-1){
fDistanceToVertex[ALG_SPLINE] = ((HBaseTrack*)HPidFL::getSplineTrack(pMatch->getSplineInd()))->getTarDist();
}
if(pMatch->getRungeKuttaInd()>-1){
fDistanceToVertex[ALG_RUNGEKUTTA] = ((HBaseTrack*)HPidFL::getRKTrack(pMatch->getRungeKuttaInd()))->getTarDist();
}
iIndClusInf0=HPidMdcFunc::getMdcClusInfoIndexBySegment(pInnerMdcSeg,0);
iIndClusInf1=HPidMdcFunc::getMdcClusInfoIndexBySegment(pInnerMdcSeg,1);
fInnerMdcChiSquare = HPidMdcFunc::getMdcChiSquare(pInnerMdcSeg );
fInnerMdcdEdx = pTrackCand->getdedxInnerSeg();
fInnerMdcdEdxSigma=pTrackCand->getSigmadedxInnerSeg();
fMdcRCoord = pInnerMdcSeg->getR();
fMdcZCoord = pInnerMdcSeg->getZ();
fMdcTheta = HPidFL::getMdcTheta(pInnerMdcSeg->getTheta());
fMdcPhi = HPidFL::getMdcPhi(pInnerMdcSeg->getSec(),pInnerMdcSeg->getPhi());
setFlagInnerMDC();
iIndInnerSeg = pTrackCand->getSeg1Ind();
}
else
{
Error("HPidHitData::fillFromMetMatch()","Inner MDC segment has invalid index");
exit(-1);
}
if(pTrackCand->getSeg2Ind()>-1)
{
pOuterMdcSeg = HPidFL::getMdcSeg(pTrackCand->getSeg2Ind());
}
if(pOuterMdcSeg != NULL)
{
iIndClusInf2=HPidMdcFunc::getMdcClusInfoIndexBySegment(pOuterMdcSeg,0);
iIndClusInf3=HPidMdcFunc::getMdcClusInfoIndexBySegment(pOuterMdcSeg,1);
fOuterMdcChiSquare = HPidMdcFunc::getMdcChiSquare(pOuterMdcSeg);
fOuterMdcdEdx = pTrackCand->getdedxOuterSeg();
fOuterMdcdEdxSigma=pTrackCand->getSigmadedxOuterSeg();
setFlagOuterMDC();
iIndOuterSeg = pTrackCand->getSeg2Ind();
}
}
else
{
Error("HPidHitData::fillFromMetMatch()","MDC track candidate has invalid index");
exit(-1);
}
Int_t bestRingIndex=-1;
if(pMatch->getARichInd(0)>-1)
{
bestRingIndex= HPidFL::pickBestRing(pMatch, fMdcPhi, fMdcTheta);
pRichHit = HPidFL::getRichHit(pMatch->getARichInd(bestRingIndex));
}
if(pRichHit != NULL)
{
nRingPadNr = pRichHit->getRingPadNr();
fRingCentroid = pRichHit->getCentroid();
fRichTheta = pRichHit->getTheta();
fRichPhi = pRichHit->getPhi();
nRingPatMat = pRichHit->getRingPatMat();
nRingHouTra = pRichHit->getRingHouTra();
nRingAmplitude = pRichHit->getRingAmplitude();
nRingLocalMax4 = pRichHit->getRingLocalMax4();
iIndRICH = pMatch->getARichInd(bestRingIndex);
setFlagRICH();
}
if(pMatch->getARichIPUInd(0)>-1)
pRichHitIPU = HPidFL::getRichHitIPU(pMatch->getARichIPUInd(0));
if(pRichHitIPU != NULL)
{
iIPURingQuality = pRichHitIPU->getQuality();
iIPUVetoQuality = pRichHitIPU->getVetoQuality();
setFlagRICHIPU();
iIndRICHIPU = pMatch->getARichIPUInd(0);
}
iSystem=pMatch->getSystem();
if(pMatch->getSystem() == 0)
{
pShowerHitTof = HPidFL::getShowerHitTof(pMatch->getMetaHitInd());
if(!pShowerHitTof) {
pShowerHitTof = HPidFL::getShowerHitTofTrack(pMatch->getMetaHitInd());
}
if(pShowerHitTof!=NULL)
{
setFlagSHOWER();
fShowerSum[0] = pShowerHitTof->getSum(0);
fShowerSum[1] = pShowerHitTof->getSum(1);
fShowerSum[2] = pShowerHitTof->getSum(2);
nShowerClS[0] = pShowerHitTof->getClusterSize(0);
nShowerClS[1] = pShowerHitTof->getClusterSize(1);
nShowerClS[2] = pShowerHitTof->getClusterSize(2);
nShowerRow = pShowerHitTof->getRow();
nShowerCol = pShowerHitTof->getCol();
fShowerTimeOfFlight = pShowerHitTof->getTof();
iIndShower = pMatch->getShowerHitInd();
iTofinoMult = pShowerHitTof->getTofinoMult();
nMetaCell = pShowerHitTof->getTofinoCell();
pShowerHitTof->getXY(&fMetaLocalX, &fMetaLocalY);
}
else
{
Error("HPidHitData::fillFromMeta","Shower hit indexed but not found");
}
}
if(pMatch->getSystem() == 1)
{
Int_t nClsSize = (Int_t)pMatch->getTofClusterSize();
#warning - check this with the MetaMatch expert!
if ( nClsSize <= 0 ){
pTofHit = HPidFL::getTofHit(pMatch->getMetaHitInd());
}
else if ( nClsSize >= 1 ){
pTofHit = HPidFL::getTofCluster(pMatch->getMetaHitInd());
}
else {
Warning("fillFromMetaMatch",
"What should I do with cluster size=%d?", nClsSize);
}
if(pTofHit!=NULL)
{
setFlagTOF();
fTOFTimeOfFlight = pTofHit->getTof();
fTOFLeftAmplitude = pTofHit->getLeftAmp();
fTOFRightAmplitude = pTofHit->getRightAmp();
fTofEloss = pTofHit->getEdep();
iIndTOF = pMatch->getTofHitInd();
nTofClsSize = nClsSize;
nMetaCell = pTofHit->getModule()*8+pTofHit->getCell();
nTofCell = pTofHit->getCell();
nTofModule = pTofHit->getModule();
fMetaLocalX=pTofHit->getXpos();
if(iIndTOF<0)
{
Error("HPidHitData::fillFromMetaMatch","Negative tof hit index!");
}
}
else
{
Error("HPidHitData::fillFromMetaMatch","Tof hit indexed but not found!");
}
}
}
Float_t HPidHitData::getDeltaThetaMDCRICH() const
{
return fRichTheta -fMdcTheta;
}
Float_t HPidHitData::getDeltaPhiMDCRICH() const
{
return ( fRichPhi- fMdcPhi )*TMath::Sin(TMath::DegToRad()*fMdcTheta);
}
Float_t HPidHitData::getDeltaThetaRKRICH(Float_t fRKTheta) const
{
return fRichTheta -fRKTheta;
}
Float_t HPidHitData::getDeltaPhiRKRICH(Float_t fRKPhi,Float_t fRKTheta) const
{
return ( fRichPhi- fRKPhi )*TMath::Sin(TMath::DegToRad()*fRKTheta);
}
void HPidHitData::print(void) const
{
printf("HPidHitData\n");
printf("nRingPadNr: %d\n", nRingPadNr);
printf("fRingCentroid: %f\n", fRingCentroid);
printf("fRichTheta: %f\n", fRichTheta);
printf("fRichPhi: %f\n", fRichPhi);
printf("nRingPatMat: %d\n", nRingPatMat);
printf("nRingHouTra: %d\n", nRingHouTra);
printf("nRingAmplitude: %d\n", nRingAmplitude);
printf("nRingLocalMax4: %d\n", nRingLocalMax4);
printf("fInnerMdcChiSquare: %f\n", fInnerMdcChiSquare);
printf("fInnerMdcdEdx: %f\n", fInnerMdcdEdx);
printf("fInnerMdcdEdxSigma: %f\n", fInnerMdcdEdxSigma);
printf("fMdcRCoord: %f\n",fMdcRCoord);
printf("fMdcZCoord: %f\n",fMdcZCoord);
printf("fMdcTheta: %f\n",fMdcTheta);
printf("fMdcPhi: %f\n",fMdcPhi);
printf("ifOuterMdcChiSquare: %f\n", fOuterMdcChiSquare);
printf("fOuterMdcdEdx: %f\n", fOuterMdcdEdx);
printf("fOuterMdcdEdxSigma: %f\n", fOuterMdcdEdxSigma);
printf("iIPURingQuality: %d\n", iIPURingQuality);
printf("iIPUVetoQuality: %d\n", iIPUVetoQuality);
printf("fShowerSum[0]: %f\n", fShowerSum[0]);
printf("fShowerSum[1]: %f\n", fShowerSum[1]);
printf("fShowerSum[2]: %f\n", fShowerSum[2]);
printf("fShowerTimeOfFlight: %f\n", fShowerTimeOfFlight);
printf("fMetaLocalX: %f\n", fMetaLocalX);
printf("fMetaLocalY: %f\n", fMetaLocalY);
printf("fTOFTimeOfFlight: %f\n", fTOFTimeOfFlight);
printf("fTOFLeftAmplitude: %f\n", fTOFLeftAmplitude);
printf("fTOFRightAmplitude: %f\n", fTOFRightAmplitude);
printf("fTofEloss: %f\n", fTofEloss);
printf("iTofinoMult: %d\n", iTofinoMult);
printf("nMetaCell: %d\n", nMetaCell);
printf("nTofCell: %d\n", nTofCell);
printf("nTofModule: %d\n", nTofModule);
printf("iIndRICH: %d\n",iIndRICH);
printf("iIndRICHIPU: %d\n",iIndRICHIPU);
printf("iIndInnerSeg: %d\n",iIndInnerSeg);
printf("iIndOuterSeg: %d\n",iIndOuterSeg);
printf("iIndShower: %d\n",iIndShower);
printf("iIndTOF: %d\n",iIndTOF);
printf("iIndMatch: %d\n",iIndMatch);
printf("iIndClusInf0: %d\n",iIndClusInf0);
printf("iIndClusInf1: %d\n",iIndClusInf1);
printf("iIndClusInf2: %d\n",iIndClusInf2);
printf("iIndClusInf3: %d\n",iIndClusInf3);
}
Last change: Sat May 22 13:07:09 2010
Last generated: 2010-05-22 13:07
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.