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 #include <Riostream.h>
18 #include <TGeoManager.h>
19 #include <TGeoMatrix.h>
20 #include <TGeoPhysicalNode.h>
21 #include <AliGeomManager.h>
22 #include "AliCDBManager.h"
23 #include "AliCDBStorage.h"
24 #include "AliCDBEntry.h"
26 #include "AliVZEROTriggerMask.h"
27 #include "AliVZEROdigit.h"
29 //______________________________________________________________________
30 ClassImp(AliVZEROTriggerMask)
32 //______________________________________________________________________
34 AliVZEROTriggerMask::AliVZEROTriggerMask()
37 fTimeWindowWidthBBA(50.0),
38 fTimeWindowWidthBGA(20.0),
39 fTimeWindowWidthBBC(50.0),
40 fTimeWindowWidthBGC(20.0),
50 //________________________________________________________________________________
51 Double_t AliVZEROTriggerMask::GetZPosition(const char* symname){
52 // Get the global z coordinate of the given V0 alignable volume
55 TGeoPNEntry *pne = gGeoManager->GetAlignableEntry(symname);
59 TGeoPhysicalNode *pnode = pne->GetPhysicalNode();
61 TGeoHMatrix* hm = pnode->GetMatrix();
62 tr = hm->GetTranslation();
64 const char* path = pne->GetTitle();
65 if(!gGeoManager->cd(path)){
66 AliErrorClass(Form("Volume path %s not valid!",path));
69 tr = gGeoManager->GetCurrentMatrix()->GetTranslation();
75 //________________________________________________________________________________
78 void AliVZEROTriggerMask::FillMasks(TTree* vzeroDigitsTree,
79 TClonesArray* vzeroDigits)
81 const Double_t LightSpeed = 2.9979245800; // cm/100 ps
82 Float_t Z_V0A = TMath::Abs(GetZPosition("VZERO/V0A"));
83 Float_t Z_V0C = TMath::Abs(GetZPosition("VZERO/V0C"));
85 // distance in time units from nominal vertex to V0
86 Float_t v0a_dist = Z_V0A/LightSpeed; // 100 of picoseconds
87 Float_t v0c_dist = Z_V0C/LightSpeed; // 100 of picoseconds
88 Float_t bunch_separation = 1000.0; // 100 of picoseconds
93 // loop over vzero entries
94 Int_t nEntries = (Int_t)vzeroDigitsTree->GetEntries();
95 for (Int_t e=0; e<nEntries; e++) {
96 vzeroDigitsTree->GetEvent(e);
98 Int_t nDigits = vzeroDigits->GetEntriesFast();
100 for (Int_t d=0; d<nDigits; d++) {
101 // vzeroDigitsTree->GetEvent(d);
102 AliVZEROdigit* digit = (AliVZEROdigit*)vzeroDigits->At(d);
104 Int_t PMNumber = digit->PMNumber();
105 Float_t adc = digit->ADC();
106 Float_t tdc = digit->Time(); // in 100 of picoseconds
108 if (adc>fAdcThresHold) {
109 if (PMNumber<32) { // in V0C
110 if (tdc>(v0c_dist-fTimeWindowWidthBBC/2.0) &&
111 tdc<(v0c_dist+fTimeWindowWidthBBC/2.0))
112 fBBtriggerV0C+=(one<<PMNumber);
113 if (tdc>(bunch_separation-v0c_dist-fTimeWindowWidthBGC/2.0) &&
114 tdc<(bunch_separation-v0c_dist+fTimeWindowWidthBGC/2.0))
115 fBGtriggerV0C+=(one<<PMNumber);
117 if (PMNumber>31) { // in V0A
118 Int_t shift = PMNumber-32;
119 if (tdc>(v0a_dist-fTimeWindowWidthBBA/2.0) &&
120 tdc<(v0a_dist+fTimeWindowWidthBBA/2.0))
121 fBBtriggerV0A+=(one<<shift);
122 if (tdc>(bunch_separation-v0a_dist-fTimeWindowWidthBGA/2.0) &&
123 tdc<(bunch_separation-v0a_dist+fTimeWindowWidthBGA/2.0))
124 fBGtriggerV0A+=(one<<shift);
127 } // end of loop over digits
128 } // end of loop over events in digits tree