1 #include <AliESDVertex.h>
2 #include <AliITSVertexer.h>
3 #include <AliRunLoader.h>
4 #include <AliITSLoader.h>
5 #include <AliMultiplicity.h>
6 #include <AliITSMultReconstructor.h>
8 ClassImp(AliITSVertexer)
10 //////////////////////////////////////////////////////////////////////
11 // Base class for primary vertex reconstruction //
12 // AliESDVertexer is a class for full 3D primary vertex finding //
13 // derived classes: AliITSVertexerIons AliITSvertexerPPZ //
14 // AliITSVertexer3D //
15 //////////////////////////////////////////////////////////////////////
17 //______________________________________________________________________
18 AliITSVertexer::AliITSVertexer():AliVertexer() {
19 // Default Constructor
22 AliITSVertexer::AliITSVertexer(TString filename) {
23 // Standard constructor
24 AliRunLoader *rl = AliRunLoader::GetRunLoader();
26 Fatal("AliITSVertexer","Run Loader not found");
29 Fatal("AliITSVertexer","The AliRun object is not available - nothing done");
36 AliITSLoader* itsLoader = (AliITSLoader*) rl->GetLoader("ITSLoader");
37 if(!filename.Contains("default"))itsLoader->SetVerticesFileName(filename);
38 if(!filename.Contains("null"))itsLoader->LoadVertices("recreate");
39 itsLoader->LoadRecPoints();
42 lst = static_cast<Int_t>(rl->TreeE()->GetEntries());
47 //______________________________________________________________________
48 AliITSVertexer::AliITSVertexer(const AliITSVertexer &vtxr) : AliVertexer(vtxr) {
50 // Copies are not allowed. The method is protected to avoid misuse.
51 Error("AliITSVertexer","Copy constructor not allowed\n");
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");
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;}
68 if(!fCurrentVertex)success=kFALSE;
69 if(fCurrentVertex && fCurrentVertex->GetNContributors()<1)success=kFALSE;
71 AliWarning("Tracklets multiplicity not determined because the primary vertex was not found");
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");
86 fCurrentVertex->GetXYZ(vtx);
88 for(Int_t i=0;i<3;i++)vtxf[i]=vtx[i];
89 multReco->SetHistOn(kFALSE);
90 multReco->Reconstruct(itsClusterTree,vtxf,vtxf);
91 Int_t notracks=multReco->GetNTracklets();
92 Float_t *tht = new Float_t [notracks];
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++){
96 tht[i] = multReco->GetTracklet(i)[0];
97 phi[i] = multReco->GetTracklet(i)[1];
98 dphi[i] = multReco->GetTracklet(i)[2];
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];
107 fMult = new AliMultiplicity(notracks,tht,phi,dphi,nosingleclus,ths,phs);
113 itsLoader->UnloadRecPoints();
118 //______________________________________________________________________
119 void AliITSVertexer::WriteCurrentVertex(){
120 // Write the current AliVertex object to file fOutFile
121 AliRunLoader *rl = AliRunLoader::GetRunLoader();
122 AliITSLoader* itsLoader = (AliITSLoader*) rl->GetLoader("ITSLoader");
123 fCurrentVertex->SetName("Vertex");
124 // const char * name = fCurrentVertex->GetName();
125 // itsLoader->SetVerticesContName(name);
126 Int_t rc = itsLoader->PostVertex(fCurrentVertex);
127 rc = itsLoader->WriteVertices();