//----------------------------------------------------------- // File and Version Information: // $Id$ // // Description: // Implementation of resCalc // Uses existing CDC circle fits (XY) and calculates // residua in XY. // // Environment: // Software developed for the PANDA Detector at FAIR. // // Author List: // Sverre Doerhein (original author) // // Physik Department E18, TUM // //----------------------------------------------------------- //Header #include "TpcCdcTrackTrackCylResCalc.h" //ROOT #include "TClonesArray.h" #include "TClass.h" //Collaborating classes #include "CdcTrack.h" #include "TpcCluster.h" #include "TpcResidual.h" #include "TpcRefResidualCollection.h" #include "TpcAlignmentManager.h" //Genfit #include "GFTrack.h" #include "RKTrackRep.h" #include "GFAbsTrackRep.h" #include "GFException.h" #include "GFTools.h" //Standard lib #include #include #include TpcCdcTrackTrackCylResCalc::TpcCdcTrackTrackCylResCalc() :fAlignment(false),fRadius(20),fPhiCut(TMath::Pi()/12), fCdcTrackBranchName("CdcTrackPostFit"), fTpcTrackBranchName("TpcTrackPostFit") { fNExpectedBranches = 2; } TpcCdcTrackTrackCylResCalc::~TpcCdcTrackTrackCylResCalc() {;} bool TpcCdcTrackTrackCylResCalc::init() { if(fBranchMap.size() != fNExpectedBranches) { std::cerr<<"TpcCdcTrackTrackCylResCalc::init(): "<GetClass()->GetName()); if(type.find(cdcTrackRefType)GetClass()->GetName()); if(type.find(tpcTrackType)GetEntriesFast(); unsigned int nTpcTracks = fTpcTrackArray->GetEntriesFast(); std::vector tpcPos; std::vector tpcCov; bool firstCdcTrack=true; //std::cout<<"calc(): nCdcTracks:"<UncheckedAt(iCdc); RKTrackRep* cdcRep=(RKTrackRep*) cdcTrack->getCardinalRep(); if(cdcRep->getStatusFlag()){ continue; } TVector3 cpos,cmom; TVector3 cposErr,cmomErr; TMatrixDSym ccov; try{ cdcRep->extrapolateToCylinder(fRadius,cpos,cmom); GFDetPlane plane(cpos,cmom); cdcRep->getPosMomCov(plane,cposErr,cmomErr,ccov); }catch(GFException exp){ // std::cerr<<__FILE__<<": "<<__LINE__<<": "<<": "<UncheckedAt(iTpc); RKTrackRep* tpcRep=(RKTrackRep*) tpcTrack->getCardinalRep(); if(tpcRep->getStatusFlag()){ continue; } GFTrackCand cand = tpcTrack->getCand(); int irep=tpcTrack->getCardinalRepID(); int ihit=cand.getNHits()-1; if(tpcTrack->getSmoothing()){ GFTools::updateRepSmoothed(tpcTrack,irep,ihit); } TVector3 tpos,tmom; TVector3 tposErr,tmomErr; TMatrixDSym tcov; try{ tpcRep->extrapolateToCylinder(fRadius,tpos,tmom); GFDetPlane plane(tpos,tmom); tpcRep->getPosMomCov(plane,tposErr,tmomErr,tcov); }catch(GFException exp){ // std::cerr<<__FILE__<<": "<<__LINE__<<": "< fPhiCut){ continue; } TpcResidual* theRes=new TpcResidual(); theRes->setResXYZ(cposErr-tposErr); theRes->setRefPos(cposErr); theRes->setHitPos(tposErr); theRes->setTrackCov(ccov3); theRes->setHitCov(tcov3); theRes->setTrackDir(cmomErr.Unit()); ////std::cout<<" adding res"; fResults.back()->addResidual(theRes); }else{ //std::cout<<"using old extrap "< fPhiCut){ continue; } TpcResidual* theRes=new TpcResidual(); theRes->setResXYZ(cposErr-tpcPos[iTpc]); theRes->setRefPos(cposErr); theRes->setHitPos(tpcPos[iTpc]); theRes->setTrackCov(ccov3); theRes->setHitCov(tpcCov[iTpc]); theRes->setTrackDir(cmomErr.Unit()); ////std::cout<<" adding res"; fResults.back()->addResidual(theRes); } } firstCdcTrack=false; } ////std::cout<