]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSVertexer.cxx
merging RecPoints and ClustersV2. All ClusterFinders produce AliITSRecPoints objects...
[u/mrichter/AliRoot.git] / ITS / AliITSVertexer.cxx
1 #include <AliESDVertex.h>
2 #include <AliITSVertexer.h>
3 #include <AliRunLoader.h>
4 #include <AliITSLoader.h>
5
6 ClassImp(AliITSVertexer)
7
8 //////////////////////////////////////////////////////////////////////
9 // Base class for primary vertex reconstruction                     //
10 // AliESDVertexer is a class for full 3D primary vertex finding     //
11 // derived classes: AliITSVertexerIons AliITSvertexerPPZ            //
12 //                  AliITSVertexerTracks                            //
13 //////////////////////////////////////////////////////////////////////
14
15 //______________________________________________________________________
16 AliITSVertexer::AliITSVertexer():AliVertexer() {
17   // Default Constructor
18   //SetUseV2Clusters(kTRUE);
19 }
20
21 AliITSVertexer::AliITSVertexer(TString filename) {
22   // Standard constructor
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   }
30   fCurrentVertex  = 0;   
31   SetDebug();
32   SetFirstEvent(0);
33   SetLastEvent(0);
34   rl->LoadHeader();
35   AliITSLoader* itsLoader =  (AliITSLoader*) rl->GetLoader("ITSLoader");
36   if(!filename.Contains("default"))itsLoader->SetVerticesFileName(filename);
37   if(!filename.Contains("null"))itsLoader->LoadVertices("recreate");
38   itsLoader->LoadRecPoints();
39   Int_t lst;
40   if(rl->TreeE()){
41     lst = static_cast<Int_t>(rl->TreeE()->GetEntries());
42     SetLastEvent(lst-1);
43   }
44   //SetUseV2Clusters(kTRUE);
45 }
46
47 //______________________________________________________________________
48 AliITSVertexer::AliITSVertexer(const AliITSVertexer &vtxr) : AliVertexer(vtxr) {
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
62
63 //______________________________________________________________________
64 void AliITSVertexer::WriteCurrentVertex(){
65   // Write the current AliVertex object to file fOutFile
66   AliRunLoader *rl = AliRunLoader::GetRunLoader();
67   AliITSLoader* itsLoader =  (AliITSLoader*) rl->GetLoader("ITSLoader");
68   fCurrentVertex->SetName("Vertex");
69   //  const char * name = fCurrentVertex->GetName();
70   //  itsLoader->SetVerticesContName(name);
71   Int_t rc = itsLoader->PostVertex(fCurrentVertex);
72   rc = itsLoader->WriteVertices();
73 }
74 /*
75 //______________________________________________________________________
76 void AliITSVertexer::Clusters2RecPoints
77 (const TClonesArray *clusters, Int_t idx, TClonesArray *points) {
78   //------------------------------------------------------------
79   // Conversion AliITSRecPoint -> AliITSRecPoints for the ITS
80   // module "idx" (entry in the tree with the clusters).
81   // Simplified version, supposed to work with the pixels only !
82   //------------------------------------------------------------
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
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
89   if (idx<=klastSPD1) {
90     yshift=0.248499;  //let's hope the positioning of the SPDs will not change
91   } else if (idx<=klastSPD2) {
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;
101     AliITSRecPoint *c = (AliITSRecPoint *)clusters->UncheckedAt(i);
102
103     Float_t x=c->GetY();  if (idx<=klastSPD1) x=-x;
104     x+=yshift;
105
106     Float_t z=c->GetZ();
107     z=-z; z+=zshift[idx%4];
108
109     p.SetDetLocalX(x);
110     p.SetDetLocalZ(z);
111     p.SetQ(c->GetQ());
112     p.SetSigmaDetLocX2(c->GetSigmaY2());
113     p.SetSigmaZ2(c->GetSigmaZ2());
114     p.SetLabel(c->GetLabel(0),0);
115     p.SetLabel(c->GetLabel(1),1);
116     p.SetLabel(c->GetLabel(2),2);
117
118     new (pn[i]) AliITSRecPoint(p);
119   }
120
121 }
122
123 */