3 |
|
// |
4 |
|
// PlotKineMod |
5 |
|
// |
6 |
< |
// This module |
6 |
> |
// This module allows one to quickly plot eta and pt distribution of a given particle. |
7 |
|
// |
8 |
|
// Authors: C.Loizides |
9 |
|
//-------------------------------------------------------------------------------------------------- |
27 |
|
|
28 |
|
const char *GetColName() const { return fColName; } |
29 |
|
Double_t GetEtaMin() const { return fEtaMin; } |
30 |
< |
Double_t GSetEtaMax() const { return fEtaMax; } |
30 |
> |
Double_t GetEtaMax() const { return fEtaMax; } |
31 |
|
Double_t GetPtMin() const { return fPtMin; } |
32 |
|
Double_t GetPtMax() const { return fPtMax; } |
33 |
+ |
Bool_t GetLoadBranch() const { return fLoadBr; } |
34 |
|
void SetColName(const char *n) { fColName=n; } |
35 |
|
void SetEtaMin(Double_t e) { fEtaMin = e; } |
36 |
|
void SetEtaMax(Double_t e) { fEtaMax = e; } |
37 |
+ |
void SetLoadBranch(Bool_t b) { fLoadBr = b; } |
38 |
|
void SetPtMin(Double_t pt) { fPtMin = pt; } |
39 |
|
void SetPtMax(Double_t pt) { fPtMax = pt; } |
40 |
|
|
41 |
|
protected: |
42 |
+ |
Bool_t Load(); |
43 |
+ |
void Process(); |
44 |
+ |
void SlaveBegin(); |
45 |
+ |
|
46 |
|
TString fColName; //name of collection |
47 |
|
Double_t fPtMin; //minimum pt |
48 |
|
Double_t fPtMax; //maximum pt |
55 |
|
TH1D *fMassHist; //!mass histogram |
56 |
|
TH1D *fMtHist; //!mt histogram |
57 |
|
|
52 |
– |
void Process(); |
53 |
– |
void SlaveBegin(); |
54 |
– |
|
58 |
|
ClassDefT(PlotKineMod,1) // Plot kinematics module |
59 |
|
}; |
60 |
|
} |
74 |
|
fEtaHist(0) |
75 |
|
{ |
76 |
|
// Constructor. |
77 |
+ |
|
78 |
+ |
this->SetFillHist(1); |
79 |
|
} |
80 |
|
|
81 |
|
//-------------------------------------------------------------------------------------------------- |
82 |
|
template<class T> |
83 |
< |
void mithep::PlotKineMod<T>::Process() |
83 |
> |
Bool_t mithep::PlotKineMod<T>::Load() |
84 |
|
{ |
85 |
< |
// Process entries of the tree: Just load the branch and fill the histograms. |
85 |
> |
// Load data from branch or get pointer from event. |
86 |
|
|
87 |
< |
if (fLoadBr) |
87 |
> |
if (GetLoadBranch()) |
88 |
|
LoadBranch(GetColName()); |
89 |
< |
else |
89 |
> |
else |
90 |
|
fCol = GetObjThisEvt<Collection<T> >(GetColName()); |
91 |
+ |
|
92 |
+ |
return (fCol!=0); |
93 |
+ |
} |
94 |
+ |
|
95 |
+ |
//-------------------------------------------------------------------------------------------------- |
96 |
+ |
template<class T> |
97 |
+ |
void mithep::PlotKineMod<T>::Process() |
98 |
+ |
{ |
99 |
+ |
// Process entries of the tree: Just load the branch and fill the histograms. |
100 |
+ |
|
101 |
+ |
if (!Load()) { |
102 |
+ |
this->SendError(kAbortModule, "Process", "Could not load data!"); |
103 |
+ |
return; |
104 |
+ |
} |
105 |
+ |
|
106 |
+ |
if (!GetFillHist()) |
107 |
+ |
return; |
108 |
|
|
109 |
< |
Int_t ents=fCol->GetEntries(); |
110 |
< |
for(Int_t i=0;i<ents;++i) { |
109 |
> |
UInt_t ents=fCol->GetEntries(); |
110 |
> |
for(UInt_t i=0;i<ents;++i) { |
111 |
|
const T *p = fCol->At(i); |
112 |
|
Double_t pt = p->Pt(); |
113 |
|
if (pt<fPtMin) |
130 |
|
{ |
131 |
|
// Request a branch and create the histograms. |
132 |
|
|
133 |
< |
if (fLoadBr) |
133 |
> |
if (GetLoadBranch()) |
134 |
|
ReqBranch(GetColName(), fCol); |
135 |
|
|
136 |
< |
fPtHist = new TH1D("hPtHist",";p_{t} [GeV];#",100,0.,250.); |
137 |
< |
AddOutput(fPtHist); |
138 |
< |
fEtaHist = new TH1D("hEtaHist",";#eta;#",160,-8.,8.); |
139 |
< |
AddOutput(fEtaHist); |
136 |
> |
if (GetFillHist()) { |
137 |
> |
AddTH1(fPtHist,"hPtHist",";p_{t} [GeV];#",100,0.,250.); |
138 |
> |
AddTH1(fEtaHist,"hEtaHist",";#eta;#",160,-8.,8.); |
139 |
> |
} |
140 |
|
} |
141 |
|
#endif |