Compare commits

..

2 Commits

Author SHA1 Message Date
vs19g 4ba9c73b98 modified: Analyzer.C 2024-08-26 10:33:29 -04:00
vs19g 238ec8961e modified: Analyzer.C 2024-08-26 10:33:29 -04:00

View File

@ -28,6 +28,8 @@ TH2F * hqqqVpcIndex;
TH2F * hqqqVpcE;
TH2F * hsx3VpcE;
TH2F * hanVScatsum;
TH2F * hAnodeHits;
int padID = 0;
SX3 sx3_contr;
@ -67,6 +69,7 @@ void Analyzer::Begin(TTree * /*tree*/){
hsx3VpcE->SetNdivisions( -12, "y");
hZProj = new TH1F("hZProj", "Z Projection", 200, -600, 600);
hAnodeHits = new TH2F("hAnodeHits", "Anode vs Anode Energy, Anode ID; Anode E", 24,0 , 23, 400, 0 , 16000);
hanVScatsum = new TH2F("hanVScatsum", "Anode vs Cathode Sum; Anode E; Cathode E", 400,0 , 10000, 400, 0 , 16000);
@ -257,66 +260,66 @@ Bool_t Analyzer::Process(Long64_t entry){
}
// //======================= PC
ID.clear();
int counter=0;
std::vector<std::pair<int, double>> E;
E.clear();
for( int i = 0; i < pc.multi; i ++){
if( pc.e[i] > 100 ) ID.push_back(std::pair<int, int>(pc.id[i], i));
if( pc.e[i] > 100 ) E.push_back(std::pair<int, double>(pc.index[i], pc.e[i]));
hpcIndexVE->Fill( pc.index[i], pc.e[i] );
for( int j = i+1; j < pc.multi; j++){
hpcCoin->Fill( pc.index[i], pc.index[j]);
}
}
// for( size_t i = 0; i < E.size(); i++) printf("%zu | %d %d \n", i, E[i].first, E[i].second );
if( E.size()>=3 ){
std::vector<std::pair<int, double>> anodeHits;
std::vector<std::pair<int, double>> cathodeHits;
int aID = 0;
int cID = 0;
float aE = 0;
float cE = 0;
bool multi_an =false;
// if( ID[0].first < 1 ) {
// aID = pc.ch[ID[0].second];
// cID = pc.ch[ID[1].second];
// }else{
// cID = pc.ch[ID[0].second];
// aID = pc.ch[ID[1].second];
// }
// printf("anode= %d, cathode = %d\n", aID, cID);
// for( int k = 0; k < qqq.multi; k++){
// if(qqq.index[k]==75 && pc.index[k]==2 && pc.e[k]>100){
for(int l=0;l<E.size();l++){
if(E[l].first<24 && E[l].first!=20 && E[l].first!=12){
if(!multi_an){
aE = E[l].second;
}
multi_an=true;
}
else {
cE = E[l].second + cE;
}
}
// }
// }
hanVScatsum->Fill(aE,cE);
// Define the excluded SX3 and QQQ channels
std::unordered_set<int> excludeSX3 = {34, 35, 36, 37, 61, 62, 67, 73, 74, 75, 76, 77, 78, 79, 80, 93, 97, 100, 103, 108, 109, 110, 111, 112};
std::unordered_set<int> excludeQQQ = {0, 17, 109, 110, 111, 112, 113, 119, 127, 128};
if( ID[0].first < 1 ) {
aID = pc.ch[ID[0].second];
cID = pc.ch[ID[1].second];
}else{
cID = pc.ch[ID[0].second];
aID = pc.ch[ID[1].second];
for (int i = 0; i < pc.multi; i++) {
if (pc.e[i] > 20) { // Reduced threshold for debugging
for (int j = 0; j < sx3.multi; j++) {
if (excludeSX3.find(sx3.index[j]) == excludeSX3.end()) {
hpcIndexVE->Fill(pc.index[i], pc.e[i]);
if (pc.e[i] > 20) {
if (pc.index[i] < 24) {
anodeHits.push_back(std::make_pair(pc.index[i], pc.e[i]));
} else if (pc.index[i] >= 24) {
cathodeHits.push_back(std::make_pair(pc.index[i], pc.e[i]));
}
}
for (int k = i + 1; k < pc.multi; k++) {
hpcCoin->Fill(pc.index[i], pc.index[k]);
}
}
}
if (!anodeHits.empty() && !cathodeHits.empty()) {
float aESum = 0;
float cESum = 0;
for (const auto& anode : anodeHits) {
aESum += anode.second;
hAnodeHits->Fill(anode.first, anode.second);
}
for (const auto& cathode : cathodeHits) {
cESum += cathode.second;
}
// Debugging output
printf("Filling histogram: aESum = %f, cESum = %f\n", aESum, cESum);
hanVScatsum->Fill(aESum, cESum);
}
anodeHits.clear();
cathodeHits.clear();
}
}
// hanVScatsum->Fill(aE,cE);
if( HitNonZero){
pw_contr.CalTrack( hitPos, aID, cID);
@ -324,7 +327,7 @@ Bool_t Analyzer::Process(Long64_t entry){
}
}
@ -397,6 +400,7 @@ void Analyzer::Terminate(){
canvas->cd(padID); canvas->cd(padID)->SetGrid(1);
// hZProj->Draw();
hanVScatsum->Draw("colz");
// hanVScatsum->Draw("colz");
hAnodeHits->Draw("colz");
}