MarlinTPC  1.2.0
IonsInVoxelsProcessor.h
1 #ifndef IonsInVoxelsProcessor_h
2 #define IonsInVoxelsProcessor_h 1
3 
4 //MARLINTPC
5 #include "VoxelTPC.h"
6 
7 //LCIO
8 #include <lcio.h>
9 
10 //MARLIN
11 #include <marlin/Processor.h>
12 
13 //C++
14 #include <string>
15 
16 //GEAR
17 #include <gear/PadRowLayout2D.h>
18 
19 #include <TTree.h>
20 #include <TFile.h>
21 
22 
23 namespace marlintpc{
24 
25 class VoxelTPC;
26 
27 /* The following comment is tranfered to doxygen documentation
28  * which begins with a second asterix, or in case of on line comment an extra third slash
29  */
30 
67 class IonsInVoxelsProcessor : public marlin::Processor {
68 
69 
70  public:
71 
72  virtual Processor* newProcessor() { return new IonsInVoxelsProcessor ; }
73 
75  virtual ~IonsInVoxelsProcessor();
76 
80  virtual void init() ;
81 
84  virtual void processRunHeader(lcio::LCRunHeader* run ) ;
85 
88  virtual void processEvent(lcio::LCEvent * evt ) ;
89 
93  virtual void end();
94 
95 
99  int getPad(gear::PadRowLayout2D const* padLayout, SimTrackerHit* hit);
100 
101 
102 protected:
103 
104  //input and output collections
105  std::string _inputIonsColName;
106  std::string _outputVoxelColName;
107 
108  //padLayout pointer
109  gear::PadRowLayout2D const * _padLayout;
110 
111  //the pad layout type (cartesian or polar)
112  int _padLayoutType;
113 
114  //pointer to the VoxelTPC which stores the ions
115  marlintpc::VoxelTPC* _voxelTPC;
116 
117  //input parameters from steering file
120  int _nEvt;
121  double _binLength;
124  std::string _rootFileName;
125 
126  //TPC parameters
127  double _maxDriftLength;
128 
129  // Parameters for the root tree
130  std::vector <double> _leaf_chargePerVolume;
131  std::vector <int> _leaf_charge;
132  std::vector <int> _leaf_padIndex;
133  std::vector <int> _leaf_zIndex;
134  std::vector <double> _leaf_x,_leaf_y,_leaf_z;
135 
136  TTree *_chargeInVoxelsTree; // the root tree
137  TFile * _rootFile; // the root file
138 
140  void fillTree(LCCollectionVec* outputVoxelCollection);
141 
142  bool _useNegativeHalf;
143 };
144 
145 }//end of namespace marlintpc
146 
147 #endif
virtual void processEvent(lcio::LCEvent *evt)
Called for every event - the working horse.
Definition: IonsInVoxelsProcessor.cc:166
The VoxelTPC is a helper class containing a std::map of all TPCVoxels which contain charge...
Definition: VoxelTPC.h:42
int getPad(gear::PadRowLayout2D const *padLayout, SimTrackerHit *hit)
Function to get the pad corresponding to a hit for the different pad layouts.
Definition: IonsInVoxelsProcessor.cc:267
std::vector< int > _leaf_padIndex
the gear pad index
Definition: IonsInVoxelsProcessor.h:132
virtual void end()
Write the root file and close it porperly.
Definition: IonsInVoxelsProcessor.cc:390
int _writeAfterNEvents
Only write after n events (and summ up until then)
Definition: IonsInVoxelsProcessor.h:123
virtual void processRunHeader(lcio::LCRunHeader *run)
Called for every run.
Definition: IonsInVoxelsProcessor.cc:153
std::vector< int > _leaf_zIndex
the z index
Definition: IonsInVoxelsProcessor.h:133
double _ionisationEnergy
The mean ionisation energy in the gas.
Definition: IonsInVoxelsProcessor.h:122
std::string _rootFileName
Name of the file for the debug tree.
Definition: IonsInVoxelsProcessor.h:124
virtual void init()
Called at the begin of the job before anything is read.
Definition: IonsInVoxelsProcessor.cc:97
bool _outputIsPersistent
Flag whether to write the output to disk.
Definition: IonsInVoxelsProcessor.h:118
double _binLength
Length of the zBins.
Definition: IonsInVoxelsProcessor.h:121
void fillTree(LCCollectionVec *outputVoxelCollection)
a helper function to avoid code duplication.
Definition: IonsInVoxelsProcessor.cc:328
std::vector< int > _leaf_charge
charge per voxel
Definition: IonsInVoxelsProcessor.h:131
int _outputType
Output type: event based or total.
Definition: IonsInVoxelsProcessor.h:119
std::vector< double > _leaf_chargePerVolume
the charge per volume in the voxel (in C/mm^2)
Definition: IonsInVoxelsProcessor.h:130
This processor takes all ions from the primary ionisation and stores there charges in voxels...
Definition: IonsInVoxelsProcessor.h:67
std::vector< double > _leaf_z
the coordinates of the voxel centre
Definition: IonsInVoxelsProcessor.h:134