]>
Commit | Line | Data |
---|---|---|
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 | ///////////////////////////////////////////////////////////////////////// | |
33 | ClassImp(AliITSVertexerFast) | |
34 | ||
35 | ||
36 | ||
37 | //______________________________________________________________________ | |
8221b41b | 38 | AliITSVertexerFast::AliITSVertexerFast():AliITSVertexer(), |
39 | fSmear(0) | |
40 | { | |
92e7a7bb | 41 | // Default Constructor |
42 | fSmear = 0; | |
43 | } | |
44 | ||
45 | //______________________________________________________________________ | |
8221b41b | 46 | AliITSVertexerFast::AliITSVertexerFast(Double_t *smear):AliITSVertexer(), |
47 | fSmear(0) | |
48 | { | |
92e7a7bb | 49 | // Standard constructor |
50 | fSmear = new Double_t[3]; | |
51 | for(Int_t i=0;i<3;i++)fSmear[i]=smear[i]; | |
2257f27e | 52 | Info("AliITSVertexerFast","Gaussian smaring of the generated vertex. Parameters %f12.5 , %f12.5 , %f12.5 \n",fSmear[0],fSmear[1],fSmear[2]); |
92e7a7bb | 53 | } |
54 | ||
55 | //______________________________________________________________________ | |
56 | AliITSVertexerFast::~AliITSVertexerFast(){ | |
57 | // Destructor | |
58 | if(fSmear)delete [] fSmear; | |
59 | fSmear = 0; | |
60 | } | |
61 | ||
62 | //______________________________________________________________________ | |
d681bb2d | 63 | AliESDVertex* AliITSVertexerFast::FindVertexForCurrentEvent(Int_t evnumb){ |
92e7a7bb | 64 | // Defines the AliITSVertex for the current event |
65 | fCurrentVertex = 0; | |
66 | AliRunLoader *rl =AliRunLoader::GetRunLoader(); | |
67 | rl->GetEvent(evnumb); | |
68 | TArrayF primaryVertex(3); // true vertex | |
69 | AliHeader* header = gAlice->GetHeader(); | |
70 | AliGenEventHeader* genEventHeader = header->GenEventHeader(); | |
71 | genEventHeader->PrimaryVertex(primaryVertex); | |
72 | ||
73 | // Smearing | |
74 | Double_t vrttrue[3],vrtx[3]; | |
75 | for(Int_t k=0; k<3;k++){ | |
76 | vrttrue[k] = static_cast<Double_t>(primaryVertex[k]); | |
77 | vrtx[k] = gRandom->Gaus(vrttrue[k],fSmear[k]); | |
78 | } | |
79 | char name[30]; | |
80 | sprintf(name,"Vertex_%d",evnumb); | |
d681bb2d | 81 | fCurrentVertex = new AliESDVertex(vrtx,fSmear,name); |
92e7a7bb | 82 | fCurrentVertex->SetTruePos(vrttrue); |
83 | return fCurrentVertex; | |
84 | } | |
85 | ||
86 | //______________________________________________________________________ | |
87 | void AliITSVertexerFast::FindVertices(){ | |
88 | // computes the vertices of the events in the range FirstEvent - LastEvent | |
89 | ||
90 | AliRunLoader *rl = AliRunLoader::GetRunLoader(); | |
91 | AliITSLoader* iTSloader = (AliITSLoader*) rl->GetLoader("ITSLoader"); | |
92 | iTSloader->ReloadRecPoints(); | |
93 | for(Int_t i=fFirstEvent;i<=fLastEvent;i++){ | |
94 | rl->GetEvent(i); | |
95 | FindVertexForCurrentEvent(i); | |
96 | if(fCurrentVertex) WriteCurrentVertex(); | |
97 | else { | |
98 | cout<<"Vertex not found for event "<<i<<endl; | |
99 | ||
100 | } | |
101 | ||
102 | } | |
103 | ||
104 | } | |
105 | ||
106 | //________________________________________________________ | |
107 | void AliITSVertexerFast::PrintStatus() const { | |
108 | // Print current status | |
109 | cout <<"=======================================================\n"; | |
110 | ||
111 | cout<<"First event to be processed "<<fFirstEvent; | |
112 | cout<<"\n Last event to be processed "<<fLastEvent<<endl; | |
113 | cout<<"RMS for gaussian smearing: "; | |
114 | for(Int_t k=0;k<3;k++)cout<<" "<<fSmear[k]; | |
115 | cout<<endl; | |
116 | } | |
117 | ||
118 | //______________________________________________________________________ | |
119 | AliITSVertexerFast::AliITSVertexerFast(const AliITSVertexerFast &vtxr) : | |
120 | AliITSVertexer(vtxr) { | |
121 | // Copy constructor | |
122 | // Copies are not allowed. The method is protected to avoid misuse. | |
123 | Error("AliITSVertexerFast","Copy constructor not allowed\n"); | |
124 | } | |
125 | ||
126 | //______________________________________________________________________ | |
127 | AliITSVertexerFast& AliITSVertexerFast::operator=(const | |
128 | AliITSVertexerFast& /* vtxr */){ | |
129 | // Assignment operator | |
130 | // Assignment is not allowed. The method is protected to avoid misuse. | |
131 | Error("= operator","Assignment operator not allowed\n"); | |
132 | return *this; | |
133 | } |