Embedding

Update:  New B/EEMC embedding framework from Wei-Ming Zhang currently in peer review


The present BEMC embedding works as an afterburner that must be done after the TPC embedding.  Wei-Ming Zhang is working on a version that work in parallel with the TPC embedding.  Here's the current workflow:

During TPC embedding

In this step, only real EMC data is processed with all of the TPC embedding.  In the end, there are two files:
  1. .event.root - This file contains the TPC reconstructed tracks (real data + simulation) and BEMC reco information (real data only)
  2. .geant.root - This files contains the simulated tracks (TPC + EMC simulated data)
Once again, no BEMC embedding is done at this level.  The chain that process the BEMC real data is the same as the one used for production (StEmcRawMaker, StPreEclMaker and StEpcMaker)

After TPC embedding

This is where the BEMC embedding happens.  The idea is to get the output from the TPC embedding (.geant.root and .event.root files) and mix the BEMC simulated data with the real BEMC data.  The mixing is performed by StEmcMixerMaker and the main idea is to add the simulated ADC values to the real event ADC values.  In order to do that we need to follow some simple rules:
  1. We have to simulate the ADC values with the same calibration table used for the real data
  2. We cannot add pedestals or noise to the simulated data.  The real data already include the pedestals and noise.  If we simulate them we will end up overestimating both quantities.
  3. We should embed simulated hits only for the towers with status==1.
The macro that runs the embedding can be found at StRoot/StEmcMixerMaker/macros/doEmcEmbedEvent.C.  The basic chain that runs in this macro is
  1. StIOMaker - to read the .event.root and .geant.root files
  2. St_db_Maker - to make the interface with the STAR database and get the BEMC tables
  3. StEmcADCtoEMaker - reprocesses the real BEMC data and fills an StEvent object with the calibrated real data.
  4. StEmcPreMixerMaker - this is a simple maker whose only function is to make sure the chain timestamp is set using the real data event time.  This is very important to make sure the tables are correctly retrieved from the database.
  5. StMcEventMaker - builds an StMcEvent object in memory.  This is necessary because the simulator maker needs to get the BEMC simulated data in this format.
  6. StEmcSimulatorMaker - this maker gets the StMcEvent in memory that contains the BEMC simulated hits and does a slow simulation of the detector, generating the ADC values with the correct calibration tables.  At this point we have two StEmcCollections in memory: the one with the real BEMC data from step 3, and the one with the simulated data from the simulator maker.
  7. StEmcMixerMaker - this maker gets the two StEmcCollections and adds the simulated one to the real data.  This is a simple ADC_total = ADC1 + ADC2 for each channel in each detector.  Only simulated hits belonging to channels that were good in the real data are added.
  8. StEmcADCtoEMaker - reconstructs the event once more.  This step gets the new ADC values and recalibrates them.
  9. StPreEclMaker - reconstructs the clusters with the embedded hits.
  10. StEpcMaker - reconstructs the points
  11. StAssociationMaker - does the TPC association
  12. StEmcAssociationMaker - does the BEMC association
  13. Add your own analysis maker
The embedding flow is illustrated in the following diagram:



StEmcAssociationMaker

Introduction

To treat many-particle events (pp and AuAu), we need to know which particle generated which cluster/point before evaluating the reconstructed clusters and points.  StEmcAssociationMaker accomplishes this by matching the many clusters and points in a given event with the respective simulated particles.

Association Matrix

In order to associate the clusters/points to the corresponding particles, the Association software creates matrices.  The matrix columns correspond to the reconstructed clusters/points and the lines correspond to the particles.  We have three kinds of matrices:
  • Simple Matrix - matrix elements are 0 or 1.
  • Particle Fraction Matrix - matrix elements are the fraction of the total particle energy in a cluster.
  • Cluster Fraction matrix - matrix elements are the fraction of energy of a cluster that comes from a given particle.

                Simple Matrix                      Particle Fraction Matrix                 Cluster Fraction Matrix


A simple example using association matrices is presented below.  In the case of double photon events, we plot the purity of the measured clusters in SMD eta as a function of the photon distance.  The purity is obtained from the "Cluster Fraction" Association Matrix.

How to Use

In order to follow the same scheme done in StAssociationMaker we save the association information in multimaps.  Multimaps make it very easy for the user to get the association information for a given StMcTrack, cluster or point.  Detailed documentation for StAssociationMaker is available <a href="http://www.star.bnl.gov/STAR/comp/pkg/dev/StRoot/StAssociationMaker/doc/">here</a>.  There are essentially four multimaps defined for the BEMC:
  1. multiEmcTrackCluster - correlates the StMcTrack with StEmcClusters
  2. multiEmcClusterTrack - corrrelates the StEmcCluster with StMcTracks
  3. multiEmcTrackPoint - correlates the StMcTrack with StEmcPoints
  4. multiEmcPointTrack - correlates the StEmcPoint with StMcTracks
The following sample code can be used to access one of these multimaps provided StEmcAssociationMaker is available in the chain:
StEmcAssociationMaker *emcAssoc = GetMaker("EmcAssoc");
if(!emcAssoc) return;
multiEmcTrackCluster *map = emcAssoc->getTrackClusterMap(1);
if(!map) return;
for(multiEmcTrackClusterIter j=map->begin(); j!=map->end(); j++)
{
StMcTrack* track = (StMcTrack*)(*j).first;
StEmcClusterAssociation* value = (StEmcClusterAssociation*)(*j).second;
if(track && value)
{
StEmcCluster *c = (StEmcCluster*) value->getCluster();
if(c)
{
cout <<" McTrack = "<<track<<" GeantId = "<<track->geantId()
<<" pt = "<<track->pt()<<" TReta = "<<track->pseudoRapidity()
<<" Cl = "<<c<<" E = "<<c->energy()<<" eta = "<<c->eta()
<<" phi = "<<c->phi()
<<" FrTr = "<<value->getFractionTrack()
<<" FrCl = "<<value->getFractionCluster()<<endl;
}
}
}
For a detailed example of how to use the BEMC multimaps please have a look at the StEmcAssociationMaker::printMaps() method.