21 #include <TLorentzVector.h>
25 #include <calobase/RawCluster.h>
26 #include <calobase/RawClusterContainer.h>
27 #include <calobase/RawClusterUtility.h>
28 #include <calobase/RawTowerGeomContainer.h>
31 #include <calobase/TowerInfoContainer.h>
32 #include <calobase/TowerInfo.h>
35 #include <CLHEP/Geometry/Point3D.h>
47 std::cout <<
"caloTreeGen::caloTreeGen(const std::string &name) Calling ctor" << std::endl;
53 std::cout <<
"caloTreeGen::~caloTreeGen() Calling dtor" << std::endl;
63 T =
new TTree(
"T",
"T");
90 se ->
Print(
"NODETREE");
92 std::cout <<
"caloTreeGen::Init(PHCompositeNode *topNode) Initializing" << std::endl;
99 std::cout <<
"caloTreeGen::InitRun(PHCompositeNode *topNode) Initializing for Run XXX" << std::endl;
108 RawClusterContainer *clusterContainer = findNode::getClass<RawClusterContainer>(topNode,
"CLUSTERINFO_CEMC");
111 std::cout <<
PHWHERE <<
"caloTreeGen::process_event - Fatal Error - CLUSTER_CEMC node is missing. " << std::endl;
117 emcTowerContainer = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_CEMC");
118 if(!emcTowerContainer)
120 std::cout <<
PHWHERE <<
"caloTreeGen::process_event Could not find node TOWERS_CEMC" << std::endl;
126 RawTowerGeomContainer *towergeom = findNode::getClass<RawTowerGeomContainer>(topNode,
"TOWERGEOM_CEMC");
129 std::cout <<
PHWHERE <<
"caloTreeGen::process_event Could not find node TOWERGEOM_CEMC" << std::endl;
136 unsigned int tower_range = emcTowerContainer->
size();
138 for(
unsigned int iter = 0; iter < tower_range; iter++)
140 unsigned int towerkey = emcTowerContainer->
encode_key(iter);
146 double energy = emcTowerContainer -> get_tower_at_channel(iter) -> get_energy()/calib;
148 double time = emcTowerContainer -> get_tower_at_channel(iter) -> get_time();
152 double phi = towergeom -> get_phicenter(iphi);
153 double eta = towergeom -> get_etacenter(ieta);
166 for(clusterIter = clusterEnd.first; clusterIter != clusterEnd.second; clusterIter++)
168 RawCluster *recoCluster = clusterIter -> second;
170 CLHEP::Hep3Vector
vertex(0,0,0);
174 float clusE = E_vec_cluster.mag();
175 float clus_eta = E_vec_cluster.pseudoRapidity();
176 float clus_phi = E_vec_cluster.phi();
177 float clus_pt = E_vec_cluster.perp();
178 float clus_chi = recoCluster -> get_chi2();
180 float maxTowerEnergy =
getMaxTowerE(recoCluster,emcTowerContainer);
182 m_clusterE.push_back(E_vec_cluster_Full.mag());
233 std::cout <<
"caloTreeGen::EndRun(const int runnumber) Ending Run for Run " << runnumber << std::endl;
240 std::cout <<
"caloTreeGen::End(PHCompositeNode *topNode) This is the End..." << std::endl;
254 std::cout <<
"caloTreeGen::Reset(PHCompositeNode *topNode) being Reset" << std::endl;
261 std::cout <<
"caloTreeGen::Print(const std::string &what) const Printing info for " << what << std::endl;
267 unsigned int etabin = key >> 16U;
268 unsigned int phibin = key - (etabin << 16U);
276 unsigned int etabin = key >> 16U;
286 for(toweriter = towers.first; toweriter != towers.second; toweriter++)
288 float towE = toweriter -> second;
290 if( towE > maxEnergy) maxEnergy = towE;
300 std::vector<int> towerIDsEta;
301 for(toweriter = towers.first; toweriter != towers.second; toweriter++) towerIDsEta.push_back(
RawTowerDefs::decode_index1(toweriter -> first));
311 std::vector<int> towerIDsPhi;
312 for(toweriter = towers.first; toweriter != towers.second; toweriter++) towerIDsPhi.push_back(
RawTowerDefs::decode_index2(toweriter -> first));
321 std::vector<float> towerE;
322 for(toweriter = towers.first; toweriter != towers.second; toweriter++) towerE.push_back(toweriter -> second);