#include <SimCalorimetry/EcalTestBeam/interface/EcalTBDigiProducer.h>
Definition at line 30 of file EcalTBDigiProducer.h.
typedef EcalTDigitizer<EBDigitizerTraits> EcalTBDigiProducer::EBDigitizer [private] |
EcalTBDigiProducer::EcalTBDigiProducer | ( | const edm::ParameterSet & | params | ) | [explicit] |
output collections names
Test Beam specific part
Definition at line 17 of file EcalTBDigiProducer.cc.
References doPhaseShift, doReadout, EBdigiCollection_, EBs25notCont, ecalTBInfoLabel, EEs25notCont, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hitsProducer_, index, int, ranges, row, EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::runRanges, EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::tdcMax, EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::tdcMin, tdcRanges, theBarrelDigitizer, theCoder, theCorrNoise, theEcalResponse, theEcalShape, theElectronicsSim, theNoiseMatrix, theParameterMap, theTBReadout, thisPhaseShift, tunePhaseShift, and use2004OffsetConvention_.
00018 : theGeometry(0) 00019 { 00021 00022 EBdigiCollection_ = params.getParameter<std::string>("EBdigiCollection"); 00023 hitsProducer_ = params.getParameter<std::string>("hitsProducer"); 00024 00025 produces<EBDigiCollection>(); 00026 produces<EcalTBTDCRawInfo>(); 00027 00028 // initialize the default valuer for hardcoded parameters and the EB/EE shape 00029 00030 double simHitToPhotoelectronsBarrel = params.getParameter<double>("simHitToPhotoelectronsBarrel"); 00031 double simHitToPhotoelectronsEndcap = params.getParameter<double>("simHitToPhotoelectronsEndcap"); 00032 double photoelectronsToAnalogBarrel = params.getParameter<double>("photoelectronsToAnalogBarrel"); 00033 double photoelectronsToAnalogEndcap = params.getParameter<double>("photoelectronsToAnalogEndcap"); 00034 double samplingFactor = params.getParameter<double>("samplingFactor"); 00035 double timePhase = params.getParameter<double>("timePhase"); 00036 int readoutFrameSize = params.getParameter<int>("readoutFrameSize"); 00037 int binOfMaximum = params.getParameter<int>("binOfMaximum"); 00038 bool doPhotostatistics = params.getParameter<bool>("doPhotostatistics"); 00039 bool syncPhase = params.getParameter<bool>("syncPhase"); 00040 00041 // possible phase shift for asynchronous trigger (e.g. test-beam) 00042 00043 doPhaseShift = !syncPhase; 00044 thisPhaseShift = 1.; 00045 00046 theParameterMap = new EcalSimParameterMap(simHitToPhotoelectronsBarrel, simHitToPhotoelectronsEndcap, 00047 photoelectronsToAnalogBarrel, photoelectronsToAnalogEndcap, 00048 samplingFactor, timePhase, readoutFrameSize, binOfMaximum, 00049 doPhotostatistics, syncPhase); 00050 theEcalShape = new EcalShape(timePhase); 00051 00052 theEcalResponse = new CaloHitResponse(theParameterMap, theEcalShape); 00053 00054 bool addNoise = params.getParameter<bool>("doNoise"); 00055 00056 EcalCorrMatrix thisMatrix; 00057 00058 std::vector<double> corrNoiseMatrix = params.getParameter< std::vector<double> >("CorrelatedNoiseMatrix"); 00059 if ( corrNoiseMatrix.size() == (unsigned int)(readoutFrameSize*readoutFrameSize) ) { 00060 for ( int row = 0 ; row < readoutFrameSize; ++row ) { 00061 for ( int column = 0 ; column < readoutFrameSize; ++column ) { 00062 int index = column + readoutFrameSize*row; 00063 thisMatrix(row,column) = corrNoiseMatrix[index]; 00064 } 00065 } 00066 } 00067 theNoiseMatrix = new EcalCorrelatedNoiseMatrix(thisMatrix); 00068 00069 theCorrNoise = new CorrelatedNoisifier<EcalCorrMatrix>(thisMatrix); 00070 00071 theCoder = new EcalCoder(addNoise, theCorrNoise); 00072 bool applyConstantTerm = params.getParameter<bool>("applyConstantTerm"); 00073 double rmsConstantTerm = params.getParameter<double> ("ConstantTerm"); 00074 theElectronicsSim = new EcalElectronicsSim(theParameterMap, theCoder, applyConstantTerm, rmsConstantTerm); 00075 00076 theBarrelDigitizer = new EBDigitizer(theEcalResponse, theElectronicsSim, addNoise); 00077 00078 // not containment corrections 00079 EBs25notCont = params.getParameter<double>("EBs25notContainment"); 00080 EEs25notCont = params.getParameter<double>("EEs25notContainment"); 00081 00083 00084 typedef std::vector< edm::ParameterSet > Parameters; 00085 Parameters ranges=params.getParameter<Parameters>("tdcRanges"); 00086 for(Parameters::iterator itRanges = ranges.begin(); itRanges != ranges.end(); ++itRanges) 00087 { 00088 EcalTBTDCRecInfoAlgo::EcalTBTDCRanges aRange; 00089 aRange.runRanges.first = itRanges->getParameter<int>("startRun"); 00090 aRange.runRanges.second = itRanges->getParameter<int>("endRun"); 00091 aRange.tdcMin = itRanges->getParameter< std::vector<double> >("tdcMin"); 00092 aRange.tdcMax = itRanges->getParameter< std::vector<double> >("tdcMax"); 00093 tdcRanges.push_back(aRange); 00094 } 00095 00096 use2004OffsetConvention_ = params.getUntrackedParameter< bool >("use2004OffsetConvention",false); 00097 00098 ecalTBInfoLabel = params.getUntrackedParameter<std::string>("EcalTBInfoLabel","SimEcalTBG4Object"); 00099 doReadout = params.getParameter<bool>("doReadout"); 00100 00101 theTBReadout = new EcalTBReadout(ecalTBInfoLabel); 00102 00103 tunePhaseShift = params.getParameter<double>("tunePhaseShift"); 00104 00105 }
EcalTBDigiProducer::~EcalTBDigiProducer | ( | ) | [virtual] |
Definition at line 108 of file EcalTBDigiProducer.cc.
References theBarrelDigitizer, theCoder, theCorrNoise, theEcalResponse, theEcalShape, theElectronicsSim, theNoiseMatrix, theParameterMap, and theTBReadout.
00109 { 00110 delete theParameterMap; 00111 delete theEcalShape; 00112 delete theEcalResponse; 00113 delete theCorrNoise; 00114 delete theNoiseMatrix; 00115 delete theCoder; 00116 delete theElectronicsSim; 00117 delete theBarrelDigitizer; 00118 delete theTBReadout; 00119 }
void EcalTBDigiProducer::checkCalibrations | ( | const edm::EventSetup & | eventSetup | ) | [private] |
Definition at line 193 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::setPedestals(), and theCoder.
Referenced by produce().
00194 { 00195 00196 // Pedestals from event setup 00197 00198 edm::ESHandle<EcalPedestals> dbPed; 00199 eventSetup.get<EcalPedestalsRcd>().get( dbPed ); 00200 const EcalPedestals* thePedestals=dbPed.product(); 00201 00202 theCoder->setPedestals( thePedestals ); 00203 00204 // ADC -> GeV Scale 00205 edm::ESHandle<EcalADCToGeVConstant> pAgc; 00206 eventSetup.get<EcalADCToGeVConstantRcd>().get(pAgc); 00207 const EcalADCToGeVConstant* agc = pAgc.product(); 00208 00209 // Gain Ratios 00210 edm::ESHandle<EcalGainRatios> pRatio; 00211 eventSetup.get<EcalGainRatiosRcd>().get(pRatio); 00212 const EcalGainRatios* gr = pRatio.product(); 00213 00214 theCoder->setGainRatios( gr ); 00215 00216 EcalMGPAGainRatio * defaultRatios = new EcalMGPAGainRatio(); 00217 00218 double theGains[theCoder->NGAINS+1]; 00219 theGains[0] = 0.; 00220 theGains[3] = 1.; 00221 theGains[2] = defaultRatios->gain6Over1() ; 00222 theGains[1] = theGains[2]*(defaultRatios->gain12Over6()) ; 00223 00224 LogDebug("EcalDigi") << " Gains: " << "\n" << " g1 = " << theGains[1] << "\n" << " g2 = " << theGains[2] << "\n" << " g3 = " << theGains[3]; 00225 00226 delete defaultRatios; 00227 00228 const double EBscale = (agc->getEBValue())*theGains[1]*(theCoder->MAXADC)*EBs25notCont; 00229 LogDebug("EcalDigi") << " GeV/ADC = " << agc->getEBValue() << "\n" << " saturation for EB = " << EBscale; 00230 const double EEscale = (agc->getEEValue())*theGains[1]*(theCoder->MAXADC)*EEs25notCont; 00231 LogDebug("EcalDigi") << " GeV/ADC = " << agc->getEEValue() << "\n" << " saturation for EE = " << EEscale; 00232 theCoder->setFullScaleEnergy( EBscale , EEscale ); 00233 }
void EcalTBDigiProducer::checkGeometry | ( | const edm::EventSetup & | eventSetup | ) | [private] |
Definition at line 236 of file EcalTBDigiProducer.cc.
References edm::EventSetup::get(), theGeometry, and updateGeometry().
Referenced by produce().
00237 { 00238 // TODO find a way to avoid doing this every event 00239 edm::ESHandle<CaloGeometry> hGeometry; 00240 eventSetup.get<CaloGeometryRecord>().get(hGeometry); 00241 00242 const CaloGeometry * pGeometry = &*hGeometry; 00243 00244 // see if we need to update 00245 if(pGeometry != theGeometry) { 00246 theGeometry = pGeometry; 00247 updateGeometry(); 00248 } 00249 }
void EcalTBDigiProducer::fillTBTDCRawInfo | ( | EcalTBTDCRawInfo & | theTBTDCRawInfo | ) | [private] |
Definition at line 286 of file EcalTBDigiProducer.cc.
References int, LogDebug, EcalTBTDCRawInfo::setSample(), Ecal2006TBTDCRanges_v1_cff::tdcMax, Ecal2006TBTDCRanges_v1_cff::tdcMin, tdcRanges, and thisPhaseShift.
Referenced by produce().
00286 { 00287 00288 unsigned int thisChannel = 1; 00289 00290 unsigned int thisCount = (unsigned int)(thisPhaseShift*(tdcRanges[0].tdcMax[0]-tdcRanges[0].tdcMin[0]) + tdcRanges[0].tdcMin[0]); 00291 00292 EcalTBTDCSample theTBTDCSample(thisChannel, thisCount); 00293 00294 unsigned int sampleIndex = 0; 00295 theTBTDCRawInfo.setSample(sampleIndex, theTBTDCSample); 00296 00297 LogDebug("EcalDigi") << theTBTDCSample << "\n" << theTBTDCRawInfo; 00298 00299 }
void EcalTBDigiProducer::produce | ( | edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
Produces the EDM products,.
Implements edm::EDProducer.
Definition at line 122 of file EcalTBDigiProducer.cc.
References checkCalibrations(), checkGeometry(), detId, doPhaseShift, doReadout, DetId::Ecal, ecalTBInfoLabel, fillTBTDCRawInfo(), hitsProducer_, EcalTBReadout::performReadout(), edm::Handle< T >::product(), EcalTDigitizer< Traits >::run(), setPhaseShift(), theBarrelDigitizer, theEcalTBInfo, theTBReadout, theTTmap, and thisPhaseShift.
00123 { 00124 00125 // Step A: Get Inputs 00126 00127 checkGeometry(eventSetup); 00128 checkCalibrations(eventSetup); 00129 00130 const std::string barrelHitsName(hitsProducer_+"EcalHitsEB"); 00131 00132 // Get input 00133 edm::Handle<CrossingFrame<PCaloHit> > crossingFrame; 00134 event.getByLabel("mix",barrelHitsName,crossingFrame); 00135 std::auto_ptr<MixCollection<PCaloHit> > 00136 barrelHits( new MixCollection<PCaloHit>(crossingFrame.product())); 00137 00138 std::auto_ptr<EcalTBTDCRawInfo> TDCproduct(new EcalTBTDCRawInfo(1)); 00139 00140 // Step B: Create empty output 00141 std::auto_ptr<EBDigiCollection> barrelResult(new EBDigiCollection()); 00142 00143 // run the algorithm 00144 00145 CaloDigiCollectionSorter sorter(5); 00146 00147 if (doPhaseShift) { 00148 00149 edm::Handle<PEcalTBInfo> theEcalTBInfo; 00150 event.getByLabel(ecalTBInfoLabel,theEcalTBInfo); 00151 thisPhaseShift = theEcalTBInfo->phaseShift(); 00152 00153 DetId detId(DetId::Ecal, 1); 00154 setPhaseShift(detId); 00155 00156 // fill the TDC information in the event 00157 00158 fillTBTDCRawInfo(*TDCproduct); 00159 00160 } 00161 00162 theBarrelDigitizer->run(*barrelHits, *barrelResult); 00163 edm::LogInfo("DigiInfo") << "EB Digis: " << barrelResult->size(); 00164 00165 // perform the TB readout if required, 00166 // otherwise simply fill the proper object 00167 00168 std::auto_ptr<EBDigiCollection> barrelReadout(new EBDigiCollection()); 00169 if ( doReadout ) { 00170 theTBReadout->performReadout(event, *theTTmap, *barrelResult, *barrelReadout); 00171 } 00172 else { 00173 barrelResult->swap(*barrelReadout); 00174 } 00175 00176 /* 00177 std::vector<EBDataFrame> sortedDigisEB = sorter.sortedVector(*barrelReadout); 00178 LogDebug("EcalDigi") << "Top 10 EB digis"; 00179 for(int i = 0; i < std::min(10,(int) sortedDigisEB.size()); ++i) 00180 { 00181 LogDebug("EcalDigi") << sortedDigisEB[i]; 00182 } 00183 */ 00184 00185 // Step D: Put outputs into event 00186 event.put(barrelReadout); 00187 event.put(TDCproduct); 00188 00189 }
Definition at line 266 of file EcalTBDigiProducer.cc.
References LogDebug, python::trackProbabilityAnalysis_cff::parameters, CaloHitResponse::setPhaseShift(), EcalSimParameterMap::simParameters(), DetId::subdetId(), CaloSimParameters::syncPhase(), theEcalResponse, theParameterMap, thisPhaseShift, tunePhaseShift, and use2004OffsetConvention_.
Referenced by produce().
00266 { 00267 00268 const CaloSimParameters & parameters = theParameterMap->simParameters(detId); 00269 if ( !parameters.syncPhase() ) { 00270 00271 int myDet = detId.subdetId(); 00272 00273 LogDebug("EcalDigi") << "Setting the phase shift " << thisPhaseShift << " and the offset " << tunePhaseShift << " for the subdetector " << myDet; 00274 00275 if ( myDet == 1) { 00276 double passPhaseShift = thisPhaseShift+tunePhaseShift; 00277 if ( use2004OffsetConvention_ ) passPhaseShift = 1.-passPhaseShift; 00278 theEcalResponse->setPhaseShift(passPhaseShift); 00279 } 00280 00281 } 00282 00283 }
void EcalTBDigiProducer::updateGeometry | ( | ) | [private] |
Definition at line 252 of file EcalTBDigiProducer.cc.
References DetId::Ecal, EcalBarrel, CaloGeometry::getValidDetIds(), EcalTDigitizer< Traits >::setDetIds(), EcalTBReadout::setDetIds(), CaloHitResponse::setGeometry(), theBarrelDigitizer, theEcalResponse, theGeometry, and theTBReadout.
Referenced by checkGeometry().
00252 { 00253 theEcalResponse->setGeometry(theGeometry); 00254 00255 const std::vector<DetId>& theBarrelDets = theGeometry->getValidDetIds(DetId::Ecal, EcalBarrel); 00256 00257 edm::LogInfo("EcalDigi") << "deb geometry: " << "\n" 00258 << "\t barrel: " << theBarrelDets.size (); 00259 00260 theBarrelDigitizer->setDetIds(theBarrelDets); 00261 00262 theTBReadout->setDetIds(theBarrelDets); 00263 }
bool EcalTBDigiProducer::doPhaseShift [private] |
Definition at line 80 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and produce().
bool EcalTBDigiProducer::doReadout [private] |
Definition at line 83 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and produce().
std::string EcalTBDigiProducer::EBdigiCollection_ [private] |
double EcalTBDigiProducer::EBs25notCont [private] |
Definition at line 93 of file EcalTBDigiProducer.h.
Referenced by checkCalibrations(), and EcalTBDigiProducer().
std::string EcalTBDigiProducer::ecalTBInfoLabel [private] |
Definition at line 78 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and produce().
double EcalTBDigiProducer::EEs25notCont [private] |
Definition at line 94 of file EcalTBDigiProducer.h.
Referenced by checkCalibrations(), and EcalTBDigiProducer().
std::string EcalTBDigiProducer::hitsProducer_ [private] |
Definition at line 91 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and produce().
std::vector<EcalTBTDCRecInfoAlgo::EcalTBTDCRanges> EcalTBDigiProducer::tdcRanges [private] |
Definition at line 85 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and fillTBTDCRawInfo().
Definition at line 59 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), produce(), updateGeometry(), and ~EcalTBDigiProducer().
EcalCoder* EcalTBDigiProducer::theCoder [private] |
Definition at line 70 of file EcalTBDigiProducer.h.
Referenced by checkCalibrations(), EcalTBDigiProducer(), and ~EcalTBDigiProducer().
Definition at line 66 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and ~EcalTBDigiProducer().
Definition at line 64 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), setPhaseShift(), updateGeometry(), and ~EcalTBDigiProducer().
const CaloVShape* EcalTBDigiProducer::theEcalShape [private] |
Definition at line 62 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and ~EcalTBDigiProducer().
Definition at line 69 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and ~EcalTBDigiProducer().
const CaloGeometry* EcalTBDigiProducer::theGeometry [private] |
Definition at line 72 of file EcalTBDigiProducer.h.
Referenced by checkGeometry(), and updateGeometry().
Definition at line 67 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and ~EcalTBDigiProducer().
const EcalSimParameterMap* EcalTBDigiProducer::theParameterMap [private] |
Definition at line 61 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), setPhaseShift(), and ~EcalTBDigiProducer().
EcalTBReadout* EcalTBDigiProducer::theTBReadout [private] |
Definition at line 76 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), produce(), updateGeometry(), and ~EcalTBDigiProducer().
const EcalTrigTowerConstituentsMap* EcalTBDigiProducer::theTTmap [private] |
double EcalTBDigiProducer::thisPhaseShift [private] |
Definition at line 81 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), fillTBTDCRawInfo(), produce(), and setPhaseShift().
double EcalTBDigiProducer::tunePhaseShift [private] |
Definition at line 88 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and setPhaseShift().
Definition at line 86 of file EcalTBDigiProducer.h.
Referenced by EcalTBDigiProducer(), and setPhaseShift().