37 return e * float(
z)/
a;
49 Double_t mp =TDatabasePDG::Instance()->GetParticle(2212)->Mass();
50 return TMath::Sqrt(be*be-mp*mp);
69 const char*
Name() {
return (
IsP() ?
"P" :
IsA() ?
"A" :
""); }
90 if (b.EqualTo(
"P") || b.EqualTo(
"PROTON")) {
93 else if (b.EqualTo(
"A") || b.BeginsWidth(
"PB")) {
113 Info(
"GRP",
"Will try from file %s",
FileName());
115 Warning(
"GRP",
"Failed to read from file, trying from OCDB");
117 Fatal(
"GRP",
"Failed to get GRP values");
128 " Beam energy: %d GeV\n"
129 " sqrt(s_NN): %d GeV\n"
130 " Beam 1: %s (%d %d)\n"
131 " Beam 2: %s (%d %d)",
199 return tmp.Atoi() + 2000;
211 return (static_cast<TObjString*>(o))->String().Atoi();
221 Info(
"GRP",
"Cannot open file %s",
FileName());
225 std::ifstream* pin =
new std::ifstream(
"grp.dat");
226 std::ifstream& in = *pin;
231 if (line.IsNull())
continue;
232 if (line[0] ==
'#')
continue;
237 Info(
"GRP",
"No line found");
240 Info(
"GRP",
"Got the line %s", env.Data());
242 if (tokens->GetEntries() < 8) {
243 Warning(
"GRP",
"Failed to get enough field from GRP_SUMMARY=%s",
247 period = tokens->At(0)->GetName();
268 AliCDBManager* cdb = AliCDBManager::Instance();
269 cdb->SetDefaultStorageFromRun(r);
271 AliCDBEntry* ent = cdb->Get(
"GRP/GRP/Data");
273 Warning(
"GRP",
"No GRP data found");
280 AliGRPObject* obj =
static_cast<AliGRPObject*
>(ent->GetObject());
283 period = obj->GetLHCPeriod();
284 beamEnergy = TMath::Ceil(obj->GetBeamEnergy());
285 TString beam1T = obj->GetSingleBeamType(0);
286 TString beam2T = obj->GetSingleBeamType(1);
288 if (!beam1T.IsNull() && !beam2T.IsNull()) {
293 TString beamType = obj->GetBeamType();
294 if (beamType.IsNull()) {
295 Warning(
"GRP",
"No beam type");
302 beam1T = ab->At(0)->GetName();
303 beam2T = ab->At(1)->GetName();
319 energy = (TMath::Abs(sNN - 2760) < 10 ? 2760 :
320 TMath::Abs(sNN - 5023) < 10 ? 5023 :
321 TMath::Abs(sNN - 2360) < 10 ? 2360 :
322 TMath::Abs(sNN - 900) < 10 ? 900 :
323 TMath::Abs(sNN - 7000) < 10 ? 7000 :
324 TMath::Abs(sNN - 8000) < 10 ? 8000 :
325 TMath::Abs(sNN - 13000) < 10 ? 13000 :
329 std::ofstream* pout =
new std::ofstream(fn);
330 std::ofstream& out = *pout;
331 out <<
"# PERIOD:RUN:BEAMENERGY:ENERGY:BEAM1A:BEAM1Z:BEAM2A:BEAM2Z\n"
340 <<
"# EOF " << std::endl;
357 if (val.IsNull())
return def;
358 return UInt_t(val.Atoll());
const char * FileName() const
static UInt_t Env2UInt(const char *envName, UInt_t def)
void Set(const TString &b)
UInt_t CMEnergy(UShort_t how=0) const
static UInt_t Obj2UInt(const TObject *o)
Double_t BeamEnergy(UShort_t which)
Float_t GetMomentum(Float_t e) const
Bool_t ReadFromOCDB(UInt_t r)
Double_t BeamMomentum(UShort_t which)
Float_t GetEnergy(Float_t e) const