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

VtxClusterList.cxx

Go to the documentation of this file.
00001 
00002 //                      VtxClusterList.cxx  -  description
00003 //                             -------------------
00004 //    begin                : Thu June 3 2004
00005 //    copyright            : (C) 2004 by Joshua Boehm
00006 //    email                : boehm@physics.harvard.edu
00007 //    Last Modified        : August 10, 2004
00008 //    VtxClusterList is a reconstruction class used by VertexFinder
00009 //    to organize and determine the vertex position in z.
00011 
00012 #include "VtxClusterList.h"
00013 #include "MessageService/MsgService.h"
00014 
00015 //Inline Functions Defined in VtxClusterList.h
00016 //   Int_t Size() {return list.size();};  //Returns the number of groups
00017 //   Int_t Size(int i) {return list[i].Size();}; Returns size of cluster i
00018 //   void Clear() {list.clear(); };    //Clears the group listing
00019 
00020                                                                                 
00021 CVSID("$Id: VtxClusterList.cxx,v 1.3 2006/12/01 20:30:53 rhatcher Exp $");
00022 
00023 
00024 Float_t VtxClusterList::GetTotalEventEnergy()
00025 {
00026   Float_t total = 0;
00027   for(Int_t i = 0; i < Size(); i++) total += list[i].GetTotalEnergy();
00028 
00029   return total;
00030 }
00031 
00032 VtxClusterList::VtxClusterList(vector<Float_t> &lenepl, Int_t N_PLANES, Float_t kNoiseCut)
00033 {
00034   bool inGroup = false;
00035   Float_t binEnergy = 0;
00036   Float_t prevBinEnergy = -1;
00037 
00038   for(Int_t plane = 0; plane < N_PLANES; plane++)
00039   {
00040      binEnergy = lenepl[plane];
00041      if(binEnergy > kNoiseCut)
00042      {
00043         if(inGroup){
00044            list[TMath::Max(Size()-1, 0)].AddPlane(plane, binEnergy);
00045         }else{
00046             inGroup = true;
00047             VtxCluster newCluster(plane, binEnergy);
00048             list.push_back(newCluster);
00049         }
00050      }else{
00051         if(inGroup && prevBinEnergy < kNoiseCut) inGroup = false;
00052      }
00053        
00054      prevBinEnergy = binEnergy;
00055   }
00056 
00057   if(Size() == 0){
00058     MSG("VtxClusterList", Msg::kError)
00059           <<"No Clusters could be formed"<<endl;
00060   
00061     for(int i = 0; i < N_PLANES; i++)
00062     {
00063        MSG("VtxClusterList", Msg::kError)
00064            <<"Plane "<<i<<" of "<<N_PLANES<<": "<<lenepl[i]<<endl;
00065     }
00066   }
00067 
00068 }
00069 
00070 VtxClusterList::~VtxClusterList()
00071 {
00072   Clear();
00073 }
00074 
00075 void VtxClusterList::Report()
00076 {
00077   for(Int_t i = 0; i < Size(); i++){
00078     cout<<i<<"   "<<list[i].Size()<<"  "<<list[i].GetFirstPlane()
00079         <<"    "<<list[i].GetLastPlane()<<endl;
00080     for(Int_t j = 0; j < list[i].Size(); j++)
00081         cout<<j<<"  "<<list[i].GetPlane(j)<<"  "<<list[i].GetEnergy(j)<<endl;
00082   }
00083 }
00084 
00085 Int_t VtxClusterList::RisingEdgeCandidate()
00086 {
00087    //First go and check for strong rising edges
00088    Int_t candidate = -1;
00089    bool found = false;
00090  
00091    for(Int_t i = 0; i < Size() && !found; i++)
00092    {
00093       if(list[i].HasRisingEdge())
00094       {
00095          if(list[i].Size() > 15 || list[i].GetTotalEnergy() > 200)//i0.5*GetTotalEventEnergy())
00096          {
00097            candidate = i;
00098            found = true;
00099          }
00100 
00101          Float_t subTotal = 0;
00102          for(Int_t j = 0; j < i; j++)
00103               subTotal += list[j].GetTotalEnergy();
00104  
00105          if(subTotal/GetTotalEventEnergy() > 0.5){
00106              candidate = -1;
00107              found = true;  //What i have found though is this isnt
00108                             //   meant to be a rising edge system
00109              continue;
00110          }
00111          if(candidate == -1) candidate = i;
00112          else{
00113            if(list[i].Size() > 4 && 
00114                list[i].GetTotalEnergy() > list[candidate].GetTotalEnergy())
00115               candidate = i;
00116          }
00117       }
00118    }
00119 
00120    return candidate;
00121 }
00122 
00123 Int_t VtxClusterList::Process()
00124 {
00125    if(Size() == 0) return -1;
00126 
00127    bool debug = false;
00128    Int_t maxGroupSize = 0;
00129    Int_t candidate = -1;
00130    Int_t candPlane = -1;
00131    Int_t startGuess = -1;
00132    for(Int_t i = 0; i < Size(); i++)
00133      maxGroupSize = TMath::Max(maxGroupSize, list[i].Size());
00134 
00135    candidate = RisingEdgeCandidate();
00136    
00137    if(debug) cout<<candidate<<endl;
00138      
00139    if(candidate != -1){
00140      startGuess = list[candidate].GetEdgeTrigger();
00141    }else {
00142      candidate = 0;
00143      for(Int_t i = 0; i < Size(); i++)
00144      {
00145         Float_t recent = list[i].GetEnergy(list[i].GetNCTrigger());
00146         Float_t old = list[candidate].GetEnergy(list[candidate].GetNCTrigger());
00147         if(debug) cout<<old<<"    "<<recent<<"    "<<endl;        
00148    
00149         Float_t subTotal = 0;
00150         for(Int_t j = 0; j < i; j++)
00151            subTotal += list[j].GetTotalEnergy();
00152 
00153         //We cant have  70% of the energy backscattered
00154         if(recent > 2*old && subTotal/GetTotalEventEnergy() < 0.5)
00155            candidate = i;
00156      }
00157      startGuess = list[candidate].GetNCTrigger();
00158    }
00159  
00160    if(debug) cout<<"start  "<<startGuess<<endl;
00161 
00162    if(startGuess > 0)
00163    {
00164      candPlane = list[candidate].GetPlane(startGuess);
00165     if(list[candidate].Size() > 3) {
00166      //If there is a blip then the rising edges, ignore that repeat as necessary
00167      //     rewinding
00168      Int_t i = startGuess;
00169      if(i > 0)
00170      {
00171         if(i > 0 && list[candidate].GetPlane(i)-list[candidate].GetPlane(i-1) == 1
00172                  && list[candidate].GetEnergy(i) > list[candidate].GetEnergy(i-1))
00173                 i--;
00174 
00175         candPlane = list[candidate].GetPlane(i);
00176      }
00177     }
00178    }else
00179       candPlane = list[candidate].GetFirstPlane();
00180  
00181    if(debug) cout<<candidate<<"  "<<candPlane<<endl;
00182    if(candPlane == -1) candPlane = list[candidate].GetFirstPlane();
00183    if(debug) cout<<candidate<<"  "<<candPlane<<endl;
00184    return candPlane;
00185 }
00186 

Generated on Mon Feb 15 11:07:51 2010 for loon by  doxygen 1.3.9.1