|
//____________________________________________________________________ // // A module to generate scaler histograms // // // $Id: BrScalerHistModule.cxx,v 1.1 2002/08/30 17:07:07 hagel Exp $ // $Author: hagel $ // $Date: 2002/08/30 17:07:07 $ // $Copytight: 2000 BRAHMS Collaboration // #include "BrScalerHistModule.h" #include "BrEventHeader.h" #include "BrTrigScaler.h" #include "BrEvent.h" #include "TDirectory.h" #include "TH1.h" #include <BrIostream.h> //____________________________________________________________________ ClassImp(BrScalerHistModule); //____________________________________________________________________ BrScalerHistModule::BrScalerHistModule() { // Default constructor SetState(kSetup); } //____________________________________________________________________ BrScalerHistModule::BrScalerHistModule(const Char_t* name, const Char_t* title) : BrModule(name, title) { // Normal constructor SetState(kSetup); } //_______________________________________________________ void BrScalerHistModule::Init() { // Initialize variables. SetState(kInit); fInit = kTRUE; fLastTicNo = 0; if(fMode == k2001pp) { Char_t *scalers[] = { "INel L R ", "Inel L", "Inel R", "Inel L R (RC)", "BB L.R", "BB Left", "BB right", "BB LR >=2", "scaler 9", "1Hz Tick", "Trig 3 MRS", "scaler 12", "H1 U.D singles", "H2 U.D singles", "BB L singles >=2", "BB R singles >=2" }; for(Int_t i=0;i<16;i++) fScalerNames[i] = scalers[i]; } else if(fMode == k2001AuAu) { Char_t *scalers[] = { "ZDC", "Inel Left", "Inel Right", "Inel trig (5) ", "BB L.R", "BB Left", "BB right", "BB L.R >=2", "Trigger 6 (FS)", "1Hz Tick", "Trigger 3(MRS)", "scaler 12", "H1 U.D singles", "H2 U.D singles", "BB L singles >=2", "BB R singles >=2" }; for(Int_t i=0;i<16;i++) fScalerNames[i] = scalers[i]; } else { Char_t *scalers[] = { "ZDC", "Inel Left", "Inel Right", "Inel trig (5) ", "BB L.R", "BB Left", "BB right", "BB L.R >=2", "Trigger 6 (FS)", "1Hz Tick", "Trigger 3(MRS)", "scaler 12", "H1 U.D singles", "H2 U.D singles", "BB L singles >=2", "BB R singles >=2" }; for(Int_t i=0;i<16;i++) fScalerNames[i] = scalers[i]; } } //_______________________________________________________ void BrScalerHistModule::DefineHistograms() { // Define histograms // if (GetState() != kInit) { // Problem("Define Histograms", "must be called after Init"); // return; // } // remember current directory TDirectory* savdir = gDirectory; // Make directory for this module TDirectory* hdir = savdir->mkdir("ScalerHists"); if (!hdir) { Warning("DefineHistograms","could not create histogram subdirectory"); return; } // Change directory to histogram directory hdir->cd(); // Make histograms for(Int_t i=0;i<16;i++){ hRate[i] = new TH1F(Form("rate_%d",i+1), fScalerNames[i].Data(), 2160, 0.,21600.); //enough for 6 hours } //Now, set some pretty colors hRate[1]->SetLineColor(kYellow); hRate[2]->SetLineColor(kBlue); hRate[5]->SetLineColor(kYellow); hRate[6]->SetLineColor(kBlue); hRate[14]->SetLineColor(kYellow); hRate[15]->SetLineColor(kBlue); //Interesting ratios for pp hFsOverInel = new TH1F("hFsOverInel","hFsOverInel",2160,0,21600); hMrsOverInel = new TH1F("hMrsOverInel","hMrsOverInel",2160,0,21600); // Restore directory gDirectory = savdir; } //_______________________________________________________ void BrScalerHistModule::Event(BrEventNode* input, BrEventNode* output) { // Return with status set to kDisaster if the input was note a // BrEvent object, or the trigger mask doesn't fit with the selected // triggers. SetState(kEvent); SetStatus(kOk); BrEventHeader *event_header = ((BrEvent*)input)->GetEventHeader(); Int_t trig1 = event_header->TriggerWord(1); Info(30,"Event","trig1 = %d",trig1); //if(trig1 != 32896) return; //What is this??? sync trigger??? BrTrigScaler* scaler_p = (BrTrigScaler*)input->GetObject ("TriggerScalers"); Info(20,"Event","scaler_p = %d, fInit = %d",Int_t(scaler_p),fInit); if(scaler_p){ if(fInit){ for(Int_t j=0;j<16;j++) fPreviousScaler[j]= scaler_p->GetScaler(j); fInit = kFALSE; fFirstTicNo=fLastTicNo = fPreviousScaler[9]; return; //nothing more to do on this first time through. } Float_t scalerSave[16]; // Assume scaler 10 is 1 Hz counter. Int_t ticno = scaler_p->GetScaler(9); if (ticno < fLastTicNo) ticno +=0x1000000; Float_t timeElapsed = ticno - fFirstTicNo; Float_t timeDifference = ticno - fLastTicNo; if(ticno > fLastTicNo+10){ Int_t j; for(j=0;j<16;j++){ Int_t scaler = scaler_p->GetScaler(j); scalerSave[j] = scaler; if(scaler < fPreviousScaler[j]) fPreviousScaler[j] -= 0x1000000; Float_t rate = Float_t(scaler-fPreviousScaler[j])/timeDifference; if(HistOn()) hRate[j]->Fill(timeElapsed, rate); } //Get some interesting quantities for pp, namely ratios of trig 6/5; trig3/5 Float_t xInel = scalerSave[0] - fPreviousScaler[0]; Float_t xFs = scalerSave[8] - fPreviousScaler[8]; Float_t xMrs = scalerSave[10] - fPreviousScaler[10]; Float_t fsOverInel = 0.0; Float_t mrsOverInel = 0.0; if(xInel > 0) fsOverInel = xFs / xInel; if(xInel > 0) mrsOverInel = xMrs / xInel; hFsOverInel->Fill(timeElapsed,fsOverInel); hMrsOverInel->Fill(timeElapsed,mrsOverInel); //Now, save the scalers for the next time around for(j=0;j<16;j++) fPreviousScaler[j] = Int_t(scalerSave[j]); //And the ticno fLastTicNo = ticno; } } } //____________________________________________________________________ void BrScalerHistModule::Finish() { } //____________________________________________________________________ void BrScalerHistModule::Print(Option_t* option) const { // Print info on module BrModule::Print(option); TString opt(option); opt.ToLower(); if (opt.Contains("d")) { cout<< " Original author: K. Hagel" << endl << " $Author: hagel $" << endl << " $Date: 2002/08/30 17:07:07 $" << endl << " $Revision: 1.1 $ " << endl << endl << "*************************************************" << endl; } } // // $Log: BrScalerHistModule.cxx,v $ // Revision 1.1 2002/08/30 17:07:07 hagel // Initial revision // |
||||||
This page automatically generated by script docBrat by Christian Holm |
Copyright ; 2002 BRAHMS Collaboration
<brahmlib@rcf.rhic.bnl.gov>
|