X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=HMPID%2FAliHMPIDCluster.cxx;h=26a55503cc3ca6c0bc6dd6a70e15bbfa1c261552;hb=db0e7063cefb57dc187c92ee0505918fbaa59aba;hp=5849aab28bdeb62bd7ee2e834e7a6b7aa701d34b;hpb=557ca324b917ef9671c6309864c243fe40d661c8;p=u%2Fmrichter%2FAliRoot.git diff --git a/HMPID/AliHMPIDCluster.cxx b/HMPID/AliHMPIDCluster.cxx index 5849aab28bd..26a55503cc3 100644 --- a/HMPID/AliHMPIDCluster.cxx +++ b/HMPID/AliHMPIDCluster.cxx @@ -13,19 +13,73 @@ // * provided "as is" without express or implied warranty. * // ************************************************************************** +#include "AliHMPIDCluster.h" //class header #include //Solve() #include //Solve() #include //Solve() #include //Draw() -#include "AliLog.h" //FitFunc() - -#include "AliHMPIDCluster.h" //class header +#include "AliLog.h" //FindCusterSize() Bool_t AliHMPIDCluster::fgDoCorrSin=kTRUE; ClassImp(AliHMPIDCluster) + +void AliHMPIDCluster::SetClusterParams(Double_t xL,Double_t yL,Int_t iCh ) +{ + //------------------------------------------------------------------------ + //Set the cluster properties for the AliCluster3D part + //------------------------------------------------------------------------ + + //Get the volume ID from the previously set PNEntry + UShort_t volId=AliGeomManager::LayerToVolUID(AliGeomManager::kHMPID,iCh); + + + //get L->T cs matrix for a given chamber + const TGeoHMatrix *t2l= AliGeomManager::GetTracking2LocalMatrix(volId); + + if(!fParam->GetInstType()) //if there is no geometry we cannot retrieve the volId (only for monitoring) + { + new(this) AliCluster3D(); return; + } + + + //transformation from the pad cs to local + xL -= 0.5*fParam->SizeAllX(); //size of all pads with dead zones included + yL -= 0.5*fParam->SizeAllY(); + + // Get the position in the tracking cs + Double_t posL[3]={xL, yL, 0.}; //this is the LORS of HMPID + Double_t posT[3]; + t2l->MasterToLocal(posL,posT); + + //Get the cluster covariance matrix in the tracking cs + Double_t covL[9] = { + 0.8*0.8/12., 0., 0.0, //pad size X + 0., 0.84*0.84/12., 0.0, //pad size Y + 0., 0., 0.1, //just 1 , no Z dimension ??? + }; + + TGeoHMatrix m; + m.SetRotation(covL); + m.Multiply(t2l); + m.MultiplyLeft(&t2l->Inverse()); + Double_t *covT = m.GetRotationMatrix(); + + new(this) AliCluster3D(volId, // Can be done safer + posT[0],posT[1],posT[2], + covT[0],covT[1],covT[2], + covT[4],covT[5], + covT[8], + 0x0); // No MC labels ? +} + + +AliHMPIDCluster::~AliHMPIDCluster(){ + if(fDigs) delete fDigs; fDigs=0; + } + //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ void AliHMPIDCluster::CoG() { @@ -34,7 +88,7 @@ void AliHMPIDCluster::CoG() // Returns: none Int_t minPadX=999,minPadY=999,maxPadX=-1,maxPadY=-1; //for box finding if(fDigs==0) return; //no digits in this cluster - fX=fY=fQRaw=0; //init summable parameters + fXX=fYY=fQRaw=0; //init summable parameters Int_t maxQpad=-1,maxQ=-1; //to calculate the pad with the highest charge AliHMPIDDigit *pDig=0x0; for(Int_t iDig=0;iDigGetEntriesFast();iDig++){ //digits loop @@ -46,14 +100,14 @@ void AliHMPIDCluster::CoG() if(pDig->PadPcY() < minPadY) minPadY = pDig->PadPcY(); // MinY Float_t q=pDig->Q(); //get QDC - fX += pDig->LorsX()*q;fY +=pDig->LorsY()*q; //add digit center weighted by QDC + fXX += pDig->LorsX()*q;fYY +=pDig->LorsY()*q; //add digit center weighted by QDC fQRaw+=q; //increment total charge if(q>maxQ) {maxQpad = pDig->Pad();maxQ=(Int_t)q;} // to find pad with highest charge }//digits loop fBox=(maxPadX-minPadX+1)*100+maxPadY-minPadY+1; // dimension of the box: format Xdim*100+Ydim - if ( fQRaw != 0 ) fX/=fQRaw;fY/=fQRaw; //final center of gravity + if ( fQRaw != 0 ) {fXX/=fQRaw;fYY/=fQRaw;} //final center of gravity if(fDigs->GetEntriesFast()>1&&fgDoCorrSin)CorrSin(); //correct it by sinoid @@ -63,6 +117,9 @@ void AliHMPIDCluster::CoG() fChi2=0; // no Chi2 to find fNlocMax=0; // proper status from this method fSt=kCoG; + + if(fParam->GetInstType()) SetClusterParams(fXX,fYY,fCh); //need to fill the AliCluster3D part + }//CoG() //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ void AliHMPIDCluster::CorrSin() @@ -71,9 +128,9 @@ void AliHMPIDCluster::CorrSin() // Arguments: none // Returns: none Int_t pc,px,py; - AliHMPIDParam::Lors2Pad(fX,fY,pc,px,py); //tmp digit to get it center - Float_t x=fX-AliHMPIDParam::LorsX(pc,px); //diff between cluster x and center of the pad contaning this cluster - fX+=3.31267e-2*TMath::Sin(2*TMath::Pi()/0.8*x)-2.66575e-3*TMath::Sin(4*TMath::Pi()/0.8*x)+2.80553e-3*TMath::Sin(6*TMath::Pi()/0.8*x)+0.0070; + fParam->Lors2Pad(fXX,fYY,pc,px,py); //tmp digit to get it center + Float_t x=fXX-fParam->LorsX(pc,px); //diff between cluster x and center of the pad contaning this cluster + fXX+=3.31267e-2*TMath::Sin(2*TMath::Pi()/0.8*x)-2.66575e-3*TMath::Sin(4*TMath::Pi()/0.8*x)+2.80553e-3*TMath::Sin(6*TMath::Pi()/0.8*x)+0.0070; } //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ void AliHMPIDCluster::Draw(Option_t*) @@ -128,12 +185,12 @@ void AliHMPIDCluster::FitFunc(Int_t &iNpars, Double_t* deriv, Double_t &chi2, Do for(Int_t i=0;iDig(i)->IntMathieson(par[3*j],par[3*j+1]); - derivPart[3*j ][i] += par[3*j+2]*(pClu->Dig(i)->Mathieson(par[3*j]-pClu->Dig(i)->LorsX()-0.5*AliHMPIDParam::SizePadX())- - pClu->Dig(i)->Mathieson(par[3*j]-pClu->Dig(i)->LorsX()+0.5*AliHMPIDParam::SizePadX()))* - pClu->Dig(i)->IntPartMathi(par[3*j+1],2); - derivPart[3*j+1][i] += par[3*j+2]*(pClu->Dig(i)->Mathieson(par[3*j+1]-pClu->Dig(i)->LorsY()-0.5*AliHMPIDParam::SizePadY())- - pClu->Dig(i)->Mathieson(par[3*j+1]-pClu->Dig(i)->LorsY()+0.5*AliHMPIDParam::SizePadY()))* - pClu->Dig(i)->IntPartMathi(par[3*j],1); + derivPart[3*j ][i] += par[3*j+2]*(pClu->Dig(i)->MathiesonX(par[3*j]-pClu->Dig(i)->LorsX()-0.5*AliHMPIDParam::SizePadX())- + pClu->Dig(i)->MathiesonX(par[3*j]-pClu->Dig(i)->LorsX()+0.5*AliHMPIDParam::SizePadX()))* + pClu->Dig(i)->IntPartMathiY(par[3*j+1]); + derivPart[3*j+1][i] += par[3*j+2]*(pClu->Dig(i)->MathiesonY(par[3*j+1]-pClu->Dig(i)->LorsY()-0.5*AliHMPIDParam::SizePadY())- + pClu->Dig(i)->MathiesonY(par[3*j+1]-pClu->Dig(i)->LorsY()+0.5*AliHMPIDParam::SizePadY()))* + pClu->Dig(i)->IntPartMathiX(par[3*j]); derivPart[3*j+2][i] += fracMathi; } } @@ -154,6 +211,9 @@ void AliHMPIDCluster::FitFunc(Int_t &iNpars, Double_t* deriv, Double_t &chi2, Do for(Int_t i=0;i0&&QRaw()>0) ratio = Q()/QRaw()*100; - Printf("%sCLU: ch=%i (%7.3f,%7.3f) Q=%8.3f Qraw=%8.3f(%3.0f%%) Size=%2i DimBox=%i LocMax=%i Chi2=%7.3f %s", + Printf("%sCLU: ch=%i (%7.3f,%7.3f) Q=%8.3f Qraw=%8.3f(%3.0f%%) Size=%2i DimBox=%i LocMax=%i Chi2=%7.3f %s", opt,Ch(),X(),Y(),Q(),QRaw(),ratio,Size(),fBox,fNlocMax,fChi2,status); if(fDigs) fDigs->Print(); }//Print() //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -Int_t AliHMPIDCluster::Solve(TClonesArray *pCluLst,Bool_t isTryUnfold) +Int_t AliHMPIDCluster::Solve(TClonesArray *pCluLst,Int_t *pSigmaCut, Bool_t isTryUnfold) { //This methode is invoked when the cluster is formed to solve it. Solve the cluster means to try to unfold the cluster //into the local maxima number of clusters. This methode is invoked by AliHMPIDRconstructor::Dig2Clu() on cluster by cluster basis. @@ -196,11 +257,25 @@ Int_t AliHMPIDCluster::Solve(TClonesArray *pCluLst,Bool_t isTryUnfold) const Int_t kMaxLocMax=6; //max allowed number of loc max for fitting // CoG(); //First calculate CoG for the given cluster + Int_t iCluCnt=pCluLst->GetEntriesFast(); //get current number of clusters already stored in the list by previous operations - if(isTryUnfold==kFALSE || Size()==1) { //if cluster contains single pad there is no way to improve the knowledge - (isTryUnfold)?fSt=kSi1:fSt=kNot; + + Int_t rawSize = Size(); //get current raw cluster size + + if(rawSize>100) { + fSt = kBig; + } else if(isTryUnfold==kFALSE) { + fSt = kNot; + } else if(rawSize==1) { + fSt = kSi1; + } + + if(rawSize>100 || isTryUnfold==kFALSE || rawSize==1) { //No deconv if: 1 - big cluster (also avoid no zero suppression!) + // 2 - flag is set to FALSE + if(fParam->GetInstType()) SetClusterParams(fXX,fYY,fCh); // 3 - size = 1 new ((*pCluLst)[iCluCnt++]) AliHMPIDCluster(*this); //add this raw cluster return 1; + } //Phase 0. Initialise Fitter @@ -208,6 +283,9 @@ Int_t AliHMPIDCluster::Solve(TClonesArray *pCluLst,Bool_t isTryUnfold) Int_t ierflg = 0; TVirtualFitter *fitter = TVirtualFitter::Fitter(this,3*6); //initialize Fitter + delete fitter; //temporary solution to avoid the inteference with previous instances + fitter = TVirtualFitter::Fitter(this,3*6); //initialize Fitter + arglist[0] = -1; ierflg = fitter->ExecuteCommand("SET PRI", arglist, 1); // no printout ierflg = fitter->ExecuteCommand("SET NOW", arglist, 0); //no warning messages @@ -224,12 +302,12 @@ Int_t AliHMPIDCluster::Solve(TClonesArray *pCluLst,Bool_t isTryUnfold) //Phase 1. Find number of local maxima. Strategy is to check if the current pad has QDC more then all neigbours. Also find the box contaning the cluster fNlocMax=0; - for(Int_t iDig1=0;iDig1LorsX();Double_t yStart=pDig1->LorsY(); - Double_t xMin=xStart-AliHMPIDParam::SizePadX(); - Double_t xMax=xStart+AliHMPIDParam::SizePadX(); - Double_t yMin=yStart-AliHMPIDParam::SizePadY(); - Double_t yMax=yStart+AliHMPIDParam::SizePadY(); + Double_t xMin=xStart-fParam->SizePadX(); + Double_t xMax=xStart+fParam->SizePadX(); + Double_t yMin=yStart-fParam->SizePadY(); + Double_t yMax=yStart+fParam->SizePadY(); ierflg = fitter->SetParameter(3*fNlocMax ,Form("x%i",fNlocMax),xStart,0.1,xMin,xMax); // X,Y,Q initial values of the loc max pad ierflg = fitter->SetParameter(3*fNlocMax+1,Form("y%i",fNlocMax),yStart,0.1,yMin,yMax); // X, Y constrained to be near the loc max - ierflg = fitter->SetParameter(3*fNlocMax+2,Form("q%i",fNlocMax),pDig1->Q(),0.1,0,100000); // Q constrained to be positive + ierflg = fitter->SetParameter(3*fNlocMax+2,Form("q%i",fNlocMax),pDig1->Q(),0.1,0,10000); // Q constrained to be positive fNlocMax++; @@ -259,17 +337,17 @@ Int_t AliHMPIDCluster::Solve(TClonesArray *pCluLst,Bool_t isTryUnfold) //Phase 2. Fit loc max number of Mathiesons or add this current cluster to the list // case 1 -> no loc max found if ( fNlocMax == 0) { // case of no local maxima found: pads with same charge... - - ierflg = fitter->SetParameter(3*fNlocMax ,Form("x%i",fNlocMax),fX,0.1,0,0); // Init values taken from CoG() -> fX,fY,fQRaw - ierflg = fitter->SetParameter(3*fNlocMax+1,Form("y%i",fNlocMax),fY,0.1,0,0); // - ierflg = fitter->SetParameter(3*fNlocMax+2,Form("q%i",fNlocMax),fQRaw,0.1,0,100000); // - fNlocMax = 1; fSt=kNoLoc; + if(fParam->GetInstType()) SetClusterParams(fXX,fYY,fCh); //need to fill the AliCluster3D part + new ((*pCluLst)[iCluCnt++]) AliHMPIDCluster(*this); //add new unfolded cluster + + return fNlocMax; } // case 2 -> loc max found. Check # of loc maxima - if ( fNlocMax >= kMaxLocMax) { // if # of local maxima exceeds kMaxLocMax... + if ( fNlocMax >= kMaxLocMax) { + if(fParam->GetInstType()) SetClusterParams(fXX,fYY,fCh); // if # of local maxima exceeds kMaxLocMax... fSt = kMax; new ((*pCluLst)[iCluCnt++]) AliHMPIDCluster(*this); //...add this raw cluster } else { //or resonable number of local maxima to fit and user requested it // Now ready for minimization step @@ -292,19 +370,25 @@ Int_t AliHMPIDCluster::Solve(TClonesArray *pCluLst,Bool_t isTryUnfold) Double_t dummy; char sName[80]; //vars to get results from Minuit Double_t edm, errdef; Int_t nvpar, nparx; - + for(Int_t i=0;iGetParameter(3*i ,sName, fX, fErrX , dummy, dummy); // X - fitter->GetParameter(3*i+1 ,sName, fY, fErrY , dummy, dummy); // Y + fitter->GetParameter(3*i ,sName, fXX, fErrX , dummy, dummy); // X + fitter->GetParameter(3*i+1 ,sName, fYY, fErrY , dummy, dummy); // Y fitter->GetParameter(3*i+2 ,sName, fQ, fErrQ , dummy, dummy); // Q fitter->GetStats(fChi2, edm, errdef, nvpar, nparx); //get fit infos - if(fSt!=kAbn) { - if(fNlocMax!=1)fSt=kUnf; // if unfolded - if(fNlocMax==1&&fSt!=kNoLoc) fSt=kLo1; // if only 1 loc max - if ( !IsInPc()) fSt = kEdg; // if Out of Pc - if(fSt==kNoLoc) fNlocMax=0; // if with no loc max (pads with same charge..) - } - new ((*pCluLst)[iCluCnt++]) AliHMPIDCluster(*this); //add new unfolded cluster + + if(fNlocMax>1)FindClusterSize(i,pSigmaCut); //find clustersize for deconvoluted clusters + //after this call, fSi temporarly is the calculated size. Later is set again + //to its original value + if(fSt!=kAbn) { + if(fNlocMax!=1)fSt=kUnf; // if unfolded + if(fNlocMax==1&&fSt!=kNoLoc) fSt=kLo1; // if only 1 loc max + if ( !IsInPc()) fSt = kEdg; // if Out of Pc + if(fSt==kNoLoc) fNlocMax=0; // if with no loc max (pads with same charge..) + } + if(fParam->GetInstType()) SetClusterParams(fXX,fYY,fCh); //need to fill the AliCluster3D part + new ((*pCluLst)[iCluCnt++]) AliHMPIDCluster(*this); //add new unfolded cluster + if(fNlocMax>1)SetSize(rawSize); //Original raw size is set again to its proper value } } @@ -312,3 +396,19 @@ Int_t AliHMPIDCluster::Solve(TClonesArray *pCluLst,Bool_t isTryUnfold) }//Solve() //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +void AliHMPIDCluster::FindClusterSize(Int_t i,Int_t *pSigmaCut) +{ + +//Estimate of the clustersize for a deconvoluted cluster + Int_t size = 0; + for(Int_t iDig=0;iDigCh(); + Double_t qPad = Q()*pDig->IntMathieson(X(),Y()); //pad charge + AliDebug(1,Form("Chamber %i X %i Y %i SigmaCut %i pad %i qpadMath %8.2f qPadRaw %8.2f Qtotal %8.2f cluster n.%i",iCh,pDig->PadChX(),pDig->PadChY(), + pSigmaCut[iCh],iDig,qPad,pDig->Q(),QRaw(),i)); + if(qPad>pSigmaCut[iCh]) size++; + } + AliDebug(1,Form(" Calculated size %i",size)); + if(size>0) SetSize(size); //in case of size == 0, original raw clustersize used +}