Atlfast::Isolator Class Reference

Associates ReconstructedParticles to Clusters and evaluates isolation. More...

#include <Isolator.h>

Collaboration diagram for Atlfast::Isolator:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Isolator (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~Isolator ()
StatusCode initialize ()
StatusCode execute ()
StatusCode finalize ()

Private Member Functions

bool isIsolated (MsgStream &, ReconstructedParticleCollection::const_iterator, std::vector< ITwoCptCell * > &, std::vector< ICluster * > &)

Private Attributes

double m_rClusterMatch
double m_rClusterIsolation
double m_eClusterIsolation
double m_rCellIsolation
double m_eCellIsolation
double m_rLowerHalo
double m_rHigherHalo
std::string m_inputLocation
std::string m_isolatedOutputLocation
std::string m_nonIsolatedOutputLocation
std::string m_cellLocation
std::string m_clusterLocation
TesIOm_tesIO
std::string m_mcLocation
KinematicHelper m_kinehelp
HepMC_helper::IMCselectorm_visibleToCal

Detailed Description

Associates ReconstructedParticles to Clusters and evaluates isolation.

The associations are established by searching in a user-defined cone around the RP position for unassociated Clusters.
The isolation is calculated by searching in user-defined cones around the RP position for Clusters and unused (unclustered) Cells. The corresponding energies are then compared to user-defined limits.

Isolator.jpg

Isolator sequence

Definition at line 77 of file Isolator.h.


Constructor & Destructor Documentation

Atlfast::Isolator::Isolator ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Standard Athena-Algorithm Constructor

Definition at line 42 of file Isolator.cxx.

00043     : Algorithm( name, pSvcLocator )
00044     , m_tesIO( 0 ) {
00045     
00046     // Setting the parameter defaults.
00047     m_rClusterMatch      = 0.150;
00048     m_rClusterIsolation  = 0.400;
00049     m_eClusterIsolation  = 0.0*GeV;
00050     m_rCellIsolation     = 0.200;
00051     m_eCellIsolation     = 10.0*GeV;
00052 
00053     m_rLowerHalo         = 0.2;
00054     m_rHigherHalo        = 0.4;
00055     
00056     // Default paths for entities in the TES
00057     m_inputLocation                 = "/Event/AtlfastElectrons";
00058     m_cellLocation                  = "/Event/AtlfastCells";
00059     m_clusterLocation               = "/Event/AtlfastClusters";
00060     m_isolatedOutputLocation        = "/Event/AtlfastIsolatedElectrons";
00061     m_nonIsolatedOutputLocation     = "/Event/AtlfastNonIsolatedElectrons";
00062     
00063     // This is how you declare the paramemters to Gaudi so that
00064     // they can be over-written via the job options file
00065     
00066     declareProperty( "RClusterMatch",             m_rClusterMatch ) ;
00067     declareProperty( "RClusterIsolation",         m_rClusterIsolation ) ;
00068     declareProperty( "EClusterIsolation",         m_eClusterIsolation ) ;
00069     declareProperty( "RCellIsolation",            m_rCellIsolation ) ;
00070     declareProperty( "ECellIsolation",            m_eCellIsolation ) ;
00071     
00072     declareProperty( "InputLocation",             m_inputLocation ) ;
00073     declareProperty( "CellLocation",              m_cellLocation ) ;
00074     declareProperty( "ClusterLocation",           m_clusterLocation ) ;
00075     declareProperty( "IsolatedOutputLocation",    m_isolatedOutputLocation ) ;
00076     declareProperty( "NonIsolatedOutputLocation", m_nonIsolatedOutputLocation ) ;
00077     
00078     declareProperty( "RLowerHalo",                m_rLowerHalo ) ;
00079     declareProperty( "RHigherHalo",               m_rHigherHalo ) ;
00080 
00081   }

Atlfast::Isolator::~Isolator (  )  [virtual]

Default Destructor

Definition at line 84 of file Isolator.cxx.

00084                       {
00085     MsgStream log( messageService(), name() ) ;
00086     log << MSG::INFO << "destructor" << endreq;
00087     delete m_tesIO;
00088   } 


Member Function Documentation

StatusCode Atlfast::Isolator::initialize (  ) 

Standard Athena-Algorithm method

Definition at line 95 of file Isolator.cxx.

00095                                  {
00096     MsgStream log( messageService(), name() ) ;
00097     log << MSG::DEBUG << "Initialising" << endreq;
00098     
00099     
00100     //get the Global Event Data using singleton pattern
00101     GlobalEventData* ged = GlobalEventData::Instance();
00102     m_visibleToCal   = ged -> visibleToCal();
00103     m_mcLocation     = ged -> mcLocation();
00104 
00105     //    m_tesIO = new TesIO(eventDataService());
00106     m_tesIO = new TesIO(m_mcLocation, ged->justHardScatter());
00107 
00108     
00109     HeaderPrinter hp("Atlfast Isolator:", log);
00110     
00111     hp.add("TES Locations:             ");
00112     hp.add(" Particles from            ", m_inputLocation); 
00113     hp.add(" Cells from                ", m_cellLocation);    
00114     hp.add(" Clusters from             ", m_clusterLocation); 
00115     hp.add(" Isolated Particles to     ", m_isolatedOutputLocation);
00116     hp.add(" Non-Isolated Particles to ", m_nonIsolatedOutputLocation);
00117     hp.add("Cluster match DeltaR       ", m_rClusterMatch);
00118     hp.add("Cluster isolation DeltaR   ", m_rClusterIsolation);
00119     hp.add("Cluster isolation E thresh ", m_eClusterIsolation);
00120     hp.add("Cell isolation DeltaR      ", m_rCellIsolation);
00121     hp.add("Cell isolation E thresh    ", m_eCellIsolation);
00122     hp.print();
00123     
00124     
00125     return StatusCode::SUCCESS ;
00126   }

StatusCode Atlfast::Isolator::execute (  ) 

Standard Athena-Algorithm method

Definition at line 153 of file Isolator.cxx.

00153                                {
00154     
00155     //................................
00156     // make a message logging stream
00157     
00158     MsgStream log( messageService(), name() ) ;
00159     std::string mess;
00160     //...............................
00161     // Extract the input particles which are to be tested for isolation.
00162     
00163     //std::vector<ReconstructedParticle*> particles;
00164     const ReconstructedParticleCollection* particles(0);
00165     if(!m_tesIO->getDH(particles, m_inputLocation)){
00166       log << MSG::DEBUG 
00167           << "No reconstructed particles in TES to treat" 
00168           << endreq ;
00169       return StatusCode::SUCCESS ;
00170     }
00171     
00172     log << MSG::DEBUG 
00173         << "Found " 
00174         << particles->size() 
00175         << " particles in TES "
00176         << endreq ;
00177     
00178     
00179     //.........................................................
00180     // Extract the (pointers to) cells and clusters from the TES into 
00181     // locally defined arrays.
00182     
00183     
00184     std::vector<ITwoCptCell*> cells;
00185     if(!m_tesIO->copy<ITwoCptCellCollection> (cells, m_cellLocation)){
00186       
00187       log << MSG::DEBUG 
00188           << "No Cells found in TES at " 
00189           << m_cellLocation 
00190           << endreq ;
00191     }
00192     
00193     
00194     std::vector<ICluster*> clusters;
00195     if(!m_tesIO->copy<IClusterCollection>(clusters, m_clusterLocation)){
00196       log << MSG::DEBUG 
00197           << "No Clusters found in TES at " 
00198           << m_clusterLocation 
00199           << endreq ;
00200     }
00201     
00202     
00203     // ......................
00204     // Make an empty container object which will store (pointers to) all 
00205     // sucessfully isolated and non isolated electrons.  
00206     
00207     ReconstructedParticleCollection* isolatedParticles = 
00208       new ReconstructedParticleCollection ;
00209     
00210     ReconstructedParticleCollection* nonIsolatedParticles = 
00211       new ReconstructedParticleCollection ;
00212     
00213     
00214     //.........................................................
00215     // For each particle in the input list test if it is isolated.
00216     // If so copy it into the output collection.
00217     
00218     ReconstructedParticleCollection::const_iterator particle ;
00219     
00220     for( particle = particles->begin(); 
00221          particle != particles->end(); 
00222          ++particle)
00223       {       
00224         if( this->isIsolated( log, particle, cells, clusters ) )     
00225           isolatedParticles->push_back
00226             ( new ReconstructedParticle( *particle ) ); 
00227         else
00228           nonIsolatedParticles->push_back
00229             ( new ReconstructedParticle( *particle ) );         
00230       }
00231     
00232     
00233     //......................................
00234     // Register particles in the transient event store. 
00235     
00236     TesIoStat tis;
00237     tis = m_tesIO->store(isolatedParticles, m_isolatedOutputLocation );  
00238     if( tis.isNotValid() ) {
00239       log << MSG::ERROR << "Failed to register output in TES at " 
00240           << m_isolatedOutputLocation <<  endreq ;
00241       return tis;
00242     } else{
00243       log << MSG::DEBUG << "Written " << isolatedParticles->size() 
00244           << " isolated particles to TES " << endreq;
00245     }
00246     
00247     tis = m_tesIO->store(nonIsolatedParticles, m_nonIsolatedOutputLocation );
00248     if( tis.isNotValid() ) {
00249       log << MSG::ERROR << "Failed to register output in TES at " 
00250           << m_nonIsolatedOutputLocation <<  endreq ;
00251     } else {
00252       log << MSG::DEBUG << "Written " << nonIsolatedParticles->size() 
00253           << " NON-isolated particles to TES " << endreq;
00254     }
00255     
00256     return tis ;
00257     
00258   }

StatusCode Atlfast::Isolator::finalize (  ) 

Standard Athena-Algorithm method

Definition at line 132 of file Isolator.cxx.

00132                                {
00133     MsgStream log( messageService(), name() ) ;
00134     log << MSG::INFO << "finalizing" << endreq;
00135     return StatusCode::SUCCESS ;
00136   }

bool Atlfast::Isolator::isIsolated ( MsgStream &  ,
ReconstructedParticleCollection::const_iterator  ,
std::vector< ITwoCptCell * > &  ,
std::vector< ICluster * > &   
) [private]

This is the heart of this algorithm: the bit that does the isolation

Definition at line 269 of file Isolator.cxx.

00274      {
00275     
00276     log << MSG::DEBUG << "\n\t Treating particle: " << *particle ;
00277     
00278     // Things we need to remember until the end of the method
00279     // If, during processing of Clusters, we identify an "associated cluster"
00280     // we remember it for use if the particle is finally judged to be isolated
00281     bool associated = false ;
00282     ICluster* associatedCluster = NULL ;
00283     
00284     
00285     
00286     //....................................
00287     // Cluster isolation
00288     
00289     if( !storedClusters.empty() ) {
00290       
00291       // Make a local copy as we want to mutate the list of pointers
00292       std::vector<ICluster*>  clusters( 
00293                                       storedClusters.begin(), 
00294                                       storedClusters.end() 
00295                                       );
00296       
00297       //Only use clusters not already claimed by ReconstructedParticles
00298       std::vector<ICluster*>::iterator firstNonAssociatedCluster ;
00299       firstNonAssociatedCluster = 
00300         std::partition(
00301                        clusters.begin(),
00302                        clusters.end(),
00303                        IsAssociated<ReconstructedParticle>
00304                        );
00305       if(firstNonAssociatedCluster != clusters.begin()){
00306         log<<MSG::DEBUG<<"First "
00307            <<firstNonAssociatedCluster-clusters.begin()
00308            <<" clusters are associated to ReconstructedParticles "
00309            <<clusters.end()-firstNonAssociatedCluster
00310            <<" cluster(s) remain"
00311            <<endreq;
00312       }else{
00313         log<<MSG::DEBUG
00314            <<"No clusters are associated to ReconstructedParticles"
00315            <<endreq;
00316       }
00317       if(clusters.end()!=firstNonAssociatedCluster){
00318         // .....................
00319         // Associate unclaimed clusters with current particle. 
00320         // This looks at the nearest cluster only, and decides whether
00321         // it is within an "association" cone
00322         
00323         partial_sort(
00324                      firstNonAssociatedCluster,
00325                      firstNonAssociatedCluster+1,
00326                      clusters.end(), 
00327                      SortAttribute::DeltaR( *particle )
00328                      );
00329         
00330         log<<MSG::DEBUG<<"Sorted clusters "<<endreq;
00331         
00332         associated =
00333           (m_kinehelp.deltaR(*particle, *firstNonAssociatedCluster) <  
00334            m_rClusterMatch);
00335         
00336         if( associated ) 
00337           {
00338             log << "\n\t -->Found associated cluster: "  
00339                 << *clusters.begin() ;
00340             
00341             // Remember the relevant cluster until the end of this method
00342             associatedCluster = *firstNonAssociatedCluster ;
00343             
00344             // Set the first nonassociated cluster
00345             ++firstNonAssociatedCluster;
00346             
00347           }
00348         
00349         
00350         //............................................
00351         // Now we can check Cluster Isolation 
00352         // (if there is at least one more cluster to check)
00353         
00354         // Use kinematic helper to do all work
00355         double eClusterSum = m_kinehelp.sumETInCone( 
00356                                                     firstNonAssociatedCluster, 
00357                                                     clusters.end(), 
00358                                                     *particle,
00359                                                     m_rClusterIsolation
00360                                                     );
00361         
00362         // Apply the cut criteria
00363         
00364         if( eClusterSum  > m_eClusterIsolation ) 
00365           log  << "\n\t -->Excess Cluster energy in cone = " << eClusterSum 
00366                << "   => NOT-ISOLATED " << endreq;       
00367         else
00368           log  << "\n\t -->Excess Cluster energy in cone = " << eClusterSum 
00369                << "   => ISOLATED "  ;
00370         
00371         if( eClusterSum  > m_eClusterIsolation )  return false ;
00372         
00373       }
00374       
00375     }
00376     
00377     
00378     //............................................
00379     // Cell Isolation: 
00380     
00381     if( !storedCells.empty() ) {
00382       
00383       // Test on isolation in respect of the total transverese energy of all 
00384       // Cells within a given r-cone
00385       
00386       // Use kinematic helper to do all work
00387       double eCellSum = m_kinehelp.sumETInCone( 
00388                                                storedCells.begin(), 
00389                                                storedCells.end(), 
00390                                                *particle,
00391                                                m_rCellIsolation
00392                                                );
00393       
00394       
00395       // Subtract the energy associated with particle under test
00396       // as the cells summed will have included its deposit
00397       //    CalSelect depositsInCal;
00398       //    if(depositsInCal( *particle) ) eCellSum -= (*particle)->eT() ;
00399       bool itDeposits = m_visibleToCal->operator()( (*particle)->truth() );
00400       
00401       if(itDeposits) eCellSum -= (*particle)->eT() ;
00402       
00403       
00404       // Apply isolation criteria
00405       
00406       if( eCellSum  > m_eCellIsolation ) 
00407         log  
00408           << "\n\t -->Excess Cell energy in cone = " << eCellSum 
00409           << "   => NOT-ISOLATED " << endreq ;    
00410       else
00411         log   
00412           << "\n\t -->Excess Cell energy in cone = " << eCellSum 
00413           << "   => ISOLATED " << endreq ;
00414       
00415       if( eCellSum  > m_eCellIsolation ) return false ;
00416       
00417     }
00418     
00419     //..........................................
00420     // If we get here then the candidate was judged to be isolated
00421     
00422     // It is only now that we wish to set associations between isolated
00423     // particles and clusters. I.e we dont want to flag associations for 
00424     // non-isolated particles
00425     
00426     if( associated ) {
00427       
00428       // Calculate halo quantities for Particle
00429       // Scalar sum
00430       (*particle)->set_halo(m_kinehelp.sumETInHalo(storedCells.begin(),
00431                                                    storedCells.end(),
00432                                                    *particle,
00433                                                    m_rLowerHalo,
00434                                                    m_rHigherHalo
00435                                                    ));
00436       // Vector sum
00437       (*particle)->set_halovector(m_kinehelp.sumMomentumInHalo(storedCells.begin(),
00438                                                                storedCells.end(),
00439                                                                *particle,
00440                                                                m_rLowerHalo,
00441                                                                m_rHigherHalo
00442                                                                ));
00443       
00444       // Set the association from Particle -> Cluster
00445       IAOO* iamp = *particle;
00446       iamp->associate( associatedCluster ) ;
00447       
00448       log  << MSG::DEBUG 
00449            << "Particle of type "<< (*particle)->pdg_id()
00450            <<" associated to Cluster" 
00451            << endreq;
00452       //assert(IsAssociated<Cluster>( *particle ));
00453       
00454       // Set the association from Cluster -> Particle
00455       IAOO* iamc = associatedCluster;
00456       iamc->associate( *particle ) ;
00457       
00458       log  << MSG::DEBUG 
00459            << "Cluster associated to Particle of type "
00460            << (*particle)->pdg_id() 
00461            << endreq;
00462       
00463       //assert(IsAssociated<ReconstructedParticle>( associatedCluster ));
00464     }
00465     
00466     log << endreq ;
00467     
00468     return true ;
00469   }


Member Data Documentation

double Atlfast::Isolator::m_rClusterMatch [private]

R-cone for associating a Cluster to a particle

Definition at line 104 of file Isolator.h.

double Atlfast::Isolator::m_rClusterIsolation [private]

R-cone in which to sum unassociated Cluster eT

Definition at line 107 of file Isolator.h.

double Atlfast::Isolator::m_eClusterIsolation [private]

eT threshold to apply to summed Cluster eT

Definition at line 110 of file Isolator.h.

double Atlfast::Isolator::m_rCellIsolation [private]

R-cone in which to sum Cell eT

Definition at line 113 of file Isolator.h.

double Atlfast::Isolator::m_eCellIsolation [private]

eT threshold to apply to excess summed Cluster eT

Definition at line 116 of file Isolator.h.

double Atlfast::Isolator::m_rLowerHalo [private]

Upper and lower bounds of halo interval in dR

Definition at line 119 of file Isolator.h.

double Atlfast::Isolator::m_rHigherHalo [private]

Definition at line 120 of file Isolator.h.

std::string Atlfast::Isolator::m_inputLocation [private]

Location in TES to obtain input particles to be isolated

Definition at line 123 of file Isolator.h.

std::string Atlfast::Isolator::m_isolatedOutputLocation [private]

Location in TES to write out isolated list.

Definition at line 126 of file Isolator.h.

std::string Atlfast::Isolator::m_nonIsolatedOutputLocation [private]

Location in TES to write out isolated list.

Definition at line 128 of file Isolator.h.

std::string Atlfast::Isolator::m_cellLocation [private]

Location of Cells in TES

Definition at line 131 of file Isolator.h.

std::string Atlfast::Isolator::m_clusterLocation [private]

Location of Clusters in TES

Definition at line 133 of file Isolator.h.

TesIO* Atlfast::Isolator::m_tesIO [private]

For accessing StoreGate

Definition at line 137 of file Isolator.h.

std::string Atlfast::Isolator::m_mcLocation [private]

holds the Storegate MC location

Definition at line 140 of file Isolator.h.

KinematicHelper Atlfast::Isolator::m_kinehelp [private]

Definition at line 148 of file Isolator.h.

HepMC_helper::IMCselector* Atlfast::Isolator::m_visibleToCal [private]

Definition at line 149 of file Isolator.h.


The documentation for this class was generated from the following files:
Generated on Mon Sep 24 14:19:40 2007 for AtlfastAlgs by  doxygen 1.5.1