emcClusterContentv2.C

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