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