Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:18:31

0001 
0002 //
0003 // Template for this file generated with eicmkplugin.py
0004 // Author: Nilanga Wickramaarachchi
0005 //
0006 
0007 #include <JANA/JEventProcessorSequentialRoot.h>
0008 #include <TH2D.h>
0009 #include <TFile.h>
0010 #include <TTree.h>
0011 #include <TMath.h>
0012 
0013 #define MAXHIT 50000
0014 
0015 #include <edm4eic/RawTrackerHit.h>
0016 #include <edm4eic/MCRecoTrackerHitAssociation.h>
0017 #include <edm4hep/MCParticle.h>
0018 
0019 class hpDIRCrawHitsProcessor: public JEventProcessorSequentialRoot {
0020 private:
0021   PrefetchT<edm4eic::RawTrackerHit> rawhits = {this, "DIRCRawHits"};
0022   PrefetchT<edm4eic::MCRecoTrackerHitAssociation> in_hit_assocs = {this, "DIRCRawHitsAssociations"};
0023   
0024     // Declare histogram and tree pointers here. e.g.
0025     // TH1D* hEraw  = nullptr;
0026     // TH2D* hEdigi = nullptr ;
0027   TH2D* hHitposition = nullptr;
0028   TH2D* hHitposition_after = nullptr;
0029   TH1D* hnhits = nullptr;
0030   TH1D* hnhits_qe = nullptr;
0031   TH1D* hnhits_qe_primary = nullptr;
0032   TH1I* hist_num_sim_hits = nullptr;
0033   TH1I* hist_parent_pdg = nullptr;
0034 
0035   TTree* dirctree;
0036 
0037   Int_t nhits;
0038   Int_t mcp_id[MAXHIT];
0039   Int_t pixel_id[MAXHIT];
0040   Double_t hit_pos_x[MAXHIT];
0041   Double_t hit_pos_y[MAXHIT];
0042   Double_t hit_pos_z[MAXHIT];
0043   Double_t hit_time[MAXHIT];
0044 
0045   double timeResolution = 1/16.0;
0046 
0047   double prism_width = 350.0;
0048   double lens_height = 50.0;
0049   double dirc_r_avg = 708.5; // --- r_min = 700 mm, r_max = 717 mm, r_avg = (r_min + r_max)/2
0050   double prism_x_edge = dirc_r_avg - lens_height/2;
0051   double prism_y_edge = prism_width/2;
0052   double NCol = 4, NRow = 6;
0053   double prism_x_dim = lens_height + (300 * tan(32*TMath::DegToRad()));
0054   double prism_y_dim = prism_width;
0055   double MCP_total_dim = 57.0;
0056   double MCP_active_dim = 53.0;
0057   double pixel_dim = MCP_active_dim / 16.0;
0058 
0059   double gap_x = (prism_x_dim - NCol*MCP_total_dim) / (NCol + 1);
0060   double gap_y = (prism_y_dim - NRow*MCP_total_dim) / (NRow + 1);
0061 
0062   double mcp_active_x_edge = prism_x_edge + gap_x + 2;
0063   double mcp_active_y_edge = prism_y_edge - gap_y - 2;
0064   
0065 public:
0066     hpDIRCrawHitsProcessor() { SetTypeName(NAME_OF_THIS); }
0067 
0068     void InitWithGlobalRootLock() override;
0069     void ProcessSequential(const std::shared_ptr<const JEvent>& event) override;
0070     void FinishWithGlobalRootLock() override;
0071 };