Belle II Software development
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
12using namespace std;
13using namespace Belle2;
14using namespace CDC;
15
16// register module
17REG_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.");
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);
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
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);
162 }
163
164 if (m_scp.getWireSag() != m_wireSag) {
165 B2INFO("CDCJobCntlParModifier: wireSag modified: " << m_scp.getWireSag() << " to " << m_wireSag);
167 }
168
170 B2INFO("CDCJobCntlParModifier: modLeftRightFlag modified: " << m_scp.getModLeftRightFlag() << " to " << m_modLeftRightFlag);
172 }
173
174 if (m_scp.getDebug() != m_debug4Sim) {
175 B2INFO("CDCJobCntlParModifier: debug4Sim modified: " << m_scp.getDebug() << " to " << m_debug4Sim);
177 }
178
180 B2INFO("CDCJobCntlParModifier: thresholdEnergyDeposit modified: " << m_scp.getThresholdEnergyDeposit() << " to " <<
183 }
184
186 B2INFO("CDCJobCntlParModifier: minTrackLength modified: " << m_scp.getMinTrackLength() << " to " << m_minTrackLength);
188 }
189
190 //For Geometry
192 B2INFO("CDCJobCntlParModifier: materialDefinitionMode modified: " << m_gcp.getMaterialDefinitionMode() << " to " <<
195 }
196
198 B2INFO("CDCJobCntlParModifier: senseWireZposMode modified: " << m_gcp.getSenseWireZposMode() << " " << m_senseWireZposMode);
200 }
201
203 B2INFO("CDCJobCntlParModifier: printMaterialTable modified: " << m_gcp.getPrintMaterialTable() << " to " << m_printMaterialTable);
205 }
206
207 if (m_gcp.getDebug() != m_debug4Geo) {
208 B2INFO("CDCJobCntlParModifier: debug4Geo modified: " << m_gcp.getDebug() << " to " << m_debug4Geo);
210 }
211
213 B2INFO("CDCJobCntlParModifier: displacement switch modified: " << m_gcp.getDisplacement() << " to " << m_displacement);
215 }
216
217 if (m_gcp.getAlignment() != m_alignment) {
218 B2INFO("CDCJobCntlParModifier: alignment switch modified: " << m_gcp.getAlignment() << " to " << m_alignment);
220 }
221
223 B2INFO("CDCJobCntlParModifier: misalignment switch modified: " << m_gcp.getMisalignment() << " to " << m_misalignment);
225 }
226
228 B2INFO("CDCJobCntlParModifier: displacementInputType modified: " << m_gcp.getDisplacementInputType() << " to " <<
231 }
232
234 B2INFO("CDCJobCntlParModifier: alignmentInputType modified: " << m_gcp.getAlignmentInputType() << " to " << m_alignmentInputType);
236 }
237
239 B2INFO("CDCJobCntlParModifier: misalignmentInputType modified: " << m_gcp.getMisalignmentInputType() << " to " <<
242 }
243
245 B2INFO("CDCJobCntlParModifier: xtInputType modified: " << m_gcp.getXtInputType() << " to " << m_xtInputType);
247 }
248
250 B2INFO("CDCJobCntlParModifier: sigmaInputType modified: " << m_gcp.getSigmaInputType() << " to " << m_sigmaInputType);
252 }
253
255 B2INFO("CDCJobCntlParModifier: propSpeedInputType modified: " << m_gcp.getPropSpeedInputType() << " to " << m_propSpeedInputType);
257 }
258
260 B2INFO("CDCJobCntlParModifier: t0InputType modified: " << m_gcp.getT0InputType() << " to " << m_t0InputType);
262 }
263
265 B2INFO("CDCJobCntlParModifier: twInputType modified: " << m_gcp.getTwInputType() << " to " << m_twInputType);
267 }
268
270 B2INFO("CDCJobCntlParModifier: bwInputType modified: " << m_gcp.getBwInputType() << " to " << m_bwInputType);
272 }
273
275 B2INFO("CDCJobCntlParModifier: chMapInputType modified: " << m_gcp.getChMapInputType() << " to " << m_chMapInputType);
277 }
278
280 B2INFO("CDCJobCntlParModifier: edep-to-adc modified: " << m_gcp.getEDepToADCInputType() << " to " << m_eDepToADCInputType);
282 }
283
285 B2INFO("CDCJobCntlParModifier: displacementFile modified: " << m_gcp.getDisplacementFile() << " to " << m_displacementFile);
287 }
288
290 B2INFO("CDCJobCntlParModifier: alignmentFile modified: " << m_gcp.getAlignmentFile() << " to " << m_alignmentFile);
292 }
293
295 B2INFO("CDCJobCntlParModifier: misalignmentFile modified: " << m_gcp.getMisalignmentFile() << " to " << m_misalignmentFile);
297 }
298
299 if (m_gcp.getXtFile() != m_xtFile) {
300 B2INFO("CDCJobCntlParModifier: xtFile modified: " << m_gcp.getXtFile() << " to " << m_xtFile);
302 }
303
304 if (m_gcp.getSigmaFile() != m_sigmaFile) {
305 B2INFO("CDCJobCntlParModifier: sigmaFile modified: " << m_gcp.getSigmaFile() << " to " << m_sigmaFile);
307 }
308
310 B2INFO("CDCJobCntlParModifier: propSpeedFile modified: " << m_gcp.getPropSpeedFile() << " to " << m_propSpeedFile);
312 }
313
314 if (m_gcp.getT0File() != m_t0File) {
315 B2INFO("CDCJobCntlParModifier: t0File modified: " << m_gcp.getT0File() << " to " << m_t0File);
317 }
318
319 if (m_gcp.getTwFile() != m_twFile) {
320 B2INFO("CDCJobCntlParModifier: timeWalkFile modified: " << m_gcp.getTwFile() << " to " << m_twFile);
322 }
323
324 if (m_gcp.getBwFile() != m_bwFile) {
325 B2INFO("CDCJobCntlParModifier: badWireFile modified: " << m_gcp.getBwFile() << " to " << m_bwFile);
327 }
328
329 if (m_gcp.getChMapFile() != m_chMapFile) {
330 B2INFO("CDCJobCntlParModifier: chMapFile modified: " << m_gcp.getChMapFile() << " to " << m_chMapFile);
332 }
333
335 B2INFO("CDCJobCntlParModifier: edep-to-adcFile modified: " << m_gcp.getEDepToADCFile() << " to " << m_eDepToADCFile);
337 }
338
340 B2INFO("CDCJobCntlParModifier: addFudgeFactorForSigmaForData modified: " << m_gcp.getAddFudgeFactorForSigmaForData() << " to "
343 }
344
346 B2INFO("CDCJobCntlParModifier: addFudgeFactorForSigmaForMC modified: " << m_gcp.getAddFudgeFactorForSigmaForMC() << " to " <<
349 }
350
352 B2INFO("CDCJobCntlParModifier: mapper geometry flag modified: " << m_gcp.getMapperGeometry() << " to " << m_mapperGeometry);
354 }
355
357 B2INFO("CDCJobCntlParModifier: mapper phi-angle modified: " << m_gcp.getMapperPhiAngle() << " to " << m_mapperPhiAngle);
359 }
360}
361
363{
364}
int m_materialDefinitionMode
Material definition mode.
bool m_timeWalk
Switch for time walk in translator.
std::string m_displacementFile
Displacement file.
double m_addFudgeFactorForSigmaForMC
Additional fudge factor for space resol.
bool m_wireSag
Switch for sense wire sag.
double m_minTrackLength
Minimum track length for G4 step (cm)
double m_addFudgeFactorForSigmaForData
Additional fudge factor for space resol.
void event() override
Actual digitization of all hits in the CDC.
bool m_displacementInputType
Displacement input type.
std::string m_misalignmentFile
Misalignment file.
bool m_debug4Sim
Switch for debug printing.
bool m_eDepToADCInputType
EDep-to-adc input type.
std::string m_eDepToADCFile
EDep-to-adc file.
bool m_printMaterialTable
Switch for printing the G4 material table.
bool m_misalignmentInputType
Misalignment input type.
CDC::CDCGeoControlPar & m_gcp
Reference to CDCGeo...
double m_mapperPhiAngle
Mapper phi-angle(deg).
bool m_debug4Geo
Switch for debug printing.
bool m_modLeftRightFlag
Switch for modified left/right flag.
CDC::CDCSimControlPar & m_scp
Reference to CDCSim...
The Class for CDC Geometry Control Parameters.
void setPropSpeedFile(const std::string &input)
Set input file name for prop-speed.
bool getDebug() const
Get debug flag.
bool getSigmaInputType()
Get input type for sigma.
bool getPrintMaterialTable() const
Get printMaterialTable flag.
bool getMisalignmentInputType()
Get input type for wire misalignment.
void setBwInputType(bool input)
Set input type for bad wire.
void setXtFile(const std::string &input)
Set input file name for xt-relation.
std::string getT0File() const
Get input file name for t0.
void setSenseWireZposMode(int input)
Set sense wire zpos mode.
bool getDisplacementInputType()
Get input type for wire displacement.
void setPrintMaterialTable(bool onoff)
Set printMaterialTable flag.
void setDebug(bool onoff)
Set debug flag.
void setChMapFile(const std::string &input)
Set input file name for channel map.
double getAddFudgeFactorForSigmaForMC() const
Get additional fudge factor for space resol for MC.
std::string getEDepToADCFile() const
Get input file name for edeptoadc.
void setXtInputType(bool input)
Set input type for xt.
std::string getDisplacementFile() const
Get input file name for wire displacement.
void setT0InputType(bool input)
Set input type for t0.
std::string getMisalignmentFile() const
Get input file name for wire misalignment.
void setMaterialDefinitionMode(int input)
Set material defition mode.
std::string getAlignmentFile() const
Get input file name for wire alignment.
void setMapperGeometry(bool torf)
Set mapper geometry flag.
bool getAlignmentInputType()
Get input type for wire alignment.
void setAlignmentInputType(bool input)
Set input type for wire alignment.
double getMaterialDefinitionMode() const
Get material definition mode.
std::string getPropSpeedFile() const
Get input file name for prop-speed.
void setTwFile(const std::string &input)
Set input file name for time-walk.
bool getT0InputType()
Get input type for t0.
bool getEDepToADCInputType()
Get input type for edeptoadc.
void setAddFudgeFactorForSigmaForData(double input)
Set additional fudge factor for space resol.
std::string getSigmaFile() const
Get input file name for sigma.
void setMapperPhiAngle(double phi)
Set mapper phi-angle (deg.)
bool getAlignment() const
Get alignment switch.
void setSigmaFile(const std::string &input)
Set input file name for sigma.
void setTwInputType(bool input)
Set input type for time-walk.
void setMisalignmentFile(const std::string &input)
Set input file name for wire misalignment.
bool getMisalignment() const
Get misalignment switch.
void setAlignmentFile(const std::string &input)
Set input file name for wire alignment.
void setAddFudgeFactorForSigmaForMC(double input)
Set additional fudge factor for space resol.
void setMisalignment(bool input)
Set misalignment switch.
bool getDisplacement() const
Get displacement switch.
void setDisplacement(bool input)
Set displacement switch.
void setT0File(const std::string &input)
Set input file name for t0.
void setDisplacementInputType(bool input)
Set input type for wire displacement.
void setEDepToADCFile(const std::string &input)
Set input file name for edep-to-adc.
bool getMapperGeometry()
Get mapper geometry flag.
int getSenseWireZposMode() const
Get sense wire z position mode.
double getAddFudgeFactorForSigmaForData() const
Get additional fudge factor for space resol for data.
std::string getXtFile() const
Get input file name for xt-relation.
double getMapperPhiAngle()
Get mapper phi-angle.
void setEDepToADCInputType(bool input)
Set input type for edep-to-adc.
bool getTwInputType()
Get input type for time-walk.
std::string getBwFile() const
Get input file name for badwire.
void setMisalignmentInputType(bool input)
Set input type for wire misalignment.
void setSigmaInputType(bool input)
Set input type for sigma.
bool getChMapInputType()
Get input type for channel map.
void setDisplacementFile(const std::string &input)
Set input file name for wire displacement.
std::string getTwFile() const
Get input file name for time-walk.
bool getXtInputType()
Get input type for xt.
bool getBwInputType()
Get input type for bad wire.
bool getPropSpeedInputType()
Get input type for prop.
void setAlignment(bool input)
Set alignment switch.
void setPropSpeedInputType(bool input)
Set input type for prop.
void setChMapInputType(bool input)
Set input type for channel map.
std::string getChMapFile() const
Get input file name for channel map.
void setBwFile(const std::string &input)
Set input file name for bad wire.
The Class for CDC Simulation Control Parameters.
bool getDebug() const
Get debug flag.
bool getModLeftRightFlag() const
Get modified left/right flag.
void setWireSag(bool onoff)
Set wiresag flag.
void setDebug(bool onoff)
Set debug flag.
double getMinTrackLength() const
Get minimum track length.
void setMinTrackLength(double input)
Set minimum track length.
double getThresholdEnergyDeposit() const
Get threshold for Energy Deposit;.
bool getWireSag() const
Get wiresag flag.
void setThresholdEnergyDeposit(double input)
Set threshold for Energy Deposit;.
void setTimeWalk(bool onoff)
Set time-walk flag.
void setModLeftRightFlag(bool onoff)
Set modified left/right flag.
bool getTimeWalk() const
Get time-walk flag.
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:80
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#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.
STL namespace.