81 virtual void endJob()
override ;
144 _digicollectionToken(consumes<edm::DetSetVector<
SiStripDigi> >(iConfig.getParameter<edm::
InputTag>(
"digiCollection"))),
147 _phasepart(iConfig.getUntrackedParameter<std::
string>(
"phasePartition",
"None")),
148 _zs(iConfig.getUntrackedParameter<bool>(
"zeroSuppressed",
true)),
149 _suffix(iConfig.getParameter<std::
string>(
"mapSuffix")),
151 _rhm(consumesCollector()),
152 _useCabling(iConfig.getUntrackedParameter<bool>(
"useCabling",
true)),
162 _nShots = tfserv->
make<TH1F>(
"nShots",
"Number of Shots per event",200,-0.5,199.5);
163 _nShots->GetXaxis()->SetTitle(
"Shots");
_nShots->GetYaxis()->SetTitle(
"Events");
166 _whichAPV = tfserv->
make<TH1F>(
"whichAPV",
"APV with shots",6,-0.5,5.5);
169 _stripMult = tfserv->
make<TH1F>(
"stripMultiplicity",
"Shot Strip Multiplicity",129,-0.5,128.5);
170 _stripMult->GetXaxis()->SetTitle(
"Number of Strips");
_stripMult->GetYaxis()->SetTitle(
"Shots");
172 _median = tfserv->
make<TH1F>(
"median",
"APV Shot charge median",256,-0.5,255.5);
173 _median->GetXaxis()->SetTitle(
"Charge [ADC]");
_median->GetYaxis()->SetTitle(
"Shots");
175 _subDetector = tfserv->
make<TH1F>(
"subDets",
"SubDetector Shot distribution",10,-0.5,9.5);
178 _nShotsbxcycle = tfserv->
make<TProfile>(
"nShotsBXcycle",
"Number of shots vs APV cycle bin",70,-0.5,69.5);
181 _nShotsdbx = tfserv->
make<TProfile>(
"nShotsDBX",
"Number of shots vs #Delta(BX)",1000,-0.5,999.5);
182 _nShotsdbx->GetXaxis()->SetTitle(
"Event #Delta(BX)");
_nShotsdbx->GetYaxis()->SetTitle(
"APV shots");
184 _nShotsdbxincycle = tfserv->
make<TProfile>(
"nShotsDBXincycle",
"Number of shots vs #Delta(BX) w.r.t. APV cycle",1000,-0.5,999.5);
187 _nShotsbxcycleprev = tfserv->
make<TProfile>(
"nShotsBXcycleprev",
"Number of shots vs APV cycle bin of previous L1A",70,-0.5,69.5);
190 _nShotsdbxprev = tfserv->
make<TProfile>(
"nShotsDBXprev",
"Number of shots vs #Delta(BX) of previous L1A",1000,-0.5,999.5);
193 _nShotsdbxincycleprev = tfserv->
make<TProfile>(
"nShotsDBXincycleprev",
"Number of shots vs #Delta(BX) w.r.t. APV cycle of previous L1A",1000,-0.5,999.5);
204 _fed = tfserv->
make<TH1F>(
"fed",
"FED Shot distribution",440,50,490);
205 _fed->GetYaxis()->SetTitle(
"Shots");
208 _channelvsfed = tfserv->
make<TH2F>(
"channelvsfed",
"Channel vs FED Shot distribution",440,50,490,97,-0.5,96.5);
212 _nShotsVsFED = tfserv->
make<TH2F>(
"nShotsVsFED",
"Number of Shots per event vs fedid",440,50,490,200,-0.5,199.5);
216 _medianVsFED = tfserv->
make<TH2F>(
"medianVsFED",
"APV Shot charge median vs fedid",440,50,490,256,-0.5,255.5);
259 if(apvphase.isValid() && !apvphase.failedToGet()) {
272 std::vector<int> nshotsperFed;
276 nshotsperFed.resize(lNumFeds,0);
280 const std::vector<APVShot>& shots = apvsf.
getShots();
282 for(std::vector<APVShot>::const_iterator shot=shots.begin();shot!=shots.end();++shot) {
283 if(shot->isGenuine()) {
287 uint32_t det=shot->detId();
290 int apvPair = shot->apvNumber()/2;
298 lChannelId = theConn.
fedCh();
299 thelFEDId = theConn.
fedId();
302 edm::LogWarning(
"ConnectionNotFound") <<
"connection of det " << det <<
" APV pair " << apvPair <<
" not found";
304 LogDebug(
"FED channels") << thelFEDId <<
" " << lChannelId ;
308 if (!(conns.size()))
continue;
310 for (uint32_t ch = 0; ch<conns.size(); ch++) {
311 if(conns[ch] && conns[ch]->isConnected()) {
313 LogDebug(
"ReadyForFEDid") <<
"Ready for FED id " << ch;
314 lFedId = conns[ch]->fedId();
315 LogDebug(
"FEDid") <<
"obtained FED id " << ch <<
" " << lFedId;
319 edm::LogWarning(
"InvalidFEDid") << lFedId <<
" for detid " << det <<
" connection " << ch;
326 edm::LogWarning(
"NoValidFEDid") << lFedId <<
"found for detid " << det;
330 if(lFedId != thelFEDId) {
331 edm::LogWarning(
"FEDidMismatch") <<
" Mismatch in FED id for det " << det <<
" APV pair "
332 << apvPair <<
" : " << lFedId <<
" vs " << thelFEDId;
338 LogDebug(
"ReadyToBeFilled") <<
" ready to be filled with " << thelFEDId <<
" " << lChannelId;
340 LogDebug(
"Filled") <<
" filled with " << thelFEDId <<
" " << lChannelId;
384 for (uint16_t lFed(0); lFed<lNumFeds; lFed++){
402 (*_nShotsrun)->GetXaxis()->SetTitle(
"Shots"); (*_nShotsrun)->GetYaxis()->SetTitle(
"Events");
403 (*_nShotsrun)->StatOverflows(kTRUE);
407 (*_nShotsVsTimerun)->GetXaxis()->SetTitle(
"Orbit"); (*_nShotsVsTimerun)->GetYaxis()->SetTitle(
"Number of Shots");
408 (*_nShotsVsTimerun)->SetCanExtend(TH1::kXaxis);
412 (*_whichAPVrun)->GetXaxis()->SetTitle(
"APV"); (*_whichAPVrun)->GetYaxis()->SetTitle(
"Shots");
416 (*_stripMultrun)->GetXaxis()->SetTitle(
"Number of Strips"); (*_stripMultrun)->GetYaxis()->SetTitle(
"Shots");
420 (*_medianrun)->GetXaxis()->SetTitle(
"Charge [ADC]"); (*_medianrun)->GetYaxis()->SetTitle(
"Shots");
424 (*_subDetectorrun)->GetYaxis()->SetTitle(
"Shots");
429 (*_fedrun)->GetYaxis()->SetTitle(
"Shots");
462 tkmap.
save(
true,0,0,tkshotmultmapname);
464 tkmap2.
save(
true,0,0,tkstripmultmapname);
virtual void beginJob() override
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
virtual void endRun(const edm::Run &, const edm::EventSetup &) override
T * make(const Args &...args) const
make new ROOT object
virtual void endJob() override
const uint16_t & fedId() const
TProfile * _nShotsbxcycleprev
TProfile * _nShotsdbxincycle
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
const std::vector< APVShot > & getShots() const
void save(std::string filename)
TH1F ** makeTH1F(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax)
APVShotsAnalyzer(const edm::ParameterSet &)
edm::EDGetTokenT< EventWithHistory > _historyProductToken
Class containning control, module, detector and connection information, at the level of a FED channel...
void fill(uint32_t &detid, float value)
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)
TProfile ** makeTProfile(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax)
virtual 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...
void dumpInTkMap(TrackerMap *tkmap, bool dumpEntries=false)
void beginRun(const edm::Run &iRun)
T const * product() const
TProfile * _nShotsdbxincycleprev
const std::string _phasepart
TProfile * _nShotsdbxprev
static const uint16_t FED_ID_MAX
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< APVCyclePhaseCollection > _apvphasecollToken
edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > _digicollectionToken
uint32_t _cacheIdDet
DB cache ID used to establish if the cabling has changed during the run.
void add(uint32_t &detid, float value)
void updateDetCabling(const edm::EventSetup &setup)