CMS 3D CMS Logo

Classes | Functions
EcalRecHit.h File Reference
#include "DataFormats/DetId/interface/DetId.h"
#include "DataFormats/CaloRecHit/interface/CaloRecHit.h"
#include <vector>
#include <cmath>

Go to the source code of this file.

Classes

class  EcalRecHit
 

Functions

std::ostream & operator<< (std::ostream &s, const EcalRecHit &hit)
 

Function Documentation

std::ostream& operator<< ( std::ostream &  s,
const EcalRecHit hit 
)

Definition at line 10 of file EcalRecHit.cc.

References DetId::det(), EcalRecHit::detid(), DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, EcalRecHit::energy(), DetId::subdetId(), and EcalRecHit::time().

10  {
11  if (hit.detid().det() == DetId::Ecal && hit.detid().subdetId() == EcalBarrel)
12  return s << EBDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns";
13  else if (hit.detid().det() == DetId::Ecal && hit.detid().subdetId() == EcalEndcap)
14  return s << EEDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns";
15  else if (hit.detid().det() == DetId::Ecal && hit.detid().subdetId() == EcalPreshower)
16  return s << ESDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns";
17  else
18  return s << "EcalRecHit undefined subdetector" ;
19 }
const DetId & detid() const
Definition: EcalRecHit.h:72
float time() const
Definition: EcalRecHit.h:70
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
float energy() const
Definition: EcalRecHit.h:68
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39