#include "AliRICHTracker.h" #include #include #include #include "AliRICH.h" #include "AliRICHHelix.h" #include #include "AliRICHRecon.h" #include #include #include ClassImp(AliRICHTracker) //__________________________________________________________________________________________________ Int_t AliRICHTracker::PropagateBack(AliESD *pESD) { // Interface callback methode invoked by AliRecontruction during tracking after TOF // It steers to different way to provide the final reconstructed information sutable for analisys: // 1. AliESD - reconstructed tracks are used // 2. RICH private ntuple for debug- stack particles used instead of reconstructed tracks AliDebug(1,"Start pattern recognition"); if(pESD->GetNumberOfTracks()) RecWithESD(pESD); else RecWithStack(0); AliDebug(1,"Stop pattern recognition"); return 0; // error code: 0=no error; }//PropagateBack() //__________________________________________________________________________________________________ void AliRICHTracker::RecWithESD(AliESD *pESD) { //recontruction from ESD // Int_t iNtracks=pESD->GetNumberOfTracks(); Double_t b=GetFieldMap()->SolenoidField()/10;// magnetic field in Tesla AliDebug(1,Form("Start with %i tracks in %f Tesla field",iNtracks,b)); Double_t xb[3],pb[3];//tmp storage for track parameters TVector3 x0(0,0,0); TVector3 p0(0,0,0);//tmp storage for AliRICHHelix AliRICH *pRich=((AliRICH*)gAlice->GetDetector("RICH")); for(Int_t iTrackN=0;iTrackNGetTrack(iTrackN);// get next reconstructed track // if((pTrack->GetStatus()&AliESDtrack::kTOFout)==0) continue; //ignore tracks not recontructed by TOF pTrack->GetXYZ(xb); pTrack->GetPxPyPz(pb); Int_t status=pTrack->GetStatus()&AliESDtrack::kTOFout;//get running track parameters Int_t charge = (Int_t)(-TMath::Sign(1.,pTrack->GetSign()*b)); AliDebug(1,Form("Track %i pmod=%f charge=%i stat=%i",iTrackN,pTrack->GetP(),charge,status)); x0.SetXYZ(xb[0],xb[1],xb[2]); p0.SetXYZ(pb[0],pb[1],pb[2]); AliRICHHelix helix(x0,p0,charge,b); Int_t iChamber=helix.RichIntersect(pRich->P()); AliDebug(1,Form("intersection with %i chamber found",iChamber)); if(!iChamber) continue;//intersection with no chamber found Double_t distMip=9999; //min distance between clusters and track position on PC Int_t iMipId=0; //index of that min distance cluster for(Int_t iClusN=0;iClusNClusters(iChamber)->GetEntries();iClusN++){//clusters loop for intersected chamber AliRICHcluster *pClus=(AliRICHcluster*)pRich->Clusters(iChamber)->UncheckedAt(iClusN);//get pointer to current cluster Double_t distCurrent=pClus->DistTo(helix.PosPc());//ditance between current cluster and helix intersection with PC if(distCurrentDistTo(helix.PosPc()))); }//clusters loop for intersected chamber AliDebug(1,Form("Min distance cluster: %i dist is %f",iMipId,distMip)); AliRICHRecon recon(&helix,pRich->Clusters(iChamber),iMipId); //create reconstruction object for helix, list of clusters Double_t thetaCerenkov=recon.ThetaCerenkov(); //search for mean Cerenkov angle for this track AliDebug(1,Form("FINAL Theta Cerenkov=%f",thetaCerenkov)); pTrack->SetRICHsignal(thetaCerenkov); // Double_t richPID[5]={0.2,0.2,0.2,0.2,0.2}; //start with equal probs for (e,mu,pi,k,p) // CalcProb(thetaCerenkov,p0.Mag(),richPID); // pTrack->SetRICHpid(richPID); }//ESD tracks loop AliDebug(1,"Stop."); } //RecWithESD //__________________________________________________________________________________________________ void AliRICHTracker::RecWithStack(TNtupleD *hn) { // Reconstruction for particles from STACK AliRICH *pRich=((AliRICH*)gAlice->GetDetector("RICH")); // pRich->GetLoader()->GetRunLoader()->LoadHeader(); pRich->GetLoader()->GetRunLoader()->LoadKinematics(); AliStack *pStack = pRich->GetLoader()->GetRunLoader()->Stack(); if(!pStack) {AliDebug(1,Form("No STACK found in AliRoot"));return;} Int_t iNtracks=pStack->GetNtrack(); AliDebug(1,Form(" Start reconstruction with %i track(s) from Stack",iNtracks)); Double_t hnvec[20]; Double_t b=GetFieldMap()->SolenoidField()/10;// magnetic field in Tesla AliDebug(1,Form("Start with simulated %i tracks in %f Tesla field",iNtracks,b)); TVector3 x0(0,0,0); TVector3 p0(0,0,0);//tmp storage for AliRICHHelix if(pRich->GetLoader()->LoadRecPoints()) {AliDebug(1,Form("No clusters found in RICH"));return;} pRich->GetLoader()->TreeR()->GetEntry(0); for(Int_t iTrackN=0;iTrackNParticle(iTrackN); if(!pParticle) {AliDebug(1,Form("Not a valid TParticle pointer. Track skipped"));continue;} AliDebug(1,Form(" PDG code : %i",pParticle->GetPdgCode())); // // problem of PDG code of some extra particles to be solved!!!!!!!!! // // found problem! Look in TRD directory : codes from Fluka are : // // if ((pdg_code == 10010020) || // (pdg_code == 10010030) || // (pdg_code == 50000050) || // (pdg_code == 50000051) || // (pdg_code == 10020040)) { // if(pParticle->GetPdgCode()>=50000050||pParticle->GetPdgCode()==0||pParticle->GetPdgCode()>10000) {AliDebug(1,Form("A photon as track... Track skipped"));continue;} // // to be updated for us!! // AliDebug(1,Form("Track %i is a %s with charge %i and momentum %f", iTrackN,pParticle->GetPDG()->GetName(),Int_t(pParticle->GetPDG()->Charge()),pParticle->P())); // if(pParticle->GetMother(0)!=-1) continue; //consider only primaries if(pParticle->GetPDG()->Charge()==0||TMath::Abs(Int_t(pParticle->GetPDG()->Charge()))!=3) continue; //to avoid photons from stack... hnvec[0]=pParticle->P(); hnvec[1]=pParticle->GetPDG()->Charge(); hnvec[2]=pParticle->Theta(); hnvec[3]=pParticle->Phi(); p0.SetMagThetaPhi(pParticle->P(),pParticle->Theta(),pParticle->Phi()); x0.SetXYZ(pParticle->Vx(),pParticle->Vy(),pParticle->Vz()); AliRICHHelix helix(x0,p0,TMath::Sign(1,(Int_t)pParticle->GetPDG()->Charge()),b); Int_t iChamber=helix.RichIntersect(pRich->P()); AliDebug(1,Form("intersection with %i chamber found",iChamber)); if(!iChamber) continue;// no intersection with RICH found hnvec[4]=helix.PosPc().X(); hnvec[5]=helix.PosPc().Y(); Double_t distMip=9999; //min distance between clusters and track position on PC Double_t mipX=kBad; //min distance between clusters and track position on PC Double_t mipY=kBad; //min distance between clusters and track position on PC Double_t chargeMip=kBad; // charge MIP to find Int_t iMipId=kBad; //index of that min distance cluster for(Int_t iClusN=0;iClusNClusters(iChamber)->GetEntries();iClusN++){//clusters loop for intersected chamber AliRICHcluster *pClus=(AliRICHcluster*)pRich->Clusters(iChamber)->UncheckedAt(iClusN);//get pointer to current cluster Double_t distCurrent=pClus->DistTo(helix.PosPc());//ditance between current cluster and helix intersection with PC if(distCurrentX(); mipY=pClus->Y(); chargeMip=pClus->Q();iMipId=1000000*iChamber+iClusN;}//find cluster nearest to the track AliDebug(1,Form("Ploc (%f,%f,%f) dist= %f",helix.Ploc().Mag(),helix.Ploc().Theta()*TMath::RadToDeg(), helix.Ploc().Phi()*TMath::RadToDeg(),pClus->DistTo(helix.PosPc()))); }//clusters loop for intersected chamber AliDebug(1,Form("Min distance cluster: %i dist is %f",iMipId,distMip)); hnvec[6]=mipX;hnvec[7]=mipY; hnvec[8]=chargeMip; AliRICHRecon recon(&helix,pRich->Clusters(iChamber),iMipId); Double_t thetaCerenkov=recon.ThetaCerenkov(); //search for mean Cerenkov angle for this track hnvec[9]=thetaCerenkov; hnvec[10]=recon.GetHoughPhotons(); hnvec[11]=(Double_t)iMipId; hnvec[12]=(Double_t)iChamber; hnvec[13]=(Double_t)pParticle->GetPdgCode(); if(hn) hn->Fill(hnvec); AliDebug(1,Form("FINAL Theta Cerenkov=%f",thetaCerenkov)); }//stack particles loop pRich->GetLoader()->UnloadRecPoints(); AliDebug(1,"Stop."); }//RecWithStack //__________________________________________________________________________________________________ Int_t AliRICHTracker::LoadClusters(TTree *pTree) { // Load clusters for RICH AliDebug(1,"Start."); pTree->GetEntry(0); AliDebug(1,"Stop."); return 0; } //__________________________________________________________________________________________________ void AliRICHTracker::CalcProb(Double_t thetaCer,Double_t pmod, Double_t *richPID) { // Calculates probability to be a electron-muon-pion-kaon-proton // from the given Cerenkov angle and momentum assuming no initial particle composition // (i.e. apriory probability to be the particle of the given sort is the same for all sorts) Double_t height[AliPID::kSPECIES];Double_t totalHeight=0; for(Int_t iPart=0;iPart=1) {break;} Double_t thetaTh = TMath::ACos(cosThetaTh); Double_t sinThetaThNorm = TMath::Sin(thetaTh)/TMath::Sqrt(1-1/(refIndex*refIndex)); Double_t sigmaThetaTh = (0.014*(1/sinThetaThNorm-1) + 0.0043)*1.25; height[iPart] = TMath::Gaus(thetaCer,thetaTh,sigmaThetaTh); totalHeight +=height[iPart]; } for(Int_t iPart=0;iPart