10#include "SpectraAna.h"
14#include "CutCollection.h"
15#include "CutContainer.h"
20#include "TrackPdgCut.h"
25#include <TObjString.h>
47 fEventCollectionsNames(NULL),
48 fTrackCollectionsNames(NULL),
58 Double_t p = TMath::Sqrt(px * px + py * py + pz * pz);
62 e = TMath::Sqrt(p * p + m * m);
65 m = TMath::Sqrt(e * e - p * p);
67 Double_t pt = TMath::Sqrt(px * px + py * py);
68 Double_t mt = TMath::Sqrt(pt * pt + m * m);
69 Double_t y = 0.5 * TMath::Log((e + pz) / (e - pz));
79 eta = 0.5 * TMath::Log((p + pz) / (p - pz));
88 Package*
package = TrackAna::Report();
92 TString title_event = ((TObjString*) fEventCollectionsNames->UncheckedAt(event_collection_no))->GetString();
93 TString title_track = ((TObjString*) fTrackCollectionsNames->UncheckedAt(i))->GetString();
94 TString pack_name = Form(
"%s#%s", title_event.Data(), title_track.Data());
106 package->AddObject(pack);
124 axisConf[2] = z_axis;
125 z_axis->SetTitle(
"dN/dP_{T}d#eta");
126 axisConf[1] = pt_axis;
127 axisConf[0] = eta_axis;
129 z_axis->SetTitle(
"dN/dP_{T}dy");
130 axisConf[1] = pt_axis;
131 axisConf[0] = y_axis;
133 z_axis->SetTitle(
"dN/dm_{T}d#eta");
134 axisConf[1] = mt_axis;
135 axisConf[0] = eta_axis;
137 z_axis->SetTitle(
"dN/dm_{T}dy");
138 axisConf[1] = mt_axis;
139 axisConf[0] = y_axis;
150 TString title = ((TObjString*) fEventCollectionsNames->UncheckedAt(event_collection_no))->GetString();
152 title = title + ((TObjString*) fTrackCollectionsNames->UncheckedAt(i))->GetString();
153 fPtY->
At(i)->SetTitle(title);
154 fPtEta->
At(i)->SetTitle(title);
155 fMtY->
At(i)->SetTitle(title);
156 fMtEta->
At(i)->SetTitle(title);
157 fPtY->
At(i)->SetName(title);
158 fPtEta->
At(i)->SetName(title);
159 fMtY->
At(i)->SetName(title);
160 fMtEta->
At(i)->SetName(title);
163 if (fMass.size() == 0) {
165 return Task::EInitFlag::kFATAL;
168 Cout::PrintInfo(
"Mass used, but some masses are not set", EInfo::kError);
172 Cout::PrintInfo(Form(
"Mass at collection %i (%4.2f) is not valid", i, fMass.at(i)), EInfo::kError);
204 if (fEventCollectionsNames == NULL) { fEventCollectionsNames =
new TClonesArray(
"TObjString"); }
205 TObjString* obj_string = (TObjString*) fEventCollectionsNames->ConstructedAt(event_collection);
206 obj_string->SetString(name);
210 if (fTrackCollectionsNames == NULL) { fTrackCollectionsNames =
new TClonesArray(
"TObjString"); }
211 TObjString* obj_string = (TObjString*) fTrackCollectionsNames->ConstructedAt(track_collection);
212 obj_string->SetString(name);
215 void SpectraAna::CheckNames() {
216 if (fTrackCollectionsNames == NULL) { fTrackCollectionsNames =
new TClonesArray(
"TObjString"); }
218 TObjString* obj = (TObjString*) fTrackCollectionsNames->UncheckedAt(i);
220 obj = (TObjString*) fTrackCollectionsNames->ConstructedAt(i);
221 obj->SetString(Form(
"track_collection[%i]", i));
225 if (fEventCollectionsNames == NULL) { fEventCollectionsNames =
new TClonesArray(
"TObjString"); }
227 TObjString* obj = (TObjString*) fEventCollectionsNames->UncheckedAt(i);
229 obj = (TObjString*) fEventCollectionsNames->ConstructedAt(i);
230 obj->SetString(Form(
"event_collection[%i]", i));
237 if (fMass.size() < (UInt_t) track_collection) { fMass.resize(track_collection + 1); }
238 fMass[track_collection] = mass;
242 TString option = opt;
243 if (!option.EqualTo(
"auto")) {
246 Int_t event_collections = 0;
248 Cout::PrintInfo(
"You sent auto option without event cuts, automatic configuration "
249 "will be work only for first even colllection",
266 for (
int i = 0; i < event_collections; i++) {
267 Int_t count = event_collections * i;
290 SpectraAna::~SpectraAna() {
297 if (fTrackCollectionsNames)
delete fTrackCollectionsNames;
298 if (fEventCollectionsNames)
delete fEventCollectionsNames;
static void PrintInfo(TString text, Hal::EInfo status)
Int_t GetPrevAddr(Int_t index) const
ULong64_t GetPassed(Option_t *opt="") const
Int_t GetEventCollectionsNo() const
CutCollection * GetTrackCollection(Int_t collection) const
CutCollection * GetEventCollection(Int_t collection) const
void SetMinAndMax(Double_t val, Int_t i=0)
void SetCollectionID(Int_t i)
CutContainer * fCutContainer
Int_t fEventCollectionsNo
virtual void AddCut(const Cut &cut, Option_t *opt="")
virtual void AddTags(TString tag)
void Fill(Int_t i, Double_t X, Double_t Y)
void Init(Int_t size, HistogramAxisConf **axisconf, TString title, Bool_t Sumw=kFALSE)
void SetName(TString name)
void AddObject(TObject *object)
void SetPtAxis(Int_t bins, Double_t min, Double_t max)
void SetMtAxis(Int_t bins, Double_t min, Double_t max)
virtual void ProcessTrack()
void SetYAxis(Int_t bins, Double_t min, Double_t max)
void SetMass(Double_t mass, Int_t track_collection)
void SetOption(Option_t *opt)
void SetEventCollectionName(TString name, Int_t event_collection=0)
virtual Task::EInitFlag Init()
void SetEtaAxis(Int_t bins, Double_t min, Double_t max)
void SetTrackCollectionName(TString name, Int_t track_collection=0)
virtual Task::EInitFlag Init()
Int_t fCurrentTrackCollectionID
Int_t fTrackCollectionsNo
virtual void SetOption(Option_t *option)