]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSVertexerFast.cxx
Compatibility with the ROOT trunk
[u/mrichter/AliRoot.git] / ITS / AliITSVertexerFast.cxx
CommitLineData
92e7a7bb 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>
d681bb2d 18#include "AliESDVertex.h"
92e7a7bb 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/////////////////////////////////////////////////////////////////////////
fe7d86eb 33
34using std::endl;
35using std::cout;
92e7a7bb 36ClassImp(AliITSVertexerFast)
37
38
39
40//______________________________________________________________________
8221b41b 41AliITSVertexerFast::AliITSVertexerFast():AliITSVertexer(),
42fSmear(0)
43{
92e7a7bb 44 // Default Constructor
45 fSmear = 0;
33c3c91a 46 AliRunLoader *rl =AliRunLoader::Instance();
60b9526b 47 TTree *trK=(TTree*)rl->TreeK();
48 if(!trK)AliFatal("This class should be used only with simulated events!!");
49 rl->LoadHeader();
92e7a7bb 50}
51
52//______________________________________________________________________
8221b41b 53AliITSVertexerFast::AliITSVertexerFast(Double_t *smear):AliITSVertexer(),
54fSmear(0)
55{
92e7a7bb 56 // Standard constructor
57 fSmear = new Double_t[3];
58 for(Int_t i=0;i<3;i++)fSmear[i]=smear[i];
9364069b 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]));
33c3c91a 60 AliRunLoader *rl =AliRunLoader::Instance();
60b9526b 61 TTree *trK=(TTree*)rl->TreeK();
62 if(!trK)AliFatal("This class should be used only with simulated events!!");
63 rl->LoadHeader();
64
92e7a7bb 65}
66
60b9526b 67
92e7a7bb 68//______________________________________________________________________
69AliITSVertexerFast::~AliITSVertexerFast(){
70 // Destructor
f510fd70 71 delete [] fSmear;
92e7a7bb 72}
73
74//______________________________________________________________________
308c2f7c 75AliESDVertex* AliITSVertexerFast::FindVertexForCurrentEvent(TTree *itsClusterTree){
92e7a7bb 76 // Defines the AliITSVertex for the current event
308c2f7c 77 AliWarning(Form("This class should be used only with simulated events!! Input cluster tree (%p) will not be used!!",itsClusterTree));
78
92e7a7bb 79 fCurrentVertex = 0;
33c3c91a 80 AliRunLoader *rl =AliRunLoader::Instance();
92e7a7bb 81 TArrayF primaryVertex(3); // true vertex
d3b3a3b2 82 AliHeader* header = rl->GetHeader();
92e7a7bb 83 AliGenEventHeader* genEventHeader = header->GenEventHeader();
84 genEventHeader->PrimaryVertex(primaryVertex);
60b9526b 85
92e7a7bb 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 }
308c2f7c 92 fCurrentVertex = new AliESDVertex(vrtx,fSmear,"Smeared Generated Vertex");
db2eccce 93 fCurrentVertex->SetTitle("vertexer: smearMC");
92e7a7bb 94 return fCurrentVertex;
60b9526b 95
92e7a7bb 96}
97
92e7a7bb 98//________________________________________________________
99void AliITSVertexerFast::PrintStatus() const {
100 // Print current status
101 cout <<"=======================================================\n";
102
92e7a7bb 103 cout<<"RMS for gaussian smearing: ";
104 for(Int_t k=0;k<3;k++)cout<<" "<<fSmear[k];
105 cout<<endl;
106}
107