1 /**************************************************************************
2 * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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>
18 #include "AliESDVertex.h"
19 #include <AliITSVertexerFast.h>
20 #include "AliHeader.h"
21 #include "AliGenEventHeader.h"
23 #include "AliITSLoader.h"
24 #include "AliRunLoader.h"
26 /////////////////////////////////////////////////////////////////////////
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 //
32 /////////////////////////////////////////////////////////////////////////
36 ClassImp(AliITSVertexerFast)
40 //______________________________________________________________________
41 AliITSVertexerFast::AliITSVertexerFast():AliITSVertexer(),
44 // Default Constructor
46 AliRunLoader *rl =AliRunLoader::Instance();
47 TTree *trK=(TTree*)rl->TreeK();
48 if(!trK)AliFatal("This class should be used only with simulated events!!");
52 //______________________________________________________________________
53 AliITSVertexerFast::AliITSVertexerFast(Double_t *smear):AliITSVertexer(),
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!!");
68 //______________________________________________________________________
69 AliITSVertexerFast::~AliITSVertexerFast(){
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));
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);
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]);
92 fCurrentVertex = new AliESDVertex(vrtx,fSmear,"Smeared Generated Vertex");
93 fCurrentVertex->SetTitle("vertexer: smearMC");
94 return fCurrentVertex;
98 //________________________________________________________
99 void AliITSVertexerFast::PrintStatus() const {
100 // Print current status
101 cout <<"=======================================================\n";
103 cout<<"RMS for gaussian smearing: ";
104 for(Int_t k=0;k<3;k++)cout<<" "<<fSmear[k];