CMS 3D CMS Logo

Photon.cc
Go to the documentation of this file.
1 //
2 //
3 
6 
7 using pat::Photon;
8 
11  : PATObject<reco::Photon>(reco::Photon()),
12  embeddedSuperCluster_(false),
13  embeddedSeedCluster_(false),
14  embeddedRecHits_(false),
15  passElectronVeto_(false),
16  hasPixelSeed_(false),
17  seedEnergy_(0.0),
18  eMax_(0.0),
19  e2nd_(0.0),
20  e3x3_(0.0),
21  eTop_(0.0),
22  eBottom_(0.0),
23  eLeft_(0.0),
24  eRight_(0.0),
25  see_(-999.),
26  spp_(-999.),
27  sep_(-999.),
28  maxDR_(-999.),
29  maxDRDPhi_(-999.),
30  maxDRDEta_(-999.),
31  maxDRRawEnergy_(-999.),
32  subClusRawE1_(-999.),
33  subClusRawE2_(-999.),
34  subClusRawE3_(-999.),
35  subClusDPhi1_(-999.),
36  subClusDPhi2_(-999.),
37  subClusDPhi3_(-999.),
38  subClusDEta1_(-999.),
39  subClusDEta2_(-999.),
40  subClusDEta3_(-999.),
41  cryEta_(-999.),
42  cryPhi_(-999),
43  iEta_(-999),
44  iPhi_(-999) {}
45 
47 Photon::Photon(const reco::Photon& aPhoton)
48  : PATObject<reco::Photon>(aPhoton),
49  embeddedSuperCluster_(false),
50  embeddedSeedCluster_(false),
51  embeddedRecHits_(false),
52  passElectronVeto_(false),
53  hasPixelSeed_(false),
54  seedEnergy_(0.0),
55  eMax_(0.0),
56  e2nd_(0.0),
57  e3x3_(0.0),
58  eTop_(0.0),
59  eBottom_(0.0),
60  eLeft_(0.0),
61  eRight_(0.0),
62  see_(-999.),
63  spp_(-999.),
64  sep_(-999.),
65  maxDR_(-999.),
66  maxDRDPhi_(-999.),
67  maxDRDEta_(-999.),
68  maxDRRawEnergy_(-999.),
69  subClusRawE1_(-999.),
70  subClusRawE2_(-999.),
71  subClusRawE3_(-999.),
72  subClusDPhi1_(-999.),
73  subClusDPhi2_(-999.),
74  subClusDPhi3_(-999.),
75  subClusDEta1_(-999.),
76  subClusDEta2_(-999.),
77  subClusDEta3_(-999.),
78  cryEta_(-999.),
79  cryPhi_(-999),
80  iEta_(-999),
81  iPhi_(-999) {}
82 
85  : PATObject<reco::Photon>(aPhotonRef),
86  embeddedSuperCluster_(false),
87  embeddedSeedCluster_(false),
88  embeddedRecHits_(false),
89  passElectronVeto_(false),
90  hasPixelSeed_(false),
91  seedEnergy_(0.0),
92  eMax_(0.0),
93  e2nd_(0.0),
94  e3x3_(0.0),
95  eTop_(0.0),
96  eBottom_(0.0),
97  eLeft_(0.0),
98  eRight_(0.0),
99  see_(-999.),
100  spp_(-999.),
101  sep_(-999.),
102  maxDR_(-999.),
103  maxDRDPhi_(-999.),
104  maxDRDEta_(-999.),
105  maxDRRawEnergy_(-999.),
106  subClusRawE1_(-999.),
107  subClusRawE2_(-999.),
108  subClusRawE3_(-999.),
109  subClusDPhi1_(-999.),
110  subClusDPhi2_(-999.),
111  subClusDPhi3_(-999.),
112  subClusDEta1_(-999.),
113  subClusDEta2_(-999.),
114  subClusDEta3_(-999.),
115  cryEta_(-999.),
116  cryPhi_(-999),
117  iEta_(-999),
118  iPhi_(-999) {}
119 
121 Photon::Photon(const edm::Ptr<reco::Photon>& aPhotonRef)
122  : PATObject<reco::Photon>(aPhotonRef),
123  embeddedSuperCluster_(false),
124  embeddedSeedCluster_(false),
125  embeddedRecHits_(false),
126  passElectronVeto_(false),
127  hasPixelSeed_(false),
128  seedEnergy_(0.0),
129  eMax_(0.0),
130  e2nd_(0.0),
131  e3x3_(0.0),
132  eTop_(0.0),
133  eBottom_(0.0),
134  eLeft_(0.0),
135  eRight_(0.0),
136  see_(-999.),
137  spp_(-999.),
138  sep_(-999.),
139  maxDR_(-999.),
140  maxDRDPhi_(-999.),
141  maxDRDEta_(-999.),
142  maxDRRawEnergy_(-999.),
143  subClusRawE1_(-999.),
144  subClusRawE2_(-999.),
145  subClusRawE3_(-999.),
146  subClusDPhi1_(-999.),
147  subClusDPhi2_(-999.),
148  subClusDPhi3_(-999.),
149  subClusDEta1_(-999.),
150  subClusDEta2_(-999.),
151  subClusDEta3_(-999.),
152  cryEta_(-999.),
153  cryPhi_(-999),
154  iEta_(-999),
155  iPhi_(-999) {}
156 
158 Photon::~Photon() {}
159 
160 std::ostream& reco::operator<<(std::ostream& out, const pat::Photon& obj) {
161  if (!out)
162  return out;
163 
164  out << "\tpat::Photon: ";
165  out << std::setiosflags(std::ios::right);
166  out << std::setiosflags(std::ios::fixed);
167  out << std::setprecision(3);
168  out << " E/pT/eta/phi " << obj.energy() << "/" << obj.pt() << "/" << obj.eta() << "/" << obj.phi();
169  return out;
170 }
171 
175  if (embeddedSuperCluster_) {
176  if (embeddedSeedCluster_ || !basicClusters_.empty() || !preshowerClusters_.empty()) {
177  if (!superClusterRelinked_.isSet()) {
178  std::unique_ptr<std::vector<reco::SuperCluster> > sc(new std::vector<reco::SuperCluster>(superCluster_));
179  if (embeddedSeedCluster_ && !(*sc)[0].seed().isAvailable()) {
180  (*sc)[0].setSeed(seed());
181  }
182  if (!basicClusters_.empty() && !(*sc)[0].clusters().isAvailable()) {
184  for (unsigned int iclus = 0; iclus < basicClusters_.size(); ++iclus) {
185  clusters.push_back(reco::CaloClusterPtr(&basicClusters_, iclus));
186  }
187  (*sc)[0].setClusters(clusters);
188  }
189  if (!preshowerClusters_.empty() && !(*sc)[0].preshowerClusters().isAvailable()) {
191  for (unsigned int iclus = 0; iclus < preshowerClusters_.size(); ++iclus) {
192  clusters.push_back(reco::CaloClusterPtr(&preshowerClusters_, iclus));
193  }
194  (*sc)[0].setPreshowerClusters(clusters);
195  }
196  superClusterRelinked_.set(std::move(sc));
197  }
198  return reco::SuperClusterRef(&*superClusterRelinked_, 0);
199  } else {
200  return reco::SuperClusterRef(&superCluster_, 0);
201  }
202  } else {
204  }
205 }
206 
209  if (embeddedSeedCluster_) {
210  return reco::CaloClusterPtr(&seedCluster_, 0);
211  } else {
212  return reco::Photon::superCluster()->seed();
213  }
214 }
215 
218  superCluster_.clear();
219  if (reco::Photon::superCluster().isNonnull()) {
220  superCluster_.push_back(*reco::Photon::superCluster());
221  embeddedSuperCluster_ = true;
222  }
223 }
224 
227  seedCluster_.clear();
228  if (reco::Photon::superCluster().isNonnull() && reco::Photon::superCluster()->seed().isNonnull()) {
229  seedCluster_.push_back(*reco::Photon::superCluster()->seed());
230  embeddedSeedCluster_ = true;
231  }
232 }
233 
236  basicClusters_.clear();
237  if (reco::Photon::superCluster().isNonnull()) {
238  reco::CaloCluster_iterator itscl = reco::Photon::superCluster()->clustersBegin();
239  reco::CaloCluster_iterator itsclE = reco::Photon::superCluster()->clustersEnd();
240  for (; itscl != itsclE; ++itscl) {
241  basicClusters_.push_back(**itscl);
242  }
243  }
244 }
245 
248  preshowerClusters_.clear();
249  if (reco::Photon::superCluster().isNonnull()) {
250  reco::CaloCluster_iterator itscl = reco::Photon::superCluster()->preshowerClustersBegin();
251  reco::CaloCluster_iterator itsclE = reco::Photon::superCluster()->preshowerClustersEnd();
252  for (; itscl != itsclE; ++itscl) {
253  preshowerClusters_.push_back(**itscl);
254  }
255  }
256 }
257 
258 // method to store the RecHits internally
260  if (rechits != nullptr) {
261  recHits_ = *rechits;
262  embeddedRecHits_ = true;
263  }
264 }
265 
266 // method to retrieve a photon ID (or throw)
267 Bool_t Photon::photonID(const std::string& name) const {
268  for (std::vector<IdPair>::const_iterator it = photonIDs_.begin(), ed = photonIDs_.end(); it != ed; ++it) {
269  if (it->first == name)
270  return it->second;
271  }
272  cms::Exception ex("Key not found");
273  ex << "pat::Photon: the ID " << name << " can't be found in this pat::Photon.\n";
274  ex << "The available IDs are: ";
275  for (std::vector<IdPair>::const_iterator it = photonIDs_.begin(), ed = photonIDs_.end(); it != ed; ++it) {
276  ex << "'" << it->first << "' ";
277  }
278  ex << ".\n";
279  throw ex;
280 }
281 // check if an ID is there
282 bool Photon::isPhotonIDAvailable(const std::string& name) const {
283  for (std::vector<IdPair>::const_iterator it = photonIDs_.begin(), ed = photonIDs_.end(); it != ed; ++it) {
284  if (it->first == name)
285  return true;
286  }
287  return false;
288 }
289 
290 edm::RefVector<pat::PackedCandidateCollection> Photon::associatedPackedPFCandidates() const {
291  edm::RefVector<pat::PackedCandidateCollection> ret(packedPFCandidates_.id());
292  for (uint16_t idx : associatedPackedFCandidateIndices_) {
293  ret.push_back(edm::Ref<pat::PackedCandidateCollection>(packedPFCandidates_, idx));
294  }
295  return ret;
296 }
297 
301  if (i >= associatedPackedFCandidateIndices_.size()) {
302  return reco::CandidatePtr();
303  } else {
305  edm::Ref<pat::PackedCandidateCollection>(packedPFCandidates_, associatedPackedFCandidateIndices_[i])));
306  }
307 }
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:543
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
mps_fire.i
i
Definition: mps_fire.py:428
reco::Photon::superCluster
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
funct::false
false
Definition: Factorize.h:29
electronProducer_cfi.embedPreshowerClusters
embedPreshowerClusters
embed in AOD externally stored the electron's basic clusters
Definition: electronProducer_cfi.py:50
Photon.h
pat::Photon
Analysis-level Photon class.
Definition: Photon.h:46
edm::PtrVectorItr
Definition: PtrVector.h:51
edm::SortedCollection< EcalRecHit >
edm::RefVector
Definition: EDProductfwd.h:27
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
reco::CaloClusterPtr
edm::Ptr< CaloCluster > CaloClusterPtr
Definition: CaloClusterFwd.h:21
edm::Ref
Definition: AssociativeIterator.h:58
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
edm::refToPtr
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
Definition: RefToPtr.h:18
fileCollector.seed
seed
Definition: fileCollector.py:127
sistrip::sep_
static const char sep_[]
Definition: ConstantsForDqm.h:18
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
edm::PtrVector< CaloCluster >
reco::SuperClusterRef
edm::Ref< SuperClusterCollection > SuperClusterRef
reference to an object in a collection of SuperCluster objects
Definition: SuperClusterFwd.h:15
electronProducer_cfi.embedBasicClusters
embedBasicClusters
embed in AOD externally stored the electron's seedcluster
Definition: electronProducer_cfi.py:49
HI_PhotonSkim_cff.rechits
rechits
Definition: HI_PhotonSkim_cff.py:76
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
bsc_activity_cfg.clusters
clusters
Definition: bsc_activity_cfg.py:36
electronProducer_cfi.embedRecHits
embedRecHits
embed in AOD externally stored track (note: gsf electrons don't have a track)
Definition: electronProducer_cfi.py:55
Photon
Definition: Photon.py:1
RefToPtr.h
reco::operator<<
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:66
reco::Photon::Photon
Photon()
default constructor
Definition: Photon.h:32
nanoDQM_cff.Photon
Photon
Definition: nanoDQM_cff.py:96
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::Ptr
Definition: AssociationVector.h:31
reco::Photon
Definition: Photon.h:22
electronProducer_cfi.embedSuperCluster
embedSuperCluster
embed in AOD externally stored gsf track
Definition: electronProducer_cfi.py:46
eostools.move
def move(src, dest)
Definition: eostools.py:511
electronProducer_cfi.embedSeedCluster
embedSeedCluster
embed in AOD externally stored supercluster
Definition: electronProducer_cfi.py:48
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::RefToBase
Definition: AssociativeIterator.h:54
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
cms::Exception
Definition: Exception.h:70
reco::CandidatePtr
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
Definition: CandidateFwd.h:25
reco::LeafCandidate::sourceCandidatePtr
CandidatePtr sourceCandidatePtr(size_type i) const override
Definition: LeafCandidate.h:103
reco::Photon::~Photon
~Photon() override
destructor