File indexing completed on 2025-08-06 08:14:17
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064 #include "UEvsEtaCentrality.h"
0065
0066 #include <fun4all/Fun4AllReturnCodes.h>
0067 #include <fun4all/PHTFileServer.h>
0068
0069 #include <phool/PHCompositeNode.h>
0070
0071 #include <phool/PHCompositeNode.h>
0072 #include <phool/getClass.h>
0073
0074 #include <g4jets/JetMap.h>
0075 #include <g4jets/Jetv1.h>
0076
0077 #include <centrality/CentralityInfo.h>
0078
0079 #include <calobase/RawTower.h>
0080 #include <calobase/RawTowerContainer.h>
0081 #include <calobase/RawTowerGeom.h>
0082 #include <calobase/RawTowerGeomContainer.h>
0083 #include <calobase/TowerInfoContainer.h>
0084 #include <calobase/TowerInfo.h>
0085
0086 #include <jetbackground/TowerBackground.h>
0087
0088 #include <TTree.h>
0089 #include <TH1F.h>
0090 #include <TH2F.h>
0091
0092 UEvsEtaCentrality::UEvsEtaCentrality(const std::string& name, const std::string& outputfilename)
0093 : SubsysReco(name)
0094 , m_outputFileName(outputfilename)
0095 {
0096 std::cout << "UEvsEtaCentrality::UEvsEtaCentrality(const std::string &name) Calling ctor" << std::endl;
0097 }
0098
0099
0100 UEvsEtaCentrality::~UEvsEtaCentrality()
0101 {
0102 std::cout << "UEvsEtaCentrality::~UEvsEtaCentrality() Calling dtor" << std::endl;
0103 }
0104
0105
0106 int UEvsEtaCentrality::Init(PHCompositeNode *topNode)
0107 {
0108 std::cout << "UEvsEtaCentrality::Init(PHCompositeNode *topNode) Initializing" << std::endl;
0109
0110 if (Verbosity() >= UEvsEtaCentrality::VERBOSITY_SOME)
0111 std::cout << "MyJetAnalysis::Init - Outoput to " << m_outputFileName << std::endl;
0112
0113 PHTFileServer::get().open(m_outputFileName, "RECREATE");
0114
0115 hv2_cent = new TH2F("hv2_cent","",10,0,100,50,0,0.5);
0116 hPsi2_cent = new TH2F("hPsi2_cent","",10,0,100,50,-1.57,1.57);
0117 hUEiHcalEta_Cent0_20 = new TH2F("hUEiHcalEta_Cent0_20", "", 24, -1.1,1.1, 48, 0, 0.25);
0118 hUEoHcalEta_Cent0_20 = new TH2F("hUEoHcalEta_Cent0_20", "", 24, -1.1,1.1, 48, 0, 0.5);
0119 hUEemcalEta_Cent0_20 = new TH2F("hUEemcalEta_Cent0_20", "", 24, -1.1,1.1, 48, 0, 1.5);
0120
0121 hUEiHcalEta_Cent20_50 = new TH2F("hUEiHcalEta_Cent20_50", "", 24, -1.1,1.1, 48, 0, 0.25);
0122 hUEoHcalEta_Cent20_50 = new TH2F("hUEoHcalEta_Cent20_50", "", 24, -1.1,1.1, 48, 0, 0.5);
0123 hUEemcalEta_Cent20_50 = new TH2F("hUEemcalEta_Cent20_50", "", 24, -1.1,1.1, 48, 0, 1.5);
0124
0125 hUEiHcalEta_Cent50_100 = new TH2F("hUEiHcalEta_Cent50_100", "", 24, -1.1,1.1, 48, 0, 0.25);
0126 hUEoHcalEta_Cent50_100 = new TH2F("hUEoHcalEta_Cent50_100", "", 24, -1.1,1.1, 48, 0, 0.5);
0127 hUEemcalEta_Cent50_100 = new TH2F("hUEemcalEta_Cent50_100", "", 24, -1.1,1.1, 48, 0, 1.5);
0128
0129 return Fun4AllReturnCodes::EVENT_OK;
0130 }
0131
0132
0133 int UEvsEtaCentrality::InitRun(PHCompositeNode *topNode)
0134 {
0135 std::cout << "UEvsEtaCentrality::InitRun(PHCompositeNode *topNode) Initializing for Run XXX" << std::endl;
0136 return Fun4AllReturnCodes::EVENT_OK;
0137 }
0138
0139
0140 int UEvsEtaCentrality::process_event(PHCompositeNode *topNode)
0141 {
0142
0143
0144 CentralityInfo* cent_node = findNode::getClass<CentralityInfo>(topNode, "CentralityInfo");
0145 if (!cent_node)
0146 {
0147 std::cout
0148 << "MyJetAnalysis::process_event - Error can not find centrality node "
0149 << std::endl;
0150 exit(-1);
0151 }
0152
0153
0154
0155
0156 TowerInfoContainer *towersEM3 = findNode::getClass<TowerInfoContainer>(topNode, "TOWERINFO_CALIB_CEMC_RETOWER");
0157 TowerInfoContainer *towersIH3 = findNode::getClass<TowerInfoContainer>(topNode, "TOWERINFO_CALIB_HCALIN");
0158 TowerInfoContainer *towersOH3 = findNode::getClass<TowerInfoContainer>(topNode, "TOWERINFO_CALIB_HCALOUT");
0159 RawTowerGeomContainer *tower_geom = findNode::getClass<RawTowerGeomContainer>(topNode, "TOWERGEOM_HCALIN");
0160 RawTowerGeomContainer *tower_geomOH = findNode::getClass<RawTowerGeomContainer>(topNode, "TOWERGEOM_HCALOUT");
0161 if(!towersEM3 || !towersIH3 || !towersOH3){
0162 std::cout
0163 <<"MyJetAnalysis::process_event - Error can not find raw tower node "
0164 << std::endl;
0165 exit(-1);
0166 }
0167
0168 if(!tower_geom || !tower_geomOH){
0169 std::cout
0170 <<"MyJetAnalysis::process_event - Error can not find raw tower geometry "
0171 << std::endl;
0172 exit(-1);
0173 }
0174
0175
0176 TowerBackground *background = findNode::getClass<TowerBackground>(topNode, "TowerInfoBackground_Sub2");
0177 if(!background){
0178 std::cout<<"Can't get background. Exiting"<<std::endl;
0179 return Fun4AllReturnCodes::EVENT_OK;
0180 }
0181
0182 float background_v2 = 0;
0183 float background_Psi2 = 0;
0184 float m_centrality = 0;
0185
0186 m_centrality = cent_node->get_centile(CentralityInfo::PROP::epd_NS);
0187 background_v2 = background->get_v2();
0188 background_Psi2 = background->get_Psi2();
0189
0190 hv2_cent->Fill(m_centrality, background_v2);
0191 hPsi2_cent->Fill(m_centrality, background_Psi2);
0192
0193 int i=0;
0194 for (i=0;i<=23;i++){
0195
0196
0197
0198 float UEi = background->get_UE(1).at(i);
0199 float UEo = background->get_UE(2).at(i);
0200 float UEe = background->get_UE(0).at(i);
0201
0202 double eta = tower_geom->get_etacenter(i);
0203
0204 if (m_centrality > 0 && m_centrality <= 20){
0205 hUEiHcalEta_Cent0_20->Fill(eta, UEi);
0206 hUEoHcalEta_Cent0_20->Fill(eta, UEo);
0207 hUEemcalEta_Cent0_20->Fill(eta, UEe);
0208 }
0209 if (m_centrality > 20 && m_centrality <= 50){
0210 hUEiHcalEta_Cent20_50->Fill(eta, UEi);
0211 hUEoHcalEta_Cent20_50->Fill(eta, UEo);
0212 hUEemcalEta_Cent20_50->Fill(eta, UEe);
0213 }
0214
0215 if (m_centrality > 50 && m_centrality <= 100){
0216 hUEiHcalEta_Cent50_100->Fill(eta, UEi);
0217 hUEoHcalEta_Cent50_100->Fill(eta, UEo);
0218 hUEemcalEta_Cent50_100->Fill(eta, UEe);
0219 }
0220
0221
0222 }
0223
0224
0225
0226
0227 return Fun4AllReturnCodes::EVENT_OK;
0228 }
0229
0230
0231 int UEvsEtaCentrality::ResetEvent(PHCompositeNode *topNode)
0232 {
0233
0234
0235
0236
0237 return Fun4AllReturnCodes::EVENT_OK;
0238 }
0239
0240
0241 int UEvsEtaCentrality::EndRun(const int runnumber)
0242 {
0243 std::cout << "UEvsEtaCentrality::EndRun(const int runnumber) Ending Run for Run " << runnumber << std::endl;
0244 return Fun4AllReturnCodes::EVENT_OK;
0245 }
0246
0247
0248 int UEvsEtaCentrality::End(PHCompositeNode *topNode)
0249 {
0250 std::cout << "MyJetAnalysis::End - Output to " << m_outputFileName << std::endl;
0251 PHTFileServer::get().cd(m_outputFileName);
0252
0253 hv2_cent->Write();
0254 hPsi2_cent->Write();
0255 hUEiHcalEta_Cent0_20->Write();
0256 hUEoHcalEta_Cent0_20->Write();
0257 hUEemcalEta_Cent0_20->Write();
0258 hUEiHcalEta_Cent20_50->Write();
0259 hUEoHcalEta_Cent20_50->Write();
0260 hUEemcalEta_Cent20_50->Write();
0261 hUEiHcalEta_Cent50_100->Write();
0262 hUEoHcalEta_Cent50_100->Write();
0263 hUEemcalEta_Cent50_100->Write();
0264 std::cout << "UEvsEtaCentrality::End(PHCompositeNode *topNode) This is the End..." << std::endl;
0265 return Fun4AllReturnCodes::EVENT_OK;
0266 }
0267
0268
0269 int UEvsEtaCentrality::Reset(PHCompositeNode *topNode)
0270 {
0271 std::cout << "UEvsEtaCentrality::Reset(PHCompositeNode *topNode) being Reset" << std::endl;
0272 return Fun4AllReturnCodes::EVENT_OK;
0273 }
0274
0275
0276 void UEvsEtaCentrality::Print(const std::string &what) const
0277 {
0278 std::cout << "UEvsEtaCentrality::Print(const std::string &what) const Printing info for " << what << std::endl;
0279 }