LISummarySorter Class Reference

#include <LISummarySorter.h>

List of all members.

Public Member Functions

 LISummarySorter ()
 ~LISummarySorter ()
void AddEntry (RawChannelId channelid, Float_t mean, Float_t rms, Int_t numEntries)
void CloseFile (TFile *outfile)
void CountNumSummaries (Int_t num)
void GetElectronicsData (Int_t channel)
void GetMuxBoxInfo (PlexPinDiodeId plexPinDiodeId)
void GetMuxBoxInfo (PlexPixelSpotId plexPixelSpotId)
TFile * OpenFile (Int_t runNumber, Int_t runNumberSub, Int_t detectorType)
void OutputData ()
void PrintRecoSummary ()
void ReconstructStripEnd (Int_t channel)
Bool_t ReconstructPin (Int_t channel)
void ReconstructTrigPmt ()
void ResetTreeVariables ()
void SetDetector (VldContext vldC)
void SetRawDaqVldCtx (VldContext vldC)
void SetRunNumber (Int_t runNum)
void SetRunNumberSub (Short_t runNumSub)
void SetRunType (Short_t runT)
void SetPlexHandle (VldContext vldC)
Bool_t Update (Int_t led, Int_t pulseHeight, Int_t pulseWidth, Int_t pulserBox, Int_t calibPoint, VldTimeStamp time, Int_t calibType, Int_t pulses, Int_t period)
void WriteFile (TFile *outfile)

Private Member Functions

void InitialiseTree ()
void SetLIVariables (Int_t led, Int_t pulseHeight, Int_t pulseWidth, Int_t pulserBox, Int_t calibPoint, VldTimeStamp time, Int_t calibType, Int_t pulses, Int_t period)
string GetElecString () const
string GetElecString (RawChannelId rChId) const
void PrintBigMessage () const
void PrintBlockInfo (string preString) const

Private Attributes

Int_t ashtray
Int_t badHitCounter
Int_t calibPoint
Int_t calibType
Int_t cerenkovCounter
Int_t chAdd
Int_t channel
std::vector< LIChannelchannels
Int_t chip
Int_t commonModeCounter
Int_t correlatedHit
Int_t crate
std::map< Int_t, Int_t > crates
Int_t detectorType
Int_t eastWest
Int_t elecType
Int_t farLed
Int_t farPulserBox
string filename
Int_t first_time
Int_t inRack
Int_t geoAdd
Int_t goodHitCounter
Int_t led
std::map< Int_t, Int_t > leds
LILookup fLookup
Int_t fMasterCh
Float_t mean
Int_t fMinderCh
PlexHandleplexHandle
Int_t nearLed
Int_t nearPulserBox
Int_t numEntries
Int_t numericMuxBox
TTree * outtree
TFile * outputFile
Float_t fPe
Int_t period
Int_t pixel
Int_t pinCounter
std::map< Int_t, Int_t > pinCounterReco
Int_t pinGain
Int_t pinInBox
Int_t plane
std::map< Int_t, Int_t > plexOppPbCounter
std::map< Int_t, Int_t > plexPbCounter
Int_t pulseHeight
Int_t pulserBox
std::map< Int_t, Int_t > pulserBoxes
Int_t pulses
Int_t pulseWidth
Int_t rackBay
Int_t rackLevel
VldContext fRawDaqVldCtx
Int_t rawSummaryBlockCounter
Int_t rawSummaryCounter
Int_t readoutType
Int_t runNumber
Int_t runNumberSub
Int_t runType
Float_t rms
Int_t strip
Int_t stripCounter
Int_t fStripEnd
Int_t summaryCounter
VldTimeStamp time
Int_t timestamp
Int_t timestampNanoSec
Int_t timingFidCounter
Int_t tofCounter
Int_t triggerOrCounter
Int_t trigPmtCounter
Int_t unconnectedPixelCounter
Int_t unknownCounter
VldContext validity
Int_t varc
Int_t vfb
Int_t vmm

Detailed Description

Definition at line 35 of file LISummarySorter.h.


Constructor & Destructor Documentation

LISummarySorter::LISummarySorter (  ) 

Definition at line 36 of file LISummarySorter.cxx.

References ashtray, badHitCounter, calibPoint, calibType, cerenkovCounter, chAdd, channel, chip, commonModeCounter, correlatedHit, crate, detectorType, eastWest, elecType, farLed, farPulserBox, first_time, fMasterCh, fMinderCh, fPe, fStripEnd, geoAdd, goodHitCounter, inRack, Msg::kDebug, led, mean, MSG, nearLed, nearPulserBox, numEntries, numericMuxBox, outputFile, outtree, period, pinCounter, pinGain, pinInBox, pixel, plane, plexHandle, pulseHeight, pulserBox, pulses, pulseWidth, rackBay, rackLevel, rawSummaryBlockCounter, rawSummaryCounter, readoutType, rms, runNumber, runNumberSub, runType, strip, stripCounter, summaryCounter, timestamp, timestampNanoSec, timingFidCounter, tofCounter, triggerOrCounter, trigPmtCounter, unconnectedPixelCounter, unknownCounter, varc, vfb, and vmm.

00037 {
00038   MSG("LISummarySorter",Msg::kDebug) 
00039     <<"Running LISummarySorter Constructor..."<<endl;
00040 
00041   //initialise data members
00042   ashtray=-1;
00043   badHitCounter=0;
00044   calibPoint=-1;
00045   calibType=-1;
00046   cerenkovCounter=0;
00047   chAdd=-1;
00048   channel=-1;
00049   chip=-1;
00050   commonModeCounter=0;//readoutType counter
00051   correlatedHit=-1;
00052   crate=-1;
00053   detectorType=-1;
00054   eastWest=-1;//0 is east, 1 is west 
00055   elecType=-1;
00056   farLed=-1;
00057   farPulserBox=-1;
00058   first_time=0;
00059   inRack=-1;//determines mux box in rack 0-7
00060   geoAdd=-1;
00061   goodHitCounter=0;
00062   led=-1;
00063   fMasterCh=-1;
00064   mean=-1.;
00065   fMinderCh=-1;
00066   nearLed=-1;
00067   nearPulserBox=-1;
00068   numEntries=-1;
00069   numericMuxBox=-1;
00070   outtree=0;//set pointer to tree to zero
00071   outputFile=0;
00072   fPe=-1;
00073   period=-1;
00074   pixel=-1;
00075   pinCounter=0;
00076   pinGain=-1;//0 is low, 1 is high gain
00077   pinInBox=-1;//0 is low gain (VA=0), 1 is high gain (VA=1)
00078   plane=-1;
00079   plexHandle=0;
00080   pulseHeight=-1;
00081   pulserBox=-1;
00082   pulses=-1;
00083   pulseWidth=-1;
00084   rackBay=-1;//determines which rack 0-15
00085   rackLevel=-1;//0 is top, 1 is bottom
00086   rawSummaryBlockCounter=0;
00087   rawSummaryCounter=0;
00088   readoutType=-1;
00089   rms=-1.;
00090   runNumber=-1;
00091   runNumberSub=-1;
00092   runType=-1;
00093   strip=-1;
00094   stripCounter=0;
00095   fStripEnd=-1;
00096   summaryCounter=0;
00097   timestamp=-1;
00098   timestampNanoSec=-1;
00099   timingFidCounter=0;
00100   tofCounter=0;
00101   triggerOrCounter=0;
00102   trigPmtCounter=0;
00103   unconnectedPixelCounter=0;
00104   unknownCounter=0;
00105   varc=-1;
00106   vfb=-1;
00107   vmm=-1;
00108 
00109   MSG("LISummarySorter",Msg::kDebug) 
00110     <<"Finished LISummarySorter Constructor"<<endl;
00111 }

LISummarySorter::~LISummarySorter (  ) 

Definition at line 115 of file LISummarySorter.cxx.

References Msg::kDebug, MSG, and plexHandle.

00116 {
00117   MSG("LISummarySorter",Msg::kDebug) 
00118     <<"Running LISummarySorter destructor..."<<endl;
00119 
00120   //get rid of memory leak right at the end
00121   if (plexHandle) delete plexHandle;
00122 
00123   MSG("LISummarySorter",Msg::kDebug) 
00124     <<"Finished LISummarySorter destructor"<<endl;
00125 }


Member Function Documentation

void LISummarySorter::AddEntry ( RawChannelId  channelid,
Float_t  mean,
Float_t  rms,
Int_t  numEntries 
)

Definition at line 1336 of file LISummarySorter.cxx.

References bfld::AsString(), channels, fLookup, RawChannelId::GetChAdd(), RawChannelId::GetCrate(), GetElecString(), PlexHandle::GetReadoutType(), InitialiseTree(), Msg::kDebug, Msg::kInfo, ReadoutType::kTOF, ReadoutType::kTriggerOR, ReadoutType::kUnknown, Msg::kVerbose, Msg::kWarning, MAXMSG, MSG, LILookup::NUMCHADD, outtree, and plexHandle.

Referenced by LISummaryModule::GetPulserBlocks(), and LISummaryModule::GetSummaryBlocks().

01340 {
01341   //initialise the tree if the first time (also opens file)
01342   if (!outtree) this->InitialiseTree();
01343 
01344   Int_t ch=channelId.GetCrate()*fLookup.NUMCHADD+channelId.GetChAdd();
01345   
01346   MSG("LISummarySorterUltraVerbose",Msg::kVerbose) 
01347     <<"ch="<<ch<<", ChAdd="<<channelId.GetChAdd()<<endl;
01348 
01349   //set the channelId of the channel
01350   channels[ch].SetChannelId(channelId);
01351   
01352   //this is deliberately LIChannel type message
01353   MSG("LIChannel",Msg::kVerbose) 
01354     <<this->GetElecString(channels[ch].GetChannelId())<<endl;
01355 
01357   //do I really want to add zero channels????
01358   //maybe just add the channel once, so it appears in the tree?
01359   //probably just put everything in there!
01361 
01362   string msgPrefix="Used Summary w/ strange values ";
01363 
01364   //add the means and rms to the running total
01365   channels[ch].AddEntry(numEntries,mean,rms); 
01366 
01367   //do some sanity checking that there are no strange entries
01368   if (mean==0 || numEntries==0){
01369     //get the raw channel id to use below
01370     RawChannelId rChId=channels[ch].GetChannelId();
01371     
01372     //have to get the readout type since it wont have been set for the
01373     //first point
01374     if (plexHandle->GetReadoutType(channels[ch].GetChannelId())==
01375         ReadoutType::kTOF || 
01376         plexHandle->GetReadoutType(channels[ch].GetChannelId())==
01377         ReadoutType::kUnknown || 
01378         plexHandle->GetReadoutType(channels[ch].GetChannelId())==
01379         ReadoutType::kTriggerOR
01380         ){
01381 
01382       //these often have zero mean but finite num entries at caldet
01383       MAXMSG("LISanityCheck",Msg::kVerbose,50) 
01384         <<msgPrefix
01385         <<"numHits="<<numEntries
01386         <<", mean="<<static_cast<Int_t>(mean)
01387         <<", rms="<<static_cast<Int_t>(rms)
01388         <<", rt="<<ReadoutType::AsString(plexHandle->GetReadoutType
01389                                          (channels[ch].GetChannelId()))
01390         <<" "<<this->GetElecString(rChId)<<endl;
01391     }
01392     else{
01393       MAXMSG("LISanityCheck",Msg::kWarning,50) 
01394         <<msgPrefix
01395         <<"numHits="<<numEntries
01396         <<", mean="<<static_cast<Int_t>(mean)
01397         <<", rms="<<static_cast<Int_t>(rms)
01398         <<", rt="<<ReadoutType::AsString(plexHandle->GetReadoutType
01399                                          (channels[ch].GetChannelId()))
01400         <<" "<<this->GetElecString(rChId)<<endl;
01401     }
01402   }
01403   //check that there are no strange zero rms channels
01404   else if (rms==0){
01405     //get the raw channel id to use below
01406     RawChannelId rChId=channels[ch].GetChannelId();
01407     
01408     if (numEntries>=6){
01409       MAXMSG("LISanityCheck",Msg::kInfo,50) 
01410         <<msgPrefix
01411         <<"numHits="<<numEntries
01412         <<", adc="<<static_cast<Int_t>(mean)
01413         <<", rms="<<static_cast<Int_t>(rms)
01414         <<", rt="<<ReadoutType::AsString(plexHandle->GetReadoutType
01415                                          (channels[ch].GetChannelId()))
01416         <<" "<<this->GetElecString(rChId)<<endl;
01417     }
01418     else if (numEntries>=5){
01419       MAXMSG("LISanityCheck",Msg::kDebug,50) 
01420         <<msgPrefix
01421         <<"numHits="<<numEntries
01422         <<", mean="<<static_cast<Int_t>(mean)
01423         <<", rms="<<static_cast<Int_t>(rms)
01424         <<", rt="<<ReadoutType::AsString(plexHandle->GetReadoutType
01425                                          (channels[ch].GetChannelId()))
01426         <<" "<<this->GetElecString(rChId)<<endl;
01427     }
01428     else if (numEntries>=4){
01429       MAXMSG("LISanityCheck",Msg::kVerbose,50) 
01430         <<msgPrefix
01431         <<"numHits="<<numEntries
01432         <<", mean="<<static_cast<Int_t>(mean)
01433         <<", rms="<<static_cast<Int_t>(rms)
01434         <<", rt="<<ReadoutType::AsString(plexHandle->GetReadoutType
01435                                          (channels[ch].GetChannelId()))
01436         <<" "<<this->GetElecString(rChId)<<endl;
01437     }
01438   }
01439 }

void LISummarySorter::CloseFile ( TFile *  outfile  ) 

Definition at line 1603 of file LISummarySorter.cxx.

References Msg::kInfo, Msg::kWarning, and MSG.

Referenced by OutputData().

01604 {
01605   if (outfile){
01606     MSG("LISummarySorter",Msg::kInfo)<<"Closing output file..."<<endl;
01607     outfile->Close();
01608     MSG("LISummarySorter",Msg::kInfo)<<"Output file closed"<<endl;
01609   }
01610   else{
01611     MSG("LISummarySorter",Msg::kWarning)
01612       <<"Can't close file: outfile="<<outfile<<endl;
01613   }
01614 }

void LISummarySorter::CountNumSummaries ( Int_t  num  )  [inline]

Definition at line 47 of file LISummarySorter.h.

References rawSummaryCounter.

Referenced by LISummaryModule::GetSummaryBlocks().

00047 {rawSummaryCounter+=num;};

string LISummarySorter::GetElecString ( RawChannelId  rChId  )  const [private]

Definition at line 742 of file LISummarySorter.cxx.

References bfld::AsString(), Form(), RawChannelId::GetCrate(), RawChannelId::GetElecType(), RawChannelId::GetGeographicAddress(), RawChannelId::GetMasterChannel(), RawChannelId::GetMinderChannel(), RawChannelId::GetVaAdcSel(), RawChannelId::GetVaChannel(), RawChannelId::GetVaChip(), RawChannelId::GetVarcId(), RawChannelId::GetVmm(), ElecType::kQIE, ElecType::kVA, Msg::kVerbose, and MSG.

00743 {
00744   MSG("LISummarySorter",Msg::kVerbose) 
00745     <<"Running GetElecString method..."<<endl;
00746 
00747   string elecString="";
00748   string sCrate=Form("%d",rChId.GetCrate());
00749   string sElecType=ElecType::AsString(rChId.GetElecType());
00750 
00751   if (rChId.GetElecType()==ElecType::kVA){
00752     string sVarc=Form("%d",rChId.GetVarcId());
00753     string sVmm=Form("%d",rChId.GetVmm());
00754     string sVfb=Form("%d",rChId.GetVaAdcSel());
00755     string sChip=Form("%d",rChId.GetVaChip());
00756     string sChannel=Form("%d",rChId.GetVaChannel());
00757 
00758     elecString=sElecType+
00759       "("+sCrate+","+sVarc+","+sVmm+","+sVfb+","+sChip+","+sChannel+")";
00760   }     
00761   else if (rChId.GetElecType()==ElecType::kQIE){
00762     string sGeoAdd=Form("%d",rChId.GetGeographicAddress());
00763     string sMasterCh=Form("%d",rChId.GetMasterChannel());
00764     string sMinderCh=Form("%d",rChId.GetMinderChannel());
00765         
00766     elecString=sElecType+
00767       "("+sCrate+","+sGeoAdd+","+sMasterCh+","+sMinderCh+")";
00768   }
00769   return elecString;
00770 }

string LISummarySorter::GetElecString (  )  const [private]

Definition at line 709 of file LISummarySorter.cxx.

References channel, chip, crate, elecType, fMasterCh, fMinderCh, Form(), geoAdd, ElecType::kQIE, ElecType::kVA, Msg::kVerbose, MSG, varc, vfb, and vmm.

Referenced by AddEntry(), ReconstructPin(), ReconstructStripEnd(), and Update().

00710 {
00711   MSG("LISummarySorter",Msg::kVerbose) 
00712     <<"Running GetElecString method..."<<endl;
00713 
00714   string elecString="";
00715   string sCrate=Form("%d",crate);
00716 
00717   if (elecType==ElecType::kVA){
00718     string sVarc=Form("%d",varc);
00719     string sVmm=Form("%d",vmm);
00720     string sVfb=Form("%d",vfb);
00721     string sChip=Form("%d",chip);
00722     string sChannel=Form("%d",channel);
00723     string sElecType="VA";
00724     
00725     elecString=sElecType+
00726       "("+sCrate+","+sVarc+","+sVmm+","+sVfb+","+sChip+","+sChannel+")";
00727   }     
00728   else if (elecType==ElecType::kQIE){
00729     string sGeoAdd=Form("%d",geoAdd);
00730     string sMasterCh=Form("%d",fMasterCh);
00731     string sMinderCh=Form("%d",fMinderCh);
00732     string sElecType="QIE";
00733     
00734     elecString=sElecType+
00735       "("+sCrate+","+sGeoAdd+","+sMasterCh+","+sMinderCh+")";
00736   }
00737   return elecString;
00738 }

void LISummarySorter::GetElectronicsData ( Int_t  channel  ) 

Definition at line 774 of file LISummarySorter.cxx.

References chAdd, channel, channels, chip, crate, elecType, fMasterCh, fMinderCh, geoAdd, RawChannelId::GetChAdd(), RawChannelId::GetCrate(), RawChannelId::GetElecType(), RawChannelId::GetGeographicAddress(), RawChannelId::GetMasterChannel(), RawChannelId::GetMinderChannel(), VldTimeStamp::GetNanoSec(), VldTimeStamp::GetSec(), RawChannelId::GetVaAdcSel(), RawChannelId::GetVaChannel(), RawChannelId::GetVaChip(), RawChannelId::GetVarcId(), RawChannelId::GetVmm(), mean, numEntries, rms, summaryCounter, time, timestamp, timestampNanoSec, varc, vfb, and vmm.

Referenced by Update().

00775 {
00776   //get the raw channel id to use below
00777   RawChannelId rChId=channels[ch].GetChannelId();
00778 
00779   //get generic electronics stuff
00780   elecType=rChId.GetElecType();
00781   crate=rChId.GetCrate();
00782 
00783   //fardet stuff
00784   chAdd=rChId.GetChAdd();
00785   varc=rChId.GetVarcId();
00786   vmm=rChId.GetVmm();
00787   vfb=rChId.GetVaAdcSel();
00788   chip=rChId.GetVaChip();
00789   channel=rChId.GetVaChannel();  
00790 
00791   //neardet stuff
00792   fMasterCh=rChId.GetMasterChannel();
00793   fMinderCh=rChId.GetMinderChannel();
00794   geoAdd=rChId.GetGeographicAddress();
00795 
00796   //not strictly electronics!
00797   timestamp=static_cast<Int_t>(time.GetSec());
00798   timestampNanoSec=time.GetNanoSec();
00799   mean=channels[ch].GetMean();
00800   rms=channels[ch].GetRms();
00801   numEntries=channels[ch].GetNumEntries();
00802   summaryCounter=channels[ch].GetSummaryCounter();
00803 }

void LISummarySorter::GetMuxBoxInfo ( PlexPixelSpotId  plexPixelSpotId  ) 

Definition at line 1290 of file LISummarySorter.cxx.

References PlexPixelSpotId::AsString(), LILookup::ConvertEastWest(), LILookup::ConvertRackLevel(), eastWest, fLookup, PlexMuxBoxId::GetEastWest(), PlexMuxBoxId::GetInRack(), PlexMuxBoxId::GetNumericMuxBox(), PlexMuxBoxId::GetRackBay(), PlexMuxBoxId::GetRackLevel(), inRack, Msg::kVerbose, Msg::kWarning, MSG, numericMuxBox, rackBay, and rackLevel.

01291 {
01292   MSG("LISummarySorter",Msg::kVerbose) 
01293     <<"Getting mux box info..."<<endl;
01294 
01295     rackBay=static_cast<Int_t>(plexPixelSpotId.GetRackBay());
01296     inRack=static_cast<Int_t>(plexPixelSpotId.GetInRack());
01297     numericMuxBox=static_cast<Int_t>
01298       (plexPixelSpotId.GetNumericMuxBox());
01299     const Char_t eastWestChar=plexPixelSpotId.GetEastWest();
01300     const Char_t rackLevelChar=plexPixelSpotId.GetRackLevel();
01301     string sEastWest=static_cast<string>(&eastWestChar);
01302     sEastWest=sEastWest[0];//sometimes has two characters
01303     string sRackLevel=static_cast<string>(&rackLevelChar);
01304     sRackLevel=sRackLevel[0];
01305     
01306     //translate eastwest string to an integer
01307     eastWest=fLookup.ConvertEastWest(sEastWest);
01308     if (eastWest==-1) {
01309       MSG("LISummarySorter",Msg::kWarning) 
01310         <<"plexPixelSpotId="<<plexPixelSpotId.AsString()
01311         <<", eastWest="<<sEastWest
01312         <<", length="<<sEastWest.size()
01313         <<", 1st="<<sEastWest[0]
01314         <<", 2nd="<<sEastWest[1]
01315         << endl;
01316     }
01317               
01318     //translate rackLevel string to an integer
01319     rackLevel=fLookup.ConvertRackLevel(sRackLevel);
01320     if (rackLevel==-1){
01321       MSG("LISummarySorter",Msg::kWarning) 
01322         <<"plexPixelSpotId="<<plexPixelSpotId.AsString()
01323         <<", rackLevel="<<sRackLevel 
01324         <<",size="<<sRackLevel.size()
01325         <<",1s="<<sRackLevel[0]
01326         <<",2s="<<sRackLevel[1]
01327         << endl;
01328     }      
01329 
01330   MSG("LISummarySorter",Msg::kVerbose)
01331     <<"Finished getting mux box info"<<endl;
01332 }

void LISummarySorter::GetMuxBoxInfo ( PlexPinDiodeId  plexPinDiodeId  ) 

Definition at line 1244 of file LISummarySorter.cxx.

References PlexPinDiodeId::AsString(), LILookup::ConvertEastWest(), LILookup::ConvertRackLevel(), eastWest, fLookup, PlexMuxBoxId::GetEastWest(), PlexMuxBoxId::GetInRack(), PlexMuxBoxId::GetNumericMuxBox(), PlexMuxBoxId::GetRackBay(), PlexMuxBoxId::GetRackLevel(), inRack, Msg::kVerbose, Msg::kWarning, MSG, numericMuxBox, rackBay, and rackLevel.

Referenced by ReconstructPin(), and ReconstructStripEnd().

01245 {
01246   MSG("LISummarySorter",Msg::kVerbose) 
01247     <<"Getting mux box info..."<<endl;
01248 
01249     rackBay=static_cast<Int_t>(plexPinDiodeId.GetRackBay());
01250     inRack=static_cast<Int_t>(plexPinDiodeId.GetInRack());
01251     numericMuxBox=static_cast<Int_t>
01252       (plexPinDiodeId.GetNumericMuxBox());
01253     const Char_t eastWestChar=plexPinDiodeId.GetEastWest();
01254     const Char_t rackLevelChar=plexPinDiodeId.GetRackLevel();
01255     string sEastWest=static_cast<string>(&eastWestChar);
01256     sEastWest=sEastWest[0];//sometimes has two characters
01257     string sRackLevel=static_cast<string>(&rackLevelChar);
01258     sRackLevel=sRackLevel[0];
01259     
01260     //translate eastWest string to an integer
01261     eastWest=fLookup.ConvertEastWest(sEastWest);
01262     if (eastWest==-1) {
01263       MSG("LISummarySorter",Msg::kWarning) 
01264         << "plexPinDiodeId="<<plexPinDiodeId.AsString()
01265         << ", eastWest="<<sEastWest
01266         << ", length="<<sEastWest.size()
01267         << ", 1st="<<sEastWest[0]
01268         << ", 2nd="<<sEastWest[1]
01269         << endl;
01270     }
01271          
01272     //translate rackLevel string to an integer
01273     rackLevel=fLookup.ConvertRackLevel(sRackLevel);
01274     if (rackLevel==-1){
01275       MSG("LISummarySorter",Msg::kWarning) 
01276         << "plexPinDiodeId="<<plexPinDiodeId.AsString()
01277         << ", rackLevel="<<sRackLevel 
01278         << ", length="<<sRackLevel.size()
01279         << ", 1st="<<sRackLevel[0]
01280         << ", 2nd="<<sRackLevel[1]
01281         << endl;
01282     }      
01283 
01284   MSG("LISummarySorter",Msg::kVerbose)
01285     <<"Finished getting mux box info"<<endl;
01286 }

void LISummarySorter::InitialiseTree (  )  [private]

Definition at line 1443 of file LISummarySorter.cxx.

References ashtray, calibPoint, calibType, chAdd, channel, chip, correlatedHit, crate, detectorType, eastWest, elecType, farLed, farPulserBox, fMasterCh, fMinderCh, fPe, fStripEnd, geoAdd, inRack, led, mean, nearLed, nearPulserBox, numEntries, numericMuxBox, OpenFile(), outputFile, outtree, period, pinGain, pinInBox, pixel, plane, pulseHeight, pulserBox, pulses, pulseWidth, rackBay, rackLevel, readoutType, rms, runNumber, runNumberSub, runType, strip, summaryCounter, timestamp, varc, vfb, and vmm.

Referenced by AddEntry().

01444 {
01445   //open the file, doing this before the tree is created 
01446   //ensures tree is written to disk as it is created
01447   outputFile=this->OpenFile(runNumber,runNumberSub,detectorType);
01448 
01449   outtree = new TTree("li_tree","li_tree");
01450   
01451   //set tree branches  
01452   outtree->Branch("ashtray",&ashtray,"ashtray/I",32000);
01453   outtree->Branch("calibPoint",&calibPoint,"calibPoint/I",32000);
01454   outtree->Branch("calibType",&calibType,"calibType/I",32000);
01455   outtree->Branch("chAdd",&chAdd,"chAdd/I",32000);
01456   outtree->Branch("channel",&channel,"channel/I",32000);
01457   //
01458   outtree->Branch("chip",&chip,"chip/I",32000);
01459   outtree->Branch("correlatedHit",&correlatedHit,
01460                   "correlatedHit/I",32000);
01461   outtree->Branch("crate",&crate,"crate/I",32000);
01462   outtree->Branch("detectorType",&detectorType,"detectorType/I",32000); 
01463   outtree->Branch("eastWest",&eastWest,"eastWest/I",32000);
01464   //  
01465   outtree->Branch("elecType",&elecType,"elecType/I",32000);
01466   outtree->Branch("farLed",&farLed,"farLed/I",32000);
01467   outtree->Branch("farPulserBox",&farPulserBox,"farPulserBox/I",32000);
01468   outtree->Branch("geoAdd",&geoAdd,"geoAdd/I",32000);
01469   outtree->Branch("inRack",&inRack,"inRack/I",32000);
01470   //
01471   outtree->Branch("led",&led,"led/I",32000);
01472   outtree->Branch("masterCh",&fMasterCh,"masterCh/I",32000);
01473   outtree->Branch("mean",&mean,"mean/F",32000);
01474   outtree->Branch("minderCh",&fMinderCh,"minderCh/I",32000);
01475   outtree->Branch("nearLed",&nearLed,"nearLed/I",32000);
01476   //
01477   outtree->Branch("nearPulserBox",&nearPulserBox,
01478                   "nearPulserBox/I",32000);
01479   outtree->Branch("numEntries",&numEntries,"numEntries/I",32000);
01480   outtree->Branch("numericMuxBox",&numericMuxBox,
01481                   "numericMuxBox/I",32000);
01482   outtree->Branch("pe",&fPe,"pe/I",32000);
01483 
01484   outtree->Branch("period",&period,"period/I",32000);
01485   //
01486   outtree->Branch("pinGain",&pinGain,"pinGain/I",32000);
01487   outtree->Branch("pinInBox",&pinInBox,"pinInBox/I",32000);
01488   outtree->Branch("pixel",&pixel,"pixel/I",32000);
01489   outtree->Branch("plane",&plane,"plane/I",32000);
01490   outtree->Branch("pulseHeight",&pulseHeight,"pulseHeight/I",32000);
01491   //
01492   outtree->Branch("pulserBox",&pulserBox,"pulserBox/I",32000); 
01493   outtree->Branch("pulses",&pulses,"pulses/I",32000);
01494   outtree->Branch("pulseWidth",&pulseWidth,"pulseWidth/I",32000);
01495   outtree->Branch("rackBay",&rackBay,"rackBay/I",32000);
01496   outtree->Branch("rackLevel",&rackLevel,"rackLevel/I",32000);
01497   //
01498   outtree->Branch("readoutType",&readoutType,"readoutType/I",32000);
01499   outtree->Branch("rms",&rms,"rms/F",32000);
01500   outtree->Branch("runNumber",&runNumber,"runNumber/I",32000);
01501   outtree->Branch("runNumberSub",&runNumberSub,"runNumberSub/I",32000);
01502   outtree->Branch("runType",&runType,"runType/I",32000);
01503   //
01504   outtree->Branch("strip",&strip,"strip/I",32000);
01505   outtree->Branch("stripEnd",&fStripEnd,"stripEnd/I",32000);
01506   outtree->Branch("summaryCounter",&summaryCounter,
01507                   "summaryCounter/I",32000);
01508   outtree->Branch("timestamp",&timestamp,"timestamp/I",32000);
01509   outtree->Branch("varc",&varc,"varc/I",32000);
01510   //
01511   outtree->Branch("vfb",&vfb,"vfb/I",32000);
01512   outtree->Branch("vmm",&vmm,"vmm/I",32000);//this is branch number 47 
01513 }

TFile * LISummarySorter::OpenFile ( Int_t  runNumber,
Int_t  runNumberSub,
Int_t  detectorType 
)

Definition at line 1517 of file LISummarySorter.cxx.

References Form(), Detector::kCalDet, Detector::kFar, Msg::kInfo, Detector::kNear, MSG, and outputFile.

Referenced by InitialiseTree().

01519 {
01520   TFile *outputFile=0;
01521 
01522   string sRunNumber=Form("%d",runNumber);
01523   string sRunNumberSub=Form("%d",runNumberSub);
01524   string sDetector="";
01525   if (detectorType==static_cast<Int_t>(Detector::kFar)){
01526     sDetector="F";
01527   }
01528   else if (detectorType==static_cast<Int_t>(Detector::kNear)){
01529     sDetector="N"; 
01530   }
01531   else if (detectorType==static_cast<Int_t>(Detector::kCalDet)){
01532     sDetector="C"; 
01533   }
01534   else{
01535     sDetector="TypeNotKnown"; 
01536   }
01537   string sZeros="";
01538   string sZeros2="";
01539 
01540   if (runNumber>=0 && runNumber<10) sZeros="00000000";
01541   else if (runNumber>=10 && runNumber<100) sZeros="000000";
01542   else if (runNumber>=100 && runNumber<1000) sZeros="00000";
01543   else if (runNumber>=1000 && runNumber<10000) sZeros="0000";
01544   else if (runNumber>=10000 && runNumber<100000) sZeros="000";
01545   else if (runNumber>=100000 && runNumber<1000000) sZeros="00";
01546   else if (runNumber>=1000000 && runNumber<10000000) sZeros="0";
01547   else if (runNumber>=10000000 && runNumber<100000000) sZeros="";
01548 
01549   if (runNumberSub>=0 && runNumberSub<10) sZeros2="000";
01550   else if (runNumberSub>=10 && runNumberSub<100) sZeros2="00";
01551   else if (runNumberSub>=100 && runNumberSub<1000) sZeros2="0";
01552   else if (runNumberSub>=1000 && runNumberSub<10000) sZeros2="";
01553 
01554   string sFileName="LIData"+sDetector+sZeros+sRunNumber+"_"+
01555     sZeros2+sRunNumberSub+".root";
01556 
01557   //test if file already exists
01558   ifstream Test(sFileName.c_str());
01559 
01560   if(!Test){
01561     outputFile= new TFile(sFileName.c_str(),"NEW");
01562   }
01563   else {
01564     //Need new filename
01565     Int_t fred=1;
01566     while(Test) {
01567       Test.close();
01568       string sAppendage=Form("%d",fred);
01569       sFileName="LIData"+sDetector+sZeros+sRunNumber+"_"+
01570         sZeros2+sRunNumberSub+"_"+sAppendage+".root";
01571       Test.open(sFileName.c_str());
01572       fred++;
01573     }
01574     outputFile = new TFile(sFileName.c_str(),"NEW");
01575     outputFile->SetCompressionLevel(9);
01576   }
01577   MSG("LISummarySorter",Msg::kInfo) 
01578     <<" ** Output file opened: "<<sFileName<<" ** "<<endl;
01579   return outputFile;
01580 }

void LISummarySorter::OutputData (  ) 

Definition at line 280 of file LISummarySorter.cxx.

References CloseFile(), Msg::kVerbose, MSG, outputFile, and WriteFile().

Referenced by LISummaryModule::EndJob().

00281 {
00282   MSG("LISummarySorter",Msg::kVerbose)
00283     <<"Running OutputData method..."<<endl;
00284 
00285   this->WriteFile(outputFile);
00286   this->CloseFile(outputFile);  
00287 
00288   MSG("LISummarySorter",Msg::kVerbose) 
00289     <<"OutputData method finished"<<endl;
00290 }

void LISummarySorter::PrintBigMessage (  )  const [private]

Definition at line 685 of file LISummarySorter.cxx.

References channel, chip, correlatedHit, crate, eastWest, elecType, fMasterCh, fMinderCh, geoAdd, Msg::kInfo, ElecType::kQIE, ElecType::kVA, led, mean, MSG, numEntries, plane, pulserBox, readoutType, rms, strip, varc, vfb, and vmm.

Referenced by ReconstructTrigPmt().

00686 { 
00687   MSG("LISummarySorter",Msg::kInfo) 
00688     <<"("<<pulserBox<<":"<<led<<")";
00689     
00690   if (elecType==ElecType::kVA){
00691     MSG("LISummarySorter",Msg::kInfo) 
00692       <<"VA("<<crate<<","<<varc<<","<<vmm<<","<<vfb
00693       <<","<<chip<<","<<channel<<")";
00694   }
00695   else if (elecType==ElecType::kQIE){
00696     MSG("LISummarySorter",Msg::kInfo) 
00697       <<"QIE("<<crate<<","<<geoAdd<<","<<fMasterCh<<","<<fMinderCh<<")";
00698   }
00699   
00700   MSG("LISummarySorter",Msg::kInfo) 
00701     <<", (m,r,n)=("<<mean<<","<<rms
00702     <<","<<numEntries<<"), cHit="<<correlatedHit
00703     <<", e/w="<<eastWest<<", rt="<<readoutType
00704     <<" (Pl;St)=("<<plane<<";"<<strip<<")"<<endl;
00705 }

void LISummarySorter::PrintBlockInfo ( string  preString  )  const [private]

Definition at line 294 of file LISummarySorter.cxx.

References calibPoint, calibType, MuELoss::e, Form(), VldTimeStamp::GetSec(), Msg::kInfo, Msg::kVerbose, Msg::kWarning, led, MSG, period, pulseHeight, pulserBox, pulses, pulseWidth, and time.

Referenced by Update().

00295 {
00296   MSG("LISummarySorter",Msg::kVerbose)<<"PrintBlockInfo..."<<endl;
00297 
00298   if (time.GetSec()<1000){
00299     static Int_t numberMsg=0;
00300     if (numberMsg<10){
00301       MSG("LISummarySorter",Msg::kWarning) 
00302         <<"Number of seconds="<<time.GetSec()<<endl;
00303       if (numberMsg==9){
00304         MSG("LISummarySorter",Msg::kWarning) 
00305           <<endl
00306           <<"This is the last message of this type to be printed"
00307           <<endl;
00308       }
00309     }
00310     numberMsg++;
00311   }
00312   
00313   TDatime datime;
00314   datime.Set(time.GetSec());
00315   
00316   //play around with the formatting a little
00317   string sHour=Form("%d",datime.GetHour());
00318   string sMinute=Form("%d",datime.GetMinute());
00319   string sSecond=Form("%d",datime.GetSecond());
00320   string sMonth=Form("%d",datime.GetMonth());
00321   string sDay=Form("%d",datime.GetDay());
00322   if (datime.GetHour()<10) sHour="0"+sHour;
00323   if (datime.GetMinute()<10) sMinute="0"+sMinute;
00324   if (datime.GetSecond()<10) sSecond="0"+sSecond;
00325   if (datime.GetMonth()<10) sMonth="0"+sMonth;
00326   if (datime.GetDay()<10) sDay="0"+sDay;
00327 
00328   //protect from fpe
00329   Double_t pulseFreq=-1;
00330   if (period!=0) pulseFreq=ceil(1.0/(period*1.0e-5));
00331   string sPulseFreq=Form("%d",static_cast<Int_t>(pulseFreq));
00332   string sPeriod=Form("%d",static_cast<Int_t>(period));
00333   if (pulseFreq<0) sPulseFreq="??? (period="+sPeriod+")";
00334 
00335   MSG("LISummarySorter",Msg::kInfo) 
00336     <<preString 
00337     <<"PB="<<pulserBox 
00338     <<" Led="<<led
00339     <<" CP="<<calibPoint
00340     <<"/"<<calibType
00341     <<" PH="<<pulseHeight
00342     <<" PW="<<pulseWidth
00343     <<" PF="<<sPulseFreq
00344     <<" PN="<<pulses
00345     <<" at "<<sHour
00346     <<":"<<sMinute
00347     <<":"<<sSecond
00348     <<" on "<<datime.GetYear()
00349     <<"/"<<sMonth
00350     <<"/"<<sDay
00351     <<endl;
00352 
00353   MSG("LISummarySorter",Msg::kVerbose) 
00354     <<"PrintBlockInfo method finished"<<endl;
00355 }

void LISummarySorter::PrintRecoSummary (  ) 

Definition at line 129 of file LISummarySorter.cxx.

References badHitCounter, cerenkovCounter, commonModeCounter, crates, detectorType, fLookup, goodHitCounter, Msg::kInfo, Msg::kVerbose, leds, MSG, LILookup::NUMCRATES, LILookup::NUMLEDS, LILookup::NUMPULSERBOXES, pinCounter, pinCounterReco, plexOppPbCounter, plexPbCounter, pulserBoxes, rawSummaryBlockCounter, rawSummaryCounter, runNumber, runNumberSub, stripCounter, timingFidCounter, tofCounter, triggerOrCounter, trigPmtCounter, unconnectedPixelCounter, and unknownCounter.

Referenced by LISummaryModule::EndJob().

00130 {
00131   MSG("LISummarySorter",Msg::kVerbose)
00132     <<"Running PrintRecoSummary method..."<<endl;
00133 
00134   //print out summary of reconstruction information
00135   if (runNumber!=-1 && runNumberSub!=-1 && detectorType!=-1){
00136     Int_t totalHits=0;
00137     totalHits=
00138       unconnectedPixelCounter+
00139       unknownCounter+
00140       stripCounter+
00141       pinCounter+
00142       trigPmtCounter+
00143       commonModeCounter+
00144       triggerOrCounter+
00145       cerenkovCounter+
00146       tofCounter+
00147       timingFidCounter;
00148     
00149     MSG("LISummarySorter",Msg::kInfo) 
00150       <<endl 
00151       <<" ** Job Summary Information: **"<<endl
00152       <<"  Readout types processed:"<<endl
00153       <<"    kUnknown="<<unknownCounter<<endl      
00154       <<"    kScintStrip="<<stripCounter<<endl
00155       <<"    kUnconnectedPixel="<<unconnectedPixelCounter<<endl
00156       <<"    kPinDiode="<<pinCounter<<endl
00157       <<"    kFlashTrigPMT="<<trigPmtCounter<<endl
00158       <<"    kVACommonMode="<<commonModeCounter<<endl
00159       <<"    kTriggerOR="<<triggerOrCounter<<endl
00160       <<"    kCerenkov="<<cerenkovCounter<<endl
00161       <<"    kTOF="<<tofCounter<<endl
00162       <<"    kTimingFid="<<timingFidCounter<<endl
00163       <<"    Total hits="<<totalHits<<endl;
00164     
00165     if (totalHits!=0){
00166 
00167       MSG("LISummarySorter",Msg::kInfo) 
00168         <<endl
00169         <<"  Scintillator hits that were attributed to an LI pulse:" 
00170         <<endl
00171         <<"    Successful="<<goodHitCounter<<endl
00172         <<"    Failures="<<badHitCounter<<endl
00173         <<"    Sum of above=" 
00174         <<badHitCounter+goodHitCounter<<endl;
00175     
00176       //number of entries found for each pulser box
00177       totalHits=0;
00178       MSG("LISummarySorter",Msg::kInfo) 
00179         <<endl 
00180         <<"  Number of hits when a given pulser box was flashing:"<<endl;
00181       for (Int_t i=0;i<fLookup.NUMPULSERBOXES;i++){
00182         MSG("LISummarySorter",Msg::kInfo) 
00183           <<"    Pulser Box "<<i<<"=" 
00184           <<pulserBoxes[i]<<endl;
00185         totalHits+=pulserBoxes[i];
00186       }
00187       MSG("LISummarySorter",Msg::kInfo) 
00188         <<"    Total hits ="<<totalHits<<endl;
00189     
00190       //Plex results for pulser boxes
00191       totalHits=0;
00192       MSG("LISummarySorter",Msg::kInfo) 
00193         <<endl
00194         <<"  Plex results for pulser boxes:" 
00195         <<endl;
00196       for (Int_t i=0;i<fLookup.NUMPULSERBOXES;i++){
00197         MSG("LISummarySorter",Msg::kInfo) 
00198           <<"    Pulser Box "<<i<<"=" 
00199           <<plexPbCounter[i] 
00200           <<"    Opposite Pulser Box "<<i<<"=" 
00201           <<plexOppPbCounter[i] 
00202           <<endl;
00203         totalHits+=plexPbCounter[i];
00204       }
00205       MSG("LISummarySorter",Msg::kInfo) 
00206         <<"    Total hits ="<<totalHits<<endl;
00207     
00208       //number of entries found for each crate using plex
00209       totalHits=0;
00210       MSG("LISummarySorter",Msg::kInfo) 
00211         <<endl 
00212         <<"  Plex results for crates:"<<endl;
00213       for (Int_t i=0;i<fLookup.NUMCRATES;i++){
00214         MSG("LISummarySorter",Msg::kInfo) 
00215           <<"    Crate "<<i<<"=" 
00216           <<crates[i]<<endl;
00217         totalHits+=crates[i];
00218       }
00219       MSG("LISummarySorter",Msg::kInfo) 
00220         <<"  Total hits ="<<totalHits<<endl;
00221     
00222       //number of entries found for each led
00223       totalHits=0;
00224       MSG("LISummarySorter",Msg::kInfo) 
00225         <<endl<<"  Number of hits when a given led was flashing:"<<endl;
00226       for (Int_t i=0;i<fLookup.NUMLEDS;i++){
00227         MSG("LISummarySorter",Msg::kInfo) 
00228           <<"    led "<<i+1<<" = "<<leds[i]<<endl;
00229         totalHits+=leds[i];
00230       }
00231       MSG("LISummarySorter",Msg::kInfo) 
00232         <<"    Total hits = "<<totalHits<<endl;
00233 
00234       //number of reconstructed pins
00235       totalHits=0;
00236       MSG("LISummarySorter",Msg::kInfo) 
00237         <<endl<<"  Number of pins reconstructed:"<<endl;
00238       for (Int_t i=0;i<fLookup.NUMLEDS;i++){
00239         MSG("LISummarySorter",Msg::kInfo) 
00240           <<"    led "<<i+1<<" = "<<pinCounterReco[i]<<endl;
00241         totalHits+=pinCounterReco[i];
00242       }
00243 
00244       //change this bit for fpe problem
00245       MSG("LISummarySorter",Msg::kInfo) 
00246         <<"    Total reconstructed pins = "<<totalHits<<" of "
00247         <<pinCounter;
00248       if (pinCounter>0){
00249         MSG("LISummarySorter",Msg::kInfo) 
00250           <<" ("<<100.*totalHits/pinCounter<<"%)"<<endl;
00251       }
00252       else MSG("LISummarySorter",Msg::kInfo)<<endl;
00253 
00254       //number of summary blocks and summaries in those blocks    
00255       MSG("LISummarySorter",Msg::kInfo)  
00256         <<endl<<" Number of raw LI summary blocks found = "
00257         <<rawSummaryBlockCounter<<endl;     
00258       MSG("LISummarySorter",Msg::kInfo)   
00259         <<" Total number of raw LI summaries in above blocks = " 
00260         <<rawSummaryCounter<<endl; 
00261       MSG("LISummarySorter",Msg::kInfo)    
00262         <<" Average number of summaries per block = "  
00263         <<rawSummaryCounter/rawSummaryBlockCounter<<endl;  
00264     }//end of if totalHits
00265 
00266     MSG("LISummarySorter",Msg::kInfo) 
00267       <<endl<<" ** End of Job Summary Information: ** "<<endl; 
00268   }
00269   else {
00270     MSG("LISummarySorter",Msg::kInfo) 
00271       <<" ** No LI stream found in this file **"<<endl<<endl;
00272   }
00273 
00274   MSG("LISummarySorter",Msg::kVerbose) 
00275     <<"OutputData PrintRecoSummary finished"<<endl;
00276 }

Bool_t LISummarySorter::ReconstructPin ( Int_t  channel  ) 

return true when pin is reconstructed return false when reconstruction fails for whatever reason

Definition at line 1067 of file LISummarySorter.cxx.

References PlexPinDiodeId::AsString(), PlexLedId::AsString(), channels, correlatedHit, detectorType, farLed, farPulserBox, fLookup, GetElecString(), PlexPinDiodeId::GetGain(), PlexPinDiodeId::GetInBox(), PlexHandle::GetLedId(), PlexLedId::GetLedInBox(), GetMuxBoxInfo(), LILookup::GetOppPb(), LILookup::GetPinDiodePlanes(), PlexLedId::GetPulserBox(), PlexHandle::GetRawChannelId(), PlexLedId::IsValid(), PlexPinDiodeId::IsValid(), Detector::kCalDet, Detector::kFar, Msg::kFatal, Detector::kNear, Msg::kVerbose, Msg::kWarning, LILookup::LASTLED, led, mean, MSG, nearLed, nearPulserBox, pinCounterReco, pinGain, pinInBox, plane, plexHandle, and pulserBox.

Referenced by Update().

01068 {
01071 
01072   MSG("LISummarySorter",Msg::kVerbose) 
01073     <<"Reconstructing Pin..."<<endl;
01074 
01075   PlexPinDiodeId plexPinDiodeId=plexHandle->
01076     GetPinDiodeId(channels[ch].GetChannelId());
01077 
01078   //check if pin diode id is valid          
01079   if (!plexPinDiodeId.IsValid()){
01080     MSG("LISummarySorter",Msg::kWarning)
01081       <<"PIN diode id not valid"
01082       <<", LED="<<led<<", PB="<<pulserBox<<", pl="<<plane
01083       <<", mean="<<mean<<endl;    
01084     MSG("LISummarySorter",Msg::kVerbose) 
01085       <<"ReconstructPin method finished"<<endl;
01086     return false;
01087   }
01088 
01089   //get led id associated with actual pin diode hit
01090   PlexLedId plexLedId=plexHandle->GetLedId(plexPinDiodeId);
01091 
01092   //check if led id associated with pin is valid
01093   if (!plexLedId.IsValid()){
01094     MSG("LISummarySorter",Msg::kVerbose)
01095       <<"LedId obtained from pin not valid = "<<plexLedId.AsString()
01096       <<" "<<this->GetElecString()<<endl;
01097     MSG("LISummarySorter",Msg::kVerbose) 
01098       <<"ReconstructPin method finished"<<endl;
01099     return false;
01100   }
01101   
01102   //set nearLed to be the led that the plex associates with the pin
01103   nearLed=plexLedId.GetLedInBox();
01104   farLed=-1;// there is no far led for a pin!
01105   //get pulserbox info
01106   nearPulserBox=plexLedId.GetPulserBox();
01107   //there is no far pulser box associated with a pin diode 
01108   //but get it anyway since it is just the opposite one
01109   farPulserBox=fLookup.GetOppPb(pulserBox,detectorType);
01110   
01111   //quick sanity check
01112   if ((nearLed<fLookup.FIRSTLED || nearLed>fLookup.LASTLED) && 
01113       detectorType==Detector::kFar){
01114     MSG("LISummarySorter",Msg::kWarning)
01115       <<"Strange values for led = "<<nearLed
01116       <<" "<<this->GetElecString()<<endl;
01117   }
01118   
01119   pinInBox=plexPinDiodeId.GetInBox();
01120   pinGain=plexPinDiodeId.GetGain();
01121   
01122   MSG("LISummarySorter",Msg::kVerbose)  
01123     <<"plexPinDiodeId="<<plexPinDiodeId.AsString() 
01124     <<", inBox="<<pinInBox 
01125     <<", pinGain="<<pinGain<<endl;
01126   
01127   //set all the mux box variables
01128   this->GetMuxBoxInfo(plexPinDiodeId);
01129   
01130   //generate a plex led id to then get the two possible pins
01131   PlexLedId ledId;
01132   if (detectorType==Detector::kFar){
01133     ledId=PlexLedId(Detector::kFar,pulserBox,led); 
01134   }
01135   else if (detectorType==Detector::kNear){
01136     ledId=PlexLedId(Detector::kNear,pulserBox,led); 
01137   }
01138   else if (detectorType==Detector::kCalDet){
01139     ledId=PlexLedId(Detector::kCalDet,pulserBox,led); 
01140   }
01141   else {
01142     MSG("LISummarySorter",Msg::kFatal)
01143       <<"Detector type not known = "<<detectorType<<endl;
01144   }
01145   
01146   if (!ledId.IsValid()){
01147     MSG("LISummarySorter",Msg::kWarning)
01148       <<"LedId not valid = "<<ledId.AsString()<<endl;
01149   }
01150 
01151   //create a pair to hold the two possible pin diode ids
01152   pair<PlexPinDiodeId,PlexPinDiodeId> plexPins=plexHandle->
01153     GetPinDiodeIds(ledId);
01154   
01155   //first is gain=1, second is gain=0
01156   MSG("LISummarySorter",Msg::kVerbose) 
01157     <<"first pin gain="<<plexPins.first.GetGain()
01158     <<", second pin gain="<<plexPins.second.GetGain()<<endl;
01159   
01160   //get the pin diode id of the current pin
01161   PlexPinDiodeId currentPinId=plexHandle->
01162     GetPinDiodeId(channels[ch].GetChannelId());
01163 
01164   //get the planes associated with the pin diode
01165   pair<Int_t,Int_t> pinPlanes=fLookup.GetPinDiodePlanes(currentPinId,
01166                                                         plexHandle);
01167 
01168   //set the plane to be the first
01169   //at FD this is ok since the shared pmt is not used
01170   //at CD you can work it out since you always return the lower plane
01171   plane=pinPlanes.first;
01172 
01173   MSG("LISummarySorter",Msg::kVerbose)
01174     <<"PIN diode's associated plane="<<plane<<endl;
01175 
01176   //get the raw channel id of the plex pin for this 
01177   //led and pulser box combination to then compare with the
01178   //raw channel id of the actual pin being reconstructed
01179   pair<RawChannelId,RawChannelId> rawChanIds;
01180   //get chan ids of pins 
01181   rawChanIds.first=plexHandle->GetRawChannelId(plexPins.first);
01182   rawChanIds.second=plexHandle->GetRawChannelId(plexPins.second);
01183 
01184   //compare chan id of first pin
01185   if (rawChanIds.first.IsSameChannel(channels[ch].GetChannelId())){
01186     MSG("LISummarySorter",Msg::kVerbose)
01187       <<"PIN reconstructed: First pin="
01188       <<plexPins.first.AsString()<<endl
01189       <<"                         pin="
01190       <<plexPinDiodeId.AsString()<<endl;
01191     correlatedHit=1;
01192     pinCounterReco[led-1]++;
01193   }
01194   else{//compare the second possibility
01195     if (rawChanIds.second.IsSameChannel(channels[ch].GetChannelId())){
01196       MSG("LISummarySorter",Msg::kVerbose) 
01197         <<"PIN reconstructed: Second pin="<<
01198         plexPins.second.AsString()<<endl
01199         <<"                          pin="<<
01200         plexPinDiodeId.AsString()<<endl;
01201       correlatedHit=1;
01202       pinCounterReco[led-1]++;
01203     }
01204   }
01205 
01206   //print out pin info of non-reconstructed pins
01207   if (correlatedHit!=1){
01208     MSG("LISummarySorter",Msg::kVerbose) 
01209       <<endl<<"PIN not reconstructed, noise hit"
01210       <<", pin="<<plexPinDiodeId.AsString()<<endl;
01211   }
01212 
01213   MSG("LISummarySorter",Msg::kVerbose) 
01214     <<"ReconstructPin method finished"<<endl;
01215   if (correlatedHit==1) return true;
01216   else return false;
01217 }

void LISummarySorter::ReconstructStripEnd ( Int_t  channel  ) 

This function reconstructs the strip end that was flashed during a given led pulse

1.) ask the plex for the list of the alt strips that illuminate the given readout channel which has a hit

2.) ask the plex for the pulserbox that illuminates the alt strips (call it plexPulserBox)

3.) ask the plex for the pulserbox that illuminates the other side of the alt strips (call it plexOppPulserBox)

4.) require that the pulserbox flashing is equal to (plexPulserBox OR plexOppPulserBox). If not, flag it as uncorrelated and move to next hit. Else, continue to next step.

5.) loop through all alt strips and in each case ask the plex for the led that illuminates the stripend (call it plexLed) and the opposite stripend (call it plexLedOpp).

6.) for each of the alt possibilities compare the led that is known to be flashing with plexLed and plexOppLed. If one of the alt possible leds matches either plexLed or plexOppLed then flag the hit as correlated.

7.) do a sanity check that only ONE of the alt strips was flashed by the current led. (always seems to be the case)

Definition at line 807 of file LISummarySorter.cxx.

References ashtray, bfld::AsString(), channels, correlatedHit, detectorType, farLed, farPulserBox, LILookup::FIRSTSPECTROMETERPLANE, fLookup, fStripEnd, GetElecString(), PlexStripEndId::GetEnd(), PlexHandle::GetLedId(), PlexLedId::GetLedInBox(), GetMuxBoxInfo(), PlexStripEndId::GetOppositeSEId(), PlexPixelSpotId::GetPixel(), PlexHandle::GetPixelSpotId(), PlexSEIdAltL::GetPlane(), PlexSEIdAltL::GetPlaneView(), PlexLedId::GetPulserBox(), PlexStripEndId::GetStrip(), PlexLedId::IsValid(), PlexStripEndId::IsValid(), it, Detector::kCalDet, Msg::kDebug, Detector::kFar, Detector::kNear, PlaneView::kV, Msg::kVerbose, Msg::kWarning, led, LILookup::Led2Ashtray(), MAXMSG, mean, MSG, nearLed, nearPulserBox, pixel, plane, plexHandle, plexOppPbCounter, plexPbCounter, pulserBox, and strip.

Referenced by Update().

00808 {
00811 
00839   MSG("LISummarySorter",Msg::kDebug) 
00840     <<"Reconstructing strip end..."<<endl;
00841 
00842   //Get strip-end alternative list
00843   PlexSEIdAltL altlist = plexHandle->
00844     GetSEIdAltL(channels[ch].GetChannelId());
00845   
00846   //the plane is known from the rawchannel so get it here
00847   plane=altlist.GetPlane();  
00848   MSG("LISummarySorter",Msg::kVerbose)
00849     <<"New altlist: plane="<<plane<<endl;
00850 
00851   //check that the plane view is kX, kY, kU or kV before reconstructing
00852   PlaneView::PlaneView_t planeView=altlist.GetPlaneView();  
00853   if (planeView>PlaneView::kV){
00854 
00855     Msg::LogLevel_t msgLevel=Msg::kDebug;
00856     //if (planeView>7 || planeView<7) msgLevel=Msg::kVerbose;
00857     
00858     MSG("LISummarySorter",msgLevel) 
00859       <<"Plane="<<plane
00860       <<", PlaneView="<<PlaneView::AsString(planeView)
00861       <<", therefore not reconstructing this plane"<<endl;
00862 
00863     //if (planeView==7) this->PrintBigMessage();
00864     //I am seeing some unknown views on vmm 5 in various crates???
00865 
00866     return;//don't reconstruct planes with no LI
00867   }
00868 
00869   //variable to sanity check reconstruction
00870   Int_t loopCounter=0;
00871   //hold true strip end id
00872   PlexStripEndId tmpSeid;
00873 
00875   //loop over the alternative strips
00877   for (PlexSEIdAltL::iterator it=altlist.begin(); 
00878        it!=altlist.end();it++){
00879 
00880     //set default values for led and pin plex variables
00881     Int_t plexLedInBox=-1;
00882     Int_t plexPulserBox=-1;
00883     Int_t plexOppLedInBox=-1;
00884     Int_t plexOppPulserBox=-1;
00885 
00886     //get strip end and opposite strip end id
00887     PlexStripEndId SEId=(*it).GetSEId();
00888     PlexStripEndId oppSEId=SEId.GetOppositeSEId();
00889 
00890     //get the temporary pixel of this possible strip
00891     //it is always the same for FD but 4 diff possibilites for ND
00892     PlexPixelSpotId plexPixelSpotId=plexHandle->GetPixelSpotId
00893       ((*it).GetSEId());
00894     //pixel is the same for all altSE
00895     Int_t tmpPixel=plexPixelSpotId.GetPixel();
00896 
00897     //a bit of sanity checking
00898     loopCounter++;
00899     if ((loopCounter>1 && detectorType==Detector::kCalDet) || 
00900         (loopCounter>8 && detectorType==Detector::kFar) ||
00901         (loopCounter>4 && detectorType==Detector::kNear)){
00902       MSG("LISummarySorter",Msg::kWarning) 
00903         <<"SEIdAltList has > 1 entry, loopCounter="<<loopCounter
00904         <<", CH="<<correlatedHit
00905         <<", end="<<SEId.GetEnd()
00906         <<", led="<<led
00907         <<", pl="<<plane
00908         <<", "<<this->GetElecString()<<endl;
00909     }
00910 
00911     //get ledIds for strip end and opp strip end
00912     PlexLedId ledId=plexHandle->GetLedId(SEId);       
00913     PlexLedId oppLedId=plexHandle->GetLedId(oppSEId);
00914 
00915     //sanity check that ledid is valid
00916     if (!ledId.IsValid()){
00917       MAXMSG("LISummarySorter",Msg::kWarning,20) 
00918         <<"LedId not valid, jumping to next SEId"
00919         << ", L="<<led
00920         << ", PB="<<pulserBox
00921         << ", pl="<<plane
00922         << ", mean="<<mean
00923         << endl;
00924       continue;
00925     }   
00926 
00927     //get pulserbox info for both sides
00928     plexPulserBox=ledId.GetPulserBox();   
00929     plexOppPulserBox=oppLedId.GetPulserBox();
00930     
00931     //these are the same for all alternative SEs
00932     nearPulserBox=plexPulserBox;
00933     farPulserBox=plexOppPulserBox;
00934     
00935     //get led number for both sides
00936     plexLedInBox=ledId.GetLedInBox();
00937     plexOppLedInBox=oppLedId.GetLedInBox();
00938     
00939     //reconstruct the strip for xtalk hits at CalDet and at ND forward
00940     //section (ND spectrometer is ambiguous due to 4 pixels=1 channel)
00941     if ((detectorType==Detector::kCalDet) ||
00942         (detectorType==Detector::kNear && 
00943          plane<LILookup::FIRSTSPECTROMETERPLANE)){
00944       //this is unambiguous at CalDet, so do it here for ALL hits
00945       //i.e. do it for xtalk too
00946       nearLed=plexLedInBox;
00947       farLed=plexOppLedInBox;
00948       strip=SEId.GetStrip();
00949       fStripEnd=SEId.GetEnd();
00950       
00951       MAXMSG("LISummarySorter",Msg::kDebug,200) 
00952         <<"XTalk reco: PB="<<pulserBox
00953         <<", pl="<<plane
00954         <<", s="<<strip
00955         <<", mean="<<mean
00956         <<endl;
00957     }  
00958 
00959     //determine whether to continue or not
00960     //ignore noise hits in crates not being flashed
00961     //there is no more information that can be determined for them
00962     //18-Sep-04: moved below section to allocate strips to ND forward
00963     //section
00964     if (plexPulserBox!=pulserBox && 
00965         plexOppPulserBox!=pulserBox) continue;
00966 
00967     //if (led==18){
00968     MSG("LISummarySorter",Msg::kDebug) 
00969       <<"pxL="<<plexLedInBox
00970       <<", L="<<led
00971       <<", pxPB="<<plexPulserBox
00972       <<", pxOpPB="<<plexOppPulserBox
00973       <<", PB="<<pulserBox
00974       <<", pl="<<plane
00975       <<", s="<<strip
00976       <<", sPlex="<<SEId.GetStrip()
00977       <<", pix="<<tmpPixel
00978       <<", mean="<<mean
00979       <<endl;
00980     //}
00981     //determine if it's a correlated hit    
00982     if ((pulserBox==nearPulserBox && led==plexLedInBox) ||
00983         (pulserBox==farPulserBox && led==plexOppLedInBox)){
00984 
00985       //sanity check 
00986       if (((nearLed>0 || farLed>0) && 
00987            detectorType!=Detector::kCalDet && 
00988            (detectorType!=Detector::kNear &&
00989             plane>=LILookup::FIRSTSPECTROMETERPLANE)) || 
00990           correlatedHit==1){
00991         //only do the led check if detector is not CalDet
00992         //otherwise check that leds have not already been set
00993         MAXMSG("LISummarySorter",Msg::kWarning,50) 
00994           <<"Overwritten near or far led during strip reconstruction"
00995           <<", correlatedHit="<<correlatedHit<<endl
00996           <<"led="<<led
00997           <<", oldnL="<<nearLed<<", newnL="<<plexLedInBox
00998           <<", oldfL="<<farLed<<", newfL="<<plexOppLedInBox
00999           <<", oldSt="<<strip<<", newSt="<<SEId.GetStrip()
01000           <<", pix="<<tmpPixel<<", pl="<<plane
01001           <<" "<<this->GetElecString()<<endl;
01002       }
01003       
01004       //if (led==18){
01005       MSG("LISummarySorter",Msg::kDebug) 
01006         <<"Found CorrelatedHit"<<endl
01007         <<"led="<<led
01008         <<", oldnL="<<nearLed<<", newnL="<<plexLedInBox
01009         <<", oldfL="<<farLed<<", newfL="<<plexOppLedInBox
01010         <<", oldSt="<<strip<<", newSt="<<SEId.GetStrip()
01011         <<", pix="<<tmpPixel<<", pl="<<plane
01012         <<" "<<this->GetElecString()<<endl;
01013       //}
01014       //count entries for pulserboxes
01015       plexPbCounter[plexPulserBox]++;
01016       plexOppPbCounter[plexOppPulserBox]++;
01017       
01018       //set more variables
01019       correlatedHit=1;
01020       strip=SEId.GetStrip();
01021       fStripEnd=SEId.GetEnd();
01022       //Int_t oppStrip=oppSEId.GetStrip();//just used for message below
01023       nearLed=plexLedInBox;
01024       farLed=plexOppLedInBox;  
01025       //note that strip, se, nearL and farL get set twice for correlated
01026       //hits in CalDet, but so what!
01027       //Less complicated than checking if CalDet or not
01028 
01029       //save the reconstructed seid
01030       tmpSeid=SEId;
01031     }//end of if
01032     
01033     //use the led to determine which ashtray was being illuminated
01034     //only set the variable if the channel is in the crate 
01035     //(or opposite crate) that is being illuminated
01036     if (pulserBox==nearPulserBox || pulserBox==farPulserBox){
01037       ashtray=fLookup.Led2Ashtray(led,plane,detectorType);
01038     }
01039   }//end of for
01040   
01042   //reconstruct the pixel and mux box info
01044   //get pixel spot id for strip end
01045   PlexPixelSpotId plexPixelSpotId;
01046   if (tmpSeid.IsValid()){
01047     plexPixelSpotId=plexHandle->GetPixelSpotId(tmpSeid);
01048     pixel=plexPixelSpotId.GetPixel();
01049   }
01050   else{
01051     //if a stripend wasn't reconstructed then just use the first
01052     //strip end in the altlist to get the pixel
01053     //even though it will only be one of the possible four in the ND
01054     plexPixelSpotId=plexHandle->GetPixelSpotId
01055       ((*altlist.begin()).GetSEId());
01056     pixel=plexPixelSpotId.GetPixel();
01057   }
01058   //set all the mux box variables
01059   this->GetMuxBoxInfo(plexPixelSpotId);
01060 
01061   MSG("LISummarySorter",Msg::kVerbose) 
01062     <<"ReconstructStripEnd method finished"<<endl;
01063 }

void LISummarySorter::ReconstructTrigPmt (  ) 

Definition at line 1221 of file LISummarySorter.cxx.

References channel, correlatedHit, detectorType, farPulserBox, fLookup, LILookup::GetOppPb(), Msg::kVerbose, MSG, nearPulserBox, LILookup::Pb2TrigPmtChannel(), PrintBigMessage(), and pulserBox.

Referenced by Update().

01222 {
01223   MSG("LISummarySorter",Msg::kVerbose) 
01224     <<"Reconstructing Trigger Pmt..."<<endl;
01225 
01226   if (channel==fLookup.Pb2TrigPmtChannel(pulserBox,detectorType)){
01227     nearPulserBox=pulserBox;
01228     //there is no far pulser box associated with a trig pmt hit
01229     //but get it anyway
01230     farPulserBox=fLookup.GetOppPb(pulserBox,detectorType);
01231     correlatedHit=1;
01232   }
01233 
01234   if (fLookup.Pb2TrigPmtChannel(pulserBox,detectorType)==-1){
01235     this->PrintBigMessage();
01236   }
01237   
01238   MSG("LISummarySorter",Msg::kVerbose)
01239     <<"ReconstructTrigPmt method finished"<<endl;
01240 }

void LISummarySorter::ResetTreeVariables (  ) 

Definition at line 612 of file LISummarySorter.cxx.

References ashtray, chAdd, channel, chip, correlatedHit, crate, eastWest, elecType, farLed, farPulserBox, fMasterCh, fMinderCh, fPe, fStripEnd, geoAdd, inRack, mean, nearLed, nearPulserBox, numEntries, numericMuxBox, pinGain, pinInBox, pixel, plane, rackBay, rackLevel, readoutType, rms, strip, summaryCounter, timestamp, timestampNanoSec, varc, vfb, and vmm.

Referenced by Update().

00613 {
00614   //reset reconstructed tree variables
00615   //but not the LI pulser box settings
00616 
00617   //listed here for a checksum
00618   //   calibPoint=new_calibPoint;
00619   //   pulseHeight=new_pulseHeight;
00620   //   pulseWidth=new_pulseWidth;
00621   //   pulserBox=new_pulserBox;
00622   //   led=new_led;
00623   //   time=new_time;
00624   //   period=new_period;
00625   //   calibType=new_calibType;
00626   //   pulses=new_pulses;
00627   // 9 above but time is a struct and not directly in tree so only 8
00628     
00629   ashtray=-1;
00630   chAdd=-1;
00631   channel=-1;
00632   chip=-1;
00633   correlatedHit=0;
00634   crate=-1;
00635 
00636   //this only gets updated when you have a new led
00637   //so don't reset here
00638   //detectorType=-1;
00639 
00640   eastWest=-1;
00641   elecType=-1;
00642   farLed=-1;
00643   farPulserBox=-1;
00644   geoAdd=-1;
00645   inRack=-1;
00646   fMasterCh=-1;
00647   mean=-1.;
00648   fMinderCh=-1;
00649   nearLed=-1;
00650   nearPulserBox=-1;
00651   numEntries=-1;
00652   numericMuxBox=-1;
00653   fPe=-1;
00654   pixel=-1;
00655   pinGain=-1;
00656   pinInBox=-1;
00657   plane=-1;
00658   rackBay=-1;
00659   rackLevel=-1;
00660   readoutType=-1;
00661   rms=-1.;
00662 
00663   //these three only get updated when you have a new led etc
00664   //so don't reset here
00665   //runNumber=-1;
00666   //runNumberSub=-1;
00667   //runType=-1;
00668 
00669   strip=-1;
00670   fStripEnd=-1;
00671   summaryCounter=0;
00672   timestamp=-1;
00673   timestampNanoSec=-1;
00674   varc=-1;
00675   vfb=-1;
00676   vmm=-1;
00677 
00678   //38 variables above +fPe
00679   //+8 for pulser box settings
00680   //=46 altogether - same as number of branches in tree
00681 }

void LISummarySorter::SetDetector ( VldContext  vldC  ) 

Definition at line 1728 of file LISummarySorter.cxx.

References VldContext::AsString(), detectorType, fLookup, VldContext::GetDetector(), VldContext::IsValid(), Msg::kDebug, Msg::kVerbose, Msg::kWarning, MSG, and LILookup::SetDetector().

Referenced by LISummaryModule::GetPulserBlocks(), and LISummaryModule::Reco().

01729 { 
01730   MSG("LISummarySorter",Msg::kVerbose)  
01731     <<"Setting detector type..."<<endl; 
01732  
01733   MSG("LISummarySorter",Msg::kDebug) 
01734     <<"Argument of SetDetector: VldC="<<vldC.AsString()<<endl; 
01735    
01736   //check if the validity context is valid 
01737   if (vldC.IsValid()){
01738 
01739     detectorType=static_cast<Int_t>(vldC.GetDetector()); 
01740     MSG("LISummarySorter",Msg::kDebug) 
01741       <<"Detector Type "<<detectorType<<" found"<<endl;
01742 
01743     //set the detector specific variables only once
01744     static Bool_t detNotSet=true;
01745     if (detNotSet){
01746       fLookup.SetDetector(detectorType);
01747       detNotSet=false;
01748     }
01749   } 
01750   else{ 
01751     MSG("LISummarySorter",Msg::kWarning)  
01752       <<"Validity context not valid = "<<vldC.AsString()
01753       <<endl<<"Could not set detector type"<<endl; 
01754   } 
01755  
01756   MSG("LISummarySorter",Msg::kVerbose)  
01757     <<"Finished SetDetector method"<<endl; 
01758 } 

void LISummarySorter::SetLIVariables ( Int_t  led,
Int_t  pulseHeight,
Int_t  pulseWidth,
Int_t  pulserBox,
Int_t  calibPoint,
VldTimeStamp  time,
Int_t  calibType,
Int_t  pulses,
Int_t  period 
) [private]

Definition at line 359 of file LISummarySorter.cxx.

References calibPoint, calibType, led, period, pulseHeight, pulserBox, pulses, pulseWidth, and time.

Referenced by Update().

00368 {
00369   //set summarySorters variables
00370   calibPoint=new_calibPoint;
00371   pulseHeight=new_pulseHeight;
00372   pulseWidth=new_pulseWidth;
00373   pulserBox=new_pulserBox;
00374   led=new_led;
00375   time=new_time;
00376   period=new_period;
00377   calibType=new_calibType;
00378   pulses=new_pulses; 
00379 }

void LISummarySorter::SetPlexHandle ( VldContext  vldC  ) 

Definition at line 1618 of file LISummarySorter.cxx.

References VldContext::AsString(), VldTimeStamp::AsString(), exit(), fRawDaqVldCtx, VldContext::GetDetector(), VldTimeStamp::GetSec(), VldRange::GetTimeEnd(), VldContext::GetTimeStamp(), VldRange::GetTimeStart(), PlexHandle::GetVldRange(), MsgService::Instance(), VldRange::IsCompatible(), VldContext::IsValid(), SimFlag::kData, Msg::kDebug, Msg::kFatal, Msg::kInfo, Msg::kVerbose, Msg::kWarning, MSG, plexHandle, and VldTimeStamp::Print().

Referenced by LISummaryModule::GetPulserBlocks(), and LISummaryModule::GetSummaryBlocks().

01619 {
01620   MSG("LISummarySorter",Msg::kVerbose) 
01621     <<"Setting new validity context for plex handle..."<<endl;
01622 
01623   MSG("LISummarySorter",Msg::kDebug)
01624     <<"Input to SetPlexHandle() VldC="<<vldC.AsString()<<endl;
01625   
01626   if (vldC.GetTimeStamp().GetSec()==0){
01627     static Int_t numberMsg=0;
01628     if (numberMsg<2){
01629       MSG("LISummarySorter",Msg::kWarning)
01630         <<endl<<endl
01631         <<"************************* WARNING ********************"<<endl
01632         <<"* Number of seconds in summary block=0"<<endl
01633         <<"* Using RawDaqHeader timestamp to create"<<endl
01634         <<"* plex handle instead"<<endl
01635         <<"******************************************************"<<endl
01636         <<endl;
01637     }
01638     numberMsg++;
01639 
01640     const VldTimeStamp ts=fRawDaqVldCtx.GetTimeStamp();
01641 
01642     //print the timestamp if verbose
01643     if (MsgService::Instance()->IsActive("LISummarySorter",
01644                                          Msg::kVerbose)){
01645       MSG("LISummarySorter",Msg::kInfo) 
01646         <<"Using VldTimeStamp="<<endl;
01647       ts.Print();
01648     }
01649     
01650     VldContext hackedVldC(vldC.GetDetector(),SimFlag::kData,ts);
01651     
01652     MSG("LISummarySorter",Msg::kDebug) 
01653       <<"After setting plex handle using VldC="
01654       <<hackedVldC.AsString()<<endl; 
01655     
01656     //check if the validity context is valid then create the plex handle
01657     if (hackedVldC.IsValid()){
01658 
01659       //delete the plex handle if it already exists
01660       if (plexHandle){
01661         delete plexHandle;
01662       }
01663       //create a new plex handle
01664       plexHandle=new PlexHandle(hackedVldC); 
01665     }
01666     else{
01667       MSG("LISummarySorter",Msg::kFatal) 
01668         <<"Validity context not valid="<<vldC.AsString()<<endl;
01669       exit(1);
01670     }
01671   }
01672   else{ 
01673     //check if the validity context is valid then create the plex handle
01674     if (vldC.IsValid()){
01675 
01676       //delete the plex handle if it already exists
01677       if (plexHandle){
01678         delete plexHandle;
01679       }
01680 
01681       //create a new plex handle
01682       plexHandle=new PlexHandle(vldC); 
01683       
01684       //get validity range
01685       VldRange myVldRange=plexHandle->GetVldRange();
01686       MSG("LISummarySorter",Msg::kVerbose)
01687         <<"Range TimeStart="<<myVldRange.GetTimeStart().AsString()<<endl
01688         <<"Range TimeEnd="<<myVldRange.GetTimeEnd().AsString()<<endl
01689         <<"Compatible="<<myVldRange.IsCompatible(vldC)<<endl;
01690     }
01691     else{
01692       MSG("LISummarySorter",Msg::kFatal) 
01693         <<"Validity context not valid="<<vldC.AsString()<<endl;
01694       exit(1);
01695     }
01696   }
01697   
01698   MSG("LISummarySorter",Msg::kVerbose) 
01699     <<"Finished setting new validity context for plex handle"<<endl;
01700 }

void LISummarySorter::SetRawDaqVldCtx ( VldContext  vldC  ) 

Definition at line 1704 of file LISummarySorter.cxx.

References VldContext::AsString(), fRawDaqVldCtx, VldContext::IsValid(), Msg::kDebug, Msg::kVerbose, Msg::kWarning, and MSG.

Referenced by LISummaryModule::Reco().

01705 { 
01706   MSG("LISummarySorter",Msg::kVerbose)  
01707     <<"Setting RawDaqVldCtx"<<endl; 
01708  
01709   MSG("LISummarySorter",Msg::kDebug) 
01710     <<"Input to SetRawDaqVldCtx() VldC="<<vldC.AsString()<<endl; 
01711    
01712   //check if the validity context is valid 
01713   if (vldC.IsValid()){
01714     fRawDaqVldCtx=vldC;
01715   } 
01716   else{ 
01717     MSG("LISummarySorter",Msg::kWarning)  
01718       <<"Validity context not valid = "<<vldC.AsString()
01719       <<endl<<"Could not set fRawDaqVldCtx"<<endl; 
01720   } 
01721  
01722   MSG("LISummarySorter",Msg::kVerbose)  
01723     <<"Finished SetRawDaqVldCtx method"<<endl; 
01724 } 

void LISummarySorter::SetRunNumber ( Int_t  runNum  )  [inline]

Definition at line 61 of file LISummarySorter.h.

References runNumber.

Referenced by LISummaryModule::GetPulserBlocks(), and LISummaryModule::Reco().

00061 {runNumber=runNum;};

void LISummarySorter::SetRunNumberSub ( Short_t  runNumSub  )  [inline]

Definition at line 62 of file LISummarySorter.h.

References runNumberSub.

Referenced by LISummaryModule::GetPulserBlocks(), and LISummaryModule::Reco().

00062                                          {runNumberSub=static_cast
00063                                             <Int_t>(runNumSub);};

void LISummarySorter::SetRunType ( Short_t  runT  )  [inline]

Definition at line 64 of file LISummarySorter.h.

References runType.

Referenced by LISummaryModule::GetPulserBlocks(), and LISummaryModule::Reco().

00064 {runType=static_cast<Int_t>(runT);};

Bool_t LISummarySorter::Update ( Int_t  led,
Int_t  pulseHeight,
Int_t  pulseWidth,
Int_t  pulserBox,
Int_t  calibPoint,
VldTimeStamp  time,
Int_t  calibType,
Int_t  pulses,
Int_t  period 
)

This function does the following:

  • check for a new led, pulse height, etc
  • do nothing if same point
  • write previous points data to the tree if new point found

Definition at line 383 of file LISummarySorter.cxx.

References bfld::AsString(), ReadoutType::AsString(), badHitCounter, calibPoint, cerenkovCounter, channels, commonModeCounter, correlatedHit, crate, crates, fLookup, GetElecString(), GetElectronicsData(), goodHitCounter, ReadoutType::kCerenkov, Msg::kError, ReadoutType::kFlashTrigPMT, Msg::kInfo, ReadoutType::kPinDiode, ReadoutType::kScintStrip, ReadoutType::kTimingFid, ReadoutType::kTOF, ReadoutType::kTriggerOR, ReadoutType::kUnconnectedPixel, ReadoutType::kUnknown, ReadoutType::kVACommonMode, Msg::kVerbose, Msg::kWarning, led, leds, MAXMSG, mean, MSG, LILookup::NUMCHADD, LILookup::NUMCRATES, numEntries, outtree, pinCounter, plexHandle, PrintBlockInfo(), pulseHeight, pulserBox, pulserBoxes, pulseWidth, rawSummaryBlockCounter, readoutType, ReconstructPin(), ReconstructStripEnd(), ReconstructTrigPmt(), ResetTreeVariables(), rms, SetLIVariables(), stripCounter, timingFidCounter, tofCounter, triggerOrCounter, trigPmtCounter, unconnectedPixelCounter, and unknownCounter.

Referenced by LISummaryModule::EndJob(), LISummaryModule::GetPulserBlocks(), and LISummaryModule::GetSummaryBlocks().

00392 {
00397   
00398   //this method gets called once for each raw summary block so
00399   //count the number of summary blocks here
00400   rawSummaryBlockCounter++;
00401 
00402   MSG("LISummarySorter",Msg::kVerbose)
00403     <<"Running LISummarySorter::Update method..."<<endl;
00404 
00405   if(led==-1){//it is initialised to -1
00406 
00407     MSG("LISummarySorter",Msg::kInfo) 
00408       <<"Initialising variables for LI settings in Update()"<<endl;
00409     
00410     //initialise the vector of LIChannels
00411     if (channels.size()==0){
00412       for (Int_t i=0;i<LILookup::NUMCRATES*LILookup::NUMCHADD;i++){
00413         channels.push_back(LIChannel());
00414       }
00415       MSG("LISummarySorter",Msg::kInfo) 
00416         <<"Vector of channels initialised to "
00417         <<LILookup::NUMCRATES*LILookup::NUMCHADD
00418         <<" (NUMCRATES="<<LILookup::NUMCRATES
00419         <<", NUMCHADD="<<LILookup::NUMCHADD<<")"
00420         <<endl; 
00421     }
00422     else{
00423       MSG("LISummarySorter",Msg::kInfo) 
00424         <<"Channels vector can't be initialised; already done!"<<endl;
00425     }
00426 
00427     this->SetLIVariables(new_led,new_pulseHeight,new_pulseWidth,
00428                          new_pulserBox,new_calibPoint,new_time,
00429                          new_calibType,new_pulses,new_period);
00430       
00431     this->PrintBlockInfo("First initialisation ");
00432     return false;//didn't update tree
00433   }
00434   // Write out data from previous led, pulse height, etc here
00435   else if(new_led!=led ||
00436           new_pulseHeight!=pulseHeight ||
00437           new_pulseWidth!=pulseWidth ||
00438           new_pulserBox!=pulserBox ||
00439           new_calibPoint!=calibPoint){
00440 
00441     //get an iterator to the map
00442     vector<LIChannel>::iterator chIt;
00443     chIt=channels.begin()-1;//so can increment straight away
00444     Int_t ch=-1;
00445 
00446     //loop over every possible channel
00447     while (chIt!=channels.end()){
00448 
00449       //increment the loop variables
00450       ch++;
00451       chIt++;
00452       MSG("LISummarySorterUltraVerbose",Msg::kVerbose) 
00453         <<"At beginning: Channel="<<ch<<endl;
00454 
00455       numEntries=channels[ch].GetNumEntries();      
00456       //check if channel was hit 
00457       if(numEntries==0) continue;
00458 
00459       //reset the variables and get the electronics info        
00460       this->ResetTreeVariables();
00461       this->GetElectronicsData(ch);
00462 
00463       //gather run statistics
00464       crates[crate]++;
00465       if (crate>fLookup.NUMCRATES || crate<0){
00466         MSG("LISummarySorter",Msg::kError) 
00467           <<"Crate out of range: crate="<<crate<<endl;
00468       }
00469 
00470       if (pulserBox<fLookup.NUMPULSERBOXES && pulserBox>=0 && 
00471           led<=fLookup.NUMLEDS && led>=1){
00472         pulserBoxes[pulserBox]++;
00473         leds[led-1]++;
00474       }
00475       else{
00476         static Int_t numberMsg=0;
00477         if (numberMsg<10){
00478           MSG("LISummarySorter",Msg::kError)
00479             <<"Pulser box or Led out of range: (PB,LED)=("<<pulserBox 
00480             <<","<<led<<")"<<endl;
00481           if (numberMsg==9){
00482             MSG("LISummarySorter",Msg::kError)
00483               <<endl
00484               <<"This is the last message of this type to be printed"
00485               <<endl;
00486           } 
00487         }
00488         numberMsg++;
00489       }
00490 
00491       //get readout type
00492       //      ReadoutType::Readout_t rt=plexHandle->
00493       //GetReadoutType(channels[ch]->GetChannelId());
00494       ReadoutType::Readout_t rt=plexHandle->
00495         GetReadoutType(chIt->GetChannelId());
00496       readoutType=static_cast<Int_t>(rt);//set tree variable
00497       MSG("LISummarySorter",Msg::kVerbose) 
00498         <<"rt="<<ReadoutType::AsString(rt)
00499         <<", mean="<<mean <<", rms="<<rms 
00500         <<", numEnt="<<numEntries 
00501         <<" "<<this->GetElecString()<<endl; 
00502 
00503       //check for dodgy channels
00504       if (rms==0 || numEntries==0 || mean==0){
00505         if (numEntries>10){
00506           if (readoutType==ReadoutType::kTOF ||
00507               readoutType==ReadoutType::kUnknown || 
00508               readoutType==ReadoutType::kTriggerOR){
00509             MSG("LISanityCheck",Msg::kVerbose) 
00510               <<" ** Channel with strange values: mean="<<mean 
00511               <<", rms="<<rms 
00512               <<", numEnt="<<numEntries 
00513               <<", rt="<<ReadoutType::AsString(rt)
00514               <<" "<<this->GetElecString()<<endl; 
00515           }
00516           else{
00517             //if (rms==0 && detectorType==Detector::kNear){
00518               //do nothing; too many of these with bad channels
00519             //}
00520             //else{
00521               MAXMSG("LISanityCheck",Msg::kInfo,50) 
00522                 <<"Writing out bad channel: mean="
00523                 <<(Int_t)mean 
00524                 <<", rms="<<rms 
00525                 <<", numEnt="<<numEntries 
00526                 <<", rt="<<ReadoutType::AsString(rt)
00527                 <<" "<<this->GetElecString()<<endl; 
00528               //}
00529           }
00530         }
00531       }
00532 
00533       //use the readout type to decide what to do
00534       //count the number of each type in file
00535       if (rt==ReadoutType::kUnknown){
00536         unknownCounter++;
00537       }
00538       else if (rt==ReadoutType::kUnconnectedPixel){
00539         unconnectedPixelCounter++;
00540       }
00541       else if (rt==ReadoutType::kScintStrip) {
00542         stripCounter++;
00543 
00544         //run the algorithm to correlate hits with flashes and 
00545         //determine the strip end
00546         this->ReconstructStripEnd(ch);
00547 
00548         //count hits that were attributed to an LI pulse        
00549         if (correlatedHit){
00550           goodHitCounter++;
00551         }
00552         else{
00553           badHitCounter++;
00554         }
00555       }//end of if
00556       else if (rt==ReadoutType::kPinDiode){
00557         pinCounter++;
00558         this->ReconstructPin(ch);
00559       }
00560       else if (rt==ReadoutType::kFlashTrigPMT){
00561         trigPmtCounter++;
00562         this->ReconstructTrigPmt();
00563       }
00564       else if (rt==ReadoutType::kVACommonMode){
00565         commonModeCounter++;
00566       }
00567       else if (rt==ReadoutType::kTriggerOR){
00568         triggerOrCounter++;
00569       }
00570       else if (rt==ReadoutType::kCerenkov){
00571         cerenkovCounter++;
00572       }
00573       else if (rt==ReadoutType::kTOF){
00574         tofCounter++;
00575       }
00576       else if (rt==ReadoutType::kTimingFid){
00577         timingFidCounter++;
00578       }
00579       else {
00580         MSG("LISummarySorter",Msg::kWarning) 
00581           <<"ReadoutType not defined:" 
00582           <<" rt="<<ReadoutType::AsString(rt)
00583           <<" "<<this->GetElecString()
00584           <<endl;
00585       }   
00586       //fill the tree with all the current data for this channel
00587       outtree->Fill();
00588     }//end of loop
00589 
00590     this->PrintBlockInfo("Wrote point: ");
00591 
00592     //reset all channels for next point
00593     for(UInt_t ch=0;ch<channels.size();ch++){
00594       channels[ch].Clean();       
00595     }
00596 
00597     //set the variables to be the new ones
00598     this->SetLIVariables(new_led,new_pulseHeight,new_pulseWidth,
00599                          new_pulserBox,new_calibPoint,new_time,
00600                          new_calibType,new_pulses,new_period);
00601     
00602     return true;//did update tree
00603   }//end of else if
00604 
00605   MSG("LISummarySorter",Msg::kVerbose)
00606     <<"Finished LISummarySorter::Update method..."<<endl;
00607   return false;//didn't update tree
00608 }

void LISummarySorter::WriteFile ( TFile *  outfile  ) 

Definition at line 1584 of file LISummarySorter.cxx.

References Msg::kInfo, Msg::kWarning, MSG, and outtree.

Referenced by OutputData().

01585 {
01586   if (outfile && outtree){
01587     MSG("LISummarySorter",Msg::kInfo)<<"Writing out tree..."<<endl;
01588     outfile->cd();
01589     outtree->Write();
01590     delete outtree;  
01591     MSG("LISummarySorter",Msg::kInfo) 
01592       <<"Tree written and deleted"<<endl;
01593   }
01594   else {
01595     MSG("LISummarySorter",Msg::kWarning)
01596       <<"Can't write out tree (outtree="<<outtree
01597       <<", outfile="<<outfile<<")"<<endl;
01598   }
01599 }


Member Data Documentation

Int_t LISummarySorter::ashtray [private]

Definition at line 89 of file LISummarySorter.h.

Referenced by LISummarySorter(), PrintRecoSummary(), and Update().

Int_t LISummarySorter::calibPoint [private]
Int_t LISummarySorter::calibType [private]

Definition at line 91 of file LISummarySorter.h.

Referenced by InitialiseTree(), LISummarySorter(), PrintBlockInfo(), and SetLIVariables().

Definition at line 92 of file LISummarySorter.h.

Referenced by LISummarySorter(), PrintRecoSummary(), and Update().

Int_t LISummarySorter::chAdd [private]
Int_t LISummarySorter::channel [private]
std::vector<LIChannel> LISummarySorter::channels [private]
Int_t LISummarySorter::chip [private]

Definition at line 97 of file LISummarySorter.h.

Referenced by LISummarySorter(), PrintRecoSummary(), and Update().

Int_t LISummarySorter::crate [private]
std::map<Int_t,Int_t> LISummarySorter::crates [private]

Definition at line 100 of file LISummarySorter.h.

Referenced by PrintRecoSummary(), and Update().

Int_t LISummarySorter::eastWest [private]
Int_t LISummarySorter::elecType [private]
Int_t LISummarySorter::farLed [private]
string LISummarySorter::filename [private]

Definition at line 106 of file LISummarySorter.h.

Int_t LISummarySorter::first_time [private]

Definition at line 107 of file LISummarySorter.h.

Referenced by LISummarySorter().

Int_t LISummarySorter::fMasterCh [private]
Int_t LISummarySorter::fMinderCh [private]
Float_t LISummarySorter::fPe [private]

Definition at line 124 of file LISummarySorter.h.

Referenced by InitialiseTree(), LISummarySorter(), and ResetTreeVariables().

Definition at line 141 of file LISummarySorter.h.

Referenced by SetPlexHandle(), and SetRawDaqVldCtx().

Int_t LISummarySorter::fStripEnd [private]
Int_t LISummarySorter::geoAdd [private]

Definition at line 110 of file LISummarySorter.h.

Referenced by LISummarySorter(), PrintRecoSummary(), and Update().

Int_t LISummarySorter::inRack [private]
Int_t LISummarySorter::led [private]
std::map<Int_t,Int_t> LISummarySorter::leds [private]

Definition at line 112 of file LISummarySorter.h.

Referenced by PrintRecoSummary(), and Update().

Float_t LISummarySorter::mean [private]
Int_t LISummarySorter::nearLed [private]
Int_t LISummarySorter::numEntries [private]
TFile* LISummarySorter::outputFile [private]

Definition at line 123 of file LISummarySorter.h.

Referenced by InitialiseTree(), LISummarySorter(), OpenFile(), and OutputData().

TTree* LISummarySorter::outtree [private]

Definition at line 122 of file LISummarySorter.h.

Referenced by AddEntry(), InitialiseTree(), LISummarySorter(), Update(), and WriteFile().

Int_t LISummarySorter::period [private]

Definition at line 125 of file LISummarySorter.h.

Referenced by InitialiseTree(), LISummarySorter(), PrintBlockInfo(), and SetLIVariables().

Int_t LISummarySorter::pinCounter [private]

Definition at line 127 of file LISummarySorter.h.

Referenced by LISummarySorter(), PrintRecoSummary(), and Update().

std::map<Int_t,Int_t> LISummarySorter::pinCounterReco [private]

Definition at line 128 of file LISummarySorter.h.

Referenced by PrintRecoSummary(), and ReconstructPin().

Int_t LISummarySorter::pinGain [private]
Int_t LISummarySorter::pinInBox [private]
Int_t LISummarySorter::pixel [private]
Int_t LISummarySorter::plane [private]
std::map<Int_t,Int_t> LISummarySorter::plexOppPbCounter [private]

Definition at line 132 of file LISummarySorter.h.

Referenced by PrintRecoSummary(), and ReconstructStripEnd().

std::map<Int_t,Int_t> LISummarySorter::plexPbCounter [private]

Definition at line 133 of file LISummarySorter.h.

Referenced by PrintRecoSummary(), and ReconstructStripEnd().

Int_t LISummarySorter::pulserBox [private]
std::map<Int_t,Int_t> LISummarySorter::pulserBoxes [private]

Definition at line 136 of file LISummarySorter.h.

Referenced by PrintRecoSummary(), and Update().

Int_t LISummarySorter::pulses [private]

Definition at line 137 of file LISummarySorter.h.

Referenced by InitialiseTree(), LISummarySorter(), PrintBlockInfo(), and SetLIVariables().

Int_t LISummarySorter::pulseWidth [private]
Int_t LISummarySorter::rackBay [private]
Int_t LISummarySorter::rackLevel [private]

Definition at line 142 of file LISummarySorter.h.

Referenced by LISummarySorter(), PrintRecoSummary(), and Update().

Definition at line 143 of file LISummarySorter.h.

Referenced by CountNumSummaries(), LISummarySorter(), and PrintRecoSummary().

Float_t LISummarySorter::rms [private]
Int_t LISummarySorter::runNumber [private]

Definition at line 145 of file LISummarySorter.h.

Referenced by InitialiseTree(), LISummarySorter(), PrintRecoSummary(), and SetRunNumber().

Int_t LISummarySorter::runType [private]

Definition at line 150 of file LISummarySorter.h.

Referenced by InitialiseTree(), LISummarySorter(), and SetRunType().

Int_t LISummarySorter::strip [private]

Definition at line 153 of file LISummarySorter.h.

Referenced by LISummarySorter(), PrintRecoSummary(), and Update().

Definition at line 156 of file LISummarySorter.h.

Referenced by GetElectronicsData(), PrintBlockInfo(), and SetLIVariables().

Int_t LISummarySorter::timestamp [private]

Definition at line 158 of file LISummarySorter.h.

Referenced by GetElectronicsData(), LISummarySorter(), and ResetTreeVariables().

Definition at line 159 of file LISummarySorter.h.

Referenced by LISummarySorter(), PrintRecoSummary(), and Update().

Int_t LISummarySorter::tofCounter [private]

Definition at line 160 of file LISummarySorter.h.

Referenced by LISummarySorter(), PrintRecoSummary(), and Update().

Definition at line 161 of file LISummarySorter.h.

Referenced by LISummarySorter(), PrintRecoSummary(), and Update().

Definition at line 162 of file LISummarySorter.h.

Referenced by LISummarySorter(), PrintRecoSummary(), and Update().

Definition at line 163 of file LISummarySorter.h.

Referenced by LISummarySorter(), PrintRecoSummary(), and Update().

Definition at line 164 of file LISummarySorter.h.

Referenced by LISummarySorter(), PrintRecoSummary(), and Update().

Definition at line 165 of file LISummarySorter.h.

Int_t LISummarySorter::varc [private]
Int_t LISummarySorter::vfb [private]
Int_t LISummarySorter::vmm [private]

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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1