Belle II Software  release-06-02-00
CDCJobCntlParModifierModule.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #include <cdc/modules/cdcJobCntlParModifier/CDCJobCntlParModifierModule.h>
10 //#include <framework/logging/Logger.h>
11 
12 using namespace std;
13 using namespace Belle2;
14 using namespace CDC;
15 
16 // register module
17 REG_MODULE(CDCJobCntlParModifier)
19  m_gcp(CDCGeoControlPar::getInstance()), m_timeWalk(), m_wireSag(), m_modLeftRightFlag(), m_debug4Sim(), m_thresholdEnergyDeposit(),
20  m_minTrackLength(), m_addFudgeFactorForSigmaForData(), m_addFudgeFactorForSigmaForMC(),
21  m_mapperGeometry(), m_mapperPhiAngle(), m_debug4Geo(), m_printMaterialTable(),
22  m_materialDefinitionMode(), m_senseWireZposMode(),
23  m_displacement(),
24  m_alignment(),
25  m_misalignment(),
26  m_displacementInputType(), m_alignmentInputType(), m_misalignmentInputType(), m_xtInputType(), m_sigmaInputType(),
27  m_propSpeedInputType(), m_t0InputType(), m_twInputType(), m_bwInputType(), m_chMapInputType(), m_eDepToADCInputType(),
28  m_displacementFile(),
29  m_alignmentFile(), m_misalignmentFile(), m_xtFile(), m_sigmaFile(), m_propSpeedFile(), m_t0File(), m_twFile(), m_bwFile(),
30  m_chMapFile(), m_eDepToADCFile()
31 
32 {
33  // B2INFO("CDCJobCntlParModifierModule::constructor called.");
34  // Set description
35  setDescription("Change job contorol parameters. Please put this module in the path (before Geometry module) with specified input parameters when you want to change them.");
36  setPropertyFlags(c_ParallelProcessingCertified);
37 
38  //N.B. The following default values must be identical to the ones in xxControlPar objects.
39  //For Simulation
40  //Switch for debug
41  addParam("Debug4Sim", m_debug4Sim, "Switch on/off debug in FullSim.", false);
42  //Switch for time walk in translator
43  addParam("TimeWalkInTranslator", m_timeWalk,
44  "Switch on/off time-walk correction in the TDC-count translator for MC events. Use the CDCDigitizer's flag if you want to add/not add time walk in digitization.",
45  true);
46  //Switch for wire sag
47  addParam("WireSag", m_wireSag,
48  "Switch on/off sense wire (gravitational) sag in FullSim. Here, sag means the main part which corresponds to design+displacement in case of wire position. You can control the perturbative part (corresponting to (mis)alignment in case of wire-position) of sag in Digitizer.",
49  true);
50  //Switch for modified left/right flag
51  addParam("ModLeftRightFlag", m_modLeftRightFlag, "Switch on/off calculation of modified left/right flag in FullSim.", false);
52  //energy thresh
53  addParam("ThresholdEnergyDeposit", m_thresholdEnergyDeposit,
54  "Energy deposite (edep) thresh. for G4 step (GeV). All hits with smaller edep will be dropped at FullSim level. Set this to a negative value if you want to keep simhits with edep=0.",
55  0.0);
56  //min. track length
57  addParam("MinTrackLength", m_minTrackLength,
58  "Minimum track length (cm) required for saving in MCParticle.; to be applied to all particles other than primaries and decay-daughters.",
59  15.0);
60 
61  //For Geometry
62  //Switch for debug
63  addParam("Debug4Geo", m_debug4Geo, "Switch on/off debug in Geo.", false);
64  //Switch for printing material table
65  addParam("PrintMaterialTable", m_printMaterialTable,
66  "Switch on/off printing the G4 material table at the stage of CDC geometry creation.", false);
67  //material definition mode
68  addParam("MaterialDefinitionMode", m_materialDefinitionMode,
69  "Material definition mode: =0: define a mixture of gases and wires in the entire tracking volume; =1: dummy; =2: define all sense and field wires explicitly in the volume.",
70  0);
71  //sense wire z pos mode
72  addParam("SenseWireZposMode", m_senseWireZposMode,
73  "Sense wire z position mode: =1: correct for feedthrough effect; =0: not correct.", 1);
74  //displacement switch
75  addParam("Displacement", m_displacement, "Switch for wire displacement: on/off.", true);
76  //alignmentt switch
77  addParam("Alignment", m_alignment, "Switch for wire alignment: on/off.", true);
78  //misalignment switch
79  // addParam("Misalignment", m_misalignment, "Switch for wire misalignment: on/off.", true);
80  m_misalignment = false;
81 
82 
83  //input type for displacement
84  addParam("DisplacementInputType", m_displacementInputType, "Input type for wire displacement; db-object (true); text-file (false).",
85  true);
86  //input type for alignment
87  addParam("AlignmentInputType", m_alignmentInputType, "Input type for wire alignment; db-object (true); text-file (false).", true);
88  //input type for misalignment
89  // addParam("MisalignmentInputType", m_misalignmentInputType, "Input type for wire misalignment; db-object (true); text-file (false).", true);
90  m_misalignmentInputType = true;
91  //input type for xt-relation
92  addParam("XtInputType", m_xtInputType, "Input type for xt-relations; db-object (true); text-file (false).", true);
93  //input type for sigma
94  addParam("SigmaInputType", m_sigmaInputType, "Input type for sigmas; db-object (true); text-file (false).", true);
95  //input type for prop-speed
96  addParam("PropSpeedInputType", m_propSpeedInputType, "Input type for prop-speeds; db-object (true); text-file (false).", true);
97  //input type for t0
98  addParam("T0InputType", m_t0InputType, "Input type for t0s; db-object (true); text-file (false).", true);
99  //input type for time walk
100  addParam("TimeWalkInputType", m_twInputType, "Input type for time walks; db-object (true); text-file (false).", true);
101  //input type for bad wire
102  addParam("BadWireInputType", m_bwInputType, "Input type for bad wires; db-object (true); text-file (false).", true);
103  //input type for channel map
104  addParam("ChannelMapInputType", m_chMapInputType, "Input type for channel map; db-object (true); text-file (false).", true);
105  //input type for edep-to-adc
106  addParam("EDepToADCInputType", m_eDepToADCInputType, "Input type for edep-to-adc; db-object (true); text-file (false).", true);
107 
108 
109  //displacement file
110  addParam("DisplacementFile", m_displacementFile, "Input file name (on cdc/data) for wire displacement.",
111  string("displacement_v2.2.1.dat"));
112  //alignment file
113  addParam("AlignmentFile", m_alignmentFile, "Input file name (on cdc/data) for wire alignment.", string("alignment_v2.dat"));
114  //misalignment file
115  // addParam("MisalignmentFile", m_misalignmentFile, "Input file name (on cdc/data) for wire misalignment.", string("misalignment_v2.dat"));
116  m_misalignmentFile = string("misalignment_v2.dat");
117  //xt-relation
118  addParam("XtFile", m_xtFile, "Input file name (on cdc/data) for xt-relations. You can specify either an uncompressed or gzip file.",
119  string("xt_v3_chebyshev.dat.gz"));
120  //sigma
121  addParam("SigmaFile", m_sigmaFile, "Input file name (on cdc/data) for sigmas.", string("sigma_v2.dat"));
122  //prop-speed
123  addParam("PropSpeedFile", m_propSpeedFile, "Input file name (on cdc/data) for prop-speeds.", string("propspeed_v0.dat"));
124  //t0
125  addParam("T0File", m_t0File, "Input file name (on cdc/data) for t0s.", string("t0_v1.dat"));
126  //time walk
127  addParam("TimeWalkFile", m_twFile, "Input file name (on cdc/data) for time walks.", string("tw_off.dat"));
128  //bad wire
129  addParam("BadWireFile", m_bwFile, "Input file name (on cdc/data) for bad wires.", string("badwire_v1.dat"));
130  //channel map
131  addParam("ChannelMapFile", m_chMapFile, "Input file name (on cdc/data) for channel map.", string("ch_map.dat"));
132  //edep-to-adc
133  addParam("EDepToADCFile", m_eDepToADCFile, "Input file name (on cdc/data) for edep-to-adc.", string("edeptoadc.dat"));
134 
135  //additional fudge factor for data
136  addParam("AddFudgeFactorForSigmaForData", m_addFudgeFactorForSigmaForData,
137  "Additional fudge factor for space resol. used in real data event reconstruction (common to all cells).",
138  double(1.));
139 
140  //additional fudge factor for MC
141  addParam("AddFudgeFactorForSigmaForMC", m_addFudgeFactorForSigmaForMC,
142  "Additional fudge factor for space resol. used in MC event reconstruction (common to all cells). N.B. This factor is not applied in digitization; only applied in reconstruction. Pplease set the fudge parameter of digitizer instead if you want to change the digitization sigma indep. of sigma used in reconstruction.",
143  double(1.));
144 
145  //mapper geometry flag
146  addParam("MapperGeometry", m_mapperGeometry, "Define B-field mapper geometry used in GCR in 2017 summer. Tentative option.",
147  bool(false));
148 
149  //mapper phi-angle
150  addParam("MapperPhiAngle", m_mapperPhiAngle, "Phi-angle (deg.) of B-field mapper used in GCR in 2017 summer. Tentative option.",
151  double(16.7));
152 
153 }
154 
155 void CDCJobCntlParModifierModule::initialize()
156 {
157  // B2INFO("CDCJobCntlParModifierModule::initialize() called.");
158  //For Simulation
159  if (m_scp.getTimeWalk() != m_timeWalk) {
160  B2INFO("CDCJobCntlParModifier: timeWalk modified: " << m_scp.getTimeWalk() << " to " << m_timeWalk);
161  m_scp.setTimeWalk(m_timeWalk);
162  }
163 
164  if (m_scp.getWireSag() != m_wireSag) {
165  B2INFO("CDCJobCntlParModifier: wireSag modified: " << m_scp.getWireSag() << " to " << m_wireSag);
166  m_scp.setWireSag(m_wireSag);
167  }
168 
169  if (m_scp.getModLeftRightFlag() != m_modLeftRightFlag) {
170  B2INFO("CDCJobCntlParModifier: modLeftRightFlag modified: " << m_scp.getModLeftRightFlag() << " to " << m_modLeftRightFlag);
171  m_scp.setModLeftRightFlag(m_modLeftRightFlag);
172  }
173 
174  if (m_scp.getDebug() != m_debug4Sim) {
175  B2INFO("CDCJobCntlParModifier: debug4Sim modified: " << m_scp.getDebug() << " to " << m_debug4Sim);
176  m_scp.setDebug(m_debug4Sim);
177  }
178 
179  if (m_scp.getThresholdEnergyDeposit() != m_thresholdEnergyDeposit) {
180  B2INFO("CDCJobCntlParModifier: thresholdEnergyDeposit modified: " << m_scp.getThresholdEnergyDeposit() << " to " <<
181  m_thresholdEnergyDeposit);
182  m_scp.setThresholdEnergyDeposit(m_thresholdEnergyDeposit);
183  }
184 
185  if (m_scp.getMinTrackLength() != m_minTrackLength) {
186  B2INFO("CDCJobCntlParModifier: minTrackLength modified: " << m_scp.getMinTrackLength() << " to " << m_minTrackLength);
187  m_scp.setMinTrackLength(m_minTrackLength);
188  }
189 
190  //For Geometry
191  if (m_gcp.getMaterialDefinitionMode() != m_materialDefinitionMode) {
192  B2INFO("CDCJobCntlParModifier: materialDefinitionMode modified: " << m_gcp.getMaterialDefinitionMode() << " to " <<
193  m_materialDefinitionMode);
194  m_gcp.setMaterialDefinitionMode(m_materialDefinitionMode);
195  }
196 
197  if (m_gcp.getSenseWireZposMode() != m_senseWireZposMode) {
198  B2INFO("CDCJobCntlParModifier: senseWireZposMode modified: " << m_gcp.getSenseWireZposMode() << " " << m_senseWireZposMode);
199  m_gcp.setSenseWireZposMode(m_senseWireZposMode);
200  }
201 
202  if (m_gcp.getPrintMaterialTable() != m_printMaterialTable) {
203  B2INFO("CDCJobCntlParModifier: printMaterialTable modified: " << m_gcp.getPrintMaterialTable() << " to " << m_printMaterialTable);
204  m_gcp.setPrintMaterialTable(m_printMaterialTable);
205  }
206 
207  if (m_gcp.getDebug() != m_debug4Geo) {
208  B2INFO("CDCJobCntlParModifier: debug4Geo modified: " << m_gcp.getDebug() << " to " << m_debug4Geo);
209  m_gcp.setDebug(m_debug4Geo);
210  }
211 
212  if (m_gcp.getDisplacement() != m_displacement) {
213  B2INFO("CDCJobCntlParModifier: displacement switch modified: " << m_gcp.getDisplacement() << " to " << m_displacement);
214  m_gcp.setDisplacement(m_displacement);
215  }
216 
217  if (m_gcp.getAlignment() != m_alignment) {
218  B2INFO("CDCJobCntlParModifier: alignment switch modified: " << m_gcp.getAlignment() << " to " << m_alignment);
219  m_gcp.setAlignment(m_alignment);
220  }
221 
222  if (m_gcp.getMisalignment() != m_misalignment) {
223  B2INFO("CDCJobCntlParModifier: misalignment switch modified: " << m_gcp.getMisalignment() << " to " << m_misalignment);
224  m_gcp.setMisalignment(m_misalignment);
225  }
226 
227  if (m_gcp.getDisplacementInputType() != m_displacementInputType) {
228  B2INFO("CDCJobCntlParModifier: displacementInputType modified: " << m_gcp.getDisplacementInputType() << " to " <<
229  m_displacementInputType);
230  m_gcp.setDisplacementInputType(m_displacementInputType);
231  }
232 
233  if (m_gcp.getAlignmentInputType() != m_alignmentInputType) {
234  B2INFO("CDCJobCntlParModifier: alignmentInputType modified: " << m_gcp.getAlignmentInputType() << " to " << m_alignmentInputType);
235  m_gcp.setAlignmentInputType(m_alignmentInputType);
236  }
237 
238  if (m_gcp.getMisalignmentInputType() != m_misalignmentInputType) {
239  B2INFO("CDCJobCntlParModifier: misalignmentInputType modified: " << m_gcp.getMisalignmentInputType() << " to " <<
240  m_misalignmentInputType);
241  m_gcp.setMisalignmentInputType(m_misalignmentInputType);
242  }
243 
244  if (m_gcp.getXtInputType() != m_xtInputType) {
245  B2INFO("CDCJobCntlParModifier: xtInputType modified: " << m_gcp.getXtInputType() << " to " << m_xtInputType);
246  m_gcp.setXtInputType(m_xtInputType);
247  }
248 
249  if (m_gcp.getSigmaInputType() != m_sigmaInputType) {
250  B2INFO("CDCJobCntlParModifier: sigmaInputType modified: " << m_gcp.getSigmaInputType() << " to " << m_sigmaInputType);
251  m_gcp.setSigmaInputType(m_sigmaInputType);
252  }
253 
254  if (m_gcp.getPropSpeedInputType() != m_propSpeedInputType) {
255  B2INFO("CDCJobCntlParModifier: propSpeedInputType modified: " << m_gcp.getPropSpeedInputType() << " to " << m_propSpeedInputType);
256  m_gcp.setPropSpeedInputType(m_propSpeedInputType);
257  }
258 
259  if (m_gcp.getT0InputType() != m_t0InputType) {
260  B2INFO("CDCJobCntlParModifier: t0InputType modified: " << m_gcp.getT0InputType() << " to " << m_t0InputType);
261  m_gcp.setT0InputType(m_t0InputType);
262  }
263 
264  if (m_gcp.getTwInputType() != m_twInputType) {
265  B2INFO("CDCJobCntlParModifier: twInputType modified: " << m_gcp.getTwInputType() << " to " << m_twInputType);
266  m_gcp.setTwInputType(m_twInputType);
267  }
268 
269  if (m_gcp.getBwInputType() != m_bwInputType) {
270  B2INFO("CDCJobCntlParModifier: bwInputType modified: " << m_gcp.getBwInputType() << " to " << m_bwInputType);
271  m_gcp.setBwInputType(m_bwInputType);
272  }
273 
274  if (m_gcp.getChMapInputType() != m_chMapInputType) {
275  B2INFO("CDCJobCntlParModifier: chMapInputType modified: " << m_gcp.getChMapInputType() << " to " << m_chMapInputType);
276  m_gcp.setChMapInputType(m_chMapInputType);
277  }
278 
279  if (m_gcp.getEDepToADCInputType() != m_eDepToADCInputType) {
280  B2INFO("CDCJobCntlParModifier: edep-to-adc modified: " << m_gcp.getEDepToADCInputType() << " to " << m_eDepToADCInputType);
281  m_gcp.setEDepToADCInputType(m_eDepToADCInputType);
282  }
283 
284  if (m_gcp.getDisplacementFile() != m_displacementFile) {
285  B2INFO("CDCJobCntlParModifier: displacementFile modified: " << m_gcp.getDisplacementFile() << " to " << m_displacementFile);
286  m_gcp.setDisplacementFile(m_displacementFile);
287  }
288 
289  if (m_gcp.getAlignmentFile() != m_alignmentFile) {
290  B2INFO("CDCJobCntlParModifier: alignmentFile modified: " << m_gcp.getAlignmentFile() << " to " << m_alignmentFile);
291  m_gcp.setAlignmentFile(m_alignmentFile);
292  }
293 
294  if (m_gcp.getMisalignmentFile() != m_misalignmentFile) {
295  B2INFO("CDCJobCntlParModifier: misalignmentFile modified: " << m_gcp.getMisalignmentFile() << " to " << m_misalignmentFile);
296  m_gcp.setMisalignmentFile(m_misalignmentFile);
297  }
298 
299  if (m_gcp.getXtFile() != m_xtFile) {
300  B2INFO("CDCJobCntlParModifier: xtFile modified: " << m_gcp.getXtFile() << " to " << m_xtFile);
301  m_gcp.setXtFile(m_xtFile);
302  }
303 
304  if (m_gcp.getSigmaFile() != m_sigmaFile) {
305  B2INFO("CDCJobCntlParModifier: sigmaFile modified: " << m_gcp.getSigmaFile() << " to " << m_sigmaFile);
306  m_gcp.setSigmaFile(m_sigmaFile);
307  }
308 
309  if (m_gcp.getPropSpeedFile() != m_propSpeedFile) {
310  B2INFO("CDCJobCntlParModifier: propSpeedFile modified: " << m_gcp.getPropSpeedFile() << " to " << m_propSpeedFile);
311  m_gcp.setPropSpeedFile(m_propSpeedFile);
312  }
313 
314  if (m_gcp.getT0File() != m_t0File) {
315  B2INFO("CDCJobCntlParModifier: t0File modified: " << m_gcp.getT0File() << " to " << m_t0File);
316  m_gcp.setT0File(m_t0File);
317  }
318 
319  if (m_gcp.getTwFile() != m_twFile) {
320  B2INFO("CDCJobCntlParModifier: timeWalkFile modified: " << m_gcp.getTwFile() << " to " << m_twFile);
321  m_gcp.setTwFile(m_twFile);
322  }
323 
324  if (m_gcp.getBwFile() != m_bwFile) {
325  B2INFO("CDCJobCntlParModifier: badWireFile modified: " << m_gcp.getBwFile() << " to " << m_bwFile);
326  m_gcp.setBwFile(m_bwFile);
327  }
328 
329  if (m_gcp.getChMapFile() != m_chMapFile) {
330  B2INFO("CDCJobCntlParModifier: chMapFile modified: " << m_gcp.getChMapFile() << " to " << m_chMapFile);
331  m_gcp.setChMapFile(m_chMapFile);
332  }
333 
334  if (m_gcp.getEDepToADCFile() != m_eDepToADCFile) {
335  B2INFO("CDCJobCntlParModifier: edep-to-adcFile modified: " << m_gcp.getEDepToADCFile() << " to " << m_eDepToADCFile);
336  m_gcp.setEDepToADCFile(m_eDepToADCFile);
337  }
338 
339  if (m_gcp.getAddFudgeFactorForSigmaForData() != m_addFudgeFactorForSigmaForData) {
340  B2INFO("CDCJobCntlParModifier: addFudgeFactorForSigmaForData modified: " << m_gcp.getAddFudgeFactorForSigmaForData() << " to "
341  << m_addFudgeFactorForSigmaForData);
342  m_gcp.setAddFudgeFactorForSigmaForData(m_addFudgeFactorForSigmaForData);
343  }
344 
345  if (m_gcp.getAddFudgeFactorForSigmaForMC() != m_addFudgeFactorForSigmaForMC) {
346  B2INFO("CDCJobCntlParModifier: addFudgeFactorForSigmaForMC modified: " << m_gcp.getAddFudgeFactorForSigmaForMC() << " to " <<
347  m_addFudgeFactorForSigmaForMC);
348  m_gcp.setAddFudgeFactorForSigmaForMC(m_addFudgeFactorForSigmaForMC);
349  }
350 
351  if (m_gcp.getMapperGeometry() != m_mapperGeometry) {
352  B2INFO("CDCJobCntlParModifier: mapper geometry flag modified: " << m_gcp.getMapperGeometry() << " to " << m_mapperGeometry);
353  m_gcp.setMapperGeometry(m_mapperGeometry);
354  }
355 
356  if (m_gcp.getMapperPhiAngle() != m_mapperPhiAngle) {
357  B2INFO("CDCJobCntlParModifier: mapper phi-angle modified: " << m_gcp.getMapperPhiAngle() << " to " << m_mapperPhiAngle);
358  m_gcp.setMapperPhiAngle(m_mapperPhiAngle);
359  }
360 }
361 
362 void CDCJobCntlParModifierModule::event()
363 {
364 }
The Class for Detailed Digitization of CDC.
The Class for CDC Geometry Control Parameters.
The Class for CDC Simulation Control Parameters.
Base class for Modules.
Definition: Module.h:72
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.