R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BNeulandMappedHist.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 "FairRunOnline.h"
18#include "R3BEventHeader.h"
19#include "R3BLosMappedData.h"
22#include "TClonesArray.h"
23#include "TH1F.h"
24#include "TH2F.h"
25
27 : FairTask("NeulandMappedHist", 1)
28 , fnEvents(0)
29 , fNItemsTotal(0)
30 , fHeader(NULL)
31 , fLandMappedData(NULL)
32 , fNeulandTamexHitMapped(NULL)
33 , fLosMappedData(NULL)
34{
35}
36
37R3BNeulandMappedHist::R3BNeulandMappedHist(const char* name, Int_t iVerbose)
38 : FairTask(name, iVerbose)
39 , fnEvents(0)
40 , fNItemsTotal(0)
41 , fHeader(NULL)
42 , fLandMappedData(NULL)
43 , fNeulandTamexHitMapped(NULL)
44 , fLosMappedData(NULL)
45{
46}
47
49
51{
52 FairRootManager* fMan = FairRootManager::Instance();
53 fHeader = dynamic_cast<R3BEventHeader*>(fMan->GetObject("EventHeader."));
54 fLandMappedData = dynamic_cast<TClonesArray*>(fMan->GetObject("NeulandTacquilaMappedData"));
55 fLosMappedData = dynamic_cast<TClonesArray*>(fMan->GetObject("LosMapped"));
56 fNeulandTamexHitMapped = dynamic_cast<TClonesArray*>(fMan->GetObject("NeulandMappedData"));
57 CreateHistos();
58
59 return kSUCCESS;
60}
61
62void R3BNeulandMappedHist::Exec(Option_t* option)
63{
64 if (fHeader)
65 {
66 fh_trigger->Fill(fHeader->GetTrigger());
67 }
68
69 if (fLandMappedData)
70 {
71 Int_t nLandMapped = fLandMappedData->GetEntries();
72 fNItemsTotal += nLandMapped;
74 for (Int_t i = 0; i < nLandMapped; i++)
75 {
76 hitmapped = dynamic_cast<R3BNeulandTacquilaMappedData*>(fLandMappedData->At(i));
77 fh_land_mapped_barid->Fill((hitmapped->GetPlane() - 1) * 50 + hitmapped->GetPaddle());
78 fh_land_mapped_side->Fill(hitmapped->GetSide());
79 fh_land_mapped_clock->Fill(hitmapped->GetClock());
80 fh_land_mapped_tac->Fill(hitmapped->GetTacData());
81 fh_land_mapped_qdc->Fill(hitmapped->GetQdcData());
82 }
83 }
84
85 if (fNeulandTamexHitMapped)
86 {
87 Int_t nNeulandTamexHitsMapped = fNeulandTamexHitMapped->GetEntries();
88 // fNItemsTotal += nLandRawHitsMapped;
89 R3BPaddleTamexMappedData* hitmapped;
90 for (Int_t i = 0; i < nNeulandTamexHitsMapped; i++)
91 {
92 hitmapped = dynamic_cast<R3BPaddleTamexMappedData*>(fNeulandTamexHitMapped->At(i));
93 fh_neuland_mapped_is17->Fill(hitmapped->Is17());
94 if (!hitmapped->Is17())
95 {
96 fh_neuland_mapped_planeid->Fill(hitmapped->GetPlaneId());
97 fh_neuland_mapped_barid->Fill(hitmapped->GetBarId());
98 // fh_neuland_mapped_side->Fill(hitmapped->GetSide());
99
100 fh_neuland_mapped_cle->Fill(hitmapped->GetCoarseTime(0, 0)); // PM1 LE
101 fh_neuland_mapped_cte->Fill(hitmapped->GetCoarseTime(0, 1)); // PM1 TE
102 fh_neuland_mapped_fle->Fill(hitmapped->GetFineTime(0, 0)); // PM1 LE
103 fh_neuland_mapped_fte->Fill(hitmapped->GetFineTime(0, 1)); // PM1 TE
104
105 fh_neuland_mapped_cle->Fill(hitmapped->GetCoarseTime(1, 0)); // PM2 LE
106 fh_neuland_mapped_cte->Fill(hitmapped->GetCoarseTime(1, 1)); // PM2 TE
107 fh_neuland_mapped_fle->Fill(hitmapped->GetFineTime(1, 0)); // PM2 LE
108 fh_neuland_mapped_fte->Fill(hitmapped->GetFineTime(1, 1)); // PM2 TE
109 // cout<<"in ana: "<<hitmapped->GetPlaneId()<<" "<<hitmapped->GetBarId()<<endl;
110 }
111 }
112 }
113
114 if (fLosMappedData)
115 {
116 Int_t nLosMapped = fLosMappedData->GetEntries();
117 R3BLosMappedData* loshit;
118 for (Int_t i = 0; i < nLosMapped; i++)
119 {
120 loshit = dynamic_cast<R3BLosMappedData*>(fLosMappedData->At(i));
121 fh_los_det->Fill(loshit->GetDetector());
122 fh_los_ch->Fill(loshit->GetChannel());
123 fh_los_tcoarse->Fill(loshit->GetTimeCoarse());
124 fh_los_tfine->Fill(loshit->GetTimeFine());
125 }
126 }
127
128 fnEvents += 1;
129 // if (0 == (fnEvents % 1000))
130 //{
131 // LOG(info) << "R3BNeulandMappedHist : " << fnEvents << " events collected";
132 //}
133}
134
135void R3BNeulandMappedHist::FinishTask() { WriteHistos(); }
136
137void R3BNeulandMappedHist::CreateHistos()
138{
139 fh_trigger = new TH1F("h_trigger", "Trigger", 10, -0.5, 9.5);
140
141 fh_land_mapped_barid = new TH1F("h_land_mapped_barid", "Bar ID", 500, -0.5, 499.5);
142 fh_land_mapped_side = new TH1F("h_land_mapped_side", "Side", 5, -0.5, 4.5);
143 fh_land_mapped_clock = new TH1F("h_land_mapped_clock", "Clock count", 70, -0.5, 69.5);
144 fh_land_mapped_tac = new TH1F("h_land_mapped_tac", "TAC data", 500, 0., 5000.);
145 fh_land_mapped_qdc = new TH1F("h_land_mapped_qdc", "QDC data", 100, 0., 1000.);
146
147 fh_neuland_mapped_is17 = new TH1F("h_neuland_mapped_is17", "Is 17", 4, -0.5, 3.5);
148 fh_neuland_mapped_planeid = new TH1F("h_neuland_mapped_planeid", "Plane ID", 30, -0.5, 29.5);
149 fh_neuland_mapped_barid = new TH1F("h_neuland_mapped_barid", "Bar ID", 50, -0.5, 49.5);
150 fh_neuland_mapped_side = new TH1F("h_neuland_mapped_side", "Side", 5, -0.5, 4.5);
151 fh_neuland_mapped_cle = new TH1F("h_neuland_mapped_cle", "Coarse time LE", 8200, 0., 8200.);
152 fh_neuland_mapped_cte = new TH1F("h_neuland_mapped_cte", "Coarse time TE", 8200, 0., 8200.);
153 fh_neuland_mapped_fle = new TH1F("h_neuland_mapped_fle", "Fine time LE", 600, 0., 600.);
154 fh_neuland_mapped_fte = new TH1F("h_neuland_mapped_fte", "Fine time TE", 600, 0., 600.);
155
156 fh_los_det = new TH1F("h_los_det", "Detector", 20, -0.5, 19.5);
157 fh_los_ch = new TH1F("h_los_ch", "Channel", 20, -0.5, 19.5);
158 fh_los_tcoarse = new TH1F("h_los_tcoarse", "Time coarse", 1000, 0., 10000.);
159 fh_los_tfine = new TH1F("h_los_tfine", "Time fine", 200, 0., 2000.);
160
161 FairRunOnline* run = FairRunOnline::Instance();
162
163 run->AddObject(fh_trigger);
164
165 run->AddObject(fh_land_mapped_barid);
166 run->AddObject(fh_land_mapped_side);
167 run->AddObject(fh_land_mapped_clock);
168 run->AddObject(fh_land_mapped_tac);
169 run->AddObject(fh_land_mapped_qdc);
170
171 run->AddObject(fh_neuland_mapped_is17);
172 run->AddObject(fh_neuland_mapped_planeid);
173 run->AddObject(fh_neuland_mapped_barid);
174 run->AddObject(fh_neuland_mapped_side);
175 run->AddObject(fh_neuland_mapped_cle);
176 run->AddObject(fh_neuland_mapped_cte);
177 run->AddObject(fh_neuland_mapped_fle);
178 run->AddObject(fh_neuland_mapped_fte);
179
180 run->AddObject(fh_los_det);
181 run->AddObject(fh_los_ch);
182 run->AddObject(fh_los_tcoarse);
183 run->AddObject(fh_los_tfine);
184
185 run->RegisterHttpCommand("/Reset_h_land_mapped_barid", "/h_land_mapped_barid/->Reset()");
186}
187
188void R3BNeulandMappedHist::WriteHistos()
189{
190 fh_neuland_mapped_is17->Write();
191 fh_neuland_mapped_planeid->Write();
192 fh_neuland_mapped_barid->Write();
193 fh_neuland_mapped_side->Write();
194 fh_neuland_mapped_cle->Write();
195 fh_neuland_mapped_cte->Write();
196 fh_neuland_mapped_fle->Write();
197 fh_neuland_mapped_fte->Write();
198}
199
ClassImp(R3B::Neuland::Cal2HitPar)
virtual InitStatus Init()
virtual void Exec(Option_t *option)
const Int_t & GetFineTime(int t, int e) const
const Int_t & GetCoarseTime(int t, int e) const