本文整理汇总了C++中TClonesArray::Compress方法的典型用法代码示例。如果您正苦于以下问题:C++ TClonesArray::Compress方法的具体用法?C++ TClonesArray::Compress怎么用?C++ TClonesArray::Compress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TClonesArray
的用法示例。
在下文中一共展示了TClonesArray::Compress方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mergeDigits
int mergeDigits(TString digitdir, Int_t /*simEvOffset*/)
{
AliRunLoader *rl = AliRunLoader::Open(digitdir+TString("/galice.root"));
AliPHOSLoader *prl = (AliPHOSLoader*)rl->GetDetectorLoader("PHOS");
prl->LoadDigits("UPDATE");
//prl->LoadDigits();
Int_t nEvents = rl->GetNumberOfEvents();
TClonesArray *mydigits = 0;
simTree->SetBranchAddress("Digits", &mydigits);
Int_t nDigits = 0;
Int_t nEmbedDigits = 0;
Int_t nOverlappingDigits = 0;
Int_t nNewDigits = 0;
Int_t nPhosDigits = prl->Digits()->GetEntries();
Int_t nMyEvents = simTree->GetEntries();
std::cout << "Number of real events: " << nEvents << std::endl;
std::cout << "Number of sim events: " << nMyEvents << std::endl;
nEvents = TMath::Min(nEvents, nMyEvents);
std::cout << "Looping over: " << nEvents << std::endl;
for (Int_t ev = 0; ev < nEvents; ev++)
{
rl->GetEvent(ev);
simTree->GetEntry(ev);
Int_t nMyDigits = mydigits->GetEntries();
//Int_t nDigsFound = 0;
nEmbedDigits += nMyDigits;
TClonesArray *phosDigits = prl->Digits();
nPhosDigits = prl->Digits()->GetEntries();
for (Int_t iDig = 0; iDig < nPhosDigits; iDig++)
{
//const AliPHOSDigit *digit = prl->Digit(iDig);
AliPHOSDigit *digit = (AliPHOSDigit*)phosDigits->At(iDig);
nDigits++;
for (Int_t n = 0; n < nMyDigits; n++)
{
AliPHOSDigit *myDigit = (AliPHOSDigit*)mydigits->At(n);
if (digit->GetId() == myDigit->GetId())
{
nOverlappingDigits++;
break;
}
}
}
if(nOverlappingDigits == nMyDigits)
{
std::cout << "Digits alredy embedded!" << std::endl;
continue;
}
for (Int_t iDig = 0; iDig < nMyDigits; iDig++)
{
AliPHOSDigit *myDigit = (AliPHOSDigit*)mydigits->At(iDig);
if (myDigit)
{
for (Int_t n = 0; n < nPhosDigits; n++)
{
//const AliPHOSDigit *digit = prl->Digit(n);
AliPHOSDigit *digit = (AliPHOSDigit*)phosDigits->At(n);
if (digit->GetId() == myDigit->GetId())
{
digit->SetALTROSamplesHG(0, 0);
digit->SetALTROSamplesLG(0, 0);
*digit += *myDigit;
myDigit = 0;
break;
}
}
if (myDigit)
{
TClonesArray *digArray = prl->Digits();
AliPHOSDigit *newDig = new((*digArray)[nPhosDigits+nNewDigits]) AliPHOSDigit(*myDigit);
newDig->SetALTROSamplesHG(0, 0);
newDig->SetALTROSamplesLG(0, 0);
nNewDigits++;
}
}
}
phosDigits->Compress();
Int_t ndigits = phosDigits->GetEntries() ;
phosDigits->Sort();
// Remove digits that are flagged bad in BCM. Then remove digits that are below threshold
for (Int_t i = 0 ; i < ndigits ; i++)
{
AliPHOSDigit *digit = static_cast<AliPHOSDigit*>( phosDigits->At(i) ) ;
//.........这里部分代码省略.........