Line data Source code
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 : #include <AliLog.h>
26 :
27 : /////////////////////////////////////////////////////////////////////////
28 : // //
29 : // Fast vertexer - True (i.e. generated) vertex coordinates //
30 : // are smeared with gaussians of given width //
31 : // Origin: masera@to.infn.it 25/09/2003 //
32 : // //
33 : /////////////////////////////////////////////////////////////////////////
34 :
35 : using std::endl;
36 : using std::cout;
37 118 : ClassImp(AliITSVertexerFast)
38 :
39 :
40 :
41 : //______________________________________________________________________
42 0 : AliITSVertexerFast::AliITSVertexerFast():AliITSVertexer(),
43 0 : fSmear(0)
44 0 : {
45 : // Default Constructor
46 0 : fSmear = 0;
47 0 : AliRunLoader *rl =AliRunLoader::Instance();
48 0 : TTree *trK=(TTree*)rl->TreeK();
49 0 : if(!trK)AliFatal("This class should be used only with simulated events!!");
50 0 : rl->LoadHeader();
51 0 : }
52 :
53 : //______________________________________________________________________
54 0 : AliITSVertexerFast::AliITSVertexerFast(Double_t *smear):AliITSVertexer(),
55 0 : fSmear(0)
56 0 : {
57 : // Standard constructor
58 0 : fSmear = new Double_t[3];
59 0 : for(Int_t i=0;i<3;i++)fSmear[i]=smear[i];
60 0 : 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]));
61 0 : AliRunLoader *rl =AliRunLoader::Instance();
62 0 : TTree *trK=(TTree*)rl->TreeK();
63 0 : if(!trK)AliFatal("This class should be used only with simulated events!!");
64 0 : rl->LoadHeader();
65 :
66 0 : }
67 :
68 :
69 : //______________________________________________________________________
70 0 : AliITSVertexerFast::~AliITSVertexerFast(){
71 : // Destructor
72 0 : delete [] fSmear;
73 0 : }
74 :
75 : //______________________________________________________________________
76 : AliESDVertex* AliITSVertexerFast::FindVertexForCurrentEvent(TTree *itsClusterTree){
77 : // Defines the AliITSVertex for the current event
78 0 : AliWarning(Form("This class should be used only with simulated events!! Input cluster tree (%p) will not be used!!",itsClusterTree));
79 :
80 0 : fCurrentVertex = 0;
81 0 : AliRunLoader *rl =AliRunLoader::Instance();
82 0 : TArrayF primaryVertex(3); // true vertex
83 0 : AliHeader* header = rl->GetHeader();
84 0 : AliGenEventHeader* genEventHeader = header->GenEventHeader();
85 0 : genEventHeader->PrimaryVertex(primaryVertex);
86 :
87 : // Smearing
88 0 : Double_t vrttrue[3],vrtx[3];
89 0 : for(Int_t k=0; k<3;k++){
90 0 : vrttrue[k] = static_cast<Double_t>(primaryVertex[k]);
91 0 : vrtx[k] = gRandom->Gaus(vrttrue[k],fSmear[k]);
92 : }
93 0 : fCurrentVertex = new AliESDVertex(vrtx,fSmear,"Smeared Generated Vertex");
94 0 : fCurrentVertex->SetTitle("vertexer: smearMC");
95 0 : return fCurrentVertex;
96 :
97 0 : }
98 :
99 : //________________________________________________________
100 : void AliITSVertexerFast::PrintStatus() const {
101 : // Print current status
102 0 : cout <<"=======================================================\n";
103 :
104 0 : cout<<"RMS for gaussian smearing: ";
105 0 : for(Int_t k=0;k<3;k++)cout<<" "<<fSmear[k];
106 0 : cout<<endl;
107 0 : }
108 :
|