Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

mcchk::DetAna Class Reference

A module to check the results from the Monte Carlo generator. More...

#include <DetAna.h>

Inheritance diagram for mcchk::DetAna:

jobc::Module cfg::Observer List of all members.

Public Member Functions

 DetAna (const char *version)
 ~DetAna ()
void Update (const cfg::Config &c)
jobc::Result Ana (const edm::EventHandle &evt)

Private Attributes

rawdata::det_id_ fDetector
 ipnd, near, far
TH1F * fNumDigits
 number of digits per event
TH1F * fADCs
 adc values for each digit
TH2F * fHitCellsXView
 cells hit in the x view
TH2F * fHitCellsYView
 cells hit in the y view
int fCellsX
 number of cells in x view
int fCellsY
 number of cells in y view
int fPlanes
 number of planes

Detailed Description

A module to check the results from the Monte Carlo generator.

Definition at line 18 of file DetAna.h.


Constructor & Destructor Documentation

DetAna::DetAna const char *  version  ) 
 

Definition at line 30 of file DetAna.cxx.

References jobc::Module::SetCfgVersion().

00030                                   : 
00031   jobc::Module("mcchk::DetAna"),
00032   fNumDigits(0),
00033   fADCs(0),
00034   fHitCellsXView(0),
00035   fHitCellsYView(0)
00036 {
00037 
00038   this->SetCfgVersion(version);
00039 
00040 }

DetAna::~DetAna  ) 
 

Definition at line 48 of file DetAna.cxx.

00049 {
00050 }


Member Function Documentation

jobc::Result DetAna::Ana const edm::EventHandle evt  )  [virtual]
 

on the first time through this method declare the histograms to be used by the module.

end loop over digits

Reimplemented from jobc::Module.

Definition at line 53 of file DetAna.cxx.

References rawdata::RawDigit::ADC(), util::EDMUtils::Detector(), fADCs, fCellsX, fCellsY, fHitCellsXView, fHitCellsYView, fNumDigits, fPlanes, cmap::CMap::GetCell(), util::EDMUtils::GetCMap(), util::EDMUtils::GetGeometry(), cmap::CMap::GetPlane(), geo::Geometry::GetPlanesByView(), msg1cnt, rawdata::RawDigit::NADC(), geo::Geometry::Plane(), and edm::EventHandle::Raw().

00054 {
00057   if(!fNumDigits){
00058     geo::Geometry& geo = util::EDMUtils::GetGeometry(evt);
00059     const std::set<unsigned int> planesX = geo.GetPlanesByView(geo::kX);
00060     const std::set<unsigned int> planesY = geo.GetPlanesByView(geo::kY);
00061     fCellsX = geo.Plane(*planesX.begin()).Ncells();
00062     fCellsY = geo.Plane(*planesY.begin()).Ncells();
00063     fPlanes = planesX.size() + planesY.size();
00064     
00065     std::cout << "using geometry for " << util::EDMUtils::Detector(evt) << " x cells = " << fCellsX
00066               << " y cells = " << fCellsY << " planes = " << fPlanes << std::endl;
00067     fNumDigits     = new TH1F("fNumDigits", ";Digits;", 1000, 0., 1000.);
00068     fADCs          = new TH1F("fADCs", ";ADC;", 1000, 0., 1000.);
00069     fHitCellsXView = new TH2F("fHitCellsXView", ";Plane; Cell", 
00070                               fPlanes, 0., 1.*fPlanes, fCellsX, 0., 1.*fCellsX);
00071     fHitCellsYView = new TH2F("fHitCellsYView", ";Plane; Cell", 
00072                               fPlanes, 0., 1.*fPlanes, fCellsY, 0., 1.*fCellsY);
00073   }
00074 
00075 
00076   // Pull the Raw Digits information out
00077   std::vector<const rawdata::RawDigit*> diglist;
00078   try{ evt.Raw().Get(".", diglist); }
00079   catch(edm::Exception e){
00080     if(msg1cnt < 5){
00081       std::cerr << "no raw digit list for this event" << std::endl;
00082       ++msg1cnt;
00083     }
00084     fNumDigits->Fill(0.);
00085     return jobc::kFailed;
00086   }
00087 
00088   fNumDigits->Fill(diglist.size());
00089 
00090   geo::View_t view = geo::kX;
00091   geo::Geometry& geo = util::EDMUtils::GetGeometry(evt);
00092   cmap::CMap &cmap = util::EDMUtils::GetCMap(evt);
00093   
00094   for(unsigned int i = 0; i < diglist.size(); ++i){
00095     const rawdata::RawDigit* rd = diglist[i];
00096     for(unsigned int adc = 0; adc < rd->NADC(); ++adc)
00097       fADCs->Fill(rd->ADC(adc));
00098 
00099     // Need to ask channel map for plane and cell number.
00100     view = geo.Plane(cmap.GetPlane(rd)).View();
00101     if(view == geo::kX)
00102       fHitCellsXView->Fill(1.*cmap.GetPlane(rd)+0.5, 1.*cmap.GetCell(rd)+0.5);
00103     else if(view == geo::kY)
00104       fHitCellsYView->Fill(1.*cmap.GetPlane(rd)+0.5, 1.*cmap.GetCell(rd)+0.5);
00105   }
00106 
00107   return jobc::kPassed;
00108 }

void DetAna::Update const cfg::Config c  )  [virtual]
 

Implements cfg::Observer.

Definition at line 43 of file DetAna.cxx.

00044 { 
00045 }


Member Data Documentation

TH1F* mcchk::DetAna::fADCs [private]
 

adc values for each digit

Definition at line 30 of file DetAna.h.

Referenced by Ana().

int mcchk::DetAna::fCellsX [private]
 

number of cells in x view

Definition at line 34 of file DetAna.h.

Referenced by Ana().

int mcchk::DetAna::fCellsY [private]
 

number of cells in y view

Definition at line 35 of file DetAna.h.

Referenced by Ana().

rawdata::det_id_ mcchk::DetAna::fDetector [private]
 

ipnd, near, far

Definition at line 27 of file DetAna.h.

TH2F* mcchk::DetAna::fHitCellsXView [private]
 

cells hit in the x view

Definition at line 31 of file DetAna.h.

Referenced by Ana().

TH2F* mcchk::DetAna::fHitCellsYView [private]
 

cells hit in the y view

Definition at line 32 of file DetAna.h.

Referenced by Ana().

TH1F* mcchk::DetAna::fNumDigits [private]
 

number of digits per event

Definition at line 29 of file DetAna.h.

Referenced by Ana().

int mcchk::DetAna::fPlanes [private]
 

number of planes

Definition at line 36 of file DetAna.h.

Referenced by Ana().


The documentation for this class was generated from the following files:
Generated on Sun Nov 22 04:45:32 2009 for NOvA Offline by  doxygen 1.3.9.1