]>
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 // |
14 | // AliITSVertexerTracks // | |
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); | |
91 | cout<<"======================================================="<<endl; | |
92 | cout<<"Event number "<<evnumber<<"; tracklets= "<<multReco->GetNTracklets()<<endl; | |
93 | Int_t notracks=multReco->GetNTracklets(); | |
94 | Float_t *trk = new Float_t [notracks]; | |
95 | Float_t *phi = new Float_t [notracks]; | |
96 | Float_t *dphi = new Float_t [notracks]; | |
97 | for(Int_t i=0;i<multReco->GetNTracklets();i++){ | |
98 | trk[i] = multReco->GetTracklet(i)[0]; | |
99 | phi[i] = multReco->GetTracklet(i)[1]; | |
100 | dphi[i] = multReco->GetTracklet(i)[2]; | |
101 | } | |
102 | fMult = new AliMultiplicity(notracks,trk,phi, dphi); | |
103 | delete [] trk; | |
104 | delete [] phi; | |
105 | delete [] dphi; | |
32e449be | 106 | itsLoader->UnloadRecPoints(); |
107 | delete multReco; | |
108 | return; | |
109 | } | |
c5f0f3c1 | 110 | |
111 | //______________________________________________________________________ | |
112 | void AliITSVertexer::WriteCurrentVertex(){ | |
113 | // Write the current AliVertex object to file fOutFile | |
88cb7938 | 114 | AliRunLoader *rl = AliRunLoader::GetRunLoader(); |
41b19549 | 115 | AliITSLoader* itsLoader = (AliITSLoader*) rl->GetLoader("ITSLoader"); |
88cb7938 | 116 | fCurrentVertex->SetName("Vertex"); |
117 | // const char * name = fCurrentVertex->GetName(); | |
41b19549 | 118 | // itsLoader->SetVerticesContName(name); |
119 | Int_t rc = itsLoader->PostVertex(fCurrentVertex); | |
120 | rc = itsLoader->WriteVertices(); | |
c5f0f3c1 | 121 | } |