141 : _digicollectionToken(
142 consumes<edm::DetSetVector<
SiStripDigi> >(iConfig.getParameter<edm::
InputTag>(
"digiCollection"))),
146 _useCabling(iConfig.getUntrackedParameter<bool>(
"useCabling",
true)),
148 : decltype(_detCablingWatcher){}),
151 _zs(
iConfig.getUntrackedParameter<
bool>(
"zeroSuppressed",
true)),
163 _nShots = tfserv->
make<TH1F>(
"nShots",
"Number of Shots per event", 200, -0.5, 199.5);
164 _nShots->GetXaxis()->SetTitle(
"Shots");
165 _nShots->GetYaxis()->SetTitle(
"Events");
166 _nShots->StatOverflows(kTRUE);
168 _whichAPV = tfserv->
make<TH1F>(
"whichAPV",
"APV with shots", 6, -0.5, 5.5);
169 _whichAPV->GetXaxis()->SetTitle(
"APV");
170 _whichAPV->GetYaxis()->SetTitle(
"Shots");
172 _stripMult = tfserv->
make<TH1F>(
"stripMultiplicity",
"Shot Strip Multiplicity", 129, -0.5, 128.5);
173 _stripMult->GetXaxis()->SetTitle(
"Number of Strips");
174 _stripMult->GetYaxis()->SetTitle(
"Shots");
176 _median = tfserv->
make<TH1F>(
"median",
"APV Shot charge median", 256, -0.5, 255.5);
177 _median->GetXaxis()->SetTitle(
"Charge [ADC]");
178 _median->GetYaxis()->SetTitle(
"Shots");
180 _subDetector = tfserv->
make<TH1F>(
"subDets",
"SubDetector Shot distribution", 10, -0.5, 9.5);
181 _subDetector->GetYaxis()->SetTitle(
"Shots");
183 _nShotsbxcycle = tfserv->
make<TProfile>(
"nShotsBXcycle",
"Number of shots vs APV cycle bin", 70, -0.5, 69.5);
184 _nShotsbxcycle->GetXaxis()->SetTitle(
"Event BX mod(70)");
185 _nShotsbxcycle->GetYaxis()->SetTitle(
"APV shots");
187 _nShotsdbx = tfserv->
make<TProfile>(
"nShotsDBX",
"Number of shots vs #Delta(BX)", 1000, -0.5, 999.5);
188 _nShotsdbx->GetXaxis()->SetTitle(
"Event #Delta(BX)");
189 _nShotsdbx->GetYaxis()->SetTitle(
"APV shots");
192 tfserv->
make<TProfile>(
"nShotsDBXincycle",
"Number of shots vs #Delta(BX) w.r.t. APV cycle", 1000, -0.5, 999.5);
193 _nShotsdbxincycle->GetXaxis()->SetTitle(
"Event #Delta(BX) w.r.t. APV cycle");
194 _nShotsdbxincycle->GetYaxis()->SetTitle(
"APV shots");
197 tfserv->
make<TProfile>(
"nShotsBXcycleprev",
"Number of shots vs APV cycle bin of previous L1A", 70, -0.5, 69.5);
198 _nShotsbxcycleprev->GetXaxis()->SetTitle(
"Previous L1A BX mod(70)");
199 _nShotsbxcycleprev->GetYaxis()->SetTitle(
"APV shots");
202 tfserv->
make<TProfile>(
"nShotsDBXprev",
"Number of shots vs #Delta(BX) of previous L1A", 1000, -0.5, 999.5);
203 _nShotsdbxprev->GetXaxis()->SetTitle(
"Previous L1A #Delta(BX)");
204 _nShotsdbxprev->GetYaxis()->SetTitle(
"APV shots");
206 _nShotsdbxincycleprev = tfserv->
make<TProfile>(
207 "nShotsDBXincycleprev",
"Number of shots vs #Delta(BX) w.r.t. APV cycle of previous L1A", 1000, -0.5, 999.5);
208 _nShotsdbxincycleprev->GetXaxis()->SetTitle(
"Previous L1A #Delta(BX) w.r.t. APV cycle");
209 _nShotsdbxincycleprev->GetYaxis()->SetTitle(
"APV shots");
211 _nShotsrun =
_rhm.makeTH1F(
"nShotsrun",
"Number of Shots per event", 200, -0.5, 199.5);
213 _rhm.makeTProfile(
"nShotsVsTimerun",
"Mean number of shots vs orbit number", 4 * 500, 0, 500 * 262144);
214 _whichAPVrun =
_rhm.makeTH1F(
"whichAPVrun",
"APV with shots", 6, -0.5, 5.5);
215 _stripMultrun =
_rhm.makeTH1F(
"stripMultiplicityrun",
"Shot Strip Multiplicity", 129, -0.5, 128.5);
216 _medianrun =
_rhm.makeTH1F(
"medianrun",
"APV Shot charge median", 256, -0.5, 255.5);
217 _subDetectorrun =
_rhm.makeTH1F(
"subDetsrun",
"SubDetector Shot distribution", 10, -0.5, 9.5);
220 _fed = tfserv->
make<TH1F>(
"fed",
"FED Shot distribution", 440, 50, 490);
221 _fed->GetYaxis()->SetTitle(
"Shots");
222 _fedrun =
_rhm.makeTH1F(
"fedrun",
"FED Shot distribution", 440, 50, 490);
225 tfserv->
make<TH2F>(
"channelvsfed",
"Channel vs FED Shot distribution", 440, 50, 490, 97, -0.5, 96.5);
226 _channelvsfed->GetXaxis()->SetTitle(
"FED");
227 _channelvsfed->GetYaxis()->SetTitle(
"Channel");
230 tfserv->
make<TH2F>(
"nShotsVsFED",
"Number of Shots per event vs fedid", 440, 50, 490, 200, -0.5, 199.5);
231 _nShotsVsFED->GetXaxis()->SetTitle(
"fedId");
232 _nShots->GetYaxis()->SetTitle(
"Shots");
233 _nShots->GetZaxis()->SetTitle(
"Events");
234 _nShotsVsFED->StatOverflows(kTRUE);
236 _medianVsFED = tfserv->
make<TH2F>(
"medianVsFED",
"APV Shot charge median vs fedid", 440, 50, 490, 256, -0.5, 255.5);
237 _medianVsFED->GetXaxis()->SetTitle(
"fedId");
238 _medianVsFED->GetYaxis()->SetTitle(
"Charge [ADC]");
239 _median->GetZaxis()->SetTitle(
"Shots");
268 tkhisto = std::make_unique<TkHistoMap>(tkDetMap,
"ShotMultiplicity",
"ShotMultiplicity", -1);
269 tkhisto2 = std::make_unique<TkHistoMap>(tkDetMap,
"StripMultiplicity",
"StripMultiplicity", -1);
281 if (apvphase.isValid() && !apvphase.failedToGet()) {
293 std::vector<int> nshotsperFed;
297 nshotsperFed.resize(lNumFeds, 0);
301 const std::vector<APVShot>& shots = apvsf.
getShots();
303 for (std::vector<APVShot>::const_iterator shot = shots.begin(); shot != shots.end(); ++shot) {
304 if (shot->isGenuine()) {
307 uint32_t det = shot->detId();
309 int apvPair = shot->apvNumber() / 2;
317 lChannelId = theConn.
fedCh();
318 thelFEDId = theConn.
fedId();
321 <<
"connection of det " << det <<
" APV pair " << apvPair <<
" not found";
323 LogDebug(
"FED channels") << thelFEDId <<
" " << lChannelId;
330 for (uint32_t ch = 0; ch < conns.size(); ch++) {
331 if (conns[ch] && conns[ch]->isConnected()) {
333 LogDebug(
"ReadyForFEDid") <<
"Ready for FED id " << ch;
334 lFedId = conns[ch]->fedId();
335 LogDebug(
"FEDid") <<
"obtained FED id " << ch <<
" " << lFedId;
339 edm::LogWarning(
"InvalidFEDid") << lFedId <<
" for detid " << det <<
" connection " << ch;
346 edm::LogWarning(
"NoValidFEDid") << lFedId <<
"found for detid " << det;
350 if (lFedId != thelFEDId) {
351 edm::LogWarning(
"FEDidMismatch") <<
" Mismatch in FED id for det " << det <<
" APV pair " << apvPair <<
" : "
352 << lFedId <<
" vs " << thelFEDId;
358 LogDebug(
"ReadyToBeFilled") <<
" ready to be filled with " << thelFEDId <<
" " << lChannelId;
360 LogDebug(
"Filled") <<
" filled with " << thelFEDId <<
" " << lChannelId;
365 (*_fedrun)->Fill(lFedId);
377 (*_whichAPVrun)->Fill(shot->apvNumber());
379 (*_medianrun)->Fill(shot->median());
381 (*_stripMultrun)->Fill(shot->nStrips());
383 (*_subDetectorrun)->Fill(shot->subDet());
385 tkhisto2->fill(det, shot->nStrips());
393 (*_nShotsrun)->Fill(nshots);
405 for (uint16_t lFed(0); lFed < lNumFeds; lFed++) {
411 (*_nShotsVsTimerun)->Fill(iEvent.
orbitNumber(), nshots);
418 (*_nShotsrun)->GetXaxis()->SetTitle(
"Shots");
419 (*_nShotsrun)->GetYaxis()->SetTitle(
"Events");
420 (*_nShotsrun)->StatOverflows(kTRUE);
424 (*_nShotsVsTimerun)->GetXaxis()->SetTitle(
"Orbit");
425 (*_nShotsVsTimerun)->GetYaxis()->SetTitle(
"Number of Shots");
426 (*_nShotsVsTimerun)->SetCanExtend(TH1::kXaxis);
430 (*_whichAPVrun)->GetXaxis()->SetTitle(
"APV");
431 (*_whichAPVrun)->GetYaxis()->SetTitle(
"Shots");
435 (*_stripMultrun)->GetXaxis()->SetTitle(
"Number of Strips");
436 (*_stripMultrun)->GetYaxis()->SetTitle(
"Shots");
440 (*_medianrun)->GetXaxis()->SetTitle(
"Charge [ADC]");
441 (*_medianrun)->GetYaxis()->SetTitle(
"Shots");
445 (*_subDetectorrun)->GetYaxis()->SetTitle(
"Shots");
450 (*_fedrun)->GetYaxis()->SetTitle(
"Shots");
472 tkmap.
save(
true, 0, 0, tkshotmultmapname);
474 tkmap2.
save(
true, 0, 0, tkstripmultmapname);
static const std::string kSharedResource
std::unique_ptr< TkHistoMap > tkhisto
const FedChannelConnection & getConnection(uint32_t det_id, unsigned short apv_pair) const
static const uint16_t FED_ID_MIN
const uint16_t & fedCh() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
TProfile ** _nShotsVsTimerun
edm::ESGetToken< SiStripDetCabling, SiStripDetCablingRcd > _detCablingToken
void endRun(const edm::Run &, const edm::EventSetup &) override
T * make(const Args &...args) const
make new ROOT object
const uint16_t & fedId() const
TProfile * _nShotsbxcycleprev
TProfile * _nShotsdbxincycle
edm::ESWatcher< SiStripDetCablingRcd > _detCablingWatcher
_rhm(consumesCollector())
bool getData(T &iHolder) const
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
const std::vector< APVShot > & getShots() const
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
APVShotsAnalyzer(const edm::ParameterSet &)
edm::EDGetTokenT< EventWithHistory > _historyProductToken
Class containning control, module, detector and connection information, at the level of a FED channel...
edm::ESGetToken< TkDetMap, TrackerTopologyRcd > _tkDetMapToken
void updateDetCabling(const SiStripDetCablingRcd &iRcd)
void setPalette(int numpalette)
TProfile * _nShotsbxcycle
void save(bool print_total=true, float minval=0., float maxval=0., std::string s="svgmap.svg", int width=1500, int height=800)
void beginRun(const edm::Run &, const edm::EventSetup &) override
const SiStripDetCabling * _detCabling
The cabling object.
A Digi for the silicon strip detector, containing both strip and adc information, and suitable for st...
_phasepart(iConfig.getUntrackedParameter< std::string >("phasePartition","None"))
Log< level::Info, false > LogInfo
_suffix(iConfig.getParameter< std::string >("mapSuffix"))
void beginRun(const edm::Run &iRun)
bool check(const edm::EventSetup &iSetup)
TProfile * _nShotsdbxincycleprev
const std::string _phasepart
TProfile * _nShotsdbxprev
static const uint16_t FED_ID_MAX
~APVShotsAnalyzer() override
Log< level::Warning, false > LogWarning
void analyze(const edm::Event &, const edm::EventSetup &) override
_detCablingToken(_useCabling?decltype(_detCablingToken){esConsumes()}:decltype(_detCablingToken){})
std::unique_ptr< TkHistoMap > tkhisto2
edm::EDGetTokenT< APVCyclePhaseCollection > _apvphasecollToken
edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > _digicollectionToken
_zs(iConfig.getUntrackedParameter< bool >("zeroSuppressed", true))