41 verbosity_(pSet.getUntrackedParameter(
"verbosity", 1U)),
42 nChannels_(0), iEvent_(0)
49 std::cout <<
"*EcnaAnalyzer-constructor> Parameter initialization." << endl;
189 for(Int_t nFedTcc= 1; nFedTcc<=MaxSMAndDS; nFedTcc++){
fESFromFedTcc[nFedTcc-1] = -1;}
191 for(Int_t nFedTcc= 1;nFedTcc<= 3;nFedTcc++){
fESFromFedTcc[nFedTcc-1]=nFedTcc+ 6;}
192 for(Int_t nFedTcc= 4;nFedTcc<= 9;nFedTcc++){
fESFromFedTcc[nFedTcc-1]=nFedTcc- 3;}
194 for(Int_t nFedTcc=10;nFedTcc<=27;nFedTcc++){
fSMFromFedTcc[nFedTcc-1]=nFedTcc+ 9;}
195 for(Int_t nFedTcc=28;nFedTcc<=45;nFedTcc++){
fSMFromFedTcc[nFedTcc-1]=nFedTcc-27;}
197 for(Int_t nFedTcc=46;nFedTcc<=48;nFedTcc++){
fESFromFedTcc[nFedTcc-1]=nFedTcc-30;}
198 for(Int_t nFedTcc=49;nFedTcc<=54;nFedTcc++){
fESFromFedTcc[nFedTcc-1]=nFedTcc-39;}
352 std::cout <<
"*EcnaAnalyzer::EcnaAnalyzer-constructor> fStexName = " <<
fStexName << endl;
357 std::cout <<
"*EcnaAnalyzer::EcnaAnalyzer-constructor> Init done. " << endl;
368 cout << setiosflags(ios::showpoint | ios::uppercase);
369 cout << setprecision(3) << setw(6);
370 cout.setf(ios::dec, ios::basefield);
371 cout.setf(ios::fixed, ios::floatfield);
372 cout.setf(ios::left, ios::adjustfield);
373 cout.setf(ios::right, ios::adjustfield);
375 std::cout <<
"EcnaAnalyzer::~EcnaAnalyzer()> destructor is going to be executed." << endl;
384 std::cout << endl <<
"!EcnaAnalyzer-destructor> **** ERROR **** fMyCnaEBSM = " <<
fMyCnaEBSM
386 <<
", last event fFedId(+601) = " <<
fFedId+601 << endl
404 if(
fMyCnaEBSM[iSM]->WriteRootFile() == kFALSE )
406 std::cout <<
"!EcnaAnalyzer-destructor> PROBLEM with write ROOT file for SM" << iSM+1
412 std::cout <<
"*EcnaAnalyzer-destructor> Calculations and writing on file already done for SM "
424 <<
", last event fFedId(+601) = " <<
fFedId+601 << endl
444 std::cout <<
"!EcnaAnalyzer-destructor> PROBLEM with write ROOT file for Dee" << iDee+1
450 std::cout <<
"*EcnaAnalyzer-destructor> Calculations and writing on file already done for Dee "
459 std::cout <<
"*EcnaAnalyzer-destructor> Numbers of events with ERROR(S) returned by BuildEventDistributions(): "
462 std::cout << endl<<
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << endl;
464 std::cout <<
"*EcnaAnalyzer-destructor> Run types seen in event headers before selection:" << endl;
469 <<
" event header(s) with run type " <<
runtype(
i) << endl;
472 std::cout << endl<<
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << endl;
474 std::cout <<
"*EcnaAnalyzer-destructor> Mgpa gains seen in event headers before selection:" << endl;
479 <<
" event header(s) with gain " <<
gainvalue(
i) << endl;
482 std::cout << endl<<
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << endl;
484 std::cout <<
"*EcnaAnalyzer-destructor> Numbers of selected events for each FED:" << endl;
492 std::cout << endl<<
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << endl;
505 std::cout << endl<<
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << endl;
517 std::cout <<
"*EcnaAnalyzer-destructor> End of execution." << endl;
531 cout << setiosflags(ios::showpoint | ios::uppercase);
532 cout << setprecision(3) << setw(6);
533 cout.setf(ios::dec, ios::basefield);
534 cout.setf(ios::fixed, ios::floatfield);
535 cout.setf(ios::left, ios::adjustfield);
536 cout.setf(ios::right, ios::adjustfield);
543 if( iFreq <= 0 ){iFreq = 10000;}
552 myEventHeader = pEventHeader.product();
558 headerItr != myEventHeader->end();++headerItr)
562 fRunNumber = (Int_t)headerItr->getRunNumber();
566 fFedId = (Int_t)headerItr->fedId() - 601;
612 fFedTcc = (Int_t)headerItr->getDccInTCCCommand();
618 if( fFedTcc < 10 || fFedTcc > 45 )
return;
709 Int_t MaxNbOfStex = 0;
732 if( Int_t(digisEB->
end()-digisEB->
begin()) >= 0 &&
733 Int_t(digisEB->
end()-digisEB->
begin()) <= Int_t(digisEB->
size()) )
744 EBDetId id_crystal(digiItr->id());
747 Int_t i0SM = id_crystal.
ism() - 1;
757 std::cout <<
"*EcnaAnalyzer::analyze(...)> ********* INIT ECNA EB ********* " << endl
763 <<
" SM = " << i0SM+1 << endl
782 time_t i_current_ev_time = (time_t)(t_current_ev_time>>32);
783 const time_t* p_current_ev_time = &i_current_ev_time;
784 char* astime = ctime(p_current_ev_time);
788 <<
". First event date : " << astime << endl;
797 Int_t iEta = id_crystal.ietaSM();
798 Int_t iPhi = id_crystal.iphiSM();
805 Int_t NbOfSamplesFromDigis = digiItr->size();
809 if( NbOfSamplesFromDigis > 0 && NbOfSamplesFromDigis <= fMyEBEcal->MaxSampADC() )
811 Double_t adcDBLS = (Double_t)0;
815 for (Int_t i0Sample=0; i0Sample<3; i0Sample++)
816 {adcDBLS += (Double_t)(df.
sample(i0Sample).
adc());}
817 adcDBLS /= (Double_t)3;
820 for (Int_t i0Sample=0; i0Sample<
fNbOfSamples; i0Sample++)
822 Double_t
adc = (Double_t)(df.
sample(i0Sample).
adc()) - adcDBLS;
831 std::cout <<
"EcnaAnalyzer::analyze(...)> NbOfSamplesFromDigis out of bounds = "
832 << NbOfSamplesFromDigis << endl;
867 if( Int_t(digisEE->
end()-digisEE->
begin()) >= 0 &&
868 Int_t(digisEE->
end()-digisEE->
begin()) <= Int_t(digisEE->
size()) )
878 EEDetId id_crystal(digiItr->id());
880 Int_t iX_data = id_crystal.
ix();
881 Int_t iY_data = id_crystal.iy();
882 Int_t i_quad = id_crystal.iquadrant();
883 Int_t i_sgnZ = id_crystal.zside();
889 if( i_quad == 1 || i_quad == 4 ){iX = iX_data - 50;}
890 if( i_quad == 3 || i_quad == 2 ){iX = 51 - iX_data;}
895 Int_t n1DeeNumber = 0;
896 if( i_quad == 1 && i_sgnZ == 1 ){n1DeeNumber = 2;}
897 if( i_quad == 1 && i_sgnZ == -1 ){n1DeeNumber = 3;}
898 if( i_quad == 2 && i_sgnZ == 1 ){n1DeeNumber = 1;}
899 if( i_quad == 2 && i_sgnZ == -1 ){n1DeeNumber = 4;}
900 if( i_quad == 3 && i_sgnZ == 1 ){n1DeeNumber = 1;}
901 if( i_quad == 3 && i_sgnZ == -1 ){n1DeeNumber = 4;}
902 if( i_quad == 4 && i_sgnZ == 1 ){n1DeeNumber = 2;}
903 if( i_quad == 4 && i_sgnZ == -1 ){n1DeeNumber = 3;}
905 Int_t i0Dee = n1DeeNumber-1;
915 std::cout <<
"*EcnaAnalyzer::analyze(...)> ********* INIT ECNA EE ********* " << endl
921 <<
" Dee = " << i0Dee+1 << endl
928 Bool_t cOKForTreatment = kFALSE;
936 if( !(fESFromFedTcc[
fFedTcc-1] == 5 || fESFromFedTcc[
fFedTcc-1] == 14) )
946 cOKForTreatment = kTRUE;
949 if( fESFromFedTcc[
fFedTcc-1] == 5 || fESFromFedTcc[
fFedTcc-1] == 14 )
973 cOKForTreatment = kTRUE;
984 {cOKForTreatment = kTRUE;}
987 if( cOKForTreatment== kTRUE )
1000 time_t i_current_ev_time = (time_t)(t_current_ev_time>>32);
1001 const time_t* p_current_ev_time = &i_current_ev_time;
1002 char* astime = ctime(p_current_ev_time);
1005 std::cout <<
"----- beginning of analysis for " <<
fStexName << i0Dee+1 <<
"-------" << endl
1009 <<
" First event date = " << astime << endl
1011 <<
"---------------------------------------------------------------" << endl;
1022 Int_t NbOfSamplesFromDigis = digiItr->size();
1026 if( NbOfSamplesFromDigis > 0 && NbOfSamplesFromDigis <= fMyEEEcal->MaxSampADC() )
1028 Double_t adcDBLS = (Double_t)0;
1032 for (Int_t i0Sample=0; i0Sample<3; i0Sample++)
1033 {adcDBLS += (Double_t)(df.
sample(i0Sample).
adc());}
1034 adcDBLS /= (Double_t)3;
1037 for (Int_t i0Sample = 0; i0Sample <
fNbOfSamples; i0Sample++)
1039 Double_t
adc = (Double_t)(df.
sample(i0Sample).
adc()) - adcDBLS;
1048 std::cout <<
"EcnaAnalyzer::analyze(...)> NbOfSamplesFromDigis out of bounds = "
1049 << NbOfSamplesFromDigis << endl;
1122 for( Int_t i0FedES= 0; i0FedES<= 3; i0FedES++ )
1131 for( Int_t i0FedES= 5; i0FedES<= 8; i0FedES++ )
1135 for( Int_t i0FedES= 9; i0FedES<=12; i0FedES++ )
1144 for( Int_t i0FedES=14; i0FedES<=17; i0FedES++ )
1148 for( Int_t i0Dee=0; i0Dee<4; i0Dee++ )
1168 time_t i_current_ev_time = (time_t)(t_current_ev_time>>32);
1169 const time_t* p_current_ev_time = &i_current_ev_time;
1170 char* astime = ctime(p_current_ev_time);
1174 std::cout <<
"---------- End of analysis for " <<
fStexName << i0Stex+1 <<
" -----------" << endl;
1175 Int_t n3 = 3;
CheckMsg(n3, i0Stex);
1179 std::cout <<
" Last event date = " << astime << endl
1182 <<
"'s with " <<
fReqNbOfEvts <<
" events analyzed." << endl
1183 <<
"---------------------------------------------------------" << endl;
1199 if(
fMyCnaEBSM[i0Stex]->WriteRootFile() == kFALSE )
1201 std::cout <<
"!EcnaAnalyzer::analyze> PROBLEM with write ROOT file for SM" << i0Stex+1
1207 std::cout <<
"!EcnaAnalyzer::analyze> Set memory free: delete done for SM " << i0Stex+1 << endl;
1223 if(
fMyCnaEEDee[i0Stex]->WriteRootFile() == kFALSE )
1225 std::cout <<
"!EcnaAnalyzer::analyze> PROBLEM with write ROOT file for Dee" << i0Stex+1
1231 std::cout <<
"!EcnaAnalyzer::analyze> Set memory free: delete done for Dee " << i0Stex+1 << endl;
1235 std::cout <<
"*---------------------------------------------------------------------------- " << endl;
1248 if( s_opt ==
"EVT" )
1250 Int_t MaxNbOfStex = 0;
1261 <<
"**************************** ANALYSIS REPORT > OK **************************************" << endl
1262 <<
"*EcnaAnalyzer::AnalysisOutcome(...)> The maximum requested number of events and the maximum" << endl
1264 <<
"'s have been reached." << endl
1265 <<
" Analysis successfully ended from EcnaAnalyzer " << endl
1266 <<
" by SIGNAL: kill(getpid(),SIGUSR2)." << endl
1268 <<
" Last requested event number = " <<
fLastReqEvent << endl
1273 std::cout <<
"****************************************************************************************" << endl
1277 kill(getpid(),SIGUSR2);
1285 <<
"**************************** ANALYSIS REPORT >>> *** WARNING *** WARNING *** WARNING ***" << endl
1286 <<
"*EcnaAnalyzer::AnalysisOutcome(...)> Last event reached before completion of analysis." << endl
1287 <<
" Analysis ended from EcnaAnalyzer " << endl
1288 <<
" by SIGNAL: kill(getpid(),SIGUSR2)." << endl
1290 <<
" Last requested event number = " <<
fLastReqEvent << endl
1295 std::cout <<
"****************************************************************************************" << endl
1299 kill(getpid(),SIGUSR2);
1304 if( s_opt ==
"ERR_FNEG" )
1307 <<
"**************************** ANALYSIS REPORT >>> **** ERROR **** ERROR **** ERROR ******" << endl
1308 <<
"*EcnaAnalyzer::AnalysisOutcome(...)> First event number = " <<
fFirstReqEvent
1309 <<
". Should be strictly potitive." << endl
1310 <<
" Analysis ended from EcnaAnalyzer " << endl
1311 <<
" by SIGNAL: kill(getpid(),SIGUSR2)." << endl;
1313 std::cout <<
"****************************************************************************************" << endl
1317 kill(getpid(),SIGUSR2);
1319 if( s_opt ==
"ERR_LREQ" )
1322 <<
"**************************** ANALYSIS REPORT >>> **** ERROR **** ERROR **** ERROR ******" << endl
1323 <<
"*EcnaAnalyzer::analyze(...)> Requested number of events = " <<
fReqNbOfEvts <<
"." << endl
1324 <<
" Too large compared to the event range: "
1326 <<
" Analysis ended from EcnaAnalyzer " << endl
1327 <<
" by SIGNAL: kill(getpid(),SIGUSR2)." << endl;
1329 std::cout <<
"****************************************************************************************" << endl
1333 kill(getpid(),SIGUSR2);
1340 {Int_t nm1 = -1;
CheckMsg(MsgNum, nm1);}
1347 {
std::cout <<
"---------------- CROSS-CHECK A ------------------ " << endl
1348 <<
"**************** CURRENT EVENT ****************** " << endl;}
1350 {
std::cout <<
"---------------- CROSS-CHECK B ------------------ " << endl
1351 <<
"**** FIRST EVENT PASSING USER'S ANALYSIS CUT **** " << endl;}
1353 {
std::cout <<
"---------------- CROSS-CHECK C ------------------ " << endl
1354 <<
"*** CURRENT VALUES BEFORE RESULT FILE WRITING *** " << endl;}
1355 if( MsgNum == 3 || MsgNum == 4 )
1364 <<
" fFedTcc = " <<
fFedTcc << endl
1365 <<
" fFedId(+601) = " <<
fFedId+601 << endl
1381 << setw(5) << nStexNbOfTreatedEvents <<
" events. "
1383 if( j0Stex == i0Stex ){
std::cout <<
" (going to write file for this " <<
fStexName <<
").";}
1396 std::cout <<
"Fed (ES) " << setw(3) << i0FedES+1 <<
": "
1397 << setw(5) << nFedNbOfTreatedEvents <<
" events."
1412 if( j0Stex == i0Stex ){
std::cout <<
" (going to write file for this " <<
fStexName <<
").";}
1421 if( MsgNum == 1 || MsgNum == 2 )
1422 {
std::cout <<
"*---------------------------------------------------------------------------- " << endl;}
1424 {
std::cout <<
"*............................................................................ " << endl;}
1430 TString cType =
"?";
1432 if( numtype == 0 ){cType =
"COSMICS";}
1433 if( numtype == 1 ){cType =
"BEAMH4";}
1434 if( numtype == 2 ){cType =
"BEAMH2";}
1435 if( numtype == 3 ){cType =
"MTCC";}
1436 if( numtype == 4 ){cType =
"LASER_STD";}
1437 if( numtype == 5 ){cType =
"LASER_POWER_SCAN";}
1438 if( numtype == 6 ){cType =
"LASER_DELAY_SCAN";}
1439 if( numtype == 7 ){cType =
"TESTPULSE_SCAN_MEM";}
1440 if( numtype == 8 ){cType =
"TESTPULSE_MGPA";}
1441 if( numtype == 9 ){cType =
"PEDESTAL_STD";}
1442 if( numtype == 10 ){cType =
"PEDESTAL_OFFSET_SCAN";}
1443 if( numtype == 11 ){cType =
"PEDESTAL_25NS_SCAN";}
1444 if( numtype == 12 ){cType =
"LED_STD";}
1446 if( numtype == 13 ){cType =
"PHYSICS_GLOBAL";}
1447 if( numtype == 14 ){cType =
"COSMICS_GLOBAL";}
1448 if( numtype == 15 ){cType =
"HALO_GLOBAL";}
1450 if( numtype == 16 ){cType =
"LASER_GAP";}
1451 if( numtype == 17 ){cType =
"TESTPULSE_GAP";}
1452 if( numtype == 18 ){cType =
"PEDESTAL_GAP";}
1453 if( numtype == 19 ){cType =
"LED_GAP";}
1455 if( numtype == 20 ){cType =
"PHYSICS_LOCAL";}
1456 if( numtype == 21 ){cType =
"COSMICS_LOCAL";}
1457 if( numtype == 22 ){cType =
"HALO_LOCAL";}
1458 if( numtype == 23 ){cType =
"CALIB_LOCAL";}
1460 if( numtype == 24 ){cType =
"PEDSIM";}
1469 if( numgain == 1 ){value = 12;}
1470 if( numgain == 2 ){value = 6;}
1471 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
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
TString runtype(const Int_t &)
Int_t fChozenRunTypeNumber
EcnaAnalyzer(const edm::ParameterSet &)
Int_t fMaxMgpaGainCounter
TString GetDeeDirViewedFromIP(const Int_t &)
Int_t Get1DeeSCEcnaFrom1DeeCrys(const Int_t &, const TString)
std::vector< T >::const_iterator const_iterator
EcalMGPASample sample(int i) const
Int_t * fFedNbOfTreatedEvents
TEcnaNumbering * fMyEENumbering
const_iterator begin() const
Int_t Get0TowEchaFrom1SMCrys(const Int_t &)
string eventHeaderCollection_
Int_t gainvalue(const Int_t &)
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
Bool_t AnalysisOutcome(const TString)
Int_t fMaxTreatedStexCounter
unsigned long long Time_t
Int_t Get1SCEchaFrom1DeeCrys(const Int_t &, const TString)
void GetReadyToReadData(TString, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &)
string eventHeaderProducer_
Int_t fNbOfSelectedEvents
TEcnaNumbering * fMyEBNumbering
unsigned long long TimeValue_t
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Int_t * fNbOfTreatedFedsInStex
TimeValue_t value() const
T const * product() const
TString * fDeeNumberString
const_iterator end() const
virtual void analyze(const edm::Event &, const edm::EventSetup &)
void StartStopDate(TString, TString)
Int_t * fMemoDateFirstEvent
void StartStopTime(time_t, time_t)
edm::Timestamp time() const
int adc() const
get the ADC sample (12 bits)
Int_t * fNbOfTreatedFedsInDee