X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=HMPID%2FAliHMPIDReconstructor.cxx;h=d01ca390bd2fc1207948fa8cc5c1e555ed74f307;hb=66ee9f2fea51bc69509147f93422741d1f509ef3;hp=4264ec91fc70bba563711a9afbbc646761f1bad5;hpb=dac53a45e1151e854da3ac3483d1205764f46b9c;p=u%2Fmrichter%2FAliRoot.git diff --git a/HMPID/AliHMPIDReconstructor.cxx b/HMPID/AliHMPIDReconstructor.cxx index 4264ec91fc7..d01ca390bd2 100644 --- a/HMPID/AliHMPIDReconstructor.cxx +++ b/HMPID/AliHMPIDReconstructor.cxx @@ -26,56 +26,41 @@ #include //ctor #include //FillEsd() #include //Reconstruct() for raw digits +#include // #include "AliHMPIDRawStream.h" //ConvertDigits() -#include "AliHMPIDRecoParam.h" //ctor +#include "AliHMPIDRecoParamV1.h" //ctor +#include ClassImp(AliHMPIDReconstructor) -AliHMPIDRecoParam* AliHMPIDReconstructor::fgkRecoParam =0; // +Int_t AliHMPIDReconstructor::fgStreamLevel = 0; // stream (debug) level + //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -AliHMPIDReconstructor::AliHMPIDReconstructor():AliReconstructor(),fUserCut(0),fDaqSig(0),fDig(0),fClu(0) +AliHMPIDReconstructor::AliHMPIDReconstructor():AliReconstructor(),fDaqSig(0),fDig(0),fClu(0) { // //ctor // AliHMPIDParam::Instance(); //geometry loaded for reconstruction - fUserCut = new Int_t[7]; + fClu=new TObjArray(AliHMPIDParam::kMaxCh+1); fClu->SetOwner(kTRUE); fDig=new TObjArray(AliHMPIDParam::kMaxCh+1); fDig->SetOwner(kTRUE); for(int i=AliHMPIDParam::kMinCh;i<=AliHMPIDParam::kMaxCh;i++){ - fDig->AddAt(new TClonesArray("AliHMPIDDigit"),i); - TClonesArray *pClus = new TClonesArray("AliHMPIDCluster"); + fDig->AddAt(new TClonesArray("AliHMPIDDigit",24000),i); + TClonesArray *pClus = new TClonesArray("AliHMPIDCluster",24000); pClus->SetUniqueID(i); fClu->AddAt(pClus,i); } - - if(fgkRecoParam!=0x0 && fgkRecoParam->GetUserCutMode()==kFALSE) - { - for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) { - fUserCut[iCh] = fgkRecoParam->GetUserCut(iCh); - Printf("HMPID: UserCut successfully loaded (from RecoParam) for chamber %i -> %i ",iCh,fUserCut[iCh]); - } - } - else { - AliCDBEntry *pUserCutEnt =AliCDBManager::Instance()->Get("HMPID/Calib/UserCut"); //contains TObjArray of 14 TObject with n. of sigmas to cut charge - if(pUserCutEnt) { - TObjArray *pUserCut = (TObjArray*)pUserCutEnt->GetObject(); - for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){ //chambers loop - fUserCut[iCh] = pUserCut->At(iCh)->GetUniqueID(); - Printf("HMPID: UserCut successfully loaded (from OCDB) for chamber %i -> %i ",iCh,fUserCut[iCh]); - } - } - } - + AliCDBEntry *pDaqSigEnt =AliCDBManager::Instance()->Get("HMPID/Calib/DaqSig"); //contains TObjArray of TObjArray 14 TMatrixF sigmas values for pads if(!pDaqSigEnt) AliFatal("No pedestals from DAQ!"); fDaqSig = (TObjArray*)pDaqSigEnt->GetObject(); for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){ //chambers loop - Printf(" HMPID: DaqSigCut successfully loaded for chamber %i -> %i ",iCh,(Int_t)fDaqSig->At(iCh)->GetUniqueID()); + AliDebug(1,Form("DaqSigCut successfully loaded for chamber %i -> %i ",iCh,(Int_t)fDaqSig->At(iCh)->GetUniqueID())); } }//AliHMPIDReconstructor //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -void AliHMPIDReconstructor::Dig2Clu(TObjArray *pDigAll,TObjArray *pCluAll,Bool_t isTryUnfold) +void AliHMPIDReconstructor::Dig2Clu(TObjArray *pDigAll,TObjArray *pCluAll,Int_t *pUserCut,Bool_t isTryUnfold) { // Finds all clusters for a given digits list provided not empty. Currently digits list is a list of all digits for a single chamber. // Puts all found clusters in separate lists, one per clusters. @@ -83,6 +68,7 @@ void AliHMPIDReconstructor::Dig2Clu(TObjArray *pDigAll,TObjArray *pCluAll,Bool_t // pCluAll - list of clusters for all chambers // isTryUnfold - flag to choose between CoG and Mathieson fitting // Returns: none + TMatrixF padMap(AliHMPIDParam::kMinPx,AliHMPIDParam::kMaxPcx,AliHMPIDParam::kMinPy,AliHMPIDParam::kMaxPcy); //pads map for single chamber 0..159 x 0..143 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){ //chambers loop @@ -102,8 +88,7 @@ void AliHMPIDReconstructor::Dig2Clu(TObjArray *pDigAll,TObjArray *pCluAll,Bool_t AliHMPIDDigit *pDig=(AliHMPIDDigit*)pDigCur->At(iDig); //take current digit if(!(pDig=UseDig(pDig->PadChX(),pDig->PadChY(),pDigCur,&padMap))) continue; //this digit is already taken in FormClu(), go after next digit FormClu(&clu,pDig,pDigCur,&padMap); //form cluster starting from this digit by recursion - - clu.Solve(pCluCur,isTryUnfold); //solve this cluster and add all unfolded clusters to provided list + clu.Solve(pCluCur,pUserCut,isTryUnfold); //solve this cluster and add all unfolded clusters to provided list clu.Reset(); //empty current cluster }//digits loop for current chamber }//chambers loop @@ -136,18 +121,38 @@ void AliHMPIDReconstructor::Reconstruct(TTree *pDigTree,TTree *pCluTree)const // Returns: none AliDebug(1,"Start."); for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) { - pCluTree->Branch(Form("HMPID%d",iCh),&((*fClu)[iCh]),4000,0); + pCluTree->Branch(Form("HMPID%d",iCh),&((*fClu)[iCh]),7); pDigTree->SetBranchAddress(Form("HMPID%d",iCh),&((*fDig)[iCh])); } + + Int_t pUserCut[7]; + + if(AliHMPIDReconstructor::GetRecoParam()) { + for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) { + pUserCut[iCh] = AliHMPIDReconstructor::GetRecoParam()->GetHmpUserCut(iCh); + AliDebug(1,Form("UserCut successfully loaded (from AliHMPIDRecoParamV1) for chamber %i -> %i ",iCh,pUserCut[iCh])); + } + } + else { + for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) { + pUserCut[iCh] = 4; // minimal requirement for sigma cut + AliDebug(1,Form("UserCut loaded from defaults for chamber %i -> %i ",iCh,pUserCut[iCh])); + AliDebug(1,Form("Cannot get AliHMPIDRecoParamV1!")); + } + } + TVirtualFitter* fitter = TVirtualFitter::GetFitter(); + delete fitter; + fitter = TVirtualFitter::Fitter(0,3*6); // create a new fitter to avoid interferrence with others pDigTree->GetEntry(0); - Dig2Clu(fDig,fClu); //cluster finder + Dig2Clu(fDig,fClu,pUserCut); //cluster finder pCluTree->Fill(); //fill tree for current event - + delete fitter; for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){ fDig->At(iCh)->Clear(); fClu->At(iCh)->Clear(); } + AliDebug(1,"Stop."); }//Reconstruct(for simulated digits) //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -160,50 +165,45 @@ void AliHMPIDReconstructor::ConvertDigits(AliRawReader *pRR,TTree *pDigTree)cons AliDebug(1,"Start."); // Int_t digcnt=0; + Int_t iDigCnt[7]={0,0,0,0,0,0,0}; - for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) { - pDigTree->Branch(Form("HMPID%d",iCh),&((*fDig)[iCh]),4000,0); + for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){ + pDigTree->Branch(Form("HMPID%d",iCh),&((*fDig)[iCh])); + } - Int_t iDigCnt=0; - AliHMPIDRawStream stream(pRR); - while(stream.Next()) - { + Int_t pUserCut[7]; + + if(AliHMPIDReconstructor::GetRecoParam()) { + for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) { + pUserCut[iCh] = AliHMPIDReconstructor::GetRecoParam()->GetHmpUserCut(iCh); + AliDebug(1,Form("UserCut successfully loaded (from AliHMPIDRecoParamV1) for chamber %i -> %i ",iCh,pUserCut[iCh])); + } + } + else { + for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) { + pUserCut[iCh] = 4; // minimal requirement for sigma cut + AliDebug(1,Form("UserCut loaded from defaults for chamber %i -> %i ",iCh,pUserCut[iCh])); + AliDebug(1,Form("Cannot get AliHMPIDRecoParamV1!")); + } + } - UInt_t ddl=stream.GetDDLNumber(); //returns 0,1,2 ... 13 - if((UInt_t)(2*iCh)==ddl || (UInt_t)(2*iCh+1)==ddl) { - for(Int_t row = 1; row <= AliHMPIDRawStream::kNRows; row++){ - for(Int_t dil = 1; dil <= AliHMPIDRawStream::kNDILOGICAdd; dil++){ - for(Int_t pad = 0; pad < AliHMPIDRawStream::kNPadAdd; pad++){ - if(stream.GetCharge(ddl,row,dil,pad) < 1) continue; - AliHMPIDDigit dig(stream.GetPad(ddl,row,dil,pad),stream.GetCharge(ddl,row,dil,pad)); - if(!IsDigSurvive(&dig)) continue; - new((*((TClonesArray*)fDig->At(iCh)))[iDigCnt++]) AliHMPIDDigit(dig); //add this digit to the tmp list - }//pad - }//dil - }//row - }//while + AliHMPIDRawStream stream(pRR); + + while(stream.Next()) + { + Int_t ch = AliHMPIDParam::DDL2C(stream.GetDDLNumber()); + for(Int_t iPad=0;iPadAt(ch)))[iDigCnt[ch]++]) AliHMPIDDigit(dig); //add this digit to the tmp list } - stream.Delete(); } + pDigTree->Fill(); for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++)fDig->At(iCh)->Clear(); + AliDebug(1,"Stop."); }//Reconstruct digits from raw digits //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -void AliHMPIDReconstructor::FillESD(TTree */*digitsTree*/, TTree */*clustersTree*/, AliESDEvent *pESD) const -{ -// Fill ESD with all the infos from HMPID -// Probability vector from AliHMPIDPid -//... - AliHMPIDPid pID; - Double_t prob[AliPID::kSPECIES]; - - for(Int_t iTrk=0;iTrkGetNumberOfTracks();iTrk++){//ESD tracks loop - AliESDtrack *pTrk = pESD->GetTrack(iTrk);// get next reconstructed track - pID.FindPid(pTrk,AliPID::kSPECIES,prob); - pTrk->SetHMPIDpid(prob); - }//ESD tracks loop - -}//FillESD()