48 edm::LogWarning(
"EcalSelectiveReadout") <<
"Parameter configFromCondDB of EcalSelectiveReadout module not found. "
49 "Selective readout configuration will be read from python file.";
119 auto_ptr<EBDigiCollection> selectedEBDigis;
120 auto_ptr<EEDigiCollection> selectedEEDigis;
121 auto_ptr<EBSrFlagCollection> ebSrFlags;
122 auto_ptr<EESrFlagCollection> eeSrFlags;
147 suppressor_->run(eventSetup, *trigPrims, *ebDigis, *eeDigis,
148 selectedEBDigis.get(), selectedEEDigis.get(),
149 ebSrFlags.get(), eeSrFlags.get());
153 ofstream ttfFile(
"TTF.txt", (iEvent==1?
ios::trunc:ios::app));
155 iEvent==1?
true:
false);
157 ofstream srfFile(
"SRF.txt", (iEvent==1?
ios::trunc:ios::app));
159 suppressor_->getEcalSelectiveReadout()->printHeader(srfFile);
161 srfFile <<
"# Event " << iEvent <<
"\n";
162 suppressor_->getEcalSelectiveReadout()->print(srfFile);
165 ofstream afFile(
"AF.txt", (iEvent==1?
ios::trunc:ios::app));
167 iEvent==1?
true:
false);
189 event.getByToken(
EB_token, hEBDigis);
193 static bool firstCall=
true;
205 event.getByToken(
EE_token, hEEDigis);
209 static bool firstCall =
true;
274 const char tccFlagMarker[] = {
'x',
'.',
'S',
'?',
'C',
'E',
'E',
'E',
'E'};
281 os <<
"# TCC flag map\n#\n"
282 "# +-->Phi " << tccFlagMarker[0+1] <<
": 000 (low interest)\n"
283 "# | " << tccFlagMarker[1+1] <<
": 001 (mid interest)\n"
284 "# | " << tccFlagMarker[2+1] <<
": 010 (not valid)\n"
285 "# V Eta " << tccFlagMarker[3+1] <<
": 011 (high interest)\n"
286 "# " << tccFlagMarker[4+1] <<
": 1xx forced readout (Hw error)\n"
290 vector<vector<int> > ttf(nEta, vector<int>(nPhi, -1));
292 it != tp.
end(); ++it){
294 if(trigPrim.
size()>0){
295 int iEta = trigPrim.
id().
ieta();
296 int iEta0 = iEta<0?iEta+nEta/2:iEta+nEta/2-1;
297 int iPhi0 = trigPrim.
id().
iphi() - 1;
298 ttf[iEta0][iPhi0] = trigPrim.
ttFlag();
301 for(
int iEta=0; iEta<nEta; ++iEta){
302 for(
int iPhi=0; iPhi<nPhi; ++iPhi){
303 os << tccFlagMarker[ttf[iEta][iPhi]+1];
313 static std::atomic<bool> warnWeightCnt{
true};
314 bool expected =
true;
315 if((
int)weights.size() > nFIRTaps && warnWeightCnt.compare_exchange_strong(expected,
false,std::memory_order_acq_rel)){
316 edm::LogWarning(
"Configuration") <<
"The list of DCC zero suppression FIR "
317 "weights given in parameter dccNormalizedWeights is longer "
318 "than the expected depth of the FIR filter :(" << nFIRTaps <<
"). "
319 "The last weights will be discarded.";
322 if(weights.size()>0){
324 double maxWeight = weights[iMaxWeight];
326 for(
unsigned i=0;
i<weights.size(); ++
i){
327 if(weights[
i]>maxWeight){
329 maxWeight = weights[iMaxWeight];
341 if(rc && maxWeightBin!=binOfMax){
343 <<
"The maximum weight of DCC zero suppression FIR filter is not "
344 "applied to the expected maximum sample(" << binOfMax
345 << (binOfMax==1?
"st":(binOfMax==2?
"nd":(binOfMax==3?
"rd":
"th")))
346 <<
" time sample). This may indicate faulty 'dccNormalizedWeights' "
347 "or 'ecalDccZs1sSample' parameters.";
355 int& binOfMax)
const{
360 string bofm(
"binOfMaximum");
361 if(
find(ebDigiParamList.begin(), ebDigiParamList.end(), bofm)
362 != ebDigiParamList.end()){
377 const char srpFlagMarker[] = {
'.',
'z',
'Z',
'F',
'4',
'5',
'6',
'7'};
381 const char* date = ctime(&t);
382 os <<
"#SRP flag map\n#\n"
383 "# Generatied on: " << date <<
"\n#\n"
384 "# +-->Phi/Y " << srpFlagMarker[0] <<
": suppressed\n"
385 "# | " << srpFlagMarker[1] <<
": ZS 1\n"
386 "# | " << srpFlagMarker[2] <<
": ZS 2\n"
387 "# V Eta/X " << srpFlagMarker[3] <<
": full readout\n"
422 os <<
"# Event " << iEvent <<
"\n";
430 for(
size_t i=0;
i <
sizeof(eeSrf)/
sizeof(
int); ((
int*)eeSrf)[
i++] = -1){};
432 it != eeSrFlags.
end(); ++it){
434 int iZ0 = flag.
id().
zside()>0?1:0;
435 int iX0 = flag.
id().
ix()-1;
436 int iY0 = flag.
id().
iy()-1;
437 assert(iZ0>=0 && iZ0<nEndcaps);
438 assert(iX0>=0 && iX0<nScX);
439 assert(iY0>=0 && iY0<nScY);
440 eeSrf[iZ0][iX0][iY0] = flag.
value();
442 const int nEbTtEta = 34;
443 const int nEeTtEta = 11;
444 const int nTtEta = nEeTtEta*2+nEbTtEta;
445 const int nTtPhi = 72;
446 int ebSrf[nEbTtEta][nTtPhi];
447 for(
size_t i=0;
i<
sizeof(ebSrf)/
sizeof(
int); ((
int*)ebSrf)[
i++] = -1){};
449 it != ebSrFlags.
end(); ++it){
452 int iEta = flag.
id().
ieta();
453 int iEta0 = iEta + nTtEta/2 - (iEta>=0?1:0);
454 int iEbEta0 = iEta0 - nEeTtEta;
455 int iPhi0 = flag.
id().
iphi() - 1;
456 assert(iEbEta0>=0 && iEbEta0<nEbTtEta);
457 assert(iPhi0>=0 && iPhi0<nTtPhi);
465 ebSrf[iEbEta0][iPhi0] = flag.
value();
472 for(
int iX0=0; iX0<nScX; ++iX0){
473 for(
int iY0=0; iY0<nScY; ++iY0){
474 int srFlag = eeSrf[0][iX0][iY0];
476 && srFlag<(
int)(
sizeof(srpFlagMarker)/
sizeof(srpFlagMarker[0])));
477 os << (srFlag==-1?
' ':srpFlagMarker[srFlag]);
486 for(
int iPhi0 = 0; iPhi0 < nTtPhi; ++iPhi0){
487 int srFlag = ebSrf[iEta0][iPhi0];
489 && srFlag<(
int)(
sizeof(srpFlagMarker)/
sizeof(srpFlagMarker[0])));
490 os << (srFlag==-1?
'?':srpFlagMarker[srFlag]);
496 for(
int iX0=0; iX0<nScX; ++iX0){
497 for(
int iY0=0; iY0<nScY; ++iY0){
498 int srFlag = eeSrf[1][iX0][iY0];
500 && srFlag<(
int)(
sizeof(srpFlagMarker)/
sizeof(srpFlagMarker[0])));
501 os << (srFlag==-1?
' ':srpFlagMarker[srFlag]);
512 throw cms::Exception(
"Configuration") <<
"Selective readout emulator, EcalSelectiveReadout, supports only single set of ZS weights. "
527 throw cms::Exception(
"Configuration") <<
"Inconsistency between number of weigth sets ("
529 <<
"number of ecalDccZs1Sample values ("
T getParameter(std::string const &) const
const CaloGeometry * theGeometry
T getUntrackedParameter(std::string const &, T const &) const
std::string trigPrimProducer_
std::string eedigiCollection_
std::string ebSRPdigiCollection_
const EEDigiCollection * getEEDigis(edm::Event &event) const
void checkTriggerMap(const edm::EventSetup &eventSetup)
void checkGeometry(const edm::EventSetup &eventSetup)
std::vector< EcalTriggerPrimitiveDigi >::const_iterator const_iterator
std::string eeSrFlagCollection_
std::vector< std::vector< float > > dccNormalizedWeights_
const char tccFlagMarker[]
bool getBinOfMax(const edm::Event &evt, const edm::ProductID &noZsDigiId, int &binOfMax) const
const EcalSRSettings * settings_
void printTTFlags(const EcalTrigPrimDigiCollection &tp, std::ostream &os) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
int ieta() const
get the tower ieta
edm::EDGetTokenT< EBDigiCollection > EB_token
virtual void produce(edm::Event &event, const edm::EventSetup &eventSetup)
edm::ParameterSet params_
void checkElecMap(const edm::EventSetup &eventSetup)
edm::SortedCollection< EBSrFlag > EBSrFlagCollection
const EcalTrigTowerConstituentsMap * theTriggerTowerMap
edm::SortedCollection< EESrFlag > EESrFlagCollection
std::vector< int > ecalDccZs1stSample_
std::string trigPrimCollection_
const EcalElectronicsMapping * theElecMap
std::vector< std::string > getParameterNames() const
std::auto_ptr< EcalSelectiveReadoutSuppressor > suppressor_
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void checkWeights(const edm::Event &evt, const edm::ProductID &noZSDigiId) const
static int getFIRTapCount()
const_iterator end() const
virtual ~EcalSelectiveReadoutProducer()
int iphi() const
get the tower iphi
static const int nEndcaps
const EBDigiCollection * getEBDigis(edm::Event &event) const
const EcalTrigPrimDigiCollection * getTrigPrims(edm::Event &event) const
const EcalTrigTowerDetId & id() const
T const * product() const
const EcalScDetId & id() const
T const * product() const
static const size_t nTriggerTowersInEta
static const size_t nTriggerTowersInPhi
edm::EDGetTokenT< EcalTrigPrimDigiCollection > EcTP_token
const EcalTrigTowerDetId & id() const
std::string digiProducer_
edm::EDGetTokenT< EEDigiCollection > EE_token
std::string ebSrFlagCollection_
static void printSrFlags(std::ostream &os, const EBSrFlagCollection &ebSrFlags, const EESrFlagCollection &eeSrFlags, int iEvent=-1, bool withHeader=true)
EcalSelectiveReadoutProducer(const edm::ParameterSet ¶ms)
Provenance getProvenance(BranchID const &theID) const
static void checkValidity(const EcalSRSettings &settings)
int ttFlag() const
get the Trigger tower Flag of interesting sample
ParameterSet const & parameterSet(Provenance const &provenance)
std::string eeSRPdigiCollection_
const_iterator begin() const
const char srpFlagMarker[]
std::string ebdigiCollection_
std::auto_ptr< EcalSRSettings > settingsFromFile_