Skip to content
Snippets Groups Projects
Commit 0ab46de3 authored by Stephen A. Wood's avatar Stephen A. Wood
Browse files

Checkin of days work. Starting to convert Hall C to Hall A detector map.

parent 0e623d16
Branches
Tags
No related merge requests found
......@@ -5,6 +5,7 @@
#pragma link off all functions;
#pragma link C++ global gHcParms;
#pragma link C++ global gHcDetectorMap;
#pragma link C++ class THcInterface+;
#pragma link C++ class THcParmList+;
......
......@@ -32,11 +32,70 @@ inline static bool IsComment( const string& s, string::size_type pos )
(s[pos] == '!') );
}
virtual Int_t THcDetectorMap::FillMap(THaDetMap *detmap, string *detectorname) {
Int_t detectorid=3; // Get this from detectorname
// Loop through the list looking for all hardware channels that
// are detectorid. Sort and try to minimize AddModule calls
//_____________________________________________________________________________
THcDetectorMap::THcDetectorMap() : fNchans(0)
{
}
//_____________________________________________________________________________
THcDetectorMap::~THcDetectorMap()
{
}
//bool THcDetectorMap::compare(const ChaninMod *first, const ChaninMod *second) {
// return((first->channel < second->channel)? true: false);
//}
struct Functor
{
bool operator() (const THcDetectorMap::ChaninMod &first, const THcDetectorMap::ChaninMod &second)
{ return((first.channel < second.channel)? true: false);}
};
//_____________________________________________________________________________
Int_t THcDetectorMap::FillMap(THaDetMap *detmap, const char *detectorname)
// Should probably return a status
{
list<ModChanList>::iterator imod;
ChaninMod Achan;
ModChanList Amod;
// Need one array of uniq crate/slot combos
// Translate detector name into and ID
Int_t did=3; // Get this from detectorname
mlist.clear();
for(Int_t ich=0;ich<fNchans;ich++) {
if(fTable[ich].did == did) {
Int_t roc=fTable[ich].roc;
Int_t slot=fTable[ich].slot;
for(imod=mlist.begin(); imod!= mlist.end(); ++imod) {
Achan.channel = fTable[ich].channel;
Achan.plane = fTable[ich].plane;
Achan.counter = fTable[ich].counter;
Achan.signal = fTable[ich].signal;
if((*imod).roc == roc && (*imod).slot == slot) {
(*imod).clist.push_back(Achan);
}
}
if(imod == mlist.end()) {
Amod.roc = roc;
Amod.slot = slot;
Amod.clist.clear();
Amod.clist.push_back(Achan);
mlist.push_back(Amod);
}
}
}
if(mlist.size() <= 0) {
return(-1);
}
Functor f;
for(imod=mlist.begin(); imod!= mlist.end(); ++imod) {
list<ChaninMod> *clistp = &((*imod).clist);
clistp->sort(f);//Sort by channel
}
return(0);
}
void THcDetectorMap::Load(const char *fname)
......@@ -60,6 +119,8 @@ void THcDetectorMap::Load(const char *fname)
Int_t detector=0;
Int_t slot=0;
fNchans = 0;
string::size_type start, pos=0;
char varname[100];
......@@ -126,7 +187,16 @@ void THcDetectorMap::Load(const char *fname)
signal= ((TObjString*)vararr->At(3))->GetString().Atoi();
}
cout << channel << " " << plane << " " << counter << " " << signal << endl;
fTable[fNchans].roc=roc;
fTable[fNchans].roc=slot;
fTable[fNchans].channel=channel;
fTable[fNchans].did=detector;
fTable[fNchans].plane=plane;
fTable[fNchans].counter=counter;
fTable[fNchans].signal=signal;
fNchans++;
}
}
......
......@@ -8,23 +8,46 @@
//////////////////////////////////////////////////////////////////////////
#include "TObject.h"
#include "THaDetMap.h"
#include <list>
class THcDetectorMap : public TObject {
public:
THcDetectorMap() {}
virtual ~THcDetectorMap() {}
THcDetectorMap();
virtual ~THcDetectorMap();
virtual void Load(const char *fname);
// Member variables needed
// List of detector IDs.
// Hardware to logical detector mapping for each detector
// Mapping between detector names and numbers
// Hardwire, but later configure
struct Detector {
UInt_t did; // Numberical Detector ID
TList*
virtual Int_t FillMap(THaDetMap* detmap, const char* detectorname);
Int_t fNchans; // Number of hardware channels
struct Channel { // Mapping for one hardware channel
Int_t roc;
Int_t slot;
Int_t channel;
Int_t did;
Int_t plane;
Int_t counter;
Int_t signal;
};
Channel fTable[10000]; // Big ugly cache of the map file
struct ChaninMod {
Int_t channel;
Int_t plane;
Int_t counter;
Int_t signal;
};
struct ModChanList {
Int_t roc;
Int_t slot;
std::list<ChaninMod> clist;
};
std::list<ModChanList> mlist;
bool compare(const ChaninMod *first, const ChaninMod *second);
protected:
......
......@@ -53,6 +53,7 @@ THcHodoscope::THcHodoscope( ) :
//_____________________________________________________________________________
THaAnalysisObject::EStatus THcHodoscope::Init( const TDatime& date )
{
static const char* const here = "Init()";
// Extra initialization for scintillators: set up DataDest map
if( THaNonTrackingDetector::Init( date ) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment