Commit 4429ac27 authored by Norbert Herrmann's avatar Norbert Herrmann
Browse files

implement T0 digi input

parent 5578d4a3
......@@ -350,7 +350,8 @@ void CbmTofEventClusterizer::Exec(Option_t* option) {
if (fEventsColl) {
LOG(info) << "CbmTofEventClusterizer::Exec => New timeslice " << iNbTs
<< " with " << fEventsColl->GetEntriesFast() << " events, "
<< fDigiMan->GetNofDigis(ECbmModuleId::kTof) << " TOF digis ";
<< fDigiMan->GetNofDigis(ECbmModuleId::kTof) << " TOF digis + "
<< fDigiMan->GetNofDigis(ECbmModuleId::kT0) << " T0 digis ";
iNbTs++;
Int_t iNbHits = 0;
......@@ -363,6 +364,13 @@ void CbmTofEventClusterizer::Exec(Option_t* option) {
fTofDigiVec.clear();
//if (fTofDigisColl) fTofDigisColl->Clear("C");
//Int_t iNbDigis=0; (VF) not used
for (Int_t iDigi = 0; iDigi < tEvent->GetNofData(ECbmDataType::kT0Digi);
iDigi++) {
Int_t iDigiIndex =
static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kT0Digi, iDigi));
const CbmTofDigi* tDigi = fDigiMan->Get<CbmTofDigi>(iDigiIndex);
fTofDigiVec.push_back(CbmTofDigi(*tDigi));
}
for (Int_t iDigi = 0; iDigi < tEvent->GetNofData(ECbmDataType::kTofDigi);
iDigi++) {
Int_t iDigiIndex =
......@@ -516,10 +524,12 @@ Bool_t CbmTofEventClusterizer::RegisterInputs() {
fDigiMan = CbmDigiManager::Instance();
fDigiMan->Init();
if (!fDigiMan->IsPresent(ECbmModuleId::kTof)) {
LOG(error) << GetName() << ": No digi input!";
LOG(error) << GetName() << ": No Tof digi input!";
return kFALSE;
}
if (fDigiMan->IsPresent(ECbmModuleId::kT0)) {
LOG(warn) << GetName() << ": separate T0 digi input!";
}
fTrbHeader = (TTrbHeader*) fManager->GetObject("TofTrbHeader.");
if (NULL == fTrbHeader) {
LOG(info) << "CbmTofEventClusterizer::RegisterInputs => Could not get "
......@@ -5405,7 +5415,8 @@ Bool_t CbmTofEventClusterizer::BuildClusters() {
pDigi->GetChannel(),
(0 == pDigi->GetSide()) ? 1 : 0,
pDigi->GetType());
LOG(debug) << "Duplicated digi at address 0x" << std::hex
LOG(debug) << "Duplicated digi " << fTofDigiVec.size()
<< " with address 0x" << std::hex
<< pDigiN->GetAddress();
}
}
......@@ -5961,7 +5972,7 @@ void CbmTofEventClusterizer::fit_ybox(TH1* h1,
<< Form(" %6.3f %6.3f %6.3f %6.3f ", fp[0], fp[1], fp[2], fp[3]);
}
h1->Fit("YBox", "QM");
h1->Fit("YBox", "QM0");
double res[10];
double err[10];
......@@ -6921,18 +6932,32 @@ Bool_t CbmTofEventClusterizer::BuildHits() {
&& dWeightedTime == pHitL->GetTime()) {
LOG(debug) << "Store Hit twice? "
<< " fiNbHits " << fiNbHits << ", "
<< Form("0x%08x", iDetId);
<< Form("0x%08x, MatchCollSize %d, IndRefSize %lu ",
iDetId, fTofDigiMatchColl->GetEntriesFast(),vDigiIndRef.size());
for (UInt_t i = 0; i < vDigiIndRef.size(); i++) {
CbmTofDigi* pDigiC =
&(fTofCalDigiVec->at(vDigiIndRef.at(i)));
LOG(debug) << " Digi " << pDigiC->ToString();
if(vDigiIndRef.at(i) < (Int_t) fTofCalDigiVec->size()) {
CbmTofDigi* pDigiC = &(fTofCalDigiVec->at(vDigiIndRef.at(i)));
LOG(debug) << " Digi " <<i<<" "<< pDigiC->ToString();
} else {
LOG(fatal) << "Insufficient CalDigiVec size for i "
<< i <<", Ind " << vDigiIndRef.at(i);
}
}
CbmMatch* digiMatchL =
(CbmMatch*) fTofDigiMatchColl->At(fiNbHits - 1);
for (Int_t i = 0; i < digiMatchL->GetNofLinks();
i++) {
if(NULL == fTofDigiMatchColl) assert("No DigiMatchColl");
CbmMatch* digiMatchL=NULL;
if( fTofDigiMatchColl->GetEntriesFast() >= fiNbHits-1) {
digiMatchL=(CbmMatch*) fTofDigiMatchColl->At(fiNbHits-1);
}else{
LOG(fatal) << "DigiMatchColl has insufficient size "
<< fTofDigiMatchColl->GetEntriesFast();
}
if(NULL != digiMatchL)
for (Int_t i = 0; i < digiMatchL->GetNofLinks(); i++) {
CbmLink L0 = digiMatchL->GetLink(i);
LOG(debug) << "report link "<<i<<"("<<digiMatchL->GetNofLinks()<<"), ind "<<L0.GetIndex();
Int_t iDigIndL = L0.GetIndex();
if (iDigIndL >= (Int_t) vDigiIndRef.size()) {
if (iDetId != fiBeamRefAddr) {
......@@ -6949,8 +6974,11 @@ Bool_t CbmTofEventClusterizer::BuildHits() {
CbmTofDigi* pDigiC =
&(fTofCalDigiVec->at(vDigiIndRef.at(iDigIndL)));
LOG(debug) << " DigiL " << pDigiC->ToString();
} else {
LOG(warn) << "Invalid digMatch Link at Index " << fiNbHits-1;
}
}
LOG(debug)<< "Current HitsColl length " << fTofHitsColl->GetEntriesFast();
}
CbmTofHit* pHit = new CbmTofHit(
iDetId,
......@@ -6958,8 +6986,7 @@ Bool_t CbmTofEventClusterizer::BuildHits() {
hitPosErr, //local detector coordinates
fiNbHits, // this number is used as reference!!
dWeightedTime,
vDigiIndRef
.size(), // number of linked digis = 2*CluSize
vDigiIndRef.size(), // number of linked digis = 2*CluSize
//vPtsRef.size(), // flag = number of TofPoints generating the cluster
Int_t(dWeightsSum * 10.)); //channel -> Tot
//0) ; //channel
......@@ -7509,10 +7536,11 @@ Bool_t CbmTofEventClusterizer::CalibRawDigis() {
<< fDigiBdfPar->GetNbChan(pDigi->GetType(), 0);
}
if (bAddBeamCounterSideDigi)
if (0) // (bAddBeamCounterSideDigi)
if (pCalDigi->GetType() == 5
|| pCalDigi->GetType()
== 8) { // for Pad counters generate fake digi to mockup a strip
LOG(debug) << "add Pad counter 2. Side digi for 0x" << std::hex << pCalDigi->GetAddress();
fTofCalDigiVec->push_back(CbmTofDigi(*pCalDigi));
CbmTofDigi* pCalDigi2 = &(fTofCalDigiVec->back());
iDigIndCal++;
......
Supports Markdown
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