Skip to content

Commit

Permalink
Add objects to allow possibility of storing energy deposit informatio…
Browse files Browse the repository at this point in the history
…n in passive material
  • Loading branch information
Sunanda committed May 7, 2017
1 parent ebcc09c commit 22b8bb1
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 0 deletions.
63 changes: 63 additions & 0 deletions SimDataFormats/CaloHit/interface/PassiveHit.h
@@ -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_
11 changes: 11 additions & 0 deletions SimDataFormats/CaloHit/src/PassiveHit.cc
@@ -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;
}
6 changes: 6 additions & 0 deletions SimDataFormats/CaloHit/src/classes.h
Expand Up @@ -4,6 +4,7 @@
#include "SimDataFormats/CaloHit/interface/HFShowerPhoton.h"
#include "SimDataFormats/CaloHit/interface/PCaloHit.h"
#include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h"
#include "SimDataFormats/CaloHit/interface/PassiveHit.h"
#include "DataFormats/Common/interface/Wrapper.h"

namespace SimDataFormats_CaloHit {
Expand All @@ -24,5 +25,10 @@ namespace SimDataFormats_CaloHit {

HFShowerPhotonCollection rv4;
edm::Wrapper<HFShowerPhotonCollection> wc4;

PassiveHit rv5;
edm::PassiveHitContainer v5;
std::vector<const PassiveHit*> vcp5;
edm::Wrapper<edm::PassiveHitContainer> wc5;
};
}
6 changes: 6 additions & 0 deletions SimDataFormats/CaloHit/src/classes_def.xml
Expand Up @@ -28,4 +28,10 @@
<class name="edm::Wrapper<HFShowerLibraryEventInfo>" />
<class name="edm::Wrapper<std::vector<HFShowerLibraryEventInfo> >"/>
<typedef name="CastorShowerEvent::Point" />
<class name="PassiveHit" ClassVersion="11">
<version ClassVersion="11" checksum="2866279991"/>
</class>
<class name="std::vector<PassiveHit>"/>
<class name="std::vector<const PassiveHit*>"/>
<class name="edm::Wrapper<std::vector<PassiveHit>>" splitLevel="0"/>
</lcgdict>

0 comments on commit 22b8bb1

Please sign in to comment.