16 #include <calobase/RawTower.h>
17 #include <calobase/RawTowerContainer.h>
18 #include <calobase/RawTowerGeom.h>
19 #include <calobase/RawTowerGeomContainer.h>
20 #include <calobase/TowerInfoContainer.h>
21 #include <calobase/TowerInfo.h>
23 #include <Pythia8/Pythia.h>
28 #include <fastjet/PseudoJet.hh>
33 #include "fastjet/ClusterSequence.hh"
34 #include "fastjet/contrib/SoftDrop.hh"
36 using namespace fastjet;
43 #include "TVirtualPad.h"
44 #include "TApplication.h"
52 SubsysReco(
"JetValidation_" + recojetname +
"_" + truthjetname)
53 , m_recoJetName(recojetname)
55 , m_outputFileName(outputfilename)
89 std::cout <<
"JetValidation::JetValidation(const std::string &name) Calling ctor" << std::endl;
95 std::cout <<
"JetValidation::~JetValidation() Calling dtor" << std::endl;
101 std::cout <<
"JetValidation::Init(PHCompositeNode *topNode) Initializing" << std::endl;
103 std::cout <<
"JetValidation::Init - Output to " <<
m_outputFileName << std::endl;
106 m_T =
new TTree(
"T",
"MyJetAnalysis Tree");
153 std::cout <<
"JetValidation::InitRun(PHCompositeNode *topNode) Initializing for Run XXX" << std::endl;
160 std::cout <<
"JetValidation::process_event(PHCompositeNode *topNode) Processing Event" << std::endl;
168 <<
"MyJetAnalysis::process_event - Error can not find DST Reco JetContainer node "
178 <<
"MyJetAnalysis::process_event - Error can not find DST Truth JetMap node "
184 JetContainer* seedjetsraw = findNode::getClass<JetContainer>(topNode,
"AntiKt_TowerInfo_HIRecoSeedsRaw_r02");
188 <<
"MyJetAnalysis::process_event - Error can not find DST raw seed jets "
193 JetContainer* seedjetssub = findNode::getClass<JetContainer>(topNode,
"AntiKt_TowerInfo_HIRecoSeedsSub_r02");
197 <<
"MyJetAnalysis::process_event - Error can not find DST subtracted seed jets "
203 CentralityInfo* cent_node = findNode::getClass<CentralityInfo>(topNode,
"CentralityInfo");
207 <<
"MyJetAnalysis::process_event - Error can not find centrality node "
213 GlobalVertexMap *vertexmap = findNode::getClass<GlobalVertexMap>(topNode,
"GlobalVertexMap");
219 TowerInfoContainer *towersEM3 = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_CEMC_RETOWER_SUB1");
220 TowerInfoContainer *towersIH3 = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_HCALIN_SUB1");
221 TowerInfoContainer *towersOH3 = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_HCALOUT_SUB1");
222 RawTowerGeomContainer *tower_geom = findNode::getClass<RawTowerGeomContainer>(topNode,
"TOWERGEOM_HCALIN");
223 RawTowerGeomContainer *tower_geomOH = findNode::getClass<RawTowerGeomContainer>(topNode,
"TOWERGEOM_HCALOUT");
224 if(!towersEM3 || !towersIH3 || !towersOH3){
226 <<
"MyJetAnalysis::process_event - Error can not find raw tower node "
231 if(!tower_geom || !tower_geomOH){
233 <<
"MyJetAnalysis::process_event - Error can not find raw tower geometry "
239 TowerBackground *background = findNode::getClass<TowerBackground>(topNode,
"TowerInfoBackground_Sub2");
241 std::cout<<
"Can't get background. Exiting"<<std::endl;
251 float background_v2 = 0;
252 float background_Psi2 = 0;
255 background_v2 = background->
get_v2();
256 background_Psi2 = background->
get_Psi2();
259 for (
auto jet : *jets)
262 if(jet->get_pt() < 1)
continue;
264 m_id.push_back(jet->get_id());
266 m_eta.push_back(jet->get_eta());
267 m_phi.push_back(jet->get_phi());
268 m_e.push_back(jet->get_e());
269 m_pt.push_back(jet->get_pt());
282 for (
auto comp: jet->get_comp_vec())
288 if (
comp.first == 15 ||
comp.first == 30)
290 tower = towersIH3->get_tower_at_channel(channel);
291 if(!tower || !tower_geom){
294 unsigned int calokey = towersIH3->encode_key(channel);
295 int ieta = towersIH3->getTowerEtaBin(calokey);
296 int iphi = towersIH3->getTowerPhiBin(calokey);
298 float UE = background->
get_UE(1).at(ieta);
299 float tower_phi = tower_geom->get_tower_geometry(key)->get_phi();
300 float tower_eta = tower_geom->get_tower_geometry(key)->get_eta();
302 UE = UE * (1 + 2 * background_v2 * cos(2 * (tower_phi - background_Psi2)));
304 double pt = (tower->
get_energy() + UE) / cosh(tower_eta);
305 totalPx += pt * cos(tower_phi);
306 totalPy += pt * sin(tower_phi);
307 totalPz += pt * sinh(tower_eta);
309 else if (
comp.first == 16 ||
comp.first == 31)
311 tower = towersOH3->get_tower_at_channel(channel);
312 if(!tower || !tower_geomOH)
317 unsigned int calokey = towersOH3->encode_key(channel);
318 int ieta = towersOH3->getTowerEtaBin(calokey);
319 int iphi = towersOH3->getTowerPhiBin(calokey);
321 float UE = background->
get_UE(2).at(ieta);
322 float tower_phi = tower_geomOH->get_tower_geometry(key)->get_phi();
323 float tower_eta = tower_geomOH->get_tower_geometry(key)->get_eta();
325 UE = UE * (1 + 2 * background_v2 * cos(2 * (tower_phi - background_Psi2)));
327 double pt = (tower->
get_energy() + UE) / cosh(tower_eta);
328 totalPx += pt * cos(tower_phi);
329 totalPy += pt * sin(tower_phi);
330 totalPz += pt * sinh(tower_eta);
332 else if (
comp.first == 14 ||
comp.first == 29)
335 if(!tower || !tower_geom)
340 unsigned int calokey = towersEM3->
encode_key(channel);
344 float UE = background->
get_UE(0).at(ieta);
345 float tower_phi = tower_geom->get_tower_geometry(key)->get_phi();
346 float tower_eta = tower_geom->get_tower_geometry(key)->get_eta();
348 UE = UE * (1 + 2 * background_v2 * cos(2 * (tower_phi - background_Psi2)));
350 double pt = (tower->
get_energy() + UE) / cosh(tower_eta);
351 totalPx += pt * cos(tower_phi);
352 totalPy += pt * sin(tower_phi);
353 totalPz += pt * sinh(tower_eta);
376 Jet* truthjet = iter->second;
380 if ((not eta_cut) or (not pt_cut))
continue;
394 for (
auto jet : *seedjetsraw)
396 int passesCut = jet->get_property(Jet::PROPERTY::prop_SeedItr);
404 for (
auto jet : *seedjetssub)
406 int passesCut = jet->get_property(Jet::PROPERTY::prop_SeedItr);
459 std::cout <<
"JetValidation::EndRun(const int runnumber) Ending Run for Run " << runnumber << std::endl;
466 std::cout <<
"JetValidation::End - Output to " <<
m_outputFileName << std::endl;
470 std::cout <<
"JetValidation::End(PHCompositeNode *topNode) This is the End..." << std::endl;
477 std::cout <<
"JetValidation::Reset(PHCompositeNode *topNode) being Reset" << std::endl;
484 std::cout <<
"JetValidation::Print(const std::string &what) const Printing info for " << what << std::endl;