FairRoot/PandaRoot
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PndMvdCreateDefaultApvMap Class Reference

#include <PndMvdCreateDefaultApvMap.h>

Inheritance diagram for PndMvdCreateDefaultApvMap:

Public Member Functions

 PndMvdCreateDefaultApvMap ()
 
 ~PndMvdCreateDefaultApvMap ()
 
 PndMvdCreateDefaultApvMap (const PndMvdCreateDefaultApvMap &)=delete
 
PndMvdCreateDefaultApvMapoperator= (const PndMvdCreateDefaultApvMap &)=delete
 
virtual void SetParContainers ()
 
virtual InitStatus Init ()
 
virtual InitStatus ReInit ()
 
virtual void Exec (Option_t *)
 
Bool_t CreateFile (TString outFile)
 

Private Member Functions

Bool_t SelectSensorParams (TString detname)
 
void WriteExpandNode ()
 
 ClassDef (PndMvdCreateDefaultApvMap, 1)
 

Private Attributes

std::map< Double_t,
std::vector< Map_Entry > > 
fSortedMapping
 
PndSdsStripDigiParfCurrentDigiPar
 
TList * fDigiParameterList
 
Int_t fFeCount
 
Int_t fFakeCount
 

Detailed Description

Definition at line 28 of file PndMvdCreateDefaultApvMap.h.

Constructor & Destructor Documentation

PndMvdCreateDefaultApvMap::PndMvdCreateDefaultApvMap ( )

Definition at line 26 of file PndMvdCreateDefaultApvMap.cxx.

26  :
28  fCurrentDigiPar(NULL),
29  fDigiParameterList(new TList()),
30  fFeCount(0),
31  fFakeCount(0)
32 {
33 }
std::map< Double_t, std::vector< Map_Entry > > fSortedMapping
PndSdsStripDigiPar * fCurrentDigiPar
PndMvdCreateDefaultApvMap::~PndMvdCreateDefaultApvMap ( )

Definition at line 36 of file PndMvdCreateDefaultApvMap.cxx.

References fDigiParameterList.

PndMvdCreateDefaultApvMap::PndMvdCreateDefaultApvMap ( const PndMvdCreateDefaultApvMap )
delete

Member Function Documentation

PndMvdCreateDefaultApvMap::ClassDef ( PndMvdCreateDefaultApvMap  ,
 
)
private
Bool_t PndMvdCreateDefaultApvMap::CreateFile ( TString  outFile)

Our main function here

Definition at line 72 of file PndMvdCreateDefaultApvMap.cxx.

References Double_t, fSortedMapping, gGeoManager, map, out, outfile, TString, and WriteExpandNode().

73 {
74  Info("CreateFile","Output file name is %s",outFileName.Data());
75  std::ofstream outfile(outFileName.Data(),std::ofstream::out);
76 
77  TString oldpath = gGeoManager->GetPath();
78  gGeoManager->CdTop();
79  if( ! oldpath.BeginsWith(gGeoManager->GetPath()) ) oldpath = gGeoManager->GetPath();
81  gGeoManager->cd(oldpath.Data());
82 
83  // loop over sorted mapping and write to file
84  for(std::map<Double_t, std::vector<Map_Entry> >::iterator
85  iter=fSortedMapping.begin(); iter!=fSortedMapping.end();iter++)
86  {
87  std::vector<Map_Entry> entryset = iter->second;
88  for(std::vector<Map_Entry>::iterator
89  iter2=entryset.begin(); iter2!=entryset.end();iter2++)
90  {
91  Map_Entry anEntry = *iter2;
92  TString detpath = anEntry.first;
93  std::pair<Int_t,Int_t> aPair = anEntry.second;
94  Int_t feSoft = aPair.first;
95  Int_t feHard = aPair.second;
96  outfile << feHard << " " << feSoft << " " << detpath << std::endl;
97  std::cout << feHard << " " << feSoft << " " << detpath << std::endl;
98  }
99  }
100 
101  outfile.close();
102  return kTRUE;
103 }
PndTransMap * map
Definition: sim_emc_apd.C:99
std::map< Double_t, std::vector< Map_Entry > > fSortedMapping
TGeoManager * gGeoManager
std::pair< TString, std::pair< Int_t, Int_t > > Map_Entry
Double_t
TFile * out
Definition: reco_muo.C:20
TString outfile
virtual void PndMvdCreateDefaultApvMap::Exec ( Option_t *  )
inlinevirtual

Virtual method Exec

Definition at line 44 of file PndMvdCreateDefaultApvMap.h.

44 {return;};
InitStatus PndMvdCreateDefaultApvMap::Init ( )
virtual

Definition at line 61 of file PndMvdCreateDefaultApvMap.cxx.

References gGeoManager.

62 {
63  // Check for all necessary framework i/o
64  if(!gGeoManager) {
65  Error("Init","Cannot find a valid GeoManager");
66  return kERROR;
67  }
68  return kSUCCESS;
69 }
TGeoManager * gGeoManager
PndMvdCreateDefaultApvMap& PndMvdCreateDefaultApvMap::operator= ( const PndMvdCreateDefaultApvMap )
delete
virtual InitStatus PndMvdCreateDefaultApvMap::ReInit ( )
inlinevirtual

Definition at line 41 of file PndMvdCreateDefaultApvMap.h.

41 {return kSUCCESS;};
Bool_t PndMvdCreateDefaultApvMap::SelectSensorParams ( TString  detname)
private

Definition at line 148 of file PndMvdCreateDefaultApvMap.cxx.

References fCurrentDigiPar, and fDigiParameterList.

Referenced by WriteExpandNode().

149 {
150  TIter parsetiter(fDigiParameterList);
151  while ( PndSdsStripDigiPar* digipar = (PndSdsStripDigiPar*)parsetiter() )
152  {
153  const char* sensortype = digipar->GetSensType();
154  if(detpath.Contains(sensortype)) {
155  fCurrentDigiPar = digipar;
156  Info("SelectSensorParams","Found a parameter set for %s", detpath.Data());
157  return kTRUE;
158  }
159  }
160  // no suiting object found
161  Error("SelectSensorParams","Detector name does not contain a valid parameter name. DetName : %s",detpath.Data());
162  return kFALSE;
163 }
Digitization Parameter Class for MVD-Strip part.
PndSdsStripDigiPar * fCurrentDigiPar
void PndMvdCreateDefaultApvMap::SetParContainers ( )
virtual

Definition at line 43 of file PndMvdCreateDefaultApvMap.cxx.

References fDigiParameterList, PndMvdContFact::GetDigiParNames(), rtdb, and TString.

44 {
45  FairRun* ana = FairRun::Instance();
46  FairRuntimeDb* rtdb=ana->GetRuntimeDb();
47  PndMvdContFact* themvdcontfact = (PndMvdContFact*)rtdb->getContFactory("PndMvdContFact");
48  TList* theContNames = themvdcontfact->GetDigiParNames();
49  Info("SetParContainers()","The container names list contains %i entries",theContNames->GetEntries());
50  TIter cfIter(theContNames);
51  while (TObjString* contname = (TObjString*)cfIter()) {
52  TString parsetname = contname->String();
53  if(parsetname.BeginsWith("MVDStripDigiPar")){
54  PndSdsStripDigiPar* digipar = (PndSdsStripDigiPar*)(rtdb->getContainer(parsetname.Data()));
55  fDigiParameterList->Add(digipar);
56  Info("SetParContainers()","Add container %s",parsetname.Data());
57  }
58  }
59 }
TList * GetDigiParNames()
Digitization Parameter Class for MVD-Strip part.
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
void PndMvdCreateDefaultApvMap::WriteExpandNode ( )
private

Definition at line 105 of file PndMvdCreateDefaultApvMap.cxx.

References Double_t, fCurrentDigiPar, fe, fFakeCount, fFeCount, fSortedMapping, PndSdsStripDigiPar::GetNrBotFE(), PndSdsStripDigiPar::GetNrTopFE(), gGeoManager, push_back(), SelectSensorParams(), and TString.

Referenced by CreateFile().

106 {
107  // this volume should be an assambly
108  TGeoNode* node = gGeoManager->GetCurrentNode();
109  //TGeoVolume* vol = node->GetVolume();
110  if(node->GetNdaughters() > 0)
111  { // iterate to daughters
112  for (Int_t Nod=0; Nod<node->GetNdaughters();Nod++) {
113  gGeoManager->CdDown(Nod);
114  WriteExpandNode();
115  gGeoManager->CdUp();
116  }
117  } else { // no daughter nodes
118  TString detpath=gGeoManager->GetPath();
119  // some checks
120  if(!detpath.Contains("Strip")) return;
121  if(!SelectSensorParams(detpath)) return;
122  // Chosen sorting parameter: z Position of the node.
123  // TODO: Is it done correctly like this?
124  TGeoTranslation* tran = (TGeoTranslation*)node->GetMatrix();
125  Double_t sortparam = (tran->GetTranslation())[2];
126  Int_t feSens = fCurrentDigiPar->GetNrTopFE() + fCurrentDigiPar->GetNrBotFE();
127  for(Int_t fe =0;fe<feSens;fe++)
128  { // write to mapping
129  Int_t feNr;
130  // count only real-world existing frontends, others are -1
132  fFakeCount--; // decrease first, starting at -1!
133  feNr = fFakeCount; // handle the single sided sensors with a fake bittom side
134  }else{
135  feNr=fFeCount;
136  fFeCount++; // increase later, starting at 0
137  }
138  std::pair<Int_t,Int_t> apair(fe,feNr);
139  Map_Entry anEntry(detpath,apair);
140  (fSortedMapping[sortparam]).push_back(anEntry);
141  }
142  }
143  return;
144 }
labels push_back("electron")
std::map< Double_t, std::vector< Map_Entry > > fSortedMapping
TGeoManager * gGeoManager
std::pair< TString, std::pair< Int_t, Int_t > > Map_Entry
Double_t
PndSdsStripDigiPar * fCurrentDigiPar
int fe
Definition: anaLmdDigi.C:67
Int_t GetNrTopFE() const
Int_t GetNrBotFE() const
Bool_t SelectSensorParams(TString detname)

Member Data Documentation

PndSdsStripDigiPar* PndMvdCreateDefaultApvMap::fCurrentDigiPar
private

Definition at line 59 of file PndMvdCreateDefaultApvMap.h.

Referenced by SelectSensorParams(), and WriteExpandNode().

TList* PndMvdCreateDefaultApvMap::fDigiParameterList
private
Int_t PndMvdCreateDefaultApvMap::fFakeCount
private

Definition at line 62 of file PndMvdCreateDefaultApvMap.h.

Referenced by WriteExpandNode().

Int_t PndMvdCreateDefaultApvMap::fFeCount
private

Definition at line 61 of file PndMvdCreateDefaultApvMap.h.

Referenced by WriteExpandNode().

std::map<Double_t, std::vector<Map_Entry> > PndMvdCreateDefaultApvMap::fSortedMapping
private

Definition at line 54 of file PndMvdCreateDefaultApvMap.h.

Referenced by CreateFile(), and WriteExpandNode().


The documentation for this class was generated from the following files: