HighLAND
ECalEMEnergySystematicsBase.cxx
1 #include "ECalEMEnergySystematicsBase.hxx"
2 #include "EventBoxTracker.hxx"
3 
4 //********************************************************************
5 ECalEMEnergySystematicsBase::ECalEMEnergySystematicsBase(UInt_t npar, const std::string& name, BinnedParams::TypeEnum type):EventVariationBase(npar),BinnedParams(name, type){
6  //********************************************************************
7 
9 }
10 
11 //********************************************************************
13  //********************************************************************
14 
15  // Get the SystBox for this event
16  SystBoxB* box = GetSystBox(event);
17 
18  // Get the relevant tracks for this systematic
19  AnaRecObjectC** tracks = box->RelevantRecObjects;
20 
21  for (Int_t itrk=0; itrk<box->nRelevantRecObjects; itrk++){
22  // For each track get ecal segment
23  for (Int_t iecal=0; iecal<static_cast<AnaTrackB*>(tracks[itrk])->nECALSegments; iecal++){
24 
25  AnaECALParticleB* ecal = static_cast<AnaECALParticleB*>(static_cast<AnaTrackB*>(tracks[itrk])->ECALSegments[iecal]);
26 
27  if(!ecal) continue;
28  if (!ecal->Original) continue;
29 
30  // Go back to the corrected EMEnergy
31  ecal->EMEnergy = static_cast<const AnaECALParticleB*>(ecal->Original)->EMEnergy;
32  }
33  }
34  // Don't reset the spill to corrected
35  return false;
36 }
37 
38 //********************************************************************
40 //********************************************************************
41  (void)(event);
42 
43  const AnaTrackB* track = static_cast<const AnaTrackB*>(&recObj);
44 
45  //track should use Tracker or DsECal
46  if (!SubDetId::GetDetectorUsed(track->Detector, SubDetId::kTECAL) &&
47  !SubDetId::GetDetectorUsed(track->Detector, SubDetId::kDSECAL))
48  return false;
49 
50  // track should have one ECal segment
51  if (track->nECALSegments!=1) return false;
52 
53  if (!track->ECALSegments[0]) return false;
54 
55  return true;
56 }
57 
58 
59 //********************************************************************
61  //********************************************************************
62 
63  //TODO: tracker tracks for the moment, will add ECal iso-samples as well, but this needs another EventBox
64  Int_t ngroups=0;
65  for (UInt_t b=0; b<sel.GetNBranches(); b++){
66  SubDetId_h det = sel.GetDetectorFV(b);
67  if (det == SubDetId::kFGD1 || det == SubDetId::kFGD){
68  IDs[ngroups++] = EventBoxTracker::kTracksWithTPCorFGD1;
69  }
70  if (det == SubDetId::kFGD2 || det == SubDetId::kFGD){
71  IDs[ngroups++] = EventBoxTracker::kTracksWithTPCorFGD2;
72  }
73  }
74 
75  return ngroups;
76 }
77 
78 
unsigned long Detector
AnaECALParticleB * ECALSegments[NMAXECALS]
The ECAL segments that contributed to this global track.
int nECALSegments
How many ECAL tracks are associated with this track.
virtual bool UndoSystematic(AnaEventC &event)
Undo the systematic variations done by ApplyVariation. This is faster tha reseting the full Spill...
Representation of an ECAL segment of a global track.
SystBoxB * GetSystBox(const AnaEventC &event, Int_t isel=0, Int_t ibranch=0) const
Get the SystBox corresponding to a selection, branch and event.
void SetNParameters(int N)
Set the number of systematic parameters associated to this systematic.
static bool GetDetectorUsed(unsigned long BitField, SubDetId::SubDetEnum det)
Method to see if a certain subdetector or subdetector system is used.
Definition: SubDetId.cxx:40
const AnaParticleB * Original
Int_t GetRelevantRecObjectGroups(const SelectionBase &sel, Int_t *IDs) const
Get the TrackGroup IDs array for this systematic.
Representation of a global track.
TypeEnum
Enumerator describing the values that _type member can take.
UInt_t GetNBranches() const
Return the number of branches.
Int_t nRelevantRecObjects
----—— Relevant rec objects and true objects for each systematic ------------—— ...
Definition: SystBoxB.hxx:20
Int_t GetNBins()
Get the number of bins.
SubDetId_h GetDetectorFV(Int_t ibranch=0) const
Get the detector in which the Fiducial Volume is defined.
virtual bool IsRelevantRecObject(const AnaEventC &, const AnaRecObjectC &) const
Check whether a RecObject is relevant for this systematic or not.