EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PndSensorNamePar.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PndSensorNamePar.cxx
1 #include <iostream>
2 #include "PndSensorNamePar.h"
3 
4 PndSensorNamePar::PndSensorNamePar(const char* name, const char* title, const char* context)
5  : FairParGenericSet(name,title,context), fSensorNames()
6 {
7  clear();
8  fSensorNames = new TObjArray();
9  fSensorNames->SetOwner(kTRUE);
10 
11 }
12 
14 {
15  fSensorNames = new TObjArray(*(L.GetSensorNames()));
16 }
17 
19 {
20  fSensorNames = new TObjArray(*(L.GetSensorNames()));
21  return *this;
22 }
23 
25 {
26  if(!list) return;
27  list->addObject("SensorNames", fSensorNames);
28 }
29 
31 {
32  if (!list) return kFALSE;
33  if (!list->fillObject("SensorNames",fSensorNames)) return kFALSE;
34  FillMap();
35  return kTRUE;
36 }
37 
39 {
40  if (SensorInList(name) < 0) {
41  fSensorNames->AddLast(name);
42  this->setChanged();
43  FairRun *fRun = FairRun::Instance();
44  this->setInputVersion(fRun->GetRunId(), 1);
45  fMapOfSensorNames[name->GetString()] = fSensorNames->GetEntries() - 1;
46  fMapOfSensorIndizes[fSensorNames->GetEntries() - 1] = name->GetString();
47 
48  return fSensorNames->GetEntries() - 1;
49  } else
50  return SensorInList(name);
51 
52 }
53 
55 
57 {
58  std::cout<<"SensorNames:"<<std::endl;
59  std::cout<< "Entries: " << fSensorNames->GetEntries() << std::endl;
60 // for (int i = 0; i < fSensorNames->GetEntries(); i++){
61 // TObjString* mySensName = (TObjString*)fSensorNames->At(i);
62 // std::cout << i << ": " << mySensName->GetString().Data() << std::endl;
63 // }
64  for (std::map<Int_t, TString>::iterator iter = fMapOfSensorIndizes.begin(); iter != fMapOfSensorIndizes.end(); iter++){
65  std::cout << iter->first << ": " << iter->second.Data() << std::endl;
66  }
67 }