]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSVertexer.cxx
Version number incremented
[u/mrichter/AliRoot.git] / ITS / AliITSVertexer.cxx
CommitLineData
d681bb2d 1#include <AliESDVertex.h>
32e63e47 2#include "AliITSgeomTGeo.h"
27167524 3#include "AliITSVertexer.h"
4#include "AliRunLoader.h"
5#include "AliITSLoader.h"
6#include "AliMultiplicity.h"
7#include "AliITSMultReconstructor.h"
8
9const Float_t AliITSVertexer::fgkPipeRadius = 3.0;
c5f0f3c1 10
11ClassImp(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 21AliITSVertexer::AliITSVertexer():AliVertexer(),
22fLadders(),
23fLadOnLay2(0) {
c5f0f3c1 24 // Default Constructor
27167524 25 SetLaddersOnLayer2();
c5f0f3c1 26}
27
27167524 28AliITSVertexer::AliITSVertexer(TString filename):AliVertexer(),
29fLadders(),
30fLadOnLay2(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");
b84b24bf 49
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//______________________________________________________________________
1bc7737e 62AliITSVertexer::AliITSVertexer(const AliITSVertexer &vtxr) : AliVertexer(vtxr),
63fLadders(),
64fLadOnLay2(0)
65{
41b19549 66 // Copy constructor
67 // Copies are not allowed. The method is protected to avoid misuse.
68 Error("AliITSVertexer","Copy constructor not allowed\n");
69}
70
71//______________________________________________________________________
72AliITSVertexer& AliITSVertexer::operator=(const AliITSVertexer& /* vtxr */){
73 // Assignment operator
74 // Assignment is not allowed. The method is protected to avoid misuse.
75 Error("= operator","Assignment operator not allowed\n");
76 return *this;
77}
78
27167524 79//______________________________________________________________________
80AliITSVertexer::~AliITSVertexer() {
81 // Destructor
82 if(fLadders) delete [] fLadders;
83}
84
32e449be 85//______________________________________________________________________
86void AliITSVertexer::FindMultiplicity(Int_t evnumber){
87 // Invokes AliITSMultReconstructor to determine the
88 // charged multiplicity in the pixel layers
89 if(fMult){delete fMult; fMult = 0;}
90 Bool_t success=kTRUE;
91 if(!fCurrentVertex)success=kFALSE;
92 if(fCurrentVertex && fCurrentVertex->GetNContributors()<1)success=kFALSE;
93 if(!success){
94 AliWarning("Tracklets multiplicity not determined because the primary vertex was not found");
95 return;
96 }
97 AliITSMultReconstructor* multReco = new AliITSMultReconstructor();
98 AliRunLoader *rl =AliRunLoader::GetRunLoader();
99 AliITSLoader* itsLoader = (AliITSLoader*)rl->GetLoader("ITSLoader");
32e449be 100 itsLoader->LoadRecPoints();
101 rl->GetEvent(evnumber);
102 TTree* itsClusterTree = itsLoader->TreeR();
103 if (!itsClusterTree) {
104 AliError(" Can't get the ITS cluster tree !\n");
105 return;
106 }
107 Double_t vtx[3];
108 fCurrentVertex->GetXYZ(vtx);
109 Float_t vtxf[3];
110 for(Int_t i=0;i<3;i++)vtxf[i]=vtx[i];
111 multReco->SetHistOn(kFALSE);
112 multReco->Reconstruct(itsClusterTree,vtxf,vtxf);
32e449be 113 Int_t notracks=multReco->GetNTracklets();
968e8539 114 Float_t *tht = new Float_t [notracks];
32e449be 115 Float_t *phi = new Float_t [notracks];
116 Float_t *dphi = new Float_t [notracks];
de4c520e 117 Int_t *labels = new Int_t[notracks];
0939e22a 118 Int_t *labelsL2 = new Int_t[notracks];
32e449be 119 for(Int_t i=0;i<multReco->GetNTracklets();i++){
968e8539 120 tht[i] = multReco->GetTracklet(i)[0];
32e449be 121 phi[i] = multReco->GetTracklet(i)[1];
122 dphi[i] = multReco->GetTracklet(i)[2];
1b9fef1c 123 labels[i] = static_cast<Int_t>(multReco->GetTracklet(i)[3]);
0939e22a 124 labelsL2[i] = static_cast<Int_t>(multReco->GetTracklet(i)[4]);
32e449be 125 }
968e8539 126 Int_t nosingleclus=multReco->GetNSingleClusters();
127 Float_t *ths = new Float_t [nosingleclus];
128 Float_t *phs = new Float_t [nosingleclus];
129 for(Int_t i=0;i<nosingleclus;i++){
130 ths[i] = multReco->GetCluster(i)[0];
131 phs[i] = multReco->GetCluster(i)[1];
132 }
0939e22a 133 fMult = new AliMultiplicity(notracks,tht,phi,dphi,labels,labelsL2,nosingleclus,ths,phs);
968e8539 134 delete [] tht;
32e449be 135 delete [] phi;
136 delete [] dphi;
968e8539 137 delete [] ths;
138 delete [] phs;
d6fc37c1 139 delete [] labels;
0939e22a 140 delete [] labelsL2;
32e449be 141 itsLoader->UnloadRecPoints();
142 delete multReco;
143 return;
144}
c5f0f3c1 145
27167524 146//______________________________________________________________________
147void AliITSVertexer::SetLaddersOnLayer2(Int_t ladwid){
148 // Calculates the array of ladders on layer 2 to be used with a
149 // given ladder on layer 1
150 fLadOnLay2=ladwid;
c7719399 151 // AliRunLoader *rl =AliRunLoader::GetRunLoader();
152 // AliITSLoader* itsLoader = (AliITSLoader*)rl->GetLoader("ITSLoader");
32e63e47 153 // AliITSgeom* geom = itsLoader->GetITSgeom();
154 Int_t ladtot1=AliITSgeomTGeo::GetNLadders(1);
27167524 155 if(fLadders) delete [] fLadders;
156 fLadders=new UShort_t[ladtot1];
157
158
159 Double_t pos1[3],pos2[3];
32e63e47 160 Int_t mod1=AliITSgeomTGeo::GetModuleIndex(2,1,1);
161 AliITSgeomTGeo::GetTranslation(mod1,pos1); // position of the module in the MRS
27167524 162 Double_t phi0=TMath::ATan2(pos1[1],pos1[0]);
163 if(phi0<0) phi0+=2*TMath::Pi();
32e63e47 164 Int_t mod2=AliITSgeomTGeo::GetModuleIndex(2,2,1);
165 AliITSgeomTGeo::GetTranslation(mod2,pos2);
27167524 166 Double_t phi2=TMath::ATan2(pos2[1],pos2[0]);
167 if(phi2<0) phi2+=2*TMath::Pi();
168 Double_t deltaPhi= phi0-phi2; // phi width of a layer2 module
169
170 for(Int_t i= 0; i<ladtot1;i++){
32e63e47 171 Int_t modlad= AliITSgeomTGeo::GetModuleIndex(1,i+1,1);
27167524 172 Double_t posmod[3];
32e63e47 173 AliITSgeomTGeo::GetTranslation(modlad,posmod);
27167524 174 Double_t phimod=TMath::ATan2(posmod[1],posmod[0]);
175 if(phimod<0) phimod+=2*TMath::Pi();
176 Double_t phi1= phimod+deltaPhi*double(fLadOnLay2);
177 if(phi1<0) phi1+=2*TMath::Pi();
178 if(phi1>2*TMath::Pi()) phi1-=2*TMath::Pi();
179 Double_t philad1=phi0-phi1;
180 UShort_t lad1;
181 Double_t ladder1=(philad1)/(deltaPhi) +1.;
182 if(ladder1<1){ladder1=40+ladder1;}
183 lad1=int(ladder1+0.5);
184 fLadders[i]=lad1;
185 }
186}
187
188
c5f0f3c1 189//______________________________________________________________________
190void AliITSVertexer::WriteCurrentVertex(){
191 // Write the current AliVertex object to file fOutFile
88cb7938 192 AliRunLoader *rl = AliRunLoader::GetRunLoader();
41b19549 193 AliITSLoader* itsLoader = (AliITSLoader*) rl->GetLoader("ITSLoader");
88cb7938 194 fCurrentVertex->SetName("Vertex");
195 // const char * name = fCurrentVertex->GetName();
41b19549 196 // itsLoader->SetVerticesContName(name);
197 Int_t rc = itsLoader->PostVertex(fCurrentVertex);
198 rc = itsLoader->WriteVertices();
c5f0f3c1 199}
de4c520e 200