MINFEMU Class Reference

#include <MINFEMU.h>

Inheritance diagram for MINFEMU:

MINFDetector List of all members.

Public Member Functions

 MINFEMU ()
 MINFEMU (const char *name, const char *title="")
virtual ~MINFEMU ()
virtual void BookHits (REROOT_Event *revt)
virtual void DeEmbellishTrack (Int_t track)
Int_t DistancetoPrimitive (Int_t px, Int_t py)
virtual void DumpHit (Int_t ihit)
virtual Float_t GetHitELOSS (Int_t ihit)
virtual Float_t GetHitPartMom (Int_t ihit)
virtual Int_t GetIPDG (Int_t ihit)
virtual void EmbellishTrack (Int_t track)
virtual void InspectHit (Int_t ihit)
virtual void LoadPoints (Int_t track)
virtual void Paint (Option_t *opt="")
virtual void ResetPoints ()
TObjArray * Vecs ()

Private Attributes

TObjArray * fVecs

Detailed Description

Definition at line 18 of file MINFEMU.h.


Constructor & Destructor Documentation

MINFEMU::MINFEMU (  ) 

Definition at line 51 of file MINFEMU.cxx.

00052 {
00053    fNV       = 0;
00054    fNH       = 0;
00055    fIshunt   = 0;
00056    fVecs     = 0;
00057 }

MINFEMU::MINFEMU ( const char *  name,
const char *  title = "" 
)

Definition at line 60 of file MINFEMU.cxx.

References MINFDetector::fHits, MINFDetector::fIshunt, MINFDetector::fNH, MINFDetector::fNV, and fVecs.

00060                                                     :
00061    MINFDetector(name,title)
00062 {
00063 
00064 //Begin_Html
00065 /*
00066 <img src="gif/MINFEMU.gif">
00067 */
00068 //End_Html
00069 
00070    fHits = new TClonesArray("MINFEMUHit", 1500);
00071 
00072    fNV         =  1;
00073    fNH         =  3;
00074    fIshunt     =  0;
00075    fVecs       =  0;
00076 }

MINFEMU::~MINFEMU (  )  [virtual]

Definition at line 79 of file MINFEMU.cxx.

References fVecs.

00080 {
00081    if (fVecs) fVecs->Delete();
00082    delete fVecs;
00083    fVecs = 0;
00084 }


Member Function Documentation

void MINFEMU::BookHits ( REROOT_Event revt  )  [virtual]

Reimplemented from MINFDetector.

Definition at line 87 of file MINFEMU.cxx.

References REROOT_PlanePos::ActvSpec(), REROOT_EmuHit::CellPos(), REROOT_Geom::cellposs(), REROOT_Geom::curgeom(), det, MINFast::EMU, REROOT_Event::emuhits(), MINFDetector::fHits, MINFDetector::fIshunt, MINFDetector::fNhits, MINFDetector::fTrkHits, MINFast::GetNtrack(), MINFDetector::GetTrkHits(), gMINFast, REROOT_EmuHit::IPln(), REROOT_EmuHit::ITrack(), REROOT_Event::n_emuhits(), REROOT_Geom::planeposs(), REROOT_Geom::planespecs(), REROOT_Rotm::r11(), REROOT_Rotm::r12(), REROOT_Rotm::r13(), REROOT_Rotm::r21(), REROOT_Rotm::r22(), REROOT_Rotm::r23(), REROOT_Rotm::r31(), REROOT_Rotm::r32(), REROOT_Rotm::r33(), REROOT_PlanePos::RotmID(), REROOT_Geom::rotms(), REROOT_PlaneSpec::Thickness(), REROOT_EmuHit::XBegin(), REROOT_EmuHit::XEnd(), REROOT_PlanePos::XYActv(), REROOT_CellPos::XYZCenter(), REROOT_EmuHit::YBegin(), REROOT_EmuHit::YEnd(), REROOT_EmuHit::ZBegin(), REROOT_EmuHit::ZEnd(), and REROOT_PlanePos::ZFrntActv().

00088 {
00089    
00090 // Get pointer to current REROOT_Geom object.
00091    REROOT_Geom *rgeo = REROOT_Geom::curgeom();
00092 
00093 // Set detector type index from MINFast enum of detector types.
00094    Int_t det = (MINFast::DETTYPE) MINFast::EMU;
00095 
00096 // Set up fTrkHits = TObjArray by track of TObjArrays by hit.
00097    Int_t ntracks = gMINFast->GetNtrack();
00098    fTrkHits = new TObjArray(ntracks);
00099 
00100 //gmi printf("MINFEMU::BookHits: create fTrkHits for ntracks = %d\n",
00101 //gmi                                                          ntracks);
00102 //gmi printf("MINFEMU::BookHits: Tracks in fTrkHits = %d\n",
00103 //gmi                                       fTrkHits->GetEntriesFast());
00104 
00105    for (Int_t itrk=0; itrk<ntracks; itrk++) {
00106      fTrkHits->Add(new TObjArray(50));
00107 
00108 //gmi printf("MINFEMU::BookHits: addhitarray to fTrkHits for trk %d\n",
00109 //gmi                                                             itrk);
00110 //gmi printf("MINFEMU::BookHits: Tracks in fTrkHits = %d\n",
00111 //gmi                                       fTrkHits->GetEntriesFast());
00112 
00113    }
00114 
00115    TClonesArray &lhits = *fHits;
00116    const TClonesArray *emuhits = revt->emuhits();
00117    REROOT_EmuHit *emuhit;
00118 
00119    for (Int_t ihit=0; ihit<revt->n_emuhits(); ihit++) {
00120      emuhit = (REROOT_EmuHit *) emuhits->At(ihit);
00121      Int_t track = TMath::Abs(emuhit->ITrack()); // Should flag neg trks
00122 
00123 //gmi printf("MINFEMU::BookHits: processing hit %d\n",ihit);
00124 //gmi printf("MINFEMU::BookHits: Hit comes from track %d\n",
00125 //gmi                                                 emuhit->ITrack());
00126 
00127 // Kludge until emuhits gets meaningful track number.
00128      if (track >= ntracks)
00129       printf("MINFEMU::BookHits: Track no. %d >= number of tracks %d\n",
00130                                                         track, ntracks);
00131      track = TMath::Min(track, ntracks-1); 
00132 
00133 //gmi printf("MINFEMU::BookHits: Track no. converted to %d\n",track);
00134 //gmi printf("MINFEMU::BookHits: Hits so far this track = %d\n",
00135 //gmi                 ((TObjArray *) fTrkHits->At(track))->GetLast()+1);
00136 //gmi printf("MINFEMU::BookHits: Hits so far this track = %d\n",
00137 //gmi                 ((TObjArray *) GetTrkHits(track))->GetLast()+1);
00138 
00139 // Calculate XYZGlobal first.
00140      const TClonesArray *cellposs   = rgeo->cellposs();
00141      const TClonesArray *planeposs  = rgeo->planeposs();
00142      const TClonesArray *planespecs = rgeo->planespecs();
00143      const TClonesArray *rotms      = rgeo->rotms();
00144 
00145 // These lines are here for debug.  gmi
00146      if (!cellposs)   {cout << "cellposs = 0" << endl;  return;}
00147      if (!planeposs)  {cout << "planeposs = 0" << endl;  return;}
00148      if (!planespecs) {cout << "planespecs = 0" << endl;  return;}
00149      if (!rotms)      {cout << "rotms = 0" << endl;  return;}
00150 
00151 // Get pointer to REROOT_PlanePos from its TClonesArray.
00152      REROOT_PlanePos *planepos =
00153                       (REROOT_PlanePos *) planeposs->At(emuhit->IPln());
00154 
00155 // Get pointer to REROOT_PlaneSpec from its TClonesArray.
00156      REROOT_PlaneSpec *planespec =
00157               (REROOT_PlaneSpec *) planespecs->At(planepos->ActvSpec());
00158 
00159 // Get pointer to REROOT_Rotm from its TClonesArray.
00160      REROOT_Rotm *rotm = (REROOT_Rotm *) rotms->At(planepos->RotmID());
00161 
00162 // Get pointer to REROOT_CellPos from its TClonesArray.
00163      REROOT_CellPos *cellpos =
00164                      (REROOT_CellPos *) cellposs->At(emuhit->CellPos());
00165 
00166 // Calculate XYZGlobal[6] vector for hit XYZ and DIRCOSXYZ.
00167      Float_t xyz_center[3];
00168      xyz_center[0] = planepos->XYActv()[0];
00169      xyz_center[1] = planepos->XYActv()[1];
00170      xyz_center[2] = planepos->ZFrntActv() + 0.5*planespec->Thickness();
00171 
00172      Float_t xyz_inplane[3];
00173      xyz_inplane[0] = 0.5 * (emuhit->XEnd()+emuhit->XBegin()) +
00174                             (cellpos->XYZCenter()[0]);
00175      xyz_inplane[1] = 0.5 * (emuhit->YEnd()+emuhit->YBegin()) +
00176                             (cellpos->XYZCenter()[1]);
00177      xyz_inplane[2] = 0.5 * (emuhit->ZEnd()+emuhit->ZBegin()) +
00178                             (cellpos->XYZCenter()[2]);
00179 
00180      Float_t dir_inplane[3];
00181      dir_inplane[0] = emuhit->XEnd() - emuhit->XBegin();
00182      dir_inplane[1] = emuhit->YEnd() - emuhit->YBegin();
00183      dir_inplane[2] = emuhit->ZEnd() - emuhit->ZBegin();
00184 
00185      Float_t XYZGlobal[6];       // Hit positions and direction cosines.
00186 
00187 // Hit positions.
00188      XYZGlobal[0] = xyz_inplane[0]*rotm->r11() +
00189                     xyz_inplane[1]*rotm->r21() +
00190                     xyz_inplane[2]*rotm->r31() + xyz_center[0];
00191      XYZGlobal[1] = xyz_inplane[0]*rotm->r12() +
00192                     xyz_inplane[1]*rotm->r22() +
00193                     xyz_inplane[2]*rotm->r32() + xyz_center[1];
00194      XYZGlobal[2] = xyz_inplane[0]*rotm->r13() +
00195                     xyz_inplane[1]*rotm->r23() +
00196                     xyz_inplane[2]*rotm->r33() + xyz_center[2];
00197 
00198 // Hit direction cosines.
00199      XYZGlobal[3] = dir_inplane[0]*rotm->r11() +
00200                     dir_inplane[1]*rotm->r21() +
00201                     dir_inplane[2]*rotm->r31();
00202      XYZGlobal[4] = dir_inplane[0]*rotm->r12() +
00203                     dir_inplane[1]*rotm->r22() +
00204                     dir_inplane[2]*rotm->r32();
00205      XYZGlobal[5] = dir_inplane[0]*rotm->r13() +
00206                     dir_inplane[1]*rotm->r23() +
00207                     dir_inplane[2]*rotm->r33();
00208 
00209      Float_t vnorm = 0.;
00210      Int_t ic;
00211      for (ic=3; ic<6; ic++) vnorm += XYZGlobal[ic]*XYZGlobal[ic];
00212      vnorm = (vnorm==0.) ? 1. : 1./TMath::Sqrt(vnorm);
00213      for (ic=3; ic<6; ic++) XYZGlobal[ic] *= vnorm;
00214 
00215      Int_t *vol = 0;
00216      new(lhits[ihit]) MINFEMUHit(fIshunt,det,ihit,track,vol,XYZGlobal);
00217      fNhits++;
00218 
00219 //gmi printf("MINFEMU::BookHits: addhitarray to lhits for hit %d\n",
00220 //gmi                                                             ihit);
00221 //gmi printf("MINFEMU::BookHits: hits in lhits = %d\n",
00222 //gmi                                           lhits.GetEntriesFast());
00223 //gmi printf("MINFEMU::BookHits: fNhits = %d\n",fNhits);
00224 
00225 // Put pointer to this MINFEMUHit object into fTrkHits[track][itrkhit].
00226      ((TObjArray *) GetTrkHits(track))->Add(lhits[fNhits-1]);
00227 
00228    }
00229 }

void MINFEMU::DeEmbellishTrack ( Int_t  track  )  [virtual]

Reimplemented from MINFDetector.

Definition at line 232 of file MINFEMU.cxx.

References MINFDetector::DisplayList(), and Vecs().

00233 {
00234 
00235 // Remove embellishments for current track.
00236    MINFVecs *vecs = (MINFVecs *) Vecs()->UncheckedAt(track);
00237    if (DisplayList()) DisplayList()->Remove(vecs);
00238    TIter next(vecs);
00239    MINFVecLine *line;
00240    while ((line = (MINFVecLine *) next())) gPad->RecursiveRemove(line);
00241 }

Int_t MINFEMU::DistancetoPrimitive ( Int_t  px,
Int_t  py 
) [virtual]

Reimplemented from MINFDetector.

Definition at line 244 of file MINFEMU.cxx.

00245 {
00246    return 9999;
00247 }

void MINFEMU::DumpHit ( Int_t  ihit  )  [virtual]

Reimplemented from MINFDetector.

Definition at line 250 of file MINFEMU.cxx.

References REROOT_Event::emuhits(), MINFast::GetREROOTEvent(), gMINFast, and REROOT_EmuHit::printEvent().

00251 {
00252 
00253 // Dump REROOT object for selected hit.
00254 printf("MINFEMU::DumpHit number %d\n", ihit);
00255    const TClonesArray *emuhits = gMINFast->GetREROOTEvent()->emuhits();
00256    REROOT_EmuHit *emuhit = (REROOT_EmuHit *) emuhits->UncheckedAt(ihit);
00257    if (emuhit) {
00258      emuhit->printEvent(cout);
00259      emuhit->Dump();
00260    }
00261 }

void MINFEMU::EmbellishTrack ( Int_t  track  )  [virtual]

Reimplemented from MINFDetector.

Definition at line 264 of file MINFEMU.cxx.

References MINFDetector::DisplayList(), and Vecs().

00265 {
00266 
00267 // Embellish current track.
00268    MINFVecs *vecs = (MINFVecs *) Vecs()->UncheckedAt(track);
00269    if (DisplayList()) DisplayList()->Add(vecs);
00270    TIter next(vecs);
00271    MINFVecLine *line;
00272    while ((line = (MINFVecLine *) next())) {
00273      line->Draw();
00274      line->Paint();
00275    }
00276 //gmi   vecs->Draw();
00277 //gmi   vecs->Paint();
00278 }

Float_t MINFEMU::GetHitELOSS ( Int_t  ihit  )  [virtual]

Reimplemented from MINFDetector.

Definition at line 281 of file MINFEMU.cxx.

References REROOT_EmuHit::ELoss(), REROOT_Event::emuhits(), MINFast::GetREROOTEvent(), and gMINFast.

00282 {
00283 
00284 // Returns ELOSS for selected hit.
00285    const TClonesArray *emuhits = gMINFast->GetREROOTEvent()->emuhits();
00286    REROOT_EmuHit *emuhit = (REROOT_EmuHit *) emuhits->UncheckedAt(ihit);
00287    if (!emuhit) return 0.;
00288    return (emuhit->ELoss());
00289 }

Float_t MINFEMU::GetHitPartMom ( Int_t  ihit  )  [virtual]

Reimplemented from MINFDetector.

Definition at line 292 of file MINFEMU.cxx.

References REROOT_Event::emuhits(), MINFast::GetREROOTEvent(), gMINFast, and REROOT_EmuHit::Ptot().

00293 {
00294 
00295 // Returns momentum of particle causing selected hit.
00296    const TClonesArray *emuhits = gMINFast->GetREROOTEvent()->emuhits();
00297    REROOT_EmuHit *emuhit = (REROOT_EmuHit *) emuhits->UncheckedAt(ihit);
00298    if (!emuhit) return 0.;
00299    return (emuhit->Ptot());
00300 }

Int_t MINFEMU::GetIPDG ( Int_t  ihit  )  [virtual]

Reimplemented from MINFDetector.

Definition at line 303 of file MINFEMU.cxx.

References REROOT_Event::emuhits(), MINFast::GetREROOTEvent(), gMINFast, and REROOT_EmuHit::IPDG().

00304 {
00305 
00306 // Get REROOT object for selected hit.
00307    const TClonesArray *emuhits = gMINFast->GetREROOTEvent()->emuhits();
00308    REROOT_EmuHit *emuhit = (REROOT_EmuHit *) emuhits->UncheckedAt(ihit);
00309    if (emuhit) return (emuhit->IPDG());
00310    return 0;
00311 }

void MINFEMU::InspectHit ( Int_t  ihit  )  [virtual]

Reimplemented from MINFDetector.

Definition at line 314 of file MINFEMU.cxx.

References REROOT_Event::emuhits(), MINFast::GetREROOTEvent(), and gMINFast.

00315 {
00316 
00317 // Inspect REROOT object for selected hit.
00318    const TClonesArray *emuhits = gMINFast->GetREROOTEvent()->emuhits();
00319    REROOT_EmuHit *emuhit = (REROOT_EmuHit *) emuhits->UncheckedAt(ihit);
00320    if (emuhit) emuhit->Inspect();
00321 }

void MINFEMU::LoadPoints ( Int_t  track  )  [virtual]

Reimplemented from MINFDetector.

Definition at line 324 of file MINFEMU.cxx.

References MINFVecs::AddVec(), MINFEMUHit::DX(), MINFEMUHit::DY(), MINFEMUHit::DZ(), fVecs, MINFast::GetNtrack(), MINFHit::GetTrack(), MINFDetector::GetTrkHits(), gMINFast, MINFDetector::LoadPoints(), MINFVecs::SetDetector(), MINFVecs::SetParticle(), MINFVecs::SetScale(), MINFHit::X(), MINFHit::Y(), and MINFHit::Z().

00325 {
00326 // Use the parent method to store x,y,z of all hits in MINFPoints.
00327    MINFDetector::LoadPoints(track);
00328 
00329 // Store directional vectors of all hits in MINFVecs.
00330    if (fVecs == 0) fVecs = new TObjArray(gMINFast->GetNtrack());
00331    TObjArray *thits = GetTrkHits(track);
00332    Int_t nhits = thits->GetEntriesFast();
00333 
00334    if (nhits == 0) return;
00335    MINFEMUHit *ahit = (MINFEMUHit *) thits->UncheckedAt(0);
00336    MINFVecs *vecs = new MINFVecs();
00337    fVecs->AddAt(vecs,track);
00338    vecs->SetDetector(this);
00339    vecs->SetParticle(ahit->GetTrack());
00340    vecs->SetScale(0.025);            // Half-length of direction vectors
00341    for (Int_t hit=0; hit<nhits; hit++) {
00342      ahit = (MINFEMUHit *) thits->UncheckedAt(hit);
00343      vecs->AddVec(ahit->X(),  ahit->Y(),  ahit->Z(),
00344                   ahit->DX(), ahit->DY(), ahit->DZ() );
00345    }
00346 }

void MINFEMU::Paint ( Option_t *  opt = ""  )  [virtual]

Reimplemented from MINFDetector.

Definition at line 349 of file MINFEMU.cxx.

00350 {
00351 }

void MINFEMU::ResetPoints (  )  [virtual]

Reimplemented from MINFDetector.

Definition at line 354 of file MINFEMU.cxx.

References fVecs, and MINFDetector::ResetPoints().

00355 {
00356 
00357 // Call parent method.
00358    MINFDetector::ResetPoints();
00359 
00360 // Reset array of direction vectors for this detector
00361    if (fVecs) {
00362      fVecs->Delete();
00363      delete fVecs;
00364      fVecs = 0;
00365    }
00366 }

TObjArray* MINFEMU::Vecs (  )  [inline]

Definition at line 37 of file MINFEMU.h.

References fVecs.

Referenced by DeEmbellishTrack(), and EmbellishTrack().

00037 {return fVecs;}


Member Data Documentation

TObjArray* MINFEMU::fVecs [private]

Definition at line 40 of file MINFEMU.h.

Referenced by LoadPoints(), MINFEMU(), ResetPoints(), Vecs(), and ~MINFEMU().


The documentation for this class was generated from the following files:
Generated on Wed Sep 10 22:51:29 2014 for loon by  doxygen 1.4.7