Report problems to ATLAS LXR Team (with time and IP address indicated)

The LXR Cross Referencer

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Architecture: linux ]
Version: head ] [ nightly ] [ GaudiDev ]
  Links to LXR source navigation pages for stable releases [ 12.*.* ]   [ 13.*.* ]   [ 14.*.* ]   [ 15.*.* ] 

001 // ================================================
002 //        ClusterConeStrategy class Implementation
003 //
004 //  + PreCluster helper class
005 //
006 // ================================================
007 //
008 // Namespace Atlfast
009 //
010 #include "AtlfastAlgs/ClusterConeStrategy.h"
011 
012 #include "AtlfastEvent/IKinematic.h"
013 #include "AtlfastEvent/Cluster.h"
014 #include "AtlfastEvent/CollectionDefs.h"
015 
016 #include "AtlfastUtils/FunctionObjects.h"
017 
018 #include <cmath> 
019 #include <algorithm>
020 #include <vector>
021 
022 // Gaudi includes
023 #include "GaudiKernel/MsgStream.h"
024 
025 //Other
026 #include "CLHEP/Vector/LorentzVector.h"
027 
028 
029 namespace Atlfast {
030   using std::sort;
031   using std::partition;
032 
033 /** @brief Implements the cone jet finder as a clustering strategy.
034    *
035    * Default R-cone value is 0.401. The 0.001 avoids problems with the
036    * 0.1x0.1 grid when running on Atlfast calorimeter cells.
037    * This strategy has been shown to produce different results than the JetRec
038    * cone jet finder and should be superseded soon.
039    */
040 
041   void 
042   ClusterConeStrategy::makeClusters( 
043                                     MsgStream& log, 
044                                     const std::vector<IKinematic*>&storedCells,
045                                     IKinematicVector& unusedCells,
046                                     IClusterCollection* clusters) const {
047     log << MSG::DEBUG << storedCells.size() << "cells to start with"<<endreq;
048     // The cell collection suppplied is not mutable as it contains items
049     // (or pointers to items) in the TES. 
050     // Therefore we copy pointers to two local mutable collections  as we want 
051     // to manipulate them as part of the clustering strategy
052     
053     // This is to hold cells remaining available for cluster formation. 
054     localCellCollection availableCells(storedCells.begin(), 
055                                        storedCells.end() );
056     localCellIterator firstAvailableCell = availableCells.begin() ;
057     localCellIterator lastAvailableCell  = availableCells.end() ;
058     
059     // This is to keep remaining candidate initiators.
060     localCellCollection availableInitiators( storedCells.begin(), 
061                                              storedCells.end() ) ;
062     localCellIterator firstAvailableInitiator  = availableInitiators.begin() ;
063     localCellIterator lastAvailableInitiator   = availableInitiators.end() ;
064 
065     // Partition the inititator candidates to retain only those above threshold
066     lastAvailableInitiator 
067       = partition( firstAvailableInitiator, 
068                    lastAvailableInitiator,
069                    PartitionCondition::AboveThresholdET( m_minInitiatorET )
070                    );
071     
072     // Sort the remaining initiator candidates into descending order of eT
073     // This means the first available initiator will always be the highest eT
074     sort( firstAvailableInitiator, 
075           lastAvailableInitiator, 
076           SortAttribute::DescendingET() 
077           );
078     
079     
080     // Iterate over all initiator candidates
081     
082     while( firstAvailableInitiator != lastAvailableInitiator  ) {
083       
084       // Partition the cells to find those within the required R-cone
085       
086       //substitute an rCone with no args to stop the compiler wingeing
087       // about unused parameters
088       // double rCone = this->rCone( *firstAvailableInitiator ) ;
089       double rCone = this->rCone( ) ;
090       
091       localCellIterator endCellInCone = partition
092         ( 
093          firstAvailableCell, 
094          lastAvailableCell, 
095          PartitionCondition::BelowThresholdDeltaR( *firstAvailableInitiator, 
096                                                    rCone )
097          );
098       
099       // Accumulate all cells in cone to get weighted kinematic centre
100       // We use a PreCluster helper object for this
101       PreCluster preclus( firstAvailableCell, endCellInCone, m_masslessJets);
102       
103       // Test if sum eT is above minumum. 
104       if( preclus.eT() > m_minClusterET ){
105         // Make a cluster and add to the collection
106         HepLorentzVector temp=preclus;
107         ICluster* newclus =  
108           new Cluster( temp, firstAvailableCell, endCellInCone ) ;
109         //      Cluster* newclus =  
110         //        new Cluster( preclus, firstAvailableCell, endCellInCone ) ;
111         clusters->push_back( newclus ) ;
112         
113         //log << MSG::DEBUG << "New Cluster created " << newclus << endreq ;
114         
115         // Remove all used cells from the available initiator range
116         localCellIterator cell= firstAvailableCell; 
117         for(; cell != endCellInCone; ++cell ){ 
118           lastAvailableInitiator =
119             std::remove( firstAvailableInitiator, 
120                          lastAvailableInitiator, *cell );
121         }
122         
123         // Remove all used cells from the available cell range
124         firstAvailableCell = endCellInCone ;
125         
126       }else{
127         //log << MSG::DEBUG << "Failed to form new cluster" 
128         //    << *firstAvailableInitiator << endreq ;
129         
130         // This initiator didnt lead to a good cluster.
131         // Remove it from the available initiator  range
132         ++firstAvailableInitiator ;
133       }
134       
135     }
136 
137     localCellIterator cellIter = firstAvailableCell;
138     for(; cellIter!=lastAvailableCell; ++cellIter){
139       //      unusedCells.push_back(new Cell(**cellIter));
140       //PS 24/01/03
141       //the next line replaces the previous line
142       // but why was it there in the first place?
143       //      unusedCells.push_back( (*cellIter)->clone() );
144       unusedCells.push_back(*cellIter);
145     }
146     return;
147   }
148   
149   //-------------------------------------------// private: rcone
150   //------------------------------------------
151   
152   // looks up R-cone size according to position of initiator
153   
154   //double ClusterConeStrategy::rCone( Cell* initiator )
155   double ClusterConeStrategy::rCone() const {
156     // Temporary: return barrel always as we dont have mechanism
157     // to determine calorimeter geometry yet.
158     return m_rConeBarrel ;
159   }
160   
161   
162   
163   
164   //-------------------------------------
165   // PreClusterHelper class
166   //-------------------------------------
167   
168   // Constructor
169   ClusterConeStrategy::PreCluster::PreCluster( 
170                                               localCellIterator start, 
171                                               localCellIterator end,
172                                               bool masslessJets) : 
173     m_eT_total(0),
174     m_eta_weighted(0),
175     m_masslessJets(masslessJets),
176     m_momentum_sum( 0, 0, 0, 0 ){ 
177     
178     for( localCellIterator cell = start; cell != end; ++cell ){
179       // Construct sum kinematic quantities weighted by eT
180       // These are done EXACTLY as per the old ATLFAST++
181       m_eT_total     += (*cell)->eT() ;
182       m_eta_weighted += (*cell)->eta() * (*cell)->eT() ;
183       
184       // This next code for phi DOES NOT do things in exactly the same
185       // way as old ATLFAST++
186       // In particular the simple weighted phi which was implemented
187       // would seem to have a problem at the cyclic boundary 
188       // (unless I misunderstood, if it averaged pi-epsilon and -pi+epsilon
189       // it would get 0 instead of pi
190       // What is implemented here is a more generic solution which
191       // is currently only used for phi, but could be used for eT
192       // and eta also later
193       
194       m_momentum_sum += (*cell)->momentum() ;
195       
196     } 
197   }       
198   
199   // queries
200   
201   double ClusterConeStrategy::PreCluster::eT()  { return m_eT_total ; }
202   
203   double ClusterConeStrategy::PreCluster::eta() { 
204     // Implemented exactly as per the old ATLFAST++
205     if( m_eT_total > 0 ) return m_eta_weighted / m_eT_total ;
206     else return 0. ;
207   }
208   
209   double ClusterConeStrategy::PreCluster::phi() { 
210     // Implemented differently to the old ATLFAST++
211     return m_momentum_sum.phi() ; 
212   }
213   
214   
215   // Conversion of eT, eta, phi to HepLorentzVector
216   ClusterConeStrategy::PreCluster::operator HepLorentzVector () {
217     
218     // Note:  there is a good reason this doesnt use the member
219     // 4-vector. It is trying to mimic as far as possible the old
220     // ATLFAST++. 
221     // This may be changed in the future.
222     
223     double theta = atan( exp( - this->eta() ) ) * 2.0 ;
224     
225     double x=0.,y=0.,z=0.,t=0. ;
226     
227     if( (0. < theta) && ( theta < M_PI ) )
228       {           
229         if(m_masslessJets){
230           t = this->eT() / sin( theta ) ;
231           x = this->eT() * cos( this->phi() ) ;
232           y = this->eT() * sin( this->phi() ) ;
233           z = t * cos( theta ) ;
234         }else{
235           t = m_momentum_sum.e();
236           x = m_momentum_sum.px();
237           y = m_momentum_sum.py();
238           z = m_momentum_sum.pz();
239         }
240       }
241     
242     return HepLorentzVector( x, y, z, t ) ; 
243   }
244 } // end of namespace bracket
245 
246 
247 
248 
249 
250 
251 
252 
253 
254 
255 

source navigation ] diff markup ] identifier search ] general search ]

Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems
This page was automatically generated by the LXR engine. Valid HTML 4.01!