R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BNeulandTacquilaMapped2CalPar.cxx
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3 * Copyright (C) 2019-2025 Members of R3B Collaboration *
4 * *
5 * This software is distributed under the terms of the *
6 * GNU General Public Licence (GPL) version 3, *
7 * copied verbatim in the file "LICENSE". *
8 * *
9 * In applying this license GSI does not waive the privileges and immunities *
10 * granted to it by virtue of its status as an Intergovernmental Organization *
11 * or submit itself to any jurisdiction. *
12 ******************************************************************************/
13
15#include "FairLogger.h"
16#include "FairRootManager.h"
17#include "FairRtdbRun.h"
18#include "FairRunIdGenerator.h"
19#include "FairRuntimeDb.h"
20#include "R3BEventHeader.h"
22#include "R3BTCalEngine.h"
23#include "R3BTCalPar.h"
24#include "TClonesArray.h"
25#include "TF1.h"
26#include "TH1F.h"
27#include <stdlib.h>
28
30 : fUpdateRate(1000000)
31 , fMinStats(100000)
32 , fTrigger(-1)
33 , fNofPMTs(0)
34 , fNEvents(0)
35 , fCal_Par(NULL)
36{
37}
38
40 : FairTask(name, iVerbose)
41 , fUpdateRate(1000000)
42 , fMinStats(100000)
43 , fTrigger(-1)
44 , fNofPMTs(0)
45 , fNEvents(0)
46 , fCal_Par(NULL)
47{
48}
49
51{
52 if (fCal_Par)
53 {
54 delete fCal_Par;
55 }
56 if (fEngine)
57 {
58 delete fEngine;
59 }
60}
61
63{
64 FairRootManager* rm = FairRootManager::Instance();
65 if (!rm)
66 {
67 return kFATAL;
68 }
69 header = dynamic_cast<R3BEventHeader*>(rm->GetObject("EventHeader."));
70 if (!header)
71 {
72 return kFATAL;
73 }
74 fHits = dynamic_cast<TClonesArray*>(rm->GetObject("NeulandTacquilaMappedData"));
75 if (!fHits)
76 {
77 return kFATAL;
78 }
79
80 fCal_Par = dynamic_cast<R3BTCalPar*>(FairRuntimeDb::instance()->getContainer("LandTCalPar"));
81 fCal_Par->setChanged();
82
83 fEngine = new R3BTCalEngine(fCal_Par, fMinStats);
84
85 return kSUCCESS;
86}
87
89{
90 if (fTrigger >= 0)
91 {
92 if (header->GetTrigger() != fTrigger)
93 {
94 return;
95 }
96 }
97
98 Int_t nHits = fHits->GetEntries();
99 if (nHits > (fNofPMTs / 2))
100 {
101 return;
102 }
103
105 Int_t iPlane;
106 Int_t iPaddle;
107 Int_t iSide;
108
109 // Loop over mapped hits
110 for (Int_t i = 0; i < nHits; i++)
111 {
112 hit = dynamic_cast<R3BNeulandTacquilaMappedData*>(fHits->At(i));
113 if (!hit)
114 {
115 continue;
116 }
117
118 // Check bar ID
119 iPlane = hit->GetPlane();
120 iPaddle = hit->GetPaddle();
121 iSide = hit->GetSide();
122
123 // Fill TAC histogram
124 fEngine->Fill(iPlane, iPaddle, iSide, hit->GetTacData());
125 fEngine->Fill(iPlane, iPaddle, iSide + 2, hit->GetStopT());
126 }
127
128 // Increment events
129 fNEvents += 1;
130}
131
133
134void R3BNeulandTacquilaMapped2CalPar::FinishTask() { fEngine->CalculateParamTacquila(); }
135
ClassImp(R3B::Neuland::Cal2HitPar)
An analysis task for TCAL calibration of NeuLAND data.
virtual void FinishEvent()
A method for finish of processing of an event.
virtual void Exec(Option_t *option)
Method for event loop implementation.
virtual void FinishTask()
Method for finish of the task execution.
virtual InitStatus Init()
Method for task initialization.