/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Emc/EmcRecEventModel/EmcRecEventModel-01-01-18/src/RecEmcShower.cxx

Go to the documentation of this file.
00001 //
00002 //  Bes Rec EMC Shower
00003 //
00004 //  Created by Zhe Wang 2003, 10, 1
00005 //
00006 #include <iostream>
00007 #include <complex>
00008 
00009 #include "EmcRecEventModel/RecEmcShower.h"
00010 
00011 //Constructors and destructors
00012 RecEmcShower::RecEmcShower()
00013 {
00014   Clear();
00015 }
00016 
00017 RecEmcShower::~RecEmcShower()
00018 {
00019   //Clear();
00020 }
00021 
00022 //Copy and assignment                                                        
00023 RecEmcShower::RecEmcShower(const DstEmcShower& aShower)
00024   :DstEmcShower(aShower)
00025 {
00026   Clear();
00027   fShowerId=RecEmcID(aShower.cellId());
00028 }
00029 
00030 RecEmcShower& RecEmcShower::operator=(const DstEmcShower& aShower)
00031 { 
00032   Clear();
00033   DstEmcShower::operator=(aShower);
00034   fShowerId=RecEmcID(aShower.cellId());
00035   return *this;
00036 }
00037 
00038 /*RecEmcShower::RecEmcShower(const RecEmcShower& aShower)
00039   :ContainedObject(aShower),DstEmcShower(aShower)
00040 {  
00041   *this = aShower;
00042 }
00043 
00044 RecEmcShower& RecEmcShower::operator=(const RecEmcShower& aShower)
00045 {
00046   RecEmcFractionMap::const_iterator pFractionMap;
00047 
00048   Clear();
00049 
00050   if(this!=&aShower)
00051   {
00052     DstEmcShower::operator=(aShower);
00053 
00054     for(pFractionMap=aShower.Begin();
00055         pFractionMap!=aShower.End();
00056         pFractionMap++){
00057       Insert(pFractionMap->second);
00058     }
00059     fCellId3x3=aShower.CellId3x3();
00060     fCellId5x5=aShower.CellId5x5();
00061     fTofShower=aShower.TofShower();
00062     fShowerId=aShower.ShowerId();
00063     fClusterId=aShower.ClusterId();
00064     fCluster=aShower.Cluster();
00065     fEAll=aShower.EAll();
00066     fELepton=aShower.ELepton();
00067     fETof2x1=aShower.ETof2x1();
00068     fETof2x3=aShower.ETof2x3();
00069     //fPosition=aShower.Position();
00070     fNearestSeed=aShower.NearestSeed();
00071     fThetaGap=aShower.ThetaGap();
00072     fPhiGap=aShower.PhiGap();
00073   }
00074 
00075   return *this;
00076 }*/
00077 
00078 //Other methods
00079 void RecEmcShower::Clear()
00080 {
00081   fShowerId.clear();
00082   fClusterId.clear();
00083   fCellId3x3.clear();
00084   fCellId5x5.clear();
00085   fFractionMap.clear();
00086   //
00087   fCluster=NULL;
00088   fTofShower=false;
00089   fEAll=0;
00090   fELepton=0;
00091   fETof2x1=0;
00092   fETof2x3=0;
00093   //
00094   //HepPoint3D o(0,0,0);
00095   //fPosition=o;
00096   //   
00097   fNearestSeed.clear();
00098   fThetaGap=0;
00099   fPhiGap=0;
00100 }
00101 
00102 //Access a Shower
00103 RecEmcID RecEmcShower::ShowerId(RecEmcID id)
00104 {
00105   return fShowerId=id;
00106 }
00107 
00108 //Access a Cluster
00109 void RecEmcShower::ClusterId(const RecEmcID id)
00110 {
00111   fClusterId=id;
00112 }
00113 
00114 void RecEmcShower::Cluster(RecEmcCluster* pCluster)
00115 {
00116   fCluster=pCluster;
00117 }
00118 
00119 void RecEmcShower::CellId3x3(RecEmcIDVector& id3x3)
00120 {
00121   fCellId3x3.clear();
00122   fCellId3x3=id3x3;
00123 }
00124 
00125 void RecEmcShower::CellId5x5(RecEmcIDVector& id5x5)
00126 {
00127   fCellId5x5.clear();
00128   fCellId5x5=id5x5;
00129 }
00130 
00131 RecEmcFractionMap::const_iterator RecEmcShower::Begin() const
00132 {
00133   return fFractionMap.begin();
00134 }
00135 
00136 RecEmcFractionMap::const_iterator RecEmcShower::End() const
00137 {
00138   return fFractionMap.end();
00139 }
00140 
00141 RecEmcFractionMap::const_iterator RecEmcShower::Find(const RecEmcID& CellId) const
00142 {   
00143   // If failed the return vale is End().
00144   return fFractionMap.find(CellId);
00145 }
00146 
00147 //Insert and Erase a Fraction  
00148 void RecEmcShower::Insert(const RecEmcFraction& aFraction)
00149 {
00150   fFractionMap[aFraction.getCellId()]=aFraction;
00151   return;
00152 }
00153 
00154 void RecEmcShower::Erase(const RecEmcFraction& aFraction)
00155 {      
00156   RecEmcFractionMap::const_iterator pFractionMap;
00157   pFractionMap=fFractionMap.find(aFraction.getCellId());
00158 
00159   //blank FractionMap
00160   if(fFractionMap.empty()) 
00161   {
00162     return;
00163   }
00164 
00165   //not find 
00166   if(pFractionMap==End()) 
00167   {
00168     return;
00169   }
00170 
00171   //find it
00172   if(pFractionMap!=End())
00173   {
00174     fFractionMap.erase(pFractionMap->first);
00175     //empty
00176     if(fFractionMap.empty())
00177     {
00178       Clear();
00179       return;
00180     }
00181     //not empty
00182     else
00183     {
00184       return;
00185     }
00186   }
00187 }
00188 
00189 //Dump out.
00190 void RecEmcShower::Dump() const
00191 {
00192   RecEmcFractionMap::const_iterator pFractionMap;
00193 
00194   cout<<"EMC Shower: ";
00195 
00196   cout<<"Shower Id= ";
00197   cout<<fShowerId<<endl;
00198 
00199   for(pFractionMap=fFractionMap.begin();
00200       pFractionMap!=fFractionMap.end();
00201       pFractionMap++)
00202   {
00203     pFractionMap->second.Dump();
00204   }
00205 }
00206 
00207 
00208 //physics attribute
00209 unsigned int RecEmcShower::getSize() const
00210 {
00211   return fFractionMap.size();
00212 }
00213 
00214 RecEmcFractionMap RecEmcShower::getFractionMap() const
00215 {
00216   RecEmcFractionMap tmpFractionMap;
00217   RecEmcFractionMap::const_iterator pFractionMap;
00218 
00219   for(pFractionMap=fFractionMap.begin();
00220       pFractionMap!=fFractionMap.end();
00221       pFractionMap++){
00222     RecEmcFraction aFraction=pFractionMap->second;
00223     tmpFractionMap[aFraction.getCellId()]=aFraction;
00224   }
00225 
00226   return tmpFractionMap;
00227 }
00228 
00229 RecEmcFractionMap RecEmcShower::getFractionMap3x3() const
00230 {
00231   RecEmcFractionMap tmpFractionMap;
00232   if(fFractionMap.empty()) return tmpFractionMap;
00233 
00234   RecEmcFractionMap::const_iterator pFractionMap;
00235   ci_RecEmcIDVector pNearCell;
00236 
00237   for(pFractionMap=fFractionMap.begin();
00238       pFractionMap!=fFractionMap.end();
00239       pFractionMap++){
00240     for(pNearCell=fCellId3x3.begin();
00241         pNearCell!=fCellId3x3.end();
00242         pNearCell++){
00243       if(pFractionMap->second.getCellId()==*pNearCell){
00244         RecEmcFraction aFraction=pFractionMap->second;
00245         tmpFractionMap[aFraction.getCellId()]=aFraction;
00246       }
00247     }
00248   }
00249 
00250   return tmpFractionMap;
00251 }
00252 
00253 RecEmcFractionMap RecEmcShower::getFractionMap5x5() const
00254 {
00255   RecEmcFractionMap tmpFractionMap;
00256   if(fFractionMap.empty()) return tmpFractionMap;
00257   
00258   RecEmcFractionMap::const_iterator pFractionMap;
00259   ci_RecEmcIDVector pNearCell;
00260 
00261   for(pFractionMap=fFractionMap.begin();
00262       pFractionMap!=fFractionMap.end();
00263       pFractionMap++){
00264     for(pNearCell=fCellId5x5.begin();
00265         pNearCell!=fCellId5x5.end();
00266         pNearCell++){
00267       if(pFractionMap->second.getCellId()==*pNearCell){
00268         RecEmcFraction aFraction=pFractionMap->second;
00269         tmpFractionMap[aFraction.getCellId()]=aFraction;
00270       }
00271     }
00272   }
00273 
00274   return tmpFractionMap;
00275 }
00276 
00278 RecEmcEnergy RecEmcShower::EAll(RecEmcEnergy e)
00279 {
00280   return fEAll=e;
00281 }
00282 RecEmcEnergy RecEmcShower::ELepton(RecEmcEnergy e)
00283 {
00284   return fELepton=e;
00285 }
00286 RecEmcEnergy RecEmcShower::ETof2x1(RecEmcEnergy e)
00287 {
00288   return fETof2x1=e;
00289 }
00290 RecEmcEnergy RecEmcShower::ETof2x3(RecEmcEnergy e)
00291 {
00292   return fETof2x3=e;
00293 }
00295 
00296 RecEmcID RecEmcShower::NearestSeed() const
00297 {
00298   return fNearestSeed;
00299 }
00300 
00301 RecEmcID RecEmcShower::NearestSeed(const RecEmcID& ns)
00302 {
00303   return fNearestSeed=ns;
00304 }
00305 
00306 int RecEmcShower::ThetaGap() const
00307 {
00308   return fThetaGap;
00309 }
00310 
00311 int RecEmcShower::ThetaGap(int ThetaGap)
00312 {
00313   return fThetaGap=ThetaGap;
00314 }
00315 
00316 int RecEmcShower::PhiGap() const
00317 {
00318   return fPhiGap;
00319 }
00320 
00321 int RecEmcShower::PhiGap(int PhiGap)
00322 {
00323   return fPhiGap=PhiGap;
00324 }
00325 
00326 ostream& operator<<(ostream & os, const RecEmcShower& aShower)
00327 {
00328   RecEmcFractionMap::const_iterator pFractionMap;
00329   RecEmcFractionMap::const_iterator ciFractionMap3x3;
00330   RecEmcFractionMap::const_iterator ciFractionMap5x5;
00331 
00332   os<<"------------------RecEmcShower:"<<endl;
00333   os<<"Track id: "<<aShower.trackId()<<", number of hits: "<<aShower.getSize()
00334     <<", status: "<<aShower.status()<<", shower id: "<<aShower.getShowerId()
00335     <<", cluster id: "<<aShower.getClusterId()<<", module: "<<aShower.module()
00336     <<", time: "<<aShower.time()<<endl;
00337   os<<"Energy: "<<aShower.energy()<<", de: "<<aShower.dE()
00338     <<", eseed: "<<aShower.eSeed()
00339     <<", e3x3: "<<aShower.e3x3()<<", e5x5: "<<aShower.e5x5()
00340     <<", eall: "<<aShower.getEAll()<<", elepton: "<<aShower.getELepton()<<endl;
00341   os<<"Position: "<<aShower.position()
00342     <<", theta: "<<aShower.theta()<<", phi: "<<aShower.phi()
00343     <<"\ndx: "<<aShower.dx()<<", dy: "<<aShower.dy()<<", dz: "<<aShower.dz()
00344     <<", dtheta: "<<aShower.dtheta()<<", dphi: "<<aShower.dphi()<<endl;
00345   os<<"Second moment: "<<aShower.secondMoment()
00346     <<", lat moment: "<<aShower.latMoment()
00347     <<", a20 moment: "<<aShower.a20Moment()
00348     <<", a42 moment: "<<aShower.a42Moment()<<endl;
00349   os<<"Error matrix: \n"<<aShower.errorMatrix()<<endl;
00350 
00351   if(aShower.getSize()>0) {
00352     os<<"Fraction Map: "<<endl;
00353     for(pFractionMap=aShower.Begin();
00354         pFractionMap!=aShower.End();
00355         pFractionMap++){
00356       os<< (pFractionMap->second);
00357     }
00358   }
00359 
00360   RecEmcFractionMap fracMap = aShower.getFractionMap3x3();
00361   if(fracMap.size()>0) {
00362     os<<"Fraction Map 3x3: "<<endl; 
00363     for(ciFractionMap3x3=fracMap.begin();
00364         ciFractionMap3x3!=fracMap.end();
00365         ciFractionMap3x3++){
00366       os<< (ciFractionMap3x3->second);
00367     }
00368   }
00369 
00370   fracMap = aShower.getFractionMap5x5();
00371   if(fracMap.size()>0) {
00372     os<<"Fraction Map 5x5: "<<endl; 
00373     for(ciFractionMap5x5=fracMap.begin();
00374         ciFractionMap5x5!=fracMap.end();
00375         ciFractionMap5x5++){
00376       os<< (ciFractionMap5x5->second);
00377     }
00378   }
00379 
00380   os<<endl;
00381 
00382   return os;
00383 }
00384 

Generated on Tue Nov 29 22:58:17 2016 for BOSS_7.0.2 by  doxygen 1.4.7