Skip to content
Snippets Groups Projects
Commit 647b386d authored by Savannah Rose Shively's avatar Savannah Rose Shively
Browse files

finding counts?

parent a6db2db9
No related branches found
No related tags found
No related merge requests found
Pipeline #5024222 passed
......@@ -140,9 +140,13 @@ def VertexZCompare(event):
def ClusterLocation(event):
starr=[]
for loc in event.clusterLocation:
starr+=[int(str(loc).split()[0])]
if event.clusterIsDaughter: starr+=[int(str(loc).split()[0])]
return starr
def ClusterLocation2(event):
for loc in event.clusterLocation:
print(loc)
def MakeCompareArray(event,getvaluelambda,filters):
val = getvaluelambda(event)
countarr=[0 for i in range(len(filters))]
......@@ -317,10 +321,17 @@ MainArrDict={
'array':[],
'lambda': ClusterLocation,
'plotterfunc': configBasicHist,
'plotkwargs' :{'bins':5,'kwargs':{'range':[0,5]}},
'plotkwargs' :{},#'bins':5,'kwargs':{'range':[0,5]}
},
'NumClusters':{
'array':[],
'lambda': lambda event: len(event.clusterLocation),
'plotterfunc': configBasicHist,
'plotkwargs' :{},
},
}
#energy deposited hist
#frac of energy deposited hist
#
......@@ -328,7 +339,7 @@ MainArrDict={
TestArrDict=dict()
testname='DPDecayVertexZ_Compare' #Any key from MainArrDict
testname='AllClusterLocations' #Any key from MainArrDict
TestArrDict[testname]=MainArrDict[testname]
# for k in MainArrDict.keys():
# if 'Check' in k:
......@@ -338,6 +349,7 @@ def GeneralPlotter(arrDict,dcuts=[],lcuts=[],showplot=True,savefig=False):
nans=0
for event in t:
#ClusterLocation2(event)
if ApplyAllCuts(event,dcuts,lcuts):
for name in arrDict.keys():
value=nan
......@@ -381,7 +393,7 @@ def GeneralPlotter(arrDict,dcuts=[],lcuts=[],showplot=True,savefig=False):
#EXECUTE
if __name__ == "__main__":
DP_fnames=['Ntuple_Aee_10MeV_1Em4_']# Ntuple_Aee_10MeV_1Em5_ Ntuple_Aee_100MeV_1Em5_ Ntuple_Amm_316MeV_2Em6_
DP_fnames=['Ntuple_Aee_100MeV_1Em5_']# Ntuple_Aee_10MeV_1Em5_ Ntuple_Amm_316MeV_2Em6_ Ntuple_Aee_10MeV_1Em4_
for f in DP_fnames:
user_input=f
t = TChain("events")
......
......@@ -443,6 +443,7 @@ StatusCode PairVertexAlg::execute(const EventContext &ctx) const
ATH_CHECK(clusterContainer.isValid());
ATH_CHECK(h_collectionMap.isValid());
int clustercount=0;
std::vector<Identifier> clustersSofar;
//loop over all clusters
if (clusterContainer->size()>0)
......@@ -450,11 +451,13 @@ StatusCode PairVertexAlg::execute(const EventContext &ctx) const
for (auto collection : *clusterContainer) //
{
Identifier id = collection->identify();
int station = m_idHelper->station(id);
int clustercollectionstation = m_idHelper->station(id);
for (auto cluster : *collection)
{
Identifier clusterID = cluster->identify();
if (std::any_of(std::begin(clustersSofar), std::end(clustersSofar), [&](Identifier i){return i == clusterID;})){continue;}
clustersSofar.push_back(clusterID);
auto clusterRDOList = cluster->rdoList();
float TotalEnergyDeposited=0;
float TotalEnergyDeposited_daughterPos=0;
......@@ -472,13 +475,14 @@ StatusCode PairVertexAlg::execute(const EventContext &ctx) const
const auto& simdata = h_collectionMap->find(rdoID)->second;
const auto& deposits = simdata.getdeposits();
int barcode = 0;
int pdgID =0;
float edeposit = 0;
HepMcParticleLink primary{};
for( const auto& depositPair : deposits)
{
barcode = depositPair.first->barcode();
int pdgID = depositPair.first->pdg_id();
float edeposit = depositPair.second;
pdgID = depositPair.first->pdg_id();
edeposit = depositPair.second;
TotalEnergyDeposited+=edeposit; //sum all deposited energies in RDO for each cluster
......@@ -488,10 +492,10 @@ StatusCode PairVertexAlg::execute(const EventContext &ctx) const
if (pdgID>0){TotalEnergyDeposited_daughterNeg+=edeposit;}
if (pdgID<0){TotalEnergyDeposited_daughterPos+=edeposit;}
}
}
}
}
}//End DepositPair loop
}//End CollectionMap if
}//End RDO loop
m_clusterETotPos.push_back(TotalEnergyDeposited_daughterPos);
m_clusterETotNeg.push_back(TotalEnergyDeposited_daughterNeg);
m_clusterETot.push_back(TotalEnergyDeposited);
......@@ -511,8 +515,8 @@ StatusCode PairVertexAlg::execute(const EventContext &ctx) const
}
m_clusterCount=clustercount;
}
}
}//end loop iterating over clusters
}//end loop iterating over cluster collections
m_tree->Fill();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment