CMS 3D CMS Logo

EcalNextToDeadChannelESProducer.cc
Go to the documentation of this file.
1 
2 
3 #include <memory>
15 
27 
28 public:
30 
31  typedef std::shared_ptr<EcalNextToDeadChannel> ReturnType;
32 
33  ReturnType produce(const EcalNextToDeadChannelRcd& iRecord);
34 
35 
36 
37 private:
38 
41 
44 
46 
47  // threshold above which a channel will be considered "dead"
49 };
50 
52  //the following line is needed to tell the framework what
53  // data is being produced
54  setWhatProduced(this);
55 
56  statusThreshold_= iConfig.getParameter<int>("channelStatusThresholdForDead");
57 }
58 
59 
60 
63 
64  auto host = holder_.makeOrGet([]() {
65  return new HostType;
66  });
67 
68  host->ifRecordChanges<EcalChannelStatusRcd>(iRecord,
69  [this,h=host.get()](auto const& rec) {
71  });
72 
73  return host;
74 }
75 
76 
77 void
81 
82  rcd->clear();
83 
84  // Find channels next to dead ones and fill corresponding record
85 
87  chs.get (h);
88 
89  for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
90  if(ieta==0) continue;
91  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
92  if (EBDetId::validDetId(ieta,iphi)) {
93 
94  EBDetId detid(ieta,iphi);
95 
97  *h,
99 
100 
101  rcd->setValue(detid,1);
102  };
103  }
104  } // for phi
105  } // for eta
106 
107  // endcap
108 
109  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
110  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
111 
112  if (EEDetId::validDetId(iX,iY,1)) {
113  EEDetId detid(iX,iY,1);
114 
116  *h,
118  rcd->setValue(detid,1);
119  };
120 
121  }
122 
123  if (EEDetId::validDetId(iX,iY,-1)) {
124  EEDetId detid(iX,iY,-1);
125 
127  *h,
129 
130  rcd->setValue(detid,1);
131  };
132  }
133  } // for iy
134  } // for ix
135 }
136 
137 //define this as a plug-in
139 
140 // Configure (x)emacs for this file ...
141 // Local Variables:
142 // mode:c++
143 // compile-command: "cd .. ; scram b"
144 // End:
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:116
host
Definition: query.py:115
static const int MIN_IPHI
Definition: EBDetId.h:142
EcalNextToDeadChannelESProducer(const edm::ParameterSet &iConfig)
void setupNextToDeadChannels(const EcalChannelStatusRcd &, EcalNextToDeadChannel *)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
EcalCondObjectContainer< uint8_t > EcalNextToDeadChannel
static const int IX_MIN
Definition: EEDetId.h:294
static const int IY_MIN
Definition: EEDetId.h:298
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:124
std::shared_ptr< EcalNextToDeadChannel > ReturnType
void setValue(const uint32_t id, const Item &item)
edm::ESProductHost< EcalNextToDeadChannel, EcalChannelStatusRcd > HostType
static const int IX_MAX
Definition: EEDetId.h:302
static bool isNextToDeadFromNeighbours(const DetId &id, const EcalChannelStatus &chs, int chStatusThreshold)
same as isNextToDead, but will use information from the neighbour
Definition: EcalTools.cc:71
static const int MAX_IPHI
Definition: EBDetId.h:144
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
static const int MAX_IETA
Definition: EBDetId.h:143
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
static const int IY_MAX
Definition: EEDetId.h:306
bool get(HolderT &iHolder) const
ReturnType produce(const EcalNextToDeadChannelRcd &iRecord)
edm::ReusableObjectHolder< HostType > holder_