Skip to content
Snippets Groups Projects
Commit eafa2d62 authored by Adam Edward Barton's avatar Adam Edward Barton
Browse files

Merge branch 'RemoveObsoleteFCScode_master' into 'master'

Remove obsolete FastCaloSim code

See merge request atlas/athena!34956
parents 792ceaaa 7e256e9a
No related branches found
No related tags found
6 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!34956Remove obsolete FastCaloSim code
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
// class CBNT_DetailedCellInfo
// modified for my purpose using CellInformations 14. april 2008
//
// make ntuple for CaloCell
//
//
// Using StoreGate now.
//
// 23 April 2004: add simple detector information, J.Tanaka
#include "FastCaloSim/CBNTAA_DetailedCellInfo.h"
#include "CaloEvent/CaloCellContainer.h" // Container of all LAr and Tile cells. http://alxr.usatlas.bnl.gov/lxr/source/atlas/Calorimeter/CaloEvent/CaloEvent/CaloCellContainer.h
#include "CaloEvent/CaloCell.h" // added 21 april 2008 for using cell information
#include "CaloDetDescr/CaloDetDescrElement.h" // added 21 april 2008 for using caloDDE() method
#include "GaudiKernel/ISvcLocator.h"
#include "GaudiKernel/StatusCode.h"
#include "GaudiKernel/MsgStream.h"
#include "StoreGate/StoreGateSvc.h"
#include "CaloIdentifier/CaloID.h" // includes all CaloIdetifier
#include "CLHEP/Units/SystemOfUnits.h"
#include "CaloSimEvent/CaloCalibrationHit.h"
#include "CaloSimEvent/CaloCalibrationHitContainer.h"
#include "CaloDetDescr/CaloDetDescrManager.h"
#include "FastCaloSim/FastCaloSimIsGenSimulStable.h"
#include "TruthHelper/GenAll.h"
#include "AtlasHepMC/GenParticle.h"
#include "GaudiKernel/IPartPropSvc.h"
#include "HepPDT/ParticleData.hh"
#include "TrkParameters/Perigee.h"
#include <TVector3.h>
#include <map>
#include <iomanip>
#include <fstream>
//#include "CaloConditions/ICaloBadChanTool.h"
CBNTAA_DetailedCellInfo::CBNTAA_DetailedCellInfo(const std::string& name, ISvcLocator* pSvcLocator) :
CBNT_AthenaAwareBase(name, pSvcLocator),
m_cellsName("AllCalo"), //Cell container
m_saveTimeInfo(false),m_saveQInfo(false),
m_saveId(false),m_savePosition(false),
m_FastShowerCellBuilderTool("FastShowerCellBuilderTool"),
m_gentesIO(0),m_particleDataTable(0),
m_suffix("Par"),m_cellsoutfile(""),m_mcLocation("TruthEvent")
{ // string property for Cell container
declareProperty("CellsName",m_cellsName);
// list of calo to treat
declareProperty("CaloNums",m_caloNums);
// string property for Cell container
declareProperty("CellEnergyThreshold",m_cellEnergyThreshold);
// suffix for all the variables
declareProperty("Suffix",m_suffix);
declareProperty("SaveTimeInfo",m_saveTimeInfo);
declareProperty("SaveQualityInfo",m_saveQInfo);
declareProperty("SaveId",m_saveId);
declareProperty("CellinfoOutfile",m_cellsoutfile);
declareProperty("SavePositionInfo",m_savePosition);
declareProperty("CalibrationContainers",m_CalibrationContainerNames);
declareProperty("CalibrationContainersInactive",m_CalibrationContainerInactiveNames);
declareProperty("FastShowerCellBuilderTool",m_FastShowerCellBuilderTool);
declareProperty("McLocation",m_mcLocation);
}
CBNTAA_DetailedCellInfo::~CBNTAA_DetailedCellInfo()
{ }
// INITIALIZE
StatusCode
CBNTAA_DetailedCellInfo::CBNT_initialize()
{
MsgStream log(messageService(), name());
log << MSG::INFO << " in CBNT_DetailedCellInfo_initialize" << endmsg;
log << MSG::INFO << " reading CaloCellContainer " << m_cellsName << endmsg ;
// VARIABLE m_saveDetInfo() NOT USED SO FAR 15.04.2008
StatusCode sc ;
if ( sc == StatusCode::FAILURE ) {
log<<MSG::ERROR << " could not add item to col wise ntuple" << endmsg;
return StatusCode::FAILURE;
}
addBranch ("ecell"+m_suffix,m_eCell,"ecell"+m_suffix+"/F");
addBranch ("NCells"+m_suffix,m_nhit,"NCells"+m_suffix+"/I");
addBranch ("ECells"+m_suffix,m_eCells);
//############
addBranch ("CalEM_energy"+m_suffix,EM_energy);
addBranch ("CalNonEM_energy"+m_suffix,NonEM_energy);
addBranch ("CalInvisible_energy"+m_suffix,Invisible_energy);
addBranch ("CalEscaped_energy"+m_suffix,Escaped_energy);
addBranch ("CalEMInactive_energy"+m_suffix,EMInactive_energy);
addBranch ("CalNonEMInactive_energy"+m_suffix,NonEMInactive_energy);
addBranch ("CalInvisibleInactive_energy"+m_suffix,InvisibleInactive_energy);
addBranch ("CalEscapedInactive_energy"+m_suffix,EscapedInactive_energy);
addBranch ("Layer"+m_suffix,Layer);
addBranch ("CellID"+m_suffix,CellID);
//############
addBranch ("EtaCells"+m_suffix,m_etaCells);
addBranch ("PhiCells"+m_suffix,m_phiCells);
if (m_savePosition) {
addBranch ("xCells"+m_suffix,m_xCells);
addBranch ("yCells"+m_suffix,m_yCells);
addBranch ("zCells"+m_suffix,m_zCells);
}
addBranch ("QCells"+m_suffix,m_fitQCells);
addBranch ("GainCells"+m_suffix,m_gainCells);
if (m_saveDetInfo) addBranch ("DetCells"+m_suffix,m_detCells);
if (m_saveTimeInfo) addBranch ("TimeCells"+m_suffix,m_timeCells);
if (m_saveQInfo) addBranch ("BadCells"+m_suffix,m_qCells);
if (m_saveId) addBranch("IdCells"+m_suffix,m_offId);
//#########################################################
addBranch ("d_calo_surf"+m_suffix,dcalosurf,"d_calo_surf"+m_suffix+"/F");
addBranch ("eta_calo_surf"+m_suffix,etacalosurf,"eta_calo_surf"+m_suffix+"/F");
addBranch ("phi_calo_surf"+m_suffix,phicalosurf,"phi_calo_surf"+m_suffix+"/F");
addBranch ("ld_calo_layercenter"+m_suffix,ldcalolayercenter);
addBranch ("leta_calo_layercenter"+m_suffix,letacalolayercenter);
addBranch ("lphi_calo_layercenter"+m_suffix,lphicalolayercenter);
addBranch ("Layerok"+m_suffix,lok);
// get StoreGate
/* StatusCode sc = service("StoreGateSvc", m_storeGate);
if (sc.isFailure()) {
mLog << MSG::ERROR
<< "Unable to retrieve pointer to StoreGateSvc"
<< endmsg;
return sc;
}*/
sc = service("StoreGateSvc", m_storeGate);
if ( sc == StatusCode::FAILURE ) {
log<<MSG::ERROR << " could not access SotreGate " << endmsg;
return StatusCode::FAILURE;
}
// Bad Channel Tool not used so far 15.04.2008
/* if (m_saveQInfo) {
sc=m_pb_tool.retrieve();
if (sc.isFailure()) {
log << MSG::ERROR << "Could not retrieve bad channel tool " << m_pb_tool << endmsg;
m_saveQInfo=false;
return sc;
}
}*/
unsigned int nSubCalo=static_cast<int>(CaloCell_ID::NSUBCALO) ;
//check calo number specified
m_caloSelection = false ;
if (m_caloNums.size()==0) {
log << MSG::INFO << " No calorimeter selection " << endmsg;
//return StatusCode::SUCCESS;
} else if (m_caloNums.size()>nSubCalo ) {
log << MSG::ERROR << " More than "
<< nSubCalo << " calo specified. Must be wrong. Stop." << endmsg;
return StatusCode::FAILURE;
} else {
m_caloSelection = true ;
for (unsigned int index=0; index < m_caloNums.size() ; ++index) {
if (m_caloNums[index]>=nSubCalo ) {
log << MSG::ERROR << "Invalid calo specification:"
<< m_caloNums[index] << "Stop." << endmsg ;
return StatusCode::FAILURE;
} else
{
log << MSG::INFO << " Select calorimeter " << m_caloNums[index] << endmsg ;
}
}
}
//--------------------------------------------------
// Cell information for AddNoiseCellBuilderTool
m_caloDDM = CaloDetDescrManager::instance() ;
if(m_cellsoutfile!="") {
log << MSG::INFO << "Creating cell output file "<< m_cellsoutfile << endmsg ;
std::ofstream outfile(m_cellsoutfile.c_str());
for(CaloDetDescrManager::calo_element_const_iterator calo_iter=m_caloDDM->element_begin();calo_iter<m_caloDDM->element_end();++calo_iter) {
const CaloDetDescrElement* theDDE=*calo_iter;
if(theDDE) {
Identifier cellID=theDDE->identify();
int sample=(int)theDDE->getSampling();
outfile<<cellID<<" "<<sample<<" "<<theDDE->eta()<<" "<<theDDE->phi()<<" "<<theDDE->r()<<" "<<theDDE->x()<<" "<<theDDE->y()<<" "<<theDDE->z()
<<" "<<theDDE->deta()<<" "<<theDDE->dphi()<<" "<<theDDE->dr()<<" "<<theDDE->dx()<<" "<<theDDE->dy()<<" "<<theDDE->dz()<<std::endl;
}
}
outfile.close();
} else {
log << MSG::INFO << "skip creating cell output file"<< endmsg ;
}
//_______________________________________________________________________
// end Cell information
// access compact cell tools
sc=m_FastShowerCellBuilderTool.retrieve();
if (sc.isFailure()) {
log << MSG::ERROR << "Failed to retrieve FastShowerCellBuilderTool: "
<< m_FastShowerCellBuilderTool << endmsg;
return sc;
} else {
log << MSG::DEBUG << "Successfully retrieve FastShowerCellBuilderTool: "
<< m_FastShowerCellBuilderTool << endmsg;
}
m_gentesIO = new GenAccessIO();
IPartPropSvc* p_PartPropSvc;
sc=service("PartPropSvc",p_PartPropSvc);
if (sc.isFailure() || 0 == p_PartPropSvc) {
log<<MSG::ERROR << "could not find PartPropService"<<endmsg;
return StatusCode::FAILURE;
}
m_particleDataTable = (HepPDT::ParticleDataTable*) p_PartPropSvc->PDT();
if(m_particleDataTable == 0){
log<<MSG::ERROR << "PDG table not found"<<endmsg;
return StatusCode::FAILURE;
}
return StatusCode::SUCCESS;
}
StatusCode CBNTAA_DetailedCellInfo::CBNT_finalize()
{
return StatusCode::SUCCESS;
}
StatusCode CBNTAA_DetailedCellInfo::CBNT_execute()
{
MsgStream log( messageService(), name() );
log << MSG::INFO << " in CBNTAA_DetailedCellInfo_execute" << endmsg;
// typedef CaloCellContainer CONTAINER;
const CaloCellContainer* cellcoll(0);
StatusCode sc=m_storeGate->retrieve(cellcoll,"AllCalo");
if (sc.isFailure()) {
log << MSG::ERROR
<< "" << endmsg;
return sc;
}
const DataHandle<CaloCalibrationHitContainer> clbc;
std::vector<const CaloCalibrationHitContainer * > v_clbc;
std::vector<const CaloCalibrationHitContainer * > v_clbcInactive;
std::vector<std::string>::iterator iter;
for (iter=m_CalibrationContainerNames.begin();iter!=m_CalibrationContainerNames.end();++iter) {
sc = m_storeGate->retrieve(clbc,*iter);
if (sc.isFailure()) {
log << MSG::ERROR << "Cannot retrieve calibration container" << endmsg;
} else {
v_clbc.push_back(clbc);
}
}
for (iter=m_CalibrationContainerInactiveNames.begin();iter!=m_CalibrationContainerInactiveNames.end();++iter) {
sc = m_storeGate->retrieve(clbc,*iter);
if (sc.isFailure()) {
log << MSG::ERROR << "Cannot retrieve calibration container (Inactive)" << endmsg;
} else {
v_clbcInactive.push_back(clbc);
}
}
CaloCellContainer::const_iterator f_cell = cellcoll->begin();
CaloCellContainer::const_iterator l_cell = cellcoll->end();
m_nhit = 0;
//int index = 0 ;
// float e = f_cell->energy() ;
for ( ; f_cell!=l_cell; ++f_cell)
{
float CalEM = 0;
float CalNONEM = 0;
float CalInv = 0;
float CalEsc = 0;
float CalEMInactive = 0;
float CalNONEMInactive= 0;
float CalInvInactive = 0;
float CalEscInactive = 0;
const CaloCell* cell = (*f_cell) ;
++m_nhit ;
float e = cell->energy() ;
m_eCell +=e;
//if(cell->energy()>0){
/* log << MSG::INFO << " cellenergie: " << cell->energy() <<" Layer " << cell->caloDDE()->getSampling() <<endmsg;
log << MSG::INFO << " eta " << cell->eta() << " phi " << cell->phi() << endmsg ;
log << MSG::INFO << "--------------------------------------------" << endmsg; */
//} // added on 23. april use the calibaration hits info
std::vector<const CaloCalibrationHitContainer * >::const_iterator it;
for (it=v_clbc.begin();it!=v_clbc.end();++it) {
CaloCalibrationHitContainer::const_iterator first_calib_cell;
CaloCalibrationHitContainer::const_iterator last_calib_cell = (*it)->end();
//loop over cells in calibration container
for(first_calib_cell = (*it)->begin();first_calib_cell!=last_calib_cell;++first_calib_cell)
{
if ((*first_calib_cell)->cellID()==cell->ID())
{
// CalibrationHit which correspond to cell in ClusterContainer has been found
CaloCalibrationHit *calibration_hit=*first_calib_cell;
// log << MSG::INFO << calibration_hit->energyEM()<< endmsg ;
// log << MSG::INFO <<calibration_hit->energyNonEM()<< endmsg ;
// log << MSG::INFO <<calibration_hit->energyInvisible()<< endmsg ;
// log << MSG::INFO <<calibration_hit->energyEscaped()<< endmsg ;
// log << MSG::INFO <<calibration_hit->energyTotal()<< endmsg ;
CalEM += calibration_hit->energyEM();
CalNONEM += calibration_hit->energyNonEM();
CalInv += calibration_hit->energyInvisible();
CalEsc += calibration_hit->energyEscaped();
} // end of if condition
}
} //end of loop over all calibration containers
std::vector<const CaloCalibrationHitContainer * >::const_iterator itInactive;
for (itInactive=v_clbcInactive.begin();itInactive!=v_clbcInactive.end();++itInactive) {
CaloCalibrationHitContainer::const_iterator first_calib_cell;
CaloCalibrationHitContainer::const_iterator last_calib_cell = (*itInactive)->end();
//loop over cells in calibration container
for(first_calib_cell = (*itInactive)->begin();first_calib_cell!=last_calib_cell;++first_calib_cell)
{
if ((*first_calib_cell)->cellID()==cell->ID())
{
// CalibrationHit which correspond to cell in ClusterContainer has been found
CaloCalibrationHit *calibration_hit=*first_calib_cell;
// log << MSG::INFO << calibration_hit->energyEM()<< endmsg ;
// log << MSG::INFO <<calibration_hit->energyNonEM()<< endmsg ;
// log << MSG::INFO <<calibration_hit->energyInvisible()<< endmsg ;
// log << MSG::INFO <<calibration_hit->energyEscaped()<< endmsg ;
// log << MSG::INFO <<calibration_hit->energyTotal()<< endmsg ;
CalEMInactive += calibration_hit->energyEM();
CalNONEMInactive += calibration_hit->energyNonEM();
CalInvInactive += calibration_hit->energyInvisible();
CalEscInactive += calibration_hit->energyEscaped();
} // end of if condition
}
} //end of loop over all calibration containers
// log << MSG::INFO << "cell=" << (int)cell<< endmsg ;
// log << MSG::INFO << "m_eCells=" << (int)m_eCells<< endmsg ;
// log << MSG::INFO << "m_eCells" << cell->energy()<< endmsg ;
m_eCells->push_back( cell->energy());
// log << MSG::INFO << "m_etaCells" << endmsg ;
m_etaCells->push_back(cell->eta());
// log << MSG::INFO << "m_phiCells" << endmsg ;
m_phiCells->push_back(cell->phi()) ;
// log << MSG::INFO << "Layer" << endmsg ;
Layer->push_back(cell->caloDDE()->getSampling());
// log << MSG::INFO << "CellID" << endmsg ;
CellID->push_back(cell->ID().get_identifier32().get_compact());
// log << MSG::INFO << "EM_energy" << endmsg ;
EM_energy->push_back(CalEM);
// log << MSG::INFO << "NonEM_energy" << endmsg ;
NonEM_energy->push_back(CalNONEM);
// log << MSG::INFO << "Invisible_energy" << endmsg ;
Invisible_energy->push_back(CalInv);
// log << MSG::INFO << "Escaped_energy" << endmsg ;
Escaped_energy->push_back(CalEsc);
EMInactive_energy->push_back(CalEMInactive);
// log << MSG::INFO << "NonEM_energy" << endmsg ;
NonEMInactive_energy->push_back(CalNONEMInactive);
// log << MSG::INFO << "Invisible_energy" << endmsg ;
InvisibleInactive_energy->push_back(CalInvInactive);
// log << MSG::INFO << "Escaped_energy" << endmsg ;
EscapedInactive_energy->push_back(CalEscInactive);
} // end of loop over all cells
//typedef std::map<int,int> MCdo_simul_state;
// FastCaloSimIsGenSimulStable ifs;
GenAll ifs;
MCparticleCollection particles;
log <<MSG::INFO<<"Start getting particles"<<endmsg;
sc = m_gentesIO->getMC(particles, &ifs, m_mcLocation );
if ( sc.isFailure() ) {
log << MSG::ERROR << "getMC from "<<m_mcLocation<<" failed "<< endmsg;
return StatusCode::FAILURE;
}
log << MSG::INFO <<"start finding partilces n="<<particles.size()<< endmsg;
MCparticleCollectionCIter ip;
for(auto par: particles){
log << MSG::INFO << "entering the for loop" << endmsg;
double charge = 0;
HepPDT::ParticleData* ap = m_particleDataTable->particle( abs( par->pdg_id() ) );
if(!ap){
log<<MSG::WARNING<<" id="<<par->pdg_id()<<" stat="<<par->status()<<" pt="<<par->momentum().perp()<<" eta="<<par->momentum().eta()<<" phi="<<par->momentum().phi()<<" : particle info not found"<<endmsg;
//return StatusCode::SUCCESS;
} else {
charge = ap->charge();
if(par->pdg_id()<0) charge = -charge;
}
log << MSG::INFO <<" id="<<par->pdg_id()<<" stat="<<par->status()<<" pt="<<par->momentum().perp()<<" eta="<<par->momentum().eta()<<" phi="<<par->momentum().phi()<<" charge="<<charge<< endmsg;
auto pvtx = par->production_vertex();
Trk::GlobalPosition pos(HepLorentzVector(pvtx->position().x(),pvtx->position().y(),pvtx->position().z(),pvtx->position().t()));
Trk::GlobalMomentum mom(HepLorentzVector(par->momentum().px(),par->momentum().py(),par->momentum().pz(),par->momentum().e()));
Trk::Perigee candidatePerigee(pos,mom,charge,pos);
FastShowerCellBuilderTool* the_FastShowerCellBuilderTool=dynamic_cast<FastShowerCellBuilderTool*>(&(*m_FastShowerCellBuilderTool));
log<<MSG::INFO<<"============= Getting Calo Surface ================="<<endmsg;
const Trk::TrackParameters* params_on_surface=the_FastShowerCellBuilderTool->get_calo_surface(candidatePerigee,charge);
if(!params_on_surface) {
return StatusCode::FAILURE;
}
TVector3 surface;
surface.SetPtEtaPhi(1,the_FastShowerCellBuilderTool->get_eta_calo_surf(),the_FastShowerCellBuilderTool->get_phi_calo_surf());
surface.SetMag(the_FastShowerCellBuilderTool->get_d_calo_surf());
log<<MSG::INFO<< "eta_calo_surf: "<< the_FastShowerCellBuilderTool->get_eta_calo_surf() << "phi_calo_surf(): "<< the_FastShowerCellBuilderTool->get_phi_calo_surf() << endmsg;
dcalosurf=the_FastShowerCellBuilderTool->get_d_calo_surf();
etacalosurf=the_FastShowerCellBuilderTool->get_eta_calo_surf();
phicalosurf=the_FastShowerCellBuilderTool->get_phi_calo_surf();
for(int sample=CaloCell_ID_FCS::FirstSample;sample<CaloCell_ID_FCS::MaxSample;++sample) {
log<<MSG::INFO<<"============= Getting Calo position for sample "<<sample<<endmsg;
lok->push_back(the_FastShowerCellBuilderTool->get_calo_etaphi(params_on_surface,(CaloCell_ID_FCS::CaloSample)sample));
ldcalolayercenter->push_back(the_FastShowerCellBuilderTool->get_d_calo_surf(sample));
letacalolayercenter->push_back(the_FastShowerCellBuilderTool->get_eta_calo_surf(sample));
lphicalolayercenter->push_back(the_FastShowerCellBuilderTool->get_phi_calo_surf(sample));
;
}
break;
}
return StatusCode::SUCCESS;
}
StatusCode CBNTAA_DetailedCellInfo::CBNT_clear()
{
MsgStream log( messageService(), name() );
log << MSG::INFO << " in CBNT_DetailedCellInfo_clear" << endmsg;
m_nhit=0 ;
m_eCell=0 ;
m_eCells->clear() ;
m_etaCells->clear() ;
m_phiCells->clear() ;
EM_energy->clear() ;
NonEM_energy->clear() ;
Invisible_energy->clear() ;
Escaped_energy->clear() ;
EMInactive_energy->clear() ;
NonEMInactive_energy->clear() ;
InvisibleInactive_energy->clear() ;
EscapedInactive_energy->clear() ;
Layer->clear();
CellID->clear();
dcalosurf=0;
etacalosurf=0;
phicalosurf=0;
ldcalolayercenter->clear();
letacalolayercenter->clear();
lphicalolayercenter->clear();
lok->clear();
if (m_savePosition) {
m_xCells->clear() ;
m_yCells->clear() ;
m_zCells->clear() ;
}
m_fitQCells->clear() ;
m_gainCells->clear() ;
if (m_saveDetInfo) m_detCells->clear() ;
if (m_saveTimeInfo) m_timeCells->clear() ;
if (m_saveId) m_offId->clear();
if (m_saveQInfo) m_qCells->clear() ;
return StatusCode::SUCCESS;
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef CBNTAA_DETAILEDCELLINFO_H
#define CBNTAA_DETAILEDCELLINFO_H
//
// CBNTAA_DetailedCellInfo:
// CBNT Algorithm class accessing detailed cell Information
// for the parametrization
// Retrieve CaloCell container, and make ntuple
//
// ***** Algorithm properties (name defined in cxx file):
// ***** NtupleID: Ntuple ID number
// ***** CellColl: Cell Container name
#include "CBNT_Utils/CBNT_AthenaAwareBase.h"
#include "FastCaloSim/FastShowerCellBuilderTool.h"
#include "HepPDT/ParticleDataTable.hh"
//#include "GaudiKernel/NTuple.h"
#include "Identifier/Identifier.h"
#include "GaudiKernel/ToolHandle.h"
#include <string>
class StoreGateSvc;
class LArEM_ID;
class LArFCAL_ID;
class LArHEC_ID;
class TileID;
class CaloCalibrationHitContainer;
//class ICaloBadChanTool;
class CBNTAA_DetailedCellInfo: public CBNT_AthenaAwareBase
{
public:
CBNTAA_DetailedCellInfo(const std::string& name, ISvcLocator* pSvcLocator);
virtual ~CBNTAA_DetailedCellInfo();
StatusCode CBNT_initialize();
StatusCode CBNT_execute();
StatusCode CBNT_finalize();
StatusCode CBNT_clear();
private:
std::vector<std::string> m_CalibrationContainerNames;
std::vector<std::string> m_CalibrationContainerInactiveNames;
std::string m_cellsName; //Cell container
int m_maxNCells ; //Maximum number of cells in ntuple
std::vector<unsigned int> m_caloNums ; // which calo to treat
float m_cellEnergyThreshold ; // threshold on cell energy for ntuple
// if negative symmetric
bool m_saveDetInfo;
bool m_saveTimeInfo;
bool m_caloSelection ;
bool m_saveQInfo;
bool m_saveId;
bool m_savePosition;
const CaloDetDescrManager* m_caloDDM;
// ToolHandle<ICaloBadChanTool> m_pb_tool;
ToolHandle<ICaloCellMakerTool> m_FastShowerCellBuilderTool;
//ToolHandle<FastShowerCellBuilderTool> m_FastShowerCellBuilderTool;
TruthHelper::GenAccessIO* m_gentesIO;
HepPDT::ParticleDataTable* m_particleDataTable;
// variables to be in ntuple.
long m_nhit;
float m_eCell;
long m_nCells;
std::vector<float> * m_eCells;
//######################
std::vector<float> * EM_energy;
std::vector<float> * NonEM_energy;
std::vector<float> * Invisible_energy;
std::vector<float> * Escaped_energy;
std::vector<float> * EMInactive_energy;
std::vector<float> * NonEMInactive_energy;
std::vector<float> * InvisibleInactive_energy;
std::vector<float> * EscapedInactive_energy;
std::vector<long> * Layer;
std::vector<long> * CellID;
//######################
std::vector<float> * m_etaCells;
std::vector<float> * m_phiCells;
std::vector<float> * m_xCells;
std::vector<float> * m_yCells;
std::vector<float> * m_zCells;
std::vector<long> * m_detCells;
std::vector<float> * m_timeCells;
std::vector<long> * m_qCells;
std::vector<float> * m_fitQCells;
std::vector<long> * m_gainCells;
std::vector< unsigned long >* m_offId;
//######################
float dcalosurf;
float etacalosurf;
float phicalosurf;
std::vector<float> * ldcalolayercenter;
std::vector<float> * letacalolayercenter;
std::vector<float> * lphicalolayercenter;
std::vector<bool> * lok;
StoreGateSvc* m_storeGate;
std::string m_suffix;
std::string m_cellsoutfile;
std::string m_mcLocation;
};
#endif
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# DetailedCellInfo
from FastCaloSim.FastCaloSimConf import CBNTAA_DetailedCellInfo
the_CBNT_DetailedCellInfo = CBNTAA_DetailedCellInfo()
topSequence.CBNT_AthenaAware += the_CBNT_DetailedCellInfo
the_CBNT_DetailedCellInfo.CalibrationContainers = [ "LArCalibrationHitActive", "TileCalibrationCellHitCnt"]
the_CBNT_DetailedCellInfo.CalibrationContainersInactive = [ "LArCalibrationHitInactive"]
#Write a text file with the geometry information of all calorimeter cells
#the_CBNT_DetailedCellInfo.CellinfoOutfile="outcells.ATLAS-CSC-05-00-00.txt"
from FastCaloSim.FastCaloSimFactory import FastCaloSimFactory
theFastShowerCellBuilderTool=FastCaloSimFactory()
from AthenaCommon.AppMgr import ToolSvc
ToolSvc += theFastShowerCellBuilderTool
the_CBNT_DetailedCellInfo.FastShowerCellBuilderTool=theFastShowerCellBuilderTool
#Reconfigure truth output to store all particles
#from CBNT_Truth.CBNTAA_TruthCfg import CBNTAA_Truth
#theCBNTAA_Truth.All.Enable = True
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include <vector>
#include "FastCaloSim/FastCaloSimIsGenSimulStable.h"
#include "AtlasHepMC/GenParticle.h"
#include "AtlasHepMC/GenVertex.h"
using std::vector;
using std::abs;
//****************************************************************
//* FastCaloSimIsGenSimulStable *
//****************************************************************
FastCaloSimIsGenSimulStable::FastCaloSimIsGenSimulStable() {}
bool FastCaloSimIsGenSimulStable::operator()( const HepMC::GenParticle* const p ) const {
int status=p->status();
HepMC::GenVertex* vertex = p->end_vertex();
// we want to keep primary particle with status==2 but without vertex in HepMC
int vertex_barcode=-999999;
if (vertex) vertex_barcode=vertex->barcode();
return (
(status%1000 == 1) ||
(status%1000 == 2 && status > 1000) ||
(status==2 && vertex_barcode<-200000)
) ? true:false;
}
bool FastCaloSimIsGenSimulStable::operator() ( const HepMC::GenParticle& p ) const {
return this->operator()(&p);
}
GenIMCselector* FastCaloSimIsGenSimulStable::create() const {return new FastCaloSimIsGenSimulStable(*this);}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// *************************************************************************
// * *
// * class FastCaloSimIsGenSimulStable *
// * *
// * this predicate returns true if the particle is stable in a generated *
// * event or is a Geant decay product *
// * i.e. the particle belongs to the final state. *
// * *
// *************************************************************************
#ifndef TRUTHHELPER_FASTCALOSIMISGENSIMULSTABLE_H
#define TRUTHHELPER_FASTCALOSIMISGENSIMULSTABLE_H
#ifndef TRUTHHELPER_GENIMCSELECTOR_H
#include "TruthHelper/GenIMCselector.h"
#endif
using namespace TruthHelper;
class FastCaloSimIsGenSimulStable: public GenIMCselector {
public:
FastCaloSimIsGenSimulStable();
GenIMCselector* create() const;
virtual bool operator()( const HepMC::GenParticle* const p )const;
virtual bool operator()( const HepMC::GenParticle& p ) const;
private:
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment