diff --git a/Analyzer.C b/Analyzer.C index 893f934..3a27b2f 100644 --- a/Analyzer.C +++ b/Analyzer.C @@ -64,11 +64,11 @@ void Analyzer::Begin(TTree * /*tree*/){ hqqqVpcIndex->SetNdivisions( -612, "x"); hqqqVpcIndex->SetNdivisions( -12, "y"); - hqqqVpcE = new TH2F("hqqqVpcEnergy", "qqq vs pc; qqq energy; pc energy", 400, 0, 5000, 400, 0, 5000); + hqqqVpcE = new TH2F("hqqqVpcEnergy", "qqq vs pc; qqq energy; pc energy", 400, 0, 5000, 400, 0, 16000); hqqqVpcE->SetNdivisions( -612, "x"); hqqqVpcE->SetNdivisions( -12, "y"); - hsx3VpcE = new TH2F("hsx3VpcEnergy", "sx3 vs pc; sx3 energy; pc energy", 400, 0, 5000, 400, 0, 5000); + hsx3VpcE = new TH2F("hsx3VpcEnergy", "sx3 vs pc; sx3 energy; pc energy", 3200, 0, 5000, 3200, 0, 8000); hsx3VpcE->SetNdivisions( -612, "x"); hsx3VpcE->SetNdivisions( -12, "y"); @@ -132,7 +132,7 @@ Bool_t Analyzer::Process(Long64_t entry){ } for( int j = 0; j < pc.multi; j++){ - hsx3VpcIndex->Fill( sx3.index[i], pc.index[j] ); + // hsx3VpcIndex->Fill( sx3.index[i], pc.index[j] ); // if( sx3.ch[index] > 8 ){ // hsx3VpcE->Fill( sx3.e[i], pc.e[j] ); // } @@ -343,11 +343,14 @@ Bool_t Analyzer::Process(Long64_t entry){ if( AnCatSum->IsInside(aE, cESum)){ inCut=true; } - // if(inCut){ + if(inCut){ hanVScatsum->Fill(aE,cESum); hAnodeHits->Fill(aID, aE); - // } - // } + for(int j=0;sx3.multi;j++){ + + hsx3VpcIndex->Fill( sx3.index[i], pc.index[j] ); + } + } // } } } @@ -357,7 +360,9 @@ Bool_t Analyzer::Process(Long64_t entry){ if( HitNonZero){ - pw_contr.CalTrack1( hitPos, aID, cIDMax, cIDnextMax, cEMax, cEnextMax,1); + // pw_contr.CalTrack1( hitPos, aID, cIDMax, cIDnextMax, cEMax, cEnextMax,1); + + pw_contr.CalTrack( hitPos, aID, cID); hZProj->Fill(pw_contr.GetZ0()); } diff --git a/Analyzer1.C b/Analyzer1.C new file mode 100644 index 0000000..62c47d1 --- /dev/null +++ b/Analyzer1.C @@ -0,0 +1,402 @@ +#define Analyzer1_cxx + +#include "Analyzer1.h" +#include +#include +#include +#include + +#include +#include + +#include "Armory/ClassSX3.h" +#include "Armory/ClassPW.h" + +#include "TVector3.h" + +TH2F * hsx3IndexVE; +TH2F * hqqqIndexVE; +TH2F * hpcIndexVE; + +TH2F * hsx3Coin; +TH2F * hqqqCoin; +TH2F * hpcCoin; + +TH2F * hqqqPolar; +TH2F * hsx3VpcIndex; +TH2F * hqqqVpcIndex; +TH2F * hqqqVpcE; +TH2F * hsx3VpcE; +TH2F * hanVScatsum; +int padID = 0; + +SX3 sx3_contr; +PW pw_contr; +TVector3 hitPos; +bool HitNonZero; + +TH1F * hZProj; + +void Analyzer1::Begin(TTree * /*tree*/){ + TString option = GetOption(); + + hsx3IndexVE = new TH2F("hsx3IndexVE", "SX3 index vs Energy; sx3 index ; Energy", 24*12, 0, 24*12, 400, 0, 5000); hsx3IndexVE->SetNdivisions( -612, "x"); + hqqqIndexVE = new TH2F("hqqqIndexVE", "QQQ index vs Energy; QQQ index ; Energy", 4*2*16, 0, 4*2*16, 400, 0, 5000); hqqqIndexVE->SetNdivisions( -1204, "x"); + hpcIndexVE = new TH2F("hpcIndexVE", "PC index vs Energy; PC index ; Energy", 2*24, 0, 2*24, 400, 0, 4000); hpcIndexVE->SetNdivisions( -1204, "x"); + + + hsx3Coin = new TH2F("hsx3Coin", "SX3 Coincident", 24*12, 0, 24*12, 24*12, 0, 24*12); + hqqqCoin = new TH2F("hqqqCoin", "QQQ Coincident", 4*2*16, 0, 4*2*16, 4*2*16, 0, 4*2*16); + hpcCoin = new TH2F("hpcCoin", "PC Coincident", 2*24, 0, 2*24, 2*24, 0, 2*24); + + hqqqPolar = new TH2F("hqqqPolar", "QQQ Polar ID", 16*4, -TMath::Pi(), TMath::Pi(),16, 10, 50); + + hsx3VpcIndex = new TH2F("hsx3Vpcindex", "sx3 vs pc; sx3 index; pc index", 24*12, 0, 24*12, 48, 0, 48); + hsx3VpcIndex->SetNdivisions( -612, "x"); + hsx3VpcIndex->SetNdivisions( -12, "y"); + hqqqVpcIndex = new TH2F("hqqqVpcindex", "qqq vs pc; qqq index; pc index", 4*2*16, 0, 4*2*16, 48, 0, 48); + hqqqVpcIndex->SetNdivisions( -612, "x"); + hqqqVpcIndex->SetNdivisions( -12, "y"); + + hqqqVpcE = new TH2F("hqqqVpcEnergy", "qqq vs pc; qqq energy; pc energy", 400, 0, 5000, 400, 0, 5000); + hqqqVpcE->SetNdivisions( -612, "x"); + hqqqVpcE->SetNdivisions( -12, "y"); + + hsx3VpcE = new TH2F("hsx3VpcEnergy", "sx3 vs pc; sx3 energy; pc energy", 400, 0, 5000, 400, 0, 5000); + hsx3VpcE->SetNdivisions( -612, "x"); + hsx3VpcE->SetNdivisions( -12, "y"); + + hZProj = new TH1F("hZProj", "Z Projection", 1200, -600, 600); + + hanVScatsum = new TH2F("hanVScatsum", "Anode vs Cathode Sum; Anode E; Cathode E", 400,0 , 10000, 400, 0 , 16000); + + sx3_contr.ConstructGeo(); + pw_contr.ConstructGeo(); + +} + + + + +Bool_t Analyzer1::Process(Long64_t entry){ + + // if ( entry > 100 ) return kTRUE; + + hitPos.Clear(); + HitNonZero = false; + + // if( entry > 1) return kTRUE; + // printf("################### ev : %llu \n", entry); + + b_sx3Multi->GetEntry(entry); + b_sx3ID->GetEntry(entry); + b_sx3Ch->GetEntry(entry); + b_sx3E->GetEntry(entry); + b_sx3T->GetEntry(entry); + b_qqqMulti->GetEntry(entry); + b_qqqID->GetEntry(entry); + b_qqqCh->GetEntry(entry); + b_qqqE->GetEntry(entry); + b_qqqT->GetEntry(entry); + b_pcMulti->GetEntry(entry); + b_pcID->GetEntry(entry); + b_pcCh->GetEntry(entry); + b_pcE->GetEntry(entry); + b_pcT->GetEntry(entry); + + sx3.CalIndex(); + qqq.CalIndex(); + pc.CalIndex(); + + // sx3.Print(); + + //########################################################### Raw data + // //======================= SX3 + + std::vector> ID; // first = id, 2nd = index + for( int i = 0; i < sx3.multi; i ++){ + ID.push_back(std::pair(sx3.id[i], i)); + + hsx3IndexVE->Fill( sx3.index[i], sx3.e[i] ); + + for( int j = i+1; j < sx3.multi; j++){ + hsx3Coin->Fill( sx3.index[i], sx3.index[j]); + } + + for( int j = 0; j < pc.multi; j++){ + hsx3VpcIndex->Fill( sx3.index[i], pc.index[j] ); + // if( sx3.ch[index] > 8 ){ + // hsx3VpcE->Fill( sx3.e[i], pc.e[j] ); + // } + } + } + + + if( ID.size() > 0 ){ + std::sort(ID.begin(), ID.end(), [](const std::pair & a, const std::pair & b) { + return a.first < b.first; + } ); + // printf("##############################\n"); + // for( size_t i = 0; i < ID.size(); i++) printf("%zu | %d %d \n", i, ID[i].first, ID[i].second ); + + std::vector> sx3ID; + sx3ID.push_back(ID[0]); + bool found = false; + for( size_t i = 1; i < ID.size(); i++){ + if( ID[i].first == sx3ID.back().first) { + sx3ID.push_back(ID[i]); + if( sx3ID.size() >= 3) { + found = true; + } + }else{ + if( !found ){ + sx3ID.clear(); + sx3ID.push_back(ID[i]); + } + } + } + + // printf("---------- sx3ID Multi : %zu \n", sx3ID.size()); + + if( found ){ + int sx3ChUp, sx3ChDn, sx3ChBk; + float sx3EUp, sx3EDn; + // printf("------ sx3 ID : %d, multi: %zu\n", sx3ID[0].first, sx3ID.size()); + for( size_t i = 0; i < sx3ID.size(); i++ ){ + int index = sx3ID[i].second; + // printf(" %zu | index %d | ch : %d, energy : %d \n", i, index, sx3.ch[index], sx3.e[index]); + + + if( sx3.ch[index] < 8 ){ + if( sx3.ch[index] % 2 == 0) { + sx3ChDn = sx3.ch[index]; + sx3EDn = sx3.e[index]; + }else{ + sx3ChUp = sx3.ch[index]; + sx3EUp = sx3.e[index]; + } + }else{ + sx3ChBk = sx3.ch[index]; + } + for( int j = 0; j < pc.multi; j++){ + // hsx3VpcIndex->Fill( sx3.index[i], pc.index[j] ); + if( sx3.ch[index] > 8 ){ + hsx3VpcE->Fill( sx3.e[i], pc.e[j] ); + // hpcIndexVE->Fill( pc.index[i], pc.e[i] ); + } + } + } + + sx3_contr.CalSX3Pos(sx3ID[0].first, sx3ChUp, sx3ChDn, sx3ChBk, sx3EUp, sx3EDn); + hitPos = sx3_contr.GetHitPos(); + HitNonZero = true; + // hitPos.Print(); + } + + } + + + // //======================= QQQ + for( int i = 0; i < qqq.multi; i ++){ + // for( int j = 0; j < pc.multi; j++){ + // if(pc.index[j]==4){ + hqqqIndexVE->Fill( qqq.index[i], qqq.e[i] ); + // } + // } + for( int j = 0; j < qqq.multi; j++){ + if ( j == i ) continue; + hqqqCoin->Fill( qqq.index[i], qqq.index[j]); + } + + + for( int j = i + 1; j < qqq.multi; j++){ + for( int k = 0; k < pc.multi; k++){ + if(pc.index[k]<24 && pc.e[k]>50 ){ + hqqqVpcE->Fill( qqq.e[i], pc.e[k] ); + // hpcIndexVE->Fill( pc.index[i], pc.e[i] ); + hqqqVpcIndex->Fill( qqq.index[i], pc.index[j] ); + + } + // } + } + // if( qqq.used[i] == true ) continue; + + //if( qqq.id[i] == qqq.id[j] && (16 - qqq.ch[i]) * (16 - qqq.ch[j]) < 0 ){ // must be same detector and wedge and ring + if( qqq.id[i] == qqq.id[j] ){ // must be same detector + + int chWedge = -1; + int chRing = -1; + if( qqq.ch[i] < qqq.ch[j]){ + chRing = qqq.ch[j] - 16; + chWedge = qqq.ch[i]; + }else{ + chRing = qqq.ch[i]; + chWedge = qqq.ch[j] - 16; + } + + // printf(" ID : %d , chWedge : %d, chRing : %d \n", qqq.id[i], chWedge, chRing); + + double theta = -TMath::Pi()/2 + 2*TMath::Pi()/16/4.*(qqq.id[i]*16 + chWedge +0.5); + double rho = 10.+40./16.*(chRing+0.5); + // if(qqq.e[i]>50){ + hqqqPolar->Fill( theta, rho); + // } + // qqq.used[i] = true; + // qqq.used[j] = true; + + if( !HitNonZero ){ + double x = rho * TMath::Cos(theta); + double y = rho * TMath::Sin(theta); + hitPos.SetXYZ(x, y, 23 + 75 + 30); + HitNonZero = true; + } + } + } + + + } + // //======================= PC + + ID.clear(); + int counter=0; + std::vector> E; + E.clear(); + for( int i = 0; i < pc.multi; i ++){ + + if( pc.e[i] > 100 ) ID.push_back(std::pair(pc.id[i], i)); + if( pc.e[i] > 100 ) E.push_back(std::pair(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 ){ + + 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=24){ + cE = E[l].second + cE; + } + } + // } + // } + hanVScatsum->Fill(aE,cE); + + 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]; + } + + if( HitNonZero){ + pw_contr.CalTrack( hitPos, aID, cID); + hZProj->Fill(pw_contr.GetZ0()); + } + + + } + + + + //########################################################### Track constrcution + + + //############################## DO THE KINEMATICS + + + return kTRUE; +} + +void Analyzer1::Terminate(){ + + gStyle->SetOptStat("neiou"); + TCanvas * canvas = new TCanvas("cANASEN", "ANASEN", 2000, 2000); + canvas->Divide(3,3); + + //hsx3VpcIndex->Draw("colz"); + + //=============================================== pad-1 + padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1); + + hsx3IndexVE->Draw("colz"); + + //=============================================== pad-2 + padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1); + + hqqqIndexVE->Draw("colz"); + + //=============================================== pad-3 + padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1); + + hpcIndexVE->Draw("colz"); + + //=============================================== pad-4 + padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1); + + hsx3Coin->Draw("colz"); + + //=============================================== pad-5 + padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1); + + canvas->cd(padID)->SetLogz(true); + + hqqqCoin->Draw("colz"); + + //=============================================== pad-6 + padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1); + + hpcCoin->Draw("colz"); + + //=============================================== pad-7 + padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1); + + // hsx3VpcIndex ->Draw("colz"); + hsx3VpcE->Draw("colz") ; + + //=============================================== pad-8 + padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1); + + // hqqqVpcIndex ->Draw("colz"); + + hqqqVpcE ->Draw("colz"); + //=============================================== pad-9 + padID ++; + + // canvas->cd(padID)->DrawFrame(-50, -50, 50, 50); + // hqqqPolar->Draw("same colz pol"); + + canvas->cd(padID); canvas->cd(padID)->SetGrid(1); +// hZProj->Draw(); + hanVScatsum->Draw("colz"); + +} diff --git a/Analyzer1.h b/Analyzer1.h new file mode 100644 index 0000000..9d9d3a7 --- /dev/null +++ b/Analyzer1.h @@ -0,0 +1,114 @@ +#ifndef Analyzer1_h +#define Analyzer1_h + +#include +#include +#include +#include + +#include "Armory/ClassDet.h" + +class Analyzer1 : public TSelector { +public : + TTree *fChain; //!pointer to the analyzed TTree or TChain + +// Fixed size dimensions of array or collections stored in the TTree if any. + + // Declaration of leaf types + Det sx3; + Det qqq; + Det pc ; + + ULong64_t evID; + UInt_t run; + + // List of branches + TBranch *b_eventID; //! + TBranch *b_run; //! + TBranch *b_sx3Multi; //! + TBranch *b_sx3ID; //! + TBranch *b_sx3Ch; //! + TBranch *b_sx3E; //! + TBranch *b_sx3T; //! + TBranch *b_qqqMulti; //! + TBranch *b_qqqID; //! + TBranch *b_qqqCh; //! + TBranch *b_qqqE; //! + TBranch *b_qqqT; //! + TBranch *b_pcMulti; //! + TBranch *b_pcID; //! + TBranch *b_pcCh; //! + TBranch *b_pcE; //! + TBranch *b_pcT; //! + + Analyzer1(TTree * /*tree*/ =0) : fChain(0) { } + virtual ~Analyzer1() { } + virtual Int_t Version() const { return 2; } + virtual void Begin(TTree *tree); + virtual void SlaveBegin(TTree *tree); + virtual void Init(TTree *tree); + virtual Bool_t Notify(); + virtual Bool_t Process(Long64_t entry); + virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0) { return fChain ? fChain->GetTree()->GetEntry(entry, getall) : 0; } + virtual void SetOption(const char *option) { fOption = option; } + virtual void SetObject(TObject *obj) { fObject = obj; } + virtual void SetInputList(TList *input) { fInput = input; } + virtual TList *GetOutputList() const { return fOutput; } + virtual void SlaveTerminate(); + virtual void Terminate(); + + ClassDef(Analyzer1,0); +}; + +#endif + +#ifdef Analyzer1_cxx +void Analyzer1::Init(TTree *tree){ + + // Set branch addresses and branch pointers + if (!tree) return; + fChain = tree; + fChain->SetMakeClass(1); + + fChain->SetBranchAddress("evID", &evID, &b_eventID); + fChain->SetBranchAddress("run", &run, &b_run); + + sx3.SetDetDimension(24,12); + qqq.SetDetDimension(4,32); + pc.SetDetDimension(2,24); + + fChain->SetBranchAddress("sx3Multi", &sx3.multi, &b_sx3Multi); + fChain->SetBranchAddress("sx3ID", &sx3.id, &b_sx3ID); + fChain->SetBranchAddress("sx3Ch", &sx3.ch, &b_sx3Ch); + fChain->SetBranchAddress("sx3E", &sx3.e, &b_sx3E); + fChain->SetBranchAddress("sx3T", &sx3.t, &b_sx3T); + fChain->SetBranchAddress("qqqMulti", &qqq.multi, &b_qqqMulti); + fChain->SetBranchAddress("qqqID", &qqq.id, &b_qqqID); + fChain->SetBranchAddress("qqqCh", &qqq.ch, &b_qqqCh); + fChain->SetBranchAddress("qqqE", &qqq.e, &b_qqqE); + fChain->SetBranchAddress("qqqT", &qqq.t, &b_qqqT); + fChain->SetBranchAddress("pcMulti", &pc.multi, &b_pcMulti); + fChain->SetBranchAddress("pcID", &pc.id, &b_pcID); + fChain->SetBranchAddress("pcCh", &pc.ch, &b_pcCh); + fChain->SetBranchAddress("pcE", &pc.e, &b_pcE); + fChain->SetBranchAddress("pcT", &pc.t, &b_pcT); + +} + +Bool_t Analyzer1::Notify(){ + + return kTRUE; +} + +void Analyzer1::SlaveBegin(TTree * /*tree*/){ + + TString option = GetOption(); + +} + +void Analyzer1::SlaveTerminate(){ + +} + + +#endif // #ifdef Analyzer_cxx diff --git a/Armory/ClassPW.h b/Armory/ClassPW.h index 620ee90..17c6afe 100644 --- a/Armory/ClassPW.h +++ b/Armory/ClassPW.h @@ -243,6 +243,7 @@ inline void PW::CalTrack1(TVector3 sx3Pos, int anodeID, int cathodeID1, int cath double q1 = cathodeE1; double q2 = cathodeE2; double fracC = (q1) / (q1 + q2); + // shifting the coordinates of the cathode wire along 2 axes c1 and c2 TVector3 shiftC1 = (Ca[cathodeID2].first - Ca[cathodeID1].first) * fracC; TVector3 shiftC2 = (Ca[cathodeID2].second - Ca[cathodeID1].second) * fracC; TVector3 c1 = Ca[cathodeID1].first + shiftC1; diff --git a/PreAnalysis_C_ACLiC_dict.cxx_tmp_829464 b/PreAnalysis_C_ACLiC_dict.cxx_tmp_829464 new file mode 100644 index 0000000..f11e014 --- /dev/null +++ b/PreAnalysis_C_ACLiC_dict.cxx_tmp_829464 @@ -0,0 +1,4 @@ +// Do NOT change. Changes will be lost next time file is generated + +#define R__DICTIONARY_FILENAME dIhomedIvigneshsitaramandI27Al_analysisdIANASEN_analysisdIPreAnalysis_C_ACLiC_dict +#define R__NO_DEPRECATION diff --git a/PreAnalysis_C_ACLiC_dict584672d457_dictUmbrella.h b/PreAnalysis_C_ACLiC_dict584672d457_dictUmbrella.h new file mode 100644 index 0000000..e69de29 diff --git a/PreAnalysis_C_ACLiC_dictd53e725542_dictContent.h b/PreAnalysis_C_ACLiC_dictd53e725542_dictContent.h new file mode 100644 index 0000000..e69de29 diff --git a/mapping.h b/mapping.h index c734eeb..9f031a4 100644 --- a/mapping.h +++ b/mapping.h @@ -77,13 +77,13 @@ const std::vector mapping = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //================== 334 - 20116, 20117, 20118, 20119, 20120, 20121, 20122, 20123, 20016, 20017, 20018, 20019, 20020, 20021, 20022, 20023, + 20116, 20117, 20118, 20119, -1, 20121, 20122, 20123, 20016, 20017, 20018, 20019, 20020, 20021, 20022, 20023, //================== 379 20000, 20001, 20002, 20003, 20004, 20005, -1, 20007, 20008, -1, 20010, 20011, 20012, 20013, 20014, 20015, //================== 325 20100, 20101, 20102, 20103, 20104, 20105, 20106, 20107, 20108, 20109, 20110, 20111, 20112, 20113, 20114, 20115, //================== 405 - 20006, -1, -1, 20009, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 + 20006, -1, -1, 20009, -1, 20120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };