Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add objects to allow possibility of storing energy deposit informatio…
…n in passive material
- Loading branch information
Sunanda
committed
May 7, 2017
1 parent
ebcc09c
commit 22b8bb1
Showing
4 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#ifndef SimDataFormats_PassiveHit_H | ||
#define SimDataFormats_PassiveHit_H | ||
|
||
#include<string> | ||
#include <vector> | ||
|
||
// Persistent Hit in passive material | ||
|
||
class PassiveHit { | ||
|
||
public: | ||
|
||
PassiveHit(std::string vname, unsigned int id, float e=0., float t=0., | ||
int it=0) : vname_(vname), id_(id), energy_(e), time_(t), it_(it) {} | ||
PassiveHit() : vname_(""), id_(0), energy_(0), time_(0), it_(0) {} | ||
|
||
//Names | ||
static const char *name() { return "PassiveHit"; } | ||
|
||
const char * getName() const { return name (); } | ||
|
||
//Energy deposit of the Hit | ||
double energy() const { return energy_; } | ||
void setEnergy(double e) { energy_ = e; } | ||
|
||
|
||
//Time of the deposit | ||
double time() const { return time_; } | ||
void setTime(float t) { time_ = t;} | ||
|
||
//Geant track number | ||
int trackId() const { return it_; } | ||
void setTrackId(int it) { it_ = it; } | ||
|
||
//DetId where the Hit is recorded | ||
void setID(std::string vname, unsigned int id) { vname_ = vname; id_ = id; } | ||
std::string vname() const { return vname_; } | ||
unsigned int id() const { return id_; } | ||
|
||
//Comparisons | ||
bool operator<(const PassiveHit &d) const { return energy_ < d.energy_; } | ||
|
||
//Same Hit (by value) | ||
bool operator==(const PassiveHit &d) const | ||
{ return (energy_ == d.energy_ && id_ == d.id_ && vname_ == d.vname_); } | ||
|
||
|
||
protected: | ||
std::string vname_; | ||
unsigned int id_; | ||
float energy_; | ||
float time_; | ||
int it_; | ||
}; | ||
|
||
namespace edm { | ||
typedef std::vector<PassiveHit> PassiveHitContainer; | ||
} // edm | ||
|
||
#include<iosfwd> | ||
std::ostream &operator<<(std::ostream &, const PassiveHit &); | ||
|
||
#endif // _SimDataFormats_SimCaloHit_PassiveHit_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include "SimDataFormats/CaloHit/interface/PassiveHit.h" | ||
#include<iostream> | ||
|
||
std::ostream & operator<<(std::ostream& o,const PassiveHit& hit) { | ||
o << hit.vname() << " 0x" <<std::hex << hit.id() << std::dec | ||
<< ": Energy " << hit.energy() << " GeV " | ||
<< " Tof " << hit.time() << " ns " | ||
<< " Track #" << hit.trackId(); | ||
|
||
return o; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters