diff --git a/k4GaudiPandora/include/DDCaloDigi.h b/k4GaudiPandora/include/DDCaloDigi.h index 958772d..52ead06 100644 --- a/k4GaudiPandora/include/DDCaloDigi.h +++ b/k4GaudiPandora/include/DDCaloDigi.h @@ -103,11 +103,9 @@ const int MAX_LAYERS = 200; const int MAX_STAVES = 16; using retType = std::tuple; using DDCaloDigi_t = k4FWCore::MultiTransformer; @@ -119,18 +117,19 @@ struct DDCaloDigi final StatusCode finalize() override; retType operator()( - const edm4hep::SimCalorimeterHitCollection& ecalSimCaloHits, - const edm4hep::SimCalorimeterHitCollection& hcalSimCaloHits, + const edm4hep::SimCalorimeterHitCollection& simCaloHits, const edm4hep::EventHeaderCollection& headers) const; private: // collections - Gaudi::Property m_ecalCollection{this, "ECALCollection", "ecalCollection", "The input collection for ECAL"}; - Gaudi::Property m_hcalCollection{this, "HCALCollection", "hcalCollection", "The input collection for HCAL"}; - Gaudi::Property m_outputEcalCollection{this, "OutputECALCollection", "outputEcalCollection", "The output collection for ECAL"}; - Gaudi::Property m_outputHcalCollection{this, "OutputHCALCollection", "outputHcalCollection", "The output collection for HCAL"}; - Gaudi::Property m_outputRelCollection{this, "OutputRelCollection", "outputRelCollection", "The output relation collection"}; + Gaudi::Property m_inputCollection{this, "inputCaloCollection", {"inputCollection"}, "The input SimCalorimeterHitCollection"}; + //Gaudi::Property m_ecalCollection{this, "ECALCollection", "ecalCollection", "The input collection for ECAL"}; + //Gaudi::Property m_hcalCollection{this, "HCALCollection", "hcalCollection", "The input collection for HCAL"}; + //Gaudi::Property m_outputEcalCollection{this, "OutputECALCollection", "outputEcalCollection", "The output collection for ECAL"}; + //Gaudi::Property m_outputHcalCollection{this, "OutputHCALCollection", "outputHcalCollection", "The output collection for HCAL"}; + Gaudi::Property m_outputCollection{this, "outputCollection", {"outputCollection"}, "The output CalorimeterHitCollection"}; + Gaudi::Property m_RelCollection{this, "RelCollection", {"outputRelCollection"}, "The output relation collection"}; // digitazing parameters for ECAL and HCAL Gaudi::Property m_thresholdEcal{this, "ECALThreshold", {5.0e-5}, "Threshold for ECAL Hits in GeV"}; diff --git a/k4GaudiPandora/options/runDDCaloDigi.py b/k4GaudiPandora/options/runDDCaloDigi.py index d6462c7..446ea05 100644 --- a/k4GaudiPandora/options/runDDCaloDigi.py +++ b/k4GaudiPandora/options/runDDCaloDigi.py @@ -37,14 +37,14 @@ calodigi = DDCaloDigi() #FIXME: add properties -calodigi.ECALCollection = "ECalBarrelCollection" # "ECalBarrelCollection","ECalEndcapCollection" -calodigi.HCALCollection = "HCalBarrelCollection" # "HCalBarrelCollection","HCalEndcapCollection","HCalRingCollection" -calodigi.OutputECALCollection = "ECALCaloHitCollection" -calodigi.OutputHCALCollection = "HCALCaloHitCollection" -calodigi.OutputRelCollection = "RelCollection" +calodigi.inputCollection = "ECalBarrelCollection" # "ECalBarrelCollection","ECalEndcapCollection" + # "HCalBarrelCollection","HCalEndcapCollection","HCalRingCollection" +calodigi.outputCollection = "ECALCaloHitCollection" +#calodigi.OutputHCALCollection = "HCALCaloHitCollection" +calodigi.outputRelCollection = "RelCollection" iosvc = IOSvc() -iosvc.input = "../simulation/sim_partgun_1000.root" +iosvc.input = "../simulation/sim_edm4hep.root" iosvc.output = "../outputfiles/outputCaloDigi_Gaudi.root" hps = RootHistSvc("HistogramPersistencySvc") diff --git a/k4GaudiPandora/src/DDCaloDigi.cc b/k4GaudiPandora/src/DDCaloDigi.cc index 905b402..e1a01a5 100644 --- a/k4GaudiPandora/src/DDCaloDigi.cc +++ b/k4GaudiPandora/src/DDCaloDigi.cc @@ -82,21 +82,20 @@ dd4hep::rec::LayeredCalorimeterData* getExtension(unsigned int includeFlag, unsi DDCaloDigi::DDCaloDigi(const std::string& aName, ISvcLocator* aSvcLoc) : MultiTransformer(aName, aSvcLoc, { - KeyValues("ECALCollection", {"ECalBarrelCollection"}), - KeyValues("HCALCollection", {"HCalBarrelCollection"}), + KeyValues("inputCollection", {"ECalBarrelCollection"}), KeyValues("HeaderName", {"EventHeader"}), }, { - KeyValues("OutputECALCollection", {"ECalorimeterHit1"}), //, "ECalorimeterHit2", "ECalorimeterHit3"}), - KeyValues("OutputHCALCollection", {"HCalorimeterHit1"}), //, "HCalorimeterHit2", "HCalorimeterHit3"}), - KeyValues("OutputRelCollection", {"RelationSimCaloHit"}) + KeyValues("outputECALCollection", {"ECalorimeterHit1"}), //, "ECalorimeterHit2", "ECalorimeterHit3"}), + //KeyValues("OutputHCALCollection", {"HCalorimeterHit1"}), //, "HCalorimeterHit2", "HCalorimeterHit3"}), + KeyValues("outputRelCollection", {"RelationCaloHit"}) }) { m_uidSvc = service("UniqueIDGenSvc", true); if (!m_uidSvc) { error() << "Unable to get UniqueIDGenSvc" << endmsg; } - m_geoSvc = serviceLocator()->service("GeoSvc"); // important to initialize m_geoSvc + //m_geoSvc = serviceLocator()->service("GeoSvc"); // important to initialize m_geoSvc // // helper struct for string comparision --- Is needed??? @@ -275,15 +274,14 @@ StatusCode DDCaloDigi::initialize() { } retType DDCaloDigi::operator()( - const edm4hep::SimCalorimeterHitCollection& ecalSimCaloHitCollection, - const edm4hep::SimCalorimeterHitCollection& hcalSimCaloHitCollection, + const edm4hep::SimCalorimeterHitCollection& simCaloHitCollection, const edm4hep::EventHeaderCollection& eventHeaders) const { auto const& headers = eventHeaders.at(nRun); //FIXME maybe debug() << " process event : " << headers.getEventNumber() << " - run " << headers.getRunNumber() << endmsg; // headers[0].getRunNumber(),headers[0].getEventNumber() auto ecalcol = edm4hep::CalorimeterHitCollection(); // create output collection for ECAL - auto hcalcol = edm4hep::CalorimeterHitCollection(); // create output collection for HCAL + //auto hcalcol = edm4hep::CalorimeterHitCollection(); // create output collection for HCAL //edm4hep::CaloHitSimCaloHitLinkCollection outputRelation; auto Relcol = edm4hep::CaloHitSimCaloHitLinkCollection(); // create relation collection CalorimeterHit-SimCalorimeterHit @@ -299,7 +297,7 @@ retType DDCaloDigi::operator()( // // * Reading Collections of ECAL Simulated Hits * // - std::string ecalColName = m_ecalCollection; // The input collection for ECAL + std::string ecalColName = m_inputCollection; // The input collection for ECAL cout << "looking for collection: " << ecalColName << endl; if (ecalColName.find("dummy") != string::npos) { @@ -335,7 +333,7 @@ retType DDCaloDigi::operator()( } - for (const auto& hit : ecalSimCaloHitCollection) { + for (const auto& hit : simCaloHitCollection) { // SimCalorimeterHit * hit = dynamic_cast( col->getElementAt( j ) ) ; const int cellID = hit.getCellID(); float energy = hit.getEnergy(); @@ -576,7 +574,7 @@ retType DDCaloDigi::operator()( // ecalcol->parameters().setValue(LCIO::CellIDEncoding,initString); } - //return std::make_tuple(std::move(ecalcol), std::move(Relcol)); + return std::make_tuple(std::move(ecalcol), std::move(Relcol)); if (m_histograms) { @@ -603,6 +601,7 @@ retType DDCaloDigi::operator()( // // * Reading HCAL Collections of Simulated Hits * // + /* std::string hcalColName = m_hcalCollection; // The input collection for HCAL cout << "looking for collection: " << hcalColName << endl; @@ -621,7 +620,7 @@ retType DDCaloDigi::operator()( // for (int j(0); j < numElements; ++j) { //loop over all SimCalorimeterHits in this collection //auto hcaloRel = Relcol.create(); - for (const auto& hit : hcalSimCaloHitCollection) { + for (const auto& hit : simCaloHitCollection) { float energy = hit.getEnergy(); //preselect for SimHits with energySum>threshold. Doubtful at least, as lower energy hit might fluctuate up and still be counted if (energy > m_thresholdHcal[0] / 2) { @@ -800,9 +799,11 @@ retType DDCaloDigi::operator()( // evt->addCollection(chschcol,_outputRelCollection.c_str()); // _nEvt++; -return std::make_tuple(std::move(ecalcol), std::move(hcalcol), std::move(Relcol)); +return std::make_tuple(std::move(hcalcol), std::move(Relcol)); +*/ } + StatusCode DDCaloDigi::finalize() { return StatusCode::SUCCESS; } //fix // if (_histograms) {