AliRoot Core
3dc7879 (3dc7879)
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
AliGenEventHeader.cxx
Go to the documentation of this file.
1
/**************************************************************************
2
* Copyright(c) 1998-1999, 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
16
/* $Id$ */
17
18
//---------------------------------------------------------------------
19
// Event header base class for generator.
20
// Stores as a minimum the date, run number, event number,
21
// number of particles produced
22
// and the impact parameter.
23
// Author: andreas.morsch@cern.ch
24
//---------------------------------------------------------------------
25
26
#include "
AliLog.h
"
27
#include "
AliGenEventHeader.h
"
28
ClassImp(
AliGenEventHeader
)
29
30
//_______________________________________________________________________
31
AliGenEventHeader
::
AliGenEventHeader
():
32
fNProduced(-1),
33
fVertex(3),
34
fInteractionTime(0.),
35
fEventWeight(1.),
36
fEventWeights(),
37
fEventWeightNameGenerator("
gen
")
38
{
39
//
40
// Constructor
41
//
42
}
43
44
//_______________________________________________________________________
45
AliGenEventHeader::AliGenEventHeader
(
const
char
* name):
46
TNamed(name,
"Event Header"
),
47
fNProduced(-1),
48
fVertex(3),
49
fInteractionTime(0.),
50
fEventWeight(1.)
51
{
52
//
53
// Constructor
54
//
55
}
56
57
//_______________________________________________________________________
58
void
AliGenEventHeader::SetPrimaryVertex
(
const
TArrayF &o)
59
{
60
//
61
// Set the primary vertex for the event
62
//
63
fVertex
[0]=o.At(0);
64
fVertex
[1]=o.At(1);
65
fVertex
[2]=o.At(2);
66
}
67
68
//_______________________________________________________________________
69
void
AliGenEventHeader::PrimaryVertex
(TArrayF &o)
const
70
{
71
//
72
// Return the primary vertex for the event
73
//
74
o.Set(3);
75
o[0] =
fVertex
.At(0);
76
o[1] =
fVertex
.At(1);
77
o[2] =
fVertex
.At(2);
78
}
79
80
Float_t
AliGenEventHeader::GetEventWeight
(
const
TString &name)
81
{
82
// return weight associated to name,
83
// if not found return 1
84
85
// for compatibility we return fEventWeight
86
// when generator weight is requested but map is empty
87
if
(
fEventWeights
.empty() && (name ==
fEventWeightNameGenerator
))
88
return
fEventWeight
;
89
else
if
(
fEventWeights
.find(name.Data()) !=
fEventWeights
.end())
90
return
fEventWeights
[name.Data()];
91
else
92
return
1.;
93
}
94
95
void
AliGenEventHeader::AddEventWeight
(
const
TString &name, Float_t w)
96
{
97
// add new event name
98
99
if
(
fEventWeights
.find(name.Data()) !=
fEventWeights
.end()) {
100
AliWarning
(Form(
"Updating already existing event weight <%s>"
, name.Data()));
101
fEventWeights
[name.Data()] *= w;
102
}
else
{
103
fEventWeights
[name.Data()] = w;
104
}
105
106
fEventWeight
*= w;
107
}
AliGenEventHeader::AliGenEventHeader
AliGenEventHeader()
Definition:
AliGenEventHeader.cxx:31
AliGenEventHeader::PrimaryVertex
virtual void PrimaryVertex(TArrayF &o) const
Definition:
AliGenEventHeader.cxx:69
AliGenEventHeader.h
AliGenEventHeader::GetEventWeight
virtual Float_t GetEventWeight(const TString &name)
Definition:
AliGenEventHeader.cxx:80
AliWarning
#define AliWarning(message)
Definition:
AliLog.h:541
AliLog.h
gen
void gen(Int_t nev=1, const char *genConfig="$ALICE_ROOT/MUON/macros/genTestConfig.C")
Definition:
gen.C:45
AliGenEventHeader::SetPrimaryVertex
virtual void SetPrimaryVertex(const TArrayF &o)
Definition:
AliGenEventHeader.cxx:58
AliGenEventHeader::AddEventWeight
virtual void AddEventWeight(const TString &name, Float_t w)
Definition:
AliGenEventHeader.cxx:95
AliGenEventHeader::fEventWeight
Float_t fEventWeight
Definition:
AliGenEventHeader.h:48
AliGenEventHeader
Definition:
AliGenEventHeader.h:20
AliGenEventHeader::fEventWeights
std::map< std::string, Float_t > fEventWeights
Definition:
AliGenEventHeader.h:50
AliGenEventHeader::fVertex
TArrayF fVertex
Definition:
AliGenEventHeader.h:46
AliGenEventHeader::fEventWeightNameGenerator
const TString fEventWeightNameGenerator
Definition:
AliGenEventHeader.h:51
STEER
STEERBase
AliGenEventHeader.cxx
Generated on Tue Nov 6 2018 17:14:21 for AliRoot Core by
1.8.11