00001
00002 #ifndef XAODMISSINGET_VERSIONS_MISSINGETCOMPOSITIONBASE_H
00003 #define XAODMISSINGET_VERSIONS_MISSINGETCOMPOSITIONBASE_H
00004
00005 #include "xAODMissingET/versions/MissingETBase.h"
00006
00007 #include "xAODBase/IParticle.h"
00008 #include "xAODBase/IParticleContainer.h"
00009
00010 #include "AthContainers/ConstDataVector.h"
00011 #include "AthLinks/ElementLink.h"
00012
00013 #include "xAODMissingET/MissingETContainer.h"
00014
00015 #include "xAODJet/JetContainer.h"
00016
00017 #include <vector>
00018 #include <iterator>
00019
00021 namespace MissingETBase
00022 {
00023 namespace Types
00024 {
00031 typedef ElementLink<xAOD::MissingETContainer> metlink_t;
00036 typedef ElementLink<xAOD::JetContainer> jetlink_t;
00041 typedef ElementLink<xAOD::IParticleContainer> objlink_t;
00044 typedef ConstDataVector<xAOD::IParticleContainer> const_signal_vector_t;
00045
00052 typedef std::vector<objlink_t> objlink_vector_t;
00053 typedef std::vector<const xAOD::IParticle*> object_vector_t;
00055 }
00056
00064 struct Status
00065 {
00067 enum Reco {
00068 Total = 0x01000000,
00069 ContributedTerm = 0x02000000,
00070 CorrectedTerm = 0x04000000,
00071 AlternativeTerm = 0x08000000,
00072 StandAlone = 0x00000000 };
00074 enum Vertex {
00075 Primary = 0x00100000,
00076 Secondary = 0x00200000,
00077 Event = 0x00010000,
00078 Nominal = 0x00020000,
00079 Specific = 0x00040000,
00080 NoVertex = 0x00000000 };
00086 enum Correction {
00087 Corrected = 0x00001000,
00088 Pileup = 0x00001100,
00089 PileupCalo = 0x00001110,
00090 PileupTrack = 0x00001120,
00091 PileupSTVF = 0x00001121,
00092 PileupJetVertex = 0x00001122,
00093 PileupJetArea = 0x00001140,
00094 NotCorrected = 0x00000000 };
00095
00098 static const Types::bitmask_t clearedStatusTag = StandAlone | NoVertex | NotCorrected;
00099 static const Types::bitmask_t generalSummedTag = Total | NoVertex | NotCorrected;
00100 static const Types::bitmask_t generalContribTag = StandAlone | NoVertex | NotCorrected;
00101 static const Types::bitmask_t generalHardTermTag = ContributedTerm | Specific | Pileup;
00102 static const Types::bitmask_t generalSoftTermTag = ContributedTerm | NoVertex | NotCorrected;
00103 static Types::bitmask_t clearedStatus() { return clearedStatusTag; }
00104 static Types::bitmask_t summedTerm() { return generalSummedTag; }
00105 static Types::bitmask_t contributedTerm() { return generalContribTag; }
00106 static Types::bitmask_t contributedHardTerm() { return generalHardTermTag; }
00107 static Types::bitmask_t contributedSoftTerm() { return generalSoftTermTag; }
00110 struct Tags
00111 {
00112 static Types::bitmask_t setPattern(Types::bitmask_t rec,Types::bitmask_t vtx,Types::bitmask_t cor) { return ( rec | vtx ) | cor; }
00113
00114 static Types::bitmask_t total(Vertex vtx=Nominal,Correction cor=NotCorrected) { return setPattern(Total,vtx,cor); }
00115 static Types::bitmask_t contributedTerm(Vertex vtx=Nominal,Correction cor=NotCorrected) { return setPattern(ContributedTerm,vtx,cor); }
00116 static Types::bitmask_t correctedTerm(Vertex vtx=Nominal,Correction cor=Corrected) { return setPattern(CorrectedTerm,vtx,cor); }
00117 static Types::bitmask_t alternativeTerm(Vertex vtx=Nominal,Correction cor=NotCorrected) { return setPattern(AlternativeTerm,vtx,cor); }
00118
00119 static bool hasPattern(Types::bitmask_t sw,Types::bitmask_t pat) { return ( sw & pat ) == pat; }
00120
00121 static bool isTotal(Types::bitmask_t sw) { return hasPattern(sw,Total); }
00122 static bool isContributedTerm(Types::bitmask_t sw) { return hasPattern(sw,ContributedTerm); }
00123 static bool isAlternativeTerm(Types::bitmask_t sw) { return hasPattern(sw,AlternativeTerm); }
00124 static bool isStandAlone(Types::bitmask_t sw) { return hasPattern(sw,StandAlone); }
00125 };
00126 };
00127
00128 namespace Container
00129 {
00145 template<class ITER>
00146 size_t iteratorDiff(ITER first,ITER last) { return (size_t)(std::distance(first,last)); }
00160 template<class ITER>
00161 ITER iteratorAdvance(ITER iter,size_t step) { ITER fIter(iter); std::advance(iter,step); return fIter; }
00163 }
00164
00166 namespace UsageHandler
00167 {
00169 enum Policy {
00170 AllCalo = 0x0010,
00171 OnlyCluster = 0x0011,
00172 OnlyTrack = 0x0012,
00173 TrackCluster = 0x0014,
00174 PhysicsObject = 0x0020,
00175 ParticleFlow = 0x0040,
00176 TruthParticle = 0x0100,
00177 UnknownPolicy = 0x0000 };
00178 }
00179 }
00180 #endif
00181