BmnRoot
Loading...
Searching...
No Matches
BmnZdcAnalyzer.cxx
Go to the documentation of this file.
1/*
2 * File: BmnZdcAnalyzer.cxx
3 * Author: pnaleks
4 *
5 * Created on 5 июня 2020 г., 18:58
6 */
7
8#include "BmnZdcAnalyzer.h"
9#include "FairLogger.h"
10#include "FairRootManager.h"
11#include <TStopwatch.h>
12
13using namespace std;
14static Float_t workTime = 0.0;
15
17 FairTask("BmnZdcAnalyzer"),
18
19 fArrayOfZdcDigits(nullptr),
20 fBmnZDCEventData(nullptr),
21
22 fModuleScale(nullptr),
23 fModuleThreshold(nullptr)
24{}
25
28
30{
31 FairRootManager* ioman = FairRootManager::Instance();
32 fArrayOfZdcDigits = (TClonesArray*) ioman->GetObject("ZdcDigit");
33 if (fArrayOfZdcDigits == nullptr)
34 {
35 // check if there is an old name of the branch ("ZDC")
36 fArrayOfZdcDigits = (TClonesArray*) ioman->GetObject("ZDC");
37 if (fArrayOfZdcDigits == nullptr)
38 {
39 LOG(error)<<"BmnZdcAnalyzer::Init() branch 'ZdcDigit' or old 'ZDC' not found! Task will be deactivated";
40 SetActive(kFALSE);
41 return kERROR;
42 }
43 }
44
45 fBmnZDCEventData = new BmnZDCEventData();
46 ioman->Register("ZDCEventData.", "Zdc", fBmnZDCEventData, kTRUE);
47
48 Info(__func__,"ZDC analyzer ready");
49 return kSUCCESS;
50}
51
52void BmnZdcAnalyzer::Exec(Option_t* opt) {
53
54 TStopwatch sw;
55 sw.Start();
56
57 if (!IsActive())
58 return;
59
60 fBmnZDCEventData->Set(fArrayOfZdcDigits, fModuleScale, fModuleThreshold);
61
62 sw.Stop();
63 workTime += sw.RealTime();
64}
65
67 printf("Work time of BmnZdcAnalyzer: %4.2f sec.\n", workTime);
68}
void Set(TClonesArray *pArrayOfBmnZDCDigits, Float_t *pModuleScale=0, Float_t *pModuleThreshold=0)
virtual void Finish()
virtual InitStatus Init()
virtual ~BmnZdcAnalyzer()
virtual void Exec(Option_t *opt)
STL namespace.