Commit 90167c21 authored by Chad Lantz's avatar Chad Lantz
Browse files

Corrected branch construction and filling process for simple data types

parent 8ee82a42
......@@ -54,7 +54,6 @@ class AnalysisManager
void FillNtuples( );
void CreateVectors ( G4int nZDCs, G4int nRPDs );
void MakeZDCTree ( G4int nTupleNo, G4int zdcNo );
void MakeZDCOpticalTree( G4int nTupleNo, G4int zdcNo );
void MakeRPDTree ( G4int nTupleNo, G4int rpdNo );
......
......@@ -191,13 +191,18 @@ void AnalysisManager::MakeZDCTree( G4int nTupleNo, G4int zdcNo ){
sprintf(name,"ZDC%dtree",zdcNo+1);
m_analysisManager->CreateNtuple( name, "ZDC data");
if(!CLUSTER){
//Make branches containing sipmle data types
//Do this first so column ID number is predictable
m_analysisManager->CreateNtupleDColumn( nTupleNo, "lastStep" );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "gunPosX" );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "gunPosY" );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "gunPosZ" );
m_analysisManager->CreateNtupleIColumn( nTupleNo, "EventNo" );
//Resize the vector for the number of branches storing double vectors
m_ZDCdblVec->at(zdcNo).resize(11);
//Make double branches
m_analysisManager->CreateNtupleDColumn( nTupleNo, "lastStep" );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "gunPosX" );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "gunPosY" );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "gunPosZ" );
//Make double vector branches
m_analysisManager->CreateNtupleDColumn( nTupleNo, "x", m_ZDCdblVec->at(zdcNo).at(0) );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "y", m_ZDCdblVec->at(zdcNo).at(1) );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "z", m_ZDCdblVec->at(zdcNo).at(2) );
......@@ -213,7 +218,6 @@ void AnalysisManager::MakeZDCTree( G4int nTupleNo, G4int zdcNo ){
//Resize the vector for the number of branches storing int vectors
m_ZDCintVec->at(zdcNo).resize(6);
//Make int branches
m_analysisManager->CreateNtupleIColumn( nTupleNo, "EventNo" );
m_analysisManager->CreateNtupleIColumn( nTupleNo, "modNo", m_ZDCintVec->at(zdcNo).at(0) );
m_analysisManager->CreateNtupleIColumn( nTupleNo, "radNo", m_ZDCintVec->at(zdcNo).at(1) );
m_analysisManager->CreateNtupleIColumn( nTupleNo, "rodNo", m_ZDCintVec->at(zdcNo).at(2) );
......@@ -222,13 +226,17 @@ void AnalysisManager::MakeZDCTree( G4int nTupleNo, G4int zdcNo ){
m_analysisManager->CreateNtupleIColumn( nTupleNo, "pid", m_ZDCintVec->at(zdcNo).at(5) );
} else { //Fewer vector branches to save storage space
//Resize the vector for the number of branches storing double vectors
m_ZDCdblVec->at(zdcNo).resize(6);
//Make double branches
//Make branches containing sipmle data types
//Do this first so column ID number is predictable
m_analysisManager->CreateNtupleDColumn( nTupleNo, "lastStep" );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "gunPosX" );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "gunPosY" );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "gunPosZ" );
m_analysisManager->CreateNtupleIColumn( nTupleNo, "EventNo" );
//Resize the vector for the number of branches storing double vectors
m_ZDCdblVec->at(zdcNo).resize(6);
//Make double branches
m_analysisManager->CreateNtupleDColumn( nTupleNo, "x", m_ZDCdblVec->at(zdcNo).at(0) );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "y", m_ZDCdblVec->at(zdcNo).at(1) );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "z", m_ZDCdblVec->at(zdcNo).at(2) );
......@@ -236,7 +244,6 @@ void AnalysisManager::MakeZDCTree( G4int nTupleNo, G4int zdcNo ){
//Resize the vector for the number of branches storing int vectors
m_ZDCintVec->at(zdcNo).resize(1);
//Make int branches
m_analysisManager->CreateNtupleIColumn( nTupleNo, "EventNo" );
m_analysisManager->CreateNtupleIColumn( nTupleNo, "nCherenkovs", m_ZDCintVec->at(zdcNo).at(1) );
m_analysisManager->CreateNtupleIColumn( nTupleNo, "radNo", m_ZDCintVec->at(zdcNo).at(0) );
}//end if !CLUSTER
......@@ -250,13 +257,18 @@ void AnalysisManager::MakeZDCOpticalTree( G4int nTupleNo, G4int zdcNo ){
sprintf(name,"ZDC%dtree",zdcNo+1);
m_analysisManager->CreateNtuple( name, "ZDC data");
//Resize the vector for the number of branches storing double vectors
m_ZDCdblVec->at(zdcNo).resize(6);
//Make double branches
//Make branches containing sipmle data types
//Do this first so column ID number is predictable
m_analysisManager->CreateNtupleDColumn( nTupleNo, "lastStep" );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "gunPosX" );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "gunPosY" );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "gunPosZ" );
m_analysisManager->CreateNtupleIColumn( nTupleNo, "EventNo" );
m_analysisManager->CreateNtupleIColumn( nTupleNo, "nCherenkovs" );
//Resize the vector for the number of branches storing double vectors
m_ZDCdblVec->at(zdcNo).resize(6);
//Make double branches
m_analysisManager->CreateNtupleDColumn( nTupleNo, "x", m_ZDCdblVec->at(zdcNo).at(0) );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "y", m_ZDCdblVec->at(zdcNo).at(1) );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "z", m_ZDCdblVec->at(zdcNo).at(2) );
......@@ -267,8 +279,6 @@ void AnalysisManager::MakeZDCOpticalTree( G4int nTupleNo, G4int zdcNo ){
//Resize the vector for the number of branches storing int vectors
m_ZDCintVec->at(zdcNo).resize(1);
//Make int branches
m_analysisManager->CreateNtupleIColumn( nTupleNo, "EventNo" );
m_analysisManager->CreateNtupleIColumn( nTupleNo, "nCherenkovs" );
m_analysisManager->CreateNtupleIColumn( nTupleNo, "rodNo", m_ZDCintVec->at(zdcNo).at(0) );
m_analysisManager->FinishNtuple( nTupleNo );
......@@ -281,13 +291,18 @@ void AnalysisManager::MakeRPDTree( G4int nTupleNo, G4int rpdNo ){
sprintf(name,"RPD%dtree",rpdNo+1);
m_analysisManager->CreateNtuple( name, "RPD data");
if(!CLUSTER){
//Resize the vector for the number of branches storing double vectors
m_RPDdblVec->at(rpdNo).resize(11);
//Make double branches
//Make branches containing sipmle data types
//Do this first so column ID number is predictable
m_analysisManager->CreateNtupleDColumn( nTupleNo, "lastStep" );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "gunPosX" );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "gunPosY" );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "gunPosZ" );
m_analysisManager->CreateNtupleIColumn( nTupleNo, "EventNo" );
//Resize the vector for the number of branches storing double vectors
m_RPDdblVec->at(rpdNo).resize(11);
//Make double branches
m_analysisManager->CreateNtupleDColumn( nTupleNo, "x", m_RPDdblVec->at(rpdNo).at(0) );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "y", m_RPDdblVec->at(rpdNo).at(1) );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "z", m_RPDdblVec->at(rpdNo).at(2) );
......@@ -303,7 +318,6 @@ void AnalysisManager::MakeRPDTree( G4int nTupleNo, G4int rpdNo ){
//Resize the vector for the number of branches storing int vectors
m_RPDintVec->at(rpdNo).resize(6);
//Make int branches
m_analysisManager->CreateNtupleIColumn( nTupleNo, "EventNo" );
m_analysisManager->CreateNtupleIColumn( nTupleNo, "modNo", m_RPDintVec->at(rpdNo).at(0) );
m_analysisManager->CreateNtupleIColumn( nTupleNo, "radNo", m_RPDintVec->at(rpdNo).at(1) );
m_analysisManager->CreateNtupleIColumn( nTupleNo, "rodNo", m_RPDintVec->at(rpdNo).at(2) );
......@@ -312,13 +326,17 @@ void AnalysisManager::MakeRPDTree( G4int nTupleNo, G4int rpdNo ){
m_analysisManager->CreateNtupleIColumn( nTupleNo, "pid", m_RPDintVec->at(rpdNo).at(5) );
} else { //Fewer vector branches to save storage space
//Resize the vector for the number of branches storing double vectors
m_RPDdblVec->at(rpdNo).resize(3);
//Make double branches
//Make branches containing sipmle data types
//Do this first so column ID number is predictable
m_analysisManager->CreateNtupleDColumn( nTupleNo, "lastStep" );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "gunPosX" );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "gunPosY" );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "gunPosZ" );
m_analysisManager->CreateNtupleIColumn( nTupleNo, "EventNo" );
//Resize the vector for the number of branches storing double vectors
m_RPDdblVec->at(rpdNo).resize(3);
//Make double branches
m_analysisManager->CreateNtupleDColumn( nTupleNo, "x", m_RPDdblVec->at(rpdNo).at(0) );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "y", m_RPDdblVec->at(rpdNo).at(1) );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "z", m_RPDdblVec->at(rpdNo).at(2) );
......@@ -326,7 +344,6 @@ void AnalysisManager::MakeRPDTree( G4int nTupleNo, G4int rpdNo ){
//Resize the vector for the number of branches storing int vectors
m_RPDintVec->at(rpdNo).resize(2);
//Make int branches
m_analysisManager->CreateNtupleIColumn( nTupleNo, "EventNo" );
m_analysisManager->CreateNtupleIColumn( nTupleNo, "nCherenkovs", m_RPDintVec->at(rpdNo).at(1) );
m_analysisManager->CreateNtupleIColumn( nTupleNo, "rodNo", m_RPDintVec->at(rpdNo).at(0) );
}//end if !CLUSTER
......@@ -340,24 +357,30 @@ void AnalysisManager::MakeRPDTree( G4int nTupleNo, G4int rpdNo ){
void AnalysisManager::MakeRPDOpticalTree( G4int nTupleNo, G4int rpdNo ){
char name[20];
sprintf(name,"RPD%dtree",rpdNo+1);
//Resize the vector for the number of branches storing double vectors
m_RPDdblVec->at(rpdNo).resize(3);
//Make double branches
m_analysisManager->CreateNtuple( name, "RPD data");
//Make branches containing sipmle data types
//Do this first so column ID number is predictable
m_analysisManager->CreateNtupleDColumn( nTupleNo, "lastStep" );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "lastStepTest" );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "gunPosX" );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "gunPosY" );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "gunPosZ" );
m_analysisManager->CreateNtupleIColumn( nTupleNo, "EventNo" );
m_analysisManager->CreateNtupleIColumn( nTupleNo, "nCherenkovs" );
//Resize the vector for the number of branches storing double vectors
m_RPDdblVec->at(rpdNo).resize(6);
//Make double branches
m_analysisManager->CreateNtupleDColumn( nTupleNo, "x", m_RPDdblVec->at(rpdNo).at(0) );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "y", m_RPDdblVec->at(rpdNo).at(1) );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "z", m_RPDdblVec->at(rpdNo).at(2) );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "Px", m_RPDdblVec->at(rpdNo).at(3) );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "Py", m_RPDdblVec->at(rpdNo).at(4) );
m_analysisManager->CreateNtupleDColumn( nTupleNo, "Pz", m_RPDdblVec->at(rpdNo).at(5) );
//Resize the vector for the number of branches storing int vectors
//Make int branches
m_RPDintVec->at(rpdNo).resize(1);
m_analysisManager->CreateNtupleIColumn( nTupleNo, "EventNo" );
m_analysisManager->CreateNtupleIColumn( nTupleNo, "nCherenkovs" );
m_analysisManager->CreateNtupleIColumn( nTupleNo, "rodNo", m_RPDintVec->at(rpdNo).at(0) );
m_analysisManager->FinishNtuple( nTupleNo );
......@@ -365,24 +388,3 @@ void AnalysisManager::MakeRPDOpticalTree( G4int nTupleNo, G4int rpdNo ){
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void AnalysisManager::CreateVectors(G4int nZDCs, G4int nRPDs){
//Make a new vector of vectors of pointers to vectors of doubles
m_ZDCdblVec = new std::vector< std::vector< std::vector<double> > >(nZDCs);
m_ZDCintVec = new std::vector< std::vector< std::vector< int > > >(nZDCs);
m_RPDdblVec = new std::vector< std::vector< std::vector<double> > >(nRPDs);
m_RPDintVec = new std::vector< std::vector< std::vector< int > > >(nRPDs);
// Resize to the largest number of branches we will fill from vectors
for(G4int i = 0; i < nZDCs; i++){
m_ZDCdblVec->at(i).resize(10);
m_ZDCintVec->at(i).resize(8);
}//end ZDC loop
for(G4int i = 0; i < nRPDs; i++){
m_RPDdblVec->at(i).resize(10);
m_RPDintVec->at(i).resize(8);
}//end RPD loop
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
......@@ -102,7 +102,7 @@ void EventAction::EndOfEventAction(const G4Event* evt){
analysisManager->FillNtupleDColumn(i,2, pVert->GetY0() );
analysisManager->FillNtupleDColumn(i,3, pVert->GetZ0() );
analysisManager->FillNtupleIColumn(i,0, fEventNo );
analysisManager->FillNtupleIColumn(i,4, fEventNo );
}
//Use our custom class to finish the job
......@@ -249,6 +249,7 @@ void EventAction::ProcessOpticalHitCollection ( FiberHitsCollection* HC ){
//Grab nCherenkovs and skip anything that isn't a photon
if( (*HC)[i]->getParticle() != G4OpticalPhoton::OpticalPhotonDefinition() ){
nCherenkovsSum += nCherenkovs;
nSkipped++;
continue;
}
......@@ -256,6 +257,7 @@ void EventAction::ProcessOpticalHitCollection ( FiberHitsCollection* HC ){
G4ThreeVector position = (*HC)[i]->getPos();
G4int trackID = (*HC)[i]->getTrackID();
if( position.y() < topOfVolume - 0.2*mm || trackID == prevTrackId ){
nSkipped++;
continue;
}
trackID = prevTrackId;
......@@ -265,31 +267,29 @@ void EventAction::ProcessOpticalHitCollection ( FiberHitsCollection* HC ){
G4int rodNo = (*HC)[i]->getRodNb();
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
if( trackID != prevTrackId ){
if( name.compare(0,3,"ZDC") == 0 ){//ZDC hitsCollID, check to be sure/symmetric
int zdcNo = atoi( name.substr(3,1).c_str() );
m_ZDCdblVec->at(zdcNo-1).at(0). push_back( origin.x() );
m_ZDCdblVec->at(zdcNo-1).at(1). push_back( origin.y() );
m_ZDCdblVec->at(zdcNo-1).at(2). push_back( origin.z() );
m_ZDCdblVec->at(zdcNo-1).at(3). push_back( momentum.x() );
m_ZDCdblVec->at(zdcNo-1).at(4). push_back( momentum.y() );
m_ZDCdblVec->at(zdcNo-1).at(5). push_back( momentum.z() );
analysisManager->FillNtupleIColumn( zdcNo, 1, nCherenkovsSum );
m_ZDCintVec->at(zdcNo-1).at(0).push_back( rodNo );
}//end fill ZDC vectors
if( name.compare(0,3,"RPD") == 0 ){//RPD hitsCollID, check to be sure/symmetric
int rpdNo = atoi( name.substr(3,1).c_str() );
m_RPDdblVec->at(rpdNo-1).at(0). push_back( origin.x() );
m_RPDdblVec->at(rpdNo-1).at(1). push_back( origin.y() );
m_RPDdblVec->at(rpdNo-1).at(2). push_back( origin.z() );
m_RPDdblVec->at(rpdNo-1).at(3). push_back( momentum.x() );
m_RPDdblVec->at(rpdNo-1).at(4). push_back( momentum.y() );
m_RPDdblVec->at(rpdNo-1).at(5). push_back( momentum.z() );
analysisManager->FillNtupleIColumn( rpdNo + m_ZDCdblVec->size(), 1, nCherenkovsSum );
m_RPDintVec->at(rpdNo-1).at(0). push_back( rodNo );
}//end fill RPD vectors
}// end if trackID
if( name.compare(0,3,"ZDC") == 0 ){//ZDC hitsCollID, check to be sure/symmetric
int zdcNo = atoi( name.substr(3,1).c_str() );
m_ZDCdblVec->at(zdcNo-1).at(0). push_back( origin.x() );
m_ZDCdblVec->at(zdcNo-1).at(1). push_back( origin.y() );
m_ZDCdblVec->at(zdcNo-1).at(2). push_back( origin.z() );
m_ZDCdblVec->at(zdcNo-1).at(3). push_back( momentum.x() );
m_ZDCdblVec->at(zdcNo-1).at(4). push_back( momentum.y() );
m_ZDCdblVec->at(zdcNo-1).at(5). push_back( momentum.z() );
analysisManager->FillNtupleIColumn( zdcNo, 5, nCherenkovsSum );
m_ZDCintVec->at(zdcNo-1).at(0).push_back( rodNo );
}//end fill ZDC vectors
if( name.compare(0,3,"RPD") == 0 ){//RPD hitsCollID, check to be sure/symmetric
int rpdNo = atoi( name.substr(3,1).c_str() );
m_RPDdblVec->at(rpdNo-1).at(0). push_back( origin.x() );
m_RPDdblVec->at(rpdNo-1).at(1). push_back( origin.y() );
m_RPDdblVec->at(rpdNo-1).at(2). push_back( origin.z() );
m_RPDdblVec->at(rpdNo-1).at(3). push_back( momentum.x() );
m_RPDdblVec->at(rpdNo-1).at(4). push_back( momentum.y() );
m_RPDdblVec->at(rpdNo-1).at(5). push_back( momentum.z() );
analysisManager->FillNtupleIColumn( rpdNo - 1 + m_ZDCdblVec->size() , 5, nCherenkovsSum );
m_RPDintVec->at(rpdNo-1).at(0). push_back( rodNo );
}//end fill RPD vectors
}// end hit loop
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment