ScintHitAna Class Reference

#include <ScintHitAna.h>

Inheritance diagram for ScintHitAna:
JobCModule

List of all members.

Public Member Functions

 ScintHitAna ()
 ~ScintHitAna ()
JobCResult Ana (const MomNavigator *mom)

Private Attributes

TFile * fTreeFile
TTree * fTree
DigiScintHitfHit
MyGeomfGeom
Int_t fEvent

Detailed Description

Definition at line 28 of file ScintHitAna.h.


Constructor & Destructor Documentation

ScintHitAna::ScintHitAna (  ) 

Definition at line 26 of file ScintHitAna.cxx.

00027 {
00028   //======================================================================
00029   // Make a tree.
00030   //======================================================================
00031   fTreeFile = new TFile("scinthits.root","RECREATE");
00032   fTree = new TTree("shtree","shtree");
00033   fTree->Branch("scinthit","DigiScintHit",&fHit,32000,1);
00034   fTree->Branch("geom","MyGeom",&fGeom,32000,1);
00035   fTree->Branch("event",&fEvent,"event/I");
00036   fEvent = 0;
00037   fGeom = new MyGeom;
00038 }

ScintHitAna::~ScintHitAna (  ) 

Definition at line 42 of file ScintHitAna.cxx.

References fTree, and fTreeFile.

00043 {
00044 //======================================================================
00045 // Close the file
00046 //======================================================================
00047   fTreeFile->cd();
00048   fTree->Write();
00049   fTreeFile->Close();
00050   delete fTreeFile;
00051   delete fTree;
00052 }


Member Function Documentation

JobCResult ScintHitAna::Ana ( const MomNavigator mom  )  [virtual]

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 56 of file ScintHitAna.cxx.

References fEvent, fGeom, fHit, RecDataRecord< T >::FindComponent(), MomNavigator::FragmentIter(), fTree, UgliStripHandle::GetHalfLength(), UgliStripHandle::GetHalfThickness(), UgliStripHandle::GetHalfWidth(), SimSnarlRecord::GetSimSnarlHeader(), UgliGeomHandle::GetStripHandle(), RecHeader::GetVldContext(), Msg::kError, JobCResult::kFailed, JobCResult::kPassed, MyGeom::length, MSG, DigiScintHit::StripEndId(), MyGeom::thickness, and MyGeom::width.

00057 {
00058 //======================================================================
00059 // Fill the tree.
00060 //======================================================================
00061   
00062   SimSnarlRecord* simsnarl = 0;
00063   TObject* tobj;
00064   TIter    fragiter = mom->FragmentIter();
00065   
00066   // Get the simsnarl.
00067   while( ( tobj = fragiter.Next() ) ) {
00068     simsnarl = dynamic_cast<SimSnarlRecord*>(tobj);
00069     if(simsnarl) break;
00070   }
00071   const SimSnarlHeader* simHeader = simsnarl->GetSimSnarlHeader();
00072   if(simHeader ==0){
00073     MSG("Photon",Msg::kError) << "Cannot find SimSnarlHeader in SimSnarl." << endl;
00074     return JobCResult::kFailed;
00075   }
00076   
00077   // We need a context to do table lookups
00078   VldContext simContext = simHeader->GetVldContext();
00079   
00080   
00081   // Get the DigiScintHits.
00082   // Get the scint hit array.
00083   const TObjArray* hitArray = 
00084     dynamic_cast<const TObjArray*>(simsnarl->FindComponent(0,"DigiScintHits"));
00085   if(hitArray==0) {
00086     cout << "Can't find scint hit array.\n"; 
00087     return JobCResult::kPassed;  
00088   };
00089   
00090   
00091   // Fill the tree.
00092   UgliGeomHandle ugli(simContext);
00093   
00094   TIter hitarrayIter(hitArray);
00095   while( (tobj = hitarrayIter.Next()) ) {
00096     const DigiScintHit* scinthit = dynamic_cast<DigiScintHit*>(tobj);
00097     if(scinthit) {
00098       fHit = const_cast<DigiScintHit*>(scinthit);
00099 
00100       UgliStripHandle strip = ugli.GetStripHandle(scinthit->StripEndId());
00101       fGeom->length = strip.GetHalfLength();
00102       fGeom->width  = strip.GetHalfWidth();
00103       fGeom->thickness = strip.GetHalfThickness();
00104 
00105       fTree->Fill();
00106 
00107     }
00108   }
00109   
00110 
00111   fEvent++;
00112 
00113   return JobCResult::kPassed; // kNoDecision, kFailed, etc.
00114 }


Member Data Documentation

Int_t ScintHitAna::fEvent [private]

Definition at line 47 of file ScintHitAna.h.

Referenced by Ana().

Definition at line 46 of file ScintHitAna.h.

Referenced by Ana().

Definition at line 45 of file ScintHitAna.h.

Referenced by Ana().

TTree* ScintHitAna::fTree [private]

Definition at line 42 of file ScintHitAna.h.

Referenced by Ana(), and ~ScintHitAna().

TFile* ScintHitAna::fTreeFile [private]

Definition at line 41 of file ScintHitAna.h.

Referenced by ~ScintHitAna().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1