1 #include <AliESDVertex.h>
2 #include <AliITSVertexer.h>
3 #include <AliRunLoader.h>
4 #include <AliITSLoader.h>
5 #include <AliITSRecPoint.h>
6 #include <AliITSclusterV2.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 // AliITSVertexerTracks //
15 //////////////////////////////////////////////////////////////////////
17 //______________________________________________________________________
18 AliITSVertexer::AliITSVertexer():AliVertexer() {
19 // Default Constructor
20 SetUseV2Clusters(kTRUE);
23 AliITSVertexer::AliITSVertexer(TString filename) {
24 // Standard constructor
25 AliRunLoader *rl = AliRunLoader::GetRunLoader();
27 Fatal("AliITSVertexer","Run Loader not found");
30 Fatal("AliITSVertexer","The AliRun object is not available - nothing done");
37 AliITSLoader* itsLoader = (AliITSLoader*) rl->GetLoader("ITSLoader");
38 if(!filename.Contains("default"))itsLoader->SetVerticesFileName(filename);
39 if(!filename.Contains("null"))itsLoader->LoadVertices("recreate");
40 itsLoader->LoadRecPoints();
43 lst = static_cast<Int_t>(rl->TreeE()->GetEntries());
46 SetUseV2Clusters(kTRUE);
49 //______________________________________________________________________
50 AliITSVertexer::AliITSVertexer(const AliITSVertexer &vtxr) : AliVertexer(vtxr) {
52 // Copies are not allowed. The method is protected to avoid misuse.
53 Error("AliITSVertexer","Copy constructor not allowed\n");
56 //______________________________________________________________________
57 AliITSVertexer& AliITSVertexer::operator=(const AliITSVertexer& /* vtxr */){
58 // Assignment operator
59 // Assignment is not allowed. The method is protected to avoid misuse.
60 Error("= operator","Assignment operator not allowed\n");
65 //______________________________________________________________________
66 void AliITSVertexer::WriteCurrentVertex(){
67 // Write the current AliVertex object to file fOutFile
68 AliRunLoader *rl = AliRunLoader::GetRunLoader();
69 AliITSLoader* itsLoader = (AliITSLoader*) rl->GetLoader("ITSLoader");
70 fCurrentVertex->SetName("Vertex");
71 // const char * name = fCurrentVertex->GetName();
72 // itsLoader->SetVerticesContName(name);
73 Int_t rc = itsLoader->PostVertex(fCurrentVertex);
74 rc = itsLoader->WriteVertices();
77 //______________________________________________________________________
78 void AliITSVertexer::Clusters2RecPoints
79 (const TClonesArray *clusters, Int_t idx, TClonesArray *points) {
80 //------------------------------------------------------------
81 // Conversion AliITSclusterV2 -> AliITSRecPoints for the ITS
82 // module "idx" (entry in the tree with the clusters).
83 // Simplified version, supposed to work with the pixels only !
84 //------------------------------------------------------------
85 const Int_t lastSPD1=79; //let's hope the number of the SPDs will not change
86 const Int_t lastSPD2=239;//let's hope the number of the SPDs will not change
88 Float_t yshift = 0; //see AliITSclustererV2.cxx about these shifts
89 Float_t zshift[4] = {-10.708000, -3.536000, 3.536000, 10.708000}; //let's hope the positioning of the SPDs will not change
92 yshift=0.248499; //let's hope the positioning of the SPDs will not change
93 } else if (idx<=lastSPD2) {
94 yshift=3.096207; //let's hope the positioning of the SPDs will not change
96 Fatal("Clusters2RecPoints","This is not an SPD module ! %d",idx);
99 TClonesArray &pn=*points;
100 Int_t ncl=clusters->GetEntriesFast();
101 for (Int_t i=0; i<ncl; i++) {
103 AliITSclusterV2 *c = (AliITSclusterV2 *)clusters->UncheckedAt(i);
105 Float_t x=c->GetY(); if (idx<=lastSPD1) x=-x;
109 z=-z; z+=zshift[idx%4];
114 p.SetSigmaX2(c->GetSigmaY2());
115 p.SetSigmaZ2(c->GetSigmaZ2());
116 p.SetLabel(0,c->GetLabel(0));
117 p.SetLabel(1,c->GetLabel(1));
118 p.SetLabel(2,c->GetLabel(2));
120 new (pn[i]) AliITSRecPoint(p);