#include <mMuiSlowSim.h>
Public Methods | |
| mMuiSlowSim () | |
| ~mMuiSlowSim () | |
| virtual PHBoolean | event (PHCompositeNode *) |
Private Methods | |
| void | set_interface_ptrs (PHCompositeNode *top_node) |
| void | digitize () |
| void | associate_mctrk () |
| void | fill_new_mctrk (TMuiMCHitMapO::pointer mc_hit_ptr) |
Private Attributes | |
| const mMuiSlowSimPar * | _mod_par |
| TMuiMCHitMapO * | _mc_hit_map |
| TMutMCTrkMap * | _mc_trk_map |
| TABLE_HEAD_ST | _munhits_h |
| MUNHITS_ST * | _munhits |
| PHTimeServer::timer | _timer |
INSERT MODULE DESCRIPTION HERE
| Object | Description | Privilege |
| const mMuiSlowSimPar* | Parameter Table | immutable
INSERT ADDITIONAL IOC SPECIFICATIONS HERE
|
Definition at line 45 of file mMuiSlowSim.h.
|
|
Definition at line 56 of file mMuiSlowSim.cxx.
00056 { }
|
|
|
Definition at line 217 of file mMuiSlowSim.cxx. References _mc_hit_map, _mc_trk_map, and fill_new_mctrk. Referenced by event.
00218 {
00219 // Loop over TMuiMCHitMap [
00220 // Loop over TMutMCTrkMap [
00221 // if(the trkid from mctrk map matches trkid of muimchit map) [
00222 // associate muimchit and mctrk.
00223 // set association flag true
00224 // ]
00225 // ]
00226 // if(association flag is not true) [
00227 // make a new mctrk and insert it in map.
00228 // fill the fields of new mctrk object.
00229 // ]
00230 // ]
00231
00232 TMuiMCHitMapO::iterator muimchit_iter = _mc_hit_map->range();
00233 while(TMuiMCHitMapO::pointer muimchit_ptr = muimchit_iter.next()){
00234 TMutMCTrkMap::iterator mctrk_iter = _mc_trk_map->range();
00235 bool is_associated = false;
00236 while(TMutMCTrkMap::pointer mctrk_ptr = mctrk_iter.next()){
00237 if(mctrk_ptr->get()->get_track_id()!=muimchit_ptr->get()->get_track_id())
00238 continue;
00239 is_associated = true;
00240 PHKey::associate(muimchit_ptr,mctrk_ptr);
00241 }
00242 if(is_associated==false) fill_new_mctrk(muimchit_ptr);
00243 }
00244 }
|
|
|
Definition at line 121 of file mMuiSlowSim.cxx. References _mc_hit_map, _munhits, _munhits_h, TMuiMCHitMapO::insert_new, and v3. Referenced by event.
00122 {
00123 // ==================================================================
00124 // Loop through the PISA hits, and add twopacks to the dMuiRaw table.
00125 // ==================================================================
00126
00127 for (int hit=0; hit<_munhits_h.nok; hit++) {
00128
00129 // Determine the arm and gap number from the PISA plane number.
00130 // PISA convention: 2001-2006 are South Arm, 1001-1006 are North.
00131 short PisaPlane = _munhits[hit].plane_num; //staf table
00132 /*plane_num is data memeber of munhits struct*/
00133
00134 short iArm = -1;
00135 if (PisaPlane > 2000) {
00136 iArm = kSOUTH;
00137 } else {
00138 iArm = kNORTH;
00139 }
00140
00141 short iPlane = (PisaPlane%1000) - 1;
00142 //divide 1001 through 1006 each by 1000 taken remainder subtract by 1
00143
00144 if ( (iArm<0) || (iArm>=TMuiChannelId::kArmsTotal) ||
00145 (iPlane<0) || (iPlane>=TMuiChannelId::kPlanesPerArm) ) {
00146 continue;
00147 } //sanity check
00148
00149 TMuiMCHitMapO::iterator mc_hit_iter = _mc_hit_map->insert_new(iArm,iPlane);
00150 //mc_hit_iter is the pointer to the interface object (TMuiHitO the MC Hit Object)
00151 //insert_new methid is declared in file: TMuiMCHitMapO.h
00152 /* ONLY insert arm and plane information since there is NOT any panel or orientation
00153 information in PISA for the MuID */
00154 /* Set the location of the MCHit object */
00155 mc_hit_iter->get()->set_arm(iArm);
00156 mc_hit_iter->get()->set_plane(iPlane);
00157
00158 /*the following seven set_* methods are defined in TMuiMCHitO */
00159 mc_hit_iter->get()->set_track_id(_munhits[hit].track_num);
00160 mc_hit_iter->get()->set_x(_munhits[hit].rhit[0]);
00161 mc_hit_iter->get()->set_y(_munhits[hit].rhit[1]);
00162 mc_hit_iter->get()->set_z(_munhits[hit].rhit[2]);
00163 mc_hit_iter->get()->set_px(_munhits[hit].phit[0]);
00164 mc_hit_iter->get()->set_py(_munhits[hit].phit[1]);
00165 mc_hit_iter->get()->set_pz(_munhits[hit].phit[2]);
00166 mc_hit_iter->get()->set_pid(_munhits[hit].trk_id);
00167
00168 /* the get()->set_* takes pisa information and puts it into the interface object (here TMuiMCHitO) which has already had its pointer inserted into the container (here the the MCHitMap) */
00169
00170 // rhit and phit originate in the MuID PISA file:
00171 // simulation/pisa2000/src/phnxcore/encodeRootEvntMui.cc
00172 Hep3Vector X(_munhits[hit].rhit[0], //rhit is the PISA MuID HIT position
00173 _munhits[hit].rhit[1], //...position GVect
00174 _munhits[hit].rhit[2]);
00175 // make a unite vector from phit.
00176 //
00177 float r = sqrt(_munhits[hit].phit[0]*_munhits[hit].phit[0]+_munhits[hit].phit[1]*_munhits[hit].phit[1]+_munhits[hit].phit[2]*_munhits[hit].phit[2]);
00178 float v1=_munhits[hit].phit[0]/r;
00179 float v2=_munhits[hit].phit[1]/r;
00180 float v3=_munhits[hit].phit[2]/r;
00181
00182 /* need clarification
00183 Hep3Vector V(_munhits[hit].phit[0], //phit is the MuID PISA momentum
00184 _munhits[hit].phit[1], //...unit vector DirVect
00185 _munhits[hit].phit[2]);
00186 */
00187 Hep3Vector V(v1,v2,v3);
00188 std::vector<TMuiChannelId> twoPackList;
00189 //TMuiChannelId located at offline/packages/muigeom
00190
00191 twoPackList = TMuiGeometry::Geom()->findTwoPacks(iArm,iPlane,X,V);
00192 //TMuiGeometry located at offline/packages/muigeom
00193
00194 //for above "findTwoPacks" accessor method declared in TMuiGeometry.hh
00195 // Find two-packs in the specified plane that lie along a trajectory.
00196 // The trajectory is given by the position GVect and the unit vector
00197 // DirVect in global coordinates.
00198 /* findTwoPacks(const short& Arm, const short& Plane, const Hep3Vector& GVect,
00199 const Hep3Vector &DirVect); */
00200 if (twoPackList.size() > 0) { /* size() is method of STL vector class */
00201
00202 for (unsigned int i=0; i<twoPackList.size(); i++) {
00203 short iPanel = twoPackList[i].Panel();
00204 EOrient_t iOrient = twoPackList[i].Orient();
00205 short iTwoPack = twoPackList[i].TwoPack();
00206 mc_hit_iter->get()->add_twopack(iOrient, iPanel, iTwoPack);
00207 /* Panel(), Orient(), TwoPack() are TMuiChannelId accessor methods */
00208 /* add_two_pack is a TMuiMCHitO method */
00209 /* now the interface object contains the two_pack information */
00210 }
00211 }
00212 }
00213 // cout << "mMuiReadout-I8 finished looping through PISA data" << endl;
00214 }
|
|
|
Definition at line 60 of file mMuiSlowSim.cxx. References _mc_hit_map, _mod_par, _timer, associate_mctrk, digitize, TMuiParBase::get_verbosity, and set_interface_ptrs.
00061 {
00062
00063 _timer.get()->restart();
00064
00065 try {
00066 // Reset IOC pointers
00067 //
00068 set_interface_ptrs(top_node);
00069
00070 // Do the conversion of PISA hits to TMuiMCHit objects
00071 //
00072 digitize();
00073
00074 // Do the association between MCMuiHit and MCTrack,
00075 // MuTr slowsim has to been run first.
00076 //
00077 associate_mctrk();
00078
00079 } catch(std::exception& e) {
00080 // MODULE CODE GOES HERE
00081 //
00082 MUTOO::TRACE(e.what());
00083 return False;
00084 }
00085
00086 // If verbose dump the contents of the cluster map
00087 // Verbosity methods declared in TMuiParBase
00088
00089 _timer.get()->stop();
00090 if(_mod_par->get_verbosity() >= MUIOO::ALOT) _mc_hit_map->print();
00091 if(_mod_par->get_verbosity() >= MUIOO::SOME) _timer.get()->print();
00092 return True;
00093 }
|
|
|
Definition at line 247 of file mMuiSlowSim.cxx. References _mc_trk_map, and MUIOO::TRACE. Referenced by associate_mctrk.
00248 {
00249
00250 // Get the parent MC track information via a pisa call according to
00251 // the track id.
00252 // Insert a new mctrk into mctrkmap.
00253 // Fill in the fields.
00254 //
00255 float ptot=0, ptheta=0, pphi=0, r_vertex=0, z_vertex=0, theta_vertex=0, phi_vertex=0;
00256 int nfile=0, error=0, itparent=0, idparent=0, idpart=0;
00257
00258 int track_id = mc_hit_ptr->get()->get_track_id();
00259
00260 // Insert an new TMutMCTrk into map
00261 //
00262 TMutMCTrkMap::iterator mctrk_iter = _mc_trk_map->insert_new(mc_hit_ptr->get()->get_arm());
00263
00264 // Make the PISA call to get track data
00265 //
00266 dio_ptrkstack(&track_id, &nfile, &error, &ptot, &ptheta, &pphi,
00267 &r_vertex, &z_vertex, &theta_vertex, &phi_vertex,
00268 &itparent, &idparent, &idpart);
00269
00270 // Fill in the fields.
00271 //
00272 mctrk_iter->get()->set_arm(mc_hit_ptr->get()->get_arm());
00273 mctrk_iter->get()->set_pid(idpart);
00274 mctrk_iter->get()->set_track_id(track_id);
00275 mctrk_iter->get()->set_parent_id(idparent);
00276 mctrk_iter->get()->set_x_orig(r_vertex*sin(theta_vertex*MUIOO::DEG_TO_RAD)*cos(phi_vertex*MUIOO::DEG_TO_RAD));
00277 mctrk_iter->get()->set_y_orig(r_vertex*sin(theta_vertex*MUIOO::DEG_TO_RAD)*sin(phi_vertex*MUIOO::DEG_TO_RAD));
00278 mctrk_iter->get()->set_z_orig(z_vertex);
00279 mctrk_iter->get()->set_px_orig(ptot*sin(ptheta*MUIOO::DEG_TO_RAD)*cos(pphi*MUIOO::DEG_TO_RAD));
00280 mctrk_iter->get()->set_py_orig(ptot*sin(ptheta*MUIOO::DEG_TO_RAD)*sin(pphi*MUIOO::DEG_TO_RAD));
00281 mctrk_iter->get()->set_pz_orig(ptot*cos(ptheta*MUIOO::DEG_TO_RAD));
00282
00283 // UBER-kludge -- don't know how to get charge info -- set correctly
00284 // for muon/pion/kaon/proton at least. -- This kludge was made by sean,
00285 // not by chun, the smarter guy.
00286 //
00287 if(idpart==5 || idpart==8 || idpart == 11 || idpart == 14){
00288 mctrk_iter->get()->set_charge(1);
00289 } else if(idpart == 6 || idpart == 9 || idpart == 12 || idpart == 15) {
00290 mctrk_iter->get()->set_charge(-1);
00291 } else {
00292 MUIOO::TRACE("mMuiSlowSim got an unrecognized PID -- setting charge to 0");
00293 mctrk_iter->get()->set_charge(0);
00294 }
00295 // Do the association
00296 //
00297 PHKey::associate(mc_hit_ptr, mctrk_iter.current());
00298 }
|
|
|
Reset IOC and external interface pointers Definition at line 97 of file mMuiSlowSim.cxx. References _mc_hit_map, _mc_trk_map, _mod_par, _munhits, and _munhits_h. Referenced by event.
00098 {
00099 // module runtime parameters
00100 //
00101 _mod_par = TMutNode<mMuiSlowSimPar>::find_node(top_node,"mMuiSlowSimPar");
00102
00103 // Interface Object Container pointers for muid MC hits.
00104 //
00105 _mc_hit_map = TMutNode<TMuiMCHitMapO>::find_node(top_node,"TMuiMCHitMapO");
00106
00107 // Interface Object Containter pointers for MC tracks.
00108 //
00109 _mc_trk_map = TMutNode<TMutMCTrkMap>::find_node(top_node,"TMutMCTrkMap");
00110
00111 // PISA input in wrapped STAF table form here. Use of wrapped STAF tables
00112 // has been depreciated -- this interface will eventually go away.
00113 //
00114 munhitsWrapper* munhits_ptr= TMutNode<munhitsWrapper>::find_io_node(top_node,"munhits");
00115 _munhits_h = munhits_ptr->TableHeader();
00116 _munhits = munhits_ptr->TableData();
00117 }
|
|
|
Definition at line 71 of file mMuiSlowSim.h. Referenced by associate_mctrk, digitize, event, and set_interface_ptrs. |
|
|
Definition at line 75 of file mMuiSlowSim.h. Referenced by associate_mctrk, fill_new_mctrk, and set_interface_ptrs. |
|
|
Definition at line 67 of file mMuiSlowSim.h. Referenced by event, and set_interface_ptrs. |
|
|
Definition at line 80 of file mMuiSlowSim.h. Referenced by digitize, and set_interface_ptrs. |
|
|
Definition at line 79 of file mMuiSlowSim.h. Referenced by digitize, and set_interface_ptrs. |
|
|
Definition at line 84 of file mMuiSlowSim.h. Referenced by event. |