CbmRoot
Simple/Lx.h
Go to the documentation of this file.
1 #ifndef LX_INCLUDED
2 #define LX_INCLUDED
3 
4 #pragma GCC diagnostic ignored "-Weffc++"
5 
6 #include "CbmMuchPixelHit.h"
7 #include "FairTask.h"
8 #include "LxCA.h"
9 #include "LxMC.h"
10 #include "TClonesArray.h"
11 #include <unistd.h>
12 //#include "LxEff.h"
13 #include "CbmStsKFTrackFitter.h"
14 #include "CbmTrackMatch.h"
15 #include "CbmVertex.h"
16 #include "FairFileHeader.h"
17 #include "FairRunAna.h"
18 #include "TH1.h"
19 #include "TProfile.h"
20 #include "TProfile2D.h"
21 #include <fstream>
22 
23 #ifdef FAST_CODE
24 #define LX_DYNAMIC_CAST static_cast
25 #else // FAST_CODE
26 #define LX_DYNAMIC_CAST dynamic_cast
27 #endif // FAST_CODE
28 
29 class LxHitFile {
30 public:
31  LxHitFile();
32  ~LxHitFile();
33  bool Open(TString fileName, bool forWrite);
34  bool StartEvent(Int_t nEnt);
35  bool EndEvent();
36  bool WriteHit(Int_t stationNumber,
37  Int_t layerNumber,
38  Double_t x,
39  Double_t y,
40  Double_t z,
41  Double_t xErr,
42  Double_t yErr,
43  Double_t zErr);
44  bool ReadEvent(Int_t eventNumber);
45  bool ReadHit(Int_t& stationNumber,
46  Int_t& layerNumber,
47  Double_t& x,
48  Double_t& y,
49  Double_t& z,
50  Double_t& xErr,
51  Double_t& yErr,
52  Double_t& zErr);
53  bool Close();
54 
55 private:
57  int fd;
58  std::list<off_t> eventOffs;
59  char* evBuf;
60  int bufSize;
61  char* evPtr;
62  char* evEnd;
63 };
64 
65 extern TString lxFinderParticleType;
66 
67 struct LxStsMCPoint {
68  scaltype p, q, x, y, z, px, py, pz;
71 };
72 
73 class LxFinder : public FairTask {
74  //friend struct LxEff;
75  friend class LxDraw;
76  friend class LxParallFinder;
77  friend class FinderCapsule;
78 
79 public:
80  static LxFinder* Instance();
81  explicit LxFinder();
82  ~LxFinder();
83  InitStatus Init(); // Inherited virtual.
84  void Exec(Option_t* opt); // Inherited virtual.
85 
86  void SetGenInvMass(bool value) { generateInvMass = value; }
87 
88  void SetGenBackground(bool value) { generateBackground = value; }
89 
90  void SetGenChi2(bool value) { generateChi2 = value; }
91 
92  void SetLinkWithSts(bool value) { linkWithSts = value; }
93 
94  void SetUseMCPInsteadOfHits(bool value) { useMCPInsteadOfHits = value; }
95 
96  void SetCalcMiddlePoints(bool value) { calcMiddlePoints = value; }
97 
98  void SetCutCoeff(scaltype value) { cutCoeff = value; }
99 
100  void SetSaveOnlyTriggeringTracks(bool value) {
101  saveOnlyTriggeringTracks = value;
102  }
103 
104  void SetVerbosity(Int_t v) { verbosity = v; }
105 
106  void SetParallMode(bool v) { parallMode = v; }
107 
108  void SetHitFileName(TString v) { hitFileName = v; }
109 
110  void SetFileSaveSuffix(TString v) { fileSaveSuffix = v; }
111 
112  void SetParticleType(TString v) {
113  particleType = v;
115 
116  if (v == "omega") {
118 #ifdef MAKE_EFF_CALC
119  pPtCut = false;
120 #endif //MAKE_EFF_CALC
121  }
122  }
123 
124 private:
125  void SaveRecoTracks();
126  void CalcInvMass();
127  void FinishTask(); // Inherited virtual.
128  void SaveEventTracks();
129  void SaveInvMass();
130  void SaveBackground();
131  void SaveSignalChi2();
132  void SaveBackgroundChi2();
133  bool Trigger();
134  bool ReadEvent(Int_t evNum);
136  TClonesArray* muchPixelHits;
137  TClonesArray* listMCTracks;
138  TClonesArray* listMuchPts;
139  TClonesArray* listMuchClusters;
141  TClonesArray* listStsTracks;
142  TClonesArray* listStsMatches;
143  TClonesArray*
144  listStsPts; // STS MC-points array. Used for experiments with STS matching.
145  TClonesArray* listRecoTracks; // It is an output array.
146 #ifdef MAKE_EFF_CALC
147  //LxEff effCounter;
148  void MatchMCToReco();
149  void MatchRecoToMC();
150 #endif //MAKE_EFF_CALC
152 #ifdef MAKE_HISTOS
153  static TH1F* massHisto;
154  //static TH1F* backgroundMassHisto;
155  static TTree* superEventTracks;
156  static TH1F* signalChi2Histo;
157  static TH1F* backgroundChi2Histo;
158  static TProfile* effByMomentumProfile;
159  static TH1F* muPlusDtxHisto;
160  static TH1F* muMinusDtxHisto;
161  static TH1F* signalXAtZ0;
162  static TH1F* signalYAtZ0;
163  static TH1F* bgrXAtZ0;
164  static TH1F* bgrYAtZ0;
167  static TH1F* signalTanSigns;
168  static TH1F* signalCoordSigns;
169  static TH1F* bgrTanSigns;
170  static TH1F* bgrCoordSigns;
171  static TH1F* numberOfTracks;
176  static TH1F* bgrInterTracksAngle;
177  static TH2F* bgrInterTrackCorrDA;
179  static TH1F* muchMomErrSig;
180  static TH1F* muchMomErrBgr;
181 #endif // static CbmStsTrack* superEventData;
182 
185  // These two containers below accumulates respectively all positive and all negative reconstructed tracks for all events.
186  std::list<CbmStsTrack> positiveTracks;
187  std::list<CbmStsTrack> negativeTracks;
195  Int_t verbosity;
197  TString hitFileName;
198  TString fileSaveSuffix;
199  TString particleType;
200  bool pPtCut;
201  std::vector<LxMCPoint>
202  MCPoints; // Points should lay here in the same order as in listMuchPts.
203  std::vector<LxMCTrack>
204  MCTracks; // Tracks should lay here in the same order as in listMCTracks.
205  std::list<LxStsMCPoint> MCStsPoints;
206  std::list<LxStsMCPoint*> MCStsPointsByStations[8];
207 #ifdef MAKE_DISPERSE_2D_HISTOS
208  std::list<LxMCPoint*> MCPointsByStations[LXSTATIONS][LXLAYERS];
210 #endif //MAKE_DISPERSE_2D_HISTOS
212  //std::map<Int_t, std::map<Int_t, int> > particleCounts;
213 #ifdef MAKE_EFF_CALC
214  std::ofstream
215  incomplete_events; // Events where not all tracks are reconstructed.
218  bool hasSignalInEvent; //hasJPsiInEvent;
219  Int_t signalCounter; //jpsiCounter;
220 #endif //MAKE_EFF_CALC
221  Int_t eventNumber;
222 #ifdef CALC_MUCH_DETECTORS_EFF
223  Int_t mcPointsCount;
224  Int_t mcPointsTriggered;
225 #endif //CALC_MUCH_DETECTORS_EFF
227 #ifdef MAKE_TRIGGERING_HISTOS
232 #endif //MAKE_TRIGGERING_HISTOS
233  std::map<string, unsigned int> particlesCountAll;
234  std::map<string, unsigned int> particlesCountSign;
235  std::map<string, unsigned int> particlesCountDist;
236  std::map<string, unsigned int> particlesCountTrig;
238 
240 };
241 
242 #pragma GCC diagnostic warning "-Weffc++"
243 
244 #endif //LX_INCLUDED
LxFinder
Definition: Simple/Lx.h:73
LxFinder::SetGenBackground
void SetGenBackground(bool value)
Definition: Simple/Lx.h:88
LxFinder::pPtCut
bool pPtCut
Definition: Simple/Lx.h:200
LxFinder::MCStsPointsByStations
std::list< LxStsMCPoint * > MCStsPointsByStations[8]
Definition: Simple/Lx.h:206
LxFinder::fInstance
static LxFinder * fInstance
Definition: Simple/Lx.h:135
LxFinder::calcMiddlePoints
bool calcMiddlePoints
Definition: Simple/Lx.h:193
LxFinder::bgrInterTracksDistance
static TH1F * bgrInterTracksDistance
Definition: Simple/Lx.h:166
zCoordsByStations
Double_t zCoordsByStations[LXSTATIONS][LXLAYERS]
Definition: riplet/Lx.cxx:70
LxFinder::SetParticleType
void SetParticleType(TString v)
Definition: Simple/Lx.h:112
CbmVertex.h
LxFinder::FinishTask
void FinishTask()
Definition: Simple/Lx.cxx:1581
LxFinder::bgrInterTracksDistanceOn1st
static TH1F * bgrInterTracksDistanceOn1st
Definition: Simple/Lx.h:175
LxSpace::stationsInAlgo
Int_t stationsInAlgo
Definition: LxCA.h:333
LxStsMCPoint
Definition: Simple/Lx.h:67
LxFinder::muMinusDtxHisto
static TH1F * muMinusDtxHisto
Definition: Simple/Lx.h:160
LxFinder::saveOnlyTriggeringTracks
bool saveOnlyTriggeringTracks
Definition: Simple/Lx.h:226
LxHitFile
Definition: Simple/Lx.h:29
LxHitFile::evBuf
char * evBuf
Definition: Simple/Lx.h:59
LxFinder::numberOfTracks
static TH1F * numberOfTracks
Definition: Simple/Lx.h:171
LxFinder::SaveBackground
void SaveBackground()
Definition: Simple/Lx.cxx:1752
LxFinder::triggeringAllTracksVertices
static TH1F * triggeringAllTracksVertices
Definition: Simple/Lx.h:228
LxFinder::Exec
void Exec(Option_t *opt)
Definition: Simple/Lx.cxx:762
LxFinder::extFitter
CbmStsKFTrackFitter extFitter
Definition: Simple/Lx.h:183
scaltype
#define scaltype
Definition: CbmGlobalTrackingDefs.h:17
LxHitFile::~LxHitFile
~LxHitFile()
Definition: Simple/Lx.cxx:77
LxHitFile::useForWrite
bool useForWrite
Definition: Simple/Lx.h:56
LxFinder::massHisto
static TH1F * massHisto
Definition: Simple/Lx.h:153
LxFinder::SetVerbosity
void SetVerbosity(Int_t v)
Definition: Simple/Lx.h:104
LxStsMCPoint::stationNumber
Int_t stationNumber
Definition: Simple/Lx.h:69
LxFinder::triggeringTrigTracksVertices
static TH1F * triggeringTrigTracksVertices
Definition: Simple/Lx.h:231
LxFinder::particlesCountAll
std::map< string, unsigned int > particlesCountAll
Definition: Simple/Lx.h:233
LxFinder::superEventData
CbmStsTrack * superEventData
Definition: Simple/Lx.h:151
LxFinder::SetSaveOnlyTriggeringTracks
void SetSaveOnlyTriggeringTracks(bool value)
Definition: Simple/Lx.h:100
LxDraw
Definition: Simple/LxDraw.h:9
LxFinder::bgrInterTracksDistanceOn1stSigns
static TH1F * bgrInterTracksDistanceOn1stSigns
Definition: Simple/Lx.h:178
LxFinder::Trigger
bool Trigger()
Definition: LxTrigger.cxx:6
LxHitFile::eventOffs
std::list< off_t > eventOffs
Definition: Simple/Lx.h:58
LxFinder::eventNumber
Int_t eventNumber
Definition: Simple/Lx.h:221
LxFinder::signalInterTracksDistance
static TH1F * signalInterTracksDistance
Definition: Simple/Lx.h:165
LxFinder::listStsMatches
TClonesArray * listStsMatches
Definition: Simple/Lx.h:142
LxFinder::MCTracks
std::vector< LxMCTrack > MCTracks
Definition: Simple/Lx.h:204
LxFinder::particleType
TString particleType
Definition: Simple/Lx.h:199
LxFinder::MCPoints
std::vector< LxMCPoint > MCPoints
Definition: Simple/Lx.h:202
LxFinder::particlesCountDist
std::map< string, unsigned int > particlesCountDist
Definition: Simple/Lx.h:235
LxStsMCPoint::y
scaltype y
Definition: Simple/Lx.h:68
LxFinder::~LxFinder
~LxFinder()
Definition: Simple/Lx.cxx:280
LxFinder::listMuchPts
TClonesArray * listMuchPts
Definition: Simple/Lx.h:138
LxFinder::verbosity
Int_t verbosity
Definition: Simple/Lx.h:195
LxFinder::SetCutCoeff
void SetCutCoeff(scaltype value)
Definition: Simple/Lx.h:98
LXLAYERS
#define LXLAYERS
Definition: Simple/LxSettings.h:8
LxFinder::parallMode
bool parallMode
Definition: Simple/Lx.h:196
LxFinder::signalXAtZ0
static TH1F * signalXAtZ0
Definition: Simple/Lx.h:161
LxFinder::linkWithSts
bool linkWithSts
Definition: Simple/Lx.h:191
LxFinder::falseSignalTriggerings
Int_t falseSignalTriggerings
Definition: Simple/Lx.h:216
LxHitFile::Open
bool Open(TString fileName, bool forWrite)
Definition: Simple/Lx.cxx:79
LxSpace
Definition: LxCA.h:309
LxFinder::hitFileName
TString hitFileName
Definition: Simple/Lx.h:197
CbmTrackMatch.h
LxFinder::generateChi2
bool generateChi2
Definition: Simple/Lx.h:190
LxFinder::bgrTanSigns
static TH1F * bgrTanSigns
Definition: Simple/Lx.h:169
LxFinder::listMuchPixelDigiMatches
TClonesArray * listMuchPixelDigiMatches
Definition: Simple/Lx.h:140
LxFinder::generateBackground
bool generateBackground
Definition: Simple/Lx.h:189
LxFinder::SaveSignalChi2
void SaveSignalChi2()
Definition: Simple/Lx.cxx:1790
LxFinder::triggeringSignTracksVertices
static TH1F * triggeringSignTracksVertices
Definition: Simple/Lx.h:230
LxFinder::ReadEvent
bool ReadEvent(Int_t evNum)
Definition: Simple/Lx.cxx:1816
LxStsMCPoint::x
scaltype x
Definition: Simple/Lx.h:68
LxFinder::hasSignalInEvent
bool hasSignalInEvent
Definition: Simple/Lx.h:218
LxFinder::particlesCountTrig
std::map< string, unsigned int > particlesCountTrig
Definition: Simple/Lx.h:236
LxFinder::muchMomErrBgr
static TH1F * muchMomErrBgr
Definition: Simple/Lx.h:180
LxStsMCPoint::py
scaltype py
Definition: Simple/Lx.h:68
CbmStsKFTrackFitter
Definition: CbmStsKFTrackFitter.h:14
LxStsMCPoint::mcTrack
LxMCTrack * mcTrack
Definition: Simple/Lx.h:70
LxFinder::particlesCountSign
std::map< string, unsigned int > particlesCountSign
Definition: Simple/Lx.h:234
LxFinder::listStsPts
TClonesArray * listStsPts
Definition: Simple/Lx.h:144
LxFinder::ClassDef
ClassDef(LxFinder, 1)
LxFinder::SetUseMCPInsteadOfHits
void SetUseMCPInsteadOfHits(bool value)
Definition: Simple/Lx.h:94
LxFinder::useMCPInsteadOfHits
bool useMCPInsteadOfHits
Definition: Simple/Lx.h:192
LxFinder::signalInterTracksDistanceOn1st
static TH1F * signalInterTracksDistanceOn1st
Definition: Simple/Lx.h:172
LxFinder::SaveRecoTracks
void SaveRecoTracks()
Definition: Simple/Lx.cxx:1412
LxHitFile::evPtr
char * evPtr
Definition: Simple/Lx.h:61
LxFinder::listMCTracks
TClonesArray * listMCTracks
Definition: Simple/Lx.h:137
LxFinder::SaveEventTracks
void SaveEventTracks()
Definition: Simple/LxUtils.cxx:6
CbmVertex
Definition: CbmVertex.h:26
LxFinder::SetLinkWithSts
void SetLinkWithSts(bool value)
Definition: Simple/Lx.h:92
LxFinder::trueSignalTriggerings
Int_t trueSignalTriggerings
Definition: Simple/Lx.h:217
LxHitFile::LxHitFile
LxHitFile()
Definition: Simple/Lx.cxx:74
LxFinder::Instance
static LxFinder * Instance()
Definition: Simple/Lx.cxx:249
LxFinder::positiveTracks
std::list< CbmStsTrack > positiveTracks
Definition: Simple/Lx.h:186
LxFinder::Init
InitStatus Init()
Definition: Simple/Lx.cxx:346
LxFinder::SetGenChi2
void SetGenChi2(bool value)
Definition: Simple/Lx.h:90
LxFinder::MCStsPoints
std::list< LxStsMCPoint > MCStsPoints
Definition: Simple/Lx.h:205
LxStsMCPoint::q
scaltype q
Definition: Simple/Lx.h:68
LxFinder::signalInterTracksAngle
static TH1F * signalInterTracksAngle
Definition: Simple/Lx.h:173
LxFinder::bgrInterTracksAngle
static TH1F * bgrInterTracksAngle
Definition: Simple/Lx.h:176
LxFinder::SetHitFileName
void SetHitFileName(TString v)
Definition: Simple/Lx.h:108
LxStsMCPoint::px
scaltype px
Definition: Simple/Lx.h:68
LxHitFile::bufSize
int bufSize
Definition: Simple/Lx.h:60
LxStsMCPoint::p
scaltype p
Definition: Simple/Lx.h:68
LxFinder::bgrCoordSigns
static TH1F * bgrCoordSigns
Definition: Simple/Lx.h:170
LxFinder::muchMomErrSig
static TH1F * muchMomErrSig
Definition: Simple/Lx.h:179
LxFinder::caSpace
LxSpace caSpace
Definition: Simple/Lx.h:211
LxHitFile::ReadEvent
bool ReadEvent(Int_t eventNumber)
Definition: Simple/Lx.cxx:144
LxFinder::CalcInvMass
void CalcInvMass()
Definition: Simple/Lx.cxx:1453
LxFinder::MatchRecoToMC
void MatchRecoToMC()
Definition: Simple/LxEff.cxx:135
LxFinder::signalCounter
Int_t signalCounter
Definition: Simple/Lx.h:219
FinderCapsule
Definition: LxParall.cxx:23
LxFinder::SetCalcMiddlePoints
void SetCalcMiddlePoints(bool value)
Definition: Simple/Lx.h:96
LxFinder::hitFile
LxHitFile hitFile
Definition: Simple/Lx.h:237
LxFinder::SaveInvMass
void SaveInvMass()
Definition: Simple/Lx.cxx:1739
LxFinder::LxFinder
LxFinder()
Definition: Simple/Lx.cxx:251
LxFinder::SaveBackgroundChi2
void SaveBackgroundChi2()
Definition: Simple/Lx.cxx:1803
LxFinder::signalYAtZ0
static TH1F * signalYAtZ0
Definition: Simple/Lx.h:162
LxFinder::SetFileSaveSuffix
void SetFileSaveSuffix(TString v)
Definition: Simple/Lx.h:110
LxFinder::listStsTracks
TClonesArray * listStsTracks
Definition: Simple/Lx.h:141
LxFinder::signalCoordSigns
static TH1F * signalCoordSigns
Definition: Simple/Lx.h:168
LxFinder::bgrInterTrackCorrDA
static TH2F * bgrInterTrackCorrDA
Definition: Simple/Lx.h:177
LxFinder::bgrYAtZ0
static TH1F * bgrYAtZ0
Definition: Simple/Lx.h:164
v
__m128 v
Definition: L1/vectors/P4_F32vec4.h:1
LxCA.h
LxFinder::negativeTracks
std::list< CbmStsTrack > negativeTracks
Definition: Simple/Lx.h:187
LxFinder::listMuchClusters
TClonesArray * listMuchClusters
Definition: Simple/Lx.h:139
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
LxHitFile::EndEvent
bool EndEvent()
Definition: Simple/Lx.cxx:105
CbmMuchPixelHit.h
Class for pixel hits in MUCH detector.
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
LxHitFile::WriteHit
bool WriteHit(Int_t stationNumber, Int_t layerNumber, Double_t x, Double_t y, Double_t z, Double_t xErr, Double_t yErr, Double_t zErr)
Definition: Simple/Lx.cxx:115
LxHitFile::ReadHit
bool ReadHit(Int_t &stationNumber, Int_t &layerNumber, Double_t &x, Double_t &y, Double_t &z, Double_t &xErr, Double_t &yErr, Double_t &zErr)
Definition: Simple/Lx.cxx:199
LxFinder::listRecoTracks
TClonesArray * listRecoTracks
Definition: Simple/Lx.h:145
LxHitFile::fd
int fd
Definition: Simple/Lx.h:57
LxFinder::incomplete_events
std::ofstream incomplete_events
Definition: Simple/Lx.h:215
LxHitFile::Close
bool Close()
Definition: Simple/Lx.cxx:228
LxFinder::SetGenInvMass
void SetGenInvMass(bool value)
Definition: Simple/Lx.h:86
LxFinder::generateInvMass
bool generateInvMass
Definition: Simple/Lx.h:188
LxFinder::fPrimVtx
CbmVertex * fPrimVtx
Definition: Simple/Lx.h:184
LxFinder::backgroundChi2Histo
static TH1F * backgroundChi2Histo
Definition: Simple/Lx.h:157
LxFinder::superEventTracks
static TTree * superEventTracks
Definition: Simple/Lx.h:155
LxFinder::signalTanSigns
static TH1F * signalTanSigns
Definition: Simple/Lx.h:167
LxMCTrack
Definition: Simple/LxMC.h:27
LxFinder::cutCoeff
scaltype cutCoeff
Definition: Simple/Lx.h:194
LxHitFile::StartEvent
bool StartEvent(Int_t nEnt)
Definition: Simple/Lx.cxx:92
LxFinder::signalChi2Histo
static TH1F * signalChi2Histo
Definition: Simple/Lx.h:156
LxHitFile::evEnd
char * evEnd
Definition: Simple/Lx.h:62
MCPointsByStations
std::list< LxMCPoint * > MCPointsByStations[LXSTATIONS][LXLAYERS]
Definition: riplet/Lx.cxx:69
CbmStsTrack
Definition: CbmStsTrack.h:37
LxFinder::fileSaveSuffix
TString fileSaveSuffix
Definition: Simple/Lx.h:198
LxFinder::effByMomentumProfile
static TProfile * effByMomentumProfile
Definition: Simple/Lx.h:158
lxFinderParticleType
TString lxFinderParticleType
Definition: Simple/Lx.cxx:282
LxFinder::muPlusDtxHisto
static TH1F * muPlusDtxHisto
Definition: Simple/Lx.h:159
LxParallFinder
Definition: LxParall.h:7
LxFinder::MatchMCToReco
void MatchMCToReco()
Definition: Simple/LxEff.cxx:8
LXSTATIONS
#define LXSTATIONS
Definition: Simple/LxSettings.h:9
eventNumber
Int_t eventNumber
Definition: riplet/Lx.cxx:78
LxFinder::SetParallMode
void SetParallMode(bool v)
Definition: Simple/Lx.h:106
LxFinder::bgrXAtZ0
static TH1F * bgrXAtZ0
Definition: Simple/Lx.h:163
LxFinder::muchPixelHits
TClonesArray * muchPixelHits
Definition: Simple/Lx.h:136
LxFinder::signalInterTrackCorrDA
static TH2F * signalInterTrackCorrDA
Definition: Simple/Lx.h:174
CbmStsKFTrackFitter.h
LxStsMCPoint::z
scaltype z
Definition: Simple/Lx.h:68
LxMC.h
LxStsMCPoint::pz
scaltype pz
Definition: Simple/Lx.h:68
LxFinder::triggeringDistTracksVertices
static TH1F * triggeringDistTracksVertices
Definition: Simple/Lx.h:229