13 |
|
class TestMod : public BaseMod |
14 |
|
{ |
15 |
|
public: |
16 |
< |
TestMod() : fSumPt(0), fCount(0) {} |
16 |
> |
TestMod(const char *n="GsfTracks") : fCol(0), fName(n), fSumPt(0), fCount(0) {} |
17 |
|
protected: |
18 |
|
void Process() { |
19 |
< |
LoadBranch("GsfTracks"); |
20 |
< |
for(UInt_t i=0;i<fCol->Entries();++i) { |
19 |
> |
LoadBranch(fName); |
20 |
> |
for(UInt_t i=0;i<fCol->GetEntries();++i) { |
21 |
|
fSumPt+=fCol->At(i)->Pt(); |
22 |
|
++fCount; |
23 |
|
} |
24 |
|
} |
25 |
|
void SlaveBegin() { |
26 |
< |
ReqBranch("GsfTracks",fCol); |
26 |
> |
ReqBranch(fName,fCol); |
27 |
|
} |
28 |
|
void SlaveTerminate() { |
29 |
< |
printf("Avg pt found: %f", fSumPt/fCount); |
29 |
> |
printf("TestMod: %s -> Avg pt found: %f (%f/%d)\n", fName.Data(), fSumPt/fCount, fSumPt, fCount); |
30 |
|
} |
31 |
|
|
32 |
|
const TrackCol *fCol; |
33 |
+ |
TString fName; |
34 |
|
Double_t fSumPt; |
35 |
|
Int_t fCount; |
36 |
|
|
39 |
|
} |
40 |
|
|
41 |
|
//-------------------------------------------------------------------------------------------------- |
42 |
< |
void runGsfTrackTest(const char *files = "mit-gen_000.root") |
42 |
> |
void runGsfTrackTest(const char *files, UInt_t nev=0) |
43 |
|
{ |
44 |
|
using namespace mithep; |
45 |
|
gDebugMask = Debug::kAnalysis; |
46 |
|
gDebugLevel = 1; |
47 |
|
|
48 |
< |
TestMod *tmod = new TestMod; |
48 |
> |
TestMod *tmod1 = new TestMod("GsfTracks"); |
49 |
> |
TestMod *tmod2 = new TestMod("Tracks"); |
50 |
|
|
51 |
|
// set up analysis |
52 |
|
Analysis *ana = new Analysis; |
53 |
< |
ana->SetSuperModule(tmod); |
53 |
> |
ana->AddSuperModule(tmod1); |
54 |
> |
ana->AddSuperModule(tmod2); |
55 |
|
ana->AddFile(files); |
56 |
|
ana->SetUseHLT(0); |
57 |
+ |
if (nev) |
58 |
+ |
ana->SetProcessNEvents(nev); |
59 |
+ |
|
60 |
|
if (gROOT->IsBatch()) |
61 |
|
ana->SetOutputName("mit-example-hist.root"); |
62 |
|
|