R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BNeulandTcalFill.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
14// ----------------------------------------------------------------
15// ----- R3BNeulandTcalFill -----
16// ----- Created 27-01-2015 by M.Heil -----
17// ----------------------------------------------------------------
18
19#include "R3BNeulandTcalFill.h"
20#include "FairLogger.h"
21#include "FairRootManager.h"
22#include "FairRtdbRun.h"
23#include "FairRunIdGenerator.h"
24#include "FairRuntimeDb.h"
25#include "R3BEventHeader.h"
27#include "R3BTCalEngine.h"
28#include "R3BTCalPar.h"
29#include "TClonesArray.h"
30#include "TF1.h"
31#include "TH1F.h"
32#include <stdlib.h>
33
35 : FairTask("R3BNeulandTCalFill", 1)
36 , fUpdateRate(1000000)
37 , fMinStats(100000)
38 , fTrigger(-1)
39 , fNofPlanes(0)
40 , fNofBars(0)
41 , fNof17(0)
42 , fNEvents(0)
43 , fCal_Par(NULL)
44{
45}
46
47R3BNeulandTcalFill::R3BNeulandTcalFill(const char* name, Int_t iVerbose)
48 : FairTask(name, iVerbose)
49 , fUpdateRate(1000000)
50 , fMinStats(100000)
51 , fTrigger(-1)
52 , fNofPlanes(0)
53 , fNofBars(0)
54 , fNof17(0)
55 , fNEvents(0)
56 , fCal_Par(NULL)
57{
58}
59
61{
62 if (fCal_Par)
63 {
64 delete fCal_Par;
65 }
66 if (fEngine)
67 {
68 delete fEngine;
69 }
70}
71
73{
74 FairRootManager* rm = FairRootManager::Instance();
75 if (!rm)
76 {
77 return kFATAL;
78 }
79 header = dynamic_cast<R3BEventHeader*>(rm->GetObject("EventHeader."));
80 /* if (!header)
81 {
82 return kFATAL;
83 }*/
84 fHits = dynamic_cast<TClonesArray*>(rm->GetObject("NeulandMappedData"));
85 if (!fHits)
86 {
87 return kFATAL;
88 }
89
90 fCal_Par = dynamic_cast<R3BTCalPar*>(FairRuntimeDb::instance()->getContainer("LandTCalPar"));
91 fCal_Par->setChanged();
92
93 fEngine = new R3BTCalEngine(fCal_Par, fMinStats);
94
95 return kSUCCESS;
96}
97
99{
100 /* if (fTrigger >= 0)
101 {
102 if (header->GetTrigger() != fTrigger)
103 {
104 return;
105 }
106 }*/
107
108 Int_t nHits = fHits->GetEntries();
109 // LOG(info) << "number of hits:" << nHits << " " ;
110
111 /*
112 if (nHits > (fNofPMTs / 2))
113 {
114 return;
115 }
116 */
117
119 Int_t iPlane;
120 Int_t iBar;
121
122 // Loop over mapped hits
123 for (Int_t i = 0; i < nHits; i++)
124 {
125 hit = dynamic_cast<R3BPaddleTamexMappedData*>(fHits->At(i));
126 if (!hit)
127 {
128 continue;
129 }
130
131 iPlane = hit->GetPlaneId();
132 iBar = hit->GetBarId();
133
134 if (iPlane > fNofPlanes)
135 {
136 LOG(error) << "R3BNeulandTcalFill::Exec() : more planes then expected! Plane: " << iPlane;
137 continue;
138 }
139 if (iBar > fNofBars)
140 {
141 LOG(error) << "R3BNeulandTcalFill::Exec() : more bars then expected! Plane: " << iBar;
142 continue;
143 }
144
145 // if (hit->Is17())
146 // {
147 // 17-th channel
148 // MH channel = fNofPMTs + hit->GetGtb() * 20 + hit->GetTacAddr();
149 // }
150 // else
151 // {
152 // PMT signal
153 // iSide = hit->GetSide();
154
155 // LOG(info) << "Plane: " << iPlane << " Bar: " << iBar << " Side: " << iSide << " Cal channel: " <<
156 // channel << " " ;
157
158 // }
159
160 // Fill TAC histogram
161 fEngine->Fill(iPlane, iBar, 0, hit->GetFineTime1LE());
162 fEngine->Fill(iPlane, iBar, 0 + 2, hit->GetFineTime1TE());
163
164 fEngine->Fill(iPlane, iBar, 1, hit->GetFineTime2LE());
165 fEngine->Fill(iPlane, iBar, 1 + 2, hit->GetFineTime2TE());
166 }
167
168 // Increment events
169 fNEvents += 1;
170}
171
173
174void R3BNeulandTcalFill::FinishTask() { fEngine->CalculateParamVFTX(); }
175
ClassImp(R3B::Neuland::Cal2HitPar)
An analysis task for TCAL calibration of NeuLAND Tamex data.
virtual ~R3BNeulandTcalFill()
Destructor.
R3BNeulandTcalFill()
Default constructor.
virtual void FinishTask()
Method for finish of the task execution.
virtual void Exec(Option_t *option)
Method for event loop implementation.
virtual void FinishEvent()
A method for finish of processing of an event.
virtual InitStatus Init()
Method for task initialization.
const Int_t & GetFineTime2LE() const
const Int_t & GetFineTime1LE() const
const Int_t & GetFineTime2TE() const
const Int_t & GetFineTime1TE() const