]>
Commit | Line | Data |
---|---|---|
b762c2f6 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2000, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
b762c2f6 | 16 | #include "AliRICHDigitizer.h" |
b762c2f6 | 17 | #include "AliRICH.h" |
0fe8fa07 | 18 | #include <AliRun.h> |
19 | #include <AliRunLoader.h> | |
b762c2f6 | 20 | #include "AliRunDigitizer.h" |
0fe8fa07 | 21 | #include <AliLoader.h> |
22 | #include <AliLog.h> | |
23 | ||
b762c2f6 | 24 | |
25 | ClassImp(AliRICHDigitizer) | |
26 | ||
c60862bf | 27 | //__________________________________________________________________________________________________ |
aed240d4 | 28 | void AliRICHDigitizer::Exec(Option_t*) |
b762c2f6 | 29 | { |
0fe8fa07 | 30 | //This methode is responsible for merging sdigits to a list of digits |
31 | //Disintegration leeds to the fact that one hit affected several neighbouring pads, which means that the same pad might be | |
32 | //affected by few hits. | |
33 | AliDebug(1,Form("Start with %i input(s) for event %i",fManager->GetNinputs(),fManager->GetOutputEventNr())); | |
34 | //First we read all sdigits from all inputs | |
35 | AliRunLoader *pInRunLoader=0;//in and out Run loaders | |
36 | AliLoader *pInRichLoader=0;//in and out RICH loaders | |
37 | TClonesArray tmpCA("AliRICHDigit");//tmp storage for sdigits sum up from all input files | |
d4c94996 | 38 | Int_t total=0; |
9416c50c | 39 | for(Int_t inFileN=0;inFileN<fManager->GetNinputs();inFileN++){//files loop |
0fe8fa07 | 40 | pInRunLoader = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(inFileN)); //get run loader from current input |
41 | pInRichLoader = pInRunLoader->GetLoader("RICHLoader"); if(pInRichLoader==0) continue; //no RICH in this input, check the next input | |
42 | if (!pInRunLoader->GetAliRun()) pInRunLoader->LoadgAlice(); | |
43 | AliRICH* pInRich=(AliRICH*)pInRunLoader->GetAliRun()->GetDetector("RICH"); //take RICH from current input | |
44 | pInRichLoader->LoadSDigits(); pInRichLoader->TreeS()->GetEntry(0); //take list of RICH sdigits from current input | |
db910db9 | 45 | AliDebug(1,Form("input %i has %i sdigits",inFileN,pInRich->SDigs()->GetEntries())); |
46 | for(Int_t i=0;i<pInRich->SDigs()->GetEntries();i++){//collect sdigits from current input to tmpCA | |
47 | new(tmpCA[total++]) AliRICHDigit(*(AliRICHDigit*)pInRich->SDigs()->At(i)); | |
0fe8fa07 | 48 | ((AliRICHDigit*)tmpCA[total-1])->AddTidOffset(fManager->GetMask(inFileN));//apply TID shift since all inputs count tracks independently starting from 0 |
89924db8 | 49 | } |
db910db9 | 50 | pInRichLoader->UnloadSDigits(); pInRich->SDigReset(); //close current input and reset |
c60862bf | 51 | }//files loop |
88cb7938 | 52 | |
0fe8fa07 | 53 | tmpCA.Sort(); //at this point we have a list of all sdigits from all inputs, now sort them according to fPad field |
54 | ||
55 | AliRunLoader *pOutRunLoader = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName()); //open output stream (only 1 possible) | |
56 | AliLoader *pOutRichLoader = pOutRunLoader->GetLoader("RICHLoader"); //take output RICH loader | |
57 | AliRICH *pOutRich = (AliRICH*)pOutRunLoader->GetAliRun()->GetDetector("RICH"); //take output RICH | |
58 | pOutRichLoader->MakeTree("D"); pOutRich->MakeBranch("D"); //create TreeD in output stream | |
d4c94996 | 59 | |
3d61f7c0 | 60 | 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 |
0fe8fa07 | 61 | Int_t iNdigsPerPad=0; //how many sdigits for a given pad |
d4c94996 | 62 | for(Int_t i=0;i<tmpCA.GetEntries();i++){//sdigits loop (sorted) |
0fe8fa07 | 63 | AliRICHDigit *pSdig=(AliRICHDigit*)tmpCA.At(i);//get new sdigit |
0422a446 | 64 | if(pSdig->PadAbs()==iId){//still the same pad |
65 | iNdigsPerPad++; dQdc+=pSdig->Qdc(); iCfm+=pSdig->Cfm();//sum up charge and cfm | |
66 | 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 | |
0fe8fa07 | 67 | if(iNdigsPerPad<=3) aTids[iNdigsPerPad-1]=pSdig->GetTrack(0); |
db910db9 | 68 | 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())); |
09c52ebc | 69 | }else{//new pad, add the pevious one |
db910db9 | 70 | if(iId!=-1 && AliRICHParam::IsOverTh(iChamber,pad,dQdc)) pOutRich->DigAdd(iChamber,pad,(Int_t)dQdc,iCfm,aTids); //add newly created dig |
0422a446 | 71 | iChamber=pSdig->Chamber(); pad=pSdig->Pad(); iCfm=pSdig->Cfm(); dQdc=pSdig->Qdc(); iId=pSdig->PadAbs(); //init all values by current sdig |
0fe8fa07 | 72 | iNdigsPerPad=1; aTids[0]=pSdig->GetTrack(0); aTids[1]=aTids[2]=-1; |
09c52ebc | 73 | } |
74 | }//sdigits loop (sorted) | |
db910db9 | 75 | if(tmpCA.GetEntries() && AliRICHParam::IsOverTh(iChamber,pad,dQdc)) pOutRich->DigAdd(iChamber,pad,(Int_t)dQdc,iCfm,aTids);//add the last dig |
d4c94996 | 76 | |
0fe8fa07 | 77 | pOutRichLoader->TreeD()->Fill(); //fill the output tree with the list of digits |
78 | pOutRichLoader->WriteDigits("OVERWRITE"); //serialize them to file | |
d4c94996 | 79 | |
0fe8fa07 | 80 | tmpCA.Clear(); //remove all tmp sdigits |
db910db9 | 81 | pOutRichLoader->UnloadDigits(); pOutRich->DigReset(); |
c60862bf | 82 | }//Exec() |