// File: hrichpedestalraw.cc // // Author: Angelika Elhardt // Last update by Angelika Elhardt: 01/01/13 15:14:06 // last modified by W.Schoen: 2000/11/08 #include #include "hrichpedestalraw.h" #include "hevent.h" #include "hspectrometer.h" #include "hrichdetector.h" #include "hcategory.h" #include "hmatrixcatiter.h" #include "hrichraw.h" #include "richdef.h" #include "hrichgeometrypar.h" #include "hdetgeompar.h" #include "hruntimedb.h" #include "hrichcalparcell.h" #include "hlocation.h" #include "hrichcalpar.h" #include "hrichmappingpar.h" #include #include ClassImp(HRichPedestalRaw) HRichPedestalRaw::HRichPedestalRaw(Text_t *name, Text_t *title, char * path ,char * pString): HReconstructor(name,title) { pedPathName = path; strcpy(sectorList,pString); numSec = strlen(sectorList); for (int i=0;i sectorMax) { cout<<"!!!!!!!!!!!!!!!!!!!!!!!"<47 && b<55)){ cout<<"Attention!!! "<Fill(j,k,pStat[sIx][j][k]); pSum[sIx][j][k] = pSum[sIx][j][k]/nCounter; pSum2[sIx][j][k] = pSum2[sIx][j][k]/nCounter; Float_t radikand = pSum2[sIx][j][k]-pSum[sIx][j][k]*pSum[sIx][j][k]; if (radikand >= 0){ pSum2[sIx][j][k] = sqrt(radikand); meanHisto[i]->Fill(j,k,pSum[sIx][j][k]); sigmaHisto[i]->Fill(j,k,pSum2[sIx][j][k]); }else{ cout<<"!2D!numeric prob occured, nr of events proc: " <= 0){ mean1dHisto[i]->Fill(j,pSum[sIx][x][y]); sigma1dHisto[i]->Fill(j,pSum2[sIx][x][y]); }else{ cout<<"!1D!numeric prob occured @ event no " <getRuntimeDb()->getContainer("RichMappingParameters"); //vec5 = ((HRichMappingPar*)fMappingPar)->padsx; //int x = (int) (*vec5)(hardwarenumber); return ((HRichMappingPar*)fMappingPar)->getCol(hardwarenumber); } int HRichPedestalRaw::getRow(int hardwarenumber){ fMappingPar=gHades->getRuntimeDb()->getContainer("RichMappingParameters"); //vec6 = ((HRichMappingPar*)fMappingPar)->padsy; //int y = (int) (*vec6)(hardwarenumber); return ((HRichMappingPar*)fMappingPar)->getRow(hardwarenumber); } void HRichPedestalRaw::uipFile(){ //cout << "using uipfile information" << endl; TFile *pFile = new TFile("uipfile_new.root","read","Testfile",1); if(pFile){ vec3 = (TVector*) pFile->Get("uip"); //retrieve object from file vec5 = (TVector*) pFile->Get("pads_x"); //and keyname vec6 = (TVector*) pFile->Get("pads_y"); } else cout << "problems opening upifile" << endl; } void HRichPedestalRaw::bookCanvases(){ } void HRichPedestalRaw::calculate(){ HRichRaw *pRaw=NULL; Bool_t kData = kFALSE; pIter->Reset(); while( (pRaw = (HRichRaw *)pIter->Next()) ){ kData = kTRUE; Int_t sec = pRaw->getSector(); Float_t fCharge = pRaw->getCharge(); Int_t iRow = pRaw->getRow(); Int_t iCol = pRaw->getCol(); if(mask[sec][0]==1){ if(iRow < rowMax && iCol < colMax){ int sIx = mask[sec][1]; //if ((iCol==0 && iRow==0) ||(iCol==1 && iRow==0)||(iCol==0 && iRow==1) ) //cout << "decoded a wrong address: Col= "<< iCol << " Row= " << iRow << endl; // if(sec==1 && iCol==44 && iRow==55){ // cout<<"(2,44,55): "<Write(); mean1dHisto[i]->Write(); sigmaHisto[i]->Write(); sigma1dHisto[i]->Write(); statHisto[i]->Write(); } } dataFile->Close(); cout<<"Histos are written to: "<getSetup()->getDetector("Rich"); pRichRaw=gHades->getCurrentEvent()->getCategory(catRichRaw); if (!pRichRaw) { pRichRaw=pRichDet->buildCategory(catRichRaw); if (!pRichRaw) return kFALSE; else gHades->getCurrentEvent() ->addCategory(catRichRaw, pRichRaw, "Rich"); } pIter = (HMatrixCatIter*)pRichRaw->MakeIterator(); //There should no longer be any uipfile in use. //We are supposed to handle this viw mapping par //containers! //uipFile(); initMappingPar(); initCalPar(); nCounter = 0; } return kTRUE; } Int_t HRichPedestalRaw::execute() { if (checkInput){ calculate(); // mean and sigma } return kTRUE; } Bool_t HRichPedestalRaw::finalize(void) { if (checkInput){ //cout<<"We are in finalize!"<getRuntimeDb(); fCalPar = rtdb->getContainer("RichCalPar"); } void HRichPedestalRaw::initMappingPar() { cout << "init mappar" << endl; HRuntimeDb* rtdb=gHades->getRuntimeDb(); fMappingPar = rtdb->getContainer("RichMappingParameters"); } Bool_t HRichPedestalRaw::fillCalParCntr(){ initCalPar(); HLocation loc; HRichCalParCell *pCell=0; loc.setNIndex(3); Int_t n=0; for(Int_t k =0; kgetSlot(loc); if (pCell) { pCell = new(pCell) HRichCalParCell; pCell->setSector(k); pCell->setRow(j); pCell->setCol(i); pCell->setSlope(1); pCell->setOffset(pSum[sIx][i][j]); pCell->setSigma(pSum2[sIx][i][j]); n++; }else{ cerr<<"Error in HRichPedestalRaw::fillCalParCntr"<getObject(loc); cout<<"Location: "<getSlope()<<" : "<getOffset()<<" : "<getSigma()<Get("uip unconnected"); HRuntimeDb* rtdb=gHades->getRuntimeDb(); fMappingPar = rtdb->getContainer("RichMappingParameters"); //TVector *pUncVec = ((HRichMappingPar*)fMappingPar)->uncuip; //vec3 = ((HRichMappingPar*)fMappingPar)->uiplog; for (Int_t i = 0; iisValidUpi(hardware)){ pedestalOut<isUnConnCh(hardware)){ pedestalOut<Close(); } void HRichPedestalRaw::createCalibration(){ char * extPed = ".txt"; char calFile[128]; // filename and path! strcpy(calFile,pedPathName); strcat(calFile,"_cal"); strcat(calFile,extPed); //cout<