00001
00010 #include "Validation/GlobalDigis/interface/GlobalDigisProducer.h"
00011
00012 GlobalDigisProducer::GlobalDigisProducer(const edm::ParameterSet& iPSet) :
00013 fName(""), verbosity(0), frequency(0), label(""), getAllProvenances(false),
00014 printProvenanceInfo(false), theCSCStripPedestalSum(0),
00015 theCSCStripPedestalCount(0), count(0)
00016 {
00017 std::string MsgLoggerCat = "GlobalDigisProducer_GlobalDigisProducer";
00018
00019
00020 fName = iPSet.getUntrackedParameter<std::string>("Name");
00021 verbosity = iPSet.getUntrackedParameter<int>("Verbosity");
00022 frequency = iPSet.getUntrackedParameter<int>("Frequency");
00023 label = iPSet.getParameter<std::string>("Label");
00024 edm::ParameterSet m_Prov =
00025 iPSet.getParameter<edm::ParameterSet>("ProvenanceLookup");
00026 getAllProvenances =
00027 m_Prov.getUntrackedParameter<bool>("GetAllProvenances");
00028 printProvenanceInfo =
00029 m_Prov.getUntrackedParameter<bool>("PrintProvenanceInfo");
00030
00031
00032 ECalEBSrc_ = iPSet.getParameter<edm::InputTag>("ECalEBSrc");
00033 ECalEESrc_ = iPSet.getParameter<edm::InputTag>("ECalEESrc");
00034 ECalESSrc_ = iPSet.getParameter<edm::InputTag>("ECalESSrc");
00035 HCalSrc_ = iPSet.getParameter<edm::InputTag>("HCalSrc");
00036 HCalDigi_ = iPSet.getParameter<edm::InputTag>("HCalDigi");
00037 SiStripSrc_ = iPSet.getParameter<edm::InputTag>("SiStripSrc");
00038 SiPxlSrc_ = iPSet.getParameter<edm::InputTag>("SiPxlSrc");
00039 MuDTSrc_ = iPSet.getParameter<edm::InputTag>("MuDTSrc");
00040 MuCSCStripSrc_ = iPSet.getParameter<edm::InputTag>("MuCSCStripSrc");
00041 MuCSCWireSrc_ = iPSet.getParameter<edm::InputTag>("MuCSCWireSrc");
00042
00043
00044
00045 verbosity %= 10;
00046
00047
00048 produces<PGlobalDigi>(label);
00049
00050
00051 if (verbosity >= 0) {
00052 edm::LogInfo(MsgLoggerCat)
00053 << "\n===============================\n"
00054 << "Initialized as EDProducer with parameter values:\n"
00055 << " Name = " << fName << "\n"
00056 << " Verbosity = " << verbosity << "\n"
00057 << " Frequency = " << frequency << "\n"
00058 << " Label = " << label << "\n"
00059 << " GetProv = " << getAllProvenances << "\n"
00060 << " PrintProv = " << printProvenanceInfo << "\n"
00061 << " ECalEBSrc = " << ECalEBSrc_.label()
00062 << ":" << ECalEBSrc_.instance() << "\n"
00063 << " ECalEESrc = " << ECalEESrc_.label()
00064 << ":" << ECalEESrc_.instance() << "\n"
00065 << " ECalESSrc = " << ECalESSrc_.label()
00066 << ":" << ECalESSrc_.instance() << "\n"
00067 << " HCalSrc = " << HCalSrc_.label()
00068 << ":" << HCalSrc_.instance() << "\n"
00069 << " HCalDigi = " << HCalDigi_.label()
00070 << ":" << HCalDigi_.instance() << "\n"
00071 << " SiStripSrc = " << SiStripSrc_.label()
00072 << ":" << SiStripSrc_.instance() << "\n"
00073 << " SiPixelSrc = " << SiPxlSrc_.label()
00074 << ":" << SiPxlSrc_.instance() << "\n"
00075 << " MuDTSrc = " << MuDTSrc_.label()
00076 << ":" << MuDTSrc_.instance() << "\n"
00077 << " MuCSCStripSrc = " << MuCSCStripSrc_.label()
00078 << ":" << MuCSCStripSrc_.instance() << "\n"
00079 << " MuCSCWireSrc = " << MuCSCWireSrc_.label()
00080 << ":" << MuCSCWireSrc_.instance() << "\n"
00081 << "===============================\n";
00082 }
00083
00084
00085
00086 ECalgainConv_[0] = 0.;
00087 ECalgainConv_[1] = 1.;
00088 ECalgainConv_[2] = 2.;
00089 ECalgainConv_[3] = 12.;
00090 ECalbarrelADCtoGeV_ = 0.035;
00091 ECalendcapADCtoGeV_ = 0.06;
00092
00093 }
00094
00095 GlobalDigisProducer::~GlobalDigisProducer()
00096 {
00097 }
00098
00099 void GlobalDigisProducer::beginJob( void )
00100 {
00101 std::string MsgLoggerCat = "GlobalDigisProducer_beginJob";
00102
00103
00104
00105
00106
00107
00108 EcalMGPAGainRatio * defaultRatios = new EcalMGPAGainRatio();
00109
00110 ECalgainConv_[0] = 0.;
00111 ECalgainConv_[1] = 1.;
00112 ECalgainConv_[2] = defaultRatios->gain12Over6() ;
00113 ECalgainConv_[3] = ECalgainConv_[2]*(defaultRatios->gain6Over1()) ;
00114
00115 delete defaultRatios;
00116
00117
00118
00119
00120 if (verbosity >= 0) {
00121 edm::LogInfo(MsgLoggerCat)
00122 << "Modified Calorimeter gain constants: g0 = " << ECalgainConv_[0]
00123 << ", g1 = " << ECalgainConv_[1] << ", g2 = " << ECalgainConv_[2]
00124 << ", g3 = " << ECalgainConv_[3];
00125
00126
00127
00128 }
00129
00130
00131 clear();
00132 return;
00133 }
00134
00135 void GlobalDigisProducer::endJob()
00136 {
00137 std::string MsgLoggerCat = "GlobalDigisProducer_endJob";
00138 if (verbosity >= 0)
00139 edm::LogInfo(MsgLoggerCat)
00140 << "Terminating having processed " << count << " events.";
00141 return;
00142 }
00143
00144 void GlobalDigisProducer::produce(edm::Event& iEvent,
00145 const edm::EventSetup& iSetup)
00146 {
00147 std::string MsgLoggerCat = "GlobalDigisProducer_produce";
00148
00149
00150 ++count;
00151
00152
00153
00154
00155 edm::ESHandle<EcalADCToGeVConstant> pAgc;
00156 iSetup.get<EcalADCToGeVConstantRcd>().get(pAgc);
00157 const EcalADCToGeVConstant* agc = pAgc.product();
00158 ECalbarrelADCtoGeV_ = agc->getEBValue();
00159 ECalendcapADCtoGeV_ = agc->getEEValue();
00160 if (verbosity >= 0) {
00161 edm::LogInfo(MsgLoggerCat)
00162 << "Modified Calorimeter ADCtoGeV constants: barrel = "
00163 << ECalbarrelADCtoGeV_ << ", endcap = " << ECalendcapADCtoGeV_;
00164 }
00165
00166
00167
00168 int nrun = iEvent.id().run();
00169 int nevt = iEvent.id().event();
00170
00171 if (verbosity > 0) {
00172 edm::LogInfo(MsgLoggerCat)
00173 << "Processing run " << nrun << ", event " << nevt
00174 << " (" << count << " events total)";
00175 } else if (verbosity == 0) {
00176 if (nevt%frequency == 0 || nevt == 1) {
00177 edm::LogInfo(MsgLoggerCat)
00178 << "Processing run " << nrun << ", event " << nevt
00179 << " (" << count << " events total)";
00180 }
00181 }
00182
00183
00184 clear();
00185
00186
00187 if (getAllProvenances) {
00188
00189 std::vector<const edm::Provenance*> AllProv;
00190 iEvent.getAllProvenance(AllProv);
00191
00192 if (verbosity >= 0)
00193 edm::LogInfo(MsgLoggerCat)
00194 << "Number of Provenances = " << AllProv.size();
00195
00196 if (printProvenanceInfo && (verbosity >= 0)) {
00197 TString eventout("\nProvenance info:\n");
00198
00199 for (unsigned int i = 0; i < AllProv.size(); ++i) {
00200 eventout += "\n ******************************";
00201 eventout += "\n Module : ";
00202
00203 eventout += AllProv[i]->moduleLabel();
00204 eventout += "\n ProductID : ";
00205
00206 eventout += AllProv[i]->productID().id();
00207 eventout += "\n ClassName : ";
00208
00209 eventout += AllProv[i]->className();
00210 eventout += "\n InstanceName : ";
00211
00212 eventout += AllProv[i]->productInstanceName();
00213 eventout += "\n BranchName : ";
00214
00215 eventout += AllProv[i]->branchName();
00216 }
00217 eventout += "\n ******************************\n";
00218 edm::LogInfo(MsgLoggerCat) << eventout << "\n";
00219 printProvenanceInfo = false;
00220 }
00221 getAllProvenances = false;
00222 }
00223
00224
00225
00226 fillECal(iEvent, iSetup);
00227
00228 fillHCal(iEvent, iSetup);
00229
00230 fillTrk(iEvent, iSetup);
00231
00232 fillMuon(iEvent, iSetup);
00233
00234 if (verbosity > 0)
00235 edm::LogInfo (MsgLoggerCat)
00236 << "Done gathering data from event.";
00237
00238
00239 std::auto_ptr<PGlobalDigi> pOut(new PGlobalDigi);
00240
00241 if (verbosity > 2)
00242 edm::LogInfo (MsgLoggerCat)
00243 << "Saving event contents:";
00244
00245
00246
00247 storeECal(*pOut);
00248
00249 storeHCal(*pOut);
00250
00251 storeTrk(*pOut);
00252
00253 storeMuon(*pOut);
00254
00255
00256 iEvent.put(pOut,label);
00257
00258 return;
00259 }
00260
00261 void GlobalDigisProducer::fillECal(edm::Event& iEvent,
00262 const edm::EventSetup& iSetup)
00263 {
00264 std::string MsgLoggerCat = "GlobalDigisProducer_fillECal";
00265
00266 TString eventout;
00267 if (verbosity > 0)
00268 eventout = "\nGathering info:";
00269
00270
00271
00272 edm::Handle<CrossingFrame<PCaloHit> > crossingFrame;
00273
00274
00275
00276
00277
00278
00279
00281
00283 bool isBarrel = true;
00284 edm::Handle<EBDigiCollection> EcalDigiEB;
00285 iEvent.getByLabel(ECalEBSrc_, EcalDigiEB);
00286 if (!EcalDigiEB.isValid()) {
00287 edm::LogWarning(MsgLoggerCat)
00288 << "Unable to find EcalDigiEB in event!";
00289 return;
00290 }
00291 if ( EcalDigiEB->size() == 0) isBarrel = false;
00292
00293 if (isBarrel) {
00294
00295
00296 const std::string barrelHitsName("EcalHitsEB");
00297 iEvent.getByLabel("mix",barrelHitsName,crossingFrame);
00298 if (!crossingFrame.isValid()) {
00299 edm::LogWarning(MsgLoggerCat)
00300 << "Unable to find cal barrel crossingFrame in event!";
00301 return;
00302 }
00303
00304
00305
00306 std::auto_ptr<MixCollection<PCaloHit> >
00307 barrelHits(new MixCollection<PCaloHit>(crossingFrame.product()));
00308
00309
00310 MapType ebSimMap;
00311 for (MixCollection<PCaloHit>::MixItr hitItr
00312 = barrelHits->begin();
00313 hitItr != barrelHits->end();
00314 ++hitItr) {
00315
00316 EBDetId ebid = EBDetId(hitItr->id());
00317
00318 uint32_t crystid = ebid.rawId();
00319 ebSimMap[crystid] += hitItr->energy();
00320 }
00321
00322
00323 const EBDigiCollection *barrelDigi = EcalDigiEB.product();
00324
00325 std::vector<double> ebAnalogSignal;
00326 std::vector<double> ebADCCounts;
00327 std::vector<double> ebADCGains;
00328 ebAnalogSignal.reserve(EBDataFrame::MAXSAMPLES);
00329 ebADCCounts.reserve(EBDataFrame::MAXSAMPLES);
00330 ebADCGains.reserve(EBDataFrame::MAXSAMPLES);
00331
00332 int i = 0;
00333 for (unsigned int digis=0; digis<EcalDigiEB->size(); ++digis)
00334 {
00335
00336
00337
00338
00339
00340 ++i;
00341
00342 EBDataFrame ebdf = (*barrelDigi)[digis];
00343 int nrSamples = ebdf.size();
00344
00345 EBDetId ebid = ebdf.id () ;
00346
00347
00348 double Emax = 0;
00349 int Pmax = 0;
00350 double pedestalPreSample = 0.;
00351 double pedestalPreSampleAnalog = 0.;
00352
00353 for (int sample = 0 ; sample < nrSamples; ++sample) {
00354
00355 ebAnalogSignal[sample] = 0.;
00356 ebADCCounts[sample] = 0.;
00357 ebADCGains[sample] = -1.;
00358 }
00359
00360
00361 for (int sample = 0 ; sample < nrSamples; ++sample) {
00362
00363
00364 EcalMGPASample thisSample = ebdf[sample];
00365 ebADCCounts[sample] = (thisSample.adc());
00366 ebADCGains[sample] = (thisSample.gainId());
00367 ebAnalogSignal[sample] =
00368 (ebADCCounts[sample] * ECalgainConv_[(int)ebADCGains[sample]]
00369 * ECalbarrelADCtoGeV_);
00370 if (Emax < ebAnalogSignal[sample]) {
00371 Emax = ebAnalogSignal[sample];
00372 Pmax = sample;
00373 }
00374 if ( sample < 3 ) {
00375 pedestalPreSample += ebADCCounts[sample] ;
00376 pedestalPreSampleAnalog +=
00377 ebADCCounts[sample] * ECalgainConv_[(int)ebADCGains[sample]]
00378 * ECalbarrelADCtoGeV_ ;
00379 }
00380
00381 }
00382 pedestalPreSample /= 3. ;
00383 pedestalPreSampleAnalog /= 3. ;
00384
00385
00386 double Erec = Emax - pedestalPreSampleAnalog
00387 * ECalgainConv_[(int)ebADCGains[Pmax]];
00388
00389
00390 EBCalAEE.push_back(Erec);
00391 EBCalSHE.push_back(ebSimMap[ebid.rawId()]);
00392 EBCalmaxPos.push_back(Pmax);
00393 }
00394
00395 if (verbosity > 1) {
00396 eventout += "\n Number of EBDigis collected:.............. ";
00397 eventout += i;
00398 }
00399 }
00400
00402
00404 bool isEndCap = true;
00405 edm::Handle<EEDigiCollection> EcalDigiEE;
00406 iEvent.getByLabel(ECalEESrc_, EcalDigiEE);
00407 if (!EcalDigiEE.isValid()) {
00408 edm::LogWarning(MsgLoggerCat)
00409 << "Unable to find EcalDigiEE in event!";
00410 return;
00411 }
00412 if (EcalDigiEE->size() == 0) isEndCap = false;
00413
00414 if (isEndCap) {
00415
00416
00417 const std::string endcapHitsName("EcalHitsEE");
00418 iEvent.getByLabel("mix",endcapHitsName,crossingFrame);
00419 if (!crossingFrame.isValid()) {
00420 edm::LogWarning(MsgLoggerCat)
00421 << "Unable to find cal endcap crossingFrame in event!";
00422 return;
00423 }
00424
00425
00426
00427 std::auto_ptr<MixCollection<PCaloHit> >
00428 endcapHits(new MixCollection<PCaloHit>(crossingFrame.product()));
00429
00430
00431 MapType eeSimMap;
00432 for (MixCollection<PCaloHit>::MixItr hitItr
00433 = endcapHits->begin();
00434 hitItr != endcapHits->end();
00435 ++hitItr) {
00436
00437 EEDetId eeid = EEDetId(hitItr->id());
00438
00439 uint32_t crystid = eeid.rawId();
00440 eeSimMap[crystid] += hitItr->energy();
00441 }
00442
00443
00444 const EEDigiCollection *endcapDigi = EcalDigiEE.product();
00445
00446 std::vector<double> eeAnalogSignal;
00447 std::vector<double> eeADCCounts;
00448 std::vector<double> eeADCGains;
00449 eeAnalogSignal.reserve(EEDataFrame::MAXSAMPLES);
00450 eeADCCounts.reserve(EEDataFrame::MAXSAMPLES);
00451 eeADCGains.reserve(EEDataFrame::MAXSAMPLES);
00452
00453 int i = 0;
00454
00455
00456
00457
00458 for (unsigned int digis=0; digis<EcalDigiEE->size(); ++digis){
00459
00460 ++i;
00461
00462 EEDataFrame eedf = (*endcapDigi)[digis];
00463 int nrSamples = eedf.size();
00464
00465 EEDetId eeid = eedf.id () ;
00466
00467
00468 double Emax = 0;
00469 int Pmax = 0;
00470 double pedestalPreSample = 0.;
00471 double pedestalPreSampleAnalog = 0.;
00472
00473 for (int sample = 0 ; sample < nrSamples; ++sample) {
00474
00475 eeAnalogSignal[sample] = 0.;
00476 eeADCCounts[sample] = 0.;
00477 eeADCGains[sample] = -1.;
00478 }
00479
00480
00481 for (int sample = 0 ; sample < nrSamples; ++sample) {
00482
00483
00484 EcalMGPASample thisSample = eedf[sample];
00485
00486 eeADCCounts[sample] = (thisSample.adc());
00487 eeADCGains[sample] = (thisSample.gainId());
00488 eeAnalogSignal[sample] =
00489 (eeADCCounts[sample] * ECalgainConv_[(int)eeADCGains[sample]]
00490 * ECalbarrelADCtoGeV_);
00491 if (Emax < eeAnalogSignal[sample]) {
00492 Emax = eeAnalogSignal[sample];
00493 Pmax = sample;
00494 }
00495 if ( sample < 3 ) {
00496 pedestalPreSample += eeADCCounts[sample] ;
00497 pedestalPreSampleAnalog +=
00498 eeADCCounts[sample] * ECalgainConv_[(int)eeADCGains[sample]]
00499 * ECalbarrelADCtoGeV_ ;
00500 }
00501
00502 }
00503 pedestalPreSample /= 3. ;
00504 pedestalPreSampleAnalog /= 3. ;
00505
00506
00507 double Erec = Emax - pedestalPreSampleAnalog
00508 * ECalgainConv_[(int)eeADCGains[Pmax]];
00509
00510
00511 EECalAEE.push_back(Erec);
00512 EECalSHE.push_back(eeSimMap[eeid.rawId()]);
00513 EECalmaxPos.push_back(Pmax);
00514 }
00515
00516 if (verbosity > 1) {
00517 eventout += "\n Number of EEDigis collected:.............. ";
00518 eventout += i;
00519 }
00520 }
00521
00523
00525 bool isPreshower = true;
00526 edm::Handle<ESDigiCollection> EcalDigiES;
00527 iEvent.getByLabel(ECalESSrc_, EcalDigiES);
00528 if (!EcalDigiES.isValid()) {
00529 edm::LogWarning(MsgLoggerCat)
00530 << "Unable to find EcalDigiES in event!";
00531 return;
00532 }
00533 if (EcalDigiES->size() == 0) isPreshower = false;
00534
00535 if (isPreshower) {
00536
00537
00538 const std::string preshowerHitsName("EcalHitsES");
00539 iEvent.getByLabel("mix",preshowerHitsName,crossingFrame);
00540 if (!crossingFrame.isValid()) {
00541 edm::LogWarning(MsgLoggerCat)
00542 << "Unable to find cal preshower crossingFrame in event!";
00543 return;
00544 }
00545
00546
00547
00548 std::auto_ptr<MixCollection<PCaloHit> >
00549 preshowerHits(new MixCollection<PCaloHit>(crossingFrame.product()));
00550
00551
00552 MapType esSimMap;
00553 for (MixCollection<PCaloHit>::MixItr hitItr
00554 = preshowerHits->begin();
00555 hitItr != preshowerHits->end();
00556 ++hitItr) {
00557
00558 ESDetId esid = ESDetId(hitItr->id());
00559
00560 uint32_t crystid = esid.rawId();
00561 esSimMap[crystid] += hitItr->energy();
00562 }
00563
00564
00565 const ESDigiCollection *preshowerDigi = EcalDigiES.product();
00566
00567 std::vector<double> esADCCounts;
00568 esADCCounts.reserve(ESDataFrame::MAXSAMPLES);
00569
00570 int i = 0;
00571 for (unsigned int digis=0; digis<EcalDigiES->size(); ++digis) {
00572
00573
00574
00575
00576
00577 ++i;
00578
00579
00580 ESDataFrame esdf = (*preshowerDigi)[digis];
00581 int nrSamples = esdf.size();
00582
00583 ESDetId esid = esdf.id () ;
00584
00585
00586 for (int sample = 0 ; sample < nrSamples; ++sample) {
00587
00588 esADCCounts[sample] = 0.;
00589 }
00590
00591
00592 for (int sample = 0 ; sample < nrSamples; ++sample) {
00593
00594 ESSample thisSample = esdf[sample];
00595
00596 esADCCounts[sample] = (thisSample.adc());
00597 }
00598
00599 ESCalADC0.push_back(esADCCounts[0]);
00600 ESCalADC1.push_back(esADCCounts[1]);
00601 ESCalADC2.push_back(esADCCounts[2]);
00602 ESCalSHE.push_back(esSimMap[esid.rawId()]);
00603 }
00604
00605 if (verbosity > 1) {
00606 eventout += "\n Number of ESDigis collected:.............. ";
00607 eventout += i;
00608 }
00609 }
00610
00611 if (verbosity > 0)
00612 edm::LogInfo(MsgLoggerCat) << eventout << "\n";
00613
00614 return;
00615 }
00616
00617 void GlobalDigisProducer::storeECal(PGlobalDigi& product)
00618 {
00619 std::string MsgLoggerCat = "GlobalDigisProducer_storeECal";
00620
00621 if (verbosity > 2) {
00622 TString eventout("\n nEBDigis = ");
00623 eventout += EBCalmaxPos.size();
00624 for (unsigned int i = 0; i < EBCalmaxPos.size(); ++i) {
00625 eventout += "\n (maxPos, AEE, SHE) = (";
00626 eventout += EBCalmaxPos[i];
00627 eventout += ", ";
00628 eventout += EBCalAEE[i];
00629 eventout += ", ";
00630 eventout += EBCalSHE[i];
00631 eventout += ")";
00632 }
00633 eventout += "\n nEEDigis = ";
00634 eventout += EECalmaxPos.size();
00635 for (unsigned int i = 0; i < EECalmaxPos.size(); ++i) {
00636 eventout += "\n (maxPos, AEE, SHE) = (";
00637 eventout += EECalmaxPos[i];
00638 eventout += ", ";
00639 eventout += EECalAEE[i];
00640 eventout += ", ";
00641 eventout += EECalSHE[i];
00642 eventout += ")";
00643 }
00644 eventout += "\n nESDigis = ";
00645 eventout += ESCalADC0.size();
00646 for (unsigned int i = 0; i < ESCalADC0.size(); ++i) {
00647 eventout += "\n (ADC0, ADC1, ADC2, SHE) = (";
00648 eventout += ESCalADC0[i];
00649 eventout += ", ";
00650 eventout += ESCalADC1[i];
00651 eventout += ", ";
00652 eventout += ESCalADC2[i];
00653 eventout += ", ";
00654 eventout += ESCalSHE[i];
00655 eventout += ")";
00656 }
00657 edm::LogInfo(MsgLoggerCat) << eventout << "\n";
00658 }
00659
00660 product.putEBCalDigis(EBCalmaxPos,EBCalAEE,EBCalSHE);
00661 product.putEECalDigis(EECalmaxPos,EECalAEE,EECalSHE);
00662 product.putESCalDigis(ESCalADC0,ESCalADC1,ESCalADC2,ESCalSHE);
00663
00664 return;
00665 }
00666
00667 void GlobalDigisProducer::fillHCal(edm::Event& iEvent,
00668 const edm::EventSetup& iSetup)
00669 {
00670 std::string MsgLoggerCat = "GlobalDigisProducer_fillHCal";
00671
00672 TString eventout;
00673 if (verbosity > 0)
00674 eventout = "\nGathering info:";
00675
00676
00677 edm::ESHandle<HcalDbService> HCalconditions;
00678 iSetup.get<HcalDbRecord>().get(HCalconditions);
00679 if (!HCalconditions.isValid()) {
00680 edm::LogWarning(MsgLoggerCat)
00681 << "Unable to find HCalconditions in event!";
00682 return;
00683 }
00684 const HcalQIEShape *shape = HCalconditions->getHcalShape();
00685
00686 CaloSamples tool;
00687
00689
00691 edm::Handle<edm::PCaloHitContainer> hcalHits;
00692 iEvent.getByLabel(HCalSrc_,hcalHits);
00693 if (!hcalHits.isValid()) {
00694 edm::LogWarning(MsgLoggerCat)
00695 << "Unable to find hcalHits in event!";
00696 return;
00697 }
00698 const edm::PCaloHitContainer *simhitResult = hcalHits.product();
00699
00700 MapType fHBEnergySimHits;
00701 MapType fHEEnergySimHits;
00702 MapType fHOEnergySimHits;
00703 MapType fHFEnergySimHits;
00704 for (std::vector<PCaloHit>::const_iterator simhits = simhitResult->begin();
00705 simhits != simhitResult->end();
00706 ++simhits) {
00707
00708 HcalDetId detId(simhits->id());
00709 uint32_t cellid = detId.rawId();
00710
00711 if (detId.subdet() == sdHcalBrl){
00712 fHBEnergySimHits[cellid] += simhits->energy();
00713 }
00714 if (detId.subdet() == sdHcalEC){
00715 fHEEnergySimHits[cellid] += simhits->energy();
00716 }
00717 if (detId.subdet() == sdHcalOut){
00718 fHOEnergySimHits[cellid] += simhits->energy();
00719 }
00720 if (detId.subdet() == sdHcalFwd){
00721 fHFEnergySimHits[cellid] += simhits->energy();
00722 }
00723 }
00724
00726
00728 edm::Handle<edm::SortedCollection<HBHEDataFrame> > hbhe;
00729 iEvent.getByLabel(HCalDigi_,hbhe);
00730 if (!hbhe.isValid()) {
00731 edm::LogWarning(MsgLoggerCat)
00732 << "Unable to find HBHEDataFrame in event!";
00733 return;
00734 }
00735 edm::SortedCollection<HBHEDataFrame>::const_iterator ihbhe;
00736
00737 int iHB = 0;
00738 int iHE = 0;
00739 for (ihbhe = hbhe->begin(); ihbhe != hbhe->end(); ++ihbhe) {
00740 HcalDetId cell(ihbhe->id());
00741
00742 if ((cell.subdet() == sdHcalBrl) || (cell.subdet() == sdHcalEC)) {
00743
00744
00745 const HcalCalibrations& calibrations =
00746 HCalconditions->getHcalCalibrations(cell);
00747 const HcalQIECoder *channelCoder = HCalconditions->getHcalCoder(cell);
00748 HcalCoderDb coder(*channelCoder, *shape);
00749 coder.adc2fC(*ihbhe, tool);
00750
00751
00752 if (cell.subdet() == sdHcalBrl) {
00753
00754 ++iHB;
00755 float fDigiSum = 0.0;
00756 for (int ii = 0; ii < tool.size(); ++ii) {
00757
00758 int capid = (*ihbhe)[ii].capid();
00759 fDigiSum += (tool[ii] - calibrations.pedestal(capid));
00760 }
00761
00762 HBCalAEE.push_back(fDigiSum);
00763 HBCalSHE.push_back(fHBEnergySimHits[cell.rawId()]);
00764 }
00765
00766
00767 if (cell.subdet() == sdHcalEC) {
00768
00769 ++iHE;
00770 float fDigiSum = 0.0;
00771 for (int ii = 0; ii < tool.size(); ++ii) {
00772 int capid = (*ihbhe)[ii].capid();
00773 fDigiSum += (tool[ii]-calibrations.pedestal(capid));
00774 }
00775
00776 HECalAEE.push_back(fDigiSum);
00777 HECalSHE.push_back(fHEEnergySimHits[cell.rawId()]);
00778 }
00779 }
00780 }
00781
00782 if (verbosity > 1) {
00783 eventout += "\n Number of HBDigis collected:.............. ";
00784 eventout += iHB;
00785 }
00786
00787 if (verbosity > 1) {
00788 eventout += "\n Number of HEDigis collected:.............. ";
00789 eventout += iHE;
00790 }
00791
00793
00795 edm::Handle<edm::SortedCollection<HODataFrame> > ho;
00796 iEvent.getByLabel(HCalDigi_,ho);
00797 if (!ho.isValid()) {
00798 edm::LogWarning(MsgLoggerCat)
00799 << "Unable to find HODataFrame in event!";
00800 return;
00801 }
00802 edm::SortedCollection<HODataFrame>::const_iterator iho;
00803
00804 int iHO = 0;
00805 for (iho = ho->begin(); iho != ho->end(); ++iho) {
00806 HcalDetId cell(iho->id());
00807
00808 if (cell.subdet() == sdHcalOut) {
00809
00810
00811 const HcalCalibrations& calibrations =
00812 HCalconditions->getHcalCalibrations(cell);
00813 const HcalQIECoder *channelCoder = HCalconditions->getHcalCoder(cell);
00814 HcalCoderDb coder (*channelCoder, *shape);
00815 coder.adc2fC(*iho, tool);
00816
00817 ++iHO;
00818 float fDigiSum = 0.0;
00819 for (int ii = 0; ii < tool.size(); ++ii) {
00820
00821 int capid = (*iho)[ii].capid();
00822 fDigiSum += (tool[ii] - calibrations.pedestal(capid));
00823 }
00824
00825 HOCalAEE.push_back(fDigiSum);
00826 HOCalSHE.push_back(fHOEnergySimHits[cell.rawId()]);
00827 }
00828 }
00829
00830 if (verbosity > 1) {
00831 eventout += "\n Number of HODigis collected:.............. ";
00832 eventout += iHO;
00833 }
00834
00836
00838 edm::Handle<edm::SortedCollection<HFDataFrame> > hf;
00839 iEvent.getByLabel(HCalDigi_,hf);
00840 if (!hf.isValid()) {
00841 edm::LogWarning(MsgLoggerCat)
00842 << "Unable to find HFDataFrame in event!";
00843 return;
00844 }
00845 edm::SortedCollection<HFDataFrame>::const_iterator ihf;
00846
00847 int iHF = 0;
00848 for (ihf = hf->begin(); ihf != hf->end(); ++ihf) {
00849 HcalDetId cell(ihf->id());
00850
00851 if (cell.subdet() == sdHcalFwd) {
00852
00853
00854 const HcalCalibrations& calibrations =
00855 HCalconditions->getHcalCalibrations(cell);
00856 const HcalQIECoder *channelCoder = HCalconditions->getHcalCoder(cell);
00857 HcalCoderDb coder (*channelCoder, *shape);
00858 coder.adc2fC(*ihf, tool);
00859
00860 ++iHF;
00861 float fDigiSum = 0.0;
00862 for (int ii = 0; ii < tool.size(); ++ii) {
00863
00864 int capid = (*ihf)[ii].capid();
00865 fDigiSum += (tool[ii] - calibrations.pedestal(capid));
00866 }
00867
00868 HFCalAEE.push_back(fDigiSum);
00869 HFCalSHE.push_back(fHFEnergySimHits[cell.rawId()]);
00870 }
00871 }
00872
00873 if (verbosity > 1) {
00874 eventout += "\n Number of HFDigis collected:.............. ";
00875 eventout += iHF;
00876 }
00877
00878 if (verbosity > 0)
00879 edm::LogInfo(MsgLoggerCat) << eventout << "\n";
00880
00881 return;
00882 }
00883
00884 void GlobalDigisProducer::storeHCal(PGlobalDigi& product)
00885 {
00886 std::string MsgLoggerCat = "GlobalDigisProducer_storeHCal";
00887
00888 if (verbosity > 2) {
00889 TString eventout("\n nHBDigis = ");
00890 eventout += HBCalAEE.size();
00891 for (unsigned int i = 0; i < HBCalAEE.size(); ++i) {
00892 eventout += "\n (AEE, SHE) = (";
00893 eventout += HBCalAEE[i];
00894 eventout += ", ";
00895 eventout += HBCalSHE[i];
00896 eventout += ")";
00897 }
00898 eventout += "\n nHEDigis = ";
00899 eventout += HECalAEE.size();
00900 for (unsigned int i = 0; i < HECalAEE.size(); ++i) {
00901 eventout += "\n (AEE, SHE) = (";
00902 eventout += HECalAEE[i];
00903 eventout += ", ";
00904 eventout += HECalSHE[i];
00905 eventout += ")";
00906 }
00907 eventout += "\n nHODigis = ";
00908 eventout += HOCalAEE.size();
00909 for (unsigned int i = 0; i < HOCalAEE.size(); ++i) {
00910 eventout += "\n (AEE, SHE) = (";
00911 eventout += HOCalAEE[i];
00912 eventout += ", ";
00913 eventout += HOCalSHE[i];
00914 eventout += ")";
00915 }
00916 eventout += "\n nHFDigis = ";
00917 eventout += HFCalAEE.size();
00918 for (unsigned int i = 0; i < HFCalAEE.size(); ++i) {
00919 eventout += "\n (AEE, SHE) = (";
00920 eventout += HFCalAEE[i];
00921 eventout += ", ";
00922 eventout += HFCalSHE[i];
00923 eventout += ")";
00924 }
00925
00926 edm::LogInfo(MsgLoggerCat) << eventout << "\n";
00927 }
00928
00929 product.putHBCalDigis(HBCalAEE,HBCalSHE);
00930 product.putHECalDigis(HECalAEE,HECalSHE);
00931 product.putHOCalDigis(HOCalAEE,HOCalSHE);
00932 product.putHFCalDigis(HFCalAEE,HFCalSHE);
00933
00934 return;
00935 }
00936
00937 void GlobalDigisProducer::fillTrk(edm::Event& iEvent,
00938 const edm::EventSetup& iSetup)
00939 {
00940 std::string MsgLoggerCat = "GlobalDigisProducer_fillTrk";
00941
00942 TString eventout;
00943 if (verbosity > 0)
00944 eventout = "\nGathering info:";
00945
00946
00947 edm::Handle<edm::DetSetVector<SiStripDigi> > stripDigis;
00948 iEvent.getByLabel(SiStripSrc_, stripDigis);
00949 if (!stripDigis.isValid()) {
00950 edm::LogWarning(MsgLoggerCat)
00951 << "Unable to find stripDigis in event!";
00952 return;
00953 }
00954
00955 int nStripBrl = 0, nStripFwd = 0;
00956 edm::DetSetVector<SiStripDigi>::const_iterator DSViter;
00957 for (DSViter = stripDigis->begin(); DSViter != stripDigis->end();
00958 ++DSViter) {
00959 unsigned int id = DSViter->id;
00960 DetId detId(id);
00961 edm::DetSet<SiStripDigi>::const_iterator begin = DSViter->data.begin();
00962 edm::DetSet<SiStripDigi>::const_iterator end = DSViter->data.end();
00963 edm::DetSet<SiStripDigi>::const_iterator iter;
00964
00965
00966 if (detId.subdetId() == sdSiTIB) {
00967 TIBDetId tibid(id);
00968 for (iter = begin; iter != end; ++iter) {
00969 ++nStripBrl;
00970 if (tibid.layer() == 1) {
00971 TIBL1ADC.push_back((*iter).adc());
00972 TIBL1Strip.push_back((*iter).strip());
00973 }
00974 if (tibid.layer() == 2) {
00975 TIBL2ADC.push_back((*iter).adc());
00976 TIBL2Strip.push_back((*iter).strip());
00977 }
00978 if (tibid.layer() == 3) {
00979 TIBL3ADC.push_back((*iter).adc());
00980 TIBL3Strip.push_back((*iter).strip());
00981 }
00982 if (tibid.layer() == 4) {
00983 TIBL4ADC.push_back((*iter).adc());
00984 TIBL4Strip.push_back((*iter).strip());
00985 }
00986 }
00987 }
00988
00989
00990 if (detId.subdetId() == sdSiTOB) {
00991 TOBDetId tobid(id);
00992 for (iter = begin; iter != end; ++iter) {
00993 ++nStripBrl;
00994 if (tobid.layer() == 1) {
00995 TOBL1ADC.push_back((*iter).adc());
00996 TOBL1Strip.push_back((*iter).strip());
00997 }
00998 if (tobid.layer() == 2) {
00999 TOBL2ADC.push_back((*iter).adc());
01000 TOBL2Strip.push_back((*iter).strip());
01001 }
01002 if (tobid.layer() == 3) {
01003 TOBL3ADC.push_back((*iter).adc());
01004 TOBL3Strip.push_back((*iter).strip());
01005 }
01006 if (tobid.layer() == 4) {
01007 TOBL4ADC.push_back((*iter).adc());
01008 TOBL4Strip.push_back((*iter).strip());
01009 }
01010 }
01011 }
01012
01013
01014 if (detId.subdetId() == sdSiTID) {
01015 TIDDetId tidid(id);
01016 for (iter = begin; iter != end; ++iter) {
01017 ++nStripFwd;
01018 if (tidid.wheel() == 1) {
01019 TIDW1ADC.push_back((*iter).adc());
01020 TIDW1Strip.push_back((*iter).strip());
01021 }
01022 if (tidid.wheel() == 2) {
01023 TIDW2ADC.push_back((*iter).adc());
01024 TIDW2Strip.push_back((*iter).strip());
01025 }
01026 if (tidid.wheel() == 3) {
01027 TIDW3ADC.push_back((*iter).adc());
01028 TIDW3Strip.push_back((*iter).strip());
01029 }
01030 }
01031 }
01032
01033
01034 if (detId.subdetId() == sdSiTEC) {
01035 TECDetId tecid(id);
01036 for (iter = begin; iter != end; ++iter) {
01037 ++nStripFwd;
01038 if (tecid.wheel() == 1) {
01039 TECW1ADC.push_back((*iter).adc());
01040 TECW1Strip.push_back((*iter).strip());
01041 }
01042 if (tecid.wheel() == 2) {
01043 TECW2ADC.push_back((*iter).adc());
01044 TECW2Strip.push_back((*iter).strip());
01045 }
01046 if (tecid.wheel() == 3) {
01047 TECW3ADC.push_back((*iter).adc());
01048 TECW3Strip.push_back((*iter).strip());
01049 }
01050 if (tecid.wheel() == 4) {
01051 TECW4ADC.push_back((*iter).adc());
01052 TECW4Strip.push_back((*iter).strip());
01053 }
01054 if (tecid.wheel() == 5) {
01055 TECW5ADC.push_back((*iter).adc());
01056 TECW5Strip.push_back((*iter).strip());
01057 }
01058 if (tecid.wheel() == 6) {
01059 TECW6ADC.push_back((*iter).adc());
01060 TECW6Strip.push_back((*iter).strip());
01061 }
01062 if (tecid.wheel() == 7) {
01063 TECW7ADC.push_back((*iter).adc());
01064 TECW7Strip.push_back((*iter).strip());
01065 }
01066 if (tecid.wheel() == 8) {
01067 TECW8ADC.push_back((*iter).adc());
01068 TECW8Strip.push_back((*iter).strip());
01069 }
01070 }
01071 }
01072 }
01073
01074 if (verbosity > 1) {
01075 eventout += "\n Number of BrlStripDigis collected:........ ";
01076 eventout += nStripBrl;
01077 }
01078
01079 if (verbosity > 1) {
01080 eventout += "\n Number of FrwdStripDigis collected:....... ";
01081 eventout += nStripFwd;
01082 }
01083
01084
01085 edm::Handle<edm::DetSetVector<PixelDigi> > pixelDigis;
01086 iEvent.getByLabel(SiPxlSrc_, pixelDigis);
01087 if (!pixelDigis.isValid()) {
01088 edm::LogWarning(MsgLoggerCat)
01089 << "Unable to find pixelDigis in event!";
01090 return;
01091 }
01092
01093 int nPxlBrl = 0, nPxlFwd = 0;
01094 edm::DetSetVector<PixelDigi>::const_iterator DPViter;
01095 for (DPViter = pixelDigis->begin(); DPViter != pixelDigis->end();
01096 ++DPViter) {
01097 unsigned int id = DPViter->id;
01098 DetId detId(id);
01099 edm::DetSet<PixelDigi>::const_iterator begin = DPViter->data.begin();
01100 edm::DetSet<PixelDigi>::const_iterator end = DPViter->data.end();
01101 edm::DetSet<PixelDigi>::const_iterator iter;
01102
01103
01104 if (detId.subdetId() == sdPxlBrl) {
01105 PXBDetId bdetid(id);
01106 for (iter = begin; iter != end; ++iter) {
01107 ++nPxlBrl;
01108 if (bdetid.layer() == 1) {
01109 BRL1ADC.push_back((*iter).adc());
01110 BRL1Row.push_back((*iter).row());
01111 BRL1Col.push_back((*iter).column());
01112 }
01113 if (bdetid.layer() == 2) {
01114 BRL2ADC.push_back((*iter).adc());
01115 BRL2Row.push_back((*iter).row());
01116 BRL2Col.push_back((*iter).column());
01117 }
01118 if (bdetid.layer() == 3) {
01119 BRL3ADC.push_back((*iter).adc());
01120 BRL3Row.push_back((*iter).row());
01121 BRL3Col.push_back((*iter).column());
01122 }
01123 }
01124 }
01125
01126
01127 if (detId.subdetId() == sdPxlFwd) {
01128 PXFDetId fdetid(id);
01129 for (iter = begin; iter != end; ++iter) {
01130 ++nPxlFwd;
01131 if (fdetid.disk() == 1) {
01132 if (fdetid.side() == 1) {
01133 FWD1nADC.push_back((*iter).adc());
01134 FWD1nRow.push_back((*iter).row());
01135 FWD1nCol.push_back((*iter).column());
01136 }
01137 if (fdetid.side() == 2) {
01138 FWD1pADC.push_back((*iter).adc());
01139 FWD1pRow.push_back((*iter).row());
01140 FWD1pCol.push_back((*iter).column());
01141 }
01142 }
01143 if (fdetid.disk() == 2) {
01144 if (fdetid.side() == 1) {
01145 FWD2nADC.push_back((*iter).adc());
01146 FWD2nRow.push_back((*iter).row());
01147 FWD2nCol.push_back((*iter).column());
01148 }
01149 if (fdetid.side() == 2) {
01150 FWD2pADC.push_back((*iter).adc());
01151 FWD2pRow.push_back((*iter).row());
01152 FWD2pCol.push_back((*iter).column());
01153 }
01154 }
01155 }
01156 }
01157 }
01158
01159 if (verbosity > 1) {
01160 eventout += "\n Number of BrlPixelDigis collected:........ ";
01161 eventout += nPxlBrl;
01162 }
01163
01164 if (verbosity > 1) {
01165 eventout += "\n Number of FrwdPixelDigis collected:....... ";
01166 eventout += nPxlFwd;
01167 }
01168
01169 if (verbosity > 0)
01170 edm::LogInfo(MsgLoggerCat) << eventout << "\n";
01171
01172 return;
01173 }
01174
01175 void GlobalDigisProducer::storeTrk(PGlobalDigi& product)
01176 {
01177 std::string MsgLoggerCat = "GlobalDigisProducer_storeTrk";
01178
01179 if (verbosity > 2) {
01180
01181
01182 TString eventout("\n nTIBL1 = ");
01183 eventout += TIBL1ADC.size();
01184 for (unsigned int i = 0; i < TIBL1ADC.size(); ++i) {
01185 eventout += "\n (ADC, strip) = (";
01186 eventout += TIBL1ADC[i];
01187 eventout += ", ";
01188 eventout += TIBL1Strip[i];
01189 eventout += ")";
01190 }
01191 eventout += "\n nTIBL2 = ";
01192 eventout += TIBL2ADC.size();
01193 for (unsigned int i = 0; i < TIBL2ADC.size(); ++i) {
01194 eventout += "\n (ADC, strip) = (";
01195 eventout += TIBL2ADC[i];
01196 eventout += ", ";
01197 eventout += TIBL2Strip[i];
01198 eventout += ")";
01199 }
01200 eventout += "\n nTIBL3 = ";
01201 eventout += TIBL3ADC.size();
01202 for (unsigned int i = 0; i < TIBL3ADC.size(); ++i) {
01203 eventout += "\n (ADC, strip) = (";
01204 eventout += TIBL3ADC[i];
01205 eventout += ", ";
01206 eventout += TIBL3Strip[i];
01207 eventout += ")";
01208 }
01209 eventout += "\n nTIBL4 = ";
01210 eventout += TIBL4ADC.size();
01211 for (unsigned int i = 0; i < TIBL4ADC.size(); ++i) {
01212 eventout += "\n (ADC, strip) = (";
01213 eventout += TIBL4ADC[i];
01214 eventout += ", ";
01215 eventout += TIBL4Strip[i];
01216 eventout += ")";
01217 }
01218 eventout += "\n nTOBL1 = ";
01219 eventout += TOBL1ADC.size();
01220 for (unsigned int i = 0; i < TOBL1ADC.size(); ++i) {
01221 eventout += "\n (ADC, strip) = (";
01222 eventout += TOBL1ADC[i];
01223 eventout += ", ";
01224 eventout += TOBL1Strip[i];
01225 eventout += ")";
01226 }
01227 eventout += "\n nTOBL2 = ";
01228 eventout += TOBL2ADC.size();
01229 for (unsigned int i = 0; i < TOBL2ADC.size(); ++i) {
01230 eventout += "\n (ADC, strip) = (";
01231 eventout += TOBL2ADC[i];
01232 eventout += ", ";
01233 eventout += TOBL2Strip[i];
01234 eventout += ")";
01235 }
01236 eventout += "\n nTOBL3 = ";
01237 eventout += TOBL3ADC.size();
01238 for (unsigned int i = 0; i < TOBL3ADC.size(); ++i) {
01239 eventout += "\n (ADC, strip) = (";
01240 eventout += TOBL3ADC[i];
01241 eventout += ", ";
01242 eventout += TOBL3Strip[i];
01243 eventout += ")";
01244 }
01245 eventout += "\n nTOBL4 = ";
01246 eventout += TOBL4ADC.size();
01247 for (unsigned int i = 0; i < TOBL4ADC.size(); ++i) {
01248 eventout += "\n (ADC, strip) = (";
01249 eventout += TOBL4ADC[i];
01250 eventout += ", ";
01251 eventout += TOBL4Strip[i];
01252 eventout += ")";
01253 }
01254 eventout += "\n nTIDW1 = ";
01255 eventout += TIDW1ADC.size();
01256 for (unsigned int i = 0; i < TIDW1ADC.size(); ++i) {
01257 eventout += "\n (ADC, strip) = (";
01258 eventout += TIDW1ADC[i];
01259 eventout += ", ";
01260 eventout += TIDW1Strip[i];
01261 eventout += ")";
01262 }
01263 eventout += "\n nTIDW2 = ";
01264 eventout += TIDW2ADC.size();
01265 for (unsigned int i = 0; i < TIDW2ADC.size(); ++i) {
01266 eventout += "\n (ADC, strip) = (";
01267 eventout += TIDW2ADC[i];
01268 eventout += ", ";
01269 eventout += TIDW2Strip[i];
01270 eventout += ")";
01271 }
01272 eventout += "\n nTIDW3 = ";
01273 eventout += TIDW3ADC.size();
01274 for (unsigned int i = 0; i < TIDW3ADC.size(); ++i) {
01275 eventout += "\n (ADC, strip) = (";
01276 eventout += TIDW3ADC[i];
01277 eventout += ", ";
01278 eventout += TIDW3Strip[i];
01279 eventout += ")";
01280 }
01281 eventout += "\n nTECW1 = ";
01282 eventout += TECW1ADC.size();
01283 for (unsigned int i = 0; i < TECW1ADC.size(); ++i) {
01284 eventout += "\n (ADC, strip) = (";
01285 eventout += TECW1ADC[i];
01286 eventout += ", ";
01287 eventout += TECW1Strip[i];
01288 eventout += ")";
01289 }
01290 eventout += "\n nTECW2 = ";
01291 eventout += TECW2ADC.size();
01292 for (unsigned int i = 0; i < TECW2ADC.size(); ++i) {
01293 eventout += "\n (ADC, strip) = (";
01294 eventout += TECW2ADC[i];
01295 eventout += ", ";
01296 eventout += TECW2Strip[i];
01297 eventout += ")";
01298 }
01299 eventout += "\n nTECW3 = ";
01300 eventout += TECW3ADC.size();
01301 for (unsigned int i = 0; i < TECW3ADC.size(); ++i) {
01302 eventout += "\n (ADC, strip) = (";
01303 eventout += TECW3ADC[i];
01304 eventout += ", ";
01305 eventout += TECW3Strip[i];
01306 eventout += ")";
01307 }
01308 eventout += "\n nTECW4 = ";
01309 eventout += TECW4ADC.size();
01310 for (unsigned int i = 0; i < TECW4ADC.size(); ++i) {
01311 eventout += "\n (ADC, strip) = (";
01312 eventout += TECW4ADC[i];
01313 eventout += ", ";
01314 eventout += TECW4Strip[i];
01315 eventout += ")";
01316 }
01317 eventout += "\n nTECW5 = ";
01318 eventout += TECW5ADC.size();
01319 for (unsigned int i = 0; i < TECW5ADC.size(); ++i) {
01320 eventout += "\n (ADC, strip) = (";
01321 eventout += TECW5ADC[i];
01322 eventout += ", ";
01323 eventout += TECW5Strip[i];
01324 eventout += ")";
01325 }
01326 eventout += "\n nTECW6 = ";
01327 eventout += TECW6ADC.size();
01328 for (unsigned int i = 0; i < TECW6ADC.size(); ++i) {
01329 eventout += "\n (ADC, strip) = (";
01330 eventout += TECW6ADC[i];
01331 eventout += ", ";
01332 eventout += TECW6Strip[i];
01333 eventout += ")";
01334 }
01335 eventout += "\n nTECW7 = ";
01336 eventout += TECW7ADC.size();
01337 for (unsigned int i = 0; i < TECW7ADC.size(); ++i) {
01338 eventout += "\n (ADC, strip) = (";
01339 eventout += TECW7ADC[i];
01340 eventout += ", ";
01341 eventout += TECW7Strip[i];
01342 eventout += ")";
01343 }
01344 eventout += "\n nTECW8 = ";
01345 eventout += TECW8ADC.size();
01346 for (unsigned int i = 0; i < TECW8ADC.size(); ++i) {
01347 eventout += "\n (ADC, strip) = (";
01348 eventout += TECW8ADC[i];
01349 eventout += ", ";
01350 eventout += TECW8Strip[i];
01351 eventout += ")";
01352 }
01353
01354
01355 eventout += "\n nBRL1 = ";
01356 eventout += BRL1ADC.size();
01357 for (unsigned int i = 0; i < BRL1ADC.size(); ++i) {
01358 eventout += "\n (ADC, row, column) = (";
01359 eventout += BRL1ADC[i];
01360 eventout += ", ";
01361 eventout += BRL1Row[i];
01362 eventout += ", ";
01363 eventout += BRL1Col[i];
01364 eventout += ")";
01365 }
01366 eventout += "\n nBRL2 = ";
01367 eventout += BRL2ADC.size();
01368 for (unsigned int i = 0; i < BRL2ADC.size(); ++i) {
01369 eventout += "\n (ADC, row, column) = (";
01370 eventout += BRL2ADC[i];
01371 eventout += ", ";
01372 eventout += BRL2Row[i];
01373 eventout += ", ";
01374 eventout += BRL2Col[i];
01375 eventout += ")";
01376 }
01377 eventout += "\n nBRL3 = ";
01378 eventout += BRL3ADC.size();
01379 for (unsigned int i = 0; i < BRL3ADC.size(); ++i) {
01380 eventout += "\n (ADC, row, column) = (";
01381 eventout += BRL3ADC[i];
01382 eventout += ", ";
01383 eventout += BRL3Row[i];
01384 eventout += ", ";
01385 eventout += BRL3Col[i];
01386 eventout += ")";
01387 }
01388 eventout += "\n nFWD1p = ";
01389 eventout += FWD1pADC.size();
01390 for (unsigned int i = 0; i < FWD1pADC.size(); ++i) {
01391 eventout += "\n (ADC, row, column) = (";
01392 eventout += FWD1pADC[i];
01393 eventout += ", ";
01394 eventout += FWD1pRow[i];
01395 eventout += ", ";
01396 eventout += FWD1pCol[i];
01397 eventout += ")";
01398 }
01399 eventout += "\n nFWD1p = ";
01400 eventout += FWD1nADC.size();
01401 for (unsigned int i = 0; i < FWD1nADC.size(); ++i) {
01402 eventout += "\n (ADC, row, column) = (";
01403 eventout += FWD1nADC[i];
01404 eventout += ", ";
01405 eventout += FWD1nRow[i];
01406 eventout += ", ";
01407 eventout += FWD1nCol[i];
01408 eventout += ")";
01409 }
01410 eventout += "\n nFWD1p = ";
01411 eventout += FWD2pADC.size();
01412 for (unsigned int i = 0; i < FWD2pADC.size(); ++i) {
01413 eventout += "\n (ADC, row, column) = (";
01414 eventout += FWD2pADC[i];
01415 eventout += ", ";
01416 eventout += FWD2pRow[i];
01417 eventout += ", ";
01418 eventout += FWD2pCol[i];
01419 eventout += ")";
01420 }
01421 eventout += "\n nFWD2p = ";
01422 eventout += FWD2nADC.size();
01423 for (unsigned int i = 0; i < FWD2nADC.size(); ++i) {
01424 eventout += "\n (ADC, row, column) = (";
01425 eventout += FWD2nADC[i];
01426 eventout += ", ";
01427 eventout += FWD2nRow[i];
01428 eventout += ", ";
01429 eventout += FWD2nCol[i];
01430 eventout += ")";
01431 }
01432
01433 edm::LogInfo(MsgLoggerCat) << eventout << "\n";
01434 }
01435
01436
01437 product.putTIBL1Digis(TIBL1ADC,TIBL1Strip);
01438 product.putTIBL2Digis(TIBL2ADC,TIBL2Strip);
01439 product.putTIBL3Digis(TIBL3ADC,TIBL3Strip);
01440 product.putTIBL4Digis(TIBL4ADC,TIBL4Strip);
01441 product.putTOBL1Digis(TOBL1ADC,TOBL1Strip);
01442 product.putTOBL2Digis(TOBL2ADC,TOBL2Strip);
01443 product.putTOBL3Digis(TOBL3ADC,TOBL3Strip);
01444 product.putTOBL4Digis(TOBL4ADC,TOBL4Strip);
01445 product.putTIDW1Digis(TIDW1ADC,TIDW1Strip);
01446 product.putTIDW2Digis(TIDW2ADC,TIDW2Strip);
01447 product.putTIDW3Digis(TIDW3ADC,TIDW3Strip);
01448 product.putTECW1Digis(TECW1ADC,TECW1Strip);
01449 product.putTECW2Digis(TECW2ADC,TECW2Strip);
01450 product.putTECW3Digis(TECW3ADC,TECW3Strip);
01451 product.putTECW4Digis(TECW4ADC,TECW4Strip);
01452 product.putTECW5Digis(TECW5ADC,TECW5Strip);
01453 product.putTECW6Digis(TECW6ADC,TECW6Strip);
01454 product.putTECW7Digis(TECW7ADC,TECW7Strip);
01455 product.putTECW8Digis(TECW8ADC,TECW8Strip);
01456
01457
01458 product.putBRL1Digis(BRL1ADC, BRL1Row, BRL1Col);
01459 product.putBRL2Digis(BRL2ADC, BRL2Row, BRL2Col);
01460 product.putBRL3Digis(BRL3ADC, BRL3Row, BRL3Col);
01461 product.putFWD1pDigis(FWD1pADC, FWD1pRow, FWD1pCol);
01462 product.putFWD1nDigis(FWD1nADC, FWD1nRow, FWD1nCol);
01463 product.putFWD2pDigis(FWD2pADC, FWD2pRow, FWD2pCol);
01464 product.putFWD2nDigis(FWD2nADC, FWD2nRow, FWD2nCol);
01465
01466 return;
01467 }
01468
01469 void GlobalDigisProducer::fillMuon(edm::Event& iEvent,
01470 const edm::EventSetup& iSetup)
01471 {
01472 std::string MsgLoggerCat = "GlobalDigisProducer_fillMuon";
01473
01474 TString eventout;
01475 if (verbosity > 0)
01476 eventout = "\nGathering info:";
01477
01478
01479 edm::Handle<DTDigiCollection> dtDigis;
01480 iEvent.getByLabel(MuDTSrc_, dtDigis);
01481 if (!dtDigis.isValid()) {
01482 edm::LogWarning(MsgLoggerCat)
01483 << "Unable to find dtDigis in event!";
01484 return;
01485 }
01486
01487 int nDt = 0;
01488 DTDigiCollection::DigiRangeIterator detUnitIt;
01489 for (detUnitIt = dtDigis->begin(); detUnitIt != dtDigis->end();
01490 ++detUnitIt) {
01491
01492 const DTLayerId& id = (*detUnitIt).first;
01493 const DTDigiCollection::Range& range = (*detUnitIt).second;
01494
01495 for (DTDigiCollection::const_iterator digiIt = range.first;
01496 digiIt != range.second;
01497 ++digiIt) {
01498
01499 ++nDt;
01500
01501 DTWireId wireId(id,(*digiIt).wire());
01502 if (wireId.station() == 1) {
01503 MB1SLayer.push_back(id.superlayer());
01504 MB1Time.push_back((*digiIt).time());
01505 MB1Layer.push_back(id.layer());
01506 }
01507 if (wireId.station() == 2) {
01508 MB2SLayer.push_back(id.superlayer());
01509 MB2Time.push_back((*digiIt).time());
01510 MB2Layer.push_back(id.layer());
01511 }
01512 if (wireId.station() == 3) {
01513 MB3SLayer.push_back(id.superlayer());
01514 MB3Time.push_back((*digiIt).time());
01515 MB3Layer.push_back(id.layer());
01516 }
01517 if (wireId.station() == 4) {
01518 MB4SLayer.push_back(id.superlayer());
01519 MB4Time.push_back((*digiIt).time());
01520 MB4Layer.push_back(id.layer());
01521 }
01522 }
01523 }
01524
01525 if (verbosity > 1) {
01526 eventout += "\n Number of DtMuonDigis collected:.......... ";
01527 eventout += nDt;
01528 }
01529
01530
01531 edm::Handle<CSCStripDigiCollection> strips;
01532 iEvent.getByLabel(MuCSCStripSrc_, strips);
01533 if (!strips.isValid()) {
01534 edm::LogWarning(MsgLoggerCat)
01535 << "Unable to find muon strips in event!";
01536 return;
01537 }
01538
01539 int nStrips = 0;
01540 for (CSCStripDigiCollection::DigiRangeIterator j = strips->begin();
01541 j != strips->end();
01542 ++j) {
01543
01544 std::vector<CSCStripDigi>::const_iterator digiItr = (*j).second.first;
01545 std::vector<CSCStripDigi>::const_iterator last = (*j).second.second;
01546
01547 for ( ; digiItr != last; ++digiItr) {
01548 ++nStrips;
01549
01550
01551 std::vector<int> adcCounts = digiItr->getADCCounts();
01552 theCSCStripPedestalSum += adcCounts[0];
01553 theCSCStripPedestalSum += adcCounts[1];
01554 theCSCStripPedestalCount += 2;
01555
01556
01557 if (theCSCStripPedestalCount > 100) {
01558 float pedestal = theCSCStripPedestalSum / theCSCStripPedestalCount;
01559 if (adcCounts[5] > (pedestal + 100))
01560 CSCStripADC.push_back(adcCounts[4] - pedestal);
01561 }
01562 }
01563 }
01564
01565 if (verbosity > 1) {
01566 eventout += "\n Number of CSCStripDigis collected:........ ";
01567 eventout += nStrips;
01568 }
01569
01570
01571 edm::Handle<CSCWireDigiCollection> wires;
01572 iEvent.getByLabel(MuCSCWireSrc_, wires);
01573 if (!wires.isValid()) {
01574 edm::LogWarning(MsgLoggerCat)
01575 << "Unable to find muon wires in event!";
01576 return;
01577 }
01578
01579 int nWires = 0;
01580 for (CSCWireDigiCollection::DigiRangeIterator j = wires->begin();
01581 j != wires->end();
01582 ++j) {
01583
01584 std::vector<CSCWireDigi>::const_iterator digiItr = (*j).second.first;
01585 std::vector<CSCWireDigi>::const_iterator endDigi = (*j).second.second;
01586
01587 for ( ; digiItr != endDigi; ++digiItr) {
01588 ++nWires;
01589
01590 CSCWireTime.push_back(digiItr->getTimeBin());
01591 }
01592 }
01593
01594 if (verbosity > 1) {
01595 eventout += "\n Number of CSCWireDigis collected:......... ";
01596 eventout += nWires;
01597 }
01598
01599 if (verbosity > 0)
01600 edm::LogInfo(MsgLoggerCat) << eventout << "\n";
01601
01602 return;
01603 }
01604
01605 void GlobalDigisProducer::storeMuon(PGlobalDigi& product)
01606 {
01607 std::string MsgLoggerCat = "GlobalDigisProducer_storeMuon";
01608
01609 if (verbosity > 2) {
01610
01611
01612 TString eventout("\n nMB1 = ");
01613 eventout += MB1SLayer.size();
01614 for (unsigned int i = 0; i < MB1SLayer.size(); ++i) {
01615 eventout += "\n (slayer, time, layer) = (";
01616 eventout += MB1SLayer[i];
01617 eventout += ", ";
01618 eventout += MB1Time[i];
01619 eventout += ", ";
01620 eventout += MB1Layer[i];
01621 eventout += ")";
01622 }
01623 eventout += "\n nMB2 = ";
01624 eventout += MB2SLayer.size();
01625 for (unsigned int i = 0; i < MB2SLayer.size(); ++i) {
01626 eventout += "\n (slayer, time, layer) = (";
01627 eventout += MB2SLayer[i];
01628 eventout += ", ";
01629 eventout += MB2Time[i];
01630 eventout += ", ";
01631 eventout += MB2Layer[i];
01632 eventout += ")";
01633 }
01634 eventout += "\n nMB3 = ";
01635 eventout += MB3SLayer.size();
01636 for (unsigned int i = 0; i < MB3SLayer.size(); ++i) {
01637 eventout += "\n (slayer, time, layer) = (";
01638 eventout += MB3SLayer[i];
01639 eventout += ", ";
01640 eventout += MB3Time[i];
01641 eventout += ", ";
01642 eventout += MB3Layer[i];
01643 eventout += ")";
01644 }
01645 eventout += "\n nMB2 = ";
01646 eventout += MB4SLayer.size();
01647 for (unsigned int i = 0; i < MB4SLayer.size(); ++i) {
01648 eventout += "\n (slayer, time, layer) = (";
01649 eventout += MB4SLayer[i];
01650 eventout += ", ";
01651 eventout += MB4Time[i];
01652 eventout += ", ";
01653 eventout += MB4Layer[i];
01654 eventout += ")";
01655 }
01656
01657
01658 eventout += "\n nCSCStrip = ";
01659 eventout += CSCStripADC.size();
01660 for (unsigned int i = 0; i < CSCStripADC.size(); ++i) {
01661 eventout += "\n (adc) = (";
01662 eventout += CSCStripADC[i];
01663 eventout += ")";
01664 }
01665
01666
01667 eventout += "\n nCSCWire = ";
01668 eventout += CSCWireTime.size();
01669 for (unsigned int i = 0; i < CSCWireTime.size(); ++i) {
01670 eventout += "\n (time) = (";
01671 eventout += CSCWireTime[i];
01672 eventout += ")";
01673 }
01674
01675 edm::LogInfo(MsgLoggerCat) << eventout << "\n";
01676 }
01677
01678 product.putMB1Digis(MB1SLayer,MB1Time,MB1Layer);
01679 product.putMB2Digis(MB2SLayer,MB2Time,MB2Layer);
01680 product.putMB3Digis(MB3SLayer,MB3Time,MB3Layer);
01681 product.putMB4Digis(MB4SLayer,MB4Time,MB4Layer);
01682
01683 product.putCSCstripDigis(CSCStripADC);
01684
01685 product.putCSCwireDigis(CSCWireTime);
01686
01687 return;
01688 }
01689
01690 void GlobalDigisProducer::clear()
01691 {
01692 std::string MsgLoggerCat = "GlobalDigisProducer_clear";
01693
01694 if (verbosity > 0)
01695 edm::LogInfo(MsgLoggerCat)
01696 << "Clearing event holders";
01697
01698
01699
01700 EECalmaxPos.clear();
01701 EECalAEE.clear();
01702 EECalSHE.clear();
01703
01704 EBCalmaxPos.clear();
01705 EBCalAEE.clear();
01706 EBCalSHE.clear();
01707
01708 ESCalADC0.clear();
01709 ESCalADC1.clear();
01710 ESCalADC2.clear();
01711 ESCalSHE.clear();
01712
01713
01714 HBCalAEE.clear();
01715 HBCalSHE.clear();
01716 HECalAEE.clear();
01717 HECalSHE.clear();
01718 HOCalAEE.clear();
01719 HOCalSHE.clear();
01720 HFCalAEE.clear();
01721 HFCalSHE.clear();
01722
01723
01724 TIBL1ADC.clear();
01725 TIBL2ADC.clear();
01726 TIBL3ADC.clear();
01727 TIBL4ADC.clear();
01728 TIBL1Strip.clear();
01729 TIBL2Strip.clear();
01730 TIBL3Strip.clear();
01731 TIBL4Strip.clear();
01732
01733 TOBL1ADC.clear();
01734 TOBL2ADC.clear();
01735 TOBL3ADC.clear();
01736 TOBL4ADC.clear();
01737 TOBL1Strip.clear();
01738 TOBL2Strip.clear();
01739 TOBL3Strip.clear();
01740 TOBL4Strip.clear();
01741
01742 TIDW1ADC.clear();
01743 TIDW2ADC.clear();
01744 TIDW3ADC.clear();
01745 TIDW1Strip.clear();
01746 TIDW2Strip.clear();
01747 TIDW3Strip.clear();
01748
01749 TECW1ADC.clear();
01750 TECW2ADC.clear();
01751 TECW3ADC.clear();
01752 TECW4ADC.clear();
01753 TECW5ADC.clear();
01754 TECW6ADC.clear();
01755 TECW7ADC.clear();
01756 TECW8ADC.clear();
01757 TECW1Strip.clear();
01758 TECW2Strip.clear();
01759 TECW3Strip.clear();
01760 TECW4Strip.clear();
01761 TECW5Strip.clear();
01762 TECW6Strip.clear();
01763 TECW7Strip.clear();
01764 TECW8Strip.clear();
01765
01766 BRL1ADC.clear();
01767 BRL1Row.clear();
01768 BRL1Col.clear();
01769 BRL2ADC.clear();
01770 BRL2Row.clear();
01771 BRL2Col.clear();
01772 BRL3ADC.clear();
01773 BRL3Row.clear();
01774 BRL3Col.clear();
01775
01776 FWD1pADC.clear();
01777 FWD1pRow.clear();
01778 FWD1pCol.clear();
01779 FWD1nADC.clear();
01780 FWD1nRow.clear();
01781 FWD1nCol.clear();
01782 FWD2pADC.clear();
01783 FWD2pRow.clear();
01784 FWD2pCol.clear();
01785 FWD2nADC.clear();
01786 FWD2nRow.clear();
01787 FWD2nCol.clear();
01788
01789
01790 MB1SLayer.clear();
01791 MB1Time.clear();
01792 MB1Layer.clear();
01793 MB2SLayer.clear();
01794 MB2Time.clear();
01795 MB2Layer.clear();
01796 MB3SLayer.clear();
01797 MB3Time.clear();
01798 MB3Layer.clear();
01799 MB4SLayer.clear();
01800 MB4Time.clear();
01801 MB4Layer.clear();
01802
01803 CSCStripADC.clear();
01804
01805 CSCWireTime.clear();
01806
01807 return;
01808 }
01809
01810
01811