]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSVertexerFast.cxx
Revert one change (Sun,Alpha)
[u/mrichter/AliRoot.git] / ITS / AliITSVertexerFast.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15 #include <Riostream.h>
16 #include <TArrayF.h>
17 #include <TRandom.h>
18 #include "AliITSVertex.h"
19 #include <AliITSVertexerFast.h>
20 #include "AliHeader.h"
21 #include "AliGenEventHeader.h"
22 #include "AliRun.h"
23 #include "AliITSLoader.h"
24 #include "AliRunLoader.h"
25
26 /////////////////////////////////////////////////////////////////////////
27 //                                                                     //
28 // Fast vertexer - True (i.e. generated) vertex coordinates            //
29 // are smeared with gaussians of given width                           //
30 // Origin: masera@to.infn.it     25/09/2003                            //
31 //                                                                     //
32 /////////////////////////////////////////////////////////////////////////
33 ClassImp(AliITSVertexerFast)
34
35
36
37 //______________________________________________________________________
38 AliITSVertexerFast::AliITSVertexerFast():AliITSVertexer() {
39   // Default Constructor
40   fSmear = 0;
41 }
42
43 //______________________________________________________________________
44 AliITSVertexerFast::AliITSVertexerFast(Double_t *smear):AliITSVertexer() {
45   // Standard constructor
46   fSmear = new Double_t[3];
47   for(Int_t i=0;i<3;i++)fSmear[i]=smear[i];
48 }
49
50 //______________________________________________________________________
51 AliITSVertexerFast::~AliITSVertexerFast(){
52   // Destructor
53   if(fSmear)delete [] fSmear;
54   fSmear = 0;
55 }
56
57 //______________________________________________________________________
58 AliITSVertex* AliITSVertexerFast::FindVertexForCurrentEvent(Int_t evnumb){
59   // Defines the AliITSVertex for the current event
60   fCurrentVertex = 0;
61   AliRunLoader *rl =AliRunLoader::GetRunLoader();
62   rl->GetEvent(evnumb);
63   TArrayF primaryVertex(3);  // true vertex
64   AliHeader* header = gAlice->GetHeader();
65   AliGenEventHeader* genEventHeader = header->GenEventHeader();   
66   genEventHeader->PrimaryVertex(primaryVertex); 
67
68   // Smearing
69   Double_t vrttrue[3],vrtx[3];
70   for(Int_t k=0; k<3;k++){
71     vrttrue[k] = static_cast<Double_t>(primaryVertex[k]);
72     vrtx[k] = gRandom->Gaus(vrttrue[k],fSmear[k]);
73   }
74   char name[30];
75   sprintf(name,"Vertex_%d",evnumb);
76   fCurrentVertex = new AliITSVertex(vrtx,fSmear,name);
77   fCurrentVertex->SetTruePos(vrttrue);
78   return fCurrentVertex;
79 }
80
81 //______________________________________________________________________
82 void AliITSVertexerFast::FindVertices(){
83   // computes the vertices of the events in the range FirstEvent - LastEvent
84
85   AliRunLoader *rl = AliRunLoader::GetRunLoader();
86   AliITSLoader* iTSloader =  (AliITSLoader*) rl->GetLoader("ITSLoader");
87   iTSloader->ReloadRecPoints();
88   for(Int_t i=fFirstEvent;i<=fLastEvent;i++){
89     rl->GetEvent(i);
90     FindVertexForCurrentEvent(i);   
91     if(fCurrentVertex) WriteCurrentVertex();
92     else {
93       cout<<"Vertex not found for event "<<i<<endl;
94
95     }
96
97   }
98
99 }
100
101 //________________________________________________________
102 void AliITSVertexerFast::PrintStatus() const {
103   // Print current status
104   cout <<"=======================================================\n";
105
106   cout<<"First event to be processed "<<fFirstEvent;
107   cout<<"\n Last event to be processed "<<fLastEvent<<endl;
108   cout<<"RMS for gaussian smearing: ";
109   for(Int_t k=0;k<3;k++)cout<<" "<<fSmear[k];
110   cout<<endl;
111 }
112
113 //______________________________________________________________________
114 AliITSVertexerFast::AliITSVertexerFast(const AliITSVertexerFast &vtxr) : 
115                     AliITSVertexer(vtxr) {
116   // Copy constructor
117   // Copies are not allowed. The method is protected to avoid misuse.
118   Error("AliITSVertexerFast","Copy constructor not allowed\n");
119 }
120
121 //______________________________________________________________________
122 AliITSVertexerFast& AliITSVertexerFast::operator=(const 
123                     AliITSVertexerFast& /* vtxr */){
124   // Assignment operator
125   // Assignment is not allowed. The method is protected to avoid misuse.
126   Error("= operator","Assignment operator not allowed\n");
127   return *this;
128 }