9 #include "ERSimtoRaw.h" 19 : FairTask(
"Convert Sim event to Raw event", NEvents),
31 : FairTask(
"Convert Sim event to Raw event"),
51 FairRootManager* ioman = FairRootManager::Instance();
52 if ( ! ioman ) Fatal(
"Init",
"No FairRootManager");
56 fPixelSignals = (TClonesArray*) ioman->GetObject(
"NeuRadPixelSignal");
58 Fatal(
"Init",
"Can`t find branch in input file!");
63 for (Int_t iChanel = 0; iChanel < fNChanels; iChanel++){
66 bName.Form(
"ch%d.",iChanel+1);
67 ioman->Register(bName,
"Raw", fRawEvents[iChanel], kTRUE);
78 if ( !(fEvent%500) ) { std::cout <<
"####### EVENT " << fEvent <<
" #####" << std::endl; }
79 Int_t simSize,side,counter,PEnum;
80 Double_t maxAmp, StartTime, FinishTime;
84 FairRun* run = FairRun::Instance();
85 run->MarkFill(kFALSE);
86 for (Int_t iSignal = 0; iSignal < fPixelSignals->GetEntriesFast(); iSignal++){
88 if ( signal->PixelNb() != 136 )
continue;
89 TArrayF* result = signal->ResultSignal();
92 simSize = result->GetSize();
94 if ( signal->Side() == 0 ){
95 for(Int_t i = 0; i<simSize; i++){
96 if( maxAmp < result->GetAt(i) ) {maxAmp = result->GetAt(i);}
102 StartTime = signal->GetStartTime();
103 FinishTime = signal->GetFinishTime();
105 for(Int_t nPoint = 0; nPoint< fNPoints; nPoint++) {
107 if( nPoint<=StartTime*10 || nPoint>=(FinishTime*10-1) ) {
108 if(signal->Side() == 0) {fRawEvents[0]->SetAmp(0, nPoint);}
109 if(signal->Side() == 1) {fRawEvents[1]->SetAmp(0, nPoint);}
112 if(signal->Side() == 0) {fRawEvents[0]->SetAmp(-result->GetAt(nPoint - StartTime*10), nPoint);}
113 if(signal->Side() == 1) {fRawEvents[1]->SetAmp(-result->GetAt(nPoint - StartTime*10), nPoint);}
116 if(signal->Side() == 0) {fRawEvents[0]->SetTime(nPoint*0.1, nPoint);}
117 if(signal->Side() == 1) {fRawEvents[1]->SetTime(nPoint*0.1, nPoint);}
120 if(signal->Side() == 0) fRawEvents[0]->SetStartTime(StartTime);
121 if(signal->Side() == 1) fRawEvents[1]->SetStartTime(StartTime);
122 if(signal->Side() == 0) fRawEvents[0]->SetFinishTime(FinishTime);
123 if(signal->Side() == 1) fRawEvents[1]->SetFinishTime(FinishTime);
125 if(signal->Side() == 0) {
126 fRawEvents[0]->SetPETimes(signal->GetPETimes());
127 fRawEvents[0]->SetPEAmps(signal->GetPEAmps());
128 fRawEvents[0]->SetEvent(fEvent);
130 if(signal->Side() == 1) {
131 fRawEvents[1]->SetPETimes(signal->GetPETimes());
132 fRawEvents[1]->SetPEAmps(signal->GetPEAmps());
133 fRawEvents[1]->SetEvent(fEvent);
virtual void Exec(Option_t *opt)
virtual InitStatus Init()
class for raw data obtained from measurements or simulations