X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;ds=sidebyside;f=RICH%2FAliRICHDigitizer.cxx;h=25361f65158f21f1d1222588b8dff14b29727301;hb=7d0f353c97d9d272d42838d06bc26878859827df;hp=04b1195348cf8de03cad1502659ce3af79f91f27;hpb=3582c1f981a3c64204f8b80e5a95766560761c4c;p=u%2Fmrichter%2FAliRoot.git diff --git a/RICH/AliRICHDigitizer.cxx b/RICH/AliRICHDigitizer.cxx index 04b1195348c..25361f65158 100644 --- a/RICH/AliRICHDigitizer.cxx +++ b/RICH/AliRICHDigitizer.cxx @@ -13,80 +13,92 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ - -#include - -#include -#include -#include -#include -#include - -#include -#include - #include "AliRICHDigitizer.h" #include "AliRICH.h" -#include "AliRun.h" -#include "AliPDG.h" +#include "AliRICHDigit.h" +#include +#include #include "AliRunDigitizer.h" +#include +#include + ClassImp(AliRICHDigitizer) -//__________________________________________________________________________________________________ -AliRICHDigitizer::AliRICHDigitizer() -{//default constructor -}//default ctor -//__________________________________________________________________________________________________ -AliRICHDigitizer::AliRICHDigitizer(AliRunDigitizer *pManager) - :AliDigitizer(pManager) -{ -//main ctor which should be used - if(GetDebug())Info("main ctor","Start."); - fRich=(AliRICH*)gAlice->GetDetector("RICH"); -}//main ctor -//__________________________________________________________________________________________________ -AliRICHDigitizer::~AliRICHDigitizer() -{ -//dtor - if(GetDebug())Info("dtor","Start."); -}//dtor -//__________________________________________________________________________________________________ +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ void AliRICHDigitizer::Exec(Option_t*) { - if(GetDebug())Info("Exec","Start with %i input(s) and %i",fManager->GetNinputs(),fManager->GetOutputEventNr()); +// This methode is responsible for merging sdigits to a list of digits +//Disintegration leeds to the fact that one hit affects several neighbouring pads, which means that the same pad might be affected by few hits. + AliDebug(1,Form("Start with %i input(s) for event %i",fManager->GetNinputs(),fManager->GetOutputEventNr())); +//First we read all sdigits from all inputs + AliRunLoader *pInRunLoader=0;//in and out Run loaders + AliLoader *pInRichLoader=0;//in and out RICH loaders + TClonesArray sdigs("AliRICHDigit");//tmp storage for sdigits sum up from all input files + Int_t total=0; + for(Int_t inFileN=0;inFileNGetNinputs();inFileN++){//files loop + pInRunLoader = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(inFileN)); //get run loader from current input + pInRichLoader = pInRunLoader->GetLoader("RICHLoader"); if(pInRichLoader==0) continue; //no RICH in this input, check the next input + if (!pInRunLoader->GetAliRun()) pInRunLoader->LoadgAlice(); + AliRICH* pInRich=(AliRICH*)pInRunLoader->GetAliRun()->GetDetector("RICH"); //take RICH from current input + pInRichLoader->LoadSDigits(); pInRichLoader->TreeS()->GetEntry(0); //take list of RICH sdigits from current input + AliDebug(1,Form("input %i has %i sdigits",inFileN,pInRich->SdiLst()->GetEntries())); + for(Int_t i=0;iSdiLst()->GetEntries();i++){ //collect sdigits from current input + AliRICHDigit *pSDig=(AliRICHDigit*)pInRich->SdiLst()->At(i); + pSDig->AddTidOffset(fManager->GetMask(inFileN)); //apply TID shift since all inputs count tracks independently starting from 0 + new(sdigs[total++]) AliRICHDigit(*pSDig); + } + pInRichLoader->UnloadSDigits(); pInRich->SdiReset(); //close current input and reset + }//files loop + + //PH if(sdigs.GetEntries()==0) return; //no sdigits collected, nothing to convert - AliRunLoader *pInAL, *pOutAL;//in and out Run loaders - AliLoader *pInRL, *pOutRL;//in and out RICH loaders - - pOutAL = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName()); - pOutRL = pOutAL->GetLoader("RICHLoader"); + AliRunLoader *pOutRunLoader = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName()); //open output stream (only 1 possible) + AliLoader *pOutRichLoader = pOutRunLoader->GetLoader("RICHLoader"); //take output RICH loader + AliRICH *pOutRich = (AliRICH*)pOutRunLoader->GetAliRun()->GetDetector("RICH"); //take output RICH + pOutRichLoader->MakeTree("D"); pOutRich->MakeBranch("D"); //create TreeD in output stream + Sdi2Dig(&sdigs,pOutRich->DigLst()); - - AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH"); + pOutRichLoader->TreeD()->Fill(); //fill the output tree with the list of digits + pOutRichLoader->WriteDigits("OVERWRITE"); //serialize them to file - if(!pOutRL->TreeD()) pOutRL->MakeTree("D"); pRICH->MakeBranch("D"); + sdigs.Clear(); //remove all tmp sdigits + pOutRichLoader->UnloadDigits(); pOutRich->DigReset(); +}//Exec() +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +void AliRICHDigitizer::Sdi2Dig(TClonesArray *pSdiLst,TObjArray *pDigLst) +{ +// Converts list of sdigits to 7 lists of digits, one per each chamber +// Arguments: pSDigLst - list of all sdigits +// pDigLst - list of 7 lists of digits +// Returns: none + TClonesArray *pLst[7]; Int_t iCnt[7]; - for(Int_t inputFile=0;inputFileGetNinputs();inputFile++){//files loop - pInAL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(inputFile)); - pInRL = pInAL->GetLoader("RICHLoader"); - pInRL->LoadSDigits(); - pInRL->TreeD()->GetEntries(0); - }//files loop - - - - pOutRL->TreeD()->Fill(); - - - pRICH->ResetDigits(); /// ??? should it be here??? + for(Int_t i=0;i<7;i++){ + pLst[i]=(TClonesArray*)(*pDigLst)[i]; + iCnt[i]=pLst[i]->GetEntries(); //in principle those lists should be empty + } - pOutRL->WriteDigits("OVERWRITE"); - - pOutRL->UnloadHits(); - pOutRL->UnloadDigits(); - if(GetDebug())Info("Exec","Stop"); -}//Exec() -//__________________________________________________________________________________________________ + pSdiLst->Sort(); + + Int_t iPad=-1,iCh=-1,iNdigPad=-1,aTids[3]={-1,-1,-1}; Float_t q=-1; + for(Int_t i=0;iGetEntries();i++){ //sdigits loop (sorted) + AliRICHDigit *pSdig=(AliRICHDigit*)pSdiLst->At(i); //take current sdigit + if(pSdig->Pad()==iPad){ //if the same pad + q+=pSdig->Q(); //sum up charge + iNdigPad++; if(iNdigPad<=3) aTids[iNdigPad-1]=pSdig->GetTrack(0); //collect TID + continue; + } + if(i!=0 && AliRICHDigit::IsOverTh(q)) new((*pLst[iCh])[iCnt[iCh]++]) AliRICHDigit(iPad,(Int_t)q,aTids); //do not create digit for the very first sdigit + iPad=pSdig->Pad(); iCh=AliRICHDigit::A2C(iPad); //new sdigit comes, reset collectors + iNdigPad=1; + aTids[0]=pSdig->GetTrack(0);aTids[1]=aTids[2]=-1; + q=pSdig->Q(); + }//sdigits loop (sorted) + + if(AliRICHDigit::IsOverTh(q)) new((*pLst[iCh])[iCnt[iCh]++]) AliRICHDigit(iPad,(Int_t)q,aTids); //add the last one, in case of empty sdigits list q=-1 + //so digit is not created +}//Sdi2Dig() +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++