Go to the documentation of this file.00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020 #include "CaloOnlineTools/EcalTools/plugins/EcalExclusiveTrigFilter.h"
00021
00022 using namespace cms;
00023 using namespace edm;
00024 using namespace std;
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 EcalExclusiveTrigFilter::EcalExclusiveTrigFilter(const edm::ParameterSet& iConfig) :
00038 l1GTReadoutRecTag_ (iConfig.getUntrackedParameter<std::string>("L1GlobalReadoutRecord","gtDigis"))
00039 {
00040
00041
00042 }
00043
00044
00045 EcalExclusiveTrigFilter::~EcalExclusiveTrigFilter()
00046 {
00047
00048
00049
00050
00051 }
00052
00053
00054
00055
00056
00057
00058
00059 bool
00060 EcalExclusiveTrigFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup)
00061 {
00062
00063 Handle<L1MuGMTReadoutCollection> gmtrc_handle;
00064 iEvent.getByLabel(l1GTReadoutRecTag_,gmtrc_handle);
00065 L1MuGMTReadoutCollection const* gmtrc = gmtrc_handle.product();
00066 if (!(gmtrc_handle.isValid()))
00067 {
00068 LogWarning("EcalExclusiveTrigFilter") << "l1MuGMTReadoutCollection" << " not available";
00069
00070 }
00071
00072
00073 Handle<L1GlobalTriggerReadoutRecord> L1GTRR;
00074 iEvent.getByLabel(l1GTReadoutRecTag_,L1GTRR);
00075 bool isEcalL1 = false;
00076 const unsigned int sizeOfDecisionWord(L1GTRR->decisionWord().size());
00077 if (!(L1GTRR.isValid()))
00078 {
00079 LogWarning("EcalExclusiveTrigFilter") << l1GTReadoutRecTag_ << " not available";
00080
00081 }
00082 else if(sizeOfDecisionWord<128)
00083 {
00084 LogWarning("EcalExclusiveTrigFilter") << "size of L1 decisionword is " << sizeOfDecisionWord
00085 << "; L1 Ecal triggering bits not available";
00086 }
00087 else
00088 {
00089 l1Names_.resize(sizeOfDecisionWord);
00090 l1Accepts_.resize(sizeOfDecisionWord);
00091 for (unsigned int i=0; i!=sizeOfDecisionWord; ++i) {
00092 l1Accepts_[i]=0;
00093 l1Names_[i]="NameNotAvailable";
00094 }
00095 for (unsigned int i=0; i!=sizeOfDecisionWord; ++i) {
00096 if (L1GTRR->decisionWord()[i])
00097 {
00098 l1Accepts_[i]++;
00099
00100 }
00101 }
00102
00103 if(l1Accepts_[14] || l1Accepts_[15] || l1Accepts_[16] || l1Accepts_[17]
00104 || l1Accepts_[18] || l1Accepts_[19] || l1Accepts_[20])
00105 isEcalL1 = true;
00106 if(l1Accepts_[73] || l1Accepts_[74] || l1Accepts_[75] || l1Accepts_[76]
00107 || l1Accepts_[77] || l1Accepts_[78])
00108 isEcalL1 = true;
00109 }
00110
00111 bool isRPCL1 = false;
00112 bool isDTL1 = false;
00113 bool isCSCL1 = false;
00114 bool isHCALL1 = false;
00115
00116 std::vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
00117 std::vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
00118
00119 for(igmtrr=gmt_records.begin(); igmtrr!=gmt_records.end(); igmtrr++) {
00120
00121 std::vector<L1MuRegionalCand>::const_iterator iter1;
00122 std::vector<L1MuRegionalCand> rmc;
00123
00124
00125 int idt = 0;
00126 rmc = igmtrr->getDTBXCands();
00127 for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
00128 if ( !(*iter1).empty() ) {
00129 idt++;
00130 }
00131 }
00132
00133
00134
00135 if(igmtrr->getBxInEvent()==0 && idt>0) isDTL1 = true;
00136
00137
00138 int irpcb = 0;
00139 rmc = igmtrr->getBrlRPCCands();
00140 for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
00141 if ( !(*iter1).empty() ) {
00142 irpcb++;
00143 }
00144 }
00145
00146
00147
00148 if(igmtrr->getBxInEvent()==0 && irpcb>0) isRPCL1 = true;
00149
00150
00151 int icsc = 0;
00152 rmc = igmtrr->getCSCCands();
00153 for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
00154 if ( !(*iter1).empty() ) {
00155 icsc++;
00156 }
00157 }
00158
00159
00160 if(igmtrr->getBxInEvent()==0 && icsc>0) isCSCL1 = true;
00161 }
00162
00163 L1GlobalTriggerReadoutRecord const* gtrr = L1GTRR.product();
00164
00165 for(int ibx=-1; ibx<=1; ibx++) {
00166 bool hcal_top = false;
00167 bool hcal_bot = false;
00168 const L1GtPsbWord psb = gtrr->gtPsbWord(0xbb0d,ibx);
00169 std::vector<int> valid_phi;
00170 if((psb.aData(4)&0x3f) >= 1) {valid_phi.push_back( (psb.aData(4)>>10)&0x1f ); }
00171 if((psb.bData(4)&0x3f) >= 1) {valid_phi.push_back( (psb.bData(4)>>10)&0x1f ); }
00172 if((psb.aData(5)&0x3f) >= 1) {valid_phi.push_back( (psb.aData(5)>>10)&0x1f ); }
00173 if((psb.bData(5)&0x3f) >= 1) {valid_phi.push_back( (psb.bData(5)>>10)&0x1f ); }
00174 std::vector<int>::const_iterator iphi;
00175 for(iphi=valid_phi.begin(); iphi!=valid_phi.end(); iphi++) {
00176
00177 if(*iphi<9) hcal_top=true;
00178 if(*iphi>8) hcal_bot=true;
00179 }
00180 if(ibx==0 && hcal_top && hcal_bot) isHCALL1=true;
00181 }
00182
00183 std::cout << "**** Trigger Source ****" << std::endl;
00184 if(isDTL1) std::cout << "DT" << std::endl;
00185 if(isRPCL1) std::cout << "RPC" << std::endl;
00186 if(isCSCL1) cout << "CSC" << endl;
00187 if(isHCALL1) std::cout << "HCAL" << std::endl;
00188 if(isEcalL1) std::cout << "ECAL" << std::endl;
00189 std::cout << "************************" << std::endl;
00190
00191 return(isEcalL1 && !isDTL1 && !isRPCL1 && !isCSCL1 && !isHCALL1);
00192
00193 }