merging RecPoints and ClustersV2. All ClusterFinders produce AliITSRecPoints objects...
[u/mrichter/AliRoot.git] / ITS / AliITSVertexer.cxx
CommitLineData
d681bb2d 1#include <AliESDVertex.h>
c5f0f3c1 2#include <AliITSVertexer.h>
88cb7938 3#include <AliRunLoader.h>
4#include <AliITSLoader.h>
c5f0f3c1 5
6ClassImp(AliITSVertexer)
7
8//////////////////////////////////////////////////////////////////////
9// Base class for primary vertex reconstruction //
d681bb2d 10// AliESDVertexer is a class for full 3D primary vertex finding //
41b19549 11// derived classes: AliITSVertexerIons AliITSvertexerPPZ //
12// AliITSVertexerTracks //
c5f0f3c1 13//////////////////////////////////////////////////////////////////////
14
15//______________________________________________________________________
2257f27e 16AliITSVertexer::AliITSVertexer():AliVertexer() {
c5f0f3c1 17 // Default Constructor
00a7cc50 18 //SetUseV2Clusters(kTRUE);
c5f0f3c1 19}
20
88cb7938 21AliITSVertexer::AliITSVertexer(TString filename) {
c5f0f3c1 22 // Standard constructor
88cb7938 23 AliRunLoader *rl = AliRunLoader::GetRunLoader();
24 if(!rl){
25 Fatal("AliITSVertexer","Run Loader not found");
26 }
27 if(rl->LoadgAlice()){
28 Fatal("AliITSVertexer","The AliRun object is not available - nothing done");
29 }
c5f0f3c1 30 fCurrentVertex = 0;
c5f0f3c1 31 SetDebug();
32 SetFirstEvent(0);
33 SetLastEvent(0);
88cb7938 34 rl->LoadHeader();
41b19549 35 AliITSLoader* itsLoader = (AliITSLoader*) rl->GetLoader("ITSLoader");
979e3647 36 if(!filename.Contains("default"))itsLoader->SetVerticesFileName(filename);
2257f27e 37 if(!filename.Contains("null"))itsLoader->LoadVertices("recreate");
41b19549 38 itsLoader->LoadRecPoints();
88cb7938 39 Int_t lst;
40 if(rl->TreeE()){
41 lst = static_cast<Int_t>(rl->TreeE()->GetEntries());
42 SetLastEvent(lst-1);
c5f0f3c1 43 }
00a7cc50 44 //SetUseV2Clusters(kTRUE);
c5f0f3c1 45}
46
47//______________________________________________________________________
2257f27e 48AliITSVertexer::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//______________________________________________________________________
55AliITSVertexer& 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
c5f0f3c1 62
63//______________________________________________________________________
64void AliITSVertexer::WriteCurrentVertex(){
65 // Write the current AliVertex object to file fOutFile
88cb7938 66 AliRunLoader *rl = AliRunLoader::GetRunLoader();
41b19549 67 AliITSLoader* itsLoader = (AliITSLoader*) rl->GetLoader("ITSLoader");
88cb7938 68 fCurrentVertex->SetName("Vertex");
69 // const char * name = fCurrentVertex->GetName();
41b19549 70 // itsLoader->SetVerticesContName(name);
71 Int_t rc = itsLoader->PostVertex(fCurrentVertex);
72 rc = itsLoader->WriteVertices();
c5f0f3c1 73}
00a7cc50 74/*
2257f27e 75//______________________________________________________________________
76void AliITSVertexer::Clusters2RecPoints
77(const TClonesArray *clusters, Int_t idx, TClonesArray *points) {
78 //------------------------------------------------------------
00a7cc50 79 // Conversion AliITSRecPoint -> AliITSRecPoints for the ITS
2257f27e 80 // module "idx" (entry in the tree with the clusters).
81 // Simplified version, supposed to work with the pixels only !
82 //------------------------------------------------------------
7d62fb64 83 const Int_t klastSPD1=79; //let's hope the number of the SPDs will not change
84 const Int_t klastSPD2=239;//let's hope the number of the SPDs will not change
2257f27e 85
86 Float_t yshift = 0; //see AliITSclustererV2.cxx about these shifts
87 Float_t zshift[4] = {-10.708000, -3.536000, 3.536000, 10.708000}; //let's hope the positioning of the SPDs will not change
88
7d62fb64 89 if (idx<=klastSPD1) {
2257f27e 90 yshift=0.248499; //let's hope the positioning of the SPDs will not change
7d62fb64 91 } else if (idx<=klastSPD2) {
2257f27e 92 yshift=3.096207; //let's hope the positioning of the SPDs will not change
93 } else {
94 Fatal("Clusters2RecPoints","This is not an SPD module ! %d",idx);
95 }
96
97 TClonesArray &pn=*points;
98 Int_t ncl=clusters->GetEntriesFast();
99 for (Int_t i=0; i<ncl; i++) {
100 AliITSRecPoint p;
00a7cc50 101 AliITSRecPoint *c = (AliITSRecPoint *)clusters->UncheckedAt(i);
2257f27e 102
7d62fb64 103 Float_t x=c->GetY(); if (idx<=klastSPD1) x=-x;
2257f27e 104 x+=yshift;
105
106 Float_t z=c->GetZ();
107 z=-z; z+=zshift[idx%4];
108
00a7cc50 109 p.SetDetLocalX(x);
110 p.SetDetLocalZ(z);
2257f27e 111 p.SetQ(c->GetQ());
00a7cc50 112 p.SetSigmaDetLocX2(c->GetSigmaY2());
2257f27e 113 p.SetSigmaZ2(c->GetSigmaZ2());
00a7cc50 114 p.SetLabel(c->GetLabel(0),0);
115 p.SetLabel(c->GetLabel(1),1);
116 p.SetLabel(c->GetLabel(2),2);
2257f27e 117
118 new (pn[i]) AliITSRecPoint(p);
119 }
120
121}
00a7cc50 122
123*/