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 /////////////////////////////////////////////////////////////////////////
33 ClassImp(AliITSVertexerFast)
37 //______________________________________________________________________
38 AliITSVertexerFast::AliITSVertexerFast():AliITSVertexer(),
41 // Default Constructor
43 AliRunLoader *rl =AliRunLoader::GetRunLoader();
44 TTree *trK=(TTree*)rl->TreeK();
45 if(!trK)AliFatal("This class should be used only with simulated events!!");
49 //______________________________________________________________________
50 AliITSVertexerFast::AliITSVertexerFast(Double_t *smear):AliITSVertexer(),
53 // Standard constructor
54 fSmear = new Double_t[3];
55 for(Int_t i=0;i<3;i++)fSmear[i]=smear[i];
56 Info("AliITSVertexerFast","Gaussian smaring of the generated vertex. Parameters %f12.5 , %f12.5 , %f12.5 \n",fSmear[0],fSmear[1],fSmear[2]);
57 AliRunLoader *rl =AliRunLoader::GetRunLoader();
58 TTree *trK=(TTree*)rl->TreeK();
59 if(!trK)AliFatal("This class should be used only with simulated events!!");
65 //______________________________________________________________________
66 AliITSVertexerFast::~AliITSVertexerFast(){
68 if(fSmear)delete [] fSmear;
72 //______________________________________________________________________
73 AliESDVertex* AliITSVertexerFast::FindVertexForCurrentEvent(Int_t evnumb){
74 // Defines the AliITSVertex for the current event
76 AliRunLoader *rl =AliRunLoader::GetRunLoader();
78 TArrayF primaryVertex(3); // true vertex
79 AliHeader* header = rl->GetAliRun()->GetHeader();
80 AliGenEventHeader* genEventHeader = header->GenEventHeader();
81 genEventHeader->PrimaryVertex(primaryVertex);
84 Double_t vrttrue[3],vrtx[3];
85 for(Int_t k=0; k<3;k++){
86 vrttrue[k] = static_cast<Double_t>(primaryVertex[k]);
87 vrtx[k] = gRandom->Gaus(vrttrue[k],fSmear[k]);
90 sprintf(name,"Vertex_%d",evnumb);
91 fCurrentVertex = new AliESDVertex(vrtx,fSmear,name);
92 return fCurrentVertex;
96 //______________________________________________________________________
97 void AliITSVertexerFast::FindVertices(){
98 // computes the vertices of the events in the range FirstEvent - LastEvent
100 AliRunLoader *rl = AliRunLoader::GetRunLoader();
101 AliITSLoader* iTSloader = (AliITSLoader*) rl->GetLoader("ITSLoader");
102 iTSloader->ReloadRecPoints();
103 for(Int_t i=fFirstEvent;i<=fLastEvent;i++){
105 FindVertexForCurrentEvent(i);
106 if(fCurrentVertex) WriteCurrentVertex();
108 cout<<"Vertex not found for event "<<i<<endl;
116 //________________________________________________________
117 void AliITSVertexerFast::PrintStatus() const {
118 // Print current status
119 cout <<"=======================================================\n";
121 cout<<"First event to be processed "<<fFirstEvent;
122 cout<<"\n Last event to be processed "<<fLastEvent<<endl;
123 cout<<"RMS for gaussian smearing: ";
124 for(Int_t k=0;k<3;k++)cout<<" "<<fSmear[k];
128 //______________________________________________________________________
129 AliITSVertexerFast::AliITSVertexerFast(const AliITSVertexerFast &vtxr) :
130 AliITSVertexer(vtxr) {
132 // Copies are not allowed. The method is protected to avoid misuse.
133 Error("AliITSVertexerFast","Copy constructor not allowed\n");
136 //______________________________________________________________________
137 AliITSVertexerFast& AliITSVertexerFast::operator=(const
138 AliITSVertexerFast& /* vtxr */){
139 // Assignment operator
140 // Assignment is not allowed. The method is protected to avoid misuse.
141 Error("= operator","Assignment operator not allowed\n");