9 #include <beast/fangs/modules/FANGSStudyModule.h>
10 #include <beast/fangs/dataobjects/FANGSSimHit.h>
11 #include <beast/fangs/dataobjects/FANGSHit.h>
12 #include <framework/datastore/StoreArray.h>
13 #include <framework/gearbox/GearDir.h>
14 #include <framework/logging/Logger.h>
15 #include <framework/gearbox/Const.h>
31 using namespace fangs;
45 setDescription(
"Study module for Fangs (BEAST)");
49 FANGSStudyModule::~FANGSStudyModule()
54 void FANGSStudyModule::defineHisto()
56 h_time =
new TH2F(
"h_time",
"Detector # vs. time", 20, 0., 20., 1000, 0., 750.);
58 h_timeWeighted =
new TH2F(
"h_timeWeigthed",
"Detector # vs. time weighted by the energy deposited", 20, 0., 20., 1000, 0., 750.);
59 h_timeWeighted->Sumw2();
60 h_timeThres =
new TH2F(
"h_timeThres",
"Detector # vs. time", 20, 0., 20., 750, 0., 750.);
62 h_timeWeightedThres =
new TH2F(
"h_timeWeigthedThres",
"Detector # vs. time weighted by the energy deposited", 20, 0., 20., 750, 0.,
64 h_timeWeightedThres->Sumw2();
65 h_edep =
new TH2F(
"h_edep",
"Time bin # vs. energy deposited", 20, 0., 20., 1000, 0., 10.);
67 h_edep1 =
new TH2F(
"h_edep1",
"Time bin # vs. energy deposited", 20, 0., 20., 1000, 0., 10.);
69 h_edep2 =
new TH2F(
"h_edep2",
"Time bin # vs. energy deposited", 20, 0., 20., 1000, 0., 10.);
71 h_edep3 =
new TH2F(
"h_edep3",
"Time bin # vs. energy deposited", 20, 0., 20., 1000, 0., 10.);
74 h_edepThres =
new TH2F(
"h_edepThres",
"Time bin # vs. energy deposited", 20, 0., 20., 1000, 0., 10.);
76 h_edepThres1 =
new TH2F(
"h_edepThres1",
"Time bin # vs. energy deposited", 20, 0., 20., 1000, 0., 10.);
77 h_edepThres1->Sumw2();
78 h_edepThres2 =
new TH2F(
"h_edepThres2",
"Time bin # vs. energy deposited", 20, 0., 20., 1000, 0., 10.);
79 h_edepThres2->Sumw2();
80 h_edepThres3 =
new TH2F(
"h_edepThres3",
"Time bin # vs. energy deposited", 20, 0., 20., 1000, 0., 10.);
81 h_edepThres3->Sumw2();
82 for (
int i = 0; i < 3; i++) {
83 h_zvedep[i] =
new TH1F(TString::Format(
"h_zvedep_%d", i) ,
"edep [MeV] vs. z [cm]", 2000, -25., 25.);
86 h_xvzvedep[i] =
new TH2F(TString::Format(
"h_xvzvedep_%d", i) ,
"edep [MeV] vs. z [cm]", 2000, -25., 25., 2000, -25., 25.);
87 h_xvzvedep[i]->Sumw2();
89 h_yvzvedep[i] =
new TH2F(TString::Format(
"h_yvzvedep_%d", i) ,
"edep [MeV] vs. z [cm]", 2000, -25., 25., 2000, -25., 25.);
90 h_yvzvedep[i]->Sumw2();
92 h_rvzvedep[i] =
new TH2F(TString::Format(
"h_rvzvedep_%d", i) ,
"edep [MeV] vs. z [cm]", 2000, 0., 25., 2000, -25., 25.);
93 h_rvzvedep[i]->Sumw2();
95 h_xvyvedep[i] =
new TH2F(TString::Format(
"h_xvyvedep_%d", i) ,
"edep [MeV] vs. y [cm]", 2000, -25., 25., 2000, -25., 25.);
96 h_xvyvedep[i]->Sumw2();
98 h_zvedepW[i] =
new TH1F(TString::Format(
"h_zvedepW_%d", i) ,
"edep [MeV] vs. z [cm]", 2000, -25., 25.);
99 h_zvedepW[i]->Sumw2();
101 h_xvzvedepW[i] =
new TH2F(TString::Format(
"h_xvzvedepW_%d", i) ,
"edep [MeV] vs. x vs. z [cm]", 2000, -25., 25., 2000, -25., 25.);
102 h_xvzvedepW[i]->Sumw2();
104 h_yvzvedepW[i] =
new TH2F(TString::Format(
"h_yvzvedepW_%d", i) ,
"edep [MeV] vs. y vs. z [cm]", 2000, -25., 25., 2000, -25., 25.);
105 h_yvzvedepW[i]->Sumw2();
107 h_xvyvedepW[i] =
new TH2F(TString::Format(
"h_xvyvedepW_%d", i) ,
"edep [MeV] vs. x vs. y [cm]", 2000, -25., 25., 2000, -25., 25.);
108 h_xvyvedepW[i]->Sumw2();
110 h_rvzvedepW[i] =
new TH2F(TString::Format(
"h_rvzvedepW_%d", i) ,
"edep [MeV] vs. z [cm]", 2000, 0., 25., 2000, -25., 25.);
111 h_rvzvedepW[i]->Sumw2();
114 h_zvedepT[i] =
new TH1F(TString::Format(
"h_zvedepT_%d", i) ,
"edep [MeV] vs. z [cm]", 2000, -25., 25.);
115 h_zvedepT[i]->Sumw2();
117 h_xvzvedepT[i] =
new TH2F(TString::Format(
"h_xvzvedepT_%d", i) ,
"edep [MeV] vs. z [cm]", 2000, -25., 25., 2000, -25., 25.);
118 h_xvzvedepT[i]->Sumw2();
120 h_yvzvedepT[i] =
new TH2F(TString::Format(
"h_yvzvedepT_%d", i) ,
"edep [MeV] vs. z [cm]", 2000, -25., 25., 2000, -25., 25.);
121 h_yvzvedepT[i]->Sumw2();
123 h_rvzvedepT[i] =
new TH2F(TString::Format(
"h_rvzvedepT_%d", i) ,
"edep [MeV] vs. z [cm]", 2000, 0., 25., 2000, -25., 25.);
124 h_rvzvedepT[i]->Sumw2();
126 h_xvyvedepT[i] =
new TH2F(TString::Format(
"h_xvyvedepT_%d", i) ,
"edep [MeV] vs. y [cm]", 2000, -25., 25., 2000, -25., 25.);
127 h_xvyvedepT[i]->Sumw2();
129 h_zvedepWT[i] =
new TH1F(TString::Format(
"h_zvedepWT_%d", i) ,
"edep [MeV] vs. z [cm]", 2000, -25., 25.);
130 h_zvedepWT[i]->Sumw2();
132 h_xvzvedepWT[i] =
new TH2F(TString::Format(
"h_xvzvedepWT_%d", i) ,
"edep [MeV] vs. x vs. z [cm]", 2000, -25., 25., 2000, -25., 25.);
133 h_xvzvedepWT[i]->Sumw2();
135 h_yvzvedepWT[i] =
new TH2F(TString::Format(
"h_yvzvedepWT_%d", i) ,
"edep [MeV] vs. y vs. z [cm]", 2000, -25., 25., 2000, -25., 25.);
136 h_yvzvedepWT[i]->Sumw2();
138 h_xvyvedepWT[i] =
new TH2F(TString::Format(
"h_xvyvedepWT_%d", i) ,
"edep [MeV] vs. x vs. y [cm]", 2000, -25., 25., 2000, -25., 25.);
139 h_xvyvedepWT[i]->Sumw2();
141 h_rvzvedepWT[i] =
new TH2F(TString::Format(
"h_rvzvedepWT_%d", i) ,
"edep [MeV] vs. z [cm]", 2000, 0., 25., 2000, -25., 25.);
142 h_rvzvedepWT[i]->Sumw2();
144 h_Edep =
new TH2F(
"h_Edep",
"det # # vs. energy deposited", 20, 0., 20., 1000, 0., 10.);
145 h_pxNb =
new TH2F(
"h_pxNb",
"det # # vs. nb pixel", 20, 0., 20., 1000, 0., 1000.);
146 for (
int i = 0; i < 15; i++) {
147 h_cvr[i] =
new TH2F(TString::Format(
"cvr_%d", i) ,
" col v. row", 80, 0., 80., 336, 0., 336.);
152 void FANGSStudyModule::initialize()
154 B2INFO(
"FANGSStudyModule: Initialize");
163 fctQ_Calib1 =
new TF1(
"fctQ_Calib1",
"[0]*([1]*x-[2])/([3]-x)", 0., 15.);
164 fctQ_Calib1->SetParameters(m_TOTQ1, m_TOTC1, m_TOTA1 * m_TOTB1, m_TOTA1);
166 fctQ_Calib2 =
new TF1(
"fctQ_Calib2",
"[0]*([1]*x-[2])/([3]-x)", 0., 15.);
167 fctQ_Calib2->SetParameters(m_TOTQ2, m_TOTC2, m_TOTA2 * m_TOTB2, m_TOTA2);
170 void FANGSStudyModule::beginRun()
174 void FANGSStudyModule::event()
194 if (olddetNb != detNb) {
196 h_Edep->Fill(detNb, esum);
197 h_pxNb->Fill(detNb, ipix);
201 for (
int j = 0; j < maxSIZE; j++) {
209 x[ipix] = col * (2. * m_ChipColumnX / (float)m_ChipColumnNb) - m_ChipColumnX;
210 y[ipix] = row * (2. * m_ChipRowY / (float)m_ChipRowNb) - m_ChipRowY;
211 z[ipix] = (m_PixelTimeBin / 2. + m_PixelTimeBin * bcid) * m_v_sensor;
212 if (tot < 3) e[ipix] = fctQ_Calib1->Eval(tot) * m_Workfct * 1e-3;
213 else e[ipix] = fctQ_Calib2->Eval(tot) * m_Workfct * 1e-3;
215 h_cvr[detNb]->Fill(col, row);
223 for (
int i = 0; i < nSimHits; i++) {
228 double timeBin = aHit->
getTime();
232 double r = sqrt(position.X() * position.X() + position.Y() * position.Y());
233 int detNB = (lad - 1) * 5 + sen - 1;
236 h_time->Fill(detNB, timeBin);
237 h_edep->Fill(detNB, adep * 1e3);
238 if (fabs(pdg) == Const::electron.getPDGCode())h_edep1->Fill(detNB, adep * 1e3);
239 if (pdg == Const::photon.getPDGCode())h_edep2->Fill(detNB, adep * 1e3);
240 if (pdg != Const::photon.getPDGCode() && fabs(pdg) != Const::electron.getPDGCode())h_edep3->Fill(detNB, adep * 1e3);
241 if (adep > 50.*1e-6) {
242 h_timeThres->Fill(detNB, timeBin);
243 h_edepThres->Fill(detNB, adep * 1e3);
244 if (fabs(pdg) == Const::electron.getPDGCode())h_edepThres1->Fill(detNB, adep * 1e3);
245 if (pdg == Const::photon.getPDGCode())h_edepThres2->Fill(detNB, adep * 1e3);
246 if (pdg != Const::photon.getPDGCode() && fabs(pdg) != Const::electron.getPDGCode())h_edepThres3->Fill(detNB, adep * 1e3);
248 h_zvedep[lad - 1]->Fill(position.Z());
249 h_xvzvedep[lad - 1]->Fill(position.X(), position.Z());
250 h_yvzvedep[lad - 1]->Fill(position.Y(), position.Z());
251 h_xvyvedep[lad - 1]->Fill(position.X(), position.Y());
252 h_rvzvedep[lad - 1]->Fill(r, position.Z());
253 h_zvedepW[lad - 1]->Fill(position.Z(), adep * 1e3);
254 h_xvzvedepW[lad - 1]->Fill(position.X(), position.Z(), adep * 1e3);
255 h_yvzvedepW[lad - 1]->Fill(position.Y(), position.Z(), adep * 1e3);
256 h_xvyvedepW[lad - 1]->Fill(position.X(), position.Y(), adep * 1e3);
257 h_rvzvedepW[lad - 1]->Fill(r, position.Z(), adep * 1e3);
258 if (adep > 50.*1e-6) {
259 h_zvedepT[lad - 1]->Fill(position.Z());
260 h_xvzvedepT[lad - 1]->Fill(position.X(), position.Z());
261 h_yvzvedepT[lad - 1]->Fill(position.Y(), position.Z());
262 h_xvyvedepT[lad - 1]->Fill(position.X(), position.Y());
263 h_rvzvedepT[lad - 1]->Fill(r, position.Z());
264 h_zvedepWT[lad - 1]->Fill(position.Z(), adep * 1e3);
265 h_xvzvedepWT[lad - 1]->Fill(position.X(), position.Z(), adep * 1e3);
266 h_yvzvedepWT[lad - 1]->Fill(position.Y(), position.Z(), adep * 1e3);
267 h_xvyvedepWT[lad - 1]->Fill(position.X(), position.Y(), adep * 1e3);
268 h_rvzvedepWT[lad - 1]->Fill(r, position.Z(), adep * 1e3);
275 void FANGSStudyModule::getXMLData()
277 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name=\"FANGS\"]/Content/");
279 m_PixelThreshold = content.getInt(
"PixelThreshold");
280 m_PixelThresholdRMS = content.getInt(
"PixelThresholdRMS");
281 m_PixelTimeBinNb = content.getInt(
"PixelTimeBinNb");
282 m_PixelTimeBin = content.getDouble(
"PixelTimeBin");
283 m_ChipColumnNb = content.getInt(
"ChipColumnNb");
284 m_ChipRowNb = content.getInt(
"ChipRowNb");
285 m_ChipColumnX = content.getDouble(
"ChipColumnX");
286 m_ChipRowY = content.getDouble(
"ChipRowY");
287 m_TOTA1 = content.getDouble(
"TOTA1");
288 m_TOTB1 = content.getDouble(
"TOTB1");
289 m_TOTC1 = content.getDouble(
"TOTC1");
290 m_TOTQ1 = content.getDouble(
"TOTQ1");
291 m_TOTA2 = content.getDouble(
"TOTA2");
292 m_TOTB2 = content.getDouble(
"TOTB2");
293 m_TOTC2 = content.getDouble(
"TOTC2");
294 m_TOTQ2 = content.getDouble(
"TOTQ2");
295 m_v_sensor = content.getDouble(
"v_sensor");
296 m_sensor_width = content.getDouble(
"sensor_width");
297 m_Workfct = content.getDouble(
"Workfct");
301 void FANGSStudyModule::endRun()
308 void FANGSStudyModule::terminate()
ClassFANGSHit - digitization simulated hit for the FANGS detector.
int getBCID() const
Return the BCID.
int getrow() const
Return the row.
int getTOT() const
Return the TOT.
int getdetNb() const
Return the TPC number.
int getcolumn() const
Return the column.
Class FANGSSimHit - Geant4 simulated hit for the FANGS detector.
float getTime() const
Return the global time.
float getEnergyDep() const
Return the energy deposition in electrons.
int getLadder() const
Return the Ladder number (starting at 1, increasing with phi)
int getSensor() const
Return the Sensor number (starting at 1, increasing with decreasing z)
int getPDG() const
Return the PDG number of the track.
TVector3 getPosEntry() const
Return the entry track position.
GearDir is the basic class used for accessing the parameter store.
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Accessor to arrays stored in the data store.
int getEntries() const
Get the number of objects in the array.
Study module for Fangs (BEAST)
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.