00001 00002 #include "Calibration/HcalIsolatedTrackReco/interface/SubdetFEDSelector.h" 00003 00004 SubdetFEDSelector::SubdetFEDSelector(const edm::ParameterSet& iConfig) 00005 { 00006 getEcal_=iConfig.getParameter<bool>("getECAL"); 00007 getStrip_=iConfig.getParameter<bool>("getSiStrip"); 00008 getPixel_=iConfig.getParameter<bool>("getSiPixel"); 00009 getHcal_=iConfig.getParameter<bool>("getHCAL"); 00010 getMuon_=iConfig.getParameter<bool>("getMuon"); 00011 getTrigger_=iConfig.getParameter<bool>("getTrigger"); 00012 00013 rawInLabel_=iConfig.getParameter<edm::InputTag>("rawInputLabel"); 00014 00015 produces<FEDRawDataCollection>(); 00016 00017 } 00018 00019 SubdetFEDSelector::~SubdetFEDSelector() 00020 { 00021 } 00022 00023 void 00024 SubdetFEDSelector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) 00025 { 00026 00027 std::auto_ptr<FEDRawDataCollection> producedData(new FEDRawDataCollection); 00028 00029 edm::Handle<FEDRawDataCollection> rawIn; 00030 iEvent.getByLabel(rawInLabel_,rawIn); 00031 00032 std::vector<int> selFEDs; 00033 00034 if (getEcal_) 00035 { 00036 for (int i=FEDNumbering::MINECALFEDID; i<=FEDNumbering::MAXECALFEDID; i++) 00037 { 00038 selFEDs.push_back(i); 00039 } 00040 for (int i=FEDNumbering::MINPreShowerFEDID; i<=FEDNumbering::MAXPreShowerFEDID; i++) 00041 { 00042 selFEDs.push_back(i); 00043 } 00044 } 00045 00046 if (getMuon_) 00047 { 00048 for (int i=FEDNumbering::MINCSCFEDID; i<=FEDNumbering::MAXCSCFEDID; i++) 00049 { 00050 selFEDs.push_back(i); 00051 } 00052 for (int i=FEDNumbering::MINCSCTFFEDID; i<=FEDNumbering::MAXCSCTFFEDID; i++) 00053 { 00054 selFEDs.push_back(i); 00055 } 00056 for (int i=FEDNumbering::MINDTFEDID; i<=FEDNumbering::MAXDTFEDID; i++) 00057 { 00058 selFEDs.push_back(i); 00059 } 00060 for (int i=FEDNumbering::MINDTTFFEDID; i<=FEDNumbering::MAXDTTFFEDID; i++) 00061 { 00062 selFEDs.push_back(i); 00063 } 00064 for (int i=FEDNumbering::MINRPCFEDID; i<=FEDNumbering::MAXRPCFEDID; i++) 00065 { 00066 selFEDs.push_back(i); 00067 } 00068 for (int i=FEDNumbering::MINCSCDDUFEDID; i<=FEDNumbering::MAXCSCDDUFEDID; i++) 00069 { 00070 selFEDs.push_back(i); 00071 } 00072 for (int i=FEDNumbering::MINCSCContingencyFEDID; i<=FEDNumbering::MAXCSCContingencyFEDID; i++) 00073 { 00074 selFEDs.push_back(i); 00075 } 00076 for (int i=FEDNumbering::MINCSCTFSPFEDID; i<=FEDNumbering::MAXCSCTFSPFEDID; i++) 00077 { 00078 selFEDs.push_back(i); 00079 } 00080 } 00081 00082 00083 if (getHcal_) 00084 { 00085 for (int i=FEDNumbering::MINHCALFEDID; i<=FEDNumbering::MAXHCALFEDID; i++) 00086 { 00087 selFEDs.push_back(i); 00088 } 00089 } 00090 00091 00092 if (getStrip_) 00093 { 00094 for (int i=FEDNumbering::MINSiStripFEDID; i<=FEDNumbering::MAXSiStripFEDID; i++) 00095 { 00096 selFEDs.push_back(i); 00097 } 00098 } 00099 00100 00101 if (getPixel_) 00102 { 00103 for (int i=FEDNumbering::MINSiPixelFEDID; i<=FEDNumbering::MAXSiPixelFEDID; i++) 00104 { 00105 selFEDs.push_back(i); 00106 } 00107 } 00108 00109 if (getTrigger_) 00110 { 00111 for (int i=FEDNumbering::MINTriggerEGTPFEDID; i<=FEDNumbering::MAXTriggerEGTPFEDID; i++) 00112 { 00113 selFEDs.push_back(i); 00114 } 00115 for (int i=FEDNumbering::MINTriggerGTPFEDID; i<=FEDNumbering::MAXTriggerGTPFEDID; i++) 00116 { 00117 selFEDs.push_back(i); 00118 } 00119 for (int i=FEDNumbering::MINTriggerLTCFEDID; i<=FEDNumbering::MAXTriggerLTCFEDID; i++) 00120 { 00121 selFEDs.push_back(i); 00122 } 00123 for (int i=FEDNumbering::MINTriggerLTCmtccFEDID; i<=FEDNumbering::MAXTriggerLTCmtccFEDID; i++) 00124 { 00125 selFEDs.push_back(i); 00126 } 00127 for (int i=FEDNumbering::MINTriggerGCTFEDID; i<=FEDNumbering::MAXTriggerGCTFEDID; i++) 00128 { 00129 selFEDs.push_back(i); 00130 } 00131 00132 for (int i=FEDNumbering::MINTriggerLTCTriggerFEDID; i<=FEDNumbering::MAXTriggerLTCTriggerFEDID; i++) 00133 { 00134 selFEDs.push_back(i); 00135 } 00136 00137 for (int i=FEDNumbering::MINTriggerLTCHCALFEDID; i<=FEDNumbering::MAXTriggerLTCHCALFEDID; i++) 00138 { 00139 selFEDs.push_back(i); 00140 } 00141 00142 for (int i=FEDNumbering::MINTriggerLTCSiStripFEDID; i<=FEDNumbering::MAXTriggerLTCSiStripFEDID; i++) 00143 { 00144 selFEDs.push_back(i); 00145 } 00146 00147 for (int i=FEDNumbering::MINTriggerLTCECALFEDID; i<=FEDNumbering::MAXTriggerLTCECALFEDID; i++) 00148 { 00149 selFEDs.push_back(i); 00150 } 00151 00152 for (int i=FEDNumbering::MINTriggerLTCTotemCastorFEDID; i<=FEDNumbering::MAXTriggerLTCTotemCastorFEDID; i++) 00153 { 00154 selFEDs.push_back(i); 00155 } 00156 for (int i=FEDNumbering::MINTriggerLTCRPCFEDID; i<=FEDNumbering::MAXTriggerLTCRPCFEDID; i++) 00157 { 00158 selFEDs.push_back(i); 00159 } 00160 00161 for (int i=FEDNumbering::MINTriggerLTCCSCFEDID; i<=FEDNumbering::MAXTriggerLTCCSCFEDID; i++) 00162 { 00163 selFEDs.push_back(i); 00164 } 00165 for (int i=FEDNumbering::MINTriggerLTCDTFEDID; i<=FEDNumbering::MAXTriggerLTCDTFEDID; i++) 00166 { 00167 selFEDs.push_back(i); 00168 } 00169 for (int i=FEDNumbering::MINTriggerLTCSiPixelFEDID; i<=FEDNumbering::MAXTriggerLTCSiPixelFEDID; i++) 00170 { 00171 selFEDs.push_back(i); 00172 } 00173 00174 } 00175 00176 for (int i=FEDNumbering::MINDAQeFEDFEDID; i<=FEDNumbering::MAXDAQeFEDFEDID; i++) 00177 { 00178 selFEDs.push_back(i); 00179 } 00180 00181 00182 // Copying: 00183 const FEDRawDataCollection *rdc=rawIn.product(); 00184 00185 // if ( ( rawData[i].provenance()->processName() != e.processHistory().rbegin()->processName() ) ) 00186 // continue ; // skip all raw collections not produced by the current process 00187 00188 for ( int j=0; j< FEDNumbering::MAXFEDID; ++j ) 00189 { 00190 bool rightFED=false; 00191 for (uint32_t k=0; k<selFEDs.size(); k++) 00192 { 00193 if (j==selFEDs[k]) 00194 { 00195 rightFED=true; 00196 } 00197 } 00198 if (!rightFED) continue; 00199 const FEDRawData & fedData = rdc->FEDData(j); 00200 size_t size=fedData.size(); 00201 00202 if ( size > 0 ) 00203 { 00204 // this fed has data -- lets copy it 00205 FEDRawData & fedDataProd = producedData->FEDData(j); 00206 if ( fedDataProd.size() != 0 ) { 00207 // std::cout << " More than one FEDRawDataCollection with data in FED "; 00208 // std::cout << j << " Skipping the 2nd\n"; 00209 continue; 00210 } 00211 fedDataProd.resize(size); 00212 unsigned char *dataProd=fedDataProd.data(); 00213 const unsigned char *data=fedData.data(); 00214 for ( unsigned int k=0; k<size; ++k ) { 00215 dataProd[k]=data[k]; 00216 } 00217 } 00218 } 00219 00220 iEvent.put(producedData); 00221 00222 } 00223 00224 00225 // ------------ method called once each job just before starting event loop ------------ 00226 void SubdetFEDSelector::beginJob() { 00227 } 00228 00229 // ------------ method called once each job just after ending the event loop ------------ 00230 void SubdetFEDSelector::endJob() { 00231 }