22 : rpctfSource_( ps.getParameter<
InputTag >(
"rpctfSource") ),
26 m_rateUpdateTime( ps.getParameter< int >(
"rateUpdateTime") ),
27 m_rateBinSize( ps.getParameter< int >(
"rateBinSize") ),
28 m_rateNoOfBins( ps.getParameter< int >(
"rateNoOfBins") ),
29 m_lastUsedBxInBxdiff(0),
30 output_dir_ (ps.getUntrackedParameter<string>(
"output_dir") )
39 if(
verbose_)
cout <<
"L1TRPCTF: constructor...." << endl;
51 cout <<
"L1T Monitoring histograms will be saved to " <<
outputFile_.c_str() << endl;
91 ostringstream oDir; oDir<<
output_dir_ <<
"/CrateSynchroHistograms/";
93 for(
unsigned int i = 0;
i < 12;
i++) {
95 ostringstream
o; o<<
"RPCTF_crate_"<<
i<<
"_synchro";
97 for (
int bx = -2; bx < 3; ++bx){
98 ostringstream
b; b<<
"BX="<<bx;
107 "RPCTF eta value bx=0", 33, -16.5, 16.5 ) ;
109 "RPCTF eta value bx>0", 33, -16.5, 16.5 ) ;
111 "RPCTF eta value bx<0", 33, -16.5, 16.5 ) ;
114 "RPCTF phi value bx=0", 144, -0.5, 143.5) ;
116 "RPCTF phi value bx>0", 144, -0.5, 143.5 ) ;
118 "RPCTF phi value bx<0", 144, -0.5, 143.5 ) ;
123 "RPCTF pt value bx=0", 160, -0.5, 159.5 );
125 "RPCTF pt value bx>0", 160, -0.5, 159.5 );
127 "RPCTF pt value bx<0", 160, -0.5, 159.5 );
131 "RPCTF charge value bx=0", 3, -1.5, 1.5 ) ;
133 "RPCTF charge value bx>0", 3, -1.5, 1.5 ) ;
135 "RPCTF charge value bx<01", 3, -1.5, 1.5 ) ;
138 "RPCTF quality bx=0", 6, -0.5, 5.5 ) ;
140 "RPCTF quality bx>0", 6, -0.5, 5.5 ) ;
142 "RPCTF quality bx<0", 6, -0.5, 5.5 ) ;
145 "RPCTF number of tracks - barrel, bx=0", 5, -0.5, 4.5 ) ;
147 "RPCTF number of tracks - barrel, bx>0", 5, -0.5, 4.5 ) ;
149 "RPCTF number of tracks - barrel, bx<0", 5, -0.5, 4.5 ) ;
154 "RPCTF number of tracks - endcap, bx=0", 5, -0.5, 4.5 ) ;
156 "RPCTF number of tracks - endcap, bx>0", 5, -0.5, 4.5 ) ;
158 "RPCTF number of tracks - endcap, bx<0", 5, -0.5, 4.5 ) ;
165 "RPCTF quality vs eta, bx=0",
169 "RPCTF quality vs eta, bx>0",
173 "RPCTF quality vs eta, bx<0",
180 "RPCTF occupancy(eta,phi), bx=0",
184 "RPCTF occupancy(eta,phi), bx>0",
188 "RPCTF occupancy(eta,phi), bx<0",
193 "RPCTF bx distribiution", 7, -3.5, 3.5 );
196 for (
int l = 0;
l<3; ++
l){
206 for (
int i = 0;
i < 12 ; ++
i ){
209 int lBin = int((30./360)*
i*144)+1;
210 std::stringstream ss;
212 for (
int l = 0;
l<3; ++
l){
232 for (
int i = -16;
i < 17 ; ++
i ){
233 std::stringstream ss;
235 for (
int l = 0;
l<3; ++
l){
254 "RPCTrigger - bx difference", 12000, -.5, 11999.5);
283 LogInfo(
"EndJob") <<
"analyzed " <<
nev_ <<
" events";
300 edm::LogInfo(
"DataNotFound") <<
"can't find L1MuGMTReadoutCollection with label "
307 vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->
getRecords();
308 vector<L1MuGMTReadoutRecord>::const_iterator RRItr;
310 std::vector<int> nrpctftrack_b(3,0);
311 std::vector<int> nrpctftrack_e(3,0);
312 bool rpcCandsPresentInEvent =
false;
314 vector<L1TRPCTF::BxDelays> all_bxdelays;
317 for( RRItr = gmt_records.begin() ;
318 RRItr != gmt_records.end() ;
322 if (
verbose_)
cout <<
"Readout Record " << RRItr->getBxInEvent() << endl;
324 vector<vector<L1MuRegionalCand> > brlAndFwdCands;
325 brlAndFwdCands.push_back(RRItr->getBrlRPCCands());
326 brlAndFwdCands.push_back(RRItr->getFwdRPCCands());
329 vector<vector<L1MuRegionalCand> >::iterator RPCTFCands = brlAndFwdCands.begin();
330 for(; RPCTFCands!= brlAndFwdCands.end(); ++RPCTFCands)
333 for( vector<L1MuRegionalCand>::const_iterator
334 ECItr = RPCTFCands->begin() ;
335 ECItr != RPCTFCands->end() ;
340 if (ECItr->bx() > 0) bxindex = 2;
341 if (ECItr->bx() < 0) bxindex = 0;
343 if (!ECItr->empty()) {
345 rpcCandsPresentInEvent =
true;
347 if (beIndex == 0) ++nrpctftrack_b[bxindex];
348 if (beIndex == 1) ++nrpctftrack_e[bxindex];
350 if (
verbose_)
cout <<
"RPCTFCand bx " << ECItr->bx() << endl;
352 int tower = ECItr->eta_packed();
354 tower = - ( (~tower & 63) + 1);
360 if (
verbose_)
cout <<
"\tRPCTFCand eta value " << ECItr->etaValue() << endl;
363 if (
verbose_)
cout <<
"\tRPCTFCand phi value " << ECItr->phiValue() << endl;
366 if (
verbose_)
cout <<
"\tRPCTFCand pt value " << ECItr->ptValue()<< endl;
369 if (
verbose_)
cout <<
"\tRPCTFCand charge value " << ECItr->chargeValue() << endl;
372 if (
verbose_)
cout <<
"\tRPCTFCand quality " << ECItr->quality() << endl;
379 bx_del.
bx = ECItr->bx();
380 bx_del.
eta_t = tower;
381 bx_del.
phi_p = ECItr->phi_packed();
382 all_bxdelays.push_back(bx_del);
390 for (
int bxI = 0; bxI < 3; ++bxI){
396 if (rpcCandsPresentInEvent) {
414 for(
unsigned int i = 0;
i < all_bxdelays.size();
i++) {
416 int sector= ((all_bxdelays[
i].phi_p+ 142)%144)/12;
417 if (sector>11 || sector < 0)
continue;
418 int eta_tower = all_bxdelays[
i].eta_t;
419 for(
unsigned int j = 0;
j < all_bxdelays.size();
j++) {
421 int sector2= ((all_bxdelays[
j].phi_p + 142)%144)/12;
423 int distance_cut = 1;
424 int distance = ((sector+12)-sector2)%12;
425 distance =
min(distance, 11-distance);
426 if(distance<distance_cut)
continue;
428 int bxDiff = all_bxdelays[
i].bx-all_bxdelays[
j].bx;
445 static bool flushed =
false;
448 LogWarning(
"L1TRPCTF") <<
"Rate histos allready flushed \n";
451 if (flush) flushed =
true;
467 std::pair<int, int>
p;
470 int curTimeInMinutes=startTimeInMinutes;
471 while (curTimeInMinutes==startTimeInMinutes){
473 if (p.first < 0)
break;
480 if (max < p.second) max = p.second;
481 if (
min > p.second)
min = p.second;
std::set< unsigned long long int > m_globBX
std::pair< int, int > removeAndGetRateForEarliestTime()
MonitorElement * rpctfcratesynchro[12]
T getUntrackedParameter(std::string const &, T const &) const
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * rpctfchargevalue[3]
MonitorElement * rpctfetavalue[3]
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
void fillRateHistos(int orbit, bool flush=false)
void rmdir(const std::string &fullpath)
MonitorElement * rpctfptvalue[3]
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
int bunchCrossing() const
MonitorElement * m_rateAvg
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
int getTimeForOrbit(int orbit)
void analyze(const edm::Event &e, const edm::EventSetup &c)
void addOrbit(int orbit)
Adds event with specified orbit. If the event for some reason comes late (after removal of corespondi...
L1TRateHelper::L1TRateHelper m_rateHelper
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
MonitorElement * rpctfquality[3]
const T & max(const T &a, const T &b)
MonitorElement * rpctfphivalue[3]
MonitorElement * m_rateMax
void endRun(const edm::Run &r, const edm::EventSetup &c)
void setVerbose(unsigned level)
MonitorElement * m_bxDiff
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
MonitorElement * m_muonsEtaPhi[3]
MonitorElement * m_qualVsEta[3]
std::vector< L1MuGMTReadoutRecord > getRecords() const
L1TRPCTF(const edm::ParameterSet &ps)
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
long long int m_lastUsedBxInBxdiff
T const * product() const
MonitorElement * rpctfntrack_e[3]
int getEarliestTime()
gets time of earliest event (orbit) recorded in event. Returned time -1 is invalid ...
edm::InputTag rpctfSource_
MonitorElement * m_rateMin
MonitorElement * rpctfntrack_b[3]
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setCurrentFolder(const std::string &fullpath)