X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=VZERO%2FAliVZEROTrigger.cxx;h=de566fa2b8ea4db354bb8e713c38e44d09feeccd;hb=14e4c3fabe896698bedfd4a38bb334c008fa160f;hp=b2b89e583096d848c7bac66b34ac5638228805c7;hpb=c299dbe46b6a13c093ab192a8558e2c98f20b9d1;p=u%2Fmrichter%2FAliRoot.git diff --git a/VZERO/AliVZEROTrigger.cxx b/VZERO/AliVZEROTrigger.cxx index b2b89e58309..de566fa2b8e 100644 --- a/VZERO/AliVZEROTrigger.cxx +++ b/VZERO/AliVZEROTrigger.cxx @@ -1,127 +1,133 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ +/* $Id$ */ +// --------------------- +// Class AliVZEROTrigger +// --------------------- +// Top class to simulate the VZERO trigger response +// This class is only used for interface with AliTriggerDetector +// Its create and Set Inputs of the CTP +// The Calculation of the trigger response is done into AliVZEROTriggerSimulator +// + + +#include +#include + #include "AliRun.h" +#include "AliLoader.h" +#include "AliLog.h" #include "AliRunLoader.h" +#include "AliTriggerInput.h" +#include "AliVZEROdigit.h" +#include "AliVZEROTriggerSimulator.h" #include "AliVZEROTrigger.h" //______________________________________________________________________ ClassImp(AliVZEROTrigger) -//////////////////////////////////////////////////////////////////////// -// -// Version 1 -// -// AliVZEROTrigger: -// -//////////////////////////////////////////////////////////////////////// //______________________________________________________________________ -AliVZEROTrigger::AliVZEROTrigger() - :AliTriggerDetector(), - fAdcThresHold(0.0), - fTimeWindowWidth(50.0) - + +AliVZEROTrigger::AliVZEROTrigger():AliTriggerDetector() { SetName("VZERO"); CreateInputs(); - - SetAdcThreshold(); - SetTimeWindowWidth(); } - //______________________________________________________________________ void AliVZEROTrigger::CreateInputs() { - // inputs - - // Do not create inputs again!! - if( fInputs.GetEntriesFast() > 0 ) return; - - fInputs.AddLast( new AliTriggerInput( "VZERO_LEFT", "At least one hit in the left VZERO", 0x01 ) ); - fInputs.AddLast( new AliTriggerInput( "VZERO_RIGHT","At least one hit in the right VZERO", 0x02 ) ); - fInputs.AddLast( new AliTriggerInput( "VZERO_AND", "At least one hit in the each (left and right) VZERO", 0x04 ) ); - fInputs.AddLast( new AliTriggerInput( "VZERO_OR", "At least one hit in the one (left one right) VZERO", 0x08 ) ); - - fInputs.AddLast( new AliTriggerInput( "VZERO_BEAMGAS", "Beam gas VZERO trigger ", 0x010 ) ); + // Do not create inputs again!! + if( fInputs.GetEntriesFast() > 0 ) return; + + fInputs.AddLast( new AliTriggerInput( "VZERO_BBA_AND_BBC", "VZERO", 0 ) ); + fInputs.AddLast( new AliTriggerInput( "VZERO_BBA_OR_BBC","VZERO", 0 ) ); + fInputs.AddLast( new AliTriggerInput( "VZERO_BGA_AND_BBC", "VZERO", 0 ) ); + fInputs.AddLast( new AliTriggerInput( "0VGA", "VZERO", 0 ) ); + fInputs.AddLast( new AliTriggerInput( "VZERO_BGC_AND_BBA", "VZERO", 0 ) ); + fInputs.AddLast( new AliTriggerInput( "0VGC", "VZERO", 0 ) ); + fInputs.AddLast( new AliTriggerInput( "VZERO_CTA1_AND_CTC1", "VZERO", 0 ) ); + fInputs.AddLast( new AliTriggerInput( "VZERO_CTA1_OR_CTC1", "VZERO", 0 ) ); + fInputs.AddLast( new AliTriggerInput( "VZERO_CTA2_AND_CTC2", "VZERO", 0 ) ); + fInputs.AddLast( new AliTriggerInput( "VZERO_CTA2_OR_CTC2", "VZERO", 0 ) ); + fInputs.AddLast( new AliTriggerInput( "VZERO_MTA_AND_MTC", "VZERO", 0 ) ); + fInputs.AddLast( new AliTriggerInput( "VZERO_MTA_OR_MTC", "VZERO", 0 ) ); + fInputs.AddLast( new AliTriggerInput( "0VBA", "VZERO", 0 ) ); + fInputs.AddLast( new AliTriggerInput( "0VBC", "VZERO", 0 ) ); + fInputs.AddLast( new AliTriggerInput( "VZERO_BGA_OR_BGC", "VZERO", 0 ) ); + fInputs.AddLast( new AliTriggerInput( "VZERO_BEAMGAS", "VZERO", 0 ) ); + + // The following are kept for compatibility with the CTP configuration file. Will have to be removed at some point + fInputs.AddLast( new AliTriggerInput( "VZERO_AND", "VZERO", 0 ) ); + fInputs.AddLast( new AliTriggerInput( "VZERO_OR","VZERO", 0 ) ); } //______________________________________________________________________ void AliVZEROTrigger::Trigger() { - // ********** Get run loader for the current event ********** - AliRunLoader* runLoader = gAlice->GetRunLoader(); - - AliVZEROLoader* loader = (AliVZEROLoader* )runLoader->GetLoader( "VZEROLoader" ); - - loader->LoadDigits("READ"); - TTree* vzeroDigitsTree = loader->TreeD(); - if (!vzeroDigitsTree) return; - - TClonesArray* vzeroDigits = new TClonesArray("AliVZEROdigit",1000); - TBranch* digitBranch = vzeroDigitsTree->GetBranch("VZERODigit"); - digitBranch->SetAddress(&vzeroDigits); - - // number of hits in left/right - Int_t nLeftDig = 0; - Int_t nRightDig = 0; - - // first time - Float_t firstTimeLeft = 9999.0; - Float_t firstTimeRight = 9999.0; - Float_t TimeHalfWidth = fTimeWindowWidth/2.0; - - // loop over vzero entries - Int_t nEntries = (Int_t)vzeroDigitsTree->GetEntries(); - for (Int_t e=0; eGetEvent(e); - - Int_t nDigits = vzeroDigits->GetEntriesFast(); - - for (Int_t d=0; dGetEvent(d); - AliVZEROdigit* digit = (AliVZEROdigit*)vzeroDigits->At(d); - - Int_t PMNumber = digit->PMNumber(); - Float_t adc = digit->ADC(); - Float_t tdc = digit->Time(); // in 100 of picoseconds - - if (PMNumber<=31 && adc>fAdcThresHold) { - if (tdc>(29.0-TimeHalfWidth) && tdc<(29.0+TimeHalfWidth)) nRightDig++; - if (tdc=32 && adc>fAdcThresHold) { - if (tdc>(112.0-TimeHalfWidth) && tdc<(112.0+TimeHalfWidth)) nLeftDig++; - if (tdc 0) - SetInput( "VZERO_LEFT" ); - - if (nRightDig > 0) - SetInput( "VZERO_RIGHT" ); - - if (nLeftDig>0 || nRightDig>0) { - SetInput( "VZERO_OR" ); - - if (nLeftDig>0 && nRightDig>0) { - SetInput( "VZERO_AND" ); - } - } - - AliDebug(1,Form("VZERO PMs fired: %d (left) %d (right)", nLeftDig, nRightDig)); - + AliRunLoader* runLoader = AliRunLoader::Instance(); + + AliLoader* loader = runLoader->GetLoader( "VZEROLoader" ); + + if(!loader) { + AliError("Can not get VZERO loader"); + return; + } + loader->LoadDigits("update"); + TTree* vzeroDigitsTree = loader->TreeD(); + + if (!vzeroDigitsTree) { + AliError("Can not get the VZERO digit tree"); + return; + } + TClonesArray* vzeroDigits = NULL; + TBranch* digitBranch = vzeroDigitsTree->GetBranch("VZERODigit"); + digitBranch->SetAddress(&vzeroDigits); + + AliVZEROTriggerSimulator * triggerSimulator = new AliVZEROTriggerSimulator(vzeroDigitsTree,vzeroDigits); + + + triggerSimulator->Run(); + + loader->WriteDigits("OVERWRITE"); + loader->UnloadDigits(); + + if(triggerSimulator->GetBBAandBBC()) SetInput( "VZERO_BBA_AND_BBC" ); + if(triggerSimulator->GetBBAorBBC()) SetInput( "VZERO_BBA_OR_BBC" ); + if(triggerSimulator->GetBGAandBBC()) SetInput( "VZERO_BGA_AND_BBC" ); + if(triggerSimulator->GetBGA()) SetInput( "0VGA" ); + if(triggerSimulator->GetBGCandBBA()) SetInput( "VZERO_BGC_AND_BBA" ); + if(triggerSimulator->GetBGC()) SetInput( "0VGC" ); + if(triggerSimulator->GetCTA1andCTC1()) SetInput( "VZERO_CTA1_AND_CTC1" ); + if(triggerSimulator->GetCTA1orCTC1()) SetInput( "VZERO_CTA1_OR_CTC1" ); + if(triggerSimulator->GetCTA2andCTC2()) SetInput( "VZERO_CTA2_AND_CTC2" ); + if(triggerSimulator->GetCTA1orCTC1()) SetInput( "VZERO_CTA1_OR_CTC1" ); + if(triggerSimulator->GetMTAandMTC()) SetInput( "VZERO_MTA_AND_MTC" ); + if(triggerSimulator->GetMTAorMTC()) SetInput( "VZERO_MTA_OR_MTC" ); + if(triggerSimulator->GetBBA()) SetInput( "0VBA" ); + if(triggerSimulator->GetBBC()) SetInput( "0VBC" ); + if(triggerSimulator->GetBGAorBGC()) SetInput( "VZERO_BGA_OR_BGC" ); + if(triggerSimulator->GetBeamGas()) SetInput( "VZERO_BEAMGAS" ); + + // The following are kept for compatibility with the CTP configuration file. Will have to be removed at some point + if(triggerSimulator->GetBBAandBBC()) SetInput( "VZERO_AND" ); + if(triggerSimulator->GetBBAorBBC()) SetInput( "VZERO_OR" ); + return; } +