CbmRoot
Loading...
Searching...
No Matches
CbmCosy2019MonitorAlgoHodo.cxx
Go to the documentation of this file.
1/* Copyright (C) 2019-2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau, Florian Uhlig [committer] */
4
5// -----------------------------------------------------------------------------
6// ----- -----
7// ----- CbmCosy2019MonitorAlgoHodo -----
8// ----- Created 03.07.2019 by P.-A. Loizeau -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
13
15
16//#include "CbmCosy2019HodoPar.h"
17
18#include "FairRootManager.h"
19#include "FairRun.h"
20#include "FairRunOnline.h"
21#include "FairRuntimeDb.h"
22#include "TCanvas.h"
23#include "TH1.h"
24#include "TH2.h"
25#include "TList.h"
26#include "TProfile.h"
27#include "TROOT.h"
28#include "TString.h"
29
30#include <Logger.h>
31
32#include <cstdint>
33#include <fstream>
34#include <iomanip>
35#include <iostream>
36
37// -------------------------------------------------------------------------
40 ,
42 fbMonitorMode(kFALSE)
43 , fbDebugMonitorMode(kFALSE)
45 , fuDpbId(0x5b75)
47 , fvbHodoSwapXY(kuNbHodos, kFALSE)
48 , fvbHodoInvertX(kuNbHodos, kFALSE)
49 , fvbHodoInvertY(kuNbHodos, kFALSE)
52 ,
53 /*
54 fUnpackPar( nullptr ),
55 fuNbModules( 0 ),
56 fviModuleType(),
57 fviModAddress(),
58 fuNrOfDpbs( 0 ),
59 fDpbIdIndexMap(),
60 fvbCrobActiveFlag(),
61 fuNbFebs( 0 ),
62 fuNbHodoXyters( 0 ),
63 fviFebModuleIdx(),
64 fviFebModuleSide(),
65 fviFebType(),
66 fvdFebAdcGain(),
67 fvdFebAdcOffs(),
68 fviFebAddress(),
69*/
73 , fdTsStartTime(-1.0)
74 , fdTsStopTimeCore(-1.0)
76 , fdMsTime(-1.0)
77 , fuMsIndex(0)
78 , fmMsgCounter()
80 , fuCurrDpbId(0)
84 , fdStartTime(-1.0)
85 , fdStartTimeMsSz(-1.0)
86 , ftStartTimeUnix(std::chrono::steady_clock::now())
87 , fvmHitsInMs()
88 , fhHodoMessType(nullptr)
89 , fhHodoStatusMessType(nullptr)
91 , fhHodoMessTypePerElink(nullptr)
92 , fhHodoChanCntRaw(kuNbHodos, nullptr)
93 , fhHodoChanAdcRaw(kuNbHodos, nullptr)
95 , fhHodoChanAdcCal(kuNbHodos, nullptr)
97 , fhHodoChanRawTs(kuNbHodos, nullptr)
102 , fhHodoChanDistT(kuNbHodos, nullptr)
103 , fhHodoFiberCnt(kuNbHodos, std::vector<TH1*>(kuNbAxis, nullptr))
104 , fhHodoFiberAdc(kuNbHodos, std::vector<TH2*>(kuNbAxis, nullptr))
105 , fhHodoFiberAdcProf(kuNbHodos, std::vector<TProfile*>(kuNbAxis, nullptr))
115 , fhHodoFullCoincPosA(nullptr)
116 , fhHodoFullCoincPosB(nullptr)
117 , fhHodoFullCoincCompX(nullptr)
118 , fhHodoFullCoincCompY(nullptr)
120 , fhHodoFullCoincTimeDiff(nullptr)
122 , fhHodoFullCoincRateEvo(nullptr)
124 , fhPrevHitDtAllAsics(nullptr)
125 , fhPrevHitDtAsicA(nullptr)
126 , fhPrevHitDtAsicB(nullptr)
127 , fhPrevHitDtAsicsAB(nullptr)
134 , fcSummary(nullptr)
135 , fcHodoSummaryRaw(kuNbHodos, nullptr)
136 , fcHodoSummaryFiber(kuNbHodos, nullptr)
137 , fcHodoFiberCoinc(nullptr)
138 , fcHodoFiberCoincAB(nullptr)
139 , fcHodoFullCoinc(nullptr)
140 , fcHodoFullCoincPos(nullptr)
141 , fcHodoPrevHitDt(nullptr)
142{
143}
149
150// -------------------------------------------------------------------------
152{
153 LOG(info) << "Initializing mCBM HODO 2019 monitor algo";
154
155 return kTRUE;
156}
164
165// -------------------------------------------------------------------------
167{
168 LOG(info) << "Init parameter containers for CbmCosy2019MonitorAlgoHodo";
169 Bool_t initOK = ReInitContainers();
170
171 return initOK;
172}
174{
175 LOG(info) << "**********************************************";
176 LOG(info) << "ReInit parameter containers for CbmCosy2019MonitorAlgoHodo";
177 /*
178 fUnpackPar = (CbmCosy2019HodoPar*)fParCList->FindObject("CbmCosy2019HodoPar");
179 if( nullptr == fUnpackPar )
180 return kFALSE;
181*/
182 Bool_t initOK = InitParameters();
183
184 return initOK;
185}
187{
188 if (nullptr == fParCList) fParCList = new TList();
189 /*
190 fUnpackPar = new CbmCosy2019HodoPar("CbmCosy2019HodoPar");
191 fParCList->Add(fUnpackPar);
192*/
193 return fParCList;
194}
196{
197 /*
198 fuNbModules = fUnpackPar->GetNbOfModules();
199 LOG(info) << "Nr. of STS Modules: " << fuNbModules;
200
201 fviModuleType.resize( fuNbModules );
202 fviModAddress.resize( fuNbModules );
203 for( UInt_t uModIdx = 0; uModIdx < fuNbModules; ++uModIdx)
204 {
205 fviModuleType[ uModIdx ] = fUnpackPar->GetModuleType( uModIdx );
206 fviModAddress[ uModIdx ] = fUnpackPar->GetModuleAddress( uModIdx );
207 LOG(info) << "Module #" << std::setw(2) << uModIdx
208 << " Type " << std::setw(4) << fviModuleType[ uModIdx ]
209 << " Address 0x" << std::setw(8) << std::hex <<fviModAddress[ uModIdx ]
210 << std::dec;
211 } // for( UInt_t uModIdx = 0; uModIdx < fuNbModules; ++uModIdx)
212
213 fuNrOfDpbs = fUnpackPar->GetNrOfDpbs();
214 LOG(info) << "Nr. of STS DPBs: " << fuNrOfDpbs;
215
216 fDpbIdIndexMap.clear();
217 for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
218 {
219 fDpbIdIndexMap[ fUnpackPar->GetDpbId( uDpb ) ] = uDpb;
220 LOG(info) << "Eq. ID for DPB #" << std::setw(2) << uDpb << " = 0x"
221 << std::setw(4) << std::hex << fUnpackPar->GetDpbId( uDpb )
222 << std::dec
223 << " => " << fDpbIdIndexMap[ fUnpackPar->GetDpbId( uDpb ) ];
224 } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
225
226 fuNbFebs = fUnpackPar->GetNrOfFebs();
227 LOG(info) << "Nr. of FEBs: " << fuNbFebs;
228
229 fuNbHodoXyters = fUnpackPar->GetNrOfAsics();
230 LOG(info) << "Nr. of HodoXyter ASICs: " << fuNbHodoXyters;
231
232 fvbCrobActiveFlag.resize( fuNrOfDpbs );
233 fviFebModuleIdx.resize( fuNrOfDpbs );
234 fviFebModuleSide.resize( fuNrOfDpbs );
235 fviFebType.resize( fuNrOfDpbs );
236 fvdFebAdcGain.resize( fuNrOfDpbs );
237 fvdFebAdcOffs.resize( fuNrOfDpbs );
238 for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
239 {
240 fvbCrobActiveFlag[ uDpb ].resize( fUnpackPar->GetNbCrobsPerDpb() );
241 fviFebModuleIdx[ uDpb ].resize( fUnpackPar->GetNbCrobsPerDpb() );
242 fviFebModuleSide[ uDpb ].resize( fUnpackPar->GetNbCrobsPerDpb() );
243 fviFebType[ uDpb ].resize( fUnpackPar->GetNbCrobsPerDpb() );
244 fvdFebAdcGain[ uDpb ].resize( fUnpackPar->GetNbCrobsPerDpb() );
245 fvdFebAdcOffs[ uDpb ].resize( fUnpackPar->GetNbCrobsPerDpb() );
246 for( UInt_t uCrobIdx = 0; uCrobIdx < fUnpackPar->GetNbCrobsPerDpb(); ++uCrobIdx )
247 {
248 fvbCrobActiveFlag[ uDpb ][ uCrobIdx ] = fUnpackPar->IsCrobActive( uDpb, uCrobIdx );
249
250 fviFebModuleIdx[ uDpb ][ uCrobIdx ].resize( fUnpackPar->GetNbFebsPerCrob() );
251 fviFebModuleSide[ uDpb ][ uCrobIdx ].resize( fUnpackPar->GetNbFebsPerCrob() );
252 fviFebType[ uDpb ][ uCrobIdx ].resize( fUnpackPar->GetNbFebsPerCrob(), -1 );
253 fvdFebAdcGain[ uDpb ][ uCrobIdx ].resize( fUnpackPar->GetNbFebsPerCrob(), 0.0 );
254 fvdFebAdcOffs[ uDpb ][ uCrobIdx ].resize( fUnpackPar->GetNbFebsPerCrob(), 0.0 );
255 for( UInt_t uFebIdx = 0; uFebIdx < fUnpackPar->GetNbFebsPerCrob(); ++ uFebIdx )
256 {
257 fviFebModuleIdx[ uDpb ][ uCrobIdx ][ uFebIdx ] = fUnpackPar->GetFebModuleIdx( uDpb, uCrobIdx, uFebIdx );
258 fviFebModuleSide[ uDpb ][ uCrobIdx ][ uFebIdx ] = fUnpackPar->GetFebModuleSide( uDpb, uCrobIdx, uFebIdx );
259 fvdFebAdcGain[ uDpb ][ uCrobIdx ][ uFebIdx ] = fUnpackPar->GetFebAdcGain( uDpb, uCrobIdx, uFebIdx );
260 fvdFebAdcOffs[ uDpb ][ uCrobIdx ][ uFebIdx ] = fUnpackPar->GetFebAdcOffset( uDpb, uCrobIdx, uFebIdx );
261
262 if( 0 <= fviFebModuleIdx[ uDpb ][ uCrobIdx ][ uFebIdx ] &&
263 fviFebModuleIdx[ uDpb ][ uCrobIdx ][ uFebIdx ] < fuNbModules &&
264 0 <= fviFebModuleSide[ uDpb ][ uCrobIdx ][ uFebIdx ] &&
265 fviFebModuleSide[ uDpb ][ uCrobIdx ][ uFebIdx ] < 2 )
266 {
267 switch( fviModuleType[ fviFebModuleIdx[ uDpb ][ uCrobIdx ][ uFebIdx ] ] )
268 {
269 case 0: // FEB-8-1 with ZIF connector on the right
270 {
271 // P side (0) has type A (0)
272 // N side (1) has type B (1)
273 fviFebType[ uDpb ][ uCrobIdx ][ uFebIdx ] = fviFebModuleSide[ uDpb ][ uCrobIdx ][ uFebIdx ];
274
279 fviFebAddress.push_back( fviModAddress[ fviFebModuleIdx[ uDpb ][ uCrobIdx ][ uFebIdx ] ]
280 + ( fviFebModuleSide[ uDpb ][ uCrobIdx ][ uFebIdx ] << 25 ) );
281
282 break;
283 } // case 0: // FEB-8-1 with ZIF connector on the right
284 case 1: // FEB-8-1 with ZIF connector on the left
285 {
286 // P side (0) has type B (1)
287 // N side (1) has type A (0)
288 fviFebType[ uDpb ][ uCrobIdx ][ uFebIdx ] = !(fviFebModuleSide[ uDpb ][ uCrobIdx ][ uFebIdx ]);
289
294 fviFebAddress.push_back( fviModAddress[ fviFebModuleIdx[ uDpb ][ uCrobIdx ][ uFebIdx ] ]
295 + ( (!fviFebModuleSide[ uDpb ][ uCrobIdx ][ uFebIdx ]) << 25 ) );
296 break;
297 } // case 1: // FEB-8-1 with ZIF connector on the left
298 default:
299 LOG(fatal) << Form( "Bad module type for DPB #%02u CROB #%u FEB %02u: %d",
300 uDpb, uCrobIdx, uFebIdx,
301 fviModuleType[ fviFebModuleIdx[ uDpb ][ uCrobIdx ][ uFebIdx ] ] );
302 break;
303 } // switch( fviModuleType[ fviFebModuleIdx[ uDpb ][ uCrobIdx ][ uFebIdx ] ] )
304 } // FEB active and module index OK
305 else if( -1 == fviFebModuleIdx[ uDpb ][ uCrobIdx ][ uFebIdx ] ||
306 -1 == fviFebModuleSide[ uDpb ][ uCrobIdx ][ uFebIdx ] )
307 {
308 fviFebAddress.push_back( 0 );
309 } // Module index or type is set to inactive
310 else
311 {
312 LOG(fatal) << Form( "Bad module Index and/or Side for DPB #%02u CROB #%u FEB %02u: %d %d",
313 uDpb, uCrobIdx, uFebIdx,
314 fviFebModuleIdx[ uDpb ][ uCrobIdx ][ uFebIdx ],
315 fviFebModuleSide[ uDpb ][ uCrobIdx ][ uFebIdx ] );
316 } // Bad module index or type for this FEB
317 } // for( UInt_t uFebIdx = 0; uFebIdx < fUnpackPar->GetNbFebsPerCrob(); ++ uFebIdx )
318 } // for( UInt_t uCrobIdx = 0; uCrobIdx < fUnpackPar->GetNbCrobsPerDpb(); ++uCrobIdx )
319 } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
320
321 for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
322 {
323 TString sPrintoutLine = Form( "DPB #%02u CROB Active ?: ", uDpb);
324 for( UInt_t uCrobIdx = 0; uCrobIdx < fUnpackPar->GetNbCrobsPerDpb(); ++uCrobIdx )
325 {
326 sPrintoutLine += Form( "%1u", ( fvbCrobActiveFlag[ uDpb ][ uCrobIdx ] == kTRUE ) );
327 } // for( UInt_t uCrobIdx = 0; uCrobIdx < fUnpackPar->GetNbCrobsPerDpb(); ++uCrobIdx )
328 LOG(info) << sPrintoutLine;
329 } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
330
331 UInt_t uGlobalFebIdx = 0;
332 for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
333 {
334 for( UInt_t uCrobIdx = 0; uCrobIdx < fUnpackPar->GetNbCrobsPerDpb(); ++uCrobIdx )
335 {
336 LOG(info) << Form( "DPB #%02u CROB #%u: ", uDpb, uCrobIdx);
337 for( UInt_t uFebIdx = 0; uFebIdx < fUnpackPar->GetNbFebsPerCrob(); ++ uFebIdx )
338 {
339 if( 0 <= fviFebModuleIdx[ uDpb ][ uCrobIdx ][ uFebIdx ] )
340 LOG(info) << Form( " FEB #%02u (%02u): Mod. Idx = %03d Side %c (%2d) Type %c (%2d) (Addr. 0x%08x) ADC gain %4.0f e- ADC Offs %5.0f e-",
341 uFebIdx, uGlobalFebIdx,
342 fviFebModuleIdx[ uDpb ][ uCrobIdx ][ uFebIdx ],
343 1 == fviFebModuleSide[ uDpb ][ uCrobIdx ][ uFebIdx ] ? 'N': 'P',
344 fviFebModuleSide[ uDpb ][ uCrobIdx ][ uFebIdx ],
345 1 == fviFebType[ uDpb ][ uCrobIdx ][ uFebIdx ] ? 'B' : 'A',
346 fviFebType[ uDpb ][ uCrobIdx ][ uFebIdx ],
347 fviFebAddress[ uGlobalFebIdx ],
348 fvdFebAdcGain[ uDpb ][ uCrobIdx ][ uFebIdx ],
349 fvdFebAdcOffs[ uDpb ][ uCrobIdx ][ uFebIdx ]
350 );
351 uGlobalFebIdx ++;
352 } // for( UInt_t uFebIdx = 0; uFebIdx < fUnpackPar->GetNbFebsPerCrob(); ++ uFebIdx )
353 } // for( UInt_t uCrobIdx = 0; uCrobIdx < fUnpackPar->GetNbCrobsPerDpb(); ++uCrobIdx )
354 } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
355
356 // Internal status initialization
357 fvulCurrentTsMsb.resize( fuNrOfDpbs );
358 fvuCurrentTsMsbCycle.resize( fuNrOfDpbs );
359 for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
360 {
361 fvulCurrentTsMsb[uDpb] = 0;
362 fvuCurrentTsMsbCycle[uDpb] = 0;
363 } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
364*/
365
367 /*
368 for( UInt_t uHodoIdx = 0; uHodoIdx < kuNbHodos; ++uHodoIdx )
369 {
370 fhHodoFiberCnt[ uHodoIdx ].resize( kuNbAxis, nullptr );
371 fhHodoFiberAdc[ uHodoIdx ].resize( kuNbAxis, nullptr );
372 fhHodoFiberAdcProf[ uHodoIdx ].resize( kuNbAxis, nullptr );
373 fhHodoFiberHitRateEvo[ uHodoIdx ].resize( kuNbAxis, nullptr );
374 fvdChanCountsSinceLastRateUpdate[ uHodoIdx ].resize( kuNbChanPerAsic, 0.0 );
375 fdHodoChanLastTimeForDist[ uHodoIdx ].resize( kuNbChanPerAsic, 0.0 );
376 } // for( uHodoIdx = 0; uHodoIdx < kuNbHodos; ++uHodoIdx )
377*/
378 return kTRUE;
379}
380// -------------------------------------------------------------------------
381
382void CbmCosy2019MonitorAlgoHodo::AddMsComponentToList(size_t component, UShort_t usDetectorId)
383{
385 for (UInt_t uCompIdx = 0; uCompIdx < fvMsComponentsList.size(); ++uCompIdx)
386 if (component == fvMsComponentsList[uCompIdx]) return;
387
389 fvMsComponentsList.push_back(component);
390
391 LOG(info) << "CbmCosy2019MonitorAlgoHodo::AddMsComponentToList => Component " << component << " with detector ID 0x"
392 << std::hex << usDetectorId << std::dec << " added to list";
393}
394// -------------------------------------------------------------------------
395
397{
398 fulCurrentTsIdx = ts.index();
399 fdTsStartTime = static_cast<Double_t>(ts.descriptor(0, 0).idx);
400
402 if (0 == fulCurrentTsIdx) { return kTRUE; } // if( 0 == fulCurrentTsIdx )
403
405 if (-1.0 == fdTsCoreSizeInNs) {
406 fuNbCoreMsPerTs = ts.num_core_microslices();
407 fuNbOverMsPerTs = ts.num_microslices(0) - ts.num_core_microslices();
410 LOG(info) << "Timeslice parameters: each TS has " << fuNbCoreMsPerTs << " Core MS and " << fuNbOverMsPerTs
411 << " Overlap MS, for a core duration of " << fdTsCoreSizeInNs << " ns and a full duration of "
412 << fdTsFullSizeInNs << " ns";
413
417 LOG(info) << "In each TS " << fuNbMsLoop << " MS will be looped over";
418 } // if( -1.0 == fdTsCoreSizeInNs )
419
422 // LOG(info) << Form( "TS %5d Start %12f Stop %12f", fulCurrentTsIdx, fdTsStartTime, fdTsStopTimeCore );
423
425 for (fuMsIndex = 0; fuMsIndex < fuNbMsLoop; fuMsIndex++) {
427 for (UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx) {
428 UInt_t uMsComp = fvMsComponentsList[uMsCompIdx];
429
430 if (kFALSE == ProcessMs(ts, uMsComp, fuMsIndex)) {
431 LOG(error) << "Failed to process ts " << fulCurrentTsIdx << " MS " << fuMsIndex << " for component " << uMsComp;
432 return kFALSE;
433 } // if( kFALSE == ProcessMs( ts, uMsCompIdx, fuMsIndex ) )
434 } // for( UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx )
435
437 std::sort(fvmHitsInMs.begin(), fvmHitsInMs.end());
438 /*
440 for( auto itHitIn = fvmHitsInMs.begin(); itHitIn < fvmHitsInMs.end(); ++itHitIn )
441 {
442 UInt_t uFebIdx = itHitIn->GetAsic() / fUnpackPar->GetNbAsicsPerFeb();
443 UInt_t uChanInFeb = itHitIn->GetChan()
444 + fUnpackPar->GetNbChanPerAsic() * (itHitIn->GetAsic() % fUnpackPar->GetNbAsicsPerFeb());
445
446 ULong64_t ulTimeInNs = static_cast< ULong64_t >( itHitIn->GetTs() * stsxyter::kdClockCycleNs - fdTimeOffsetNs );
447
448 fDigiVect.push_back( CbmHodoDigi( fviFebAddress[ uFebIdx ], uChanInFeb, ulTimeInNs, itHitIn->GetAdc() ) );
449 } // for( auto itHitIn = fvmHitsInMs.begin(); itHitIn < fvmHitsInMs.end(); ++itHitIn )
450*/
451
452 if (kFALSE == FillHistograms()) {
453 LOG(error) << "Failed to fill histos in ts " << fulCurrentTsIdx << " MS " << fuMsIndex;
454 return kFALSE;
455 } // if( kFALSE == FillHistograms() )
456
458 fvmHitsInMs.clear();
459 } // for( fuMsIndex = 0; fuMsIndex < uNbMsLoop; fuMsIndex ++ )
460
462 fvmHitsInMs.clear();
463
464
465 return kTRUE;
466}
467
468Bool_t CbmCosy2019MonitorAlgoHodo::ProcessMs(const fles::Timeslice& ts, size_t uMsCompIdx, size_t uMsIdx)
469{
470 auto msDescriptor = ts.descriptor(uMsCompIdx, uMsIdx);
471 fuCurrentEquipmentId = msDescriptor.eq_id;
472 const uint8_t* msContent = reinterpret_cast<const uint8_t*>(ts.content(uMsCompIdx, uMsIdx));
473
474 uint32_t uSize = msDescriptor.size;
475 fulCurrentMsIdx = msDescriptor.idx;
476
477 Double_t dMsTime = (1e-9) * static_cast<double>(fulCurrentMsIdx);
478 LOG(debug) << "Microslice: " << fulCurrentMsIdx << " from EqId " << std::hex << fuCurrentEquipmentId << std::dec
479 << " has size: " << uSize;
480
481 if (0 == fvbMaskedComponents.size()) fvbMaskedComponents.resize(ts.num_components(), kFALSE);
482
483 fuCurrDpbId = static_cast<uint32_t>(fuCurrentEquipmentId & 0xFFFF);
484
486 if (fuDpbId != fuCurrDpbId) {
487 if (kFALSE == fvbMaskedComponents[uMsCompIdx]) {
488 LOG(info) << "---------------------------------------------------------------";
489 /*
490 LOG(info) << "hi hv eqid flag si sv idx/start crc size offset";
491 LOG(info) << Form( "%02x %02x %04x %04x %02x %02x %016llx %08x %08x %016llx",
492 static_cast<unsigned int>(msDescriptor.hdr_id),
493 static_cast<unsigned int>(msDescriptor.hdr_ver), msDescriptor.eq_id, msDescriptor.flags,
494 static_cast<unsigned int>(msDescriptor.sys_id),
495 static_cast<unsigned int>(msDescriptor.sys_ver), msDescriptor.idx, msDescriptor.crc,
496 msDescriptor.size, msDescriptor.offset );
497*/
498 LOG(info) << FormatMsHeaderPrintout(msDescriptor);
499 LOG(warning) << "Could not find the sDPB index for AFCK id 0x" << std::hex << fuCurrDpbId << std::dec
500 << " in timeslice " << fulCurrentTsIdx << " in microslice " << uMsIdx << " component " << uMsCompIdx
501 << "\n"
502 << "If valid this index has to be added in the STS "
503 "parameter file in the DbpIdArray field";
504 fvbMaskedComponents[uMsCompIdx] = kTRUE;
505
508 if (1 == fulCurrentTsIdx) return kTRUE;
509 } // if( kFALSE == fvbMaskedComponents[ uMsComp ] )
510 else
511 return kTRUE;
512
513 return kFALSE;
514 } // if( fuDpbId != fuCurrDpbId )
515
517 if (static_cast<Int_t>(fvdPrevMsTime[uMsCompIdx]) < static_cast<Int_t>(dMsTime)) {
519 for (UInt_t uHodoIdx = 0; uHodoIdx < kuNbHodos; ++uHodoIdx) {
521 if (0 == fviTimeSecLastRateUpdate[uHodoIdx]) {
522 fviTimeSecLastRateUpdate[uHodoIdx] = static_cast<Int_t>(dMsTime);
523 for (UInt_t uChan = 0; uChan < kuNbChanPerAsic; ++uChan) {
524 fvdChanCountsSinceLastRateUpdate[uHodoIdx][uChan] = 0.0;
525 } // for( UInt_t uChan = 0; uChan < kuNbChanPerAsic; ++uChan )
526 continue;
527 } // if( 0 == fviTimeSecLastRateUpdate[ uHodoIdx ] )
528
529 Int_t iTimeInt = static_cast<Int_t>(dMsTime) - fviTimeSecLastRateUpdate[uHodoIdx];
530 if (fiTimeIntervalRateUpdate <= iTimeInt) {
531 for (UInt_t uChan = 0; uChan < kuNbChanPerAsic; ++uChan) {
532 fhHodoChanHitRateProf[uHodoIdx]->Fill(uChan, fvdChanCountsSinceLastRateUpdate[uHodoIdx][uChan] / iTimeInt);
533 fvdChanCountsSinceLastRateUpdate[uHodoIdx][uChan] = 0.0;
534 } // for( UInt_t uChan = 0; uChan < kuNbChanPerAsic; ++uChan )
535
536 fviTimeSecLastRateUpdate[uHodoIdx] = static_cast<Int_t>(dMsTime);
537 } // if( fiTimeIntervalRateUpdate <= iTimeInt )
538 } // for( UInt_t uHodoIdx = 0; uHodoIdx < kuNbHodos; ++uHodoIdx )
539 } // if( static_cast<Int_t>( fvdPrevMsTime[ uMsCompIdx ] ) < static_cast<Int_t>( dMsTime ) )
540 fvdPrevMsTime[uMsCompIdx] = dMsTime;
541
543 uint16_t uMsHeaderFlags = msDescriptor.flags;
544 for (UInt_t uBit = 0; uBit < 16; ++uBit)
545 fhHodoMsStatusFieldType->Fill(uBit, (uMsHeaderFlags >> uBit) & 0x1);
546
548 UInt_t uTsMsbCycleHeader = std::floor(fulCurrentMsIdx / (stsxyter::kulTsCycleNbBins * stsxyter::kdClockCycleNs));
549
550 if (0 == uMsIdx) {
551 fvuCurrentTsMsbCycle = uTsMsbCycleHeader;
553 } // if( 0 == uMsIdx )
554 else if (uTsMsbCycleHeader != fvuCurrentTsMsbCycle && 4194303 != fvulCurrentTsMsb) {
555 LOG(warning) << "TS MSB cycle from MS header does not match current cycle from data "
556 << "for TS " << std::setw(12) << fulCurrentTsIdx << " MS " << std::setw(12) << fulCurrentMsIdx
557 << " MsInTs " << std::setw(3) << uMsIdx << " ====> " << fvuCurrentTsMsbCycle << " VS "
558 << uTsMsbCycleHeader;
559 fvuCurrentTsMsbCycle = uTsMsbCycleHeader;
560 }
561
562 // If not integer number of message in input buffer, print warning/error
563 if (0 != (uSize % kuBytesPerMessage))
564 LOG(error) << "The input microslice buffer does NOT "
565 << "contain only complete nDPB messages!";
566
567 // Compute the number of complete messages in the input microslice buffer
568 uint32_t uNbMessages = (uSize - (uSize % kuBytesPerMessage)) / kuBytesPerMessage;
569
570 // Prepare variables for the loop on contents
571 const uint32_t* pInBuff = reinterpret_cast<const uint32_t*>(msContent);
572 for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx++) {
573 // Fill message
574 uint32_t ulData = static_cast<uint32_t>(pInBuff[uIdx]);
575
576 stsxyter::Message mess(static_cast<uint32_t>(ulData & 0xFFFFFFFF));
577
579 stsxyter::MessType typeMess = mess.GetMessType();
580 fmMsgCounter[typeMess]++;
581 fhHodoMessType->Fill(static_cast<uint16_t>(typeMess));
582
583 switch (typeMess) {
585 // Extract the eLink and Asic indices => Should GO IN the fill method now that obly hits are link/asic specific!
586 UShort_t usElinkIdx = mess.GetLinkIndex();
587 fhHodoMessTypePerElink->Fill(usElinkIdx, static_cast<uint16_t>(typeMess));
588
590 UInt_t uHodoIdx = 0;
591 Bool_t bBadElink = kTRUE;
592 for (uHodoIdx = 0; uHodoIdx < kuNbHodos; ++uHodoIdx)
593 if (fvuElinkIdxHodo[uHodoIdx] == usElinkIdx) {
594 bBadElink = kFALSE;
595 break;
596 } // if( fuElinkIdxHodo[ uHodo ] == usElinkIdx )
597
598 if (bBadElink) {
599 LOG(warning) << "CbmCosy2019MonitorAlgoHodo::DoUnpack => "
600 << "Wrong elink Idx! Elink raw " << Form("%2d", usElinkIdx);
601 continue;
602 } // if( bBadElink )
603
604 ProcessHitInfo(mess, uHodoIdx, uMsIdx);
605 break;
606 } // case stsxyter::MessType::Hit :
608 fhHodoMessTypePerElink->Fill(0., static_cast<uint16_t>(typeMess));
609
610 ProcessTsMsbInfo(mess, uIdx, uMsIdx);
611 break;
612 } // case stsxyter::MessType::TsMsb :
614 fhHodoMessTypePerElink->Fill(0., static_cast<uint16_t>(typeMess));
615
616 // The first message in the TS is a special ones: EPOCH
617 ProcessEpochInfo(mess);
618
619 if (0 < uIdx)
620 LOG(info) << "CbmCosy2019MonitorAlgoHodo::DoUnpack => "
621 << "EPOCH message at unexpected position in MS: message " << uIdx << " VS message 0 expected!";
622 break;
623 } // case stsxyter::MessType::TsMsb :
625 UShort_t usElinkIdx = mess.GetStatusLink();
626 fhHodoMessTypePerElink->Fill(usElinkIdx, static_cast<uint16_t>(typeMess));
627 ProcessStatusInfo(mess);
628 break;
629 } // case stsxyter::MessType::Status
631 fhHodoMessTypePerElink->Fill(0., static_cast<uint16_t>(typeMess));
632 // FillTsMsbInfo( mess );
633 break;
634 } // case stsxyter::MessType::Empty :
636 fhHodoMessTypePerElink->Fill(0., static_cast<uint16_t>(typeMess));
637 break;
638 } // case stsxyter::MessType::Dummy / ReadDataAck / Ack :
639 default: {
640 LOG(fatal) << "CbmCosy2019MonitorAlgoHodo::DoUnpack => "
641 << "Unknown message type, should never happen, stopping "
642 "here! Type found was: "
643 << static_cast<int>(typeMess);
644 }
645 } // switch( typeMess )
646 } // for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx ++)
647
648 return kTRUE;
649}
650
651// -------------------------------------------------------------------------
653 const UInt_t& /*uMsIdx*/)
654{
655 UShort_t usChan = mess.GetHitChannel();
656 UShort_t usRawAdc = mess.GetHitAdc();
657 // UShort_t usTsOver = mess.GetHitTimeOver();
658 UShort_t usRawTs = mess.GetHitTime();
659
660 fhHodoChanCntRaw[uHodoIdx]->Fill(usChan);
661 fhHodoChanAdcRaw[uHodoIdx]->Fill(usChan, usRawAdc);
662 fhHodoChanAdcRawProf[uHodoIdx]->Fill(usChan, usRawAdc);
663 fhHodoChanRawTs[uHodoIdx]->Fill(usChan, usRawTs);
664 fhHodoChanMissEvt[uHodoIdx]->Fill(usChan, mess.IsHitMissedEvts());
665
666 /*
667 Double_t dCalAdc = fvdFebAdcOffs[ fuCurrDpbIdx ][ uCrobIdx ][ uFebIdx ]
668 + (usRawAdc - 1)* fvdFebAdcGain[ fuCurrDpbIdx ][ uCrobIdx ][ uFebIdx ];
669 fhHodoChanAdcCal[ uHodoIdx ]->Fill( usChan, dCalAdc );
670 fhHodoChanAdcCalProf[ uHodoIdx ]->Fill( usChan, dCalAdc );
671*/
672
674 UInt_t uAxis = kuChannelToPlaneMap[usChan];
675 UInt_t uFiber = kuChannelToFiberMap[usChan];
676
678 fhHodoFiberCnt[uHodoIdx][uAxis]->Fill(uFiber);
679 fhHodoFiberAdc[uHodoIdx][uAxis]->Fill(uFiber, usRawAdc);
680 fhHodoFiberAdcProf[uHodoIdx][uAxis]->Fill(uFiber, usRawAdc);
681
684 Long64_t ulHitTime = usRawTs;
685 ulHitTime += static_cast<ULong64_t>(stsxyter::kuHitNbTsBins) * static_cast<ULong64_t>(fvulCurrentTsMsb)
686 + static_cast<ULong64_t>(stsxyter::kulTsCycleNbBins) * static_cast<ULong64_t>(fvuCurrentTsMsbCycle);
687
689 Double_t dHitTimeNs = ulHitTime * stsxyter::kdClockCycleNs;
690
692 fhHodoChanDistT[uHodoIdx]->Fill(dHitTimeNs - fdHodoChanLastTimeForDist[uHodoIdx][usChan], usChan);
693 fdHodoChanLastTimeForDist[uHodoIdx][usChan] = dHitTimeNs;
694
695 fvmHitsInMs.push_back(stsxyter::FinalHit(ulHitTime, usRawAdc, uHodoIdx, uFiber, uAxis, 0));
696
698 if (-1 == fdStartTime) fdStartTime = dHitTimeNs;
699
700 // Fill histos with time as X axis
701 Double_t dTimeSinceStartSec = (dHitTimeNs - fdStartTime) * 1e-9;
702 // Double_t dTimeSinceStartMin = dTimeSinceStartSec / 60.0;
703
704 fvdChanCountsSinceLastRateUpdate[uHodoIdx][usChan] += 1;
705
706 fhHodoChanHitRateEvo[uHodoIdx]->Fill(dTimeSinceStartSec, usChan);
707 fhHodoFiberHitRateEvo[uHodoIdx][uAxis]->Fill(dTimeSinceStartSec, uFiber);
708 if (mess.IsHitMissedEvts()) {
709 fhHodoChanMissEvtEvo[uHodoIdx]->Fill(dTimeSinceStartSec, usChan);
710 } // if( mess.IsHitMissedEvts() )
711}
712
713void CbmCosy2019MonitorAlgoHodo::ProcessTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx, UInt_t uMsIdx)
714{
715 UInt_t uVal = mess.GetTsMsbVal();
716
717 // Update Status counters
718 if (uVal < fvulCurrentTsMsb) {
719
720 LOG(info) << " TS " << std::setw(12) << fulCurrentTsIdx << " MS " << std::setw(12) << fulCurrentMsIdx << " MS Idx "
721 << std::setw(4) << uMsIdx << " Msg Idx " << std::setw(5) << uMessIdx << " Old TsMsb " << std::setw(5)
722 << fvulCurrentTsMsb << " Old MsbCy " << std::setw(5) << fvuCurrentTsMsbCycle << " new TsMsb "
723 << std::setw(5) << uVal;
724
726 } // if( uVal < fvulCurrentTsMsb )
727 if (uVal != fvulCurrentTsMsb + 1 && 0 != uVal && 4194303 != fvulCurrentTsMsb
728 && 1 != uMessIdx) // 1st TS MSB in MS always repat of last in prev MS
729 {
730 LOG(info) << "TS MSb Jump in "
731 << " TS " << std::setw(12) << fulCurrentTsIdx << " MS " << std::setw(12) << fulCurrentMsIdx << " MS Idx "
732 << std::setw(4) << uMsIdx << " Msg Idx " << std::setw(5) << uMessIdx << " => Old TsMsb " << std::setw(5)
733 << fvulCurrentTsMsb << " new TsMsb " << std::setw(5) << uVal;
734 } // if( uVal + 1 != fvulCurrentTsMsb && 4194303 != uVal && 0 != fvulCurrentTsMsb && 1 != uMessIdx )
735 fvulCurrentTsMsb = uVal;
736 /*
737 ULong64_t ulNewTsMsbTime = static_cast< ULong64_t >( stsxyter::kuHitNbTsBins )
738 * static_cast< ULong64_t >( fvulCurrentTsMsb )
739 + static_cast< ULong64_t >( stsxyter::kulTsCycleNbBins )
740 * static_cast< ULong64_t >( fvuCurrentTsMsbCycle );
741*/
742}
743
745{
746 // UInt_t uVal = mess.GetEpochVal();
747 // UInt_t uCurrentCycle = uVal % stsxyter::kulTsCycleNbBins;
748
749 /*
750 // Update Status counters
751 if( usVal < fvulCurrentTsMsb )
752 fvuCurrentTsMsbCycle ++;
753 fvulCurrentTsMsb = usVal;
754*/
755}
756
758{
759 /*
760 UInt_t uCrobIdx = usElinkIdx / XXXX
761 Int_t uFebIdx = XXXX
762 UInt_t uAsicIdx = XXX
763
764 UShort_t usStatusField = mess.GetStatusStatus();
765
766 fhPulserStatusMessType->Fill( uAsicIdx, usStatusField );
768 if( fbPrintMessages )
769 {
770 std::cout << Form("TS %12u MS %12u mess %5u ", fulCurrentTsIdx, fulCurrentMsIdx, uIdx );
771 mess.PrintMess( std::cout, fPrintMessCtrl );
772 } // if( fbPrintMessages )
773*/
774}
775
776// -------------------------------------------------------------------------
777
778// -------------------------------------------------------------------------
779
781{
782 fhHodoMessType = new TH1I("hHodoMessType", "Nb of message for each type; Type", 6, 0., 6.);
783 fhHodoMessType->GetXaxis()->SetBinLabel(1, "Dummy");
784 fhHodoMessType->GetXaxis()->SetBinLabel(2, "Hit");
785 fhHodoMessType->GetXaxis()->SetBinLabel(3, "TsMsb");
786 fhHodoMessType->GetXaxis()->SetBinLabel(4, "Epoch");
787 fhHodoMessType->GetXaxis()->SetBinLabel(5, "Status");
788 fhHodoMessType->GetXaxis()->SetBinLabel(6, "Empty");
789
791 new TH2I("hHodoStatusMessType", "Nb of status message of each type for each DPB; ASIC; Status Type", kuNbHodos, 0,
792 kuNbHodos, 16, 0., 16.);
793 /*
794 fhHodoStatusMessType->GetYaxis()->SetBinLabel( 1, "Dummy");
795 fhHodoStatusMessType->GetYaxis()->SetBinLabel( 2, "Hit");
796 fhHodoStatusMessType->GetYaxis()->SetBinLabel( 3, "TsMsb");
797 fhHodoStatusMessType->GetYaxis()->SetBinLabel( 4, "Epoch");
798*/
799
801 new TH2I("hHodoMsStatusFieldType", "For each flag in the MS header, ON/OFF counts; Flag bit []; ON/OFF; MS []", 16,
802 -0.5, 15.5, 2, -0.5, 1.5);
803 /*
804 fhHodoStatusMessType->GetYaxis()->SetBinLabel( 1, "Dummy");
805 fhHodoStatusMessType->GetYaxis()->SetBinLabel( 2, "Hit");
806 fhHodoStatusMessType->GetYaxis()->SetBinLabel( 3, "TsMsb");
807 fhHodoStatusMessType->GetYaxis()->SetBinLabel( 4, "Epoch");
808*/
809
810 fhHodoMessTypePerElink = new TH2I("hHodoMessTypePerElink", "Nb of message of each type for each eLink; eLink; Type",
811 kuNbElinksDpb, 0, kuNbElinksDpb, 6, 0., 6.);
812 fhHodoMessTypePerElink->GetYaxis()->SetBinLabel(1, "Dummy");
813 fhHodoMessTypePerElink->GetYaxis()->SetBinLabel(2, "Hit");
814 fhHodoMessTypePerElink->GetYaxis()->SetBinLabel(3, "TsMsb");
815 fhHodoMessTypePerElink->GetYaxis()->SetBinLabel(4, "Epoch");
816 fhHodoMessTypePerElink->GetYaxis()->SetBinLabel(5, "Status");
817 fhHodoMessTypePerElink->GetYaxis()->SetBinLabel(6, "Empty");
818
819 AddHistoToVector(fhHodoMessType, "MessTypes");
823
824 for (UInt_t uHodoIdx = 0; uHodoIdx < kuNbHodos; ++uHodoIdx) {
827 fhHodoChanCntRaw[uHodoIdx] = new TH1I(Form("hHodoChanCntRaw_%u", uHodoIdx),
828 Form("Hits Count per channel, Hodo #%u; Channel; Hits []", uHodoIdx),
829 kuNbChanPerAsic, -0.5, kuNbChanPerAsic - 0.5);
830
832 fhHodoChanAdcRaw[uHodoIdx] = new TH2I(Form("hHodoChanAdcRaw_%u", uHodoIdx),
833 Form("Raw Adc distribution per channel, Hodo #%u; Channel []; "
834 "Adc []; Hits []",
835 uHodoIdx),
838
840 fhHodoChanAdcRawProf[uHodoIdx] =
841 new TProfile(Form("hHodoChanAdcRawProf_%u", uHodoIdx),
842 Form("Raw Adc prodile per channel, Hodo #%u; Channel []; Adc []", uHodoIdx), kuNbChanPerAsic, -0.5,
843 kuNbChanPerAsic - 0.5);
844 /*
846 fhHodoChanAdcCal[ uHodoIdx ] = new TH2I( Form( "hHodoChanAdcCal_%u", uHodoIdx ),
847 Form( "Cal. Adc distribution per channel, Hodo #%u; Channel []; Adc [e-]; Hits []", uHodoIdx ),
848 kuNbChanPerAsic, -0.5, kuNbChanPerAsic - 0.5,
849 50, 0., 100000. );
850
852 fhHodoChanAdcCalProf[ uHodoIdx ] = new TProfile( Form( "hHodoChanAdcCalProf_%u", uHodoIdx ),
853 Form( "Cal. Adc prodile per channel, Hodo #%u; Channel []; Adc [e-]", uHodoIdx ),
854 kuNbChanPerAsic, -0.5, kuNbChanPerAsic - 0.5 );
855*/
857 fhHodoChanRawTs[uHodoIdx] = new TH2I(Form("hHodoChanRawTs_%u", uHodoIdx),
858 Form("Raw Timestamp distribution per channel, FEB #%03u; "
859 "Channel []; Ts []; Hits []",
860 uHodoIdx),
863
865 fhHodoChanMissEvt[uHodoIdx] = new TH2I(Form("hHodoChanMissEvt_%u", uHodoIdx),
866 Form("Missed Event flags per channel, Hodo #%u; Channel []; "
867 "Miss Evt []; Hits []",
868 uHodoIdx),
869 kuNbChanPerAsic, -0.5, kuNbChanPerAsic - 0.5, 2, -0.5, 1.5);
870
872 fhHodoChanMissEvtEvo[uHodoIdx] = new TH2I(Form("hHodoChanMissEvtEvo_%u", uHodoIdx),
873 Form("Missed Evt flags per second & channel in Hodo #%u; Time "
874 "[s]; Channel []; Missed Evt flags []",
875 uHodoIdx),
876 1800, 0, 1800, kuNbChanPerAsic, -0.5, kuNbChanPerAsic - 0.5);
877
879 fhHodoChanHitRateEvo[uHodoIdx] =
880 new TH2I(Form("hHodoChanHitRateEvo_%u", uHodoIdx),
881 Form("Hits per second & channel in Hodo #%u; Time [s]; Channel []; Hits []", uHodoIdx), 1800, 0, 1800,
882 kuNbChanPerAsic, -0.5, kuNbChanPerAsic - 0.5);
883
885 fhHodoChanHitRateProf[uHodoIdx] =
886 new TProfile(Form("hHodoChanHitRateProf_%u", uHodoIdx),
887 Form("Hits per second for each channel in Hodo #%u; Channel []; Hits/s []", uHodoIdx),
888 kuNbChanPerAsic, -0.5, kuNbChanPerAsic - 0.5);
889
891 fhHodoChanDistT[uHodoIdx] = new TH2I(Form("hHodoChanDistT_%u", uHodoIdx),
892 Form("Time distance between hits on same channel in Hodo #%u; "
893 "Time difference [ns]; Channel []; ",
894 uHodoIdx),
895 1000, -0.5, 6250.0 - 0.5, kuNbChanPerAsic, -0.5, kuNbChanPerAsic - 0.5);
896
898 for (UInt_t uAxis = 0; uAxis < kuNbAxis; ++uAxis) {
899 Char_t cAxisName = (uAxis ? 'Y' : 'X');
901 fhHodoFiberCnt[uHodoIdx][uAxis] =
902 new TH1I(Form("hHodoFiberCnt%c_%u", cAxisName, uHodoIdx),
903 Form("Hits Count per Fiber, Hodo #%u Axis %c; Fiber; Hits []", uHodoIdx, cAxisName),
904 kuNbChanPerAsic / 2, -0.5, kuNbChanPerAsic / 2 - 0.5);
905
907 fhHodoFiberAdc[uHodoIdx][uAxis] = new TH2I(Form("fhHodoFiberAdc%c_%u", cAxisName, uHodoIdx),
908 Form("Raw Adc distribution per Fiber, Hodo #%u Axis %c; "
909 "Channel []; Adc []; Hits []",
910 uHodoIdx, cAxisName),
911 kuNbChanPerAsic / 2, -0.5, kuNbChanPerAsic / 2 - 0.5,
913
915 fhHodoFiberAdcProf[uHodoIdx][uAxis] =
916 new TProfile(Form("hHodoFiberAdcProf%c_%u", cAxisName, uHodoIdx),
917 Form("Raw Adc prodile per Fiber, Hodo #%u Axis %c; Channel []; Adc []", uHodoIdx, cAxisName),
918 kuNbChanPerAsic / 2, -0.5, kuNbChanPerAsic / 2 - 0.5);
919
921 fhHodoFiberHitRateEvo[uHodoIdx][uAxis] =
922 new TH2I(Form("hHodoFiberHitRateEvo%c_%u", cAxisName, uHodoIdx),
923 Form("Hits per second & Fiber in Hodo #%u Axis %c; Time [s]; "
924 "Channel []; Hits []",
925 uHodoIdx, cAxisName),
926 1800, 0, 1800, kuNbChanPerAsic / 2, -0.5, kuNbChanPerAsic / 2 - 0.5);
927
928 AddHistoToVector(fhHodoFiberCnt[uHodoIdx][uAxis], "Fibers");
929 AddHistoToVector(fhHodoFiberAdc[uHodoIdx][uAxis], "Fibers");
930 AddHistoToVector(fhHodoFiberAdcProf[uHodoIdx][uAxis], "Fibers");
931 AddHistoToVector(fhHodoFiberHitRateEvo[uHodoIdx][uAxis], "Fibers");
932 } // for( UInt_t uAxis = 0; uAxis < kuNbAxis; ++uAxis )
933
936
939 fhHodoFiberCoincMapXY[uHodoIdx] = new TH2I(Form("hHodoFiberCoincMapXY_%u", uHodoIdx),
940 Form("Map of coincident (X, Y) pairs in Hodo #%u; X [Fiber]; Y "
941 "[Fiber]; Hits []",
942 uHodoIdx),
943 kuNbChanPerAsic / 2, -0.5, kuNbChanPerAsic / 2 - 0.5,
944 kuNbChanPerAsic / 2, -0.5, kuNbChanPerAsic / 2 - 0.5);
946 fhHodoFiberCoincTimeXY[uHodoIdx] = new TH1I(Form("hHodoFiberCoincTimeXY_%u", uHodoIdx),
947 Form("Time difference of coincident (X, Y) pairs in Hodo #%u; "
948 "t_Y - t_X [ns]; Hits []",
949 uHodoIdx),
952 fhHodoFiberCoincWalkXY_X[uHodoIdx] = new TH2I(Form("hHodoFiberCoincWalkXY_X_%u", uHodoIdx),
953 Form("Walk X of coincident (X, Y) pairs in Hodo #%u; ADC X "
954 "[bin]; t_Y - t_X [ns]; Hits []",
955 uHodoIdx),
958 fhHodoFiberCoincWalkXY_Y[uHodoIdx] = new TH2I(Form("hHodoFiberCoincWalkXY_Y_%u", uHodoIdx),
959 Form("Walk X of coincident (X, Y) pairs in Hodo #%u; ADC X "
960 "[bin]; t_Y - t_X [ns]; Hits []",
961 uHodoIdx),
964
965 AddHistoToVector(fhHodoChanCntRaw[uHodoIdx], "Raw");
966 AddHistoToVector(fhHodoChanAdcRaw[uHodoIdx], "Raw");
967 AddHistoToVector(fhHodoChanAdcRawProf[uHodoIdx], "Raw");
968 // AddHistoToVector( fhHodoChanAdcCal[ uHodoIdx ], "Raw" );
969 // AddHistoToVector( fhHodoChanAdcCalProf[ uHodoIdx ], "Raw" );
970 AddHistoToVector(fhHodoChanRawTs[uHodoIdx], "Raw");
971 AddHistoToVector(fhHodoChanMissEvt[uHodoIdx], "Raw");
972 AddHistoToVector(fhHodoChanMissEvtEvo[uHodoIdx], "Raw");
973 AddHistoToVector(fhHodoChanHitRateEvo[uHodoIdx], "Raw");
974 AddHistoToVector(fhHodoChanHitRateProf[uHodoIdx], "Raw");
975 AddHistoToVector(fhHodoChanDistT[uHodoIdx], "Raw");
976 AddHistoToVector(fhHodoFiberCoincMapXY[uHodoIdx], "Coinc");
977 AddHistoToVector(fhHodoFiberCoincTimeXY[uHodoIdx], "Coinc");
978 AddHistoToVector(fhHodoFiberCoincWalkXY_X[uHodoIdx], "Coinc");
979 AddHistoToVector(fhHodoFiberCoincWalkXY_Y[uHodoIdx], "Coinc");
980 } // for( UInt_t uHodoIdx = 0; uHodoIdx < kuNbHodos; ++uHodoIdx )
981
982 for (UInt_t uAxis = 0; uAxis < kuNbAxis; ++uAxis) {
983 Char_t cAxisName = (uAxis ? 'Y' : 'X');
984 Char_t cOtherAxisName = (uAxis ? 'X' : 'Y');
987 fhHodoFiberCoincMapSameAB[uAxis] = new TH2I(Form("hHodoFiberCoincMapSameAB_%c%c", cAxisName, cAxisName),
988 Form("Map of coincident (%c, %c) pairs in Hodo A and B; %c_A "
989 "[Fiber]; %c_B [Fiber]; Hits []",
990 cAxisName, cAxisName, cAxisName, cAxisName),
991 kuNbChanPerAsic / 2, -0.5, kuNbChanPerAsic / 2 - 0.5,
992 kuNbChanPerAsic / 2, -0.5, kuNbChanPerAsic / 2 - 0.5);
994 fhHodoFiberCoincTimeSameAB[uAxis] = new TH1I(Form("hHodoFiberCoincTimeSameAB_%c%c", cAxisName, cAxisName),
995 Form("Time difference of coincident (%c, %c) pairs in Hodo A "
996 "and B; t_%c_B - t_%c_A [ns]; Hits []",
997 cAxisName, cAxisName, cAxisName, cAxisName),
999
1001 fhHodoFiberCoincMapDiffAB[uAxis] = new TH2I(Form("hHodoFiberCoincMapDiffAB_%c%c", cAxisName, cOtherAxisName),
1002 Form("Map of coincident (%c, %c) pairs in Hodo A and B; %c_A "
1003 "[Fiber]; %c_B [Fiber]; Hits []",
1004 cAxisName, cOtherAxisName, cOtherAxisName, cAxisName),
1005 kuNbChanPerAsic / 2, -0.5, kuNbChanPerAsic / 2 - 0.5,
1006 kuNbChanPerAsic / 2, -0.5, kuNbChanPerAsic / 2 - 0.5);
1008 fhHodoFiberCoincTimeDiffAB[uAxis] = new TH1I(Form("hHodoFiberCoincTimeDiffAB_%c%c", cAxisName, cOtherAxisName),
1009 Form("Time difference of coincident (%c, %c) pairs in Hodo A and B; "
1010 "t_%c_B - t_%c_A [ns]; Hits []",
1011 cAxisName, cOtherAxisName, cOtherAxisName, cAxisName),
1013
1018 } // for( UInt_t uAxis = 0; uAxis < kuNbAxis; ++uAxis )
1019
1022 fhHodoFullCoincPosA = new TH2I("fhHodoFullCoincPosA",
1023 "Position on Hodo A for coincident pairs in Hodo A and B; X_A "
1024 "[Fiber]; Y_A [Fiber]; Hits []",
1025 kuNbChanPerAsic / 2, -0.5, kuNbChanPerAsic / 2 - 0.5, kuNbChanPerAsic / 2, -0.5,
1026 kuNbChanPerAsic / 2 - 0.5);
1028 fhHodoFullCoincPosB = new TH2I("fhHodoFullCoincPosB",
1029 "Position on Hodo B for coincident pairs in Hodo A and B; X_B "
1030 "[Fiber]; Y_B [Fiber]; Hits []",
1031 kuNbChanPerAsic / 2, -0.5, kuNbChanPerAsic / 2 - 0.5, kuNbChanPerAsic / 2, -0.5,
1032 kuNbChanPerAsic / 2 - 0.5);
1034 fhHodoFullCoincCompX = new TH2I("hHodoFullCoincCompX",
1035 "Comparison of X pos for coincident pairs in Hodo A and B; X_A "
1036 "[Fiber]; X_B [Fiber]; Hits []",
1037 kuNbChanPerAsic / 2, -0.5, kuNbChanPerAsic / 2 - 0.5, kuNbChanPerAsic / 2, -0.5,
1038 kuNbChanPerAsic / 2 - 0.5);
1040 fhHodoFullCoincCompY = new TH2I("hHodoFullCoincCompY",
1041 "Comparison of Y pos for coincident pairs in Hodo A and B; Y_A "
1042 "[Fiber]; Y_B [Fiber]; Hits []",
1043 kuNbChanPerAsic / 2, -0.5, kuNbChanPerAsic / 2 - 0.5, kuNbChanPerAsic / 2, -0.5,
1044 kuNbChanPerAsic / 2 - 0.5);
1045
1048 new TH2I("hHodoFullCoincResidualXY",
1049 "X and Y residuals for coincident pairs in Hodo A and B; X_B - "
1050 "X_A [Fiber]; Y_B - Y_A [Fiber]; Hits []",
1051 kuNbChanPerAsic + 1, -1.0 * kuNbChanPerAsic / 2 - 0.5, kuNbChanPerAsic / 2 + 0.5, kuNbChanPerAsic + 1,
1052 -1.0 * kuNbChanPerAsic / 2 - 0.5, kuNbChanPerAsic / 2 + 0.5);
1054 fhHodoFullCoincTimeDiff = new TH1I("hHodoFullCoincTimeDiff",
1055 "Time difference of coincident pairs in Hodo A and B; (t_X_B + "
1056 "t_Y_B)/2 - (t_X_A + t_Y_A)/2 [ns]; Hits []",
1058
1059 fhHodoFullCoincRateEvo = new TH1I("fhHodoFullCoincRateEvo",
1060 "Evolution of the full coincidence rate; "
1061 "Time in run [s]; Full coincidences;",
1062 1800, -0.5, 1800 - 0.5);
1063
1071
1072 for (UInt_t uHodoIdx = 0; uHodoIdx < kuNbHodos; ++uHodoIdx) {
1073 for (UInt_t uAxis = 0; uAxis < kuNbAxis; ++uAxis) {
1074 Char_t cAxisName = (uAxis ? 'Y' : 'X');
1075 fhHodoFullCoincTimeWalk[uHodoIdx][uAxis] =
1076 new TH2I(Form("hHodoFullCoincTimeWalk_%u%c", uHodoIdx, cAxisName),
1077 Form("Time walk of coincident (A, B) pairs in Hodo #%u Axis "
1078 "%c; ADC %u_%c [bin]; Time Diff <B> - <A> [ns]; Hits []",
1079 uHodoIdx, cAxisName, uHodoIdx, cAxisName),
1082 AddHistoToVector(fhHodoFullCoincTimeWalk[uHodoIdx][uAxis], "Walk");
1083
1084 fhHodoFullCoincPosEvo[uHodoIdx][uAxis] =
1085 new TH2I(Form("hHodoFullCoincPosEvo_%u%c", uHodoIdx, cAxisName),
1086 Form("Time evolution of coincident (A, B) pairs position in Hodo #%u "
1087 "Axis %c; Time in run [s]; Position %u_%c [Fiber]; Hits []",
1088 uHodoIdx, cAxisName, uHodoIdx, cAxisName),
1089 2000, -0.5, 1000 - 0.5, kuNbChanPerAsic / 2, -0.5, kuNbChanPerAsic / 2 - 0.5);
1090 AddHistoToVector(fhHodoFullCoincPosEvo[uHodoIdx][uAxis], "FullCoinc");
1091 } // for( UInt_t uAxis = 0; uAxis < kuNbAxis; ++uAxis )
1092 } // for( UInt_t uHodoIdx = 0; uHodoIdx < kuNbHodos; ++uHodoIdx )
1093
1095 fhPrevHitDtAllAsics = new TH1I("hPrevHitDtAllAsics",
1096 "Time difference between current and previous hits in any ASIC; t "
1097 "- t_prev [ns]; Hit pairs []",
1098 10000, 0.0, 10000 * stsxyter::kdClockCycleNs);
1099 fhPrevHitDtAsicA = new TH1I("hPrevHitDtAsicA",
1100 "Time difference between current and previous "
1101 "hits in ASIC A; t - t_prev [ns]; Hit pairs []",
1102 10000, 0.0, 10000 * stsxyter::kdClockCycleNs);
1103 fhPrevHitDtAsicB = new TH1I("hPrevHitDtAsicB",
1104 "Time difference between current and previous "
1105 "hits in ASIC B; t - t_prev [ns]; Hit pairs []",
1106 10000, 0.0, 10000 * stsxyter::kdClockCycleNs);
1107 fhPrevHitDtAsicsAB = new TH1I("hPrevHitDtAsicsAB",
1108 "Time difference between current in ASIC A and previous hit in "
1109 "ASIC B; t - t_prev [ns]; Hit pairs []",
1110 10000, 0.0, 10000 * stsxyter::kdClockCycleNs);
1111
1112 AddHistoToVector(fhPrevHitDtAllAsics, "SetupDebugging");
1113 AddHistoToVector(fhPrevHitDtAsicA, "SetupDebugging");
1114 AddHistoToVector(fhPrevHitDtAsicB, "SetupDebugging");
1115 AddHistoToVector(fhPrevHitDtAsicsAB, "SetupDebugging");
1116
1118 Double_t w = 860;
1119 Double_t h = 480;
1120
1121 fcSummary = new TCanvas("fcSummary", "Summary for the Hodo sDPB", w, h);
1122 fcSummary->Divide(2, 2);
1123
1124 fcSummary->cd(1);
1125 gPad->SetGridx();
1126 gPad->SetGridy();
1127 gPad->SetLogy();
1128 fhHodoMessType->Draw("hist");
1129
1130 fcSummary->cd(2);
1131 gPad->SetGridx();
1132 gPad->SetGridy();
1133 gPad->SetLogz();
1134 fhHodoStatusMessType->Draw("colz");
1135
1136 fcSummary->cd(3);
1137 gPad->SetGridx();
1138 gPad->SetGridy();
1139 gPad->SetLogz();
1140 fhHodoMsStatusFieldType->Draw("colz");
1141
1142 fcSummary->cd(4);
1143 gPad->SetGridx();
1144 gPad->SetGridy();
1145 gPad->SetLogz();
1146 fhHodoMessTypePerElink->Draw("colz");
1147
1148 AddCanvasToVector(fcSummary, "canvases");
1149
1150
1151 for (UInt_t uHodoIdx = 0; uHodoIdx < kuNbHodos; ++uHodoIdx) {
1153 fcHodoSummaryRaw[uHodoIdx] =
1154 new TCanvas(Form("cHodoSummaryRaw%u", uHodoIdx), Form("Raw Summary for Hodo %u", uHodoIdx), w, h);
1155 fcHodoSummaryRaw[uHodoIdx]->Divide(4, 2);
1156
1157 fcHodoSummaryRaw[uHodoIdx]->cd(1);
1158 gPad->SetGridx();
1159 gPad->SetGridy();
1160 gPad->SetLogy();
1161 fhHodoChanCntRaw[uHodoIdx]->Draw("hist");
1162
1163 fcHodoSummaryRaw[uHodoIdx]->cd(2);
1164 gPad->SetGridx();
1165 gPad->SetGridy();
1166 gPad->SetLogy();
1167 fhHodoChanHitRateProf[uHodoIdx]->Draw("hist");
1168
1169 fcHodoSummaryRaw[uHodoIdx]->cd(3);
1170 gPad->SetGridx();
1171 gPad->SetGridy();
1172 gPad->SetLogz();
1173 fhHodoChanAdcRaw[uHodoIdx]->Draw("colz");
1174
1175 fcHodoSummaryRaw[uHodoIdx]->cd(4);
1176 gPad->SetGridx();
1177 gPad->SetGridy();
1178 fhHodoChanAdcRawProf[uHodoIdx]->Draw("hist");
1179
1180 fcHodoSummaryRaw[uHodoIdx]->cd(5);
1181 gPad->SetGridx();
1182 gPad->SetGridy();
1183 gPad->SetLogz();
1184 fhHodoChanDistT[uHodoIdx]->Draw("colz");
1185
1186 fcHodoSummaryRaw[uHodoIdx]->cd(6);
1187 gPad->SetGridx();
1188 gPad->SetGridy();
1189 gPad->SetLogz();
1190 fhHodoChanHitRateEvo[uHodoIdx]->Draw("colz");
1191
1192 fcHodoSummaryRaw[uHodoIdx]->cd(7);
1193 gPad->SetGridx();
1194 gPad->SetGridy();
1195 gPad->SetLogz();
1196 fhHodoChanMissEvt[uHodoIdx]->Draw("colz");
1197
1198 fcHodoSummaryRaw[uHodoIdx]->cd(8);
1199 gPad->SetGridx();
1200 gPad->SetGridy();
1201 gPad->SetLogz();
1202 fhHodoChanMissEvtEvo[uHodoIdx]->Draw("colz");
1203
1205 fcHodoSummaryFiber[uHodoIdx] =
1206 new TCanvas(Form("cHodoSummaryFiber%u", uHodoIdx), Form("Fiber Summary for Hodo %u", uHodoIdx), w, h);
1207 fcHodoSummaryFiber[uHodoIdx]->Divide(4, 2);
1208
1209 for (UInt_t uAxis = 0; uAxis < kuNbAxis; ++uAxis) {
1210 fcHodoSummaryFiber[uHodoIdx]->cd(1 + 4 * uAxis);
1211 gPad->SetGridx();
1212 gPad->SetGridy();
1213 gPad->SetLogy();
1214 fhHodoFiberCnt[uHodoIdx][uAxis]->Draw("hist");
1215
1216 fcHodoSummaryFiber[uHodoIdx]->cd(2 + 4 * uAxis);
1217 gPad->SetGridx();
1218 gPad->SetGridy();
1219 gPad->SetLogz();
1220 fhHodoFiberAdc[uHodoIdx][uAxis]->Draw("colz");
1221
1222 fcHodoSummaryFiber[uHodoIdx]->cd(3 + 4 * uAxis);
1223 gPad->SetGridx();
1224 gPad->SetGridy();
1225 fhHodoFiberAdcProf[uHodoIdx][uAxis]->Draw("hist");
1226
1227 fcHodoSummaryFiber[uHodoIdx]->cd(4 + 4 * uAxis);
1228 gPad->SetGridx();
1229 gPad->SetGridy();
1230 gPad->SetLogz();
1231 fhHodoFiberHitRateEvo[uHodoIdx][uAxis]->Draw("colz");
1232 } // for( UInt_t uAxis = 0; uAxis < kuNbAxis; ++uAxis )
1233
1234 AddCanvasToVector(fcHodoSummaryRaw[uHodoIdx], "canvases");
1235 AddCanvasToVector(fcHodoSummaryFiber[uHodoIdx], "canvases");
1236 } // for( UInt_t uHodoIdx = 0; uHodoIdx < kuNbHodos; ++uHodoIdx )
1237
1238 fcHodoFiberCoinc = new TCanvas("fcHodoFiberCoinc", "X/Y coincidences in same hodoscope", w, h);
1239 fcHodoFiberCoinc->Divide(4, 2);
1240
1241 fcHodoFiberCoinc->cd(1);
1242 gPad->SetGridx();
1243 gPad->SetGridy();
1244 gPad->SetLogz();
1245 fhHodoFiberCoincMapXY[0]->Draw("colz");
1246
1247 fcHodoFiberCoinc->cd(2);
1248 gPad->SetGridx();
1249 gPad->SetGridy();
1250 gPad->SetLogy();
1251 fhHodoFiberCoincTimeXY[0]->Draw("hist");
1252
1253 fcHodoFiberCoinc->cd(3);
1254 gPad->SetGridx();
1255 gPad->SetGridy();
1256 gPad->SetLogz();
1257 fhHodoFiberCoincWalkXY_X[0]->Draw("colz");
1258
1259 fcHodoFiberCoinc->cd(4);
1260 gPad->SetGridx();
1261 gPad->SetGridy();
1262 gPad->SetLogz();
1263 fhHodoFiberCoincWalkXY_Y[0]->Draw("colz");
1264
1265 fcHodoFiberCoinc->cd(5);
1266 gPad->SetGridx();
1267 gPad->SetGridy();
1268 gPad->SetLogz();
1269 fhHodoFiberCoincMapXY[1]->Draw("colz");
1270
1271 fcHodoFiberCoinc->cd(6);
1272 gPad->SetGridx();
1273 gPad->SetGridy();
1274 gPad->SetLogy();
1275 fhHodoFiberCoincTimeXY[1]->Draw("hist");
1276
1277 fcHodoFiberCoinc->cd(7);
1278 gPad->SetGridx();
1279 gPad->SetGridy();
1280 gPad->SetLogz();
1281 fhHodoFiberCoincWalkXY_X[1]->Draw("colz");
1282
1283 fcHodoFiberCoinc->cd(8);
1284 gPad->SetGridx();
1285 gPad->SetGridy();
1286 gPad->SetLogz();
1287 fhHodoFiberCoincWalkXY_Y[1]->Draw("colz");
1288
1289 fcHodoFiberCoincAB = new TCanvas("fcHodoFiberCoincAB", "X/Y coincidences between hodoscopes", w, h);
1290 fcHodoFiberCoincAB->Divide(4, 2);
1291
1292 for (UInt_t uAxis = 0; uAxis < kuNbAxis; ++uAxis) {
1293 fcHodoFiberCoincAB->cd(1 + 4 * uAxis);
1294 gPad->SetGridx();
1295 gPad->SetGridy();
1296 gPad->SetLogz();
1297 fhHodoFiberCoincMapSameAB[uAxis]->Draw("colz");
1298
1299 fcHodoFiberCoincAB->cd(2 + 4 * uAxis);
1300 gPad->SetGridx();
1301 gPad->SetGridy();
1302 gPad->SetLogy();
1303 fhHodoFiberCoincTimeSameAB[uAxis]->Draw("hist");
1304
1305 fcHodoFiberCoincAB->cd(3 + 4 * uAxis);
1306 gPad->SetGridx();
1307 gPad->SetGridy();
1308 gPad->SetLogz();
1309 fhHodoFiberCoincMapDiffAB[uAxis]->Draw("colz");
1310
1311 fcHodoFiberCoincAB->cd(4 + 4 * uAxis);
1312 gPad->SetGridx();
1313 gPad->SetGridy();
1314 gPad->SetLogy();
1315 fhHodoFiberCoincTimeDiffAB[uAxis]->Draw("hist");
1316 } // for( UInt_t uAxis = 0; uAxis < kuNbAxis; ++uAxis )
1317
1318 fcHodoFullCoinc = new TCanvas("fcHodoFullCoinc", "Full coincidences between hodoscopes", w, h);
1319 fcHodoFullCoinc->Divide(4, 2);
1320
1321 fcHodoFullCoinc->cd(1);
1322 gPad->SetGridx();
1323 gPad->SetGridy();
1324 gPad->SetLogz();
1325 fhHodoFullCoincCompX->Draw("colz");
1326
1327 fcHodoFullCoinc->cd(2);
1328 gPad->SetGridx();
1329 gPad->SetGridy();
1330 gPad->SetLogz();
1331 fhHodoFullCoincResidualXY->Draw("colz");
1332
1333 fcHodoFullCoinc->cd(3);
1334 gPad->SetGridx();
1335 gPad->SetGridy();
1336 gPad->SetLogz();
1337 fhHodoFullCoincTimeWalk[0][0]->Draw("colz");
1338
1339 fcHodoFullCoinc->cd(4);
1340 gPad->SetGridx();
1341 gPad->SetGridy();
1342 gPad->SetLogz();
1343 fhHodoFullCoincTimeWalk[0][1]->Draw("colz");
1344
1345 fcHodoFullCoinc->cd(5);
1346 gPad->SetGridx();
1347 gPad->SetGridy();
1348 gPad->SetLogz();
1349 fhHodoFullCoincCompY->Draw("colz");
1350
1351
1352 fcHodoFullCoinc->cd(6);
1353 gPad->SetGridx();
1354 gPad->SetGridy();
1355 gPad->SetLogy();
1356 fhHodoFullCoincTimeDiff->Draw("hist");
1357
1358 fcHodoFullCoinc->cd(7);
1359 gPad->SetGridx();
1360 gPad->SetGridy();
1361 gPad->SetLogz();
1362 fhHodoFullCoincTimeWalk[1][0]->Draw("colz");
1363
1364 fcHodoFullCoinc->cd(8);
1365 gPad->SetGridx();
1366 gPad->SetGridy();
1367 gPad->SetLogz();
1368 fhHodoFullCoincTimeWalk[1][1]->Draw("colz");
1369
1371 new TCanvas("fcHodoFullCoincPos", "Hit Positions for Full coincidences between hodoscopes", w, h);
1372 fcHodoFullCoincPos->Divide(2);
1373
1374 fcHodoFullCoincPos->cd(1);
1375 gPad->SetGridx();
1376 gPad->SetGridy();
1377 gPad->SetLogz();
1378 fhHodoFullCoincPosA->Draw("colz");
1379
1380 fcHodoFullCoincPos->cd(2);
1381 gPad->SetGridx();
1382 gPad->SetGridy();
1383 gPad->SetLogz();
1384 fhHodoFullCoincPosB->Draw("colz");
1385
1387 new TCanvas("fcHodoFullCoincPosEvo", "Hit Positions Evo for Full coincidences between hodoscopes", w, h);
1388 fcHodoFullCoincPosEvo->Divide(4);
1389
1390 fcHodoFullCoincPosEvo->cd(1);
1391 gPad->SetGridx();
1392 gPad->SetGridy();
1393 gPad->SetLogz();
1394 fhHodoFullCoincPosEvo[0][0]->Draw("colz");
1395
1396 fcHodoFullCoincPosEvo->cd(2);
1397 gPad->SetGridx();
1398 gPad->SetGridy();
1399 gPad->SetLogz();
1400 fhHodoFullCoincPosEvo[0][1]->Draw("colz");
1401
1402 fcHodoFullCoincPosEvo->cd(3);
1403 gPad->SetGridx();
1404 gPad->SetGridy();
1405 gPad->SetLogz();
1406 fhHodoFullCoincPosEvo[1][0]->Draw("colz");
1407
1408 fcHodoFullCoincPosEvo->cd(4);
1409 gPad->SetGridx();
1410 gPad->SetGridy();
1411 gPad->SetLogz();
1412 fhHodoFullCoincPosEvo[1][1]->Draw("colz");
1413
1414 fcHodoPrevHitDt = new TCanvas("fcHodoPrevHitDt", "Time difference between current and previous hits", w, h);
1415 fcHodoPrevHitDt->Divide(2, 2);
1416
1417 fcHodoPrevHitDt->cd(1);
1418 gPad->SetGridx();
1419 gPad->SetGridy();
1420 gPad->SetLogy();
1421 fhPrevHitDtAllAsics->Draw("hist");
1422
1423 fcHodoPrevHitDt->cd(2);
1424 gPad->SetGridx();
1425 gPad->SetGridy();
1426 gPad->SetLogy();
1427 fhPrevHitDtAsicA->Draw("hist");
1428
1429 fcHodoPrevHitDt->cd(3);
1430 gPad->SetGridx();
1431 gPad->SetGridy();
1432 gPad->SetLogy();
1433 fhPrevHitDtAsicB->Draw("hist");
1434
1435 fcHodoPrevHitDt->cd(4);
1436 gPad->SetGridx();
1437 gPad->SetGridy();
1438 gPad->SetLogy();
1439 fhPrevHitDtAsicsAB->Draw("hist");
1440
1446
1447 return kTRUE;
1448}
1450{
1452 std::vector<std::vector<stsxyter::FinalHit>> lastHitHodoAxis;
1453 std::vector<std::vector<Bool_t>> bHitFoundHodoAxis;
1454 lastHitHodoAxis.resize(kuNbHodos);
1455 bHitFoundHodoAxis.resize(kuNbHodos);
1456 for (UInt_t uHodoIdx = 0; uHodoIdx < kuNbHodos; ++uHodoIdx) {
1457 lastHitHodoAxis[uHodoIdx].resize(kuNbAxis);
1458 bHitFoundHodoAxis[uHodoIdx].resize(kuNbAxis, kFALSE);
1459 } // for( UInt_t uHodoIdx = 0; uHodoIdx < kuNbHodos; ++uHodoIdx )
1460
1462 UInt_t uTotalNbHits = fvmHitsInMs.size();
1463 for (UInt_t uHit = 0; uHit < uTotalNbHits; ++uHit) {
1464 UInt_t uHodo = fvmHitsInMs[uHit].GetAsic();
1465 UInt_t uAxis = fvmHitsInMs[uHit].GetDpb();
1466 // UInt_t uFiber = fvmHitsInMs[ uHit ].GetChan();
1467
1469 Double_t dCurrentHitTime = fvmHitsInMs[uHit].GetTs() * stsxyter::kdClockCycleNs;
1471 if (0 == uHodo) {
1472 fhPrevHitDtAsicA->Fill(dCurrentHitTime - fvdPreviousHitTimePerAsic[0]);
1473 fhPrevHitDtAsicsAB->Fill(dCurrentHitTime - fvdPreviousHitTimePerAsic[1]);
1474 } // if( 0 == uHodo )
1475 else
1476 fhPrevHitDtAsicB->Fill(dCurrentHitTime - fvdPreviousHitTimePerAsic[1]);
1477
1478 fuPreviousHitAsic = uHodo;
1479 fvdPreviousHitTimePerAsic[uHodo] = dCurrentHitTime;
1480
1481 lastHitHodoAxis[uHodo][uAxis] = fvmHitsInMs[uHit];
1482 bHitFoundHodoAxis[uHodo][uAxis] = kTRUE;
1483
1485 if (bHitFoundHodoAxis[uHodo][0] && bHitFoundHodoAxis[uHodo][1]) {
1486 Double_t dTimeDiffAxis = lastHitHodoAxis[uHodo][1].GetTs() * stsxyter::kdClockCycleNs
1487 - lastHitHodoAxis[uHodo][0].GetTs() * stsxyter::kdClockCycleNs;
1488
1489 if (-fdTimeCoincLimitNs < dTimeDiffAxis && dTimeDiffAxis < fdTimeCoincLimitNs) {
1490 fhHodoFiberCoincMapXY[uHodo]->Fill(lastHitHodoAxis[uHodo][0].GetChan(), lastHitHodoAxis[uHodo][1].GetChan());
1491 fhHodoFiberCoincTimeXY[uHodo]->Fill(dTimeDiffAxis);
1492 fhHodoFiberCoincWalkXY_X[uHodo]->Fill(lastHitHodoAxis[uHodo][0].GetAdc(), dTimeDiffAxis);
1493 fhHodoFiberCoincWalkXY_Y[uHodo]->Fill(lastHitHodoAxis[uHodo][1].GetAdc(), dTimeDiffAxis);
1494 } // if( -fdTimeCoincLimitNs < dTimeDiffAxis && dTimeDiffAxis < fdTimeCoincLimitNs )
1495 } // if( bHitFoundHodoAxis[ uHodo ][ 0 ] && bHitFoundHodoAxis[ uHodo ][ 1 ] )
1496
1498 if (bHitFoundHodoAxis[0][uAxis] && bHitFoundHodoAxis[1][uAxis]) {
1499 Double_t dTimeDiffHodoSame = lastHitHodoAxis[1][uAxis].GetTs() * stsxyter::kdClockCycleNs
1500 - lastHitHodoAxis[0][uAxis].GetTs() * stsxyter::kdClockCycleNs;
1501
1502 if (-fdTimeCoincLimitNs < dTimeDiffHodoSame && dTimeDiffHodoSame < fdTimeCoincLimitNs) {
1503 fhHodoFiberCoincMapSameAB[uAxis]->Fill(lastHitHodoAxis[0][uAxis].GetChan(),
1504 lastHitHodoAxis[1][uAxis].GetChan());
1505 fhHodoFiberCoincTimeSameAB[uAxis]->Fill(dTimeDiffHodoSame);
1506 } // if( -fdTimeCoincLimitNs < dTimeDiffAxis && dTimeDiffAxis < fdTimeCoincLimitNs )
1507 } // if( bHitFoundHodoAxis[ 0 ][ uAxis ] && bHitFoundHodoAxis[ 1 ][ uAxis ] )
1508
1509 UInt_t uAxisA = (uHodo ? !uAxis : uAxis);
1510 UInt_t uAxisB = (uHodo ? uAxis : !uAxis);
1511 if (bHitFoundHodoAxis[0][uAxisA] && bHitFoundHodoAxis[1][uAxisB]) {
1512 Double_t dTimeDiffHodoDiff = lastHitHodoAxis[1][uAxisB].GetTs() * stsxyter::kdClockCycleNs
1513 - lastHitHodoAxis[0][uAxisA].GetTs() * stsxyter::kdClockCycleNs;
1514
1515 if (-fdTimeCoincLimitNs < dTimeDiffHodoDiff && dTimeDiffHodoDiff < fdTimeCoincLimitNs) {
1516 fhHodoFiberCoincMapDiffAB[uAxisA]->Fill(lastHitHodoAxis[0][uAxisA].GetChan(),
1517 lastHitHodoAxis[1][uAxisB].GetChan());
1518 fhHodoFiberCoincTimeDiffAB[uAxisA]->Fill(dTimeDiffHodoDiff);
1519 } // if( -fdTimeCoincLimitNs < dTimeDiffAxis && dTimeDiffAxis < fdTimeCoincLimitNs )
1520 }
1521
1523 if (bHitFoundHodoAxis[0][0] && bHitFoundHodoAxis[0][1] && bHitFoundHodoAxis[1][0] && bHitFoundHodoAxis[1][1]) {
1524 Double_t dTimeDiffHodoA = lastHitHodoAxis[0][1].GetTs() * stsxyter::kdClockCycleNs
1525 - lastHitHodoAxis[0][0].GetTs() * stsxyter::kdClockCycleNs;
1526 Double_t dTimeDiffHodoB = lastHitHodoAxis[1][1].GetTs() * stsxyter::kdClockCycleNs
1527 - lastHitHodoAxis[1][0].GetTs() * stsxyter::kdClockCycleNs;
1528 Double_t dTimeDiffHodoAB = (lastHitHodoAxis[1][1].GetTs() * stsxyter::kdClockCycleNs
1529 + lastHitHodoAxis[1][0].GetTs() * stsxyter::kdClockCycleNs)
1530 / 2.0
1531 - (lastHitHodoAxis[0][1].GetTs() * stsxyter::kdClockCycleNs
1532 + lastHitHodoAxis[0][0].GetTs() * stsxyter::kdClockCycleNs)
1533 / 2.0;
1534 Double_t dTimeHitHodoAB = (lastHitHodoAxis[1][1].GetTs() * stsxyter::kdClockCycleNs
1535 + lastHitHodoAxis[1][0].GetTs() * stsxyter::kdClockCycleNs
1536 + lastHitHodoAxis[0][1].GetTs() * stsxyter::kdClockCycleNs
1537 + lastHitHodoAxis[0][0].GetTs() * stsxyter::kdClockCycleNs)
1538 / 4.0;
1539
1540 if (-fdTimeCoincLimitNs < dTimeDiffHodoA && dTimeDiffHodoA < fdTimeCoincLimitNs
1541 && -fdTimeCoincLimitNs < dTimeDiffHodoB && dTimeDiffHodoB < fdTimeCoincLimitNs
1542 && -fdTimeCoincLimitNs < dTimeDiffHodoAB && dTimeDiffHodoAB < fdTimeCoincLimitNs) {
1543 UInt_t uPosXA = fvbHodoSwapXY[0] ? lastHitHodoAxis[0][1].GetChan() : lastHitHodoAxis[0][0].GetChan();
1544 UInt_t uPosYA = fvbHodoSwapXY[0] ? lastHitHodoAxis[0][0].GetChan() : lastHitHodoAxis[0][1].GetChan();
1545 UInt_t uPosXB = fvbHodoSwapXY[1] ? lastHitHodoAxis[1][1].GetChan() : lastHitHodoAxis[1][0].GetChan();
1546 UInt_t uPosYB = fvbHodoSwapXY[1] ? lastHitHodoAxis[1][0].GetChan() : lastHitHodoAxis[1][1].GetChan();
1547
1548 if (fvbHodoInvertX[0]) uPosXA = kuNbChanPerAsic / 2 - 1 - uPosXA;
1549 if (fvbHodoInvertY[0]) uPosYA = kuNbChanPerAsic / 2 - 1 - uPosYA;
1550 if (fvbHodoInvertX[1]) uPosXB = kuNbChanPerAsic / 2 - 1 - uPosXB;
1551 if (fvbHodoInvertY[1]) uPosYB = kuNbChanPerAsic / 2 - 1 - uPosYB;
1552
1553 Double_t dResX = uPosXB;
1554 Double_t dResY = uPosYB;
1555
1556 dResX -= uPosXA;
1557 dResY -= uPosYA;
1558
1559 fhHodoFullCoincPosA->Fill(uPosXA, uPosYA);
1560 fhHodoFullCoincPosB->Fill(uPosXB, uPosYB);
1561
1562 fhHodoFullCoincCompX->Fill(uPosXA, uPosXB);
1563 fhHodoFullCoincCompY->Fill(uPosYA, uPosYB);
1564 fhHodoFullCoincResidualXY->Fill(dResX, dResY);
1565 fhHodoFullCoincTimeDiff->Fill(dTimeDiffHodoAB);
1566
1567 fhHodoFullCoincTimeWalk[0][0]->Fill(lastHitHodoAxis[0][0].GetAdc(), dTimeDiffHodoAB);
1568 fhHodoFullCoincTimeWalk[0][1]->Fill(lastHitHodoAxis[0][1].GetAdc(), dTimeDiffHodoAB);
1569 fhHodoFullCoincTimeWalk[1][0]->Fill(lastHitHodoAxis[1][0].GetAdc(), dTimeDiffHodoAB);
1570 fhHodoFullCoincTimeWalk[1][1]->Fill(lastHitHodoAxis[1][1].GetAdc(), dTimeDiffHodoAB);
1571
1572 Double_t dTimeSinceStart = (dTimeHitHodoAB - fdStartTime) * 1e-9;
1573 fhHodoFullCoincRateEvo->Fill(dTimeSinceStart);
1574
1575 fhHodoFullCoincPosEvo[0][0]->Fill(dTimeSinceStart, uPosXA);
1576 fhHodoFullCoincPosEvo[0][1]->Fill(dTimeSinceStart, uPosYA);
1577 fhHodoFullCoincPosEvo[1][0]->Fill(dTimeSinceStart, uPosXB);
1578 fhHodoFullCoincPosEvo[1][1]->Fill(dTimeSinceStart, uPosYB);
1579 /*
1580 LOG(info) << "Hodoscopes full coincidence found at " << (dTimeHitHodoAB*1e-9)
1581 << " Position A = ( " << uPosXA << ", " << uPosYA << ")"
1582 << " Position B = ( " << uPosXB << ", " << uPosYB << ")"
1583 << " dT = " << dTimeDiffHodoAB;
1584*/
1585 } // if all hodo axis in coinc and hodos in coinc
1586 } // if all ( Hodo, Axis ) pairs have at least 1 hit
1587 /*
1588 for( UInt_t uHodoOther = 0; uHodoOther < kuNbHodos; ++uHodoOther )
1589 {
1590 for( UInt_t uAxisOther = 0; uAxisOther < kuNbAxis; ++uAxisOther )
1591 {
1592 if( uHodoOther == uHodo )
1593 {
1594 if( uAxisOther == uAxis )
1595 continue;
1596
1597 } // if( uHodoOther == uHodo )
1598
1599 } // for( UInt_t uAxisOther = 0; uAxisOther < kuNbAxis; ++uAxisOther )
1600 } // for( UInt_t uHodoOther = 0; uHodoOther < kuNbHodos; ++uHodoOther )
1601*/
1602 } // for( UInt_t uHit = 0; uHit < uTotalNbHits; ++uHit )
1603
1604 return kTRUE;
1605}
1607{
1608 fhHodoMessType->Reset();
1609 fhHodoStatusMessType->Reset();
1610 fhHodoMsStatusFieldType->Reset();
1611 fhHodoMessTypePerElink->Reset();
1612
1613 for (UInt_t uHodoIdx = 0; uHodoIdx < kuNbHodos; ++uHodoIdx) {
1614 for (UInt_t uAxis = 0; uAxis < kuNbAxis; ++uAxis) {
1615 fhHodoFiberCnt[uHodoIdx][uAxis]->Reset();
1616 fhHodoFiberAdc[uHodoIdx][uAxis]->Reset();
1617 fhHodoFiberAdcProf[uHodoIdx][uAxis]->Reset();
1618 fhHodoFiberHitRateEvo[uHodoIdx][uAxis]->Reset();
1619
1620 fhHodoFullCoincTimeWalk[uHodoIdx][uAxis]->Reset();
1621 fhHodoFullCoincPosEvo[uHodoIdx][uAxis]->Reset();
1622 } // for( UInt_t uAxis = 0; uAxis < kuNbAxis; ++uAxis )
1623
1624 fhHodoChanCntRaw[uHodoIdx]->Reset();
1625 fhHodoChanAdcRaw[uHodoIdx]->Reset();
1626 fhHodoChanAdcRawProf[uHodoIdx]->Reset();
1627 fhHodoChanAdcCal[uHodoIdx]->Reset();
1628 fhHodoChanAdcCalProf[uHodoIdx]->Reset();
1629 fhHodoChanRawTs[uHodoIdx]->Reset();
1630 fhHodoChanMissEvt[uHodoIdx]->Reset();
1631 fhHodoChanMissEvtEvo[uHodoIdx]->Reset();
1632 fhHodoChanHitRateEvo[uHodoIdx]->Reset();
1633 fhHodoChanHitRateProf[uHodoIdx]->Reset();
1634 fhHodoChanDistT[uHodoIdx]->Reset();
1635
1636 fhHodoFiberCoincMapXY[uHodoIdx]->Reset();
1637 fhHodoFiberCoincTimeXY[uHodoIdx]->Reset();
1638 fhHodoFiberCoincWalkXY_X[uHodoIdx]->Reset();
1639 fhHodoFiberCoincWalkXY_Y[uHodoIdx]->Reset();
1640
1641 } // for( UInt_t uHodoIdx = 0; uHodoIdx < kuNbHodos; ++uHodoIdx )
1642
1643
1644 for (UInt_t uAxis = 0; uAxis < kuNbAxis; ++uAxis) {
1645 fhHodoFiberCoincMapSameAB[uAxis]->Reset();
1646 fhHodoFiberCoincTimeSameAB[uAxis]->Reset();
1647 fhHodoFiberCoincMapDiffAB[uAxis]->Reset();
1648 fhHodoFiberCoincTimeDiffAB[uAxis]->Reset();
1649 } // for( UInt_t uAxis = 0; uAxis < kuNbAxis; ++uAxis )
1650
1651 fhHodoFullCoincPosA->Reset();
1652 fhHodoFullCoincPosB->Reset();
1653 fhHodoFullCoincCompX->Reset();
1654 fhHodoFullCoincCompY->Reset();
1656 fhHodoFullCoincTimeDiff->Reset();
1657
1658 fhPrevHitDtAllAsics->Reset();
1659 fhPrevHitDtAsicA->Reset();
1660 fhPrevHitDtAsicB->Reset();
1661 fhPrevHitDtAsicsAB->Reset();
1662
1663 return kTRUE;
1664}
1665// -------------------------------------------------------------------------
std::string FormatMsHeaderPrintout(const fles::MicrosliceDescriptor &msDescriptor)
int Int_t
bool Bool_t
UInt_t fuDpbId
Settings from parameter file => For now use only accessors!
std::vector< TH2 * > fhHodoFiberCoincMapXY
+/- in clock cycles
static const Int_t kiMaxNbFlibLinks
Constants.
std::vector< std::vector< TH2 * > > fhHodoFullCoincTimeWalk
TH1 * fhHodoFullCoincRateEvo
[ Hodo ][ Axis ]
std::vector< std::vector< TH2 * > > fhHodoFiberHitRateEvo
[ Hodo ][ Axis ]
std::vector< Double_t > fvdPrevMsTime
End Time in ns of current TS Core from the index of the first MS first component.
std::chrono::steady_clock::time_point ftStartTimeUnix
Double_t fdMsTime
Header time of previous MS per link.
const UInt_t kuChannelToPlaneMap[kuNbChanPerAsic]
Map from channel index to PMT pixel.
std::vector< Double_t > fvdPreviousHitTimePerAsic
std::map< stsxyter::MessType, UInt_t > fmMsgCounter
std::vector< stsxyter::FinalHit > fvmHitsInMs
Hits time-sorting.
Int_t fiRunStartDateTimeSec
Temp holder until Current equipment ID is properly filled in MS.
std::vector< TH2 * > fhHodoChanMissEvtEvo
[ Hodo ]
Double_t fdTimeOffsetNs
User settings: Data correction parameters.
std::vector< std::vector< TProfile * > > fhHodoFiberAdcProf
[ Hodo ][ Axis ]
std::vector< std::vector< Double_t > > fvdChanCountsSinceLastRateUpdate
[ Hodo ]
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
Bool_t fbDebugMonitorMode
Switch ON the filling of a minimal set of histograms.
std::vector< TH1 * > fhHodoFiberCoincTimeSameAB
[ Axis ]
Int_t fiBinSizeDatePlots
Start of run time since "epoch" in s, for the plots with date as X axis.
std::vector< TH2 * > fhHodoChanDistT
[ Hodo ]
Double_t fdTsStopTimeCore
Time in ns of current TS from the index of the first MS first component.
std::vector< Int_t > fviTimeSecLastRateUpdate
std::vector< TH1 * > fhHodoFiberCoincTimeDiffAB
[ Axis ]
std::vector< TH2 * > fhHodoChanRawTs
[ Hodo ]
std::vector< TH2 * > fhHodoFiberCoincMapSameAB
[ Hodo ]
const UInt_t kuChannelToFiberMap[kuNbChanPerAsic]
Bool_t fbMonitorMode
Default set closest cosmic setup stack.
TH1 * fhHodoMessType
All hits (time in bins, ADC in bins, asic, channel) in last MS, sorted with "<" operator.
static const UInt_t kuNbHodos
Max Nb of eLinks for this sDPB: 2 GBTx with 42 eLinks each.
std::vector< std::vector< Double_t > > fdHodoChanLastTimeForDist
[ Hodo ][ Chan ]
void ProcessEpochInfo(stsxyter::Message mess)
static const UInt_t kuNbChanPerAsic
Per hodoscope = X and Y.
std::vector< TH2 * > fhHodoChanMissEvt
[ Hodo ]
Bool_t ProcessTs(const fles::Timeslice &ts)
std::vector< TCanvas * > fcHodoSummaryRaw
std::vector< Bool_t > fvbMaskedComponents
Switch ON the filling of a additional set of histograms.
std::vector< TProfile * > fhHodoChanAdcRawProf
[ Hodo ]
std::vector< TProfile * > fhHodoChanAdcCalProf
[ Hodo ]
std::vector< TH2 * > fhHodoFiberCoincWalkXY_Y
[ Hodo ]
std::vector< TH1 * > fhHodoChanCntRaw
Raw = ASIC channels.
void ProcessStatusInfo(stsxyter::Message mess)
Double_t fdTimeCoincLimitNs
+/- in clock cycles
std::vector< std::vector< TH2 * > > fhHodoFiberAdc
[ Hodo ][ Axis ]
std::vector< std::vector< TH1 * > > fhHodoFiberCnt
static const UInt_t kuNbAxis
Nb of hodoscopes = Nb FEBs = Nb ASICs.
Bool_t ProcessMs(const fles::Timeslice &ts, size_t uMsCompIdx, size_t uMsIdx)
std::vector< TH2 * > fhHodoChanAdcRaw
[ Hodo ]
ULong64_t fulCurrentTsIdx
Map from channel index to Hodoscope Axis (X or Y)
std::vector< TH2 * > fhHodoFiberCoincWalkXY_X
[ Hodo ]
std::vector< TCanvas * > fcHodoSummaryFiber
std::vector< TH2 * > fhHodoChanAdcCal
[ Hodo ]
std::vector< TH2 * > fhHodoFiberCoincMapDiffAB
[ Axis ]
void ProcessTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx=0, UInt_t uMsIdx=0)
std::vector< TH1 * > fhHodoFiberCoincTimeXY
[ Hodo ]
std::vector< std::vector< TH2 * > > fhHodoFullCoincPosEvo
UInt_t fuMsIndex
Start Time in ns of current MS from its index field in header.
void ProcessHitInfo(stsxyter::Message mess, const UInt_t &uHodoIdx, const UInt_t &uMsIdx)
std::vector< TProfile * > fhHodoChanHitRateProf
[ Hodo ]
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
UInt_t fvuCurrentTsMsbCycle
Current TS MSB for each DPB.
std::vector< TH2 * > fhHodoChanHitRateEvo
[ Hodo ]
void AddHistoToVector(TNamed *pointer, std::string sFolder="")
std::vector< size_t > fvMsComponentsList
void AddCanvasToVector(TCanvas *pointer, std::string sFolder="")
Data class with information on a STS local track.
XPU_D bool IsHitMissedEvts() const
For Hit data: Returns Missed event flag (1 bit field)
XPU_D uint16_t GetHitAdc() const
For Hit data: Returns ADC value (5 bit field)
XPU_D uint16_t GetHitChannel() const
For Hit data: Returns StsXYTER channel number (7 bit field)
XPU_D uint16_t GetLinkIndex() const
For all data: Returns the (global) index of the eLink on which the message was received (n bit field)
XPU_D MessType GetMessType() const
Returns the message type, see enum MessType.
XPU_D uint16_t GetHitTime() const
For Hit data: Returns timestamp (8 bit field, 2 MSB bits overlap removed)
XPU_D uint32_t GetTsMsbVal() const
For TS MSB data: Returns the TS MSB 22 bit field)
XPU_D uint16_t GetStatusLink() const
For Status data: Returns the Link Inedx (9 bit field)
Hash for CbmL1LinkKey.
static constexpr uint64_t kulTsCycleNbBins
static constexpr uint32_t kuHitNbTsBins
static constexpr uint32_t kuHitNbAdcBins
Status/properties constants.
static constexpr double kdClockCycleNs
MessType
Message types.