// ----------------------------------------------------------------------------
// $Id: LCDCluster.cxx,v 1.3 2001/06/21 05:24:59 toshi Exp $
// ----------------------------------------------------------------------------
//
// $Log: LCDCluster.cxx,v $
// Revision 1.3 2001/06/21 05:24:59 toshi
// A bug fix. The range of initialization of m_McListI[] and m_McListE[] was
// wrong.
//
// Revision 1.2 2001/06/20 22:30:57 toshi
// Force to set m_CalHitI[], m_McListI[50], and m_McListE[50] to be zero
// when a LCDCluster is initialized.
//
// Revision 1.1 2001/05/15 17:27:17 masako
// Move LCDCluster.C to LCDCluster.cxx .
//
// Revision 1.2 2001/04/28 23:40:22 toshi
// Start to use CVS.
//
//
//////////////////////////////////////////////////////////////////////////
//
// LCDCluster
//
// The LCDCluster class is used to extract cluster information from
// the GISMO ascii output file.
//
//////////////////////////////////////////////////////////////////////////
#include "LCDCluster.h"
#include "LCDCalHit.h"
#include "TVector2.h"
ClassImp(LCDCluster)
//__________________________________________________________________________
void LCDCluster::InitArray() {
Int_t i=0;
for (i=0 ; i < 1000 ; i++) {
m_CalHitI[i]=0;
}
for (i=0 ; i < 50 ; i++) {
m_McListI[i]=0;
m_McListE[i]=0;
}
}
//__________________________________________________________________________
//__________________________________________________________________________
void LCDCluster::SetUpCluster(Double_t energy,
Double_t pos_phi, Double_t pos_phierr,
Double_t pos_theta,Double_t pos_thetaerr,
Double_t pos_r, Double_t pos_rerr,
Int_t barend, Int_t sysid
) {
// Set the clusters attributes
m_energy = energy;
m_PosTheta = pos_theta;
m_PosThetaErr = pos_thetaerr;
m_PosPhi = pos_phi;
m_PosPhiErr = pos_phierr;
m_PosR = pos_r;
m_PosRErr = pos_rerr;
m_barend = barend;
m_system = sysid;
}
//__________________________________________________________________________
//__________________________________________________________________________
void LCDCluster::AddCalHit(Int_t hit_index) {
Int_t f_calhit=-1;
for (Int_t ihit=0 ; ihit < m_CalHitN ; ihit++) {
if (m_CalHitI[ihit] == hit_index) {
f_calhit = ihit;
break;
}
}
if (f_calhit == -1) {
if (m_CalHitN > 999) {
fprintf(stderr,
"LCDCluster::AddCalHit # of CalHit is over 999!!! hit=%dn",
m_CalHitN);
} else {
m_CalHitI[m_CalHitN++ ] = hit_index;
}
}
}
//__________________________________________________________________________
//__________________________________________________________________________
void LCDCluster::AddParticle(Int_t part_index, Double_t epart) {
Int_t f_part=-1;
for (Int_t imc=0 ; imc < m_McListN ; imc++) {
if (m_McListI[imc] == part_index) {
f_part = imc;
break;
}
}
if (f_part > -1) {
m_McListE[f_part] += epart;
} else {
if (m_McListN > 49) {
fprintf(stderr,
"LCDCluster::AddParticle # of McPart is over 49!!! hit=%dn",
m_McListN);
} else {
m_McListI[m_McListN ] = part_index;
m_McListE[m_McListN++] = epart;
}
}
}
//__________________________________________________________________________
//__________________________________________________________________________
void LCDCluster::RemoveCalHit(Int_t calhit_index) {
Int_t f_calhit=-1;
Int_t ihit;
for (ihit=0 ; ihit < m_CalHitN ; ihit++) {
if (m_CalHitI[ihit] == calhit_index) {
f_calhit = ihit;
break;
}
}
if (f_calhit > -1) {
for (ihit=f_calhit+1 ; ihit < m_CalHitN ; ihit++) {
m_CalHitI[ihit-1] = m_CalHitI[ihit];
}
m_CalHitN--;
} else {
fprintf(stderr,
"LCDCluster::RemoveParticle McPart could not find!!! idx=%dn",
calhit_index);
}
}
//__________________________________________________________________________
//__________________________________________________________________________
void LCDCluster::RemoveParticle(Int_t part_index, Double_t epart) {
Int_t f_part=-1;
Int_t imc;
for (imc=0 ; imc < m_McListN ; imc++) {
if (m_McListI[imc] == part_index) {
f_part = imc;
break;
}
}
if (f_part > -1) {
m_McListE[f_part] -= epart;
if (m_McListE[f_part] <= 0) {
for (imc=f_part+1 ; imc < m_McListN ; imc++) {
m_McListI[imc-1] = m_McListI[imc];
m_McListE[imc-1] = m_McListE[imc];
}
m_McListN--;
}
} else {
fprintf(stderr,
"LCDCluster::RemoveParticle McPart could not find!!! idx=%dn",
part_index);
for (imc=0 ; imc < m_McListN ; imc++) {
fprintf(stderr,
"imc=%d mcidx=%d emc=%fn",imc,m_McListI[imc],m_McListE[imc]);
}
}
}
//__________________________________________________________________________
ROOT page - Class index - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.