Belle II Software  release-08-01-10
MCMatcherTRGECLModule Class Reference

Class to represent the hit of one cell. More...

#include <MCMatcherTRGECLModule.h>

Inheritance diagram for MCMatcherTRGECLModule:
Collaboration diagram for MCMatcherTRGECLModule:

Public Types

typedef std::map< int, int > PrimaryTrackMap
 define a map for Primary Track
 
typedef std::multimap< int, int > MultiMap
 define a multimap for hits in showers
 
enum  EModulePropFlags {
  c_Input = 1 ,
  c_Output = 2 ,
  c_ParallelProcessingCertified = 4 ,
  c_HistogramManager = 8 ,
  c_InternalSerializer = 16 ,
  c_TerminateInAllProcesses = 32 ,
  c_DontCollectStatistics = 64
}
 Each module can be tagged with property flags, which indicate certain features of the module. More...
 
typedef ModuleCondition::EAfterConditionPath EAfterConditionPath
 Forward the EAfterConditionPath definition from the ModuleCondition.
 

Public Member Functions

 MCMatcherTRGECLModule ()
 Constructor.
 
virtual ~MCMatcherTRGECLModule ()
 Destructor.
 
 MCMatcherTRGECLModule (MCMatcherTRGECLModule &)=delete
 Copy constructor, deleted.
 
MCMatcherTRGECLModuleoperator= (MCMatcherTRGECLModule &)=delete
 Assignment operator, deleted.
 
virtual void initialize () override
 Initialize variables, print info, and start CPU clock.
 
virtual void beginRun () override
 Nothing so far.
 
virtual void event () override
 Actual digitization of all hits in the ECL. More...
 
virtual void endRun () override
 Nothing so far.
 
virtual void terminate () override
 Stopping of CPU clock.
 
virtual std::vector< std::string > getFileNames (bool outputFiles)
 Return a list of output filenames for this modules. More...
 
const std::string & getName () const
 Returns the name of the module. More...
 
const std::string & getType () const
 Returns the type of the module (i.e. More...
 
const std::string & getPackage () const
 Returns the package this module is in.
 
const std::string & getDescription () const
 Returns the description of the module.
 
void setName (const std::string &name)
 Set the name of the module. More...
 
void setPropertyFlags (unsigned int propertyFlags)
 Sets the flags for the module properties. More...
 
LogConfiggetLogConfig ()
 Returns the log system configuration.
 
void setLogConfig (const LogConfig &logConfig)
 Set the log system configuration.
 
void setLogLevel (int logLevel)
 Configure the log level.
 
void setDebugLevel (int debugLevel)
 Configure the debug messaging level.
 
void setAbortLevel (int abortLevel)
 Configure the abort log level.
 
void setLogInfo (int logLevel, unsigned int logInfo)
 Configure the printed log information for the given level. More...
 
void if_value (const std::string &expression, const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 Add a condition to the module. More...
 
void if_false (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to add a condition to the module. More...
 
void if_true (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to set the condition of the module. More...
 
bool hasCondition () const
 Returns true if at least one condition was set for the module.
 
const ModuleConditiongetCondition () const
 Return a pointer to the first condition (or nullptr, if none was set)
 
const std::vector< ModuleCondition > & getAllConditions () const
 Return all set conditions for this module.
 
bool evalCondition () const
 If at least one condition was set, it is evaluated and true returned if at least one condition returns true. More...
 
std::shared_ptr< PathgetConditionPath () const
 Returns the path of the last true condition (if there is at least one, else reaturn a null pointer). More...
 
Module::EAfterConditionPath getAfterConditionPath () const
 What to do after the conditional path is finished. More...
 
std::vector< std::shared_ptr< Path > > getAllConditionPaths () const
 Return all condition paths currently set (no matter if the condition is true or not).
 
bool hasProperties (unsigned int propertyFlags) const
 Returns true if all specified property flags are available in this module. More...
 
bool hasUnsetForcedParams () const
 Returns true and prints error message if the module has unset parameters which the user has to set in the steering file.
 
const ModuleParamListgetParamList () const
 Return module param list.
 
template<typename T >
ModuleParam< T > & getParam (const std::string &name) const
 Returns a reference to a parameter. More...
 
bool hasReturnValue () const
 Return true if this module has a valid return value set.
 
int getReturnValue () const
 Return the return value set by this module. More...
 
std::shared_ptr< PathElementclone () const override
 Create an independent copy of this module. More...
 
std::shared_ptr< boost::python::list > getParamInfoListPython () const
 Returns a python list of all parameters. More...
 

Static Public Member Functions

static void exposePythonAPI ()
 Exposes methods of the Module class to Python.
 

Protected Member Functions

virtual void def_initialize ()
 Wrappers to make the methods without "def_" prefix callable from Python. More...
 
virtual void def_beginRun ()
 Wrapper method for the virtual function beginRun() that has the implementation to be used in a call from Python.
 
virtual void def_event ()
 Wrapper method for the virtual function event() that has the implementation to be used in a call from Python.
 
virtual void def_endRun ()
 This method can receive that the current run ends as a call from the Python side. More...
 
virtual void def_terminate ()
 Wrapper method for the virtual function terminate() that has the implementation to be used in a call from Python.
 
void setDescription (const std::string &description)
 Sets the description of the module. More...
 
void setType (const std::string &type)
 Set the module type. More...
 
template<typename T >
void addParam (const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
 Adds a new parameter to the module. More...
 
template<typename T >
void addParam (const std::string &name, T &paramVariable, const std::string &description)
 Adds a new enforced parameter to the module. More...
 
void setReturnValue (int value)
 Sets the return value for this module as integer. More...
 
void setReturnValue (bool value)
 Sets the return value for this module as bool. More...
 
void setParamList (const ModuleParamList &params)
 Replace existing parameter list.
 

Private Member Functions

std::list< ModulePtrgetModules () const override
 no submodules, return empty list
 
std::string getPathString () const override
 return the module name.
 
void setParamPython (const std::string &name, const boost::python::object &pyObj)
 Implements a method for setting boost::python objects. More...
 
void setParamPythonDict (const boost::python::dict &dictionary)
 Implements a method for reading the parameter values from a boost::python dictionary. More...
 

Private Attributes

StoreArray< TRGECLDigi0MCm_trgECLDigi0MC
 output for TRGECLDigi0MC
 
StoreArray< TRGECLHitMCm_trgECLHitMC
 output for TRGECLHitMC
 
double m_timeCPU = 0.
 CPU time

 
int m_nRun = 0
 Run number

 
int m_nEvent = 0
 Event number.
 
TrgEclMapping_TCMap
 object of TC Mapping
 
int TCId [100]
 TCId

 
double TCRawEnergy [100]
 TC raw energy.
 
double TCRawTiming [100]
 TC raw timing.
 
double SignalContribution [100]
 Signal Contibution in a TC.
 
double BKGContribution [100]
 Backgroun Contribution in a TC

 
double maxEnergy [100][3]
 Energy of maximum contribtion particle

 
double contribution [100][3]
 particles contribution

 
int TCPrimaryIndex [100][3]
 Primary Index in TC hit

 
int XtalId [100][3]
 XtalId in TC

 
double px [100][3]
 Momentum X of particle.
 
double py [100][3]
 Momentum Y of particle.
 
double pz [100][3]
 Momentum Z of particle.
 
int trackId [100][3]
 Track Id.
 
int background_tag [100][3]
 Beam background tag.
 
int pid [100][3]
 Particle ID.
 
int mother [100][3]
 Mother ID

 
int gmother [100][3]
 Grand mother ID

 
int ggmother [100][3]
 Grand Grand Mother ID

 
int gggmother [100][3]
 Grand Grand Grand Mother ID

 
double MCEnergy [100][3]
 Raw Energy of particle

 
int ieclhit [100][3]
 eclhit id

 
int TCIdHit [100]
 TCId

 
double TCHitEnergy [100]
 TC Hit energy

 
double TCHitTiming [100]
 TC Hit Timking

 
int TCPrimaryIndexHit [100][3]
 Primary Index in TC hit

 
int XtalIdHit [100][3]
 XtalId in TC

 
double pxHit [100][3]
 Momentum X of particle.
 
double pyHit [100][3]
 Momentum X of particle.
 
double pzHit [100][3]
 Momentum X of particle.
 
int trackIdHit [100][3]
 Track Id.
 
int background_tagHit [100][3]
 Beam background tag.
 
int pidHit [100][3]
 Particle ID.
 
int motherHit [100][3]
 Mother ID

 
int gmotherHit [100][3]
 Grand mother ID

 
int ggmotherHit [100][3]
 Grand Grand Mother ID

 
int gggmotherHit [100][3]
 Grand Grand Grand Mother ID

 
double MCEnergyHit [100][3]
 Raw Energy of particle

 
double SignalContributionHit [100]
 Signal Contibution in a TC.
 
double BKGContributionHit [100]
 Backgroun Contribution in a TC

 
double contributionHit [100][3]
 particles contribution

 
std::string m_name
 The name of the module, saved as a string (user-modifiable)
 
std::string m_type
 The type of the module, saved as a string.
 
std::string m_package
 Package this module is found in (may be empty).
 
std::string m_description
 The description of the module.
 
unsigned int m_propertyFlags
 The properties of the module as bitwise or (with |) of EModulePropFlags.
 
LogConfig m_logConfig
 The log system configuration of the module.
 
ModuleParamList m_moduleParamList
 List storing and managing all parameter of the module.
 
bool m_hasReturnValue
 True, if the return value is set.
 
int m_returnValue
 The return value.
 
std::vector< ModuleConditionm_conditions
 Module condition, only non-null if set.
 

Detailed Description

Class to represent the hit of one cell.

Definition at line 33 of file MCMatcherTRGECLModule.h.

Member Enumeration Documentation

◆ EModulePropFlags

enum EModulePropFlags
inherited

Each module can be tagged with property flags, which indicate certain features of the module.

Enumerator
c_Input 

This module is an input module (reads data).

c_Output 

This module is an output module (writes data).

c_ParallelProcessingCertified 

This module can be run in parallel processing mode safely (All I/O must be done through the data store, in particular, the module must not write any files.)

c_HistogramManager 

This module is used to manage histograms accumulated by other modules.

c_InternalSerializer 

This module is an internal serializer/deserializer for parallel processing.

c_TerminateInAllProcesses 

When using parallel processing, call this module's terminate() function in all processes().

This will also ensure that there is exactly one process (single-core if no parallel modules found) or at least one input, one main and one output process.

c_DontCollectStatistics 

No statistics is collected for this module.

Definition at line 77 of file Module.h.

Member Function Documentation

◆ clone()

std::shared_ptr< PathElement > clone ( ) const
overridevirtualinherited

Create an independent copy of this module.

Note that parameters are shared, so changing them on a cloned module will also affect the original module.

Implements PathElement.

Definition at line 179 of file Module.cc.

◆ def_endRun()

virtual void def_endRun ( )
inlineprotectedvirtualinherited

This method can receive that the current run ends as a call from the Python side.

For regular C++-Modules that forwards the call to the regular endRun() method.

Reimplemented in PyModule.

Definition at line 439 of file Module.h.

◆ def_initialize()

virtual void def_initialize ( )
inlineprotectedvirtualinherited

Wrappers to make the methods without "def_" prefix callable from Python.

Overridden in PyModule. Wrapper method for the virtual function initialize() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 420 of file Module.h.

◆ evalCondition()

bool evalCondition ( ) const
inherited

If at least one condition was set, it is evaluated and true returned if at least one condition returns true.

If no condition or result value was defined, the method returns false. Otherwise, the condition is evaluated and true returned, if at least one condition returns true. To speed up the evaluation, the condition strings were already parsed in the method if_value().

Returns
True if at least one condition and return value exists and at least one condition expression was evaluated to true.

Definition at line 96 of file Module.cc.

◆ event()

void event ( void  )
overridevirtual

Actual digitization of all hits in the ECL.

The digitized hits are written into the DataStore.

Reimplemented from Module.

Definition at line 142 of file MCMatcherTRGECLModule.cc.

143 {
144 
145 
146  StoreArray<MCParticle> mcParticles;
147  PrimaryTrackMap eclPrimaryMap;
148  eclPrimaryMap.clear();
149  int nParticles = mcParticles.getEntries();
150  // cout << nParticles << endl;
151  for (int iPart = 0; iPart < nParticles ; ++iPart) {
152  if (mcParticles[iPart]->getMother() == NULL) {
153  if (!mcParticles[iPart]->hasStatus(MCParticle::c_PrimaryParticle)) {
154  if (!mcParticles[iPart]->hasStatus(MCParticle::c_StableInGenerator)) {
155  continue;
156  }
157  }
158  }
159 
160 
161 
162  bool adhoc_StableInGeneratorFlag(mcParticles[iPart]->hasStatus(MCParticle::c_StableInGenerator));
163 
164  if (mcParticles[iPart]->hasStatus(MCParticle::c_PrimaryParticle)
165  && adhoc_StableInGeneratorFlag) {
166  if (mcParticles[iPart]->getArrayIndex() == -1) {
167  eclPrimaryMap.insert(pair<int, int>(iPart, iPart));
168  } else {
169  eclPrimaryMap.insert(pair<int, int>(mcParticles[iPart]->getArrayIndex(), mcParticles[iPart]->getArrayIndex()));
170  }
171  } else {
172  if (mcParticles[iPart]->getMother() == NULL) continue;
173  if (eclPrimaryMap.find(mcParticles[iPart]->getMother()->getArrayIndex()) != eclPrimaryMap.end()) {
174  eclPrimaryMap.insert(
175  pair<int, int>(mcParticles[iPart]->getArrayIndex(), eclPrimaryMap[mcParticles[iPart]->getMother()->getArrayIndex()]));
176 
177  }//if mother of mcParticles is stored.
178  }//if c_StableInGenerator and c_PrimaryParticle
179 
180  }//for mcParticles
181 
182  //Connect TRGECLDigi0 and MCParticle using ECLHit
183  StoreArray<ECLHit> eclHitArray("ECLHits");
184  RelationArray eclHitRel(mcParticles, eclHitArray);
185  StoreArray<TRGECLDigi0> trgeclDigi0Array;
186  RelationArray trgeclDigi0ToMCPart(trgeclDigi0Array, mcParticles);
187  int nHits_hit = eclHitArray.getEntries() - 1;
188  //
189  int ihit = 0;
190 
191  const int NofTCDigiHit = trgeclDigi0Array.getEntries();
192 
193  // cout << NofTCDigiHit << endl;
194 
195  for (int ii = 0; ii < NofTCDigiHit; ii++) {
196 
197 
198  TRGECLDigi0* aTRGECLDigi0 = trgeclDigi0Array[ii];
199  TCId[ihit] = (aTRGECLDigi0->getTCId() - 1);
200  TCRawTiming[ihit] = aTRGECLDigi0 ->getRawTiming();
201 
202  int itimeindex = (int)(TCRawTiming[ihit] / 100 + 40);
203  TCRawEnergy[ihit] = aTRGECLDigi0 ->getRawEnergy() / Unit::GeV;
204  if (TCRawEnergy[ihit] < 0.1) {continue;} //0.05 GeV cut to save time.
205  for (int hit = 0; hit < nHits_hit; hit++) {//Find relation of TRGECLDigi0 and ECLHit
206 
207  ECLHit* aECLHit = eclHitArray[hit];;
208 
209  double hitE = aECLHit->getEnergyDep() / Unit::GeV;
210  if (hitE < 0.1) {continue;} //to save time.
211  int hitCellId = aECLHit->getCellId() - 1;
212  int hitTCId = _TCMap->getTCIdFromXtalId(hitCellId + 1) - 1;
213  int timeindex = (int)((aECLHit ->getTimeAve()) / 100 + 40);
214  int backtag = aECLHit ->getBackgroundTag();
215 
216  if (hitTCId != TCId[ihit]) {continue;}
217  if (itimeindex != timeindex) {continue;}
218  if (backtag == 0) { SignalContribution[ihit] = SignalContribution[ihit] + hitE;}
219  else { BKGContribution[ihit] = BKGContribution[ihit] + hitE;}
220 
221 
222  if (TCId[ihit] == hitTCId && maxEnergy[ihit][0] < hitE) {
223 
224  ieclhit[ihit][0] = hit;
225  maxEnergy[ihit][0] = hitE;
226  contribution[ihit][0] = hitE;
227  XtalId[ihit][0] = hitCellId ;
228  background_tag[ihit][0] = backtag;
229 
230  }
231 
232 
233  if (TCId[ihit] == hitTCId && maxEnergy[ihit][1] < hitE && hitE < maxEnergy[ihit][0]) {
234  ieclhit[ihit][1] = hit;
235  maxEnergy[ihit][1] = hitE;
236  contribution[ihit][1] = hitE;
237  XtalId[ihit][1] = hitCellId ;
238  background_tag[ihit][1] = backtag;
239  }
240 
241 
242  if (TCId[ihit] == hitTCId && maxEnergy[ihit][2] < hitE && hitE < maxEnergy[ihit][1]) {
243  ieclhit[ihit][2] = hit;
244  maxEnergy[ihit][2] = hitE;
245  contribution[ihit][2] = hitE;
246  XtalId[ihit][2] = hitCellId ;
247  background_tag[ihit][2] = backtag;
248 
249  }
250  }
251  //Find the relation of TRGECLDigi0 and MCParticle using ECLHit
252  for (int index = 0; index < eclHitRel.getEntries(); index++) {
253  int PrimaryIndex = -1;
254 
255  map<int, int>::iterator iter = eclPrimaryMap.find(eclHitRel[index].getFromIndex());
256 
257  if (iter != eclPrimaryMap.end()) {
258  PrimaryIndex = iter->second;
259  }
260  int eclhitRelSize = eclHitRel[index].getToIndices().size();
261  for (int pri_hit = 0; pri_hit < eclhitRelSize ; pri_hit++) {
262  int ieclHitRel = eclHitRel[index].getToIndex(pri_hit);
263  if (ieclhit[ihit][0] == ieclHitRel) {
264  TCPrimaryIndex[ihit][0] = PrimaryIndex;
265 
266  }
267  if (ieclhit[ihit][1] == ieclHitRel) {
268  TCPrimaryIndex[ihit][1] = PrimaryIndex;
269 
270  }
271  if (ieclhit[ihit][2] == ieclHitRel) {
272  TCPrimaryIndex[ihit][2] = PrimaryIndex;
273 
274  }
275  }
276  }
277 
278 
279  trackId[ihit][0] = TCPrimaryIndex[ihit][0];
280  trackId[ihit][1] = TCPrimaryIndex[ihit][1];
281  trackId[ihit][2] = TCPrimaryIndex[ihit][2];
282 
283 
284  // cout <<ihit <<" " << trackId[ihit][0] << " " << trackId[ihit][1] << " " << trackId[ihit][2] << " " << endl;
285 
286 
287  int mclist = 0;
288 
289  if (TCPrimaryIndex[ihit][0] > 0) {
290 
291  MCEnergy[ihit][0] = mcParticles[TCPrimaryIndex[ihit][0]]->getEnergy();
292  pid[ihit][0] = mcParticles[TCPrimaryIndex[ihit][0]]->getPDG();
293  px[ihit][0] = (mcParticles[TCPrimaryIndex[ihit][0]]->getMomentum()).X();
294  py[ihit][0] = (mcParticles[TCPrimaryIndex[ihit][0]]->getMomentum()).Y();
295  pz[ihit][0] = (mcParticles[TCPrimaryIndex[ihit][0]]->getMomentum()).Z();
296  if (pid[ihit][0] != 0 && (mcParticles[TCPrimaryIndex[ihit][0]]->getMother())) {
297  mother[ihit][0] = mcParticles[TCPrimaryIndex[ihit][0]]->getMother() ->getPDG();
298  mclist = mcParticles[TCPrimaryIndex[ihit][0]]->getMother()-> getIndex();
299  }
300  if (mclist != 1 && mother[ihit][0] != 0 && (mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother())) {
301  gmother[ihit][0] = mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother() ->getPDG();
302  mclist = mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother()-> getIndex();
303 
304  }
305  if (mclist != 1 && gmother[ihit][0] != 0 && (mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother()->getMother())) {
306  ggmother[ihit][0] = mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother()->getMother() ->getPDG();
307  mclist = mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother()->getMother()-> getIndex();
308 
309 
310  }
311  if (mclist != 1 && ggmother[ihit][0] != 0) {
312  if (mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother()->getMother()->getMother()) {
313  gggmother[ihit][0] = mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother()->getMother()->getMother() ->getPDG();
314 
315  }
316  }
317 
318  }
319  mclist = 0;
320  if (TCPrimaryIndex[ihit][1] > 0) {
321 
322  MCEnergy[ihit][1] = mcParticles[TCPrimaryIndex[ihit][1]]->getEnergy();
323  pid[ihit][1] = mcParticles[TCPrimaryIndex[ihit][1]]->getPDG();
324  px[ihit][1] = (mcParticles[TCPrimaryIndex[ihit][1]]->getMomentum()).X();
325  py[ihit][1] = (mcParticles[TCPrimaryIndex[ihit][1]]->getMomentum()).Y();
326  pz[ihit][1] = (mcParticles[TCPrimaryIndex[ihit][1]]->getMomentum()).Z();
327  if (pid[ihit][1] != 0 && (mcParticles[TCPrimaryIndex[ihit][1]]->getMother())) {
328  mother[ihit][1] = mcParticles[TCPrimaryIndex[ihit][1]]->getMother() ->getPDG();
329  mclist = mcParticles[TCPrimaryIndex[ihit][1]]->getMother()-> getIndex();
330  }
331  if (mclist != 1 && mother[ihit][1] != 0 && (mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother())) {
332  gmother[ihit][1] = mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother() ->getPDG();
333  mclist = mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother()-> getIndex();
334 
335  }
336  if (mclist != 1 && gmother[ihit][1] != 0 && (mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother()->getMother())) {
337  ggmother[ihit][1] = mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother()->getMother() ->getPDG();
338  mclist = mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother()->getMother()-> getIndex();
339  }
340  if (mclist != 1 && ggmother[ihit][1] != 0) {
341  if (mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother()->getMother()->getMother()) {
342  gggmother[ihit][1] = mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother()->getMother()->getMother() ->getPDG();
343  }
344  }
345  }
346  mclist = 0;
347  if (TCPrimaryIndex[ihit][2] > 0) {
348 
349  MCEnergy[ihit][2] = mcParticles[TCPrimaryIndex[ihit][2]]->getEnergy();
350  pid[ihit][2] = mcParticles[TCPrimaryIndex[ihit][2]]->getPDG();
351  px[ihit][2] = (mcParticles[TCPrimaryIndex[ihit][2]]->getMomentum()).X();
352  py[ihit][2] = (mcParticles[TCPrimaryIndex[ihit][2]]->getMomentum()).Y();
353  pz[ihit][2] = (mcParticles[TCPrimaryIndex[ihit][2]]->getMomentum()).Z();
354  if (pid[ihit][2] != 0 && (mcParticles[TCPrimaryIndex[ihit][2]]->getMother())) {
355  mother[ihit][2] = mcParticles[TCPrimaryIndex[ihit][2]]->getMother() ->getPDG();
356  mclist = mcParticles[TCPrimaryIndex[ihit][2]]->getMother()-> getIndex();
357  }
358  if (mclist != 1 && mother[ihit][2] != 0 && (mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother())) {
359  gmother[ihit][2] = mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother() ->getPDG();
360  mclist = mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother()-> getIndex();
361 
362  }
363  if (mclist != 1 && gmother[ihit][2] != 0 && (mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother()->getMother())) {
364  ggmother[ihit][2] = mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother()->getMother() ->getPDG();
365  mclist = mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother()->getMother()-> getIndex();
366  }
367  if (mclist != 1 && ggmother[ihit][2] != 0) {
368  if (mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother()->getMother()->getMother()) {
369  gggmother[ihit][2] = mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother()->getMother()->getMother() ->getPDG();
370  }
371  }
372 
373  }
374  trgeclDigi0ToMCPart.add(ii, TCPrimaryIndex[ihit][0]);
375  ihit++;
376  }
377 
378 
379  StoreArray<TRGECLDigi0MC> TCDigiArray;
380  for (int ii = 0; ii < ihit; ++ii) {
381 
382  if (TCRawEnergy[ii] < 0.1) {continue;}
383  TCDigiArray.appendNew();
384  int m_hitNum = TCDigiArray.getEntries() - 1;
385 
386  TCDigiArray[m_hitNum]->setEventId(m_nEvent);
387  TCDigiArray[m_hitNum]->setTCId(TCId[ii]);
388 
389  TCDigiArray[m_hitNum]->setRawEnergy(TCRawEnergy[ii]);
390  TCDigiArray[m_hitNum]->setRawTiming(TCRawTiming[ii]);
391  TCDigiArray[m_hitNum]->setTrackId(trackId[ii]);
392  TCDigiArray[m_hitNum]->setCellId(XtalId[ii]);
393 
394  TCDigiArray[m_hitNum]->setPDG(pid[ii]);
395  TCDigiArray[m_hitNum]->setMother(mother[ii]);
396  TCDigiArray[m_hitNum]->setGMother(gmother[ii]);
397  TCDigiArray[m_hitNum]->setGGMother(ggmother[ii]);
398  TCDigiArray[m_hitNum]->setGGGMother(gggmother[ii]);
399 
400  TCDigiArray[m_hitNum]->setPX(px[ii]);
401  TCDigiArray[m_hitNum]->setPY(py[ii]);
402  TCDigiArray[m_hitNum]->setPZ(pz[ii]);
403  TCDigiArray[m_hitNum]->setMCEnergy(MCEnergy[ii]);
404  TCDigiArray[m_hitNum]->setContribution(contribution[ii]);
405  TCDigiArray[m_hitNum]->setBackgroundTag(background_tag[ii]);
406  TCDigiArray[m_hitNum]->setSignalContribution(SignalContribution[ii]);
407  TCDigiArray[m_hitNum]->setBKGContribution(BKGContribution[ii]);
408  }
409 
410  //Find relation of TRGECLHit and MCParticle using TRGECLDigi0
411 
412  StoreArray<TRGECLHit> trgeclHitArray;
413  RelationArray trgeclHitToMCPart(trgeclHitArray, mcParticles);
414  const int NofTCHit = trgeclHitArray.getEntries();
415 
416 
417  for (int ii = 0; ii < NofTCHit; ++ii) {
418 
419  TRGECLHit* aTRGECLHit = trgeclHitArray[ii];
420  TCIdHit[ii] = (aTRGECLHit->getTCId() - 1);
421  TCHitTiming[ii] = aTRGECLHit ->getTimeAve();
422  TCHitEnergy[ii] = aTRGECLHit -> getEnergyDep();
423  int itimeindex = (int)(TCHitTiming[ii] / 100 + 40);
424 
425  for (int index = 0; index < trgeclDigi0ToMCPart.getEntries(); ++index) {
426  int idigi = index;
427  int idigitimeindex = (int)(TCRawTiming[idigi] / 100 + 40);
428  if (TCId[idigi] != TCIdHit[ii]) {continue;}
429  if (itimeindex != idigitimeindex) {continue;}
430 
431  TCPrimaryIndexHit[ii][0] = TCPrimaryIndex[idigi][0];
432  contributionHit[ii][0] = contribution[idigi][0];
433  XtalIdHit[ii][0] = XtalId[idigi][0] ;
434 
435  TCPrimaryIndexHit[ii][1] = TCPrimaryIndex[idigi][1];
436  contributionHit[ii][1] = contribution[idigi][1];
437  XtalIdHit[ii][1] = XtalId[idigi][1] ;
438 
439  TCPrimaryIndexHit[ii][2] = TCPrimaryIndex[idigi][2];
440  contributionHit[ii][2] = contribution[idigi][2];
441  XtalIdHit[ii][2] = XtalId[idigi][2] ;
442 
443  background_tagHit[ii][0] = background_tag[idigi][0] ;
444  background_tagHit[ii][1] = background_tag[idigi][1] ;
445  background_tagHit[ii][2] = background_tag[idigi][2] ;
446 
448  ;
449  BKGContributionHit[ii] = BKGContribution[idigi];
450 
451 
452  trackIdHit[ii][0] = trackId[idigi][0];
453  trackIdHit[ii][1] = trackId[idigi][0];
454  trackIdHit[ii][2] = trackId[idigi][0];
455 
456  MCEnergyHit[ii][0] = MCEnergy[idigi][0];
457  pidHit[ii][0] = pid[idigi][0] ;
458  pxHit[ii][0] = px[idigi][0];
459  pyHit[ii][0] = py[idigi][0];
460  pzHit[ii][0] = pz[idigi][0];
461  gmotherHit[ii][0] = gmother[idigi][0];
462  ggmotherHit[ii][0] = ggmother[idigi][0];
463  gggmotherHit[ii][0] = gggmother[idigi][0];
464 
465  MCEnergyHit[ii][1] = MCEnergy[idigi][1];
466  pidHit[ii][1] = pid[idigi][1] ;
467  pxHit[ii][1] = px[idigi][1];
468  pyHit[ii][1] = py[idigi][1];
469  pzHit[ii][1] = pz[idigi][1];
470  gmotherHit[ii][1] = gmother[idigi][1];
471  ggmotherHit[ii][1] = ggmother[idigi][1];
472  gggmotherHit[ii][1] = gggmother[idigi][1];
473 
474  MCEnergyHit[ii][2] = MCEnergy[idigi][2];
475  pidHit[ii][2] = pid[idigi][2] ;
476  pxHit[ii][2] = px[idigi][2];
477  pyHit[ii][2] = py[idigi][2];
478  pzHit[ii][2] = pz[idigi][2];
479  gmotherHit[ii][2] = gmother[idigi][2];
480  ggmotherHit[ii][2] = ggmother[idigi][2];
481  gggmotherHit[ii][2] = gggmother[idigi][2];
482  }
483 
484 
485 
486  trgeclHitToMCPart.add(ii, TCPrimaryIndexHit[ii][0]);
487  }
488 
489  StoreArray<TRGECLHitMC> TCHitArray;
490  for (int ii = 0; ii < trgeclHitArray.getEntries(); ++ii) {
491  TCHitArray.appendNew();
492  int m_hitNum = TCHitArray.getEntries() - 1;
493 
494  TCHitArray[m_hitNum]->setEventId(m_nEvent);
495  TCHitArray[m_hitNum]-> setTCId(TCIdHit[ii]);
496  TCHitArray[m_hitNum]->setCellId(XtalIdHit[ii]);
497  TCHitArray[m_hitNum]->setEnergyDep(TCHitEnergy[ii]);
498  TCHitArray[m_hitNum]-> setTimeAve(TCHitTiming[ii]);
499  TCHitArray[m_hitNum]-> setTrackId(trackIdHit[ii]);
500  TCHitArray[m_hitNum]-> setPDG(pidHit[ii]);
501  TCHitArray[m_hitNum]->setMother(motherHit[ii]);
502  TCHitArray[m_hitNum]->setGMother(gmotherHit[ii]);
503  TCHitArray[m_hitNum]->setGGMother(ggmotherHit[ii]);
504  TCHitArray[m_hitNum]->setGGGMother(gggmotherHit[ii]);
505  TCHitArray[m_hitNum]->setPX(pxHit[ii]);
506  TCHitArray[m_hitNum]->setPY(pyHit[ii]);
507  TCHitArray[m_hitNum]->setPZ(pzHit[ii]);
508  TCHitArray[m_hitNum]->setMCEnergy(MCEnergyHit[ii]);
509  TCHitArray[m_hitNum]->setBackgroundTag(background_tagHit[ii]);
510  TCHitArray[m_hitNum]->setSignalContribution(SignalContributionHit[ii]);
511  TCHitArray[m_hitNum]->setBKGContribution(BKGContributionHit[ii]);
512  TCHitArray[m_hitNum]->setContribution(contributionHit[ii]);
513 
514  }
515 
516  ++m_nEvent;
517 
518 }
Class to store simulated hits which equate to average of ECLSImHit on crystals input for digitization...
Definition: ECLHit.h:25
int getCellId() const
Get Cell ID.
Definition: ECLHit.h:65
double getEnergyDep() const
Get deposit energy.
Definition: ECLHit.h:70
double pz[100][3]
Momentum Z of particle.
double BKGContribution[100]
Backgroun Contribution in a TC
int background_tag[100][3]
Beam background tag.
int gmotherHit[100][3]
Grand mother ID
double contributionHit[100][3]
particles contribution
double pxHit[100][3]
Momentum X of particle.
int ggmother[100][3]
Grand Grand Mother ID
double MCEnergy[100][3]
Raw Energy of particle
double SignalContribution[100]
Signal Contibution in a TC.
double contribution[100][3]
particles contribution
double py[100][3]
Momentum Y of particle.
double BKGContributionHit[100]
Backgroun Contribution in a TC
int gggmotherHit[100][3]
Grand Grand Grand Mother ID
int gmother[100][3]
Grand mother ID
double TCHitEnergy[100]
TC Hit energy
int TCPrimaryIndexHit[100][3]
Primary Index in TC hit
double pzHit[100][3]
Momentum X of particle.
double MCEnergyHit[100][3]
Raw Energy of particle
double SignalContributionHit[100]
Signal Contibution in a TC.
int ggmotherHit[100][3]
Grand Grand Mother ID
int TCPrimaryIndex[100][3]
Primary Index in TC hit
int gggmother[100][3]
Grand Grand Grand Mother ID
double maxEnergy[100][3]
Energy of maximum contribtion particle
double TCRawEnergy[100]
TC raw energy.
int background_tagHit[100][3]
Beam background tag.
double pyHit[100][3]
Momentum X of particle.
double TCHitTiming[100]
TC Hit Timking
std::map< int, int > PrimaryTrackMap
define a map for Primary Track
int XtalIdHit[100][3]
XtalId in TC
double TCRawTiming[100]
TC raw timing.
double px[100][3]
Momentum X of particle.
TrgEclMapping * _TCMap
object of TC Mapping
@ c_PrimaryParticle
bit 0: Particle is primary particle.
Definition: MCParticle.h:47
@ c_StableInGenerator
bit 1: Particle is stable, i.e., not decaying in the generator.
Definition: MCParticle.h:49
Low-level class to create/modify relations between StoreArrays.
Definition: RelationArray.h:62
virtual unsigned short getBackgroundTag() const
Get background tag.
Definition: SimHitBase.h:46
T * appendNew()
Construct a new T object at the end of the array.
Definition: StoreArray.h:246
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216
Raw TC result nefor digitizing.
Definition: TRGECLDigi0.h:21
double getRawTiming() const
Get raw TC timing.
Definition: TRGECLDigi0.h:64
int getTCId() const
Get TC id.
Definition: TRGECLDigi0.h:57
double getRawEnergy() const
Get Energy and Timing Get raw TC energy.
Definition: TRGECLDigi0.h:62
Example Detector.
Definition: TRGECLHit.h:22
double getTimeAve() const
The method to get hit average time.
Definition: TRGECLHit.h:64
int getTCId() const
The method to get TC id.
Definition: TRGECLHit.h:58
int getTCIdFromXtalId(int)
get [TC ID] from [Xtal ID]
static const double GeV
Standard of [energy, momentum, mass].
Definition: Unit.h:51

◆ getAfterConditionPath()

Module::EAfterConditionPath getAfterConditionPath ( ) const
inherited

What to do after the conditional path is finished.

(defaults to c_End if no condition is set)

Definition at line 133 of file Module.cc.

◆ getConditionPath()

std::shared_ptr< Path > getConditionPath ( ) const
inherited

Returns the path of the last true condition (if there is at least one, else reaturn a null pointer).


Definition at line 113 of file Module.cc.

◆ getFileNames()

virtual std::vector<std::string> getFileNames ( bool  outputFiles)
inlinevirtualinherited

Return a list of output filenames for this modules.

This will be called when basf2 is run with "--dry-run" if the module has set either the c_Input or c_Output properties.

If the parameter outputFiles is false (for modules with c_Input) the list of input filenames should be returned (if any). If outputFiles is true (for modules with c_Output) the list of output files should be returned (if any).

If a module has sat both properties this member is called twice, once for each property.

The module should return the actual list of requested input or produced output filenames (including handling of input/output overrides) so that the grid system can handle input/output files correctly.

This function should return the same value when called multiple times. This is especially important when taking the input/output overrides from Environment as they get consumed when obtained so the finalized list of output files should be stored for subsequent calls.

Reimplemented in RootOutputModule, StorageRootOutputModule, and RootInputModule.

Definition at line 134 of file Module.h.

◆ getName()

const std::string& getName ( ) const
inlineinherited

Returns the name of the module.

This can be changed via e.g. set_name() in the steering file to give more useful names if there is more than one module of the same type.

For identifying the type of a module, using getType() (or type() in Python) is recommended.

Definition at line 187 of file Module.h.

◆ getParamInfoListPython()

std::shared_ptr< boost::python::list > getParamInfoListPython ( ) const
inherited

Returns a python list of all parameters.

Each item in the list consists of the name of the parameter, a string describing its type, a python list of all default values and the description of the parameter.

Returns
A python list containing the parameters of this parameter list.

Definition at line 279 of file Module.cc.

◆ getReturnValue()

int getReturnValue ( ) const
inlineinherited

Return the return value set by this module.

This value is only meaningful if hasReturnValue() is true

Definition at line 381 of file Module.h.

◆ getType()

const std::string & getType ( ) const
inherited

Returns the type of the module (i.e.

class name minus 'Module')

Definition at line 41 of file Module.cc.

◆ hasProperties()

bool hasProperties ( unsigned int  propertyFlags) const
inherited

Returns true if all specified property flags are available in this module.

Parameters
propertyFlagsOred EModulePropFlags which should be compared with the module flags.

Definition at line 160 of file Module.cc.

◆ if_false()

void if_false ( const std::shared_ptr< Path > &  path,
EAfterConditionPath  afterConditionPath = EAfterConditionPath::c_End 
)
inherited

A simplified version to add a condition to the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

It is equivalent to the if_value() method, using the expression "<1". This method is meant to be used together with the setReturnValue(bool value) method.

Parameters
pathShared pointer to the Path which will be executed if the return value is false.
afterConditionPathWhat to do after executing 'path'.

Definition at line 85 of file Module.cc.

◆ if_true()

void if_true ( const std::shared_ptr< Path > &  path,
EAfterConditionPath  afterConditionPath = EAfterConditionPath::c_End 
)
inherited

A simplified version to set the condition of the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

It is equivalent to the if_value() method, using the expression ">=1". This method is meant to be used together with the setReturnValue(bool value) method.

Parameters
pathShared pointer to the Path which will be executed if the return value is true.
afterConditionPathWhat to do after executing 'path'.

Definition at line 90 of file Module.cc.

◆ if_value()

void if_value ( const std::string &  expression,
const std::shared_ptr< Path > &  path,
EAfterConditionPath  afterConditionPath = EAfterConditionPath::c_End 
)
inherited

Add a condition to the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

See https://confluence.desy.de/display/BI/Software+ModCondTut or ModuleCondition for a description of the syntax.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

Parameters
expressionThe expression of the condition.
pathShared pointer to the Path which will be executed if the condition is evaluated to true.
afterConditionPathWhat to do after executing 'path'.

Definition at line 79 of file Module.cc.

◆ setDescription()

void setDescription ( const std::string &  description)
protectedinherited

Sets the description of the module.

Parameters
descriptionA description of the module.

Definition at line 214 of file Module.cc.

◆ setLogInfo()

void setLogInfo ( int  logLevel,
unsigned int  logInfo 
)
inherited

Configure the printed log information for the given level.

Parameters
logLevelThe log level (one of LogConfig::ELogLevel)
logInfoWhat kind of info should be printed? ORed combination of LogConfig::ELogInfo flags.

Definition at line 73 of file Module.cc.

◆ setName()

void setName ( const std::string &  name)
inlineinherited

Set the name of the module.

Note
The module name is set when using the REG_MODULE macro, but the module can be renamed before calling process() using the set_name() function in your steering file.
Parameters
nameThe name of the module

Definition at line 214 of file Module.h.

◆ setParamPython()

void setParamPython ( const std::string &  name,
const boost::python::object &  pyObj 
)
privateinherited

Implements a method for setting boost::python objects.

The method supports the following types: list, dict, int, double, string, bool The conversion of the python object to the C++ type and the final storage of the parameter value is done in the ModuleParam class.

Parameters
nameThe unique name of the parameter.
pyObjThe object which should be converted and stored as the parameter value.

Definition at line 234 of file Module.cc.

◆ setParamPythonDict()

void setParamPythonDict ( const boost::python::dict &  dictionary)
privateinherited

Implements a method for reading the parameter values from a boost::python dictionary.

The key of the dictionary has to be the name of the parameter and the value has to be of one of the supported parameter types.

Parameters
dictionaryThe python dictionary from which the parameter values are read.

Definition at line 249 of file Module.cc.

◆ setPropertyFlags()

void setPropertyFlags ( unsigned int  propertyFlags)
inherited

Sets the flags for the module properties.

Parameters
propertyFlagsbitwise OR of EModulePropFlags

Definition at line 208 of file Module.cc.

◆ setReturnValue() [1/2]

void setReturnValue ( bool  value)
protectedinherited

Sets the return value for this module as bool.

The bool value is saved as an integer with the convention 1 meaning true and 0 meaning false. The value can be used in the steering file to divide the analysis chain into several paths.

Parameters
valueThe value of the return value.

Definition at line 227 of file Module.cc.

◆ setReturnValue() [2/2]

void setReturnValue ( int  value)
protectedinherited

Sets the return value for this module as integer.

The value can be used in the steering file to divide the analysis chain into several paths.

Parameters
valueThe value of the return value.

Definition at line 220 of file Module.cc.

◆ setType()

void setType ( const std::string &  type)
protectedinherited

Set the module type.

Only for use by internal modules (which don't use the normal REG_MODULE mechanism).

Definition at line 48 of file Module.cc.


The documentation for this class was generated from the following files: