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

Convert Task of data. More...

#include <PndMvdConvertApvTask.h>

Inheritance diagram for PndMvdConvertApvTask:

Public Member Functions

 PndMvdConvertApvTask (PndMvdConvertApv *Apvconvert, PndMvdBoxMap *Apvmapper)
 
 ~PndMvdConvertApvTask ()
 
 PndMvdConvertApvTask (const PndMvdConvertApvTask &)=delete
 
PndMvdConvertApvTaskoperator= (const PndMvdConvertApvTask &)=delete
 
virtual void Exec (Option_t *opt)
 
virtual void SetParContainers ()
 
virtual InitStatus Init ()
 
virtual void Finish ()
 
void SetPersistance (Bool_t p=kTRUE)
 
Bool_t GetPersistance ()
 

Private Member Functions

Bool_t IsSingleSided (TString &detpath)
 
Int_t CalcBotFakeFE (TString detpath)
 
void Register ()
 
void Reset ()
 
 ClassDef (PndMvdConvertApvTask, 1)
 

Private Attributes

Bool_t fPersistance
 
PndMvdConvertApvfApvConvert
 class which convert the read in and hold the streams More...
 
PndMvdBoxMapfApvMapper
 
TClonesArray * fStripArray
 array of results More...
 
PndGeoHandlingfGeoH
 Geohandler for name string compression. More...
 
Int_t iStrip
 number of strips in this event More...
 
TList * fDigiParameterList
 
std::map< TString, Int_t > fBotSides
 

Detailed Description

Convert Task of data.

Task to convert data from real measurement with strip sensors

Author
Lars Ackermann
Date
11.03.2009

Definition at line 39 of file PndMvdConvertApvTask.h.

Constructor & Destructor Documentation

PndMvdConvertApvTask::PndMvdConvertApvTask ( PndMvdConvertApv Apvconvert,
PndMvdBoxMap Apvmapper 
)

Default constructor

Definition at line 31 of file PndMvdConvertApvTask.cxx.

31  : FairTask() ,
32  fPersistance(kTRUE),
33  fApvConvert(Apvconvert),
34  fApvMapper(Apvmapper),
35  fStripArray(NULL),
37  iStrip(0),
38  fDigiParameterList(new TList()),
39  fBotSides()
40 {
41 }
TClonesArray * fStripArray
array of results
PndGeoHandling * fGeoH
Geohandler for name string compression.
static PndGeoHandling * Instance()
PndMvdConvertApv * fApvConvert
class which convert the read in and hold the streams
std::map< TString, Int_t > fBotSides
Int_t iStrip
number of strips in this event
PndMvdConvertApvTask::~PndMvdConvertApvTask ( )

Destructor

Definition at line 43 of file PndMvdConvertApvTask.cxx.

44 {
45 }
PndMvdConvertApvTask::PndMvdConvertApvTask ( const PndMvdConvertApvTask )
delete

Member Function Documentation

Int_t PndMvdConvertApvTask::CalcBotFakeFE ( TString  detpath)
private

Definition at line 225 of file PndMvdConvertApvTask.cxx.

References fBotSides.

Referenced by Exec().

226 {
227 
228  for(std::map<TString,Int_t>::iterator it=fBotSides.begin();it!=fBotSides.end();it++)
229  {
230  if( detpath.Contains(it->first) )
231  {
232  return it->second;
233  }
234  }
235  return -99999; //return something silly
236 
237 }
std::map< TString, Int_t > fBotSides
PndMvdConvertApvTask::ClassDef ( PndMvdConvertApvTask  ,
 
)
private
void PndMvdConvertApvTask::Exec ( Option_t *  opt)
virtual

Virtual method Exec

Definition at line 121 of file PndMvdConvertApvTask.cxx.

References CalcBotFakeFE(), PndMvdBoxMap::DoMapping(), Double_t, fApvConvert, fApvMapper, fGeoH, fStripArray, fVerbose, PndSdsDigi::GetCharge(), PndGeoHandling::GetPath(), PndGeoHandling::GetShortID(), IsSingleSided(), kMVDHitsStrip, push_back(), PndMvdConvertApv::ReadNext(), and TString.

122 {
123 
124  // cout << "--*--" << endl;
125 
126 
127  // Reset output array
128  fStripArray->Delete();
129 
130  std::map<Int_t,Double_t> singleSidedBacksideMap;
131  std::map<Int_t,std::vector<Int_t> > buffIndex;
132 
133  Int_t nbox, ch;
134  //Int_t rw=-1;
135  Int_t sw=-1, botfe=-1;
136  TString detpath="";
137  Int_t detnameid;
138  Int_t stripnum;
139  Int_t buffCh = -1;
140  Double_t buffClock;
141  Double_t buffSpill;
142 
143  std::vector<PndSdsDigiStrip> strips = fApvConvert->ReadNext();
144  for (std::vector<PndSdsDigiStrip>::iterator strip=strips.begin(); strip!=strips.end(); ++strip)
145  {
146  //rw=strip->GetFE();
147  //sw=strip->GetFE();
148 
149  nbox = strip -> GetSensorID();
150  //ch = strip -> GetChannel();
151  buffCh = strip -> GetChannel();
152  fApvMapper->DoMapping(nbox,buffCh,detpath);
153  detnameid=fGeoH->GetShortID(detpath);
154 
155  buffClock = strip->GetTimeStamp();
156  buffSpill = strip->GetTimeStampError();
157 
158  if(fVerbose>1) Info("Exec","Write a Digi from detector %s %i",detpath.Data(),detnameid);
159  stripnum = fStripArray->GetEntriesFast();
160  //cout << "stripnum: " << stripnum << endl;
161 
162  sw = (Int_t) buffCh/128.;
163  ch = (Int_t) buffCh%128;
164 
165  if (IsSingleSided(detpath))
166  {
167  //cout << "Detected as single sided: " << detpath.Data() << endl;
168  if (sw > 2)
169  {
170  sw = sw - 3;
171  }
172  }
173 
174  //cout << "Box: " << nbox << ", channel: " << buffCh << ", nome: " << detpath.Data() << ", iD: " << detnameid << ", FE: " << sw << ", corrCh: " << ch << endl;
175 
176  PndSdsDigiStrip *buffStr = new PndSdsDigiStrip(strip->GetIndices(), strip->GetDetID(),detnameid, sw, ch, strip->GetCharge(),strip->GetTimeStamp());
177  buffStr->SetTimeStampError(strip->GetTimeStampError());
178 
179  new ((*fStripArray)[stripnum]) PndSdsDigiStrip(*buffStr);
180 
181  //new ((*fStripArray)[stripnum]) PndSdsDigiStrip(strip->GetIndices(), strip->GetDetID(),detnameid, sw, ch, strip->GetCharge() ,0);
182  // collect information of fake bottom sides if singlesided
183  if (IsSingleSided(detpath))
184  { // collect information of fake bottom sides if singlesided
185  singleSidedBacksideMap[detnameid]+= strip->GetCharge();
186  (buffIndex[detnameid]).push_back(strip->GetIndex());
187  }
188  }
189 
190  // writing the single sided fake backside
191  for (std::map<Int_t,Double_t>::iterator it=singleSidedBacksideMap.begin();it!=singleSidedBacksideMap.end();++it)
192  {
193  stripnum = fStripArray->GetEntriesFast();
194  botfe=CalcBotFakeFE( fGeoH->GetPath(it->first) );
195 
196  PndSdsDigiStrip *buffStr2 = new PndSdsDigiStrip(buffIndex[it->first], kMVDHitsStrip,it->first, botfe, 0, it->second, buffClock);
197  buffStr2->SetTimeStampError(buffSpill);
198 
199  new ((*fStripArray)[stripnum])PndSdsDigiStrip(*buffStr2);
200 
201  //new ((*fStripArray)[stripnum])PndSdsDigiStrip(buffIndex[it->first], kMVDHitsStrip,it->first, botfe, 0, it->second, 0);
202  }
203 
204 }
TClonesArray * fStripArray
array of results
int fVerbose
Definition: poormantracks.C:24
labels push_back("electron")
Class for digitised strip hits.
Double_t GetCharge() const
Definition: PndSdsDigi.h:60
TString GetPath(Int_t shortID)
for a given shortID the path is returned
Bool_t IsSingleSided(TString &detpath)
void DoMapping(Int_t nbox, Int_t chan, TString &detpath)
Double_t
std::vector< PndSdsDigiStrip > ReadNext()
Int_t GetShortID(TString path)
for a given path the (unique) position of the sensor path in the fSensorNamePar-List is given...
PndGeoHandling * fGeoH
Geohandler for name string compression.
PndMvdConvertApv * fApvConvert
class which convert the read in and hold the streams
Int_t CalcBotFakeFE(TString detpath)
void PndMvdConvertApvTask::Finish ( )
virtual

finish task

Returns
void

Definition at line 239 of file PndMvdConvertApvTask.cxx.

240 {}
Bool_t PndMvdConvertApvTask::GetPersistance ( )
inline

Definition at line 70 of file PndMvdConvertApvTask.h.

References fPersistance.

70 {return fPersistance;};
InitStatus PndMvdConvertApvTask::Init ( )
virtual

init task

Definition at line 79 of file PndMvdConvertApvTask.cxx.

References PndGeoHandling::CreateUniqueSensorId(), fApvConvert, fApvMapper, fBotSides, fDigiParameterList, fGeoH, fPersistance, fStripArray, fVerbose, PndMvdBoxMap::Init(), PndMvdConvertApv::Init(), PndGeoHandling::PrintSensorNames(), and TString.

80 {
81 
82  // Get RootManager
83  FairRootManager* ioman = FairRootManager::Instance();
84  if ( ! ioman )
85  {
86  std::cout << "-E- PndMvdStripHitProducer::Init: "
87  << "RootManager not instantiated!" << std::endl;
88  return kFATAL;
89  }
90 
91  // Create and register output array
92  fStripArray = new TClonesArray("PndSdsDigiStrip");
93  ioman->Register("MVDStripDigis", "MVD", fStripArray, fPersistance);
94  fApvConvert->Init();
95  fApvMapper->Init();
96  cout<<"Init of Task finished"<<endl;
97 
98  // set up the geohandler
99  std::vector<std::string> listOfSensitives;
100  listOfSensitives.push_back("StripActive");
101  fGeoH->CreateUniqueSensorId("", listOfSensitives);
102 
104 
105  TIter parsetiter(fDigiParameterList);
106  while ( PndSdsStripDigiPar* digipar = (PndSdsStripDigiPar*)parsetiter() )
107  {
108  cout << "Debugging, sens type: " << (TString)digipar->GetSensType() << ", num of bot FE: " << digipar->GetNrBotFE() << endl;
109  if(digipar->GetNrBotFE()==1)
110  { // we count top side first from 0; Bot side strarts at #top fe's
111  fBotSides[(TString)digipar->GetSensType()]=digipar->GetNrTopFE();
112  }
113  }
114 
115  return kSUCCESS;
116 
117 }
TClonesArray * fStripArray
array of results
int fVerbose
Definition: poormantracks.C:24
void CreateUniqueSensorId(TString startName, std::vector< std::string > listOfSensitives)
Has to be called during simulation to create unique sensor id.
void PrintSensorNames()
Bool_t Init()
Digitization Parameter Class for MVD-Strip part.
PndGeoHandling * fGeoH
Geohandler for name string compression.
PndMvdConvertApv * fApvConvert
class which convert the read in and hold the streams
std::map< TString, Int_t > fBotSides
Bool_t PndMvdConvertApvTask::IsSingleSided ( TString detpath)
private

Definition at line 207 of file PndMvdConvertApvTask.cxx.

References fBotSides.

Referenced by Exec().

208 {
209 
210  if( !(detpath.Contains("Strip")) ) return kFALSE;
211 
212  for(std::map<TString,Int_t>::iterator it=fBotSides.begin();it!=fBotSides.end();it++)
213  {
214  if( detpath.Contains(it->first) )
215  {
216  //cout << "Sensor type: " << it->first << endl;
217  //cout << "Path: " << detpath << endl;
218  return kTRUE;
219  }
220  }
221 
222  return kFALSE;
223 }
std::map< TString, Int_t > fBotSides
PndMvdConvertApvTask& PndMvdConvertApvTask::operator= ( const PndMvdConvertApvTask )
delete
void PndMvdConvertApvTask::Register ( )
private
Returns
void
void PndMvdConvertApvTask::Reset ( )
private
Returns
void
void PndMvdConvertApvTask::SetParContainers ( )
virtual

Definition at line 47 of file PndMvdConvertApvTask.cxx.

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

48 { // in this task we even don't need the digitization info
49 
50 cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
51 cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
52 cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
53 cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
54 cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
55 
56  FairRun* ana = FairRun::Instance();
57  FairRuntimeDb* rtdb=ana->GetRuntimeDb();
58  PndMvdContFact* themvdcontfact = (PndMvdContFact*)rtdb->getContFactory("PndMvdContFact");
59  TList* theContNames = themvdcontfact->GetDigiParNames();
60  Info("SetParContainers()","The container names list contains %i entries",theContNames->GetEntries());
61  TIter cfIter(theContNames);
62  while (TObjString* contname = (TObjString*)cfIter()) {
63  TString parsetname = contname->String();
64  if(parsetname.BeginsWith("MVDStripDigiPar")){
65  PndSdsStripDigiPar* digipar = (PndSdsStripDigiPar*)(rtdb->getContainer(parsetname.Data()));
66  Info("SetParcontiners()","check some values. fDigiParameterList: %p digipar: %p",fDigiParameterList,digipar);
67  fDigiParameterList->Add(digipar);
68 
69 
70  Info("SetParContainers()","Loaded container %s",parsetname.Data());
71  }
72  }
73 
74  return;
75 
76 }
TList * GetDigiParNames()
Digitization Parameter Class for MVD-Strip part.
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
void PndMvdConvertApvTask::SetPersistance ( Bool_t  p = kTRUE)
inline

Definition at line 69 of file PndMvdConvertApvTask.h.

References fPersistance, and p.

69 {fPersistance=p;};
Double_t p
Definition: anasim.C:58

Member Data Documentation

PndMvdConvertApv* PndMvdConvertApvTask::fApvConvert
private

class which convert the read in and hold the streams

Definition at line 76 of file PndMvdConvertApvTask.h.

Referenced by Exec(), and Init().

PndMvdBoxMap* PndMvdConvertApvTask::fApvMapper
private

Definition at line 77 of file PndMvdConvertApvTask.h.

Referenced by Exec(), and Init().

std::map<TString,Int_t> PndMvdConvertApvTask::fBotSides
private

Definition at line 85 of file PndMvdConvertApvTask.h.

Referenced by CalcBotFakeFE(), Init(), and IsSingleSided().

TList* PndMvdConvertApvTask::fDigiParameterList
private

Definition at line 84 of file PndMvdConvertApvTask.h.

Referenced by Init(), and SetParContainers().

PndGeoHandling* PndMvdConvertApvTask::fGeoH
private

Geohandler for name string compression.

Definition at line 81 of file PndMvdConvertApvTask.h.

Referenced by Exec(), and Init().

Bool_t PndMvdConvertApvTask::fPersistance
private

Definition at line 70 of file PndMvdConvertApvTask.h.

Referenced by GetPersistance(), Init(), and SetPersistance().

TClonesArray* PndMvdConvertApvTask::fStripArray
private

array of results

Definition at line 79 of file PndMvdConvertApvTask.h.

Referenced by Exec(), and Init().

Int_t PndMvdConvertApvTask::iStrip
private

number of strips in this event

Definition at line 83 of file PndMvdConvertApvTask.h.


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