ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/PhysicsMod/interface/PlotKineMod.h
(Generate patch)

Comparing UserCode/MitAna/PhysicsMod/interface/PlotKineMod.h (file contents):
Revision 1.8 by loizides, Tue May 12 18:41:40 2009 UTC vs.
Revision 1.12 by loizides, Wed Jun 17 11:50:27 2009 UTC

# Line 11 | Line 11
11   #ifndef MITANA_PHYSICSMOD_PLOTKINEMOD_H
12   #define MITANA_PHYSICSMOD_PLOTKINEMOD_H
13  
14 + #include "MitAna/DataCont/interface/Collection.h"
15   #include "MitAna/TreeMod/interface/BaseMod.h"
15 #include "MitAna/DataTree/interface/Collections.h"
16   #include <TH1D.h>
17  
18   namespace mithep
# Line 30 | Line 30 | namespace mithep
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;      }
33        void                     SetColName(const char *n)       { fColName=n;          }
34 +      void                     SetEntriesMax(Int_t e)          { fEntriesMax = e;     }
35        void                     SetEtaMin(Double_t e)           { fEtaMin = e;         }
36        void                     SetEtaMax(Double_t e)           { fEtaMax = e;         }
37        void                     SetInputName(const char *n)     { SetColName(n);       }
38      void                     SetLoadBranch(Bool_t b)         { fLoadBr = b;         }
38        void                     SetPtMin(Double_t pt)           { fPtMin = pt;         }
39        void                     SetPtMax(Double_t pt)           { fPtMax = pt;         }
40  
# Line 49 | Line 48 | namespace mithep
48        Double_t                 fPtMax;      //maximum pt
49        Double_t                 fEtaMin;     //minimum eta
50        Double_t                 fEtaMax;     //maximum eta
51 <      Bool_t                   fLoadBr;     //=true then load branch (def=1)
51 >      Int_t                    fEntriesMax;  //maximum number of entries
52        const Collection<T>     *fCol;        //!pointer to collection
53        TH1D                    *fPtHist;     //!pt histogram
54        TH1D                    *fEtaHist;    //!eta histogram
55 +      TH1D                    *fEntHist;    //!entries histogram
56  
57 <      ClassDefT(PlotKineMod, 1) // Plot kinematics module
57 >      ClassDef(PlotKineMod, 1) // Plot kinematics module
58    };
59   }
60  
# Line 67 | Line 67 | mithep::PlotKineMod<T>::PlotKineMod(cons
67    fPtMax(5000),
68    fEtaMin(-10),
69    fEtaMax(10),
70 <  fLoadBr(kTRUE),
70 >  fEntriesMax(250),
71    fCol(0),
72    fPtHist(0),
73 <  fEtaHist(0)
73 >  fEtaHist(0),
74 >  fEntHist(0)
75   {
76    // Constructor.
77  
78 <  SetFillHist(1);
78 < }
79 <
80 < //--------------------------------------------------------------------------------------------------
81 < template<class T>
82 < Bool_t mithep::PlotKineMod<T>::Load()
83 < {
84 <  // Load data from branch or get pointer from event.
85 <
86 <  if (GetLoadBranch())
87 <    LoadBranch(GetColName());
88 <  else
89 <    fCol = GetObjThisEvt<Collection<T> >(GetColName());
90 <
91 <  return (fCol!=0);
78 >  SetFillHist(kTRUE);
79   }
80  
81   //--------------------------------------------------------------------------------------------------
# Line 97 | Line 84 | void mithep::PlotKineMod<T>::Process()
84   {
85    // Process entries of the tree: Just load the branch and fill the histograms.
86  
87 <  if (!Load()) {
87 >  if (!LoadEventObject(GetColName(), fCol)) {
88      SendError(kAbortModule, "Process", "Could not load data!");
89      return;
90    }
# Line 106 | Line 93 | void mithep::PlotKineMod<T>::Process()
93      return;
94      
95    UInt_t ents=fCol->GetEntries();
96 +  fEntHist->Fill(ents);
97    for(UInt_t i=0;i<ents;++i) {
98       const T *p = fCol->At(i);
99       Double_t pt = p->Pt();
# Line 129 | Line 117 | void mithep::PlotKineMod<T>::SlaveBegin(
117   {
118    // Request a branch and create the histograms.
119    
120 <  if (GetLoadBranch())
133 <    ReqBranch(GetColName(), fCol);
120 >  ReqEventObject(GetColName(), fCol);
121  
122    if (GetFillHist()) {
123      Int_t ptbins = (Int_t)((fPtMax-fPtMin)/2.5);
124      AddTH1(fPtHist,"hPtHist",";p_{t} [GeV];#",ptbins,fPtMin,fPtMax);
125      Int_t etabins = (Int_t)((fEtaMax-fEtaMin)/0.1);
126      AddTH1(fEtaHist,"hEtaHist",";#eta;#",etabins,fEtaMin,fEtaMax);
127 +    AddTH1(fEntHist,"hEntriesHist",";#entries;#",fEntriesMax,-0.5,fEntriesMax-0.5);
128    }
129   }
130   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines