File indexing completed on 2025-08-05 08:11:58
0001
0002
0003 #ifndef DNDETAINTT_H
0004 #define DNDETAINTT_H
0005
0006 #include <fun4all/SubsysReco.h>
0007
0008 #include <ffarawobjects/InttRawHit.h>
0009 #include <ffarawobjects/InttRawHitContainer.h>
0010
0011 #include <ffaobjects/EventHeader.h>
0012
0013 #include <phhepmc/PHHepMCGenEvent.h>
0014 #include <phhepmc/PHHepMCGenEventMap.h>
0015 #include <phhepmc/PHHepMCGenHelper.h>
0016
0017 #pragma GCC diagnostic push
0018 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
0019 #include <HepMC/GenEvent.h>
0020 #include <HepMC/GenVertex.h>
0021 #pragma GCC diagnostic pop
0022 #include <HepMC/GenParticle.h>
0023 #include <HepMC/HeavyIon.h> // for HeavyIon
0024 #include <HepMC/IteratorRange.h>
0025 #include <HepMC/SimpleVector.h>
0026
0027 #include <g4eval/SvtxClusterEval.h>
0028 #include <g4eval/SvtxEvalStack.h>
0029 #include <g4eval/SvtxHitEval.h>
0030 #include <g4eval/SvtxTruthEval.h>
0031 #include <g4main/PHG4Hit.h>
0032 #include <g4main/PHG4HitContainer.h>
0033 #include <g4main/PHG4Particle.h>
0034 #include <g4main/PHG4TruthInfoContainer.h>
0035 #include <g4main/PHG4VtxPoint.h>
0036 #include <phool/getClass.h>
0037
0038 #include <g4detectors/PHG4CylinderGeomContainer.h>
0039 #include <intt/CylinderGeomIntt.h>
0040 #include <intt/CylinderGeomInttHelper.h>
0041
0042 #include "calotrigger/MinimumBiasInfo.h"
0043 #include <centrality/CentralityInfo.h>
0044 #include <phool/getClass.h>
0045 #include <trackbase/ActsGeometry.h>
0046 #include <trackbase/InttDefs.h>
0047 #include <trackbase/InttEventInfo.h>
0048 #include <trackbase/MvtxDefs.h>
0049 #include <trackbase/TrkrCluster.h>
0050 #include <trackbase/TrkrClusterContainerv4.h>
0051 #include <trackbase/TrkrClusterHitAssoc.h>
0052 #include <trackbase/TrkrClusterv4.h>
0053 #include <trackbase/TrkrDefs.h>
0054 #include <trackbase/TrkrHitSet.h>
0055 #include <trackbase/TrkrHitSetContainer.h>
0056 #include <trackbase/TrkrHitTruthAssoc.h>
0057 #include <trackbase_historic/ActsTransformations.h>
0058 #include <trackbase_historic/SvtxTrack.h>
0059 #include <trackbase_historic/SvtxTrackMap.h>
0060
0061 #include <calotrigger/MinimumBiasInfo.h>
0062 #include <calotrigger/TriggerAnalyzer.h>
0063 #include <calotrigger/TriggerRunInfoReco.h>
0064 #include <centrality/CentralityInfo.h>
0065 #include <globalvertex/GlobalVertex.h>
0066 #include <globalvertex/GlobalVertexMap.h>
0067 #include <globalvertex/MbdVertex.h>
0068 #include <globalvertex/MbdVertexMapv1.h>
0069 #include <mbd/MbdOut.h>
0070 #include <mbd/MbdPmtContainer.h>
0071 #include <mbd/MbdPmtHit.h>
0072
0073 #include <ffarawobjects/Gl1Packet.h>
0074
0075 #include <fstream>
0076 #include <iomanip>
0077 #include <iostream>
0078 #include <math.h>
0079 #include <string>
0080
0081 #include <TDatabasePDG.h>
0082 #include <TFile.h>
0083 #include <TLorentzVector.h>
0084 #include <TParticle.h>
0085 #include <TParticlePDG.h>
0086 #include <TTree.h>
0087 #include <TVector3.h>
0088
0089 class PHCompositeNode;
0090 class SvtxTrack;
0091 class SvtxTrackMap;
0092 class TrkrHitSetContainer;
0093 class InttEventInfo;
0094 class MinimumBiasInfo;
0095 class PHHepMCGenEvent;
0096 class PHHepMCGenEventMap;
0097 class PHHepMCGenHelper;
0098 class TrkrClusterContainer;
0099 class CentralityInfo;
0100 class MbdPmtHit;
0101 class MbdOut;
0102 class MbdPmtContainer;
0103 class MbdVertex;
0104 class MbdVertexMap;
0105
0106 class dNdEtaINTT : public SubsysReco
0107 {
0108 public:
0109 dNdEtaINTT(const std::string &name = "dNdEtaINTTAnalyzer",
0110 const std::string &outputfile = "INTTdNdEta.root",
0111 const bool &isData = false);
0112
0113 ~dNdEtaINTT() override;
0114
0115
0116
0117
0118
0119
0120 int Init(PHCompositeNode *topNode) override;
0121
0122
0123
0124
0125
0126
0127 int InitRun(PHCompositeNode *topNode) override;
0128
0129
0130
0131
0132 int process_event(PHCompositeNode *topNode) override;
0133
0134
0135 int ResetEvent(PHCompositeNode *topNode) override;
0136
0137
0138 int EndRun(const int runnumber) override;
0139
0140
0141 int End(PHCompositeNode *topNode) override;
0142
0143
0144 int Reset(PHCompositeNode * ) override;
0145
0146 void Print(const std::string &what = "ALL") const override;
0147
0148 void GetHEPMC(bool b) { _get_hepmc_info = b; }
0149
0150 void GetRecoCluster(bool b) { _get_reco_cluster = b; }
0151
0152 void GetTruthCluster(bool b) { _get_truth_cluster = b; }
0153
0154 void GetINTTdata(bool b) { _get_intt_data = b; }
0155
0156 void GetCentrality(bool b) { _get_centrality = b; }
0157
0158 void GetPMTInfo(bool b) { _get_pmt_info = b; }
0159
0160 void GetInttRawHit(bool b) { _get_inttrawhit = b; }
0161
0162 void GetTrkrHit(bool b) { _get_trkr_hit = b; }
0163
0164 void GetPHG4(bool b) { _get_phg4_info = b; }
0165
0166 void GetAllPHG4(bool b) { _get_allphg4_info = b; }
0167
0168 void GetTrigger(bool b) { _get_trigger_info = b; }
0169
0170 private:
0171 void ResetVectors();
0172 void GetHEPMCInfo(PHCompositeNode *topNode);
0173 void GetRecoClusterInfo(PHCompositeNode *topNode);
0174 void GetTruthClusterInfo(PHCompositeNode *topNode);
0175 void GetCentralityInfo(PHCompositeNode *topNode);
0176 void GetInttRawHitInfo(PHCompositeNode *topNode);
0177 void GetTrkrHitInfo(PHCompositeNode *topNode);
0178 void GetPHG4Info(PHCompositeNode *topNode);
0179 void GetAllPHG4Info(PHCompositeNode *topNode);
0180 void GetTriggerInfo(PHCompositeNode *topNode);
0181 std::vector<int> GetAncestors(PHG4Particle *p);
0182
0183 bool _get_hepmc_info;
0184 bool _get_truth_cluster;
0185 bool _get_reco_cluster;
0186 bool _get_centrality;
0187 bool _get_intt_data;
0188 bool _get_inttrawhit;
0189 bool _get_trkr_hit;
0190 bool _get_phg4_info;
0191 bool _get_allphg4_info;
0192 bool _get_pmt_info;
0193 bool _get_trigger_info;
0194
0195 unsigned int eventNum = 0;
0196 std::string _outputFile;
0197 bool IsData;
0198
0199
0200
0201 TTree *outtree;
0202 int event_, evt_sequence_;
0203 uint64_t intt_bco;
0204
0205 double cthresh = 0.25;
0206 float centrality_bimp_;
0207 float centrality_impactparam_;
0208 float centrality_mbd_;
0209 float centrality_mbdquantity_;
0210 int ncoll_;
0211 int npart_;
0212 UShort_t clk;
0213 UShort_t femclk;
0214 Short_t mbd_north_npmt;
0215 Short_t mbd_south_npmt;
0216 float mbd_south_charge_sum;
0217 float mbd_north_charge_sum;
0218 float mbd_charge_sum;
0219 float mbd_charge_asymm;
0220 float mbd_z_vtx;
0221 float m_pmt_q[128];
0222 int mbd_nhitsoverths_south;
0223 int mbd_nhitsoverths_north;
0224 bool is_min_bias;
0225 bool is_min_bias_wozdc;
0226
0227
0228 float TruthPV_trig_x_;
0229 float TruthPV_trig_y_;
0230 float TruthPV_trig_z_;
0231 int NTruthVtx_;
0232
0233
0234 int NHepMCFSPart_;
0235 int signal_process_id_;
0236 std::vector<float> HepMCFSPrtl_Pt_;
0237 std::vector<float> HepMCFSPrtl_Eta_;
0238 std::vector<float> HepMCFSPrtl_Phi_;
0239 std::vector<float> HepMCFSPrtl_E_;
0240 std::vector<float> HepMCFSPrtl_prodx_;
0241 std::vector<float> HepMCFSPrtl_prody_;
0242 std::vector<float> HepMCFSPrtl_prodz_;
0243 std::vector<int> HepMCFSPrtl_PID_;
0244
0245
0246 int NClus_;
0247 int NClus_Layer1_;
0248 std::vector<int> ClusLayer_;
0249 std::vector<int> ClusHitcount_;
0250 std::vector<int> ClusTimeBucketId_;
0251 std::vector<float> ClusX_;
0252 std::vector<float> ClusY_;
0253 std::vector<float> ClusZ_;
0254 std::vector<float> ClusR_;
0255 std::vector<float> ClusPhi_;
0256 std::vector<float> ClusEta_;
0257 std::vector<unsigned int> ClusAdc_;
0258 std::vector<float> ClusPhiSize_;
0259 std::vector<float> ClusZSize_;
0260 std::vector<uint8_t> ClusLadderZId_;
0261 std::vector<uint8_t> ClusLadderPhiId_;
0262 std::vector<uint32_t> ClusTrkrHitSetKey_;
0263
0264 std::vector<int> ClusMatchedG4P_MaxE_trackID_;
0265 std::vector<float> ClusMatchedG4P_MaxE_Pt_;
0266 std::vector<float> ClusMatchedG4P_MaxE_Eta_;
0267 std::vector<float> ClusMatchedG4P_MaxE_Phi_;
0268 std::vector<int> ClusMatchedG4P_MaxClusE_trackID_;
0269 std::vector<int> ClusMatchedG4P_MaxClusE_ancestorTrackID_;
0270 std::vector<float> ClusMatchedG4P_MaxClusE_Pt_;
0271 std::vector<float> ClusMatchedG4P_MaxClusE_Eta_;
0272 std::vector<float> ClusMatchedG4P_MaxClusE_Phi_;
0273
0274
0275 int NTruthLayers_;
0276 std::vector<int> ClusTruthCKeys_;
0277 std::vector<int> TruthClusPhiSize_;
0278 std::vector<int> TruthClusZSize_;
0279 std::vector<int> PrimaryTruthClusPhiSize_;
0280 std::vector<int> PrimaryTruthClusZSize_;
0281 std::vector<int> ClusNG4Particles_;
0282 std::vector<int> ClusNPrimaryG4Particles_;
0283 std::vector<int> TruthClusNRecoClus_;
0284 std::vector<int> PrimaryTruthClusNRecoClus_;
0285
0286
0287 int NInttRawHits_;
0288 std::vector<uint64_t> InttRawHit_bco_;
0289 std::vector<uint32_t> InttRawHit_packetid_;
0290 std::vector<uint32_t> InttRawHit_word_;
0291 std::vector<uint16_t> InttRawHit_fee_;
0292 std::vector<uint16_t> InttRawHit_channel_id_;
0293 std::vector<uint16_t> InttRawHit_chip_id_;
0294 std::vector<uint16_t> InttRawHit_adc_;
0295 std::vector<uint16_t> InttRawHit_FPHX_BCO_;
0296 std::vector<uint16_t> InttRawHit_full_FPHX_;
0297 std::vector<uint16_t> InttRawHit_full_ROC_;
0298 std::vector<uint16_t> InttRawHit_amplitude_;
0299
0300
0301 int NTrkrhits_, NTrkrhits_Layer1_;
0302 std::vector<uint16_t> TrkrHitRow_;
0303 std::vector<uint16_t> TrkrHitColumn_;
0304 std::vector<uint16_t> TrkrHitADC_;
0305 std::vector<uint8_t> TrkrHitLadderZId_;
0306 std::vector<uint8_t> TrkrHitLadderPhiId_;
0307 std::vector<int> TrkrHitTimeBucketId_;
0308 std::vector<uint8_t> TrkrHitLayer_;
0309 std::vector<float> TrkrHitX_;
0310 std::vector<float> TrkrHitY_;
0311 std::vector<float> TrkrHitZ_;
0312 std::vector<float> TrkrHit_truthHit_x0_;
0313 std::vector<float> TrkrHit_truthHit_y0_;
0314 std::vector<float> TrkrHit_truthHit_z0_;
0315 std::vector<float> TrkrHit_truthHit_x1_;
0316 std::vector<float> TrkrHit_truthHit_y1_;
0317 std::vector<float> TrkrHit_truthHit_z1_;
0318
0319
0320 int NPrimaryG4P_;
0321 int NPrimaryG4P_promptChargeHadron_;
0322 std::vector<float> PrimaryG4P_Pt_;
0323 std::vector<float> PrimaryG4P_Eta_;
0324 std::vector<float> PrimaryG4P_Phi_;
0325 std::vector<float> PrimaryG4P_E_;
0326 std::vector<int> PrimaryG4P_PID_;
0327 std::vector<int> PrimaryG4P_trackID_;
0328 std::vector<TString> PrimaryG4P_ParticleClass_;
0329 std::vector<bool> PrimaryG4P_isStable_;
0330 std::vector<double> PrimaryG4P_Charge_;
0331 std::vector<bool> PrimaryG4P_isChargeHadron_;
0332 std::vector<float> PHG4Hit_x0_;
0333 std::vector<float> PHG4Hit_y0_;
0334 std::vector<float> PHG4Hit_z0_;
0335 std::vector<float> PHG4Hit_x1_;
0336 std::vector<float> PHG4Hit_y1_;
0337 std::vector<float> PHG4Hit_z1_;
0338 std::vector<float> PHG4Hit_edep_;
0339
0340
0341 int NAllG4P_;
0342 std::vector<float> G4P_Pt_;
0343 std::vector<float> G4P_Eta_;
0344 std::vector<float> G4P_Phi_;
0345 std::vector<float> G4P_E_;
0346 std::vector<int> G4P_PID_;
0347 std::vector<int> G4P_trackID_;
0348
0349
0350 uint64_t GL1Packet_BCO_ = 0;
0351 uint64_t triggervec_ = 0;
0352 std::vector<int> firedTriggers_;
0353 std::vector<std::string> firedTriggers_name_;
0354 std::vector<bool> firedTriggers_checkraw_;
0355 std::vector<int> firedTriggers_prescale_;
0356 std::vector<uint64_t> firedTriggers_scalers_;
0357 std::vector<uint64_t> firedTriggers_livescalers_;
0358 std::vector<uint64_t> firedTriggers_rawscalers_;
0359
0360 EventHeader *eventheader = nullptr;
0361 InttEventInfo *intteventinfo = nullptr;
0362
0363 PHHepMCGenEventMap *m_geneventmap = nullptr;
0364 PHHepMCGenEvent *m_genevt = nullptr;
0365
0366 SvtxEvalStack *svtx_evalstack = nullptr;
0367 SvtxTruthEval *truth_eval = nullptr;
0368 SvtxClusterEval *clustereval = nullptr;
0369 SvtxHitEval *hiteval = nullptr;
0370
0371 TrkrClusterContainerv4 *dst_clustermap = nullptr;
0372 TrkrClusterHitAssoc *clusterhitmap = nullptr;
0373 InttRawHitContainer *inttrawhitcontainer = nullptr;
0374 TrkrHitSetContainer *hitsets = nullptr;
0375 ActsGeometry *_tgeometry = nullptr;
0376 PHG4CylinderGeomContainer *_intt_geom_container = nullptr;
0377 PHG4TruthInfoContainer *m_truth_info = nullptr;
0378 PHG4HitContainer *g4hit = nullptr;
0379 TrkrHitTruthAssoc *_hit_truth_map = nullptr;
0380 CentralityInfo *m_CentInfo = nullptr;
0381 MinimumBiasInfo *_minimumbiasinfo = nullptr;
0382 MbdOut *m_mbdout = nullptr;
0383 MbdPmtContainer *m_mbdpmtcontainer = nullptr;
0384 GlobalVertexMap *m_glbvtxmap = nullptr;
0385 GlobalVertex *m_glbvtx = nullptr;
0386 MbdVertexMapv1 *m_mbdvtxmap = nullptr;
0387 MbdVertex *m_mbdvtx = nullptr;
0388
0389 Gl1Packet *gl1packet = nullptr;
0390 TriggerAnalyzer *triggeranalyzer = nullptr;
0391 };
0392
0393 #endif