|
//____________________________________________________________________ // // Rdo module for the pp Td1 trigger counters. // // // The bb information is only used in case of creating an Ntuple. // This Ntuple is very useful to check internal resolution, timing offfsets // and slewing corrections. // // // TODO: // Add calibrations for Position and timing offsets. // Add calibrations for eff speed of light. // //____________________________________________________________________ // // $Id: BrTd1RdoModule.cxx,v 1.6 2002/04/02 19:21:31 videbaek Exp $ // $Author: videbaek $ // $Date: 2002/04/02 19:21:31 $ // $Copyright: (C) 2002 BRAHMS Collaboration <brahmlib@rhic.bnl.gov> // #ifndef BRAT_BrTd1RdoModule #include "BrTd1RdoModule.h" #endif #ifndef ROOT_TDirectory #include "TDirectory.h" #endif #include <BrIostream.h> #ifndef ROOT_TH1 #include "TH1.h" #endif #ifndef ROOT_TH2 #include "TH2.h" #endif #ifndef ROOT_TNtuple #include "TNtuple.h" #endif #ifndef BRAT_BrEventNode #include "BrEventNode.h" #endif #ifndef BRAT_BrTd1Rdo #include "BrTd1Rdo.h" #endif #ifndef BRAT_BrTofDig #include "BrTofDig.h" #endif #ifndef BRAT_BrBbVertex #include "BrBbVertex.h" #endif #ifndef BRAT_BrCalibrationManager #include "BrCalibrationManager.h" #endif #ifndef BRAT_BrTofCalibration #include "BrTofCalibration.h" #endif //____________________________________________________________________ ClassImp(BrTd1RdoModule); //____________________________________________________________________ BrTd1RdoModule::BrTd1RdoModule() { // Default constructor. DO NOT USE SetState(kSetup); SetDefaultParameters(); } //____________________________________________________________________ BrTd1RdoModule::BrTd1RdoModule(const Char_t* name, const Char_t* title) : BrModule(name, title) { // Named Constructor SetState(kSetup); SetDefaultParameters(); } //___________________________________________________________ void BrTd1RdoModule::SetDefaultParameters() { // default parameters, called in constructors SetNtuple(); // default is kFALSE SetUseBbVertex(); // default is kTRUE } //____________________________________________________________________ void BrTd1RdoModule::DefineHistograms() { // Define histograms. They are: // <fill in here> if (GetState() != kInit) { Stop("DefineHistograms", "Must be called after Init"); return; } TDirectory* saveDir = gDirectory; TDirectory* histDir = gDirectory->mkdir(GetName()); histDir->cd(); // Make histograms here fhTimeSlat = new TH2F("timeSlat","Time vs slats", 3, 0.5, 3.5, 1024, 0, 128); fhTimeUpSlat = new TH2F("timeUpSlat","TimeUp vs slats", 3, 0.5, 3.5, 1024, 0, 128); fhTimeDownSlat = new TH2F("timeDownSlat","TimeDown vs slats", 3, 0.5, 3.5, 1024, 0, 128); fhAdcUpSlat = new TH2F("adcUpSlat","Normalized Adc Up vs Slat",3, 0.5, 3.5, 1024, 0, 8196); fhAdcDownSlat = new TH2F("adcDownSlat","Normalized Adc Down vs Slat",3, 0.5, 3.5, 512, 0, 4096); fhPosSlat = new TH2F("posSlat","Average Pos vs Slat",3, 0.5, 3.5, 200,-10,10); if(fUseNtuple) fTd1Tree = new TNtuple(Form("%sRdoTree", GetName()), Form("%s rdo hits tree", GetName()), "slat:tof:tdcup:tdcdown:deup:dedown:y:" "bbt0:bbtl:bbtr:z"); gDirectory = saveDir; } //____________________________________________________________________ void BrTd1RdoModule::Init() { // Job-level initialisation SetState(kInit); if (DebugLevel() > 1) cout << "Entering Init of BrTd1RdoModule" << endl; // calibration BrCalibrationManager *parMan = BrCalibrationManager::Instance(); if (!parMan) { Abort("Init", "Couldn't instantiate calibration manager"); return; } // get the calibration element (created in main) fCalibration = (BrTofCalibration*)parMan->Register("BrTofCalibration", GetName()); if (!fCalibration) { Abort("Init", "Couldn't get calibration parameters for %s", GetName()); return; } // check calibration mode BrCalibration::EAccessMode mode = BrCalibration::kRead; const Int_t nSlats = 3; // pedestals if (!fCalibration->GetAccessMode("topPedestal") || !fCalibration->GetAccessMode("botPedestal")) { fCalibration->Use("topPedestal", mode, nSlats); fCalibration->Use("botPedestal", mode, nSlats); } if (!fCalibration->GetAccessMode("topTdcGain") || !fCalibration->GetAccessMode("botTdcGain")) { fCalibration->Use("topTdcGain", mode, nSlats); fCalibration->Use("botTdcGain", mode, nSlats); } if (!fCalibration->GetAccessMode("topGap") || !fCalibration->GetAccessMode("botGap")) { fCalibration->Use("topGap", mode, nSlats); fCalibration->Use("botGap", mode, nSlats); } if (!fCalibration->GetAccessMode("topGapStart") || !fCalibration->GetAccessMode("botGapStart")) { fCalibration->Use("topGapStart", mode, nSlats); fCalibration->Use("botGapStart", mode, nSlats); } if(!fCalibration->GetAccessMode("topAdcGain")){ fCalibration->Use("topAdcGain", mode, nSlats); fCalibration->Use("botAdcGain", mode, nSlats); } fPositionOffset[0] = 1.3; fPositionOffset[1] = 4.9; fPositionOffset[2] = 0.6; fTimeOffset[0] = 0.0; // nsec fTimeOffset[1] = 0.249; // Time offset is actual timing + amount from 7.5 cm difference. fTimeOffset[2] = 0.183; // nsec } //____________________________________________________________________ void BrTd1RdoModule::Begin() { // Run-level initialisation SetState(kBegin); } //____________________________________________________________________ void BrTd1RdoModule::Event(BrEventNode* inNode, BrEventNode* outNode) { // Per event method SetState(kEvent); BrDataTable* table = inNode->GetDataTable ("DigTof TD1"); if(!table) return; BrBbVertex* bb=0; if(fUseBbVertex){ bb = (BrBbVertex*) inNode->GetObject("BB Vertex"); if (!bb) { if (DebugLevel() > 2) Warning("Event", "No Beam Beam vertex"); } } Float_t tdcUp[3], tdcDown[3]; Float_t adcUp[3], adcDown[3]; int nh= table->GetEntries(); for(int k=0; k < nh; k++){ BrTofDig* p = (BrTofDig*) table->At(k); if(p) { int slat = p->GetSlatno()-1; int slatc = slat+1; Float_t tPed = fCalibration->GetTopPedestal(slatc); Float_t bPed = fCalibration->GetBotPedestal(slatc); tdcUp[slat]= p->GetTdcUp(); tdcDown[slat]= p->GetTdcDown(); Float_t topGapStart = fCalibration->GetTopAdcGapStart(slatc); Float_t topGap = fCalibration->GetTopAdcGap(slatc); Float_t botGap = fCalibration->GetBotAdcGap(slatc); Float_t botGapStart = fCalibration->GetBotAdcGapStart(slatc); if(p->GetAdcUp() < topGapStart) adcUp[slat]= p->GetAdcUp(); else adcUp[slat]= p->GetAdcUp() - topGap; if(p->GetAdcDown() < botGapStart) adcDown[slat]= p->GetAdcDown(); else adcDown[slat]= p->GetAdcDown() -botGap; adcDown[slat] -=bPed; adcUp[slat] -=tPed; } } BrTd1Rdo* td1Rdo = new BrTd1Rdo("Td1Rdo","rdo"); outNode->AddObject(td1Rdo); for(int k=0;k<3;k++){ if(tdcUp[k]<4000 && tdcDown[k]<4000){ int slat = k+1; Float_t tTGain = fCalibration->GetTopTdcGain(slat); Float_t bTGain = fCalibration->GetBotTdcGain(slat); Float_t tAdcGain = fCalibration->GetTopAdcGain(slat); Float_t bAdcGain = fCalibration->GetBotAdcGain(slat); Float_t tdcup =tdcUp[k]*tTGain; Float_t tdcdown= tdcDown[k]*bTGain; float deup = adcUp[k]/tAdcGain*1000.; float dedown = adcDown[k]/bAdcGain*1000.; if(deup<0.3 || dedown < 0.3) continue; // // Poor mans slewing - but looks good when adjusting to Ntuple's (deup:tdcup-bbr) // float dtup = -1.2/TMath::Sqrt(deup/1000)+1.2; float dtdown = -1.2/TMath::Sqrt(dedown/1000.)+1.2; Float_t t0 = (tdcup+dtup+tdcdown+dtdown)/2 + fTimeOffset[k]; // nsec Float_t y = (-tdcup-dtup+tdcdown+dtdown)*15. * 0.40 -fPositionOffset[k]; Float_t x = 4.25 - k*4.0; Float_t de = (deup+dedown)/2.0; td1Rdo->AddHit(k+1, t0, de, y, x); if(HistOn()){ int slat=k+1; fhTimeUpSlat->Fill(slat,tdcup); fhTimeDownSlat->Fill(slat,tdcdown); fhAdcUpSlat->Fill(slat, deup); fhAdcDownSlat->Fill(slat,dedown); fhTimeSlat->Fill(slat,t0); fhPosSlat->Fill(slat,y); } if (fUseNtuple) { if(bb){ Float_t bbt0 = bb->GetTime0(); Float_t bbz = bb->GetZ0(); Float_t bbtl = bb->GetLeftTime(); Float_t bbtr = bb->GetRightTime(); const Float_t ntVar[] = { slat, t0, tdcup, tdcdown, deup, dedown, y, bbt0, bbtl, bbtr, bbz }; fTd1Tree->Fill(ntVar); } } } } // // if(Verbose()>10){ td1Rdo->Print("ad"); } } //____________________________________________________________________ void BrTd1RdoModule::End() { // Run-level finalisation SetState(kEnd); } //____________________________________________________________________ void BrTd1RdoModule::Finish() { // Job-level finalisation SetState(kFinish); } //____________________________________________________________________ void BrTd1RdoModule::Print(Option_t* option) const { // Print module information // See BrModule::Print for options. // In addition this module defines the Option: // <fill in here> TString opt(option); opt.ToLower(); BrModule::Print(option); if (opt.Contains("d")) cout << endl << " Original author: Flemming Videbaek" << endl << " Last Modifications: " << endl << " $Author: videbaek $" << endl << " $Date: 2002/04/02 19:21:31 $" << endl << " $Revision: 1.6 $ " << endl << endl << "-------------------------------------------------" << endl; } //____________________________________________________________________ // // $Log: BrTd1RdoModule.cxx,v $ // Revision 1.6 2002/04/02 19:21:31 videbaek // modified constants // // Revision 1.5 2002/03/20 19:22:38 videbaek // Added usage of calibration objects instead of hardcoded constants. // This is partly done, but misses a few. See code for details. // // Revision 1.4 2002/03/04 15:33:49 videbaek // modified hard-code constants // // Revision 1.3 2002/02/15 21:18:00 videbaek // Minor updates - still prototype // // Revision 1.2 2002/02/15 20:04:59 videbaek // Added histograms // // Revision 1.1 2002/02/08 21:43:43 videbaek // Added RdoModule for Td1 - prototype // // |
||||||
This page automatically generated by script docBrat by Christian Holm |
Copyright ; 2002 BRAHMS Collaboration
<brahmlib@rcf.rhic.bnl.gov>
|