Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ANtpSnarlManipulator.cxx

Go to the documentation of this file.
00001 
00002 //$Id: ANtpSnarlManipulator.cxx,v 1.2 2005/05/04 16:09:58 minoscvs Exp $
00003 //
00004 //ANtpSnarlManipulator.cxx
00005 //
00006 //B. Rebel 10/2004
00008 
00009 #include "AnalysisNtuples/Module/ANtpSnarlManipulator.h"
00010 #include "MessageService/MsgService.h"
00011 
00012 #include <cassert>
00013 #include <algorithm>
00014 
00015 ClassImp(ANtpSnarlManipulator)
00016 
00017 CVSID("$Id: ANtpSnarlManipulator.cxx,v 1.2 2005/05/04 16:09:58 minoscvs Exp $");
00018 
00019 //-------------------------------------------------------------------
00020 ANtpSnarlManipulator::ANtpSnarlManipulator() :
00021   fEventArray(0),
00022   fTrackArray(0),
00023   fShowerArray(0),
00024   fStripArray(0),
00025   fUseLengthTrack(0),
00026   fUsePHShower(0),
00027   fUseNPlanesShower(0),
00028   fUsePHTrack(0),
00029   fUseNPlanesTrack(0)
00030 {
00031     
00032   MSG("ANtpSnarlManipulator", Msg::kDebug) << "ANtpSnarlManipulator::Constructor" << endl;
00033   
00034 }
00035 
00036 //-------------------------------------------------------------------
00037 void ANtpSnarlManipulator::Initialize(TClonesArray  *eventArray, TClonesArray *trackArray, 
00038                                       TClonesArray *showerArray, TClonesArray *stripArray)
00039 {
00040   fEventArray = eventArray;
00041   fTrackArray = trackArray;
00042   fShowerArray = showerArray;
00043   fStripArray = stripArray;
00044 
00045   MSG("ANtpSnarlManipulator", Msg::kDebug) << "ANtpSnarlManipulator::Constructor" << endl;    
00046 }
00047 
00048 
00049 //----------------------------------------------------------------------
00050 ANtpSnarlManipulator::~ANtpSnarlManipulator()
00051 { 
00052   MSG("ANtpSnarlManipulator", Msg::kDebug) << "ANtpSnarlManipulator::Destructor" << endl; 
00053 }
00054 
00055 //------------------------------------------------------------------------
00056 NtpSREvent *ANtpSnarlManipulator::GetEvent(Int_t index) 
00057 {
00058   NtpSREvent *ntpEvent = 0;
00059       
00060   if(index < fEventArray->GetLast()+1)
00061     ntpEvent = dynamic_cast<NtpSREvent *>(fEventArray->At(index));
00062   
00063   return ntpEvent;
00064 }
00065 
00066 //------------------------------------------------------------------------
00067 NtpSRTrack *ANtpSnarlManipulator::GetTrack(Int_t index) 
00068 {
00069   NtpSRTrack *ntpTrack = 0;
00070       
00071   if(index < fTrackArray->GetLast()+1)
00072     ntpTrack = dynamic_cast<NtpSRTrack *>(fTrackArray->At(index));
00073   
00074   return ntpTrack;
00075 }
00076 
00077 //------------------------------------------------------------------------
00078 NtpSRShower *ANtpSnarlManipulator::GetShower(Int_t index) 
00079 {
00080   NtpSRShower *ntpShower = 0;
00081 
00082   if(index < fShowerArray->GetLast()+1)
00083     ntpShower = dynamic_cast<NtpSRShower *>(fShowerArray->At(index));
00084   
00085   return ntpShower;
00086 }
00087 
00088 //-------------------------------------------------------------------------
00089 NtpSRTrack *ANtpSnarlManipulator::GetPrimaryTrack() 
00090 {
00091   NtpSRTrack *primaryTrack = 0;
00092   NtpSRTrack *ntpTrack = 0;
00093 
00094   for(Int_t i = 0; i < fTrackArray->GetLast()+1; ++i){
00095     
00096     ntpTrack = dynamic_cast<NtpSRTrack *>(fTrackArray->At(i));
00097     
00098     //if you dont already have a candidate, make this track it
00099     if(!primaryTrack) primaryTrack = ntpTrack;
00100     
00101     //check to see if this track is better than the best so far.  the fUseXXX
00102     //variables are set to 1. or 0. depending on if they should be used to 
00103     //determine which is the primary track
00104     if(ntpTrack->ds > primaryTrack->ds*fUseLengthTrack
00105        && ntpTrack->plane.n > primaryTrack->plane.n*fUseNPlanesTrack
00106        && ntpTrack->ph.sigmap > primaryTrack->ph.sigmap*fUsePHTrack)
00107       primaryTrack = ntpTrack;
00108     
00109   }//end loop over tracks in the event
00110   
00111   return primaryTrack;
00112   
00113 }
00114 
00115 //-------------------------------------------------------------------------
00116 NtpSRShower *ANtpSnarlManipulator::GetPrimaryShower() 
00117 {
00118   NtpSRShower *ntpShower = 0;
00119   NtpSRShower *primaryShower = 0;
00120   
00121   for(Int_t i = 0; i < fShowerArray->GetLast()+1; ++i){
00122     
00123     ntpShower = dynamic_cast<NtpSRShower *>(fShowerArray->At(i));
00124     
00125     //if you dont already have a candidate, make this Shower it
00126     if(!primaryShower) primaryShower = ntpShower;
00127     
00128     //check to see if this Shower is better than the best so far.  the fUseXXX
00129     //variables are set to 1. or 0. depending on if they should be used to 
00130     //determine which is the primary Shower
00131     if(ntpShower->plane.n > primaryShower->plane.n*fUseNPlanesShower
00132        && ntpShower->ph.sigmap > primaryShower->ph.sigmap*fUsePHShower)
00133       primaryShower = ntpShower;
00134     
00135   }//end loop over Showers in the event
00136   
00137   return primaryShower;
00138   
00139 }
00140 
00141 //------------------------------------------------------------------------
00142 NtpSRStrip *ANtpSnarlManipulator::GetStrip(Int_t index) 
00143 {
00144   NtpSRStrip *ntpStrip = 0;
00145 
00146   if(index < fStripArray->GetLast()+1)
00147     ntpStrip = dynamic_cast<NtpSRStrip *>(fStripArray->At(index));
00148   
00149   return ntpStrip;
00150 }
00151 
00152 //--------------------------------------------------------------------------
00153 void ANtpSnarlManipulator::SetPrimaryTrackCriteria(Int_t useNPlanes, Int_t useLength,
00154                                                    Int_t usePH)
00155 {
00156   fUseLengthTrack = useLength;
00157   fUseNPlanesTrack = useNPlanes;
00158   fUsePHTrack = usePH;
00159   
00160   return;
00161 }
00162 
00163 //--------------------------------------------------------------------------
00164 void ANtpSnarlManipulator::SetPrimaryShowerCriteria(Int_t useNPlanes, Int_t usePH)
00165 {
00166   fUseNPlanesShower = useNPlanes;
00167   fUsePHShower = usePH;
00168   
00169   return;
00170 }

Generated on Mon Feb 15 11:06:22 2010 for loon by  doxygen 1.3.9.1