ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TreeMod/src/HLTMod.cc
(Generate patch)

Comparing UserCode/MitAna/TreeMod/src/HLTMod.cc (file contents):
Revision 1.4 by loizides, Tue Nov 25 14:29:41 2008 UTC vs.
Revision 1.12 by loizides, Mon Jul 13 10:39:20 2009 UTC

# Line 5 | Line 5
5   #include <TTree.h>
6   #include "MitAna/DataTree/interface/Names.h"
7   #include "MitAna/DataTree/interface/TriggerName.h"
8 + #include "MitAna/DataTree/interface/TriggerMask.h"
9   #include "MitAna/DataTree/interface/TriggerObject.h"
10 + #include "MitAna/DataTree/interface/TriggerObjectCol.h"
11 + #include "MitAna/DataTree/interface/TriggerObjectsTable.h"
12  
13   using namespace mithep;
14  
# Line 15 | Line 18 | ClassImp(mithep::HLTMod)
18   HLTMod::HLTMod(const char *name, const char *title) :
19    BaseMod(name,title),
20    fAbort(kTRUE),
21 +  fPrintTable(kFALSE),
22    fBitsName(Names::gkHltBitBrn),
23 <  fMyObjsNamePub(Form("%sObjsadafafa", name)),
23 >  fMyObjsNamePub(Form("%sTrigObjs", name)),
24    fBits(0),
25    fMyTrgObjs(0),
26    fTriggers(0),
# Line 43 | Line 47 | void HLTMod::AddTrigger(const char *expr
47    // "A", "!A", "A&B", "A&!B" or "A&B&C"  
48  
49    string tname(expr);
50 <  fTrigNames.AddCopy(tname);
50 >  fTrigNames.push_back(tname);
51   }
52  
53   //--------------------------------------------------------------------------------------------------
# Line 51 | Line 55 | void HLTMod::AddTrigObjs(UInt_t tid)
55   {
56    // Add trigger objects corresponding to trigger id.
57  
58 <  const BitMask256 &ba = fTrigBitsAnd.Ref(tid);
59 <  const BitMask256 &bm = fTrigBitsCmp.Ref(tid);
58 >  const BitMask256 &ba = fTrigBitsAnd.at(tid);
59 >  const BitMask256 &bm = fTrigBitsCmp.at(tid);
60    for (UInt_t i=0; i<bm.Size(); ++i) {
61      if (ba.TestBit(i)==0)
62        continue; // not an active trigger bit
# Line 72 | Line 76 | void HLTMod::BeginRun()
76   {
77    // Get HLT tree and set branches. Compute bitmasks to be used when comparing to the HLT bits.
78  
79 <  fTrigBitsAnd.Reset();
80 <  fTrigBitsCmp.Reset();
79 >  fTrigBitsAnd.clear();
80 >  fTrigBitsCmp.clear();
81  
82    if (fPrintTable)
83      fTriggers->Print();
84  
85 <  for (UInt_t i=0; i<fTrigNames.Entries(); ++i) {
85 >  for (UInt_t i=0; i<fTrigNames.size(); ++i) {
86      BitMask256 tmask; //trigger mask
87      BitMask256 amask; //bitand mask
88 <    TString names(fTrigNames.At(i)->c_str());
88 >    TString names(fTrigNames.at(i).c_str());
89 >
90      TObjArray *arr = names.Tokenize("&");
91      if (arr) {
92        for(Int_t j=0; j<arr->GetEntries(); j++){
# Line 96 | Line 101 | void HLTMod::BeginRun()
101          }
102          const TriggerName *tn = fTriggers->Get(sptr);
103          if (!tn) {
104 <          Warning("BeginRun", "Trigger %s not found.", tn->Name());
104 >          Warning("BeginRun", "Trigger %s not found.", sptr);
105            continue;
106          }
107          UShort_t bit = tn->Id();
# Line 106 | Line 111 | void HLTMod::BeginRun()
111        }
112        delete arr;
113      }
114 <    fTrigBitsAnd.AddCopy(amask);
115 <    fTrigBitsCmp.AddCopy(tmask);
114 >    fTrigBitsAnd.push_back(amask);
115 >    fTrigBitsCmp.push_back(tmask);
116    }
117   }
118  
# Line 126 | Line 131 | void HLTMod::Process()
131    fMyTrgObjs->SetOwner(kFALSE); // the objects are owned by the object table
132    fBitsDone.Clear();
133    Bool_t accept = kFALSE;
134 <  for (UInt_t i = 0; i<fTrigBitsAnd.Entries(); ++i) {
135 <    BitMask256 bitmask(*fBits);
136 <    bitmask &= fTrigBitsAnd.Ref(i);
137 <    if (bitmask==fTrigBitsCmp.Ref(i)) {
134 >  for (UInt_t i = 0; i<fTrigBitsAnd.size(); ++i) {
135 >    BitMask256 bitmask(fBits->Get());
136 >    bitmask &= fTrigBitsAnd.at(i);
137 >    if (bitmask==fTrigBitsCmp.at(i)) {
138        accept = kTRUE;
139        AddTrigObjs(i);
140      }
# Line 148 | Line 153 | void HLTMod::Process()
153  
154    // take action if accepted
155    ++fNAcceped;
156 +  IncNEventsProcessed();
157    OnAccepted();
158    if (!AddObjThisEvt(fMyTrgObjs)) {
159      SendError(kAbortAnalysis, "Process",
# Line 176 | Line 182 | void HLTMod::SlaveBegin()
182      return;
183    }
184   }
185 +
186 + //--------------------------------------------------------------------------------------------------
187 + void HLTMod::SlaveTerminate()
188 + {
189 +  // Save number of accepted events.
190 +
191 +  SaveNEventsProcessed("hDHLTEvents");
192 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines