1 #include "../interface/LaserTask.h"
30 MGPAGainsPN_ = commonParams.getUntrackedParameter<std::vector<int> >(
"MGPAGainsPN");
33 laserWavelengths_ = taskParams.getUntrackedParameter<std::vector<int> >(
"laserWavelengths");
36 if(*wlItr <= 0 || *wlItr >= 5)
throw cms::Exception(
"InvalidConfiguration") <<
"Laser Wavelength" << std::endl;
39 if(*gainItr != 1 && *gainItr != 16)
throw cms::Exception(
"InvalidConfiguration") <<
"PN diode gain" << std::endl;
41 map<string, string> replacements;
47 replacements[
"wl"] = ss.str();
49 unsigned offset(*wlItr - 1);
61 replacements[
"pngain"] = ss.str();
63 offset = (*wlItr - 1) *
nPNGain + (*gainItr == 1 ? 0 : 1);
78 unsigned offset(*wlItr - 1);
88 offset = (*wlItr - 1) *
nPNGain + (*gainItr == 1 ? 0 : 1);
137 int iDCC(dcchItr->id() - 1);
141 wavelength_[iDCC] = dcchItr->getEventSettings().wavelength + 1;
151 const DetId& id(digiItr->id());
153 int iDCC(
dccId(
id) - 1);
163 for(
int iSample(0); iSample < 10; iSample++)
174 int iDCC(
dccId(
id) - 1);
181 for(
int iSample(0); iSample < 4; iSample++)
182 pedestal += digiItr->sample(iSample).adc();
186 for(
int iSample(0); iSample < 50; iSample++){
189 float amp(digiItr->sample(iSample).adc() - pedestal);
191 if(amp > max) max = amp;
194 int gain(digiItr->sample(0).gainId() == 0 ? 1 : 16);
212 const DetId& id(uhitItr->id());
214 int iDCC(
dccId(
id) - 1);
220 float amp(
max((
double)uhitItr->amplitude(), 0.));
221 float jitter(
max((
double)uhitItr->jitter() + 5.0, 0.));
230 float pn0(0.), pn1(0.);
237 pn0 =
pnAmp_[iDCC][pnPair.first];
238 pn1 =
pnAmp_[iDCC][pnPair.second];
248 pn0 =
pnAmp_[pnAFED][pnPair.first];
249 pn1 =
pnAmp_[pnBFED][pnPair.second];
252 if(pn0 < 10 && pn1 > 10){
254 }
else if(pn0 > 10 && pn1 < 10){
256 }
else if(pn0 + pn1 > 1){
257 aop = amp / (0.5 * (pn0 + pn1));
275 for(
unsigned iWL(0); iWL <
nWL; iWL++){
282 for(
unsigned iPNGain(0); iPNGain <
nPNGain; iPNGain++){
283 unsigned offset(iWL * nPNGain + iPNGain);
static int lmmod(SuperCrysCoord iX, SuperCrysCoord iY)
void endEvent(const edm::Event &, const edm::EventSetup &) override
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
void runOnRawData(const EcalRawDataCollection &)
unsigned getEEPnDCC(unsigned, unsigned)
std::vector< int > MGPAGainsPN_
std::map< int, std::vector< float > > pnAmp_
std::vector< EcalDCCHeaderBlock >::const_iterator const_iterator
EcalMGPASample sample(int i) const
unsigned dccId(const DetId &)
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
const_iterator begin() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
static std::pair< int, int > pn(int ilmmod)
int iphi() const
get the crystal iphi
void runOnDigis(const EcalDigiCollection &)
static std::pair< int, int > pn(int dee, int ilmod)
const T & max(const T &a, const T &b)
void beginRun(const edm::Run &, const edm::EventSetup &) override
void runOnUncalibRecHits(const EcalUncalibratedRecHitCollection &, Collections)
int ieta() const
get the crystal ieta
int wavelength_[BinService::nDCC]
unsigned int offset(bool)
static int lmmod(EBGlobalCoord ieta, EBGlobalCoord iphi)
std::vector< int > laserWavelengths_
bool filterRunType(const std::vector< short > &) override
const_iterator end() const
std::vector< MESet * > MEs_
const_iterator end() const
bool enable_[BinService::nDCC]
static int dee(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
LaserTask(const edm::ParameterSet &, const edm::ParameterSet &)
static void setMEData(std::vector< MEData > &)
DEFINE_ECALDQM_WORKER(CertificationClient)
void runOnPnDigis(const EcalPnDiodeDigiCollection &)
const_iterator begin() const
int adc() const
get the ADC sample (12 bits)