]>
Commit | Line | Data |
---|---|---|
d681bb2d | 1 | #include <AliESDVertex.h> |
c5f0f3c1 | 2 | #include <AliITSVertexer.h> |
88cb7938 | 3 | #include <AliRunLoader.h> |
4 | #include <AliITSLoader.h> | |
32e449be | 5 | #include <AliMultiplicity.h> |
6 | #include <AliITSMultReconstructor.h> | |
c5f0f3c1 | 7 | |
8 | ClassImp(AliITSVertexer) | |
9 | ||
10 | ////////////////////////////////////////////////////////////////////// | |
11 | // Base class for primary vertex reconstruction // | |
d681bb2d | 12 | // AliESDVertexer is a class for full 3D primary vertex finding // |
41b19549 | 13 | // derived classes: AliITSVertexerIons AliITSvertexerPPZ // |
c61c02f4 | 14 | // AliITSVertexer3D // |
c5f0f3c1 | 15 | ////////////////////////////////////////////////////////////////////// |
16 | ||
17 | //______________________________________________________________________ | |
2257f27e | 18 | AliITSVertexer::AliITSVertexer():AliVertexer() { |
c5f0f3c1 | 19 | // Default Constructor |
c5f0f3c1 | 20 | } |
21 | ||
88cb7938 | 22 | AliITSVertexer::AliITSVertexer(TString filename) { |
c5f0f3c1 | 23 | // Standard constructor |
88cb7938 | 24 | AliRunLoader *rl = AliRunLoader::GetRunLoader(); |
25 | if(!rl){ | |
26 | Fatal("AliITSVertexer","Run Loader not found"); | |
27 | } | |
28 | if(rl->LoadgAlice()){ | |
29 | Fatal("AliITSVertexer","The AliRun object is not available - nothing done"); | |
30 | } | |
c5f0f3c1 | 31 | fCurrentVertex = 0; |
ecc64c3f | 32 | fDebug = 0; |
c5f0f3c1 | 33 | SetFirstEvent(0); |
34 | SetLastEvent(0); | |
88cb7938 | 35 | rl->LoadHeader(); |
41b19549 | 36 | AliITSLoader* itsLoader = (AliITSLoader*) rl->GetLoader("ITSLoader"); |
979e3647 | 37 | if(!filename.Contains("default"))itsLoader->SetVerticesFileName(filename); |
2257f27e | 38 | if(!filename.Contains("null"))itsLoader->LoadVertices("recreate"); |
41b19549 | 39 | itsLoader->LoadRecPoints(); |
88cb7938 | 40 | Int_t lst; |
41 | if(rl->TreeE()){ | |
42 | lst = static_cast<Int_t>(rl->TreeE()->GetEntries()); | |
43 | SetLastEvent(lst-1); | |
c5f0f3c1 | 44 | } |
45 | } | |
46 | ||
41b19549 | 47 | //______________________________________________________________________ |
2257f27e | 48 | AliITSVertexer::AliITSVertexer(const AliITSVertexer &vtxr) : AliVertexer(vtxr) { |
41b19549 | 49 | // Copy constructor |
50 | // Copies are not allowed. The method is protected to avoid misuse. | |
51 | Error("AliITSVertexer","Copy constructor not allowed\n"); | |
52 | } | |
53 | ||
54 | //______________________________________________________________________ | |
55 | AliITSVertexer& AliITSVertexer::operator=(const AliITSVertexer& /* vtxr */){ | |
56 | // Assignment operator | |
57 | // Assignment is not allowed. The method is protected to avoid misuse. | |
58 | Error("= operator","Assignment operator not allowed\n"); | |
59 | return *this; | |
60 | } | |
61 | ||
32e449be | 62 | //______________________________________________________________________ |
63 | void AliITSVertexer::FindMultiplicity(Int_t evnumber){ | |
64 | // Invokes AliITSMultReconstructor to determine the | |
65 | // charged multiplicity in the pixel layers | |
66 | if(fMult){delete fMult; fMult = 0;} | |
67 | Bool_t success=kTRUE; | |
68 | if(!fCurrentVertex)success=kFALSE; | |
69 | if(fCurrentVertex && fCurrentVertex->GetNContributors()<1)success=kFALSE; | |
70 | if(!success){ | |
71 | AliWarning("Tracklets multiplicity not determined because the primary vertex was not found"); | |
72 | return; | |
73 | } | |
74 | AliITSMultReconstructor* multReco = new AliITSMultReconstructor(); | |
75 | AliRunLoader *rl =AliRunLoader::GetRunLoader(); | |
76 | AliITSLoader* itsLoader = (AliITSLoader*)rl->GetLoader("ITSLoader"); | |
77 | multReco->SetGeometry(itsLoader->GetITSgeom()); | |
78 | itsLoader->LoadRecPoints(); | |
79 | rl->GetEvent(evnumber); | |
80 | TTree* itsClusterTree = itsLoader->TreeR(); | |
81 | if (!itsClusterTree) { | |
82 | AliError(" Can't get the ITS cluster tree !\n"); | |
83 | return; | |
84 | } | |
85 | Double_t vtx[3]; | |
86 | fCurrentVertex->GetXYZ(vtx); | |
87 | Float_t vtxf[3]; | |
88 | for(Int_t i=0;i<3;i++)vtxf[i]=vtx[i]; | |
89 | multReco->SetHistOn(kFALSE); | |
90 | multReco->Reconstruct(itsClusterTree,vtxf,vtxf); | |
32e449be | 91 | Int_t notracks=multReco->GetNTracklets(); |
968e8539 | 92 | Float_t *tht = new Float_t [notracks]; |
32e449be | 93 | Float_t *phi = new Float_t [notracks]; |
94 | Float_t *dphi = new Float_t [notracks]; | |
95 | for(Int_t i=0;i<multReco->GetNTracklets();i++){ | |
968e8539 | 96 | tht[i] = multReco->GetTracklet(i)[0]; |
32e449be | 97 | phi[i] = multReco->GetTracklet(i)[1]; |
98 | dphi[i] = multReco->GetTracklet(i)[2]; | |
99 | } | |
968e8539 | 100 | Int_t nosingleclus=multReco->GetNSingleClusters(); |
101 | Float_t *ths = new Float_t [nosingleclus]; | |
102 | Float_t *phs = new Float_t [nosingleclus]; | |
103 | for(Int_t i=0;i<nosingleclus;i++){ | |
104 | ths[i] = multReco->GetCluster(i)[0]; | |
105 | phs[i] = multReco->GetCluster(i)[1]; | |
106 | } | |
107 | fMult = new AliMultiplicity(notracks,tht,phi,dphi,nosingleclus,ths,phs); | |
108 | delete [] tht; | |
32e449be | 109 | delete [] phi; |
110 | delete [] dphi; | |
968e8539 | 111 | delete [] ths; |
112 | delete [] phs; | |
32e449be | 113 | itsLoader->UnloadRecPoints(); |
114 | delete multReco; | |
115 | return; | |
116 | } | |
c5f0f3c1 | 117 | |
118 | //______________________________________________________________________ | |
119 | void AliITSVertexer::WriteCurrentVertex(){ | |
120 | // Write the current AliVertex object to file fOutFile | |
88cb7938 | 121 | AliRunLoader *rl = AliRunLoader::GetRunLoader(); |
41b19549 | 122 | AliITSLoader* itsLoader = (AliITSLoader*) rl->GetLoader("ITSLoader"); |
88cb7938 | 123 | fCurrentVertex->SetName("Vertex"); |
124 | // const char * name = fCurrentVertex->GetName(); | |
41b19549 | 125 | // itsLoader->SetVerticesContName(name); |
126 | Int_t rc = itsLoader->PostVertex(fCurrentVertex); | |
127 | rc = itsLoader->WriteVertices(); | |
c5f0f3c1 | 128 | } |