File indexing completed on 2021-12-03 23:51:39
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisModules/interface/EcnaAnalyzer.h"
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 EcnaAnalyzer::EcnaAnalyzer(const edm::ParameterSet &pSet)
0044 : verbosity_(pSet.getUntrackedParameter("verbosity", 1U)), nChannels_(0), iEvent_(0) {
0045
0046
0047 using namespace edm;
0048 using namespace std;
0049
0050 fMyEcnaEBObjectManager = new TEcnaObject();
0051 fMyEcnaEEObjectManager = new TEcnaObject();
0052
0053 TEcnaParPaths *myPathEB = new TEcnaParPaths(fMyEcnaEBObjectManager);
0054 TEcnaParPaths *myPathEE = new TEcnaParPaths(fMyEcnaEEObjectManager);
0055
0056 std::cout << "*EcnaAnalyzer-constructor> Check path for resultsq Root files." << std::endl;
0057
0058 if (myPathEB->GetPathForResultsRootFiles() == kFALSE) {
0059 std::cout << "*EcnaAnalyzer-constructor> *** ERROR *** Path for result "
0060 "files not found."
0061 << std::endl;
0062 kill(getpid(), SIGUSR2);
0063 } else {
0064 std::cout << "*EcnaAnalyzer-constructor> Path for result files found = " << myPathEB->ResultsRootFilePath()
0065 << std::endl;
0066 }
0067
0068 if (myPathEE->GetPathForResultsRootFiles() == kFALSE) {
0069 std::cout << "*EcnaAnalyzer-constructor> *** ERROR *** Path for result "
0070 "files not found."
0071 << std::endl;
0072 kill(getpid(), SIGUSR2);
0073 } else {
0074 std::cout << "*EcnaAnalyzer-constructor> Path for result files found = " << myPathEE->ResultsRootFilePath()
0075 << std::endl;
0076 }
0077
0078 std::cout << "*EcnaAnalyzer-constructor> Parameter initialization." << std::endl;
0079
0080 fgMaxCar = (Int_t)512;
0081 fTTBELL = '\007';
0082 fOutcomeError = kFALSE;
0083
0084 fMyEBEcal = new TEcnaParEcal(fMyEcnaEBObjectManager, "EB");
0085 fMyEBNumbering = new TEcnaNumbering(fMyEcnaEBObjectManager, "EB");
0086
0087 fMyEEEcal = new TEcnaParEcal(fMyEcnaEEObjectManager, "EE");
0088 fMyEENumbering = new TEcnaNumbering(fMyEcnaEEObjectManager, "EE");
0089
0090
0091
0092 eventHeaderProducer_ = pSet.getParameter<std::string>("eventHeaderProducer");
0093 digiProducer_ = pSet.getParameter<std::string>("digiProducer");
0094
0095 eventHeaderCollection_ = pSet.getParameter<std::string>("eventHeaderCollection");
0096 EBdigiCollection_ = pSet.getParameter<std::string>("EBdigiCollection");
0097 EEdigiCollection_ = pSet.getParameter<std::string>("EEdigiCollection");
0098
0099 sAnalysisName_ = pSet.getParameter<std::string>("sAnalysisName");
0100 sNbOfSamples_ = pSet.getParameter<std::string>("sNbOfSamples");
0101 sFirstReqEvent_ = pSet.getParameter<std::string>("sFirstReqEvent");
0102 sLastReqEvent_ = pSet.getParameter<std::string>("sLastReqEvent");
0103 sReqNbOfEvts_ = pSet.getParameter<std::string>("sReqNbOfEvts");
0104 sStexName_ = pSet.getParameter<std::string>("sStexName");
0105 sStexNumber_ = pSet.getParameter<std::string>("sStexNumber");
0106
0107 fAnalysisName = sAnalysisName_.Data();
0108 fNbOfSamples = atoi(sNbOfSamples_.Data());
0109 fFirstReqEvent = atoi(sFirstReqEvent_.Data());
0110 fLastReqEvent = atoi(sLastReqEvent_.Data());
0111 fReqNbOfEvts = atoi(sReqNbOfEvts_.Data());
0112 fStexName = sStexName_.Data();
0113 fStexNumber = atoi(sStexNumber_.Data());
0114
0115
0116 if (fFirstReqEvent < 1) {
0117 fOutcomeError = AnalysisOutcome("ERR_FNEG");
0118 }
0119
0120 if ((fLastReqEvent >= fFirstReqEvent) && (fReqNbOfEvts > fLastReqEvent - fFirstReqEvent + 1)) {
0121 fOutcomeError = AnalysisOutcome("ERR_LREQ");
0122 }
0123
0124 if (fOutcomeError == kTRUE)
0125 return;
0126
0127
0128 fRunTypeCounter = nullptr;
0129 fMaxRunTypeCounter = 26;
0130 fRunTypeCounter = new Int_t[fMaxRunTypeCounter];
0131 for (Int_t i = 0; i < fMaxRunTypeCounter; i++) {
0132 fRunTypeCounter[i] = 0;
0133 }
0134
0135 fMgpaGainCounter = nullptr;
0136 fMaxMgpaGainCounter = 4;
0137 fMgpaGainCounter = new Int_t[fMaxMgpaGainCounter];
0138 for (Int_t i = 0; i < fMaxMgpaGainCounter; i++) {
0139 fMgpaGainCounter[i] = 0;
0140 }
0141
0142 fFedIdCounter = nullptr;
0143 fMaxFedIdCounter = 54;
0144 fFedIdCounter = new Int_t[fMaxFedIdCounter];
0145 for (Int_t i = 0; i < fMaxFedIdCounter; i++) {
0146 fFedIdCounter[i] = 0;
0147 }
0148
0149 fEvtNumber = 0;
0150 fEvtNumberMemo = -1;
0151 fRecNumber = 0;
0152
0153 fDeeDS5Memo1 = 0;
0154 fDeeDS5Memo2 = 0;
0155
0156 fCurrentEventNumber = 0;
0157 fNbOfSelectedEvents = 0;
0158
0159 fMemoCutOK = 0;
0160 fTreatedFedOrder = 0;
0161 fNbOfTreatedStexs = 0;
0162
0163
0164 if (fStexName == "SM") {
0165 fMaxFedUnitCounter = fMyEBEcal->MaxSMInEB();
0166 }
0167 if (fStexName == "Dee") {
0168 fMaxFedUnitCounter = fMyEEEcal->MaxDSInEE();
0169 }
0170
0171 fFedDigiOK = new Int_t[fMaxFedUnitCounter];
0172 for (Int_t i = 0; i < fMaxFedUnitCounter; i++) {
0173 fFedDigiOK[i] = 0;
0174 }
0175
0176 fFedNbOfTreatedEvents = new Int_t[fMaxFedUnitCounter];
0177 for (Int_t i = 0; i < fMaxFedUnitCounter; i++) {
0178 fFedNbOfTreatedEvents[i] = 0;
0179 }
0180
0181 fFedStatus = new Int_t[fMaxFedUnitCounter];
0182 for (Int_t i = 0; i < fMaxFedUnitCounter; i++) {
0183 fFedStatus[i] = 0;
0184 }
0185
0186 fFedStatusOrder = new Int_t[fMaxFedUnitCounter];
0187 for (Int_t i = 0; i < fMaxFedUnitCounter; i++) {
0188 fFedStatusOrder[i] = 0;
0189 }
0190
0191 fDeeNumberString = new TString[fMaxFedUnitCounter];
0192 for (Int_t i = 0; i < fMaxFedUnitCounter; i++) {
0193 fDeeNumberString[i] = "SM";
0194 }
0195
0196 if (fStexName == "Dee") {
0197 fDeeNumberString[0] = "Sector1 Dee4";
0198 fDeeNumberString[1] = "Sector2 Dee4";
0199 fDeeNumberString[2] = "Sector3 Dee4";
0200 fDeeNumberString[3] = "Sector4 Dee4";
0201 fDeeNumberString[4] = "Sector5 Dee4-Dee3";
0202 fDeeNumberString[5] = "Sector6 Dee3";
0203 fDeeNumberString[6] = "Sector7 Dee3";
0204 fDeeNumberString[7] = "Sector8 Dee3";
0205 fDeeNumberString[8] = "Sector9 Dee3";
0206 fDeeNumberString[9] = "Sector1 Dee1";
0207 fDeeNumberString[10] = "Sector2 Dee1";
0208 fDeeNumberString[11] = "Sector3 Dee1";
0209 fDeeNumberString[12] = "Sector4 Dee1";
0210 fDeeNumberString[13] = "Sector5 Dee1-Dee2";
0211 fDeeNumberString[14] = "Sector6 Dee2";
0212 fDeeNumberString[15] = "Sector7 Dee2";
0213 fDeeNumberString[16] = "Sector8 Dee2";
0214 fDeeNumberString[17] = "Sector9 Dee2";
0215 }
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239 Int_t MaxSMAndDS = fMyEBEcal->MaxSMInEB() + fMyEEEcal->MaxDSInEE();
0240
0241 fSMFromFedTcc = new Int_t[MaxSMAndDS];
0242 fESFromFedTcc = new Int_t[MaxSMAndDS];
0243 for (Int_t nFedTcc = 1; nFedTcc <= MaxSMAndDS; nFedTcc++) {
0244 fESFromFedTcc[nFedTcc - 1] = -1;
0245 }
0246
0247 for (Int_t nFedTcc = 1; nFedTcc <= 3; nFedTcc++) {
0248 fESFromFedTcc[nFedTcc - 1] = nFedTcc + 6;
0249 }
0250 for (Int_t nFedTcc = 4; nFedTcc <= 9; nFedTcc++) {
0251 fESFromFedTcc[nFedTcc - 1] = nFedTcc - 3;
0252 }
0253
0254 for (Int_t nFedTcc = 10; nFedTcc <= 27; nFedTcc++) {
0255 fSMFromFedTcc[nFedTcc - 1] = nFedTcc + 9;
0256 }
0257 for (Int_t nFedTcc = 28; nFedTcc <= 45; nFedTcc++) {
0258 fSMFromFedTcc[nFedTcc - 1] = nFedTcc - 27;
0259 }
0260
0261 for (Int_t nFedTcc = 46; nFedTcc <= 48; nFedTcc++) {
0262 fESFromFedTcc[nFedTcc - 1] = nFedTcc - 30;
0263 }
0264 for (Int_t nFedTcc = 49; nFedTcc <= 54; nFedTcc++) {
0265 fESFromFedTcc[nFedTcc - 1] = nFedTcc - 39;
0266 }
0267
0268
0269
0270
0271 if (fStexName == "SM") {
0272 fMaxTreatedStexCounter = fMyEBEcal->MaxSMInEB();
0273 }
0274 if (fStexName == "Dee") {
0275 fMaxTreatedStexCounter = fMyEEEcal->MaxDeeInEE();
0276 }
0277
0278 fStexNbOfTreatedEvents = new Int_t[fMaxTreatedStexCounter];
0279 for (Int_t i = 0; i < fMaxTreatedStexCounter; i++) {
0280 fStexNbOfTreatedEvents[i] = 0;
0281 }
0282
0283 fTimeFirst = new time_t[fMaxTreatedStexCounter];
0284 for (Int_t i = 0; i < fMaxTreatedStexCounter; i++) {
0285 fTimeFirst[i] = 0;
0286 }
0287 fTimeLast = new time_t[fMaxTreatedStexCounter];
0288 for (Int_t i = 0; i < fMaxTreatedStexCounter; i++) {
0289 fTimeLast[i] = 0;
0290 }
0291
0292 fMemoDateFirstEvent = new Int_t[fMaxTreatedStexCounter];
0293 ;
0294 for (Int_t i = 0; i < fMaxTreatedStexCounter; i++) {
0295 fMemoDateFirstEvent[i] = 0;
0296 }
0297
0298 Int_t MaxCar = fgMaxCar;
0299 fDateFirst = new TString[fMaxTreatedStexCounter];
0300 for (Int_t i = 0; i < fMaxTreatedStexCounter; i++) {
0301 fDateFirst[i].Resize(MaxCar);
0302 fDateFirst[i] = "*1st event date not found*";
0303 }
0304
0305 MaxCar = fgMaxCar;
0306 fDateLast = new TString[fMaxTreatedStexCounter];
0307 for (Int_t i = 0; i < fMaxTreatedStexCounter; i++) {
0308 fDateLast[i].Resize(MaxCar);
0309 fDateLast[i] = "*last event date not found*";
0310 }
0311
0312 fStexStatus = new Int_t[fMaxTreatedStexCounter];
0313 for (Int_t i = 0; i < fMaxTreatedStexCounter; i++) {
0314 fStexStatus[i] = 0;
0315 }
0316
0317 fStexDigiOK = new Int_t[fMaxTreatedStexCounter];
0318 for (Int_t i = 0; i < fMaxTreatedStexCounter; i++) {
0319 fStexDigiOK[i] = 0;
0320 }
0321
0322 fNbOfTreatedFedsInDee = new Int_t[fMaxTreatedStexCounter];
0323 for (Int_t i = 0; i < fMaxTreatedStexCounter; i++) {
0324 fNbOfTreatedFedsInDee[i] = 0;
0325 }
0326
0327 fNbOfTreatedFedsInStex = new Int_t[fMaxTreatedStexCounter];
0328 for (Int_t i = 0; i < fMaxTreatedStexCounter; i++) {
0329 fNbOfTreatedFedsInStex[i] = 0;
0330 }
0331
0332
0333 fBuildEventDistribBad = nullptr;
0334 fBuildEventDistribBad = new Int_t[fMaxTreatedStexCounter];
0335 for (Int_t i = 0; i < fMaxTreatedStexCounter; i++) {
0336 fBuildEventDistribBad[i] = 0;
0337 }
0338
0339 fBuildEventDistribGood = nullptr;
0340 fBuildEventDistribGood = new Int_t[fMaxTreatedStexCounter];
0341 for (Int_t i = 0; i < fMaxTreatedStexCounter; i++) {
0342 fBuildEventDistribGood[i] = 0;
0343 }
0344
0345
0346
0347
0348
0349
0350
0351
0352
0353
0354
0355
0356
0357
0358
0359
0360
0361
0362
0363
0364
0365
0366
0367
0368
0369
0370
0371
0372
0373
0374
0375
0376
0377
0378 fLASER_STD = 4;
0379 fPEDESTAL_STD = 9;
0380 fPHYSICS_GLOBAL = 13;
0381 fPEDESTAL_GAP = 18;
0382 fPEDSIM = 24;
0383
0384 fANY_RUN = 25;
0385
0386
0387 fChozenRunTypeNumber = fANY_RUN;
0388 if (fAnalysisName == "AdcAny") {
0389 fChozenRunTypeNumber = fANY_RUN;
0390 }
0391 if (fAnalysisName == "AdcPed1" || fAnalysisName == "AdcPed6" || fAnalysisName == "AdcPed12" ||
0392 fAnalysisName == "AdcSPed1" || fAnalysisName == "AdcSPed6" || fAnalysisName == "AdcSPed12") {
0393 fChozenRunTypeNumber = fPEDESTAL_STD;
0394 }
0395 if (fAnalysisName == "AdcPeg12" || fAnalysisName == "AdcSPeg12") {
0396 fChozenRunTypeNumber = fPEDESTAL_GAP;
0397 }
0398 if (fAnalysisName == "AdcLaser" || fAnalysisName == "AdcSLaser") {
0399 fChozenRunTypeNumber = fLASER_STD;
0400 }
0401 if (fAnalysisName == "AdcPhys") {
0402 fChozenRunTypeNumber = fPHYSICS_GLOBAL;
0403 }
0404 if (fAnalysisName == "AdcPes12 " || fAnalysisName == "AdcSPes12 ") {
0405 fChozenRunTypeNumber = fPEDSIM;
0406 }
0407
0408
0409 fChozenGainNumber = 0;
0410
0411 if (fAnalysisName == "AdcAny") {
0412 fChozenGainNumber = 0;
0413 }
0414 if (fAnalysisName == "AdcPed1" || fAnalysisName == "AdcSPed1") {
0415 fChozenGainNumber = 3;
0416 }
0417 if (fAnalysisName == "AdcPed6" || fAnalysisName == "AdcSPed6") {
0418 fChozenGainNumber = 2;
0419 }
0420 if (fAnalysisName == "AdcPed12" || fAnalysisName == "AdcSPed12") {
0421 fChozenGainNumber = 1;
0422 }
0423 if (fAnalysisName == "AdcPeg12" || fAnalysisName == "AdcSPeg12") {
0424 fChozenGainNumber = 0;
0425 }
0426 if (fAnalysisName == "AdcLaser" || fAnalysisName == "AdcSLaser") {
0427 fChozenGainNumber = 0;
0428 }
0429 if (fAnalysisName == "AdcPes12 " || fAnalysisName == "AdcSPes12 ") {
0430 fChozenGainNumber = 0;
0431 }
0432 if (fAnalysisName == "AdcPhys") {
0433 fChozenGainNumber = 0;
0434 }
0435
0436
0437 fDynBaseLineSub = "no";
0438 if (fAnalysisName == "AdcAny" || fAnalysisName == "AdcPed1" || fAnalysisName == "AdcPed6" ||
0439 fAnalysisName == "AdcPed12" || fAnalysisName == "AdcPeg12" || fAnalysisName == "AdcLaser" ||
0440 fAnalysisName == "AdcPhys" || fAnalysisName == "AdcPes12 ") {
0441 fDynBaseLineSub = "no";
0442 }
0443 if (fAnalysisName == "AdcSPed1" || fAnalysisName == "AdcSPed6" || fAnalysisName == "AdcSPed12" ||
0444 fAnalysisName == "AdcSPeg12" || fAnalysisName == "AdcSLaser" || fAnalysisName == "AdcSPes12 ") {
0445 fDynBaseLineSub = "yes";
0446 }
0447
0448
0449
0450 if (fStexNumber == 0) {
0451 if (fStexName == "SM") {
0452 fSMIndexBegin = 0;
0453 fSMIndexStop = fMyEBEcal->MaxSMInEB();
0454 fStexIndexBegin = fSMIndexBegin;
0455 fStexIndexStop = fSMIndexStop;
0456 fDeeIndexBegin = 0;
0457 fDeeIndexStop = 0;
0458 }
0459 if (fStexName == "Dee") {
0460 fSMIndexBegin = 0;
0461 fSMIndexStop = 0;
0462 fDeeIndexBegin = 0;
0463 fDeeIndexStop = fMyEEEcal->MaxDeeInEE();
0464 fStexIndexBegin = fDeeIndexBegin;
0465 fStexIndexStop = fDeeIndexStop;
0466 }
0467 } else {
0468 if (fStexName == "SM") {
0469 fSMIndexBegin = fStexNumber - 1;
0470 fSMIndexStop = fStexNumber;
0471 fStexIndexBegin = fSMIndexBegin;
0472 fStexIndexStop = fSMIndexStop;
0473 fDeeIndexBegin = 0;
0474 fDeeIndexStop = 0;
0475 }
0476 if (fStexName == "Dee") {
0477 fSMIndexBegin = 0;
0478 fSMIndexStop = 0;
0479 fDeeIndexBegin = fStexNumber - 1;
0480 fDeeIndexStop = fStexNumber;
0481 fStexIndexBegin = fDeeIndexBegin;
0482 fStexIndexStop = fDeeIndexStop;
0483 }
0484 }
0485
0486
0487 fRunNumber = 0;
0488
0489 fMyCnaEBSM = nullptr;
0490 fMyCnaEEDee = nullptr;
0491
0492 fRunTypeNumber = -1;
0493 fMgpaGainNumber = -1;
0494
0495 fFedId = -1;
0496 fFedTcc = -1;
0497
0498 std::cout << "*EcnaAnalyzer::EcnaAnalyzer-constructor> fAnalysisName = " << fAnalysisName << std::endl;
0499 std::cout << "*EcnaAnalyzer::EcnaAnalyzer-constructor> fNbOfSamples = " << fNbOfSamples << std::endl;
0500 std::cout << "*EcnaAnalyzer::EcnaAnalyzer-constructor> fFirstReqEvent = " << fFirstReqEvent << std::endl;
0501 std::cout << "*EcnaAnalyzer::EcnaAnalyzer-constructor> fLastReqEvent = " << fLastReqEvent << std::endl;
0502 std::cout << "*EcnaAnalyzer::EcnaAnalyzer-constructor> fReqNbOfEvts = " << fReqNbOfEvts << std::endl;
0503 std::cout << "*EcnaAnalyzer::EcnaAnalyzer-constructor> fStexName = " << fStexName << std::endl;
0504 std::cout << "*EcnaAnalyzer::EcnaAnalyzer-constructor> fStexNumber = " << fStexNumber << std::endl;
0505 std::cout << "*EcnaAnalyzer::EcnaAnalyzer-constructor> fChozenRunTypeNumber = " << fChozenRunTypeNumber << std::endl;
0506 std::cout << "*EcnaAnalyzer::EcnaAnalyzer-constructor> fChozenGainNumber = " << fChozenGainNumber << std::endl
0507 << std::endl;
0508
0509 std::cout << "*EcnaAnalyzer::EcnaAnalyzer-constructor> Init done. " << std::endl;
0510 }
0511
0512
0513 EcnaAnalyzer::~EcnaAnalyzer() {
0514
0515
0516
0517 using namespace std;
0518
0519 std::cout << std::setiosflags(std::ios::showpoint | std::ios::uppercase);
0520 std::cout << std::setprecision(3) << std::setw(6);
0521 cout.setf(std::ios::dec, std::ios::basefield);
0522 cout.setf(std::ios::fixed, std::ios::floatfield);
0523 cout.setf(std::ios::left, std::ios::adjustfield);
0524 cout.setf(std::ios::right, std::ios::adjustfield);
0525
0526 std::cout << "EcnaAnalyzer::~EcnaAnalyzer()> destructor is going to be executed." << std::endl;
0527
0528 if (fOutcomeError == kTRUE)
0529 return;
0530
0531
0532
0533
0534 if (fMyCnaEBSM == nullptr && fStexName == "SM") {
0535 std::cout << std::endl
0536 << "!EcnaAnalyzer-destructor> **** ERROR **** fMyCnaEBSM = " << fMyCnaEBSM
0537 << ". !===> ECNA HAS NOT BEEN INITIALIZED." << std::endl
0538 << " Last event run type = " << runtype(fRunTypeNumber) << ", fRunTypeNumber = " << fRunTypeNumber
0539 << ", last event Mgpa gain = " << gainvalue(fMgpaGainNumber) << ", fMgpaGainNumber = " << fMgpaGainNumber
0540 << ", last event fFedId(+601) = " << fFedId + 601 << std::endl
0541 << std::endl;
0542 } else {
0543 for (Int_t iSM = fSMIndexBegin; iSM < fSMIndexStop; iSM++) {
0544 if (fMyCnaEBSM[iSM] != nullptr) {
0545
0546 fMyCnaEBSM[iSM]->StartStopDate(fDateFirst[iSM], fDateLast[iSM]);
0547 fMyCnaEBSM[iSM]->StartStopTime(fTimeFirst[iSM], fTimeLast[iSM]);
0548
0549
0550 fMyCnaEBSM[iSM]->GetReadyToCompute();
0551 fMyCnaEBSM[iSM]->SampleValues();
0552
0553
0554
0555 if (fMyCnaEBSM[iSM]->WriteRootFile() == kFALSE) {
0556 std::cout << "!EcnaAnalyzer-destructor> PROBLEM with write ROOT file for SM" << iSM + 1 << fTTBELL
0557 << std::endl;
0558 }
0559 } else {
0560 std::cout << "*EcnaAnalyzer-destructor> Calculations and writing on "
0561 "file already done for SM "
0562 << iSM + 1 << std::endl;
0563 }
0564 }
0565 delete fMyCnaEBSM;
0566 }
0567
0568
0569 if (fMyCnaEEDee == nullptr && fStexName == "Dee") {
0570 std::cout << std::endl
0571 << "!EcnaAnalyzer-destructor> **** ERROR **** fMyCnaEEDee = " << fMyCnaEEDee
0572 << ". !===> ECNA HAS NOT BEEN INITIALIZED." << std::endl
0573 << " Last event run type = " << runtype(fRunTypeNumber) << ", fRunTypeNumber = " << fRunTypeNumber
0574 << ", last event Mgpa gain = " << gainvalue(fMgpaGainNumber) << ", fMgpaGainNumber = " << fMgpaGainNumber
0575 << ", last event fFedId(+601) = " << fFedId + 601 << std::endl
0576 << std::endl;
0577 } else {
0578 for (Int_t iDee = fDeeIndexBegin; iDee < fDeeIndexStop; iDee++) {
0579 if (fMyCnaEEDee[iDee] != nullptr) {
0580
0581 fMyCnaEEDee[iDee]->StartStopDate(fDateFirst[iDee], fDateLast[iDee]);
0582 fMyCnaEEDee[iDee]->StartStopTime(fTimeFirst[iDee], fTimeLast[iDee]);
0583
0584
0585 fMyCnaEEDee[iDee]->GetReadyToCompute();
0586 fMyCnaEEDee[iDee]->SampleValues();
0587
0588
0589
0590 if (fMyCnaEEDee[iDee]->WriteRootFile() == kFALSE) {
0591 std::cout << "!EcnaAnalyzer-destructor> PROBLEM with write ROOT file "
0592 "for Dee"
0593 << iDee + 1 << fTTBELL << std::endl;
0594 }
0595 } else {
0596 std::cout << "*EcnaAnalyzer-destructor> Calculations and writing on "
0597 "file already done for Dee "
0598 << iDee + 1 << std::endl;
0599 }
0600 }
0601 delete fMyCnaEEDee;
0602 }
0603 std::cout << endl;
0604
0605
0606
0607 std::cout << "*EcnaAnalyzer-destructor> Status of events returned by "
0608 "GetSampleAdcValues(): "
0609 << std::endl;
0610
0611 for (Int_t i0Stex = fStexIndexBegin; i0Stex < fStexIndexStop; i0Stex++) {
0612 std::cout << fStexName << i0Stex + 1 << "> Status OK: " << fBuildEventDistribGood[i0Stex]
0613 << " / ERROR(S): " << fBuildEventDistribBad[i0Stex];
0614 if (fBuildEventDistribBad[i0Stex] > 0) {
0615 std::cout << " <=== SHOULD BE EQUAL TO ZERO ! " << fTTBELL;
0616 }
0617 std::cout << std::endl;
0618 }
0619
0620 std::cout << std::endl << "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << std::endl;
0621
0622 std::cout << "*EcnaAnalyzer-destructor> Run types seen in event headers "
0623 "before selection:"
0624 << std::endl;
0625
0626 for (Int_t i = 0; i < fMaxRunTypeCounter; i++) {
0627 std::cout << " => " << std::setw(10) << fRunTypeCounter[i] << " event header(s) with run type " << runtype(i)
0628 << std::endl;
0629 }
0630
0631 std::cout << std::endl << "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << std::endl;
0632
0633 std::cout << "*EcnaAnalyzer-destructor> Mgpa gains seen in event headers "
0634 "before selection:"
0635 << std::endl;
0636
0637 for (Int_t i = 0; i < fMaxMgpaGainCounter; i++) {
0638 std::cout << " => " << std::setw(10) << fMgpaGainCounter[i] << " event header(s) with gain " << gainvalue(i)
0639 << std::endl;
0640 }
0641
0642 std::cout << std::endl << "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << std::endl;
0643
0644 std::cout << "*EcnaAnalyzer-destructor> Numbers of selected events for each FED:" << std::endl;
0645
0646 for (Int_t i = 0; i < fMaxFedIdCounter; i++) {
0647 std::cout << " => FedId " << i + 601 << ": " << std::setw(10) << fFedIdCounter[i] << " events" << std::endl;
0648 }
0649
0650 std::cout << std::endl << "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << std::endl;
0651
0652 if (fStexNumber == 0) {
0653
0654
0655
0656
0657 }
0658 if (fStexNumber > 0) {
0659 std::cout << "*EcnaAnalyzer-destructor> fDateFirst = " << fDateFirst[fStexNumber - 1] << std::endl
0660 << " fDateLast = " << fDateLast[fStexNumber - 1] << std::endl
0661 << std::endl;
0662 }
0663
0664 std::cout << std::endl << "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << std::endl;
0665
0666 Int_t n0 = 0;
0667 CheckMsg(n0);
0668
0669 delete fMyEBNumbering;
0670 delete fMyEENumbering;
0671
0672 delete fMyEBEcal;
0673 delete fMyEEEcal;
0674
0675 std::cout << "*EcnaAnalyzer-destructor> End of execution." << std::endl;
0676 }
0677
0678
0679
0680
0681
0682
0683
0684 void EcnaAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) {
0685 using namespace std;
0686
0687 std::cout << std::setiosflags(std::ios::showpoint | std::ios::uppercase);
0688 std::cout << std::setprecision(3) << std::setw(6);
0689 cout.setf(std::ios::dec, std::ios::basefield);
0690 cout.setf(std::ios::fixed, std::ios::floatfield);
0691 cout.setf(std::ios::left, std::ios::adjustfield);
0692 cout.setf(std::ios::right, std::ios::adjustfield);
0693
0694 using namespace edm;
0695
0696 fRecNumber++;
0697
0698 Int_t iFreq = (fLastReqEvent - fFirstReqEvent + 1) / 5;
0699 if (iFreq <= 0) {
0700 iFreq = 10000;
0701 }
0702
0703 Int_t MaxSMAndDS = fMyEBEcal->MaxSMInEB() + fMyEEEcal->MaxDSInEE();
0704
0705
0706
0707 Handle<EcalRawDataCollection> pEventHeader;
0708 const EcalRawDataCollection *myEventHeader = nullptr;
0709 try {
0710 iEvent.getByLabel(eventHeaderProducer_, eventHeaderCollection_, pEventHeader);
0711 myEventHeader = pEventHeader.product();
0712 } catch (std::exception &ex) {
0713 std::cerr << "Error! can't get the product " << eventHeaderCollection_.c_str() << std::endl;
0714 }
0715
0716 for (EcalRawDataCollection::const_iterator headerItr = myEventHeader->begin(); headerItr != myEventHeader->end();
0717 ++headerItr) {
0718
0719
0720 fRunNumber = (Int_t)headerItr->getRunNumber();
0721 if (fRunNumber <= 0) {
0722 fRunNumber = (Int_t)iEvent.id().run();
0723 }
0724 fRunTypeNumber = (Int_t)headerItr->getRunType();
0725 fMgpaGainNumber = (Int_t)headerItr->getMgpaGain();
0726 fFedId = (Int_t)headerItr->fedId() - 601;
0727 fEvtNumber = (Int_t)headerItr->getLV1();
0728 if (fEvtNumber <= 0) {
0729 fEvtNumber = (Int_t)iEvent.id().event();
0730 }
0731
0732 if (fEvtNumber != fEvtNumberMemo) {
0733 fEvtNumberMemo = fEvtNumber;
0734
0735
0736
0737
0738
0739 if (AnalysisOutcome("EVT") == kTRUE) {
0740 return;
0741 }
0742
0743
0744
0745 fCurrentEventNumber++;
0746
0747 if (fRecNumber == 1 || fRecNumber == 50 || fRecNumber == 100 || fRecNumber == 500 || fRecNumber == 1000 ||
0748 fRecNumber % iFreq == 0) {
0749 Int_t n1 = 1;
0750 CheckMsg(n1);
0751 }
0752
0753 if (fCurrentEventNumber < fFirstReqEvent)
0754 return;
0755 }
0756
0757
0758 if (fRunTypeNumber >= 0 && fRunTypeNumber < fMaxRunTypeCounter) {
0759 fRunTypeCounter[fRunTypeNumber]++;
0760 }
0761 if (fMgpaGainNumber >= 0 && fMgpaGainNumber < fMaxMgpaGainCounter) {
0762 fMgpaGainCounter[fMgpaGainNumber]++;
0763 }
0764
0765
0766
0767
0768 if (!(fRunNumber > 0 && (fRunTypeNumber == fChozenRunTypeNumber || fChozenRunTypeNumber == fANY_RUN) &&
0769 (fMgpaGainNumber == fChozenGainNumber || fChozenGainNumber == 0)))
0770 return;
0771
0772
0773
0774 if (fMemoCutOK == 0) {
0775 fMemoCutOK = 1;
0776 }
0777
0778
0779
0780
0781
0782 if (fAnalysisName == "AdcPeg12" || fAnalysisName == "AdcSPeg12" || fAnalysisName == "AdcPhys" ||
0783 fAnalysisName == "AdcAny") {
0784 fFedTcc = (Int_t)headerItr->getDccInTCCCommand();
0785
0786 if (fFedTcc >= 1 && fFedTcc <= MaxSMAndDS) {
0787 if (fStexName == "SM") {
0788 if (fFedTcc < 10 || fFedTcc > 45)
0789 return;
0790
0791 if (fSMFromFedTcc[fFedTcc - 1] >= 1 && fSMFromFedTcc[fFedTcc - 1] <= fMyEBEcal->MaxSMInEB() &&
0792 fStexNbOfTreatedEvents[fSMFromFedTcc[fFedTcc - 1] - 1] >= fReqNbOfEvts)
0793 return;
0794 }
0795
0796 if (fStexName == "Dee") {
0797 if (fFedTcc >= 10 && fFedTcc <= 45)
0798 return;
0799
0800 if (fESFromFedTcc[fFedTcc - 1] >= 1 && fESFromFedTcc[fFedTcc - 1] <= fMyEEEcal->MaxDSInEE() &&
0801 fFedNbOfTreatedEvents[fESFromFedTcc[fFedTcc - 1] - 1] >= fReqNbOfEvts)
0802 return;
0803 }
0804 }
0805 }
0806
0807
0808
0809 if (fFedId >= 0 && fFedId < fMaxFedIdCounter) {
0810 fFedIdCounter[fFedId]++;
0811 }
0812
0813 }
0814
0815
0816
0817 if (fMemoCutOK == 0)
0818 return;
0819
0820
0821 fNbOfSelectedEvents++;
0822 if (fNbOfSelectedEvents == 1) {
0823 Int_t n2 = 2;
0824 CheckMsg(n2);
0825 }
0826
0827
0828
0829
0830 if (fMyCnaEBSM == nullptr && fStexName == "SM") {
0831 fMyCnaEBSM = new TEcnaRun *[fMyEBEcal->MaxSMInEB()];
0832 for (Int_t i0SM = 0; i0SM < fMyEBEcal->MaxSMInEB(); i0SM++) {
0833 fMyCnaEBSM[i0SM] = nullptr;
0834 }
0835 }
0836
0837 if (fMyCnaEEDee == nullptr && fStexName == "Dee") {
0838 fMyCnaEEDee = new TEcnaRun *[fMyEEEcal->MaxDeeInEE()];
0839 for (Int_t iDee = 0; iDee < fMyEEEcal->MaxDeeInEE(); iDee++) {
0840 fMyCnaEEDee[iDee] = nullptr;
0841 }
0842 }
0843
0844
0845 Int_t MaxNbOfStex = 0;
0846 if (fStexName == "SM") {
0847 MaxNbOfStex = fMyEBEcal->MaxSMInEB();
0848 }
0849 if (fStexName == "Dee") {
0850 MaxNbOfStex = fMyEEEcal->MaxDeeInEE();
0851 }
0852
0853 if ((fStexNumber > 0 && fNbOfTreatedStexs == 0) || (fStexNumber == 0 && fNbOfTreatedStexs < MaxNbOfStex)) {
0854
0855
0856 if (fStexName == "SM" && fSMIndexBegin < fSMIndexStop) {
0857
0858 Handle<EBDigiCollection> pdigisEB;
0859 const EBDigiCollection *digisEB = nullptr;
0860 try {
0861 iEvent.getByLabel(digiProducer_, EBdigiCollection_, pdigisEB);
0862 digisEB = pdigisEB.product();
0863 } catch (std::exception &ex) {
0864 std::cerr << "Error! can't get the product " << EBdigiCollection_.c_str() << std::endl;
0865 }
0866
0867
0868 if (int(digisEB->size()) > nChannels_) {
0869 nChannels_ = digisEB->size();
0870 }
0871
0872
0873 if (Int_t(digisEB->end() - digisEB->begin()) >= 0 &&
0874 Int_t(digisEB->end() - digisEB->begin()) <= Int_t(digisEB->size())) {
0875
0876
0877
0878
0879
0880
0881
0882 for (EBDigiCollection::const_iterator digiItr = digisEB->begin(); digiItr != digisEB->end(); ++digiItr) {
0883 EBDetId id_crystal(digiItr->id());
0884
0885
0886 Int_t i0SM = id_crystal.ism() - 1;
0887
0888 if (i0SM >= 0 && i0SM < fMaxTreatedStexCounter) {
0889 if (fMyCnaEBSM[i0SM] == nullptr && fStexStatus[i0SM] != 2) {
0890
0891
0892 fMyCnaEBSM[i0SM] = new TEcnaRun(fMyEcnaEBObjectManager, "EB", fNbOfSamples);
0893 fMyCnaEBSM[i0SM]->GetReadyToReadData(
0894 fAnalysisName, fRunNumber, fFirstReqEvent, fLastReqEvent, fReqNbOfEvts, i0SM + 1, fRunTypeNumber);
0895
0896 std::cout << "*EcnaAnalyzer::analyze(...)> ********* INIT ECNA "
0897 "EB ********* "
0898 << std::endl
0899 << " fAnalysisName = " << fAnalysisName << std::endl
0900 << " fRunNumber = " << fRunNumber << std::endl
0901 << " fFirstReqEvent = " << fFirstReqEvent << std::endl
0902 << " fLastReqEvent = " << fLastReqEvent << std::endl
0903 << " fReqNbOfEvts = " << fReqNbOfEvts << std::endl
0904 << " SM = " << i0SM + 1 << std::endl
0905 << " run type = " << runtype(fRunTypeNumber)
0906 << std::endl;
0907
0908 }
0909
0910 if (fStexStatus[i0SM] < 2)
0911 {
0912 fStexDigiOK[i0SM]++;
0913 if (fStexDigiOK[i0SM] == 1) {
0914 fStexNbOfTreatedEvents[i0SM]++;
0915 }
0916
0917 if (fStexNbOfTreatedEvents[i0SM] >= 1 && fStexNbOfTreatedEvents[i0SM] <= fReqNbOfEvts) {
0918
0919
0920 edm::Timestamp Time = iEvent.time();
0921 edm::TimeValue_t t_current_ev_time = (cond::Time_t)Time.value();
0922 time_t i_current_ev_time = (time_t)(t_current_ev_time >> 32);
0923 const time_t *p_current_ev_time = &i_current_ev_time;
0924 char *astime = ctime(p_current_ev_time);
0925
0926 if (fStexDigiOK[i0SM] == 1 && fStexNbOfTreatedEvents[i0SM] == 1 &&
0927 (fStexNumber == 0 || i0SM + 1 == fStexNumber)) {
0928 fTimeFirst[i0SM] = i_current_ev_time;
0929 fDateFirst[i0SM] = astime;
0930 fTimeLast[i0SM] = i_current_ev_time;
0931 fDateLast[i0SM] = astime;
0932 std::cout << "*----> beginning of analysis for " << fStexName << i0SM + 1
0933 << ". First analyzed event date : " << astime << std::endl;
0934
0935
0936
0937
0938
0939
0940 }
0941
0942 if (i_current_ev_time < fTimeFirst[i0SM]) {
0943 fTimeFirst[i0SM] = i_current_ev_time;
0944 fDateFirst[i0SM] = astime;
0945 }
0946 if (i_current_ev_time > fTimeLast[i0SM]) {
0947 fTimeLast[i0SM] = i_current_ev_time;
0948 fDateLast[i0SM] = astime;
0949 }
0950
0951
0952
0953 if ((fStexNumber > 0 && i0SM == fStexNumber - 1) || (fStexNumber == 0)) {
0954 Int_t iEta = id_crystal.ietaSM();
0955 Int_t iPhi = id_crystal.iphiSM();
0956
0957 Int_t n1SMCrys = (iEta - 1) * (fMyEBEcal->MaxTowPhiInSM() * fMyEBEcal->MaxCrysPhiInTow()) +
0958 iPhi;
0959 Int_t n1SMTow = fMyEBNumbering->Get1SMTowFrom1SMCrys(n1SMCrys);
0960 Int_t i0TowEcha = fMyEBNumbering->Get0TowEchaFrom1SMCrys(n1SMCrys);
0961
0962 Int_t NbOfSamplesFromDigis = digiItr->size();
0963
0964 EBDataFrame df(*digiItr);
0965
0966 if (NbOfSamplesFromDigis > 0 && NbOfSamplesFromDigis <= fMyEBEcal->MaxSampADC()) {
0967 Double_t adcDBLS = (Double_t)0;
0968
0969
0970 if (fDynBaseLineSub == "yes") {
0971 for (Int_t i0Sample = 0; i0Sample < 3; i0Sample++) {
0972 adcDBLS += (Double_t)(df.sample(i0Sample).adc());
0973 }
0974 adcDBLS /= (Double_t)3;
0975 }
0976
0977 for (Int_t i0Sample = 0; i0Sample < fNbOfSamples; i0Sample++) {
0978 Double_t adc = (Double_t)(df.sample(i0Sample).adc()) - adcDBLS;
0979
0980
0981 if (fMyCnaEBSM[i0SM]->GetSampleAdcValues(
0982 fStexNbOfTreatedEvents[i0SM], n1SMTow, i0TowEcha, i0Sample, adc) == kTRUE) {
0983 fBuildEventDistribGood[i0SM]++;
0984 } else {
0985 fBuildEventDistribBad[i0SM]++;
0986 }
0987 }
0988 } else {
0989 std::cout << "EcnaAnalyzer::analyze(...)> "
0990 "NbOfSamplesFromDigis out of bounds = "
0991 << NbOfSamplesFromDigis << std::endl;
0992 }
0993 }
0994
0995 }
0996
0997 }
0998 }
0999 }
1000
1001
1002
1003 for (Int_t i0SM = 0; i0SM < fMaxTreatedStexCounter; i0SM++) {
1004 fStexDigiOK[i0SM] = 0;
1005 }
1006
1007 }
1008
1009 }
1010
1011
1012
1013 if (fStexName == "Dee" && fDeeIndexBegin < fDeeIndexStop) {
1014
1015 Handle<EEDigiCollection> pdigisEE;
1016 const EEDigiCollection *digisEE = nullptr;
1017 try {
1018 iEvent.getByLabel(digiProducer_, EEdigiCollection_, pdigisEE);
1019 digisEE = pdigisEE.product();
1020 } catch (std::exception &ex) {
1021 std::cerr << "Error! can't get the product " << EEdigiCollection_.c_str() << std::endl;
1022 }
1023
1024
1025 if (int(digisEE->size()) > nChannels_) {
1026 nChannels_ = digisEE->size();
1027 }
1028
1029
1030 if (Int_t(digisEE->end() - digisEE->begin()) >= 0 &&
1031 Int_t(digisEE->end() - digisEE->begin()) <= Int_t(digisEE->size())) {
1032
1033
1034
1035
1036
1037
1038 for (EEDigiCollection::const_iterator digiItr = digisEE->begin(); digiItr != digisEE->end(); ++digiItr) {
1039 EEDetId id_crystal(digiItr->id());
1040
1041 Int_t iX_data = id_crystal.ix();
1042 Int_t iY_data = id_crystal.iy();
1043 Int_t i_quad = id_crystal.iquadrant();
1044 Int_t i_sgnZ = id_crystal.zside();
1045
1046 Int_t iX = iX_data;
1047 Int_t iY = iY_data;
1048
1049
1050
1051
1052 if (i_quad == 1 || i_quad == 4) {
1053 iX = iX_data - 50;
1054 }
1055 if (i_quad == 3 || i_quad == 2) {
1056 iX = 51 - iX_data;
1057 }
1058
1059 Int_t n1DeeCrys =
1060 (iX - 1) * (fMyEEEcal->MaxSCIYInDee() * fMyEEEcal->MaxCrysIYInSC()) + iY;
1061
1062 Int_t n1DeeNumber = 0;
1063 if (i_quad == 1 && i_sgnZ == 1) {
1064 n1DeeNumber = 2;
1065 }
1066 if (i_quad == 1 && i_sgnZ == -1) {
1067 n1DeeNumber = 3;
1068 }
1069 if (i_quad == 2 && i_sgnZ == 1) {
1070 n1DeeNumber = 1;
1071 }
1072 if (i_quad == 2 && i_sgnZ == -1) {
1073 n1DeeNumber = 4;
1074 }
1075 if (i_quad == 3 && i_sgnZ == 1) {
1076 n1DeeNumber = 1;
1077 }
1078 if (i_quad == 3 && i_sgnZ == -1) {
1079 n1DeeNumber = 4;
1080 }
1081 if (i_quad == 4 && i_sgnZ == 1) {
1082 n1DeeNumber = 2;
1083 }
1084 if (i_quad == 4 && i_sgnZ == -1) {
1085 n1DeeNumber = 3;
1086 }
1087
1088 Int_t i0Dee = n1DeeNumber - 1;
1089
1090 if (i0Dee >= 0 && i0Dee < fMaxTreatedStexCounter) {
1091 if (fMyCnaEEDee[i0Dee] == nullptr && fStexStatus[i0Dee] != 2) {
1092
1093
1094 fMyCnaEEDee[i0Dee] = new TEcnaRun(fMyEcnaEEObjectManager, "EE", fNbOfSamples);
1095 fMyCnaEEDee[i0Dee]->GetReadyToReadData(
1096 fAnalysisName, fRunNumber, fFirstReqEvent, fLastReqEvent, fReqNbOfEvts, i0Dee + 1, fRunTypeNumber);
1097
1098 std::cout << "*EcnaAnalyzer::analyze(...)> ********* INIT ECNA "
1099 "EE ********* "
1100 << std::endl
1101 << " fAnalysisName = " << fAnalysisName << std::endl
1102 << " fRunNumber = " << fRunNumber << std::endl
1103 << " fFirstReqEvent = " << fFirstReqEvent << std::endl
1104 << " fLastReqEvent = " << fLastReqEvent << std::endl
1105 << " fReqNbOfEvts = " << fReqNbOfEvts << std::endl
1106 << " Dee = " << i0Dee + 1 << std::endl
1107 << " run type = " << runtype(fRunTypeNumber)
1108 << std::endl;
1109
1110 }
1111
1112 if (fStexStatus[i0Dee] < 2)
1113 {
1114 Bool_t cOKForTreatment = kFALSE;
1115
1116 if (fAnalysisName == "AdcPeg12" || fAnalysisName == "AdcSPeg12" || fAnalysisName == "AdcPhys" ||
1117 fAnalysisName == "AdcAny") {
1118 if (fFedTcc >= 1 && fFedTcc <= MaxSMAndDS) {
1119 fFedDigiOK[fESFromFedTcc[fFedTcc - 1] - 1]++;
1120
1121 if (!(fESFromFedTcc[fFedTcc - 1] == 5 || fESFromFedTcc[fFedTcc - 1] == 14)) {
1122 if (fFedDigiOK[fESFromFedTcc[fFedTcc - 1] - 1] == 1) {
1123 fFedNbOfTreatedEvents[fESFromFedTcc[fFedTcc - 1] - 1]++;
1124 }
1125 if (fFedNbOfTreatedEvents[fESFromFedTcc[fFedTcc - 1] - 1] >= 1 &&
1126 fFedNbOfTreatedEvents[fESFromFedTcc[fFedTcc - 1] - 1] <= fReqNbOfEvts) {
1127 fStexNbOfTreatedEvents[i0Dee] = fFedNbOfTreatedEvents[fESFromFedTcc[fFedTcc - 1] - 1];
1128 cOKForTreatment = kTRUE;
1129 }
1130 }
1131 if (fESFromFedTcc[fFedTcc - 1] == 5 || fESFromFedTcc[fFedTcc - 1] == 14) {
1132 if (fFedDigiOK[fESFromFedTcc[fFedTcc - 1] - 1] == 1) {
1133 fFedNbOfTreatedEvents[fESFromFedTcc[fFedTcc - 1] - 1]++;
1134 fDeeDS5Memo1 = n1DeeNumber;
1135 fStexNbOfTreatedEvents[i0Dee] = fFedNbOfTreatedEvents[fESFromFedTcc[fFedTcc - 1] - 1];
1136 } else {
1137 if (fDeeDS5Memo2 == 0) {
1138 if (n1DeeNumber != fDeeDS5Memo1) {
1139
1140 fDeeDS5Memo2 = n1DeeNumber;
1141 fStexNbOfTreatedEvents[i0Dee] = fFedNbOfTreatedEvents[fESFromFedTcc[fFedTcc - 1] - 1];
1142 }
1143 }
1144 }
1145 if (fFedNbOfTreatedEvents[fESFromFedTcc[fFedTcc - 1] - 1] >= 1 &&
1146 fFedNbOfTreatedEvents[fESFromFedTcc[fFedTcc - 1] - 1] <= fReqNbOfEvts) {
1147 cOKForTreatment = kTRUE;
1148 }
1149 }
1150 }
1151 }
1152
1153 else {
1154 fStexDigiOK[i0Dee]++;
1155 if (fStexDigiOK[i0Dee] == 1) {
1156 fStexNbOfTreatedEvents[i0Dee]++;
1157 }
1158 if (fStexNbOfTreatedEvents[i0Dee] >= 1 && fStexNbOfTreatedEvents[i0Dee] <= fReqNbOfEvts) {
1159 cOKForTreatment = kTRUE;
1160 }
1161 }
1162
1163 if (cOKForTreatment == kTRUE) {
1164
1165
1166 edm::Timestamp Time = iEvent.time();
1167 edm::TimeValue_t t_current_ev_time = (cond::Time_t)Time.value();
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);
1171
1172 if ((!(fAnalysisName == "AdcPeg12" || fAnalysisName == "AdcSPeg12" || fAnalysisName == "AdcPhys" ||
1173 fAnalysisName == "AdcAny") &&
1174 fStexDigiOK[i0Dee] == 1 && fStexNbOfTreatedEvents[i0Dee] == 1) ||
1175 ((fAnalysisName == "AdcPeg12" || fAnalysisName == "AdcSPeg12" || fAnalysisName == "AdcPhys" ||
1176 fAnalysisName == "AdcAny") &&
1177 fFedDigiOK[fESFromFedTcc[fFedTcc - 1] - 1] == 1 && fStexNbOfTreatedEvents[i0Dee] == 1 &&
1178 fMemoDateFirstEvent[i0Dee] == 0)) {
1179 fTimeFirst[i0Dee] = i_current_ev_time;
1180 fDateFirst[i0Dee] = astime;
1181 fTimeLast[i0Dee] = i_current_ev_time;
1182 fDateLast[i0Dee] = astime;
1183 std::cout << "----- beginning of analysis for " << fStexName << i0Dee + 1 << "-------"
1184 << std::endl
1185
1186
1187
1188
1189
1190
1191 << " First event date = " << astime << std::endl
1192 << " Nb of selected evts = " << fNbOfSelectedEvents << std::endl
1193 << "-----------------------------------------------"
1194 "----------------"
1195 << std::endl;
1196 fMemoDateFirstEvent[i0Dee]++;
1197 }
1198
1199 if (i_current_ev_time < fTimeFirst[i0Dee]) {
1200 fTimeFirst[i0Dee] = i_current_ev_time;
1201 fDateFirst[i0Dee] = astime;
1202 }
1203 if (i_current_ev_time > fTimeLast[i0Dee]) {
1204 fTimeLast[i0Dee] = i_current_ev_time;
1205 fDateLast[i0Dee] = astime;
1206 }
1207
1208
1209
1210 if ((fStexNumber > 0 && i0Dee == fStexNumber - 1) || (fStexNumber == 0)) {
1211 TString sDir = fMyEENumbering->GetDeeDirViewedFromIP(n1DeeNumber);
1212 Int_t n1DeeSCEcna = fMyEENumbering->Get1DeeSCEcnaFrom1DeeCrys(n1DeeCrys, sDir);
1213 Int_t i0SCEcha = fMyEENumbering->Get1SCEchaFrom1DeeCrys(n1DeeCrys, sDir) - 1;
1214
1215 Int_t NbOfSamplesFromDigis = digiItr->size();
1216
1217 EEDataFrame df(*digiItr);
1218
1219 if (NbOfSamplesFromDigis > 0 && NbOfSamplesFromDigis <= fMyEEEcal->MaxSampADC()) {
1220 Double_t adcDBLS = (Double_t)0;
1221
1222
1223 if (fDynBaseLineSub == "yes") {
1224 for (Int_t i0Sample = 0; i0Sample < 3; i0Sample++) {
1225 adcDBLS += (Double_t)(df.sample(i0Sample).adc());
1226 }
1227 adcDBLS /= (Double_t)3;
1228 }
1229
1230 for (Int_t i0Sample = 0; i0Sample < fNbOfSamples; i0Sample++) {
1231 Double_t adc = (Double_t)(df.sample(i0Sample).adc()) - adcDBLS;
1232
1233
1234 if (fMyCnaEEDee[i0Dee]->GetSampleAdcValues(
1235 fStexNbOfTreatedEvents[i0Dee], n1DeeSCEcna, i0SCEcha, i0Sample, adc) == kTRUE) {
1236 fBuildEventDistribGood[i0Dee]++;
1237 } else {
1238 fBuildEventDistribBad[i0Dee]++;
1239 }
1240 }
1241 } else {
1242 std::cout << "EcnaAnalyzer::analyze(...)> "
1243 "NbOfSamplesFromDigis out of bounds = "
1244 << NbOfSamplesFromDigis << std::endl;
1245 }
1246 }
1247
1248 }
1249
1250
1251
1252 }
1253 }
1254 }
1255
1256
1257
1258
1259
1260 if (fAnalysisName == "AdcPeg12" || fAnalysisName == "AdcSPeg12" || fAnalysisName == "AdcPhys" ||
1261 fAnalysisName == "AdcAny") {
1262 for (Int_t i0FedES = 0; i0FedES < fMaxFedUnitCounter; i0FedES++) {
1263 fFedDigiOK[i0FedES] = 0;
1264 }
1265
1266
1267
1268 fDeeDS5Memo1 = 0;
1269 fDeeDS5Memo2 = 0;
1270 } else {
1271 for (Int_t i0Dee = 0; i0Dee < fMaxTreatedStexCounter; i0Dee++) {
1272 fStexDigiOK[i0Dee] = 0;
1273 }
1274 }
1275
1276 }
1277
1278
1279 }
1280 }
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291 if (fStexName == "SM" || (fStexName == "Dee" &&
1292 !(fAnalysisName == "AdcPeg12" || fAnalysisName == "AdcSPeg12" ||
1293 fAnalysisName == "AdcPhys" || fAnalysisName == "AdcAny")))
1294 {
1295 for (Int_t i0Stex = fStexIndexBegin; i0Stex < fStexIndexStop; i0Stex++) {
1296 if (fStexStatus[i0Stex] != 2)
1297
1298 {
1299 if (fStexNbOfTreatedEvents[i0Stex] == fReqNbOfEvts) {
1300 fStexStatus[i0Stex] = 1;
1301 }
1302 if (fStexNbOfTreatedEvents[i0Stex] > fReqNbOfEvts) {
1303 fStexStatus[i0Stex] = 2;
1304 }
1305 }
1306 }
1307 }
1308
1309
1310 if (fStexName == "Dee" && (fAnalysisName == "AdcPeg12" || fAnalysisName == "AdcSPeg12" ||
1311 fAnalysisName == "AdcPhys" || fAnalysisName == "AdcAny")) {
1312 for (Int_t i0FedES = 0; i0FedES < fMaxFedUnitCounter; i0FedES++) {
1313 if (fFedStatus[i0FedES] != 2)
1314
1315 {
1316 if (fFedNbOfTreatedEvents[i0FedES] == fReqNbOfEvts) {
1317 fFedStatus[i0FedES] = 1;
1318 fTreatedFedOrder++;
1319 fFedStatusOrder[i0FedES] = fTreatedFedOrder;
1320 }
1321 if (fFedNbOfTreatedEvents[i0FedES] > fReqNbOfEvts) {
1322 fFedStatus[i0FedES] = 2;
1323 }
1324 }
1325 }
1326
1327 Int_t j0Fed = 4;
1328
1329
1330 for (Int_t i0FedES = 0; i0FedES <= 3; i0FedES++) {
1331 if (fFedStatus[i0FedES] == 1) {
1332 fNbOfTreatedFedsInDee[3]++;
1333 fFedStatus[i0FedES] = 2;
1334 }
1335 }
1336
1337
1338
1339 j0Fed = 4;
1340 if (fFedStatus[j0Fed] == 1) {
1341 fNbOfTreatedFedsInDee[3]++;
1342 fNbOfTreatedFedsInDee[2]++;
1343 fFedStatus[j0Fed] = 2;
1344 }
1345
1346
1347
1348 for (Int_t i0FedES = 5; i0FedES <= 8; i0FedES++) {
1349 if (fFedStatus[i0FedES] == 1) {
1350 fNbOfTreatedFedsInDee[2]++;
1351 fFedStatus[i0FedES] = 2;
1352 }
1353 }
1354
1355
1356
1357 for (Int_t i0FedES = 9; i0FedES <= 12; i0FedES++) {
1358 if (fFedStatus[i0FedES] == 1) {
1359 fNbOfTreatedFedsInDee[0]++;
1360 fFedStatus[i0FedES] = 2;
1361 }
1362 }
1363
1364
1365
1366 j0Fed = 13;
1367 if (fFedStatus[j0Fed] == 1) {
1368 fNbOfTreatedFedsInDee[0]++;
1369 fNbOfTreatedFedsInDee[1]++;
1370 fFedStatus[j0Fed] = 2;
1371 }
1372
1373
1374
1375 for (Int_t i0FedES = 14; i0FedES <= 17; i0FedES++) {
1376 if (fFedStatus[i0FedES] == 1) {
1377 fNbOfTreatedFedsInDee[1]++;
1378 fFedStatus[i0FedES] = 2;
1379 }
1380 }
1381
1382
1383 for (Int_t i0Dee = 0; i0Dee < 4; i0Dee++) {
1384 if (fNbOfTreatedFedsInStex[i0Dee] >= 0 && fNbOfTreatedFedsInStex[i0Dee] < 5) {
1385 fNbOfTreatedFedsInStex[i0Dee] = fNbOfTreatedFedsInDee[i0Dee];
1386 }
1387 if (fNbOfTreatedFedsInDee[i0Dee] == 5) {
1388 fStexStatus[i0Dee] = 1;
1389 fNbOfTreatedFedsInDee[i0Dee] = 0;
1390 }
1391 }
1392
1393 }
1394
1395
1396
1397 for (Int_t i0Stex = fStexIndexBegin; i0Stex < fStexIndexStop; i0Stex++) {
1398 if (fStexStatus[i0Stex] == 1) {
1399 fNbOfTreatedStexs++;
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412 std::cout << "---------- End of analysis for " << fStexName << i0Stex + 1 << " -----------" << std::endl;
1413 Int_t n3 = 3;
1414 CheckMsg(n3, i0Stex);
1415
1416
1417
1418
1419
1420
1421 std::cout << " Number of selected events = " << fNbOfSelectedEvents << std::endl;
1422 std::cout << std::endl
1423 << fNbOfTreatedStexs << " " << fStexName << "'s with " << fReqNbOfEvts << " events analyzed."
1424 << std::endl
1425 << "---------------------------------------------------------" << std::endl;
1426
1427
1428 if (fStexName == "SM") {
1429 if (fMyCnaEBSM[i0Stex] != nullptr) {
1430
1431 fMyCnaEBSM[i0Stex]->StartStopDate(fDateFirst[i0Stex], fDateLast[i0Stex]);
1432 fMyCnaEBSM[i0Stex]->StartStopTime(fTimeFirst[i0Stex], fTimeLast[i0Stex]);
1433
1434
1435 fMyCnaEBSM[i0Stex]->GetReadyToCompute();
1436 fMyCnaEBSM[i0Stex]->SampleValues();
1437
1438
1439
1440 if (fMyCnaEBSM[i0Stex]->WriteRootFile() == kFALSE) {
1441 std::cout << "!EcnaAnalyzer::analyze> PROBLEM with write ROOT file for SM" << i0Stex + 1 << fTTBELL
1442 << std::endl;
1443 }
1444 }
1445
1446
1447 delete fMyCnaEBSM[i0Stex];
1448 fMyCnaEBSM[i0Stex] = nullptr;
1449 std::cout << "!EcnaAnalyzer::analyze> Set memory free: delete done for SM " << i0Stex + 1 << std::endl;
1450 }
1451
1452 if (fStexName == "Dee") {
1453 if (fMyCnaEEDee[i0Stex] != nullptr) {
1454
1455 fMyCnaEEDee[i0Stex]->StartStopDate(fDateFirst[i0Stex], fDateLast[i0Stex]);
1456 fMyCnaEEDee[i0Stex]->StartStopTime(fTimeFirst[i0Stex], fTimeLast[i0Stex]);
1457
1458
1459 fMyCnaEEDee[i0Stex]->GetReadyToCompute();
1460 fMyCnaEEDee[i0Stex]->SampleValues();
1461
1462
1463
1464 if (fMyCnaEEDee[i0Stex]->WriteRootFile() == kFALSE) {
1465 std::cout << "!EcnaAnalyzer::analyze> PROBLEM with write ROOT file "
1466 "for Dee"
1467 << i0Stex + 1 << fTTBELL << std::endl;
1468 }
1469 }
1470
1471
1472 delete fMyCnaEEDee[i0Stex];
1473 fMyCnaEEDee[i0Stex] = nullptr;
1474 std::cout << "!EcnaAnalyzer::analyze> Set memory free: delete done for Dee " << i0Stex + 1 << std::endl;
1475 }
1476
1477 fStexStatus[i0Stex] = 2;
1478 std::cout << "*----------------------------------------------------------"
1479 "------------------ "
1480 << std::endl;
1481
1482 }
1483 }
1484 }
1485
1486
1487 Bool_t EcnaAnalyzer::AnalysisOutcome(const TString &s_opt) {
1488
1489
1490 Bool_t result = kFALSE;
1491
1492 if (s_opt == "EVT") {
1493 Int_t MaxNbOfStex = 0;
1494 if (fStexName == "SM") {
1495 MaxNbOfStex = fMyEBEcal->MaxSMInEB();
1496 }
1497 if (fStexName == "Dee") {
1498 MaxNbOfStex = fMyEEEcal->MaxDeeInEE();
1499 }
1500
1501 if (((fStexNumber > 0 && fNbOfTreatedStexs == 1) || (fStexNumber == 0 && fNbOfTreatedStexs == MaxNbOfStex)) &&
1502 ((fLastReqEvent < fFirstReqEvent) ||
1503 (fLastReqEvent >= fFirstReqEvent && fCurrentEventNumber <= fLastReqEvent))) {
1504 std::cout << std::endl
1505 << "**************************** ANALYSIS REPORT > OK "
1506 "**************************************"
1507 << std::endl
1508 << "*EcnaAnalyzer::AnalysisOutcome(...)> The maximum requested "
1509 "number of events and the maximum"
1510 << std::endl
1511 << " number of treated " << fStexName << "'s have been reached."
1512 << std::endl
1513 << " Analysis successfully "
1514 "ended from EcnaAnalyzer "
1515 << std::endl
1516 << " by SIGNAL: "
1517 "kill(getpid(),SIGUSR2)."
1518 << std::endl
1519 << " Number of selected "
1520 "events = "
1521 << fNbOfSelectedEvents << std::endl
1522 << " Last requested event "
1523 "number = "
1524 << fLastReqEvent << std::endl
1525 << " Current event number "
1526 " = "
1527 << fCurrentEventNumber << std::endl;
1528
1529 Int_t n0 = 0;
1530 CheckMsg(n0);
1531
1532 std::cout << "***********************************************************"
1533 "*****************************"
1534 << std::endl
1535 << std::endl;
1536
1537 result = kTRUE;
1538 kill(getpid(), SIGUSR2);
1539 }
1540
1541 if (fLastReqEvent >= fFirstReqEvent && fCurrentEventNumber > fLastReqEvent &&
1542 !((fStexNumber > 0 && fNbOfTreatedStexs == 1) || (fStexNumber == 0 && fNbOfTreatedStexs == MaxNbOfStex))) {
1543 std::cout << std::endl
1544 << "**************************** ANALYSIS REPORT >>> *** "
1545 "WARNING *** WARNING *** WARNING ***"
1546 << std::endl
1547 << "*EcnaAnalyzer::AnalysisOutcome(...)> Last event reached "
1548 "before completion of analysis."
1549 << std::endl
1550 << " Analysis ended from "
1551 "EcnaAnalyzer "
1552 << std::endl
1553 << " by SIGNAL: "
1554 "kill(getpid(),SIGUSR2)."
1555 << std::endl
1556 << " Number of selected "
1557 "events = "
1558 << fNbOfSelectedEvents << std::endl
1559 << " Last requested event "
1560 "number = "
1561 << fLastReqEvent << std::endl
1562 << " Current event number "
1563 " = "
1564 << fCurrentEventNumber << std::endl;
1565
1566 Int_t n0 = 0;
1567 CheckMsg(n0);
1568
1569 std::cout << "***********************************************************"
1570 "*****************************"
1571 << std::endl
1572 << std::endl;
1573
1574 result = kTRUE;
1575 kill(getpid(), SIGUSR2);
1576 }
1577 } else {
1578 if (s_opt == "ERR_FNEG") {
1579 std::cout << std::endl
1580 << "**************************** ANALYSIS REPORT >>> **** ERROR **** "
1581 "ERROR **** ERROR ******"
1582 << std::endl
1583 << "*EcnaAnalyzer::AnalysisOutcome(...)> First event number = " << fFirstReqEvent
1584 << ". Should be strictly potitive." << std::endl
1585 << " Analysis ended from EcnaAnalyzer " << std::endl
1586 << " by SIGNAL: kill(getpid(),SIGUSR2)." << std::endl;
1587
1588 std::cout << "***********************************************************"
1589 "*****************************"
1590 << std::endl
1591 << std::endl;
1592
1593 result = kTRUE;
1594 kill(getpid(), SIGUSR2);
1595 }
1596 if (s_opt == "ERR_LREQ") {
1597 std::cout << std::endl
1598 << "**************************** ANALYSIS REPORT >>> **** ERROR **** "
1599 "ERROR **** ERROR ******"
1600 << std::endl
1601 << "*EcnaAnalyzer::analyze(...)> Requested number of events = " << fReqNbOfEvts << "." << std::endl
1602 << " Too large compared to the event "
1603 "range: "
1604 << fFirstReqEvent << " - " << fLastReqEvent << std::endl
1605 << " Analysis ended from EcnaAnalyzer " << std::endl
1606 << " by SIGNAL: kill(getpid(),SIGUSR2)." << std::endl;
1607
1608 std::cout << "***********************************************************"
1609 "*****************************"
1610 << std::endl
1611 << std::endl;
1612
1613 result = kTRUE;
1614 kill(getpid(), SIGUSR2);
1615 }
1616 }
1617 return result;
1618 }
1619
1620 void EcnaAnalyzer::CheckMsg(const Int_t &MsgNum) {
1621 Int_t nm1 = -1;
1622 CheckMsg(MsgNum, nm1);
1623 }
1624
1625 void EcnaAnalyzer::CheckMsg(const Int_t &MsgNum, const Int_t &i0Stex) {
1626
1627
1628 if (MsgNum == 1) {
1629 std::cout << "---------------- CROSS-CHECK A ------------------ " << std::endl
1630 << "**************** CURRENT EVENT ****************** " << std::endl;
1631 }
1632 if (MsgNum == 2) {
1633 std::cout << "---------------- CROSS-CHECK B ------------------ " << std::endl
1634 << "**** FIRST EVENT PASSING USER'S ANALYSIS CUT **** " << std::endl;
1635 }
1636 if (MsgNum == 3) {
1637 std::cout << "---------------- CROSS-CHECK C ------------------ " << std::endl
1638 << "*** CURRENT VALUES BEFORE RESULT FILE WRITING *** " << std::endl;
1639 }
1640 if (MsgNum == 3 || MsgNum == 4) {
1641 std::cout << " fRecNumber = " << fRecNumber << std::endl
1642 << " fEvtNumber = " << fEvtNumber << std::endl;
1643 }
1644
1645 std::cout << " fCurrentEventNumber = " << fCurrentEventNumber << std::endl
1646 << " fNbOfSelectedEvents = " << fNbOfSelectedEvents << std::endl
1647 << " fRunNumber = " << fRunNumber << std::endl
1648 << " Chozen run type = " << runtype(fChozenRunTypeNumber) << std::endl
1649 << " Run type = " << runtype(fRunTypeNumber) << std::endl
1650 << " fFedTcc = " << fFedTcc << std::endl
1651 << " fFedId(+601) = " << fFedId + 601 << std::endl
1652 << " fStexName = " << fStexName << std::endl
1653 << " Chozen gain = " << gainvalue(fChozenGainNumber) << std::endl
1654 << " Mgpa Gain = " << gainvalue(fMgpaGainNumber) << std::endl
1655 << std::endl;
1656
1657 if (fAnalysisName == "AdcPeg12" || fAnalysisName == "AdcSPeg12" || fAnalysisName == "AdcPhys" ||
1658 fAnalysisName == "AdcAny") {
1659 if (fStexName == "SM") {
1660 for (Int_t j0Stex = fStexIndexBegin; j0Stex < fStexIndexStop; j0Stex++) {
1661 Int_t nStexNbOfTreatedEvents = fStexNbOfTreatedEvents[j0Stex];
1662 if (fStexStatus[j0Stex] == 1) {
1663 nStexNbOfTreatedEvents = fStexNbOfTreatedEvents[j0Stex];
1664 }
1665 if (fStexStatus[j0Stex] == 2) {
1666 nStexNbOfTreatedEvents = fStexNbOfTreatedEvents[j0Stex];
1667 }
1668
1669 std::cout << fStexName << std::setw(3) << j0Stex + 1 << ": " << std::setw(5) << nStexNbOfTreatedEvents
1670 << " events. " << fStexName << " status: " << fStexStatus[j0Stex];
1671 if (j0Stex == i0Stex) {
1672 std::cout << " (going to write file for this " << fStexName << ").";
1673 }
1674 std::cout << std::endl;
1675 }
1676 }
1677
1678 if (fStexName == "Dee") {
1679 for (Int_t i0FedES = 0; i0FedES < fMaxFedUnitCounter; i0FedES++) {
1680 Int_t nFedNbOfTreatedEvents = fFedNbOfTreatedEvents[i0FedES];
1681 if (fFedStatus[i0FedES] == 1) {
1682 nFedNbOfTreatedEvents = fFedNbOfTreatedEvents[i0FedES];
1683 }
1684 if (fFedStatus[i0FedES] == 2) {
1685 nFedNbOfTreatedEvents = fFedNbOfTreatedEvents[i0FedES];
1686 }
1687
1688 std::cout << "Fed (ES) " << std::setw(3) << i0FedES + 1 << ": " << std::setw(5) << nFedNbOfTreatedEvents
1689 << " events."
1690 << " Fed status: " << fFedStatus[i0FedES] << ", order: " << std::setw(3) << fFedStatusOrder[i0FedES]
1691 << " (" << fDeeNumberString[i0FedES] << ")" << std::endl;
1692 }
1693
1694 for (Int_t j0Stex = fStexIndexBegin; j0Stex < fStexIndexStop; j0Stex++) {
1695 std::cout << fStexName << std::setw(3) << j0Stex + 1 << ": " << std::setw(5) << fNbOfTreatedFedsInStex[j0Stex]
1696 << " analyzed Fed(s). " << fStexName << " status: " << fStexStatus[j0Stex];
1697 if (j0Stex == i0Stex) {
1698 std::cout << " (going to write file for this " << fStexName << ").";
1699 }
1700 std::cout << std::endl;
1701 }
1702 }
1703
1704 std::cout << "Number of " << fStexName << "'s with " << fReqNbOfEvts << " events analyzed: " << fNbOfTreatedStexs
1705 << std::endl;
1706 }
1707
1708 if (MsgNum == 1 || MsgNum == 2) {
1709 std::cout << "*------------------------------------------------------------"
1710 "---------------- "
1711 << std::endl;
1712 }
1713 if (MsgNum == 3) {
1714 std::cout << "*............................................................"
1715 "................ "
1716 << std::endl;
1717 }
1718
1719 }
1720
1721 TString EcnaAnalyzer::runtype(const Int_t &numtype) {
1722 TString cType = "?";
1723
1724 if (numtype == 0) {
1725 cType = "COSMICS";
1726 }
1727 if (numtype == 1) {
1728 cType = "BEAMH4";
1729 }
1730 if (numtype == 2) {
1731 cType = "BEAMH2";
1732 }
1733 if (numtype == 3) {
1734 cType = "MTCC";
1735 }
1736 if (numtype == 4) {
1737 cType = "LASER_STD";
1738 }
1739 if (numtype == 5) {
1740 cType = "LASER_POWER_SCAN";
1741 }
1742 if (numtype == 6) {
1743 cType = "LASER_DELAY_SCAN";
1744 }
1745 if (numtype == 7) {
1746 cType = "TESTPULSE_SCAN_MEM";
1747 }
1748 if (numtype == 8) {
1749 cType = "TESTPULSE_MGPA";
1750 }
1751 if (numtype == 9) {
1752 cType = "PEDESTAL_STD";
1753 }
1754 if (numtype == 10) {
1755 cType = "PEDESTAL_OFFSET_SCAN";
1756 }
1757 if (numtype == 11) {
1758 cType = "PEDESTAL_25NS_SCAN";
1759 }
1760 if (numtype == 12) {
1761 cType = "LED_STD";
1762 }
1763
1764 if (numtype == 13) {
1765 cType = "PHYSICS_GLOBAL";
1766 }
1767 if (numtype == 14) {
1768 cType = "COSMICS_GLOBAL";
1769 }
1770 if (numtype == 15) {
1771 cType = "HALO_GLOBAL";
1772 }
1773
1774 if (numtype == 16) {
1775 cType = "LASER_GAP";
1776 }
1777 if (numtype == 17) {
1778 cType = "TESTPULSE_GAP";
1779 }
1780 if (numtype == 18) {
1781 cType = "PEDESTAL_GAP";
1782 }
1783 if (numtype == 19) {
1784 cType = "LED_GAP";
1785 }
1786
1787 if (numtype == 20) {
1788 cType = "PHYSICS_LOCAL";
1789 }
1790 if (numtype == 21) {
1791 cType = "COSMICS_LOCAL";
1792 }
1793 if (numtype == 22) {
1794 cType = "HALO_LOCAL";
1795 }
1796 if (numtype == 23) {
1797 cType = "CALIB_LOCAL";
1798 }
1799
1800
1801 if (numtype == 24) {
1802 cType = "PEDSIM";
1803 }
1804 if (numtype == 25) {
1805 cType = "ANY_RUN";
1806 }
1807
1808 return cType;
1809 }
1810
1811 Int_t EcnaAnalyzer::gainvalue(const Int_t &numgain) {
1812 Int_t value = 0;
1813
1814 if (numgain == 1) {
1815 value = 12;
1816 }
1817 if (numgain == 2) {
1818 value = 6;
1819 }
1820 if (numgain == 3) {
1821 value = 1;
1822 }
1823
1824 return value;
1825 }