44 verbosity_(pSet.getUntrackedParameter(
"verbosity", 1U)),
45 nChannels_(0), iEvent_(0)
58 std::cout <<
"*EcnaAnalyzer-constructor> Check path for resultsq Root files." << std::endl;
60 if( myPathEB->GetPathForResultsRootFiles() == kFALSE )
62 std::cout <<
"*EcnaAnalyzer-constructor> *** ERROR *** Path for result files not found." << std::endl;
63 kill(getpid(),SIGUSR2);
67 std::cout <<
"*EcnaAnalyzer-constructor> Path for result files found = " << myPathEB->ResultsRootFilePath() << std::endl;
70 if( myPathEE->GetPathForResultsRootFiles() == kFALSE )
72 std::cout <<
"*EcnaAnalyzer-constructor> *** ERROR *** Path for result files not found." << std::endl;
73 kill(getpid(),SIGUSR2);
77 std::cout <<
"*EcnaAnalyzer-constructor> Path for result files found = " << myPathEE->ResultsRootFilePath() << std::endl;
81 std::cout <<
"*EcnaAnalyzer-constructor> Parameter initialization." << std::endl;
220 for(Int_t nFedTcc= 1; nFedTcc<=MaxSMAndDS; nFedTcc++){
fESFromFedTcc[nFedTcc-1] = -1;}
222 for(Int_t nFedTcc= 1;nFedTcc<= 3;nFedTcc++){
fESFromFedTcc[nFedTcc-1]=nFedTcc+ 6;}
223 for(Int_t nFedTcc= 4;nFedTcc<= 9;nFedTcc++){
fESFromFedTcc[nFedTcc-1]=nFedTcc- 3;}
225 for(Int_t nFedTcc=10;nFedTcc<=27;nFedTcc++){
fSMFromFedTcc[nFedTcc-1]=nFedTcc+ 9;}
226 for(Int_t nFedTcc=28;nFedTcc<=45;nFedTcc++){
fSMFromFedTcc[nFedTcc-1]=nFedTcc-27;}
228 for(Int_t nFedTcc=46;nFedTcc<=48;nFedTcc++){
fESFromFedTcc[nFedTcc-1]=nFedTcc-30;}
229 for(Int_t nFedTcc=49;nFedTcc<=54;nFedTcc++){
fESFromFedTcc[nFedTcc-1]=nFedTcc-39;}
389 std::cout <<
"*EcnaAnalyzer::EcnaAnalyzer-constructor> fNbOfSamples = " <<
fNbOfSamples << std::endl;
392 std::cout <<
"*EcnaAnalyzer::EcnaAnalyzer-constructor> fReqNbOfEvts = " <<
fReqNbOfEvts << std::endl;
393 std::cout <<
"*EcnaAnalyzer::EcnaAnalyzer-constructor> fStexName = " <<
fStexName << std::endl;
394 std::cout <<
"*EcnaAnalyzer::EcnaAnalyzer-constructor> fStexNumber = " <<
fStexNumber << std::endl;
398 std::cout <<
"*EcnaAnalyzer::EcnaAnalyzer-constructor> Init done. " << std::endl;
409 cout << setiosflags(ios::showpoint | ios::uppercase);
410 cout << setprecision(3) << setw(6);
411 cout.setf(ios::dec, ios::basefield);
412 cout.setf(ios::fixed, ios::floatfield);
413 cout.setf(ios::left, ios::adjustfield);
414 cout.setf(ios::right, ios::adjustfield);
416 std::cout <<
"EcnaAnalyzer::~EcnaAnalyzer()> destructor is going to be executed." << std::endl;
425 std::cout << std::endl <<
"!EcnaAnalyzer-destructor> **** ERROR **** fMyCnaEBSM = " <<
fMyCnaEBSM
427 <<
", last event fFedId(+601) = " <<
fFedId+601 << std::endl
445 if(
fMyCnaEBSM[iSM]->WriteRootFile() == kFALSE )
447 std::cout <<
"!EcnaAnalyzer-destructor> PROBLEM with write ROOT file for SM" << iSM+1
453 std::cout <<
"*EcnaAnalyzer-destructor> Calculations and writing on file already done for SM "
454 << iSM+1 << std::endl;
463 std::cout << std::endl <<
"!EcnaAnalyzer-destructor> **** ERROR **** fMyCnaEEDee = " <<
fMyCnaEEDee
465 <<
", last event fFedId(+601) = " <<
fFedId+601 << std::endl
485 std::cout <<
"!EcnaAnalyzer-destructor> PROBLEM with write ROOT file for Dee" << iDee+1
491 std::cout <<
"*EcnaAnalyzer-destructor> Calculations and writing on file already done for Dee "
492 << iDee+1 << std::endl;
501 std::cout <<
"*EcnaAnalyzer-destructor> Status of events returned by GetSampleAdcValues(): "
508 if( fBuildEventDistribBad[i0Stex] > 0 )
513 std::cout << std::endl<<
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << std::endl;
515 std::cout <<
"*EcnaAnalyzer-destructor> Run types seen in event headers before selection:" << std::endl;
520 <<
" event header(s) with run type " <<
runtype(
i) << std::endl;
523 std::cout << std::endl<<
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << std::endl;
525 std::cout <<
"*EcnaAnalyzer-destructor> Mgpa gains seen in event headers before selection:" << std::endl;
530 <<
" event header(s) with gain " <<
gainvalue(
i) << std::endl;
533 std::cout << std::endl<<
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << std::endl;
535 std::cout <<
"*EcnaAnalyzer-destructor> Numbers of selected events for each FED:" << std::endl;
543 std::cout << std::endl<<
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << std::endl;
556 std::cout << std::endl<<
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << std::endl;
566 std::cout <<
"*EcnaAnalyzer-destructor> End of execution." << std::endl;
580 cout << setiosflags(ios::showpoint | ios::uppercase);
581 cout << setprecision(3) << setw(6);
582 cout.setf(ios::dec, ios::basefield);
583 cout.setf(ios::fixed, ios::floatfield);
584 cout.setf(ios::left, ios::adjustfield);
585 cout.setf(ios::right, ios::adjustfield);
592 if( iFreq <= 0 ){iFreq = 10000;}
601 myEventHeader = pEventHeader.product();
607 headerItr != myEventHeader->end();++headerItr)
611 fRunNumber = (Int_t)headerItr->getRunNumber();
615 fFedId = (Int_t)headerItr->fedId() - 601;
661 fFedTcc = (Int_t)headerItr->getDccInTCCCommand();
667 if( fFedTcc < 10 || fFedTcc > 45 )
return;
712 Int_t MaxNbOfStex = 0;
735 if( Int_t(digisEB->
end()-digisEB->
begin()) >= 0 &&
736 Int_t(digisEB->
end()-digisEB->
begin()) <= Int_t(digisEB->
size()) )
747 EBDetId id_crystal(digiItr->id());
750 Int_t i0SM = id_crystal.
ism() - 1;
762 std::cout <<
"*EcnaAnalyzer::analyze(...)> ********* INIT ECNA EB ********* " << std::endl
764 <<
" fRunNumber = " <<
fRunNumber << std::endl
768 <<
" SM = " << i0SM+1 << std::endl
784 time_t i_current_ev_time = (time_t)(t_current_ev_time>>32);
785 const time_t* p_current_ev_time = &i_current_ev_time;
786 char* astime = ctime(p_current_ev_time);
797 <<
". First analyzed event date : " << astime << std::endl;
805 if( i_current_ev_time >
fTimeLast[i0SM] )
811 Int_t iEta = id_crystal.ietaSM();
812 Int_t iPhi = id_crystal.iphiSM();
819 Int_t NbOfSamplesFromDigis = digiItr->size();
823 if( NbOfSamplesFromDigis > 0 && NbOfSamplesFromDigis <= fMyEBEcal->MaxSampADC() )
825 Double_t adcDBLS = (Double_t)0;
829 for (Int_t i0Sample=0; i0Sample<3; i0Sample++)
830 {adcDBLS += (Double_t)(df.
sample(i0Sample).
adc());}
831 adcDBLS /= (Double_t)3;
834 for (Int_t i0Sample=0; i0Sample<
fNbOfSamples; i0Sample++)
836 Double_t
adc = (Double_t)(df.
sample(i0Sample).
adc()) - adcDBLS;
851 std::cout <<
"EcnaAnalyzer::analyze(...)> NbOfSamplesFromDigis out of bounds = "
852 << NbOfSamplesFromDigis << std::endl;
887 if( Int_t(digisEE->
end()-digisEE->
begin()) >= 0 &&
888 Int_t(digisEE->
end()-digisEE->
begin()) <= Int_t(digisEE->
size()) )
898 EEDetId id_crystal(digiItr->id());
900 Int_t iX_data = id_crystal.
ix();
901 Int_t iY_data = id_crystal.iy();
902 Int_t i_quad = id_crystal.iquadrant();
903 Int_t i_sgnZ = id_crystal.zside();
909 if( i_quad == 1 || i_quad == 4 ){iX = iX_data - 50;}
910 if( i_quad == 3 || i_quad == 2 ){iX = 51 - iX_data;}
915 Int_t n1DeeNumber = 0;
916 if( i_quad == 1 && i_sgnZ == 1 ){n1DeeNumber = 2;}
917 if( i_quad == 1 && i_sgnZ == -1 ){n1DeeNumber = 3;}
918 if( i_quad == 2 && i_sgnZ == 1 ){n1DeeNumber = 1;}
919 if( i_quad == 2 && i_sgnZ == -1 ){n1DeeNumber = 4;}
920 if( i_quad == 3 && i_sgnZ == 1 ){n1DeeNumber = 1;}
921 if( i_quad == 3 && i_sgnZ == -1 ){n1DeeNumber = 4;}
922 if( i_quad == 4 && i_sgnZ == 1 ){n1DeeNumber = 2;}
923 if( i_quad == 4 && i_sgnZ == -1 ){n1DeeNumber = 3;}
925 Int_t i0Dee = n1DeeNumber-1;
937 std::cout <<
"*EcnaAnalyzer::analyze(...)> ********* INIT ECNA EE ********* " << std::endl
939 <<
" fRunNumber = " <<
fRunNumber << std::endl
943 <<
" Dee = " << i0Dee+1 << std::endl
951 Bool_t cOKForTreatment = kFALSE;
959 if( !(fESFromFedTcc[
fFedTcc-1] == 5 || fESFromFedTcc[
fFedTcc-1] == 14) )
969 cOKForTreatment = kTRUE;
972 if( fESFromFedTcc[
fFedTcc-1] == 5 || fESFromFedTcc[
fFedTcc-1] == 14 )
996 cOKForTreatment = kTRUE;
1007 {cOKForTreatment = kTRUE;}
1010 if( cOKForTreatment== kTRUE )
1015 time_t i_current_ev_time = (time_t)(t_current_ev_time>>32);
1016 const time_t* p_current_ev_time = &i_current_ev_time;
1017 char* astime = ctime(p_current_ev_time);
1031 std::cout <<
"----- beginning of analysis for " <<
fStexName << i0Dee+1 <<
"-------" << std::endl
1035 <<
" First event date = " << astime << std::endl
1037 <<
"---------------------------------------------------------------" << std::endl;
1043 if( i_current_ev_time >
fTimeLast[i0Dee] )
1053 Int_t NbOfSamplesFromDigis = digiItr->size();
1057 if( NbOfSamplesFromDigis > 0 && NbOfSamplesFromDigis <= fMyEEEcal->MaxSampADC() )
1059 Double_t adcDBLS = (Double_t)0;
1063 for (Int_t i0Sample=0; i0Sample<3; i0Sample++)
1064 {adcDBLS += (Double_t)(df.
sample(i0Sample).
adc());}
1065 adcDBLS /= (Double_t)3;
1068 for (Int_t i0Sample = 0; i0Sample <
fNbOfSamples; i0Sample++)
1070 Double_t
adc = (Double_t)(df.
sample(i0Sample).
adc()) - adcDBLS;
1085 std::cout <<
"EcnaAnalyzer::analyze(...)> NbOfSamplesFromDigis out of bounds = "
1086 << NbOfSamplesFromDigis << std::endl;
1160 for( Int_t i0FedES= 0; i0FedES<= 3; i0FedES++ )
1169 for( Int_t i0FedES= 5; i0FedES<= 8; i0FedES++ )
1173 for( Int_t i0FedES= 9; i0FedES<=12; i0FedES++ )
1182 for( Int_t i0FedES=14; i0FedES<=17; i0FedES++ )
1186 for( Int_t i0Dee=0; i0Dee<4; i0Dee++ )
1215 std::cout <<
"---------- End of analysis for " <<
fStexName << i0Stex+1 <<
" -----------" << std::endl;
1216 Int_t n3 = 3;
CheckMsg(n3, i0Stex);
1223 <<
"'s with " <<
fReqNbOfEvts <<
" events analyzed." << std::endl
1224 <<
"---------------------------------------------------------" << std::endl;
1240 if(
fMyCnaEBSM[i0Stex]->WriteRootFile() == kFALSE )
1242 std::cout <<
"!EcnaAnalyzer::analyze> PROBLEM with write ROOT file for SM" << i0Stex+1
1248 std::cout <<
"!EcnaAnalyzer::analyze> Set memory free: delete done for SM " << i0Stex+1 << std::endl;
1264 if(
fMyCnaEEDee[i0Stex]->WriteRootFile() == kFALSE )
1266 std::cout <<
"!EcnaAnalyzer::analyze> PROBLEM with write ROOT file for Dee" << i0Stex+1
1272 std::cout <<
"!EcnaAnalyzer::analyze> Set memory free: delete done for Dee " << i0Stex+1 << std::endl;
1276 std::cout <<
"*---------------------------------------------------------------------------- " << std::endl;
1289 if( s_opt ==
"EVT" )
1291 Int_t MaxNbOfStex = 0;
1302 <<
"**************************** ANALYSIS REPORT > OK **************************************" << std::endl
1303 <<
"*EcnaAnalyzer::AnalysisOutcome(...)> The maximum requested number of events and the maximum" << std::endl
1305 <<
"'s have been reached." << std::endl
1306 <<
" Analysis successfully ended from EcnaAnalyzer " << std::endl
1307 <<
" by SIGNAL: kill(getpid(),SIGUSR2)." << std::endl
1309 <<
" Last requested event number = " <<
fLastReqEvent << std::endl
1314 std::cout <<
"****************************************************************************************" << std::endl
1318 kill(getpid(),SIGUSR2);
1326 <<
"**************************** ANALYSIS REPORT >>> *** WARNING *** WARNING *** WARNING ***" << std::endl
1327 <<
"*EcnaAnalyzer::AnalysisOutcome(...)> Last event reached before completion of analysis." << std::endl
1328 <<
" Analysis ended from EcnaAnalyzer " << std::endl
1329 <<
" by SIGNAL: kill(getpid(),SIGUSR2)." << std::endl
1331 <<
" Last requested event number = " <<
fLastReqEvent << std::endl
1336 std::cout <<
"****************************************************************************************" << std::endl
1340 kill(getpid(),SIGUSR2);
1345 if( s_opt ==
"ERR_FNEG" )
1348 <<
"**************************** ANALYSIS REPORT >>> **** ERROR **** ERROR **** ERROR ******" << std::endl
1349 <<
"*EcnaAnalyzer::AnalysisOutcome(...)> First event number = " <<
fFirstReqEvent
1350 <<
". Should be strictly potitive." << std::endl
1351 <<
" Analysis ended from EcnaAnalyzer " << std::endl
1352 <<
" by SIGNAL: kill(getpid(),SIGUSR2)." << std::endl;
1354 std::cout <<
"****************************************************************************************" << std::endl
1358 kill(getpid(),SIGUSR2);
1360 if( s_opt ==
"ERR_LREQ" )
1363 <<
"**************************** ANALYSIS REPORT >>> **** ERROR **** ERROR **** ERROR ******" << std::endl
1364 <<
"*EcnaAnalyzer::analyze(...)> Requested number of events = " <<
fReqNbOfEvts <<
"." << std::endl
1365 <<
" Too large compared to the event range: "
1367 <<
" Analysis ended from EcnaAnalyzer " << std::endl
1368 <<
" by SIGNAL: kill(getpid(),SIGUSR2)." << std::endl;
1370 std::cout <<
"****************************************************************************************" << std::endl
1374 kill(getpid(),SIGUSR2);
1381 {Int_t nm1 = -1;
CheckMsg(MsgNum, nm1);}
1388 {
std::cout <<
"---------------- CROSS-CHECK A ------------------ " << std::endl
1389 <<
"**************** CURRENT EVENT ****************** " << std::endl;}
1391 {
std::cout <<
"---------------- CROSS-CHECK B ------------------ " << std::endl
1392 <<
"**** FIRST EVENT PASSING USER'S ANALYSIS CUT **** " << std::endl;}
1394 {
std::cout <<
"---------------- CROSS-CHECK C ------------------ " << std::endl
1395 <<
"*** CURRENT VALUES BEFORE RESULT FILE WRITING *** " << std::endl;}
1396 if( MsgNum == 3 || MsgNum == 4 )
1398 <<
" fEvtNumber = " <<
fEvtNumber << std::endl;}
1402 <<
" fRunNumber = " <<
fRunNumber << std::endl
1405 <<
" fFedTcc = " <<
fFedTcc << std::endl
1406 <<
" fFedId(+601) = " <<
fFedId+601 << std::endl
1407 <<
" fStexName = " <<
fStexName << std::endl
1422 << std::setw(5) << nStexNbOfTreatedEvents <<
" events. "
1424 if( j0Stex == i0Stex ){
std::cout <<
" (going to write file for this " <<
fStexName <<
").";}
1437 std::cout <<
"Fed (ES) " << std::setw(3) << i0FedES+1 <<
": "
1438 << std::setw(5) << nFedNbOfTreatedEvents <<
" events."
1449 if( j0Stex == i0Stex ){
std::cout <<
" (going to write file for this " <<
fStexName <<
").";}
1458 if( MsgNum == 1 || MsgNum == 2 )
1459 {
std::cout <<
"*---------------------------------------------------------------------------- " << std::endl;}
1461 {
std::cout <<
"*............................................................................ " << std::endl;}
1467 TString cType =
"?";
1469 if( numtype == 0 ){cType =
"COSMICS";}
1470 if( numtype == 1 ){cType =
"BEAMH4";}
1471 if( numtype == 2 ){cType =
"BEAMH2";}
1472 if( numtype == 3 ){cType =
"MTCC";}
1473 if( numtype == 4 ){cType =
"LASER_STD";}
1474 if( numtype == 5 ){cType =
"LASER_POWER_SCAN";}
1475 if( numtype == 6 ){cType =
"LASER_DELAY_SCAN";}
1476 if( numtype == 7 ){cType =
"TESTPULSE_SCAN_MEM";}
1477 if( numtype == 8 ){cType =
"TESTPULSE_MGPA";}
1478 if( numtype == 9 ){cType =
"PEDESTAL_STD";}
1479 if( numtype == 10 ){cType =
"PEDESTAL_OFFSET_SCAN";}
1480 if( numtype == 11 ){cType =
"PEDESTAL_25NS_SCAN";}
1481 if( numtype == 12 ){cType =
"LED_STD";}
1483 if( numtype == 13 ){cType =
"PHYSICS_GLOBAL";}
1484 if( numtype == 14 ){cType =
"COSMICS_GLOBAL";}
1485 if( numtype == 15 ){cType =
"HALO_GLOBAL";}
1487 if( numtype == 16 ){cType =
"LASER_GAP";}
1488 if( numtype == 17 ){cType =
"TESTPULSE_GAP";}
1489 if( numtype == 18 ){cType =
"PEDESTAL_GAP";}
1490 if( numtype == 19 ){cType =
"LED_GAP";}
1492 if( numtype == 20 ){cType =
"PHYSICS_LOCAL";}
1493 if( numtype == 21 ){cType =
"COSMICS_LOCAL";}
1494 if( numtype == 22 ){cType =
"HALO_LOCAL";}
1495 if( numtype == 23 ){cType =
"CALIB_LOCAL";}
1497 if( numtype == 24 ){cType =
"PEDSIM";}
1506 if( numgain == 1 ){value = 12;}
1507 if( numgain == 2 ){value = 6;}
1508 if( numgain == 3 ){value = 1;}
int adc(sample_type sample)
get the ADC sample (12 bits)
T getParameter(std::string const &) const
EventNumber_t event() const
Int_t * fStexNbOfTreatedEvents
std::string digiProducer_
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
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 &)
std::vector< EcalDCCHeaderBlock >::const_iterator const_iterator
EcalMGPASample sample(int i) const
Int_t * fFedNbOfTreatedEvents
TEcnaNumbering * fMyEENumbering
const_iterator begin() const
Int_t Get0TowEchaFrom1SMCrys(const Int_t &)
Int_t gainvalue(const Int_t &)
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 &)
int ism() const
get the ECAL/SM id
std::string EBdigiCollection_
Int_t fMaxTreatedStexCounter
unsigned long long Time_t
Int_t Get1SCEchaFrom1DeeCrys(const Int_t &, const TString &)
Int_t fNbOfSelectedEvents
TEcnaNumbering * fMyEBNumbering
Int_t * fBuildEventDistribGood
unsigned long long TimeValue_t
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Int_t * fNbOfTreatedFedsInStex
std::string eventHeaderProducer_
T const * product() const
TString * fDeeNumberString
const_iterator end() const
std::string eventHeaderCollection_
virtual void analyze(const edm::Event &, const edm::EventSetup &)
std::string EEdigiCollection_
Int_t * fMemoDateFirstEvent
void StartStopTime(time_t, time_t)
TimeValue_t value() const
TEcnaObject * fMyEcnaEBObjectManager
edm::Timestamp time() const
TEcnaObject * fMyEcnaEEObjectManager
int adc() const
get the ADC sample (12 bits)
void StartStopDate(const TString &, const TString &)
Int_t * fNbOfTreatedFedsInDee