00001 #include "emcClusterContentv1.h"
00002
00003 ClassImp(emcClusterContentv1)
00004
00005 using namespace std;
00006
00007
00008 emcClusterContentv1::emcClusterContentv1() :
00009 fTowerid(0),
00010 fPartesum(0)
00011 {
00012 Reset();
00013 }
00014
00015
00016 emcClusterContentv1::emcClusterContentv1(const emcClusterContentv1& to)
00017 : fTowerid(0),
00018 fPartesum(0)
00019 {
00020 to.copy(*this);
00021 }
00022
00023
00024 emcClusterContentv1&
00025 emcClusterContentv1::operator=(const emcClusterContentv1& to)
00026 {
00027 if ( this != &to )
00028 {
00029 Reset();
00030 to.copy(*this);
00031 }
00032 return *this;
00033 }
00034
00035
00036 emcClusterContentv1*
00037 emcClusterContentv1::clone(void) const
00038 {
00039 return new emcClusterContentv1(*this);
00040 }
00041
00042
00043 emcClusterContentv1*
00044 emcClusterContentv1::create(void) const
00045 {
00046 return new emcClusterContentv1;
00047 }
00048
00049
00050 emcClusterContentv1::~emcClusterContentv1()
00051 {
00052 Clear();
00053 }
00054
00055
00056 void emcClusterContentv1::Clear(Option_t*)
00057 {
00058 delete[] fPartesum;
00059 fPartesum=0;
00060 delete[] fTowerid;
00061 fTowerid=0;
00062 }
00063
00064
00065 void
00066 emcClusterContentv1::copy(emcClusterContentv1& to) const
00067 {
00068 to.fDeadmap = fDeadmap;
00069 to.fWarnmap = fWarnmap;
00070
00071 to.fArm = fArm;
00072 to.fId = fId;
00073 to.fMultiplicity = fMultiplicity;
00074 to.fPid = fPid;
00075 to.fSector = fSector;
00076 to.fIypos = fIypos;
00077 to.fIzpos = fIzpos;
00078 to.fType = fType;
00079
00080 to.fX = fX;
00081 to.fY = fY;
00082 to.fZ = fZ;
00083 to.fDx = fDx;
00084 to.fDy = fDy;
00085 to.fDz = fDz;
00086 to.fDispy = fDispy;
00087 to.fDispz = fDispz;
00088 to.fE = fE;
00089 to.fE9 = fE9;
00090 to.fEcent = fEcent;
00091 to.fEcore = fEcore;
00092 to.fEtofmin = fEtofmin;
00093 to.fEtofmax = fEtofmax;
00094 to.fChi2 = fChi2;
00095 to.fQuality = fQuality;
00096 to.fPadispy = fPadispy;
00097 to.fPadispz = fPadispz;
00098 to.fProb_photon = fProb_photon;
00099 to.fPhi = fPhi;
00100 to.fTof = fTof;
00101 to.fTofmin = fTofmin;
00102 to.fTofmax = fTofmax;
00103 to.fTofcorr = fTofcorr;
00104 to.fTofcorrmin = fTofcorrmin;
00105 to.fTofcorrmax = fTofcorrmax;
00106 to.fTofdisp = fTofdisp;
00107 to.fTheta = fTheta;
00108
00109 to.Clear();
00110
00111 to.fTowerid = new int[to.fMultiplicity];
00112 to.fPartesum = new float[to.fMultiplicity];
00113 for ( int i = 0; i < to.fMultiplicity; ++i )
00114 {
00115 to.fTowerid[i] = fTowerid[i];
00116 to.fPartesum[i] = fPartesum[i];
00117 }
00118 }
00119
00120
00121 void
00122 emcClusterContentv1::identify(std::ostream& os) const
00123 {
00124 os << "emcClusterContentv1::identify" << endl;
00125 }
00126
00127
00128 int
00129 emcClusterContentv1::isValid() const
00130 {
00131 return 1;
00132 }
00133
00134
00135 float
00136 emcClusterContentv1::partesum(int index) const
00137 {
00138 if (index>=0 && index<fMultiplicity)
00139 {
00140 return fPartesum[index];
00141 }
00142 else
00143 {
00144 cerr << "emcClusterContentv1::partesum : index out of bounds ("
00145 << index << " out of " << fMultiplicity << ")" << endl;
00146 return 0;
00147 }
00148 }
00149
00150
00151 void
00152 emcClusterContentv1::print(std::ostream& out) const
00153 {
00154 std::ostream::fmtflags oldflags = out.flags();
00155
00156 out << "ARM " << arm() << " SECT " << sector()
00157 << " ID " << id() << " TYPE " << type()
00158 << " POS(Z,Y) " << izpos() << " " << iypos()
00159 << " MULT " << multiplicity()
00160 << endl;
00161 out.setf(ios::scientific);
00162 out.precision(3);
00163 out << "(X,Y,Z)" << x() << " " << y() << " " << z()
00164 << " (E,ECENT,ECORE) " << e() << " " << ecent() << " " << ecore()
00165 << " (TOF,min,max) " << tof() << " " << tofmin() << " " << tofmax()
00166 << endl
00167 << " CHI2 " << chi2()
00168 << " DISP(Z,Y) " << " " << dispz() << " " << dispy()
00169 << " PADISP(Z,Y) " << " " << padispz() << " " << padispy()
00170 << endl;
00171
00172 out.setf(oldflags);
00173 out << " Dead " << deadmap() << " Warn " << warnmap()
00174 << endl;
00175 out.setf(oldflags);
00176 }
00177
00178
00179 void
00180 emcClusterContentv1::Reset()
00181 {
00182 fArm=-1;
00183 fChi2=0;
00184 fDeadmap=0;
00185 fDispy=0;
00186 fDispz=0;
00187 fE=fE9=fEcent=fEcore=fEtofmin=fEtofmax=0;
00188 fId=0;
00189 fQuality=0;
00190 fMultiplicity=0;
00191 fPadispy=fPadispz=0;
00192 fProb_photon=0;
00193 fPhi=0;
00194 fPid=0;
00195 fSector=0;
00196 fTof=fTofmin=fTofmax=0;
00197 fTofcorr=fTofcorrmin=fTofcorrmax=0;
00198 fTofdisp=0;
00199 fTheta=0;
00200 fType=0;
00201 fWarnmap=0;
00202 fX=fY=fZ=0;
00203 fDx=fDy=fDz=0;
00204 fIypos=fIzpos=0;
00205
00206 Clear();
00207 }
00208
00209
00210 int
00211 emcClusterContentv1::towerid(int index) const
00212 {
00213 if (index>=0 && index<fMultiplicity)
00214 {
00215 return fTowerid[index];
00216 }
00217 else
00218 {
00219 cerr << "emcClusterContentv1::towerid : index out of bounds ("
00220 << index << " out of " << fMultiplicity << ")" << endl;
00221 return 0;
00222 }
00223 }
00224
00225
00226 void
00227 emcClusterContentv1::set_multiplicity(int mul)
00228 {
00229 fMultiplicity=mul;
00230
00231 Clear();
00232
00233 fTowerid = new int[fMultiplicity];
00234 for (int i = 0; i < fMultiplicity; ++i )
00235 {
00236 fTowerid[i]=-1;
00237 }
00238 fPartesum = new float[fMultiplicity];
00239 for (int i = 0; i < fMultiplicity; ++i )
00240 {
00241 fPartesum[i]=0.0;
00242 }
00243 }
00244
00245
00246 void
00247 emcClusterContentv1::set_partesum(int index, float value)
00248 {
00249 if ( !fPartesum )
00250 {
00251 cerr << "emcClusterContentv1::set_partesum : internal array is null."
00252 << " Did you forgot to specify the multiplicity ?"
00253 << endl;
00254 return;
00255 }
00256
00257 if (index>=0 && index<fMultiplicity)
00258 {
00259 fPartesum[index] = value;
00260 }
00261 else
00262 {
00263 cerr << "emcClusterContentv1::set_partesum : index out of bounds ("
00264 << index << " out of " << fMultiplicity << ")" << endl;
00265 }
00266 }
00267
00268
00269 void
00270 emcClusterContentv1::set_towerid(int index, int value)
00271 {
00272 if ( !fTowerid )
00273 {
00274 cerr << "emcClusterContentv1::set_towerid : internal array is null."
00275 << " Did you forgot to specify the multiplicity ?"
00276 << endl;
00277 return;
00278 }
00279
00280 if (index>=0 && index<fMultiplicity)
00281 {
00282 fTowerid[index] = value;
00283 }
00284 else
00285 {
00286 cerr << "emcClusterContentv1::set_towerid : index out of bounds ("
00287 << index << " out of " << fMultiplicity << ")" << endl;
00288 }
00289 }