]>
Commit | Line | Data |
---|---|---|
d3da6dc4 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, 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 | **************************************************************************/ | |
423554a3 | 15 | //. |
16 | // HMPID base class to reconstruct an event | |
17 | //. | |
18 | //. | |
19 | //. | |
d3da6dc4 | 20 | #include "AliHMPIDReconstructor.h" //class header |
21 | #include "AliHMPID.h" //Reconstruct() | |
a1d55ff3 | 22 | #include "AliHMPIDCluster.h" //Dig2Clu() |
3278403b | 23 | #include "AliHMPIDPid.h" //FillEsd() |
d3da6dc4 | 24 | #include "AliHMPIDParam.h" //FillEsd() |
a0e5c1b9 | 25 | #include <AliCDBEntry.h> //ctor |
26 | #include <AliCDBManager.h> //ctor | |
555a0dbf | 27 | #include <AliESDEvent.h> //FillEsd() |
a0e5c1b9 | 28 | #include <AliRawReader.h> //Reconstruct() for raw digits |
d76c31f4 | 29 | #include "AliHMPIDRawStream.h" //ConvertDigits() |
55a829a5 | 30 | #include "AliHMPIDRecoParam.h" //ctor |
d3da6dc4 | 31 | ClassImp(AliHMPIDReconstructor) |
32 | ||
55a829a5 | 33 | AliHMPIDRecoParam* AliHMPIDReconstructor::fgkRecoParam =0; // |
94b1fbfa | 34 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
a0e5c1b9 | 35 | AliHMPIDReconstructor::AliHMPIDReconstructor():AliReconstructor(),fUserCut(0),fDaqSig(0),fDig(0),fClu(0) |
94b1fbfa | 36 | { |
37 | // | |
38 | //ctor | |
39 | // | |
909bfbdc | 40 | AliHMPIDParam::Instance(); //geometry loaded for reconstruction |
14dc2e6c | 41 | fUserCut = new Int_t[7]; |
ae5a42aa | 42 | fClu=new TObjArray(AliHMPIDParam::kMaxCh+1); fClu->SetOwner(kTRUE); |
43 | fDig=new TObjArray(AliHMPIDParam::kMaxCh+1); fDig->SetOwner(kTRUE); | |
9cc1a411 | 44 | |
ae5a42aa | 45 | for(int i=AliHMPIDParam::kMinCh;i<=AliHMPIDParam::kMaxCh;i++){ |
94b1fbfa | 46 | fDig->AddAt(new TClonesArray("AliHMPIDDigit"),i); |
611e810d | 47 | TClonesArray *pClus = new TClonesArray("AliHMPIDCluster"); |
48 | pClus->SetUniqueID(i); | |
49 | fClu->AddAt(pClus,i); | |
94b1fbfa | 50 | } |
55a829a5 | 51 | |
52 | if(fgkRecoParam!=0x0 && fgkRecoParam->GetUserCutMode()==kFALSE) | |
53 | { | |
54 | for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) { | |
55 | fUserCut[iCh] = fgkRecoParam->GetUserCut(iCh); | |
56 | Printf("HMPID: UserCut successfully loaded (from RecoParam) for chamber %i -> %i ",iCh,fUserCut[iCh]); | |
57 | } | |
58 | } | |
59 | else { | |
a0e5c1b9 | 60 | AliCDBEntry *pUserCutEnt =AliCDBManager::Instance()->Get("HMPID/Calib/UserCut"); //contains TObjArray of 14 TObject with n. of sigmas to cut charge |
85692374 | 61 | if(pUserCutEnt) { |
62 | TObjArray *pUserCut = (TObjArray*)pUserCutEnt->GetObject(); | |
63 | for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){ //chambers loop | |
64 | fUserCut[iCh] = pUserCut->At(iCh)->GetUniqueID(); | |
55a829a5 | 65 | Printf("HMPID: UserCut successfully loaded (from OCDB) for chamber %i -> %i ",iCh,fUserCut[iCh]); |
85692374 | 66 | } |
55a829a5 | 67 | } |
9cc1a411 | 68 | } |
55a829a5 | 69 | |
9cc1a411 | 70 | AliCDBEntry *pDaqSigEnt =AliCDBManager::Instance()->Get("HMPID/Calib/DaqSig"); //contains TObjArray of TObjArray 14 TMatrixF sigmas values for pads |
71 | if(!pDaqSigEnt) AliFatal("No pedestals from DAQ!"); | |
72 | fDaqSig = (TObjArray*)pDaqSigEnt->GetObject(); | |
73 | for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){ //chambers loop | |
74 | Printf(" HMPID: DaqSigCut successfully loaded for chamber %i -> %i ",iCh,(Int_t)fDaqSig->At(iCh)->GetUniqueID()); | |
a0e5c1b9 | 75 | } |
94b1fbfa | 76 | }//AliHMPIDReconstructor |
d3da6dc4 | 77 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
3c6274c1 | 78 | void AliHMPIDReconstructor::Dig2Clu(TObjArray *pDigAll,TObjArray *pCluAll,Bool_t isTryUnfold) |
d3da6dc4 | 79 | { |
80 | // Finds all clusters for a given digits list provided not empty. Currently digits list is a list of all digits for a single chamber. | |
81 | // Puts all found clusters in separate lists, one per clusters. | |
3c6274c1 | 82 | // Arguments: pDigAll - list of digits for all chambers |
83 | // pCluAll - list of clusters for all chambers | |
d3da6dc4 | 84 | // isTryUnfold - flag to choose between CoG and Mathieson fitting |
85 | // Returns: none | |
ae5a42aa | 86 | TMatrixF padMap(AliHMPIDParam::kMinPx,AliHMPIDParam::kMaxPcx,AliHMPIDParam::kMinPy,AliHMPIDParam::kMaxPcy); //pads map for single chamber 0..159 x 0..143 |
3c6274c1 | 87 | |
ae5a42aa | 88 | for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){ //chambers loop |
3c6274c1 | 89 | TClonesArray *pDigCur=(TClonesArray*)pDigAll->At(iCh); //get list of digits for current chamber |
90 | if(pDigCur->GetEntriesFast()==0) continue; //no digits for current chamber | |
d3da6dc4 | 91 | |
3c6274c1 | 92 | padMap=(Float_t)-1; //reset map to -1 (means no digit for this pad) |
93 | TClonesArray *pCluCur=(TClonesArray*)pCluAll->At(iCh); //get list of clusters for current chamber | |
94 | ||
95 | for(Int_t iDig=0;iDig<pDigCur->GetEntriesFast();iDig++){ //digits loop to fill pads map | |
96 | AliHMPIDDigit *pDig= (AliHMPIDDigit*)pDigCur->At(iDig); //get current digit | |
97 | padMap( pDig->PadChX(), pDig->PadChY() )=iDig; //fill the map, (padx,pady) cell takes digit index | |
98 | }//digits loop to fill digits map | |
99 | ||
100 | AliHMPIDCluster clu; //tmp cluster to be used as current | |
3c6274c1 | 101 | for(Int_t iDig=0;iDig<pDigCur->GetEntriesFast();iDig++){ //digits loop for current chamber |
102 | AliHMPIDDigit *pDig=(AliHMPIDDigit*)pDigCur->At(iDig); //take current digit | |
103 | if(!(pDig=UseDig(pDig->PadChX(),pDig->PadChY(),pDigCur,&padMap))) continue; //this digit is already taken in FormClu(), go after next digit | |
104 | FormClu(&clu,pDig,pDigCur,&padMap); //form cluster starting from this digit by recursion | |
105 | ||
106 | clu.Solve(pCluCur,isTryUnfold); //solve this cluster and add all unfolded clusters to provided list | |
107 | clu.Reset(); //empty current cluster | |
108 | }//digits loop for current chamber | |
109 | }//chambers loop | |
d3da6dc4 | 110 | }//Dig2Clu() |
111 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
112 | void AliHMPIDReconstructor::FormClu(AliHMPIDCluster *pClu,AliHMPIDDigit *pDig,TClonesArray *pDigLst,TMatrixF *pDigMap) | |
113 | { | |
a1d55ff3 | 114 | // Forms the initial cluster as a combination of all adjascent digits. Starts from the given digit then calls itself recursevly for all neighbours. |
d3da6dc4 | 115 | // Arguments: pClu - pointer to cluster being formed |
a1d55ff3 | 116 | // Returns: none |
d3da6dc4 | 117 | pClu->DigAdd(pDig);//take this digit in cluster |
118 | ||
3c6274c1 | 119 | Int_t cnt=0,cx[4],cy[4]; |
d3da6dc4 | 120 | |
ae5a42aa | 121 | if(pDig->PadPcX() != AliHMPIDParam::kMinPx){cx[cnt]=pDig->PadChX()-1; cy[cnt]=pDig->PadChY() ;cnt++;} //left |
122 | if(pDig->PadPcX() != AliHMPIDParam::kMaxPx){cx[cnt]=pDig->PadChX()+1; cy[cnt]=pDig->PadChY() ;cnt++;} //right | |
123 | if(pDig->PadPcY() != AliHMPIDParam::kMinPy){cx[cnt]=pDig->PadChX() ; cy[cnt]=pDig->PadChY()-1;cnt++;} //down | |
124 | if(pDig->PadPcY() != AliHMPIDParam::kMaxPy){cx[cnt]=pDig->PadChX() ; cy[cnt]=pDig->PadChY()+1;cnt++;} //up | |
d3da6dc4 | 125 | |
a1d55ff3 | 126 | for (Int_t i=0;i<cnt;i++){//neighbours loop |
3c6274c1 | 127 | if((pDig=UseDig(cx[i],cy[i],pDigLst,pDigMap))) FormClu(pClu,pDig,pDigLst,pDigMap); //check if this neighbour pad fired and mark it as taken |
a1d55ff3 | 128 | }//neighbours loop |
d3da6dc4 | 129 | }//FormClu() |
130 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
94b1fbfa | 131 | void AliHMPIDReconstructor::Reconstruct(TTree *pDigTree,TTree *pCluTree)const |
d3da6dc4 | 132 | { |
133 | //Invoked by AliReconstruction to convert digits to clusters i.e. reconstruct simulated data | |
94b1fbfa | 134 | //Arguments: pDigTree - pointer to Digit tree |
135 | // pCluTree - poitner to Cluster tree | |
d3da6dc4 | 136 | // Returns: none |
137 | AliDebug(1,"Start."); | |
ae5a42aa | 138 | for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) { |
94b1fbfa | 139 | pCluTree->Branch(Form("HMPID%d",iCh),&((*fClu)[iCh]),4000,0); |
140 | pDigTree->SetBranchAddress(Form("HMPID%d",iCh),&((*fDig)[iCh])); | |
141 | } | |
142 | pDigTree->GetEntry(0); | |
143 | Dig2Clu(fDig,fClu); //cluster finder | |
144 | pCluTree->Fill(); //fill tree for current event | |
145 | ||
ae5a42aa | 146 | for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){ |
94b1fbfa | 147 | fDig->At(iCh)->Clear(); |
148 | fClu->At(iCh)->Clear(); | |
149 | } | |
d3da6dc4 | 150 | |
d3da6dc4 | 151 | AliDebug(1,"Stop."); |
152 | }//Reconstruct(for simulated digits) | |
a1d55ff3 | 153 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
94b1fbfa | 154 | void AliHMPIDReconstructor::ConvertDigits(AliRawReader *pRR,TTree *pDigTree)const |
155 | { | |
156 | //Invoked by AliReconstruction to convert raw digits from DDL files to digits | |
157 | //Arguments: pRR - ALICE raw reader pointer | |
158 | // pDigTree - pointer to Digit tree | |
159 | // Returns: none | |
160 | AliDebug(1,"Start."); | |
21f61e25 | 161 | // Int_t digcnt=0; |
162 | ||
163 | ||
ae5a42aa | 164 | for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) { |
21f61e25 | 165 | pDigTree->Branch(Form("HMPID%d",iCh),&((*fDig)[iCh]),4000,0); |
166 | ||
94b1fbfa | 167 | Int_t iDigCnt=0; |
21f61e25 | 168 | AliHMPIDRawStream stream(pRR); |
169 | while(stream.Next()) | |
170 | { | |
171 | ||
172 | UInt_t ddl=stream.GetDDLNumber(); //returns 0,1,2 ... 13 | |
173 | if((UInt_t)(2*iCh)==ddl || (UInt_t)(2*iCh+1)==ddl) { | |
174 | for(Int_t row = 1; row <= AliHMPIDRawStream::kNRows; row++){ | |
175 | for(Int_t dil = 1; dil <= AliHMPIDRawStream::kNDILOGICAdd; dil++){ | |
176 | for(Int_t pad = 0; pad < AliHMPIDRawStream::kNPadAdd; pad++){ | |
177 | if(stream.GetCharge(ddl,row,dil,pad) < 1) continue; | |
178 | AliHMPIDDigit dig(stream.GetPad(ddl,row,dil,pad),stream.GetCharge(ddl,row,dil,pad)); | |
179 | if(!IsDigSurvive(&dig)) continue; | |
180 | new((*((TClonesArray*)fDig->At(iCh)))[iDigCnt++]) AliHMPIDDigit(dig); //add this digit to the tmp list | |
181 | }//pad | |
182 | }//dil | |
183 | }//row | |
184 | }//while | |
185 | } | |
186 | stream.Delete(); | |
187 | } | |
94b1fbfa | 188 | pDigTree->Fill(); |
21f61e25 | 189 | |
ae5a42aa | 190 | for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++)fDig->At(iCh)->Clear(); |
21f61e25 | 191 | |
94b1fbfa | 192 | AliDebug(1,"Stop."); |
193 | }//Reconstruct digits from raw digits | |
194 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
d76c31f4 | 195 | void AliHMPIDReconstructor::FillESD(TTree */*digitsTree*/, TTree */*clustersTree*/, AliESDEvent *pESD) const |
d3da6dc4 | 196 | { |
3278403b | 197 | // Fill ESD with all the infos from HMPID |
198 | // Probability vector from AliHMPIDPid | |
199 | //... | |
200 | ||
201 | AliHMPIDPid *pPid = new AliHMPIDPid(); | |
202 | pPid->FindPid(pESD); | |
203 | delete pPid; | |
d3da6dc4 | 204 | |
a1d55ff3 | 205 | }//FillESD() |