BeamMCloss Class Reference

Job module which evaluates track energy loss in GEANT. More...

#include <BeamMCloss.h>

Inheritance diagram for BeamMCloss:

JobCModule CfgObserver List of all members.

Public Member Functions

 BeamMCloss (const char *version)
 ~BeamMCloss ()
JobCResult Reco (EDMEventHandle &evt)
void Update (const CfgConfig &)

Private Attributes

TProfile * fELost [6]
TH2F * fELost2D [6]

Detailed Description

Job module which evaluates track energy loss in GEANT.

Definition at line 18 of file BeamMCloss.h.


Constructor & Destructor Documentation

BeamMCloss::BeamMCloss ( const char *  version  ) 

Definition at line 28 of file BeamMCloss.cxx.

References name.

00028                                           :
00029   JobCModule("BeamMCloss")
00030 {
00031   SetCfgVersion(version);
00032   char name[256], title[256];
00033   for (int i = 0; i < 6; ++i) {
00034     sprintf(name, "elost%d", i + 1);
00035     sprintf(title, "Fraction of momentum lost in Chamber %d", i + 1);
00036     fELost[i] = new TProfile(name, title, 120, 0, 120);
00037 
00038     sprintf(name, "elost2d%d", i + 1);
00039     fELost2D[i] = new TH2F(name, title, 120, 0, 120, 1000, 0, 0.1);
00040   }
00041 }

BeamMCloss::~BeamMCloss (  )  [inline]

Definition at line 21 of file BeamMCloss.h.

00021 {;}


Member Function Documentation

JobCResult BeamMCloss::Reco ( EDMEventHandle evt  )  [virtual]

Reimplemented from JobCModule.

Definition at line 45 of file BeamMCloss.cxx.

References cham, GMIPPGeo::Cham(), fELost, fELost2D, geo, EDMEventHandle::Header(), GMIPPGeo::Instance(), EDMEventHeader::IsMC(), kDC1, JobCModule::kFailed, JobCModule::kPassed, kPWC6, MCTruth::Ntrack(), p, MCTrack::Particle(), MCCParticle::Q(), GMIPPGeo::TPC(), MCTruth::Track(), GChamGeo::Z(), and GTPCGeo::ZMin().

00046 {
00047   if (!evt.Header().IsMC()) return kFailed;
00048   MCTruth mct(evt);
00049 
00050   for (int i = 0; i < mct.Ntrack(); ++i) {
00051     const MCTrack& trk = mct.Track(i);
00052 
00053     const MCCParticle& part = trk.Particle();
00054     // Make sure that track is not empty and came from a charged particle
00055     if (part.Q() == 0 || trk.empty()) continue;
00056 
00057     // Use only tracks that
00058     if (trk.back()->Z() < GMIPPGeo::Instance().Cham(kPWC6).Z(1) - 1) 
00059       continue;
00060 
00061     if (part.Vz() > GMIPPGeo::Instance().TPC().ZMin() + 20) continue;
00062 
00063     for (unsigned int j = 0; j < trk.size(); ++j) {
00064       const MCCHit* hit = trk[j];
00065       for (int cham = kPWC6; cham >= kDC1; cham--) {
00066     GChamGeo& geo = GMIPPGeo::Instance().Cham(cham);
00067     if (hit->Z() < geo.Z(4) + 1 && 
00068         hit->Z() > geo.Z(1) - 1) {
00069       double p = 1 - sqrt(hit->Px() * hit->Px() +
00070                   hit->Py() * hit->Py() +
00071                   hit->Pz() * hit->Pz()) / part.P();
00072 
00073       // Do not use outliers
00074       if (p < 0.1) {
00075         fELost[cham - 3]->Fill(part.P(), p);
00076         fELost2D[cham - 3]->Fill(part.P(), p);
00077       }
00078 
00079       break;
00080     }
00081       }
00082     }
00083       
00084   }
00085 
00086   return kPassed;
00087 }

void BeamMCloss::Update ( const CfgConfig  )  [inline, virtual]

Implements CfgObserver.

Definition at line 24 of file BeamMCloss.h.

00024 {;}


Member Data Documentation

TProfile* BeamMCloss::fELost[6] [private]

Definition at line 27 of file BeamMCloss.h.

Referenced by Reco().

TH2F* BeamMCloss::fELost2D[6] [private]

Definition at line 28 of file BeamMCloss.h.

Referenced by Reco().


The documentation for this class was generated from the following files:
Generated on Mon Nov 23 08:03:58 2009 for MIPP(E907) by  doxygen 1.4.7