diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/CaloHitAna.C b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/CaloHitAna.C deleted file mode 100644 index eb6473568b009f67b68286c7cab8078dc609802b..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/CaloHitAna.C +++ /dev/null @@ -1,529 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#define CaloHitAna_cxx -#include "CaloHitAna.h" -#include <TH2.h> -#include <TStyle.h> -#include <TCanvas.h> -#include "FCS_Cell.h" -#include <iostream> -#include <map> -#include "TSystem.h" - -using namespace std; - -void CaloHitAna::Loop() -{ - //This Loop is supposed to read the output ntuple/tree - //(vector of cells, vector of G4 hits, vector of FCS detailed hits, ...) - //from the athena ISF_HitAnalysis algorithm (==ESD dumper) - //and match them together + save structured output - //NB: E = Ehit * SamplingFraction for Tile or E = Ehit / SamplingFraction (LAr) conversion - //is done here - - if (fChain == 0) return; - ProcInfo_t procinfo; - Long64_t nentries = fChain->GetEntriesFast(); - - if (m_max_nentries >= 0 && m_max_nentries < nentries) nentries = m_max_nentries; - - std::map<Long64_t, FCS_cell> cells; //read all objects and collect them by identifier (Long64_t) - std::map<Long64_t, std::vector<FCS_g4hit> > g4hits; - std::map<Long64_t, std::vector<FCS_hit> > hits; - - FCS_cell one_cell; //note that this is not extra safe if I don't have a clear method! - FCS_g4hit one_g4hit; - FCS_hit one_hit; - FCS_matchedcell one_matchedcell; - //FCS_truth one_truth; - - //From here: Loop over events: - Long64_t nbytes = 0, nb = 0; - std::cout << "before event loop" << std::endl; - for (Long64_t jentry = 0; jentry < nentries; jentry++) - { - if (jentry % 100 == 0) - std::cout << "jentry " << jentry << endl; - - Long64_t ientry = LoadTree(jentry); - if (ientry < 0) break; - nb = fChain->GetEntry(jentry); nbytes += nb; - if (jentry % m_PrintOutFrequency == 0) - { - std::cout << "Processing entry " << jentry << std::endl; - gSystem->GetProcInfo(&procinfo); - std::cout << "Memory usage: " << procinfo.fMemResident << " " << procinfo.fMemVirtual << std::endl; - } - - //Copy truth - new_truthE->clear(); - new_truthPx->clear(); - new_truthPy->clear(); - new_truthPz->clear(); - new_truthPDG->clear(); - new_truthBarcode->clear(); - new_truthVtxBarcode->clear(); - //truthcollection->clear(); - m_newTTC_entrance_eta->clear(); - m_newTTC_entrance_phi->clear(); - m_newTTC_entrance_r->clear(); - m_newTTC_entrance_z->clear(); - m_newTTC_back_eta->clear(); - m_newTTC_back_phi->clear(); - m_newTTC_back_r->clear(); - m_newTTC_back_z->clear(); - m_newTTC_mid_eta->clear(); - m_newTTC_mid_phi->clear(); - m_newTTC_mid_r->clear(); - m_newTTC_mid_z->clear(); - m_newTTC_IDCaloBoundary_eta->clear(); - m_newTTC_IDCaloBoundary_phi->clear(); - m_newTTC_IDCaloBoundary_r->clear(); - m_newTTC_IDCaloBoundary_z->clear(); - m_newTTC_Angle3D->clear(); - m_newTTC_AngleEta->clear(); - - oneeventcells->m_vector.clear(); - - if (TruthE->size() != 1) - std::cout << "Strange! TruthE->size() is " << TruthE->size() << ", but it should be 1. Please check input." << std::endl; - - for (unsigned int truth_i = 0; truth_i < TruthE->size(); truth_i++) - { - //std::cout <<truth_i<<" "<<TruthE->size()<<" "<<TruthPDG->at(truth_i)<<std::endl; - //std::cout <<"TTC2: "<<(*TTC_entrance_eta)[truth_i].size()<<std::endl;//this one has 24 layers ->ok - - new_truthE->push_back(TruthE->at(truth_i)); - new_truthPx->push_back(TruthPx->at(truth_i)); - new_truthPy->push_back(TruthPy->at(truth_i)); - new_truthPz->push_back(TruthPz->at(truth_i)); - new_truthPDG->push_back(TruthPDG->at(truth_i)); - new_truthBarcode->push_back(TruthBarcode->at(truth_i)); - //new_truthVtxBarcode->push_back(TruthVtxBarcode->at(truth_i)); - - m_newTTC_IDCaloBoundary_eta->push_back(newTTC_IDCaloBoundary_eta->at(truth_i)); - m_newTTC_IDCaloBoundary_phi->push_back(newTTC_IDCaloBoundary_phi->at(truth_i)); - m_newTTC_IDCaloBoundary_r ->push_back(newTTC_IDCaloBoundary_r->at(truth_i)); - m_newTTC_IDCaloBoundary_z ->push_back(newTTC_IDCaloBoundary_z->at(truth_i)); - m_newTTC_Angle3D ->push_back(newTTC_Angle3D->at(truth_i)); - m_newTTC_AngleEta ->push_back(newTTC_AngleEta->at(truth_i)); - - //create temporary vectors - vector<float> new_entrance_eta; - vector<float> new_entrance_phi; - vector<float> new_entrance_r; - vector<float> new_entrance_z; - vector<float> new_back_eta; - vector<float> new_back_phi; - vector<float> new_back_r; - vector<float> new_back_z; - vector<float> new_mid_eta; - vector<float> new_mid_phi; - vector<float> new_mid_r; - vector<float> new_mid_z; - - for (unsigned int s = 0; s < 24; s++) - { - new_entrance_eta.push_back((newTTC_entrance_eta->at(truth_i))[s]); - new_entrance_phi.push_back((newTTC_entrance_phi->at(truth_i))[s]); - new_entrance_r.push_back((newTTC_entrance_r->at(truth_i))[s]); - new_entrance_z.push_back((newTTC_entrance_z->at(truth_i))[s]); - new_back_eta.push_back((newTTC_back_eta->at(truth_i))[s]); - new_back_phi.push_back((newTTC_back_phi->at(truth_i))[s]); - new_back_r.push_back((newTTC_back_r->at(truth_i))[s]); - new_back_z.push_back((newTTC_back_z->at(truth_i))[s]); - new_mid_eta.push_back((newTTC_mid_eta->at(truth_i))[s]); - new_mid_phi.push_back((newTTC_mid_phi->at(truth_i))[s]); - new_mid_r.push_back((newTTC_mid_r->at(truth_i))[s]); - new_mid_z.push_back((newTTC_mid_z->at(truth_i))[s]); - } - - //push back temporary vectors - m_newTTC_entrance_eta->push_back(new_entrance_eta); - m_newTTC_entrance_phi->push_back(new_entrance_phi); - m_newTTC_entrance_r->push_back(new_entrance_r); - m_newTTC_entrance_z->push_back(new_entrance_z); - m_newTTC_back_eta->push_back(new_back_eta); - m_newTTC_back_phi->push_back(new_back_phi); - m_newTTC_back_r->push_back(new_back_r); - m_newTTC_back_z->push_back(new_back_z); - m_newTTC_mid_eta->push_back(new_mid_eta); - m_newTTC_mid_phi->push_back(new_mid_phi); - m_newTTC_mid_r->push_back(new_mid_r); - m_newTTC_mid_z->push_back(new_mid_z); - - - /* - one_truth.SetPxPyPzE((*TruthPx)[truth_i], (*TruthPy)[truth_i], (*TruthPz)[truth_i], (*TruthE)[truth_i]); - one_truth.pdgid = TruthPDG->at(truth_i); - one_truth.barcode = TruthBarcode->at(truth_i); - one_truth.vtxbarcode = TruthVtxBarcode->at(truth_i); - truthcollection->push_back(one_truth); - */ - - } - - //std::cout<<"check. after truth block"<<std::endl; - - //Now matching between cells, G4hits and G4detailed hits - //sort cells by identifier: - //clear first the containers for this event: - cells.clear(); - g4hits.clear(); - hits.clear(); - //std::cout <<"Check Original size: Cells: "<<CellIdentifier->size()<<" G4Hits: "<<G4HitCellIdentifier->size()<<" FCSHits: "<<HitCellIdentifier->size()<<std::endl; - if (m_Debug > 1) std::cout << "Reading cells..."; - - for (unsigned int cell_i = 0; cell_i < CellIdentifier->size(); cell_i++) - { - if (cells.find((*CellIdentifier)[cell_i]) == cells.end()) //doesn't exist - { - one_cell.cell_identifier = (*CellIdentifier)[cell_i]; - one_cell.sampling = (*CellSampling)[cell_i]; - one_cell.energy = (*CellE)[cell_i]; - one_cell.center_x = 0.0; //for now - one_cell.center_y = 0.0; - one_cell.center_z = 0.0; - cells.insert(std::pair<Long64_t, FCS_cell>(one_cell.cell_identifier, one_cell)); - } - else - { - //there shouldn't be a cell with the same identifier in this event - std::cout << "ISF_HitAnalysis: Same cell???? ERROR" << std::endl; - } - } - - if (m_Debug > 1) std::cout << " Done" << std::endl; - - if (m_Debug > 1) std::cout << "Reading G4hits"; - - if (m_do_g4_hits) - { - for (unsigned int g4hit_i = 0; g4hit_i < G4HitIdentifier->size(); g4hit_i++) - { - if ((*G4HitSampling)[g4hit_i] >= 0 && (*G4HitSampling)[g4hit_i] <= 25 && (*G4HitT)[g4hit_i] > m_TimingCut) - { - if (m_Debug > 1) std::cout << "Ignoring G4hit, time too large: " << g4hit_i << " time: " << (*G4HitT)[g4hit_i] << std::endl; - continue; - } - - if (g4hits.find((*G4HitCellIdentifier)[g4hit_i]) == g4hits.end()) - { - //this G4 hit doesn't exist yet - one_g4hit.identifier = (*G4HitIdentifier)[g4hit_i]; - one_g4hit.cell_identifier = (*G4HitCellIdentifier)[g4hit_i]; - one_g4hit.sampling = (*G4HitSampling)[g4hit_i]; - one_g4hit.hit_time = (*G4HitT)[g4hit_i]; - //one_g4hit.hit_energy = (*G4HitE)[g4hit_i]; - //scale the hit energy with the sampling fraction - if (one_g4hit.sampling >= 12 && one_g4hit.sampling <= 20) - { //tile - //std::cout <<"Tile: "<<(*G4HitE)[g4hit_i]<<" "<<(*G4HitSamplingFraction)[g4hit_i]<<std::endl; - if ((*G4HitSamplingFraction)[g4hit_i]) - { - one_g4hit.hit_energy = (*G4HitE)[g4hit_i] * (*G4HitSamplingFraction)[g4hit_i]; - //std::cout <<"TileE: "<<one_g4hit.hit_energy<<std::endl; - } - else one_g4hit.hit_energy = 0.; - } - else - { - //std::cout <<"LAr: "<<(*G4HitE)[g4hit_i]<<" "<<(*G4HitSamplingFraction)[g4hit_i]<<std::endl; - one_g4hit.hit_energy = (*G4HitE)[g4hit_i] / (*G4HitSamplingFraction)[g4hit_i]; - } - //one_g4hit.hit_sampfrac = (*G4HitSamplingFraction)[g4hit_i]; - //new g4hit -> insert vector with 1 element - g4hits.insert(std::pair<Long64_t, std::vector<FCS_g4hit> >(one_g4hit.cell_identifier, std::vector<FCS_g4hit>(1, one_g4hit))); - } - else - { - //G4 hit exists in this identifier -> push_back new to the vector //FCS_g4hit one_g4hit; - one_g4hit.identifier = (*G4HitIdentifier)[g4hit_i]; - one_g4hit.cell_identifier = (*G4HitCellIdentifier)[g4hit_i]; - one_g4hit.sampling = (*G4HitSampling)[g4hit_i]; - one_g4hit.hit_time = (*G4HitT)[g4hit_i]; - if (one_g4hit.sampling >= 12 && one_g4hit.sampling <= 20) - { //tile - //std::cout <<"Tile2: "<<(*G4HitE)[g4hit_i]<<" "<<(*G4HitSamplingFraction)[g4hit_i]<<std::endl; - if ((*G4HitSamplingFraction)[g4hit_i]) - { - one_g4hit.hit_energy = (*G4HitE)[g4hit_i] * (*G4HitSamplingFraction)[g4hit_i]; - //std::cout <<"TileE2: "<<one_g4hit.hit_energy<<std::endl; - } - else one_g4hit.hit_energy = 0.; - } - else - { - //std::cout <<"LAr2: "<<(*G4HitE)[g4hit_i]<<" "<<(*G4HitSamplingFraction)[g4hit_i]<<std::endl; - one_g4hit.hit_energy = (*G4HitE)[g4hit_i] / (*G4HitSamplingFraction)[g4hit_i]; - } - //one_g4hit.hit_sampfrac = (*G4HitSamplingFraction)[g4hit_i]; - g4hits[(*G4HitCellIdentifier)[g4hit_i]].push_back(one_g4hit); - } - } - } - - if (m_Debug > 1) std::cout << " Done" << std::endl; - - if (m_Debug > 1) std::cout << "Reading detailed FCS hits " << HitIdentifier->size() << std::endl; - - for (unsigned int hit_i = 0; hit_i < HitIdentifier->size(); hit_i++) - { - if ((*HitSampling)[hit_i] >= 0 && (*HitSampling)[hit_i] <= 25 && (*HitT)[hit_i] > m_TimingCut) - { - if (m_Debug > 1) - std::cout << "Ignoring FCS hit, time too large: " << hit_i << " time: " << (*HitT)[hit_i] << std::endl; - continue; - } - if (hits.find((*HitCellIdentifier)[hit_i]) == hits.end()) - { - //Detailed hit doesn't exist yet - one_hit.identifier = (*HitIdentifier)[hit_i]; - one_hit.cell_identifier = (*HitCellIdentifier)[hit_i]; - one_hit.sampling = (*HitSampling)[hit_i]; - - if (one_hit.sampling >= 12 && one_hit.sampling <= 20) - { //tile - if ((*HitSamplingFraction)[hit_i]) - { - one_hit.hit_energy = (*HitE)[hit_i] * (*HitSamplingFraction)[hit_i]; - } - else one_hit.hit_energy = 0.; - } - else - { - one_hit.hit_energy = (*HitE)[hit_i] / (*HitSamplingFraction)[hit_i]; - } - //one_hit.hit_sampfrac = (*HitSamplingFraction)[hit_i]; - one_hit.hit_time = (*HitT)[hit_i]; - one_hit.hit_x = (*HitX)[hit_i]; - one_hit.hit_y = (*HitY)[hit_i]; - one_hit.hit_z = (*HitZ)[hit_i]; - hits.insert(std::pair<Long64_t, std::vector<FCS_hit> >(one_hit.cell_identifier, std::vector<FCS_hit>(1, one_hit))); - } - else - { - //Detailed hit exists in this identifier -> push_back new to the vector - one_hit.identifier = (*HitIdentifier)[hit_i]; - one_hit.cell_identifier = (*HitCellIdentifier)[hit_i]; - one_hit.sampling = (*HitSampling)[hit_i]; - //one_hit.hit_energy = (*HitE)[hit_i]; - if (one_hit.sampling >= 12 && one_hit.sampling <= 20) - { //tile - if ((*HitSamplingFraction)[hit_i]) - { - one_hit.hit_energy = (*HitE)[hit_i] * (*HitSamplingFraction)[hit_i]; - } - else one_hit.hit_energy = 0.; - } - else - { - one_hit.hit_energy = (*HitE)[hit_i] / (*HitSamplingFraction)[hit_i]; - } - //one_hit.hit_sampfrac = (*HitSamplingFraction)[hit_i]; - one_hit.hit_time = (*HitT)[hit_i]; - one_hit.hit_x = (*HitX)[hit_i]; - one_hit.hit_y = (*HitY)[hit_i]; - one_hit.hit_z = (*HitZ)[hit_i]; - hits[(*HitCellIdentifier)[hit_i]].push_back(one_hit); - } - } - - if (m_Debug > 1) std::cout << " Done" << std::endl; - - if (m_Debug > 1) std::cout << "ISF_HitAnalysis Check: Cells: " << cells.size() << " G4hits: " << g4hits.size() << " FCS detailed hits: " << hits.size() << std::endl; - - //Start matching: - Int_t iindex = 0; - for (std::map<Long64_t, FCS_cell>::iterator it = cells.begin(); it != cells.end(); ) - { - iindex++; - // std::cout <<iindex<<std::endl; - one_matchedcell.clear(); //maybe not completely necessery, as we're not pushing_back into vectors - //set the cell part - one_matchedcell.cell = it->second; - //now look for FCS detailed hits in this cell - std::map<Long64_t, std::vector<FCS_hit> >::iterator it2 = hits.find(it->first); - if (it2 != hits.end()) - { - //std::cout <<"FCS hits found in this cell"<<std::endl; - one_matchedcell.hit = it2->second; - hits.erase(it2); //remove it - } - else - { - //no hit found for this cell - one_matchedcell.hit.clear(); //important! - } - //now look for G4hits in this cell - std::map<Long64_t, std::vector<FCS_g4hit> >::iterator it3 = g4hits.find(it->first); - if (it3 != g4hits.end()) - { - //std::cout <<"G4 hits found in this cell"<<std::endl; - one_matchedcell.g4hit = it3->second; - g4hits.erase(it3); - } - else - { - //no g4hit found for this cell - one_matchedcell.g4hit.clear();//important! - } - //std::cout <<"Erase cell"<<std::endl; - cells.erase(it++); - //std::cout <<"Insert matched object"<<std::endl; - //push_back matched cell for event jentry - oneeventcells->push_back(one_matchedcell); - //std::cout <<"Go next"<<std::endl; - - } - - //ok, cells should be empty, what about hits and g4hits? - //There could be G4hits/FCS hits for which we don't have a cell ->create a dummy empty cell with 0 energy, take the cell identifier from the hit - if (m_Debug > 1) std::cout << "ISF_HitAnalysis Check after cells: " << cells.size() << " " << g4hits.size() << " " << hits.size() << std::endl; - - for (std::map<Long64_t, std::vector<FCS_hit> >::iterator it = hits.begin(); it != hits.end();) - { - one_matchedcell.clear(); - one_matchedcell.cell.cell_identifier = it->first; - //std::cout <<"This hit didn't exist in cell: "<<it->first<<std::endl; - if (it->second.size()) - { - one_matchedcell.cell.sampling = (it->second)[0].sampling; - } - else - { - one_matchedcell.cell.sampling = -1; // - //ok, but you really shouldn't be here - std::cout << "ERROR: You shouldn't really be here" << std::endl; - } - one_matchedcell.cell.energy = 0.; - one_matchedcell.cell.center_x = 0.0; - one_matchedcell.cell.center_y = 0.0; - one_matchedcell.cell.center_z = 0.0; - one_matchedcell.hit = it->second; - std::map<Long64_t, std::vector<FCS_g4hit> >::iterator it3 = g4hits.find(it->first); - if (it3 != g4hits.end()) - { - one_matchedcell.g4hit = it3->second; - g4hits.erase(it3); - } - else - { - //no g4hit found for this cell - one_matchedcell.g4hit.clear(); //important! - } - hits.erase(it++); - oneeventcells->push_back(one_matchedcell); - - } - - //ok, hits should be empty, what about g4hits? - if (m_Debug > 1 )std::cout << "ISF_HitAnalysis Check after hits: " << cells.size() << " " << g4hits.size() << " " << hits.size() << std::endl; - for (std::map<Long64_t, std::vector<FCS_g4hit> >::iterator it = g4hits.begin(); it != g4hits.end();) - { - one_matchedcell.clear(); //maybe not so important - one_matchedcell.cell.cell_identifier = it->first; - if (it->second.size()) - { - one_matchedcell.cell.sampling = (it->second)[0].sampling; - } - else - { - one_matchedcell.cell.sampling = -1; // - //not really - std::cout << "ERROR: You shouldn't really be here" << std::endl; - } - one_matchedcell.cell.energy = 0.; - one_matchedcell.cell.center_x = 0.0; - one_matchedcell.cell.center_y = 0.0; - one_matchedcell.cell.center_z = 0.0; - one_matchedcell.g4hit = it->second; - one_matchedcell.hit.clear(); //important!! - g4hits.erase(it++); - oneeventcells->push_back(one_matchedcell); - } - - if (m_Debug > 1) std::cout << "ISF_HitAnalysis Check after g4hits: " << cells.size() << " " << g4hits.size() << " " << hits.size() << std::endl; - //Final size for this event - if (m_Debug > 1) std::cout << "ISF_HitAnalysis Matched cells size: " << oneeventcells->size() << std::endl; - - //Can fill the output tree already here: - total_cell_e = 0; - total_hit_e = 0; - total_g4hit_e = 0; - - for (int j = 0; j < MAX_LAYER - 1; j++) - { - layercells[j]->m_vector = oneeventcells->GetLayer(j); - } - - //this is for invalid cells - layercells[MAX_LAYER - 1]->m_vector = oneeventcells->GetLayer(-1); - - for (int i = 0; i < MAX_LAYER; i++) - { - cell_energy->at(i) = 0.0; //zero for each event! - hit_energy->at(i) = 0.0; - g4hit_energy->at(i) = 0.0; - - for (unsigned int cellindex = 0; cellindex < layercells[i]->size(); cellindex++) - { - if (i != MAX_LAYER - 1) - { - cell_energy->at(i) += layercells[i]->m_vector.at(cellindex).cell.energy; - total_cell_e += layercells[i]->m_vector.at(cellindex).cell.energy; - } - else - { - //don't add the energy in the invalid layer to the total energy (if there is any (shouldn't) - cell_energy->at(i) += layercells[i]->m_vector.at(cellindex).cell.energy; //this should be here anyway - } - - //sum energy of all FCS detailed hits in this layer/cell - for (unsigned int j = 0; j < layercells[i]->m_vector.at(cellindex).hit.size(); j++) - { - if (i != MAX_LAYER - 1) - { - total_hit_e += layercells[i]->m_vector.at(cellindex).hit[j].hit_energy; - hit_energy->at(i) += layercells[i]->m_vector.at(cellindex).hit[j].hit_energy; - } - else - { - //again, don't add invalid layer energy to the sum - hit_energy->at(i) += layercells[i]->m_vector.at(cellindex).hit[j].hit_energy; - } - } - - //sum energy of all G4 hits in this layer/cell - for (unsigned int j = 0; j < layercells[i]->m_vector.at(cellindex).g4hit.size(); j++) - { - if (i != MAX_LAYER - 1) - { - total_g4hit_e += layercells[i]->m_vector.at(cellindex).g4hit[j].hit_energy; - g4hit_energy->at(i) += layercells[i]->m_vector.at(cellindex).g4hit[j].hit_energy; - } - else - { - //don't add invalied layer energy to the sum - g4hit_energy->at(i) += layercells[i]->m_vector.at(cellindex).g4hit[j].hit_energy; - } - } - } - } - - cell_energy->at(MAX_LAYER) = total_cell_e; - hit_energy->at(MAX_LAYER) = total_hit_e; - g4hit_energy->at(MAX_LAYER) = total_g4hit_e; - - //Uncomment this to get energy cross check - if (jentry % m_PrintOutFrequency == 0) std::cout << "Energy check: event: " << jentry << " cell: " << total_cell_e << " g4hits: " << total_g4hit_e << " hits: " << total_hit_e << std::endl; - //tree gets filled - m_OutputTree->Fill(); - - }//loop over entries - - m_OutputTree->Write(); - m_Output->Close(); -}; diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/CaloHitAna.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/CaloHitAna.h deleted file mode 100644 index 7af0d141ca9955f74a1e7fa65eed93320ee4ecf1..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/CaloHitAna.h +++ /dev/null @@ -1,521 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -////////////////////////////////////////////////////////// -// This class has been automatically generated on -// Fri May 2 18:25:08 2014 by ROOT version 5.34/05 -// from TTree CaloHitAna/CaloHitAna -// found on file: ISF_HitAnalysispion_eta1_020514.root -////////////////////////////////////////////////////////// - -#ifndef CaloHitAna_h -#define CaloHitAna_h - -#include <TROOT.h> -#include <TChain.h> -#include <TFile.h> - -// Header file for the classes stored in the TTree if any. -#include <vector> -#include <FCS_Cell.h> - -#include <iostream> - -class CaloHitAna -{ -public : - TTree *fChain; //!pointer to the analyzed TTree or TChain - Int_t fCurrent; //!current Tree number in a TChain - TString fFilename; - - //output structure - TFile *m_Output; - TString m_OutputName; - TTree *m_OutputTree; - std::vector<Int_t> m_Settings; - Float_t m_TimingCut; - Int_t m_Debug; - Int_t m_PrintOutFrequency; - Int_t m_max_nentries; - bool m_do_g4_hits = false; - - const static int MAX_LAYER = 25; - - // Declaration of leaf types - std::vector<float> *HitX; - std::vector<float> *HitY; - std::vector<float> *HitZ; - std::vector<float> *HitE; - std::vector<float> *HitT; - std::vector<Long64_t> *HitIdentifier; - std::vector<Long64_t> *HitCellIdentifier; - std::vector<bool> *HitIsLArBarrel; - std::vector<bool> *HitIsLArEndCap; - std::vector<bool> *HitIsHEC; - std::vector<bool> *HitIsFCAL; - std::vector<bool> *HitIsTile; - std::vector<int> *HitSampling; - std::vector<float> *HitSamplingFraction; - std::vector<float> *TruthE; - std::vector<float> *TruthPx; - std::vector<float> *TruthPy; - std::vector<float> *TruthPz; - std::vector<int> *TruthPDG; - std::vector<int> *TruthBarcode; - std::vector<int> *TruthVtxBarcode; - std::vector<Long64_t> *CellIdentifier; - std::vector<float> *CellE; - std::vector<int> *CellSampling; - std::vector<float> *G4HitE; - std::vector<float> *G4HitT; - std::vector<Long64_t> *G4HitIdentifier; - std::vector<Long64_t> *G4HitCellIdentifier; - std::vector<float> *G4HitSamplingFraction; - std::vector<int> *G4HitSampling; - - //input (from is hit analysis ntuple): - std::vector<std::vector<float> >* newTTC_entrance_eta; - std::vector<std::vector<float> >* newTTC_entrance_phi; - std::vector<std::vector<float> >* newTTC_entrance_r; - std::vector<std::vector<float> >* newTTC_entrance_z; - std::vector<std::vector<float> >* newTTC_back_eta; - std::vector<std::vector<float> >* newTTC_back_phi; - std::vector<std::vector<float> >* newTTC_back_r; - std::vector<std::vector<float> >* newTTC_back_z; - std::vector<std::vector<float> >* newTTC_mid_eta; - std::vector<std::vector<float> >* newTTC_mid_phi; - std::vector<std::vector<float> >* newTTC_mid_r; - std::vector<std::vector<float> >* newTTC_mid_z; - std::vector<float>* newTTC_IDCaloBoundary_eta; - std::vector<float>* newTTC_IDCaloBoundary_phi; - std::vector<float>* newTTC_IDCaloBoundary_r; - std::vector<float>* newTTC_IDCaloBoundary_z; - std::vector<float>* newTTC_Angle3D; - std::vector<float>* newTTC_AngleEta; - - //output: - std::vector<std::vector<float> >* m_newTTC_entrance_eta = new std::vector<std::vector<float>>; - std::vector<std::vector<float> >* m_newTTC_entrance_phi = new std::vector<std::vector<float>>; - std::vector<std::vector<float> >* m_newTTC_entrance_r = new std::vector<std::vector<float>>; - std::vector<std::vector<float> >* m_newTTC_entrance_z = new std::vector<std::vector<float>>; - std::vector<std::vector<float> >* m_newTTC_back_eta = new std::vector<std::vector<float>>; - std::vector<std::vector<float> >* m_newTTC_back_phi = new std::vector<std::vector<float>>; - std::vector<std::vector<float> >* m_newTTC_back_r = new std::vector<std::vector<float>>; - std::vector<std::vector<float> >* m_newTTC_back_z = new std::vector<std::vector<float>>; - std::vector<std::vector<float> >* m_newTTC_mid_eta = new std::vector<std::vector<float>>; - std::vector<std::vector<float> >* m_newTTC_mid_phi = new std::vector<std::vector<float>>; - std::vector<std::vector<float> >* m_newTTC_mid_r = new std::vector<std::vector<float>>; - std::vector<std::vector<float> >* m_newTTC_mid_z = new std::vector<std::vector<float>>; - std::vector<float>* m_newTTC_IDCaloBoundary_eta = new std::vector<float>; - std::vector<float>* m_newTTC_IDCaloBoundary_phi = new std::vector<float>; - std::vector<float>* m_newTTC_IDCaloBoundary_r = new std::vector<float>; - std::vector<float>* m_newTTC_IDCaloBoundary_z = new std::vector<float>; - std::vector<float>* m_newTTC_Angle3D = new std::vector<float>; - std::vector<float>* m_newTTC_AngleEta = new std::vector<float>; - - FCS_matchedcellvector* oneeventcells = new FCS_matchedcellvector; //these are all matched cells in a single event - FCS_matchedcellvector* layercells[MAX_LAYER]; //these are all matched cells in a given layer in a given event - - std::vector<FCS_truth>* truthcollection = new std::vector<FCS_truth>; - - Float_t total_cell_e = 0; - Float_t total_hit_e = 0; - Float_t total_g4hit_e = 0; - - std::vector<Float_t>* cell_energy = new std::vector<Float_t>(MAX_LAYER + 1); - std::vector<Float_t>* hit_energy = new std::vector<Float_t>(MAX_LAYER + 1); - std::vector<Float_t>* g4hit_energy = new std::vector<Float_t>(MAX_LAYER + 1); - - std::vector<Float_t>* new_truthE = new std::vector<Float_t>; - std::vector<Float_t>* new_truthPx = new std::vector<Float_t>; - std::vector<Float_t>* new_truthPy = new std::vector<Float_t>; - std::vector<Float_t>* new_truthPz = new std::vector<Float_t>; - std::vector<int>* new_truthBarcode = new std::vector<int>; - std::vector<int>* new_truthPDG = new std::vector<int>; - std::vector<int>* new_truthVtxBarcode = new std::vector<int>; - - // List of branches - TBranch *b_HitX; //! - TBranch *b_HitY; //! - TBranch *b_HitZ; //! - TBranch *b_HitE; //! - TBranch *b_HitT; //! - TBranch *b_HitIdentifier; //! - TBranch *b_HitCellIdentifier; //! - TBranch *b_HitIsLArBarrel; //! - TBranch *b_HitIsLArEndCap; //! - TBranch *b_HitIsHEC; //! - TBranch *b_HitIsFCAL; //! - TBranch *b_HitIsTile; //! - TBranch *b_HitSampling; //! - TBranch *b_HitSamplingFraction; //! - TBranch *b_TruthE; //! - TBranch *b_TruthPx; //! - TBranch *b_TruthPy; //! - TBranch *b_TruthPz; //! - TBranch *b_TruthPDG; //! - TBranch *b_TruthBarcode; //! - TBranch *b_TruthVtxBarcode; //! - TBranch *b_CellIdentifier; //! - TBranch *b_CellE; //! - TBranch *b_CellSampling; //! - TBranch *b_G4HitE; //! - TBranch *b_G4HitT; //! - TBranch *b_G4HitIdentifier; //! - TBranch *b_G4HitCellIdentifier; //! - TBranch *b_G4HitSamplingFraction; //! - TBranch *b_G4HitSampling; //! - /* - TBranch *b_TTC_back_eta; //! - TBranch *b_TTC_back_phi; //! - TBranch *b_TTC_back_r; //! - TBranch *b_TTC_back_z; //! - TBranch *b_TTC_entrance_eta; //! - TBranch *b_TTC_entrance_phi; //! - TBranch *b_TTC_entrance_r; //! - TBranch *b_TTC_entrance_z; //! - TBranch *b_TTC_IDCaloBoundary_eta; //! - TBranch *b_TTC_IDCaloBoundary_phi; //! - TBranch *b_TTC_IDCaloBoundary_r; //! - TBranch *b_TTC_IDCaloBoundary_z; //! - TBranch *b_TTC_Angle3D; //! - TBranch *b_TTC_AngleEta; //! - */ - - TBranch *b_newTTC_back_eta; //! - TBranch *b_newTTC_back_phi; //! - TBranch *b_newTTC_back_r; //! - TBranch *b_newTTC_back_z; //! - TBranch *b_newTTC_entrance_eta; //! - TBranch *b_newTTC_entrance_phi; //! - TBranch *b_newTTC_entrance_r; //! - TBranch *b_newTTC_entrance_z; //! - TBranch *b_newTTC_mid_eta; //! - TBranch *b_newTTC_mid_phi; //! - TBranch *b_newTTC_mid_r; //! - TBranch *b_newTTC_mid_z; //! - TBranch *b_newTTC_IDCaloBoundary_eta; //! - TBranch *b_newTTC_IDCaloBoundary_phi; //! - TBranch *b_newTTC_IDCaloBoundary_r; //! - TBranch *b_newTTC_IDCaloBoundary_z; //! - TBranch *b_newTTC_Angle3D; //! - TBranch *b_newTTC_AngleEta; //! - - - CaloHitAna(TString filename = "ISF_HitAnalysispion_eta1.root", TString outputname = "output1.root", std::vector<Int_t> settings = std::vector<Int_t>(), Float_t timingcut = 999999., Int_t debug = 0, TTree *tree = 0); - virtual ~CaloHitAna(); - virtual Int_t Cut(Long64_t entry); - virtual Int_t GetEntry(Long64_t entry); - virtual Long64_t LoadTree(Long64_t entry); - virtual void Init(TTree *tree); - virtual void InitOutTree(); - virtual void Loop(); - virtual Bool_t Notify(); - virtual void Show(Long64_t entry = -1); - - void SetDebug(Int_t debug = 0) {m_Debug = debug;}; - void SetTimingCut(Int_t timingcut = 999999) {m_TimingCut = timingcut;}; - void SetDoAllCells(Int_t doit = 0) {if (m_Settings.size() < 1) m_Settings.resize(1, 0); m_Settings[0] = doit;}; - void SetDoLayers(Int_t doit = 0) {if (m_Settings.size() < 2) m_Settings.resize(2, 0); m_Settings[1] = doit;}; - void SetDoLayerSums(Int_t doit = 0) {if (m_Settings.size() < 3) m_Settings.resize(3, 0); m_Settings[2] = doit;}; -}; - -#endif - -#ifdef CaloHitAna_cxx -CaloHitAna::CaloHitAna(TString filename, TString outputname, std::vector<Int_t> settings, Float_t timingcut, Int_t debug, TTree *tree) : fChain(0) -{ - fFilename = filename; - // if parameter tree is not specified (or zero), connect the file - // used to generate this class and read the Tree. - if (tree == 0) { - TFile *f = TFile::Open(filename, "READ"); - TString dirname = filename; - dirname += ":/ISF_HitAnalysis"; - TDirectory * dir = (TDirectory*)f->Get(dirname); - dir->GetObject("CaloHitAna", tree); - } - Init(tree); - m_Settings = settings; - m_Debug = debug; - m_TimingCut = timingcut; - m_OutputName = outputname; - m_PrintOutFrequency = 100; - m_max_nentries = -1; - m_Output = new TFile(m_OutputName, "RECREATE"); - m_OutputTree = new TTree("FCS_ParametrizationInput", "Output_Matched_cell_Tree"); - InitOutTree(); -} - -CaloHitAna::~CaloHitAna() -{ - // if (m_OutputTree) delete m_OutputTree; - // if (m_Output) delete m_Output; - if (!fChain) return; - delete fChain->GetCurrentFile(); -} - -Int_t CaloHitAna::GetEntry(Long64_t entry) -{ - // Read contents of entry. - if (!fChain) return 0; - return fChain->GetEntry(entry); -} -Long64_t CaloHitAna::LoadTree(Long64_t entry) -{ - // Set the environment to read one entry - if (!fChain) return -5; - Long64_t centry = fChain->LoadTree(entry); - if (centry < 0) return centry; - if (fChain->GetTreeNumber() != fCurrent) { - fCurrent = fChain->GetTreeNumber(); - Notify(); - } - return centry; -} - -void CaloHitAna::InitOutTree() -{ - m_OutputTree->Branch("TruthE", &new_truthE); - m_OutputTree->Branch("TruthPx", &new_truthPx); - m_OutputTree->Branch("TruthPy", &new_truthPy); - m_OutputTree->Branch("TruthPz", &new_truthPz); - m_OutputTree->Branch("TruthPDG", &new_truthPDG); - m_OutputTree->Branch("TruthBarcode", &new_truthBarcode); - m_OutputTree->Branch("TruthVtxBarcode", &new_truthVtxBarcode); //this is duplicate of what is in the truth collection, will be good to remove/hide at some point - - m_OutputTree->Branch("newTTC_back_eta", &m_newTTC_back_eta); - m_OutputTree->Branch("newTTC_back_phi", &m_newTTC_back_phi); - m_OutputTree->Branch("newTTC_back_r", &m_newTTC_back_r); - m_OutputTree->Branch("newTTC_back_z", &m_newTTC_back_z); - m_OutputTree->Branch("newTTC_entrance_eta", &m_newTTC_entrance_eta); - m_OutputTree->Branch("newTTC_entrance_phi", &m_newTTC_entrance_phi); - m_OutputTree->Branch("newTTC_entrance_r", &m_newTTC_entrance_r); - m_OutputTree->Branch("newTTC_entrance_z", &m_newTTC_entrance_z); - m_OutputTree->Branch("newTTC_mid_eta", &m_newTTC_mid_eta); - m_OutputTree->Branch("newTTC_mid_phi", &m_newTTC_mid_phi); - m_OutputTree->Branch("newTTC_mid_r", &m_newTTC_mid_r); - m_OutputTree->Branch("newTTC_mid_z", &m_newTTC_mid_z); - m_OutputTree->Branch("newTTC_IDCaloBoundary_eta", &m_newTTC_IDCaloBoundary_eta); - m_OutputTree->Branch("newTTC_IDCaloBoundary_phi", &m_newTTC_IDCaloBoundary_phi); - m_OutputTree->Branch("newTTC_IDCaloBoundary_r", &m_newTTC_IDCaloBoundary_r); - m_OutputTree->Branch("newTTC_IDCaloBoundary_z", &m_newTTC_IDCaloBoundary_z); - m_OutputTree->Branch("newTTC_Angle3D", &m_newTTC_Angle3D); - m_OutputTree->Branch("newTTC_AngleEta", &m_newTTC_AngleEta); - - //create branches in the output tree according to the settings vector - if (! m_Settings.size() || m_Settings[0] == 1) - { - //Write all FCS_matchedcells - m_OutputTree->Branch("AllCells", &oneeventcells); - } - if (m_Settings.size() >= 2 && m_Settings[1] == 1) - { - //write cells per layer - for (Int_t i = 0; i < MAX_LAYER; i++) - { - TString branchname = "Sampling_"; - branchname += i; - // std::cout<< "fail?" << std::endl; - layercells[i] = new FCS_matchedcellvector; - m_OutputTree->Branch(branchname, &layercells[i]); - } - } - if (m_Settings.size() >= 3 && m_Settings[2] == 1) - { - //write also energies per layer: - m_OutputTree->Branch("cell_energy", &cell_energy); - m_OutputTree->Branch("hit_energy", &hit_energy); - m_OutputTree->Branch("g4hit_energy", &g4hit_energy); - - //This is a duplicate of cell_energy[25] - m_OutputTree->Branch("total_cell_energy", &total_cell_e); - m_OutputTree->Branch("total_hit_energy", &total_hit_e); - m_OutputTree->Branch("total_g4hit_energy", &total_g4hit_e); - } - // Enable/Disable recording of g4hits - if (m_Settings.size() >= 4 && m_Settings[3] == 1) { - std::cout << "do g4hits!" << std::endl; - m_do_g4_hits = true; - } -} - -void CaloHitAna::Init(TTree *tree) -{ - // The Init() function is called when the selector needs to initialize - // a new tree or chain. Typically here the branch addresses and branch - // pointers of the tree will be set. - // It is normally not necessary to make changes to the generated - // code, but the routine can be extended by the user if needed. - // Init() will be called many times when running on PROOF - // (once per file to be processed). - - // Set object pointer - HitX = 0; - HitY = 0; - HitZ = 0; - HitE = 0; - HitT = 0; - HitIdentifier = 0; - HitCellIdentifier = 0; - HitIsLArBarrel = 0; - HitIsLArEndCap = 0; - HitIsHEC = 0; - HitIsFCAL = 0; - HitIsTile = 0; - HitSampling = 0; - HitSamplingFraction = 0; - TruthE = 0; - TruthPx = 0; - TruthPy = 0; - TruthPz = 0; - TruthPDG = 0; - TruthBarcode = 0; - TruthVtxBarcode = 0; - CellIdentifier = 0; - CellE = 0; - CellSampling = 0; - G4HitE = 0; - G4HitT = 0; - G4HitIdentifier = 0; - G4HitCellIdentifier = 0; - G4HitSamplingFraction = 0; - G4HitSampling = 0; - /* - TTC_back_eta = 0; - TTC_back_phi = 0; - TTC_back_r = 0; - TTC_back_z = 0; - TTC_entrance_eta = 0; - TTC_entrance_phi = 0; - TTC_entrance_r = 0; - TTC_entrance_z = 0; - TTC_IDCaloBoundary_eta = 0; - TTC_IDCaloBoundary_phi = 0; - TTC_IDCaloBoundary_r = 0; - TTC_IDCaloBoundary_z = 0; - TTC_Angle3D = 0; - TTC_AngleEta = 0; - */ - newTTC_back_eta = 0; - newTTC_back_phi = 0; - newTTC_back_r = 0; - newTTC_back_z = 0; - newTTC_entrance_eta = 0; - newTTC_entrance_phi = 0; - newTTC_entrance_r = 0; - newTTC_entrance_z = 0; - newTTC_mid_eta = 0; - newTTC_mid_phi = 0; - newTTC_mid_r = 0; - newTTC_mid_z = 0; - newTTC_IDCaloBoundary_eta = 0; - newTTC_IDCaloBoundary_phi = 0; - newTTC_IDCaloBoundary_r = 0; - newTTC_IDCaloBoundary_z = 0; - newTTC_Angle3D = 0; - newTTC_AngleEta = 0; - - - // Set branch addresses and branch pointers - if (!tree) return; - fChain = tree; - fCurrent = -1; - fChain->SetMakeClass(1); - - fChain->SetBranchAddress("HitX", &HitX, &b_HitX); - fChain->SetBranchAddress("HitY", &HitY, &b_HitY); - fChain->SetBranchAddress("HitZ", &HitZ, &b_HitZ); - fChain->SetBranchAddress("HitE", &HitE, &b_HitE); - fChain->SetBranchAddress("HitT", &HitT, &b_HitT); - fChain->SetBranchAddress("HitIdentifier", &HitIdentifier, &b_HitIdentifier); - fChain->SetBranchAddress("HitCellIdentifier", &HitCellIdentifier, &b_HitCellIdentifier); - fChain->SetBranchAddress("HitIsLArBarrel", &HitIsLArBarrel, &b_HitIsLArBarrel); - fChain->SetBranchAddress("HitIsLArEndCap", &HitIsLArEndCap, &b_HitIsLArEndCap); - fChain->SetBranchAddress("HitIsHEC", &HitIsHEC, &b_HitIsHEC); - fChain->SetBranchAddress("HitIsFCAL", &HitIsFCAL, &b_HitIsFCAL); - fChain->SetBranchAddress("HitIsTile", &HitIsTile, &b_HitIsTile); - fChain->SetBranchAddress("HitSampling", &HitSampling, &b_HitSampling); - fChain->SetBranchAddress("HitSamplingFraction", &HitSamplingFraction, &b_HitSamplingFraction); - fChain->SetBranchAddress("TruthE", &TruthE, &b_TruthE); - fChain->SetBranchAddress("TruthPx", &TruthPx, &b_TruthPx); - fChain->SetBranchAddress("TruthPy", &TruthPy, &b_TruthPy); - fChain->SetBranchAddress("TruthPz", &TruthPz, &b_TruthPz); - fChain->SetBranchAddress("TruthPDG", &TruthPDG, &b_TruthPDG); - fChain->SetBranchAddress("TruthBarcode", &TruthBarcode, &b_TruthBarcode); - fChain->SetBranchAddress("TruthVtxBarcode", &TruthVtxBarcode, &b_TruthVtxBarcode); - fChain->SetBranchAddress("CellIdentifier", &CellIdentifier, &b_CellIdentifier); - fChain->SetBranchAddress("CellE", &CellE, &b_CellE); - fChain->SetBranchAddress("CellSampling", &CellSampling, &b_CellSampling); - fChain->SetBranchAddress("G4HitE", &G4HitE, &b_G4HitE); - fChain->SetBranchAddress("G4HitT", &G4HitT, &b_G4HitT); - fChain->SetBranchAddress("G4HitIdentifier", &G4HitIdentifier, &b_G4HitIdentifier); - fChain->SetBranchAddress("G4HitCellIdentifier", &G4HitCellIdentifier, &b_G4HitCellIdentifier); - fChain->SetBranchAddress("G4HitSamplingFraction", &G4HitSamplingFraction, &b_G4HitSamplingFraction); - fChain->SetBranchAddress("G4HitSampling", &G4HitSampling, &b_G4HitSampling); - /* - fChain->SetBranchAddress("TTC_back_eta", &TTC_back_eta, &b_TTC_back_eta); - fChain->SetBranchAddress("TTC_back_phi", &TTC_back_phi, &b_TTC_back_phi); - fChain->SetBranchAddress("TTC_back_r", &TTC_back_r, &b_TTC_back_r); - fChain->SetBranchAddress("TTC_back_z", &TTC_back_z, &b_TTC_back_z); - fChain->SetBranchAddress("TTC_entrance_eta", &TTC_entrance_eta, &b_TTC_entrance_eta); - fChain->SetBranchAddress("TTC_entrance_phi", &TTC_entrance_phi, &b_TTC_entrance_phi); - fChain->SetBranchAddress("TTC_entrance_r", &TTC_entrance_r, &b_TTC_entrance_r); - fChain->SetBranchAddress("TTC_entrance_z", &TTC_entrance_z, &b_TTC_entrance_z); - fChain->SetBranchAddress("TTC_IDCaloBoundary_eta", &TTC_IDCaloBoundary_eta, &b_TTC_IDCaloBoundary_eta); - fChain->SetBranchAddress("TTC_IDCaloBoundary_phi", &TTC_IDCaloBoundary_phi, &b_TTC_IDCaloBoundary_phi); - fChain->SetBranchAddress("TTC_IDCaloBoundary_r", &TTC_IDCaloBoundary_r, &b_TTC_IDCaloBoundary_r); - fChain->SetBranchAddress("TTC_IDCaloBoundary_z", &TTC_IDCaloBoundary_z, &b_TTC_IDCaloBoundary_z); - fChain->SetBranchAddress("TTC_Angle3D", &TTC_Angle3D, &b_TTC_Angle3D); - fChain->SetBranchAddress("TTC_AngleEta", &TTC_AngleEta, &b_TTC_AngleEta); - */ - fChain->SetBranchAddress("newTTC_back_eta", &newTTC_back_eta, &b_newTTC_back_eta); - fChain->SetBranchAddress("newTTC_back_phi", &newTTC_back_phi, &b_newTTC_back_phi); - fChain->SetBranchAddress("newTTC_back_r", &newTTC_back_r, &b_newTTC_back_r); - fChain->SetBranchAddress("newTTC_back_z", &newTTC_back_z, &b_newTTC_back_z); - fChain->SetBranchAddress("newTTC_entrance_eta", &newTTC_entrance_eta, &b_newTTC_entrance_eta); - fChain->SetBranchAddress("newTTC_entrance_phi", &newTTC_entrance_phi, &b_newTTC_entrance_phi); - fChain->SetBranchAddress("newTTC_entrance_r", &newTTC_entrance_r, &b_newTTC_entrance_r); - fChain->SetBranchAddress("newTTC_entrance_z", &newTTC_entrance_z, &b_newTTC_entrance_z); - fChain->SetBranchAddress("newTTC_mid_eta", &newTTC_mid_eta, &b_newTTC_mid_eta); - fChain->SetBranchAddress("newTTC_mid_phi", &newTTC_mid_phi, &b_newTTC_mid_phi); - fChain->SetBranchAddress("newTTC_mid_r", &newTTC_mid_r, &b_newTTC_mid_r); - fChain->SetBranchAddress("newTTC_mid_z", &newTTC_mid_z, &b_newTTC_mid_z); - fChain->SetBranchAddress("newTTC_IDCaloBoundary_eta", &newTTC_IDCaloBoundary_eta, &b_newTTC_IDCaloBoundary_eta); - fChain->SetBranchAddress("newTTC_IDCaloBoundary_phi", &newTTC_IDCaloBoundary_phi, &b_newTTC_IDCaloBoundary_phi); - fChain->SetBranchAddress("newTTC_IDCaloBoundary_r", &newTTC_IDCaloBoundary_r, &b_newTTC_IDCaloBoundary_r); - fChain->SetBranchAddress("newTTC_IDCaloBoundary_z", &newTTC_IDCaloBoundary_z, &b_newTTC_IDCaloBoundary_z); - fChain->SetBranchAddress("newTTC_Angle3D", &newTTC_Angle3D, &b_newTTC_Angle3D); - fChain->SetBranchAddress("newTTC_AngleEta", &newTTC_AngleEta, &b_newTTC_AngleEta); - - Notify(); -} - -Bool_t CaloHitAna::Notify() -{ - // The Notify() function is called when a new file is opened. This - // can be either for a new TTree in a TChain or when when a new TTree - // is started when using PROOF. It is normally not necessary to make changes - // to the generated code, but the routine can be extended by the - // user if needed. The return value is currently not used. - - return kTRUE; -} - -void CaloHitAna::Show(Long64_t entry) -{ - // Print contents of entry. - // If entry is not specified, print current entry - if (!fChain) return; - fChain->Show(entry); -} -Int_t CaloHitAna::Cut(Long64_t entry) -{ - // This function may be called from Loop. - // returns 1 if entry is accepted. - // returns -1 otherwise. - std::cout << entry << std::endl; - return 1; -} -#endif // #ifdef CaloHitAna_cxx diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/CaloHitAna2.C b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/CaloHitAna2.C deleted file mode 100644 index 5e4c61209328e12f2d1d8d14f4c0391d67d4c9a3..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/CaloHitAna2.C +++ /dev/null @@ -1,171 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "FCS_Cell.h" -#include "TFile.h" -#include "TTree.h" -#include "TString.h" -#include <string> -#include <sstream> -#include <iostream> -#include "TSystem.h" -#include "TString.h" -#include "TFile.h" -#include <stdlib.h> -#include "TLorentzVector.h" -#include "TH2D.h" - -void CaloHitAna2(TString filename="output1.root", Int_t layer=0) -{ - gSystem->Load("FCS_Cell_h.so"); - TFile *fin = TFile::Open(filename,"READ"); - if (!fin) abort(); - TTree *t = (TTree*) fin->Get("FCS_ParametrizationInput"); - if (!t) abort(); - TString foutname = filename; - TString outname=TString::Format("_output_%i.root",layer); - foutname.ReplaceAll(".root",outname); - - TFile *fout = new TFile(foutname, "RECREATE"); - TH2D *h1 = new TH2D("h1","total_cell_energy",100,-5,5,600,0,60000); - TH2D *h2 = new TH2D("h2","total_hit_energy",100,-5,5,600,0,60000); - TH2D *h3 = new TH2D("h3","total_g4hit_energy",100,-5,5,600,0,60000); - TH2D *hh1 = new TH2D("hh1","nhits",100,-5,5,1000,0,10000); - TH2D *hh2 = new TH2D("hh2","ng4hits",100,-5,5,1000,0,10000); - - TH2D *hdiff1 = new TH2D("hdiff1","cell-hit_energy",100,-5,5,200,-10000,10000); - TH2D *hdiff2 = new TH2D("hdiff2","cell-g4hit_energy",100,-5,5,200,-10000,10000); - - TString hdiffL1name; hdiffL1name.Form("hdiff1_%d",layer); - TString hdiffL2name; hdiffL2name.Form("hdiff2_%d",layer); - - TH2D *hdiffL1 = new TH2D(hdiffL1name,hdiffL1name,100,-5,5,200,-10000,10000); - TH2D *hdiffL2 = new TH2D(hdiffL2name,hdiffL2name,100,-5,5,200,-10000,10000); - - h1->Sumw2(); - h2->Sumw2(); - h3->Sumw2(); - hh1->Sumw2(); - hh2->Sumw2(); - hdiff1->Sumw2(); - hdiff2->Sumw2(); - hdiffL1->Sumw2(); - hdiffL2->Sumw2(); - - FCS_matchedcellvector *vec=0; - TString name="Sampling_"; - name+=layer; - if (layer == -1) - { - name="AllCells"; - } - t->SetBranchAddress(name,&vec); - Float_t total_cell_energy; - Float_t total_hit_energy; - Float_t total_g4hit_energy; - t->SetBranchAddress("total_cell_energy", &total_cell_energy); - t->SetBranchAddress("total_hit_energy", &total_hit_energy); - t->SetBranchAddress("total_g4hit_energy",&total_g4hit_energy); - std::vector<float> *truth_px=0; - std::vector<float> *truth_py = 0; - std::vector<float> *truth_pz = 0; - std::vector<float> *truth_e = 0; - - - t->SetBranchAddress("TruthE",&truth_e); - t->SetBranchAddress("TruthPx",&truth_px); - t->SetBranchAddress("TruthPy",&truth_py); - t->SetBranchAddress("TruthPz",&truth_pz); - - std::cout <<"Entries: "<<t->GetEntries()<<std::endl; - for (Long64_t i=0; i<t->GetEntries(); i++) - { - t->GetEntry(i); - if (i%100 ==0) std::cout <<"Event: "<<i<<" layer "<<layer<< " has: "<<vec->size()<<" cells"<<std::endl; - UInt_t totalhits=0; - UInt_t totalg4hits=0; - Float_t totalhitE = 0.; //these are per layer! - Float_t totalcellE = 0.; - Float_t totalg4hitE = 0.0; - for (UInt_t j=0; j<(*vec).size(); j++) - { - totalhits+=(*vec)[j].hit.size(); - totalg4hits+=(*vec)[j].g4hit.size(); - for (UInt_t k=0; k<(*vec)[j].hit.size(); k++) - { - totalhitE+=(*vec)[j].hit[k].hit_energy; - } - for (UInt_t k=0; k<(*vec)[j].g4hit.size(); k++) - { - totalg4hitE+=(*vec)[j].g4hit[k].hit_energy; - } - totalcellE+=(*vec)[j].cell.energy; - } - TLorentzVector pion; - /* - if (truth_e->size()>1) - { - std::cout <<"Truth: "<<truth_e->size()<<" "<<(*truth_px)[0]<<std::endl; - } - else std::cout <<truth_e->size()<<std::endl; - */ - if (truth_e->size()>=1) - { - pion.SetPxPyPzE((*truth_px)[0], (*truth_py)[0], (*truth_pz)[0], (*truth_e)[0]); - } - else continue; - /* - std::cout <<std::endl; - pion.Print(); - std::cout <<std::endl; - */ - //std::cout <<"Pion rap: "<<pion.Rapidity()<<std::endl; - h1->Fill(pion.Rapidity(), total_cell_energy); - h2->Fill(pion.Rapidity(), total_hit_energy); - h3->Fill(pion.Rapidity(), total_g4hit_energy); - hh1->Fill(pion.Rapidity(), totalhits); - hh2->Fill(pion.Rapidity(), totalg4hits); - hdiff1->Fill(pion.Rapidity(), total_cell_energy-total_hit_energy); - hdiff2->Fill(pion.Rapidity(), total_cell_energy-total_g4hit_energy); - hdiffL1->Fill(pion.Rapidity(), totalcellE-totalhitE); - hdiffL2->Fill(pion.Rapidity(), totalcellE-totalg4hitE); - if (i%100 ==0) std::cout <<" and "<<totalhits<<" hits and "<<totalg4hits<<" g4hits"<<std::endl; - } - fout->cd(); - h1->Write(); - h2->Write(); - h3->Write(); - hh1->Write(); - hh2->Write(); - hdiff1->Write(); - hdiff2->Write(); - hdiffL1->Write(); - hdiffL2->Write(); - fout->Close(); - -}; - -int main(int argc, char *argv[]) -{ - TString filename="output1.root"; - Int_t layer =2; - if (argc <=1) - { - std::cout <<"Usage: ./CaloHitAna2 inputfile sampling "<<std::endl; - exit(1); - } - - if (argc>=2) - { - filename=argv[1]; - } - if (argc>=3) - { - TString param = argv[2]; - layer = param.Atoi(); - } - std::cout <<"Parameters: inputfile: "<<filename<<" sampling: "<<layer<<std::endl; - CaloHitAna2(filename, layer); - return 0; -} diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/CaloHitAna3.C b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/CaloHitAna3.C deleted file mode 100755 index 15b8dee9f55480efacffb5ac1272890e9e62cdb4..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/CaloHitAna3.C +++ /dev/null @@ -1,202 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "FCS_Cell.h" -#include "TFile.h" -#include "TTree.h" -#include "TString.h" -#include <string> -#include <sstream> -#include <iostream> -#include "TSystem.h" -#include "TString.h" -#include "TFile.h" -#include <stdlib.h> -#include "TLorentzVector.h" -#include "TH2D.h" - -//another example how to read matched ntuples - -void CaloHitAna3(TString filename="output1.root", Int_t llayer=0, Long64_t max_entries=-1, float timing_cut=99999) -{ - gSystem->Load("./FCS_Cell_h.so"); - TFile *fin = TFile::Open(filename,"READ"); - if (!fin) abort(); - TTree *t = (TTree*) fin->Get("FCS_ParametrizationInput"); - if (!t) abort(); - TString foutname = filename; - TString outname="_output_"; - outname+=llayer; - outname+=".root"; - foutname.ReplaceAll(".root",outname); - - TFile *fout = new TFile(foutname, "RECREATE"); - - - FCS_matchedcellvector *vec; - TString name="Sampling_"; - name+=llayer; - if (llayer == -1) - { - name="AllCells"; - } - std::cout <<"Reading branch: "<<name<<" for layer: "<<llayer<<std::endl; - t->SetBranchAddress(name,&vec); - - std::vector<float> *truth_px=0; - std::vector<float> *truth_py = 0; - std::vector<float> *truth_pz = 0; - std::vector<float> *truth_e = 0; - - - t->SetBranchAddress("TruthE",&truth_e); - t->SetBranchAddress("TruthPx",&truth_px); - t->SetBranchAddress("TruthPy",&truth_py); - t->SetBranchAddress("TruthPz",&truth_pz); - - std::cout <<"Entries: "<<t->GetEntries()<<std::endl; - if (max_entries == -1 ) - { - max_entries = t->GetEntries(); - } - - for (Long64_t i=0; i<max_entries; i++) - { - //std::cout <<llayer<<std::endl; - if (i%100 ==0) std::cout<<std::endl; - t->GetEntry(i); - //if (i%100 ==0) std::cout <<"Event: "<<i<<" layer "<<layer<< " "<<name<<" has: "<<vec->size()<<" cells"<<std::endl; - //sort cells and hits - vec->sort(); - //trim timing - if (timing_cut<999999.) - { - if (i%100==0) std::cout <<"Trimming: orig size: "<<vec->size()<<" cells"<<std::endl; - vec->time_trim(timing_cut); - if (i%100==0) std::cout <<"Remaining non empty cells: "<<vec->size()<<std::endl; - } - else - { - if (i==0) std::cout<<"No time trimming"<<std::endl; - } - - if (i%100 ==0) - { - std::cout <<"======================================"<<std::endl; - std::cout <<"= EVENT "<<i<<" ="<<std::endl; - std::cout <<"======================================"<<std::endl; - std::cout <<"Layer: "<<llayer<<" : "<<vec->size()<< " cells"<<std::endl; - - float totalhitelayer = 0.; - float totalcellelayer = 0.; - for (UInt_t j=0; j<vec->size(); j++) - { - FCS_matchedcell cell = (*vec)[j]; - FCS_cell ccell = cell.cell; - float ccelle = ccell.energy; - UInt_t hitsize = cell.hit.size(); - std::cout <<" Cell "<<j<<" E: "<<ccell.energy<<" id: "<<ccell.cell_identifier<<" hits: "<<hitsize<<std::endl; - float tothite=0.; - totalcellelayer+=ccell.energy; - for (UInt_t k=0; k<hitsize; k++) - { - FCS_hit hit = cell.hit[k]; - float hite = hit.hit_energy; - float hitt = hit.hit_time; - // float hitt = (*vec)[j].hit[k].hit_time; - tothite+=hite; - totalhitelayer+=hite; - if (i%100 ==0) std::cout <<" Hit "<<k<<" HitE: "<<hite<<" Time: "<<hitt<<std::endl; - if (i%100 ==0 && hitt>1000.) std::cout <<"HERE"<<std::endl; - } - - float frac = 0.; - //long emptycell =0; - if (fabs(ccelle)>0.) - { - frac = tothite/ccelle; - } - // else emptycell++; - std::cout <<" Total hitE in cell: "<<tothite<<" / cellE: "<<ccelle<<" ( "<<frac<<" ) "<<std::endl;//<<" empty cells: "<<emptycell<<std::endl; - - } - // std::cout <<"----"<<std::endl; - //float frac2 = 0.; - //if (fabs(totalcellelayer)>0.) frac2= totalhitelayer/totalcellelayer; - std::cout <<"Total check: layer: SUMhit: "<<totalhitelayer<<" / SUMcell: "<<totalcellelayer<<std::endl;//" ( "<<frac2<<" ) "<<std::endl; - std::cout <<"======================================"<<std::endl; - std::cout <<std::endl; - } - - /* - UInt_t totalhits=0; - UInt_t totalg4hits=0; - Float_t totalhitE = 0.; //these are per layer! - Float_t totalcellE = 0.; - Float_t totalg4hitE = 0.0; - for (UInt_t j=0; j<(*vec).size(); j++) - { - if (i%100 ==0) - { - std::cout <<"Hit size: "<<(*vec)[j].hit.size()<<" g4hit size: "<<(*vec)[j].g4hit.size()<<std::endl; - std::cout <<"Reading in cell: "<<j<<std::endl; - } - totalhits+=(*vec)[j].hit.size(); - totalg4hits+=(*vec)[j].g4hit.size(); - for (UInt_t k=0; k<(*vec)[j].hit.size(); k++) - { - if (i%100 ==0) std::cout <<"Reading hit: "<<k<<" e: "<<(*vec)[j].hit[k].hit_energy<<" tot: "<<totalhitE<<std::endl; - totalhitE+=(*vec)[j].hit[k].hit_energy; - } - for (UInt_t k=0; k<(*vec)[j].g4hit.size(); k++) - { - if (i%100 ==0) std::cout <<"Reading hit: "<<k<<" e: "<<(*vec)[j].g4hit[k].hit_energy<<" tot: "<<totalg4hitE<<std::endl; - totalg4hitE+=(*vec)[j].g4hit[k].hit_energy; - } - totalcellE+=(*vec)[j].cell.energy; - } - if (i%100 ==0) std::cout <<"Test? "<<totalhits<<" hits and "<<totalg4hits<<" g4hits with C: "<<total_cell_energy<<" / "<<totalcellE<<" H: "<<total_hit_energy<<" / "<<totalhitE<<" G4: "<<total_g4hit_energy<<" / "<<totalg4hitE<<std::endl; - */ - TLorentzVector pion; - if (truth_e->size()>=1) - { - pion.SetPxPyPzE((*truth_px)[0], (*truth_py)[0], (*truth_pz)[0], (*truth_e)[0]); - } - else continue; - } - fout->cd(); - fout->Close(); - -}; - -int main(int argc, char *argv[]) -{ - TString filename="output1.root"; - Int_t layer =2; - float timing_cut=999999; - Long64_t max_entries = -1; - std::cout <<"Usage: ./CaloHitAna3 inputfile sampling max_entries timing_cut"<<std::endl; - if (argc>=2) - { - filename=argv[1]; - } - if (argc>=3) - { - TString param = argv[2]; - layer = param.Atoi(); - } - if (argc>=4) - { - TString param = argv[3]; - max_entries = param.Atoi(); - } - if (argc>=5) - { - TString param = argv[4]; - timing_cut = param.Atof(); - } - std::cout <<"Parameters: inputfile: "<<filename<<" sampling: "<<layer<<" max entries: "<<max_entries<<" timing cut: "<<timing_cut<<std::endl; - CaloHitAna3(filename, layer,max_entries,timing_cut); - return 0; -} diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCS_Cell.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCS_Cell.h deleted file mode 100644 index 560d45d6c361b5d02301737a7ed04d0b39f5f88b..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCS_Cell.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef FCS_Cell -#define FCS_Cell -#include <vector> -//#include <stdint.h> -#include <Rtypes.h> -#include <TLorentzVector.h> -//#include <iostream> -/****************************************** -This contains structure definition -All structures are relatively simple -each matched cell remembers - cell properties + vector of g4hits in this cell + vector of FCS hits in this cell - -Technicalities - needs a Linkdef.h file + makefile to create the dictionary for ROOT -then the last class could be saved in to the TTree - - ******************************************/ - -struct FCS_cell -{ - Long64_t cell_identifier; - int sampling; - float energy; - float center_x; - float center_y; - float center_z; //to be updated later - bool operator<(const FCS_cell &rhs) const { return energy > rhs.energy;}; -}; - -struct FCS_hit //this is the FCS detailed hit -{ - Long64_t identifier; //hit in the same tile cell can have two identifiers (for two PMTs) - Long64_t cell_identifier; - int sampling; //calorimeter layer - float hit_energy; //energy is already scaled for the sampling fraction - float hit_time; - float hit_x; - float hit_y; - float hit_z; - bool operator<(const FCS_hit &rhs) const { return hit_energy > rhs.hit_energy;}; - //float hit_sampfrac; -}; - -struct FCS_g4hit //this is the standard G4Hit -{ - Long64_t identifier; - Long64_t cell_identifier; - int sampling; - float hit_energy; - float hit_time; - //float hit_sampfrac; - bool operator<(const FCS_g4hit &rhs) const { return hit_energy > rhs.hit_energy;}; -}; - -struct FCS_matchedcell //this is the matched structure for a single cell -{ - FCS_cell cell; - std::vector<FCS_g4hit> g4hit; - std::vector<FCS_hit> hit; - inline void clear() {g4hit.clear(); hit.clear();}; - inline float scalingfactor(){float hitsum =0.; for (unsigned int i=0; i<hit.size(); i++){hitsum+=hit[i].hit_energy;}; return cell.energy/hitsum;}; //doesn't check for 0! - bool operator<(const FCS_matchedcell &rhs) const { return cell.energy > rhs.cell.energy;}; - inline void sorthit() { std::sort(hit.begin(), hit.end());}; - inline void sortg4hit() { std::sort(g4hit.begin(), g4hit.end());}; - inline void sort() { sorthit(); sortg4hit();}; - inline void time_trim(float timing_cut) { /*std::cout <<"Cutting: "<<timing_cut<<" from: "<<hit.size()<<" "<<g4hit.size()<<std::endl;*/hit.erase(std::remove_if(hit.begin(), hit.end(), [&timing_cut](const FCS_hit &rhs) { return rhs.hit_time>timing_cut;}), hit.end()); g4hit.erase(std::remove_if(g4hit.begin(), g4hit.end(), [&timing_cut](const FCS_g4hit &rhs) { return rhs.hit_time>timing_cut;}),g4hit.end());/*std::cout <<"remaining: "<<hit.size()<<" "<<g4hit.size()<<std::endl;*/}; -}; - -struct FCS_matchedcellvector //this is the matched structure for the whole event (or single layer) - vector of FCS_matchedcell -{ - //Note that struct can have methods - //Note the overloaded operator(s) to access the underlying vector - std::vector<FCS_matchedcell> m_vector; - inline std::vector<FCS_matchedcell> GetLayer(int layer){std::vector<FCS_matchedcell> ret; for (unsigned i=0; i<m_vector.size(); i++) {if (m_vector[i].cell.sampling == layer) ret.push_back(m_vector[i]);}; return ret;}; - inline FCS_matchedcell operator[](unsigned int place) { return m_vector[place];}; - inline unsigned int size() {return m_vector.size();}; - inline void push_back(FCS_matchedcell cell) { m_vector.push_back(cell);}; - inline void sort_cells() { std::sort(m_vector.begin(), m_vector.end());}; - inline void sort() { std::sort(m_vector.begin(), m_vector.end()); for (unsigned int i=0; i<m_vector.size(); i++) { m_vector[i].sort();};}; - inline void time_trim(float timing_cut) - { for (unsigned int i=0; i< m_vector.size(); i++) { m_vector[i].time_trim(timing_cut); }; m_vector.erase(std::remove_if(m_vector.begin(), m_vector.end(), [] (const FCS_matchedcell &rhs) { return (rhs.hit.size()==0 && rhs.g4hit.size() ==0 && fabs(rhs.cell.energy)<1e-3);}), m_vector.end());}; - inline float scalingfactor(){float cellsum=0.; float hitsum=0.; for (unsigned int i=0; i<m_vector.size(); i++){cellsum+=m_vector[i].cell.energy;for (unsigned int j=0; j<m_vector[i].hit.size(); j++){hitsum+=m_vector[i].hit[j].hit_energy;};}; return cellsum/hitsum;}; //doesn't check for 0! -}; - -struct FCS_truth : public TLorentzVector -{ - std::vector<double> TTC_entrance_eta; - std::vector<double> TTC_entrance_phi; - std::vector<double> TTC_entrance_r; - std::vector<double> TTC_entrance_z; - std::vector<double> TTC_back_eta; - std::vector<double> TTC_back_phi; - std::vector<double> TTC_back_r; - std::vector<double> TTC_back_z; - double TTC_IDCaloBoundary_eta; - double TTC_IDCaloBoundary_phi; - double TTC_IDCaloBoundary_r; - double TTC_IDCaloBoundary_z; - double TTC_Angle3D; - double TTC_AngleEta; - int barcode; - int vtxbarcode; - int pdgid; - ClassDef (FCS_truth, 1) -}; - - -#ifdef __CINT__ -#pragma link C++ struct FCS_cell+; -#pragma link C++ struct FCS_hit+; -#pragma link C++ struct FCS_g4hit+; -#pragma link C++ struct std::vector<FCS_hit>+; -#pragma link C++ struct std::vector<FCS_g4hit>+; -#pragma link C++ struct FCS_matchedcell+; -#pragma link C++ struct std::vector<FCS_matchedcell>+; -#pragma link C++ struct FCS_matchedcellvector+; -#pragma link C++ class std::vector<Float_t>+; -#pragma link C++ struct FCS_truth+; -#pragma link C++ struct std::vector<FCS_truth>+; -#endif - -#endif - diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Linkdef.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Linkdef.h deleted file mode 100644 index 73dcb053904cc3e6d3e7d77c3119c6a95d55f1df..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Linkdef.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifdef __MAKECINT__ -#pragma link C++ struct FCS_cell+; -#pragma link C++ struct FCS_hit+; -#pragma link C++ struct FCS_g4hit+; -#pragma link C++ struct std::vector<FCS_hit>+; -#pragma link C++ struct std::vector<FCS_g4hit>+; -#pragma link C++ struct FCS_matchedcell+; -#pragma link C++ struct std::vector<FCS_matchedcell>+; -#pragma link C++ struct FCS_matchedcellvector+; -#pragma link C++ class std::vector<Float_t>+; -#pragma link C++ struct FCS_truth+; -#pragma link C++ struct std::vector<FCS_truth>+; -#pragma link C++ class std::vector<std::vector<float> >+; -#endif diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Makefile b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Makefile deleted file mode 100755 index c409a954cd88a33b32ddfdae674b52d21ae93537..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -if [ -f FCS_CellDict.cxx ]; -then - rm FCS_CellDict.cxx - rm FCS_CellDict.h -fi -rootcint FCS_CellDict.cxx -c FCS_Cell.h Linkdef.h - -#compile -g++ -g -c run.C FCS_CellDict.cxx -I $(root-config --incdir) -I . -fPIC $CPPEXPFLAGS -std=c++11 - -#link executable -g++ -g -o CaloHitAna run.o FCS_CellDict.o -L $(root-config --libdir) -lGui -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lpthread -Wl,-rpath,$(root-config --libdir) -lm -ldl -fPIC $CPPEXPFLAGS -std=c++11 - -#this creates a shared library for ROOT (which can be loaded by hand) -g++ -shared -o FCS_Cell_h.so FCS_CellDict.o -L $(root-config --libdir) -lGui -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lpthread -Wl,-rpath,$(root-config --libdir) -lm -ldl -fPIC $CPPEXPFLAGS -std=c++11 - -#example -g++ -g -c CaloHitAna2.C -I $(root-config --incdir) -I . -fPIC $CPPEXPFLAGS -std=c++11 - -g++ -g -o CaloHitAna2 CaloHitAna2.o FCS_CellDict.o -L $(root-config --libdir) -lGui -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lpthread -Wl,-rpath,$(root-config --libdir) -lm -ldl -lstdc++ -fPIC $CPPEXPFLAGS -std=c++11 - -#another example -g++ -g -c CaloHitAna3.C FCS_CellDict.cxx -Wall -I $(root-config --incdir) -I . -fPIC $CPPEXPFLAGS -Wall -std=c++11 - -g++ -g -o CaloHitAna3 CaloHitAna3.o FCS_CellDict.o -L $(root-config --libdir) -lGui -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lpthread -Wl,-rpath,$(root-config --libdir) -lm -ldl -lstdc++ -fPIC $CPPEXPFLAGS -Wall -std=c++11 - diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/make_caloHitAna.sh b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/make_caloHitAna.sh deleted file mode 100644 index 0f6fbdc60a0b5518fa7349547daa4745dc375a8a..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/make_caloHitAna.sh +++ /dev/null @@ -1,4 +0,0 @@ -g++ -g -c run.C FCS_CellDict.cxx -I $(root-config --incdir) -I . -fPIC $CPPEXPFLAGS -std=c++11 -g++ -g -o CaloHitAna run.o FCS_CellDict.o -L $(root-config --libdir) -lGui -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lpthread -Wl,-rpath,$(root-config --libdir) -lm -ldl -fPIC $CPPEXPFLAGS -std=c++11 - - diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/run.C b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/run.C deleted file mode 100644 index 36e0d327799b7b294dd721368e0685ff70cf65bd..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/run.C +++ /dev/null @@ -1,91 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "CaloHitAna.C" -#include <iostream> -#include <stdlib.h> -void run(TString filename="ISF_HitAnalysispion_eta1.root",TString outputname="output1.root", std::vector<Int_t> settings =std::vector<Int_t>(), Float_t TimingCut=999999., Int_t debug = 0) -{ - //CaloHitAna t; - CaloHitAna t(filename,outputname, settings, TimingCut,debug,0); - t.Loop(); - //No need to call finish now -} - - -int main(int argc, char *argv[]) -{ - TString filename="ISF_HitAnalysispion_eta1.root"; - TString outputname="output1.root"; - if (argc <=1) - { - std::cout <<"Usage: ./CaloHitAna input.root output.root save_all_cells save_cells_per_sampling save_energies_per_sampling hit_timing_cut"<<std::endl; - exit(1); - } - if (argc >=2) - { - filename = argv[1]; - } - std::cout <<"Processing "<<filename<<std::endl; - - if (argc >=3) - { - outputname = argv[2]; - } - std::cout <<"Saving output to "<<outputname<<std::endl; - std::vector<Int_t> settings(0); - Float_t TimingCut = 999999.; - Int_t Debug = 0; - if (argc >=4) - { - for (Int_t i=3; i<argc; i++) - { - TString parameter = argv[i]; - if (! (parameter.Contains("tc") || parameter.Contains("debug"))) - { - Int_t pari = parameter.Atoi(); - settings.push_back(pari); - } - else if (parameter.Contains("tc")) - { - parameter.ReplaceAll("tc=",""); - TimingCut = parameter.Atof(); - } - else if (parameter.Contains("debug")) - { - parameter.ReplaceAll("debug=",""); - Debug = parameter.Atoi(); - std::cout <<Debug<<std::endl; - } - } - } - else - { - settings.push_back(1); - } - std::cout <<"Settings: "; - for (UInt_t i=0; i<settings.size(); i++) - { - std::cout <<settings[i]<<" "; - } - std::cout <<std::endl; - std::cout <<"Timing cut: "<<TimingCut<<std::endl; - std::cout <<"Debug: "<<Debug<<std::endl; - TFile *ftest = TFile::Open(filename,"READ"); - if (!ftest) - { - std::cout <<"File "<<filename<<"doesn't exist!"<<std::endl; - exit(1); - } - else - { - ftest->Close(); - } - delete ftest; - std::cout <<std::endl; - std::cout <<"Running"<<std::endl; - run(filename, outputname, settings, TimingCut,Debug); - - return 0; -} diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/simplerun.C b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/simplerun.C deleted file mode 100644 index 40fff4c2b4ec81459afda87ce1c517dd272415c8..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/simplerun.C +++ /dev/null @@ -1,20 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -void simplerun(TString filename="ISF_calo__211__E10000_10000__eta20_20_Evts0-1000_z03350.pool.root",TString outputname="output1.root") -{ - gROOT->LoadMacro("FCS_Cell.h+"); - gROOT->LoadMacro("CaloHitAna.C+"); - //CaloHitAna t; - CaloHitAna t(filename,outputname); - t.SetDoLayers(1); - t.SetDoLayerSums(1); - t.m_PrintOutFrequency=1; - t.m_max_nentries=5; - t.m_Debug=2; - t.Loop(); - //No need to call finish now -} - -