Particle3D Class Reference

#include <Particle3D.h>

List of all members.

Public Types

enum  EParticle3DType {
  other = 0, electron = 11, muon = 13, proton = 2212,
  photon = 22, neutron = 2112
}
typedef enum
Particle3D::EParticle3DType 
Particle3DType

Public Member Functions

 Particle3D ()
virtual ~Particle3D ()
void ResetHits ()
void SetEnergy (int ichain, int ichainhit, int inview, double energy)
double GetNextEnergy (int chain, int chainhit, int inview)
double GetPreviousEnergy (int chain, int chainhit, int inview)
void SetShared (int ichain, int ichainhit)
void UnsetShared (int ichain, int ichainhit)
void finalize ()
int ShareLocked (int ichain, int ichainhit)
void add_to_back (double iu, double iv, double iz, double ie, int chain, int chainhit, int view, double irms_t)
int hasShared ()
void Clean ()

Public Attributes

std::vector< double > u
std::vector< double > v
std::vector< double > z
std::vector< double > e
std::vector< int > chain
std::vector< int > chainhit
std::vector< int > view
std::vector< double > rms_t
std::vector< int > shared
std::vector< int > lockshared
std::vector< ParticleTypetypes
double start_u
double end_u
double start_v
double end_v
double start_z
double end_z
double sum_e
double muonfrac
double theta
double phi
double emfit_a
double emfit_b
double emfit_e0
double emfit_a_err
double emfit_b_err
double emfit_e0_err
double emfit_prob
double emfit_chisq
double emfit_ndf
double pred_e_a
double pred_g_a
double pred_b
double pred_e0
double pred_e_chisq
double pred_e_ndf
double pred_g_chisq
double pred_g_ndf
double pre_over
double pre_under
double post_over
double post_under
double calibrated_energy
double avg_rms_t
double pp_chisq
double pp_p
Particle3DType particletype
int entries
int numshared
int pp_ndf
int pp_igood
double cmp_chisq
int cmp_ndf
double peakdiff

Private Attributes

double muon_threshold_max
double muon_threshold_min
int muon_min_hits
int muonlike

Detailed Description

Definition at line 11 of file Particle3D.h.


Member Typedef Documentation


Member Enumeration Documentation

Enumerator:
other 
electron 
muon 
proton 
photon 
neutron 

Definition at line 20 of file Particle3D.h.

00021                 {
00022                         other=0,
00023                         electron=11,
00024                         muon=13,
00025                         proton=2212,
00026                         photon=22,
00027                         neutron=2112
00028                 }Particle3DType;


Constructor & Destructor Documentation

Particle3D::Particle3D (  ) 

Definition at line 6 of file Particle3D.cxx.

References MuELoss::e, and other.

00007 {
00008 
00009         start_u=0.0;
00010         end_u=0.0;
00011         start_v=0.0;
00012         end_v=0.0;
00013         start_z=10000.0;
00014         end_z=0.0;
00015         particletype=Particle3D::other;
00016         sum_e=0.0;
00017         muonfrac=0.0;
00018         entries=0;
00019         numshared=0;
00020         theta=0;
00021         phi=0;
00022         emfit_a=0;
00023         emfit_b=0;
00024         emfit_e0=0;
00025         emfit_a_err=0;
00026         emfit_b_err=0;
00027         emfit_e0_err=0;
00028         emfit_prob=0;
00029         emfit_chisq=0;
00030         emfit_ndf=0;
00031         calibrated_energy=0;
00032         muonlike=0;
00033         avg_rms_t=0;
00034 
00035 
00036 
00037 
00038 
00039         u.clear();
00040         v.clear();
00041         z.clear();
00042         e.clear();
00043         chain.clear();
00044         chainhit.clear();
00045         shared.clear();
00046         lockshared.clear();
00047         types.clear();
00048         rms_t.clear();
00049         
00050         muon_threshold_max=2.5;
00051         muon_threshold_min=0.01;
00052         muon_min_hits=2; 
00053         
00054         cmp_chisq=0;
00055         cmp_ndf = 0;
00056         peakdiff=0;     
00057                 
00058         pred_e_a=0;
00059         pred_g_a=0;
00060         pred_b=0;
00061         pred_e0=0;
00062         pred_e_chisq=0;
00063         pred_e_ndf=0;
00064         pred_g_chisq=0;
00065         pred_g_ndf=0;
00066         
00067         post_over=0;
00068         post_under=0;
00069         pre_over=0;
00070         pre_under=0;    
00071         
00072         
00073         pp_chisq=0;
00074         pp_ndf=0;
00075         pp_igood=0;
00076         pp_p=0; 
00077         
00078         
00079 }

Particle3D::~Particle3D (  )  [virtual]

Definition at line 81 of file Particle3D.cxx.

References chain, chainhit, e, lockshared, rms_t, shared, types, u, v, and z.

00082 {
00083         u.clear();
00084         v.clear();
00085         z.clear();
00086         e.clear();
00087         chain.clear();
00088         chainhit.clear();
00089         shared.clear();
00090         lockshared.clear();
00091         types.clear();
00092         rms_t.clear();
00093 }


Member Function Documentation

void Particle3D::add_to_back ( double  iu,
double  iv,
double  iz,
double  ie,
int  chain,
int  chainhit,
int  view,
double  irms_t 
)

Definition at line 372 of file Particle3D.cxx.

References chain, chainhit, e, end_u, end_v, end_z, entries, lockshared, muon_min_hits, muon_threshold_min, muonfrac, muonlike, rms_t, shared, start_u, start_v, start_z, sum_e, u, v, view, and z.

Referenced by Clean(), Finder::FindNeutrons(), Finder::Make3DParticle(), PrimaryShowerFinder::MakeParticle3D(), LongMuonFinder::MakeParticle3D(), Finder::StripMuon(), and Finder::StripMuon1().

00373 {
00374 
00375         sum_e+=ie;
00376         
00377         
00378         entries++;
00379 
00380         u.push_back(iu);
00381         v.push_back(iv);
00382         z.push_back(iz);
00383         e.push_back(ie);
00384         shared.push_back(0);
00385         lockshared.push_back(0);
00386         chain.push_back(ichain);
00387         chainhit.push_back(ichainhit);
00388         view.push_back(iview);
00389         rms_t.push_back(irms_t);
00390         
00391         if(ie < muon_threshold_max && ie > muon_threshold_min)
00392         {
00393                 muonlike++;
00394                 if (muon_min_hits <= entries ) muonfrac = (double)muonlike / (double)entries;
00395         }
00396         
00397 
00398         
00399         if(start_z > iz)
00400         {
00401                 start_z=iz;
00402                 start_u=iu;
00403                 start_v=iv;
00404 
00405         }
00406         
00407         if(end_z < iz)
00408         {
00409                 end_z=iz;
00410                 end_u=iu;
00411                 end_v=iv;
00412 
00413         }
00414 
00415 
00416 }

void Particle3D::Clean (  ) 

Definition at line 96 of file Particle3D.cxx.

References add_to_back(), chain, chainhit, e, finalize(), lockshared, numshared, ResetHits(), rms_t, shared, u, v, view, and z.

Referenced by Finder::FinalizeParticles3D().

00097 {
00098 
00099 //copy vector information
00100                 std::vector<double>iu=u;
00101                 std::vector<double>iv=v;                
00102                 std::vector<double>iz=z;
00103                 std::vector<double>ie=e;
00104                 std::vector<int>ichain=chain;           
00105                 std::vector<int>ichainhit=chainhit;     
00106                 std::vector<int>iview=view;
00107                 std::vector<double>irms_t=rms_t;
00108                 
00109                 std::vector<int>ishared=shared;  
00110                 std::vector<int>ilockshared=lockshared; 
00111 
00112 //clear existing information
00113         ResetHits();
00114 
00115 
00116 //add back entries with >0 e
00117         
00118         for(unsigned int i=0;i<iu.size();i++)
00119         {
00120                 if(ie[i]<0.01)continue;
00121                 add_to_back( iu[i],  iv[i],  iz[i],  ie[i], ichain[i],  ichainhit[i], iview[i],  irms_t[i]);
00122                 shared[shared.size()-1]=ishared[i];
00123                 lockshared[lockshared.size()-1]=ilockshared[i];
00124                 if(ishared[i])numshared++;
00125         
00126         }
00127         finalize();
00128         
00129 //      printf("cleaned particle now has %d entries\n",entries);
00130 }

void Particle3D::finalize (  ) 

Definition at line 345 of file Particle3D.cxx.

References avg_rms_t, e, entries, muon_min_hits, muon_threshold_max, muon_threshold_min, muonfrac, muonlike, rms_t, and sum_e.

Referenced by Clean(), Finder::Make3DParticle(), PrimaryShowerFinder::MakeParticle3D(), and LongMuonFinder::MakeParticle3D().

00346 {
00347         double etot=0;
00348         double rms_t_e=0;
00349         
00350         muonlike=0;
00351         for(int i=0;i<entries;i++)
00352         {
00353                 rms_t_e+=e[i]*rms_t[i];
00354                 etot+=e[i];
00355                 
00356                 if(e[i] < muon_threshold_max && e[i] > muon_threshold_min)
00357                 {
00358                         muonlike++;
00359                 }
00360         
00361                 
00362         }
00363         
00364         if (muon_min_hits <= entries ) muonfrac = (double)muonlike / (double)entries;
00365         
00366         if(etot>0)
00367         avg_rms_t = rms_t_e/etot;
00368         sum_e=etot;
00369 
00370 }

double Particle3D::GetNextEnergy ( int  chain,
int  chainhit,
int  inview 
)

Definition at line 230 of file Particle3D.cxx.

References chain, chainhit, e, view, and z.

00231 {
00232         double energy =0;
00233         
00234         //find it
00235         int idx = -1;
00236         for(unsigned int i=0;i<z.size();i++)
00237         {
00238                 if(chain[i]==ichain && chainhit[i]==ichainhit)
00239                 {
00240                         idx=i;
00241                         break;
00242                 }
00243         
00244         }
00245         
00246         //first look in other view
00247         for(unsigned int i=idx+1;i<z.size();i++)
00248         {
00249                 if(view[i]==inview)
00250                 {
00251                         energy=e[i];
00252                         break;
00253                 }
00254         }
00255         
00256         inview=inview == 2 ? 3 :2;
00257         //then look in this view
00258         if(energy==0)
00259         for(unsigned int i=idx+1;i<z.size();i++)
00260         {
00261                 if(view[i]==inview)
00262                 {
00263                         energy=e[i];
00264                         break;
00265                 }
00266         }
00267         
00268         
00269         
00270         return energy;
00271 }

double Particle3D::GetPreviousEnergy ( int  chain,
int  chainhit,
int  inview 
)

Definition at line 273 of file Particle3D.cxx.

References chain, chainhit, e, view, and z.

00274 {
00275         double energy =0;
00276         
00277         //find it
00278         int idx = -1;
00279         for(unsigned int i=0;i<z.size();i++)
00280         {
00281                 if(chain[i]==ichain && chainhit[i]==ichainhit)
00282                 {
00283                         idx=i;
00284                         break;
00285                 }
00286         
00287         }
00288         
00289         for(int i=idx-1;i>-1;i--)
00290         {
00291                 if(view[i]==inview)
00292                 {
00293                         energy=e[i];
00294                         break;
00295                 }
00296         }
00297         
00298         inview=inview == 2 ? 3 :2;
00299         //then look in this view
00300         if(energy==0)
00301                 for(int i=idx-1;i>-1;i--)
00302         {
00303                 if(view[i]==inview)
00304                 {
00305                         energy=e[i];
00306                         break;
00307                 }
00308         }
00309         
00310         return energy;
00311 }

int Particle3D::hasShared (  )  [inline]

Definition at line 122 of file Particle3D.h.

References numshared.

00122 {return numshared;};

void Particle3D::ResetHits (  ) 

Definition at line 132 of file Particle3D.cxx.

References avg_rms_t, chain, chainhit, cmp_chisq, cmp_ndf, e, emfit_a, emfit_a_err, emfit_b, emfit_b_err, emfit_chisq, emfit_e0, emfit_e0_err, emfit_ndf, emfit_prob, end_u, end_v, end_z, entries, lockshared, muonfrac, muonlike, numshared, peakdiff, pred_b, pred_e0, pred_e_a, pred_e_chisq, pred_e_ndf, pred_g_a, pred_g_chisq, pred_g_ndf, rms_t, shared, start_u, start_v, start_z, sum_e, u, v, view, and z.

Referenced by Clean().

00133 {
00134         u.clear();
00135         v.clear();
00136         z.clear();
00137         e.clear();
00138         chain.clear();
00139         chainhit.clear();
00140         shared.clear();
00141         lockshared.clear();
00142         rms_t.clear();
00143         view.clear();
00144         
00145         start_u=0;
00146         end_u=0;
00147         start_v =0;
00148         end_v =0;
00149         start_z = 10000.0;
00150         end_z = 0;
00151  
00152         sum_e=0.0;
00153         muonfrac=0.0;
00154         entries=0;
00155         muonlike=0;
00156         avg_rms_t=0;
00157         numshared=0;
00158         
00159         
00160         pred_e_a=0;
00161         pred_g_a=0;
00162         pred_b=0;
00163         pred_e0=0;
00164         pred_e_chisq=0;
00165         pred_e_ndf=0;
00166         pred_g_chisq=0;
00167         pred_g_ndf=0;   
00168         
00169         cmp_chisq=0;
00170         cmp_ndf = 0;
00171         peakdiff=0;     
00172                 
00173                 
00174                 
00175         emfit_a=0;
00176         emfit_b=0;
00177         emfit_e0=0;
00178         emfit_a_err=0;
00179         emfit_b_err=0;
00180         emfit_e0_err=0;
00181         emfit_prob=0;
00182         emfit_chisq=0;
00183         emfit_ndf=0;
00184                 
00185                                 
00186 }

void Particle3D::SetEnergy ( int  ichain,
int  ichainhit,
int  inview,
double  energy 
)

Definition at line 315 of file Particle3D.cxx.

References chain, chainhit, e, view, and z.

00316 {
00317         
00318         //find it
00319         for(unsigned int i=0;i<z.size();i++)
00320         {
00321                 if(chain[i]==ichain && chainhit[i]==ichainhit && view[i]==inview)
00322                 {
00323                         e[i]=energy;
00324                         return;
00325                 }
00326         
00327         }
00328 }

void Particle3D::SetShared ( int  ichain,
int  ichainhit 
)

Definition at line 188 of file Particle3D.cxx.

References chain, chainhit, numshared, shared, and z.

00189 {
00190         //find it
00191         int idx = -1;
00192         for(unsigned int i=0;i<z.size();i++)
00193         {
00194                 if(chain[i]==ichain && chainhit[i]==ichainhit)
00195                 {
00196                         idx=i;
00197                         break;
00198                 }
00199         
00200         }
00201         if(idx<0)return;
00202         if(shared[idx]==0)numshared++;
00203         shared[idx]=1;
00204 
00205 }

int Particle3D::ShareLocked ( int  ichain,
int  ichainhit 
)

Definition at line 330 of file Particle3D.cxx.

References chain, chainhit, lockshared, and z.

00331 {
00332         for(unsigned int i=0;i<z.size();i++)
00333         {
00334                 if(chain[i]==ichain && chainhit[i]==ichainhit)
00335                 {
00336                         return lockshared[i];
00337                         
00338                 }
00339         
00340         }
00341         return -1;
00342 }

void Particle3D::UnsetShared ( int  ichain,
int  ichainhit 
)

Definition at line 207 of file Particle3D.cxx.

References chain, chainhit, numshared, shared, and z.

00208 {
00209         //find it
00210         int idx = -1;
00211         for(unsigned int i=0;i<z.size();i++)
00212         {
00213                 if(chain[i]==ichain && chainhit[i]==ichainhit)
00214                 {
00215                         idx=i;
00216                         break;
00217                 }
00218         
00219         }
00220         if(idx<0)return;
00221         if(shared[idx]==1)numshared--;
00222         shared[idx]=0;
00223 
00224 
00225 }


Member Data Documentation

std::vector<int> Particle3D::chain
std::vector<int> Particle3D::chainhit
std::vector<double> Particle3D::e
std::vector<int> Particle3D::lockshared

Definition at line 141 of file Particle3D.h.

Referenced by add_to_back(), and finalize().

Definition at line 139 of file Particle3D.h.

Referenced by finalize().

Definition at line 140 of file Particle3D.h.

Referenced by add_to_back(), and finalize().

int Particle3D::muonlike [private]

Definition at line 142 of file Particle3D.h.

Referenced by add_to_back(), finalize(), and ResetHits().

Definition at line 100 of file Particle3D.h.

Referenced by Clean(), hasShared(), p3dsharedsort(), ResetHits(), SetShared(), and UnsetShared().

Definition at line 61 of file Particle3D.h.

Referenced by ParticlesAna::ana(), MRCCAna::ana(), and Finder::FinalizeParticles3D().

std::vector<double> Particle3D::rms_t
std::vector<int> Particle3D::shared

Definition at line 60 of file Particle3D.h.

Referenced by ParticlesAna::ana(), MRCCAna::ana(), and Finder::FinalizeParticles3D().

std::vector<double> Particle3D::u
std::vector<double> Particle3D::v
std::vector<int> Particle3D::view
std::vector<double> Particle3D::z

The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1