#include <HcalPulseShapes.h>
Public Types | |
typedef HcalPulseShape | Shape |
Public Member Functions | |
void | beginRun (edm::EventSetup const &es) |
const Shape & | defaultShape (const HcalDetId &detId) const |
in case of conditions problems | |
void | endRun () |
const Shape & | getShape (int shapeType) const |
const Shape & | hbShape () const |
HcalPulseShapes () | |
const Shape & | heShape () const |
const Shape & | hfShape () const |
const Shape & | hoShape (bool sipm=false) const |
const Shape & | shape (const HcalDetId &detId) const |
automatically figures out which shape to return | |
const Shape & | shapeForReco (const HcalDetId &detId) const |
~HcalPulseShapes () | |
Private Types | |
typedef std::map< int, const Shape * > | ShapeMap |
Private Member Functions | |
void | computeHFShape () |
void | computeHPDShape (float, float, float, float, float, float, float, float, Shape &) |
void | computeSiPMShape () |
Private Attributes | |
Shape | hfShape_ |
Shape | hpdBV30Shape_v2 |
Shape | hpdBV30ShapeMC_v2 |
Shape | hpdShape_ |
Shape | hpdShape_v2 |
Shape | hpdShape_v3 |
Shape | hpdShapeMC_v2 |
Shape | hpdShapeMC_v3 |
Shape | siPMShape_ |
const HcalMCParams * | theMCParams |
const HcalRecoParams * | theRecoParams |
ShapeMap | theShapes |
const HcalTopology * | theTopology |
typedef HcalPulseShape HcalPulseShapes::Shape |
Definition at line 21 of file HcalPulseShapes.h.
typedef std::map<int, const Shape *> HcalPulseShapes::ShapeMap [private] |
Definition at line 52 of file HcalPulseShapes.h.
HcalPulseShapes::HcalPulseShapes | ( | ) |
Definition at line 21 of file HcalPulseShapes.cc.
References computeHFShape(), computeHPDShape(), computeSiPMShape(), hfShape_, hpdBV30Shape_v2, hpdBV30ShapeMC_v2, hpdShape_, hpdShape_v2, hpdShape_v3, hpdShapeMC_v2, hpdShapeMC_v3, siPMShape_, and theShapes.
: theMCParams(0), theTopology(0), theRecoParams(0), theShapes() { /* Reco MC -------------------------------------------------------------------------------------- 000 not used (reserved) 101 101 hpdShape_ HPD (original version) 102 102 =101 HPD BV 30 volts in HBP iphi54 103 123 hpdShape_v2, hpdShapeMC_v2 HPD (2011. oct version) 104 124 hpdBV30Shape_v2, hpdBV30ShapeMC_v2 HPD bv30 in HBP iph54 105 125 hpdShape_v2, hpdShapeMC_v2 HPD (2011.11.12 version) 201 201 siPMShape_ SiPMs Zecotec shape (HO) 202 202 =201, SiPMs Hamamatsu shape (HO) 301 301 hfShape_ regular HF PMT shape 401 401 regular ZDC shape -------------------------------------------------------------------------------------- */ float ts1, ts2, ts3, thpd, tpre, wd1, wd2, wd3; // HPD Shape Version 1 (used before CMSSW5, until Oct 2011) ts1=8. ; ts2=10. ; ts3=29.3; thpd=4.0; tpre=9.0; wd1=2.0; wd2=0.7; wd3=1.0; computeHPDShape(ts1,ts2,ts3,thpd,tpre,wd1,wd2,wd3, hpdShape_); theShapes[101] = &hpdShape_; theShapes[102] = theShapes[101]; // HPD Shape Version 2 for CMSSW 5. Nov 2011 (RECO and MC separately) ts1=8. ; ts2=10. ; ts3=25.0; thpd=4.0; tpre=9.0; wd1=2.0; wd2=0.7; wd3=1.0; computeHPDShape(ts1,ts2,ts3,thpd,tpre,wd1,wd2,wd3, hpdShape_v2); theShapes[103] = &hpdShape_v2; ts1=8. ; ts2=10. ; ts3=29.3; thpd=4.0; tpre=7.0; wd1=2.0; wd2=0.7; wd3=1.0; computeHPDShape(ts1,ts2,ts3,thpd,tpre,wd1,wd2,wd3, hpdShapeMC_v2); theShapes[123] = &hpdShapeMC_v2; // HPD Shape Version 3 for CMSSW 5. Nov 2011 (RECO and MC separately) ts1=8. ; ts2=19. ; ts3=29.3; thpd=4.0; tpre=9.0; wd1=2.0; wd2=0.7; wd3=0.32; computeHPDShape(ts1,ts2,ts3,thpd,tpre,wd1,wd2,wd3, hpdShape_v3); theShapes[105] = &hpdShape_v3; ts1=8. ; ts2=10. ; ts3=22.3; thpd=4.0; tpre=7.0; wd1=2.0; wd2=0.7; wd3=1.0; computeHPDShape(ts1,ts2,ts3,thpd,tpre,wd1,wd2,wd3, hpdShapeMC_v3); theShapes[125] = &hpdShapeMC_v3; // HPD with Bias Voltage 30 volts, wider pulse. (HBPlus iphi54) ts1=8. ; ts2=12. ; ts3=31.7; thpd=9.0; tpre=9.0; wd1=2.0; wd2=0.7; wd3=1.0; computeHPDShape(ts1,ts2,ts3,thpd,tpre,wd1,wd2,wd3, hpdBV30Shape_v2); theShapes[104] = &hpdBV30Shape_v2; ts1=8. ; ts2=12. ; ts3=31.7; thpd=9.0; tpre=9.0; wd1=2.0; wd2=0.7; wd3=1.0; computeHPDShape(ts1,ts2,ts3,thpd,tpre,wd1,wd2,wd3, hpdBV30ShapeMC_v2); theShapes[124] = &hpdBV30ShapeMC_v2; // HF and SiPM computeHFShape(); computeSiPMShape(); theShapes[201] = &siPMShape_; theShapes[202] = theShapes[201]; theShapes[301] = &hfShape_; //theShapes[401] = new CaloCachedShapeIntegrator(&theZDCShape); /* // backward-compatibility with old scheme theShapes[0] = theShapes[101]; //FIXME "special" HB theShapes[1] = theShapes[101]; theShapes[2] = theShapes[201]; theShapes[3] = theShapes[301]; //theShapes[4] = theShapes[401]; */ }
HcalPulseShapes::~HcalPulseShapes | ( | ) |
Definition at line 104 of file HcalPulseShapes.cc.
References theMCParams, theRecoParams, and theTopology.
{ if (theMCParams) delete theMCParams; if (theRecoParams) delete theRecoParams; if (theTopology) delete theTopology; }
void HcalPulseShapes::beginRun | ( | edm::EventSetup const & | es | ) |
Definition at line 111 of file HcalPulseShapes.cc.
References edm::EventSetup::get(), AlCaHLTBitMon_ParallelJobs::p, edm::ESHandle< T >::product(), lumiQueryAPI::q, HcalCondObjectContainerBase::setTopo(), theMCParams, theRecoParams, and theTopology.
Referenced by HcalPulseContainmentManager::beginRun().
{ edm::ESHandle<HcalMCParams> p; es.get<HcalMCParamsRcd>().get(p); theMCParams = new HcalMCParams(*p.product()); edm::ESHandle<HcalTopology> htopo; es.get<IdealGeometryRecord>().get(htopo); theTopology=new HcalTopology(*htopo); theMCParams->setTopo(theTopology); edm::ESHandle<HcalRecoParams> q; es.get<HcalRecoParamsRcd>().get(q); theRecoParams = new HcalRecoParams(*q.product()); theRecoParams->setTopo(theTopology); // std::cout<<" skdump in HcalPulseShapes::beginRun dupm MCParams "<<std::endl; // std::ofstream skfile("skdumpMCParamsNewFormat.txt"); // HcalDbASCIIIO::dumpObject(skfile, (*theMCParams) ); }
void HcalPulseShapes::computeHFShape | ( | ) | [private] |
Definition at line 257 of file HcalPulseShapes.cc.
References funct::exp(), hfShape_, j, SiStripMonitorClusterAlca_cfi::k0, p1, p2, p4, HcalPulseShape::setNBin(), and HcalPulseShape::setShapeBin().
Referenced by HcalPulseShapes().
{ // first create pulse shape over a range of time 0 ns to 255 ns in 1 ns steps unsigned int nbin = 256; hfShape_.setNBin(nbin); std::vector<float> ntmp(nbin,0.0); // const float k0=0.7956; // shape parameters const float p2=1.355; const float p4=2.327; const float p1=4.3; // position parameter float norm = 0.0; for(unsigned int j = 0; j < 25 && j < nbin; ++j){ float r0 = j-p1; float sigma0 = (r0<0) ? p2 : p2*p4; r0 /= sigma0; if(r0 < k0) ntmp[j] = exp(-0.5*r0*r0); else ntmp[j] = exp(0.5*k0*k0-k0*r0); norm += ntmp[j]; } // normalize pulse area to 1.0 for(unsigned int j = 0; j < 25 && j < nbin; ++j){ ntmp[j] /= norm; hfShape_.setShapeBin(j,ntmp[j]); } }
void HcalPulseShapes::computeHPDShape | ( | float | ts1, |
float | ts2, | ||
float | ts3, | ||
float | thpd, | ||
float | tpre, | ||
float | wd1, | ||
float | wd2, | ||
float | wd3, | ||
Shape & | tmphpdShape_ | ||
) | [private] |
Definition at line 147 of file HcalPulseShapes.cc.
References funct::exp(), i, j, gen::k, HcalPulseShape::setNBin(), HcalPulseShape::setShapeBin(), and tmax.
Referenced by HcalPulseShapes().
{ /* std::cout << "o HcalPulseShapes::computeHPDShape " << " ts1, ts2, ts3, thpd, tpre, w1, w2, w3 =" << ts1 << ", " << ts2 << ", " << ts3 << ", " << thpd << ", " << tpre << ", " << wd1 << ", " << wd2 << ", " << wd3 << std::endl; */ // pulse shape time constants in ns /* const float ts1 = 8.; // scintillation time constants : 1,2,3 const float ts2 = 10.; const float ts3 = 29.3; const float thpd = 4.; // HPD current collection drift time const float tpre = 9.; // preamp time constant (refit on TB04 data) const float wd1 = 2.; // relative weights of decay exponents const float wd2 = 0.7; const float wd3 = 1.; */ // pulse shape componnts over a range of time 0 ns to 255 ns in 1 ns steps unsigned int nbin = 256; tmphpdShape_.setNBin(nbin); std::vector<float> ntmp(nbin,0.0); // zeroing output pulse shape std::vector<float> nth(nbin,0.0); // zeroing HPD drift shape std::vector<float> ntp(nbin,0.0); // zeroing Binkley preamp shape std::vector<float> ntd(nbin,0.0); // zeroing Scintillator decay shape unsigned int i,j,k; float norm; // HPD starts at I and rises to 2I in thpd of time norm=0.0; for(j=0;j<thpd && j<nbin;j++){ nth[j] = 1.0 + ((float)j)/thpd; norm += nth[j]; } // normalize integrated current to 1.0 for(j=0;j<thpd && j<nbin;j++){ nth[j] /= norm; } // Binkley shape over 6 time constants norm=0.0; for(j=0;j<6*tpre && j<nbin;j++){ ntp[j] = ((float)j)*exp(-((float)(j*j))/(tpre*tpre)); norm += ntp[j]; } // normalize pulse area to 1.0 for(j=0;j<6*tpre && j<nbin;j++){ ntp[j] /= norm; } // ignore stochastic variation of photoelectron emission // <...> // effective tile plus wave-length shifter decay time over 4 time constants unsigned int tmax = 6 * (int)ts3; norm=0.0; for(j=0;j<tmax && j<nbin;j++){ ntd[j] = wd1 * exp(-((float)j)/ts1) + wd2 * exp(-((float)j)/ts2) + wd3 * exp(-((float)j)/ts3) ; norm += ntd[j]; } // normalize pulse area to 1.0 for(j=0;j<tmax && j<nbin;j++){ ntd[j] /= norm; } unsigned int t1,t2,t3,t4; for(i=0;i<tmax && i<nbin;i++){ t1 = i; // t2 = t1 + top*rand; // ignoring jitter from optical path length t2 = t1; for(j=0;j<thpd && j<nbin;j++){ t3 = t2 + j; for(k=0;k<4*tpre && k<nbin;k++){ // here "4" is set deliberately, t4 = t3 + k; // as in test fortran toy MC ... if(t4<nbin){ unsigned int ntb=t4; ntmp[ntb] += ntd[i]*nth[j]*ntp[k]; } } } } // normalize for 1 GeV pulse height norm = 0.; for(i=0;i<nbin;i++){ norm += ntmp[i]; } //cout << " Convoluted SHAPE ============== " << endl; for(i=0; i<nbin; i++){ ntmp[i] /= norm; // cout << " shape " << i << " = " << ntmp[i] << endl; } for(i=0; i<nbin; i++){ tmphpdShape_.setShapeBin(i,ntmp[i]); } }
void HcalPulseShapes::computeSiPMShape | ( | ) | [private] |
Definition at line 287 of file HcalPulseShapes.cc.
References j, nt, HcalPulseShape::setNBin(), HcalPulseShape::setShapeBin(), and siPMShape_.
Referenced by HcalPulseShapes().
{ unsigned int nbin = 512; siPMShape_.setNBin(nbin); std::vector<float> nt(nbin,0.0); // double norm = 0.; for (unsigned int j = 0; j < nbin; ++j) { if (j <= 31.) nt[j] = 2.15*j; else if ((j > 31) && (j <= 96)) nt[j] = 102.1 - 1.12*j; else nt[j] = 0.0076*j - 6.4; norm += (nt[j]>0) ? nt[j] : 0.; } for (unsigned int j = 0; j < nbin; ++j) { nt[j] /= norm; siPMShape_.setShapeBin(j,nt[j]); } }
const HcalPulseShapes::Shape & HcalPulseShapes::defaultShape | ( | const HcalDetId & | detId | ) | const |
in case of conditions problems
Definition at line 385 of file HcalPulseShapes.cc.
References Exception, hbShape(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, heShape(), hfShape(), hoShape(), and HcalDetId::subdet().
Referenced by shape(), and shapeForReco().
{ edm::LogWarning("HcalPulseShapes") << "Cannot find HCAL MC Params "; HcalSubdetector subdet = detId.subdet(); switch(subdet) { case HcalBarrel: return hbShape(); case HcalEndcap: return heShape(); case HcalForward: return hfShape(); case HcalOuter: //FIXME doesn't look for SiPMs return hoShape(false); default: throw cms::Exception("HcalPulseShapes") << "unknown detId"; break; } }
void HcalPulseShapes::endRun | ( | ) |
Definition at line 133 of file HcalPulseShapes.cc.
References theMCParams, theRecoParams, and theTopology.
Referenced by HcalPulseContainmentManager::endRun().
{ if (theMCParams) delete theMCParams; if (theRecoParams) delete theRecoParams; if (theTopology) delete theTopology; theMCParams = 0; theRecoParams = 0; theTopology = 0; }
const HcalPulseShapes::Shape & HcalPulseShapes::getShape | ( | int | shapeType | ) | const |
Definition at line 312 of file HcalPulseShapes.cc.
References Exception, hpdShape_, and theShapes.
Referenced by HcalShape::setShape().
{ // std::cout << "- HcalPulseShapes::Shape for type "<< shapeType // << std::endl; ShapeMap::const_iterator shapeMapItr = theShapes.find(shapeType); if(shapeMapItr == theShapes.end()) { throw cms::Exception("HcalPulseShapes") << "unknown shapeType"; return hpdShape_; // should not return this, but... } else { return *(shapeMapItr->second); } }
const Shape& HcalPulseShapes::hbShape | ( | ) | const [inline] |
Definition at line 28 of file HcalPulseShapes.h.
References hpdShape_.
Referenced by defaultShape(), HBHEPulseShapeFlagSetter::Initialize(), and HcalNoiseMonitor::ReadHcalPulse().
{ return hpdShape_; }
const Shape& HcalPulseShapes::heShape | ( | ) | const [inline] |
Definition at line 29 of file HcalPulseShapes.h.
References hpdShape_.
Referenced by defaultShape().
{ return hpdShape_; }
const Shape& HcalPulseShapes::hfShape | ( | ) | const [inline] |
Definition at line 30 of file HcalPulseShapes.h.
References hfShape_.
Referenced by defaultShape().
{ return hfShape_; }
const Shape& HcalPulseShapes::hoShape | ( | bool | sipm = false | ) | const [inline] |
Definition at line 31 of file HcalPulseShapes.h.
References hpdShape_, and siPMShape_.
Referenced by defaultShape().
{ return sipm ? siPMShape_ : hpdShape_; }
const HcalPulseShapes::Shape & HcalPulseShapes::shape | ( | const HcalDetId & | detId | ) | const |
automatically figures out which shape to return
Definition at line 329 of file HcalPulseShapes.cc.
References defaultShape(), HcalCondObjectContainer< Item >::getValues(), HcalMCParam::signalShape(), theMCParams, and theShapes.
{ if(!theMCParams) { return defaultShape(detId); } int shapeType = theMCParams->getValues(detId)->signalShape(); /* int sub = detId.subdet(); int depth = detId.depth(); int inteta = detId.ieta(); int intphi = detId.iphi(); std::cout << " HcalPulseShapes::shape cell:" << " sub, ieta, iphi, depth = " << sub << " " << inteta << " " << intphi << " " << depth << " => ShapeId "<< shapeType << std::endl; */ ShapeMap::const_iterator shapeMapItr = theShapes.find(shapeType); if(shapeMapItr == theShapes.end()) { return defaultShape(detId); } else { return *(shapeMapItr->second); } }
const HcalPulseShapes::Shape & HcalPulseShapes::shapeForReco | ( | const HcalDetId & | detId | ) | const |
Definition at line 356 of file HcalPulseShapes.cc.
References defaultShape(), HcalCondObjectContainer< Item >::getValues(), DetId::rawId(), theRecoParams, and theShapes.
Referenced by HcalPulseContainmentManager::get().
{ if(!theRecoParams) { return defaultShape(detId); } int shapeType = theRecoParams->getValues(detId.rawId())->pulseShapeID(); /* int sub = detId.subdet(); int depth = detId.depth(); int inteta = detId.ieta(); int intphi = detId.iphi(); std::cout << ">> HcalPulseShapes::shapeForReco cell:" << " sub, ieta, iphi, depth = " << sub << " " << inteta << " " << intphi << " " << depth << " => ShapeId "<< shapeType << std::endl; */ ShapeMap::const_iterator shapeMapItr = theShapes.find(shapeType); if(shapeMapItr == theShapes.end()) { return defaultShape(detId); } else { return *(shapeMapItr->second); } }
Shape HcalPulseShapes::hfShape_ [private] |
Definition at line 45 of file HcalPulseShapes.h.
Referenced by computeHFShape(), HcalPulseShapes(), and hfShape().
Shape HcalPulseShapes::hpdBV30Shape_v2 [private] |
Definition at line 48 of file HcalPulseShapes.h.
Referenced by HcalPulseShapes().
Shape HcalPulseShapes::hpdBV30ShapeMC_v2 [private] |
Definition at line 48 of file HcalPulseShapes.h.
Referenced by HcalPulseShapes().
Shape HcalPulseShapes::hpdShape_ [private] |
Definition at line 45 of file HcalPulseShapes.h.
Referenced by getShape(), hbShape(), HcalPulseShapes(), heShape(), and hoShape().
Shape HcalPulseShapes::hpdShape_v2 [private] |
Definition at line 46 of file HcalPulseShapes.h.
Referenced by HcalPulseShapes().
Shape HcalPulseShapes::hpdShape_v3 [private] |
Definition at line 47 of file HcalPulseShapes.h.
Referenced by HcalPulseShapes().
Shape HcalPulseShapes::hpdShapeMC_v2 [private] |
Definition at line 46 of file HcalPulseShapes.h.
Referenced by HcalPulseShapes().
Shape HcalPulseShapes::hpdShapeMC_v3 [private] |
Definition at line 47 of file HcalPulseShapes.h.
Referenced by HcalPulseShapes().
Shape HcalPulseShapes::siPMShape_ [private] |
Definition at line 45 of file HcalPulseShapes.h.
Referenced by computeSiPMShape(), HcalPulseShapes(), and hoShape().
const HcalMCParams* HcalPulseShapes::theMCParams [private] |
Definition at line 49 of file HcalPulseShapes.h.
Referenced by beginRun(), endRun(), shape(), and ~HcalPulseShapes().
const HcalRecoParams* HcalPulseShapes::theRecoParams [private] |
Definition at line 51 of file HcalPulseShapes.h.
Referenced by beginRun(), endRun(), shapeForReco(), and ~HcalPulseShapes().
ShapeMap HcalPulseShapes::theShapes [private] |
Definition at line 53 of file HcalPulseShapes.h.
Referenced by getShape(), HcalPulseShapes(), shape(), and shapeForReco().
const HcalTopology* HcalPulseShapes::theTopology [private] |
Definition at line 50 of file HcalPulseShapes.h.
Referenced by beginRun(), endRun(), and ~HcalPulseShapes().