Commit fabf8be8 authored by Xuhao Yuan's avatar Xuhao Yuan
Browse files

test

parent 09271cd7
Pipeline #3429786 failed with stages
in 24 seconds
......@@ -196,6 +196,19 @@ StatusCode MCUTDepositCreator::execute() {
}
} // iSpill
#if 0
std::cout<<"I am a test in MCUTDepositCreator::execute() : "<<depositsVec.size()<<std::endl;
int hehe = 0;
for ( MCUTDeposits* depositsCont : depositsVec ) {
auto iter = depositsCont->begin();
while ( iter != depositsCont->end() ) {
std::cout<<hehe++<<" -th deposit "<<tracker()->convertID((*iter)->channelID()).channelID()<<" ; "<<(*iter)->depositedCharge()<<" ; ";
std::cout<<(*iter)->mcHit()->midPoint()<<std::endl;
++iter;
}
}
#endif
// sort by channel
for ( MCUTDeposits* depositsCont : depositsVec ) {
std::stable_sort( depositsCont->begin(), depositsCont->end(),
......@@ -208,6 +221,12 @@ StatusCode MCUTDepositCreator::execute() {
void MCUTDepositCreator::createDeposits( const MCHits* mcHitsCont, const double spillTime,
std::vector<MCUTDeposits*>& depositCont ) {
// loop over MChits
#if 0
int hehe = 0;
for ( MCHit* aHit : *mcHitsCont ) {
std::cout<<hehe++<<"-th mchits : "<<aHit->midPoint()<<std::endl;
}
#endif
for ( MCHit* aHit : *mcHitsCont ) {
......
......@@ -12,6 +12,8 @@
#include "Event/MCUTDigit.h"
#include "GaudiAlg/Transformer.h"
#include "Kernel/UTAlgBase.h"
#include "GaudiKernel/SmartIF.h" // to be remove!!
#include "Event/MCTruth.h" // to be remove
using namespace LHCb;
......@@ -73,5 +75,25 @@ MCUTDigits MCUTDigitCreator::operator()( const MCUTDeposits& depositCont ) const
} // iterDep
#if 0 //SAME!!!!
std::cout<<"I am a test in MCUTDigitCreator::operator() : "<<digitCont.size()<<std::endl;
std::stable_sort( digitCont.begin(), digitCont.end(), [&](MCUTDigit* p1, MCUTDigit* p2){
auto x1 = tracker()->convertID(UTChannelID{p1->key()}).channelID();
auto x2 = tracker()->convertID(UTChannelID{p2->key()}).channelID();
return x1<x2;});
int hehe = 0;
auto iter = digitCont.begin();
for ( ; iter != digitCont.end(); ++iter ) {
std::cout<<hehe++<<" -th digit "<<tracker()->convertID((*iter)->channelID()).channelID()<<" ; "<<(*iter)->mcDeposit().size()<<std::endl;
for ( const auto& iterDep : (*iter)->mcDeposit() ) {
const MCHit* aHit = iterDep->mcHit();
std::cout<<aHit->midPoint()<<" ; "<<tracker()->convertID(iterDep->channelID()).channelID()<<" ; "<<iterDep->depositedCharge()<<std::endl;
}
}
std::stable_sort( digitCont.begin(), digitCont.end(), [&](MCUTDigit* p1, MCUTDigit* p2){
auto x1 = (UTChannelID{p1->key()}).channelID();
auto x2 = (UTChannelID{p2->key()}).channelID();
return x1<x2;});
#endif
return digitCont;
}
......@@ -137,22 +137,67 @@ StatusCode UTDigitCreator::initialize() {
UTDigits UTDigitCreator::operator()( const MCUTDigits& mcDigitCont ) const {
#if 0
//MCUTDigits mcDigitCont_new = mcDigitCont;
std::cout<<"I am a test in UTDigitCreator::operator() "<<mcDigitCont.size()<<std::endl;
for (auto iter : mcDigitCont){
std::cout<<"mcDigit->mcDeposit().size() = "<<iter->mcDeposit().size()<<std::endl;
for ( const auto& iterDep : iter->mcDeposit() ) {
std::cout<<"\t"<<tracker()->convertID(iterDep->channelID()).channelID()<<" ; "<<iterDep->depositedCharge()<<std::endl;
}
}
#endif
// create UTDigits
UTDigits digitsCont;
createDigits( &mcDigitCont, &digitsCont );
#if 0 //SAME!!!
std::cout<<"I am a test in UTDigitCreator::operator() : "<<digitsCont.size()<<std::endl;
std::stable_sort( digitsCont.begin(), digitsCont.end(), [&](UTDigit* p1, UTDigit* p2){
auto x1 = tracker()->convertID(UTChannelID{p1->key()}).channelID();
auto x2 = tracker()->convertID(UTChannelID{p2->key()}).channelID();
return x1<x2;});
int hehe = 0;
auto iter = digitsCont.begin();
for ( ; iter != digitsCont.end(); ++iter ) {
std::cout<<hehe++<<" -th digit "<<tracker()->convertID((*iter)->channelID()).channelID()<<" ; "<<(*iter)->depositedCharge()<<" ; "<<(*iter)->index()<<std::endl;
}
std::stable_sort( digitsCont.begin(), digitsCont.end(), [&](UTDigit* p1, UTDigit* p2){
auto x1 = (UTChannelID{p1->key()}).channelID();
auto x2 = (UTChannelID{p2->key()}).channelID();
return x1<x2;});
#endif
#if 0
// generate random noise
std::vector<digitPair> noiseCont;
genRanNoiseStrips( noiseCont );
// merge containers
mergeContainers( noiseCont, &digitsCont );
#if 0 //SAME!!!
std::cout<<"I am a test in UTDigitCreator::operator() : "<<digitsCont.size()<<std::endl;
std::stable_sort( digitsCont.begin(), digitsCont.end(), [&](UTDigit* p1, UTDigit* p2){
auto x1 = tracker()->convertID(UTChannelID{p1->key()}).channelID();
auto x2 = tracker()->convertID(UTChannelID{p2->key()}).channelID();
return x1<x2;});
int hehe = 0;
auto iter = digitsCont.begin();
for ( ; iter != digitsCont.end(); ++iter ) {
std::cout<<hehe++<<" -th digit "<<tracker()->convertID((*iter)->channelID()).channelID()<<" ; "<<(*iter)->depositedCharge()<<std::endl;
}
std::stable_sort( digitsCont.begin(), digitsCont.end(), [&](UTDigit* p1, UTDigit* p2){
auto x1 = (UTChannelID{p1->key()}).channelID();
auto x2 = (UTChannelID{p2->key()}).channelID();
return x1<x2;});
#endif
// resort by channel
std::stable_sort( digitsCont.begin(), digitsCont.end(), UTDataFunctor::Less_by_Channel<const UTDigit*>() );
// Ensure that there is neighbours for all strips
addNeighbours( &digitsCont );
#endif
// and finally resort
std::stable_sort( digitsCont.begin(), digitsCont.end(), UTDataFunctor::Less_by_Channel<const UTDigit*>() );
......@@ -161,8 +206,25 @@ UTDigits UTDigitCreator::operator()( const MCUTDigits& mcDigitCont ) const {
setMCTruth( &digitsCont, &mcDigitCont )
.orThrow( "Failed to set MCTruth info", "UTDigitCreator" )
.ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ );
// checked no difference in setMCTruth!!! XuhaoYuan<<--- to be removed later
// register UTDigits in the transient data store
#if 0 //SAME!!!
std::cout<<"I am a test in UTDigitCreator::operator() : "<<digitsCont.size()<<std::endl;
std::stable_sort( digitsCont.begin(), digitsCont.end(), [&](UTDigit* p1, UTDigit* p2){
auto x1 = tracker()->convertID(UTChannelID{p1->key()}).channelID();
auto x2 = tracker()->convertID(UTChannelID{p2->key()}).channelID();
return x1<x2;});
int hehe = 0;
auto iter = digitsCont.begin();
for ( ; iter != digitsCont.end(); ++iter ) {
std::cout<<hehe++<<" -th digit "<<tracker()->convertID((*iter)->channelID()).channelID()<<" ; "<<(*iter)->depositedCharge()<<" ; "<<(*iter)->index()<<std::endl;
}
std::stable_sort( digitsCont.begin(), digitsCont.end(), [&](UTDigit* p1, UTDigit* p2){
auto x1 = (UTChannelID{p1->key()}).channelID();
auto x2 = (UTChannelID{p2->key()}).channelID();
return x1<x2;});
#endif
return digitsCont;
}
......@@ -174,15 +236,22 @@ void UTDigitCreator::genRanNoiseStrips( std::vector<digitPair>& noiseCont ) cons
// create noise strips in loop
const DeUTDetector::Sectors& tSectors = tracker()->sectors();
#if 0
int haha = 0;
for (auto iter : tSectors){
std::cout<<haha++<<"-th sector = "<<tracker()->convertID(UTChannelID{iter->elementID()}).channelID()<<std::endl;
}
#endif
if ( !m_allStrips ) {
for ( unsigned int iNoiseStrip = 0u; iNoiseStrip < m_numNoiseStrips; ++iNoiseStrip ) {
// generate a random readout sector
int iSector = (int)( 0.5 * nSector );
int iSector = 351;// /*temperary iSector ID; need to remove finally!!!*/ (int)( 0.5 * nSector );
// int iSector = (int)( m_uniformDist->shoot() * nSector );
const DeUTSector* aSector = tSectors[iSector];
int iStrip = (int)( 0.5 * aSector->nStrip() ) + aSector->firstStrip() - ( ( aSector->firstStrip() + 1 ) % 2 );
int iStrip = (int)( 0.5 * aSector->nStrip() ) + aSector->firstStrip();// - ( ( aSector->firstStrip() + 1 ) % 2 );
// int iStrip = (int)( m_uniformDist->shoot() * aSector->nStrip() ) + aSector->firstStrip();
UTChannelID aChan = aSector->stripToChan( iStrip );
//std::cout<<"--> iSector = "<<iSector<<" iStrip = "<<iStrip<<" = "<<( 0.5 * aSector->nStrip() )<<" + "<<aSector->firstStrip()<<" ; "<<tracker()->convertID(aChan).channelID()<<" ; aSector: "<<tracker()->convertID(UTChannelID{aSector->elementID()}).channelID()<<std::endl;
if ( m_useStatusConditions == false || aSector->isOKStrip( aChan ) == true ) {
// Generate a ADC value following a gaussian tail distribution
......@@ -204,6 +273,14 @@ void UTDigitCreator::genRanNoiseStrips( std::vector<digitPair>& noiseCont ) cons
} // for
}
#if 0
std::cout<<"I am a test in genRanNoiseStrips : noiseCont.size() = "<<noiseCont.size()<<std::endl;
int hehe = 0;
for (auto iter : noiseCont){
std::cout<<hehe++<<" -th entry "<<iter.first<<" ; "<<tracker()->convertID(iter.second).channelID()<<std::endl;
}
#endif
// Sort the noise digits by UTChannelID
std::stable_sort( noiseCont.begin(), noiseCont.end(), Less_by_Channel() );
}
......
......@@ -105,6 +105,23 @@ LHCb::UTDigits UTTightDigitCreator::operator()( const UTDigits& digitCont ) cons
digit->channelID() );
}
#if 0 // SAME
std::cout<<"I am a test in UTTightDigitCreator::operator() : "<<digitCont_ADCcut.size()<<std::endl;
std::stable_sort( digitCont_ADCcut.begin(), digitCont_ADCcut.end(), [&](UTDigit* p1, UTDigit* p2){
auto x1 = tracker()->convertID(UTChannelID{p1->key()}).channelID();
auto x2 = tracker()->convertID(UTChannelID{p2->key()}).channelID();
return x1<x2;});
int hehe = 0;
auto iter = digitCont_ADCcut.begin();
for ( ; iter != digitCont_ADCcut.end(); ++iter ) {
std::cout<<hehe++<<" -th digit "<<tracker()->convertID((*iter)->channelID()).channelID()<<" ; "<<(*iter)->depositedCharge()<<" ; "<<(*iter)->getdaqID()<<std::endl;
}
std::stable_sort( digitCont_ADCcut.begin(), digitCont_ADCcut.end(), [&](UTDigit* p1, UTDigit* p2){
auto x1 = (UTChannelID{p1->key()}).channelID();
auto x2 = (UTChannelID{p2->key()}).channelID();
return x1<x2;});
#endif
return digitCont_ADCcut;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment