X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=RICH%2FAliRICHDigitizer.cxx;h=0129130f9cc8a4ba13cdede0b065486ebb771525;hb=665c0a68db3f5878e2c818fe346b3b452f659d16;hp=6858aca1821985eccc9174fcb440752774c35a35;hpb=aed240d46ec890e36e1661af4805fafc8f029db1;p=u%2Fmrichter%2FAliRoot.git diff --git a/RICH/AliRICHDigitizer.cxx b/RICH/AliRICHDigitizer.cxx index 6858aca1821..0129130f9cc 100644 --- a/RICH/AliRICHDigitizer.cxx +++ b/RICH/AliRICHDigitizer.cxx @@ -13,73 +13,70 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ - -//Piotr.Skowronski@cern.ch : -//Corrections applied in order to compile (only) with new I/O and folder structure -//To be implemented correctly by responsible - -#include - -#include -#include -#include -#include -#include - -#include -#include - #include "AliRICHDigitizer.h" #include "AliRICH.h" -#include "AliRun.h" -#include "AliPDG.h" +#include +#include #include "AliRunDigitizer.h" +#include +#include + ClassImp(AliRICHDigitizer) -//__________________________________________________________________________________________________ -AliRICHDigitizer::AliRICHDigitizer(AliRunDigitizer *pManager) - :AliDigitizer(pManager) -{//main ctor which should be used -}//main ctor -//__________________________________________________________________________________________________ -AliRICHDigitizer::~AliRICHDigitizer() -{//dtor - if(fManager->GetDebug())Info("dtor","Start."); -}//dtor //__________________________________________________________________________________________________ void AliRICHDigitizer::Exec(Option_t*) { - - 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"); - +//This methode is responsible for merging sdigits to a list of digits +//Disintegration leeds to the fact that one hit affected 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 tmpCA("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->SDigs()->GetEntries())); + for(Int_t i=0;iSDigs()->GetEntries();i++){//collect sdigits from current input to tmpCA + new(tmpCA[total++]) AliRICHDigit(*(AliRICHDigit*)pInRich->SDigs()->At(i)); + ((AliRICHDigit*)tmpCA[total-1])->AddTidOffset(fManager->GetMask(inFileN));//apply TID shift since all inputs count tracks independently starting from 0 + } + pInRichLoader->UnloadSDigits(); pInRich->SDigReset(); //close current input and reset + }//files loop - - AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH"); + tmpCA.Sort(); //at this point we have a list of all sdigits from all inputs, now sort them according to fPad field - if(!pOutRL->TreeD()) pOutRL->MakeTree("D"); pRICH->MakeBranch("D"); + 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 + TVector pad(2); pad[0]=0; pad[1]=0; Int_t iChamber=0,iCfm=0,aTids[3]={0,0,0},iId=-1; Double_t dQdc=0;//current pad info + Int_t iNdigsPerPad=0; //how many sdigits for a given pad + for(Int_t i=0;iPadAbs()==iId){//still the same pad + iNdigsPerPad++; dQdc+=pSdig->Qdc(); iCfm+=pSdig->Cfm();//sum up charge and cfm + if(pSdig->Cfm()==1) aTids[0] = pSdig->GetTrack(0); // force the first tid to be mip's tid if it exists in the current pad + if(iNdigsPerPad<=3) aTids[iNdigsPerPad-1]=pSdig->GetTrack(0); + else AliDebug(1,Form("More then 3 sdigits in (%d,%d,%f,%f) with Q= %f",pSdig->Chamber(),-1,pSdig->Pad()(0),pSdig->Pad()(1),pSdig->Qdc())); + }else{//new pad, add the pevious one + if(iId!=-1 && AliRICHParam::IsOverTh(iChamber,pad,dQdc)) pOutRich->DigAdd(iChamber,pad,(Int_t)dQdc,iCfm,aTids); //add newly created dig + iChamber=pSdig->Chamber(); pad=pSdig->Pad(); iCfm=pSdig->Cfm(); dQdc=pSdig->Qdc(); iId=pSdig->PadAbs(); //init all values by current sdig + iNdigsPerPad=1; aTids[0]=pSdig->GetTrack(0); aTids[1]=aTids[2]=-1; + } + }//sdigits loop (sorted) + if(tmpCA.GetEntries() && AliRICHParam::IsOverTh(iChamber,pad,dQdc)) pOutRich->DigAdd(iChamber,pad,(Int_t)dQdc,iCfm,aTids);//add the last dig - for(Int_t inputFile=0;inputFileGetNinputs();inputFile++){//files loop - pInAL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(inputFile)); - pInRL = pInAL->GetLoader("RICHLoader"); - - - }//files loop - - - - pOutRL->TreeD()->Fill(); - - - pRICH->ResetDigits(); /// ??? should it be here??? + pOutRichLoader->TreeD()->Fill(); //fill the output tree with the list of digits + pOutRichLoader->WriteDigits("OVERWRITE"); //serialize them to file - pOutRL->WriteDigits("OVERWRITE"); - - pOutRL->UnloadHits(); - pOutRL->UnloadDigits(); + tmpCA.Clear(); //remove all tmp sdigits + pOutRichLoader->UnloadDigits(); pOutRich->DigReset(); }//Exec()