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