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

ClusterKG.cxx

Go to the documentation of this file.
00001 
00002 // Cluster3D package
00003 //
00004 // ClusterKG.cxx
00005 //
00006 // ClusterKG - a single cluster
00007 //
00008 // Author:  Katarzyna Grzelak K.Grzelak1@physics.ox.ac.uk
00009 //
00011 
00012 #include "Cluster3D/ClusterKG.h"
00013 #include "Algorithm/AlgConfig.h"
00014 #include "MessageService/MsgService.h" // needed for CVS
00015 #include "Cluster3D/StripKG.h"
00016 #include "Cluster3D/CellKG.h"
00017 #include "Cluster3D/StripListKG.h"
00018 #include "Cluster3D/CellListKG.h"
00019 
00020 ClassImp(ClusterKG)
00021 
00022 CVSID("$Id: ClusterKG.cxx,v 1.3 2007/03/01 17:44:17 rhatcher Exp $");
00023 
00024 ClusterKG::ClusterKG():energyRaw(0.),energyPe(0.),energyGeV(0.),nbOfAmbStrips(0){
00025 //
00026 //  Purpose:  Default constructor
00027 //
00028   MSG("Cluster3D", Msg::kVerbose)
00029     << "Default constructor " << endl;
00030 }
00031 
00032 //............................................................................
00033 
00034 Bool_t ClusterKG::Create(AlgConfig &ac, StripListKG &all1,  CellListKG &all2, const std::vector<Int_t> &row){
00035 //
00036 //  Purpose: Create a single cluster 
00037 //
00038 //  Arguments:
00039 //
00040 //  Return: 
00041 //
00042 //  Contact:   K.Grzelak1@physics.ox.ac.uk
00043 //
00044 // //  Program Notes:-
00045 //  =============
00046 // Finally cluster should consist of strips, not cells  
00047 
00048   Bool_t bigcluster = true;
00049   stpindexes.clear();
00050 
00051   //
00052   // Make sure that cluster consists of unique strips only
00053   //
00054   for(UInt_t jj=0; jj<row.size(); ++jj){
00055       Int_t imult1=0;
00056       Int_t imult2=0;
00057 
00058       Int_t istp1 = all1.GetStripIndex(all2.GetCellElem1(row[jj])); 
00059       Int_t istp2 = all1.GetStripIndex(all2.GetCellElem2(row[jj]));          
00060 
00061       // "Long" cells have elem1 = elem2
00062 
00063       for(UInt_t ll=0; ll<stpindexes.size(); ++ll){
00064         Int_t istp = all1.GetStripIndex(stpindexes[ll]); 
00065         if(istp1 == istp){
00066           ++imult1;
00067         }
00068         if(istp2 == istp){
00069           ++imult2;
00070         }
00071       }
00072       if(imult1==0){
00073         Int_t ind = all2.GetCellElem1(row[jj]) ;
00074         stpindexes.push_back(ind);
00075         all1.SetStripAmbiguity(ind); 
00076       }
00077       // Check if it was not a "long" cell
00078       if(imult2==0 && istp1 != istp2){
00079         Int_t ind = all2.GetCellElem2(row[jj]) ;
00080         stpindexes.push_back(ind);
00081         all1.SetStripAmbiguity(ind); 
00082       }          
00083   } 
00084 
00085   // Set cluster energy
00086   SetEnergy(all1);
00087   // Check how many strips belong to other clusters as well
00088   FindNbOfAmbStrips(all1);
00089 
00090   MSG("Cluster3D", Msg::kDebug)
00091       << " Cluster3D create "
00092       << "energyRaw= " << energyRaw 
00093       << "energyPe= " << energyPe << endl;
00094 
00095   const Int_t minStp = ac.GetInt("minClustStp");
00096   const Int_t minAmbStp = ac.GetInt("minClustAmbStp");
00097   const Double_t minClustPe = ac.GetDouble("minClustPe");
00098 
00099   MSG("Cluster3D", Msg::kDebug)
00100       << " Cluster3D create "
00101       << " nbOfAmbStrips= " << nbOfAmbStrips
00102       << "stpindexes.size()= " << stpindexes.size() << endl;
00103 
00104   //
00105   // How many strips belongs ONLY to this cluster ?
00106   // If less than minAmbStp, than it is not an interesting  cluster 
00107   //
00108 
00109   if(((Int_t)stpindexes.size() - nbOfAmbStrips) < minAmbStp){
00110     bigcluster=false;
00111   }
00112 
00113   //
00114   // Is it simply a big or a small cluster ?
00115   // If total number of strips is less than  minSt
00116   // or total pulse height is less than minClustPe
00117   // than again -> it is not an interesting cluster  
00118   //
00119 
00120   if((Int_t)stpindexes.size() < minStp || energyPe < minClustPe){
00121     bigcluster=false; 
00122   } 
00123 
00124   for(UInt_t ll=0; ll<stpindexes.size(); ++ll){
00125       MSG("Cluster3D", Msg::kDebug)
00126         << " Cluster3D create "
00127         << "all1.GetStripXTalk(stpindexes[ll])= " 
00128         << all1.GetStripXTalk(stpindexes[ll])
00129         << "all1.GetStripAmbiguity(stpindexes[ll])= " 
00130         << all1.GetStripAmbiguity(stpindexes[ll])
00131         << "all1.GetStripStrip(stpindexes[ll])= " 
00132         << all1.GetStripStrip(stpindexes[ll])
00133         << "all1.GetStripPlane(stpindexes[ll])= " 
00134         << all1.GetStripPlane(stpindexes[ll]) << endl;
00135   }
00136   return bigcluster;
00137 
00138 }
00139 
00140 //............................................................................
00141 
00142 void ClusterKG::SetEnergy(StripListKG &all1){
00143 //
00144 //  Purpose: Calculate energy of a cluster  
00145 //
00146 //  Arguments:
00147 //
00148 //  Return: 
00149 //
00150 //  Contact:   K.Grzelak1@physics.ox.ac.uk
00151 //
00152 // //  Program Notes:-
00153 //  =============
00154 
00155   energyRaw=0.0;
00156   energyPe=0.0;
00157   
00158   for(UInt_t i=0; i<stpindexes.size(); ++i){
00159     energyRaw=energyRaw+all1.GetStripRawE(stpindexes[i])
00160       +all1.GetStripRawW(stpindexes[i]);
00161     energyPe=energyPe+all1.GetStripPeE(stpindexes[i])
00162       +all1.GetStripPeW(stpindexes[i]);
00163   }
00164 }
00165 
00166 //............................................................................
00167 
00168 Double_t ClusterKG::GetEnergy(Int_t whatKind) const{
00169 //
00170 //  Purpose: Returns energy of a cluster 
00171 //
00172 //  Arguments:
00173 //
00174 //  Return: 
00175 //
00176 //  Contact:   K.Grzelak1@physics.ox.ac.uk
00177 //
00178 // //  Program Notes:-
00179 //  =============
00180 // 
00181 
00182   if(whatKind==0){
00183     return energyRaw;
00184   }
00185   else if(whatKind==1){
00186     return energyPe;
00187   }
00188   else if(whatKind==2){
00189     return energyGeV;
00190   }
00191   else{
00192     return energyPe;
00193   }
00194 
00195   return energyPe;
00196 }
00197 
00198 //............................................................................
00199 
00200 void ClusterKG::FindNbOfAmbStrips(StripListKG &all1){
00201 //
00202 //  Purpose: Find number of strips which belongs not only to this cluster  
00203 //
00204 //  Arguments: 
00205 //
00206 //  Return: 
00207 //
00208 //  Contact:   K.Grzelak1@physics.ox.ac.uk
00209 //
00210 //  Program Notes:-
00211 //  =============
00212 
00213   for(UInt_t i=0; i<stpindexes.size(); ++i){
00214     if(all1.GetStripAmbiguity(stpindexes[i])>1){
00215       nbOfAmbStrips=nbOfAmbStrips+1;
00216     } 
00217   }
00218 }
00219 
00220 //............................................................................
00221 
00222 Int_t ClusterKG::GetNbOfAmbStrips() const{
00223 //
00224 //  Purpose: Return number of strips which belongs not only to this cluster 
00225 //
00226 //  Arguments:
00227 //
00228 //  Return: 
00229 //
00230 //  Contact:   K.Grzelak1@physics.ox.ac.uk
00231 //
00232 //  Program Notes:-
00233 //  =============
00234 // 
00235 
00236   return nbOfAmbStrips;
00237 }
00238 
00239 

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