Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

mMuiResponse Class Reference
[Analysis Modules]

Reads TMuiMCHit and TMutMCTrk and generates TMuiHit objects. More...

#include <mMuiResponse.h>

List of all members.

Public Methods

 mMuiResponse ()
 ~mMuiResponse ()
virtual PHBoolean event (PHCompositeNode *)

Private Methods

void set_interface_ptrs (PHCompositeNode *top_node)
bool initialize_rng ()
bool is_alive (TMuiMCHitMapO::const_pointer mc_hit_ptr)
void response_loop ()
void fill_hit (TMuiMCHitMapO::pointer mc_hit_ptr)
void associate_mc (TMuiHitMapO::iterator hit_iter, TMuiMCHitMapO::const_pointer mc_hit_ptr)
bool check_efficiency (UShort_t arm, UShort_t plane, UShort_t panel, UShort_t orientation, UShort_t twopack) const

Private Attributes

const mMuiResponsePar_mod_par
TMuiMCHitMapO_mc_hit_map
const TMutMCTrkMap * _mc_trk_map
TMuiHitMapO_hit_map
gsl_rng * _rng
PHTimeServer::timer _timer


Detailed Description

Reads TMuiMCHit and TMutMCTrk and generates TMuiHit objects.

Reads TMuiMCHit and TMutMCTrk and generates TMutHit objects with appropriate masking for dead/low efficiency twopacks. Currently outputs fills the TMuiHitMapO (new framework).


Analysis Module Interface Specification

Object Description Privilege
const mMuiResponsePar* Parameter Table immutable
const TMuiMCHitMapO* Parameter Table immutable
const TMutMCTrkMap* Parameter Table immutable
TMuiHitMapO* Parameter Table mutable

Definition at line 52 of file mMuiResponse.h.


Constructor & Destructor Documentation

~mMuiResponse  
 

Definition at line 48 of file mMuiResponse.cxx.

00048 { }


Member Function Documentation

void associate_mc TMuiHitMapO::iterator    hit_iter,
TMuiMCHitMapO::const_pointer    mc_hit_ptr
[private]
 

Definition at line 188 of file mMuiResponse.cxx.

Referenced by fill_hit.

00190 {
00191   TMuiHitMapO::pointer hit_ptr = hit_iter.current();
00192   PHKey::associate(TMuiMCHitMapO::pointer(mc_hit_ptr), hit_ptr); 
00193 }

bool check_efficiency UShort_t    arm,
UShort_t    plane,
UShort_t    panel,
UShort_t    orientation,
UShort_t    twopack
const [private]
 

Definition at line 209 of file mMuiResponse.cxx.

References _mod_par, _rng, TMuiHVMask::get_effic_twopack, mMuiResponsePar::get_twopack_eff, and mMuiResponsePar::get_use_hv_mask.

Referenced by fill_hit.

00214 {    
00215   // Efficiency due to HV Mask
00216   //
00217   if(_mod_par->get_use_hv_mask()){
00218     // Check HV state
00219     //
00220     double random = gsl_ran_flat(_rng,0.0,1.0);
00221     double effic = TMuiHVMask::get_effic_twopack(arm,plane,panel,orientation,twopack);      
00222     if (random > effic) return false;
00223   }
00224   
00225   // Efficiency due to everything else
00226   //
00227   double random = gsl_ran_flat(_rng,0.0,1.0);
00228   double effic = _mod_par->get_twopack_eff();
00229   if (random > effic) return false;
00230   
00231   return true;
00232 }

PHBoolean event PHCompositeNode *    [virtual]
 

Definition at line 52 of file mMuiResponse.cxx.

References _hit_map, _mod_par, _timer, TMuiParBase::get_verbosity, initialize_rng, response_loop, set_interface_ptrs, and MUIOO::TRACE.

00053 {
00054   _timer.get()->restart();   
00055   try { 
00056     // Reset IOC pointers
00057     //
00058     set_interface_ptrs(top_node);        
00059     //   Function scope static gets initialized once
00060     //   Placed here instead of constructor so initialization is done
00061     //   only if module is used.
00062     //
00063     static bool rng_initialized = initialize_rng();
00064     if(rng_initialized != true) throw std::runtime_error(DESCRIPTION("mMuiResponse::event: failed to initialize rng"));
00065     // Loop over TMuiMCHits and generate TMuiHits.
00066     // Add noise and apply masking where appropriate.
00067     //
00068     response_loop();
00069 
00070   } catch(std::exception& e) {
00071     MUIOO::TRACE(e.what());
00072     return False;
00073   }    
00074   // If verbose dump the contents of the hit map
00075   //
00076   _timer.get()->stop();
00077   if(_mod_par->get_verbosity() >= MUIOO::ALOT) _hit_map->print();
00078   if(_mod_par->get_verbosity() >= MUIOO::SOME) _timer.get()->print();
00079   return True;
00080 }

void fill_hit TMuiMCHitMapO::pointer    mc_hit_ptr [private]
 

Definition at line 134 of file mMuiResponse.cxx.

References _hit_map, _mod_par, associate_mc, check_efficiency, TMuiHitMapO::get, mMuiResponsePar::get_use_hv_mask, TMuiHitMapO::insert_new, TMuiMCTwoPack::MASKED, and TMuiMCHitO::twopack_list.

Referenced by response_loop.

00135 {
00136   UShort_t arm = mc_hit_ptr->get()->get_arm();
00137   UShort_t plane = mc_hit_ptr->get()->get_plane();
00138   
00139   typedef TMuiMCHitO::twopack_list twopack_list;
00140   typedef TMuiMCHitO::twopack_list::iterator twopack_iterator;
00141   
00142   // Get an iterator for list of TMuiMCTwoPack from TMuiMCHit
00143   //
00144   twopack_list* twopacks = mc_hit_ptr->get()->get_mutable_twopack_list();
00145   twopack_iterator twopack_iter = twopacks->begin();
00146   
00147   for(;twopack_iter!=twopacks->end();++twopack_iter){
00148     
00149     // If TMuiHit exists then do nothing
00150     // if not create a new TMuiHit
00151     //
00152     UShort_t panel       =  twopack_iter->get_panel();
00153     UShort_t orientation =  twopack_iter->get_orient();
00154     UShort_t twopack     =  twopack_iter->get_twopack_index();
00155 
00156     // Check the HV and set the two pack status if this hit
00157     // is masked
00158     //
00159     if(_mod_par->get_use_hv_mask() && 
00160        !check_efficiency(arm,plane,panel,orientation,twopack)){
00161       twopack_iter->set_status(TMuiMCTwoPack::MASKED);
00162       continue;
00163     }
00164     TMuiHitMapO::iterator hit_iter = _hit_map->get(arm,
00165                                                    plane,
00166                                                    panel,
00167                                                    orientation,
00168                                                    twopack);
00169 
00170     // Look for existing hit on this strip, if none then
00171     // make a new one.
00172     //
00173     if(hit_iter.at_end()){
00174        hit_iter = _hit_map->insert_new(arm,
00175                                        plane,
00176                                        panel,
00177                                        orientation,
00178                                        twopack);
00179 
00180     }
00181 
00182     associate_mc(hit_iter, mc_hit_ptr);
00183   }
00184 
00185 }

bool initialize_rng   [private]
 

Definition at line 197 of file mMuiResponse.cxx.

References _rng.

Referenced by event.

00198 {
00199   const gsl_rng_type *T;
00200   gsl_rng_env_setup();
00201   T = gsl_rng_default;
00202   _rng = gsl_rng_alloc(T);
00203 
00204   return true;
00205 }

bool is_alive TMuiMCHitMapO::const_pointer    mc_hit_ptr [private]
 

Definition at line 113 of file mMuiResponse.cxx.

References _mod_par, _rng, mMuiResponsePar::get_twopack_eff, and TMuiParBase::get_verbosity.

00114 {
00115   // TBI, some kind of code to check if the hit is in dead
00116   // area.
00117   //  .......................
00118   // return flase
00119 
00120   // Kill the hit if a random number is larger than the eff.
00121   //
00122   double x = gsl_ran_flat(_rng,0.0,100.0);
00123   if (x > _mod_par->get_twopack_eff()) return false;
00124   if(_mod_par->get_verbosity() >= MUIOO::ALOT) {
00125     cout <<" ######## check gsl_ran in mMuiRespose ######### " << endl;
00126     cout <<" # gsl_ran_uniform = " << x << " in mMuiRespose #" << endl;
00127     cout <<" # twopack efficiency =  "<<_mod_par->get_twopack_eff() <<"  #" << endl;
00128     cout <<" #####################################################" <<endl;
00129   }
00130   return true;
00131 }

void response_loop   [private]
 

Definition at line 98 of file mMuiResponse.cxx.

References _mc_hit_map, and fill_hit.

Referenced by event.

00099 {
00100   // Get an iterator to all the TMuiMCHits
00101   //
00102   TMuiMCHitMapO::iterator mc_hit_iter = _mc_hit_map->range();
00103   // Loop over TMuiMCHits
00104   //
00105   while(TMuiMCHitMapO::pointer mc_hit_ptr = mc_hit_iter.next()){    
00106     // fill hit map and associate it with MC hit.
00107     //
00108     fill_hit(mc_hit_ptr);
00109   }
00110 }

void set_interface_ptrs PHCompositeNode *    top_node [private]
 

Reset IOC and external interface pointers

Definition at line 84 of file mMuiResponse.cxx.

References _hit_map, _mc_hit_map, _mc_trk_map, and _mod_par.

Referenced by event.

00085 {  
00086   // Module runtime parameters
00087   //
00088   _mod_par = TMutNode<mMuiResponsePar>::find_node(top_node,"mMuiResponsePar");
00089 
00090   // IOC 
00091   //
00092   _mc_hit_map = TMutNode<TMuiMCHitMapO>::find_node(top_node,"TMuiMCHitMapO");
00093   _mc_trk_map = TMutNode<TMutMCTrkMap>::find_node(top_node,"TMutMCTrkMap");
00094   _hit_map = TMutNode<TMuiHitMapO>::find_node(top_node,"TMuiHitMapO");
00095 } 


Member Data Documentation

TMuiHitMapO* _hit_map [private]
 

Definition at line 88 of file mMuiResponse.h.

Referenced by event, fill_hit, and set_interface_ptrs.

TMuiMCHitMapO* _mc_hit_map [private]
 

Definition at line 86 of file mMuiResponse.h.

Referenced by response_loop, and set_interface_ptrs.

const TMutMCTrkMap* _mc_trk_map [private]
 

Definition at line 87 of file mMuiResponse.h.

Referenced by set_interface_ptrs.

const mMuiResponsePar* _mod_par [private]
 

Definition at line 85 of file mMuiResponse.h.

Referenced by check_efficiency, event, fill_hit, is_alive, and set_interface_ptrs.

gsl_rng* _rng [private]
 

Definition at line 92 of file mMuiResponse.h.

Referenced by check_efficiency, initialize_rng, and is_alive.

PHTimeServer::timer _timer [private]
 

Definition at line 96 of file mMuiResponse.h.

Referenced by event.


The documentation for this class was generated from the following files:
MUIOO: PHENIX Muon Identifier Analysis Framework. Documentation by doxygen
Last modified: