]>
Commit | Line | Data |
---|---|---|
308c2f7c | 1 | #include "AliLog.h" |
2 | #include "AliMultiplicity.h" | |
32e63e47 | 3 | #include "AliITSgeomTGeo.h" |
27167524 | 4 | #include "AliITSVertexer.h" |
27167524 | 5 | #include "AliITSLoader.h" |
27167524 | 6 | #include "AliITSMultReconstructor.h" |
7 | ||
8 | const Float_t AliITSVertexer::fgkPipeRadius = 3.0; | |
c5f0f3c1 | 9 | |
10 | ClassImp(AliITSVertexer) | |
11 | ||
12 | ////////////////////////////////////////////////////////////////////// | |
13 | // Base class for primary vertex reconstruction // | |
d681bb2d | 14 | // AliESDVertexer is a class for full 3D primary vertex finding // |
3acc14d5 | 15 | // derived classes: AliITSVertexerIons AliITSvertexer3D // |
16 | // AliITSVertexerCosmics // | |
c5f0f3c1 | 17 | ////////////////////////////////////////////////////////////////////// |
18 | ||
8c42830a | 19 | /* $Id$ */ |
20 | ||
c5f0f3c1 | 21 | //______________________________________________________________________ |
27167524 | 22 | AliITSVertexer::AliITSVertexer():AliVertexer(), |
23 | fLadders(), | |
308c2f7c | 24 | fLadOnLay2(0), |
25 | fFirstEvent(0), | |
26 | fLastEvent(-1) | |
27167524 | 27 | { |
308c2f7c | 28 | // Default Constructor |
27167524 | 29 | SetLaddersOnLayer2(); |
8c42830a | 30 | for(Int_t i=0; i<kNSPDMod;i++) fUseModule[i]=kTRUE; |
c5f0f3c1 | 31 | } |
32 | ||
27167524 | 33 | //______________________________________________________________________ |
34 | AliITSVertexer::~AliITSVertexer() { | |
35 | // Destructor | |
36 | if(fLadders) delete [] fLadders; | |
37 | } | |
38 | ||
32e449be | 39 | //______________________________________________________________________ |
308c2f7c | 40 | void AliITSVertexer::FindMultiplicity(TTree *itsClusterTree){ |
32e449be | 41 | // Invokes AliITSMultReconstructor to determine the |
42 | // charged multiplicity in the pixel layers | |
43 | if(fMult){delete fMult; fMult = 0;} | |
44 | Bool_t success=kTRUE; | |
45 | if(!fCurrentVertex)success=kFALSE; | |
46 | if(fCurrentVertex && fCurrentVertex->GetNContributors()<1)success=kFALSE; | |
9b373e9a | 47 | |
48 | AliITSMultReconstructor multReco; | |
49 | ||
32e449be | 50 | if(!success){ |
51 | AliWarning("Tracklets multiplicity not determined because the primary vertex was not found"); | |
9b373e9a | 52 | AliWarning("Just counting the number of cluster-fired chips on the SPD layers"); |
53 | if (!itsClusterTree) { | |
54 | AliError(" Invalid ITS cluster tree !\n"); | |
55 | return; | |
56 | } | |
57 | multReco.LoadClusterFiredChips(itsClusterTree); | |
58 | Short_t nfcL1 = multReco.GetNFiredChips(0); | |
59 | Short_t nfcL2 = multReco.GetNFiredChips(1); | |
60 | fMult = new AliMultiplicity(0,0,0,0,0,0,0,0,0,nfcL1,nfcL2); | |
32e449be | 61 | return; |
62 | } | |
308c2f7c | 63 | |
32e449be | 64 | if (!itsClusterTree) { |
308c2f7c | 65 | AliError(" Invalid ITS cluster tree !\n"); |
32e449be | 66 | return; |
67 | } | |
68 | Double_t vtx[3]; | |
69 | fCurrentVertex->GetXYZ(vtx); | |
70 | Float_t vtxf[3]; | |
71 | for(Int_t i=0;i<3;i++)vtxf[i]=vtx[i]; | |
9b373e9a | 72 | multReco.SetHistOn(kFALSE); |
73 | multReco.Reconstruct(itsClusterTree,vtxf,vtxf); | |
74 | Int_t notracks=multReco.GetNTracklets(); | |
968e8539 | 75 | Float_t *tht = new Float_t [notracks]; |
32e449be | 76 | Float_t *phi = new Float_t [notracks]; |
77 | Float_t *dphi = new Float_t [notracks]; | |
de4c520e | 78 | Int_t *labels = new Int_t[notracks]; |
0939e22a | 79 | Int_t *labelsL2 = new Int_t[notracks]; |
9b373e9a | 80 | for(Int_t i=0;i<multReco.GetNTracklets();i++){ |
81 | tht[i] = multReco.GetTracklet(i)[0]; | |
82 | phi[i] = multReco.GetTracklet(i)[1]; | |
83 | dphi[i] = multReco.GetTracklet(i)[2]; | |
84 | labels[i] = static_cast<Int_t>(multReco.GetTracklet(i)[3]); | |
85 | labelsL2[i] = static_cast<Int_t>(multReco.GetTracklet(i)[4]); | |
32e449be | 86 | } |
9b373e9a | 87 | Int_t nosingleclus=multReco.GetNSingleClusters(); |
968e8539 | 88 | Float_t *ths = new Float_t [nosingleclus]; |
89 | Float_t *phs = new Float_t [nosingleclus]; | |
90 | for(Int_t i=0;i<nosingleclus;i++){ | |
9b373e9a | 91 | ths[i] = multReco.GetCluster(i)[0]; |
92 | phs[i] = multReco.GetCluster(i)[1]; | |
968e8539 | 93 | } |
9b373e9a | 94 | Short_t nfcL1 = multReco.GetNFiredChips(0); |
95 | Short_t nfcL2 = multReco.GetNFiredChips(1); | |
9b373e9a | 96 | fMult = new AliMultiplicity(notracks,tht,phi,dphi,labels,labelsL2,nosingleclus,ths,phs,nfcL1,nfcL2); |
97 | ||
968e8539 | 98 | delete [] tht; |
32e449be | 99 | delete [] phi; |
100 | delete [] dphi; | |
968e8539 | 101 | delete [] ths; |
102 | delete [] phs; | |
d6fc37c1 | 103 | delete [] labels; |
0939e22a | 104 | delete [] labelsL2; |
308c2f7c | 105 | |
32e449be | 106 | return; |
107 | } | |
c5f0f3c1 | 108 | |
27167524 | 109 | //______________________________________________________________________ |
110 | void AliITSVertexer::SetLaddersOnLayer2(Int_t ladwid){ | |
111 | // Calculates the array of ladders on layer 2 to be used with a | |
112 | // given ladder on layer 1 | |
113 | fLadOnLay2=ladwid; | |
32e63e47 | 114 | Int_t ladtot1=AliITSgeomTGeo::GetNLadders(1); |
27167524 | 115 | if(fLadders) delete [] fLadders; |
116 | fLadders=new UShort_t[ladtot1]; | |
117 | ||
118 | ||
119 | Double_t pos1[3],pos2[3]; | |
32e63e47 | 120 | Int_t mod1=AliITSgeomTGeo::GetModuleIndex(2,1,1); |
121 | AliITSgeomTGeo::GetTranslation(mod1,pos1); // position of the module in the MRS | |
27167524 | 122 | Double_t phi0=TMath::ATan2(pos1[1],pos1[0]); |
123 | if(phi0<0) phi0+=2*TMath::Pi(); | |
32e63e47 | 124 | Int_t mod2=AliITSgeomTGeo::GetModuleIndex(2,2,1); |
125 | AliITSgeomTGeo::GetTranslation(mod2,pos2); | |
27167524 | 126 | Double_t phi2=TMath::ATan2(pos2[1],pos2[0]); |
127 | if(phi2<0) phi2+=2*TMath::Pi(); | |
128 | Double_t deltaPhi= phi0-phi2; // phi width of a layer2 module | |
129 | ||
130 | for(Int_t i= 0; i<ladtot1;i++){ | |
32e63e47 | 131 | Int_t modlad= AliITSgeomTGeo::GetModuleIndex(1,i+1,1); |
27167524 | 132 | Double_t posmod[3]; |
32e63e47 | 133 | AliITSgeomTGeo::GetTranslation(modlad,posmod); |
27167524 | 134 | Double_t phimod=TMath::ATan2(posmod[1],posmod[0]); |
135 | if(phimod<0) phimod+=2*TMath::Pi(); | |
136 | Double_t phi1= phimod+deltaPhi*double(fLadOnLay2); | |
137 | if(phi1<0) phi1+=2*TMath::Pi(); | |
138 | if(phi1>2*TMath::Pi()) phi1-=2*TMath::Pi(); | |
139 | Double_t philad1=phi0-phi1; | |
140 | UShort_t lad1; | |
141 | Double_t ladder1=(philad1)/(deltaPhi) +1.; | |
142 | if(ladder1<1){ladder1=40+ladder1;} | |
143 | lad1=int(ladder1+0.5); | |
144 | fLadders[i]=lad1; | |
145 | } | |
146 | } | |
147 | ||
308c2f7c | 148 | #include "AliRunLoader.h" |
149 | ||
150 | //______________________________________________________________________ | |
151 | void AliITSVertexer::Init(TString filename){ | |
152 | // Initialize the vertexer in case of | |
153 | // analysis of an entire file | |
154 | AliRunLoader *rl = AliRunLoader::GetRunLoader(); | |
155 | if(!rl){ | |
156 | Fatal("AliITSVertexer","Run Loader not found"); | |
157 | } | |
158 | if (fLastEvent < 0) SetLastEvent(rl->GetNumberOfEvents()-1); | |
159 | ||
160 | AliITSLoader* itsloader = (AliITSLoader*) rl->GetLoader("ITSLoader"); | |
161 | if(!filename.Contains("default"))itsloader->SetVerticesFileName(filename); | |
162 | if(!filename.Contains("null"))itsloader->LoadVertices("recreate"); | |
163 | } | |
27167524 | 164 | |
c5f0f3c1 | 165 | //______________________________________________________________________ |
166 | void AliITSVertexer::WriteCurrentVertex(){ | |
167 | // Write the current AliVertex object to file fOutFile | |
88cb7938 | 168 | AliRunLoader *rl = AliRunLoader::GetRunLoader(); |
41b19549 | 169 | AliITSLoader* itsLoader = (AliITSLoader*) rl->GetLoader("ITSLoader"); |
88cb7938 | 170 | fCurrentVertex->SetName("Vertex"); |
171 | // const char * name = fCurrentVertex->GetName(); | |
41b19549 | 172 | // itsLoader->SetVerticesContName(name); |
173 | Int_t rc = itsLoader->PostVertex(fCurrentVertex); | |
174 | rc = itsLoader->WriteVertices(); | |
c5f0f3c1 | 175 | } |
de4c520e | 176 | |
308c2f7c | 177 | //______________________________________________________________________ |
178 | void AliITSVertexer::FindVertices(){ | |
179 | // computes the vertices of the events in the range FirstEvent - LastEvent | |
180 | ||
181 | AliRunLoader *rl = AliRunLoader::GetRunLoader(); | |
182 | AliITSLoader* itsloader = (AliITSLoader*) rl->GetLoader("ITSLoader"); | |
183 | itsloader->LoadRecPoints("read"); | |
184 | for(Int_t i=fFirstEvent;i<=fLastEvent;i++){ | |
185 | rl->GetEvent(i); | |
186 | TTree* cltree = itsloader->TreeR(); | |
187 | FindVertexForCurrentEvent(cltree); | |
188 | if(fCurrentVertex){ | |
189 | WriteCurrentVertex(); | |
190 | } | |
191 | else { | |
192 | AliDebug(1,Form("Vertex not found for event %d",i)); | |
193 | } | |
194 | } | |
195 | } |