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 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];
102 fMult = new AliMultiplicity(notracks,trk,phi, dphi);
106 itsLoader->UnloadRecPoints();
111 //______________________________________________________________________
112 void AliITSVertexer::WriteCurrentVertex(){
113 // Write the current AliVertex object to file fOutFile
114 AliRunLoader *rl = AliRunLoader::GetRunLoader();
115 AliITSLoader* itsLoader = (AliITSLoader*) rl->GetLoader("ITSLoader");
116 fCurrentVertex->SetName("Vertex");
117 // const char * name = fCurrentVertex->GetName();
118 // itsLoader->SetVerticesContName(name);
119 Int_t rc = itsLoader->PostVertex(fCurrentVertex);
120 rc = itsLoader->WriteVertices();