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.2 by loizides, Thu Oct 23 17:02:16 2008 UTC vs.
Revision 1.10 by ceballos, Sun May 24 19:10:43 2009 UTC

# Line 15 | Line 15 | ClassImp(mithep::HLTMod)
15   HLTMod::HLTMod(const char *name, const char *title) :
16    BaseMod(name,title),
17    fAbort(kTRUE),
18 +  fPrintTable(kFALSE),
19    fBitsName(Names::gkHltBitBrn),
20 <  fMyObjsNamePub(Form("%sObjsadafafa", name)),
20 >  fMyObjsNamePub(Form("%sTrigObjs", name)),
21    fBits(0),
22    fMyTrgObjs(0),
23    fTriggers(0),
# Line 43 | Line 44 | void HLTMod::AddTrigger(const char *expr
44    // "A", "!A", "A&B", "A&!B" or "A&B&C"  
45  
46    string tname(expr);
47 <  fTrigNames.AddCopy(tname);
47 >  fTrigNames.push_back(tname);
48   }
49  
50   //--------------------------------------------------------------------------------------------------
# Line 51 | Line 52 | void HLTMod::AddTrigObjs(UInt_t tid)
52   {
53    // Add trigger objects corresponding to trigger id.
54  
55 <  const BitMask256 &ba = fTrigBitsAnd.Ref(tid);
56 <  const BitMask256 &bm = fTrigBitsCmp.Ref(tid);
55 >  const BitMask256 &ba = fTrigBitsAnd.at(tid);
56 >  const BitMask256 &bm = fTrigBitsCmp.at(tid);
57    for (UInt_t i=0; i<bm.Size(); ++i) {
58      if (ba.TestBit(i)==0)
59        continue; // not an active trigger bit
# Line 62 | Line 63 | void HLTMod::AddTrigObjs(UInt_t tid)
63        continue; // excluded trigger bit (ie a !trgname)
64  
65      const TList *list = fTrigObjs->GetList(i);
66 <    if (list) {
66 <      TIterator *iter = list->MakeIterator();
67 <      if (iter) {
68 <        TriggerObject *to = dynamic_cast<TriggerObject *>(iter->Next());
69 <        while (to) {
70 <          fMyTrgObjs->Add(to);
71 <          to = dynamic_cast<TriggerObject *>(iter->Next());
72 <        }
73 <      }
74 <    }
66 >    fMyTrgObjs->Add(list);    
67      fBitsDone.SetBit(i);
68    }
69   }
# Line 81 | Line 73 | void HLTMod::BeginRun()
73   {
74    // Get HLT tree and set branches. Compute bitmasks to be used when comparing to the HLT bits.
75  
76 <  fTrigBitsAnd.Reset();
77 <  fTrigBitsCmp.Reset();
76 >  fTrigBitsAnd.clear();
77 >  fTrigBitsCmp.clear();
78  
79    if (fPrintTable)
80      fTriggers->Print();
81  
82 <  for (UInt_t i=0; i<fTrigNames.Entries(); ++i) {
82 >  for (UInt_t i=0; i<fTrigNames.size(); ++i) {
83      BitMask256 tmask; //trigger mask
84      BitMask256 amask; //bitand mask
85 <    TString names(fTrigNames.At(i)->c_str());
85 >    TString names(fTrigNames.at(i).c_str());
86 >
87      TObjArray *arr = names.Tokenize("&");
88      if (arr) {
89        for(Int_t j=0; j<arr->GetEntries(); j++){
# Line 105 | Line 98 | void HLTMod::BeginRun()
98          }
99          const TriggerName *tn = fTriggers->Get(sptr);
100          if (!tn) {
101 <          Warning("BeginRun", "Trigger %s not found.", tn->Name());
101 >          Warning("BeginRun", "Trigger %s not found.", sptr);
102            continue;
103          }
104          UShort_t bit = tn->Id();
# Line 115 | Line 108 | void HLTMod::BeginRun()
108        }
109        delete arr;
110      }
111 <    fTrigBitsAnd.AddCopy(amask);
112 <    fTrigBitsCmp.AddCopy(tmask);
111 >    fTrigBitsAnd.push_back(amask);
112 >    fTrigBitsCmp.push_back(tmask);
113    }
114   }
115  
# Line 128 | Line 121 | void HLTMod::Process()
121    // in a derived class, call it. Do not stop processing this event, if fAbort is kFALSE.
122  
123    ++fNEvents;
124 <  LoadBranch(fBitsName.Data());
124 >  LoadBranch(fBitsName);
125  
126    // match trigger bits to trigger mask and obtain trigger objects
127    fMyTrgObjs = new TriggerObjectOArr(0,fMyObjsNamePub);
128    fMyTrgObjs->SetOwner(kFALSE); // the objects are owned by the object table
129    fBitsDone.Clear();
130    Bool_t accept = kFALSE;
131 <  for (UInt_t i = 0; i<fTrigBitsAnd.Entries(); ++i) {
132 <    BitMask256 bitmask(*fBits);
133 <    bitmask &= fTrigBitsAnd.Ref(i);
134 <    if (bitmask==fTrigBitsCmp.Ref(i)) {
131 >  for (UInt_t i = 0; i<fTrigBitsAnd.size(); ++i) {
132 >    BitMask256 bitmask(fBits->Get());
133 >    bitmask &= fTrigBitsAnd.at(i);
134 >    if (bitmask==fTrigBitsCmp.at(i)) {
135        accept = kTRUE;
136        AddTrigObjs(i);
137      }
# Line 157 | Line 150 | void HLTMod::Process()
150  
151    // take action if accepted
152    ++fNAcceped;
153 +  IncNEventsProcessed();
154    OnAccepted();
155    if (!AddObjThisEvt(fMyTrgObjs)) {
156      SendError(kAbortAnalysis, "Process",
# Line 172 | Line 166 | void HLTMod::SlaveBegin()
166   {
167    // Request trigger bit branch and obtain trigger table and objects.
168  
169 <  ReqBranch(fBitsName.Data(), fBits);
169 >  ReqBranch(fBitsName, fBits);
170    
171    fTriggers = GetHLTTable();
172    if (!fTriggers) {
# Line 185 | Line 179 | void HLTMod::SlaveBegin()
179      return;
180    }
181   }
182 +
183 + //--------------------------------------------------------------------------------------------------
184 + void HLTMod::SlaveTerminate()
185 + {
186 +  // Save number of accepted events.
187 +
188 +  SaveNEventsProcessed("hDHLTEvents");
189 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines