#include <EcalTBDigiProducer.h>
Definition at line 37 of file EcalTBDigiProducer.h.
typedef EcalTDigitizer<EBDigitizerTraits> EcalTBDigiProducer::EBDigitizer [private] |
Reconstruction algorithm
Definition at line 63 of file EcalTBDigiProducer.h.
typedef EcalTDigitizer<EEDigitizerTraits> EcalTBDigiProducer::EEDigitizer [private] |
Definition at line 64 of file EcalTBDigiProducer.h.
EcalTBDigiProducer::EcalTBDigiProducer | ( | const edm::ParameterSet & | params | ) | [explicit] |
output collections names
Test Beam specific part
Definition at line 24 of file EcalTBDigiProducer.cc.
References ecalTPGAnalyzer_cfg::binOfMaximum, doPhaseShift, doReadout, EBdigiCollection_, EBs25notCont, ecalTBInfoLabel, EEdigiCollection_, EEs25notCont, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), getHLTprescales::index, m_barrelHitsName, m_endcapHitsName, runregparse::ranges, EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::runRanges, EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::tdcMax, EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::tdcMin, tdcRanges, theBarrelDigitizer, theCoder, theCorrNoise, theEBResponse, theEBShape, theEEResponse, theEEShape, theElectronicsSim, theEndcapDigitizer, theNoiseMatrix, theParameterMap, theTBReadout, thisPhaseShift, tunePhaseShift, and use2004OffsetConvention_.
{ EBdigiCollection_ = params.getParameter<std::string>("EBdigiCollection"); EEdigiCollection_ = params.getParameter<std::string>("EEdigiCollection"); const std::string hitsProducer ( params.getParameter<std::string>("hitsProducer") ) ; m_barrelHitsName = hitsProducer + "EcalHitsEB" ; m_endcapHitsName = hitsProducer + "EcalHitsEE" ; produces<EBDigiCollection>( EBdigiCollection_ ); produces<EEDigiCollection>( EEdigiCollection_ ); produces<EcalTBTDCRawInfo>(); //For TB // initialize the default valuer for hardcoded parameters and the EB/EE shape bool addNoise = params.getParameter<bool>("doNoise"); double simHitToPhotoelectronsBarrel = params.getParameter<double>("simHitToPhotoelectronsBarrel"); double simHitToPhotoelectronsEndcap = params.getParameter<double>("simHitToPhotoelectronsEndcap"); double photoelectronsToAnalogBarrel = params.getParameter<double>("photoelectronsToAnalogBarrel"); double photoelectronsToAnalogEndcap = params.getParameter<double>("photoelectronsToAnalogEndcap"); double samplingFactor = params.getParameter<double>("samplingFactor"); double timePhase = params.getParameter<double>("timePhase"); int readoutFrameSize = params.getParameter<int>("readoutFrameSize"); int binOfMaximum = params.getParameter<int>("binOfMaximum"); bool doPhotostatistics = params.getParameter<bool>("doPhotostatistics"); bool syncPhase = params.getParameter<bool>("syncPhase"); // possible phase shift for asynchronous trigger (e.g. test-beam) doPhaseShift = !syncPhase; //For TB thisPhaseShift = 1.; //For TB theParameterMap = new EcalSimParameterMap(simHitToPhotoelectronsBarrel, simHitToPhotoelectronsEndcap, photoelectronsToAnalogBarrel, photoelectronsToAnalogEndcap, samplingFactor, timePhase, readoutFrameSize, binOfMaximum, doPhotostatistics, syncPhase); theEBResponse = new CaloHitRespoNew(theParameterMap, &theEBShape); theEEResponse = new CaloHitRespoNew(theParameterMap, &theEEShape); EcalCorrMatrix thisMatrix; std::vector<double> corrNoiseMatrix = params.getParameter< std::vector<double> >("CorrelatedNoiseMatrix"); if ( corrNoiseMatrix.size() == (unsigned int)(readoutFrameSize*readoutFrameSize) ) { for ( int row = 0 ; row < readoutFrameSize; ++row ) { for ( int column = 0 ; column < readoutFrameSize; ++column ) { int index = column + readoutFrameSize*row; thisMatrix(row,column) = corrNoiseMatrix[index]; } } } theNoiseMatrix = new EcalCorrMatrix(thisMatrix); theCorrNoise = new CorrelatedNoisifier<EcalCorrMatrix>(thisMatrix); theCoder = new EcalCoder(addNoise, theCorrNoise); bool applyConstantTerm = params.getParameter<bool>("applyConstantTerm"); double rmsConstantTerm = params.getParameter<double> ("ConstantTerm"); theElectronicsSim = new EcalElectronicsSim(theParameterMap, theCoder, applyConstantTerm, rmsConstantTerm); theBarrelDigitizer = new EBDigitizer( theEBResponse, theElectronicsSim, addNoise ); theEndcapDigitizer = new EEDigitizer( theEEResponse, theElectronicsSim, addNoise ); // not containment corrections EBs25notCont = params.getParameter<double>("EBs25notContainment"); EEs25notCont = params.getParameter<double>("EEs25notContainment"); //For TB -------------------------------------- typedef std::vector< edm::ParameterSet > Parameters; Parameters ranges=params.getParameter<Parameters>("tdcRanges"); for(Parameters::iterator itRanges = ranges.begin(); itRanges != ranges.end(); ++itRanges) { EcalTBTDCRecInfoAlgo::EcalTBTDCRanges aRange; aRange.runRanges.first = itRanges->getParameter<int>("startRun"); aRange.runRanges.second = itRanges->getParameter<int>("endRun"); aRange.tdcMin = itRanges->getParameter< std::vector<double> >("tdcMin"); aRange.tdcMax = itRanges->getParameter< std::vector<double> >("tdcMax"); tdcRanges.push_back(aRange); } use2004OffsetConvention_ = params.getUntrackedParameter< bool >("use2004OffsetConvention",false); ecalTBInfoLabel = params.getUntrackedParameter<std::string>("EcalTBInfoLabel","SimEcalTBG4Object"); doReadout = params.getParameter<bool>("doReadout"); theTBReadout = new EcalTBReadout(ecalTBInfoLabel); tunePhaseShift = params.getParameter<double>("tunePhaseShift"); //For TB -------------------------------------- }
EcalTBDigiProducer::~EcalTBDigiProducer | ( | ) | [virtual] |
Definition at line 134 of file EcalTBDigiProducer.cc.
References theBarrelDigitizer, theCoder, theCorrNoise, theEBResponse, theEEResponse, theElectronicsSim, theEndcapDigitizer, theNoiseMatrix, and theParameterMap.
{ if (theParameterMap) { delete theParameterMap; } if (theEBResponse) { delete theEBResponse; } if (theEEResponse) { delete theEEResponse; } if (theCorrNoise) { delete theCorrNoise; } if (theNoiseMatrix) { delete theNoiseMatrix; } if (theCoder) { delete theCoder; } if (theElectronicsSim){ delete theElectronicsSim; } if (theBarrelDigitizer){ delete theBarrelDigitizer; } if (theEndcapDigitizer){ delete theEndcapDigitizer; } }
void EcalTBDigiProducer::checkCalibrations | ( | const edm::EventSetup & | eventSetup | ) | [private] |
Definition at line 268 of file EcalTBDigiProducer.cc.
References EBs25notCont, EEs25notCont, EcalMGPAGainRatio::gain12Over6(), EcalMGPAGainRatio::gain6Over1(), edm::EventSetup::get(), EcalADCToGeVConstant::getEBValue(), EcalADCToGeVConstant::getEEValue(), LogDebug, EcalCoder::MAXADC, EcalCoder::NGAINS, edm::ESHandle< T >::product(), EcalCoder::setFullScaleEnergy(), EcalCoder::setGainRatios(), EcalCoder::setIntercalibConstants(), EcalCoder::setPedestals(), and theCoder.
Referenced by produce().
{ // Pedestals from event setup edm::ESHandle<EcalPedestals> dbPed; eventSetup.get<EcalPedestalsRcd>().get( dbPed ); const EcalPedestals* thePedestals=dbPed.product(); theCoder->setPedestals( thePedestals ); // Ecal Intercalibration Constants edm::ESHandle<EcalIntercalibConstantsMC> pIcal; eventSetup.get<EcalIntercalibConstantsMCRcd>().get(pIcal); const EcalIntercalibConstantsMC *ical = pIcal.product(); theCoder->setIntercalibConstants( ical ); // ADC -> GeV Scale edm::ESHandle<EcalADCToGeVConstant> pAgc; eventSetup.get<EcalADCToGeVConstantRcd>().get(pAgc); const EcalADCToGeVConstant* agc = pAgc.product(); // Gain Ratios edm::ESHandle<EcalGainRatios> pRatio; eventSetup.get<EcalGainRatiosRcd>().get(pRatio); const EcalGainRatios* gr = pRatio.product(); theCoder->setGainRatios( gr ); EcalMGPAGainRatio * defaultRatios = new EcalMGPAGainRatio(); double theGains[theCoder->NGAINS+1]; theGains[0] = 0.; theGains[3] = 1.; theGains[2] = defaultRatios->gain6Over1() ; theGains[1] = theGains[2]*(defaultRatios->gain12Over6()) ; LogDebug("EcalDigi") << " Gains: " << "\n" << " g1 = " << theGains[1] << "\n" << " g2 = " << theGains[2] << "\n" << " g3 = " << theGains[3]; delete defaultRatios; const double EBscale = (agc->getEBValue())*theGains[1]*(theCoder->MAXADC)*EBs25notCont; LogDebug("EcalDigi") << " GeV/ADC = " << agc->getEBValue() << "\n" << " notCont = " << EBs25notCont << "\n" << " saturation for EB = " << EBscale << ", " << EBs25notCont; const double EEscale = (agc->getEEValue())*theGains[1]*(theCoder->MAXADC)*EEs25notCont; LogDebug("EcalDigi") << " GeV/ADC = " << agc->getEEValue() << "\n" << " notCont = " << EEs25notCont << "\n" << " saturation for EB = " << EEscale << ", " << EEs25notCont; theCoder->setFullScaleEnergy( EBscale , EEscale ); }
void EcalTBDigiProducer::fillTBTDCRawInfo | ( | EcalTBTDCRawInfo & | theTBTDCRawInfo | ) | [private] |
Definition at line 377 of file EcalTBDigiProducer.cc.
References LogDebug, EcalTBTDCRawInfo::setSample(), Ecal2004TBTDCRanges_cff::tdcMax, Ecal2004TBTDCRanges_cff::tdcMin, tdcRanges, and thisPhaseShift.
Referenced by produce().
{ unsigned int thisChannel = 1; unsigned int thisCount = (unsigned int)(thisPhaseShift*(tdcRanges[0].tdcMax[0]-tdcRanges[0].tdcMin[0]) + tdcRanges[0].tdcMin[0]); EcalTBTDCSample theTBTDCSample(thisChannel, thisCount); unsigned int sampleIndex = 0; theTBTDCRawInfo.setSample(sampleIndex, theTBTDCSample); LogDebug("EcalDigi") << theTBTDCSample << "\n" << theTBTDCRawInfo; }
void EcalTBDigiProducer::produce | ( | edm::Event & | event, |
const edm::EventSetup & | eventSetup | ||
) | [virtual] |
Produces the EDM products,
Implements edm::EDProducer.
Definition at line 147 of file EcalTBDigiProducer.cc.
References checkCalibrations(), gather_cfg::cout, doPhaseShift, doReadout, ExpressReco_HICollisions_FallBack::EBDigiCollection, EBdigiCollection_, DetId::Ecal, EcalBarrel, EcalEndcap, ecalTBInfoLabel, ExpressReco_HICollisions_FallBack::EcalTBTDCRawInfo, ExpressReco_HICollisions_FallBack::EEDigiCollection, EEdigiCollection_, fillTBTDCRawInfo(), edm::EventSetup::get(), edm::HandleBase::isValid(), m_barrelHitsName, m_endcapHitsName, EcalTBReadout::performReadout(), edm::Handle< T >::product(), EcalTDigitizer< Traits >::run(), EcalTBReadout::setDetIds(), CaloHitRespoNew::setGeometry(), setPhaseShift(), MixCollection< T >::size(), theBarrelDigitizer, theEBResponse, theEEResponse, theEndcapDigitizer, theTBReadout, theTTmap, and thisPhaseShift.
{ // Step A: Get Inputs //For TB ---------------- edm::ESHandle<CaloGeometry> hGeometry ; eventSetup.get<CaloGeometryRecord>().get( hGeometry ) ; theEBResponse->setGeometry( hGeometry->getSubdetectorGeometry( DetId::Ecal, EcalBarrel ) ) ; theEEResponse->setGeometry( hGeometry->getSubdetectorGeometry( DetId::Ecal, EcalEndcap ) ) ; // takes no time because gives back const ref const std::vector<DetId>& theBarrelDets ( hGeometry->getValidDetIds(DetId::Ecal, EcalBarrel) ) ; // const std::vector<DetId>& theEndcapDets ( // hGeometry->getValidDetIds(DetId::Ecal, EcalEndcap) ) ; // theBarrelDigitizer->setDetIds( theBarrelDets ) ; // theEndcapDigitizer->setDetIds( theEndcapDets ) ; theTBReadout ->setDetIds( theBarrelDets ) ; //For TB ---------------- checkCalibrations(eventSetup); // Get input edm::Handle<CrossingFrame<PCaloHit> > crossingFrame; event.getByLabel( "mix", m_barrelHitsName, crossingFrame ) ; MixCollection<PCaloHit>* EBHits ( crossingFrame.isValid() ? new MixCollection<PCaloHit>( crossingFrame.product() ) : 0 ) ; const bool isEB ( 0 != EBHits && 0 != EBHits->size() ) ; event.getByLabel( "mix", m_endcapHitsName, crossingFrame ) ; MixCollection<PCaloHit>* EEHits ( crossingFrame.isValid() ? new MixCollection<PCaloHit>( crossingFrame.product() ) : 0 ) ; const bool isEE ( 0 != EEHits && 0 != EEHits->size() ) ; //For TB ---------------------------------------- std::auto_ptr<EcalTBTDCRawInfo> TDCproduct(new EcalTBTDCRawInfo(1)); if( doPhaseShift ) { edm::Handle<PEcalTBInfo> theEcalTBInfo ; event.getByLabel( ecalTBInfoLabel, theEcalTBInfo ) ; thisPhaseShift = theEcalTBInfo->phaseShift(); DetId detId( DetId::Ecal, 1 ) ; setPhaseShift( detId ); fillTBTDCRawInfo( *TDCproduct ) ; // fill the TDC info in the event } //For TB ---------------------------------------- // Step B: Create empty output and then fill it std::auto_ptr<EBDigiCollection> barrelResult( new EBDigiCollection() ) ; std::auto_ptr<EEDigiCollection> endcapResult( new EEDigiCollection() ) ; if ( isEB ) { std::auto_ptr<MixCollection<PCaloHit> > barrelHits( EBHits ); theBarrelDigitizer->run( *barrelHits, *barrelResult ) ; edm::LogInfo("DigiInfo") << "EB Digis: " << barrelResult->size(); std::cout << "EB Digis: " << barrelResult->size()<<std::endl; /* CaloDigiCollectionSorter sorter(5) ; std::vector<EBDataFrame> sortedDigisEB = sorter.sortedVector(*barrelResult); LogDebug("EcalDigi") << "Top 10 EB digis"; std::cout<< "Top 10 EB digis\n"; for(int i = 0; i < std::min(10,(int) sortedDigisEB.size()); ++i) { LogDebug("EcalDigi") << sortedDigisEB[i]; std::cout << sortedDigisEB[i]<<"\n"; } std::cout<< std::endl ; */ } if( isEE ) { std::auto_ptr<MixCollection<PCaloHit> > endcapHits( EEHits ); theEndcapDigitizer->run( *endcapHits, *endcapResult ) ; edm::LogInfo("EcalDigi") << "EE Digis: " << endcapResult->size(); std::cout << "EE Digis: " << endcapResult->size()<<std::endl; } //For TB ------------------------------------------- // perform the TB readout if required, // otherwise simply fill the proper object std::auto_ptr<EBDigiCollection> barrelReadout( new EBDigiCollection() ) ; if ( doReadout ) { theTBReadout->performReadout( event, *theTTmap, *barrelResult, *barrelReadout); } else { barrelResult->swap(*barrelReadout); } // Step D: Put outputs into event //TB event.put(barrelResult, EBdigiCollection_); event.put( barrelReadout, EBdigiCollection_ ) ; event.put( endcapResult, EEdigiCollection_ ) ; event.put( TDCproduct ) ; //For TB ------------------------------------------- }
void EcalTBDigiProducer::setPhaseShift | ( | const DetId & | detId | ) | [private] |
Definition at line 357 of file EcalTBDigiProducer.cc.
References LogDebug, ExpressReco_HICollisions_FallBack::parameters, CaloHitRespoNew::setPhaseShift(), EcalSimParameterMap::simParameters(), DetId::subdetId(), CaloSimParameters::syncPhase(), theEBResponse, theEEResponse, theParameterMap, thisPhaseShift, tunePhaseShift, and use2004OffsetConvention_.
Referenced by produce().
{ const CaloSimParameters & parameters = theParameterMap->simParameters(detId); if ( !parameters.syncPhase() ) { int myDet = detId.subdetId(); LogDebug("EcalDigi") << "Setting the phase shift " << thisPhaseShift << " and the offset " << tunePhaseShift << " for the subdetector " << myDet; if ( myDet == 1) { double passPhaseShift = thisPhaseShift+tunePhaseShift; if ( use2004OffsetConvention_ ) passPhaseShift = 1.-passPhaseShift; theEBResponse->setPhaseShift(passPhaseShift); theEEResponse->setPhaseShift(passPhaseShift); } } }
bool EcalTBDigiProducer::doPhaseShift [private] |
Definition at line 109 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and produce().
bool EcalTBDigiProducer::doReadout [private] |
Definition at line 112 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and produce().
std::string EcalTBDigiProducer::EBdigiCollection_ [private] |
Definition at line 89 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and produce().
double EcalTBDigiProducer::EBs25notCont [private] |
Definition at line 95 of file EcalTBDigiProducer.h.
Referenced by checkCalibrations(), and EcalTBDigiProducer().
std::string EcalTBDigiProducer::ecalTBInfoLabel [private] |
Definition at line 107 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and produce().
std::string EcalTBDigiProducer::EEdigiCollection_ [private] |
Definition at line 90 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and produce().
double EcalTBDigiProducer::EEs25notCont [private] |
Definition at line 96 of file EcalTBDigiProducer.h.
Referenced by checkCalibrations(), and EcalTBDigiProducer().
std::string EcalTBDigiProducer::m_barrelHitsName [private] |
Definition at line 100 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and produce().
std::string EcalTBDigiProducer::m_endcapHitsName [private] |
Definition at line 101 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and produce().
std::vector<EcalTBTDCRecInfoAlgo::EcalTBTDCRanges> EcalTBDigiProducer::tdcRanges [private] |
Definition at line 114 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and fillTBTDCRawInfo().
Definition at line 67 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), produce(), and ~EcalTBDigiProducer().
EcalCoder* EcalTBDigiProducer::theCoder [private] |
Definition at line 87 of file EcalTBDigiProducer.h.
Referenced by checkCalibrations(), EcalTBDigiProducer(), and ~EcalTBDigiProducer().
Definition at line 81 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and ~EcalTBDigiProducer().
CaloHitRespoNew* EcalTBDigiProducer::theEBResponse [private] |
Definition at line 77 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), produce(), setPhaseShift(), and ~EcalTBDigiProducer().
const EBShape EcalTBDigiProducer::theEBShape [private] |
Definition at line 73 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer().
CaloHitRespoNew* EcalTBDigiProducer::theEEResponse [private] |
Definition at line 78 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), produce(), setPhaseShift(), and ~EcalTBDigiProducer().
const EEShape EcalTBDigiProducer::theEEShape [private] |
Definition at line 74 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer().
Definition at line 84 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and ~EcalTBDigiProducer().
Definition at line 68 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), produce(), and ~EcalTBDigiProducer().
EcalCorrMatrix* EcalTBDigiProducer::theNoiseMatrix [private] |
Definition at line 82 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and ~EcalTBDigiProducer().
const EcalSimParameterMap* EcalTBDigiProducer::theParameterMap [private] |
Definition at line 72 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), setPhaseShift(), and ~EcalTBDigiProducer().
EcalTBReadout* EcalTBDigiProducer::theTBReadout [private] |
Definition at line 105 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and produce().
const EcalTrigTowerConstituentsMap* EcalTBDigiProducer::theTTmap [private] |
Definition at line 103 of file EcalTBDigiProducer.h.
Referenced by produce().
double EcalTBDigiProducer::thisPhaseShift [private] |
Definition at line 110 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), fillTBTDCRawInfo(), produce(), and setPhaseShift().
double EcalTBDigiProducer::tunePhaseShift [private] |
Definition at line 117 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and setPhaseShift().
bool EcalTBDigiProducer::use2004OffsetConvention_ [private] |
Definition at line 115 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and setPhaseShift().