1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 //-------------------------------------------
18 // Class : AliVZEROTriggerMask
20 // Fill up the trigger mask word.
23 #include <Riostream.h>
24 #include <TGeoManager.h>
25 #include <TGeoMatrix.h>
26 #include <TGeoPhysicalNode.h>
28 #include <TClonesArray.h>
30 #include <AliGeomManager.h>
31 #include "AliCDBManager.h"
32 #include "AliCDBStorage.h"
33 #include "AliCDBEntry.h"
35 #include "AliVZEROTriggerMask.h"
36 #include "AliVZEROdigit.h"
38 //______________________________________________________________________
39 ClassImp(AliVZEROTriggerMask)
41 //______________________________________________________________________
43 AliVZEROTriggerMask::AliVZEROTriggerMask()
46 fTimeWindowWidthBBA(50.0),
47 fTimeWindowWidthBGA(20.0),
48 fTimeWindowWidthBBC(50.0),
49 fTimeWindowWidthBGC(20.0),
59 //________________________________________________________________________________
60 Double_t AliVZEROTriggerMask::GetZPosition(const char* symname){
61 // Get the global z coordinate of the given V0 alignable volume
64 TGeoPNEntry *pne = gGeoManager->GetAlignableEntry(symname);
68 TGeoPhysicalNode *pnode = pne->GetPhysicalNode();
70 TGeoHMatrix* hm = pnode->GetMatrix();
71 tr = hm->GetTranslation();
73 const char* path = pne->GetTitle();
74 if(!gGeoManager->cd(path)){
75 AliErrorClass(Form("Volume path %s not valid!",path));
78 tr = gGeoManager->GetCurrentMatrix()->GetTranslation();
84 //________________________________________________________________________________
87 void AliVZEROTriggerMask::FillMasks(TTree* vzeroDigitsTree,
88 TClonesArray* const vzeroDigits)
90 // Fill up the trigger mask word using the TDC
92 const Double_t lightSpeed = 2.9979245800; // cm/100 ps
93 Float_t zV0A = TMath::Abs(GetZPosition("VZERO/V0A"));
94 Float_t zV0C = TMath::Abs(GetZPosition("VZERO/V0C"));
96 // distance in time units from nominal vertex to V0
97 Float_t v0aDist = zV0A/lightSpeed; // 100 of picoseconds
98 Float_t v0cDist = zV0C/lightSpeed; // 100 of picoseconds
99 Float_t bunchSeparation = 1000.0; // 100 of picoseconds
104 // loop over vzero entries
105 Int_t nEntries = (Int_t)vzeroDigitsTree->GetEntries();
106 for (Int_t e=0; e<nEntries; e++) {
107 vzeroDigitsTree->GetEvent(e);
109 Int_t nDigits = vzeroDigits->GetEntriesFast();
111 for (Int_t d=0; d<nDigits; d++) {
112 // vzeroDigitsTree->GetEvent(d);
113 AliVZEROdigit* digit = (AliVZEROdigit*)vzeroDigits->At(d);
115 Int_t pmNumber = digit->PMNumber();
116 Float_t adc = digit->ADC();
117 Float_t tdc = digit->Time()*10.0; // in 100 of picoseconds
119 if (adc>fAdcThresHold) {
120 if (pmNumber<32) { // in V0C
121 if (tdc>(v0cDist-fTimeWindowWidthBBC/2.0) &&
122 tdc<(v0cDist+fTimeWindowWidthBBC/2.0))
123 fBBtriggerV0C+=(one<<pmNumber);
124 if (tdc>(bunchSeparation-v0cDist-fTimeWindowWidthBGC/2.0) &&
125 tdc<(bunchSeparation-v0cDist+fTimeWindowWidthBGC/2.0))
126 fBGtriggerV0C+=(one<<pmNumber);
128 if (pmNumber>31) { // in V0A
129 Int_t shift = pmNumber-32;
130 if (tdc>(v0aDist-fTimeWindowWidthBBA/2.0) &&
131 tdc<(v0aDist+fTimeWindowWidthBBA/2.0))
132 fBBtriggerV0A+=(one<<shift);
133 if (tdc>(bunchSeparation-v0aDist-fTimeWindowWidthBGA/2.0) &&
134 tdc<(bunchSeparation-v0aDist+fTimeWindowWidthBGA/2.0))
135 fBGtriggerV0A+=(one<<shift);
138 } // end of loop over digits
139 } // end of loop over events in digits tree