HighLAND
EventVariationBase.cxx
1 #include "EventVariationBase.hxx"
2 #include "MultiThread.hxx"
3 
4 //********************************************************************
6 //********************************************************************
7 
8  Int_t uniqueID = 0;
9 
10 #ifdef MULTITHREAD
11  uniqueID = event.UniqueID;
12 #endif
13 
14  // Delete the SystBox when it exists and create a new one.
15  // TODO: It is probably faster to just reset the arrays
16 
17  // Create the box
18  if(!_systBoxes[0][0][uniqueID])
19  _systBoxes[0][0][uniqueID] = new SystBoxB();
20 
21  // Fill the SystBox with the relevant tracks and true tracks tor this systematic
22  FillSystBox(event, sel, *_systBoxes[0][0][uniqueID]);
23 }
24 
25 //********************************************************************
27 //********************************************************************
28 
29  Int_t uniqueID = 0;
30 
31 #ifdef MULTITHREAD
32  uniqueID = event.UniqueID;
33 #else
34  (void)event;
35 #endif
36 
37  SystBoxB& box = *(_systBoxes[0][0][uniqueID]);
38 
39  if (box.RelevantRecObjects) delete [] box.RelevantRecObjects;
40  anaUtils::CreateArray(box.RelevantRecObjects, box.RelevantRecObjectsSet.size());
41  box.nRelevantRecObjects=0;
42  for (std::set<AnaRecObjectC*>::iterator it = box.RelevantRecObjectsSet.begin();it!=box.RelevantRecObjectsSet.end();it++){
43  box.RelevantRecObjects[box.nRelevantRecObjects++] = *it;
44  }
45 
46 }
47 
48 //********************************************************************
49 void EventVariationBase::FillSystBox(const AnaEventC& event, const SelectionBase& sel, SystBoxB& box){
50 //********************************************************************
51 
52  Int_t* groups;
53  anaUtils::CreateArray(groups,10);
54  Int_t nGroups = GetRelevantRecObjectGroups(sel, groups);
55  anaUtils::ResizeArray(groups,nGroups);
56 
57  // Get the EventBox for the input selection
58  EventBoxB* EventBox = event.EventBoxes[sel.GetEventBoxId()];
59 
60  if (nGroups>0){
61  Int_t nMaxRecObjects=0;
62  for (Int_t g = 0; g<nGroups;g++)
63  nMaxRecObjects += EventBox->nRecObjectsInGroup[groups[g]];
64 
65  for (Int_t g = 0; g<nGroups;g++){
66  for (Int_t i=0;i<EventBox->nRecObjectsInGroup[groups[g]];i++){
67  AnaRecObjectC* recObject = EventBox->RecObjectsInGroup[groups[g]][i];
68  if (IsRelevantRecObject(event, *recObject))
69  if (sel.IsRelevantRecObjectForSystematic(event,recObject,_index))
70  box.RelevantRecObjectsSet.insert(recObject);
71  }
72  }
73  }
74 
75  if (groups) delete [] groups;
76 }
77 
Int_t _index
The index of this systematic (needed by SystematicsManager);.
void FillSystBox(const AnaEventC &event, const SelectionBase &sel, SystBoxB &box)
Fills the SystBox.
EventBoxId_h GetEventBoxId() const
Returns the Id of the EventBox to be used in this selection.
virtual void InitializeEvent(const AnaEventC &event, const SelectionBase &sel)
Initialize the SystBox for this event.
Int_t nRecObjectsInGroup[NMAXRECOBJECTGROUPS]
----—— RecObjects and TrueRecObjects used in the selection and systematics ------------—— ...
std::set< AnaRecObjectC * > RelevantRecObjectsSet
Definition: SystBoxB.hxx:33
virtual bool IsRelevantRecObjectForSystematic(const AnaEventC &, AnaRecObjectC *, SystId_h syst_index, Int_t branch=0) const
Is this track relevant for a given systematic (prior to selection, call when initializing the event...
Int_t nRelevantRecObjects
----—— Relevant rec objects and true objects for each systematic ------------—— ...
Definition: SystBoxB.hxx:20
SystBoxB **** _systBoxes
----—— Relevant objects for this systematic ------------——
virtual bool IsRelevantRecObject(const AnaEventC &, const AnaRecObjectC &) const
Check whether a AnaRecObject is relevant for this systematic or not.