]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSVertexerFast.cxx
Centrality edges <0% and >90% checks are removed
[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 "AliESDVertex.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
34 using std::endl;
35 using std::cout;
36 ClassImp(AliITSVertexerFast)
37
38
39
40 //______________________________________________________________________
41 AliITSVertexerFast::AliITSVertexerFast():AliITSVertexer(),
42 fSmear(0) 
43 {
44   // Default Constructor
45   fSmear = 0;
46   AliRunLoader *rl =AliRunLoader::Instance();
47   TTree *trK=(TTree*)rl->TreeK();
48   if(!trK)AliFatal("This class should be used only with simulated events!!");
49   rl->LoadHeader(); 
50 }
51
52 //______________________________________________________________________
53 AliITSVertexerFast::AliITSVertexerFast(Double_t *smear):AliITSVertexer(),
54 fSmear(0)
55 {
56   // Standard constructor
57   fSmear = new Double_t[3];
58   for(Int_t i=0;i<3;i++)fSmear[i]=smear[i];
59   AliInfo(Form("Gaussian smaring of the generated vertex. Sigmas (x,y,z) = %12.5f , %12.5f , %12.5f cm",fSmear[0],fSmear[1],fSmear[2]));
60   AliRunLoader *rl =AliRunLoader::Instance();
61   TTree *trK=(TTree*)rl->TreeK();
62   if(!trK)AliFatal("This class should be used only with simulated events!!");
63   rl->LoadHeader(); 
64
65 }
66
67
68 //______________________________________________________________________
69 AliITSVertexerFast::~AliITSVertexerFast(){
70   // Destructor
71   delete [] fSmear;
72 }
73
74 //______________________________________________________________________
75 AliESDVertex* AliITSVertexerFast::FindVertexForCurrentEvent(TTree *itsClusterTree){
76   // Defines the AliITSVertex for the current event
77   AliWarning(Form("This class should be used only with simulated events!! Input cluster tree (%p) will not be used!!",itsClusterTree));
78
79   fCurrentVertex = 0;
80   AliRunLoader *rl =AliRunLoader::Instance();
81   TArrayF primaryVertex(3);  // true vertex
82   AliHeader* header = rl->GetHeader();
83   AliGenEventHeader* genEventHeader = header->GenEventHeader();   
84   genEventHeader->PrimaryVertex(primaryVertex); 
85   
86   // Smearing
87   Double_t vrttrue[3],vrtx[3];
88   for(Int_t k=0; k<3;k++){
89     vrttrue[k] = static_cast<Double_t>(primaryVertex[k]);
90     vrtx[k] = gRandom->Gaus(vrttrue[k],fSmear[k]);
91   }
92   fCurrentVertex = new AliESDVertex(vrtx,fSmear,"Smeared Generated Vertex");
93   fCurrentVertex->SetTitle("vertexer: smearMC");
94   return fCurrentVertex;
95   
96 }
97
98 //________________________________________________________
99 void AliITSVertexerFast::PrintStatus() const {
100   // Print current status
101   cout <<"=======================================================\n";
102
103   cout<<"RMS for gaussian smearing: ";
104   for(Int_t k=0;k<3;k++)cout<<" "<<fSmear[k];
105   cout<<endl;
106 }
107