Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
FluctuationsAna.cxx
1/*
2 * FluctuationsAna.cxx
3 *
4 * Created on: 18 kwi 2018
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9
10#include "FluctuationsAna.h"
11
12#include <TCollection.h>
13#include <TH1.h>
14#include <TList.h>
15#include <TString.h>
16
17#include "CutCollection.h"
18#include "CutContainer.h"
19#include "Event.h"
20#include "EventVirtualCut.h"
21#include "Std.h"
22#include "MemoryMapManager.h"
23#include "Package.h"
24
25namespace Hal {
26 FluctuationsAna::FluctuationsAna() :
27 fArray(), fBins(1001), fTackCollectionsPerEvent(0), fMin(-0.5), fMax(100.5), fHistograms(NULL) {}
28
29 void FluctuationsAna::CheckCutContainerCollections() {
30 fEventCollectionsNo = fCutContainer->GetEventCollectionsNo();
31 fTrackCollectionsNo = fCutContainer->GetTrackCollectionsNo();
32 fTackCollectionsPerEvent = fTrackCollectionsNo;
33 if (fEventCollectionsNo == 0) { AddCut(EventVirtualCut()); }
34 for (int i = 1; i < fEventCollectionsNo; i++) {
35 for (int j = 0; j < fTackCollectionsPerEvent; j++) {
36 fCutContainer->ReplicateCollection(ECutUpdate::kTrack, j, fTackCollectionsPerEvent * i + j);
37 }
38 }
39 fTrackCollectionsNo = fCutContainer->GetTrackCollectionsNo();
40 }
41
42 void FluctuationsAna::ProcessEvent() {
43 for (int i = 0; i < fTackCollectionsPerEvent; i++)
44 fArray[i] = 0;
45 CutCollection* cont = fCutContainer->GetEventCollection(fCurrentEventCollectionID);
46 for (int i = 0; i < fMemoryMap->GetTemporaryTotalTracksNo(); i++) {
47 fCurrentTrack = fCurrentEvent->GetTrack(i);
48 for (int j = 0; j < cont->GetNextNo(); j++) {
49 fCurrentTrackCollectionID = cont->GetNextAddr(j);
50 if (fCutContainer->PassTrack(fCurrentTrack, fCurrentTrackCollectionID)) { fArray[j]++; }
51 }
52 }
53 for (int i = 0; i < fTackCollectionsPerEvent; i++) {
54 fHistograms->Fill(fCurrentEventCollectionID, i, fArray[i]);
55 }
56 }
57
58 Task::EInitFlag FluctuationsAna::Init() {
59 if (TrackAna::Init() == Task::EInitFlag::kFATAL) return Task::EInitFlag::kFATAL;
60 fHistograms = new HistogramManager_2_1D<TH1D>();
61 fHistograms->Init(fEventCollectionsNo, fTackCollectionsPerEvent, fBins, fMin, fMax, kFALSE);
62 fArray.MakeBigger(fEventCollectionsNo);
63 return Task::EInitFlag::kSUCCESS;
64 }
65
66 void FluctuationsAna::SetHistogramAxis(Int_t bins, Double_t min, Double_t max) {
67 fBins = bins;
68 fMin = min;
69 fMax = max;
70 }
71
72 void FluctuationsAna::SetHistogramAxis(Int_t bins) {
73 Double_t min = -0.5;
74 Double_t max = ((Double_t) bins) + 0.5;
75 SetHistogramAxis(bins + 1, min, max);
76 }
77
78 Package* FluctuationsAna::Report() const {
79 Package* report = TrackAna::Report();
80 for (int i = 0; i < fEventCollectionsNo; i++) {
81 TList* list = new TList();
82 list->SetName(Form("Event collection [%i]", i));
83 for (int j = 0; j < fTackCollectionsPerEvent; j++) {
84 TH1* h = (TH1*) fHistograms->At(i, j)->Clone(Form("HIST_%i", j));
85 h->SetName(Form("[%i][%i]", i, j));
86 list->AddLast(h);
87 }
88 report->AddObject(list);
89 }
90 return report;
91 }
92
93 FluctuationsAna::~FluctuationsAna() {
94 if (fHistograms) delete fHistograms;
95 }
96} // namespace Hal
Int_t GetNextNo() const
Int_t GetNextAddr(Int_t index) const
void AddObject(TObject *object)
Definition Package.cxx:209