Commit bb0a04f1 authored by J.Dudouet [IPNL/CSNSM]'s avatar J.Dudouet [IPNL/CSNSM]
Browse files

Integration of the interaction type in the tracking

AgataFrameFactory.cpp: Adding a new data tracked version (1 0)
Hits.h : Adding the type in TrackedHit, and Get and SetType methods
TrackedFrame.icpp : adding TrackedFrame_1_0 class to read and write the new frame version


git-svn-id: svn+ssh://anonsvn.in2p3.fr/agata/gammaware/trunk@2225 c3abf467-7ff2-0310-b516-c5fb849bdde0
parent dc8a7868
......@@ -114,7 +114,9 @@ SharedFP *AgataFrameFactory::DoNew(Key *key, const FactoryItem & which_frame)
if ( which_frame.GetVersion() == Version(65000,1) )
frame = new TrackedFrame_65000_1(key);
if ( which_frame.GetVersion() == Version(0,0) )
frame = new TrackedFrame_0_0(key);
frame = new TrackedFrame_0_0(key);
if ( which_frame.GetVersion() == Version(1,0) )
frame = new TrackedFrame_1_0(key);
}
// by default not specific data means raw
if ( frame == 0x0 && which_frame.GetItemName().find("data") == 0 ) {
......
......@@ -111,9 +111,9 @@ public:
virtual Int_t GetID(Int_t = 0) const
{return 0;}
virtual void SetID(Int_t, Int_t = 0)
{;}
virtual void Reset() = 0;
{;}
virtual void Reset() = 0;
};
//!
......@@ -255,8 +255,14 @@ public:
*/
class TrackedHit : public Hit
{
private:
UShort_t fType;
public:
TrackedHit()
enum {kUndef, kSingle, kCompton, kPair};
public:
TrackedHit(): fType(0)
{;}
virtual ~TrackedHit()
{;}
......@@ -269,6 +275,11 @@ public:
//! Get Hit number i of the track (already added with NewHit !!)
virtual Hit *GetHit(UInt_t i = 0) const = 0;
virtual UShort_t GetType() const
{return fType;}
virtual void SetType(UShort_t s)
{fType = s;}
};
//! Concrete implementation of a tracked Hit
......@@ -363,8 +374,8 @@ public:
virtual UShort_t GetStatus() const
{return fTrackedHit.GetStatus();}
virtual void SetStatus(UShort_t s)
{fTrackedHit.SetStatus(s);}
{fTrackedHit.SetStatus(s);}
virtual void Reset()
{ fTrackedHit.Reset(); fTrack.Reset(); }
};
......
......@@ -152,8 +152,130 @@ UInt_t TrackedFrame_0_0::WriteImp()
}
}
return fBuffer->Offset();
};
class TrackedFrame_1_0 : public TrackedFrame_
{
friend class AgataFrameFactory;
private:
TrackedFrame_1_0(Key *akey);
protected:
virtual UInt_t ReadImp() ;
virtual UInt_t WriteImp() ;
public:
virtual ~TrackedFrame_1_0()
{;}
virtual void DataReset()
{ TrackedFrame_::DataReset(); }
};
TrackedFrame_1_0::TrackedFrame_1_0(Key *akey):
TrackedFrame_(akey)
{
}
UInt_t TrackedFrame_1_0::ReadImp()
{
Bool_t ok = true;
// read the global part first
Global()->GetItems((*fBuffer));
// get # of gammas from buffer
UShort_t nb_gamma = 0; (*fBuffer) >> nb_gamma;
fGammas.Reset();
for (UShort_t i = 0; i < nb_gamma ; i++ ) {
// careful type !!
Float_t x, y, z, e, t; UShort_t s, type; Int_t id0, id1;
//
(*fBuffer) >> s >> e >> type;
// add a new gamma
TrackedHit *trhit = fGammas.New();
if ( trhit == 0x0 ) {
// fLog << error << "Cannot have more than " << i << " tracked gamma-ray " << nline;
ok = false;
break;
}
trhit->SetStatus(s);
trhit->SetE(e);
trhit->SetType(type);
// now the trace
UShort_t nb_hits = 0u;
//
(*fBuffer) >> nb_hits;
//
for (UShort_t j = 0; j < nb_hits ; j++ ) {
Hit *h = trhit->NewHit();
if ( h == 0x0 ) {
// fLog << error << "Cannot add more than " << j << " hits in a tracked gamma-ray " << nline;
ok = false;
break;
}
// read hit information
(*fBuffer) >> x >> y >> z >> e >> t >> id0 >> id1 ;
//
if ( j == 0 ) { // set information of trackedHit position to the first one :
trhit->SetXYZ(x,y,z);
trhit->SetT(t);
trhit->SetID(id0,0); trhit->SetID(id1,1);
}
h->SetXYZ(x,y,z);
h->SetE(e);
h->SetT(t);
h->SetID(id0,0); h->SetID(id1,1);
}
}
if ( !ok ) {
fBuffer->SetStatus(BaseBuffer::kFail);
}
return fBuffer->Offset();
}
UInt_t TrackedFrame_1_0::WriteImp()
{
// max size for the frame
if ( !fBuffer->Reserve(fMaxFrameSize) )
return 0u;
// fill the buffer with items
Global()->SetItems((*fBuffer));
// fill the buffer with hits
(*fBuffer) << fGammas.GetSize();
for (UShort_t i = 0; i < fGammas.GetSize() ; i++ ) {
const TrackedHit *trhit =
fGammas.At(i); // next tracked hit
// status of the trace and full energie
(*fBuffer) << trhit->GetStatus() << Float_t(trhit->GetE()) << trhit->GetType() ;
// now add the trace itself ... postions, energies, time and ids
(*fBuffer) << trhit->GetNbHits();
for (UShort_t j = 0; j < trhit->GetNbHits() ; j++ ) {
// a new hit of the trace
const Hit *hit = trhit->GetHit(j);
(*fBuffer) << Float_t(hit->GetX()) << Float_t(hit->GetY()) << Float_t(hit->GetZ())
<< Float_t(hit->GetE())
<< Float_t(hit->GetT())
<< hit->GetID(0)
<< hit->GetID(1);
}
}
return fBuffer->Offset();
};
} // namespace ADF
......
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