46 : verbosity_(pSet.getUntrackedParameter(
"verbosity", 1
U)),
49 fMyEBNumbering(&fMyEcnaEBObjectManager,
"EB"),
50 fMyEBEcal(&fMyEcnaEBObjectManager,
"EB"),
51 fMyEENumbering(&fMyEcnaEEObjectManager,
"EE"),
52 fMyEEEcal(&fMyEcnaEEObjectManager,
"EE") {
58 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer-constructor> Check path for resultsq Root files.";
60 if (myPathEB->GetPathForResultsRootFiles() == kFALSE) {
61 edm::LogError(
"ecnaAnal") <<
"*EcnaAnalyzer-constructor> *** ERROR *** Path for result files not found.";
62 throw cms::Exception(
"Calibration") <<
"*EcnaAnalyzer-constructor> *** ERROR *** Path for result files not found.";
64 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer-constructor> Path for result files found = " 65 << myPathEB->ResultsRootFilePath();
68 if (myPathEE->GetPathForResultsRootFiles() == kFALSE) {
69 edm::LogError(
"ecnaAnal") <<
"*EcnaAnalyzer-constructor> *** ERROR *** Path for result files not found.";
70 throw cms::Exception(
"Calibration") <<
"*EcnaAnalyzer-constructor> *** ERROR *** Path for result files not found.";
72 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer-constructor> Path for result files found = " 73 << myPathEE->ResultsRootFilePath();
76 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer-constructor> Parameter initialization.";
204 for (Int_t nFedTcc = 1; nFedTcc <= 3; nFedTcc++) {
207 for (Int_t nFedTcc = 4; nFedTcc <= 9; nFedTcc++) {
211 for (Int_t nFedTcc = 10; nFedTcc <= 27; nFedTcc++) {
214 for (Int_t nFedTcc = 28; nFedTcc <= 45; nFedTcc++) {
218 for (Int_t nFedTcc = 46; nFedTcc <= 48; nFedTcc++) {
221 for (Int_t nFedTcc = 49; nFedTcc <= 54; nFedTcc++) {
424 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer::EcnaAnalyzer-constructor> fChozenRunTypeNumber = " 426 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer::EcnaAnalyzer-constructor> fChozenGainNumber = " 429 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer::EcnaAnalyzer-constructor> Init done. ";
438 edm::LogVerbatim(
"ecnaAnal") <<
"EcnaAnalyzer::~EcnaAnalyzer()> destructor is going to be executed." << std::endl;
447 edm::LogVerbatim(
"ecnaAnal") <<
"\n!EcnaAnalyzer-destructor> **** ERROR **** fMyCnaEBSM is empty" 448 <<
". !===> ECNA HAS NOT BEEN INITIALIZED." 453 <<
", last event fFedId(+601) = " <<
fFedId + 601 << std::endl;
467 if (
fMyCnaEBSM[iSM]->WriteRootFile() == kFALSE) {
468 edm::LogVerbatim(
"ecnaAnal") <<
"!EcnaAnalyzer-destructor> PROBLEM with write ROOT file for SM" << iSM + 1
473 <<
"*EcnaAnalyzer-destructor> Calculations and writing on file already done for SM " << iSM + 1;
480 edm::LogVerbatim(
"ecnaAnal") <<
"\n!EcnaAnalyzer-destructor> **** ERROR **** fMyCnaEEDee is empty" 481 <<
". !===> ECNA HAS NOT BEEN INITIALIZED." 486 <<
", last event fFedId(+601) = " <<
fFedId + 601 << std::endl;
500 if (
fMyCnaEEDee[iDee]->WriteRootFile() == kFALSE) {
501 edm::LogVerbatim(
"ecnaAnal") <<
"!EcnaAnalyzer-destructor> PROBLEM with write ROOT file for Dee" << iDee + 1
506 <<
"*EcnaAnalyzer-destructor> Calculations and writing on file already done for Dee " << iDee + 1;
514 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer-destructor> Status of events returned by GetSampleAdcValues(): ";
525 edm::LogVerbatim(
"ecnaAnal") <<
"\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ";
527 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer-destructor> Run types seen in event headers before selection:";
534 edm::LogVerbatim(
"ecnaAnal") <<
"\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ";
536 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer-destructor> Mgpa gains seen in event headers before selection:";
543 edm::LogVerbatim(
"ecnaAnal") <<
"\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ";
545 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer-destructor> Numbers of selected events for each FED:";
551 edm::LogVerbatim(
"ecnaAnal") <<
"\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ";
559 edm::LogVerbatim(
"ecnaAnal") <<
"\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ";
564 edm::LogVerbatim(
"ecnaAnal") <<
"*EcnaAnalyzer-destructor> End of execution.";
575 std::cout << std::setiosflags(std::ios::showpoint | std::ios::uppercase);
576 std::cout << std::setprecision(3) << std::setw(6);
579 std::cout.setf(std::ios::left, std::ios::adjustfield);
580 std::cout.setf(std::ios::right, std::ios::adjustfield);
596 myEventHeader = pEventHeader.
product();
605 fRunNumber = (Int_t)headerItr->getRunNumber();
611 fFedId = (Int_t)headerItr->fedId() - 601;
669 fFedTcc = (Int_t)headerItr->getDccInTCCCommand();
673 if (fFedTcc < 10 || fFedTcc > 45)
724 Int_t MaxNbOfStex = 0;
751 if (Int_t(digisEB->
end() - digisEB->
begin()) >= 0 &&
752 Int_t(digisEB->
end() - digisEB->
begin()) <= Int_t(digisEB->
size())) {
761 EBDetId id_crystal(digiItr->id());
764 Int_t i0SM = id_crystal.
ism() - 1;
775 <<
"*EcnaAnalyzer::analyze(...)> ********* INIT ECNA EB ********* " 781 <<
"\n SM = " << i0SM + 1
798 time_t i_current_ev_time = (time_t)(t_current_ev_time >> 32);
799 const time_t *p_current_ev_time = &i_current_ev_time;
800 char *astime = ctime(p_current_ev_time);
809 <<
". First analyzed event date : " << astime;
816 if (i_current_ev_time >
fTimeLast[i0SM]) {
824 Int_t
iEta = id_crystal.ietaSM();
825 Int_t iPhi = id_crystal.iphiSM();
832 Int_t NbOfSamplesFromDigis = digiItr->size();
837 Double_t adcDBLS = (Double_t)0;
841 for (Int_t i0Sample = 0; i0Sample < 3; i0Sample++) {
842 adcDBLS += (Double_t)(
df.sample(i0Sample).adc());
844 adcDBLS /= (Double_t)3;
847 for (Int_t i0Sample = 0; i0Sample <
fNbOfSamples; i0Sample++) {
848 Double_t
adc = (Double_t)(
df.sample(i0Sample).adc()) - adcDBLS;
860 <<
"EcnaAnalyzer::analyze(...)> NbOfSamplesFromDigis out of bounds = " << NbOfSamplesFromDigis;
898 if (Int_t(digisEE->
end() - digisEE->
begin()) >= 0 &&
899 Int_t(digisEE->
end() - digisEE->
begin()) <= Int_t(digisEE->
size())) {
907 EEDetId id_crystal(digiItr->id());
909 Int_t iX_data = id_crystal.
ix();
910 Int_t iY_data = id_crystal.iy();
911 Int_t i_quad = id_crystal.iquadrant();
912 Int_t i_sgnZ = id_crystal.zside();
920 if (i_quad == 1 || i_quad == 4) {
923 if (i_quad == 3 || i_quad == 2) {
930 Int_t n1DeeNumber = 0;
931 if (i_quad == 1 && i_sgnZ == 1) {
934 if (i_quad == 1 && i_sgnZ == -1) {
937 if (i_quad == 2 && i_sgnZ == 1) {
940 if (i_quad == 2 && i_sgnZ == -1) {
943 if (i_quad == 3 && i_sgnZ == 1) {
946 if (i_quad == 3 && i_sgnZ == -1) {
949 if (i_quad == 4 && i_sgnZ == 1) {
952 if (i_quad == 4 && i_sgnZ == -1) {
956 Int_t i0Dee = n1DeeNumber - 1;
967 <<
"*EcnaAnalyzer::analyze(...)> ********* INIT ECNA EE ********* " 973 <<
"\n Dee = " << i0Dee + 1
980 Bool_t cOKForTreatment = kFALSE;
994 cOKForTreatment = kTRUE;
1013 cOKForTreatment = kTRUE;
1025 cOKForTreatment = kTRUE;
1029 if (cOKForTreatment == kTRUE) {
1034 time_t i_current_ev_time = (time_t)(t_current_ev_time >> 32);
1035 const time_t *p_current_ev_time = &i_current_ev_time;
1036 char *astime = ctime(p_current_ev_time);
1050 <<
"----- beginning of analysis for " <<
fStexName << i0Dee + 1 <<
"-------" 1051 <<
"\n First event date = " << astime <<
"\n Nb of selected evts = " <<
fNbOfSelectedEvents 1052 <<
"\n---------------------------------------------------------------";
1060 if (i_current_ev_time >
fTimeLast[i0Dee]) {
1072 Int_t NbOfSamplesFromDigis = digiItr->size();
1077 Double_t adcDBLS = (Double_t)0;
1081 for (Int_t i0Sample = 0; i0Sample < 3; i0Sample++) {
1082 adcDBLS += (Double_t)(
df.sample(i0Sample).adc());
1084 adcDBLS /= (Double_t)3;
1087 for (Int_t i0Sample = 0; i0Sample <
fNbOfSamples; i0Sample++) {
1088 Double_t
adc = (Double_t)(
df.sample(i0Sample).adc()) - adcDBLS;
1100 <<
"EcnaAnalyzer::analyze(...)> NbOfSamplesFromDigis out of bounds = " << NbOfSamplesFromDigis;
1186 for (Int_t i0FedES = 0; i0FedES <= 3; i0FedES++) {
1204 for (Int_t i0FedES = 5; i0FedES <= 8; i0FedES++) {
1213 for (Int_t i0FedES = 9; i0FedES <= 12; i0FedES++) {
1231 for (Int_t i0FedES = 14; i0FedES <= 17; i0FedES++) {
1239 for (Int_t i0Dee = 0; i0Dee < 4; i0Dee++) {
1274 <<
" events analyzed." 1275 <<
"\n---------------------------------------------------------";
1290 if (
fMyCnaEBSM[i0Stex]->WriteRootFile() == kFALSE) {
1291 edm::LogVerbatim(
"ecnaAnal") <<
"!EcnaAnalyzer::analyze> PROBLEM with write ROOT file for SM" << i0Stex + 1
1298 edm::LogVerbatim(
"ecnaAnal") <<
"!EcnaAnalyzer::analyze> Set memory free: delete done for SM " << i0Stex + 1;
1313 if (
fMyCnaEEDee[i0Stex]->WriteRootFile() == kFALSE) {
1314 edm::LogVerbatim(
"ecnaAnal") <<
"!EcnaAnalyzer::analyze> PROBLEM with write ROOT file for Dee" << i0Stex + 1
1321 edm::LogVerbatim(
"ecnaAnal") <<
"!EcnaAnalyzer::analyze> Set memory free: delete done for Dee " << i0Stex + 1;
1325 edm::LogVerbatim(
"ecnaAnal") <<
"*---------------------------------------------------------------------------- ";
1337 if (s_opt ==
"EVT") {
1338 Int_t MaxNbOfStex = 0;
1350 <<
"\n**************************** ANALYSIS REPORT > OK **************************************" 1351 <<
"\n*EcnaAnalyzer::AnalysisOutcome(...)> The maximum requested number of events and the maximum" 1352 <<
"\n number of treated " <<
fStexName <<
"'s have been reached." 1353 <<
"\n Analysis successfully ended from EcnaAnalyzer " 1362 <<
"****************************************************************************************\n";
1370 edm::LogVerbatim(
"ecnaAnal") <<
"\n**************************** ANALYSIS REPORT >>> *** " 1371 "WARNING *** WARNING *** WARNING ***" 1372 <<
"\n*EcnaAnalyzer::AnalysisOutcome(...)> Last event reached " 1373 "before completion of analysis." 1374 <<
"\n Analysis ended from EcnaAnalyzer " 1375 <<
"\n Number of selected events = " 1377 <<
"\n Last requested event number = " 1379 <<
"\n Current event number = " 1386 <<
"****************************************************************************************" << std::endl;
1392 if (s_opt ==
"ERR_FNEG") {
1394 <<
"\n**************************** ANALYSIS REPORT >>> **** ERROR **** ERROR **** ERROR ******" 1395 <<
"\n*EcnaAnalyzer::AnalysisOutcome(...)> First event number = " <<
fFirstReqEvent 1396 <<
". Should be strictly potitive." 1397 <<
"\n Analysis ended from EcnaAnalyzer ";
1400 <<
"****************************************************************************************" << std::endl;
1405 if (s_opt ==
"ERR_LREQ") {
1407 <<
"\n**************************** ANALYSIS REPORT >>> **** ERROR **** ERROR **** ERROR ******" 1408 <<
"\n*EcnaAnalyzer::analyze(...)> Requested number of events = " <<
fReqNbOfEvts <<
"." 1409 <<
"\n Too large compared to the event range: " <<
fFirstReqEvent <<
" - " 1413 <<
"****************************************************************************************" << std::endl;
1431 edm::LogVerbatim(
"ecnaAnal") <<
"---------------- CROSS-CHECK A ------------------ " 1432 <<
"\n**************** CURRENT EVENT ****************** ";
1435 edm::LogVerbatim(
"ecnaAnal") <<
"---------------- CROSS-CHECK B ------------------ " 1436 <<
"\n**** FIRST EVENT PASSING USER'S ANALYSIS CUT **** ";
1439 edm::LogVerbatim(
"ecnaAnal") <<
"---------------- CROSS-CHECK C ------------------ " 1440 <<
"\n*** CURRENT VALUES BEFORE RESULT FILE WRITING *** ";
1442 if (MsgNum == 3 || MsgNum == 4) {
1452 <<
"\n fFedTcc = " <<
fFedTcc <<
"\n fFedId(+601) = " <<
fFedId + 601
1470 << nStexNbOfTreatedEvents <<
" events. " <<
fStexName 1472 if (j0Stex == i0Stex) {
1488 edm::LogVerbatim(
"ecnaAnal") <<
"Fed (ES) " << std::setw(3) << i0FedES + 1 <<
": " << std::setw(5)
1489 << nFedNbOfTreatedEvents <<
" events." 1490 <<
" Fed status: " <<
fFedStatus[i0FedES] <<
", order: " << std::setw(3)
1498 if (j0Stex == i0Stex) {
1508 if (MsgNum == 1 || MsgNum == 2) {
1509 edm::LogVerbatim(
"ecnaAnal") <<
"*---------------------------------------------------------------------------- ";
1512 edm::LogVerbatim(
"ecnaAnal") <<
"*............................................................................ ";
1518 TString cType =
"?";
1533 cType =
"LASER_STD";
1536 cType =
"LASER_POWER_SCAN";
1539 cType =
"LASER_DELAY_SCAN";
1542 cType =
"TESTPULSE_SCAN_MEM";
1545 cType =
"TESTPULSE_MGPA";
1548 cType =
"PEDESTAL_STD";
1550 if (numtype == 10) {
1551 cType =
"PEDESTAL_OFFSET_SCAN";
1553 if (numtype == 11) {
1554 cType =
"PEDESTAL_25NS_SCAN";
1556 if (numtype == 12) {
1560 if (numtype == 13) {
1561 cType =
"PHYSICS_GLOBAL";
1563 if (numtype == 14) {
1564 cType =
"COSMICS_GLOBAL";
1566 if (numtype == 15) {
1567 cType =
"HALO_GLOBAL";
1570 if (numtype == 16) {
1571 cType =
"LASER_GAP";
1573 if (numtype == 17) {
1574 cType =
"TESTPULSE_GAP";
1576 if (numtype == 18) {
1577 cType =
"PEDESTAL_GAP";
1579 if (numtype == 19) {
1583 if (numtype == 20) {
1584 cType =
"PHYSICS_LOCAL";
1586 if (numtype == 21) {
1587 cType =
"COSMICS_LOCAL";
1589 if (numtype == 22) {
1590 cType =
"HALO_LOCAL";
1592 if (numtype == 23) {
1593 cType =
"CALIB_LOCAL";
1597 if (numtype == 24) {
1600 if (numtype == 25) {
Log< level::Info, true > LogVerbatim
edm::EDGetTokenT< EEDigiCollection > EEdigiToken_
std::string digiProducer_
T getParameter(std::string const &) const
std::vector< time_t > fTimeLast
TString runtype(const Int_t &)
Int_t fChozenRunTypeNumber
EcnaAnalyzer(const edm::ParameterSet &)
TString GetDeeDirViewedFromIP(const Int_t &)
T const * product() const
std::vector< T >::const_iterator const_iterator
std::vector< Int_t > fNbOfTreatedFedsInStex
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::vector< Int_t > fFedNbOfTreatedEvents
std::vector< Int_t > fBuildEventDistribBad
std::vector< TString > fDateLast
std::array< Int_t, fMaxRunTypeCounter > fRunTypeCounter
static constexpr Int_t fMaxFedIdCounter
std::vector< Int_t > fStexDigiOK
std::string EBdigiCollection_
Int_t fMaxTreatedStexCounter
edm::EDGetTokenT< EcalRawDataCollection > eventHeaderToken_
unsigned long long Time_t
std::vector< time_t > fTimeFirst
Int_t Get1SCEchaFrom1DeeCrys(const Int_t &, const TString &)
Int_t fNbOfSelectedEvents
std::array< Int_t, fMaxFedIdCounter > fFedIdCounter
int ism() const
get the ECAL/SM id
edm::EDGetTokenT< EBDigiCollection > EBdigiToken_
std::vector< Int_t > fMemoDateFirstEvent
const_iterator begin() const
unsigned long long TimeValue_t
const_iterator end() const
const_iterator end() const
static constexpr Int_t fgMaxCar
std::vector< std::unique_ptr< TEcnaRun > > fMyCnaEBSM
std::array< Int_t, fMaxMgpaGainCounter > fMgpaGainCounter
TEcnaObject fMyEcnaEBObjectManager
std::vector< Int_t > fBuildEventDistribGood
std::vector< std::unique_ptr< TEcnaRun > > fMyCnaEEDee
std::string eventHeaderProducer_
std::vector< Int_t > fStexStatus
TEcnaObject fMyEcnaEEObjectManager
TEcnaNumbering fMyEENumbering
const_iterator begin() const
The iterator returned can not safely be used across threads.
std::vector< Int_t > fFedStatusOrder
static constexpr Int_t fMaxRunTypeCounter
std::vector< Int_t > fESFromFedTcc
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
std::vector< Int_t > fSMFromFedTcc
std::string eventHeaderCollection_
void analyze(const edm::Event &, const edm::EventSetup &) override
std::string EEdigiCollection_
std::vector< Int_t > fFedStatus
static constexpr Int_t fMaxMgpaGainCounter
std::vector< Int_t > fStexNbOfTreatedEvents
std::vector< TString > fDateFirst
std::vector< Int_t > fNbOfTreatedFedsInDee
TEcnaNumbering fMyEBNumbering
std::vector< Int_t > fFedDigiOK
uint16_t *__restrict__ uint16_t const *__restrict__ adc
std::vector< std::string > fDeeNumberString