90 ,
m_path(
"/PixelRDOAnalysis/")
159 m_h_rdoID =
new TH1F(
"h_rdoID",
"rdoID", 100, 0, 5e17);
163 m_h_rdoWord =
new TH1F(
"h_rdoWord",
"rdoWord", 100, 0, 350);
167 m_h_barrelEndcap =
new TH1F(
"h_barrelEndcap",
"Barrel or Endcap", 100, -5, 5);
171 m_h_layerDisk =
new TH1F(
"h_layerDisk",
"Barrel layer or Endcap disk", 100, 0, 3);
175 m_h_phiModule =
new TH1F(
"h_phiModule",
"Phi module", 100, 0, 75);
179 m_h_etaModule =
new TH1F(
"h_etaModule",
"Eta module", 100, 0, 15);
183 m_h_phiIndex =
new TH1F(
"h_phiIndex",
"Phi index", 100, 0, 350);
187 m_h_etaIndex =
new TH1F(
"h_etaIndex",
"Eta index", 100, 0, 225);
191 m_h_ToT =
new TH1F(
"h_ToT",
"ToT", 100, 0, 250);
195 m_h_BCID =
new TH1F(
"h_BCID",
"BCID", 100, -1.5, 1.5);
199 m_h_LVL1A =
new TH1F(
"h_LVL1A",
"LVL1A", 100, -1.5, 1.5);
203 m_h_LVL1ID =
new TH1F(
"h_LVL1ID",
"LVL1ID", 100, -1.5, 1.5);
207 m_h_brlLayer =
new TH1F(
"h_brlLayer",
"Barrel layer", 100, 0, 3);
211 m_h_brlPhiMod =
new TH1F(
"h_brlPhiMod",
"Barrel phi module", 100, 0, 80);
215 m_h_brlEtaMod =
new TH1F(
"h_brlEtaMod",
"Barrel eta module", 100, 0, 15);
219 m_h_brlPhiIndex =
new TH1F(
"h_brlPhiIndex",
"Barrel phi index", 100, 0, 350);
223 m_h_brlEtaIndex =
new TH1F(
"h_brlEtaIndex",
"Barrel eta index", 100, 0, 225);
227 m_h_brlToT =
new TH1F(
"h_brlToT",
"Barrel ToT", 100, 0, 250);
231 m_h_brlBCID =
new TH1F(
"h_brlBCID",
"Barrel BCID", 100, -1.5, 1.5);
235 m_h_brlLVL1A =
new TH1F(
"h_brlLVL1A",
"Barrel LVL1A", 100, -1.5, 1.5);
239 m_h_brlLVL1ID =
new TH1F(
"h_brlLVL1ID",
"Barrel LVL1ID", 100, -1.5, 1.5);
243 m_h_ecDisk =
new TH1F(
"h_ecDisk",
"Endcap disk", 100, 0, 3);
247 m_h_ecPhiMod =
new TH1F(
"h_ecPhiMod",
"Endcap phi module", 100, 0, 80);
251 m_h_ecEtaMod =
new TH1F(
"h_ecEtaMod",
"Endcap eta module", 100, 0, 15);
255 m_h_ecPhiIndex =
new TH1F(
"h_ecPhiIndex",
"Endcap phi index", 100, 0, 350);
259 m_h_ecEtaIndex =
new TH1F(
"h_ecEtaIndex",
"Endcap eta index", 100, 0, 225);
263 m_h_ecToT =
new TH1F(
"h_ecToT",
"EndcapToT", 100, 0, 250);
267 m_h_ecBCID =
new TH1F(
"h_ecBCID",
"Endcap BCID", 100, -1.5, 1.5);
271 m_h_ecLVL1A =
new TH1F(
"h_ecLVL1A",
"Endcap LVL1A", 100, -1.5, 1.5);
275 m_h_ecLVL1ID =
new TH1F(
"h_ecLVL1ID",
"Endcap LVL1ID", 100, -1.5, 1.5);
279 m_h_sdoID =
new TH1F(
"h_sdoID",
"sdoID", 100, 0, 5e17);
283 m_h_sdoWord =
new TH1F(
"h_sdoWord",
"sdoWord", 100, 0, 350);
291 m_h_layerDisk_sdo =
new TH1F(
"h_layerDisk_sdo",
"Barrel layer or Endcap disk (SDO)", 100, 0, 3);
303 m_h_phiIndex_sdo =
new TH1F(
"h_phiIndex_sdo",
"Phi index (SDO)", 100, 0, 350);
307 m_h_etaIndex_sdo =
new TH1F(
"h_etaIndex_sdo",
"Eta index (SDO)", 100, 0, 350);
311 m_h_barcode =
new TH1F(
"h_barcode",
"Barcode (SDO)", 100, 0, 2.2e5);
315 m_h_eventIndex =
new TH1F(
"h_eventIndex",
"Event Index (SDO)", 100, 0, 2);
319 m_h_charge =
new TH1F(
"h_charge",
"Charge (SDO)", 100, 0, 1e7);
324 TString truthMatchBinLables[4] = {
"All RDOs",
"Truth Matched",
"HS Matched",
"Unmatched" };
325 for(
unsigned int ibin = 1; ibin < 5; ibin++) {
331 return StatusCode::SUCCESS;
373 bool doTruthMatching =
true;
374 const HepMC::GenEvent* hardScatterEvent(
nullptr);
376 if ((!mcEventCollection.
isValid())||mcEventCollection->size()==0){
377 ATH_MSG_WARNING(
"Failed to retrieve a nonzero sized truth event collection, disabling truthMatching");
378 doTruthMatching =
false;
380 if(doTruthMatching) hardScatterEvent = mcEventCollection->at(0);
382 if(p_pixelRDO_cont.
isValid()) {
386 for ( ; rdoCont_itr != rdoCont_end; ++rdoCont_itr ) {
390 for ( ; rdo_itr != rdo_end; ++rdo_itr ) {
393 bool findMatch =
false;
395 InDetSimDataCollection::const_iterator iter = (*simDataMapPixel).find((*rdo_itr)->identify());
397 if ( iter != (*simDataMapPixel).end() ) {
399 const std::vector< InDetSimData::Deposit >& deposits = sdo.
getdeposits();
400 std::vector< InDetSimData::Deposit >::const_iterator nextdeposit = deposits.begin();
401 std::vector< InDetSimData::Deposit >::const_iterator lastdeposit = deposits.end();
402 for( ; nextdeposit!=lastdeposit; ++nextdeposit) {
404 if(particleLink.
isValid() && !findMatch){
415 const Identifier rdoID((*rdo_itr)->identify());
416 const int pixBrlEc(
m_pixelID->barrel_ec(rdoID));
417 const unsigned int rdoWord((*rdo_itr)->getWord());
418 const int pixLayerDisk(
m_pixelID->layer_disk(rdoID));
419 const int pixPhiMod(
m_pixelID->phi_module(rdoID));
420 const int pixEtaMod(
m_pixelID->eta_module(rdoID));
421 const int pixPhiIx(
m_pixelID->phi_index(rdoID));
422 const int pixEtaIx(
m_pixelID->eta_index(rdoID));
423 const int pixToT((*rdo_itr)->getToT());
424 const int pixBCID((*rdo_itr)->getBCID());
425 const int pixLVL1A((*rdo_itr)->getLVL1A());
426 const int pixLVL1ID((*rdo_itr)->getLVL1ID());
428 const unsigned long long rdoID_int = rdoID.
get_compact();
437 m_ToT->push_back(pixToT);
438 m_BCID->push_back(pixBCID);
466 else if (abs(pixBrlEc) == 4) {
482 if(simDataMapPixel.
isValid()) {
484 InDetSimDataCollection::const_iterator sdo_itr(simDataMapPixel->begin());
485 const InDetSimDataCollection::const_iterator sdo_end(simDataMapPixel->end());
487 std::vector<int> barcode_vec;
488 std::vector<int> eventIndex_vec;
489 std::vector<float> charge_vec;
490 for ( ; sdo_itr != sdo_end; ++sdo_itr ) {
493 const unsigned long long sdoID_int = sdoID.
get_compact();
494 const int sdoWord(sdo.
word());
495 const int pixBrlEc_sdo(
m_pixelID->barrel_ec(sdoID));
496 const int pixLayerDisk_sdo(
m_pixelID->layer_disk(sdoID));
497 const int pixPhiMod_sdo(
m_pixelID->phi_module(sdoID));
498 const int pixEtaMod_sdo(
m_pixelID->eta_module(sdoID));
499 const int pixPhiIx_sdo(
m_pixelID->phi_index(sdoID));
500 const int pixEtaIx_sdo(
m_pixelID->eta_index(sdoID));
529 const std::vector<InDetSimData::Deposit>& deposits = sdo.
getdeposits();
530 std::vector<InDetSimData::Deposit>::const_iterator dep_itr(deposits.begin());
531 const std::vector<InDetSimData::Deposit>::const_iterator dep_end(deposits.end());
532 for ( ; dep_itr != dep_end; ++dep_itr ) {
536 const int charge((*dep_itr).second);
546 barcode_vec.push_back(bar);
547 eventIndex_vec.push_back(eventIx);
548 charge_vec.push_back(
charge);
554 eventIndex_vec.clear();
563 return StatusCode::SUCCESS;
567 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
double charge(const T &p)
InDetRawDataCollection< PixelRDORawData > PixelRDO_Collection
Handle class for reading from StoreGate.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
DataModel_detail::const_iterator< DataVector > const_iterator
const_iterator end() const noexcept
const_iterator begin() const noexcept
a link optimized in size for a GenParticle in a McEventCollection
bool isValid() const
Validity check.
HepMC::ConstGenParticlePtr cptr() const
Dereference.
index_type eventIndex() const
Return the event number of the referenced GenEvent.
value_type get_compact() const
Get the compact id.
const std::vector< Deposit > & getdeposits() const
std::vector< int > * m_etaModule
ServiceHandle< ITHistSvc > m_thistSvc
std::vector< int > * m_phiModule
PixelRDOAnalysis(const std::string &name, ISvcLocator *pSvcLocator)
std::vector< int > * m_phiIndex
std::vector< int > * m_phiModule_sdo
std::string m_ntupleFileName
std::vector< int > * m_barrelEndcap_sdo
std::vector< bool > * m_belowThresh
std::vector< int > * m_layerDisk_sdo
std::vector< int > * m_etaIndex
std::vector< int > * m_BCID
const PixelID * m_pixelID
std::vector< int > * m_barrelEndcap
SG::ReadHandleKey< PixelRDO_Container > m_inputKey
virtual StatusCode execute() override final
std::vector< int > * m_etaModule_sdo
TH1 * m_h_barrelEndcap_sdo
std::vector< int > * m_LVL1A
std::vector< int > * m_phiIndex_sdo
std::vector< std::vector< int > > * m_eventIndex_vec
std::vector< int > * m_barcode
std::vector< int > * m_etaIndex_sdo
std::vector< int > * m_charge
std::vector< int > * m_sdoWord
std::vector< unsigned long long > * m_rdoID
std::vector< unsigned long long > * m_sdoID
std::vector< unsigned int > * m_rdoWord
virtual StatusCode initialize() override final
std::vector< int > * m_ToT
std::string m_ntupleTreeName
SG::ReadHandleKey< McEventCollection > m_inputMcEventCollectionKey
std::string m_ntupleDirName
std::vector< std::vector< int > > * m_barcode_vec
virtual StatusCode finalize() override final
std::vector< int > * m_eventIndex
SG::ReadHandleKey< InDetSimDataCollection > m_inputTruthKey
std::vector< bool > * m_noise
std::vector< std::vector< float > > * m_charge_vec
std::vector< bool > * m_badTOT
TH1 * m_h_TruthMatchedRDOs
std::vector< int > * m_LVL1ID
std::vector< bool > * m_disabled
std::vector< int > * m_layerDisk
static bool isBelowThreshold(const InDetSimData &sdo)
static bool hasBadTOT(const InDetSimData &sdo)
static bool isNoise(const InDetSimData &sdo)
static bool isDisabled(const InDetSimData &sdo)
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const GenParticle * ConstGenParticlePtr