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