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