Public Member Functions | |
virtual void | analyze (edm::Event const &e, edm::EventSetup const &c) |
virtual void | endJob () |
HcalCableMapper (edm::ParameterSet const &conf) | |
Private Types | |
typedef std::map< HcalDetId, HcalElectronicsId > | IdMap |
typedef std::map< HcalDetId, SampleSet > | PathSet |
typedef std::vector < HcalQIESample > | SampleSet |
Private Member Functions | |
void | process (const PathSet &ps, const IdMap &im) |
template<class DigiCollection> | |
void | record (const DigiCollection &digis) |
Private Attributes | |
std::map< HcalDetId, std::vector< SampleSet > > | fullHistory_ |
edm::InputTag | hbheLabel_ |
edm::InputTag | hfLabel_ |
edm::InputTag | hoLabel_ |
IdMap | IdSet |
Definition at line 21 of file HcalCableMapper.cc.
typedef std::map<HcalDetId,HcalElectronicsId> HcalCableMapper::IdMap [private] |
Definition at line 31 of file HcalCableMapper.cc.
typedef std::map<HcalDetId,SampleSet> HcalCableMapper::PathSet [private] |
Definition at line 30 of file HcalCableMapper.cc.
typedef std::vector<HcalQIESample> HcalCableMapper::SampleSet [private] |
Definition at line 28 of file HcalCableMapper.cc.
HcalCableMapper::HcalCableMapper | ( | edm::ParameterSet const & | conf | ) | [explicit] |
Definition at line 62 of file HcalCableMapper.cc.
00062 : 00063 hbheLabel_(conf.getParameter<edm::InputTag>("hbheLabel")), 00064 hoLabel_(conf.getParameter<edm::InputTag>("hoLabel")), 00065 hfLabel_(conf.getParameter<edm::InputTag>("hfLabel")){ 00066 00067 }
void HcalCableMapper::analyze | ( | edm::Event const & | e, | |
edm::EventSetup const & | c | |||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 165 of file HcalCableMapper.cc.
References edm::Event::getByLabel(), hbheLabel_, hfLabel_, hoLabel_, and record().
00165 { 00166 00167 edm::Handle<HBHEDigiCollection> hbhe; 00168 e.getByLabel(hbheLabel_,hbhe); 00169 00170 edm::Handle<HFDigiCollection> hf; 00171 e.getByLabel(hfLabel_,hf); 00172 edm::Handle<HODigiCollection> ho; 00173 e.getByLabel(hoLabel_,ho); 00174 00175 00176 record(*hbhe); 00177 record(*hf); 00178 record(*ho); 00179 }
Reimplemented from edm::EDAnalyzer.
Definition at line 184 of file HcalCableMapper.cc.
References c, fullHistory_, i, IdSet, j, k, kk, process(), and s.
00184 { 00185 00186 00187 std::vector<SampleSet>::iterator j; 00188 int c [128]; 00189 int k,ii,kk; 00190 int c_max=0,c_next=0; 00191 00192 std::map<HcalDetId,std::vector<SampleSet> >::iterator i; 00193 00194 PathSet consensus; 00195 00196 for (i=fullHistory_.begin(); i!=fullHistory_.end(); i++) { 00197 //i.first --> id 00198 //i.second --> vector<SampleSet> 00199 SampleSet s; 00200 for (k=0; k<10; k++) { 00201 for (ii=0; ii<128; ii++) c[ii]=0; 00202 00203 for (j=i->second.begin();j!=i->second.end();j++){//word number 00204 if (int(j->size())>k) 00205 c[(*j)[k].adc()]++; 00206 00207 00208 }//j loop 00209 //sort c-array 00210 for (kk=0;kk<128;kk++){ 00211 if (c[kk]>c[c_max]){ 00212 c_next=c_max; 00213 c_max = kk; 00214 } 00215 }//std::cout<<"c_max:"<<c_max << " " << c[c_max] <<", c_next:"<<c_next<< " " << c[c_next]<<std::endl; 00216 00217 00218 s.push_back(((c_max&0x7F))); 00219 00220 00221 c_next=0; 00222 c_max=0; 00223 }//k-loop 00224 consensus[i->first]=s; 00225 00226 }//i loop 00227 00228 process(consensus,IdSet); 00229 00230 00231 00232 00233 00234 }//end of endjob
Definition at line 73 of file HcalCableMapper.cc.
References c, GenMuonPlsPt100GeV_cfg::cout, HcalElectronicsId::dccid(), dd, HcalDetId::depth(), det_names, lat::endl(), HcalElectronicsId::fiberChanId(), HcalElectronicsId::fiberIndex(), header, HcalElectronicsId::htrSlot(), HcalElectronicsId::htrTopBottom(), HcalDetId::ietaAbs(), HcalDetId::iphi(), HcalElectronicsId::readoutVMECrateId(), HcalElectronicsId::spigot(), ss, and HcalDetId::subdet().
Referenced by endJob().
00073 { 00074 00075 PathSet::const_iterator iii; 00076 IdMap::const_iterator ij; 00077 00078 for (iii=ps.begin();iii!=ps.end();iii++){ 00079 00080 00081 SampleSet ss = iii->second; 00082 const HcalDetId dd = iii->first; 00083 00084 ij=im.find(dd); 00085 HcalElectronicsId eid=ij->second; 00086 00087 int header = ((ss[0].adc())&0x7F); 00088 int ieta = ((ss[1].adc())&0x3F); 00089 int z_ieta = (((ss[1].adc())>>6)&0x1); 00090 int iphi = ((ss[2].adc())&0x7F); 00091 int depth = ((ss[3].adc())&0x7); 00092 int det = (((ss[3].adc())>>3)&0xF); 00093 int spigot = ((ss[4].adc())&0xF); 00094 int fiber = (((ss[4].adc())>>4)&0x7); 00095 int crate = ((ss[5].adc())&0x1F); 00096 int fiber_chan= (((ss[5].adc())>>5)&0x3); 00097 int G_Dcc = ((ss[6].adc())&0x3F); 00098 int H_slot = ((ss[7].adc())&0x1F); 00099 int TB = (((ss[7].adc())>>5)&0x1); 00100 int RBX_7 = (((ss[7].adc())>>6)&0x1); 00101 int RBX = ((ss[8].adc())&0x7F); 00102 int RM = ((ss[9].adc())&0x3); 00103 int RM_card= (((ss[9].adc())>>2)&0x3); 00104 int RM_chan= (((ss[9].adc())>>4)&0x7); 00105 string eta_sign; 00106 std::string det_name; 00107 if (det>4 || det<0) { 00108 char c[20]; 00109 snprintf(c,20,"Det=%d",det); 00110 det_name=c; 00111 } else det_name=det_names[det]; 00112 00113 00114 if (z_ieta==1){ 00115 eta_sign = "+"; 00116 }else{eta_sign = "-";} 00117 string is_header; 00118 if (header == 0x75){ 00119 00120 //NO SHIFT 00121 if((spigot==eid.spigot())&&(fiber+1==eid.fiberIndex())&&(fiber_chan==eid.fiberChanId())&&(H_slot==eid.htrSlot())&&(G_Dcc==eid.dccid())&&(crate==eid.readoutVMECrateId())&&(iphi==dd.iphi())&&(depth==dd.depth())&&(ieta==dd.ietaAbs())&&(TB==eid.htrTopBottom())&&(det==dd.subdet())){//&&(z_ieta==dd.zside()) 00122 std::cout <<"Pathway match"<<std::endl; 00123 }else{ 00124 00125 is_header=" Header found"; 00126 00127 std::cout <<" Digi ID: " << dd << is_header<< " ieta: "<< eta_sign << ieta << " iphi: "<< iphi << " Depth: " << depth << " Detector: " << det_name << " Spigot: "<< spigot<<"/"<<eid.spigot() << " Fiber: " << fiber+1<<"/"<<eid.fiberIndex() << " Fiber Channel: "<< fiber_chan <<"/"<<eid.fiberChanId()<< " Crate: " << crate<<"/"<<eid.readoutVMECrateId() << " Global Dcc: " << G_Dcc <<"/"<<eid.dccid() << " HTR Slot: " << H_slot <<"/ " <<eid.htrSlot()<< " Top/Bottom: " << TB<<"/"<< eid.htrTopBottom() << " RBX: " << (RBX_7*128+RBX) << " RM: " << RM+1 << " RM Card: " << RM_card+1 << " RM Channel: " << RM_chan << std::endl; 00128 } 00129 }else if (ieta+64==0x75){ 00130 00131 ieta = ((ss[2].adc())&0x3F); 00132 z_ieta = (((ss[2].adc())>>6)&0x1); 00133 iphi = ((ss[3].adc())&0x7F); 00134 depth = ((ss[4].adc())&0x7); 00135 det = (((ss[4].adc())>>3)&0xF); 00136 spigot = ((ss[5].adc())&0xF); 00137 fiber = (((ss[5].adc())>>4)&0x7); 00138 crate = ((ss[6].adc())&0x1F); 00139 fiber_chan= (((ss[6].adc())>>5)&0x3); 00140 G_Dcc = ((ss[7].adc())&0x3F); 00141 H_slot = ((ss[8].adc())&0x1F); 00142 TB = (((ss[8].adc())>>5)&0x1); 00143 RBX_7 = (((ss[8].adc())>>6)&0x1); 00144 RBX = ((ss[9].adc())&0x7F); 00145 00146 00147 //SHIFT 00148 if((spigot==eid.spigot())&&(fiber+1==eid.fiberIndex())&&(fiber_chan==eid.fiberChanId())&&(H_slot==eid.htrSlot())&&(G_Dcc==eid.dccid())&&(TB==eid.htrTopBottom())&&(crate==eid.readoutVMECrateId())&&(iphi==dd.iphi())&&(depth==dd.depth())&&(det==dd.subdet())&&(ieta==dd.ietaAbs())){//&&(z_ieta==dd.zside()) 00149 00150 std::cout <<"Pathway match (SHIFT)"<<std::endl; 00151 }else{ 00152 00153 00154 is_header=" DATA SHIFT"; 00155 00156 std::cout <<" Digi ID: " << dd << is_header<< " ieta: "<< eta_sign << ieta << " iphi: "<< iphi << " Depth: " << depth << " Detector: " << det_name << " Spigot: "<< spigot<<"/"<<eid.spigot() << " Fiber: " << fiber+1<<"/"<<eid.fiberIndex() << " Fiber Channel: "<< fiber_chan <<"/"<<eid.fiberChanId()<< " Crate: " << crate<<"/"<<eid.readoutVMECrateId() << " Global Dcc: " << G_Dcc <<"/"<<eid.dccid() << " HTR Slot: " << H_slot <<"/ " <<eid.htrSlot()<< " Top/Bottom: " << TB<<"/"<< eid.htrTopBottom() << " RBX: " << (RBX_7*128+RBX) << std::endl; 00157 00158 } 00159 }else { std::cout<<" Digi ID: " <<dd << " +NO HEADER+ " << " RBX: " << (RBX_7*128+RBX) << std::endl; 00160 } 00161 } 00162 }
void HcalCableMapper::record | ( | const DigiCollection & | digis | ) | [inline, private] |
Definition at line 43 of file HcalCableMapper.cc.
References fullHistory_, i, and IdSet.
Referenced by analyze().
00043 { 00044 00045 for (typename DigiCollection::const_iterator digi=digis.begin(); digi!=digis.end(); digi++) { 00046 00047 SampleSet q; 00048 for (int i=0; i<digi->size(); i++) 00049 q.push_back(digi->sample(i)); 00050 00051 if (fullHistory_.find(digi->id())==fullHistory_.end()) fullHistory_.insert(std::pair<HcalDetId,std::vector<SampleSet> >(digi->id(),std::vector<SampleSet>())); 00052 if (IdSet.find(digi->id())==IdSet.end()) IdSet.insert(std::pair<HcalDetId,HcalElectronicsId>(digi->id(),HcalElectronicsId())); 00053 fullHistory_[digi->id()].push_back(q); 00054 IdSet[digi->id()]=digi->elecId(); 00055 } 00056 }
std::map<HcalDetId,std::vector<SampleSet> > HcalCableMapper::fullHistory_ [private] |
edm::InputTag HcalCableMapper::hbheLabel_ [private] |
edm::InputTag HcalCableMapper::hfLabel_ [private] |
edm::InputTag HcalCableMapper::hoLabel_ [private] |
IdMap HcalCableMapper::IdSet [private] |