23 |
|
public: |
24 |
|
PlotKineMod(const char *name="PlotKineMod", |
25 |
|
const char *title="Plot kinematics module"); |
26 |
– |
~PlotKineMod() {} |
26 |
|
|
27 |
< |
const char *GetColName() const { return fColName; } |
28 |
< |
Double_t GetEtaMin() const { return fEtaMin; } |
29 |
< |
Double_t GetEtaMax() const { return fEtaMax; } |
30 |
< |
Double_t GetPtMin() const { return fPtMin; } |
31 |
< |
Double_t GetPtMax() const { return fPtMax; } |
32 |
< |
Bool_t GetLoadBranch() const { return fLoadBr; } |
33 |
< |
void SetColName(const char *n) { fColName=n; } |
34 |
< |
void SetEtaMin(Double_t e) { fEtaMin = e; } |
35 |
< |
void SetEtaMax(Double_t e) { fEtaMax = e; } |
36 |
< |
void SetLoadBranch(Bool_t b) { fLoadBr = b; } |
37 |
< |
void SetPtMin(Double_t pt) { fPtMin = pt; } |
38 |
< |
void SetPtMax(Double_t pt) { fPtMax = pt; } |
27 |
> |
const char *GetColName() const { return fColName; } |
28 |
> |
Double_t GetEtaMin() const { return fEtaMin; } |
29 |
> |
Double_t GetEtaMax() const { return fEtaMax; } |
30 |
> |
const char *GetInputName() const { return GetColName(); } |
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 SetEntriesMax(Int_t e) { fEntriesMax = e; } |
36 |
> |
void SetEtaMin(Double_t e) { fEtaMin = e; } |
37 |
> |
void SetEtaMax(Double_t e) { fEtaMax = e; } |
38 |
> |
void SetInputName(const char *n) { SetColName(n); } |
39 |
> |
void SetLoadBranch(Bool_t b) { fLoadBr = b; } |
40 |
> |
void SetPtMin(Double_t pt) { fPtMin = pt; } |
41 |
> |
void SetPtMax(Double_t pt) { fPtMax = pt; } |
42 |
|
|
43 |
|
protected: |
44 |
|
Bool_t Load(); |
46 |
|
void SlaveBegin(); |
47 |
|
|
48 |
|
TString fColName; //name of collection |
49 |
+ |
Bool_t fLoadBr; //=true then load branch (def=1) |
50 |
|
Double_t fPtMin; //minimum pt |
51 |
|
Double_t fPtMax; //maximum pt |
52 |
|
Double_t fEtaMin; //minimum eta |
53 |
|
Double_t fEtaMax; //maximum eta |
54 |
< |
Bool_t fLoadBr; //=true then load branch (def=1) |
54 |
> |
Int_t fEntriesMax; //maximum number of entries |
55 |
|
const Collection<T> *fCol; //!pointer to collection |
56 |
|
TH1D *fPtHist; //!pt histogram |
57 |
|
TH1D *fEtaHist; //!eta histogram |
58 |
< |
TH1D *fMassHist; //!mass histogram |
56 |
< |
TH1D *fMtHist; //!mt histogram |
58 |
> |
TH1D *fEntHist; //!entries histogram |
59 |
|
|
60 |
< |
ClassDefT(PlotKineMod,1) // Plot kinematics module |
60 |
> |
ClassDefT(PlotKineMod, 1) // Plot kinematics module |
61 |
|
}; |
62 |
|
} |
63 |
|
|
66 |
|
mithep::PlotKineMod<T>::PlotKineMod(const char *name, const char *title) : |
67 |
|
BaseMod(name,title), |
68 |
|
fColName("SetMe"), |
69 |
+ |
fLoadBr(kTRUE), |
70 |
|
fPtMin(1), |
71 |
|
fPtMax(5000), |
72 |
|
fEtaMin(-10), |
73 |
|
fEtaMax(10), |
74 |
< |
fLoadBr(kTRUE), |
74 |
> |
fEntriesMax(250), |
75 |
|
fCol(0), |
76 |
|
fPtHist(0), |
77 |
< |
fEtaHist(0) |
77 |
> |
fEtaHist(0), |
78 |
> |
fEntHist(0) |
79 |
|
{ |
80 |
|
// Constructor. |
81 |
|
|
82 |
< |
this->SetFillHist(1); |
82 |
> |
SetFillHist(kTRUE); |
83 |
|
} |
84 |
|
|
85 |
|
//-------------------------------------------------------------------------------------------------- |
103 |
|
// Process entries of the tree: Just load the branch and fill the histograms. |
104 |
|
|
105 |
|
if (!Load()) { |
106 |
< |
this->SendError(kAbortModule, "Process", "Could not load data!"); |
106 |
> |
SendError(kAbortModule, "Process", "Could not load data!"); |
107 |
|
return; |
108 |
|
} |
109 |
|
|
111 |
|
return; |
112 |
|
|
113 |
|
UInt_t ents=fCol->GetEntries(); |
114 |
+ |
fEntHist->Fill(ents); |
115 |
|
for(UInt_t i=0;i<ents;++i) { |
116 |
|
const T *p = fCol->At(i); |
117 |
|
Double_t pt = p->Pt(); |
134 |
|
void mithep::PlotKineMod<T>::SlaveBegin() |
135 |
|
{ |
136 |
|
// Request a branch and create the histograms. |
137 |
< |
|
137 |
> |
|
138 |
|
if (GetLoadBranch()) |
139 |
|
ReqBranch(GetColName(), fCol); |
140 |
|
|
141 |
|
if (GetFillHist()) { |
142 |
< |
AddTH1(fPtHist,"hPtHist",";p_{t} [GeV];#",100,0.,250.); |
143 |
< |
AddTH1(fEtaHist,"hEtaHist",";#eta;#",160,-8.,8.); |
142 |
> |
Int_t ptbins = (Int_t)((fPtMax-fPtMin)/2.5); |
143 |
> |
AddTH1(fPtHist,"hPtHist",";p_{t} [GeV];#",ptbins,fPtMin,fPtMax); |
144 |
> |
Int_t etabins = (Int_t)((fEtaMax-fEtaMin)/0.1); |
145 |
> |
AddTH1(fEtaHist,"hEtaHist",";#eta;#",etabins,fEtaMin,fEtaMax); |
146 |
> |
AddTH1(fEntHist,"hEntriesHist",";#entries;#",fEntriesMax,-0.5,fEntriesMax-0.5); |
147 |
|
} |
148 |
|
} |
149 |
|
#endif |