X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=HMPID%2FAliHMPIDTracker.cxx;h=837164c91e310cfffe080795949c5e3851274f9b;hb=0caa916b85ea54b165b0284e603cd10593ef172d;hp=70aaee3a1dcb3ca6fc4ce942388d4d679601225d;hpb=2247c2198fc777ea86c2d1c20a4a73f1e421d1dc;p=u%2Fmrichter%2FAliRoot.git diff --git a/HMPID/AliHMPIDTracker.cxx b/HMPID/AliHMPIDTracker.cxx index 70aaee3a1dc..837164c91e3 100644 --- a/HMPID/AliHMPIDTracker.cxx +++ b/HMPID/AliHMPIDTracker.cxx @@ -4,9 +4,13 @@ #include "AliHMPIDParam.h" //GetTrackPoint(),PropagateBack() #include "AliHMPIDPid.h" //Recon(),reconHTA() #include "AliHMPIDRecon.h" //Recon() +#include "AliHMPIDRecoParamV1.h" //Recon() +#include "AliHMPIDReconstructor.h"//Recon() #include "AliHMPIDReconHTA.h" //ReconHTA() +#include //Recon() #include //PropagateBack(),Recon() -#include //Intersect() +#include //Intersect() +#include #include //GetTrackPoint(),PropagateBack() #include //GetTrackPoint() #include //GetTrackPoint() @@ -56,17 +60,12 @@ Int_t AliHMPIDTracker::IntTrkCha(AliESDtrack *pTrk,Float_t &xPc,Float_t &yPc,Flo // Static method to find intersection in between given track and HMPID chambers // Arguments: pTrk- ESD track; xPc,yPc- track intersection with PC in LORS [cm] // Returns: intersected chamber ID or -1 - AliHMPIDParam *pParam=AliHMPIDParam::Instance(); + AliHMPIDtrack *hmpTrk = new AliHMPIDtrack(*pTrk); //create a hmpid track to be used for propagation and matching for(Int_t i=AliHMPIDParam::kMinCh;i<=AliHMPIDParam::kMaxCh;i++){ //chambers loop - Double_t p1[3],n1[3]; pParam->Norm(i,n1); pParam->Point(i,p1,AliHMPIDParam::kRad); //point & norm for middle of radiator plane - Double_t p2[3],n2[3]; pParam->Norm(i,n2); pParam->Point(i,p2,AliHMPIDParam::kPc); //point & norm for entrance to PC plane - if(pTrk->Intersect(p1,n1,-GetBz())==kFALSE) continue; //try to intersect track with the middle of radiator - if(pTrk->Intersect(p2,n2,-GetBz())==kFALSE) continue; //try to intersect track with PC - pParam->Mars2LorsVec(i,n1,theta,phi); //track angles at RAD - pParam->Mars2Lors (i,p1,xRa,yRa); //TRKxRAD position - pParam->Mars2Lors (i,p2,xPc,yPc); //TRKxPC position - if(AliHMPIDParam::IsInside(xPc,yPc,pParam->DistCut())==kTRUE) return i; //return intersected chamber + Int_t chInt = IntTrkCha(i,hmpTrk,xPc,yPc,xRa,yRa,theta,phi); + if(chInt>=0) {delete hmpTrk;hmpTrk=0x0;return chInt;} } //chambers loop + delete hmpTrk; hmpTrk=0x0; return -1; //no intersection with HMPID chambers }//IntTrkCha() //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -80,10 +79,10 @@ Int_t AliHMPIDTracker::IntTrkCha(Int_t ch,AliHMPIDtrack *pTrk,Float_t &xPc,Float pParam->Norm(ch,n1); pParam->Point(ch,p1,AliHMPIDParam::kRad); //point & norm for middle of radiator plane Double_t p2[3],n2[3]; - pParam->Norm(ch,n2); + pParam->Norm(ch,n2); pParam->Point(ch,p2,AliHMPIDParam::kPc); //point & norm for entrance to PC plane - if(pTrk->Intersect(pTrk,p1,n1)==kFALSE) return -1; //try to intersect track with the middle of radiator - if(pTrk->Intersect(pTrk,p2,n2)==kFALSE) return -1; + if(pTrk->Intersect(p1,n1)==kFALSE) return -1; //try to intersect track with the middle of radiator + if(pTrk->Intersect(p2,n2)==kFALSE) return -1; pParam->Mars2LorsVec(ch,n1,theta,phi); //track angles at RAD pParam->Mars2Lors (ch,p1,xRa,yRa); //TRKxRAD position pParam->Mars2Lors (ch,p2,xPc,yPc); //TRKxPC position @@ -121,39 +120,57 @@ Int_t AliHMPIDTracker::Recon(AliESDEvent *pEsd,TObjArray *pClus,TObjArray *pNmea // Returns: error code, 0 if no errors AliHMPIDRecon recon; //instance of reconstruction class, nothing important in ctor + AliHMPIDParam *pParam = AliHMPIDParam::Instance(); //Instance of AliHMPIDParam Float_t xPc,yPc,xRa,yRa,theta,phi; - Double_t cluLORS[2]={0},cluMARS[3]={0},trkMARS[3]={0}; + Double_t cluLORS[2]={0}; +// Double_t cluMARS[3]={0},trkMARS[3]={0}; // Double_t bestcluMARS[3]={0,0,0}; - Double_t radClu,radInitTrk; +// Double_t radClu,radInitTrk; Int_t nMipClusTot=0; - Double_t d3d=0,dmin=999999,bz=0; - Bool_t isMatched=kFALSE; - Int_t cluSiz=0; - Double_t qthre = 0; Double_t nmean=0; Int_t cham=0; Int_t hvsec=0; - Int_t index=0; //index of the "best" matching cluster - Double_t bestChi2=-1; //Chi2 of the "best" matching cluster - Double_t chi2=0; +// Double_t d3d=0; + Double_t qthre = 0; Double_t nmean=0; Int_t hvsec=0; Int_t nClusCh[AliHMPIDParam::kMaxCh+1]; - Bool_t isOkQcut=kFALSE; - Bool_t isOkDcut=kFALSE; + + Bool_t tsRight = kTRUE; - AliHMPIDParam *pParam = AliHMPIDParam::Instance(); //Instance of AliHMPIDParam + UInt_t tsmin = (UInt_t)((TF1*)pQthre->At(0))->GetXmin(); // + UInt_t tsmax = (UInt_t)((TF1*)pQthre->At(0))->GetXmax(); // + UInt_t ts = pEsd->GetTimeStamp(); + if(tstsmax) { + AliWarning(Form(" in HMPID time stamp out of range!!! Please check!!! ts = %i",ts)); + tsRight = kFALSE; + } + for(Int_t iTrk=0;iTrkGetNumberOfTracks();iTrk++){ //loop on the ESD tracks in the event - isMatched=kFALSE;dmin=999999;bestChi2=99999;chi2=99999;cluSiz=0; //init. track matching params - isOkQcut = kFALSE; + +// Double_t bestChi2=99999;chi2=99999; //init. track matching params + Double_t dmin=999999,bz=0,distCut=1,distParams[5]={1}; + + Bool_t isOkDcut=kFALSE; + Bool_t isOkQcut=kFALSE; + Bool_t isMatched=kFALSE; + AliHMPIDCluster *bestHmpCluster=0x0; //the best matching cluster - AliESDtrack *pTrk = pEsd->GetTrack(iTrk); //get reconstructed track + AliESDtrack *pTrk = pEsd->GetTrack(iTrk); //get reconstructed track + + if(!pTrk->IsOn(AliESDtrack::kTPCout)) continue; + + if(pTrk->IsOn(AliESDtrack::kTPCrefit)) continue; + AliHMPIDtrack *hmpTrk = new AliHMPIDtrack(*pTrk); //create a hmpid track to be used for propagation and matching bz=AliTracker::GetBz(); +//initial flags for HMPID ESD infos + pTrk->SetHMPIDtrk(0,0,0,0); //no intersection found + pTrk->SetHMPIDmip(0,0,0,0); //store mip info in any case + pTrk->SetHMPIDcluIdx(99,99999); //chamber not found, mip not yet considered + pTrk->SetHMPIDsignal(AliHMPIDRecon::kNotPerformed); //ring reconstruction not yet performed Int_t ipCh=IntTrkCha(pTrk,xPc,yPc,xRa,yRa,theta,phi); //find the intersected chamber for this track - if(ipCh<0) { //no intersection at all, go after next track - pTrk->SetHMPIDtrk(0,0,0,0); //no intersection found - pTrk->SetHMPIDcluIdx (99,99999); //chamber not found, mip not yet considered - pTrk->SetHMPIDsignal(AliHMPIDRecon::kNotPerformed); //ring reconstruction not yet performed - continue; - } + if(ipCh<0) {delete hmpTrk;hmpTrk=0x0;continue;} //no intersection at all, go after next track + + pTrk->SetHMPIDtrk(xPc,yPc,theta,phi); //store initial infos + pTrk->SetHMPIDcluIdx(ipCh,9999); //set chamber, index of cluster + cluster size // track intersects the chamber ipCh: find the MIP @@ -161,111 +178,120 @@ Int_t AliHMPIDTracker::Recon(AliESDEvent *pEsd,TObjArray *pClus,TObjArray *pNmea nMipClusTot = pMipCluLst->GetEntries(); //total number of clusters in the given chamber nClusCh[ipCh] = nMipClusTot; + if(nMipClusTot==0) {delete hmpTrk;hmpTrk=0x0;continue;} + + Int_t index=-1; //index of the "best" matching cluster + for (Int_t iClu=0; iCluUncheckedAt(iClu); //get the cluster // evaluate qThre - if(pQthre->GetEntriesFast()==pParam->kMaxCh+1) { // just for backward compatibility - qthre=((TF1*)pQthre->At(pClu->Ch()))->Eval(pEsd->GetTimeStamp()); // - } else { // in the past just 1 qthre - hvsec = pParam->InHVSector(pClu->Y()); // per chamber - if(hvsec>=0) - qthre=((TF1*)pQthre->At(6*cham+hvsec))->Eval(pEsd->GetTimeStamp()); // - } // -// + if(tsRight){ + if(pQthre->GetEntriesFast()==pParam->kMaxCh+1) { + qthre=((TF1*)pQthre->At(pClu->Ch()))->Eval(ts); // + } else { // in the past just 1 qthre + hvsec = pParam->InHVSector(pClu->Y()); // per chamber + if(hvsec>=0) qthre=((TF1*)pQthre->At(6*ipCh+hvsec))->Eval(ts); // + } + } else qthre = pParam->QCut(); + +// if(pClu->Q()X(); cluLORS[1]=pClu->Y(); //get the LORS coordinates of the cluster - pParam->Lors2Mars(ipCh,cluLORS[0],cluLORS[1],cluMARS); //convert cluster coors. from LORS to MARS - radClu=TMath::Sqrt(cluMARS[0]*cluMARS[0]+cluMARS[1]*cluMARS[1]); //radial distance of candidate cluster in MARS - Double_t trkx0[3]; - hmpTrk->GetXYZ(trkx0); //get track position in MARS - radInitTrk=TMath::Sqrt(trkx0[0]*trkx0[0]+trkx0[1]*trkx0[1]); - hmpTrk->PropagateToR(radClu,10); - hmpTrk->GetXYZ(trkx0); //get track position in MARS - hmpTrk->GetXYZAt(radClu,bz,trkMARS); //get the track coordinates at the rad distance after prop. - d3d=TMath::Sqrt((cluMARS[0]-trkMARS[0])*(cluMARS[0]-trkMARS[0])+(cluMARS[1]-trkMARS[1])*(cluMARS[1]-trkMARS[1])+(cluMARS[2]-trkMARS[2])*(cluMARS[2]-trkMARS[2])); - chi2=hmpTrk->GetPredictedChi2(pClu); - if(dmin > d3d ) { //to be saved for the moment... - cluSiz = pClu->Size(); - dmin=d3d; - bestHmpCluster=pClu; + Double_t dist = TMath::Sqrt((xPc-cluLORS[0])*(xPc-cluLORS[0])+(yPc-cluLORS[1])*(yPc-cluLORS[1])); + + if(distX(); cluLORS[1]=pClu->Y(); -// pParam->Lors2Mars(ipCh,cluLORS[0],cluLORS[1],bestcluMARS); - }//global dmin cut - }//clus loop + bestHmpCluster=pClu; + } + } // clusters loop - pTrk->SetHMPIDmip(0,0,0,0); //store mip info in any case - if(!isOkQcut) { - pTrk->SetHMPIDcluIdx(ipCh,9999); pTrk->SetHMPIDsignal(pParam->kMipQdcCut); - continue; + delete hmpTrk;hmpTrk=0x0; continue; } + + Double_t radius = (pParam->Lors2Mars(ipCh,pParam->SizeAllX()/2,pParam->SizeAllY()/2)).Mag(); - if(dmin < pParam->DistCut()) { - isOkDcut = kTRUE; - } + if(!AliTracker::PropagateTrackToBxByBz(hmpTrk,radius,pTrk->GetMass(),1,kFALSE)) {delete hmpTrk;hmpTrk=0x0;continue;} + + if(!hmpTrk->PropagateTo(bestHmpCluster)) {delete hmpTrk;hmpTrk=0x0;continue;} + + Int_t cluSiz = bestHmpCluster->Size(); + pTrk->SetHMPIDmip(bestHmpCluster->X(),bestHmpCluster->Y(),(Int_t)bestHmpCluster->Q(),0); //store mip info in any case + pTrk->SetHMPIDcluIdx(ipCh,index+1000*cluSiz); //set chamber, index of cluster + cluster size + if(AliHMPIDReconstructor::GetRecoParam()) //retrieve distance cut + { + if(AliHMPIDReconstructor::GetRecoParam()->IsFixedDistCut()==kTRUE) //distance cut is fixed number + { + distCut=AliHMPIDReconstructor::GetRecoParam()->GetHmpTrackMatchingDist(); + } + else + { + for(Int_t ipar=0;ipar<5;ipar++) distParams[ipar]=AliHMPIDReconstructor::GetRecoParam()->GetHmpTrackMatchingDistParam(ipar); //prevision: distance cut is function of momentum + distCut=distParams[0]+distParams[1]*TMath::Power(distParams[2]*pTrk->GetP(),distParams[3]); //prevision: change functional form to be more precise + } + } + else {distCut=pParam->DistCut();} + + if(dmin < distCut) { + isOkDcut = kTRUE; + } + if(!isOkDcut) { - pTrk->SetHMPIDmip(bestHmpCluster->X(),bestHmpCluster->Y(),(Int_t)bestHmpCluster->Q(),0); //store mip info in any case - pTrk->SetHMPIDcluIdx(ipCh,index+1000*cluSiz); //set chamber, index of cluster + cluster size pTrk->SetHMPIDsignal(pParam->kMipDistCut); //closest cluster with enough charge is still too far from intersection } if(isOkQcut*isOkDcut) isMatched = kTRUE; // MIP-Track matched !! - if(!isMatched) continue; // If matched continue... - - Int_t indexAll = 0; - for(Int_t iC=0;iCUpdate(bestHmpCluster,bestChi2,indexAll); - if(!isOk) continue; - pTrk->SetOuterParam(hmpTrk,AliESDtrack::kHMPIDout); + if(!isMatched) {delete hmpTrk;hmpTrk=0x0;continue;} // If matched continue... -// cham=IntTrkCha(ipCh,hmpTrk,xPc,yPc,xRa,yRa,theta,phi); - cham=IntTrkCha(pTrk,xPc,yPc,xRa,yRa,theta,phi); - if(cham<0) { //no intersection at all, go after next track - pTrk->SetHMPIDtrk(0,0,0,0); //no intersection found - pTrk->SetHMPIDcluIdx (99,99999); //chamber not found, mip not yet considered - pTrk->SetHMPIDsignal(AliHMPIDRecon::kNotPerformed); //ring reconstruction not yet performed - continue; - } + Bool_t isOk = hmpTrk->Update(bestHmpCluster,0.1,0); + if(!isOk) {delete hmpTrk;hmpTrk=0x0;continue;} + pTrk->SetOuterHmpParam(hmpTrk,AliESDtrack::kHMPIDout); - pTrk->SetHMPIDtrk(xRa,yRa,theta,phi); //store initial infos + FillResiduals(hmpTrk,bestHmpCluster,kFALSE); + + Int_t iRad = pParam->Radiator(yRa); //evaluate the radiator involved + //evaluate nMean - if(pNmean->GetEntries()==21) { //for backward compatibility - nmean=((TF1*)pNmean->At(3*cham))->Eval(pEsd->GetTimeStamp()); //C6F14 Nmean for this chamber - } else { - Int_t iRad = pParam->Radiator(yRa); //evaluate the radiator involved - if(iRad < 0) { + if(tsRight){ + if(pNmean->GetEntries()==21) { //for backward compatibility + nmean=((TF1*)pNmean->At(3*ipCh))->Eval(ts); //C6F14 Nmean for this chamber + } else { + if(iRad < 0) { nmean = -1; - } else { - Double_t tLow = ((TF1*)pNmean->At(6*cham+2*iRad ))->Eval(pEsd->GetTimeStamp()); //C6F14 low temp for this chamber - Double_t tHigh = ((TF1*)pNmean->At(6*cham+2*iRad+1))->Eval(pEsd->GetTimeStamp()); //C6F14 high temp for this chamber - Double_t tExp = pParam->FindTemp(tLow,tHigh,yRa); //estimated temp for that chamber at that y - nmean = pParam->NIdxRad(AliHMPIDParam::Instance()->GetEPhotMean(),tExp); //mean ref idx @ a given temp - } - if(nmean < 0){ //track didn' t pass through the radiator + } else { + Double_t tLow = ((TF1*)pNmean->At(6*ipCh+2*iRad ))->Eval(ts); //C6F14 low temp for this chamber + Double_t tHigh = ((TF1*)pNmean->At(6*ipCh+2*iRad+1))->Eval(ts); //C6F14 high temp for this chamber + Double_t tExp = pParam->FindTemp(tLow,tHigh,yRa); //estimated temp for that chamber at that y + nmean = pParam->NIdxRad(AliHMPIDParam::Instance()->GetEPhotMean(),tExp); //mean ref idx @ a given temp + } + if(nmean < 0){ //track didn' t pass through the radiator pTrk->SetHMPIDsignal(AliHMPIDRecon::kNoRad); //set the appropriate flag pTrk->SetHMPIDcluIdx(ipCh,index+1000*cluSiz); //set index of cluster + delete hmpTrk;hmpTrk=0x0; continue; + } } - } + } else nmean = pParam->MeanIdxRad(); + // recon.SetImpPC(xPc,yPc); //store track impact to PC - recon.CkovAngle(pTrk,(TClonesArray *)pClus->At(cham),index,nmean); //search for Cerenkov angle of this track - + recon.CkovAngle(pTrk,(TClonesArray *)pClus->At(ipCh),index,nmean,xRa,yRa); //search for Cerenkov angle of this track + + if(pTrk->GetHMPIDsignal()<0) {delete hmpTrk;hmpTrk=0x0;continue;} + AliHMPIDPid pID; Double_t prob[5]; pID.FindPid(pTrk,5,prob); pTrk->SetHMPIDpid(prob); // Printf(" Prob e- %6.2f mu %6.2f pi %6.2f k %6.2f p %6.2f",prob[0]*100,prob[1]*100,prob[2]*100,prob[3]*100,prob[4]*100); - + delete hmpTrk;hmpTrk=0x0; }//iTrk return 0; // error code: 0=no error; @@ -280,7 +306,18 @@ Int_t AliHMPIDTracker::ReconHiddenTrk(AliESDEvent *pEsd,TObjArray *pClus,TObjArr AliHMPIDReconHTA reconHTA; //instance of reconstruction class, nothing important in ctor AliHMPIDParam *pParam = AliHMPIDParam::Instance(); //Instance of AliHMPIDParam - + + Bool_t tsRight = kTRUE; + + UInt_t tsmin = (UInt_t)((TF1*)pQthre->At(0))->GetXmin(); // + UInt_t tsmax = (UInt_t)((TF1*)pQthre->At(0))->GetXmax(); // + UInt_t ts = pEsd->GetTimeStamp(); + + if(tstsmax) { + AliWarning(Form(" in HMPID time stamp out of range!!! Please check!!! ts = %i",ts)); + tsRight = kFALSE; + } + for(Int_t iTrk=0;iTrkGetNumberOfTracks();iTrk++){ //loop on the ESD tracks in the event AliESDtrack *pTrk = pEsd->GetTrack(iTrk); //here it is simulated or just empty track @@ -316,16 +353,19 @@ Int_t AliHMPIDTracker::ReconHiddenTrk(AliESDEvent *pEsd,TObjArray *pClus,TObjArr Int_t hvsec; Double_t qthre=0; + // evaluate qThre + if(tsRight){ if(pQthre->GetEntriesFast()==pParam->kMaxCh+1) { // just for backward compatibility - qthre=((TF1*)pQthre->At(chMip))->Eval(pEsd->GetTimeStamp()); // + qthre=((TF1*)pQthre->At(chMip))->Eval(ts); // } else { // in the past just 1 qthre hvsec = pParam->InHVSector(yMip); // per chamber - if(hvsec>=0) qthre=((TF1*)pQthre->At(6*chMip+hvsec))->Eval(pEsd->GetTimeStamp()); // - } + if(hvsec>=0) qthre=((TF1*)pQthre->At(6*chMip+hvsec))->Eval(ts); // + } + } else qthre = pParam->QCut(); // if(qMipSetHMPIDmip(xMip,yMip,(Int_t)qMip,0); //store mip info in any case + pTrk->SetHMPIDmip(xMip,yMip,(Int_t)qMip,0); //store mip info in any case pTrk->SetHMPIDcluIdx(chMip,indMip+1000*cluMipSiz); pTrk->SetHMPIDsignal(pParam->kMipQdcCut); return 1; //charge compatible with MIP clusters @@ -336,24 +376,28 @@ Int_t AliHMPIDTracker::ReconHiddenTrk(AliESDEvent *pEsd,TObjArray *pClus,TObjArr Double_t yRa = yMip; //just an approx... Double_t nmean; + + Int_t iRad = pParam->Radiator(yRa); //evaluate the radiator involved + //evaluate nMean + if(tsRight){ if(pNmean->GetEntries()==21) { //for backward compatibility - nmean=((TF1*)pNmean->At(3*chMip))->Eval(pEsd->GetTimeStamp()); //C6F14 Nmean for this chamber + nmean=((TF1*)pNmean->At(3*chMip))->Eval(ts); //C6F14 Nmean for this chamber } else { - Int_t iRad = pParam->Radiator(yRa); //evaluate the radiator involved if(iRad < 0) { nmean = -1; } else { - Double_t tLow = ((TF1*)pNmean->At(6*chMip+2*iRad ))->Eval(pEsd->GetTimeStamp()); //C6F14 low temp for this chamber - Double_t tHigh = ((TF1*)pNmean->At(6*chMip+2*iRad+1))->Eval(pEsd->GetTimeStamp()); //C6F14 high temp for this chamber + Double_t tLow = ((TF1*)pNmean->At(6*chMip+2*iRad ))->Eval(ts); //C6F14 low temp for this chamber + Double_t tHigh = ((TF1*)pNmean->At(6*chMip+2*iRad+1))->Eval(ts); //C6F14 high temp for this chamber Double_t tExp = pParam->FindTemp(tLow,tHigh,yRa); //estimated temp for that chamber at that y nmean = pParam->NIdxRad(AliHMPIDParam::Instance()->GetEPhotMean(),tExp); //mean ref idx @ a given temp } if(nmean < 0){ //track didn' t pass through the radiator pTrk->SetHMPIDsignal(AliHMPIDRecon::kNoRad); //set the appropriate flag return 1; - } - } + } + } + } else nmean = pParam->MeanIdxRad(); // if(!reconHTA.CkovHiddenTrk(pTrk,(TClonesArray *)pClus->At(ipCh),indMip,nmean)) { //search for track parameters and Cerenkov angle of this track AliHMPIDPid pID;