45 : verbosity_(pSet.getUntrackedParameter(
"verbosity", 1
U)),
48 fBuildEventDistribBad(nullptr),
49 fBuildEventDistribGood(nullptr),
50 fSMFromFedTcc(nullptr),
51 fESFromFedTcc(nullptr),
52 fDeeFromFedTcc(nullptr),
53 fFedStatusOrder(nullptr),
54 fDeeNumberString(nullptr),
56 fStexNbOfTreatedEvents(nullptr),
60 fFedNbOfTreatedEvents(nullptr),
61 fNbOfTreatedFedsInDee(nullptr),
62 fNbOfTreatedFedsInStex(nullptr),
67 fMemoDateFirstEvent(nullptr),
70 fMyEBNumbering(nullptr),
72 fMyEENumbering(nullptr),
74 fRunTypeCounter(nullptr),
75 fMgpaGainCounter(nullptr),
76 fFedIdCounter(nullptr),
77 fCounterQuad(nullptr) {
86 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer-constructor> Check path for resultsq Root files.";
88 if (myPathEB->GetPathForResultsRootFiles() == kFALSE) {
89 edm::LogError(
"ecnaAnal") <<
"*EcnaAnalyzer-constructor> *** ERROR *** Path for result files not found.";
90 throw cms::Exception(
"Calibration") <<
"*EcnaAnalyzer-constructor> *** ERROR *** Path for result files not found.";
92 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer-constructor> Path for result files found = " 93 << myPathEB->ResultsRootFilePath();
96 if (myPathEE->GetPathForResultsRootFiles() == kFALSE) {
97 edm::LogError(
"ecnaAnal") <<
"*EcnaAnalyzer-constructor> *** ERROR *** Path for result files not found.";
98 throw cms::Exception(
"Calibration") <<
"*EcnaAnalyzer-constructor> *** ERROR *** Path for result files not found.";
100 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer-constructor> Path for result files found = " 101 << myPathEE->ResultsRootFilePath();
104 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer-constructor> Parameter initialization.";
270 for (Int_t nFedTcc = 1; nFedTcc <= MaxSMAndDS; nFedTcc++) {
274 for (Int_t nFedTcc = 1; nFedTcc <= 3; nFedTcc++) {
277 for (Int_t nFedTcc = 4; nFedTcc <= 9; nFedTcc++) {
281 for (Int_t nFedTcc = 10; nFedTcc <= 27; nFedTcc++) {
284 for (Int_t nFedTcc = 28; nFedTcc <= 45; nFedTcc++) {
288 for (Int_t nFedTcc = 46; nFedTcc <= 48; nFedTcc++) {
291 for (Int_t nFedTcc = 49; nFedTcc <= 54; nFedTcc++) {
530 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer::EcnaAnalyzer-constructor> fChozenRunTypeNumber = " 532 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer::EcnaAnalyzer-constructor> fChozenGainNumber = " 535 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer::EcnaAnalyzer-constructor> Init done. ";
544 edm::LogVerbatim(
"ecnaAnal") <<
"EcnaAnalyzer::~EcnaAnalyzer()> destructor is going to be executed." << std::endl;
557 <<
". !===> ECNA HAS NOT BEEN INITIALIZED." 562 <<
", last event fFedId(+601) = " <<
fFedId + 601 << std::endl;
576 if (
fMyCnaEBSM[iSM]->WriteRootFile() == kFALSE) {
577 edm::LogVerbatim(
"ecnaAnal") <<
"!EcnaAnalyzer-destructor> PROBLEM with write ROOT file for SM" << iSM + 1
582 <<
"*EcnaAnalyzer-destructor> Calculations and writing on file already done for SM " << iSM + 1;
591 <<
". !===> ECNA HAS NOT BEEN INITIALIZED." 596 <<
", last event fFedId(+601) = " <<
fFedId + 601 << std::endl;
610 if (
fMyCnaEEDee[iDee]->WriteRootFile() == kFALSE) {
611 edm::LogVerbatim(
"ecnaAnal") <<
"!EcnaAnalyzer-destructor> PROBLEM with write ROOT file for Dee" << iDee + 1
616 <<
"*EcnaAnalyzer-destructor> Calculations and writing on file already done for Dee " << iDee + 1;
625 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer-destructor> Status of events returned by GetSampleAdcValues(): ";
636 edm::LogVerbatim(
"ecnaAnal") <<
"\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ";
638 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer-destructor> Run types seen in event headers before selection:";
645 edm::LogVerbatim(
"ecnaAnal") <<
"\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ";
647 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer-destructor> Mgpa gains seen in event headers before selection:";
654 edm::LogVerbatim(
"ecnaAnal") <<
"\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ";
656 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer-destructor> Numbers of selected events for each FED:";
662 edm::LogVerbatim(
"ecnaAnal") <<
"\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ";
670 edm::LogVerbatim(
"ecnaAnal") <<
"\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ";
709 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer-destructor> End of execution.";
720 std::cout << std::setiosflags(std::ios::showpoint | std::ios::uppercase);
721 std::cout << std::setprecision(3) << std::setw(6);
724 std::cout.setf(std::ios::left, std::ios::adjustfield);
725 std::cout.setf(std::ios::right, std::ios::adjustfield);
741 myEventHeader = pEventHeader.
product();
750 fRunNumber = (Int_t)headerItr->getRunNumber();
756 fFedId = (Int_t)headerItr->fedId() - 601;
814 fFedTcc = (Int_t)headerItr->getDccInTCCCommand();
818 if (fFedTcc < 10 || fFedTcc > 45)
875 Int_t MaxNbOfStex = 0;
902 if (Int_t(digisEB->
end() - digisEB->
begin()) >= 0 &&
903 Int_t(digisEB->
end() - digisEB->
begin()) <= Int_t(digisEB->
size())) {
912 EBDetId id_crystal(digiItr->id());
915 Int_t i0SM = id_crystal.
ism() - 1;
926 <<
"*EcnaAnalyzer::analyze(...)> ********* INIT ECNA EB ********* " 932 <<
"\n SM = " << i0SM + 1
949 time_t i_current_ev_time = (time_t)(t_current_ev_time >> 32);
950 const time_t *p_current_ev_time = &i_current_ev_time;
951 char *astime = ctime(p_current_ev_time);
960 <<
". First analyzed event date : " << astime;
967 if (i_current_ev_time >
fTimeLast[i0SM]) {
975 Int_t
iEta = id_crystal.ietaSM();
976 Int_t iPhi = id_crystal.iphiSM();
983 Int_t NbOfSamplesFromDigis = digiItr->size();
987 if (NbOfSamplesFromDigis > 0 && NbOfSamplesFromDigis <= fMyEBEcal->MaxSampADC()) {
988 Double_t adcDBLS = (Double_t)0;
992 for (Int_t i0Sample = 0; i0Sample < 3; i0Sample++) {
993 adcDBLS += (Double_t)(
df.sample(i0Sample).adc());
995 adcDBLS /= (Double_t)3;
998 for (Int_t i0Sample = 0; i0Sample <
fNbOfSamples; i0Sample++) {
999 Double_t
adc = (Double_t)(
df.sample(i0Sample).adc()) - adcDBLS;
1011 <<
"EcnaAnalyzer::analyze(...)> NbOfSamplesFromDigis out of bounds = " << NbOfSamplesFromDigis;
1049 if (Int_t(digisEE->
end() - digisEE->
begin()) >= 0 &&
1050 Int_t(digisEE->
end() - digisEE->
begin()) <= Int_t(digisEE->
size())) {
1058 EEDetId id_crystal(digiItr->id());
1060 Int_t iX_data = id_crystal.
ix();
1061 Int_t iY_data = id_crystal.iy();
1062 Int_t i_quad = id_crystal.iquadrant();
1063 Int_t i_sgnZ = id_crystal.zside();
1071 if (i_quad == 1 || i_quad == 4) {
1074 if (i_quad == 3 || i_quad == 2) {
1081 Int_t n1DeeNumber = 0;
1082 if (i_quad == 1 && i_sgnZ == 1) {
1085 if (i_quad == 1 && i_sgnZ == -1) {
1088 if (i_quad == 2 && i_sgnZ == 1) {
1091 if (i_quad == 2 && i_sgnZ == -1) {
1094 if (i_quad == 3 && i_sgnZ == 1) {
1097 if (i_quad == 3 && i_sgnZ == -1) {
1100 if (i_quad == 4 && i_sgnZ == 1) {
1103 if (i_quad == 4 && i_sgnZ == -1) {
1107 Int_t i0Dee = n1DeeNumber - 1;
1118 <<
"*EcnaAnalyzer::analyze(...)> ********* INIT ECNA EE ********* " 1124 <<
"\n Dee = " << i0Dee + 1
1131 Bool_t cOKForTreatment = kFALSE;
1145 cOKForTreatment = kTRUE;
1164 cOKForTreatment = kTRUE;
1176 cOKForTreatment = kTRUE;
1180 if (cOKForTreatment == kTRUE) {
1185 time_t i_current_ev_time = (time_t)(t_current_ev_time >> 32);
1186 const time_t *p_current_ev_time = &i_current_ev_time;
1187 char *astime = ctime(p_current_ev_time);
1201 <<
"----- beginning of analysis for " <<
fStexName << i0Dee + 1 <<
"-------" 1202 <<
"\n First event date = " << astime <<
"\n Nb of selected evts = " <<
fNbOfSelectedEvents 1203 <<
"\n---------------------------------------------------------------";
1211 if (i_current_ev_time >
fTimeLast[i0Dee]) {
1223 Int_t NbOfSamplesFromDigis = digiItr->size();
1227 if (NbOfSamplesFromDigis > 0 && NbOfSamplesFromDigis <= fMyEEEcal->MaxSampADC()) {
1228 Double_t adcDBLS = (Double_t)0;
1232 for (Int_t i0Sample = 0; i0Sample < 3; i0Sample++) {
1233 adcDBLS += (Double_t)(
df.sample(i0Sample).adc());
1235 adcDBLS /= (Double_t)3;
1238 for (Int_t i0Sample = 0; i0Sample <
fNbOfSamples; i0Sample++) {
1239 Double_t
adc = (Double_t)(
df.sample(i0Sample).adc()) - adcDBLS;
1251 <<
"EcnaAnalyzer::analyze(...)> NbOfSamplesFromDigis out of bounds = " << NbOfSamplesFromDigis;
1337 for (Int_t i0FedES = 0; i0FedES <= 3; i0FedES++) {
1355 for (Int_t i0FedES = 5; i0FedES <= 8; i0FedES++) {
1364 for (Int_t i0FedES = 9; i0FedES <= 12; i0FedES++) {
1382 for (Int_t i0FedES = 14; i0FedES <= 17; i0FedES++) {
1390 for (Int_t i0Dee = 0; i0Dee < 4; i0Dee++) {
1425 <<
" events analyzed." 1426 <<
"\n---------------------------------------------------------";
1441 if (
fMyCnaEBSM[i0Stex]->WriteRootFile() == kFALSE) {
1442 edm::LogVerbatim(
"ecnaAnal") <<
"!EcnaAnalyzer::analyze> PROBLEM with write ROOT file for SM" << i0Stex + 1
1450 edm::LogVerbatim(
"ecnaAnal") <<
"!EcnaAnalyzer::analyze> Set memory free: delete done for SM " << i0Stex + 1;
1465 if (
fMyCnaEEDee[i0Stex]->WriteRootFile() == kFALSE) {
1466 edm::LogVerbatim(
"ecnaAnal") <<
"!EcnaAnalyzer::analyze> PROBLEM with write ROOT file for Dee" << i0Stex + 1
1474 edm::LogVerbatim(
"ecnaAnal") <<
"!EcnaAnalyzer::analyze> Set memory free: delete done for Dee " << i0Stex + 1;
1478 edm::LogVerbatim(
"ecnaAnal") <<
"*---------------------------------------------------------------------------- ";
1490 if (s_opt ==
"EVT") {
1491 Int_t MaxNbOfStex = 0;
1503 <<
"\n**************************** ANALYSIS REPORT > OK **************************************" 1504 <<
"\n*EcnaAnalyzer::AnalysisOutcome(...)> The maximum requested number of events and the maximum" 1505 <<
"\n number of treated " <<
fStexName <<
"'s have been reached." 1506 <<
"\n Analysis successfully ended from EcnaAnalyzer " 1515 <<
"****************************************************************************************\n";
1523 edm::LogVerbatim(
"ecnaAnal") <<
"\n**************************** ANALYSIS REPORT >>> *** " 1524 "WARNING *** WARNING *** WARNING ***" 1525 <<
"\n*EcnaAnalyzer::AnalysisOutcome(...)> Last event reached " 1526 "before completion of analysis." 1527 <<
"\n Analysis ended from EcnaAnalyzer " 1528 <<
"\n Number of selected events = " 1530 <<
"\n Last requested event number = " 1532 <<
"\n Current event number = " 1539 <<
"****************************************************************************************" << std::endl;
1545 if (s_opt ==
"ERR_FNEG") {
1547 <<
"\n**************************** ANALYSIS REPORT >>> **** ERROR **** ERROR **** ERROR ******" 1548 <<
"\n*EcnaAnalyzer::AnalysisOutcome(...)> First event number = " <<
fFirstReqEvent 1549 <<
". Should be strictly potitive." 1550 <<
"\n Analysis ended from EcnaAnalyzer ";
1553 <<
"****************************************************************************************" << std::endl;
1558 if (s_opt ==
"ERR_LREQ") {
1560 <<
"\n**************************** ANALYSIS REPORT >>> **** ERROR **** ERROR **** ERROR ******" 1561 <<
"\n*EcnaAnalyzer::analyze(...)> Requested number of events = " <<
fReqNbOfEvts <<
"." 1562 <<
"\n Too large compared to the event range: " <<
fFirstReqEvent <<
" - " 1566 <<
"****************************************************************************************" << std::endl;
1584 edm::LogVerbatim(
"ecnaAnal") <<
"---------------- CROSS-CHECK A ------------------ " 1585 <<
"\n**************** CURRENT EVENT ****************** ";
1588 edm::LogVerbatim(
"ecnaAnal") <<
"---------------- CROSS-CHECK B ------------------ " 1589 <<
"\n**** FIRST EVENT PASSING USER'S ANALYSIS CUT **** ";
1592 edm::LogVerbatim(
"ecnaAnal") <<
"---------------- CROSS-CHECK C ------------------ " 1593 <<
"\n*** CURRENT VALUES BEFORE RESULT FILE WRITING *** ";
1595 if (MsgNum == 3 || MsgNum == 4) {
1605 <<
"\n fFedTcc = " <<
fFedTcc <<
"\n fFedId(+601) = " <<
fFedId + 601
1623 << nStexNbOfTreatedEvents <<
" events. " <<
fStexName 1625 if (j0Stex == i0Stex) {
1641 edm::LogVerbatim(
"ecnaAnal") <<
"Fed (ES) " << std::setw(3) << i0FedES + 1 <<
": " << std::setw(5)
1642 << nFedNbOfTreatedEvents <<
" events." 1643 <<
" Fed status: " <<
fFedStatus[i0FedES] <<
", order: " << std::setw(3)
1651 if (j0Stex == i0Stex) {
1661 if (MsgNum == 1 || MsgNum == 2) {
1662 edm::LogVerbatim(
"ecnaAnal") <<
"*---------------------------------------------------------------------------- ";
1665 edm::LogVerbatim(
"ecnaAnal") <<
"*............................................................................ ";
1671 TString cType =
"?";
1686 cType =
"LASER_STD";
1689 cType =
"LASER_POWER_SCAN";
1692 cType =
"LASER_DELAY_SCAN";
1695 cType =
"TESTPULSE_SCAN_MEM";
1698 cType =
"TESTPULSE_MGPA";
1701 cType =
"PEDESTAL_STD";
1703 if (numtype == 10) {
1704 cType =
"PEDESTAL_OFFSET_SCAN";
1706 if (numtype == 11) {
1707 cType =
"PEDESTAL_25NS_SCAN";
1709 if (numtype == 12) {
1713 if (numtype == 13) {
1714 cType =
"PHYSICS_GLOBAL";
1716 if (numtype == 14) {
1717 cType =
"COSMICS_GLOBAL";
1719 if (numtype == 15) {
1720 cType =
"HALO_GLOBAL";
1723 if (numtype == 16) {
1724 cType =
"LASER_GAP";
1726 if (numtype == 17) {
1727 cType =
"TESTPULSE_GAP";
1729 if (numtype == 18) {
1730 cType =
"PEDESTAL_GAP";
1732 if (numtype == 19) {
1736 if (numtype == 20) {
1737 cType =
"PHYSICS_LOCAL";
1739 if (numtype == 21) {
1740 cType =
"COSMICS_LOCAL";
1742 if (numtype == 22) {
1743 cType =
"HALO_LOCAL";
1745 if (numtype == 23) {
1746 cType =
"CALIB_LOCAL";
1750 if (numtype == 24) {
1753 if (numtype == 25) {
Log< level::Info, true > LogVerbatim
Int_t * fStexNbOfTreatedEvents
edm::EDGetTokenT< EEDigiCollection > EEdigiToken_
std::string digiProducer_
T getParameter(std::string const &) const
void GetReadyToReadData(const TString &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &)
Int_t * fBuildEventDistribBad
TString runtype(const Int_t &)
Int_t fChozenRunTypeNumber
EcnaAnalyzer(const edm::ParameterSet &)
Int_t fMaxMgpaGainCounter
TString GetDeeDirViewedFromIP(const Int_t &)
T const * product() const
std::vector< T >::const_iterator const_iterator
Int_t * fFedNbOfTreatedEvents
TEcnaNumbering * fMyEENumbering
Int_t Get0TowEchaFrom1SMCrys(const Int_t &)
Int_t gainvalue(const Int_t &)
Log< level::Error, false > LogError
Int_t Get1DeeSCEcnaFrom1DeeCrys(const Int_t &, const TString &)
Bool_t AnalysisOutcome(const TString &)
void CheckMsg(const Int_t &, const Int_t &)
Int_t fCurrentEventNumber
Int_t Get1SMTowFrom1SMCrys(const Int_t &)
std::string EBdigiCollection_
Int_t fMaxTreatedStexCounter
edm::EDGetTokenT< EcalRawDataCollection > eventHeaderToken_
unsigned long long Time_t
Int_t Get1SCEchaFrom1DeeCrys(const Int_t &, const TString &)
Int_t fNbOfSelectedEvents
int ism() const
get the ECAL/SM id
TEcnaNumbering * fMyEBNumbering
edm::EDGetTokenT< EBDigiCollection > EBdigiToken_
const_iterator begin() const
Int_t * fBuildEventDistribGood
unsigned long long TimeValue_t
Int_t * fNbOfTreatedFedsInStex
const_iterator end() const
const_iterator end() const
std::string eventHeaderProducer_
const_iterator begin() const
The iterator returned can not safely be used across threads.
TString * fDeeNumberString
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
std::string eventHeaderCollection_
void analyze(const edm::Event &, const edm::EventSetup &) override
std::string EEdigiCollection_
Int_t * fMemoDateFirstEvent
void StartStopTime(time_t, time_t)
TEcnaObject * fMyEcnaEBObjectManager
TEcnaObject * fMyEcnaEEObjectManager
uint16_t *__restrict__ uint16_t const *__restrict__ adc
void StartStopDate(const TString &, const TString &)
Int_t * fNbOfTreatedFedsInDee