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