CMS 3D CMS Logo

HFShowerPMT Class Reference

#include <SimG4CMS/Calo/interface/HFShowerPMT.h>

List of all members.

Public Member Functions

double getHits (G4Step *aStep)
double getRadius ()
 HFShowerPMT (std::string &name, const DDCompactView &cpv, edm::ParameterSet const &p)
virtual ~HFShowerPMT ()

Private Member Functions

std::vector< double > getDDDArray (const std::string &, const DDsvalues_type &)

Private Attributes

int indexF
int indexR
double pePerGeV
std::vector< intpmtFib1
std::vector< intpmtFib2
std::vector< intpmtR1
std::vector< intpmtR2
std::vector< double > rTable


Detailed Description

Definition at line 18 of file HFShowerPMT.h.


Constructor & Destructor Documentation

HFShowerPMT::HFShowerPMT ( std::string &  name,
const DDCompactView cpv,
edm::ParameterSet const &  p 
)

Definition at line 19 of file HFShowerPMT.cc.

References DDFilteredView::addFilter(), DDSpecificsFilter::equals, Exception, DDFilteredView::firstChild(), getDDDArray(), edm::ParameterSet::getParameter(), index, DDFilteredView::mergedSpecifics(), pePerGeV, pmtFib1, pmtFib2, pmtR1, pmtR2, rTable, DDSpecificsFilter::setCriteria(), and value.

00020                                                     {
00021 
00022   edm::ParameterSet m_HF  = p.getParameter<edm::ParameterSet>("HFShower");
00023   pePerGeV                = m_HF.getParameter<double>("PEPerGeVPMT");
00024   
00025   G4String attribute = "ReadOutName";
00026   G4String value     = name;
00027   DDSpecificsFilter filter0;
00028   DDValue           ddv0(attribute,value,0);
00029   filter0.setCriteria(ddv0,DDSpecificsFilter::equals);
00030   DDFilteredView fv0(cpv);
00031   fv0.addFilter(filter0);
00032   if (fv0.firstChild()) {
00033     DDsvalues_type sv0(fv0.mergedSpecifics());
00034 
00035     //Special Geometry parameters
00036     rTable   = getDDDArray("rTable",sv0);
00037     edm::LogInfo("HFShower") << "HFShowerPMT: " << rTable.size() 
00038                              << " rTable (cm)";
00039     for (unsigned int ig=0; ig<rTable.size(); ig++)
00040       edm::LogInfo("HFShower") << "HFShowerPMT: rTable[" << ig << "] = "
00041                                << rTable[ig]/cm << " cm";
00042   } else {
00043     edm::LogError("HFShower") << "HFShowerPMT: cannot get filtered "
00044                               << " view for " << attribute << " matching "
00045                               << value;
00046     throw cms::Exception("Unknown", "HFShowerPMT")
00047       << "cannot match " << attribute << " to " << name <<"\n";
00048   }
00049 
00050   attribute = "Volume";
00051   value     = "HFPMT";
00052   DDSpecificsFilter filter1;
00053   DDValue           ddv1(attribute,value,0);
00054   filter1.setCriteria(ddv1,DDSpecificsFilter::equals);
00055   DDFilteredView fv1(cpv);
00056   fv1.addFilter(filter1);
00057   if (fv1.firstChild()) {
00058     DDsvalues_type sv1(fv1.mergedSpecifics());
00059     std::vector<double> neta;
00060     neta = getDDDArray("indexPMTR",sv1);
00061     for (unsigned int ii=0; ii<neta.size(); ii++) {
00062       int index = static_cast<int>(neta[ii]);
00063       int ir=-1, ifib=-1;
00064       if (index >= 0) {
00065         ir   = index/10; ifib = index%10;
00066       }
00067       pmtR1.push_back(ir);
00068       pmtFib1.push_back(ifib);
00069     }
00070     neta = getDDDArray("indexPMTL",sv1);
00071     for (unsigned int ii=0; ii<neta.size(); ii++) {
00072       int index = static_cast<int>(neta[ii]);
00073       int ir=-1, ifib=-1;
00074       if (index >= 0) {
00075         ir   = index/10; ifib = index%10;
00076       }
00077       pmtR2.push_back(ir);
00078       pmtFib2.push_back(ifib);
00079     }
00080     edm::LogInfo("HFShower") << "HFShowerPMT: gets the Index matches for "
00081                              << neta.size() << " PMTs";
00082     for (unsigned int ii=0; ii<neta.size(); ii++) 
00083       edm::LogInfo("HFShower") << "HFShowerPMT: rIndexR[" << ii << "] = "
00084                                << pmtR1[ii] << " fibreR[" << ii << "] = "
00085                                << pmtFib1[ii] << " rIndexL[" << ii << "] = "
00086                                << pmtR2[ii] << " fibreL[" << ii << "] = "
00087                                << pmtFib2[ii];
00088   } else {
00089     edm::LogWarning("HFShower") << "HFShowerPMT: cannot get filtered "
00090                                 << " view for " << attribute << " matching "
00091                                 << value;
00092   }
00093 
00094 }

HFShowerPMT::~HFShowerPMT (  )  [virtual]

Definition at line 96 of file HFShowerPMT.cc.

00096 {}


Member Function Documentation

std::vector< double > HFShowerPMT::getDDDArray ( const std::string &  str,
const DDsvalues_type sv 
) [private]

Definition at line 137 of file HFShowerPMT.cc.

References DDfetch(), DDValue::doubles(), Exception, LogDebug, and value.

Referenced by HFShowerPMT().

00138                                                                         {
00139 
00140   LogDebug("HFShower") << "HFShowerPMT:getDDDArray called for " << str;
00141 
00142   DDValue value(str);
00143   if (DDfetch(&sv,value)) {
00144     LogDebug("HFShower") << value;
00145     const std::vector<double> & fvec = value.doubles();
00146     int nval = fvec.size();
00147     if (nval < 2) {
00148       edm::LogError("HFShower") << "HFShowerPMT : # of " << str 
00149                                 << " bins " << nval << " < 2 ==> illegal";
00150       throw cms::Exception("Unknown", "HFShowerPMT")
00151         << "nval < 2 for array " << str << "\n";
00152     }
00153 
00154     return fvec;
00155   } else {
00156     edm::LogError("HFShower") << "HFShowerPMT : cannot get array " << str;
00157     throw cms::Exception("Unknown", "HFShowerPMT") 
00158       << "cannot get array " << str << "\n";
00159   }
00160 }

double HFShowerPMT::getHits ( G4Step *  aStep  ) 

Definition at line 98 of file HFShowerPMT.cc.

References indexF, indexR, LogDebug, pePerGeV, pmtFib1, pmtFib2, pmtR1, and pmtR2.

Referenced by HCalSD::getHitPMT().

00098                                           {
00099 
00100   double edep = aStep->GetTotalEnergyDeposit();
00101   indexR = indexF = -1;
00102 
00103   G4StepPoint * preStepPoint  = aStep->GetPreStepPoint(); 
00104   const G4VTouchable* touch   = preStepPoint->GetTouchable();
00105   int                 boxNo   = touch->GetReplicaNumber(2);
00106   int                 pmtNo   = touch->GetReplicaNumber(1);
00107   if (boxNo <= 1) {
00108     indexR = pmtR1[pmtNo-1];
00109     indexF = pmtFib1[pmtNo-1];
00110   } else {
00111     indexR = pmtR2[pmtNo-1];
00112     indexF = pmtFib2[pmtNo-1];
00113   }
00114 
00115   LogDebug("HFShower") << "HFShowerPMT: Box " << boxNo << " PMT "
00116                        << pmtNo << " Mapped Indices " << indexR << ", "
00117                        << indexF << " Edeposit " << edep/MeV << " MeV; PE "
00118                        << edep*pePerGeV/GeV;
00119   if (indexR >= 0 && indexF > 0) return edep*pePerGeV/GeV;
00120   else                           return 0;
00121 }

double HFShowerPMT::getRadius (  ) 

Definition at line 123 of file HFShowerPMT.cc.

References indexF, indexR, LogDebug, r, and rTable.

Referenced by HCalSD::getHitPMT().

00123                               {
00124    
00125   double r = 0.;
00126   if (indexR >= 0 && indexR+1 < (int)(rTable.size()))
00127     r = 0.5*(rTable[indexR]+rTable[indexR+1]);
00128   else
00129     LogDebug("HFShower") << "HFShowerPMT::getRadius: R " << indexR
00130                          << " F " << indexF;
00131   if (indexF == 2)  r =-r;
00132   LogDebug("HFShower") << "HFShower: Radius (" << indexR << "/" << indexF 
00133                        << ") " << r;
00134   return r;
00135 }


Member Data Documentation

int HFShowerPMT::indexF [private]

Definition at line 35 of file HFShowerPMT.h.

Referenced by getHits(), and getRadius().

int HFShowerPMT::indexR [private]

Definition at line 35 of file HFShowerPMT.h.

Referenced by getHits(), and getRadius().

double HFShowerPMT::pePerGeV [private]

Definition at line 34 of file HFShowerPMT.h.

Referenced by getHits(), and HFShowerPMT().

std::vector<int> HFShowerPMT::pmtFib1 [private]

Definition at line 37 of file HFShowerPMT.h.

Referenced by getHits(), and HFShowerPMT().

std::vector<int> HFShowerPMT::pmtFib2 [private]

Definition at line 38 of file HFShowerPMT.h.

Referenced by getHits(), and HFShowerPMT().

std::vector<int> HFShowerPMT::pmtR1 [private]

Definition at line 37 of file HFShowerPMT.h.

Referenced by getHits(), and HFShowerPMT().

std::vector<int> HFShowerPMT::pmtR2 [private]

Definition at line 38 of file HFShowerPMT.h.

Referenced by getHits(), and HFShowerPMT().

std::vector<double> HFShowerPMT::rTable [private]

Definition at line 36 of file HFShowerPMT.h.

Referenced by getRadius(), and HFShowerPMT().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:24:13 2009 for CMSSW by  doxygen 1.5.4