Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:17:50

0001 #include "BbcPmtInfoContainerV1.h"
0002 #include "BbcPmtInfoV1.h"
0003 #include "BbcDefs.h"
0004 
0005 #include <phool/PHObject.h>
0006 #include <phool/phool.h>
0007 
0008 #include <TClonesArray.h>
0009 
0010 #include <cassert>
0011 
0012 
0013 BbcPmtInfoContainerV1::BbcPmtInfoContainerV1()
0014   : _detector( DETECTOR::MBD )
0015 {
0016   const int nchannels = BbcDefs::BBC_N_PMT;
0017   _clones = new TClonesArray("BbcPmtInfoV1", nchannels);
0018   _clones->SetOwner();
0019   _clones->SetName("BbcPmtInfoContainerV1");
0020   for (int ipmt = 0; ipmt < nchannels; ipmt++)
0021   {
0022     // as tower numbers are fixed per event
0023     // construct towers once per run, and clear the towers for first use
0024     _clones->ConstructedAt( ipmt );
0025   }
0026 }
0027 
0028 BbcPmtInfoContainerV1::~BbcPmtInfoContainerV1()
0029 {
0030   delete _clones;
0031 }
0032 
0033 void BbcPmtInfoContainerV1::Reset()
0034 {
0035   // clear content of towers in the container for the next event
0036   //_clones->Clear();
0037   for (int ipmt = 0; ipmt < BbcDefs::BBC_N_PMT; ipmt++)
0038   {
0039     _clones->ConstructedAt( ipmt )->Clear();
0040   }
0041 }
0042 
0043 BbcPmtInfoV1* BbcPmtInfoContainerV1::get_tower_at_channel(int pos)
0044 {
0045   return (BbcPmtInfoV1*)_clones->ConstructedAt( pos );
0046 }
0047