52 #include "StEmcPoint.h"
53 #include "StEmcCluster.h"
54 static const char rcsid[] =
"$Id: StEmcPoint.cxx,v 2.12 2013/01/15 23:21:05 fisyak Exp $";
62 for(
int i=0;i<4;i++) {
63 mEnergyInDetector[i]=0;
74 unsigned int hp,
float q,
75 float energy,
float csq,
77 :
StHit(p,e,hp,q,c),mEnergy(energy), mChiSquare(csq), mSize(s)
82 StEmcPoint::~StEmcPoint() {}
85 StEmcPoint::energy()
const {
return mEnergy;};
88 StEmcPoint::setEnergy(
const float e) {mEnergy = e;};
91 StEmcPoint::chiSquare()
const {
return mChiSquare;};
94 StEmcPoint::setChiSquare(
const float c) {mChiSquare = c;};
97 StEmcPoint::size()
const {
return mSize;};
103 StEmcPoint::getDetId(
const StDetectorId
id)
const{
104 if(
id>=kBarrelEmcTowerId &&
id<=kBarrelSmdPhiStripId){
105 return id-kBarrelEmcTowerId;
106 }
else if(
id>=kEndcapEmcTowerId &&
id<=kEndcapSmdVStripId){
107 return id-kEndcapEmcTowerId;
109 cout<<
"***Error at StEmcPoint:::getDetId, Invalid StDetectorId"<<endl;
114 StEmcPoint::getDetId(Int_t
id)
const{
115 if(
id>=kBarrelEmcTowerId &&
id<=kBarrelSmdPhiStripId){
116 return id-kBarrelEmcTowerId;
117 }
else if(
id>=kEndcapEmcTowerId &&
id<=kEndcapSmdVStripId){
118 return id-kEndcapEmcTowerId;
120 cout<<
"***Error at StEmcPoint:::getDetId, Invalid StDetectorId"<<endl;
126 StEmcPoint::energyInDetector(
const StDetectorId
id)
const{
127 int i = getDetId(
id);
128 if(i==-1)
return 0.0;
129 return mEnergyInDetector[i];
133 StEmcPoint::setEnergyInDetector(
const StDetectorId
id,
const float e){
134 int i = getDetId(
id);
135 if(i>=0) mEnergyInDetector[i]=e;
139 StEmcPoint::sizeAtDetector(
const StDetectorId
id)
const{
140 int i = getDetId(
id);
141 if(i==-1)
return 0.0;
142 return mSizeAtDetector[i];
146 StEmcPoint::setSizeAtDetector(
const StDetectorId
id,
const float s){
147 int i = getDetId(
id);
148 if(i>=0) mSizeAtDetector[i]=s;
151 float StEmcPoint::deltaEta()
const{
return mDelta[0];}
152 float StEmcPoint::deltaPhi()
const{
return mDelta[1];}
153 float StEmcPoint::deltaU()
const{
return mDelta[0];}
154 float StEmcPoint::deltaV()
const{
return mDelta[1];}
155 void StEmcPoint::setDeltaEta(
const float d){mDelta[0]=d;}
156 void StEmcPoint::setDeltaPhi(
const float d){mDelta[1]=d;}
157 void StEmcPoint::setDeltaU(
const float d){mDelta[0]=d;}
158 void StEmcPoint::setDeltaV(
const float d){mDelta[1]=d;}
161 StEmcPoint::cluster(
const StDetectorId
id){
162 int i = getDetId(
id);
166 const StPtrVecEmcCluster&
167 StEmcPoint::cluster(
const StDetectorId
id)
const{
168 int i = getDetId(
id);
173 StEmcPoint::cluster(Int_t
id){
174 int i = getDetId(
id);
178 const StPtrVecEmcCluster&
179 StEmcPoint::cluster(Int_t
id)
const{
180 int i = getDetId(
id);
185 StEmcPoint::addCluster(
const StDetectorId
id,
const StEmcCluster* c){
187 int i = getDetId(
id);
188 if(i>=0) mCluster[i].push_back(c);
192 StEmcPoint::neighbor(){
196 const StPtrVecEmcPoint&
197 StEmcPoint::neighbor()
const {
202 StEmcPoint::addNeighbor(
const StEmcPoint* p){
203 mNeighbors.push_back(p);
207 StEmcPoint::nTracks()
const {
return mTracks.size();}
210 StEmcPoint::track() {
return mTracks;}
213 StEmcPoint::track()
const {
return mTracks;}
218 if(track) mTracks.push_back(track);
222 void StEmcPoint::print()
224 cout <<
"Point energy " << mEnergy << endl;
225 cout <<
"size " << mSize << endl;
226 cout <<
"#tracks " << mTracks.size() << endl;
227 for(
int det=0; det<4; det++){
228 cout <<
" det " << det <<
" #clusters " << mCluster[det].size()<<endl;
233 operator<<(ostream &os,
const StEmcPoint& pnt)
235 os <<
"Point Energy " << pnt.energy()
236 <<
" size " << pnt.size() <<
" #tracks " << pnt.nTracks() << endl;
237 Int_t Ids[4] = {kBarrelEmcTowerId, kBarrelEmcPreShowerId, kEndcapEmcTowerId, kEndcapEmcPreShowerId};
238 for (Int_t k = 0; k < 4; k++) {
239 const StPtrVecEmcCluster &cl = pnt.cluster(Ids[k]);
240 Int_t ncl = (Int_t) cl.size();
241 for (Int_t i = 0; i < ncl; i++) {
242 cout << *cl[i] << endl;
245 os << *((
StHit *)&pnt);
248 void StEmcPoint::Print(Option_t *option)
const {cout << *
this << endl;}